@microsoft/omnichannel-chat-widget 0.1.0-main.bcfe8a3 → 0.1.0-main.bf74329

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 (285) hide show
  1. package/lib/cjs/common/Constants.js +2 -165
  2. package/lib/cjs/common/KeyCodes.js +0 -3
  3. package/lib/cjs/common/contextDataStore/DataStoreManager.js +0 -4
  4. package/lib/cjs/common/storage/default/defaultCacheManager.js +24 -0
  5. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  6. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  7. package/lib/cjs/common/telemetry/TelemetryConstants.js +26 -18
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +14 -57
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +0 -31
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +0 -2
  11. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +30 -36
  12. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +0 -9
  13. package/lib/cjs/common/utils.js +65 -93
  14. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +6 -44
  15. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +5 -23
  16. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -32
  17. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  18. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -36
  19. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  20. package/lib/cjs/components/footerstateful/FooterStateful.js +11 -42
  21. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  22. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -45
  23. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  24. package/lib/cjs/components/headerstateful/HeaderStateful.js +16 -30
  25. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  26. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +37 -0
  27. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +18 -0
  28. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  29. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
  30. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +62 -0
  31. package/lib/cjs/components/livechatwidget/common/Deferred.js +35 -0
  32. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  33. package/lib/cjs/components/livechatwidget/common/createAdapter.js +10 -9
  34. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  35. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  36. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -43
  37. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +63 -38
  38. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  39. package/lib/cjs/components/livechatwidget/common/endChat.js +50 -43
  40. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  41. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  42. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  43. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +27 -53
  44. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +68 -82
  45. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
  46. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
  47. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  48. package/lib/cjs/components/livechatwidget/common/startChat.js +145 -117
  49. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  50. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  51. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +203 -217
  52. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +4 -17
  53. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  54. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
  55. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  56. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  57. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  58. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  59. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  60. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +10 -42
  61. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +3 -33
  62. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -24
  63. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +29 -34
  64. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  65. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  66. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  67. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
  68. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -16
  69. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  70. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
  71. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  72. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  73. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +0 -4
  74. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  75. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  76. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  77. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -41
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -13
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -16
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +2 -30
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +5 -18
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
  115. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  116. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  117. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  118. package/lib/cjs/contexts/common/ConversationState.js +3 -3
  119. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -2
  120. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +10 -12
  121. package/lib/cjs/contexts/createReducer.js +140 -103
  122. package/lib/cjs/controller/componentController.js +3 -32
  123. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  124. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  125. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  126. package/lib/cjs/index.js +0 -5
  127. package/lib/cjs/plugins/newMessageEventHandler.js +15 -36
  128. package/lib/esm/common/Constants.js +2 -153
  129. package/lib/esm/common/KeyCodes.js +0 -2
  130. package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
  131. package/lib/esm/common/storage/default/defaultCacheManager.js +16 -0
  132. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +95 -0
  133. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  134. package/lib/esm/common/telemetry/TelemetryConstants.js +30 -15
  135. package/lib/esm/common/telemetry/TelemetryHelper.js +14 -45
  136. package/lib/esm/common/telemetry/TelemetryManager.js +0 -18
  137. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +28 -24
  138. package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
  139. package/lib/esm/common/utils.js +60 -50
  140. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +6 -15
  141. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +5 -6
  142. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +9 -13
  143. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
  144. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  145. package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
  146. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -35
  147. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  148. package/lib/esm/components/headerstateful/HeaderStateful.js +16 -15
  149. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  150. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
  151. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +11 -0
  152. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  153. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
  154. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +55 -0
  155. package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
  156. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  157. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
  158. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  159. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  160. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  161. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +65 -25
  162. package/lib/esm/components/livechatwidget/common/endChat.js +52 -28
  163. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  164. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  165. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  166. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +30 -20
  167. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +71 -68
  168. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
  169. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
  170. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  171. package/lib/esm/components/livechatwidget/common/startChat.js +147 -96
  172. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  173. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +208 -156
  174. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +4 -5
  175. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  176. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  177. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  178. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  179. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  180. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  181. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  182. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -26
  183. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +5 -9
  184. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -6
  185. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +27 -9
  186. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  187. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  188. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  189. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  190. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -12
  191. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  192. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  193. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  194. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  195. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +0 -2
  196. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  197. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  198. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  199. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  200. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  201. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  202. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  203. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  204. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -26
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -9
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -14
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +4 -28
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +5 -13
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
  237. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  238. package/lib/esm/contexts/ChatContextStore.js +2 -1
  239. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  240. package/lib/esm/contexts/common/ConversationState.js +3 -3
  241. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -2
  242. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +10 -8
  243. package/lib/esm/contexts/createReducer.js +140 -100
  244. package/lib/esm/controller/componentController.js +4 -3
  245. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  246. package/lib/esm/hooks/useChatContextStore.js +0 -4
  247. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  248. package/lib/esm/plugins/newMessageEventHandler.js +15 -26
  249. package/lib/types/common/Constants.d.ts +2 -0
  250. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  251. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  252. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  253. package/lib/types/common/telemetry/TelemetryConstants.d.ts +15 -2
  254. package/lib/types/common/utils.d.ts +7 -3
  255. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  256. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  257. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  258. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  259. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  260. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  261. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  262. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  263. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -4
  264. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  265. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  266. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  267. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -2
  268. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  269. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  270. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  271. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
  272. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  273. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  274. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  275. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  276. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  277. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  278. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  279. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  280. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  281. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  282. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -2
  283. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -2
  284. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  285. package/package.json +5 -4
