@microsoft/omnichannel-chat-widget 0.1.0-main.106d830 → 0.1.0-main.170e416

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 (308) hide show
  1. package/README.md +32 -0
  2. package/lib/cjs/common/Constants.js +26 -161
  3. package/lib/cjs/common/KeyCodes.js +0 -3
  4. package/lib/cjs/common/contextDataStore/DataStoreManager.js +0 -4
  5. package/lib/cjs/common/storage/default/defaultCacheManager.js +24 -0
  6. package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +102 -0
  7. package/lib/cjs/common/storage/default/defaultInMemoryDataStore.js +78 -0
  8. package/lib/cjs/common/telemetry/TelemetryConstants.js +54 -26
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +16 -57
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +6 -31
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -3
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +37 -42
  13. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -14
  14. package/lib/cjs/common/utils.js +71 -84
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +21 -45
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -26
  17. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  18. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -32
  19. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  20. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -36
  21. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  22. package/lib/cjs/components/footerstateful/FooterStateful.js +11 -42
  23. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  24. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -44
  25. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  26. package/lib/cjs/components/headerstateful/HeaderStateful.js +16 -30
  27. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  28. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +37 -0
  29. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +18 -0
  30. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  31. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
  32. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +62 -0
  33. package/lib/cjs/components/livechatwidget/common/Deferred.js +35 -0
  34. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  35. package/lib/cjs/components/livechatwidget/common/createAdapter.js +10 -9
  36. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  37. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  38. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +36 -43
  39. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
  40. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +70 -52
  41. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  42. package/lib/cjs/components/livechatwidget/common/endChat.js +85 -35
  43. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  44. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  45. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  46. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +36 -53
  47. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +78 -128
  48. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +7 -32
  49. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
  50. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  51. package/lib/cjs/components/livechatwidget/common/startChat.js +226 -102
  52. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  53. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  54. package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  55. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +329 -191
  56. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +4 -17
  57. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  58. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
  59. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  60. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  61. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  62. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  63. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  64. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +11 -44
  65. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +19 -33
  66. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -24
  67. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  68. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  69. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  70. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  71. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
  72. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -16
  73. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  74. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
  75. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  76. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  77. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +10 -0
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -37
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  117. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  118. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  119. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -12
  120. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  121. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  122. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  123. package/lib/cjs/contexts/common/ConversationState.js +3 -3
  124. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +27 -23
  125. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +13 -13
  126. package/lib/cjs/contexts/createReducer.js +161 -99
  127. package/lib/cjs/controller/componentController.js +4 -33
  128. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  129. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  130. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  131. package/lib/cjs/index.js +0 -5
  132. package/lib/cjs/plugins/newMessageEventHandler.js +22 -46
  133. package/lib/esm/common/Constants.js +23 -148
  134. package/lib/esm/common/KeyCodes.js +0 -2
  135. package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
  136. package/lib/esm/common/storage/default/defaultCacheManager.js +16 -0
  137. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +95 -0
  138. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  139. package/lib/esm/common/telemetry/TelemetryConstants.js +58 -23
  140. package/lib/esm/common/telemetry/TelemetryHelper.js +16 -45
  141. package/lib/esm/common/telemetry/TelemetryManager.js +6 -19
  142. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  143. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +35 -26
  144. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -10
  145. package/lib/esm/common/utils.js +64 -46
  146. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +21 -16
  147. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +23 -13
  148. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  149. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +9 -13
  150. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
  151. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  152. package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
  153. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +15 -37
  154. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  155. package/lib/esm/components/headerstateful/HeaderStateful.js +16 -15
  156. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  157. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
  158. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +11 -0
  159. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  160. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
  161. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +55 -0
  162. package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
  163. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  164. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
  165. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  166. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  167. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  168. package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
  169. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +72 -39
  170. package/lib/esm/components/livechatwidget/common/endChat.js +85 -21
  171. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  172. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  173. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  174. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +39 -22
  175. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +78 -110
  176. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +7 -22
  177. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
  178. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  179. package/lib/esm/components/livechatwidget/common/startChat.js +228 -84
  180. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  181. package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
  182. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +333 -140
  183. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +4 -5
  184. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  185. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  186. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  187. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  188. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  189. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  190. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  191. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +15 -29
  192. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +21 -9
  193. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -6
  194. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  195. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  196. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  197. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  198. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  199. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -12
  200. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  201. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  202. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  203. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  204. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -0
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -22
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  241. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  242. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  243. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  244. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  245. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  246. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -5
  247. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  248. package/lib/esm/contexts/ChatContextStore.js +2 -1
  249. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  250. package/lib/esm/contexts/common/ConversationState.js +3 -3
  251. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +27 -23
  252. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +13 -9
  253. package/lib/esm/contexts/createReducer.js +161 -96
  254. package/lib/esm/controller/componentController.js +5 -4
  255. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  256. package/lib/esm/hooks/useChatContextStore.js +0 -4
  257. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  258. package/lib/esm/plugins/newMessageEventHandler.js +22 -35
  259. package/lib/types/common/Constants.d.ts +21 -1
  260. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  261. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  262. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  263. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  264. package/lib/types/common/telemetry/TelemetryConstants.d.ts +39 -8
  265. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
  266. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -4
  267. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  268. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  269. package/lib/types/common/utils.d.ts +7 -1
  270. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  271. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  272. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  273. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  274. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  275. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  276. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  277. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  278. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
  279. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  280. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -7
  281. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  282. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -2
  283. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -1
  284. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +6 -3
  285. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
  286. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  287. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  288. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  289. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -2
  290. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  291. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  292. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  293. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  294. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  295. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  296. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  297. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  298. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  299. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  300. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  301. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  302. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  303. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  304. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  305. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -3
  306. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +27 -22
  307. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  308. package/package.json +7 -9
