@microsoft/omnichannel-chat-widget 1.8.7 → 2.0.0-main.ba244dd
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 +42 -3
- package/lib/cjs/common/Constants.js +5 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +234 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +17 -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/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/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/startChat.js +31 -14
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +158 -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 +17 -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/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/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/startChat.js +31 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +157 -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 +14 -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/ChatWidgetEvents.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
- 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/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 +69 -56
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1
7
|
import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
|
|
2
8
|
import { Stack } from "@fluentui/react";
|
|
3
9
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
@@ -25,6 +31,7 @@ import { shouldLoadPersistentChatHistory } from "../livechatwidget/common/liveCh
|
|
|
25
31
|
import { useChatContextStore } from "../..";
|
|
26
32
|
import useFacadeSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
27
33
|
import usePersistentChatHistory from "./hooks/usePersistentChatHistory";
|
|
34
|
+
import { patchCitationAnchorsForA11y } from "./common/utils/citationA11y";
|
|
28
35
|
let uiTimer;
|
|
29
36
|
const broadcastChannelMessageEvent = "message";
|
|
30
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -53,8 +60,10 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
53
60
|
};
|
|
54
61
|
};
|
|
55
62
|
export const WebChatContainerStateful = props => {
|
|
56
|
-
var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp0, _props$
|
|
57
|
-
const
|
|
63
|
+
var _props$webChatContain, _defaultWebChatContai, _props$webChatContain2, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp0, _props$webChatContain5, _defaultWebChatContai2, _props$webChatContain6, _defaultWebChatContai3, _webChatContainerProp1, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _props$webChatContain7, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
64
|
+
const _useFacadeSDKStore = useFacadeSDKStore(),
|
|
65
|
+
_useFacadeSDKStore2 = _slicedToArray(_useFacadeSDKStore, 1),
|
|
66
|
+
facadeChatSDK = _useFacadeSDKStore2[0];
|
|
58
67
|
|
|
59
68
|
// Create a font family that includes emoji support, based on the primary font or default
|
|
60
69
|
const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? defaultWebChatContainerStatefulProps.webChatStyles;
|
|
@@ -62,6 +71,10 @@ export const WebChatContainerStateful = props => {
|
|
|
62
71
|
|
|
63
72
|
// Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
|
|
64
73
|
const fontFamilyWithEmojis = createIOSOptimizedEmojiFont(primaryFont);
|
|
74
|
+
|
|
75
|
+
// Enforce minimum input font-size to prevent iOS Safari auto-zoom on focus
|
|
76
|
+
const configuredInputFontSize = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 || (_props$webChatContain2 = _props$webChatContain2.adaptiveCardStyles) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.inputFontSize) ?? defaultAdaptiveCardStyles.inputFontSize;
|
|
77
|
+
const inputFontSize = parseFloat(configuredInputFontSize ?? String(Constants.minInputFontSizePx)) < Constants.minInputFontSizePx ? Constants.minInputFontSize : configuredInputFontSize;
|
|
65
78
|
useEffect(() => {
|
|
66
79
|
uiTimer = createTimer();
|
|
67
80
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
@@ -70,20 +83,25 @@ export const WebChatContainerStateful = props => {
|
|
|
70
83
|
}, []);
|
|
71
84
|
|
|
72
85
|
// Citation pane state
|
|
73
|
-
const
|
|
74
|
-
|
|
86
|
+
const _useState = useState(false),
|
|
87
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
88
|
+
citationPaneOpen = _useState2[0],
|
|
89
|
+
setCitationPaneOpen = _useState2[1];
|
|
90
|
+
const _useState3 = useState(""),
|
|
91
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
92
|
+
citationPaneText = _useState4[0],
|
|
93
|
+
setCitationPaneText = _useState4[1];
|
|
75
94
|
|
|
76
95
|
// Guard to prevent handling multiple rapid clicks which could cause
|
|
77
96
|
// the dim layer and pane to re-render out of sync and create a flicker.
|
|
78
97
|
const citationOpeningRef = useRef(false);
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
contextDataStore
|
|
86
|
-
} = props;
|
|
98
|
+
const BasicWebChat = Components.BasicWebChat;
|
|
99
|
+
const _useChatContextStore = useChatContextStore(),
|
|
100
|
+
_useChatContextStore2 = _slicedToArray(_useChatContextStore, 2),
|
|
101
|
+
state = _useChatContextStore2[0],
|
|
102
|
+
dispatch = _useChatContextStore2[1];
|
|
103
|
+
const webChatContainerProps = props.webChatContainerProps,
|
|
104
|
+
contextDataStore = props.contextDataStore;
|
|
87
105
|
|
|
88
106
|
// Type the chatConfig properly to avoid 'any' usage
|
|
89
107
|
const extendedChatConfig = props.chatConfig;
|
|
@@ -142,23 +160,123 @@ export const WebChatContainerStateful = props => {
|
|
|
142
160
|
document.addEventListener("click", clickHandler);
|
|
143
161
|
return () => document.removeEventListener("click", clickHandler);
|
|
144
162
|
}, [state]);
|
|
163
|
+
|
|
164
|
+
// Accessibility: Merge citation card's number badge and link text into a single
|
|
165
|
+
// focusable element. WebChat's LinkDefinitionItem renders an <a> containing a
|
|
166
|
+
// badge <div> (the number, e.g. "1") and a text <div> (the title). On iOS
|
|
167
|
+
// VoiceOver and Android TalkBack, those block-level descendants are otherwise
|
|
168
|
+
// announced as two separate focusable links. The patch sets a combined
|
|
169
|
+
// aria-label on the anchor and hides every descendant from the a11y tree so
|
|
170
|
+
// the whole card is announced as one link.
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const webChatRoot = document.getElementById("ms_lcw_webchat_root");
|
|
173
|
+
if (!webChatRoot) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
patchCitationAnchorsForA11y(webChatRoot);
|
|
177
|
+
const observer = new MutationObserver(mutations => {
|
|
178
|
+
for (const m of mutations) {
|
|
179
|
+
if (m.type === "childList") {
|
|
180
|
+
m.addedNodes.forEach(node => {
|
|
181
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
182
|
+
var _parentElement, _parentElement$closes;
|
|
183
|
+
patchCitationAnchorsForA11y(node);
|
|
184
|
+
// A child added inside an existing anchor (e.g. React
|
|
185
|
+
// mounting OpenInNewWindowIcon after the anchor) means
|
|
186
|
+
// the parent anchor needs to re-walk its descendants.
|
|
187
|
+
const ancestor = (_parentElement = node.parentElement) === null || _parentElement === void 0 || (_parentElement$closes = _parentElement.closest) === null || _parentElement$closes === void 0 ? void 0 : _parentElement$closes.call(_parentElement, "a.webchat__link-definitions__list-item-box");
|
|
188
|
+
if (ancestor) {
|
|
189
|
+
patchCitationAnchorsForA11y(ancestor);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
} else if (m.type === "attributes" && m.target.nodeType === Node.ELEMENT_NODE) {
|
|
194
|
+
var _target$closest;
|
|
195
|
+
// React may strip our aria-hidden during a re-render; reapply
|
|
196
|
+
// by re-patching the closest matching anchor ancestor.
|
|
197
|
+
const target = m.target;
|
|
198
|
+
const ancestor = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, "a.webchat__link-definitions__list-item-box");
|
|
199
|
+
if (ancestor) {
|
|
200
|
+
patchCitationAnchorsForA11y(ancestor);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
observer.observe(webChatRoot, {
|
|
206
|
+
childList: true,
|
|
207
|
+
subtree: true,
|
|
208
|
+
attributes: true,
|
|
209
|
+
attributeFilter: ["aria-hidden", "role", "tabindex", "inert"]
|
|
210
|
+
});
|
|
211
|
+
return () => observer.disconnect();
|
|
212
|
+
}, []);
|
|
213
|
+
const minimizedStyles = state.appStates.isMinimized ? shouldLoadPersistentHistoryMessages ? {
|
|
214
|
+
visibility: "hidden",
|
|
215
|
+
position: "absolute",
|
|
216
|
+
width: 0,
|
|
217
|
+
height: 0,
|
|
218
|
+
overflow: "hidden",
|
|
219
|
+
pointerEvents: "none"
|
|
220
|
+
} : {
|
|
221
|
+
display: "none"
|
|
222
|
+
} : {};
|
|
145
223
|
const containerStyles = {
|
|
146
|
-
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles,
|
|
147
|
-
display: state.appStates.isMinimized ? "none" : ""
|
|
148
|
-
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
224
|
+
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, minimizedStyles) // Use visibility-based hiding instead of display:none to preserve scroll position across minimize/maximize
|
|
149
225
|
};
|
|
150
226
|
const localizedTexts = {
|
|
151
227
|
...defaultMiddlewareLocalizedTexts,
|
|
152
228
|
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
153
229
|
};
|
|
154
230
|
useEffect(() => {
|
|
155
|
-
var _props$
|
|
231
|
+
var _props$webChatContain3;
|
|
156
232
|
if (getDeviceType() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
|
|
157
233
|
const chatHistoryElement = document.querySelector(`.${HtmlClassNames.webChatHistoryContainer}`);
|
|
158
234
|
if (chatHistoryElement) {
|
|
159
235
|
chatHistoryElement.setAttribute(HtmlAttributeNames.ariaLabel, webChatContainerProps.webChatHistoryMobileAccessibilityLabel);
|
|
160
236
|
}
|
|
161
237
|
}
|
|
238
|
+
|
|
239
|
+
// internal tracking: WebChats BasicToaster renders a `role="log"` container
|
|
240
|
+
// with no accessible name. When the toaster is empty (typical idle
|
|
241
|
+
// state) screen readers traversing the page announce it as "blank".
|
|
242
|
+
// Inject an aria-label so the region has a meaningful name; the
|
|
243
|
+
// consumer can override via the new
|
|
244
|
+
// `webChatNotificationRegionAccessibilityLabel` prop. The toaster
|
|
245
|
+
// may not be rendered yet when this effect first runs, so observe
|
|
246
|
+
// for it via a MutationObserver scoped to the widget root (or, if
|
|
247
|
+
// not yet mounted, the widget container's parent) so we never fire
|
|
248
|
+
// on host-page mutations outside the widget subtree.
|
|
249
|
+
const toasterLabel = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatNotificationRegionAccessibilityLabel) ?? defaultWebChatContainerStatefulProps.webChatNotificationRegionAccessibilityLabel ?? "Chat notifications";
|
|
250
|
+
const labelToaster = root => {
|
|
251
|
+
const toaster = root.querySelector(".webchat__toaster[role='log']");
|
|
252
|
+
if (toaster && !toaster.getAttribute(HtmlAttributeNames.ariaLabel)) {
|
|
253
|
+
toaster.setAttribute(HtmlAttributeNames.ariaLabel, toasterLabel);
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
};
|
|
258
|
+
// Prefer the widget root; if it is not yet in the DOM, fall back to
|
|
259
|
+
// `document` for the *initial* lookup only, then observe the most
|
|
260
|
+
// specific available scope (widget root if present, otherwise the
|
|
261
|
+
// widget's parent / document.body as a last resort). The observer
|
|
262
|
+
// re-resolves the widget root on every callback so we tighten scope
|
|
263
|
+
// as soon as it mounts.
|
|
264
|
+
let toasterObserver;
|
|
265
|
+
const resolveScope = () => document.getElementById("ms_lcw_webchat_root") ?? document.body;
|
|
266
|
+
if (!labelToaster(resolveScope())) {
|
|
267
|
+
toasterObserver = new MutationObserver(() => {
|
|
268
|
+
const scope = resolveScope();
|
|
269
|
+
if (labelToaster(scope)) {
|
|
270
|
+
var _toasterObserver;
|
|
271
|
+
(_toasterObserver = toasterObserver) === null || _toasterObserver === void 0 || _toasterObserver.disconnect();
|
|
272
|
+
toasterObserver = undefined;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
toasterObserver.observe(resolveScope(), {
|
|
276
|
+
childList: true,
|
|
277
|
+
subtree: true
|
|
278
|
+
});
|
|
279
|
+
}
|
|
162
280
|
dispatch({
|
|
163
281
|
type: LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
|
|
164
282
|
payload: webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.renderingMiddlewareProps
|
|
@@ -170,7 +288,7 @@ export const WebChatContainerStateful = props => {
|
|
|
170
288
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
171
289
|
Event: TelemetryEvent.WebChatLoaded
|
|
172
290
|
});
|
|
173
|
-
if (((_props$
|
|
291
|
+
if (((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 || (_props$webChatContain3 = _props$webChatContain3.renderingMiddlewareProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
|
|
174
292
|
try {
|
|
175
293
|
localStorage;
|
|
176
294
|
sessionStorage;
|
|
@@ -183,10 +301,14 @@ export const WebChatContainerStateful = props => {
|
|
|
183
301
|
}
|
|
184
302
|
}
|
|
185
303
|
}
|
|
304
|
+
return () => {
|
|
305
|
+
var _toasterObserver2;
|
|
306
|
+
(_toasterObserver2 = toasterObserver) === null || _toasterObserver2 === void 0 || _toasterObserver2.disconnect();
|
|
307
|
+
};
|
|
186
308
|
}, []);
|
|
187
309
|
useEffect(() => {
|
|
188
|
-
var _props$
|
|
189
|
-
if (!((_props$
|
|
310
|
+
var _props$webChatContain4;
|
|
311
|
+
if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain4 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
|
|
190
312
|
return;
|
|
191
313
|
}
|
|
192
314
|
if (!window.BroadcastChannel) {
|
|
@@ -202,14 +324,10 @@ export const WebChatContainerStateful = props => {
|
|
|
202
324
|
|
|
203
325
|
const eventListener = event => {
|
|
204
326
|
// eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
|
|
205
|
-
const
|
|
206
|
-
data
|
|
207
|
-
} = event;
|
|
327
|
+
const data = event.data;
|
|
208
328
|
if (BotMagicCodeStore.botOAuthSignInId === data.signin) {
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
code
|
|
212
|
-
} = data;
|
|
329
|
+
const signin = data.signin,
|
|
330
|
+
code = data.code;
|
|
213
331
|
const text = `${code}`;
|
|
214
332
|
const action = postActivity({
|
|
215
333
|
text,
|
|
@@ -284,9 +402,15 @@ export const WebChatContainerStateful = props => {
|
|
|
284
402
|
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp0 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp0 !== void 0 && _webChatContainerProp0.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
285
403
|
}
|
|
286
404
|
|
|
405
|
+
div[class="ac-input-container"] input,
|
|
406
|
+
div[class="ac-input-container"] textarea,
|
|
407
|
+
div[class="ac-input-container"] select {
|
|
408
|
+
font-size: ${inputFontSize} !important;
|
|
409
|
+
}
|
|
410
|
+
|
|
287
411
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
288
|
-
background-color: ${((_props$
|
|
289
|
-
color:${((_props$
|
|
412
|
+
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 || (_props$webChatContain5 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.bubbleBackground) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
|
|
413
|
+
color:${((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 || (_props$webChatContain6 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleTextColor) ?? ((_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
|
|
290
414
|
}
|
|
291
415
|
|
|
292
416
|
div[class="ac-textBlock"] a:link,
|
|
@@ -371,7 +495,7 @@ export const WebChatContainerStateful = props => {
|
|
|
371
495
|
}
|
|
372
496
|
|
|
373
497
|
.webchat__stacked-layout_container>div {
|
|
374
|
-
background: ${(props === null || props === void 0 || (_props$
|
|
498
|
+
background: ${(props === null || props === void 0 || (_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 || (_props$webChatContain7 = _props$webChatContain7.containerStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.background) ?? ""}
|
|
375
499
|
}
|
|
376
500
|
.webchat__toast_text {
|
|
377
501
|
display: flex;
|
|
@@ -400,6 +524,7 @@ export const WebChatContainerStateful = props => {
|
|
|
400
524
|
|
|
401
525
|
.webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
|
|
402
526
|
font-family: ${fontFamilyWithEmojis} !important;
|
|
527
|
+
font-size: ${inputFontSize} !important;
|
|
403
528
|
}
|
|
404
529
|
|
|
405
530
|
/* Suggested actions carousel previous/next navigation focus */
|
|
@@ -51,6 +51,16 @@ export let DesignerChatAdapter = /*#__PURE__*/function (_MockAdapter) {
|
|
|
51
51
|
if (msg.text) {
|
|
52
52
|
if (msg.suggestedActions) {
|
|
53
53
|
postAgentSuggestedActionsActivity(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
|
|
54
|
+
} else if (msg.from && msg.from.role) {
|
|
55
|
+
// Route caller-supplied `from` through the shared
|
|
56
|
+
// postBotMessageActivity helper so the activity shape
|
|
57
|
+
// (id, channelData.tags, timestamp, type) matches every
|
|
58
|
+
// other designer-mode path and downstream middleware
|
|
59
|
+
// (localizedStringsBotInitialsMiddleware, telemetry,
|
|
60
|
+
// attachment plumbing) behaves identically. The override
|
|
61
|
+
// narrows only the fields the caller cares about (e.g.
|
|
62
|
+
// from.name / from.role) — base botUser fields remain.
|
|
63
|
+
postBotMessageActivity(this.activityObserver, msg.text, undefined, index * 100, msg.from);
|
|
54
64
|
} else {
|
|
55
65
|
postBotMessageActivity(this.activityObserver, msg.text, undefined, index * 100);
|
|
56
66
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Constants } from "../../../../common/Constants";
|
|
2
|
+
import { SupportedAdaptiveCards } from "@microsoft/omnichannel-chat-sdk/lib/utils/printers/interfaces/SupportedAdaptiveCards";
|
|
2
3
|
import botActivity from "../activities/botActivity";
|
|
3
4
|
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -17,15 +18,22 @@ const convertStringValueToInt = value => {
|
|
|
17
18
|
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
20
|
const convertPersistentChatHistoryMessageToActivity = message => {
|
|
20
|
-
var _from$user, _from$
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
content,
|
|
25
|
-
created,
|
|
26
|
-
from,
|
|
27
|
-
transcriptOriginalMessageId
|
|
28
|
-
|
|
21
|
+
var _from$application, _from$user, _from$application2;
|
|
22
|
+
const additionalData = message.additionalData,
|
|
23
|
+
attachments = message.attachments,
|
|
24
|
+
botContentType = message.botContentType,
|
|
25
|
+
content = message.content,
|
|
26
|
+
created = message.created,
|
|
27
|
+
from = message.from,
|
|
28
|
+
transcriptOriginalMessageId = message.transcriptOriginalMessageId;
|
|
29
|
+
const isFromCustomer = (from === null || from === void 0 || (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer";
|
|
30
|
+
|
|
31
|
+
// Filter out customer responses to adaptive cards (e.g., form submissions like {"value":{"goPaperless":"yes"}}).
|
|
32
|
+
// These are the customer's postBack/messageBack replies to bot adaptive cards — not displayable content.
|
|
33
|
+
// In live chat, webchat hides these natively; in history we must filter them explicitly.
|
|
34
|
+
if (isFromCustomer && botContentType === "azurebotservice.adaptivecard") {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
29
37
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
38
|
const activity = {
|
|
31
39
|
...botActivity,
|
|
@@ -62,13 +70,110 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
62
70
|
name: from.user.displayName
|
|
63
71
|
};
|
|
64
72
|
}
|
|
65
|
-
if ((from === null || from === void 0 || (_from$
|
|
73
|
+
if ((from === null || from === void 0 || (_from$application2 = from.application) === null || _from$application2 === void 0 ? void 0 : _from$application2.displayName) === "Customer") {
|
|
66
74
|
activity.from = {
|
|
67
75
|
role: "user",
|
|
68
76
|
name: from.application.displayName
|
|
69
77
|
};
|
|
70
78
|
}
|
|
71
79
|
if (content) {
|
|
80
|
+
var _parsedContent;
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
+
let parsedContent;
|
|
83
|
+
try {
|
|
84
|
+
parsedContent = JSON.parse(content);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
parsedContent = null; // fall back to normal text handling
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Check if this is a customer form submission response (e.g., RichObjectMessage_Form)
|
|
90
|
+
// These should be ignored as they are form submission data, not displayable content
|
|
91
|
+
if (isFromCustomer && ((_parsedContent = parsedContent) === null || _parsedContent === void 0 || (_parsedContent = _parsedContent.value) === null || _parsedContent === void 0 ? void 0 : _parsedContent.type) === "RichObjectMessage_Form") {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (parsedContent && typeof parsedContent === "object") {
|
|
95
|
+
var _parsedContent$sugges;
|
|
96
|
+
// Structural detection: check the parsed object's properties directly
|
|
97
|
+
const hasAttachments = Array.isArray(parsedContent.attachments) && parsedContent.attachments.length > 0;
|
|
98
|
+
const hasSuggestedActions = Array.isArray((_parsedContent$sugges = parsedContent.suggestedActions) === null || _parsedContent$sugges === void 0 ? void 0 : _parsedContent$sugges.actions) && parsedContent.suggestedActions.actions.length > 0;
|
|
99
|
+
const isRawAdaptiveCardBody = parsedContent.type === "AdaptiveCard";
|
|
100
|
+
|
|
101
|
+
// Filter out suggested-action-only messages from history.
|
|
102
|
+
// WebChat only renders suggestedActions for the most recent activity, so in history
|
|
103
|
+
// these render as empty "Suggested reply" text bubbles with no actionable buttons.
|
|
104
|
+
if (hasSuggestedActions && !hasAttachments) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Substring detection: check the raw content string for known card type patterns
|
|
109
|
+
const contentLower = content.toLowerCase();
|
|
110
|
+
const isAdaptiveCard = contentLower.includes(Constants.AdaptiveCardType);
|
|
111
|
+
const isSuggestedActions = contentLower.includes(Constants.SuggestedActionsType);
|
|
112
|
+
const containsSupportedCard = Object.values(SupportedAdaptiveCards).some(type => contentLower.includes(type.toLowerCase()));
|
|
113
|
+
|
|
114
|
+
// If the content is a raw adaptive card body (type: "AdaptiveCard"), wrap it as an attachment
|
|
115
|
+
// so webchat can render it properly instead of treating it as an unknown activity type
|
|
116
|
+
if (isRawAdaptiveCardBody) {
|
|
117
|
+
return {
|
|
118
|
+
...activity,
|
|
119
|
+
text: "",
|
|
120
|
+
attachments: [{
|
|
121
|
+
contentType: SupportedAdaptiveCards.Adaptive,
|
|
122
|
+
content: parsedContent
|
|
123
|
+
}],
|
|
124
|
+
timestamp,
|
|
125
|
+
channelData: {
|
|
126
|
+
...activity.channelData,
|
|
127
|
+
"webchat:sequence-id": webchatSequenceId
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Detect rich content using both structural checks and substring matching
|
|
133
|
+
if (hasAttachments || hasSuggestedActions || isAdaptiveCard || isSuggestedActions || containsSupportedCard) {
|
|
134
|
+
var _activity$from;
|
|
135
|
+
// Preserve from.role from the base activity — parsedContent.from may lack the role property
|
|
136
|
+
// which webchat needs to determine how to render the message (bot vs user)
|
|
137
|
+
const preservedFrom = {
|
|
138
|
+
...activity.from,
|
|
139
|
+
...(parsedContent.from || {}),
|
|
140
|
+
role: ((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) || "bot"
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
...activity,
|
|
144
|
+
...parsedContent,
|
|
145
|
+
from: preservedFrom,
|
|
146
|
+
timestamp,
|
|
147
|
+
channelData: {
|
|
148
|
+
...activity.channelData,
|
|
149
|
+
"webchat:sequence-id": webchatSequenceId
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// If parsedContent is a webchat activity (type: "message") but didn't match any specific card check,
|
|
155
|
+
// still treat it as a rich activity to avoid displaying raw JSON as text
|
|
156
|
+
if (parsedContent.type === "message" && (parsedContent.attachments || parsedContent.suggestedActions || parsedContent.value)) {
|
|
157
|
+
var _activity$from2;
|
|
158
|
+
const preservedFrom = {
|
|
159
|
+
...activity.from,
|
|
160
|
+
...(parsedContent.from || {}),
|
|
161
|
+
role: ((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) || "bot"
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
...activity,
|
|
165
|
+
...parsedContent,
|
|
166
|
+
from: preservedFrom,
|
|
167
|
+
timestamp,
|
|
168
|
+
channelData: {
|
|
169
|
+
...activity.channelData,
|
|
170
|
+
"webchat:sequence-id": webchatSequenceId
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Plain text message
|
|
72
177
|
return {
|
|
73
178
|
...activity,
|
|
74
179
|
text: content,
|
|
@@ -27,8 +27,11 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
27
27
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
28
28
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
|
|
29
29
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
30
|
+
MIDDLEWARE_BANNER_FILE_SENT: "File sent successfully.",
|
|
30
31
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
31
32
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later.",
|
|
33
|
+
MIDDLEWARE_SR_PREFIX_SUCCESS: "Success. ",
|
|
34
|
+
MIDDLEWARE_SR_PREFIX_ERROR: "Error. ",
|
|
32
35
|
PREVIOUS_MESSAGES_LOADING: "Loading previous messages...",
|
|
33
36
|
CONVERSATION_DIVIDER_ARIA_LABEL: "Conversation history divider"
|
|
34
37
|
};
|
|
@@ -13,5 +13,6 @@ export const defaultWebChatContainerStatefulProps = {
|
|
|
13
13
|
honorsTargetInHTMLLinks: false,
|
|
14
14
|
hyperlinkTextOverride: false,
|
|
15
15
|
directLine: new MockAdapter(),
|
|
16
|
-
adaptiveCardStyles: defaultAdaptiveCardStyles
|
|
16
|
+
adaptiveCardStyles: defaultAdaptiveCardStyles,
|
|
17
|
+
webChatNotificationRegionAccessibilityLabel: "Chat notifications"
|
|
17
18
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Constants } from "../../../../common/Constants";
|
|
1
2
|
export const defaultAdaptiveCardStyles = {
|
|
2
3
|
background: "white",
|
|
3
4
|
color: "black",
|
|
@@ -5,5 +6,6 @@ export const defaultAdaptiveCardStyles = {
|
|
|
5
6
|
textWhiteSpace: "normal",
|
|
6
7
|
buttonWhiteSpace: "normal",
|
|
7
8
|
buttonFlexWrap: "nowrap",
|
|
8
|
-
buttonGap: "0px"
|
|
9
|
+
buttonGap: "0px",
|
|
10
|
+
inputFontSize: Constants.minInputFontSize
|
|
9
11
|
};
|
package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js
CHANGED
|
@@ -17,7 +17,7 @@ export const defaultWebChatStyles = {
|
|
|
17
17
|
bubbleTextColor: "White",
|
|
18
18
|
hideSendBox: false,
|
|
19
19
|
hideUploadButton: true,
|
|
20
|
-
primaryFont: "Segoe UI, Arial, sans-serif
|
|
20
|
+
primaryFont: "Segoe UI, Arial, sans-serif",
|
|
21
21
|
rootHeight: "100%",
|
|
22
22
|
rootWidth: "100%",
|
|
23
23
|
sendBoxTextWrap: true,
|
|
@@ -28,7 +28,7 @@ export const defaultWebChatStyles = {
|
|
|
28
28
|
suggestedActionsStackedHeight: 125,
|
|
29
29
|
suggestedActionsStackedOverflow: "scroll",
|
|
30
30
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
31
|
-
typingAnimationDuration:
|
|
31
|
+
typingAnimationDuration: 4500,
|
|
32
32
|
emojiSet: {
|
|
33
33
|
":)": "😊",
|
|
34
34
|
":-)": "😊",
|
|
@@ -34,11 +34,13 @@ export const postEchoActivity = function (activityObserver, activity, user) {
|
|
|
34
34
|
export const postBotMessageActivity = function (activityObserver, text) {
|
|
35
35
|
let tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
36
36
|
let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
|
|
37
|
+
let fromOverride = arguments.length > 4 ? arguments[4] : undefined;
|
|
37
38
|
setTimeout(() => {
|
|
38
39
|
activityObserver === null || activityObserver === void 0 || activityObserver.next({
|
|
39
40
|
id: uuidv4(),
|
|
40
41
|
from: {
|
|
41
|
-
...botUser
|
|
42
|
+
...botUser,
|
|
43
|
+
...(fromOverride ?? {})
|
|
42
44
|
},
|
|
43
45
|
text,
|
|
44
46
|
type: "message",
|