@microsoft/omnichannel-chat-widget 1.8.6 → 2.0.0-main.5ebd4eb
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/README.md +52 -5
- package/lib/cjs/common/Constants.js +5 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +234 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +19 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +6 -1
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +2 -3
- package/lib/cjs/common/telemetry/sanitizeSasInPayload.js +91 -0
- package/lib/cjs/common/utils.js +93 -17
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +16 -6
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -10
- package/lib/cjs/components/citationpanestateful/CitationDim.js +2 -3
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +27 -5
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +23 -3
- package/lib/cjs/components/dimlayer/DimLayer.js +1 -3
- package/lib/cjs/components/draggable/DraggableChatWidget.js +35 -15
- package/lib/cjs/components/draggable/DraggableEventEmitter.js +10 -1
- package/lib/cjs/components/draggable/DraggableEventReceiver.js +1 -3
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +54 -17
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +4 -12
- package/lib/cjs/components/footerstateful/FooterStateful.js +18 -9
- package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +2 -4
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +4 -6
- package/lib/cjs/components/headerstateful/HeaderStateful.js +24 -12
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +27 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +5 -11
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +11 -4
- package/lib/cjs/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +98 -5
- package/lib/cjs/components/livechatwidget/common/endChat.js +12 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +182 -1
- package/lib/cjs/components/livechatwidget/common/recoveryEligibilityTelemetry.js +60 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +31 -14
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +160 -21
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +16 -11
- package/lib/cjs/components/notificationpanestateful/NotificationPaneStateful.js +19 -12
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +13 -6
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +28 -5
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +12 -5
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +105 -11
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +12 -1
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -7
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +16 -7
- package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +10 -2
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +154 -29
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +115 -10
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/citationA11y.js +195 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IWebChatAction.js +17 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +27 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +180 -190
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +3 -5
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +22 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -23
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -35
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +199 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +29 -15
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +5 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +5 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +14 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +16 -14
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +18 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +10 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +16 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +6 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +83 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +36 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +5 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +10 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +5 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +7 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +10 -14
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -10
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +57 -11
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +25 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +10 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +6 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +2 -4
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +5 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +17 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/controller/componentController.js +13 -1
- package/lib/cjs/hooks/useWindowDimensions.js +13 -5
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/plugins/createChatTranscript.js +3 -4
- package/lib/cjs/plugins/newMessageEventHandler.js +20 -3
- package/lib/esm/common/Constants.js +5 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +235 -10
- package/lib/esm/common/telemetry/TelemetryConstants.js +19 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +2 -3
- package/lib/esm/common/telemetry/sanitizeSasInPayload.js +84 -0
- package/lib/esm/common/utils.js +88 -14
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +15 -5
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +19 -9
- package/lib/esm/components/citationpanestateful/CitationDim.js +2 -3
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +26 -4
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -2
- package/lib/esm/components/dimlayer/DimLayer.js +1 -3
- package/lib/esm/components/draggable/DraggableChatWidget.js +34 -14
- package/lib/esm/components/draggable/DraggableEventEmitter.js +10 -1
- package/lib/esm/components/draggable/DraggableEventReceiver.js +1 -3
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +54 -17
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -12
- package/lib/esm/components/footerstateful/FooterStateful.js +17 -8
- package/lib/esm/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +2 -4
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +4 -6
- package/lib/esm/components/headerstateful/HeaderStateful.js +22 -10
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +27 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +5 -11
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +11 -4
- package/lib/esm/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/esm/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +98 -5
- package/lib/esm/components/livechatwidget/common/endChat.js +12 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +182 -1
- package/lib/esm/components/livechatwidget/common/recoveryEligibilityTelemetry.js +52 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +31 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +159 -20
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +14 -9
- package/lib/esm/components/notificationpanestateful/NotificationPaneStateful.js +17 -10
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +12 -5
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +28 -5
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +11 -4
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +105 -11
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +12 -1
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -6
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +15 -6
- package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +9 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +154 -29
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +10 -0
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +115 -10
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/citationA11y.js +188 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IWebChatAction.js +10 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +27 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +180 -190
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +3 -5
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +19 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -23
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -32
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +193 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +28 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +5 -12
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +5 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +13 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +15 -13
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +17 -27
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +9 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +16 -10
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +6 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +77 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +36 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +5 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +10 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +5 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +7 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +10 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -10
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +57 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +25 -31
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +10 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +6 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +2 -4
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +5 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +17 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/controller/componentController.js +13 -1
- package/lib/esm/hooks/useWindowDimensions.js +13 -5
- package/lib/esm/plugins/createChatTranscript.js +3 -4
- package/lib/esm/plugins/newMessageEventHandler.js +20 -3
- package/lib/types/common/Constants.d.ts +4 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +29 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +15 -2
- package/lib/types/common/telemetry/sanitizeSasInPayload.d.ts +24 -0
- package/lib/types/common/utils.d.ts +3 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
- package/lib/types/components/livechatwidget/common/recoveryEligibilityTelemetry.d.ts +17 -0
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +1 -0
- package/lib/types/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/citationA11y.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatAction.d.ts +16 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +14 -38
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.d.ts +18 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.d.ts +2 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.d.ts +7 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +17 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +71 -57
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _Constants = require("../../../../common/Constants");
|
|
8
|
+
var _SupportedAdaptiveCards = require("@microsoft/omnichannel-chat-sdk/lib/utils/printers/interfaces/SupportedAdaptiveCards");
|
|
8
9
|
var _botActivity = _interopRequireDefault(require("../activities/botActivity"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -23,15 +24,22 @@ const convertStringValueToInt = value => {
|
|
|
23
24
|
|
|
24
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
26
|
const convertPersistentChatHistoryMessageToActivity = message => {
|
|
26
|
-
var _from$user, _from$
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
content,
|
|
31
|
-
created,
|
|
32
|
-
from,
|
|
33
|
-
transcriptOriginalMessageId
|
|
34
|
-
|
|
27
|
+
var _from$application, _from$user, _from$application2;
|
|
28
|
+
const additionalData = message.additionalData,
|
|
29
|
+
attachments = message.attachments,
|
|
30
|
+
botContentType = message.botContentType,
|
|
31
|
+
content = message.content,
|
|
32
|
+
created = message.created,
|
|
33
|
+
from = message.from,
|
|
34
|
+
transcriptOriginalMessageId = message.transcriptOriginalMessageId;
|
|
35
|
+
const isFromCustomer = (from === null || from === void 0 || (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer";
|
|
36
|
+
|
|
37
|
+
// Filter out customer responses to adaptive cards (e.g., form submissions like {"value":{"goPaperless":"yes"}}).
|
|
38
|
+
// These are the customer's postBack/messageBack replies to bot adaptive cards — not displayable content.
|
|
39
|
+
// In live chat, webchat hides these natively; in history we must filter them explicitly.
|
|
40
|
+
if (isFromCustomer && botContentType === "azurebotservice.adaptivecard") {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
35
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
44
|
const activity = {
|
|
37
45
|
..._botActivity.default,
|
|
@@ -68,13 +76,110 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
68
76
|
name: from.user.displayName
|
|
69
77
|
};
|
|
70
78
|
}
|
|
71
|
-
if ((from === null || from === void 0 || (_from$
|
|
79
|
+
if ((from === null || from === void 0 || (_from$application2 = from.application) === null || _from$application2 === void 0 ? void 0 : _from$application2.displayName) === "Customer") {
|
|
72
80
|
activity.from = {
|
|
73
81
|
role: "user",
|
|
74
82
|
name: from.application.displayName
|
|
75
83
|
};
|
|
76
84
|
}
|
|
77
85
|
if (content) {
|
|
86
|
+
var _parsedContent;
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
|
+
let parsedContent;
|
|
89
|
+
try {
|
|
90
|
+
parsedContent = JSON.parse(content);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
parsedContent = null; // fall back to normal text handling
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Check if this is a customer form submission response (e.g., RichObjectMessage_Form)
|
|
96
|
+
// These should be ignored as they are form submission data, not displayable content
|
|
97
|
+
if (isFromCustomer && ((_parsedContent = parsedContent) === null || _parsedContent === void 0 || (_parsedContent = _parsedContent.value) === null || _parsedContent === void 0 ? void 0 : _parsedContent.type) === "RichObjectMessage_Form") {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (parsedContent && typeof parsedContent === "object") {
|
|
101
|
+
var _parsedContent$sugges;
|
|
102
|
+
// Structural detection: check the parsed object's properties directly
|
|
103
|
+
const hasAttachments = Array.isArray(parsedContent.attachments) && parsedContent.attachments.length > 0;
|
|
104
|
+
const hasSuggestedActions = Array.isArray((_parsedContent$sugges = parsedContent.suggestedActions) === null || _parsedContent$sugges === void 0 ? void 0 : _parsedContent$sugges.actions) && parsedContent.suggestedActions.actions.length > 0;
|
|
105
|
+
const isRawAdaptiveCardBody = parsedContent.type === "AdaptiveCard";
|
|
106
|
+
|
|
107
|
+
// Filter out suggested-action-only messages from history.
|
|
108
|
+
// WebChat only renders suggestedActions for the most recent activity, so in history
|
|
109
|
+
// these render as empty "Suggested reply" text bubbles with no actionable buttons.
|
|
110
|
+
if (hasSuggestedActions && !hasAttachments) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Substring detection: check the raw content string for known card type patterns
|
|
115
|
+
const contentLower = content.toLowerCase();
|
|
116
|
+
const isAdaptiveCard = contentLower.includes(_Constants.Constants.AdaptiveCardType);
|
|
117
|
+
const isSuggestedActions = contentLower.includes(_Constants.Constants.SuggestedActionsType);
|
|
118
|
+
const containsSupportedCard = Object.values(_SupportedAdaptiveCards.SupportedAdaptiveCards).some(type => contentLower.includes(type.toLowerCase()));
|
|
119
|
+
|
|
120
|
+
// If the content is a raw adaptive card body (type: "AdaptiveCard"), wrap it as an attachment
|
|
121
|
+
// so webchat can render it properly instead of treating it as an unknown activity type
|
|
122
|
+
if (isRawAdaptiveCardBody) {
|
|
123
|
+
return {
|
|
124
|
+
...activity,
|
|
125
|
+
text: "",
|
|
126
|
+
attachments: [{
|
|
127
|
+
contentType: _SupportedAdaptiveCards.SupportedAdaptiveCards.Adaptive,
|
|
128
|
+
content: parsedContent
|
|
129
|
+
}],
|
|
130
|
+
timestamp,
|
|
131
|
+
channelData: {
|
|
132
|
+
...activity.channelData,
|
|
133
|
+
"webchat:sequence-id": webchatSequenceId
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Detect rich content using both structural checks and substring matching
|
|
139
|
+
if (hasAttachments || hasSuggestedActions || isAdaptiveCard || isSuggestedActions || containsSupportedCard) {
|
|
140
|
+
var _activity$from;
|
|
141
|
+
// Preserve from.role from the base activity — parsedContent.from may lack the role property
|
|
142
|
+
// which webchat needs to determine how to render the message (bot vs user)
|
|
143
|
+
const preservedFrom = {
|
|
144
|
+
...activity.from,
|
|
145
|
+
...(parsedContent.from || {}),
|
|
146
|
+
role: ((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) || "bot"
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
...activity,
|
|
150
|
+
...parsedContent,
|
|
151
|
+
from: preservedFrom,
|
|
152
|
+
timestamp,
|
|
153
|
+
channelData: {
|
|
154
|
+
...activity.channelData,
|
|
155
|
+
"webchat:sequence-id": webchatSequenceId
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// If parsedContent is a webchat activity (type: "message") but didn't match any specific card check,
|
|
161
|
+
// still treat it as a rich activity to avoid displaying raw JSON as text
|
|
162
|
+
if (parsedContent.type === "message" && (parsedContent.attachments || parsedContent.suggestedActions || parsedContent.value)) {
|
|
163
|
+
var _activity$from2;
|
|
164
|
+
const preservedFrom = {
|
|
165
|
+
...activity.from,
|
|
166
|
+
...(parsedContent.from || {}),
|
|
167
|
+
role: ((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) || "bot"
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
...activity,
|
|
171
|
+
...parsedContent,
|
|
172
|
+
from: preservedFrom,
|
|
173
|
+
timestamp,
|
|
174
|
+
channelData: {
|
|
175
|
+
...activity.channelData,
|
|
176
|
+
"webchat:sequence-id": webchatSequenceId
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Plain text message
|
|
78
183
|
return {
|
|
79
184
|
...activity,
|
|
80
185
|
text: content,
|
|
@@ -33,8 +33,11 @@ const defaultMiddlewareLocalizedTexts = exports.defaultMiddlewareLocalizedTexts
|
|
|
33
33
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
34
34
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
|
|
35
35
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
36
|
+
MIDDLEWARE_BANNER_FILE_SENT: "File sent successfully.",
|
|
36
37
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
37
38
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later.",
|
|
39
|
+
MIDDLEWARE_SR_PREFIX_SUCCESS: "Success. ",
|
|
40
|
+
MIDDLEWARE_SR_PREFIX_ERROR: "Error. ",
|
|
38
41
|
PREVIOUS_MESSAGES_LOADING: "Loading previous messages...",
|
|
39
42
|
CONVERSATION_DIVIDER_ARIA_LABEL: "Conversation history divider"
|
|
40
43
|
};
|
|
@@ -20,5 +20,6 @@ const defaultWebChatContainerStatefulProps = exports.defaultWebChatContainerStat
|
|
|
20
20
|
honorsTargetInHTMLLinks: false,
|
|
21
21
|
hyperlinkTextOverride: false,
|
|
22
22
|
directLine: new _mockadapter.default(),
|
|
23
|
-
adaptiveCardStyles: _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles
|
|
23
|
+
adaptiveCardStyles: _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles,
|
|
24
|
+
webChatNotificationRegionAccessibilityLabel: "Chat notifications"
|
|
24
25
|
};
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.defaultAdaptiveCardStyles = void 0;
|
|
7
|
+
var _Constants = require("../../../../common/Constants");
|
|
7
8
|
const defaultAdaptiveCardStyles = exports.defaultAdaptiveCardStyles = {
|
|
8
9
|
background: "white",
|
|
9
10
|
color: "black",
|
|
@@ -11,5 +12,6 @@ const defaultAdaptiveCardStyles = exports.defaultAdaptiveCardStyles = {
|
|
|
11
12
|
textWhiteSpace: "normal",
|
|
12
13
|
buttonWhiteSpace: "normal",
|
|
13
14
|
buttonFlexWrap: "nowrap",
|
|
14
|
-
buttonGap: "0px"
|
|
15
|
+
buttonGap: "0px",
|
|
16
|
+
inputFontSize: _Constants.Constants.minInputFontSize
|
|
15
17
|
};
|
package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js
CHANGED
|
@@ -23,7 +23,7 @@ const defaultWebChatStyles = exports.defaultWebChatStyles = {
|
|
|
23
23
|
bubbleTextColor: "White",
|
|
24
24
|
hideSendBox: false,
|
|
25
25
|
hideUploadButton: true,
|
|
26
|
-
primaryFont: "Segoe UI, Arial, sans-serif
|
|
26
|
+
primaryFont: "Segoe UI, Arial, sans-serif",
|
|
27
27
|
rootHeight: "100%",
|
|
28
28
|
rootWidth: "100%",
|
|
29
29
|
sendBoxTextWrap: true,
|
|
@@ -34,7 +34,7 @@ const defaultWebChatStyles = exports.defaultWebChatStyles = {
|
|
|
34
34
|
suggestedActionsStackedHeight: 125,
|
|
35
35
|
suggestedActionsStackedOverflow: "scroll",
|
|
36
36
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
37
|
-
typingAnimationDuration:
|
|
37
|
+
typingAnimationDuration: 4500,
|
|
38
38
|
emojiSet: {
|
|
39
39
|
":)": "😊",
|
|
40
40
|
":-)": "😊",
|
|
@@ -41,11 +41,13 @@ exports.postEchoActivity = postEchoActivity;
|
|
|
41
41
|
const postBotMessageActivity = function (activityObserver, text) {
|
|
42
42
|
let tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
43
43
|
let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
|
|
44
|
+
let fromOverride = arguments.length > 4 ? arguments[4] : undefined;
|
|
44
45
|
setTimeout(() => {
|
|
45
46
|
activityObserver === null || activityObserver === void 0 || activityObserver.next({
|
|
46
47
|
id: (0, _omnichannelChatSdk.uuidv4)(),
|
|
47
48
|
from: {
|
|
48
|
-
...botUser
|
|
49
|
+
...botUser,
|
|
50
|
+
...(fromOverride ?? {})
|
|
49
51
|
},
|
|
50
52
|
text,
|
|
51
53
|
type: "message",
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.patchCitationAnchorsForA11y = void 0;
|
|
7
|
+
// Accessibility helper: Merges WebChat's citation card number badge and link
|
|
8
|
+
// text into a single focusable element.
|
|
9
|
+
//
|
|
10
|
+
// WebChat's LinkDefinitionItem renders an <a> containing a badge <div> (number)
|
|
11
|
+
// and a text <div> (title). On iOS VoiceOver, these block-level descendants are
|
|
12
|
+
// announced as two separate focusable links (e.g. "1, link" and
|
|
13
|
+
// "Assessment of eligibility..., link"). Setting a combined aria-label on the
|
|
14
|
+
// anchor and hiding inner descendants from the accessibility tree ensures the
|
|
15
|
+
// whole card is announced as one link.
|
|
16
|
+
|
|
17
|
+
const CITATION_ANCHOR_SELECTOR = "a.webchat__link-definitions__list-item-box";
|
|
18
|
+
const PATCHED_MARKER = "ocwCitationA11yPatched";
|
|
19
|
+
const STYLE_TAG_ID = "ocw-citation-a11y-styles";
|
|
20
|
+
|
|
21
|
+
// Global CSS injected once per document. Neutralizes iOS Safari's per-inner-
|
|
22
|
+
// element tap highlight / selection / focus rectangles that otherwise make
|
|
23
|
+
// the "1" badge and the link text appear as separate selectable areas even
|
|
24
|
+
// though they are inside a single <a>.
|
|
25
|
+
// Strategy:
|
|
26
|
+
// - Make the anchor a block-level positioning parent.
|
|
27
|
+
// - Add a transparent ::after pseudo-element that covers the entire anchor.
|
|
28
|
+
// iOS Safari hit-tests that overlay as a SINGLE region, so the tap
|
|
29
|
+
// highlight / selection rectangle always covers the whole card instead
|
|
30
|
+
// of just the "1" badge or just the link text.
|
|
31
|
+
// - Make every descendant transparent to pointer / focus, so they can never
|
|
32
|
+
// become a standalone tap target.
|
|
33
|
+
const STYLE_RULES = `
|
|
34
|
+
a.webchat__link-definitions__list-item-box {
|
|
35
|
+
position: relative;
|
|
36
|
+
display: block;
|
|
37
|
+
isolation: isolate;
|
|
38
|
+
-webkit-tap-highlight-color: rgba(0, 120, 212, 0.15);
|
|
39
|
+
-webkit-touch-callout: none;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
a.webchat__link-definitions__list-item-box::after {
|
|
43
|
+
content: "";
|
|
44
|
+
position: absolute;
|
|
45
|
+
inset: 0;
|
|
46
|
+
z-index: 2;
|
|
47
|
+
background: transparent;
|
|
48
|
+
pointer-events: auto;
|
|
49
|
+
-webkit-tap-highlight-color: rgba(0, 120, 212, 0.15);
|
|
50
|
+
}
|
|
51
|
+
a.webchat__link-definitions__list-item-box * {
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
-webkit-tap-highlight-color: transparent;
|
|
54
|
+
-webkit-touch-callout: none;
|
|
55
|
+
outline: none;
|
|
56
|
+
text-decoration: inherit;
|
|
57
|
+
cursor: inherit;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const ensureStyleInjected = doc => {
|
|
61
|
+
if (!doc || typeof doc.getElementById !== "function" || doc.getElementById(STYLE_TAG_ID)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const style = doc.createElement("style");
|
|
65
|
+
style.id = STYLE_TAG_ID;
|
|
66
|
+
style.textContent = STYLE_RULES;
|
|
67
|
+
(doc.head || doc.documentElement).appendChild(style);
|
|
68
|
+
};
|
|
69
|
+
const patchCitationAnchorsForA11y = root => {
|
|
70
|
+
var _defaultView;
|
|
71
|
+
if (!root || typeof root.querySelectorAll !== "function") {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Inject global CSS once per document. This covers every citation anchor
|
|
76
|
+
// regardless of whether our per-node patch has run on it yet.
|
|
77
|
+
const rootNode = root;
|
|
78
|
+
const doc = rootNode.ownerDocument ?? ((_defaultView = root.defaultView) === null || _defaultView === void 0 ? void 0 : _defaultView.document) ?? root ?? (typeof document !== "undefined" ? document : null);
|
|
79
|
+
if (doc && typeof doc.createElement === "function") {
|
|
80
|
+
ensureStyleInjected(doc);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Also include the root itself when it matches — calls from MutationObserver
|
|
84
|
+
// pass the anchor element directly, which querySelectorAll wouldn't return.
|
|
85
|
+
const matched = new Set();
|
|
86
|
+
if (typeof root.matches === "function" && root.matches(CITATION_ANCHOR_SELECTOR)) {
|
|
87
|
+
matched.add(root);
|
|
88
|
+
}
|
|
89
|
+
root.querySelectorAll(CITATION_ANCHOR_SELECTOR).forEach(n => {
|
|
90
|
+
matched.add(n);
|
|
91
|
+
});
|
|
92
|
+
matched.forEach(anchor => {
|
|
93
|
+
var _badge$textContent, _textEl$textContent;
|
|
94
|
+
const badge = anchor.querySelector(".webchat__link-definitions__badge");
|
|
95
|
+
const textEl = anchor.querySelector(".webchat__link-definitions__list-item-text");
|
|
96
|
+
const identifier = (badge === null || badge === void 0 || (_badge$textContent = badge.textContent) === null || _badge$textContent === void 0 ? void 0 : _badge$textContent.trim()) ?? "";
|
|
97
|
+
// Prefer the explicit text element. For plain (non-card) citation anchors
|
|
98
|
+
// (no badge), fall back to the title or the anchor's own text. When a
|
|
99
|
+
// badge is present but no text element, avoid using anchor.textContent
|
|
100
|
+
// since it would duplicate the identifier.
|
|
101
|
+
let text = (textEl === null || textEl === void 0 || (_textEl$textContent = textEl.textContent) === null || _textEl$textContent === void 0 ? void 0 : _textEl$textContent.trim()) ?? "";
|
|
102
|
+
if (!text && !badge) {
|
|
103
|
+
var _anchor$getAttribute, _anchor$textContent;
|
|
104
|
+
text = ((_anchor$getAttribute = anchor.getAttribute("title")) === null || _anchor$getAttribute === void 0 ? void 0 : _anchor$getAttribute.trim()) || ((_anchor$textContent = anchor.textContent) === null || _anchor$textContent === void 0 ? void 0 : _anchor$textContent.trim()) || "";
|
|
105
|
+
}
|
|
106
|
+
if (!identifier && !text) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const combinedLabel = identifier && text ? `${identifier}, ${text}` : identifier || text;
|
|
110
|
+
|
|
111
|
+
// Always (re-)apply aria-label if absent. Setting it again with the same
|
|
112
|
+
// value when it already matches is a no-op for the DOM; this keeps the
|
|
113
|
+
// patch idempotent so React re-renders that strip the attribute heal.
|
|
114
|
+
const existingLabel = anchor.getAttribute("aria-label");
|
|
115
|
+
if (!existingLabel) {
|
|
116
|
+
anchor.setAttribute("aria-label", combinedLabel);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Explicitly mark the anchor as a single link so iOS VoiceOver treats
|
|
120
|
+
// the whole card as one element.
|
|
121
|
+
if (!anchor.getAttribute("role")) {
|
|
122
|
+
anchor.setAttribute("role", "link");
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Nuclear a11y lockdown of EVERY descendant of the anchor (not just
|
|
126
|
+
// known class names, because WebChat can render additional nodes).
|
|
127
|
+
// iOS VoiceOver is known to split focus on block-level descendants
|
|
128
|
+
// inside an <a>. Applying all of the following guarantees only the
|
|
129
|
+
// outer <a> is a selectable a11y / focus target:
|
|
130
|
+
// - aria-hidden="true" removes element from the a11y tree
|
|
131
|
+
// - role="presentation" strips any implicit semantic role
|
|
132
|
+
// - inert removes element from focus + interaction
|
|
133
|
+
// - tabindex="-1" defensive (covers browsers without inert)
|
|
134
|
+
// - title removed iOS VoiceOver in WKWebView still surfaces
|
|
135
|
+
// elements with a `title` attribute as a
|
|
136
|
+
// separately swipeable item even when
|
|
137
|
+
// aria-hidden=true. WebChat's ItemBody sets
|
|
138
|
+
// title={text} on the inner link-text div,
|
|
139
|
+
// which is the root cause of the "two
|
|
140
|
+
// separate links" announcement on iOS.
|
|
141
|
+
// We move the title to a data-* attribute
|
|
142
|
+
// so any tooltip-like tooling can still
|
|
143
|
+
// read it, but iOS VO ignores it.
|
|
144
|
+
anchor.querySelectorAll("*").forEach(el => {
|
|
145
|
+
const inner = el;
|
|
146
|
+
if (inner.getAttribute("aria-hidden") !== "true") {
|
|
147
|
+
inner.setAttribute("aria-hidden", "true");
|
|
148
|
+
}
|
|
149
|
+
if (inner.getAttribute("role") !== "presentation") {
|
|
150
|
+
inner.setAttribute("role", "presentation");
|
|
151
|
+
}
|
|
152
|
+
if (inner.getAttribute("tabindex") !== "-1") {
|
|
153
|
+
inner.setAttribute("tabindex", "-1");
|
|
154
|
+
}
|
|
155
|
+
if (!inner.hasAttribute("inert")) {
|
|
156
|
+
inner.setAttribute("inert", "");
|
|
157
|
+
}
|
|
158
|
+
const innerTitle = inner.getAttribute("title");
|
|
159
|
+
if (innerTitle !== null) {
|
|
160
|
+
inner.removeAttribute("title");
|
|
161
|
+
if (!inner.dataset.ocwOriginalTitle) {
|
|
162
|
+
inner.dataset.ocwOriginalTitle = innerTitle;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (inner.style.pointerEvents !== "none") {
|
|
166
|
+
inner.style.pointerEvents = "none";
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// DOM-level full-bleed overlay. Inline styles are used so this works
|
|
171
|
+
// even when the widget renders inside a shadow DOM (where an
|
|
172
|
+
// injected <style> tag in document.head cannot reach). The overlay
|
|
173
|
+
// becomes the ONLY visible hit-test target for iOS Safari, so tapping
|
|
174
|
+
// anywhere on the card highlights the entire card instead of just the
|
|
175
|
+
// "1" badge or just the link text.
|
|
176
|
+
const anchorStyle = anchor.style;
|
|
177
|
+
if (!anchorStyle.position) {
|
|
178
|
+
anchorStyle.position = "relative";
|
|
179
|
+
}
|
|
180
|
+
if (!anchorStyle.display || anchorStyle.display === "inline") {
|
|
181
|
+
anchorStyle.display = "block";
|
|
182
|
+
}
|
|
183
|
+
const ownerDoc = anchor.ownerDocument;
|
|
184
|
+
const existingOverlay = anchor.querySelector(":scope > [data-ocw-citation-overlay='true']");
|
|
185
|
+
if (!existingOverlay && ownerDoc && typeof ownerDoc.createElement === "function") {
|
|
186
|
+
const overlay = ownerDoc.createElement("span");
|
|
187
|
+
overlay.setAttribute("aria-hidden", "true");
|
|
188
|
+
overlay.setAttribute("data-ocw-citation-overlay", "true");
|
|
189
|
+
overlay.style.cssText = ["position:absolute", "top:0", "left:0", "right:0", "bottom:0", "z-index:2", "background:transparent", "pointer-events:auto", "-webkit-tap-highlight-color:rgba(0,120,212,0.15)", "-webkit-touch-callout:none", "-webkit-user-select:none", "user-select:none", "cursor:pointer"].join(";");
|
|
190
|
+
anchor.appendChild(overlay);
|
|
191
|
+
}
|
|
192
|
+
anchor.dataset[PATCHED_MARKER] = "true";
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
exports.patchCitationAnchorsForA11y = patchCitationAnchorsForA11y;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isWebChatAction = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Type guard narrowing the `unknown` action received by a Redux 5 store middleware
|
|
9
|
+
* down to Web Chat's IWebChatAction shape, so middlewares can safely access `type`/`payload`.
|
|
10
|
+
*/
|
|
11
|
+
const isWebChatAction = action => typeof action === "object" && action !== null && "type" in action && typeof action.type === "string";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Structural middleware type matching the unknown-action contract expected by
|
|
15
|
+
* botframework-webchat's `createStore` without exposing Redux as a public dependency.
|
|
16
|
+
*/
|
|
17
|
+
exports.isWebChatAction = isWebChatAction;
|
package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
CHANGED
|
@@ -13,13 +13,25 @@ var _WebChatStoreLoader = require("./WebChatStoreLoader");
|
|
|
13
13
|
var _utils = require("../../../common/utils");
|
|
14
14
|
var _dispatchCustomEvent = _interopRequireDefault(require("../../../common/utils/dispatchCustomEvent"));
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
22
|
/**
|
|
17
23
|
* Component to handle persistent chat history events.
|
|
18
24
|
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
19
25
|
*/
|
|
20
26
|
const WebChatEventSubscribers = () => {
|
|
21
|
-
const
|
|
22
|
-
|
|
27
|
+
const _useState = (0, _react.useState)(false),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
isConnected = _useState2[0],
|
|
30
|
+
setIsConnected = _useState2[1];
|
|
31
|
+
const _useState3 = (0, _react.useState)(false),
|
|
32
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
33
|
+
storeReady = _useState4[0],
|
|
34
|
+
setStoreReady = _useState4[1];
|
|
23
35
|
const storeWaitTimer = (0, _utils.createTimer)();
|
|
24
36
|
// Type the chatConfig properly to avoid 'any' usage
|
|
25
37
|
|
|
@@ -76,15 +88,26 @@ const WebChatEventSubscribers = () => {
|
|
|
76
88
|
// Dispatch events when connection is established
|
|
77
89
|
setTimeout(() => {
|
|
78
90
|
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.FETCH_PERSISTENT_CHAT_HISTORY);
|
|
91
|
+
// The trigger activity renders the "Loading previous messages..." banner
|
|
92
|
+
// via LazyLoadActivity. We set webchat:sequence-id to 1 and timestamp
|
|
93
|
+
// to epoch+1ms so WebChat sorts this activity BEFORE all history messages
|
|
94
|
+
// (which have sequence-ids based on transcriptOriginalMessageId timestamps).
|
|
95
|
+
// Without these, WebChat places activities without a sequence-id at the
|
|
96
|
+
// end of the transcript, causing the banner to appear at the bottom and
|
|
97
|
+
// breaking the IntersectionObserver pagination trigger (the observer only
|
|
98
|
+
// fires on visibility transitions — if the element starts visible at the
|
|
99
|
+
// bottom, the initial fire is blocked by the paused state and never
|
|
100
|
+
// re-fires since there is no transition).
|
|
79
101
|
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.ADD_ACTIVITY, {
|
|
80
102
|
activity: {
|
|
81
103
|
from: {
|
|
82
104
|
role: "bot"
|
|
83
105
|
},
|
|
84
|
-
timestamp:
|
|
106
|
+
timestamp: new Date(1).toISOString(),
|
|
85
107
|
type: "message",
|
|
86
108
|
channelData: {
|
|
87
|
-
tags: [_Constants.Constants.persistentChatHistoryMessagePullTriggerTag]
|
|
109
|
+
tags: [_Constants.Constants.persistentChatHistoryMessagePullTriggerTag],
|
|
110
|
+
"webchat:sequence-id": 1
|
|
88
111
|
}
|
|
89
112
|
}
|
|
90
113
|
});
|
|
@@ -11,9 +11,7 @@ const FormatEgressTagsMiddleware = () => next => activity => {
|
|
|
11
11
|
const activity_instance = JSON.parse(JSON.stringify(activity));
|
|
12
12
|
if (activity_instance) {
|
|
13
13
|
if (activity_instance.channelData && activity_instance.channelData.tags) {
|
|
14
|
-
const
|
|
15
|
-
tags
|
|
16
|
-
} = activity_instance.channelData;
|
|
14
|
+
const tags = activity_instance.channelData.tags;
|
|
17
15
|
if (typeof tags === "string") {
|
|
18
16
|
return next(activity);
|
|
19
17
|
} else if (tags instanceof Array) {
|
|
@@ -9,9 +9,7 @@ const formatTagsIngressMiddleware = () => next => activity => {
|
|
|
9
9
|
const activity_instance = JSON.parse(JSON.stringify(activity));
|
|
10
10
|
if (activity_instance) {
|
|
11
11
|
if (activity_instance.channelData && activity_instance.channelData.tags) {
|
|
12
|
-
const
|
|
13
|
-
tags
|
|
14
|
-
} = activity_instance.channelData;
|
|
12
|
+
const tags = activity_instance.channelData.tags;
|
|
15
13
|
if (typeof tags === "string") {
|
|
16
14
|
try {
|
|
17
15
|
//If it is json format, parse the tags. Catch block will convert string to array.(We do not need to log anything since its not an error)
|