@microsoft/omnichannel-chat-widget 0.1.0-main.86df755 → 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 (249) 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 -4
  11. package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
  12. package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
  13. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  14. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  15. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +66 -20
  16. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -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 +28 -5
  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 +101 -61
  37. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
  38. package/lib/cjs/components/livechatwidget/common/endChat.js +142 -43
  39. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  40. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -10
  41. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
  42. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
  43. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
  44. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  45. package/lib/cjs/components/livechatwidget/common/startChat.js +207 -41
  46. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  47. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +335 -71
  48. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  49. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  50. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  51. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
  52. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  53. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  54. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
  55. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  56. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +110 -2
  57. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  58. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  59. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  60. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  61. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  62. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  63. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  64. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  65. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  66. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  67. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  68. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  69. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  70. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  71. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  72. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  74. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  75. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  76. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +15 -8
  77. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +23 -7
  78. package/lib/cjs/contexts/createReducer.js +53 -12
  79. package/lib/cjs/controller/componentController.js +5 -5
  80. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  81. package/lib/esm/assets/Audios.js +1 -0
  82. package/lib/esm/assets/Icons.js +11 -0
  83. package/lib/esm/common/Constants.js +50 -3
  84. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  85. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  86. package/lib/esm/common/storage/default/defaultCacheManager.js +19 -0
  87. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  88. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +71 -0
  89. package/lib/esm/common/telemetry/TelemetryConstants.js +70 -3
  90. package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
  91. package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
  92. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  93. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  94. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +69 -18
  95. package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
  96. package/lib/esm/common/utils.js +64 -1
  97. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  98. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +31 -8
  99. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -54
  100. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +6 -6
  101. package/lib/esm/components/footerstateful/FooterStateful.js +9 -18
  102. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  103. package/lib/esm/components/headerstateful/HeaderStateful.js +24 -14
  104. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  105. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  106. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  107. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  108. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  109. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  110. package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
  111. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  112. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
  113. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
  114. package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
  115. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +99 -62
  116. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  117. package/lib/esm/components/livechatwidget/common/endChat.js +139 -42
  118. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  119. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +45 -11
  120. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
  121. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
  122. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
  123. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  124. package/lib/esm/components/livechatwidget/common/startChat.js +195 -39
  125. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  126. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +319 -76
  127. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  128. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  129. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  130. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -4
  131. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  132. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  133. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
  134. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  135. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +97 -2
  136. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  137. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  138. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  139. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  140. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  141. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  142. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  143. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  144. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
  145. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  146. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  147. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  148. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  149. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  150. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  151. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  152. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  153. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  154. package/lib/esm/contexts/common/ConversationState.js +4 -2
  155. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +15 -8
  156. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +21 -7
  157. package/lib/esm/contexts/createReducer.js +53 -11
  158. package/lib/esm/controller/componentController.js +5 -5
  159. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  160. package/lib/types/assets/Audios.d.ts +1 -0
  161. package/lib/types/assets/Icons.d.ts +11 -0
  162. package/lib/types/common/Constants.d.ts +27 -1
  163. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  164. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  165. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  166. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  167. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  168. package/lib/types/common/telemetry/TelemetryConstants.d.ts +49 -2
  169. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  170. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  171. package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
  172. package/lib/types/common/telemetry/definitions/Payload.d.ts +15 -9
  173. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  174. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  175. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
  176. package/lib/types/common/utils.d.ts +8 -1
  177. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  178. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  179. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  180. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  181. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  182. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  183. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  184. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  185. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  186. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  187. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  188. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  189. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  190. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  191. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  192. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  193. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  194. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  195. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  196. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +6 -3
  197. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  198. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  199. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  200. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  201. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  202. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  203. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  204. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  205. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  206. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  207. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  208. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  209. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  210. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  211. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  212. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  213. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  214. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  215. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  216. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  217. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  218. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  219. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  220. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +7 -2
  221. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +16 -9
  222. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  223. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  224. package/package.json +14 -13
  225. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  226. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  227. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  228. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  229. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  230. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  231. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  232. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  233. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  234. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  235. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  236. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  237. package/lib/esm/assets/assets.d.js +0 -0
  238. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  239. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  240. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  241. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  242. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  243. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  244. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  245. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  246. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  247. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  248. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  249. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -0,0 +1,94 @@
