@microsoft/omnichannel-chat-widget 0.1.0-main.861673e → 0.1.0-main.875499b

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 (242) hide show
  1. package/README.md +259 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +28 -0
  4. package/lib/cjs/common/Constants.js +54 -4
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
  6. package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
  7. package/lib/cjs/common/storage/default/defaultCacheManager.js +34 -0
  8. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +114 -0
  9. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +86 -0
  10. package/lib/cjs/common/telemetry/TelemetryConstants.js +74 -5
  11. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  12. package/lib/cjs/common/telemetry/TelemetryManager.js +17 -6
  13. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  14. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  15. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +54 -21
  16. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  17. package/lib/cjs/common/utils.js +89 -2
  18. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  19. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  20. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -58
  21. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +6 -6
  22. package/lib/cjs/components/footerstateful/FooterStateful.js +9 -18
  23. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  24. package/lib/cjs/components/headerstateful/HeaderStateful.js +23 -13
  25. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
  26. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
  27. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  28. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
  29. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
  30. package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
  31. package/lib/cjs/components/livechatwidget/common/authHelper.js +65 -0
  32. package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
  33. package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
  34. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
  35. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +32 -32
  36. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +79 -40
  37. package/lib/cjs/components/livechatwidget/common/endChat.js +142 -47
  38. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  39. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +48 -12
  40. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
  41. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -5
  42. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
  43. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  44. package/lib/cjs/components/livechatwidget/common/startChat.js +207 -41
  45. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  46. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +331 -77
  47. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  48. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  49. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  50. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
  51. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  52. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  53. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
  54. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  55. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +110 -2
  56. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  57. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  58. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  59. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  60. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  61. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  62. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  63. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  64. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  65. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  66. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  67. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  68. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  69. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  70. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  71. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  72. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  74. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  75. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +13 -8
  76. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +19 -5
  77. package/lib/cjs/contexts/createReducer.js +39 -12
  78. package/lib/cjs/controller/componentController.js +5 -5
  79. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  80. package/lib/esm/assets/Audios.js +1 -0
  81. package/lib/esm/assets/Icons.js +11 -0
  82. package/lib/esm/common/Constants.js +50 -3
  83. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  84. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  85. package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
  86. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  87. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
  88. package/lib/esm/common/telemetry/TelemetryConstants.js +70 -4
  89. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  90. package/lib/esm/common/telemetry/TelemetryManager.js +15 -6
  91. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  92. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  93. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +55 -17
  94. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  95. package/lib/esm/common/utils.js +64 -1
  96. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  97. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  98. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -54
  99. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +6 -6
  100. package/lib/esm/components/footerstateful/FooterStateful.js +9 -18
  101. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  102. package/lib/esm/components/headerstateful/HeaderStateful.js +24 -14
  103. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  104. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  105. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  106. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  107. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  108. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  109. package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
  110. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  111. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
  112. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
  113. package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
  114. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +77 -41
  115. package/lib/esm/components/livechatwidget/common/endChat.js +139 -46
  116. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  117. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +42 -13
  118. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
  119. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -4
  120. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
  121. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  122. package/lib/esm/components/livechatwidget/common/startChat.js +195 -39
  123. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  124. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +318 -82
  125. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  126. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  127. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  128. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -4
  129. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  130. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  131. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
  132. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  133. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +97 -2
  134. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  135. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  136. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  137. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  138. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  139. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  140. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  141. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  142. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  143. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  144. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  145. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  146. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  147. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  148. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  149. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  150. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  151. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  152. package/lib/esm/contexts/common/ConversationState.js +4 -2
  153. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +13 -8
  154. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +17 -5
  155. package/lib/esm/contexts/createReducer.js +39 -11
  156. package/lib/esm/controller/componentController.js +5 -5
  157. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  158. package/lib/types/assets/Audios.d.ts +1 -0
  159. package/lib/types/assets/Icons.d.ts +11 -0
  160. package/lib/types/common/Constants.d.ts +27 -1
  161. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  162. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  163. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  164. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  165. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  166. package/lib/types/common/telemetry/TelemetryConstants.d.ts +48 -2
  167. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  168. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  169. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  170. package/lib/types/common/utils.d.ts +8 -1
  171. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  172. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  173. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  174. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  175. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  176. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  177. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  178. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  179. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  180. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  181. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  182. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  183. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  184. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  185. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  186. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  187. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  188. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  189. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -2
  190. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  191. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  192. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  193. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  194. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  195. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  196. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  197. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  198. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  199. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  200. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  201. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  202. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  203. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  204. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  205. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  206. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  207. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  208. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  209. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  210. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  211. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  212. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  213. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -2
  214. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +14 -9
  215. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  216. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  217. package/package.json +14 -13
  218. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  219. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  220. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  221. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  222. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  223. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  224. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  225. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  226. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  227. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  228. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  229. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  230. package/lib/esm/assets/assets.d.js +0 -0
  231. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  232. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  233. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  234. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  235. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  236. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  237. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  238. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  239. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  240. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  241. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  242. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -1,40 +1,29 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
