@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,58 +0,0 @@
|
|
|
1
|
-
import { Loading } from "@carbon/react";
|
|
2
|
-
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
|
|
5
|
-
import React, { useContext } from "react";
|
|
6
|
-
|
|
7
|
-
import { HideComponentContext } from "../contexts/HideComponentContext.js";
|
|
8
|
-
|
|
9
|
-
import { BotHeader as BotHeaderExport } from "./header/BotHeader.js";
|
|
10
|
-
|
|
11
|
-
import { HomeScreenHeader as HomeScreenHeaderExport } from "./homeScreen/HomeScreenHeader.js";
|
|
12
|
-
|
|
13
|
-
import { AnnounceOnMountComponent as AnnounceOnMountComponentExport } from "./util/AnnounceOnMountComponent.js";
|
|
14
|
-
|
|
15
|
-
import { MountChildrenOnDelay } from "./util/MountChildrenOnDelay.js";
|
|
16
|
-
|
|
17
|
-
import { OverlayPanelName } from "./OverlayPanel.js";
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
* Copyright IBM Corp. 2025
|
|
21
|
-
*
|
|
22
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
23
|
-
* LICENSE file in the root directory of this source tree.
|
|
24
|
-
*
|
|
25
|
-
* @license
|
|
26
|
-
*/ function HydrationPanel({onClose: onClose, languagePack: languagePack, isHydrated: isHydrated, headerDisplayName: headerDisplayName, useHomeScreenVersion: useHomeScreenVersion}) {
|
|
27
|
-
const isHidden = useContext(HideComponentContext);
|
|
28
|
-
let header;
|
|
29
|
-
if (useHomeScreenVersion) {
|
|
30
|
-
header = React.createElement(HomeScreenHeaderExport, {
|
|
31
|
-
onClose: onClose
|
|
32
|
-
});
|
|
33
|
-
} else {
|
|
34
|
-
header = React.createElement(BotHeaderExport, {
|
|
35
|
-
onClose: onClose,
|
|
36
|
-
headerDisplayName: headerDisplayName,
|
|
37
|
-
onToggleHomeScreen: null,
|
|
38
|
-
includeWriteableElement: false,
|
|
39
|
-
testIdPrefix: OverlayPanelName.HYDRATING
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return React.createElement("div", {
|
|
43
|
-
className: "WAC WAC__hydratingContainer"
|
|
44
|
-
}, header, React.createElement("div", {
|
|
45
|
-
className: cx("WAC__hydrating", "WACPanelContent", {
|
|
46
|
-
"WAC__hydrating--homeScreen": useHomeScreenVersion
|
|
47
|
-
})
|
|
48
|
-
}, !isHidden && React.createElement(MountChildrenOnDelay, {
|
|
49
|
-
delay: 400
|
|
50
|
-
}, !isHydrated && React.createElement(AnnounceOnMountComponentExport, {
|
|
51
|
-
announceOnce: languagePack.window_ariaWindowLoading
|
|
52
|
-
}), React.createElement(Loading, {
|
|
53
|
-
withOverlay: false,
|
|
54
|
-
"aria-label": languagePack.window_ariaWindowLoading
|
|
55
|
-
}))));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export { HydrationPanel };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { WriteableElementName } from "../../../types/instance/ChatInstance.js";
|
|
4
|
-
|
|
5
|
-
import { useServiceManager } from "../hooks/useServiceManager.js";
|
|
6
|
-
|
|
7
|
-
import WriteableElement from "./WriteableElement.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 LatestWelcomeNodes({children: children}) {
|
|
17
|
-
const {namespace: namespace} = useServiceManager();
|
|
18
|
-
return React.createElement(React.Fragment, null, React.createElement(WriteableElement, {
|
|
19
|
-
slotName: WriteableElementName.WELCOME_NODE_BEFORE_ELEMENT,
|
|
20
|
-
id: `welcomeNodeBeforeElement${namespace.suffix}`
|
|
21
|
-
}), children);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var LatestWelcomeNodes$1 = React.memo(LatestWelcomeNodes);
|
|
25
|
-
|
|
26
|
-
export { LatestWelcomeNodes$1 as default };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { useLanguagePack } from "../hooks/useLanguagePack.js";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright IBM Corp. 2025
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*
|
|
11
|
-
* @license
|
|
12
|
-
*/ function ResponseStopped() {
|
|
13
|
-
const {messages_responseStopped: messages_responseStopped} = useLanguagePack();
|
|
14
|
-
return React.createElement("div", {
|
|
15
|
-
className: "WACResponseStopped"
|
|
16
|
-
}, messages_responseStopped);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { ResponseStopped };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AISkeletonPlaceholder, SkeletonPlaceholder as SkeletonPlaceholder$1, AISkeletonText, SkeletonText as SkeletonText$1 } from "@carbon/react";
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
import { useSelector } from "react-redux";
|
|
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 SkeletonText(props) {
|
|
15
|
-
const useAITheme = useSelector(state => state.theme.useAITheme);
|
|
16
|
-
return useAITheme ? React.createElement(AISkeletonText, {
|
|
17
|
-
...props
|
|
18
|
-
}) : React.createElement(SkeletonText$1, {
|
|
19
|
-
...props
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function SkeletonPlaceholder(props) {
|
|
24
|
-
const useAITheme = useSelector(state => state.theme.useAITheme);
|
|
25
|
-
return useAITheme ? React.createElement(AISkeletonPlaceholder, {
|
|
26
|
-
...props
|
|
27
|
-
}) : React.createElement(SkeletonPlaceholder$1, {
|
|
28
|
-
...props
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { SkeletonPlaceholder, SkeletonText };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright IBM Corp. 2025
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license
|
|
10
|
-
*/ function WriteableElement({slotName: slotName, id: id, className: className}) {
|
|
11
|
-
return React.createElement("div", {
|
|
12
|
-
className: className,
|
|
13
|
-
id: id,
|
|
14
|
-
"data-floating-menu-container": true
|
|
15
|
-
}, React.createElement("slot", {
|
|
16
|
-
name: slotName
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var WriteableElement$1 = React.memo(WriteableElement);
|
|
21
|
-
|
|
22
|
-
export { WriteableElement$1 as default };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import UserAvatar from "@carbon/icons-react/es/UserAvatar.js";
|
|
2
|
-
|
|
3
|
-
import React, { useState, useEffect } from "react";
|
|
4
|
-
|
|
5
|
-
import { useDynamicCSSProperties } from "../../hooks/useCSSCustomProperties.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 AgentAvatar(props) {
|
|
15
|
-
const {agentProfile: agentProfile, languagePack: languagePack, width: width, height: height} = props;
|
|
16
|
-
const agentName = agentProfile?.nickname;
|
|
17
|
-
const avatarStyles = useDynamicCSSProperties({
|
|
18
|
-
width: width,
|
|
19
|
-
height: height
|
|
20
|
-
});
|
|
21
|
-
const avatarUrl = agentProfile?.profile_picture_url;
|
|
22
|
-
const [hasError, setHasError] = useState(false);
|
|
23
|
-
let component;
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
setHasError(false);
|
|
26
|
-
}, [ avatarUrl ]);
|
|
27
|
-
if (!hasError && avatarUrl) {
|
|
28
|
-
component = React.createElement("img", {
|
|
29
|
-
src: avatarUrl,
|
|
30
|
-
alt: languagePack.agent_ariaAgentAvatar,
|
|
31
|
-
onError: () => setHasError(true)
|
|
32
|
-
});
|
|
33
|
-
} else if (agentName?.match(/^[\x20-\xFE]+$/)) {
|
|
34
|
-
component = React.createElement("div", {
|
|
35
|
-
"aria-label": languagePack.agent_ariaAgentAvatar,
|
|
36
|
-
className: "WACAgentAvatar__Circle",
|
|
37
|
-
style: avatarStyles
|
|
38
|
-
}, React.createElement("div", {
|
|
39
|
-
className: "WACAgentAvatar__Letter"
|
|
40
|
-
}, agentName.charAt(0)));
|
|
41
|
-
} else {
|
|
42
|
-
component = React.createElement(UserAvatar, {
|
|
43
|
-
size: 32,
|
|
44
|
-
width: width ? Number(width.replace("px", "")) : undefined,
|
|
45
|
-
height: height ? Number(height.replace("px", "")) : undefined,
|
|
46
|
-
"aria-label": languagePack.agent_ariaAgentAvatar
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return React.createElement("div", {
|
|
50
|
-
className: "WACAgentAvatar"
|
|
51
|
-
}, component);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { AgentAvatar };
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import ScreenOff from "@carbon/icons-react/es/ScreenOff.js";
|
|
2
|
-
|
|
3
|
-
import { Button } from "@carbon/react";
|
|
4
|
-
|
|
5
|
-
import cx from "classnames";
|
|
6
|
-
|
|
7
|
-
import React, { forwardRef, useRef, useImperativeHandle } from "react";
|
|
8
|
-
|
|
9
|
-
import { useSelector, shallowEqual } from "react-redux";
|
|
10
|
-
|
|
11
|
-
import { useLanguagePack } from "../../hooks/useLanguagePack.js";
|
|
12
|
-
|
|
13
|
-
import { useServiceManager } from "../../hooks/useServiceManager.js";
|
|
14
|
-
|
|
15
|
-
import { selectAgentDisplayState } from "../../store/selectors.js";
|
|
16
|
-
|
|
17
|
-
import { doFocusRef } from "../../utils/domUtils.js";
|
|
18
|
-
|
|
19
|
-
import { AnnounceOnMountComponent as AnnounceOnMountComponentExport } from "../util/AnnounceOnMountComponent.js";
|
|
20
|
-
|
|
21
|
-
import { AgentAvatar } from "./AgentAvatar.js";
|
|
22
|
-
|
|
23
|
-
import { AvailabilityMessage } from "./AvailabilityMessage.js";
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
* Copyright IBM Corp. 2025
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*
|
|
31
|
-
* @license
|
|
32
|
-
*/ function AgentBanner(props, ref) {
|
|
33
|
-
const {onButtonClick: onButtonClick} = props;
|
|
34
|
-
const languagePack = useLanguagePack();
|
|
35
|
-
const serviceManager = useServiceManager();
|
|
36
|
-
const persistedAgentState = useSelector(state => state.persistedToBrowserStorage.chatState.agentState);
|
|
37
|
-
const agentState = useSelector(state => state.agentState);
|
|
38
|
-
const {isConnecting: isConnecting, availability: availability, isScreenSharing: isScreenSharing} = agentState;
|
|
39
|
-
const displayState = useSelector(selectAgentDisplayState, shallowEqual);
|
|
40
|
-
const {agentProfile: agentProfile} = persistedAgentState;
|
|
41
|
-
const buttonRef = useRef();
|
|
42
|
-
let line1;
|
|
43
|
-
let line2;
|
|
44
|
-
let avatar;
|
|
45
|
-
let buttonLabel;
|
|
46
|
-
let animation;
|
|
47
|
-
if (isConnecting) {
|
|
48
|
-
animation = React.createElement("div", {
|
|
49
|
-
className: "WACLoadingBar__ConnectingAnimation"
|
|
50
|
-
});
|
|
51
|
-
line1 = languagePack.agent_connecting;
|
|
52
|
-
line2 = React.createElement(AnnounceOnMountComponentExport, {
|
|
53
|
-
announceOnce: languagePack.agent_connecting
|
|
54
|
-
}, React.createElement(AvailabilityMessage, {
|
|
55
|
-
availability: availability,
|
|
56
|
-
fallbackText: languagePack.agent_connectWaiting
|
|
57
|
-
}));
|
|
58
|
-
buttonLabel = languagePack.agent_connectButtonCancel;
|
|
59
|
-
} else {
|
|
60
|
-
line1 = agentProfile?.nickname || languagePack.agent_noName;
|
|
61
|
-
buttonLabel = languagePack.agent_connectedButtonEndChat;
|
|
62
|
-
avatar = React.createElement(AgentAvatar, {
|
|
63
|
-
agentProfile: agentProfile,
|
|
64
|
-
languagePack: languagePack,
|
|
65
|
-
width: "32px",
|
|
66
|
-
height: "32px"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
const onStopSharing = () => {
|
|
70
|
-
serviceManager.humanAgentService.screenShareStop();
|
|
71
|
-
};
|
|
72
|
-
useImperativeHandle(ref, () => ({
|
|
73
|
-
requestFocus: () => {
|
|
74
|
-
if (buttonRef.current) {
|
|
75
|
-
doFocusRef(buttonRef);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
}));
|
|
81
|
-
return React.createElement("div", {
|
|
82
|
-
className: cx("WACAgentBanner", {
|
|
83
|
-
"WACAgentBanner--connected": !isConnecting
|
|
84
|
-
})
|
|
85
|
-
}, displayState.isConnectingOrConnected && React.createElement("div", {
|
|
86
|
-
className: "WACAgentBanner__Body"
|
|
87
|
-
}, avatar, React.createElement("div", {
|
|
88
|
-
className: "WACAgentBanner__AgentInfo"
|
|
89
|
-
}, React.createElement("div", {
|
|
90
|
-
className: "WACAgentBanner__AgentLine1"
|
|
91
|
-
}, line1), line2 && React.createElement("div", {
|
|
92
|
-
className: "WACAgentBanner__AgentLine2"
|
|
93
|
-
}, line2)), React.createElement(Button, {
|
|
94
|
-
ref: buttonRef,
|
|
95
|
-
className: "WACAgentBanner__Button WACAgentBanner__CancelButton",
|
|
96
|
-
onClick: onButtonClick,
|
|
97
|
-
size: "sm"
|
|
98
|
-
}, buttonLabel)), isScreenSharing && React.createElement(Button, {
|
|
99
|
-
className: "WACAgentBanner__Button WACAgentBanner__StopSharingButton",
|
|
100
|
-
kind: "danger",
|
|
101
|
-
size: "sm",
|
|
102
|
-
renderIcon: ScreenOff,
|
|
103
|
-
onClick: onStopSharing
|
|
104
|
-
}, languagePack.agent_sharingStopSharingButton), animation);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const AgentBannerExport = React.memo(forwardRef(AgentBanner));
|
|
108
|
-
|
|
109
|
-
export { AgentBannerExport as AgentBanner };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { useSelector, shallowEqual } from "react-redux";
|
|
4
|
-
|
|
5
|
-
import { selectAgentDisplayState } from "../../store/selectors.js";
|
|
6
|
-
|
|
7
|
-
import { AgentBanner as AgentBannerExport } from "./AgentBanner.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 AgentBannerContainer({onButtonClick: onButtonClick, bannerRef: bannerRef}) {
|
|
17
|
-
const agentState = useSelector(state => state.agentState);
|
|
18
|
-
const displayState = useSelector(selectAgentDisplayState, shallowEqual);
|
|
19
|
-
if (displayState.isConnectingOrConnected || agentState.isScreenSharing) {
|
|
20
|
-
return React.createElement(AgentBannerExport, {
|
|
21
|
-
ref: bannerRef,
|
|
22
|
-
onButtonClick: onButtonClick
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { AgentBannerContainer };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { FormattedMessage } from "react-intl";
|
|
4
|
-
|
|
5
|
-
import { isNil } from "../../utils/lang/langUtils.js";
|
|
6
|
-
|
|
7
|
-
import { addHTMLSupport } from "../../utils/languages.js";
|
|
8
|
-
|
|
9
|
-
import { RichText as RichTextExport } from "../responseTypes/util/RichText.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
|
-
*/ function AvailabilityMessage({availability: availability, fallbackText: fallbackText}) {
|
|
19
|
-
let availabilityKey;
|
|
20
|
-
let availabilityValues;
|
|
21
|
-
let availabilityText;
|
|
22
|
-
if (!isNil(availability?.estimated_wait_time)) {
|
|
23
|
-
availabilityKey = "agent_connectingMinutes";
|
|
24
|
-
availabilityValues = {
|
|
25
|
-
time: availability.estimated_wait_time
|
|
26
|
-
};
|
|
27
|
-
} else if (!isNil(availability?.position_in_queue)) {
|
|
28
|
-
availabilityKey = "agent_connectingQueue";
|
|
29
|
-
availabilityValues = {
|
|
30
|
-
position: availability.position_in_queue
|
|
31
|
-
};
|
|
32
|
-
} else if (availability?.message) {
|
|
33
|
-
availabilityText = availability.message;
|
|
34
|
-
} else {
|
|
35
|
-
availabilityText = fallbackText;
|
|
36
|
-
}
|
|
37
|
-
if (availabilityText) {
|
|
38
|
-
return React.createElement(RichTextExport, {
|
|
39
|
-
overrideSanitize: true,
|
|
40
|
-
text: availabilityText
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return React.createElement(FormattedMessage, {
|
|
44
|
-
id: availabilityKey,
|
|
45
|
-
values: addHTMLSupport(availabilityValues)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { AvailabilityMessage };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { isElement, isInputNode, isTextAreaNode, isImageNode, isTextNode } from "../../utils/domUtils.js";
|
|
4
|
-
|
|
5
|
-
import VisuallyHidden from "../util/VisuallyHidden.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
|
-
*/
|
|
15
|
-
const ANNOUNCE_INPUT_TYPES = new Set([ "button", "date", "datetime-local", "email", "file", "month", "number", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week" ]);
|
|
16
|
-
|
|
17
|
-
const ANNOUNCE_NODE_EXCLUDE_ATTRIBUTE = "data-wac-exclude-node-read";
|
|
18
|
-
|
|
19
|
-
class AriaAnnouncerComponent extends React.PureComponent {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.ref1 = React.createRef();
|
|
23
|
-
this.ref2 = React.createRef();
|
|
24
|
-
this.useRef1 = true;
|
|
25
|
-
this.doAnnouncements = () => {
|
|
26
|
-
const strings = [];
|
|
27
|
-
this.pendingValues.forEach(elementToAnnounce => {
|
|
28
|
-
if (typeof elementToAnnounce === "string") {
|
|
29
|
-
strings.push(elementToAnnounce);
|
|
30
|
-
} else {
|
|
31
|
-
nodeToText(elementToAnnounce, strings);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const useElement = this.useRef1 ? this.ref1.current : this.ref2.current;
|
|
35
|
-
if (useElement) {
|
|
36
|
-
useElement.innerText = strings.join(" ");
|
|
37
|
-
const clearElement = this.useRef1 ? this.ref2.current : this.ref1.current;
|
|
38
|
-
clearElement.innerHTML = "";
|
|
39
|
-
}
|
|
40
|
-
this.useRef1 = !this.useRef1;
|
|
41
|
-
this.pendingValues = null;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
announceValue(value) {
|
|
45
|
-
if (!value) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (!this.pendingValues) {
|
|
49
|
-
this.pendingValues = [];
|
|
50
|
-
setTimeout(this.doAnnouncements, 250);
|
|
51
|
-
}
|
|
52
|
-
if (typeof value === "string" || hasNodeType(value)) {
|
|
53
|
-
this.pendingValues.push(value);
|
|
54
|
-
} else if (value.messageID) {
|
|
55
|
-
const formattedMessage = this.props.intl.formatMessage({
|
|
56
|
-
id: value.messageID
|
|
57
|
-
}, value.messageValues);
|
|
58
|
-
this.pendingValues.push(formattedMessage);
|
|
59
|
-
} else {
|
|
60
|
-
this.pendingValues.push(value.messageText);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
return React.createElement(VisuallyHidden, {
|
|
65
|
-
className: "WACAriaAnnouncer"
|
|
66
|
-
}, React.createElement("div", {
|
|
67
|
-
ref: this.ref1,
|
|
68
|
-
"aria-live": "polite"
|
|
69
|
-
}), React.createElement("div", {
|
|
70
|
-
ref: this.ref2,
|
|
71
|
-
"aria-live": "polite"
|
|
72
|
-
}));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function nodeToText(node, strings) {
|
|
77
|
-
if (isElement(node)) {
|
|
78
|
-
if (window.getComputedStyle(node).display !== "none" && node.getAttribute("aria-hidden") !== "true" && !node.hasAttribute(ANNOUNCE_NODE_EXCLUDE_ATTRIBUTE)) {
|
|
79
|
-
trimAndPush(node.getAttribute("aria-label"), strings);
|
|
80
|
-
if (isInputNode(node) && ANNOUNCE_INPUT_TYPES.has(node.type.toLowerCase())) {
|
|
81
|
-
if (node.value === "") {
|
|
82
|
-
trimAndPush(node.placeholder, strings);
|
|
83
|
-
} else {
|
|
84
|
-
trimAndPush(node.value, strings);
|
|
85
|
-
}
|
|
86
|
-
} else if (isTextAreaNode(node)) {
|
|
87
|
-
if (node.value === "") {
|
|
88
|
-
trimAndPush(node.placeholder, strings);
|
|
89
|
-
}
|
|
90
|
-
} else if (isImageNode(node)) {
|
|
91
|
-
trimAndPush(node.alt, strings);
|
|
92
|
-
}
|
|
93
|
-
if (node.shadowRoot) {
|
|
94
|
-
node.shadowRoot.childNodes?.forEach(childNode => {
|
|
95
|
-
nodeToText(childNode, strings);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (node.childNodes) {
|
|
99
|
-
node.childNodes.forEach(childNode => {
|
|
100
|
-
nodeToText(childNode, strings);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
} else if (isTextNode(node)) {
|
|
105
|
-
trimAndPush(node.data, strings);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function trimAndPush(value, strings) {
|
|
110
|
-
if (value) {
|
|
111
|
-
value = value.trim();
|
|
112
|
-
if (value) {
|
|
113
|
-
strings.push(value.replaceAll("\n", " "));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function hasNodeType(value) {
|
|
119
|
-
return value.nodeType !== undefined;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export { AriaAnnouncerComponent, nodeToText };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
|
-
|
|
5
|
-
import { AriaAnnouncerContext } from "../../contexts/AriaAnnouncerContext.js";
|
|
6
|
-
|
|
7
|
-
import { useServiceManager } from "../../hooks/useServiceManager.js";
|
|
8
|
-
|
|
9
|
-
import { AriaAnnouncerComponent } from "./AriaAnnouncerComponent.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
|
-
*/ function AriaAnnouncerProvider(props) {
|
|
19
|
-
const intl = useIntl();
|
|
20
|
-
const {store: store} = useServiceManager();
|
|
21
|
-
const announcerRef = useRef();
|
|
22
|
-
const announcerFunction = useCallback(value => {
|
|
23
|
-
if (!announcerRef.current) {
|
|
24
|
-
setTimeout(() => announcerRef.current.announceValue(value));
|
|
25
|
-
} else {
|
|
26
|
-
announcerRef.current.announceValue(value);
|
|
27
|
-
}
|
|
28
|
-
}, []);
|
|
29
|
-
const previousAnnounceMessageRef = useRef();
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const unsubscribe = store.subscribe(() => {
|
|
32
|
-
const currentAnnounceMessage = store.getState().announceMessage;
|
|
33
|
-
if (currentAnnounceMessage !== previousAnnounceMessageRef.current) {
|
|
34
|
-
announcerFunction(currentAnnounceMessage);
|
|
35
|
-
previousAnnounceMessageRef.current = currentAnnounceMessage;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return unsubscribe;
|
|
39
|
-
}, [ store, announcerFunction ]);
|
|
40
|
-
return React.createElement(AriaAnnouncerContext.Provider, {
|
|
41
|
-
value: announcerFunction
|
|
42
|
-
}, props.children, React.createElement(AriaAnnouncerComponent, {
|
|
43
|
-
intl: intl,
|
|
44
|
-
ref: announcerRef
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { AriaAnnouncerProvider };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
import { AriaAnnouncerContext } from "../../contexts/AriaAnnouncerContext.js";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright IBM Corp. 2025
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*
|
|
11
|
-
* @license
|
|
12
|
-
*/ function AriaLiveMessage(props) {
|
|
13
|
-
const ariaAnnouncer = useContext(AriaAnnouncerContext);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
ariaAnnouncer(props.message);
|
|
16
|
-
}, [ ariaAnnouncer, props.message ]);
|
|
17
|
-
return React.createElement("div", null);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const AriaLiveMessageExport = React.memo(AriaLiveMessage);
|
|
21
|
-
|
|
22
|
-
export { AriaLiveMessageExport as AriaLiveMessage };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import "@carbon/web-components/es-custom/components/ai-label/ai-label-action-button.js";
|
|
2
|
-
|
|
3
|
-
import CDSAILabel from "@carbon/web-components/es-custom/components/ai-label/ai-label.js";
|
|
4
|
-
|
|
5
|
-
import { createComponent } from "@lit/react";
|
|
6
|
-
|
|
7
|
-
import React from "react";
|
|
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 AISlug = createComponent({
|
|
17
|
-
tagName: "cds-custom-ai-label",
|
|
18
|
-
elementClass: CDSAILabel,
|
|
19
|
-
react: React
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export { AISlug };
|