@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
@@ -15,10 +15,44 @@ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components
15
15
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
16
16
  var _defaultGeneralPreChatSurveyPaneStyleProps = require("./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps");
17
17
  var _defaultPreChatSurveyLocalizedTexts = require("./common/defaultProps/defaultPreChatSurveyLocalizedTexts");
18
- var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
18
+ var _useChatContextStore3 = _interopRequireDefault(require("../../hooks/useChatContextStore"));
19
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
20
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
21
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
22
+ 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."); }
23
+ 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; } }
24
+ 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; }
25
+ 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; } }
26
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
21
27
  let uiTimer;
28
+ const getFocusedElementAnnouncement = element => {
29
+ var _element$textContent;
30
+ const ariaLabel = element.getAttribute(_Constants.HtmlAttributeNames.ariaLabel);
31
+ if (ariaLabel) {
32
+ return ariaLabel.trim();
33
+ }
34
+ const ariaLabelledBy = element.getAttribute(_Constants.HtmlAttributeNames.ariaLabelledby);
35
+ if (ariaLabelledBy) {
36
+ const labelledByText = ariaLabelledBy.split(/\s+/).map(id => {
37
+ var _document$getElementB;
38
+ return (_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 || (_document$getElementB = _document$getElementB.textContent) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.trim();
39
+ }).filter(Boolean).join(" ");
40
+ if (labelledByText) {
41
+ return labelledByText;
42
+ }
43
+ }
44
+ if (element.id) {
45
+ const label = Array.from(document.querySelectorAll("label")).find(candidate => candidate.htmlFor === element.id || candidate.getAttribute("for") === element.id);
46
+ if (label !== null && label !== void 0 && label.textContent) {
47
+ return label.textContent.trim();
48
+ }
49
+ }
50
+ const parentLabel = element.closest("label");
51
+ if (parentLabel !== null && parentLabel !== void 0 && parentLabel.textContent) {
52
+ return parentLabel.textContent.trim();
53
+ }
54
+ return ((_element$textContent = element.textContent) === null || _element$textContent === void 0 ? void 0 : _element$textContent.trim()) ?? "";
55
+ };
22
56
 
23
57
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
58
  const PreChatSurveyPaneStateful = props => {
@@ -35,12 +69,18 @@ const PreChatSurveyPaneStateful = props => {
35
69
  }, []);
36
70
 
37
71
  // Set MarkDown global variable to be used for prechat adaptive cards
38
- window["markdownit"] = _markdownIt.default;
39
- const [state, dispatch] = (0, _useChatContextStore.default)();
40
- const {
41
- surveyProps,
42
- initStartChat
43
- } = props;
72
+ window.markdownit = _markdownIt.default;
73
+ const _useChatContextStore = (0, _useChatContextStore3.default)(),
74
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 2),
75
+ state = _useChatContextStore2[0],
76
+ dispatch = _useChatContextStore2[1];
77
+ const surveyProps = props.surveyProps,
78
+ initStartChat = props.initStartChat;
79
+ const _useState = (0, _react.useState)(""),
80
+ _useState2 = _slicedToArray(_useState, 2),
81
+ preChatFocusAnnouncement = _useState2[0],
82
+ setPreChatFocusAnnouncement = _useState2[1];
83
+ const liveRegionUpdateTimeout = (0, _react.useRef)();
44
84
  const generalStyleProps = Object.assign({}, _defaultGeneralPreChatSurveyPaneStyleProps.defaultGeneralPreChatSurveyPaneStyleProps, surveyProps === null || surveyProps === void 0 || (_surveyProps$stylePro = surveyProps.styleProps) === null || _surveyProps$stylePro === void 0 ? void 0 : _surveyProps$stylePro.generalStyleProps, {
45
85
  display: state.appStates.isMinimized ? "none" : ""
46
86
  });
@@ -127,6 +167,16 @@ const PreChatSurveyPaneStateful = props => {
127
167
  ...(surveyProps === null || surveyProps === void 0 ? void 0 : surveyProps.styleProps),
128
168
  generalStyleProps: generalStyleProps
129
169
  };