+ import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
2
3
  import React, { useEffect } from "react";
3
4
  import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
4
- import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
5
- import { Constants } from "../../common/Constants";
6
- import { ConversationState } from "../../contexts/common/ConversationState";
7
5
  import { DimLayer } from "../dimlayer/DimLayer";
8
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
9
7
  import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
10
8
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
11
- import { PostChatSurveyMode } from "../postchatsurveypanestateful/enums/PostChatSurveyMode";
12
9
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
13
10
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
14
- import useChatContextStore from "../../hooks/useChatContextStore";
15
- import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
12
 
17
13
  export const ConfirmationPaneStateful = props => {
18
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
19
-
20
14
  const initialTabIndexMap = new Map();
21
15
  let elements = [];
22
16
  const [state, dispatch] = useChatContextStore();
23
17
  const {
24
- setPostChatContext,
25
- endChat
18
+ prepareEndChat
26
19
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
20
 
28
- const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
-
30
21
  const [adapter] = useChatAdapterStore();
31
- const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
32
- const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
33
22
  const controlProps = {
34
23
  id: "oc-lcw-confirmation-pane",
35
24
  dir: state.domainStates.globalDir,
36
25
  onConfirm: async () => {
37
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
26
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
38
27
  Event: TelemetryEvent.ConfirmationConfirmButtonClicked,
39
28
  Description: "Confirmation pane Confirm button clicked"
40
29
  });
@@ -44,40 +33,8 @@ export const ConfirmationPaneStateful = props => {
44
33
  });
45
34
 
46
35
  try {
47
- //ToDo: End Chat before PostChat Context and conversation Details is set once the getPostChatContext request ID fetch issue is fixed
48
- const conversationDetails = await chatSDK.getConversationDetails(); // ToDo: Replace with CanRenderPostChat once available in conversationDetails API response
49
-
50
- if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed && conversationDetails.canRenderPostChat === Constants.truePascal) {
51
- dispatch({
52
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
53
- payload: true
54
- });
55
- dispatch({
56
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
57
- payload: ConversationState.Loading
58
- });
59
- await setPostChatContext();
60
-
61
- if (state.domainStates.postChatContext) {
62
- dispatch({
63
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
64
- payload: ConversationState.Postchat
65
- });
66
- }
67
- } else {
68
- setTabIndices(elements, initialTabIndexMap, true);
69
-
70
- try {
71
- await endChat(adapter);
72
- } catch (error) {
73
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
74
- Event: TelemetryEvent.CloseChatMethodException,
75
- ExceptionDetails: {
76
- exception: `Failed to endChat: ${error}`
77
- }
78
- });
79
- }
80
- }
36
+ setTabIndices(elements, initialTabIndexMap, true);
37
+ await prepareEndChat(adapter, state);
81
38
  } catch (ex) {
82
39
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
83
40
  Event: TelemetryEvent.GetConversationDetailsCallFailed,
@@ -89,7 +46,7 @@ export const ConfirmationPaneStateful = props => {
89
46
  }
90
47
  },
