@microsoft/omnichannel-chat-widget 1.8.7 → 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.
Files changed (251) hide show
  1. package/README.md +52 -5
  2. package/lib/cjs/common/Constants.js +5 -0
  3. package/lib/cjs/common/facades/FacadeChatSDK.js +234 -9
  4. package/lib/cjs/common/telemetry/TelemetryConstants.js +19 -0
  5. package/lib/cjs/common/telemetry/TelemetryManager.js +6 -1
  6. package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +2 -3
  7. package/lib/cjs/common/telemetry/sanitizeSasInPayload.js +91 -0
  8. package/lib/cjs/common/utils.js +93 -17
  9. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +16 -6
  10. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -10
  11. package/lib/cjs/components/citationpanestateful/CitationDim.js +2 -3
  12. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +27 -5
  13. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +23 -3
  14. package/lib/cjs/components/dimlayer/DimLayer.js +1 -3
  15. package/lib/cjs/components/draggable/DraggableChatWidget.js +35 -15
  16. package/lib/cjs/components/draggable/DraggableEventEmitter.js +10 -1
  17. package/lib/cjs/components/draggable/DraggableEventReceiver.js +1 -3
  18. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +54 -17
  19. package/lib/cjs/components/errorboundary/ErrorBoundary.js +4 -12
  20. package/lib/cjs/components/footerstateful/FooterStateful.js +18 -9
  21. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +2 -4
  22. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +4 -6
  23. package/lib/cjs/components/headerstateful/HeaderStateful.js +24 -12
  24. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +27 -4
  25. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +5 -11
  26. package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
  27. package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +11 -4
  28. package/lib/cjs/components/livechatwidget/common/authHelper.js +44 -4
  29. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +98 -5
  30. package/lib/cjs/components/livechatwidget/common/endChat.js +12 -9
  31. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +182 -1
  32. package/lib/cjs/components/livechatwidget/common/recoveryEligibilityTelemetry.js +60 -0
  33. package/lib/cjs/components/livechatwidget/common/startChat.js +31 -14
  34. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +160 -21
  35. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +16 -11
  36. package/lib/cjs/components/notificationpanestateful/NotificationPaneStateful.js +19 -12
  37. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +13 -6
  38. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +28 -5
  39. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +12 -5
  40. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +105 -11
  41. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +12 -1
  42. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -7
  43. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +16 -7
  44. package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +10 -2
  45. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +154 -29
  46. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +10 -0
  47. package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +115 -10
  48. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -0
  49. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
  50. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
  51. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
  52. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +3 -1
  53. package/lib/cjs/components/webchatcontainerstateful/common/utils/citationA11y.js +195 -0
  54. package/lib/cjs/components/webchatcontainerstateful/interfaces/IWebChatAction.js +17 -1
  55. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +27 -4
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +1 -3
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +1 -3
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +180 -190
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +3 -5
  60. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +22 -6
  61. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -23
  62. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -35
  63. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +199 -0
  64. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +29 -15
  65. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +5 -12
  66. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +1 -1
  67. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  68. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
  69. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
  70. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +5 -8
  71. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +6 -4
  72. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +6 -4
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +14 -12
  74. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +16 -14
  75. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +18 -30
  76. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +10 -2
  77. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +1 -3
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +16 -12
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +6 -6
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +83 -0
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +36 -8
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +5 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +10 -7
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +4 -0
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -4
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +5 -1
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +7 -7
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +10 -14
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +6 -4
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -10
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +57 -11
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +6 -4
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +25 -30
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +10 -7
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +6 -4
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +2 -4
  98. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +5 -0
  99. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +17 -1
  100. package/lib/cjs/contexts/createReducer.js +15 -0
  101. package/lib/cjs/controller/componentController.js +13 -1
  102. package/lib/cjs/hooks/useWindowDimensions.js +13 -5
  103. package/lib/cjs/package.json +1 -0
  104. package/lib/cjs/plugins/createChatTranscript.js +3 -4
  105. package/lib/cjs/plugins/newMessageEventHandler.js +20 -3
  106. package/lib/esm/common/Constants.js +5 -0
  107. package/lib/esm/common/facades/FacadeChatSDK.js +235 -10
  108. package/lib/esm/common/telemetry/TelemetryConstants.js +19 -0
  109. package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
  110. package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +2 -3
  111. package/lib/esm/common/telemetry/sanitizeSasInPayload.js +84 -0
  112. package/lib/esm/common/utils.js +88 -14
  113. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +15 -5
  114. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +19 -9
  115. package/lib/esm/components/citationpanestateful/CitationDim.js +2 -3
  116. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +26 -4
  117. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -2
  118. package/lib/esm/components/dimlayer/DimLayer.js +1 -3
  119. package/lib/esm/components/draggable/DraggableChatWidget.js +34 -14
  120. package/lib/esm/components/draggable/DraggableEventEmitter.js +10 -1
  121. package/lib/esm/components/draggable/DraggableEventReceiver.js +1 -3
  122. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +54 -17
  123. package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -12
  124. package/lib/esm/components/footerstateful/FooterStateful.js +17 -8
  125. package/lib/esm/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +2 -4
  126. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +4 -6
  127. package/lib/esm/components/headerstateful/HeaderStateful.js +22 -10
  128. package/lib/esm/components/livechatwidget/LiveChatWidget.js +27 -4
  129. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +5 -11
  130. package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
  131. package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +11 -4
  132. package/lib/esm/components/livechatwidget/common/authHelper.js +44 -4
  133. package/lib/esm/components/livechatwidget/common/createMarkdown.js +98 -5
  134. package/lib/esm/components/livechatwidget/common/endChat.js +12 -9
  135. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +182 -1
  136. package/lib/esm/components/livechatwidget/common/recoveryEligibilityTelemetry.js +52 -0
  137. package/lib/esm/components/livechatwidget/common/startChat.js +31 -14
  138. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +159 -20
  139. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +14 -9
  140. package/lib/esm/components/notificationpanestateful/NotificationPaneStateful.js +17 -10
  141. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +12 -5
  142. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +28 -5
  143. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +11 -4
  144. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +105 -11
  145. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +12 -1
  146. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -6
  147. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +15 -6
  148. package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +9 -1
  149. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +154 -29
  150. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +10 -0
  151. package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +115 -10
  152. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -0
  153. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
  154. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
  155. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
  156. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +3 -1
  157. package/lib/esm/components/webchatcontainerstateful/common/utils/citationA11y.js +188 -0
  158. package/lib/esm/components/webchatcontainerstateful/interfaces/IWebChatAction.js +10 -1
  159. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +27 -4
  160. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +1 -3
  161. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +1 -3
  162. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +180 -190
  163. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +3 -5
  164. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +19 -4
  165. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -23
  166. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -32
  167. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +193 -0
  168. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.js +28 -14
  169. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +5 -12
  170. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +1 -1
  171. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  172. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
  173. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
  174. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +5 -8
  175. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +6 -4
  176. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +6 -4
  177. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +13 -11
  178. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +15 -13
  179. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +17 -27
  180. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +9 -1
  181. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +1 -3
  182. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +16 -10
  183. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +6 -6
  184. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +77 -0
  185. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +36 -8
  186. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +5 -2
  187. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +10 -7
  188. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +4 -0
  189. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -4
  190. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +5 -1
  191. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +7 -7
  192. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +10 -14
  193. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +6 -4
  194. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -10
  195. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +57 -11
  196. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +6 -4
  197. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +25 -31
  198. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +10 -7
  199. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +6 -4
  200. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
  201. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +2 -4
  202. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +5 -0
  203. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +17 -1
  204. package/lib/esm/contexts/createReducer.js +15 -0
  205. package/lib/esm/controller/componentController.js +13 -1
  206. package/lib/esm/hooks/useWindowDimensions.js +13 -5
  207. package/lib/esm/plugins/createChatTranscript.js +3 -4
  208. package/lib/esm/plugins/newMessageEventHandler.js +20 -3
  209. package/lib/types/common/Constants.d.ts +4 -0
  210. package/lib/types/common/facades/FacadeChatSDK.d.ts +29 -0
  211. package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +3 -1
  212. package/lib/types/common/telemetry/TelemetryConstants.d.ts +15 -2
  213. package/lib/types/common/telemetry/sanitizeSasInPayload.d.ts +24 -0
  214. package/lib/types/common/utils.d.ts +3 -1
  215. package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +2 -1
  216. package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
  217. package/lib/types/components/livechatwidget/common/recoveryEligibilityTelemetry.d.ts +17 -0
  218. package/lib/types/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.d.ts +6 -0
  219. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +1 -1
  220. package/lib/types/components/webchatcontainerstateful/common/utils/citationA11y.d.ts +1 -0
  221. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
  222. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatAction.d.ts +16 -1
  223. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +7 -0
  224. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +14 -38
  225. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -0
  226. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.d.ts +18 -0
  227. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.d.ts +3 -0
  228. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.d.ts +2 -4
  229. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +2 -4
  230. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.d.ts +2 -4
  231. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.d.ts +10 -0
  232. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +2 -4
  233. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.d.ts +2 -2
  234. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.d.ts +2 -4
  235. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +2 -2
  236. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.d.ts +2 -4
  237. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.d.ts +2 -2
  238. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.d.ts +2 -4
  239. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.d.ts +2 -4
  240. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.d.ts +2 -4
  241. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.d.ts +2 -4
  242. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +2 -4
  243. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.d.ts +2 -4
  244. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.d.ts +2 -4
  245. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
  246. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.d.ts +2 -4
  247. package/lib/types/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.d.ts +7 -0
  248. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  249. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +17 -0
  250. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
  251. package/package.json +71 -57