170
+ const announceFocusedElement = event => {
171
+ if (liveRegionUpdateTimeout.current) {
172
+ window.clearTimeout(liveRegionUpdateTimeout.current);
173
+ }
174
+ const announcement = getFocusedElementAnnouncement(event.target);
175
+ setPreChatFocusAnnouncement("");
176
+ liveRegionUpdateTimeout.current = window.setTimeout(() => {
177
+ setPreChatFocusAnnouncement(announcement);
178
+ }, 0);
179
+ };
130
180
  (0, _react.useEffect)(() => {
131
181
  // Set Aria-Label Attribute for Inputs
132
182
  const adaptiveCardElements = document.getElementsByClassName(_Constants.HtmlAttributeNames.adaptiveCardClassName);
@@ -174,10 +224,54 @@ const PreChatSurveyPaneStateful = props => {
174
224
  }
175
225
  }
176
226
  }, [state.appStates.isMinimized]);
177
- return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.PreChatSurveyPane, {
178
- controlProps: controlProps,
179
- styleProps: styleProps
180
- });
227
+ (0, _react.useEffect)(() => () => {
228
+ if (liveRegionUpdateTimeout.current) {
229
+ window.clearTimeout(liveRegionUpdateTimeout.current);
230
+ }
231
+ }, []);
232
+ return (
233
+ /*#__PURE__*/
234
+ // Bug 6525143 / Bug 6423684: the LiveChatWidget container is a centered
235
+ // flex column (HeaderStateful first, this pane second) with
236
+ // justifyContent: center and clipped overflow. Sizing this focus-capture
237
+ // wrapper to height: 100% makes it 100% of the ENTIRE container rather than
238
+ // the space remaining below the header, so header + pane overflow the
239
+ // container and the centered column splits the overflow top & bottom -
240
+ // clipping the header's top edge. Instead, fill only the remaining space
241
+ // with flex (flex: 1 1 auto + minHeight: 0) and lay out as a column so the
242
+ // header stays fully visible while the inner pane (a flex child that grows
243
+ // via flexGrow/flexBasis - see defaultGeneralPreChatSurveyPaneStyleProps)
244
+ // fills the leftover area and scrolls, instead of collapsing to its
245
+ // intrinsic content size.
246
+ _react.default.createElement("div", {
247
+ onFocusCapture: announceFocusedElement,
248
+ style: {
249
+ width: "100%",
250
+ flex: "1 1 auto",
251
+ minHeight: 0,
252
+ display: "flex",
253
+ flexDirection: "column"
254
+ }
255
+ }, /*#__PURE__*/_react.default.createElement("div", {
256
+ role: "status",
257
+ "aria-live": "polite",
258
+ "aria-atomic": "true",
259
+ style: {
260
+ position: "absolute",
261
+ width: "1px",
262
+ height: "1px",
263
+ margin: "-1px",
264
+ padding: 0,
265
+ border: 0,
266
+ clip: "rect(0, 0, 0, 0)",
267
+ overflow: "hidden",
268
+ whiteSpace: "nowrap"
269
+ }
270
+ }, preChatFocusAnnouncement), /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.PreChatSurveyPane, {
271
+ controlProps: controlProps,
272
+ styleProps: styleProps
273
+ }))
274
+ );
181
275
  };
182
276
  exports.PreChatSurveyPaneStateful = PreChatSurveyPaneStateful;
183
277
  var _default = exports.default = PreChatSurveyPaneStateful;
@@ -11,6 +11,17 @@ const defaultGeneralPreChatSurveyPaneStyleProps = exports.defaultGeneralPreChatS
11
11
  backgroundColor: "#FFFFFF",
12
12
  borderColor: "#F1F1F1",
13
13
  overflowY: "auto",
14
- height: "inherit",
14
+ // Bug 6525143 / Bug 6423684: the focus-capture wrapper is a flex column sized to
15
+ // the space remaining below the header (flex: 1 1 auto). Fill that space via flex
16
+ // (flexGrow: 1 / flexBasis: 0 / minHeight: 0) instead of height: 100%, which
17
+ // resolved against the whole centered #oc-lcw container and pushed the header out
18
+ // (the clip). minHeight: 0 keeps the pane shrinkable so its overflowY scroll
19
+ // engages for tall surveys rather than growing the column and clipping the header.
20
+ // Note: the shared PreChatSurveyPane default (chat-components) still merges
21
+ // height: "inherit" underneath these props; under this flex parent that resolves
22
+ // to auto and is overridden by the flex main-size, so the pane still fills via flex.
23
+ flexGrow: 1,
24
+ flexBasis: 0,
25
+ minHeight: 0,
15
26
  width: "inherit"
