@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
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
import ErrorFilled from "@carbon/icons-react/es/ErrorFilled.js";
|
|
2
|
+
|
|
3
|
+
import Restart from "@carbon/icons-react/es/Restart.js";
|
|
4
|
+
|
|
5
|
+
import { Button, InlineNotification } from "@carbon/react";
|
|
6
|
+
|
|
7
|
+
import React, { useRef, useImperativeHandle, useEffect, useState } from "react";
|
|
8
|
+
|
|
9
|
+
import { useIntl } from "react-intl";
|
|
10
|
+
|
|
11
|
+
import { useSelector } from "react-redux";
|
|
12
|
+
|
|
13
|
+
import { V as ViewChangeReason, T as TourEndReason, B as BusEventType, b as MainWindowOpenReason } from "./chat.customElement.js";
|
|
14
|
+
|
|
15
|
+
import { u as useAriaAnnouncer, I as InlineError, M as MountChildrenOnDelay } from "./chat.MountChildrenOnDelay.js";
|
|
16
|
+
|
|
17
|
+
import { u as useLanguagePack } from "./chat.AppState.js";
|
|
18
|
+
|
|
19
|
+
import { d as doFocusRef, u as useServiceManager } from "./chat.usePrevious.js";
|
|
20
|
+
|
|
21
|
+
import { a as VideoComponentExport, I as ImageExport, S as SkeletonPlaceholder, f as formatMessage, A as AnnounceOnMountComponentExport } from "./chat.VideoComponent.js";
|
|
22
|
+
|
|
23
|
+
import { H as HideComponent } from "./chat.HideComponent.js";
|
|
24
|
+
|
|
25
|
+
import Close from "@carbon/icons-react/es/Close.js";
|
|
26
|
+
|
|
27
|
+
import Subtract from "@carbon/icons-react/es/Subtract.js";
|
|
28
|
+
|
|
29
|
+
import ArrowLeft from "@carbon/icons-react/es/ArrowLeft.js";
|
|
30
|
+
|
|
31
|
+
import ArrowRight from "@carbon/icons-react/es/ArrowRight.js";
|
|
32
|
+
|
|
33
|
+
import Chat from "@carbon/icons-react/es/Chat.js";
|
|
34
|
+
|
|
35
|
+
import cx from "classnames";
|
|
36
|
+
|
|
37
|
+
import { g as getMediaDimensions } from "./chat.messageUtils.js";
|
|
38
|
+
|
|
39
|
+
import { b as consoleError } from "./chat.miscUtils.js";
|
|
40
|
+
|
|
41
|
+
import { R as RichTextExport } from "./chat.RichText.js";
|
|
42
|
+
|
|
43
|
+
import { b as MessageResponseTypes } from "./chat.Messages.js";
|
|
44
|
+
|
|
45
|
+
import { V as ViewType } from "./chat.dynamic-imports.js";
|
|
46
|
+
|
|
47
|
+
import "compute-scroll-into-view";
|
|
48
|
+
|
|
49
|
+
import "memoize-one";
|
|
50
|
+
|
|
51
|
+
import "tabbable";
|
|
52
|
+
|
|
53
|
+
import "dayjs";
|
|
54
|
+
|
|
55
|
+
import "dayjs/locale/en.js";
|
|
56
|
+
|
|
57
|
+
import "intl-messageformat";
|
|
58
|
+
|
|
59
|
+
import "./chat.browserUtils.js";
|
|
60
|
+
|
|
61
|
+
import "detect-browser";
|
|
62
|
+
|
|
63
|
+
import "./chat.constants.js";
|
|
64
|
+
|
|
65
|
+
import "@carbon/icons-react/es/Music.js";
|
|
66
|
+
|
|
67
|
+
import "lodash-es/cloneDeep.js";
|
|
68
|
+
|
|
69
|
+
import "./chat.uuid.js";
|
|
70
|
+
|
|
71
|
+
import "uuid";
|
|
72
|
+
|
|
73
|
+
import "@lit/react";
|
|
74
|
+
|
|
75
|
+
import "tslib";
|
|
76
|
+
|
|
77
|
+
import "lit";
|
|
78
|
+
|
|
79
|
+
import "lit/decorators.js";
|
|
80
|
+
|
|
81
|
+
import "lodash-es/throttle.js";
|
|
82
|
+
|
|
83
|
+
import "dompurify";
|
|
84
|
+
|
|
85
|
+
import "lit/directives/repeat.js";
|
|
86
|
+
|
|
87
|
+
import "lit/directives/unsafe-html.js";
|
|
88
|
+
|
|
89
|
+
import "./chat.htmlUtils.js";
|
|
90
|
+
|
|
91
|
+
import "./chat.stringUtils.js";
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
* Copyright IBM Corp. 2025
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
97
|
+
* LICENSE file in the root directory of this source tree.
|
|
98
|
+
*
|
|
99
|
+
* @license
|
|
100
|
+
*/ function TourCloseMinimizeComponent(props) {
|
|
101
|
+
const {hideMinimizeButton: hideMinimizeButton, onMinimizeClick: onMinimizeClick, onCloseClick: onCloseClick} = props;
|
|
102
|
+
const {tour_ariaMinimizeButton: tour_ariaMinimizeButton, tour_ariaCloseButton: tour_ariaCloseButton} = useLanguagePack();
|
|
103
|
+
return React.createElement("div", {
|
|
104
|
+
className: "WACTour__CloseMinimizeWrapper"
|
|
105
|
+
}, !hideMinimizeButton && React.createElement(React.Fragment, null, React.createElement(Button, {
|
|
106
|
+
className: "WACTour__CloseMinimizeButton WACTour__MinimizeButton",
|
|
107
|
+
kind: "ghost",
|
|
108
|
+
hasIconOnly: true,
|
|
109
|
+
renderIcon: Subtract,
|
|
110
|
+
iconDescription: tour_ariaMinimizeButton,
|
|
111
|
+
onClick: onMinimizeClick,
|
|
112
|
+
"aria-label": tour_ariaMinimizeButton
|
|
113
|
+
}), React.createElement("div", {
|
|
114
|
+
className: "WACTour__CloseMinimizeDivider"
|
|
115
|
+
})), React.createElement(Button, {
|
|
116
|
+
className: "WACTour__CloseMinimizeButton WACTour__CloseButton",
|
|
117
|
+
kind: "ghost",
|
|
118
|
+
hasIconOnly: true,
|
|
119
|
+
renderIcon: Close,
|
|
120
|
+
iconDescription: tour_ariaCloseButton,
|
|
121
|
+
onClick: onCloseClick,
|
|
122
|
+
"aria-label": tour_ariaCloseButton
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* Copyright IBM Corp. 2025
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
130
|
+
* LICENSE file in the root directory of this source tree.
|
|
131
|
+
*
|
|
132
|
+
* @license
|
|
133
|
+
*/ function TourControlsComponent(props, ref) {
|
|
134
|
+
const {reservePreviousButtonSpace: reservePreviousButtonSpace, hidePreviousButton: hidePreviousButton, renderDoneButton: renderDoneButton, disableNextButton: disableNextButton, hideButtons: hideButtons, hideChatButton: hideChatButton, onOpenMainWindowClick: onOpenMainWindowClick, onNextClick: onNextClick, onPreviousClick: onPreviousClick, onDoneClick: onDoneClick} = props;
|
|
135
|
+
const {tour_ariaChatButton: tour_ariaChatButton, tour_ariaNextButton: tour_ariaNextButton, tour_ariaPreviousButton: tour_ariaPreviousButton, tour_doneButton: tour_doneButton} = useLanguagePack();
|
|
136
|
+
const nextButtonRef = useRef();
|
|
137
|
+
const doneButtonRef = useRef();
|
|
138
|
+
useImperativeHandle(ref, () => ({
|
|
139
|
+
requestFocus: () => {
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
if (doneButtonRef.current) {
|
|
142
|
+
doFocusRef(doneButtonRef);
|
|
143
|
+
} else {
|
|
144
|
+
doFocusRef(nextButtonRef);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
return React.createElement("div", {
|
|
150
|
+
className: cx("WACTour__Controls", {
|
|
151
|
+
"WACTour__Controls--empty": hideButtons
|
|
152
|
+
})
|
|
153
|
+
}, !hideChatButton && React.createElement("div", {
|
|
154
|
+
className: "WACTour__ControlsButton"
|
|
155
|
+
}, React.createElement(Button, {
|
|
156
|
+
className: "WACTour__MainWindowButton",
|
|
157
|
+
kind: "ghost",
|
|
158
|
+
size: "md",
|
|
159
|
+
hasIconOnly: true,
|
|
160
|
+
renderIcon: props => React.createElement(Chat, {
|
|
161
|
+
...props
|
|
162
|
+
}),
|
|
163
|
+
iconDescription: tour_ariaChatButton,
|
|
164
|
+
onClick: onOpenMainWindowClick,
|
|
165
|
+
"aria-label": tour_ariaChatButton
|
|
166
|
+
})), reservePreviousButtonSpace && React.createElement("div", {
|
|
167
|
+
className: "WACTour__ControlsButton"
|
|
168
|
+
}, React.createElement(Button, {
|
|
169
|
+
className: cx("WACTour__PreviousButton", {
|
|
170
|
+
"WACTour__ControlsButton--hidden": hidePreviousButton
|
|
171
|
+
}),
|
|
172
|
+
kind: "ghost",
|
|
173
|
+
size: "md",
|
|
174
|
+
hasIconOnly: true,
|
|
175
|
+
renderIcon: props => React.createElement(ArrowLeft, {
|
|
176
|
+
...props
|
|
177
|
+
}),
|
|
178
|
+
iconDescription: tour_ariaPreviousButton,
|
|
179
|
+
onClick: onPreviousClick,
|
|
180
|
+
"aria-label": tour_ariaPreviousButton
|
|
181
|
+
})), renderDoneButton && React.createElement("div", {
|
|
182
|
+
className: "WACTour__ControlsButton"
|
|
183
|
+
}, React.createElement(Button, {
|
|
184
|
+
ref: doneButtonRef,
|
|
185
|
+
className: "WACTour__DoneButton",
|
|
186
|
+
size: "md",
|
|
187
|
+
onClick: onDoneClick
|
|
188
|
+
}, tour_doneButton)), !renderDoneButton && React.createElement("div", {
|
|
189
|
+
className: "WACTour__ControlsButton"
|
|
190
|
+
}, React.createElement(Button, {
|
|
191
|
+
ref: nextButtonRef,
|
|
192
|
+
className: "WACTour__NextButton",
|
|
193
|
+
size: "md",
|
|
194
|
+
hasIconOnly: true,
|
|
195
|
+
renderIcon: props => React.createElement(ArrowRight, {
|
|
196
|
+
...props
|
|
197
|
+
}),
|
|
198
|
+
iconDescription: tour_ariaNextButton,
|
|
199
|
+
onClick: onNextClick,
|
|
200
|
+
disabled: disableNextButton,
|
|
201
|
+
"aria-label": tour_ariaNextButton
|
|
202
|
+
})));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const TourControlsComponentExport = React.forwardRef(TourControlsComponent);
|
|
206
|
+
|
|
207
|
+
/*
|
|
208
|
+
* Copyright IBM Corp. 2025
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
211
|
+
* LICENSE file in the root directory of this source tree.
|
|
212
|
+
*
|
|
213
|
+
* @license
|
|
214
|
+
*/ function TourStepContentComponent(props) {
|
|
215
|
+
const {stepGenericItem: stepGenericItem, isCurrentStep: isCurrentStep} = props;
|
|
216
|
+
const ariaAnnouncer = useAriaAnnouncer();
|
|
217
|
+
const rootRef = useRef();
|
|
218
|
+
function showBottomBorder() {
|
|
219
|
+
const responseType = stepGenericItem.response_type;
|
|
220
|
+
switch (responseType) {
|
|
221
|
+
case MessageResponseTypes.TEXT:
|
|
222
|
+
return true;
|
|
223
|
+
|
|
224
|
+
case MessageResponseTypes.IMAGE:
|
|
225
|
+
return stepGenericItem?.description;
|
|
226
|
+
|
|
227
|
+
case MessageResponseTypes.VIDEO:
|
|
228
|
+
return stepGenericItem?.description;
|
|
229
|
+
|
|
230
|
+
default:
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function renderStepContent() {
|
|
235
|
+
const responseType = stepGenericItem.response_type;
|
|
236
|
+
switch (responseType) {
|
|
237
|
+
case MessageResponseTypes.TEXT:
|
|
238
|
+
return React.createElement(StepContentText, {
|
|
239
|
+
messageItem: stepGenericItem
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
case MessageResponseTypes.IMAGE:
|
|
243
|
+
return React.createElement(StepContentImage, {
|
|
244
|
+
messageItem: stepGenericItem
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
case MessageResponseTypes.VIDEO:
|
|
248
|
+
return React.createElement(StepContentVideo, {
|
|
249
|
+
messageItem: stepGenericItem,
|
|
250
|
+
isCurrentStep: isCurrentStep
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
default:
|
|
254
|
+
return React.createElement(StepContentUnsupportedError, {
|
|
255
|
+
messageItem: stepGenericItem,
|
|
256
|
+
isCurrentStep: isCurrentStep
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
if (isCurrentStep) {
|
|
262
|
+
setTimeout(() => ariaAnnouncer(rootRef.current));
|
|
263
|
+
}
|
|
264
|
+
}, [ isCurrentStep, stepGenericItem.response_type, ariaAnnouncer ]);
|
|
265
|
+
return React.createElement("div", {
|
|
266
|
+
className: "WACTourStep__Wrapper",
|
|
267
|
+
ref: rootRef
|
|
268
|
+
}, React.createElement("div", {
|
|
269
|
+
className: cx("WACTourStep", "WAC__message", {
|
|
270
|
+
"WACTourStep--hidden": !isCurrentStep,
|
|
271
|
+
WACTourStep__BottomBorder: showBottomBorder()
|
|
272
|
+
})
|
|
273
|
+
}, renderStepContent()));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function StepContentText(props) {
|
|
277
|
+
const {messageItem: messageItem} = props;
|
|
278
|
+
const {text: text} = messageItem;
|
|
279
|
+
return React.createElement("div", {
|
|
280
|
+
className: "WACTourStep__Text"
|
|
281
|
+
}, React.createElement(RichTextExport, {
|
|
282
|
+
text: text
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function StepContentImage(props) {
|
|
287
|
+
const {messageItem: messageItem} = props;
|
|
288
|
+
const {source: source, description: description, alt_text: alt_text} = messageItem;
|
|
289
|
+
const languagePack = useLanguagePack();
|
|
290
|
+
return React.createElement(ImageExport, {
|
|
291
|
+
imageError: languagePack.errors_imageSource,
|
|
292
|
+
source: source,
|
|
293
|
+
description: description,
|
|
294
|
+
altText: alt_text,
|
|
295
|
+
hideIconAndTitle: true
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function StepContentVideo(props) {
|
|
300
|
+
const {messageItem: messageItem, isCurrentStep: isCurrentStep} = props;
|
|
301
|
+
const {source: source, description: description, alt_text: alt_text} = messageItem;
|
|
302
|
+
const {viewState: viewState} = useSelector(state => state.persistedToBrowserStorage.launcherState);
|
|
303
|
+
const [isVideoPlaying, setIsVideoPlaying] = useState(false);
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
if (!isCurrentStep || !viewState.tour) {
|
|
306
|
+
setIsVideoPlaying(false);
|
|
307
|
+
}
|
|
308
|
+
}, [ isCurrentStep, viewState.tour ]);
|
|
309
|
+
return React.createElement(VideoComponentExport, {
|
|
310
|
+
source: source,
|
|
311
|
+
description: description,
|
|
312
|
+
baseHeight: getMediaDimensions(messageItem)?.base_height,
|
|
313
|
+
ariaLabel: alt_text,
|
|
314
|
+
playing: isVideoPlaying,
|
|
315
|
+
onPlay: () => setIsVideoPlaying(true),
|
|
316
|
+
onPause: () => setIsVideoPlaying(false),
|
|
317
|
+
hideIconAndTitle: true
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function StepContentUnsupportedError(props) {
|
|
322
|
+
const {messageItem: messageItem, isCurrentStep: isCurrentStep} = props;
|
|
323
|
+
const languagePack = useLanguagePack();
|
|
324
|
+
useEffect(() => {
|
|
325
|
+
if (isCurrentStep) {
|
|
326
|
+
consoleError(`The response type you tried to use "${messageItem.response_type}" is not valid within a tour step. The supported response types in tour steps are text, video, and image.`);
|
|
327
|
+
}
|
|
328
|
+
}, [ isCurrentStep, messageItem.response_type ]);
|
|
329
|
+
return React.createElement("div", {
|
|
330
|
+
className: "WACTourStep__UnsupportedResponse"
|
|
331
|
+
}, React.createElement(InlineError, {
|
|
332
|
+
text: languagePack.errors_generalContent
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const TourStepContentComponentExport = React.memo(TourStepContentComponent);
|
|
337
|
+
|
|
338
|
+
/*
|
|
339
|
+
* Copyright IBM Corp. 2025
|
|
340
|
+
*
|
|
341
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
342
|
+
* LICENSE file in the root directory of this source tree.
|
|
343
|
+
*
|
|
344
|
+
* @license
|
|
345
|
+
*/ function TourStepSkeletonComponent() {
|
|
346
|
+
return React.createElement("div", {
|
|
347
|
+
className: "WACTourStep WACTourStep__Skeleton"
|
|
348
|
+
}, React.createElement(SkeletonPlaceholder, {
|
|
349
|
+
className: "WACTourStep__SkeletonPlaceholder"
|
|
350
|
+
}));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/*
|
|
354
|
+
* Copyright IBM Corp. 2025
|
|
355
|
+
*
|
|
356
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
357
|
+
* LICENSE file in the root directory of this source tree.
|
|
358
|
+
*
|
|
359
|
+
* @license
|
|
360
|
+
*/ function TourContainer(props, ref) {
|
|
361
|
+
const languagePack = useLanguagePack();
|
|
362
|
+
const serviceManager = useServiceManager();
|
|
363
|
+
const ariaAnnouncer = useAriaAnnouncer();
|
|
364
|
+
const intl = useIntl();
|
|
365
|
+
const tourConfig = useSelector(state => state.config.public.tourConfig);
|
|
366
|
+
const {isHydrated: isHydrated} = useSelector(state => state);
|
|
367
|
+
const {viewState: viewState} = useSelector(state => state.persistedToBrowserStorage.launcherState);
|
|
368
|
+
const {activeTourCurrentStepIndex: activeTourCurrentStepIndex} = useSelector(state => state.persistedToBrowserStorage.chatState.persistedTourState);
|
|
369
|
+
const {activeTourStepItems: activeTourStepItems} = useSelector(state => state.tourState);
|
|
370
|
+
const [renderLoadingBar, setRenderLoadingBar] = useState(false);
|
|
371
|
+
const [renderErrorBanner, setRenderErrorBanner] = useState(false);
|
|
372
|
+
const [renderErrorScreen, setRenderErrorScreen] = useState(false);
|
|
373
|
+
const rootRef = useRef();
|
|
374
|
+
const tourControlsRef = useRef();
|
|
375
|
+
const namespace = serviceManager.namespace.originalName;
|
|
376
|
+
const languageKey = namespace ? "window_ariaTourRegionNamespace" : "window_ariaTourRegion";
|
|
377
|
+
const regionLabel = formatMessage(intl, languageKey, {
|
|
378
|
+
namespace: namespace
|
|
379
|
+
});
|
|
380
|
+
const hideTour = !viewState.tour;
|
|
381
|
+
let reservePreviousButtonSpace = true;
|
|
382
|
+
let hidePreviousButton = false;
|
|
383
|
+
let renderDoneButton = false;
|
|
384
|
+
let stepContentComponentsArray = [];
|
|
385
|
+
if (isHydrated && activeTourStepItems) {
|
|
386
|
+
reservePreviousButtonSpace = activeTourStepItems.length > 1;
|
|
387
|
+
hidePreviousButton = activeTourCurrentStepIndex <= 0;
|
|
388
|
+
renderDoneButton = activeTourCurrentStepIndex >= activeTourStepItems.length - 1;
|
|
389
|
+
stepContentComponentsArray = activeTourStepItems.map((step, index) => React.createElement(TourStepContentComponentExport, {
|
|
390
|
+
key: index,
|
|
391
|
+
stepGenericItem: step,
|
|
392
|
+
isCurrentStep: index === activeTourCurrentStepIndex
|
|
393
|
+
}));
|
|
394
|
+
} else if (!isHydrated) {
|
|
395
|
+
stepContentComponentsArray = [ React.createElement(TourStepSkeletonComponent, {
|
|
396
|
+
key: 0
|
|
397
|
+
}) ];
|
|
398
|
+
}
|
|
399
|
+
async function onOpenMainWindowClick() {
|
|
400
|
+
await serviceManager.actions.changeView(ViewType.MAIN_WINDOW, {
|
|
401
|
+
mainWindowOpenReason: MainWindowOpenReason.TOUR_OPENED_OTHER_VIEW
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
async function onDoneClick() {
|
|
405
|
+
await serviceManager.eventBus.fire({
|
|
406
|
+
type: BusEventType.TOUR_END,
|
|
407
|
+
reason: TourEndReason.DONE_CLICKED
|
|
408
|
+
}, serviceManager.instance);
|
|
409
|
+
await serviceManager.actions.endTour({
|
|
410
|
+
viewChangeReason: ViewChangeReason.TOUR_DONE
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
async function onCloseClick() {
|
|
414
|
+
await serviceManager.actions.endTour({
|
|
415
|
+
viewChangeReason: ViewChangeReason.TOUR_CLOSED
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
async function onMinimizeClick() {
|
|
419
|
+
await serviceManager.actions.changeView(ViewType.LAUNCHER, {
|
|
420
|
+
viewChangeReason: ViewChangeReason.TOUR_MINIMIZED
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function renderTourControlsComponent() {
|
|
424
|
+
return React.createElement(TourControlsComponentExport, {
|
|
425
|
+
ref: tourControlsRef,
|
|
426
|
+
hideChatButton: tourConfig?.hideChatButton,
|
|
427
|
+
reservePreviousButtonSpace: reservePreviousButtonSpace,
|
|
428
|
+
hidePreviousButton: hidePreviousButton,
|
|
429
|
+
disableNextButton: renderLoadingBar,
|
|
430
|
+
hideButtons: !isHydrated,
|
|
431
|
+
renderDoneButton: renderDoneButton,
|
|
432
|
+
onNextClick: () => {
|
|
433
|
+
serviceManager.actions.changeStepInTour({
|
|
434
|
+
nextStep: true
|
|
435
|
+
});
|
|
436
|
+
if (activeTourCurrentStepIndex + 1 === activeTourStepItems.length - 1) {
|
|
437
|
+
tourControlsRef.current?.requestFocus();
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
onPreviousClick: () => {
|
|
441
|
+
serviceManager.actions.changeStepInTour({
|
|
442
|
+
previousStep: true
|
|
443
|
+
});
|
|
444
|
+
if (activeTourCurrentStepIndex - 1 === 0) {
|
|
445
|
+
tourControlsRef.current?.requestFocus();
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
onOpenMainWindowClick: onOpenMainWindowClick,
|
|
449
|
+
onDoneClick: onDoneClick
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
function renderTourCloseMinimizeComponent() {
|
|
453
|
+
return React.createElement(TourCloseMinimizeComponent, {
|
|
454
|
+
hideMinimizeButton: tourConfig?.hideMinimizeButton,
|
|
455
|
+
onCloseClick: onCloseClick,
|
|
456
|
+
onMinimizeClick: onMinimizeClick
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
function renderTourStepStatusContainer() {
|
|
460
|
+
return React.createElement("div", {
|
|
461
|
+
className: "WACTour__StatusContainer"
|
|
462
|
+
}, renderErrorBanner && React.createElement(AnnounceOnMountComponentExport, null, React.createElement(InlineNotification, {
|
|
463
|
+
kind: "error",
|
|
464
|
+
title: languagePack.tour_errorFetchingStep,
|
|
465
|
+
lowContrast: true,
|
|
466
|
+
hideCloseButton: true,
|
|
467
|
+
onClick: () => setRenderErrorBanner(false)
|
|
468
|
+
})), renderLoadingBar && React.createElement(MountChildrenOnDelay, {
|
|
469
|
+
delay: 500
|
|
470
|
+
}, React.createElement("div", {
|
|
471
|
+
className: "WACLoadingBar__ConnectingAnimation"
|
|
472
|
+
})));
|
|
473
|
+
}
|
|
474
|
+
function renderTourErrorScreen() {
|
|
475
|
+
return React.createElement(AnnounceOnMountComponentExport, null, React.createElement("div", {
|
|
476
|
+
className: "WACTour__ErrorScreen"
|
|
477
|
+
}, React.createElement("div", {
|
|
478
|
+
className: "WACTour__ErrorHeader"
|
|
479
|
+
}, React.createElement(ErrorFilled, {
|
|
480
|
+
size: 20,
|
|
481
|
+
className: "WACTour__ErrorIcon"
|
|
482
|
+
}), languagePack.tour_errorTitle), React.createElement("div", {
|
|
483
|
+
className: "WACTour__ErrorBody"
|
|
484
|
+
}, React.createElement("div", {
|
|
485
|
+
className: "WACTour__ErrorText"
|
|
486
|
+
}, languagePack.tour_errorBody), React.createElement(Button, {
|
|
487
|
+
className: "WACTour__ErrorButton",
|
|
488
|
+
size: "sm",
|
|
489
|
+
kind: "tertiary",
|
|
490
|
+
renderIcon: props => React.createElement(Restart, {
|
|
491
|
+
size: 32,
|
|
492
|
+
...props
|
|
493
|
+
})
|
|
494
|
+
}, languagePack.buttons_retry))));
|
|
495
|
+
}
|
|
496
|
+
useImperativeHandle(ref, () => tourControlsRef.current);
|
|
497
|
+
useEffect(() => {
|
|
498
|
+
if (isHydrated && !hideTour && !renderErrorScreen) {
|
|
499
|
+
const tourInstructionsText = intl.formatMessage({
|
|
500
|
+
id: "tour_instructions"
|
|
501
|
+
}, {
|
|
502
|
+
chatButtonText: languagePack.tour_ariaChatButton
|
|
503
|
+
});
|
|
504
|
+
ariaAnnouncer(tourInstructionsText);
|
|
505
|
+
}
|
|
506
|
+
}, [ hideTour, ariaAnnouncer, languagePack, intl, isHydrated, renderErrorScreen ]);
|
|
507
|
+
useEffect(() => {
|
|
508
|
+
if (isHydrated || !hideTour) {
|
|
509
|
+
tourControlsRef.current?.requestFocus();
|
|
510
|
+
}
|
|
511
|
+
}, [ hideTour, isHydrated ]);
|
|
512
|
+
return React.createElement(HideComponent, {
|
|
513
|
+
hidden: hideTour
|
|
514
|
+
}, React.createElement("div", {
|
|
515
|
+
ref: rootRef,
|
|
516
|
+
className: "WACTour",
|
|
517
|
+
role: "region",
|
|
518
|
+
"aria-label": regionLabel
|
|
519
|
+
}, renderTourCloseMinimizeComponent(), renderErrorScreen && renderTourErrorScreen(), !renderErrorScreen && React.createElement(React.Fragment, null, stepContentComponentsArray, renderTourStepStatusContainer(), renderTourControlsComponent())));
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const TourContainerExport = React.memo(React.forwardRef(TourContainer));
|
|
523
|
+
|
|
524
|
+
export { TourContainerExport as default };
|