91
48
  onCancel: () => {
92
- TelemetryHelper.logConfigDataEvent(LogLevel.INFO, {
49
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
93
50
  Event: TelemetryEvent.ConfirmationCancelButtonClicked,
94
51
  Description: "Confirmation pane Cancel button clicked."
95
52
  });
@@ -97,12 +54,12 @@ export const ConfirmationPaneStateful = props => {
97
54
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
98
55
  payload: false
99
56
  });
100
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
57
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
101
58
 
102
- if (previousFocused) {
103
- setFocusOnElement(previousFocused);
59
+ if (previousFocusedElementId) {
60
+ setFocusOnElement("#" + previousFocusedElementId);
104
61
  dispatch({
105
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
62
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
106
63
  payload: null
107
64
  });
108
65
  } else {
@@ -25,16 +25,16 @@ export const EmailTranscriptPaneStateful = props => {
25
25
  type: LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE,
26
26
  payload: false
27
27
  });
28
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
28
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
29
29
 
30
- if (previousFocused) {
31
- setFocusOnElement(previousFocused);
30
+ if (previousFocusedElementId) {
31
+ setFocusOnElement("#" + previousFocusedElementId);
32
32
  } else {
33
33
  setFocusOnSendBox();
34
34
  }
35
35
 
36
36
  dispatch({
37
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
37
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
38
38
  payload: null
39
39
  });
40
40
  setTabIndices(elements, initialTabIndexMap, true);
@@ -68,8 +68,8 @@ export const EmailTranscriptPaneStateful = props => {
68
68
  },
69
69
  onCancel: () => {
70
70
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
71
- Event: TelemetryEvent.EmailTranscriptButtonClicked,
72
- Description: "Email Transcript button clicked."
71
+ Event: TelemetryEvent.EmailTranscriptCancelButtonClicked,
72
+ Description: "Email Transcript cancel button clicked."
73
73
  });
74
74
  closeEmailTranscriptPane();
75
75
  },
@@ -4,13 +4,13 @@ import AudioNotificationStateful from "./audionotificationstateful/AudioNotifica
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { Footer } from "@microsoft/omnichannel-chat-components";
6
6
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
7
+ import { NewMessageNotificationSoundBase64 } from "../../assets/Audios";
7
8
  import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
8
9
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
9
10
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
10
11
  import { downloadTranscript } from "./downloadtranscriptstateful/DownloadTranscriptStateful";
11
12
  import useChatContextStore from "../../hooks/useChatContextStore";
12
- import useChatSDKStore from "../../hooks/useChatSDKStore";
13
- import newMessageNotification from "../../assets/audios/newMessageNotification.mp3"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
14
 
15
15
  export const FooterStateful = props => {
16
16
  var _footerProps$controlP3, _footerProps$controlP4;
@@ -54,13 +54,12 @@ export const FooterStateful = props => {
54
54
  Event: TelemetryEvent.EmailTranscriptButtonClicked,
55
55
  Description: "Email Transcript button clicked."
56
56
  });
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);
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) ?? `${controlProps.id}-emailtranscript-button`;
59
58
 
60
- if (emailTranscriptButton) {
59
+ if (emailTranscriptButtonId) {
61
60
  dispatch({
62
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
63
- payload: emailTranscriptButton
61
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
62
+ payload: emailTranscriptButtonId
64
63
  });
65
64
  }
66
65
 
@@ -84,21 +83,13 @@ export const FooterStateful = props => {
84
83
  isAudioMuted: state.appStates.isAudioMuted
85
84
  }
86
85
  };
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, {
86
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !hideFooterDisplay && /*#__PURE__*/React.createElement(Footer, {
95
87
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
96
88
  controlProps: controlProps,
97
89
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
98
90
  }), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
99
- audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? newMessageNotification,
100
- hideAudioNotificationButton: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false,
101
- isAudioMuted: state.appStates.isAudioMuted ?? false
91
+ audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
92
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
102
93
  }));
103
94
  };
104
95
  export default FooterStateful;
@@ -105,8 +105,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
105
105
  let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
106
106
  let dialogColor = TranscriptConstants.CustomerDialogColor;