@@ -1,228 +1,293 @@
1
1
  /* eslint-disable indent */
2
+
2
3
  import { LiveChatWidgetActionType } from "./common/LiveChatWidgetActionType";
3
4
  export const createReducer = () => {
4
5
  const reducer = (state, action) => {
5
6
  var _action$payload, _action$payload2, _action$payload3;
6
-
7
7
  switch (action.type) {
8
8
  case LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID:
9
- return { ...state,
10
- domainStates: { ...state.domainStates,
9
+ return {
10
+ ...state,
11
+ domainStates: {
12
+ ...state.domainStates,
11
13
  widgetElementId: action.payload
12
14
  }
13
15
  };
14
-
15
16
  case LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS:
16
- return { ...state,
17
- domainStates: { ...state.domainStates,
17
+ return {
18
+ ...state,
19
+ domainStates: {
20
+ ...state.domainStates,
18
21
  renderingMiddlewareProps: action.payload
19
22
  }
20
23
  };
21
-
22
24
  case LiveChatWidgetActionType.SET_MIDDLEWARE_LOCALIZED_TEXTS:
23
- return { ...state,
24
- domainStates: { ...state.domainStates,
25
+ return {
26
+ ...state,
27
+ domainStates: {
28
+ ...state.domainStates,
25
29
  middlewareLocalizedTexts: action.payload
26
30
  }
27
31
  };
28
-
29
32
  case LiveChatWidgetActionType.SET_GLOBAL_DIR:
30
- return { ...state,
31
- domainStates: { ...state.domainStates,
33
+ return {
34
+ ...state,
35
+ domainStates: {
36
+ ...state.domainStates,
32
37
  globalDir: action.payload === "ltr" || action.payload === "rtl" ? action.payload : "ltr"
33
38
  }
34
39
  };
35
-
36
40
  case LiveChatWidgetActionType.SET_MINIMIZED:
37
- return { ...state,
38
- appStates: { ...state.appStates,
41
+ return {
42
+ ...state,
43
+ appStates: {
44
+ ...state.appStates,
39
45
  isMinimized: action.payload
40
46
  }
41
47
  };
42
-
43
48
  case LiveChatWidgetActionType.SET_CONVERSATION_STATE:
44
- return { ...state,
45
- appStates: { ...state.appStates,
49
+ return {
50
+ ...state,
51
+ appStates: {
52
+ ...state.appStates,
46
53
  conversationState: action.payload
47
54
  }
48
55
  };
49
-
50
56
  case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
51
- return { ...state,
52
- appStates: { ...state.appStates,
57
+ return {
58
+ ...state,
59
+ appStates: {
60
+ ...state.appStates,
53
61
  outsideOperatingHours: action.payload
54
62
  }
55
63
  };
56
-
57
64
  case LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE:
58
- return { ...state,
59
- domainStates: { ...state.domainStates,
65
+ return {
66
+ ...state,
67
+ domainStates: {
68
+ ...state.domainStates,
60
69
  preChatSurveyResponse: action.payload
61
70
  }
62
71
  };
63
-
64
- case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
65
- return { ...state,
66
- appStates: { ...state.appStates,
67
- previousElementOnFocusBeforeModalOpen: action.payload
72
+ case LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
73
+ return {
74
+ ...state,
75
+ domainStates: {
76
+ ...state.domainStates,
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ customContext: action.payload
79
+ }
80
+ };
81
+ case LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID:
82
+ return {
83
+ ...state,
84
+ appStates: {
85
+ ...state.appStates,
86
+ previousElementIdOnFocusBeforeModalOpen: action.payload
68
87
  }
69
88
  };
70
-
71
89
  case LiveChatWidgetActionType.SET_SHOW_CONFIRMATION:
72
- return { ...state,
73
- uiStates: { ...state.uiStates,
90
+ return {
91
+ ...state,
92
+ uiStates: {
93
+ ...state.uiStates,
74
94
  showConfirmationPane: action.payload
75
95
  }
76
96
  };
77
-
78
97
  case LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT:
79
- return { ...state,
80
- domainStates: { ...state.domainStates,
98
+ return {
99
+ ...state,
100
+ domainStates: {
101
+ ...state.domainStates,
81
102
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
103
  postChatContext: action.payload
83
104
  }
84
105
  };
85
-
86
106
  case LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
87
- return { ...state,
88
- uiStates: { ...state.uiStates,
107
+ return {
108
+ ...state,
109
+ uiStates: {
110
+ ...state.uiStates,
89
111
  showCallingPopup: action.payload
90
112
  }
91
113
  };
92
-
93
114
  case LiveChatWidgetActionType.SET_INCOMING_CALL:
94
- return { ...state,
95
- uiStates: { ...state.uiStates,
115
+ return {
116
+ ...state,
117
+ uiStates: {
118
+ ...state.uiStates,
96
119
  isIncomingCall: action.payload
97
120
  }
98
121
  };
99
-
100
122
  case LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
101
- return { ...state,
102
- uiStates: { ...state.uiStates,
123
+ return {
124
+ ...state,
125
+ uiStates: {
126
+ ...state.uiStates,
103
127
  focusChatButton: action.payload
104
128
  }
105
129
  };
106
-
107
130
  case LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
108
- return { ...state,
109
- uiStates: { ...state.uiStates,
131
+ return {
132
+ ...state,
133
+ uiStates: {
134
+ ...state.uiStates,
110
135
  disableVideoCall: action.payload
111
136
  }
112
137
  };
113
-
114
138
  case LiveChatWidgetActionType.DISABLE_LOCAL_VIDEO:
115
- return { ...state,
116
- uiStates: { ...state.uiStates,
139
+ return {
140
+ ...state,
141
+ uiStates: {
142
+ ...state.uiStates,
117
143
  disableSelfVideo: action.payload
118
144
  }
119
145
  };
120
-
121
146
  case LiveChatWidgetActionType.DISABLE_REMOTE_VIDEO:
122
- return { ...state,
123
- uiStates: { ...state.uiStates,
147
+ return {
148
+ ...state,
149
+ uiStates: {
150
+ ...state.uiStates,
124
151
  disableRemoteVideo: action.payload
125
152
  }
126
153
  };
127
-
128
154
  case LiveChatWidgetActionType.SET_CHAT_TOKEN:
129
- return { ...state,
130
- domainStates: { ...state.domainStates,
155
+ return {
156
+ ...state,
157
+ domainStates: {
158
+ ...state.domainStates,
131
159
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
160
  chatToken: action.payload
133
161
  }
134
162
  };
135
-
136
163
  case LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE:
137
- return { ...state,
138
- uiStates: { ...state.uiStates,
164
+ return {
165
+ ...state,
166
+ uiStates: {
167
+ ...state.uiStates,
139
168
  showEmailTranscriptPane: action.payload
140
169
  }
141
170
  };
142
-
143
171
  case LiveChatWidgetActionType.SET_PRECHAT_RESPONSE_EMAIL:
144
- return { ...state,
145
- appStates: { ...state.appStates,
172
+ return {
173
+ ...state,
174
+ appStates: {
175
+ ...state.appStates,
146
176
  preChatResponseEmail: action.payload
147
177
  }
148
178
  };
149
-
150
179
  case LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION:
151
- return { ...state,
152
- appStates: { ...state.appStates,
180
+ return {
181
+ ...state,
182
+ appStates: {
183
+ ...state.appStates,
153
184
  isAudioMuted: action.payload
154
185
  }
155
186
  };
156
-
157
187
  case LiveChatWidgetActionType.SET_E2VV_ENABLED:
158
- return { ...state,
159
- appStates: { ...state.appStates,
188
+ return {
189
+ ...state,
190
+ appStates: {
191
+ ...state.appStates,
160
192
  e2vvEnabled: action.payload
161
193
  }
162
194
  };
163
-
164
- case LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING:
165
- return { ...state,
166
- appStates: { ...state.appStates,
167
- skipChatButtonRendering: action.payload
195
+ case LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY:
196
+ return {
197
+ ...state,
198
+ appStates: {
199
+ ...state.appStates,
200
+ hideStartChatButton: action.payload
168
201
  }
169
202
  };
170
-
171
203
  case LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS:
172
- return { ...state,
173
- appStates: { ...state.appStates,
174
- proactiveChatStates: { ...state.appStates.proactiveChatStates,
204
+ return {
205
+ ...state,
206
+ appStates: {
207
+ ...state.appStates,
208
+ proactiveChatStates: {
209
+ ...state.appStates.proactiveChatStates,
175
210
  proactiveChatBodyTitle: (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.proactiveChatBodyTitle,
176
211
  proactiveChatEnablePrechat: (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.proactiveChatEnablePrechat,
177
212
  proactiveChatInNewWindow: (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.proactiveChatInNewWindow
178
213
  }
179
214
  }
180
215
  };
181
-
182
216
  case LiveChatWidgetActionType.SET_TELEMETRY_DATA:
183
- return { ...state,
184
- domainStates: { ...state.domainStates,
217
+ return {
218
+ ...state,
219
+ domainStates: {
220
+ ...state.domainStates,
185
221
  telemetryInternalData: action.payload
186
222
  }
187
223
  };
188
-
189
224
  case LiveChatWidgetActionType.SET_RECONNECT_ID:
190
- return { ...state,
191
- appStates: { ...state.appStates,
225
+ return {
226
+ ...state,
227
+ appStates: {
228
+ ...state.appStates,
192
229
  reconnectId: action.payload
193
230
  }
194
231
  };
195
-
196
232
  case LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT:
197
- return { ...state,
198
- appStates: { ...state.appStates,
233
+ return {
234
+ ...state,
235
+ appStates: {
236
+ ...state.appStates,
199
237
  unreadMessageCount: action.payload
200
238
  }
201
239
  };
202
-
203
240
  case LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
204
- return { ...state,
205
- domainStates: { ...state.domainStates,
241
+ return {
242
+ ...state,
243
+ domainStates: {
244
+ ...state.domainStates,
206
245
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
207
246
  liveChatContext: action.payload
208
247
  }
209
248
  };
210
-
211
249
  case LiveChatWidgetActionType.SET_WIDGET_STATE:
212
- return { ...action.payload
250
+ return {
251
+ ...action.payload
213
252
  };
214
-
215
253
  case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
216
- return { ...state,
217
- appStates: { ...state.appStates,
254
+ return {
255
+ ...state,
256
+ appStates: {
257
+ ...state.appStates,
218
258
  conversationEndedByAgent: action.payload
219
259
  }
220
260
  };
221
-
261
+ case LiveChatWidgetActionType.SET_WIDGET_SIZE:
262
+ return {
263
+ ...state,
264
+ domainStates: {
265
+ ...state.domainStates,
266
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
+ widgetSize: action.payload
268
+ }
269
+ };
270
+ case LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
271
+ return {
272
+ ...state,
273
+ domainStates: {
274
+ ...state.domainStates,
275
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
276
+ widgetInstanceId: action.payload
277
+ }
278
+ };
279
+ case LiveChatWidgetActionType.SET_LIVE_CHAT_CONFIG:
280
+ return {
281
+ ...state,
282
+ domainStates: {
283
+ ...state.domainStates,
284
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
+ liveChatConfig: action.payload
286
+ }
287
+ };
222
288
  default:
223
289
  return state;
224
290
  }
225
291
  };
226
-
227
292
  return reducer;
228
293
  };
@@ -1,7 +1,8 @@
1
1
  import { ConversationState } from "../contexts/common/ConversationState";
2
2
  export const shouldShowChatButton = state => {
3
- return state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed;
3
+ return (state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed) && state.appStates.hideStartChatButton === false; // Do not show chat button in case of popout
4
4
  };
5
+
5
6
  export const shouldShowProactiveChatPane = state => {
6
7
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ProactiveChat;
7
8
  };
@@ -9,7 +10,7 @@ export const shouldShowHeader = state => {
9
10
  return !state.appStates.isMinimized && state.appStates.conversationState !== ConversationState.Closed && state.appStates.conversationState !== ConversationState.ProactiveChat;
10
11
  };
11
12
  export const shouldShowFooter = state => {
12
- return !state.appStates.isMinimized && (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive);
13
+ return !state.appStates.isMinimized && (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive || state.appStates.conversationState === ConversationState.Postchat);
13
14
  };
14
15
  export const shouldShowEmailTranscriptPane = state => {
15
16
  return state.uiStates.showEmailTranscriptPane;
@@ -18,13 +19,13 @@ export const shouldShowWebChatContainer = state => {
18
19
  return state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive;
19
20
  };
20
21
  export const shouldShowLoadingPane = state => {
21
- return !state.appStates.isMinimized && !state.appStates.shouldShowPostChat && state.appStates.conversationState === ConversationState.Loading;
22
+ return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Loading;
22
23
  };
23
24
  export const shouldShowReconnectChatPane = state => {
24
25
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ReconnectChat;
25
26
  };
26
27
  export const shouldShowPostChatLoadingPane = state => {
27
- return !state.appStates.isMinimized && state.appStates.shouldShowPostChat && state.appStates.conversationState === ConversationState.Loading;
28
+ return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.PostchatLoading;
28
29
  };
29
30
  export const shouldShowOutOfOfficeHoursPane = state => {
30
31
  return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.OutOfOffice;
@@ -1,15 +1,11 @@
1
1
  import { ChatAdapterStore } from "../contexts/ChatAdapterStore";
2
2
  import { useContext } from "react";
3
-
4
3
  const useChatAdapterStore = () => {
5
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
5
  const adapter = useContext(ChatAdapterStore);
7
-
8
6
  if (!adapter) {
9
7
  throw new Error("This hook can only be used on component that is descendants of <ChatAdapterStore.Provider>");
10
8
  }
11
-
12
9
  return adapter;
13
10
  };
14
-
15
11
  export default useChatAdapterStore;
@@ -1,14 +1,10 @@
1
1
  import { useContext } from "react";
2
2
  import { ChatContextStore } from "../contexts/ChatContextStore";
3
-
4
3
  const useChatContextStore = () => {
5
4
  const context = useContext(ChatContextStore);
6
-
7
5
  if (!context) {
8
6
  throw new Error("This hook can only be used on component that is descendants of <ChatContextStore.Provider>");
9
7
  }
10
-
11
8
  return context;
12
9
  };
13
-
14
10
  export default useChatContextStore;
@@ -1,14 +1,10 @@
1
1
  import { ChatSDKStore } from "../contexts/ChatSDKStore";
2
2
  import { useContext } from "react";
3
-
4
3
  const useChatSDKStore = () => {
5
4
  const sdk = useContext(ChatSDKStore);
6
-
7
5
  if (!sdk) {
8
6
  throw new Error("This hook is not called on component that is descendants of <ChatSDKStore.Provider>, or ChatSDK is not passed into LiveChatWidget component.");
9
7
  }
10
-
11
8
  return sdk;
12
9
  };
13
-
14
10
  export default useChatSDKStore;
@@ -2,36 +2,26 @@ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/Te
2
2
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
3
3
  import { Constants } from "../common/Constants";
4
4
  import { TelemetryHelper } from "../common/telemetry/TelemetryHelper";
5
- import { TelemetryManager } from "../common/telemetry/TelemetryManager";
6
5
  export const createOnNewAdapterActivityHandler = (chatId, userId) => {
7
6
  const onNewAdapterActivityHandler = activity => {
8
7
  var _activity$channelData, _activity$channelData2, _activity$channelData3;
9
-
10
8
  const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message;
11
- const isNotHistoryMessage = isActivityMessage && !(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.historyMessageTag)) && !(activity !== null && activity !== void 0 && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && _activity$channelData3.fromList);
12
-
13
- if (isNotHistoryMessage) {
14
- raiseMessageEvent(activity);
15
- }
9
+ 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.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
10
+ raiseMessageEvent(activity, isHistoryMessage);
16
11
  };
17
-
18
- const raiseMessageEvent = activity => {
12
+ const raiseMessageEvent = (activity, isHistoryMessage) => {
19
13
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
20
- var _TelemetryManager$Int, _activity$from;
21
-
14
+ var _text, _text2, _activity$channelData4, _activity$from;
22
15
  const payload = {
16
+ // To identify hidden contents vs empty content
23
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- text: activity === null || activity === void 0 ? void 0 : activity.text,
25
- id: activity === null || activity === void 0 ? void 0 : activity.id,
18
+ text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
26
19
  type: activity === null || activity === void 0 ? void 0 : activity.type,
27
20
  timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
28
- chatId: chatId,
29
21
  userId: userId,
30
- conversationId: ((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId) ?? "",
31
- channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
22
+ tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
32
23
  messageType: ""
33
24
  };
34
-
35
25
  if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === Constants.userMessageTag) {
36
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
27
  payload.messageType = Constants.userMessageTag;
@@ -45,40 +35,37 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
45
35
  Description: "New message sent"
46
36
  });
47
37
  } else {
48
- var _activity$channelData4, _activity$channelData5;
49
-
50
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(Constants.systemMessageTag)) {
38
+ var _activity$channelData5, _activity$channelData6;
39
+ if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.systemMessageTag)) {
51
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
41
  payload.messageType = Constants.systemMessageTag;
53
42
  } else {
54
- var _activity$channelData6, _activity$channelData7, _activity$channelData8;
55
-
43
+ var _activity$channelData7, _activity$channelData8, _activity$channelData9;
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ 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;
56
48
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
- const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
-
59
- const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.tags) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
-
61
49
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
62
-
63
50
  if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
64
51
  return;
65
52
  }
66
-
67
53
  payload.messageType = Constants.userMessageTag;
68
54
  }
69
-
70
55
  const newMessageReceivedEvent = {
71
- eventName: BroadcastEvent.NewMessageReceived,
56
+ eventName: isHistoryMessage ? BroadcastEvent.HistoryMessageReceived : BroadcastEvent.NewMessageReceived,
72
57
  payload: payload
73
58
  };
74
59
  BroadcastService.postMessage(newMessageReceivedEvent);
75
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
76
- Event: TelemetryEvent.MessageReceived,
77
- Description: "New message received"
78
- });
60
+ if (!isHistoryMessage) {
61
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
62
+ Event: TelemetryEvent.MessageReceived,
63
+ Description: "New message received",
64
+ Data: payload
65
+ });
66
+ }
79
67
  }
80
68
  }
81
69
  };
82
-
83
70
  return onNewAdapterActivityHandler;
84
71
  };
@@ -1,4 +1,6 @@
1
1
  export declare class Constants {
2
+ static readonly magicCodeBroadcastChannel = "MagicCodeChannel";
3
+ static readonly magicCodeResponseBroadcastChannel = "MagicCodeResponseChannel";
2
4
  static readonly systemMessageTag = "system";
3
5
  static readonly userMessageTag = "user";
4
6
  static readonly historyMessageTag = "history";
@@ -15,7 +17,6 @@ export declare class Constants {
15
17
  static readonly true = "true";
16
18
  static readonly false = "false";
17
19
  static readonly maximumUnreadMessageCount = 99;
18
- static readonly widgetStateDataKey = "LcwChatWidgetState";
19
20
  static readonly channelIdKey = "ChannelId-";
20
21
  static readonly ChannelId = "lcw";
21
22
  static readonly CustomerTag = "FromCustomer";
@@ -33,6 +34,10 @@ export declare class Constants {
33
34
  static readonly queuePositionMessageTag = "queueposition";
34
35
  static readonly averageWaitTimeMessageTag = "averagewaittime";
35
36
  static readonly message = "message";
37
+ static readonly hiddenTag = "Hidden";
38
+ static readonly prefixTimestampTag = "ServerMessageTimestamp_";
39
+ static readonly acsChannel = "ACS_CHANNEL";
40
+ static readonly publicMessageTag = "public";
36
41
  static readonly supportedAdaptiveCardContentTypes: Array<string>;
37
42
  static readonly maxUploadFileSize = "500000";
38
43
  static readonly imageRegex: RegExp;
@@ -70,6 +75,9 @@ export declare class Constants {
70
75
  static readonly OpenLinkIconCssClass = "webchat__markdown__external-link-icon";
71
76
  static readonly internetConnectionTestUrl = "https://ocsdk-prod.azureedge.net/public/connecttest.txt";
72
77
  static readonly internetConnectionTestUrlText = "Omnichannel Connect Test";
78
+ static readonly ChatWidgetStateChangedPrefix = "ChatWidgetStateChanged";
79
+ static readonly PostChatLoadingDurationInMs = 2000;
80
+ static readonly BrowserUnloadConfirmationMessage = "Do you want to leave chat?";
73
81
  }
74
82
  export declare const Regex: {
75
83
  new (): {};
@@ -142,6 +150,18 @@ export declare enum EnvironmentVersion {
142
150
  int = "int",
143
151
  test = "test"
144
152
  }
153
+ export declare enum E2VVOptions {
154
+ NoCalling = "192350000",
155
+ VideoAndVoiceCalling = "192350001",
156
+ VoiceOnly = "192350002"
157
+ }
158
+ export declare enum LiveWorkItemState {
159
+ Active = "Active",
160
+ Closed = "Closed",
161
+ Open = "Open",
162
+ Waiting = "Waiting",
163
+ WrapUp = "WrapUp"
164
+ }
145
165
  export declare class TranscriptConstants {
146
166
  static readonly ChatTranscriptsBodyColor = "#F5F5F5";
147
167
  static readonly TranscriptMessageEmojiMessageType = "http://schema.skype.com/emoji";
@@ -6,9 +6,9 @@ export interface IContextDataStore {
6
6
  /**
7
7
  * setData: Set data to data store
8
8
  */
9
- setData: (key: string, value: string) => void;
9
+ setData: (key: string, value: any, type: string) => void;
10
10
  /**
11
11
  * removeData: Remove data from data store by key
12
12
  */
13
- removeData?: (key: string) => void;
13
+ removeData: (key: string, type: string) => void;
14
14
  }
@@ -0,0 +1,4 @@
1
+ export declare class defaultCacheManager {
2
+ static InternalCache: any;
3
+ }
4
+ export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string) => void;
@@ -0,0 +1,2 @@
1
+ import { IContextDataStore } from "../../interfaces/IContextDataStore";
2
+ export declare const defaultClientDataStoreProvider: () => IContextDataStore;
@@ -0,0 +1,6 @@
1
+ export declare const defaultInitializeInMemoryDataStore: (widgetId: string) => void;
2
+ export declare const inMemoryDataStore: () => {
3
+ getData: (key: string) => any;
4
+ setData: (key: any, data: any) => void;
5
+ removeData: (key: string) => void;
6
+ };