16
27
  };
@@ -13,9 +13,15 @@ var _ConversationState = require("../../contexts/common/ConversationState");
13
13
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
14
14
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
15
15
  var _TelemetryManager = require("../../common/telemetry/TelemetryManager");
16
- var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
16
+ var _useChatContextStore3 = _interopRequireDefault(require("../../hooks/useChatContextStore"));
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
18
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
19
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
20
+ 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."); }
21
+ 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; } }
22
+ 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; }
23
+ 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; } }
24
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
19
25
  let uiTimer;
20
26
 
21
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -28,13 +34,17 @@ const ProactiveChatPaneStateful = props => {
28
34
  Description: "Proactive chat pane loading started."
29
35
  });
30
36
  }, []);
31
- const [state, dispatch] = (0, _useChatContextStore.default)();
32
- const {
33
- proactiveChatProps,
34
- startChat
35
- } = props;
37
+ const _useChatContextStore = (0, _useChatContextStore3.default)(),
38
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 2),
39
+ state = _useChatContextStore2[0],
40
+ dispatch = _useChatContextStore2[1];
41
+ const proactiveChatProps = props.proactiveChatProps,
42
+ startChat = props.startChat;
36
43
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- const [timeoutRemoved, setTimeoutRemoved] = (0, _react.useState)(false);
44
+ const _useState = (0, _react.useState)(false),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ timeoutRemoved = _useState2[0],
47
+ setTimeoutRemoved = _useState2[1];
38
48
  const handleProactiveChatInviteTimeout = () => {
39
49
  if (!timeoutRemoved) {
40
50
  setTimeoutRemoved(true);
@@ -11,10 +11,16 @@ var _ConversationState = require("../../contexts/common/ConversationState");
11
11
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
12
12
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
13
13
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
14
- var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
14
+ var _useChatContextStore3 = _interopRequireDefault(require("../../hooks/useChatContextStore"));
15
15
  var _useFacadeChatSDKStore = _interopRequireDefault(require("../../hooks/useFacadeChatSDKStore"));
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
18
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
19
+ 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."); }
20
+ 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; } }
21
+ 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; }
22
+ 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; } }
23
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
24
  let uiTimer;
19
25
  const ReconnectChatPaneStateful = props => {
20
26
  (0, _react.useEffect)(() => {
@@ -24,15 +30,18 @@ const ReconnectChatPaneStateful = props => {
24
30
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
25
31
  });
26
32
  }, []);
27
- const [state, dispatch] = (0, _useChatContextStore.default)();
33
+ const _useChatContextStore = (0, _useChatContextStore3.default)(),
34
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 2),
35
+ state = _useChatContextStore2[0],
36
+ dispatch = _useChatContextStore2[1];
28
37
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
38
  //const chatSDK: any = useChatSDKStore();
30
- const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
39
+ const _useFacadeChatSDKStor = (0, _useFacadeChatSDKStore.default)(),
40
+ _useFacadeChatSDKStor2 = _slicedToArray(_useFacadeChatSDKStor, 1),
41
+ facadeChatSDK = _useFacadeChatSDKStor2[0];
31
42
  const chatSDK = facadeChatSDK.getChatSDK();
32
- const {
33
- reconnectChatProps,
34
- initStartChat
35
- } = props;
43
+ const reconnectChatProps = props.reconnectChatProps,
44
+ initStartChat = props.initStartChat;
36
45
  const startChat = async continueChat => {
37
46
  dispatch({
38
47
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
@@ -16,9 +16,15 @@ var _defaultStartChatErrorPaneIconImageProps = require("./common/defaultStartCha
16
16
  var _defaultStartChatErrorPaneIconStyleProps = require("./common/defaultStartChatErrorPaneIconStyleProps");
17
17
  var _defaultStartChatErrorPaneSubtitleStyleProps = require("./common/defaultStartChatErrorPaneSubtitleStyleProps");
18
18
  var _defaultStartChatErrorPaneTitleStyleProps = require("./common/defaultStartChatErrorPaneTitleStyleProps");
19
- var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
19
+ var _useChatContextStore3 = _interopRequireDefault(require("../../hooks/useChatContextStore"));
20
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
22
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
23
+ 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."); }
24
+ 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; } }
25
+ 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; }
26
+ 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; } }
27
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
22
28
  let uiTimer;