1
+ import "@testing-library/jest-dom/extend-expect";
2
+ import { createCardActionMiddleware } from "./cardActionMiddleware";
3
+ describe("cardActionMiddleware test", () => {
4
+ it("createCardActionMiddleware() with undefined botMagicCodeConfig should not change the sign in card url", () => {
5
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
6
+
7
+
8
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
9
+ const args = {
10
+ cardAction: {
11
+ type: "signin",
12
+ value: signInUrl
13
+ }
14
+ };
15
+ const results = createCardActionMiddleware(undefined)()(next)(args);
16
+ expect(signInUrl).toEqual(results.cardAction.value);
17
+ });
18
+ it("createCardActionMiddleware() with botMagicCode enabled should not change the sign in card url", () => {
19
+ const botMagicCodeConfig = {
20
+ disabled: false
21
+ };
22
+
23
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
24
+
25
+
26
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
27
+ const args = {
28
+ cardAction: {
29
+ type: "signin",
30
+ value: signInUrl
31
+ }
32
+ };
33
+ const results = createCardActionMiddleware(botMagicCodeConfig)()(next)(args);
34
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
35
+ });
36
+ it("createCardActionMiddleware() with botMagicCode disabled & no fwdUrl should not change the sign in card url", () => {
37
+ const botMagicCodeConfig = {
38
+ disabled: true
39
+ };
40
+
41
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
42
+
43
+
44
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
45
+ const args = {
46
+ cardAction: {
47
+ type: "signin",
48
+ value: signInUrl
49
+ }
50
+ };
51
+ const results = createCardActionMiddleware(botMagicCodeConfig)()(next)(args);
52
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
53
+ });
54
+ it("createCardActionMiddleware() with botMagicCode disabled & fwdUrl should append the fwdUrl in the sign in card url", () => {
55
+ const botMagicCodeConfig = {
56
+ disabled: true,
57
+ fwdUrl: "http://localhost/forwarder.html"
58
+ };
59
+
60
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
61
+
62
+
63
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
64
+ const args = {
65
+ cardAction: {
66
+ type: "signin",
67
+ value: signInUrl
68
+ }
69
+ };
70
+ const results = createCardActionMiddleware(botMagicCodeConfig)()(next)(args);
71
+ expect(signInUrl === results.cardAction.value).toBe(false);
72
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(true);
73
+ });
74
+ it("createCardActionMiddleware() should not append fwdUrl if fwdUrl & sign in card url are not in the same domain", () => {
75
+ const botMagicCodeConfig = {
76
+ disabled: true,
77
+ fwdUrl: "https://localhost/forwarder.html"
78
+ };
79
+
80
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
81
+
82
+
83
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
84
+ const args = {
85
+ cardAction: {
86
+ type: "signin",
87
+ value: signInUrl
88
+ }
89
+ };
90
+ const results = createCardActionMiddleware(botMagicCodeConfig)()(next)(args);
91
+ expect(signInUrl === results.cardAction.value).toBe(true);
92
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(false);
93
+ });
94
+ });
@@ -0,0 +1,107 @@
1
+ import { WebChatActionType } from "../../enums/WebChatActionType";
2
+ import { Constants } from "../../../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
3
+
4
+ const createMessageTimeStampMiddleware = _ref => {
5
+ let {
6
+ dispatch
7
+ } = _ref;
8
+ return next => action => {
9
+ if (isApplicable(action)) {
10
+ return next(evaluateTagsAndOverrideTimeStamp(action));
11
+ }
12
+
13
+ return next(action);
14
+ };
15
+ };
16
+
17
+ const isApplicable = action => {
18
+ return action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && isPVAConversation(action) && isPayloadValid(action) && isValidChannel(action);
19
+ };
20
+
21
+ const isPayloadValid = action => {
22
+ var _action$payload;
23
+
24
+ return action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
25
+ };
26
+
27
+ const isValidChannel = action => {
28
+ var _action$payload2, _action$payload2$acti;
29
+
30
+ return (action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.channelId) === Constants.acsChannel;
31
+ };
32
+
33
+ const isPVAConversation = action => {
34
+ return !isTagIncluded(action, Constants.systemMessageTag) && !isTagIncluded(action, Constants.publicMessageTag) && !isRoleUserOn(action);
35
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+
37
+
38
+ const isTagIncluded = (action, tag) => {
39
+ return isDataTagsPresent(action) && action.payload.activity.channelData.tags.includes(tag);
40
+ };
41
+
42
+ const isRoleUserOn = action => {
43
+ var _action$payload3, _action$payload3$acti, _action$payload3$acti2;
44
+
45
+ return (action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : (_action$payload3$acti2 = _action$payload3$acti.from) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.role) === Constants.userMessageTag;
46
+ };
47
+
48
+ const overrideTimeStamp = (timestampOriginal, timeStampNew) => {
49
+ return isTimestampValid(timeStampNew) ? timeStampNew : timestampOriginal;
50
+ };
51
+
52
+ const isTimestampValid = timeStamp => {
53
+ const regex = /(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(T)(\d{2})(:{1})(\d{2})(:{1})(\d{2})(.\d+)([Z]{1}))/;
54
+ return regex.test(timeStamp);
55
+ };
56
+
57
+ const isDataTagsPresent = action => {
58
+ var _action$payload4, _action$payload4$acti, _action$payload4$acti2;
59
+
60
+ return (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : (_action$payload4$acti2 = _action$payload4$acti.channelData) === null || _action$payload4$acti2 === void 0 ? void 0 : _action$payload4$acti2.tags) && action.payload.activity.channelData.tags.length > 0;
61
+ };
62
+
63
+ const evaluateTagsAndOverrideTimeStamp = action => {
64
+ const tagValue = tagLookup(action, Constants.prefixTimestampTag);
65
+
66
+ if (tagValue) {
67
+ const newTimestamp = extractTimeStamp(tagValue);
68
+ action.payload.activity.timestamp = overrideTimeStamp(action.payload.activity.timestamp, newTimestamp);
69
+ }
70
+
71
+ return action;
72
+ };
73
+
74
+ const extractTimeStamp = timeStamp => {
75
+ if (timeStamp && timeStamp.length > 0) {
76
+ const ts = timeStamp.split(Constants.prefixTimestampTag);
77
+
78
+ if (ts && ts.length > 1) {
79
+ return ts[1];
80
+ }
81
+ }
82
+
83
+ return timeStamp;
84
+ };
85
+
86
+ const tagLookup = (action, tag) => {
87
+ if (!isDataTagsPresent(action)) {
88
+ return null;
89
+ }
90
+
91
+ const tags = action.payload.activity.channelData.tags;
92
+ let value;
93
+
94
+ if (tags && tags.length > 0) {
95
+ for (let i = 0; i < tags.length; i++) {
96
+ value = tags[i];
97
+
98
+ if (value && value.indexOf(tag) > -1) {
99
+ return value;
100
+ }
101
+ }
102
+ }
103
+
104
+ return null;
105
+ };
106
+
107
+ export default createMessageTimeStampMiddleware;
@@ -17,22 +17,22 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
17
17
  var _action$payload;
18
18
 
19
19
  if ((action === null || action === void 0 ? void 0 : action.type) == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
20
- var _activity$from, _activity$from2, _activity$channelData5, _activity$channelData6;
20
+ var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
21
21
 
22
22
  const activity = action.payload.activity;
23
23
 
24
24
  if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
25
- var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4;
25
+ var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
26
26
 
27
27
  // ACS
28
- if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.systemMessageTag) && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(Constants.agentEndConversationMessageTag)) {
28
+ if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.supervisorForceCloseMessageTag))) {
29
29
  conversationEndCallback();
30
30
  }
