@microsoft/omnichannel-chat-widget 0.1.0-main.b59a07c → 0.1.0-main.bd0a90b

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 (323) hide show
  1. package/README.md +7 -2
  2. package/lib/cjs/assets/Icons.js +4 -2
  3. package/lib/cjs/common/Constants.js +32 -163
  4. package/lib/cjs/common/KeyCodes.js +3 -4
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -5
  6. package/lib/cjs/common/storage/default/defaultCacheManager.js +26 -0
  7. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +111 -0
  8. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  9. package/lib/cjs/common/telemetry/TelemetryConstants.js +57 -27
  10. package/lib/cjs/common/telemetry/TelemetryHelper.js +21 -59
  11. package/lib/cjs/common/telemetry/TelemetryManager.js +3 -32
  12. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +0 -2
  13. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +30 -36
  14. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +0 -9
  15. package/lib/cjs/common/utils.js +65 -93
  16. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +8 -46
  17. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +10 -24
  18. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  19. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -33
  20. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  21. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +9 -37
  22. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  23. package/lib/cjs/components/footerstateful/FooterStateful.js +11 -42
  24. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  25. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -43
  26. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  27. package/lib/cjs/components/headerstateful/HeaderStateful.js +20 -32
  28. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  29. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +39 -0
  30. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  31. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +20 -0
  32. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  33. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +34 -0
  34. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +64 -0
  35. package/lib/cjs/components/livechatwidget/common/Deferred.js +37 -0
  36. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  37. package/lib/cjs/components/livechatwidget/common/createAdapter.js +12 -9
  38. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  39. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  40. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -43
  41. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
  42. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +131 -51
  43. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  44. package/lib/cjs/components/livechatwidget/common/endChat.js +107 -54
  45. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  46. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  47. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  48. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +49 -58
  49. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +76 -129
  50. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
  51. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
  52. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  53. package/lib/cjs/components/livechatwidget/common/startChat.js +235 -127
  54. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  55. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  56. package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  57. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +317 -218
  58. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +26 -19
  59. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  60. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  61. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
  62. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  63. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  64. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  65. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  66. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  67. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +11 -43
  68. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  69. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +3 -33
  70. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -24
  71. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  72. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  73. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  74. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  75. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +12 -27
  76. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -17
  77. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  78. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +5 -15
  79. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  80. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  81. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +12 -0
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -5
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -37
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +10 -22
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +25 -61
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +7 -18
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +8 -42
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +4 -22
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  117. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  118. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  119. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  120. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  121. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  122. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  123. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
  124. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  125. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  126. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  127. package/lib/cjs/contexts/common/ConversationState.js +3 -3
  128. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +30 -26
  129. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +15 -13
  130. package/lib/cjs/contexts/createReducer.js +164 -102
  131. package/lib/cjs/controller/componentController.js +4 -33
  132. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  133. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  134. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  135. package/lib/cjs/hooks/useDebounce.js +28 -0
  136. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  137. package/lib/cjs/index.js +0 -5
  138. package/lib/cjs/plugins/newMessageEventHandler.js +29 -36
  139. package/lib/esm/assets/Icons.js +2 -1
  140. package/lib/esm/common/Constants.js +29 -150
  141. package/lib/esm/common/KeyCodes.js +3 -3
  142. package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -3
  143. package/lib/esm/common/storage/default/defaultCacheManager.js +18 -0
  144. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +104 -0
  145. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  146. package/lib/esm/common/telemetry/TelemetryConstants.js +61 -24
  147. package/lib/esm/common/telemetry/TelemetryHelper.js +21 -47
  148. package/lib/esm/common/telemetry/TelemetryManager.js +3 -19
  149. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +28 -24
  150. package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
  151. package/lib/esm/common/utils.js +60 -50
  152. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +8 -17
  153. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +12 -10
  154. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  155. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +10 -14
  156. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +9 -16
  157. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  158. package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
  159. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -36
  160. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  161. package/lib/esm/components/headerstateful/HeaderStateful.js +20 -17
  162. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  163. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -0
  164. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  165. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +13 -0
  166. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  167. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +27 -0
  168. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +57 -0
  169. package/lib/esm/components/livechatwidget/common/Deferred.js +30 -0
  170. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  171. package/lib/esm/components/livechatwidget/common/createAdapter.js +14 -4
  172. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  173. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  174. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  175. package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
  176. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +132 -37
  177. package/lib/esm/components/livechatwidget/common/endChat.js +108 -37
  178. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  179. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  180. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  181. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +52 -27
  182. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +77 -111
  183. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
  184. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
  185. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  186. package/lib/esm/components/livechatwidget/common/startChat.js +233 -103
  187. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  188. package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  189. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +321 -161
  190. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +26 -7
  191. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  192. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  193. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  194. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  195. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  196. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  197. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  198. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  199. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +14 -27
  200. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  201. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +5 -9
  202. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -6
  203. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  204. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  205. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  206. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  207. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +12 -19
  208. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -13
  209. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  210. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +5 -5
  211. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  212. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  213. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -3
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -22
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -14
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +25 -39
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +8 -9
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +9 -28
  241. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +5 -14
  242. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  243. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  244. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  245. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  246. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  247. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
  248. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  249. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  250. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  251. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  252. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  253. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  254. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  255. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
  256. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  257. package/lib/esm/contexts/ChatContextStore.js +2 -1
  258. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  259. package/lib/esm/contexts/common/ConversationState.js +3 -3
  260. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +30 -26
  261. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +15 -9
  262. package/lib/esm/contexts/createReducer.js +164 -99
  263. package/lib/esm/controller/componentController.js +5 -4
  264. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  265. package/lib/esm/hooks/useChatContextStore.js +0 -4
  266. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  267. package/lib/esm/hooks/useDebounce.js +22 -0
  268. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  269. package/lib/esm/plugins/newMessageEventHandler.js +29 -26
  270. package/lib/types/assets/Icons.d.ts +1 -0
  271. package/lib/types/common/Constants.d.ts +22 -0
  272. package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
  273. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  274. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  275. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  276. package/lib/types/common/telemetry/TelemetryConstants.d.ts +44 -9
  277. package/lib/types/common/telemetry/definitions/Contracts.d.ts +4 -4
  278. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  279. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  280. package/lib/types/common/utils.d.ts +7 -3
  281. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  282. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  283. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  284. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  285. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  286. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  287. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  288. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  289. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  290. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
  291. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -7
  292. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  293. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -2
  294. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +4 -1
  295. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -2
  296. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
  297. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  298. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  299. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  300. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  301. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -2
  302. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  303. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  304. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  305. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  306. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  307. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  308. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  309. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  310. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  311. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  312. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  313. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  314. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  315. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  316. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  317. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  318. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -3
  319. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +30 -25
  320. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  321. package/lib/types/hooks/useDebounce.d.ts +3 -0
  322. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  323. package/package.json +5 -4