23
29
  const StartChatErrorPaneStateful = startChatErrorPaneProps => {
24
30
  var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7, _startChatErrorPanePr8, _startChatErrorPanePr9, _startChatErrorPanePr0, _startChatErrorPanePr1;
@@ -28,7 +34,9 @@ const StartChatErrorPaneStateful = startChatErrorPaneProps => {
28
34
  Event: _TelemetryConstants.TelemetryEvent.UXStartChatErrorPaneStart
29
35
  });
30
36
  }, []);
31
- const [state] = (0, _useChatContextStore.default)();
37
+ const _useChatContextStore = (0, _useChatContextStore3.default)(),
38
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 1),
39
+ state = _useChatContextStore2[0];
32
40
  const generalStyleProps = Object.assign({}, _defaultStartChatErrorPaneGeneralStyleProps.defaultStartChatErrorPaneGeneralStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 || (_startChatErrorPanePr = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr === void 0 ? void 0 : _startChatErrorPanePr.generalStyleProps);
33
41
  const titleStyleProps = Object.assign({}, _defaultStartChatErrorPaneTitleStyleProps.defaultStartChatErrorPaneTitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 || (_startChatErrorPanePr2 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr2 === void 0 ? void 0 : _startChatErrorPanePr2.titleStyleProps);
34
42
  const subtitleStyleProps = Object.assign({}, _defaultStartChatErrorPaneSubtitleStyleProps.defaultStartChatErrorPaneSubtitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 || (_startChatErrorPanePr3 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr3 === void 0 ? void 0 : _startChatErrorPanePr3.subtitleStyleProps);
@@ -31,8 +31,15 @@ var _liveChatConfigUtils = require("../livechatwidget/common/liveChatConfigUtils
31
31
  var _ = require("../..");
32
32
  var _useFacadeChatSDKStore = _interopRequireDefault(require("../../hooks/useFacadeChatSDKStore"));
33
33
  var _usePersistentChatHistory = _interopRequireDefault(require("./hooks/usePersistentChatHistory"));
34
+ var _citationA11y = require("./common/utils/citationA11y");
34
35
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
35
36
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
37
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
38
+ 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."); }
39
+ 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; } }
40
+ 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; }
41
+ 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; } }
42
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
36
43
  let uiTimer;
37
44
  const broadcastChannelMessageEvent = "message";
38
45
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -61,8 +68,10 @@ const createMagicCodeSuccessResponse = signin => {
61
68
  };
62
69
  };