31
- } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === DirectLineSenderRole.Channel && ((_activity$channelData5 = activity.channelData) === null || _activity$channelData5 === void 0 ? void 0 : _activity$channelData5.type) === MessageTypes.Thread && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.properties) {
32
- var _activity$channelData7, _activity$channelData8, _activity$channelData9, _activity$channelData10;
31
+ } else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
32
+ var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
33
33
 
34
34
  // IC3
35
- if (((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.properties) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.isdeleted) === Constants.truePascal || !((_activity$channelData9 = activity.channelData) !== null && _activity$channelData9 !== void 0 && (_activity$channelData10 = _activity$channelData9.properties) !== null && _activity$channelData10 !== void 0 && _activity$channelData10.containsExternalEntitiesListeningAll)) {
35
+ if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
36
36
  conversationEndCallback();
37
37
  }
38
38
  }
@@ -0,0 +1,32 @@
1
+ import { LogLevel } from "../../../../common/telemetry/TelemetryConstants";
2
+ import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
3
+ export function createWebChatTelemetry() {
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ const handleTelemetry = event => {
6
+ const {
7
+ level
8
+ } = event;
9
+ const loglevel = level ? level.toUpperCase() : "";
10
+
11
+ switch (loglevel) {
12
+ case LogLevel.DEBUG:
13
+ TelemetryHelper.logWebChatEvent(LogLevel.DEBUG, event);
14
+ break;
15
+
16
+ case LogLevel.WARN:
17
+ TelemetryHelper.logWebChatEvent(LogLevel.WARN, event);
18
+ break;
19
+
20
+ case LogLevel.ERROR:
21
+ TelemetryHelper.logWebChatEvent(LogLevel.ERROR, event);
22
+ break;
23
+
24
+ case LogLevel.INFO:
25
+ default:
26
+ TelemetryHelper.logWebChatEvent(LogLevel.INFO, event);
27
+ break;
28
+ }
29
+ };
30
+
31
+ return handleTelemetry;
32
+ }
@@ -7,6 +7,8 @@ export let ConversationState;
7
7
  ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