@@ -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 React from "react";
2
8
  import { Stack } from "@fluentui/react";
3
9
  import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
@@ -8,20 +14,16 @@ import useChatContextStore from "../../../../../../hooks/useChatContextStore";
8
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
15
  export const HistoryMessageTimestamp = _ref => {
10
16
  var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
11
- let {
12
- args
13
- } = _ref;
14
- const [state] = useChatContextStore();
17
+ let args = _ref.args;
18
+ const _useChatContextStore = useChatContextStore(),
19
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 1),
20
+ state = _useChatContextStore2[0];
15
21
  const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
16
- const {
17
- activity: {
18
- timestamp,
19
- from: {
20
- name,
21
- role
22
- }
23
- }
24
- } = args;
22
+ const _args$activity = args.activity,
23
+ timestamp = _args$activity.timestamp,
24
+ _args$activity$from = _args$activity.from,
25
+ name = _args$activity$from.name,
26
+ role = _args$activity$from.role;
25
27
  const contentStyles = {
26
28
  ...defaultTimestampContentStyles,
27
29
  ...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
@@ -1,7 +1,12 @@
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
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
8
 
3
9
  import React, { useCallback, useEffect, useRef } from "react";
4
- import { KeyCodes } from "../../../../../../common/KeyCodes";
5
10
  import { Stack } from "@fluentui/react";
6
11
  import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
7
12
  import { defaultTimestampContentStyles } from "../defaultStyles/defaultTimestampContentStyles";
@@ -14,23 +19,17 @@ import useChatContextStore from "../../../../../../hooks/useChatContextStore";
14
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
20
  export const NotDeliveredTimestamp = _ref => {
16
21
  var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$m, _state$domainStates$m2;
17
- let {
18
- args
19
- } = _ref;
22
+ let args = _ref.args;
20
23
  const timestampRef = useRef();
21
- const {
22
- useFocus,
23
- usePostActivity
24
- } = hooks;
24
+ const useFocus = hooks.useFocus,
25
+ usePostActivity = hooks.usePostActivity;
25
26
  const focus = useFocus();
26
27
  const postActivity = usePostActivity();
27
- const {
28
- activity
29
- } = args;
30
- const {
31
- timestamp
32
- } = activity;
33
- const [state] = useChatContextStore();
28
+ const activity = args.activity;
29
+ const timestamp = activity.timestamp;
30
+ const _useChatContextStore = useChatContextStore(),
31
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 1),
32
+ state = _useChatContextStore2[0];
34
33
  const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
35
34
  const contentStyles = {
36
35
  ...defaultTimestampContentStyles,
@@ -57,23 +56,14 @@ export const NotDeliveredTimestamp = _ref => {
57
56
  await postActivity(activity);
58
57
  focus("sendBox");
59
58
  }, [activity, focus, postActivity]);
60
- const onRetryKeyEnter = event => {
61
- if (event.code === KeyCodes.ENTER) {
62
- event.preventDefault();
63
- onRetryClick();
64
- }
65
- };
66
59
  return /*#__PURE__*/React.createElement(Stack, {
67
60
  style: contentStyles,
68
61
  dir: dir,
69
62
  horizontal: true
70
63
  }, /*#__PURE__*/React.createElement("span", null, " ", getTimestampHourMinute(timestamp)), /*#__PURE__*/React.createElement("span", null, " \xA0-\xA0 "), /*#__PURE__*/React.createElement("span", {
71
64
  style: failedTextStyles
72
- }, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_NOT_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_NOT_DELIVERED, " "), /*#__PURE__*/React.createElement("span", null, " \xA0-\xA0 "), /*#__PURE__*/React.createElement("span", {
65
+ }, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_NOT_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_NOT_DELIVERED, " "), /*#__PURE__*/React.createElement("span", null, " \xA0-\xA0 "), /*#__PURE__*/React.createElement("button", {
73
66
  style: retryTextStyles,
74
- role: "button",
75
- onClick: onRetryClick,
76
- onKeyDown: onRetryKeyEnter,
77
- tabIndex: 0
78
- }, " ", ((_state$domainStates$m2 = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m2 === void 0 ? void 0 : _state$domainStates$m2.MIDDLEWARE_MESSAGE_RETRY) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_RETRY, " "));
67
+ onClick: onRetryClick
68
+ }, ((_state$domainStates$m2 = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m2 === void 0 ? void 0 : _state$domainStates$m2.MIDDLEWARE_MESSAGE_RETRY) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_RETRY));
79
69
  };