63
70
  const WebChatContainerStateful = props => {
64
- var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp0, _props$webChatContain4, _defaultWebChatContai2, _props$webChatContain5, _defaultWebChatContai3, _webChatContainerProp1, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _props$webChatContain6, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
65
- const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
71
+ var _props$webChatContain, _defaultWebChatContai, _props$webChatContain2, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp0, _props$webChatContain5, _defaultWebChatContai2, _props$webChatContain6, _defaultWebChatContai3, _webChatContainerProp1, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _props$webChatContain7, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
72
+ const _useFacadeSDKStore = (0, _useFacadeChatSDKStore.default)(),
73
+ _useFacadeSDKStore2 = _slicedToArray(_useFacadeSDKStore, 1),
74
+ facadeChatSDK = _useFacadeSDKStore2[0];
66
75
 
67
76
  // Create a font family that includes emoji support, based on the primary font or default
68
77
  const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles;
@@ -70,6 +79,10 @@ const WebChatContainerStateful = props => {
70
79
 
71
80
  // Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
72
81
  const fontFamilyWithEmojis = (0, _fontUtils.createIOSOptimizedEmojiFont)(primaryFont);
82
+
83
+ // Enforce minimum input font-size to prevent iOS Safari auto-zoom on focus
84
+ const configuredInputFontSize = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 || (_props$webChatContain2 = _props$webChatContain2.adaptiveCardStyles) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.inputFontSize) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.inputFontSize;
85
+ const inputFontSize = parseFloat(configuredInputFontSize ?? String(_Constants.Constants.minInputFontSizePx)) < _Constants.Constants.minInputFontSizePx ? _Constants.Constants.minInputFontSize : configuredInputFontSize;
73
86
  (0, _react2.useEffect)(() => {
74
87
  uiTimer = (0, _utils.createTimer)();
75
88
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -78,20 +91,25 @@ const WebChatContainerStateful = props => {
78
91
  }, []);
79
92
 
80
93
  // Citation pane state
81
- const [citationPaneOpen, setCitationPaneOpen] = (0, _react2.useState)(false);
82
- const [citationPaneText, setCitationPaneText] = (0, _react2.useState)("");
94
+ const _useState = (0, _react2.useState)(false),
95
+ _useState2 = _slicedToArray(_useState, 2),
96
+ citationPaneOpen = _useState2[0],
97
+ setCitationPaneOpen = _useState2[1];
98
+ const _useState3 = (0, _react2.useState)(""),
99
+ _useState4 = _slicedToArray(_useState3, 2),
100
+ citationPaneText = _useState4[0],
101
+ setCitationPaneText = _useState4[1];
83
102
 
84
103
  // Guard to prevent handling multiple rapid clicks which could cause
85
104
  // the dim layer and pane to re-render out of sync and create a flicker.
86
105
  const citationOpeningRef = (0, _react2.useRef)(false);
87
- const {
88
- BasicWebChat
89
- } = _botframeworkWebchat.Components;
90
- const [state, dispatch] = (0, _.useChatContextStore)();
91
- const {
92
- webChatContainerProps,
93
- contextDataStore
94
- } = props;
106
+ const BasicWebChat = _botframeworkWebchat.Components.BasicWebChat;
107
+ const _useChatContextStore = (0, _.useChatContextStore)(),
108
+ _useChatContextStore2 = _slicedToArray(_useChatContextStore, 2),
109
+ state = _useChatContextStore2[0],
110
+ dispatch = _useChatContextStore2[1];
111
+ const webChatContainerProps = props.webChatContainerProps,
112
+ contextDataStore = props.contextDataStore;
95
113
 
96
114
  // Type the chatConfig properly to avoid 'any' usage
97
115
  const extendedChatConfig = props.chatConfig;
@@ -150,23 +168,123 @@ const WebChatContainerStateful = props => {
150
168
  document.addEventListener("click", clickHandler);
151
169
  return () => document.removeEventListener("click", clickHandler);
152
170
  }, [state]);
171
+
172
+ // Accessibility: Merge citation card's number badge and link text into a single
173
+ // focusable element. WebChat's LinkDefinitionItem renders an <a> containing a
174
+ // badge <div> (the number, e.g. "1") and a text <div> (the title). On iOS
175
+ // VoiceOver and Android TalkBack, those block-level descendants are otherwise
176
+ // announced as two separate focusable links. The patch sets a combined
177
+ // aria-label on the anchor and hides every descendant from the a11y tree so
178
+ // the whole card is announced as one link.
179
+ (0, _react2.useEffect)(() => {
180
+ const webChatRoot = document.getElementById("ms_lcw_webchat_root");
181
+ if (!webChatRoot) {
182
+ return;
183
+ }
184
+ (0, _citationA11y.patchCitationAnchorsForA11y)(webChatRoot);
185
+ const observer = new MutationObserver(mutations => {
186
+ for (const m of mutations) {
187
+ if (m.type === "childList") {
188
+ m.addedNodes.forEach(node => {
189
+ if (node.nodeType === Node.ELEMENT_NODE) {
190
+ var _parentElement, _parentElement$closes;
191
+ (0, _citationA11y.patchCitationAnchorsForA11y)(node);
192
+ // A child added inside an existing anchor (e.g. React
193
+ // mounting OpenInNewWindowIcon after the anchor) means
194
+ // the parent anchor needs to re-walk its descendants.
195
+ const ancestor = (_parentElement = node.parentElement) === null || _parentElement === void 0 || (_parentElement$closes = _parentElement.closest) === null || _parentElement$closes === void 0 ? void 0 : _parentElement$closes.call(_parentElement, "a.webchat__link-definitions__list-item-box");
196
+ if (ancestor) {
197
+ (0, _citationA11y.patchCitationAnchorsForA11y)(ancestor);
198
+ }
199
+ }
200
+ });
201
+ } else if (m.type === "attributes" && m.target.nodeType === Node.ELEMENT_NODE) {
202
+ var _target$closest;
203
+ // React may strip our aria-hidden during a re-render; reapply
204
+ // by re-patching the closest matching anchor ancestor.
205
+ const target = m.target;
206
+ const ancestor = (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, "a.webchat__link-definitions__list-item-box");
207
+ if (ancestor) {
208
+ (0, _citationA11y.patchCitationAnchorsForA11y)(ancestor);
209
+ }
210
+ }
211
+ }
212
+ });
213
+ observer.observe(webChatRoot, {
214
+ childList: true,
215
+ subtree: true,
216
+ attributes: true,
217
+ attributeFilter: ["aria-hidden", "role", "tabindex", "inert"]
218
+ });
219
+ return () => observer.disconnect();
220
+ }, []);
221
+ const minimizedStyles = state.appStates.isMinimized ? shouldLoadPersistentHistoryMessages ? {
222
+ visibility: "hidden",
223
+ position: "absolute",
224
+ width: 0,
225
+ height: 0,
226
+ overflow: "hidden",
227
+ pointerEvents: "none"
228
+ } : {
229
+ display: "none"
230
+ } : {};
153
231
  const containerStyles = {
154
- root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
155
- display: state.appStates.isMinimized ? "none" : ""
156
- }) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
232
+ root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, minimizedStyles) // Use visibility-based hiding instead of display:none to preserve scroll position across minimize/maximize
157
233
  };