8
8
  ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
9
9
  ConversationState[ConversationState["Active"] = 5] = "Active";
10
- ConversationState[ConversationState["Postchat"] = 6] = "Postchat";
11
- ConversationState[ConversationState["Closed"] = 7] = "Closed";
10
+ ConversationState[ConversationState["InActive"] = 6] = "InActive";
11
+ ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
12
+ ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
13
+ ConversationState[ConversationState["Closed"] = 9] = "Closed";
12
14
  })(ConversationState || (ConversationState = {}));
@@ -7,16 +7,16 @@ export let LiveChatWidgetActionType;
7
7
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 3] = "SET_GLOBAL_DIR";
8
8
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
9
9
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
10
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
10
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
11
11
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
12
12
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
13
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 9] = "SET_SHOW_CONFIRMATION";
14
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 10] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
15
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 11] = "SET_PRECHAT_RESPONSE_EMAIL";
16
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 12] = "SET_AUDIO_NOTIFICATION";
17
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 13] = "SET_E2VV_ENABLED";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 14] = "SET_POST_CHAT_CONTEXT";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_SHOW_POST_CHAT"] = 15] = "SET_SHOULD_SHOW_POST_CHAT";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
20
20
  LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
21
21
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
22
22
  LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
@@ -28,4 +28,11 @@ export let LiveChatWidgetActionType;
28
28
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
29
29
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
30
30
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 31] = "SET_BOT_OAUTH_SIGNIN_ID";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 32] = "SET_WIDGET_SIZE";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 33] = "SET_WIDGET_INSTANCE_ID";
31
38
  })(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
@@ -1,7 +1,16 @@
1
1
  import { ConversationState } from "./ConversationState";
2
2
  import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
3
+ import { getWidgetCacheId, isNullOrUndefined } from "../../common/utils";
4
+ import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
3
5
  export const getLiveChatWidgetContextInitialState = props => {
4
- var _props$webChatContain;
6
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$webChatContain;
7
+
8
+ const widgetCacheId = getWidgetCacheId(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
9
+ const initialState = defaultClientDataStoreProvider().getData(widgetCacheId, "localStorage");
10
+
11
+ if (!isNullOrUndefined(initialState)) {
12
+ return JSON.parse(initialState);
13
+ }
5
14
 
6
15
  const LiveChatWidgetContextInitialState = {
7
16
  domainStates: {
@@ -13,14 +22,17 @@ export const getLiveChatWidgetContextInitialState = props => {
13
22
  chatToken: undefined,
14
23
  postChatContext: undefined,
15
24
  telemetryInternalData: {},
16
- globalDir: "ltr"
25
+ globalDir: "ltr",
26
+ liveChatContext: undefined,
27
+ customContext: undefined,
28
+ widgetSize: undefined,
29
+ widgetInstanceId: ""
17
30
  },
18
31
  appStates: {
19
32
  conversationState: ConversationState.Closed,
20
33
  isMinimized: false,
21
- previousElementOnFocusBeforeModalOpen: null,
34
+ previousElementIdOnFocusBeforeModalOpen: null,
22
35
  outsideOperatingHours: false,
23
- shouldShowPostChat: false,
24
36
  preChatResponseEmail: "",
25
37
  isAudioMuted: null,
26
38
  newMessage: false,
@@ -32,7 +44,8 @@ export const getLiveChatWidgetContextInitialState = props => {
32
44
  proactiveChatInNewWindow: false
33
45
  },
34
46
  e2vvEnabled: false,
35
- unreadMessageCount: 0
47
+ unreadMessageCount: 0,
48
+ conversationEndedByAgent: false
36
49
  },
37
50
  uiStates: {
38
51
  showConfirmationPane: false,
@@ -41,8 +54,9 @@ export const getLiveChatWidgetContextInitialState = props => {
41
54
  isIncomingCall: true,
42
55
  disableVideoCall: true,
43
56
  disableRemoteVideo: true,
44
- disableSelfVideo: true
57
+ disableSelfVideo: true,
58
+ focusChatButton: false
45
59
  }
46
60
  };
47
- return props.liveChatContextFromCache ?? LiveChatWidgetContextInitialState;
61
+ return LiveChatWidgetContextInitialState;
48
62
  };
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable indent */
2
2
  import { LiveChatWidgetActionType } from "./common/LiveChatWidgetActionType";
3
- import { TelemetryManager } from "../common/telemetry/TelemetryManager";
4
3
  export const createReducer = () => {
5
4
  const reducer = (state, action) => {
6
5
  var _action$payload, _action$payload2, _action$payload3;
@@ -62,10 +61,18 @@ export const createReducer = () => {
62
61
  }
63
62
  };
64
63
 
65
- case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
64
+ case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
65
+ return { ...state,
66
+ domainStates: { ...state.domainStates,
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
+ customContext: action.payload
69
+ }
70
+ };
71
+
72
+ case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
66
73
  return { ...state,
67
74
  appStates: { ...state.appStates,
68
- previousElementOnFocusBeforeModalOpen: action.payload
75
+ previousElementIdOnFocusBeforeModalOpen: action.payload
69
76
  }
70
77
  };
71
78
 
@@ -84,13 +91,6 @@ export const createReducer = () => {
84
91
  }
85
92
  };
86
93
 
87
- case LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT:
88
- return { ...state,
89
- appStates: { ...state.appStates,
90
- shouldShowPostChat: action.payload
91
- }
92
- };
93
-
94
94
  case LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
95
95
  return { ...state,
96
96
  uiStates: { ...state.uiStates,
@@ -105,6 +105,13 @@ export const createReducer = () => {
105
105
  }
106
106
  };
107
107
 
108
+ case LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
109
+ return { ...state,
110
+ uiStates: { ...state.uiStates,
111
+ focusChatButton: action.payload
112
+ }
113
+ };
114
+
108
115
  case LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
109
116
  return { ...state,
110
117
  uiStates: { ...state.uiStates,
@@ -129,6 +136,7 @@ export const createReducer = () => {
129
136
  case LiveChatWidgetActionType.SET_CHAT_TOKEN:
130
137
  return { ...state,
131
138
  domainStates: { ...state.domainStates,
139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
140
  chatToken: action.payload
133
141
  }
134
142
  };
@@ -180,7 +188,6 @@ export const createReducer = () => {
180
188
  };
181
189
 
182
190
  case LiveChatWidgetActionType.SET_TELEMETRY_DATA:
183
- TelemetryManager.InternalTelemetryData = action.payload;
184
191
  return { ...state,
185
192
  domainStates: { ...state.domainStates,
186
193
  telemetryInternalData: action.payload
@@ -201,6 +208,41 @@ export const createReducer = () => {
201
208
  }
202
209
  };
203
210
 
211
+ case LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
212
+ return { ...state,
213
+ domainStates: { ...state.domainStates,
214
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
215
+ liveChatContext: action.payload
216
+ }
217
+ };
218
+
219
+ case LiveChatWidgetActionType.SET_WIDGET_STATE:
220
+ return { ...action.payload
221
+ };
222
+
223
+ case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
224
+ return { ...state,
225
+ appStates: { ...state.appStates,
226
+ conversationEndedByAgent: action.payload
227
+ }
228
+ };
229
+
230
+ case LiveChatWidgetActionType.SET_WIDGET_SIZE:
231
+ return { ...state,
232
+ domainStates: { ...state.domainStates,
233
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
234
+ widgetSize: action.payload
235
+ }
236
+ };
237
+
238
+ case LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
239
+ return { ...state,
240
+ domainStates: { ...state.domainStates,
241
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
+ widgetInstanceId: action.payload
243
+ }
244
+ };
245
+
204
246
  default:
205
247
  return state;
206
248
  }
@@ -1,6 +1,6 @@
1
1
  import { ConversationState } from "../contexts/common/ConversationState";
2
2
  export const shouldShowChatButton = state => {
3
- return state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed;
3
+ return (state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
4
4
  };
5
5
  export const shouldShowProactiveChatPane = state => {
6
6
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ProactiveChat;
@@ -9,22 +9,22 @@ export const shouldShowHeader = state => {
9
9
  return !state.appStates.isMinimized && state.appStates.conversationState !== ConversationState.Closed && state.appStates.conversationState !== ConversationState.ProactiveChat;
10
10
  };
11
11
  export const shouldShowFooter = state => {
12
- return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Active;
12
+ return !state.appStates.isMinimized && (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive);
13
13
  };
14
14
  export const shouldShowEmailTranscriptPane = state => {
15
15
  return state.uiStates.showEmailTranscriptPane;
16
16
  };
17
17
  export const shouldShowWebChatContainer = state => {
18
- return state.appStates.conversationState === ConversationState.Active;
18
+ return state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive;
19
19
  };
20
20
  export const shouldShowLoadingPane = state => {
21
- return !state.appStates.isMinimized && !state.appStates.shouldShowPostChat && state.appStates.conversationState === ConversationState.Loading;
21
+ return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Loading;
22
22
  };
23
23
  export const shouldShowReconnectChatPane = state => {
24
24
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ReconnectChat;
25
25
  };
26
26
  export const shouldShowPostChatLoadingPane = state => {
27
- return !state.appStates.isMinimized && state.appStates.shouldShowPostChat && state.appStates.conversationState === ConversationState.Loading;
27
+ return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.PostchatLoading;
28
28
  };
29
29
  export const shouldShowOutOfOfficeHoursPane = state => {
30
30
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.OutOfOffice;
@@ -0,0 +1,82 @@
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/TelemetryConstants";
2
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
+ import { Constants } from "../common/Constants";
4
+ import { TelemetryHelper } from "../common/telemetry/TelemetryHelper";
5
+ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
6
+ const onNewAdapterActivityHandler = activity => {
7
+ var _activity$channelData, _activity$channelData2, _activity$channelData3;
8
+
9
+ const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message;
10
+ const isNotHistoryMessage = isActivityMessage && !(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.historyMessageTag)) && !(activity !== null && activity !== void 0 && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && _activity$channelData3.fromList);
11
+
12
+ if (isNotHistoryMessage) {
13
+ raiseMessageEvent(activity);
14
+ }
15
+ };
16
+
17
+ const raiseMessageEvent = activity => {
18
+ if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
19
+ var _text, _text2, _activity$channelData4, _activity$from;
20
+
21
+ const payload = {
22
+ // To identify hidden contents vs empty content
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
25
+ type: activity === null || activity === void 0 ? void 0 : activity.type,
26
+ timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
27
+ userId: userId,
28
+ tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
29
+ messageType: ""
30
+ };
31
+
32
+ if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === Constants.userMessageTag) {
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ payload.messageType = Constants.userMessageTag;
35
+ const newMessageSentEvent = {
36
+ eventName: BroadcastEvent.NewMessageSent,
37
+ payload: payload
38
+ };
39
+ BroadcastService.postMessage(newMessageSentEvent);
40
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
41
+ Event: TelemetryEvent.MessageSent,
42
+ Description: "New message sent"
43
+ });
44
+ } else {
45
+ var _activity$channelData5, _activity$channelData6;
46
+
47
+ if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.systemMessageTag)) {
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ payload.messageType = Constants.systemMessageTag;
50
+ } else {
51
+ var _activity$channelData7, _activity$channelData8, _activity$channelData9;
52
+
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
+ const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
+
56
+ const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+
58
+ const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
59
+
60
+ if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
61
+ return;
62
+ }
63
+
64
+ payload.messageType = Constants.userMessageTag;
65
+ }
66
+
67
+ const newMessageReceivedEvent = {
68
+ eventName: BroadcastEvent.NewMessageReceived,
69
+ payload: payload
70
+ };
71
+ BroadcastService.postMessage(newMessageReceivedEvent);
72
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
73
+ Event: TelemetryEvent.MessageReceived,
74
+ Description: "New message received",
75
+ Data: payload
76
+ });
77
+ }
78
+ }
79
+ };
80
+
81
+ return onNewAdapterActivityHandler;
82
+ };
@@ -0,0 +1 @@
1
+ export declare const NewMessageNotificationSoundBase64: string;