@microsoft/omnichannel-chat-widget 0.1.0-main.3d1c026 → 0.1.0-main.4151518

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 (388) hide show
  1. package/README.md +232 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +30 -0
  4. package/lib/cjs/common/Constants.js +61 -151
  5. package/lib/cjs/common/KeyCodes.js +3 -4
  6. package/lib/cjs/common/contextDataStore/DataStoreManager.js +12 -0
  7. package/lib/cjs/common/storage/default/defaultCacheManager.js +26 -0
  8. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +111 -0
  9. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  10. package/lib/cjs/common/telemetry/TelemetryConstants.js +118 -26
  11. package/lib/cjs/common/telemetry/TelemetryHelper.js +31 -56
  12. package/lib/cjs/common/telemetry/TelemetryManager.js +17 -35
  13. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  14. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -3
  15. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +49 -35
  16. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -14
  17. package/lib/cjs/common/utils.js +101 -80
  18. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +21 -45
  19. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -26
  20. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  21. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +21 -99
  22. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  23. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +11 -39
  24. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  25. package/lib/cjs/components/footerstateful/FooterStateful.js +14 -46
  26. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  27. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -44
  28. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  29. package/lib/cjs/components/headerstateful/HeaderStateful.js +27 -35
  30. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  31. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +39 -0
  32. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  33. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +20 -0
  34. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  35. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +34 -0
  36. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +64 -0
  37. package/lib/cjs/components/livechatwidget/common/Deferred.js +37 -0
  38. package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
  39. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  40. package/lib/cjs/components/livechatwidget/common/createAdapter.js +12 -9
  41. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  42. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  43. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -44
  44. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
  45. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +151 -68
  46. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  47. package/lib/cjs/components/livechatwidget/common/endChat.js +151 -61
  48. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  49. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +10 -14
  50. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  51. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +34 -74
  52. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +102 -66
  53. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +13 -20
  54. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +271 -29
  55. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  56. package/lib/cjs/components/livechatwidget/common/startChat.js +281 -67
  57. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -11
  58. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  59. package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  60. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +413 -165
  61. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +38 -26
  62. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  63. package/lib/cjs/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  64. package/lib/cjs/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  65. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +9 -14
  66. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -14
  67. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +35 -24
  68. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  69. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  70. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  71. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  72. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +27 -43
  73. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  74. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -35
  75. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  76. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +8 -24
  77. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  78. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  79. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  80. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  81. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +12 -27
  82. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +9 -16
  83. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  84. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +56 -88
  85. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  86. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  87. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +12 -0
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -5
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +33 -80
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +10 -22
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -61
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +7 -18
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +8 -42
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +4 -22
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +20 -33
  117. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  118. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +81 -45
  119. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  120. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +7 -18
  121. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
  122. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  123. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  124. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  125. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  126. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  127. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  128. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  129. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +33 -0
  130. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  131. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  132. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  133. package/lib/cjs/contexts/common/ConversationEndEntity.js +12 -0
  134. package/lib/cjs/contexts/common/ConversationState.js +4 -3
  135. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +34 -24
  136. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +24 -12
  137. package/lib/cjs/contexts/createReducer.js +213 -106
  138. package/lib/cjs/controller/componentController.js +5 -34
  139. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  140. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  141. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  142. package/lib/cjs/hooks/useDebounce.js +28 -0
  143. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  144. package/lib/cjs/index.js +0 -5
  145. package/lib/cjs/plugins/newMessageEventHandler.js +92 -0
  146. package/lib/esm/assets/Audios.js +1 -0
  147. package/lib/esm/assets/Icons.js +12 -0
  148. package/lib/esm/common/Constants.js +55 -139
  149. package/lib/esm/common/KeyCodes.js +3 -3
  150. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  151. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  152. package/lib/esm/common/storage/default/defaultCacheManager.js +18 -0
  153. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +104 -0
  154. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  155. package/lib/esm/common/telemetry/TelemetryConstants.js +117 -21
  156. package/lib/esm/common/telemetry/TelemetryHelper.js +32 -46
  157. package/lib/esm/common/telemetry/TelemetryManager.js +17 -24
  158. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  159. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  160. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +49 -23
  161. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -10
  162. package/lib/esm/common/utils.js +92 -44
  163. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +21 -16
  164. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +23 -13
  165. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  166. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -75
  167. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +11 -18
  168. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  169. package/lib/esm/components/footerstateful/FooterStateful.js +15 -26
  170. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -37
  171. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  172. package/lib/esm/components/headerstateful/HeaderStateful.js +28 -21
  173. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  174. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -0
  175. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  176. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +13 -0
  177. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  178. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +27 -0
  179. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +57 -0
  180. package/lib/esm/components/livechatwidget/common/Deferred.js +30 -0
  181. package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
  182. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  183. package/lib/esm/components/livechatwidget/common/createAdapter.js +14 -4
  184. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  185. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  186. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  187. package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
  188. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +152 -57
  189. package/lib/esm/components/livechatwidget/common/endChat.js +152 -47
  190. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  191. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +12 -11
  192. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  193. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +35 -45
  194. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +102 -58
  195. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +13 -12
  196. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +272 -22
  197. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  198. package/lib/esm/components/livechatwidget/common/startChat.js +284 -52
  199. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  200. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  201. package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  202. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +415 -117
  203. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +39 -14
  204. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  205. package/lib/esm/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
  206. package/lib/esm/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
  207. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +9 -4
  208. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +9 -4
  209. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +35 -12
  210. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  211. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  212. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  213. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  214. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +30 -28
  215. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  216. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +30 -14
  217. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  218. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +8 -6
  219. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  220. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  221. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  222. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  223. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +12 -19
  224. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +9 -12
  225. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  226. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +7 -17
  227. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  228. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  229. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -3
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  241. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  242. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +34 -66
  243. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +12 -14
  244. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +27 -40
  245. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  246. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  247. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  248. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  249. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  250. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  251. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  252. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  253. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  254. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  255. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +8 -9
  256. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +9 -28
  257. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +5 -14
  258. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +20 -22
  259. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  260. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +81 -40
  261. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  262. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +9 -14
  263. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
  264. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  265. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  266. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  267. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  268. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  269. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  270. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  271. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +27 -0
  272. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  273. package/lib/esm/contexts/ChatContextStore.js +2 -1
  274. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  275. package/lib/esm/contexts/common/ConversationEndEntity.js +5 -0
  276. package/lib/esm/contexts/common/ConversationState.js +4 -3
  277. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +34 -24
  278. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +24 -8
  279. package/lib/esm/contexts/createReducer.js +213 -102
  280. package/lib/esm/controller/componentController.js +6 -5
  281. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  282. package/lib/esm/hooks/useChatContextStore.js +0 -4
  283. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  284. package/lib/esm/hooks/useDebounce.js +22 -0
  285. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  286. package/lib/esm/plugins/newMessageEventHandler.js +85 -0
  287. package/lib/types/assets/Audios.d.ts +1 -0
  288. package/lib/types/assets/Icons.d.ts +12 -0
  289. package/lib/types/common/Constants.d.ts +48 -1
  290. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  291. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  292. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  293. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  294. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  295. package/lib/types/common/telemetry/TelemetryConstants.d.ts +85 -7
  296. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  297. package/lib/types/common/telemetry/definitions/Contracts.d.ts +4 -4
  298. package/lib/types/common/telemetry/definitions/Payload.d.ts +13 -9
  299. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +7 -3
  300. package/lib/types/common/utils.d.ts +9 -1
  301. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -4
  302. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  303. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  304. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  305. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  306. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  307. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  308. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  309. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  310. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  311. package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
  312. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  313. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
  314. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  315. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
  316. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -4
  317. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
  318. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  319. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -2
  320. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  321. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  322. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +4 -1
  323. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +9 -2
  324. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
  325. package/lib/types/components/loadingpanestateful/LoadingPaneStateful.d.ts +1 -2
  326. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  327. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +4 -0
  328. package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +4 -0
  329. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  330. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  331. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  332. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  333. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  334. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -2
  335. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  336. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  337. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  338. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  339. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  340. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  341. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  342. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  343. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  344. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  345. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  346. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  347. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  348. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  349. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  350. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  351. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  352. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
  353. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  354. package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
  355. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  356. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +13 -4
  357. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +34 -23
  358. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  359. package/lib/types/hooks/useDebounce.d.ts +3 -0
  360. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  361. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  362. package/package.json +12 -13
  363. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  364. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  365. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  366. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  367. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  368. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  369. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  370. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  371. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  372. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  373. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  374. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  375. package/lib/esm/assets/assets.d.js +0 -0
  376. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  377. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  378. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  379. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  380. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  381. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  382. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  383. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  384. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  385. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  386. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  387. package/lib/esm/assets/icons/wordIcon.svg +0 -6
  388. /package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * Enforces a max character limit that the sender can send to comply to Omnichannel chat services' limitation.