158
234
  const localizedTexts = {
159
235
  ..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
160
236
  ...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
161
237
  };
162
238
  (0, _react2.useEffect)(() => {
163
- var _props$webChatContain2;
239
+ var _props$webChatContain3;
164
240
  if ((0, _utils.getDeviceType)() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
165
241
  const chatHistoryElement = document.querySelector(`.${_Constants.HtmlClassNames.webChatHistoryContainer}`);
166
242
  if (chatHistoryElement) {
167
243
  chatHistoryElement.setAttribute(_Constants.HtmlAttributeNames.ariaLabel, webChatContainerProps.webChatHistoryMobileAccessibilityLabel);
168
244
  }
169
245
  }
246
+
247
+ // internal tracking: WebChats BasicToaster renders a `role="log"` container
248
+ // with no accessible name. When the toaster is empty (typical idle
249
+ // state) screen readers traversing the page announce it as "blank".
250
+ // Inject an aria-label so the region has a meaningful name; the
251
+ // consumer can override via the new
252
+ // `webChatNotificationRegionAccessibilityLabel` prop. The toaster
253
+ // may not be rendered yet when this effect first runs, so observe
254
+ // for it via a MutationObserver scoped to the widget root (or, if
255
+ // not yet mounted, the widget container's parent) so we never fire
256
+ // on host-page mutations outside the widget subtree.
257
+ const toasterLabel = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatNotificationRegionAccessibilityLabel) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatNotificationRegionAccessibilityLabel ?? "Chat notifications";
258
+ const labelToaster = root => {
259
+ const toaster = root.querySelector(".webchat__toaster[role='log']");
260
+ if (toaster && !toaster.getAttribute(_Constants.HtmlAttributeNames.ariaLabel)) {
261
+ toaster.setAttribute(_Constants.HtmlAttributeNames.ariaLabel, toasterLabel);
262
+ return true;
263
+ }
264
+ return false;
265
+ };
266
+ // Prefer the widget root; if it is not yet in the DOM, fall back to
267
+ // `document` for the *initial* lookup only, then observe the most
268
+ // specific available scope (widget root if present, otherwise the
269
+ // widget's parent / document.body as a last resort). The observer
270
+ // re-resolves the widget root on every callback so we tighten scope
271
+ // as soon as it mounts.
272
+ let toasterObserver;
273
+ const resolveScope = () => document.getElementById("ms_lcw_webchat_root") ?? document.body;
274
+ if (!labelToaster(resolveScope())) {
275
+ toasterObserver = new MutationObserver(() => {
276
+ const scope = resolveScope();
277
+ if (labelToaster(scope)) {
278
+ var _toasterObserver;
279
+ (_toasterObserver = toasterObserver) === null || _toasterObserver === void 0 || _toasterObserver.disconnect();
280
+ toasterObserver = undefined;
281
+ }
282
+ });
283
+ toasterObserver.observe(resolveScope(), {
284
+ childList: true,
285
+ subtree: true
286
+ });
287
+ }
170
288
  dispatch({
171
289
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
172
290
  payload: webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.renderingMiddlewareProps
@@ -178,7 +296,7 @@ const WebChatContainerStateful = props => {
178
296
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
179
297
  Event: _TelemetryConstants.TelemetryEvent.WebChatLoaded
180
298
  });
181
- if (((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 || (_props$webChatContain2 = _props$webChatContain2.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
299
+ if (((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 || (_props$webChatContain3 = _props$webChatContain3.renderingMiddlewareProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
182
300
  try {
183
301
  localStorage;
184
302
  sessionStorage;
@@ -191,10 +309,14 @@ const WebChatContainerStateful = props => {
191
309
  }
192
310
  }
193
311
  }
312
+ return () => {
313
+ var _toasterObserver2;
314
+ (_toasterObserver2 = toasterObserver) === null || _toasterObserver2 === void 0 || _toasterObserver2.disconnect();
315
+ };
194
316
  }, []);
195
317
  (0, _react2.useEffect)(() => {
196
- var _props$webChatContain3;
197
- if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain3 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain3 !== void 0 && _props$webChatContain3.disabled)) {
318
+ var _props$webChatContain4;
319
+ if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain4 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
198
320
  return;
199
321
  }
200
322
  if (!window.BroadcastChannel) {
@@ -210,14 +332,10 @@ const WebChatContainerStateful = props => {
210
332
 
211
333
  const eventListener = event => {
212
334
  // eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
213
- const {
214
- data
215
- } = event;
335
+ const data = event.data;
216
336
  if (_BotMagicCodeStore.BotMagicCodeStore.botOAuthSignInId === data.signin) {
217
- const {
218
- signin,
219
- code
220
- } = data;
337
+ const signin = data.signin,
338
+ code = data.code;
221
339
  const text = `${code}`;
222
340
  const action = postActivity({
223
341
  text,
@@ -292,9 +410,15 @@ const WebChatContainerStateful = props => {
292
410
  ${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp0 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp0 !== void 0 && _webChatContainerProp0.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
293
411
  }
294
412
 
413
+ div[class="ac-input-container"] input,
414
+ div[class="ac-input-container"] textarea,
415
+ div[class="ac-input-container"] select {
416
+ font-size: ${inputFontSize} !important;
417
+ }
418
+
295
419
  .ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
296
- background-color: ${((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 || (_props$webChatContain4 = _props$webChatContain4.webChatStyles) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.bubbleBackground) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
297
- color:${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 || (_props$webChatContain5 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.bubbleTextColor) ?? ((_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
420
+ background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 || (_props$webChatContain5 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.bubbleBackground) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
421
+ color:${((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 || (_props$webChatContain6 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleTextColor) ?? ((_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
298
422
  }
299
423
 
300
424
  div[class="ac-textBlock"] a:link,
@@ -379,7 +503,7 @@ const WebChatContainerStateful = props => {
379
503
  }
380
504
 
381
505
  .webchat__stacked-layout_container>div {
382
- background: ${(props === null || props === void 0 || (_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 || (_props$webChatContain6 = _props$webChatContain6.containerStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.background) ?? ""}
506
+ background: ${(props === null || props === void 0 || (_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 || (_props$webChatContain7 = _props$webChatContain7.containerStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.background) ?? ""}
383
507
  }
384
508
  .webchat__toast_text {
385
509
  display: flex;
@@ -408,6 +532,7 @@ const WebChatContainerStateful = props => {
408
532
 
409
533
  .webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
410
534
  font-family: ${fontFamilyWithEmojis} !important;
535
+ font-size: ${inputFontSize} !important;
411
536
  }
412
537
 
413
538
  /* Suggested actions carousel previous/next navigation focus */
@@ -58,6 +58,16 @@ let DesignerChatAdapter = exports.DesignerChatAdapter = /*#__PURE__*/function (_
58
58
  if (msg.text) {
59
59
  if (msg.suggestedActions) {
60
60
  (0, _chatAdapterUtils.postAgentSuggestedActionsActivity)(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
61
+ } else if (msg.from && msg.from.role) {
62
+ // Route caller-supplied `from` through the shared
63
+ // postBotMessageActivity helper so the activity shape
64
+ // (id, channelData.tags, timestamp, type) matches every
65
+ // other designer-mode path and downstream middleware
66
+ // (localizedStringsBotInitialsMiddleware, telemetry,
67
+ // attachment plumbing) behaves identically. The override
68
+ // narrows only the fields the caller cares about (e.g.
69
+ // from.name / from.role) — base botUser fields remain.
70
+ (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, msg.text, undefined, index * 100, msg.from);
61
71
  } else {
62
72
  (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, msg.text, undefined, index * 100);
63
73
  }