107
107
  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) {
108
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
109
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
110
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
111
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
112
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
113
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
114
+
115
+ if (shouldIgnoreMessage) {
110
116
  return;
111
117
  } else if (value.from) {
112
118
  if (value.from.application) {
@@ -127,7 +133,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
127
133
 
128
134
  if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
129
135
  fileAttachmentName = value.attachments[0].name;
130
- value.content = attachmentMessage ?? "The following attachment was uploaded during the conversation:" + fileAttachmentName;
136
+ value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
131
137
  }
132
138
  }
133
139
 
@@ -1,5 +1,5 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
2
+ import React, { useEffect, useRef, useState } from "react";
3
3
  import { ConversationState } from "../../contexts/common/ConversationState";
4
4
  import { Header } from "@microsoft/omnichannel-chat-components";
5
5
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
@@ -21,6 +21,7 @@ export const HeaderStateful = props => {
21
21
 
22
22
  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
23
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
24
+ const conversationState = useRef(state.appStates.conversationState);
24
25
  const controlProps = {
25
26
  id: "oc-lcw-header",
26
27
  dir: state.domainStates.globalDir,
@@ -35,32 +36,37 @@ export const HeaderStateful = props => {
35
36
  });
36
37
  },
37
38
  onCloseClick: async () => {
39
+ var _props$headerProps, _props$headerProps$co, _props$headerProps$co2;
40
+
38
41
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
39
42
  Event: TelemetryEvent.HeaderCloseButtonClicked,
40
43
  Description: "Header Close button clicked."
41
44
  });
42
45
 
