@carbon/ai-chat 0.4.0-rc.2 → 0.4.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/aiChatEntry.js +220 -14
- package/dist/es/chat.AppContainer.js +6491 -0
- package/dist/es/chat.AppState.js +40 -0
- package/dist/es/{chat/shared/components/BasePanelComponent.js → chat.BasePanelComponent.js} +3 -3
- package/dist/es/{chat/shared/components/panels/BodyAndFooterPanelComponent.js → chat.BodyAndFooterPanelComponent.js} +92 -9
- package/dist/es/chat.BodyWithFooterComponent.js +140 -0
- package/dist/es/{chat/shared/components/header/BotHeader.js → chat.BotHeader.js} +7 -9
- package/dist/es/{chat/shared/components/responseTypes/carousel/Carousel.js → chat.Carousel.js} +3 -3
- package/dist/es/chat.CatastrophicError.js +381 -0
- package/dist/es/chat.Chat.js +2009 -0
- package/dist/es/chat.Disclaimer.js +553 -0
- package/dist/es/chat.Header.js +1025 -0
- package/dist/es/{chat/shared/components/util/HideComponent.js → chat.HideComponent.js} +9 -2
- package/dist/es/{types/config/HomeScreenConfig.js → chat.HomeScreenConfig.js} +1 -1
- package/dist/es/{chat/shared/components/homeScreen/HomeScreen.js → chat.HomeScreenContainer.js} +159 -14
- package/dist/es/{chat/shared/components/homeScreen/HomeScreenHeader.js → chat.HomeScreenHeader.js} +3 -3
- package/dist/es/{chat/shared/services/haa/HumanAgentServiceImpl.js → chat.HumanAgentServiceImpl.js} +215 -17
- package/dist/es/{chat/shared/components/responseTypes/iframe/IFrameComponent.js → chat.IFrameComponent.js} +4 -8
- package/dist/es/chat.IFramePanel.js +151 -0
- package/dist/es/{chat/shared/components/input/Input.js → chat.Input.js} +214 -18
- package/dist/es/{types/config/ServiceDeskConfig.js → chat.LocalMessageItem.js} +17 -1
- package/dist/es/chat.MessageTypeComponent.js +3580 -0
- package/dist/es/{types/messaging/Messages.js → chat.Messages.js} +1 -1
- package/dist/es/chat.MountChildrenOnDelay.js +97 -0
- package/dist/es/{chat/shared/components/OverlayPanel.js → chat.PageObjectId.js} +70 -4
- package/dist/es/{chat/web-components/components/markdownText/src/markdownText.scss.js → chat.RichText.js} +347 -1
- package/dist/es/chat.TourContainer.js +524 -0
- package/dist/es/{chat/languages/en.json.js → chat.VideoComponent.js} +561 -1
- package/dist/es/chat.ViewSourcePanel.js +187 -0
- package/dist/es/{chat/shared/store/actions.js → chat.actions.js} +2 -2
- package/dist/es/{chat/shared/utils/browserUtils.js → chat.browserUtils.js} +1 -1
- package/dist/es/{types/utilities/carbonTypes.js → chat.carbonTypes.js} +2 -2
- package/dist/es/{chat/web-components/components/codeElement/src/codeElement.scss.js → chat.cds-aichat-code.js} +64 -1
- package/dist/es/{chat/shared/utils/constants.js → chat.constants.js} +4 -7
- package/dist/es/{types/events/eventBusTypes.js → chat.customElement.js} +32 -1
- package/dist/es/chat.dynamic-imports.js +192 -0
- package/dist/es/{chat/shared/utils/htmlUtils.js → chat.htmlUtils.js} +16 -2
- package/dist/es/{chat/shared/utils/messageUtils.js → chat.messageUtils.js} +54 -7
- package/dist/es/{chat/shared/utils/miscUtils.js → chat.miscUtils.js} +24 -5
- package/dist/es/chat.resolvablePromise.js +315 -0
- package/dist/es/{chat/shared/store/selectors.js → chat.selectors.js} +1 -1
- package/dist/es/{chat/shared/utils/lang/stringUtils.js → chat.stringUtils.js} +2 -2
- package/dist/es/{chat/shared/hooks/useCounter.js → chat.useCounter.js} +1 -1
- package/dist/es/{chat/shared/hooks/useOnMount.js → chat.useOnMount.js} +1 -1
- package/dist/es/{chat/shared/utils/domUtils.js → chat.usePrevious.js} +47 -1
- package/dist/es/{chat/shared/utils/lang/UUIDType.js → chat.uuid.js} +15 -3
- package/dist/es/web-components/cds-aichat-container/index.js +73 -4
- package/dist/es/web-components/cds-aichat-custom-element/index.js +1 -3
- package/package.json +2 -2
- package/dist/es/chat/dynamic-imports/dynamic-imports.js +0 -96
- package/dist/es/chat/react/components/AppContainer.js +0 -197
- package/dist/es/chat/react/components/UserDefinedResponsePortalsContainer.js +0 -31
- package/dist/es/chat/react/components/WriteableElementsPortalsContainer.js +0 -28
- package/dist/es/chat/react/components/chainOfThought/ChainOfThought.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderAvatar.js +0 -20
- package/dist/es/chat/react/components/chatHeader/ChatHeaderLink.js +0 -22
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenu.js +0 -27
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuButton.js +0 -60
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItem.js +0 -24
- package/dist/es/chat/react/components/chatHeader/ChatHeaderMenuItemRadioGroup.js +0 -28
- package/dist/es/chat/react/components/chatHeader/ChatHeaderOverflowMenu.js +0 -69
- package/dist/es/chat/react/components/chatHeader/ChatHeaderTitle.js +0 -22
- package/dist/es/chat/react/components/feedback/FeedbackButtonsComponent.js +0 -20
- package/dist/es/chat/react/components/feedback/FeedbackComponent.js +0 -20
- package/dist/es/chat/react/components/inlineLoading/InlineLoadingComponent.js +0 -20
- package/dist/es/chat/react/components/markdownText/MarkdownText.js +0 -20
- package/dist/es/chat/react/components/stopStreamingButton/StopStreamingButton.js +0 -20
- package/dist/es/chat/react/components/table/Table.js +0 -20
- package/dist/es/chat/shared/Chat.js +0 -115
- package/dist/es/chat/shared/ChatInstanceImpl.js +0 -360
- package/dist/es/chat/shared/chatEntryFunctions.js +0 -46
- package/dist/es/chat/shared/components/Avatar.js +0 -286
- package/dist/es/chat/shared/components/BodyWithFooterComponent.js +0 -56
- package/dist/es/chat/shared/components/CatastrophicError.js +0 -77
- package/dist/es/chat/shared/components/Chat.js +0 -244
- package/dist/es/chat/shared/components/ChatBubbleDark.js +0 -124
- package/dist/es/chat/shared/components/ChatBubbleLight.js +0 -216
- package/dist/es/chat/shared/components/Disclaimer.js +0 -86
- package/dist/es/chat/shared/components/ErrorIcon.js +0 -20
- package/dist/es/chat/shared/components/ErrorMessageDark.js +0 -89
- package/dist/es/chat/shared/components/ErrorMessageLight.js +0 -135
- package/dist/es/chat/shared/components/HydrationPanel.js +0 -58
- package/dist/es/chat/shared/components/LatestWelcomeNodes.js +0 -26
- package/dist/es/chat/shared/components/ResponseStopped.js +0 -19
- package/dist/es/chat/shared/components/SkeletonPicker.js +0 -32
- package/dist/es/chat/shared/components/WriteableElement.js +0 -22
- package/dist/es/chat/shared/components/agent/AgentAvatar.js +0 -54
- package/dist/es/chat/shared/components/agent/AgentBanner.js +0 -109
- package/dist/es/chat/shared/components/agent/AgentBannerContainer.js +0 -28
- package/dist/es/chat/shared/components/agent/AvailabilityMessage.js +0 -49
- package/dist/es/chat/shared/components/aria/AriaAnnouncerComponent.js +0 -122
- package/dist/es/chat/shared/components/aria/AriaAnnouncerProvider.js +0 -48
- package/dist/es/chat/shared/components/aria/AriaLiveMessage.js +0 -22
- package/dist/es/chat/shared/components/header/AISlug.js +0 -22
- package/dist/es/chat/shared/components/header/Header.js +0 -460
- package/dist/es/chat/shared/components/header/SimpleHeader.js +0 -27
- package/dist/es/chat/shared/components/homeScreen/HomeScreenContainer.js +0 -68
- package/dist/es/chat/shared/components/launcher/Launcher.js +0 -88
- package/dist/es/chat/shared/components/launcher/LauncherComplex.js +0 -63
- package/dist/es/chat/shared/components/launcher/LauncherContainer.js +0 -73
- package/dist/es/chat/shared/components/launcher/LauncherDesktopContainer.js +0 -221
- package/dist/es/chat/shared/components/launcher/LauncherExtended.js +0 -244
- package/dist/es/chat/shared/components/launcher/LauncherMobileContainer.js +0 -175
- package/dist/es/chat/shared/components/launcher/launcherUtils.js +0 -16
- package/dist/es/chat/shared/components/modals/ConfirmModal.js +0 -67
- package/dist/es/chat/shared/components/modals/EndAgentChatModal.js +0 -46
- package/dist/es/chat/shared/components/modals/RequestScreenShareModal.js +0 -43
- package/dist/es/chat/shared/components/notifications/Notifications.js +0 -58
- package/dist/es/chat/shared/components/panels/CustomPanel.js +0 -136
- package/dist/es/chat/shared/components/responseTypes/agent/ConnectToAgent.js +0 -30
- package/dist/es/chat/shared/components/responseTypes/agent/RealConnectToAgent.js +0 -102
- package/dist/es/chat/shared/components/responseTypes/audio/AudioComponent.js +0 -26
- package/dist/es/chat/shared/components/responseTypes/buttonItem/BaseButtonItemComponent.js +0 -69
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemComponent.js +0 -48
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemCustomEventComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemPostBackComponent.js +0 -54
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemShowPanelComponent.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/buttonItem/ButtonItemURLComponent.js +0 -42
- package/dist/es/chat/shared/components/responseTypes/card/CardItemComponent.js +0 -34
- package/dist/es/chat/shared/components/responseTypes/carousel/CarouselItemComponent.js +0 -39
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearch.js +0 -92
- package/dist/es/chat/shared/components/responseTypes/conversationalSearch/ConversationalSearchText.js +0 -158
- package/dist/es/chat/shared/components/responseTypes/custom/UserDefinedResponse.js +0 -33
- package/dist/es/chat/shared/components/responseTypes/datePicker/DatePickerComponent.js +0 -176
- package/dist/es/chat/shared/components/responseTypes/error/InlineError.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/grid/GridItemComponent.js +0 -109
- package/dist/es/chat/shared/components/responseTypes/iframe/IFrameMessage.js +0 -32
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePanel.js +0 -51
- package/dist/es/chat/shared/components/responseTypes/iframe/IFramePreviewCard.js +0 -64
- package/dist/es/chat/shared/components/responseTypes/iframe/InlineIFrame.js +0 -55
- package/dist/es/chat/shared/components/responseTypes/image/Image.js +0 -120
- package/dist/es/chat/shared/components/responseTypes/options/OptionComponent.js +0 -83
- package/dist/es/chat/shared/components/responseTypes/options/SelectComponent.js +0 -84
- package/dist/es/chat/shared/components/responseTypes/table/TableContainer.js +0 -96
- package/dist/es/chat/shared/components/responseTypes/text/TextArea.js +0 -68
- package/dist/es/chat/shared/components/responseTypes/tour/TourCard.js +0 -73
- package/dist/es/chat/shared/components/responseTypes/util/BodyMessageComponents.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/ClickableImage.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/Description.js +0 -21
- package/dist/es/chat/shared/components/responseTypes/util/FooterButtonComponents.js +0 -36
- package/dist/es/chat/shared/components/responseTypes/util/MediaPlayer.js +0 -157
- package/dist/es/chat/shared/components/responseTypes/util/Metablock.js +0 -27
- package/dist/es/chat/shared/components/responseTypes/util/RichText.js +0 -31
- package/dist/es/chat/shared/components/responseTypes/util/SearchResultBody.js +0 -53
- package/dist/es/chat/shared/components/responseTypes/util/StreamingRichText.js +0 -38
- package/dist/es/chat/shared/components/responseTypes/util/TextHolderTile.js +0 -35
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCard.js +0 -65
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationCardContent.js +0 -62
- package/dist/es/chat/shared/components/responseTypes/util/citations/CitationClickableCard.js +0 -23
- package/dist/es/chat/shared/components/responseTypes/util/citations/ExpandToPanelCard.js +0 -50
- package/dist/es/chat/shared/components/responseTypes/util/citations/ViewSourcePanel.js +0 -57
- package/dist/es/chat/shared/components/responseTypes/video/VideoComponent.js +0 -23
- package/dist/es/chat/shared/components/tour/TourCloseMinimizeComponent.js +0 -44
- package/dist/es/chat/shared/components/tour/TourContainer.js +0 -212
- package/dist/es/chat/shared/components/tour/TourControlsComponent.js +0 -98
- package/dist/es/chat/shared/components/tour/TourStepContentComponent.js +0 -156
- package/dist/es/chat/shared/components/tour/TourStepSkeletonComponent.js +0 -20
- package/dist/es/chat/shared/components/util/AnnounceOnMountComponent.js +0 -42
- package/dist/es/chat/shared/components/util/IconHolder.js +0 -16
- package/dist/es/chat/shared/components/util/ImageWithFallback.js +0 -31
- package/dist/es/chat/shared/components/util/MaybeDangerouslySetInnerHTML.js +0 -42
- package/dist/es/chat/shared/components/util/MountChildrenOnDelay.js +0 -40
- package/dist/es/chat/shared/components/util/VisuallyHidden.js +0 -18
- package/dist/es/chat/shared/containers/App.js +0 -181
- package/dist/es/chat/shared/containers/MessageComponent.js +0 -465
- package/dist/es/chat/shared/containers/MessageTypeComponent.js +0 -496
- package/dist/es/chat/shared/containers/MessagesComponent.js +0 -469
- package/dist/es/chat/shared/containers/ModalPortal.js +0 -53
- package/dist/es/chat/shared/containers/main/MainWindow.js +0 -708
- package/dist/es/chat/shared/contexts/AriaAnnouncerContext.js +0 -12
- package/dist/es/chat/shared/contexts/HideComponentContext.js +0 -12
- package/dist/es/chat/shared/contexts/LanguagePackContext.js +0 -12
- package/dist/es/chat/shared/contexts/ModalPortalRootContext.js +0 -12
- package/dist/es/chat/shared/contexts/ServiceManagerContext.js +0 -12
- package/dist/es/chat/shared/contexts/WindowSizeContext.js +0 -12
- package/dist/es/chat/shared/environmentVariables.js +0 -13
- package/dist/es/chat/shared/events/ChatActionsImpl.js +0 -783
- package/dist/es/chat/shared/events/EventBus.js +0 -161
- package/dist/es/chat/shared/hocs/withAriaAnnouncer.js +0 -25
- package/dist/es/chat/shared/hocs/withServiceManager.js +0 -25
- package/dist/es/chat/shared/hooks/useAriaAnnouncer.js +0 -16
- package/dist/es/chat/shared/hooks/useCSSCustomProperties.js +0 -21
- package/dist/es/chat/shared/hooks/useCallbackOnChange.js +0 -24
- package/dist/es/chat/shared/hooks/useEffectDidUpdate.js +0 -21
- package/dist/es/chat/shared/hooks/useLanguagePack.js +0 -16
- package/dist/es/chat/shared/hooks/usePrevious.js +0 -18
- package/dist/es/chat/shared/hooks/useServiceManager.js +0 -16
- package/dist/es/chat/shared/hooks/useShouldSanitizeHTML.js +0 -15
- package/dist/es/chat/shared/hooks/useUUID.js +0 -22
- package/dist/es/chat/shared/hooks/useWindowSize.js +0 -16
- package/dist/es/chat/shared/loadServices.js +0 -72
- package/dist/es/chat/shared/schema/historyToMessages.js +0 -231
- package/dist/es/chat/shared/schema/inputItemToLocalItem.js +0 -30
- package/dist/es/chat/shared/schema/outputItemToLocalItem.js +0 -124
- package/dist/es/chat/shared/services/CustomPanelInstance.js +0 -26
- package/dist/es/chat/shared/services/CustomPanelManager.js +0 -23
- package/dist/es/chat/shared/services/HistoryService.js +0 -59
- package/dist/es/chat/shared/services/MessageService.js +0 -351
- package/dist/es/chat/shared/services/NamespaceService.js +0 -26
- package/dist/es/chat/shared/services/ServiceManager.js +0 -19
- package/dist/es/chat/shared/services/UserSessionStorageService.js +0 -89
- package/dist/es/chat/shared/services/haa/agentStatusMessage.js +0 -108
- package/dist/es/chat/shared/services/haa/humanAgentUtils.js +0 -114
- package/dist/es/chat/shared/services/mockStorage.js +0 -30
- package/dist/es/chat/shared/store/agentActions.js +0 -125
- package/dist/es/chat/shared/store/agentReducers.js +0 -215
- package/dist/es/chat/shared/store/doCreateStore.js +0 -142
- package/dist/es/chat/shared/store/reducerUtils.js +0 -320
- package/dist/es/chat/shared/store/reducers.js +0 -871
- package/dist/es/chat/shared/store/subscriptions.js +0 -55
- package/dist/es/chat/shared/store/tourReducerUtils.js +0 -51
- package/dist/es/chat/shared/utils/ListenerList.js +0 -26
- package/dist/es/chat/shared/utils/PageObjectId.js +0 -25
- package/dist/es/chat/shared/utils/animationUtils.js +0 -77
- package/dist/es/chat/shared/utils/colors.js +0 -71
- package/dist/es/chat/shared/utils/customizers.js +0 -16
- package/dist/es/chat/shared/utils/dateUtils.js +0 -38
- package/dist/es/chat/shared/utils/homeScreenUtils.js +0 -27
- package/dist/es/chat/shared/utils/intlUtils.js +0 -21
- package/dist/es/chat/shared/utils/lang/arrayUtils.js +0 -53
- package/dist/es/chat/shared/utils/lang/langUtils.js +0 -13
- package/dist/es/chat/shared/utils/lang/objectUtils.js +0 -19
- package/dist/es/chat/shared/utils/lang/promiseUtils.js +0 -25
- package/dist/es/chat/shared/utils/lang/uuid.js +0 -16
- package/dist/es/chat/shared/utils/languages.js +0 -156
- package/dist/es/chat/shared/utils/memoizerUtils.js +0 -38
- package/dist/es/chat/shared/utils/messageServiceUtils.js +0 -36
- package/dist/es/chat/shared/utils/resolvablePromise.js +0 -32
- package/dist/es/chat/shared/utils/styleUtils.js +0 -231
- package/dist/es/chat/shared/utils/timeUtils.js +0 -14
- package/dist/es/chat/shared/utils/viewStateUtils.js +0 -38
- package/dist/es/chat/web-components/components/chainOfThought/cds-aichat-chain-of-thought.js +0 -26
- package/dist/es/chat/web-components/components/chainOfThought/src/ChainOfThoughtElement.js +0 -130
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chainOfThought/src/chainOfThoughtElement.template.js +0 -186
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/cds-aichat-chat-header-avatar.js +0 -26
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatar.template.js +0 -32
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.js +0 -52
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderAvatar/src/chatHeaderAvatarElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/cds-aichat-chat-header-link.js +0 -44
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderLink/src/chatHeaderLinkElement.template.js +0 -28
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/cds-aichat-chat-header-title.js +0 -42
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.scss.js +0 -3
- package/dist/es/chat/web-components/components/chatHeader/chatHeaderTitle/src/chatHeaderTitle.template.js +0 -20
- package/dist/es/chat/web-components/components/codeElement/cds-aichat-code.js +0 -66
- package/dist/es/chat/web-components/components/feedbackButtonsElement/cds-aichat-feedback-buttons.js +0 -26
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/FeedbackButtonsElement.js +0 -93
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackButtonsElement/src/feedbackButtonsElement.template.js +0 -84
- package/dist/es/chat/web-components/components/feedbackElement/cds-aichat-feedback.js +0 -30
- package/dist/es/chat/web-components/components/feedbackElement/src/FeedbackElement.js +0 -157
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/feedbackElement/src/feedbackElement.template.js +0 -95
- package/dist/es/chat/web-components/components/inlineLoadingElement/cds-aichat-inline-loading.js +0 -85
- package/dist/es/chat/web-components/components/inlineLoadingElement/src/styles.scss.js +0 -3
- package/dist/es/chat/web-components/components/markdownText/cds-aichat-markdown-text.js +0 -32
- package/dist/es/chat/web-components/components/markdownText/markdown/markdownToHTML.js +0 -28
- package/dist/es/chat/web-components/components/markdownText/markdown/utils/renderTokenTree.js +0 -191
- package/dist/es/chat/web-components/components/markdownText/markdown/workers/workerManager.js +0 -16
- package/dist/es/chat/web-components/components/markdownText/src/MarkdownElement.js +0 -70
- package/dist/es/chat/web-components/components/markdownText/src/markdownElement.template.js +0 -19
- package/dist/es/chat/web-components/components/roundedButton/cds-aichat-rounded-button.js +0 -29
- package/dist/es/chat/web-components/components/stopStreamingButton/cds-aichat-stop-streaming-button.js +0 -26
- package/dist/es/chat/web-components/components/stopStreamingButton/src/StopStreamingButtonElement.js +0 -49
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.scss.js +0 -3
- package/dist/es/chat/web-components/components/stopStreamingButton/src/stopStreamingButton.template.js +0 -44
- package/dist/es/chat/web-components/components/table/cds-aichat-table.js +0 -229
- package/dist/es/chat/web-components/components/table/src/table.scss.js +0 -3
- package/dist/es/chat/web-components/components/table/src/table.template.js +0 -81
- package/dist/es/chat/web-components/components/table/src/tablePagination.template.js +0 -43
- package/dist/es/chat/web-components/components/table/src/tableSkeleton.template.js +0 -17
- package/dist/es/chat/web-components/components/tagListElement/cds-aichat-tag-list.js +0 -28
- package/dist/es/chat/web-components/components/tagListElement/src/TagListElement.js +0 -70
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.scss.js +0 -3
- package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.template.js +0 -40
- package/dist/es/chat/web-components/decorators/customElement.js +0 -33
- package/dist/es/chat/web-components/internal/cds-aichat-internal.js +0 -78
- package/dist/es/chat/web-components/settings.js +0 -13
- package/dist/es/node_modules/@carbon/colors/es/index.js +0 -11
- package/dist/es/react/ChatContainer.js +0 -162
- package/dist/es/react/ChatCustomElement.js +0 -58
- package/dist/es/types/config/ChatHeaderConfig.js +0 -18
- package/dist/es/types/config/CornersType.js +0 -16
- package/dist/es/types/config/LauncherConfig.js +0 -19
- package/dist/es/types/config/PublicConfig.js +0 -36
- package/dist/es/types/instance/ChatInstance.js +0 -31
- package/dist/es/types/instance/apiTypes.js +0 -33
- package/dist/es/types/messaging/LocalMessageItem.js +0 -18
- package/dist/es/types/state/AppState.js +0 -18
- package/dist/es/types/utilities/Animation.js +0 -31
- package/dist/es/types/utilities/HasAddRemoveClassName.js +0 -27
- /package/dist/es/{chat/shared/styles/export.carbon.scss.js → chat.export.carbon.js} +0 -0
- /package/dist/es/{chat/shared/styles/export.scss.js → chat.export.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/markdown.js → chat.markdown.js} +0 -0
- /package/dist/es/{chat/web-components/components/markdownText/markdown/utils/tokenTree.js → chat.tokenTree.js} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/data-table/index.js";
|
|
2
|
-
|
|
3
|
-
import "@carbon/web-components/es-custom/components/checkbox/index.js";
|
|
4
|
-
|
|
5
|
-
import "@carbon/web-components/es-custom/components/button/index.js";
|
|
6
|
-
|
|
7
|
-
import { toString } from "@carbon/icon-helpers";
|
|
8
|
-
|
|
9
|
-
import Download16 from "@carbon/icons/es/download/16.js";
|
|
10
|
-
|
|
11
|
-
import { html } from "lit";
|
|
12
|
-
|
|
13
|
-
import { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
14
|
-
|
|
15
|
-
import { repeat } from "lit-html/directives/repeat.js";
|
|
16
|
-
|
|
17
|
-
/*
|
|
18
|
-
* Copyright IBM Corp. 2025
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*
|
|
23
|
-
* @license
|
|
24
|
-
*/ const Download16svg = toString({
|
|
25
|
-
...Download16,
|
|
26
|
-
attrs: {
|
|
27
|
-
...Download16.attrs,
|
|
28
|
-
slot: "icon"
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
function tableTemplate(tableElement) {
|
|
33
|
-
const {tableTitle: tableTitle, tableDescription: tableDescription, headers: headers, containerWidth: containerWidth, filterPlaceholderText: filterPlaceholderText, locale: locale, _handleDownload: handleDownload, _rowsWithIDs: tableRowsWithIDs, _allowFiltering: allowTableFiltering, _handleFilterEvent: handleFilterEvent} = tableElement;
|
|
34
|
-
function toolbarElement() {
|
|
35
|
-
return html`<cds-custom-table-toolbar slot="toolbar">
|
|
36
|
-
<cds-custom-table-toolbar-content>
|
|
37
|
-
${allowTableFiltering ? html`<cds-custom-table-toolbar-search
|
|
38
|
-
persistent
|
|
39
|
-
placeholder=${filterPlaceholderText}
|
|
40
|
-
></cds-custom-table-toolbar-search>` : ""}
|
|
41
|
-
<cds-custom-button @click=${handleDownload}
|
|
42
|
-
>${unsafeSVG(Download16svg)}</cds-custom-button
|
|
43
|
-
>
|
|
44
|
-
</cds-custom-table-toolbar-content>
|
|
45
|
-
</cds-custom-table-toolbar>`;
|
|
46
|
-
}
|
|
47
|
-
function headersElement() {
|
|
48
|
-
return html`<cds-custom-table-head>
|
|
49
|
-
<cds-custom-table-header-row>
|
|
50
|
-
${headers.map(header => html`<cds-custom-table-header-cell
|
|
51
|
-
>${header}</cds-custom-table-header-cell
|
|
52
|
-
>`)}
|
|
53
|
-
</cds-custom-table-header-row>
|
|
54
|
-
</cds-custom-table-head>`;
|
|
55
|
-
}
|
|
56
|
-
function rowsElement() {
|
|
57
|
-
return html`<cds-custom-table-body>
|
|
58
|
-
${repeat(tableRowsWithIDs, row => row.id, row => html`<cds-custom-table-row id=${row.id}
|
|
59
|
-
>${row.cells.map(cell => html`<cds-custom-table-cell>${cell}</cds-custom-table-cell>`)}</cds-custom-table-row
|
|
60
|
-
>`)}
|
|
61
|
-
</cds-custom-table-body>`;
|
|
62
|
-
}
|
|
63
|
-
return html`<cds-custom-table
|
|
64
|
-
style="--cds-chat-table-width:${containerWidth}px"
|
|
65
|
-
size="md"
|
|
66
|
-
locale=${locale}
|
|
67
|
-
.isSortable=${allowTableFiltering}
|
|
68
|
-
.useZebraStyles=${true}
|
|
69
|
-
@cds-custom-table-filtered=${handleFilterEvent}
|
|
70
|
-
>
|
|
71
|
-
${tableTitle && html`<cds-custom-table-header-title slot="title"
|
|
72
|
-
>${tableTitle}</cds-custom-table-header-title
|
|
73
|
-
>`}
|
|
74
|
-
${tableDescription && html`<cds-custom-table-header-description slot="description"
|
|
75
|
-
>${tableDescription}</cds-custom-table-header-description
|
|
76
|
-
>`}
|
|
77
|
-
${toolbarElement()} ${headersElement()} ${rowsElement()}
|
|
78
|
-
</cds-custom-table>`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { tableTemplate };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/pagination/index.js";
|
|
2
|
-
|
|
3
|
-
import "@carbon/web-components/es-custom/components/select/index.js";
|
|
4
|
-
|
|
5
|
-
import { html } from "lit";
|
|
6
|
-
|
|
7
|
-
import { POSSIBLE_PAGE_SIZES } from "../cds-aichat-table.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 tablePaginationTemplate(tableElement) {
|
|
17
|
-
const {_currentPageSize: currentPageSize, _currentPageNumber: currentPageNumber, _filterVisibleRowIDs: filterVisibleRowIDs, rows: rows, previousPageText: previousPageText, nextPageText: nextPageText, itemsPerPageText: itemsPerPageText, getPaginationSupplementalText: getPaginationSupplementalText, getPaginationStatusText: getPaginationStatusText, _handlePageChangeEvent: handlePageChangeEvent, _handlePageSizeChangeEvent: handlePageSizeChangeEvent} = tableElement;
|
|
18
|
-
const totalVisibleRows = filterVisibleRowIDs.size;
|
|
19
|
-
const totalRows = rows.length;
|
|
20
|
-
const supportedPageSizes = POSSIBLE_PAGE_SIZES.filter(pageSize => pageSize < totalRows);
|
|
21
|
-
return html`<cds-custom-pagination
|
|
22
|
-
page-size=${currentPageSize}
|
|
23
|
-
page=${currentPageNumber}
|
|
24
|
-
total-items=${totalVisibleRows}
|
|
25
|
-
totalPages=${Math.ceil(totalVisibleRows / currentPageSize)}
|
|
26
|
-
backward-text=${previousPageText}
|
|
27
|
-
forward-text=${nextPageText}
|
|
28
|
-
items-per-page-text=${itemsPerPageText}
|
|
29
|
-
.formatSupplementalText=${getPaginationSupplementalText}
|
|
30
|
-
.formatStatusWithDeterminateTotal=${getPaginationStatusText}
|
|
31
|
-
@cds-custom-pagination-changed-current=${handlePageChangeEvent}
|
|
32
|
-
@cds-custom-page-sizes-select-changed=${handlePageSizeChangeEvent}
|
|
33
|
-
>
|
|
34
|
-
${supportedPageSizes.map(pageSize => html`<cds-custom-select-item value="${pageSize}"
|
|
35
|
-
>${pageSize}</cds-custom-select-item
|
|
36
|
-
>`)}
|
|
37
|
-
<cds-custom-select-item value="${totalRows}"
|
|
38
|
-
>${totalRows}</cds-custom-select-item
|
|
39
|
-
>
|
|
40
|
-
</cds-custom-pagination>`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { tablePaginationTemplate };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/data-table/table-skeleton.js";
|
|
2
|
-
|
|
3
|
-
import { html } from "lit";
|
|
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
|
-
*/ function tableSkeletonTemplate() {
|
|
13
|
-
return html`<cds-custom-table-skeleton row-count="3" column-count="2">
|
|
14
|
-
</cds-custom-table-skeleton>`;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { tableSkeletonTemplate };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { carbonElement } from "../../decorators/customElement.js";
|
|
4
|
-
|
|
5
|
-
import { WEB_COMPONENT_PREFIX } from "../../settings.js";
|
|
6
|
-
|
|
7
|
-
import TagListElement from "./src/TagListElement.js";
|
|
8
|
-
|
|
9
|
-
import { tagListElementTemplate } from "./src/tagListElement.template.js";
|
|
10
|
-
|
|
11
|
-
/*
|
|
12
|
-
* Copyright IBM Corp. 2025
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
15
|
-
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*
|
|
17
|
-
* @license
|
|
18
|
-
*/ const TAG_LIST_TAG_NAME = `${WEB_COMPONENT_PREFIX}-tag-list`;
|
|
19
|
-
|
|
20
|
-
let CDSTagListElement = class CDSTagListElement extends TagListElement {
|
|
21
|
-
render() {
|
|
22
|
-
return tagListElementTemplate(this);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
CDSTagListElement = __decorate([ carbonElement(TAG_LIST_TAG_NAME) ], CDSTagListElement);
|
|
27
|
-
|
|
28
|
-
export { CDSTagListElement, TAG_LIST_TAG_NAME };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { unsafeCSS, css, LitElement } from "lit";
|
|
4
|
-
|
|
5
|
-
import { property, state } from "lit/decorators.js";
|
|
6
|
-
|
|
7
|
-
import css_248z from "./tagListElement.scss.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
|
-
*/ class TagListElement extends LitElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.selectedTags = new Set;
|
|
20
|
-
}
|
|
21
|
-
updated(changedProperties) {
|
|
22
|
-
if (changedProperties.has("initialSelectedTags")) {
|
|
23
|
-
this._setInitialValues(this.initialSelectedTags);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
_setInitialValues(values) {
|
|
27
|
-
if (values) {
|
|
28
|
-
this.selectedTags = new Set(this.initialSelectedTags);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
_handleTagClick(event) {
|
|
32
|
-
const tagValue = event.target.getAttribute("data-content");
|
|
33
|
-
const isSelected = this.selectedTags.has(tagValue);
|
|
34
|
-
if (isSelected) {
|
|
35
|
-
this.selectedTags.delete(tagValue);
|
|
36
|
-
} else {
|
|
37
|
-
this.selectedTags.add(tagValue);
|
|
38
|
-
}
|
|
39
|
-
this.onTagsChanged?.(Array.from(this.selectedTags));
|
|
40
|
-
this.requestUpdate();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
TagListElement.styles = css`
|
|
45
|
-
${unsafeCSS(css_248z)}
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
__decorate([ property({
|
|
49
|
-
type: Array,
|
|
50
|
-
attribute: "tags"
|
|
51
|
-
}) ], TagListElement.prototype, "tags", void 0);
|
|
52
|
-
|
|
53
|
-
__decorate([ property({
|
|
54
|
-
type: Array,
|
|
55
|
-
attribute: "initial-selected-tags"
|
|
56
|
-
}) ], TagListElement.prototype, "initialSelectedTags", void 0);
|
|
57
|
-
|
|
58
|
-
__decorate([ property({
|
|
59
|
-
type: Boolean,
|
|
60
|
-
attribute: "multi-select"
|
|
61
|
-
}) ], TagListElement.prototype, "multiSelect", void 0);
|
|
62
|
-
|
|
63
|
-
__decorate([ property({
|
|
64
|
-
type: Object,
|
|
65
|
-
attribute: "on-tags-changed"
|
|
66
|
-
}) ], TagListElement.prototype, "onTagsChanged", void 0);
|
|
67
|
-
|
|
68
|
-
__decorate([ state() ], TagListElement.prototype, "selectedTags", void 0);
|
|
69
|
-
|
|
70
|
-
export { TagListElement as default };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var css_248z = ".cds--aichat-tag-list-container{\n display:flex;\n flex-wrap:wrap;\n align-items:center;\n padding:0;\n margin:0;\n gap:0.5rem;\n list-style:none;\n}\n\n.cds--aichat-tag-list-item{\n box-sizing:border-box;\n padding:0.125rem;\n animation:fade-in 600ms forwards;\n font-size:var(--cds-chat-BASE-font-size-small);\n opacity:0;\n}\n\n@keyframes fade-in{\n from{\n opacity:0;\n }\n to{\n opacity:1;\n }\n}";
|
|
2
|
-
|
|
3
|
-
export { css_248z as default };
|
package/dist/es/chat/web-components/components/tagListElement/src/tagListElement.template.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/tag/index.js";
|
|
2
|
-
|
|
3
|
-
import "@carbon/web-components/es-custom/components/chat-button/index.js";
|
|
4
|
-
|
|
5
|
-
import { html } from "lit";
|
|
6
|
-
|
|
7
|
-
import { CSS_CLASS_PREFIX } from "../../../settings.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 tagListElementTemplate(customElementClass) {
|
|
17
|
-
const {selectedTags: selectedTags, tags: tags, _handleTagClick: handleTagClick} = customElementClass;
|
|
18
|
-
return html`<div class="${CSS_CLASS_PREFIX}-tag-list">
|
|
19
|
-
${html`<ul class="${CSS_CLASS_PREFIX}-tag-list-container">
|
|
20
|
-
${tags.map(value => html`<li class="${CSS_CLASS_PREFIX}-tag-list-item}">
|
|
21
|
-
<cds-custom-chat-button
|
|
22
|
-
class="${CSS_CLASS_PREFIX}-tag-list-button"
|
|
23
|
-
kind="primary"
|
|
24
|
-
size="sm"
|
|
25
|
-
type="button"
|
|
26
|
-
is-quick-action
|
|
27
|
-
role="option"
|
|
28
|
-
aria-pressed="${selectedTags.has(value)}"
|
|
29
|
-
?is-selected="${selectedTags.has(value)}"
|
|
30
|
-
data-content="${value}"
|
|
31
|
-
@click="${handleTagClick}"
|
|
32
|
-
>
|
|
33
|
-
${value}
|
|
34
|
-
</cds-custom-chat-button>
|
|
35
|
-
</li>`)}
|
|
36
|
-
</div>`}
|
|
37
|
-
</div>`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { tagListElementTemplate };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
const legacyCustomElement = (tagName, clazz) => {
|
|
10
|
-
try {
|
|
11
|
-
customElements.define(tagName, clazz);
|
|
12
|
-
} catch (error) {}
|
|
13
|
-
return clazz;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const standardCustomElement = (tagName, descriptor) => {
|
|
17
|
-
const {kind: kind, elements: elements} = descriptor;
|
|
18
|
-
return {
|
|
19
|
-
kind: kind,
|
|
20
|
-
elements: elements,
|
|
21
|
-
finisher(clazz) {
|
|
22
|
-
try {
|
|
23
|
-
customElements.define(tagName, clazz);
|
|
24
|
-
} catch (error) {}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function carbonElement(tagName) {
|
|
30
|
-
return classOrDescriptor => typeof classOrDescriptor === "function" ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { carbonElement };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { LitElement } from "lit";
|
|
4
|
-
|
|
5
|
-
import { property } from "lit/decorators.js";
|
|
6
|
-
|
|
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 { consoleWarn } from "../../shared/utils/miscUtils.js";
|
|
14
|
-
|
|
15
|
-
import { carbonElement } from "../decorators/customElement.js";
|
|
16
|
-
|
|
17
|
-
import { DYNAMIC_IMPORTS } from "../../dynamic-imports/dynamic-imports.js";
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright IBM Corp. 2025
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*
|
|
25
|
-
* @license
|
|
26
|
-
*/ let ChatContainerInternal = class ChatContainerInternal extends LitElement {
|
|
27
|
-
firstUpdated() {
|
|
28
|
-
const style = document.createElement("style");
|
|
29
|
-
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 `;
|
|
30
|
-
this.appendChild(style);
|
|
31
|
-
if (this.config) {
|
|
32
|
-
this.renderReactApp();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
updated(changedProperties) {
|
|
36
|
-
if (changedProperties.has("config") && !isEqual(this.config, changedProperties.get("config"))) {
|
|
37
|
-
if (changedProperties.get("config")) {
|
|
38
|
-
consoleWarn("The config object you have passed to AI chat has updated. Tearing down and re-starting the chat.");
|
|
39
|
-
}
|
|
40
|
-
if (this.config) {
|
|
41
|
-
this.renderReactApp();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async renderReactApp() {
|
|
46
|
-
const {AppContainer: AppContainer} = await DYNAMIC_IMPORTS.AppContainer();
|
|
47
|
-
const previousContainer = this.shadowRoot.querySelector(".cds--aichat-react-app");
|
|
48
|
-
previousContainer?.remove();
|
|
49
|
-
const container = document.createElement("div");
|
|
50
|
-
container.classList.add("cds--aichat-react-app");
|
|
51
|
-
this.shadowRoot.appendChild(container);
|
|
52
|
-
if (this.root) {
|
|
53
|
-
this.root.unmount();
|
|
54
|
-
}
|
|
55
|
-
this.root = createRoot(container);
|
|
56
|
-
this.root.render(React.createElement(AppContainer, {
|
|
57
|
-
config: this.config,
|
|
58
|
-
onBeforeRender: this.onBeforeRender,
|
|
59
|
-
onAfterRender: this.onAfterRender,
|
|
60
|
-
container: container,
|
|
61
|
-
element: this.element
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
__decorate([ property({
|
|
67
|
-
type: Object
|
|
68
|
-
}) ], ChatContainerInternal.prototype, "config", void 0);
|
|
69
|
-
|
|
70
|
-
__decorate([ property({
|
|
71
|
-
type: HTMLElement
|
|
72
|
-
}) ], ChatContainerInternal.prototype, "element", void 0);
|
|
73
|
-
|
|
74
|
-
__decorate([ property() ], ChatContainerInternal.prototype, "onBeforeRender", void 0);
|
|
75
|
-
|
|
76
|
-
__decorate([ property() ], ChatContainerInternal.prototype, "onAfterRender", void 0);
|
|
77
|
-
|
|
78
|
-
ChatContainerInternal = __decorate([ carbonElement("cds-aichat-internal") ], ChatContainerInternal);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
const CSS_CLASS_PREFIX = "cds--aichat";
|
|
10
|
-
|
|
11
|
-
const WEB_COMPONENT_PREFIX = "cds-aichat";
|
|
12
|
-
|
|
13
|
-
export { CSS_CLASS_PREFIX, WEB_COMPONENT_PREFIX };
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
|
|
3
|
-
import { createComponent } from "@lit/react";
|
|
4
|
-
|
|
5
|
-
import { css, LitElement } from "lit";
|
|
6
|
-
|
|
7
|
-
import React, { useRef, useState, useEffect, useCallback } from "react";
|
|
8
|
-
|
|
9
|
-
import { createPortal } from "react-dom";
|
|
10
|
-
|
|
11
|
-
import { useOnMount } from "../chat/shared/hooks/useOnMount.js";
|
|
12
|
-
|
|
13
|
-
import { carbonElement } from "../chat/web-components/decorators/customElement.js";
|
|
14
|
-
|
|
15
|
-
import { BusEventType } from "../types/events/eventBusTypes.js";
|
|
16
|
-
|
|
17
|
-
import { DYNAMIC_IMPORTS } from "../chat/dynamic-imports/dynamic-imports.js";
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright IBM Corp. 2025
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*
|
|
25
|
-
* @license
|
|
26
|
-
*/ let ChatContainerReact = class ChatContainerReact extends LitElement {
|
|
27
|
-
firstUpdated(changedProperties) {
|
|
28
|
-
super.firstUpdated(changedProperties);
|
|
29
|
-
this.dispatchEvent(new CustomEvent("shadow-ready", {
|
|
30
|
-
bubbles: true
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
ChatContainerReact.styles = css`
|
|
36
|
-
:host {
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 100%;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
ChatContainerReact = __decorate([ carbonElement("cds-aichat-react") ], ChatContainerReact);
|
|
43
|
-
|
|
44
|
-
const ReactChatContainer = React.memo(createComponent({
|
|
45
|
-
tagName: "cds-aichat-react",
|
|
46
|
-
elementClass: ChatContainerReact,
|
|
47
|
-
react: React
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
function ChatContainer({onBeforeRender: onBeforeRender, onAfterRender: onAfterRender, config: config, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements, element: element}) {
|
|
51
|
-
const wrapperRef = useRef(null);
|
|
52
|
-
const [wrapper, setWrapper] = useState(null);
|
|
53
|
-
const [container, setContainer] = useState(null);
|
|
54
|
-
const [AppContainerComponent, setAppContainerComponent] = useState(null);
|
|
55
|
-
const [userDefinedElements, setUserDefinedElements] = useState([]);
|
|
56
|
-
const [writeableElementSlots, setWriteableElementSlots] = useState([]);
|
|
57
|
-
const [currentInstance, setCurrentInstance] = useState(null);
|
|
58
|
-
useOnMount(() => {
|
|
59
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
DYNAMIC_IMPORTS.AppContainer().then(appContainer => {
|
|
63
|
-
setAppContainerComponent(() => appContainer.AppContainer);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!wrapperRef.current) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
let eventListenerAdded = false;
|
|
71
|
-
const wrapperElement = wrapperRef.current;
|
|
72
|
-
const handleShadowReady = () => {
|
|
73
|
-
let reactElement = wrapperElement.shadowRoot.querySelector(".cds--aichat-react-app");
|
|
74
|
-
if (!reactElement) {
|
|
75
|
-
reactElement = document.createElement("div");
|
|
76
|
-
reactElement.classList.add("cds--aichat-react-app");
|
|
77
|
-
wrapperElement.shadowRoot.appendChild(reactElement);
|
|
78
|
-
}
|
|
79
|
-
if (wrapperElement !== wrapper) {
|
|
80
|
-
setWrapper(wrapperElement);
|
|
81
|
-
}
|
|
82
|
-
if (reactElement !== container) {
|
|
83
|
-
setContainer(reactElement);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
if (wrapperElement.shadowRoot) {
|
|
87
|
-
handleShadowReady();
|
|
88
|
-
} else {
|
|
89
|
-
eventListenerAdded = true;
|
|
90
|
-
wrapperElement.addEventListener("shadow-ready", handleShadowReady, {
|
|
91
|
-
once: true
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return () => {
|
|
95
|
-
if (eventListenerAdded) {
|
|
96
|
-
wrapperElement.removeEventListener("shadow-ready", handleShadowReady);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}, [ container, wrapper, currentInstance ]);
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
if (wrapper) {
|
|
102
|
-
const combinedNodes = [ ...userDefinedElements, ...writeableElementSlots ];
|
|
103
|
-
const currentNodes = Array.from(wrapper.childNodes);
|
|
104
|
-
const newNodesSet = new Set(combinedNodes);
|
|
105
|
-
currentNodes.forEach(node => {
|
|
106
|
-
if (!newNodesSet.has(node)) {
|
|
107
|
-
wrapper.removeChild(node);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
combinedNodes.forEach(node => {
|
|
111
|
-
if (!currentNodes.includes(node)) {
|
|
112
|
-
wrapper.appendChild(node);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}, [ userDefinedElements, writeableElementSlots, wrapper ]);
|
|
117
|
-
const userDefinedHandler = useCallback(event => {
|
|
118
|
-
const {element: element} = event.data;
|
|
119
|
-
setUserDefinedElements(previousUserDefinedElements => [ ...previousUserDefinedElements, element ]);
|
|
120
|
-
}, []);
|
|
121
|
-
const onBeforeRenderOverride = useCallback(instance => {
|
|
122
|
-
if (instance) {
|
|
123
|
-
const addWriteableElementSlots = () => {
|
|
124
|
-
const slots = Object.entries(instance.writeableElements).map(writeableElement => {
|
|
125
|
-
const [key, element] = writeableElement;
|
|
126
|
-
element.setAttribute("slot", key);
|
|
127
|
-
return element;
|
|
128
|
-
});
|
|
129
|
-
setWriteableElementSlots(slots);
|
|
130
|
-
};
|
|
131
|
-
instance.on({
|
|
132
|
-
type: BusEventType.USER_DEFINED_RESPONSE,
|
|
133
|
-
handler: userDefinedHandler
|
|
134
|
-
});
|
|
135
|
-
instance.on({
|
|
136
|
-
type: BusEventType.CHUNK_USER_DEFINED_RESPONSE,
|
|
137
|
-
handler: userDefinedHandler
|
|
138
|
-
});
|
|
139
|
-
addWriteableElementSlots();
|
|
140
|
-
onBeforeRender?.(instance);
|
|
141
|
-
}
|
|
142
|
-
}, [ onBeforeRender, userDefinedHandler ]);
|
|
143
|
-
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return React.createElement(React.Fragment, null, React.createElement(ReactChatContainer, {
|
|
147
|
-
ref: wrapperRef
|
|
148
|
-
}), container && AppContainerComponent && createPortal(React.createElement(AppContainerComponent, {
|
|
149
|
-
config: config,
|
|
150
|
-
renderUserDefinedResponse: renderUserDefinedResponse,
|
|
151
|
-
renderWriteableElements: renderWriteableElements,
|
|
152
|
-
onBeforeRender: onBeforeRenderOverride,
|
|
153
|
-
onAfterRender: onAfterRender,
|
|
154
|
-
container: container,
|
|
155
|
-
setParentInstance: setCurrentInstance,
|
|
156
|
-
element: element
|
|
157
|
-
}), container));
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const ChatContainerExport = React.memo(ChatContainer);
|
|
161
|
-
|
|
162
|
-
export { ChatContainerExport as ChatContainer };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef, useCallback } from "react";
|
|
2
|
-
|
|
3
|
-
import { BusEventType } from "../types/events/eventBusTypes.js";
|
|
4
|
-
|
|
5
|
-
import { ChatContainer as ChatContainerExport } from "./ChatContainer.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
|
-
*/ function ChatCustomElement({config: config, onBeforeRender: onBeforeRender, onAfterRender: onAfterRender, renderUserDefinedResponse: renderUserDefinedResponse, renderWriteableElements: renderWriteableElements, className: className, id: id, onViewChange: onViewChange}) {
|
|
15
|
-
const [customElement, setCustomElement] = useState();
|
|
16
|
-
const originalStyles = useRef({
|
|
17
|
-
width: undefined,
|
|
18
|
-
height: undefined
|
|
19
|
-
});
|
|
20
|
-
const onBeforeRenderOverride = useCallback(async instance => {
|
|
21
|
-
function defaultViewChangeHandler(event, instance) {
|
|
22
|
-
if (event.newViewState.mainWindow) {
|
|
23
|
-
customElement.style.width = originalStyles.current.width;
|
|
24
|
-
customElement.style.height = originalStyles.current.height;
|
|
25
|
-
instance.elements.getMainWindow().removeClassName("HideWebChat");
|
|
26
|
-
} else {
|
|
27
|
-
originalStyles.current = {
|
|
28
|
-
width: customElement.style.width,
|
|
29
|
-
height: customElement.style.height
|
|
30
|
-
};
|
|
31
|
-
customElement.style.width = "0px";
|
|
32
|
-
customElement.style.height = "0px";
|
|
33
|
-
instance.elements.getMainWindow().addClassName("HideWebChat");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
instance.on({
|
|
37
|
-
type: BusEventType.VIEW_CHANGE,
|
|
38
|
-
handler: onViewChange || defaultViewChangeHandler
|
|
39
|
-
});
|
|
40
|
-
return onBeforeRender?.(instance);
|
|
41
|
-
}, [ onBeforeRender, onViewChange, customElement ]);
|
|
42
|
-
return React.createElement("div", {
|
|
43
|
-
className: className,
|
|
44
|
-
id: id,
|
|
45
|
-
ref: setCustomElement
|
|
46
|
-
}, customElement && React.createElement(ChatContainerExport, {
|
|
47
|
-
config: config,
|
|
48
|
-
onBeforeRender: onBeforeRenderOverride,
|
|
49
|
-
onAfterRender: onAfterRender,
|
|
50
|
-
renderUserDefinedResponse: renderUserDefinedResponse,
|
|
51
|
-
renderWriteableElements: renderWriteableElements,
|
|
52
|
-
element: customElement
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const ChatCustomElementExport = React.memo(ChatCustomElement);
|
|
57
|
-
|
|
58
|
-
export { ChatCustomElementExport as ChatCustomElement };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
var ChatHeaderObjectType;
|
|
10
|
-
|
|
11
|
-
(function(ChatHeaderObjectType) {
|
|
12
|
-
ChatHeaderObjectType["LINK"] = "link";
|
|
13
|
-
ChatHeaderObjectType["MENU"] = "menu";
|
|
14
|
-
ChatHeaderObjectType["BUTTON"] = "button";
|
|
15
|
-
ChatHeaderObjectType["RADIO_GROUP"] = "radio-group";
|
|
16
|
-
})(ChatHeaderObjectType || (ChatHeaderObjectType = {}));
|
|
17
|
-
|
|
18
|
-
export { ChatHeaderObjectType };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright IBM Corp. 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
* @license
|
|
8
|
-
*/
|
|
9
|
-
var CornersType;
|
|
10
|
-
|
|
11
|
-
(function(CornersType) {
|
|
12
|
-
CornersType["ROUND"] = "round";
|
|
13
|
-
CornersType["SQUARE"] = "square";
|
|
14
|
-
})(CornersType || (CornersType = {}));
|
|
15
|
-
|
|
16
|
-
export { CornersType };
|