@@ -19,10 +19,10 @@ describe("EmailTranscriptPaneStateful unit test", () => {
19
19
  attachmentMessage: "sample",
20
20
  locale: "sample"
21
21
  };
22
-
23
22
  try {
24
23
  await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
25
- expect(chatSDK.emailLiveChatTranscript).toHaveBeenCalledTimes(1); // eslint-disable-next-line no-empty
24
+ expect(chatSDK.emailLiveChatTranscript).toHaveBeenCalledTimes(1);
25
+ // eslint-disable-next-line no-empty
26
26
  } catch (ex) {}
27
27
  });
28
28
  it("Method emailLiveChatTranscript throws exception", async () => {
@@ -39,9 +39,9 @@ describe("EmailTranscriptPaneStateful unit test", () => {
39
39
  attachmentMessage: "sample",
40
40
  locale: "sample"
41
41
  };
42
-
43
42
  try {
44
- await chatSDK.emailLiveChatTranscript(chatTranscriptBody); // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
45
  } catch (ex) {
46
46
  expect(ex.message).toEqual(errorMessage);
47
47
  }
@@ -59,9 +59,9 @@ describe("EmailTranscriptPaneStateful unit test", () => {
59
59
  attachmentMessage: "sample",
60
60
  locale: "sample"
61
61
  };
62
-
63
62
  try {
64
- await chatSDK.emailLiveChatTranscript(chatTranscriptBody); // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
65
  } catch (ex) {
66
66
  expect(ex.message).toEqual(errorMessage);
67
67
  }
@@ -10,22 +10,22 @@ import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontro
10
10
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
11
11
  import { downloadTranscript } from "./downloadtranscriptstateful/DownloadTranscriptStateful";
12
12
  import useChatContextStore from "../../hooks/useChatContextStore";
13
- import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ import useChatSDKStore from "../../hooks/useChatSDKStore";
14
14
 
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
16
  export const FooterStateful = props => {
16
17
  var _footerProps$controlP3, _footerProps$controlP4;
17
-
18
- const [state, dispatch] = useChatContextStore(); // hideFooterDisplay - the purpose of this is to keep the footer always "active",
18
+ const [state, dispatch] = useChatContextStore();
19
+ // hideFooterDisplay - the purpose of this is to keep the footer always "active",
19
20
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
20
21
  // The reason for this approach is to make sure that state variables for audio notification work correctly after minimizing
21
-
22
22
  const {
23
23
  footerProps,
24
24
  downloadTranscriptProps,
25
25
  audioNotificationProps,
26
26
  hideFooterDisplay
27
- } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
-
27
+ } = props;
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
29
  const chatSDK = useChatSDKStore();
30
30
  const controlProps = {
31
31
  id: "oc-lcw-footer",
@@ -49,21 +49,17 @@ export const FooterStateful = props => {
49
49
  },
50
50
  onEmailTranscriptClick: () => {
51
51
  var _footerProps$controlP, _footerProps$controlP2;
52
-
53
52
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
54
53
  Event: TelemetryEvent.EmailTranscriptButtonClicked,
55
54
  Description: "Email Transcript button clicked."
56
55
  });
57
- const emailTranscriptButtonId = (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP = footerProps.controlProps) === null || _footerProps$controlP === void 0 ? void 0 : (_footerProps$controlP2 = _footerProps$controlP.emailTranscriptButtonProps) === null || _footerProps$controlP2 === void 0 ? void 0 : _footerProps$controlP2.id) ?? "oc-lcw-footer-emailtranscript-button";
58
- const emailTranscriptButton = document.getElementById(emailTranscriptButtonId);
59
-
60
- if (emailTranscriptButton) {
56
+ const emailTranscriptButtonId = (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP = footerProps.controlProps) === null || _footerProps$controlP === void 0 ? void 0 : (_footerProps$controlP2 = _footerProps$controlP.emailTranscriptButtonProps) === null || _footerProps$controlP2 === void 0 ? void 0 : _footerProps$controlP2.id) ?? `${controlProps.id}-emailtranscript-button`;
57
+ if (emailTranscriptButtonId) {
61
58
  dispatch({
62
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
63
- payload: emailTranscriptButton
59
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
60
+ payload: emailTranscriptButtonId
64
61
  });
65
62
  }
66
-
67
63
  dispatch({
68
64
  type: LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE,
69
65
  payload: true
@@ -80,18 +76,12 @@ export const FooterStateful = props => {
80
76
  });
81
77
  },
82
78
  ...(footerProps === null || footerProps === void 0 ? void 0 : footerProps.controlProps),
83
- audioNotificationButtonProps: { ...(footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP3 = footerProps.controlProps) === null || _footerProps$controlP3 === void 0 ? void 0 : _footerProps$controlP3.audioNotificationButtonProps),
79
+ audioNotificationButtonProps: {
80
+ ...(footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP3 = footerProps.controlProps) === null || _footerProps$controlP3 === void 0 ? void 0 : _footerProps$controlP3.audioNotificationButtonProps),
84
81
  isAudioMuted: state.appStates.isAudioMuted
85
82
  }
86
83
  };
87
- const footerId = (controlProps === null || controlProps === void 0 ? void 0 : controlProps.id) ?? "oc-lcw-footer";
88
- const footer = document.getElementById(footerId);
89
-
90
- if (footer) {
91
- footer.style.display = hideFooterDisplay ? "none" : "";
92
- }
93
-
94
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Footer, {
84
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !hideFooterDisplay && /*#__PURE__*/React.createElement(Footer, {
95
85
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
96
86
  controlProps: controlProps,
97
87
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
@@ -3,27 +3,21 @@ import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcon
3
3
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
4
4
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
5
5
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
6
-
7
6
  const processDisplayName = displayName => {
8
7
  // if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
9
8
  const displayNameRegex = ".+:.+";
10
9
  const matchedTeamsDisplayName = displayName.match(displayNameRegex);
11
-
12
10
  if (displayName.indexOf("teamsvisitor") >= 0 && matchedTeamsDisplayName && matchedTeamsDisplayName.length > 0) {
13
11
  displayName = "Customer";
14
12
  }
15
-
16
13
  return displayName;
17
14
  };
18
-
19
15
  const constructIconName = displayName => {
20
16
  if (!displayName) {
21
17
  return "";
22
18
  }
23
-
24
19
  let iconName = "C";
25
20
  const displayNameSplit = displayName.split(" ");
26
-
27
21
  if (displayNameSplit.length > 1) {
28
22
  // get the first letter of name and surname
29
23
  iconName = displayNameSplit[0][0] + displayNameSplit[1][0];
@@ -31,55 +25,42 @@ const constructIconName = displayName => {
31
25
  // get the first letter of name
32
26
  iconName = displayNameSplit[0][0];
33
27
  }
34
-
35
28
  return iconName;
36
29
  };
37
-
38
30
  const processCreatedDateTime = (createdDateTime, chatCount) => {
39
- const formattedDate = new Date(createdDateTime); // TODO: Localization:
40
-
41
- const formattedTimeString = formattedDate.toLocaleTimeString("en-us"
42
- /* Bootstrapper.LiveChatConfiguration.chatWidgetLocale */
43
- , {
31
+ const formattedDate = new Date(createdDateTime);
32
+ // TODO: Localization:
33
+ const formattedTimeString = formattedDate.toLocaleTimeString("en-us" /* Bootstrapper.LiveChatConfiguration.chatWidgetLocale */, {
44
34
  hour: "2-digit",
45
35
  minute: "2-digit"
46
36
  });
47
37
  const formattedSplitTimeString = formattedTimeString.split(" ");
48
38
  let finalizedTimeString = "";
49
-
50
39
  if (formattedSplitTimeString && formattedSplitTimeString.length > 1) {
51
40
  finalizedTimeString = formattedSplitTimeString[0] + " " + formattedSplitTimeString[1];
52
41
  }
53
-
54
42
  if (chatCount == 0) {
55
43
  return formattedDate.toLocaleDateString("en-us") + " " + finalizedTimeString;
56
44
  }
57
-
58
45
  return finalizedTimeString;
59
46
  };
60
-
61
47
  const processContent = (transcriptContent, isAgentChat, renderMarkDown) => {
62
48
  if (transcriptContent.toString().toLowerCase().indexOf(TranscriptConstants.TranscriptMessageEmojiMessageType) >= 0) {
63
49
  // eslint-disable-next-line no-useless-escape
64
50
  const emojiRegex = "<img src=\"http.*:\/\/.+\/objects\/.+\/views.+\">";
65
51
  const matchedEmojiImgTag = transcriptContent.match(emojiRegex);
66
-
67
52
  if (matchedEmojiImgTag && matchedEmojiImgTag.length > 0 && transcriptContent.toString().toLowerCase().indexOf(matchedEmojiImgTag[0]) >= 0) {
68
53
  transcriptContent = transcriptContent.replace(matchedEmojiImgTag[0], "");
69
54
  }
70
55
  }
71
-
72
56
  if (!isAgentChat && transcriptContent.toString().toLowerCase().indexOf("a href") >= 0 && transcriptContent.toString().toLowerCase().indexOf("target") >= 0) {
73
57
  transcriptContent = transcriptContent.slice(0, transcriptContent.toString().indexOf("target")) + " style='color:white' " + transcriptContent.slice(transcriptContent.toString().indexOf("target"));
74
58
  }
75
-
76
59
  if (renderMarkDown) {
77
60
  transcriptContent = renderMarkDown(transcriptContent);
78
61
  }
79
-
80
62
  return transcriptContent;
81
63
  };
82
-
83
64
  const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMessage) => {
84
65
  const chats = JSON.parse(chatTranscripts).reverse();
85
66
  const docTypeTag = "<!DOCTYPE html>";
@@ -94,8 +75,9 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
94
75
  let tabIndex = 1;
95
76
  const mainTranscriptSection = "<div class='allTranscripts' style='max-width:60%;min-width:30%;margin-left:20%;background-color:#FFFFFF;'>";
96
77
  let previousDisplayName = "";
97
- let chatCount = 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ let chatCount = 0;
98
79
 
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
81
  chats.forEach(value => {
100
82
  let dialogNameMarginTop = "6px";
101
83
  let dialogboxMarginleft = "40px";
@@ -105,8 +87,13 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
105
87
  let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
106
88
  let dialogColor = TranscriptConstants.CustomerDialogColor;
107
89
  let fontColor = TranscriptConstants.CustomerFontColor;
108
-
109
- if (value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1 || value.isControlMessage && value.isControlMessage === true || value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType || value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode) {
90
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
91
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
92
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
93
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
94
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
95
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
96
+ if (shouldIgnoreMessage) {
110
97
  return;
111
98
  } else if (value.from) {
112
99
  if (value.from.application) {
@@ -121,19 +108,15 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
121
108
  displayName = value.from.user.displayName;
122
109
  dialogColor = TranscriptConstants.CustomerDialogColor;
123
110
  }
124
-
125
111
  displayName = processDisplayName(displayName);
126
112
  iconName = constructIconName(displayName);
127
-
128
113
  if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
129
114
  fileAttachmentName = value.attachments[0].name;
130
115
  value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
131
116
  }
132
117
  }
133
-
134
118
  let displayNamePlaceholder = processCreatedDateTime(value.createdDateTime, chatCount);
135
119
  let iconPara = "";
136
-
137
120
  if (displayName !== previousDisplayName) {
138
121
  dialogboxMarginleft = "0px";
139
122
  displayNamePlaceholder = "<b>" + displayName + " </b> " + processCreatedDateTime(value.createdDateTime, chatCount);
@@ -144,17 +127,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
144
127
  </div>";
145
128
  tabIndex++;
146
129
  }
147
-
148
130
  if (displayName !== previousDisplayName) {
149
131
  if (previousDisplayName === "") {
150
132
  dialogNameMarginTop = "0px";
151
133
  }
152
-
153
134
  if (previousDisplayName !== "") {
154
135
  dialogNameMarginTop = "20px";
155
136
  }
156
137
  }
157
-
158
138
  const displayNameDiv = "<div style='margin-right:-2px;margin-top:" + dialogNameMarginTop + ";margin-bottom:-2px;margin-left:42px;top:-2px;position:relative;'>\
159
139
  <font tabindex ='" + tabIndex + "' size = '1px' color='#000000' style='font-family:Segoe UI,SegoeUI,Helvetica Neue,Helvetica,Arial,sans-serif;font-weight:500;'>\
160
140
  " + displayNamePlaceholder + "\
@@ -168,16 +148,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
168
148
  });
169
149
  const str = docTypeTag + docStartTag + docMetaTag + bodyStartTag + mainTranscriptSection + beautifiedChats + divEndTag + bodyEndTag + docEndTag;
170
150
  return str;
171
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
-
151
+ };
173
152
 
153
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
154
  export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageOnError, attachmentMessage) => {
175
155
  let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript());
176
-
177
156
  if (typeof data === Constants.String) {
178
157
  data = JSON.parse(data);
179
158
  }
180
-
181
159
  if (data[Constants.ChatMessagesJson] !== null && data[Constants.ChatMessagesJson] !== undefined) {
182
160
  const chatTranscripts = window.btoa(encodeURIComponent(beautifyChatTranscripts(data[Constants.ChatMessagesJson], renderMarkDown, attachmentMessage)));
183
161
  const byteCharacters = decodeURIComponent(window.atob(chatTranscripts));
@@ -14,10 +14,10 @@ describe("DownloadTranscriptStateful unit test", () => {
14
14
  };
15
15
  const chatSDK = new OmnichannelChatSDK(omnichannelConfig);
16
16
  jest.spyOn(chatSDK, "getLiveChatTranscript").mockResolvedValue(Promise.resolve());
17
-
18
17
  try {
19
18
  await chatSDK.getLiveChatTranscript();
20
- expect(chatSDK.getLiveChatTranscript).toHaveBeenCalledTimes(1); // eslint-disable-next-line no-empty
19
+ expect(chatSDK.getLiveChatTranscript).toHaveBeenCalledTimes(1);
20
+ // eslint-disable-next-line no-empty
21
21
  } catch (ex) {}
22
22
  });
23
23
  it("Method getLiveChatTranscript throws exception", async () => {
@@ -29,9 +29,9 @@ describe("DownloadTranscriptStateful unit test", () => {
29
29
  };
30
30
  const chatSDK = new OmnichannelChatSDK(omnichannelConfig);
31
31
  jest.spyOn(chatSDK, "getLiveChatTranscript").mockRejectedValue(new Error(errorMessage));
32
-
33
32
  try {
34
- await chatSDK.getLiveChatTranscript(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ await chatSDK.getLiveChatTranscript();
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
35
  } catch (ex) {
36
36
  expect(ex.message).toEqual(errorMessage);
37
37
  }
@@ -44,9 +44,9 @@ describe("DownloadTranscriptStateful unit test", () => {
44
44
  widgetId: ""
45
45
  };
46
46
  const chatSDK = new OmnichannelChatSDK(omnichannelConfig);
47
-
48
47
  try {
49
- await chatSDK.getLiveChatTranscript(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ await chatSDK.getLiveChatTranscript();
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
50
  } catch (ex) {
51
51
  expect(ex.message).toEqual(errorMessage);
52
52
  }
@@ -9,19 +9,19 @@ import useChatAdapterStore from "../../hooks/useChatAdapterStore";
9
9
  import useChatContextStore from "../../hooks/useChatContextStore";
10
10
  export const HeaderStateful = props => {
11
11
  var _state$domainStates$l, _state$domainStates$l2, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro;
12
-
13
- const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
-
12
+ const [state, dispatch] = useChatContextStore();
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
14
  const [adapter] = useChatAdapterStore();
16
15
  const {
17
16
  headerProps,
18
17
  outOfOfficeHeaderProps,
19
18
  endChat
20
- } = props; //Setting OutOfOperatingHours Flag
21
-
19
+ } = props;
20
+ //Setting OutOfOperatingHours Flag
22
21
  const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
23
22
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
24
23
  const conversationState = useRef(state.appStates.conversationState);
24
+ const conversationEndedByAgent = useRef(state.appStates.conversationEndedByAgent);
25
25
  const controlProps = {
26
26
  id: "oc-lcw-header",
27
27
  dir: state.domainStates.globalDir,
@@ -36,12 +36,12 @@ export const HeaderStateful = props => {
36
36
  });
37
37
  },
38
38
  onCloseClick: async () => {
39
+ var _props$headerProps, _props$headerProps$co, _props$headerProps$co2;
39
40
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
40
41
  Event: TelemetryEvent.HeaderCloseButtonClicked,
41
42
  Description: "Header Close button clicked."
42
43
  });
43
-
44
- if (conversationState.current === ConversationState.Active) {
44
+ if (conversationState.current === ConversationState.Active || conversationEndedByAgent.current) {
45
45
  dispatch({
46
46
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
47
47
  payload: true
@@ -49,18 +49,21 @@ export const HeaderStateful = props => {
49
49
  } else {
50
50
  const skipEndChatSDK = true;
51
51
  const skipCloseChat = false;
52
- await endChat(adapter, skipEndChatSDK, skipCloseChat);
52
+ const postMessageToOtherTabs = true;
53
+ await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
54
+ }
55
+ const closeButtonId = ((_props$headerProps = props.headerProps) === null || _props$headerProps === void 0 ? void 0 : (_props$headerProps$co = _props$headerProps.controlProps) === null || _props$headerProps$co === void 0 ? void 0 : (_props$headerProps$co2 = _props$headerProps$co.closeButtonProps) === null || _props$headerProps$co2 === void 0 ? void 0 : _props$headerProps$co2.id) ?? `${controlProps.id}-close-button`;
56
+ if (closeButtonId) {
57
+ dispatch({
58
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
59
+ payload: closeButtonId
60
+ });
53
61
  }
54
-
55
- dispatch({
56
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
57
- payload: document.getElementById(`${controlProps.id}-closebutton`)
58
- });
59
62
  },
60
63
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
61
- hideTitle: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
62
- hideIcon: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
63
- hideCloseButton: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
64
+ hideTitle: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
65
+ hideIcon: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
66
+ hideCloseButton: state.appStates.conversationState === ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === ConversationState.PostchatLoading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
64
67
  };
65
68
  const outOfOfficeControlProps = {
66
69
  id: "oc-lcw-header",
@@ -81,10 +84,10 @@ export const HeaderStateful = props => {
81
84
  if (state.appStates.outsideOperatingHours) {
82
85
  setOutOfOperatingHours(true);
83
86
  }
84
-
85
87
  if (state.appStates.conversationState) {
86
88
  conversationState.current = state.appStates.conversationState;
87
89
  }
90
+ conversationEndedByAgent.current = state.appStates.conversationEndedByAgent;
88
91
  }, [state.appStates]);
89
92
  return /*#__PURE__*/React.createElement(Header, {
90
93
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
@@ -7,8 +7,8 @@ import { createReducer } from "../../contexts/createReducer";
7
7
  import { getLiveChatWidgetContextInitialState } from "../../contexts/common/LiveChatWidgetContextInitialState";
8
8
  export const LiveChatWidget = props => {
9
9
  const reducer = createReducer();
10
- const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props)); // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
-
10
+ const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props));
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  const [adapter, setAdapter] = useState(undefined);
13
13
  return /*#__PURE__*/React.createElement(ChatSDKStore.Provider, {
14
14
  value: props.chatSDK
@@ -0,0 +1,32 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { Deferred } from "./Deferred";
5
+ export class ActivityStreamHandler {
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+
10
+ /**
11
+ * Use of a deferred pattern, to hold the execution of the activity.
12
+ *
13
+ * */
14
+ static cork() {
15
+ ActivityStreamHandler.restoreDeferred = new Deferred();
16
+ ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
17
+ }
18
+
19
+ /**
20
+ * Resolve the promise, releasing it to continue with the execution of the activity.
21
+ *
22
+ * */
23
+ static uncork() {
24
+ ActivityStreamHandler.restoreDeferred.resolve();
25
+ }
26
+ }
27
+ _defineProperty(ActivityStreamHandler, "restoreDeferred", {
28
+ resolve: () => {
29
+ return "initialState";
30
+ }
31
+ });
32
+ _defineProperty(ActivityStreamHandler, "restorePromise", void 0);
@@ -0,0 +1,134 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
7
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../../common/telemetry/TelemetryConstants";
8
+ import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
9
+ const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
10
+ const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
11
+ const delay = t => new Promise(resolve => setTimeout(resolve, t));
12
+ const fetchBotAuthConfigRetries = 3;
13
+ const fetchBotAuthConfigRetryInterval = 1000;
14
+ let response;
15
+ const extractSignInId = signInUrl => {
16
+ const result = botOauthUrlRegex.exec(signInUrl);
17
+ if (result && result[1]) {
18
+ return result[1];
19
+ }
20
+ return "";
21
+ };
22
+ const extractSasUrl = async attachment => {
23
+ let sasUrl = undefined;
24
+ if (attachment && attachment.content && attachment.content.tokenPostResource && attachment.content.tokenPostResource.sasUrl) {
25
+ sasUrl = attachment.content.tokenPostResource.sasUrl;
26
+ }
27
+ if (!sasUrl) {
28
+ const signInId = extractSignInId(attachment.content.buttons[0].value);
29
+ const getTestUrlEndpoint = `https://token.botframework.com/api/sas/gettesturl?signInId=${signInId}`;
30
+ try {
31
+ const response = await window.fetch(getTestUrlEndpoint);
32
+ if (response.status === 200) {
33
+ const responseJson = await response.json();
34
+ sasUrl = responseJson.sasUrl;
35
+ }
36
+ } catch {
37
+ sasUrl = undefined;
38
+ }
39
+ }
40
+ return sasUrl;
41
+ };
42
+ const fetchBotAuthConfig = async retries => {
43
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
44
+ Event: TelemetryEvent.SetBotAuthProviderFetchConfig
45
+ });
46
+ const botAuthConfigRequestEvent = {
47
+ eventName: BroadcastEvent.BotAuthConfigRequest
48
+ };
49
+ BroadcastService.postMessage(botAuthConfigRequestEvent);
50
+ const listener = BroadcastService.getMessageByEventName(BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
51
+ var _data$payload, _data$payload2;
52
+ response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
53
+ listener.unsubscribe();
54
+ });
55
+ if (response !== undefined) {
56
+ //return response;
57
+ return response;
58
+ }
59
+ if (retries === 1) {
60
+ // Base Case
61
+ throw new Error();
62
+ }
63
+ await delay(fetchBotAuthConfigRetryInterval);
64
+ return await fetchBotAuthConfig(--retries);
65
+ };
66
+ export class BotAuthActivitySubscriber {
67
+ constructor() {
68
+ _defineProperty(this, "observer", void 0);
69
+ _defineProperty(this, "signInCardSeen", void 0);
70
+ this.signInCardSeen = new Set();
71
+ }
72
+ applicable(activity) {
73
+ var _activity$attachments;
74
+ return (activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) > 0 && activity.attachments[0] && supportedSignInCardContentTypes.indexOf(activity.attachments[0].contentType) >= 0;
75
+ }
76
+ async apply(activity) {
77
+ this.observer.next(false); // Hides card
78
+ const attachment = activity.attachments[0];
79
+ const signInUrl = attachment.content.buttons[0].value;
80
+ const signInId = extractSignInId(signInUrl);
81
+ if (!signInId) {
82
+ return;
83
+ }
84
+ if (this.signInCardSeen.has(signInId)) {
85
+ // Prevents duplicate auth
86
+ return;
87
+ }
88
+ this.signInCardSeen.add(signInId);
89
+ const sasUrl = await extractSasUrl(attachment);
90
+ const event = {
91
+ eventName: BroadcastEvent.SigninCardReceived,
92
+ payload: {
93
+ sasUrl
94
+ }
95
+ };
96
+ if (!sasUrl) {
97
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
98
+ Event: TelemetryEvent.BotAuthActivityEmptySasUrl,
99
+ Description: "SaS Url is empty"
100
+ });
101
+ return activity;
102
+ } else {
103
+ BroadcastService.postMessage(event);
104
+ }
105
+ try {
106
+ const response = await fetchBotAuthConfig(fetchBotAuthConfigRetries);
107
+ if (response === false) {
108
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
109
+ Event: TelemetryEvent.SetBotAuthProviderHideCard
110
+ });
111
+ } else {
112
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
113
+ Event: TelemetryEvent.SetBotAuthProviderDisplayCard
114
+ });
115
+ return activity;
116
+ }
117
+ } catch {
118
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
119
+ Event: TelemetryEvent.SetBotAuthProviderNotFound
120
+ });
121
+ //this is to ensure listener continues waiting for response
122
+ if (this.signInCardSeen.has(signInId)) {
123
+ this.signInCardSeen.delete(signInId);
124
+ }
125
+ return activity;
126
+ }
127
+ }
128
+ async next(activity) {
129
+ if (this.applicable(activity)) {
130
+ return await this.apply(activity);
131
+ }
132
+ return activity;
133
+ }
134
+ }
@@ -0,0 +1,13 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ export class DefaultActivitySubscriber {
5
+ constructor() {
6
+ _defineProperty(this, "observer", void 0);
7
+ }
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ async next(activity) {
10
+ this.observer.next(activity);
11
+ return false;
12
+ }
13
+ }
@@ -0,0 +1,27 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { ActivityStreamHandler } from "../ActivityStreamHandler";
5
+ export class PauseActivitySubscriber {
6
+ constructor() {
7
+ _defineProperty(this, "observer", void 0);
8
+ }
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ async apply(activity) {
11
+ await ActivityStreamHandler.restorePromise;
12
+ return activity;
13
+ }
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
16
+ applicable(activity) {
17
+ return true;
18
+ }
19
+
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ async next(activity) {
22
+ if (this.applicable(activity)) {
23
+ return await this.apply(activity);
24
+ }
25
+ return activity;
26
+ }
27
+ }