5
5
  ******/
6
+
6
7
  import { NotificationHandler } from "../../notification/NotificationHandler";
7
8
  import { NotificationScenarios } from "../../enums/NotificationScenarios";
8
9
  import { WebChatActionType } from "../../enums/WebChatActionType";
9
- import { WebChatMiddlewareConstants } from "../../../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
10
+ import { WebChatMiddlewareConstants } from "../../../../../common/Constants";
10
11
 
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
11
13
  const createMaxMessageSizeValidator = localizedTexts => _ref => {
12
14
  let {
13
15
  dispatch
@@ -15,9 +17,7 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
15
17
  return next => action => {
16
18
  if (action.type === WebChatActionType.WEB_CHAT_SET_SEND_BOX) {
17
19
  var _action$payload, _action$payload$text;
18
-
19
20
  const textLength = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$text = _action$payload.text) === null || _action$payload$text === void 0 ? void 0 : _action$payload$text.length) || 0;
20
-
21
21
  if (textLength > WebChatMiddlewareConstants.maxTextLength) {
22
22
  NotificationHandler.notifyError(NotificationScenarios.MaxSizeError, localizedTexts.MIDDLEWARE_MAX_CHARACTER_COUNT_EXCEEDED);
23
23
  return next(action);
@@ -25,9 +25,7 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
25
25
  NotificationHandler.dismissNotification(NotificationScenarios.MaxSizeError);
26
26
  }
27
27
  }
28
-
29
28
  return next(action);
30
29
  };