@@ -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 React from "react";
2
8
  import { Stack } from "@fluentui/react";
3
9
  import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
@@ -7,7 +13,9 @@ import useChatContextStore from "../../../../../../hooks/useChatContextStore";
7
13
  /* eslint @typescript-eslint/no-explicit-any: "off" */
8
14
  export const SendingTimestamp = () => {
9
15
  var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
10
- const [state] = useChatContextStore();
16
+ const _useChatContextStore = useChatContextStore(),
17
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 1),
18
+ state = _useChatContextStore2[0];
11
19
  const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
12
20
  const contentStyles = {
13
21
  ...defaultTimestampContentStyles,
@@ -6,9 +6,7 @@ import NotificationPaneStateful from "../../../../notificationpanestateful/Notif
6
6
  export const createToastMiddleware = (notificationPaneProps, endChat) => {
7
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
8
8
  const toastMiddleware = () => next => card => {
9
- const {
10
- notification
11
- } = card;
9
+ const notification = card.notification;
12
10
  if (notificationPaneProps) {
13
11
  if (notification.id === NotificationScenarios.ChatDisconnect) {
14
12
  return /*#__PURE__*/React.createElement(NotificationPaneStateful, {
@@ -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
  /******
2
8
  * TypingIndicatorMiddleware
3
9
  *
@@ -17,12 +23,14 @@ import useFacadeSDKStore from "../../../../../hooks/useFacadeChatSDKStore";
17
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
24
  const TypingIndicator = _ref => {
19
25
  var _state$domainStates$l, _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3;
20
- let {
21
- activeTyping,
22
- visible
23
- } = _ref;
24
- const [facadeChatSDK] = useFacadeSDKStore();
25
- const [state] = useChatContextStore();
26
+ let activeTyping = _ref.activeTyping,
27
+ visible = _ref.visible;
28
+ const _useFacadeSDKStore = useFacadeSDKStore(),
29
+ _useFacadeSDKStore2 = _slicedToArray(_useFacadeSDKStore, 1),
30
+ facadeChatSDK = _useFacadeSDKStore2[0];
31
+ const _useChatContextStore = useChatContextStore(),
32
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 1),
33
+ state = _useChatContextStore2[0];
26
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
35
  const debounceTyping = useCallback(debounceLeading(() => facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.sendTypingEvent()), []);
28
36
  if (!activeTyping || Object.keys(activeTyping).length === 0 || ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.LiveChatVersion) === 1 && !visible) {
@@ -101,10 +109,8 @@ const TypingIndicator = _ref => {
101
109
 
102
110
  // eslint-disable-next-line react/display-name, @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
103
111
  export const typingIndicatorMiddleware = () => next => args => {
104
- const {
105
- activeTyping,
106
- visible
107
- } = args;
112
+ const activeTyping = args.activeTyping,
113
+ visible = args.visible;
108
114
  return /*#__PURE__*/React.createElement(TypingIndicator, {
109
115
  activeTyping: activeTyping,
110
116
  visible: visible
@@ -4,6 +4,7 @@
4
4
  * Handles attachment sending.
5
5
  ******/
6
6
 
7
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
7
8
  import { WebChatActionType } from "../../enums/WebChatActionType";
8
9
 
9
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -15,15 +16,14 @@ const createSendFileAction = files => {
15
16
  type: WebChatActionType.WEB_CHAT_SEND_MESSAGE
16
17
  };
17
18
  };
18
-
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
19
  const attachmentProcessingMiddleware = _ref => {
21
- let {
22
- dispatch
23
- } = _ref;
20
+ let dispatch = _ref.dispatch;
24
21
  return next => async action => {
25
22
  var _action$payload;
26
- if ((action === null || action === void 0 ? void 0 : action.type) === WebChatActionType.WEB_CHAT_SEND_MESSAGE && (action === null || action === void 0 || (_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.attachments) === null || _action$payload === void 0 ? void 0 : _action$payload.length) > 0) {
23
+ if (!isWebChatAction(action)) {
24
+ return next(action);
25
+ }
26
+ if (action.type === WebChatActionType.WEB_CHAT_SEND_MESSAGE && ((_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.attachments) === null || _action$payload === void 0 ? void 0 : _action$payload.length) > 0) {
27
27
  const files = action.payload.attachments;
28
28
  if (files.length === 1) {
29
29
  return next(action);
@@ -0,0 +1,77 @@
1
+ /******
2
+ * AttachmentSentAnnouncementMiddleware
3
+ *
4
+ * When a file attachment is successfully sent, announces the result to
5
+ * screen readers via an aria-live region so that assistive technology
6
+ * users receive immediate feedback.
7
+ ******/
8
+
9
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
10
+ import { WebChatActionType } from "../../enums/WebChatActionType";
11
+ const ARIA_LIVE_REGION_ID = "oc-lcw-attachment-announcement";
12
+
13
+ /**
14
+ * Ensures a visually-hidden aria-live region exists in the DOM for
15
+ * announcing attachment upload results to screen readers.
16
+ */
17
+ const ensureAriaLiveRegion = () => {
18
+ let region = document.getElementById(ARIA_LIVE_REGION_ID);
19
+ if (!region) {
20
+ region = document.createElement("div");
21
+ region.id = ARIA_LIVE_REGION_ID;
22
+ region.setAttribute("aria-live", "polite");
23
+ region.setAttribute("role", "status");
24
+ region.setAttribute("aria-atomic", "true");
25
+ // Visually hidden but available to screen readers
26
+ Object.assign(region.style, {
27
+ position: "absolute",
28
+ width: "1px",
29
+ height: "1px",
30
+ padding: "0",
31
+ margin: "-1px",
32
+ overflow: "hidden",
33
+ clip: "rect(0, 0, 0, 0)",
34
+ whiteSpace: "nowrap",
35
+ border: "0"
36
+ });
37
+ const container = document.getElementById("oc-lcw-container");
38
+ (container || document.body).appendChild(region);
39
+ }
40
+ return region;
41
+ };
42
+
43
+ /**
44
+ * Announces a message to screen readers by updating the aria-live region.
45
+ * Clears it briefly first so repeated identical messages are still announced.
46
+ */
47
+ const announce = message => {
48
+ const region = ensureAriaLiveRegion();
49
+ region.textContent = "";
50
+ // Small delay so the screen reader detects the content change
51
+ setTimeout(() => {
52
+ region.textContent = message;
53
+ }, 100);
54
+ };
55
+
56
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
57
+ const attachmentSentAnnouncementMiddleware = _ref => {
58
+ let dispatch = _ref.dispatch;
59
+ return next => action => {
60
+ if (!isWebChatAction(action)) {
61
+ return next(action);
62
+ }
63
+
64
+ // Intercept successfully posted activities that contain attachments
65
+ if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY_FULFILLED) {
66
+ var _action$payload;
67
+ const attachments = (_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.activity) === null || _action$payload === void 0 ? void 0 : _action$payload.attachments;
68
+ if (attachments && attachments.length > 0) {
69
+ const count = attachments.length;
70
+ const message = count === 1 ? "File sent" : `${count} files sent`;
71
+ announce(message);
72
+ }
73
+ }
74
+ return next(action);
75
+ };
76
+ };
77
+ export default attachmentSentAnnouncementMiddleware;
@@ -6,11 +6,33 @@
6
6
 
7
7
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
8
8
  import { AMSConstants } from "../../../../../common/Constants";
9
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
9
10
  import { NotificationHandler } from "../../notification/NotificationHandler";
10
11
  import { NotificationScenarios } from "../../enums/NotificationScenarios";
11
12
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
12
13
  import { WebChatActionType } from "../../enums/WebChatActionType";
13
14
  const MBtoBRatio = 1000000;
15
+ const announceFileSent = message => {
16
+ // TalkBack on Android WebView reliably announces newly *appended*
17
+ // role="alert" nodes but often misses text-content updates on existing
18
+ // nodes. Wait 500ms for the send-box focus shift to settle, then inject
19
+ // a fresh alert element appended to document.body and remove it after 3s.
20
+ setTimeout(() => {
21
+ const el = document.createElement("div");
22
+ el.setAttribute("role", "alert");
23
+ el.setAttribute("aria-live", "assertive");
24
+ el.setAttribute("aria-atomic", "true");
25
+ el.style.cssText = "position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden;";
26
+ el.textContent = message;
27
+ document.body.appendChild(el);
28
+ // Remove after TalkBack has had time to read it
29
+ setTimeout(() => {
30
+ if (el.parentNode) {
31
+ el.parentNode.removeChild(el);
32
+ }
33
+ }, 3000);
34
+ }, 500);
35
+ };
14
36
 
15
37
  /*
16
38
  * If an attachment is invalid, delete this attachment from the attachments list
@@ -188,19 +210,25 @@ const getFileSizeErrorMessage = (fileName, maxUploadFileSize, maxFileSizeSupport
188
210
  return errorMessage ? errorMessage.includes("{2}") ? errorMessage.replace("{2}", textEllipsis(fileName)) : errorMessage : "";
189
211
  };
190
212
 
191
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
213
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
192
214
  const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts) => _ref => {
193
- let {
194
- dispatch
195
- } = _ref;
215
+ let dispatch = _ref.dispatch;
196
216
  return next => action => {
217
+ if (!isWebChatAction(action)) {
218
+ return next(action);
219
+ }
197
220
  if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
198
221
  var _payload$activity, _payload$activity2;
199
- const {
200
- payload
201
- } = action;
222
+ const payload = action.payload;
202
223
  if (payload !== null && payload !== void 0 && payload.activity.attachments && payload.activity.attachments.length > 0 && (payload === null || payload === void 0 || (_payload$activity = payload.activity) === null || _payload$activity === void 0 || (_payload$activity = _payload$activity.attachments) === null || _payload$activity === void 0 ? void 0 : _payload$activity.length) === (payload === null || payload === void 0 || (_payload$activity2 = payload.activity) === null || _payload$activity2 === void 0 || (_payload$activity2 = _payload$activity2.channelData) === null || _payload$activity2 === void 0 || (_payload$activity2 = _payload$activity2.attachmentSizes) === null || _payload$activity2 === void 0 ? void 0 : _payload$activity2.length)) {
203
- return next(validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts));
224
+ var _validatedAction$payl;
225
+ const validatedAction = validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts);
226
+
227
+ // Announce to screen readers that the file was sent when validation passes
228
+ if (((_validatedAction$payl = validatedAction.payload) === null || _validatedAction$payl === void 0 || (_validatedAction$payl = _validatedAction$payl.activity) === null || _validatedAction$payl === void 0 || (_validatedAction$payl = _validatedAction$payl.attachments) === null || _validatedAction$payl === void 0 ? void 0 : _validatedAction$payl.length) > 0) {
229
+ announceFileSent(localizedTexts.MIDDLEWARE_BANNER_FILE_SENT ?? "File sent successfully.");
230
+ }
231
+ return next(validatedAction);
204
232
  }
205
233
  }
206
234
  return next(action);
@@ -4,10 +4,13 @@
4
4
  * Intercepts custom call actions and handles tel: URL navigation
5
5
  ******/
6
6
 
7
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
7
8
  import { WebChatActionType } from "../../enums/WebChatActionType";
8
-
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
10
9
  const createCallActionMiddleware = () => () => next => action => {
10
+ if (!isWebChatAction(action)) {
11
+ return next(action);
12
+ }
13
+
11
14
  // Intercept incoming activities to modify suggested actions with call type
12
15
  if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
13
16
  var _action$payload, _activity$suggestedAc;
@@ -6,16 +6,18 @@
6
6
 
7
7
  import { Constants } from "../../../../../common/Constants";
8
8
  import { DeliveryMode } from "@microsoft/omnichannel-chat-sdk";
9
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
9
10
  import { WebChatActionType } from "../../enums/WebChatActionType";
10
11
 
11
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
12
13
  const channelDataMiddleware = addConversationalSurveyTagsCallback => _ref => {
13
- let {
14
- dispatch
15
- } = _ref;
14
+ let dispatch = _ref.dispatch;
16
15
  return next => action => {
17
- var _action, _action2;
18
- if (((_action = action) === null || _action === void 0 ? void 0 : _action.type) === WebChatActionType.DIRECT_LINE_POST_ACTIVITY_PENDING && (_action2 = action) !== null && _action2 !== void 0 && (_action2 = _action2.payload) !== null && _action2 !== void 0 && (_action2 = _action2.activity) !== null && _action2 !== void 0 && _action2.channelData) {
16
+ var _action$payload;
17
+ if (!isWebChatAction(action)) {
18
+ return next(action);
19
+ }
20
+ if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY_PENDING && (_action$payload = action.payload) !== null && _action$payload !== void 0 && (_action$payload = _action$payload.activity) !== null && _action$payload !== void 0 && _action$payload.channelData) {
19
21
  const channelIdTag = `${Constants.channelIdKey}${Constants.ChannelId}`;
20
22
  const customerMessageTag = `${Constants.CustomerTag}`;
21
23
  if (action.payload.activity.channelData.tags) {
@@ -29,10 +31,11 @@ const channelDataMiddleware = addConversationalSurveyTagsCallback => _ref => {
29
31
  action.payload.activity.channelData.tags = [channelIdTag];
30
32
  action.payload.activity.channelData.tags.push(customerMessageTag);
31
33
  }
32
- action = addConversationalSurveyTagsCallback(action);
33
- action.payload.activity.channelData.metadata = {
34
+ const updatedAction = addConversationalSurveyTagsCallback(action);
35
+ updatedAction.payload.activity.channelData.metadata = {
34
36
  deliveryMode: DeliveryMode.Bridged
35
37
  };
38
+ return next(updatedAction);
36
39
  }
37
40
  return next(action);
38
41
  };
@@ -1,4 +1,5 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
2
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
2
3
  import { LiveChatWidgetActionType } from "../../../../../contexts/common/LiveChatWidgetActionType";
3
4
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
4
5
  import { executeReducer } from "../../../../../contexts/createReducer";
@@ -10,6 +11,9 @@ import { executeReducer } from "../../../../../contexts/createReducer";
10
11
 
11
12
  export const createCitationsMiddleware = (state, dispatch) => () => next => action => {
12
13
  var _action$payload;
14
+ if (!isWebChatAction(action)) {
15
+ return next(action);
16
+ }
13
17
  if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
14
18
  if (isApplicable(action)) {
15
19
  try {
@@ -7,17 +7,19 @@
7
7
 
8
8
  import { Constants } from "../../../../../common/Constants";
9
9
  import { DirectLineSenderRole } from "../../enums/DirectLineSenderRole";
10
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
10
11
  import { MessageTypes } from "../../enums/MessageType";
11
12
  import { WebChatActionType } from "../../enums/WebChatActionType";
12
13
 
13
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
14
15
  const createConversationEndMiddleware = (conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback) => _ref => {
15
- let {
16
- dispatch
17
- } = _ref;
16
+ let dispatch = _ref.dispatch;
18
17
  return next => action => {
19
18
  var _action$payload;
20
- if ((action === null || action === void 0 ? void 0 : action.type) == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
19
+ if (!isWebChatAction(action)) {
20
+ return next(action);
21
+ }
22
+ if (action.type == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
21
23
  var _activity$from2, _activity$channelData9, _activity$channelData0;
22
24
  const activity = action.payload.activity;
23
25
  if (activity.channelId === "ACS_CHANNEL") {
@@ -6,6 +6,7 @@
6
6
  ******/
7
7
 
8
8
  import { Constants } from "../../../../../common/Constants";
9
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
9
10
  import { WebChatActionType } from "../../enums/WebChatActionType";
10
11
  export const isValidCustomEvent = activity => {
11
12
  var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$from, _activity$channelData4, _activity$channelData5;
@@ -13,7 +14,10 @@ export const isValidCustomEvent = activity => {
13
14
  };
14
15
  const createCustomEventMiddleware = broadcastservice => () => next => action => {
15
16
  var _action$payload;
16
- if ((action === null || action === void 0 ? void 0 : action.type) == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
17
+ if (!isWebChatAction(action)) {
18
+ return next(action);
19
+ }
20
+ if (action.type == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
17
21
  const activity = action.payload.activity;
18
22
  if (isValidCustomEvent(activity)) {
19
23
  const customEvent = {
@@ -5,14 +5,13 @@
5
5
  ******/
6
6
 
7
7
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
8
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
8
9
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
9
10
  import { WebChatActionType } from "../../enums/WebChatActionType";
10
11
  import { isMaskingforCustomer } from "../../../common/utils/isMaskingFromCustomer";
11
12
  const applyDataMasking = (action, regexCollection) => {
12
13
  const maskedChar = "#"; //to do: load from env once OC SDK supporting.
13
- let {
14
- text
15
- } = action.payload;
14
+ let text = action.payload.text;
16
15
  if (!regexCollection) {
17
16
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
18
17
  Event: TelemetryEvent.InvalidConfiguration,
@@ -72,13 +71,14 @@ const applyDataMasking = (action, regexCollection) => {
72
71
  return action;
73
72
  };
74
73
 
75
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
74
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
76
75
  const createDataMaskingMiddleware = dataMaskingInfo => _ref => {
77
- let {
78
- dispatch
79
- } = _ref;
76
+ let dispatch = _ref.dispatch;
80
77
  return next => action => {
81
78
  var _action$payload;
79
+ if (!isWebChatAction(action)) {
80
+ return next(action);
81
+ }
82
82
  if (isMaskingforCustomer(dataMaskingInfo) && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.text && action.type === WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
83
83
  const regexCollection = dataMaskingInfo === null || dataMaskingInfo === void 0 ? void 0 : dataMaskingInfo.dataMaskingRules;
84
84
  return next(applyDataMasking(action, regexCollection));
@@ -5,30 +5,26 @@
5
5
  ******/
6
6
 
7
7
  import { Constants } from "../../../../../common/Constants";
8
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
8
9
  import { WebChatActionType } from "../../enums/WebChatActionType";
9
10
 
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
12
  const gifUploadMiddleware = _ref => {
12
- let {
13
- dispatch
14
- } = _ref;
13
+ let dispatch = _ref.dispatch;
15
14
  return next => action => {
15
+ if (!isWebChatAction(action)) {
16
+ return next(action);
17
+ }
16
18
  if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
17
19
  var _activity$attachments, _activity$channelData;
18
- const {
19
- payload: {
20
- activity
21
- }
22
- } = action;
20
+ const activity = action.payload.activity;
23
21
  if ((activity === null || activity === void 0 || (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) === (activity === null || activity === void 0 || (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 || (_activity$channelData = _activity$channelData.attachmentSizes) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.length)) {
24
22
  var _activity$attachments2;
25
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
24
  activity === null || activity === void 0 || (_activity$attachments2 = activity.attachments) === null || _activity$attachments2 === void 0 || _activity$attachments2.forEach(attachment => {
27
- const {
28
- thumbnailUrl,
29
- contentUrl,
30
- contentType
31
- } = attachment;
25
+ const thumbnailUrl = attachment.thumbnailUrl,
26
+ contentUrl = attachment.contentUrl,
27
+ contentType = attachment.contentType;
32
28
  if (contentType === Constants.GifContentType && thumbnailUrl !== contentUrl) {
33
29
  attachment.thumbnailUrl = contentUrl;
34
30
  }
@@ -5,6 +5,7 @@
5
5
  ******/
6
6
 
7
7
  import { Constants } from "../../../../../common/Constants";
8
+ import { isWebChatAction } from "../../../interfaces/IWebChatAction";
8
9
  import { WebChatActionType } from "../../enums/WebChatActionType";
9
10
  const disableHTMLPlayerDownloadButton = htmlTag => {
10
11
  setTimeout(() => {
@@ -23,13 +24,14 @@ const disableHTMLPlayerDownloadButton = htmlTag => {
23
24
  }, 500);
24
25
  };
25
26
 
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
27
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
27
28
  const htmlPlayerMiddleware = _ref => {
28
- let {
29
- dispatch
30
- } = _ref;
29
+ let dispatch = _ref.dispatch;
31
30
  return next => action => {
32
31
  var _action$payload;
32
+ if (!isWebChatAction(action)) {
33
+ return next(action);
34
+ }
33
35
  if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && ((_action$payload = action.payload) === null || _action$payload === void 0 || (_action$payload = _action$payload.activity) === null || _action$payload === void 0 || (_action$payload = _action$payload.attachments) === null || _action$payload === void 0 ? void 0 : _action$payload.length) > 0) {
34
36
  disableHTMLPlayerDownloadButton(Constants.video);
35
37
  disableHTMLPlayerDownloadButton(Constants.audio);