43
- if (state.appStates.conversationState === ConversationState.Active) {
46
+ if (conversationState.current === ConversationState.Active) {
44
47
  dispatch({
45
48
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
46
49
  payload: true
47
50
  });
48
- } else if (state.appStates.conversationState === ConversationState.Postchat) {
51
+ } else {
52
+ const skipEndChatSDK = true;
53
+ const skipCloseChat = false;
54
+ const postMessageToOtherTabs = true;
55
+ await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
56
+ }
57
+
58
+ 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`;
59
+
60
+ if (closeButtonId) {
49
61
  dispatch({
50
- type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
51
- payload: false
62
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
63
+ payload: closeButtonId
52
64
  });
53
- await endChat(adapter);
54
65
  }
55
-
56
- dispatch({
57
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
58
- payload: document.getElementById(`${controlProps.id}-closebutton`)
59
- });
60
66
  },
61
67
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
62
- 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),
63
- 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),
68
+ hideTitle: state.appStates.conversationState === ConversationState.Loading || 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),
69
+ hideIcon: state.appStates.conversationState === ConversationState.Loading || 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),
64
70
  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)
65
71
  };
66
72
  const outOfOfficeControlProps = {
@@ -82,7 +88,11 @@ export const HeaderStateful = props => {
82
88
  if (state.appStates.outsideOperatingHours) {
83
89
  setOutOfOperatingHours(true);
84
90
  }
85
- }, []);
91
+
92
+ if (state.appStates.conversationState) {
93
+ conversationState.current = state.appStates.conversationState;
94
+ }
95
+ }, [state.appStates]);
86
96
  return /*#__PURE__*/React.createElement(Header, {
87
97
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
88
98
  controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
@@ -0,0 +1,34 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { Deferred } from "./Deferred";
4
+ export class ActivityStreamHandler {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+
8
+ /**
9
+ * Use of a deferred pattern, to hold the execution of the activity.
10
+ *
11
+ * */
12
+ static cork() {
13
+ ActivityStreamHandler.restoreDeferred = new Deferred();
14
+ ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
15
+ }
16
+ /**
17
+ * Resolve the promise, releasing it to continue with the execution of the activity.
18
+ *
19
+ * */
20
+
21
+
22
+ static uncork() {
23
+ ActivityStreamHandler.restoreDeferred.resolve();
24
+ }
25
+
26
+ }
27
+
28
+ _defineProperty(ActivityStreamHandler, "restoreDeferred", {
29
+ resolve: () => {
30
+ return "initialState";
31
+ }
32
+ });
33
+
34
+ _defineProperty(ActivityStreamHandler, "restorePromise", void 0);
@@ -0,0 +1,14 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ export class DefaultActivitySubscriber {
4
+ constructor() {
5
+ _defineProperty(this, "observer", void 0);
6
+ }
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
+
14
+ }
@@ -0,0 +1,29 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { ActivityStreamHandler } from "../ActivityStreamHandler";
4
+ export class PauseActivitySubscriber {
5
+ constructor() {
6
+ _defineProperty(this, "observer", void 0);
7
+ }
8
+
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ async apply(activity) {
11
+ await ActivityStreamHandler.restorePromise;
12
+ return activity;
13
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
14
+
15
+
16
+ applicable(activity) {
17
+ return true;
18
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+
20
+
21
+ async next(activity) {
22
+ if (this.applicable(activity)) {
23
+ return await this.apply(activity);
24
+ }
25
+
26
+ return activity;
27
+ }
28
+
29
+ }
@@ -0,0 +1,59 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { DefaultActivitySubscriber } from "./ActivitySubscriber/DefaultActivitySubscriber";
4
+ import { shareObservable } from "./shareObservable";
5
+ export class ChatAdapterShim {
6
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ constructor(chatAdapter) {
11
+ _defineProperty(this, "chatAdapter", void 0);
12
+
13
+ _defineProperty(this, "activityObserver", void 0);
14
+
15
+ _defineProperty(this, "subscribers", void 0);
16
+
17
+ this.subscribers = [];
18
+ this.chatAdapter = { ...chatAdapter,
19
+ activity$: shareObservable( // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ new window.Observable(observer => {
21
+ this.activityObserver = observer; // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+
23
+ const abortController = new window.AbortController();
24
+
25
+ (async () => {
26
+ try {
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ for await (let activity of chatAdapter.activities({
29
+ signal: abortController.signal
30
+ })) {
31
+ for (const subscriber of [...this.subscribers, new DefaultActivitySubscriber()]) {
32
+ subscriber.observer = this.activityObserver;
33
+ activity = await subscriber.next(activity);
34
+
35
+ if (!activity) {
36
+ break;
37
+ }
38
+ }
39
+ }
40
+
41
+ observer.complete();
42
+ } catch (error) {
43
+ observer.error(error);
44
+ }
45
+ })();
46
+
47
+ return () => {
48
+ abortController.abort();
49
+ };
50
+ }))
51
+ };
52
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+
54
+
55
+ addSubscriber(subscriber) {
56
+ this.subscribers.push(subscriber);
57
+ }
58
+
59
+ }
@@ -0,0 +1,33 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ export class Deferred {
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ constructor() {
6
+ _defineProperty(this, "_promise", void 0);
7
+
8
+ _defineProperty(this, "_resolve", void 0);
9
+
10
+ _defineProperty(this, "_reject", () => {
11
+ return;
12
+ });
13
+
14
+ _defineProperty(this, "resolve", value => {
15
+ this._resolve(value);
16
+ });
17
+
18
+ _defineProperty(this, "reject", value => {
19
+ this._reject(value);
20
+ });
21
+
22
+ this._promise = new Promise((resolve, reject) => {
23
+ this._resolve = resolve;
24
+ this._reject = reject;
25
+ });
26
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
+
29
+ get promise() {
30
+ return this._promise;
31
+ }
32
+
33
+ }
@@ -0,0 +1,50 @@
1
+ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
3
+ import { isNullOrEmptyString } from "../../../common/utils";
4
+
5
+ const getAuthClientFunction = chatConfig => {
6
+ let authClientFunction = undefined;
7
+
8
+ if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
9
+ var _chatConfig$LiveChatC;
10
+
11
+ authClientFunction = (chatConfig === null || chatConfig === void 0 ? void 0 : (_chatConfig$LiveChatC = chatConfig.LiveChatConfigAuthSettings) === null || _chatConfig$LiveChatC === void 0 ? void 0 : _chatConfig$LiveChatC.msdyn_javascriptclientfunction) ?? undefined;
12
+ }
13
+
14
+ return authClientFunction;
15
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+
17
+
18
+ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
19
+ const authClientFunction = getAuthClientFunction(chatConfig);
20
+
21
+ if (getAuthToken && authClientFunction) {
22
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
23
+ Event: TelemetryEvent.GetAuthTokenCalled
24
+ });
25
+ const token = await getAuthToken(authClientFunction);
26
+
27
+ if (!isNullOrEmptyString(token)) {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ chatSDK.setAuthTokenProvider(async () => {
30
+ return token;
31
+ });
32
+ return true;
33
+ } else {
34
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
35
+ Event: TelemetryEvent.ReceivedNullOrEmptyToken
36
+ });
37
+ return false;
38
+ }
39
+ }
40
+
41
+ return false;
42
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+
44
+
45
+ const removeAuthTokenProvider = chatSDK => {
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ chatSDK.authenticatedUserToken = null;
48
+ };
49
+
50
+ export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider };
@@ -1,7 +1,9 @@
1
1
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
2
2
  import { NotificationLevel } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationLevel";
3
3
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
4
- import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
5
+ import { ChatAdapterShim } from "./ChatAdapterShim";
6
+ import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
7
 
6
8
  export const createAdapter = async chatSDK => {
7
9
  const chatAdapterOptionalParams = {
@@ -23,5 +25,13 @@ export const createAdapter = async chatSDK => {
23
25
  }
24
26
  }
25
27
  };
26
- return await chatSDK.createChatAdapter(chatAdapterOptionalParams);
28
+ let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams); //so far, there is no need to convert to the shim adapter when using visual tests
29
+
30
+ if (chatSDK.isMockModeOn !== true) {
31
+ adapter = new ChatAdapterShim(adapter);
32
+ adapter.addSubscriber(new PauseActivitySubscriber());
33
+ return adapter.chatAdapter;
34
+ }
35
+
36
+ return adapter;
27
37
  };
@@ -3,25 +3,14 @@ import React from "react";
3
3
  import { decodeComponentString } from "@microsoft/omnichannel-chat-components";
4
4
  import { shouldShowFooter } from "../../../controller/componentController";
5
5
  export const createFooter = (props, state) => {
6
- var _props$footerProps, _props$controlProps, _props$componentOverr, _props$componentOverr2;
6
+ var _props$controlProps, _props$componentOverr;
7
7
 
8
- const footerPropsHidden = { ...props.footerProps,
9
- controlProps: { ...((_props$footerProps = props.footerProps) === null || _props$footerProps === void 0 ? void 0 : _props$footerProps.controlProps),
10
- hideDownloadTranscriptButton: true,
11
- hideEmailTranscriptButton: true,
12
- hideAudioNotificationButton: true
13
- }
14
- };
15
- const footer = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
8
+ const hideFooterDisplay = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? false : true;
9
+ const footer = decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
16
10
  footerProps: props.footerProps,
17
11
  downloadTranscriptProps: props.downloadTranscriptProps,
18
12
  audioNotificationProps: props.audioNotificationProps,
19
- hideFooterDisplay: false
20
- }) : decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
21
- footerProps: footerPropsHidden,
22
- downloadTranscriptProps: props.downloadTranscriptProps,
23
- audioNotificationProps: props.audioNotificationProps,
24
- hideFooterDisplay: true
13
+ hideFooterDisplay: hideFooterDisplay
25
14
  });
26
15
  return footer;
27
16
  };
@@ -2,6 +2,8 @@ import { Constants } from "../../../common/Constants";
2
2
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
3
3
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
4
4
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
5
+ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
6
+ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
5
7
 
6
8
  const isInternetConnected = async () => {
7
9
  try {
@@ -18,8 +20,14 @@ export const createInternetConnectionChangeHandler = async () => {
18
20
  const connected = await isInternetConnected();
19
21
 
20
22
  if (!connected) {
23
+ TelemetryHelper.logActionEvent(LogLevel.WARN, {
24
+ Event: TelemetryEvent.NetworkDisconnected
25
+ });
21
26
  NotificationHandler.notifyError(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
22
27
  } else {
28
+ TelemetryHelper.logActionEvent(LogLevel.WARN, {
29
+ Event: TelemetryEvent.NetworkReconnected
30
+ });
23
31
  NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
24
32
  }
25
33
  }; // Checking connection status on online & offline events due to possible false positives