@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,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$application;
21
- const {
22
- additionalData,
23
- attachments,
24
- content,
25
- created,
26
- from,
27
- transcriptOriginalMessageId
28
- } = message;
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$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer") {
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
  };
@@ -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, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Noto Color Emoji\"",
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: 3500,
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",
@@ -0,0 +1,188 @@
1
+ // Accessibility helper: Merges WebChat's citation card number badge and link
2
+ // text into a single focusable element.
3
+ //
4
+ // WebChat's LinkDefinitionItem renders an <a> containing a badge <div> (number)
5
+ // and a text <div> (title). On iOS VoiceOver, these block-level descendants are
6
+ // announced as two separate focusable links (e.g. "1, link" and
7
+ // "Assessment of eligibility..., link"). Setting a combined aria-label on the
8
+ // anchor and hiding inner descendants from the accessibility tree ensures the
9
+ // whole card is announced as one link.
10
+
11
+ const CITATION_ANCHOR_SELECTOR = "a.webchat__link-definitions__list-item-box";
12
+ const PATCHED_MARKER = "ocwCitationA11yPatched";
13
+ const STYLE_TAG_ID = "ocw-citation-a11y-styles";
14
+
15
+ // Global CSS injected once per document. Neutralizes iOS Safari's per-inner-
16
+ // element tap highlight / selection / focus rectangles that otherwise make
17
+ // the "1" badge and the link text appear as separate selectable areas even
18
+ // though they are inside a single <a>.
19
+ // Strategy:
20
+ // - Make the anchor a block-level positioning parent.
21
+ // - Add a transparent ::after pseudo-element that covers the entire anchor.
22
+ // iOS Safari hit-tests that overlay as a SINGLE region, so the tap
23
+ // highlight / selection rectangle always covers the whole card instead
24
+ // of just the "1" badge or just the link text.
25
+ // - Make every descendant transparent to pointer / focus, so they can never
26
+ // become a standalone tap target.
27
+ const STYLE_RULES = `
28
+ a.webchat__link-definitions__list-item-box {
29
+ position: relative;
30
+ display: block;
31
+ isolation: isolate;
32
+ -webkit-tap-highlight-color: rgba(0, 120, 212, 0.15);
33
+ -webkit-touch-callout: none;
34
+ cursor: pointer;
35
+ }
36
+ a.webchat__link-definitions__list-item-box::after {
37
+ content: "";
38
+ position: absolute;
39
+ inset: 0;
40
+ z-index: 2;
41
+ background: transparent;
42
+ pointer-events: auto;
43
+ -webkit-tap-highlight-color: rgba(0, 120, 212, 0.15);
44
+ }
45
+ a.webchat__link-definitions__list-item-box * {
46
+ pointer-events: none;
47
+ -webkit-tap-highlight-color: transparent;
48
+ -webkit-touch-callout: none;
49
+ outline: none;
50
+ text-decoration: inherit;
51
+ cursor: inherit;
52
+ }
53
+ `;
54
+ const ensureStyleInjected = doc => {
55
+ if (!doc || typeof doc.getElementById !== "function" || doc.getElementById(STYLE_TAG_ID)) {
56
+ return;
57
+ }
58
+ const style = doc.createElement("style");
59
+ style.id = STYLE_TAG_ID;
60
+ style.textContent = STYLE_RULES;
61
+ (doc.head || doc.documentElement).appendChild(style);
62
+ };
63
+ export const patchCitationAnchorsForA11y = root => {
64
+ var _defaultView;
65
+ if (!root || typeof root.querySelectorAll !== "function") {
66
+ return;
67
+ }
68
+
69
+ // Inject global CSS once per document. This covers every citation anchor
70
+ // regardless of whether our per-node patch has run on it yet.
71
+ const rootNode = root;
72
+ const doc = rootNode.ownerDocument ?? ((_defaultView = root.defaultView) === null || _defaultView === void 0 ? void 0 : _defaultView.document) ?? root ?? (typeof document !== "undefined" ? document : null);
73
+ if (doc && typeof doc.createElement === "function") {
74
+ ensureStyleInjected(doc);
75
+ }
76
+
77
+ // Also include the root itself when it matches — calls from MutationObserver
78
+ // pass the anchor element directly, which querySelectorAll wouldn't return.
79
+ const matched = new Set();
80
+ if (typeof root.matches === "function" && root.matches(CITATION_ANCHOR_SELECTOR)) {
81
+ matched.add(root);
82
+ }
83
+ root.querySelectorAll(CITATION_ANCHOR_SELECTOR).forEach(n => {
84
+ matched.add(n);
85
+ });
86
+ matched.forEach(anchor => {
87
+ var _badge$textContent, _textEl$textContent;
88
+ const badge = anchor.querySelector(".webchat__link-definitions__badge");
89
+ const textEl = anchor.querySelector(".webchat__link-definitions__list-item-text");
90
+ const identifier = (badge === null || badge === void 0 || (_badge$textContent = badge.textContent) === null || _badge$textContent === void 0 ? void 0 : _badge$textContent.trim()) ?? "";
91
+ // Prefer the explicit text element. For plain (non-card) citation anchors
92
+ // (no badge), fall back to the title or the anchor's own text. When a
93
+ // badge is present but no text element, avoid using anchor.textContent
94
+ // since it would duplicate the identifier.
95
+ let text = (textEl === null || textEl === void 0 || (_textEl$textContent = textEl.textContent) === null || _textEl$textContent === void 0 ? void 0 : _textEl$textContent.trim()) ?? "";
96
+ if (!text && !badge) {
97
+ var _anchor$getAttribute, _anchor$textContent;
98
+ text = ((_anchor$getAttribute = anchor.getAttribute("title")) === null || _anchor$getAttribute === void 0 ? void 0 : _anchor$getAttribute.trim()) || ((_anchor$textContent = anchor.textContent) === null || _anchor$textContent === void 0 ? void 0 : _anchor$textContent.trim()) || "";
99
+ }
100
+ if (!identifier && !text) {
101
+ return;
102
+ }
103
+ const combinedLabel = identifier && text ? `${identifier}, ${text}` : identifier || text;
104
+
105
+ // Always (re-)apply aria-label if absent. Setting it again with the same
106
+ // value when it already matches is a no-op for the DOM; this keeps the
107
+ // patch idempotent so React re-renders that strip the attribute heal.
108
+ const existingLabel = anchor.getAttribute("aria-label");
109
+ if (!existingLabel) {
110
+ anchor.setAttribute("aria-label", combinedLabel);
111
+ }
112
+
113
+ // Explicitly mark the anchor as a single link so iOS VoiceOver treats
114
+ // the whole card as one element.
115
+ if (!anchor.getAttribute("role")) {
116
+ anchor.setAttribute("role", "link");
117
+ }
118
+
119
+ // Nuclear a11y lockdown of EVERY descendant of the anchor (not just
120
+ // known class names, because WebChat can render additional nodes).
121
+ // iOS VoiceOver is known to split focus on block-level descendants
122
+ // inside an <a>. Applying all of the following guarantees only the
123
+ // outer <a> is a selectable a11y / focus target:
124
+ // - aria-hidden="true" removes element from the a11y tree
125
+ // - role="presentation" strips any implicit semantic role
126
+ // - inert removes element from focus + interaction
127
+ // - tabindex="-1" defensive (covers browsers without inert)
128
+ // - title removed iOS VoiceOver in WKWebView still surfaces
129
+ // elements with a `title` attribute as a
130
+ // separately swipeable item even when
131
+ // aria-hidden=true. WebChat's ItemBody sets
132
+ // title={text} on the inner link-text div,
133
+ // which is the root cause of the "two
134
+ // separate links" announcement on iOS.
135
+ // We move the title to a data-* attribute
136
+ // so any tooltip-like tooling can still
137
+ // read it, but iOS VO ignores it.
138
+ anchor.querySelectorAll("*").forEach(el => {
139
+ const inner = el;
140
+ if (inner.getAttribute("aria-hidden") !== "true") {
141
+ inner.setAttribute("aria-hidden", "true");
142
+ }
143
+ if (inner.getAttribute("role") !== "presentation") {
144
+ inner.setAttribute("role", "presentation");
145
+ }
146
+ if (inner.getAttribute("tabindex") !== "-1") {
147
+ inner.setAttribute("tabindex", "-1");
148
+ }
149
+ if (!inner.hasAttribute("inert")) {
150
+ inner.setAttribute("inert", "");
151
+ }
152
+ const innerTitle = inner.getAttribute("title");
153
+ if (innerTitle !== null) {
154
+ inner.removeAttribute("title");
155
+ if (!inner.dataset.ocwOriginalTitle) {
156
+ inner.dataset.ocwOriginalTitle = innerTitle;
157
+ }
158
+ }
159
+ if (inner.style.pointerEvents !== "none") {
160
+ inner.style.pointerEvents = "none";
161
+ }
162
+ });
163
+
164
+ // DOM-level full-bleed overlay. Inline styles are used so this works
165
+ // even when the widget renders inside a shadow DOM (where an
166
+ // injected <style> tag in document.head cannot reach). The overlay
167
+ // becomes the ONLY visible hit-test target for iOS Safari, so tapping
168
+ // anywhere on the card highlights the entire card instead of just the
169
+ // "1" badge or just the link text.
170
+ const anchorStyle = anchor.style;
171
+ if (!anchorStyle.position) {
172
+ anchorStyle.position = "relative";
173
+ }
174
+ if (!anchorStyle.display || anchorStyle.display === "inline") {
175
+ anchorStyle.display = "block";
176
+ }
177
+ const ownerDoc = anchor.ownerDocument;
178
+ const existingOverlay = anchor.querySelector(":scope > [data-ocw-citation-overlay='true']");
179
+ if (!existingOverlay && ownerDoc && typeof ownerDoc.createElement === "function") {
180
+ const overlay = ownerDoc.createElement("span");
181
+ overlay.setAttribute("aria-hidden", "true");
182
+ overlay.setAttribute("data-ocw-citation-overlay", "true");
183
+ overlay.style.cssText = ["position:absolute", "top:0", "left:0", "right:0", "bottom:0", "z-index:2", "background:transparent", "pointer-events:auto", "-webkit-tap-highlight-color:rgba(0,120,212,0.15)", "-webkit-touch-callout:none", "-webkit-user-select:none", "user-select:none", "cursor:pointer"].join(";");
184
+ anchor.appendChild(overlay);
185
+ }
186
+ anchor.dataset[PATCHED_MARKER] = "true";
187
+ });
188
+ };
@@ -1 +1,10 @@
1
- export {};
1
+ /**
2
+ * Type guard narrowing the `unknown` action received by a Redux 5 store middleware
3
+ * down to Web Chat's IWebChatAction shape, so middlewares can safely access `type`/`payload`.
4
+ */
5
+ export const isWebChatAction = action => typeof action === "object" && action !== null && "type" in action && typeof action.type === "string";
6
+
7
+ /**
8
+ * Structural middleware type matching the unknown-action contract expected by
9
+ * botframework-webchat's `createStore` without exposing Redux as a public dependency.
10
+ */
@@ -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 { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
8
  import { useEffect, useState } from "react";
3
9
  import ChatWidgetEvents from "../../livechatwidget/common/ChatWidgetEvents";
@@ -12,8 +18,14 @@ import dispatchCustomEvent from "../../../common/utils/dispatchCustomEvent";
12
18
  * Uses WebChatStoreLoader instead of hooks to avoid context issues.
13
19
  */
14
20
  const WebChatEventSubscribers = () => {
15
- const [isConnected, setIsConnected] = useState(false);
16
- const [storeReady, setStoreReady] = useState(false);
21
+ const _useState = useState(false),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ isConnected = _useState2[0],
24
+ setIsConnected = _useState2[1];
25
+ const _useState3 = useState(false),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ storeReady = _useState4[0],
28
+ setStoreReady = _useState4[1];
17
29
  const storeWaitTimer = createTimer();
18
30
  // Type the chatConfig properly to avoid 'any' usage
19
31
 
@@ -70,15 +82,26 @@ const WebChatEventSubscribers = () => {
70
82
  // Dispatch events when connection is established
71
83
  setTimeout(() => {
72
84
  dispatchCustomEvent(ChatWidgetEvents.FETCH_PERSISTENT_CHAT_HISTORY);
85
+ // The trigger activity renders the "Loading previous messages..." banner
86
+ // via LazyLoadActivity. We set webchat:sequence-id to 1 and timestamp
87
+ // to epoch+1ms so WebChat sorts this activity BEFORE all history messages
88
+ // (which have sequence-ids based on transcriptOriginalMessageId timestamps).
89
+ // Without these, WebChat places activities without a sequence-id at the
90
+ // end of the transcript, causing the banner to appear at the bottom and
91
+ // breaking the IntersectionObserver pagination trigger (the observer only
92
+ // fires on visibility transitions — if the element starts visible at the
93
+ // bottom, the initial fire is blocked by the paused state and never
94
+ // re-fires since there is no transition).
73
95
  dispatchCustomEvent(ChatWidgetEvents.ADD_ACTIVITY, {
74
96
  activity: {
75
97
  from: {
76
98
  role: "bot"
77
99
  },
78
- timestamp: 0,
100
+ timestamp: new Date(1).toISOString(),
79
101
  type: "message",
80
102
  channelData: {
81
- tags: [Constants.persistentChatHistoryMessagePullTriggerTag]
103
+ tags: [Constants.persistentChatHistoryMessagePullTriggerTag],
104
+ "webchat:sequence-id": 1
82
105
  }
83
106
  }
84
107
  });
@@ -6,9 +6,7 @@ const FormatEgressTagsMiddleware = () => next => activity => {
6
6
  const activity_instance = JSON.parse(JSON.stringify(activity));
7
7
  if (activity_instance) {
8
8
  if (activity_instance.channelData && activity_instance.channelData.tags) {
9
- const {
10
- tags
11
- } = activity_instance.channelData;
9
+ const tags = activity_instance.channelData.tags;
12
10
  if (typeof tags === "string") {
13
11
  return next(activity);
14
12
  } else if (tags instanceof Array) {
@@ -3,9 +3,7 @@ const formatTagsIngressMiddleware = () => next => activity => {
3
3
  const activity_instance = JSON.parse(JSON.stringify(activity));
4
4
  if (activity_instance) {
5
5
  if (activity_instance.channelData && activity_instance.channelData.tags) {
6
- const {
7
- tags
8
- } = activity_instance.channelData;
6
+ const tags = activity_instance.channelData.tags;
9
7
  if (typeof tags === "string") {
10
8
  try {
11
9
  //If it is json format, parse the tags. Catch block will convert string to array.(We do not need to log anything since its not an error)