31
30
  };
32
-
33
31
  export default createMaxMessageSizeValidator;
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * Adds necessary fields for the activity for the other middlewares to function as expected.
5
5
  ******/
6
+
6
7
  import { Constants } from "../../../../../common/Constants";
7
- import { WebChatActionType } from "../../enums/WebChatActionType"; // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
8
+ import { WebChatActionType } from "../../enums/WebChatActionType";
8
9
 
10
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
9
11
  const preProcessingMiddleware = _ref => {
10
12
  let {
11
13
  dispatch
@@ -15,30 +17,28 @@ const preProcessingMiddleware = _ref => {
15
17
  const {
16
18
  activity
17
19
  } = action.payload;
18
-
19
20
  if (!activity.from || activity.from.role === Constants.userMessageTag) {
20
- action = { ...action,
21
- payload: { ...action.payload,
22
- activity: { ...action.payload.activity,
21
+ action = {
22
+ ...action,
23
+ payload: {
24
+ ...action.payload,
25
+ activity: {
26
+ ...action.payload.activity,
23
27
  textFormat: Constants.markdown
24
28
  }
25
29
  }
26
30
  };
27
31
  }
28
32
  }
29
-
30
33
  if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
31
34
  const {
32
35
  activity
33
36
  } = action.payload;
34
-
35
37
  if (activity) {
36
38
  action.payload.activity[Constants.actionType] = WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY;
37
39
  }
38
40
  }
39
-
40
41
  return next(action);
41
42
  };
42
43
  };
43
-
44
44
  export default preProcessingMiddleware;
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * Sanitizes the text.
5
5
  ******/
6
+
6
7
  import DOMPurify from "dompurify";
7
8
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
8
9
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
9
- import { WebChatActionType } from "../../enums/WebChatActionType"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
10
+ import { WebChatActionType } from "../../enums/WebChatActionType";
10
11
 
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
11
13
  const sanitizationMiddleware = _ref => {
12
14
  let {
13
15
  dispatch
@@ -16,26 +18,24 @@ const sanitizationMiddleware = _ref => {
16
18
  if (action.type === WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
17
19
  try {
18
20
  var _action$payload;
19
-
20
21
  let text = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.text;
21
-
22
22
  if (text) {
23
23
  text = DOMPurify.sanitize(text) ?? " ";
24
24
  }
25
25
  } catch (e) {
26
- const copyDataForTelemetry = { ...action,
27
- payload: { ...action.payload,
26
+ const copyDataForTelemetry = {
27
+ ...action,
28
+ payload: {
29
+ ...action.payload,
28
30
  text: undefined
29
31
  }
30
32
  };
31
33
  let errorMessage = "Failed to apply action: ";
32
-
33
34
  try {
34
35
  errorMessage += JSON.stringify(copyDataForTelemetry);
35
36
  } catch (e) {
36
37
  errorMessage += " (unable to stringify action)";
37
38
  }
38
-
39
39
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
40
40
  Event: TelemetryEvent.ProcessingSanitizationMiddlewareFailed,
41
41
  ExceptionDetails: {
@@ -45,9 +45,7 @@ const sanitizationMiddleware = _ref => {
45
45
  });
46
46
  }
47
47
  }
48
-
49
48
  return next(action);
50
49
  };
51
50
  };
52
-
53
51
  export default sanitizationMiddleware;
@@ -17,7 +17,6 @@ export class NotificationHandler {
17
17
  NotificationHandler.setFocusOnNotificationCloseButton();
18
18
  }
19
19
  }
20
-
21
20
  static dismissNotification(id) {
22
21
  if (WebChatStoreLoader.store) {
23
22
  WebChatStoreLoader.store.dispatch({
@@ -28,23 +27,18 @@ export class NotificationHandler {
28
27
  });
29
28
  }
30
29
  }
31
-
32
30
  static notifyError(id, message) {
33
31
  this.notify(id, NotificationLevel.Error, message);
34
32
  }
35
-
36
33
  static notifyWarning(id, message) {
37
34
  this.notify(id, NotificationLevel.Warning, message);
38
35
  }
39
-
40
36
  static notifyInfo(id, message) {
41
37
  this.notify(id, NotificationLevel.Info, message);
42
38
  }
43
-
44
39
  static notifySuccess(id, message) {
45
40
  this.notify(id, NotificationLevel.Success, message);
46
41
  }
47
-
48
42
  static notifyWithLevel(id, message, level) {
49
43
  if (!level) {
50
44
  this.notifyInfo(id, message);
@@ -52,30 +46,24 @@ export class NotificationHandler {
52
46
  this.notify(id, level, message);
53
47
  }
54
48
  }
55
- /* Bypass WebChat behavior and focus on banner close button */
56
-
57
49
 
50
+ /* Bypass WebChat behavior and focus on banner close button */
58
51
  static setFocusOnNotificationCloseButton() {
59
52
  const expandButton = document.querySelector(`#${HtmlIdNames.MSLiveChatWidget} .${HtmlClassNames.webChatBannerExpandButton}`);
60
-
61
53
  if (expandButton) {
62
54
  expandButton.focus();
63
55
  return;
64
56
  }
65
-
66
57
  const closeButton = document.querySelector(`#${HtmlIdNames.MSLiveChatWidget} .${HtmlClassNames.webChatBannerCloseButton}`);
67
-
68
58
  if (closeButton) {
69
59
  closeButton.focus();
70
60
  NotificationHandler.registerOnCloseEvent(closeButton);
71
61
  return;
72
62
  }
73
63
  }
74
-
75
64
  static registerOnCloseEvent(button) {
76
65
  button.onclick = () => {
77
66
  setFocusOnSendBox();
78
67
  };
79
68
  }
80
-
81
69
  }
@@ -0,0 +1,27 @@
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
+ switch (loglevel) {
11
+ case LogLevel.DEBUG:
12
+ TelemetryHelper.logWebChatEvent(LogLevel.DEBUG, event);
13
+ break;
14
+ case LogLevel.WARN:
15
+ TelemetryHelper.logWebChatEvent(LogLevel.WARN, event);
16
+ break;
17
+ case LogLevel.ERROR:
18
+ TelemetryHelper.logWebChatEvent(LogLevel.ERROR, event);
19
+ break;
20
+ case LogLevel.INFO:
21
+ default:
22
+ TelemetryHelper.logWebChatEvent(LogLevel.INFO, event);
23
+ break;
24
+ }
25
+ };
26
+ return handleTelemetry;
27
+ }
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
3
4
  export const ChatAdapterStore = /*#__PURE__*/createContext([undefined, adapter => {}]);
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  export const ChatContextStore = /*#__PURE__*/createContext(undefined);
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  export const ChatSDKStore = /*#__PURE__*/createContext(undefined);
@@ -0,0 +1,5 @@
1
+ export let ConversationEndEntity;
2
+ (function (ConversationEndEntity) {
3
+ ConversationEndEntity[ConversationEndEntity["Customer"] = 0] = "Customer";
4
+ ConversationEndEntity[ConversationEndEntity["Agent"] = 1] = "Agent";
5
+ })(ConversationEndEntity || (ConversationEndEntity = {}));
@@ -1,5 +1,4 @@
1
1
  export let ConversationState;
2
-
3
2
  (function (ConversationState) {
4
3
  ConversationState[ConversationState["Prechat"] = 0] = "Prechat";
5
4
  ConversationState[ConversationState["Loading"] = 1] = "Loading";
@@ -7,6 +6,8 @@ export let ConversationState;
7
6
  ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
8
7
  ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
9
8
  ConversationState[ConversationState["Active"] = 5] = "Active";
10
- ConversationState[ConversationState["Postchat"] = 6] = "Postchat";
11
- ConversationState[ConversationState["Closed"] = 7] = "Closed";
9
+ ConversationState[ConversationState["InActive"] = 6] = "InActive";
10
+ ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
11
+ ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
12
+ ConversationState[ConversationState["Closed"] = 9] = "Closed";
12
13
  })(ConversationState || (ConversationState = {}));
@@ -1,5 +1,4 @@
1
1
  export let LiveChatWidgetActionType;
2
-
3
2
  (function (LiveChatWidgetActionType) {
4
3
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
5
4
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
@@ -7,27 +6,38 @@ export let LiveChatWidgetActionType;
7
6
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 3] = "SET_GLOBAL_DIR";
8
7
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
9
8
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
10
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
11
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
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";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 19] = "DISABLE_LOCAL_VIDEO";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 20] = "DISABLE_REMOTE_VIDEO";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 21] = "SET_CHAT_TOKEN";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 22] = "SET_SKIP_CHAT_BUTTON_RENDERING";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 23] = "SET_PROACTIVE_CHAT_PARAMS";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
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";
9
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
10
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
11
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 8] = "SET_OUTSIDE_OPERATING_HOURS";
12
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 9] = "SET_PRE_CHAT_SURVEY_RESPONSE";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 10] = "SET_CUSTOM_CONTEXT";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 11] = "SET_SHOW_CONFIRMATION";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 12] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 13] = "SET_PRECHAT_RESPONSE_EMAIL";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 14] = "SET_AUDIO_NOTIFICATION";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 15] = "SET_E2VV_ENABLED";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 16] = "SET_POST_CHAT_CONTEXT";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 17] = "SHOW_CALLING_CONTAINER";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 18] = "SET_INCOMING_CALL";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 19] = "DISABLE_VIDEO_CALL";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 20] = "DISABLE_LOCAL_VIDEO";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 21] = "DISABLE_REMOTE_VIDEO";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 22] = "SET_CHAT_TOKEN";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 23] = "SET_START_CHAT_BUTTON_DISPLAY";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 24] = "SET_PROACTIVE_CHAT_PARAMS";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 25] = "SET_TELEMETRY_DATA";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 26] = "SET_RECONNECT_ID";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 27] = "SET_UNREAD_MESSAGE_COUNT";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 28] = "SET_FOCUS_CHAT_BUTTON";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 29] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 30] = "SET_CONVERSATION_ENDED_BY";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 31] = "SET_WIDGET_STATE";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 32] = "SET_LIVE_CHAT_CONTEXT";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 33] = "SET_BOT_OAUTH_SIGNIN_ID";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 34] = "SET_WIDGET_SIZE";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 35] = "SET_WIDGET_INSTANCE_ID";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 36] = "SET_LIVE_CHAT_CONFIG";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 37] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 38] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 39] = "SET_SHOULD_USE_BOT_SURVEY";
33
43
  })(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
@@ -1,8 +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";
5
+ import { Constants } from "../../common/Constants";
3
6
  export const getLiveChatWidgetContextInitialState = props => {
4
- var _props$webChatContain;
5
-
7
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$controlProps2, _props$webChatContain;
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 cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.cacheTtlInMins) ?? Constants.CacheTtlInMinutes;
10
+ const initialState = defaultClientDataStoreProvider(cacheTtlInMins).getData(widgetCacheId, "localStorage");
11
+ if (!isNullOrUndefined(initialState)) {
12
+ return JSON.parse(initialState);
13
+ }
6
14
  const LiveChatWidgetContextInitialState = {
7
15
  domainStates: {
8
16
  liveChatConfig: props.chatConfig,
@@ -13,18 +21,23 @@ export const getLiveChatWidgetContextInitialState = props => {
13
21
  chatToken: undefined,
14
22
  postChatContext: undefined,
15
23
  telemetryInternalData: {},
16
- globalDir: "ltr"
24
+ globalDir: "ltr",
25
+ liveChatContext: undefined,
26
+ customContext: undefined,
27
+ widgetSize: undefined,
28
+ widgetInstanceId: "",
29
+ initialChatSdkRequestId: ""
17
30
  },
18
31
  appStates: {
19
32
  conversationState: ConversationState.Closed,
20
33
  isMinimized: false,
21
- previousElementOnFocusBeforeModalOpen: null,
34
+ previousElementIdOnFocusBeforeModalOpen: null,
35
+ isStartChatFailing: false,
22
36
  outsideOperatingHours: false,
23
- shouldShowPostChat: false,
24
37
  preChatResponseEmail: "",
25
38
  isAudioMuted: null,
26
39
  newMessage: false,
27
- skipChatButtonRendering: false,
40
+ hideStartChatButton: false,
28
41
  reconnectId: undefined,
29
42
  proactiveChatStates: {
30
43
  proactiveChatBodyTitle: "",
@@ -33,7 +46,10 @@ export const getLiveChatWidgetContextInitialState = props => {
33
46
  },
34
47
  e2vvEnabled: false,
35
48
  unreadMessageCount: 0,
36
- conversationEndedByAgent: false
49
+ conversationEndedByAgentEventReceived: false,
50
+ conversationEndedBy: undefined,
51
+ postChatWorkflowInProgress: false,
52
+ shouldUseBotSurvey: false
37
53
  },
38
54
  uiStates: {
39
55
  showConfirmationPane: false,
@@ -46,5 +62,5 @@ export const getLiveChatWidgetContextInitialState = props => {
46
62
  focusChatButton: false
47
63
  }
48
64
  };
49
- return props.liveChatContextFromCache ?? LiveChatWidgetContextInitialState;
65
+ return LiveChatWidgetContextInitialState;
50
66
  };