@@ -4,251 +4,288 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createReducer = void 0;
7
-
8
7
  var _LiveChatWidgetActionType = require("./common/LiveChatWidgetActionType");
9
-
10
8
  /* eslint-disable indent */
9
+
11
10
  const createReducer = () => {
12
11
  const reducer = (state, action) => {
13
12
  var _action$payload, _action$payload2, _action$payload3;
14
-
15
13
  switch (action.type) {
16
14
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID:
17
- return { ...state,
18
- domainStates: { ...state.domainStates,
15
+ return {
16
+ ...state,
17
+ domainStates: {
18
+ ...state.domainStates,
19
19
  widgetElementId: action.payload
20
20
  }
21
21
  };
22
-
23
22
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS:
24
- return { ...state,
25
- domainStates: { ...state.domainStates,
23
+ return {
24
+ ...state,
25
+ domainStates: {
26
+ ...state.domainStates,
26
27
  renderingMiddlewareProps: action.payload
27
28
  }
28
29
  };
29
-
30
30
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MIDDLEWARE_LOCALIZED_TEXTS:
31
- return { ...state,
32
- domainStates: { ...state.domainStates,
31
+ return {
32
+ ...state,
33
+ domainStates: {
34
+ ...state.domainStates,
33
35
  middlewareLocalizedTexts: action.payload
34
36
  }
35
37
  };
36
-
37
38
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_GLOBAL_DIR:
38
- return { ...state,
39
- domainStates: { ...state.domainStates,
39
+ return {
40
+ ...state,
41
+ domainStates: {
42
+ ...state.domainStates,
40
43
  globalDir: action.payload === "ltr" || action.payload === "rtl" ? action.payload : "ltr"
41
44
  }
42
45
  };
43
-
44
46
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED:
45
- return { ...state,
46
- appStates: { ...state.appStates,
47
+ return {
48
+ ...state,
49
+ appStates: {
50
+ ...state.appStates,
47
51
  isMinimized: action.payload
48
52
  }
49
53
  };
50
-
51
54
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE:
52
- return { ...state,
53
- appStates: { ...state.appStates,
55
+ return {
56
+ ...state,
57
+ appStates: {
58
+ ...state.appStates,
54
59
  conversationState: action.payload
55
60
  }
56
61
  };
57
-
58
62
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
59
- return { ...state,
60
- appStates: { ...state.appStates,
63
+ return {
64
+ ...state,
65
+ appStates: {
66
+ ...state.appStates,
61
67
  outsideOperatingHours: action.payload
62
68
  }
63
69
  };
64
-
65
70
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE:
66
- return { ...state,
67
- domainStates: { ...state.domainStates,
71
+ return {
72
+ ...state,
73
+ domainStates: {
74
+ ...state.domainStates,
68
75
  preChatSurveyResponse: action.payload
69
76
  }
70
77
  };
71
-
72
78
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
73
- return { ...state,
74
- domainStates: { ...state.domainStates,
79
+ return {
80
+ ...state,
81
+ domainStates: {
82
+ ...state.domainStates,
75
83
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
84
  customContext: action.payload
77
85
  }
78
86
  };
79
-
80
- case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
81
- return { ...state,
82
- appStates: { ...state.appStates,
83
- previousElementOnFocusBeforeModalOpen: action.payload
87
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
88
+ return {
89
+ ...state,
90
+ appStates: {
91
+ ...state.appStates,
92
+ previousElementIdOnFocusBeforeModalOpen: action.payload
84
93
  }
85
94
  };
86
-
87
95
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION:
88
- return { ...state,
89
- uiStates: { ...state.uiStates,
96
+ return {
97
+ ...state,
98
+ uiStates: {
99
+ ...state.uiStates,
90
100
  showConfirmationPane: action.payload
91
101
  }
92
102
  };
93
-
94
103
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT:
95
- return { ...state,
96
- domainStates: { ...state.domainStates,
104
+ return {
105
+ ...state,
106
+ domainStates: {
107
+ ...state.domainStates,
97
108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
109
  postChatContext: action.payload
99
110
  }
100
111
  };
101
-
102
112
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
103
- return { ...state,
104
- uiStates: { ...state.uiStates,
113
+ return {
114
+ ...state,
115
+ uiStates: {
116
+ ...state.uiStates,
105
117
  showCallingPopup: action.payload
106
118
  }
107
119
  };
108
-
109
120
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_INCOMING_CALL:
110
- return { ...state,
111
- uiStates: { ...state.uiStates,
121
+ return {
122
+ ...state,
123
+ uiStates: {
124
+ ...state.uiStates,
112
125
  isIncomingCall: action.payload
113
126
  }
114
127
  };
115
-
116
128
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
117
- return { ...state,
118
- uiStates: { ...state.uiStates,
129
+ return {
130
+ ...state,
131
+ uiStates: {
132
+ ...state.uiStates,
119
133
  focusChatButton: action.payload
120
134
  }
121
135
  };
122
-
123
136
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
124
- return { ...state,
125
- uiStates: { ...state.uiStates,
137
+ return {
138
+ ...state,
139
+ uiStates: {
140
+ ...state.uiStates,
126
141
  disableVideoCall: action.payload
127
142
  }
128
143
  };
129
-
130
144
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.DISABLE_LOCAL_VIDEO:
131
- return { ...state,
132
- uiStates: { ...state.uiStates,
145
+ return {
146
+ ...state,
147
+ uiStates: {
148
+ ...state.uiStates,
133
149
  disableSelfVideo: action.payload
134
150
  }
135
151
  };
136
-
137
152
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.DISABLE_REMOTE_VIDEO:
138
- return { ...state,
139
- uiStates: { ...state.uiStates,
153
+ return {
154
+ ...state,
155
+ uiStates: {
156
+ ...state.uiStates,
140
157
  disableRemoteVideo: action.payload
141
158
  }
142
159
  };
143
-
144
160
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN:
145
- return { ...state,
146
- domainStates: { ...state.domainStates,
161
+ return {
162
+ ...state,
163
+ domainStates: {
164
+ ...state.domainStates,
147
165
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
148
166
  chatToken: action.payload
149
167
  }
150
168
  };
151
-
152
169
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE:
153
- return { ...state,
154
- uiStates: { ...state.uiStates,
170
+ return {
171
+ ...state,
172
+ uiStates: {
173
+ ...state.uiStates,
155
174
  showEmailTranscriptPane: action.payload
156
175
  }
157
176
  };
158
-
159
177
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRECHAT_RESPONSE_EMAIL:
160
- return { ...state,
161
- appStates: { ...state.appStates,
178
+ return {
179
+ ...state,
180
+ appStates: {
181
+ ...state.appStates,
162
182
  preChatResponseEmail: action.payload
163
183
  }
164
184
  };
165
-
166
185
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION:
167
- return { ...state,
168
- appStates: { ...state.appStates,
186
+ return {
187
+ ...state,
188
+ appStates: {
189
+ ...state.appStates,
169
190
  isAudioMuted: action.payload
170
191
  }
171
192
  };
172
-
173
193
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED:
174
- return { ...state,
175
- appStates: { ...state.appStates,
194
+ return {
195
+ ...state,
196
+ appStates: {
197
+ ...state.appStates,
176
198
  e2vvEnabled: action.payload
177
199
  }
178
200
  };
179
-
180
201
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING:
181
- return { ...state,
182
- appStates: { ...state.appStates,
202
+ return {
203
+ ...state,
204
+ appStates: {
205
+ ...state.appStates,
183
206
  skipChatButtonRendering: action.payload
184
207
  }
185
208
  };
186
-
187
209
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS:
188
- return { ...state,
189
- appStates: { ...state.appStates,
190
- proactiveChatStates: { ...state.appStates.proactiveChatStates,
210
+ return {
211
+ ...state,
212
+ appStates: {
213
+ ...state.appStates,
214
+ proactiveChatStates: {
215
+ ...state.appStates.proactiveChatStates,
191
216
  proactiveChatBodyTitle: (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.proactiveChatBodyTitle,
192
217
  proactiveChatEnablePrechat: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.proactiveChatEnablePrechat,
193
218
  proactiveChatInNewWindow: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.proactiveChatInNewWindow
194
219
  }
195
220
  }
196
221
  };
197
-
198
222
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA:
199
- return { ...state,
200
- domainStates: { ...state.domainStates,
223
+ return {
224
+ ...state,
225
+ domainStates: {
226
+ ...state.domainStates,
201
227
  telemetryInternalData: action.payload
202
228
  }
203
229
  };
204
-
205
230
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID:
206
- return { ...state,
207
- appStates: { ...state.appStates,
231
+ return {
232
+ ...state,
233
+ appStates: {
234
+ ...state.appStates,
208
235
  reconnectId: action.payload
209
236
  }
210
237
  };
211
-
212
238
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT:
213
- return { ...state,
214
- appStates: { ...state.appStates,
239
+ return {
240
+ ...state,
241
+ appStates: {
242
+ ...state.appStates,
215
243
  unreadMessageCount: action.payload
216
244
  }
217
245
  };
218
-
219
246
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
220
- return { ...state,
221
- domainStates: { ...state.domainStates,
247
+ return {
248
+ ...state,
249
+ domainStates: {
250
+ ...state.domainStates,
222
251
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
252
  liveChatContext: action.payload
224
253
  }
225
254
  };
226
-
227
255
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE:
228
- return { ...action.payload
256
+ return {
257
+ ...action.payload
229
258
  };
230
-
231
259
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
232
- return { ...state,
233
- appStates: { ...state.appStates,
260
+ return {
261
+ ...state,
262
+ appStates: {
263
+ ...state.appStates,
234
264
  conversationEndedByAgent: action.payload
235
265
  }
236
266
  };
237
-
238
267
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
239
- return { ...state,
240
- domainStates: { ...state.domainStates,
268
+ return {
269
+ ...state,
270
+ domainStates: {
271
+ ...state.domainStates,
241
272
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
273
  widgetSize: action.payload
243
274
  }
244
275
  };
245
-
276
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
277
+ return {
278
+ ...state,
279
+ domainStates: {
280
+ ...state.domainStates,
281
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
282
+ widgetInstanceId: action.payload
283
+ }
284
+ };
246
285
  default:
247
286
  return state;
248
287
  }
249
288
  };
250
-
251
289
  return reducer;
252
290
  };
253
-
254
291
  exports.createReducer = createReducer;
@@ -4,89 +4,60 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = exports.shouldShowProactiveChatPane = exports.shouldShowPreChatSurveyPane = exports.shouldShowPostChatSurveyPane = exports.shouldShowPostChatLoadingPane = exports.shouldShowOutOfOfficeHoursPane = exports.shouldShowLoadingPane = exports.shouldShowHeader = exports.shouldShowFooter = exports.shouldShowEmailTranscriptPane = exports.shouldShowConfirmationPane = exports.shouldShowChatButton = exports.shouldShowCallingContainer = void 0;
7
-
8
7
  var _ConversationState = require("../contexts/common/ConversationState");
9
-
10
8
  const shouldShowChatButton = state => {
11
9
  return (state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
12
10
  };
13
-
14
11
  exports.shouldShowChatButton = shouldShowChatButton;
15
-
16
12
  const shouldShowProactiveChatPane = state => {
17
13
  return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat;
18
14
  };
19
-
20
15
  exports.shouldShowProactiveChatPane = shouldShowProactiveChatPane;
21
-
22
16
  const shouldShowHeader = state => {
23
17
  return !state.appStates.isMinimized && state.appStates.conversationState !== _ConversationState.ConversationState.Closed && state.appStates.conversationState !== _ConversationState.ConversationState.ProactiveChat;
24
18
  };
25
-
26
19
  exports.shouldShowHeader = shouldShowHeader;
27
-
28
20
  const shouldShowFooter = state => {
29
- return !state.appStates.isMinimized && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive);
21
+ return !state.appStates.isMinimized && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive || state.appStates.conversationState === _ConversationState.ConversationState.Postchat);
30
22
  };
31
-
32
23
  exports.shouldShowFooter = shouldShowFooter;
33
-
34
24
  const shouldShowEmailTranscriptPane = state => {
35
25
  return state.uiStates.showEmailTranscriptPane;
36
26
  };
37
-
38
27
  exports.shouldShowEmailTranscriptPane = shouldShowEmailTranscriptPane;
39
-
40
28
  const shouldShowWebChatContainer = state => {
41
29
  return state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive;
42
30
  };
43
-
44
31
  exports.shouldShowWebChatContainer = shouldShowWebChatContainer;
45
-
46
32
  const shouldShowLoadingPane = state => {
47
- return !state.appStates.isMinimized && !state.appStates.shouldShowPostChat && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
33
+ return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
48
34
  };
49
-
50
35
  exports.shouldShowLoadingPane = shouldShowLoadingPane;
51
-
52
36
  const shouldShowReconnectChatPane = state => {
53
37
  return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat;
54
38
  };
55
-
56
39
  exports.shouldShowReconnectChatPane = shouldShowReconnectChatPane;
57
-
58
40
  const shouldShowPostChatLoadingPane = state => {
59
- return !state.appStates.isMinimized && state.appStates.shouldShowPostChat && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
41
+ return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading;
60
42
  };
61
-
62
43
  exports.shouldShowPostChatLoadingPane = shouldShowPostChatLoadingPane;
63
-
64
44
  const shouldShowOutOfOfficeHoursPane = state => {
65
45
  return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice;
66
46
  };
67
-
68
47
  exports.shouldShowOutOfOfficeHoursPane = shouldShowOutOfOfficeHoursPane;
69
-
70
48
  const shouldShowPreChatSurveyPane = state => {
71
49
  return state.appStates.conversationState === _ConversationState.ConversationState.Prechat;
72
50
  };
73
-
74
51
  exports.shouldShowPreChatSurveyPane = shouldShowPreChatSurveyPane;
75
-
76
52
  const shouldShowConfirmationPane = state => {
77
53
  return state.uiStates.showConfirmationPane;
78
54
  };
79
-
80
55
  exports.shouldShowConfirmationPane = shouldShowConfirmationPane;
81
-
82
56
  const shouldShowPostChatSurveyPane = state => {
83
57
  return state.appStates.conversationState === _ConversationState.ConversationState.Postchat;
84
58
  };
85
-
86
59
  exports.shouldShowPostChatSurveyPane = shouldShowPostChatSurveyPane;
87
-
88
60
  const shouldShowCallingContainer = state => {
89
61
  return state.appStates.conversationState === _ConversationState.ConversationState.Active && state.appStates.e2vvEnabled;
90
62
  };
91
-
92
63
  exports.shouldShowCallingContainer = shouldShowCallingContainer;
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _ChatAdapterStore = require("../contexts/ChatAdapterStore");
9
-
10
8
  var _react = require("react");
11
-
12
9
  const useChatAdapterStore = () => {
13
10
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
11
  const adapter = (0, _react.useContext)(_ChatAdapterStore.ChatAdapterStore);
15
-
16
12
  if (!adapter) {
17
13
  throw new Error("This hook can only be used on component that is descendants of <ChatAdapterStore.Provider>");
18
14
  }
19
-
20
15
  return adapter;
21
16
  };
22
-
23
17
  var _default = useChatAdapterStore;
24
18
  exports.default = _default;
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _ChatContextStore = require("../contexts/ChatContextStore");
11
-
12
9
  const useChatContextStore = () => {
13
10
  const context = (0, _react.useContext)(_ChatContextStore.ChatContextStore);
14
-
15
11
  if (!context) {
16
12
  throw new Error("This hook can only be used on component that is descendants of <ChatContextStore.Provider>");
17
13
  }
18
-
19
14
  return context;
20
15
  };
21
-
22
16
  var _default = useChatContextStore;
23
17
  exports.default = _default;
@@ -4,20 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _ChatSDKStore = require("../contexts/ChatSDKStore");
9
-
10
8
  var _react = require("react");
11
-
12
9
  const useChatSDKStore = () => {
13
10
  const sdk = (0, _react.useContext)(_ChatSDKStore.ChatSDKStore);
14
-
15
11
  if (!sdk) {
16
12
  throw new Error("This hook is not called on component that is descendants of <ChatSDKStore.Provider>, or ChatSDK is not passed into LiveChatWidget component.");
17
13
  }
18
-
19
14
  return sdk;
20
15
  };
21
-
22
16
  var _default = useChatSDKStore;
23
17
  exports.default = _default;
package/lib/cjs/index.js CHANGED
@@ -39,13 +39,8 @@ Object.defineProperty(exports, "useChatSDKStore", {
39
39
  return _useChatSDKStore.default;
40
40
  }
41
41
  });
42
-
43
42
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
44
-
45
43
  var _useChatContextStore = _interopRequireDefault(require("./hooks/useChatContextStore"));
46
-
47
44
  var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore"));
48
-
49
45
  var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
50
-
51
46
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -4,31 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createOnNewAdapterActivityHandler = void 0;
7
-
8
7
  var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
9
-
10
8
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
11
-
12
9
  var _Constants = require("../common/Constants");
13
-
14
10
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
15
-
16
11
  const createOnNewAdapterActivityHandler = (chatId, userId) => {
17
12
  const onNewAdapterActivityHandler = activity => {
18
13
  var _activity$channelData, _activity$channelData2, _activity$channelData3;
19
-
20
14
  const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message;
21
- 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.Constants.historyMessageTag)) && !(activity !== null && activity !== void 0 && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && _activity$channelData3.fromList);
22
-
23
- if (isNotHistoryMessage) {
24
- raiseMessageEvent(activity);
25
- }
15
+ const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
16
+ raiseMessageEvent(activity, isHistoryMessage);
26
17
  };
27
-
28
- const raiseMessageEvent = activity => {
18
+ const raiseMessageEvent = (activity, isHistoryMessage) => {
29
19
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
30
20
  var _text, _text2, _activity$channelData4, _activity$from;
31
-
32
21
  const payload = {
33
22
  // To identify hidden contents vs empty content
34
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -39,7 +28,6 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
39
28
  tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
40
29
  messageType: ""
41
30
  };
42
-
43
31
  if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _Constants.Constants.userMessageTag) {
44
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
33
  payload.messageType = _Constants.Constants.userMessageTag;
@@ -47,53 +35,44 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
47
35
  eventName: _TelemetryConstants.BroadcastEvent.NewMessageSent,
48
36
  payload: payload
49
37
  };
50
-
51
38
  _omnichannelChatComponents.BroadcastService.postMessage(newMessageSentEvent);
52
-
53
39
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
54
40
  Event: _TelemetryConstants.TelemetryEvent.MessageSent,
55
41
  Description: "New message sent"
56
42
  });
57
43
  } else {
58
44
  var _activity$channelData5, _activity$channelData6;
59
-
60
45
  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.Constants.systemMessageTag)) {
61
46
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
47
  payload.messageType = _Constants.Constants.systemMessageTag;
63
48
  } else {
64
49
  var _activity$channelData7, _activity$channelData8, _activity$channelData9;
65
-
66
50
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
- const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
-
69
- 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
70
-
51
+ const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
+ 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;
54
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
55
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
72
-
73
56
  if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
74
57
  return;
75
58
  }
76
-
77
59
  payload.messageType = _Constants.Constants.userMessageTag;
78
60
  }
79
-
80
61
  const newMessageReceivedEvent = {
81
- eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
62
+ eventName: isHistoryMessage ? _TelemetryConstants.BroadcastEvent.HistoryMessageReceived : _TelemetryConstants.BroadcastEvent.NewMessageReceived,
82
63
  payload: payload
83
64
  };
84
-
85
65
  _omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
86
-
87
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
88
- Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
89
- Description: "New message received",
90
- Data: payload
91
- });
66
+ if (!isHistoryMessage) {
67
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
68
+ Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
69
+ Description: "New message received",
70
+ Data: payload
71
+ });
72
+ }
92
73
  }
93
74
  }
94
75
  };
95
-
96
76
  return onNewAdapterActivityHandler;
97
77
  };
98
-
99
78
  exports.createOnNewAdapterActivityHandler = createOnNewAdapterActivityHandler;