@microsoft/omnichannel-chat-widget 0.1.0-main.cde77ea → 0.1.0-main.ce5063d

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 (300) hide show
  1. package/lib/cjs/assets/Icons.js +4 -2
  2. package/lib/cjs/common/Constants.js +18 -167
  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 +30 -23
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +16 -57
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +0 -31
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +0 -2
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +30 -36
  13. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +0 -9
  14. package/lib/cjs/common/utils.js +34 -108
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +8 -46
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +2 -24
  17. package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  18. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -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 +7 -45
  25. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  26. package/lib/cjs/components/headerstateful/HeaderStateful.js +17 -31
  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 +0 -5
  30. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
  31. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +11 -19
  32. package/lib/cjs/components/livechatwidget/common/Deferred.js +35 -0
  33. package/lib/cjs/components/livechatwidget/common/authHelper.js +50 -0
  34. package/lib/cjs/components/livechatwidget/common/createAdapter.js +5 -12
  35. package/lib/cjs/components/livechatwidget/common/createFooter.js +4 -23
  36. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -10
  37. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +16 -24
  38. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
  39. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +64 -43
  40. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  41. package/lib/cjs/components/livechatwidget/common/endChat.js +53 -38
  42. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  43. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  44. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  45. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +20 -54
  46. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +78 -128
  47. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
  48. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -11
  49. package/lib/cjs/components/livechatwidget/common/shareObservable.js +4 -8
  50. package/lib/cjs/components/livechatwidget/common/startChat.js +173 -112
  51. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  52. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  53. package/lib/cjs/components/livechatwidget/interfaces/{IAuthProps.js → IScrollBarProps.js} +0 -0
  54. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +257 -230
  55. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +19 -19
  56. package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
  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 +10 -38
  65. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +2 -32
  66. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -24
  67. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +29 -34
  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 +2 -17
  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/webchatcontroller/BotMagicCodeStore.js +0 -4
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -41
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -13
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -16
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +2 -30
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -19
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  117. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  118. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
  119. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  120. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  121. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  122. package/lib/cjs/contexts/common/ConversationState.js +0 -1
  123. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +30 -28
  124. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +12 -12
  125. package/lib/cjs/contexts/createReducer.js +159 -105
  126. package/lib/cjs/controller/componentController.js +2 -31
  127. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  128. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  129. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  130. package/lib/cjs/index.js +0 -5
  131. package/lib/cjs/plugins/newMessageEventHandler.js +15 -36
  132. package/lib/esm/assets/Icons.js +2 -1
  133. package/lib/esm/common/Constants.js +15 -154
  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 +34 -20
  140. package/lib/esm/common/telemetry/TelemetryHelper.js +16 -45
  141. package/lib/esm/common/telemetry/TelemetryManager.js +0 -18
  142. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +28 -24
  143. package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
  144. package/lib/esm/common/utils.js +31 -57
  145. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +8 -17
  146. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +2 -7
  147. package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
  148. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +10 -13
  149. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
  150. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  151. package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
  152. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -35
  153. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  154. package/lib/esm/components/headerstateful/HeaderStateful.js +17 -16
  155. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  156. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
  157. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +0 -3
  158. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
  159. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +11 -15
  160. package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
  161. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  162. package/lib/esm/components/livechatwidget/common/createAdapter.js +7 -6
  163. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  164. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  165. package/lib/esm/components/livechatwidget/common/createMarkdown.js +18 -18
  166. package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
  167. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -30
  168. package/lib/esm/components/livechatwidget/common/endChat.js +55 -23
  169. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  170. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  171. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  172. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +22 -19
  173. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +76 -109
  174. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
  175. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -3
  176. package/lib/esm/components/livechatwidget/common/shareObservable.js +4 -7
  177. package/lib/esm/components/livechatwidget/common/startChat.js +173 -89
  178. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  179. package/lib/esm/components/livechatwidget/interfaces/{IAuthProps.js → IScrollBarProps.js} +0 -0
  180. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +261 -169
  181. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +19 -7
  182. package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
  183. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  184. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  185. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  186. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  187. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  188. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  189. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  190. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -22
  191. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +4 -8
  192. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +6 -6
  193. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +27 -9
  194. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  195. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  196. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  197. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  198. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -13
  199. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  200. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  201. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  202. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  203. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +0 -2
  204. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +17 -26
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +2 -9
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -14
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +4 -28
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +17 -14
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  240. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  241. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  242. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  243. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  244. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
  245. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  246. package/lib/esm/contexts/ChatContextStore.js +2 -1
  247. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  248. package/lib/esm/contexts/common/ConversationState.js +0 -1
  249. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +30 -28
  250. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +12 -8
  251. package/lib/esm/contexts/createReducer.js +159 -102
  252. package/lib/esm/controller/componentController.js +3 -2
  253. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  254. package/lib/esm/hooks/useChatContextStore.js +0 -4
  255. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  256. package/lib/esm/plugins/newMessageEventHandler.js +15 -26
  257. package/lib/types/assets/Icons.d.ts +1 -0
  258. package/lib/types/common/Constants.d.ts +13 -0
  259. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  260. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  261. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  262. package/lib/types/common/telemetry/TelemetryConstants.d.ts +18 -5
  263. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -1
  264. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -4
  265. package/lib/types/common/utils.d.ts +5 -4
  266. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
  267. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  268. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  269. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  270. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  271. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  272. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
  273. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  274. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -8
  275. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  276. package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
  277. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
  278. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -1
  279. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -4
  280. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
  281. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
  282. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  283. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  284. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  285. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
  286. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  287. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  288. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  289. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  290. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
  291. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  292. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
  293. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  294. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  295. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  296. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +4 -2
  297. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +30 -27
  298. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  299. package/package.json +5 -4
  300. package/lib/types/components/livechatwidget/interfaces/IAuthProps.d.ts +0 -4
@@ -3,16 +3,17 @@
3
3
  *
4
4
  * Ensures that links within messages are processed so that the caller website cannot be traced.
5
5
  ******/
6
+
6
7
  import { Constants, HtmlAttributeNames } from "../../../../../common/Constants";
7
8
  import DOMPurify from "dompurify";
8
9
  import { WebChatActionType } from "../../enums/WebChatActionType";
9
10
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
10
- import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
11
12
 
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
14
  const convertTextToHtmlNode = text => {
13
15
  if (!text) return "";
14
16
  const element = document.createElement(HtmlAttributeNames.div);
15
-
16
17
  try {
17
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  text = DOMPurify.sanitize(text);
@@ -27,56 +28,50 @@ const convertTextToHtmlNode = text => {
27
28
  }
28
29
  });
29
30
  }
30
-
31
31
  return element;
32
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
-
32
+ };
34
33
 
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
35
  const processHTMLText = (action, text) => {
36
36
  const htmlNode = convertTextToHtmlNode(text);
37
37
  const aNodes = htmlNode.getElementsByTagName(HtmlAttributeNames.aTagName);
38
-
39
38
  if ((aNodes === null || aNodes === void 0 ? void 0 : aNodes.length) > 0) {
40
39
  try {
41
40
  for (let index = 0; index < aNodes.length; index++) {
42
41
  var _aNode$tagName;
43
-
44
- const aNode = aNodes[index]; // Skip if the node is not valid or the node's tag name is not equal to 'a', or the node href is empty.
45
-
42
+ const aNode = aNodes[index];
43
+ // Skip if the node is not valid or the node's tag name is not equal to 'a', or the node href is empty.
46
44
  if (((_aNode$tagName = aNode.tagName) === null || _aNode$tagName === void 0 ? void 0 : _aNode$tagName.toLowerCase()) !== HtmlAttributeNames.aTagName || !aNode.href) {
47
45
  continue;
48
- } // Add target to 'a' node if target is missing or does not equal to blank
49
-
46
+ }
50
47
 
48
+ // Add target to 'a' node if target is missing or does not equal to blank
51
49
  if (!aNode.target || aNode.target !== Constants.blank) {
52
50
  aNode.target = Constants.blank;
53
- } // If rel is missing or rel does not include noopener and noreferrer, add them
54
-
51
+ }
55
52
 
53
+ // If rel is missing or rel does not include noopener and noreferrer, add them
56
54
  if (!aNode.rel) {
57
55
  aNode.rel = `${HtmlAttributeNames.noopenerTag} ${HtmlAttributeNames.noreferrerTag}`;
58
56
  } else {
59
57
  if (aNode.rel.indexOf(HtmlAttributeNames.noopenerTag) === -1) {
60
58
  aNode.rel += ` ${HtmlAttributeNames.noopenerTag}`;
61
59
  }
62
-
63
60
  if (aNode.rel.indexOf(HtmlAttributeNames.noreferrerTag) === -1) {
64
61
  aNode.rel += ` ${HtmlAttributeNames.noreferrerTag}`;
65
62
  }
66
63
  }
67
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
-
64
+ }
69
65
 
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
67
  action = window.simpleUpdateIn(action, [Constants.payload, Constants.activity, Constants.text], () => htmlNode.innerHTML);
71
68
  } catch (e) {
72
69
  let errorMessage = "Failed to apply action: ";
73
-
74
70
  try {
75
71
  errorMessage += JSON.stringify(action);
76
72
  } catch (e) {
77
73
  errorMessage += " (unable to stringify action)";
78
74
  }
79
-
80
75
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
81
76
  Event: TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
82
77
  ExceptionDetails: {
@@ -86,11 +81,10 @@ const processHTMLText = (action, text) => {
86
81
  });
87
82
  }
88
83
  }
89
-
90
84
  return action;
91
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
92
-
85
+ };
93
86
 
87
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
94
88
  const htmlTextMiddleware = _ref => {
95
89
  let {
96
90
  dispatch
@@ -99,21 +93,17 @@ const htmlTextMiddleware = _ref => {
99
93
  if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
100
94
  try {
101
95
  var _action$payload, _action$payload$activ;
102
-
103
96
  const text = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.text;
104
-
105
97
  if (text) {
106
98
  action = processHTMLText(action, text);
107
99
  }
108
100
  } catch (e) {
109
101
  let errorMessage = "Failed to validate action.";
110
-
111
102
  try {
112
103
  errorMessage += JSON.stringify(action);
113
104
  } catch (e) {
114
105
  errorMessage += " (unable to stringify action)";
115
106
  }
116
-
117
107
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
118
108
  Event: TelemetryEvent.ProcessingHTMLTextMiddlewareFailed,
119
109
  ExceptionDetails: {
@@ -123,9 +113,7 @@ const htmlTextMiddleware = _ref => {
123
113
  });
124
114
  }
125
115
  }
126
-
127
116
  return next(action);
128
117
  };
129
118
  };
130
-
131
119
  export default htmlTextMiddleware;
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * Enforces a max character limit that the sender can send to comply to Omnichannel chat services' limitation.
5
5
  ******/
6
+
6
7
  import { NotificationHandler } from "../../notification/NotificationHandler";
7
8
  import { NotificationScenarios } from "../../enums/NotificationScenarios";
8
9
  import { WebChatActionType } from "../../enums/WebChatActionType";
9
- import { WebChatMiddlewareConstants } from "../../../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
10
+ import { WebChatMiddlewareConstants } from "../../../../../common/Constants";
10
11
 
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
11
13
  const createMaxMessageSizeValidator = localizedTexts => _ref => {
12
14
  let {
13
15
  dispatch
@@ -15,9 +17,7 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
15
17
  return next => action => {
16
18
  if (action.type === WebChatActionType.WEB_CHAT_SET_SEND_BOX) {
17
19
  var _action$payload, _action$payload$text;
18
-
19
20
  const textLength = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$text = _action$payload.text) === null || _action$payload$text === void 0 ? void 0 : _action$payload$text.length) || 0;
20
-
21
21
  if (textLength > WebChatMiddlewareConstants.maxTextLength) {
22
22
  NotificationHandler.notifyError(NotificationScenarios.MaxSizeError, localizedTexts.MIDDLEWARE_MAX_CHARACTER_COUNT_EXCEEDED);
23
23
  return next(action);
@@ -25,9 +25,7 @@ const createMaxMessageSizeValidator = localizedTexts => _ref => {
25
25
  NotificationHandler.dismissNotification(NotificationScenarios.MaxSizeError);
26
26
  }
27
27
  }
28
-
29
28
  return next(action);
30
29
  };
31
30
  };
32
-
33
31
  export default createMaxMessageSizeValidator;
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * Adds necessary fields for the activity for the other middlewares to function as expected.
5
5
  ******/
6
+
6
7
  import { Constants } from "../../../../../common/Constants";
7
- import { WebChatActionType } from "../../enums/WebChatActionType"; // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
8
+ import { WebChatActionType } from "../../enums/WebChatActionType";
8
9
 
10
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
9
11
  const preProcessingMiddleware = _ref => {
10
12
  let {
11
13
  dispatch
@@ -15,30 +17,28 @@ const preProcessingMiddleware = _ref => {
15
17
  const {
16
18
  activity
17
19
  } = action.payload;
18
-
19
20
  if (!activity.from || activity.from.role === Constants.userMessageTag) {
20
- action = { ...action,
21
- payload: { ...action.payload,
22
- activity: { ...action.payload.activity,
21
+ action = {
22
+ ...action,
23
+ payload: {
24
+ ...action.payload,
25
+ activity: {
26
+ ...action.payload.activity,
23
27
  textFormat: Constants.markdown
24
28
  }
25
29
  }
26
30
  };
27
31
  }
28
32
  }
29
-
30
33
  if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
31
34
  const {
32
35
  activity
33
36
  } = action.payload;
34
-
35
37
  if (activity) {
36
38
  action.payload.activity[Constants.actionType] = WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY;
37
39
  }
38
40
  }
39
-
40
41
  return next(action);
41
42
  };
42
43
  };
43
-
44
44
  export default preProcessingMiddleware;
@@ -3,11 +3,13 @@
3
3
  *
4
4
  * Sanitizes the text.
5
5
  ******/
6
+
6
7
  import DOMPurify from "dompurify";
7
8
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
8
9
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
9
- import { WebChatActionType } from "../../enums/WebChatActionType"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
10
+ import { WebChatActionType } from "../../enums/WebChatActionType";
10
11
 
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
11
13
  const sanitizationMiddleware = _ref => {
12
14
  let {
13
15
  dispatch
@@ -16,26 +18,24 @@ const sanitizationMiddleware = _ref => {
16
18
  if (action.type === WebChatActionType.WEB_CHAT_SEND_MESSAGE) {
17
19
  try {
18
20
  var _action$payload;
19
-
20
21
  let text = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.text;
21
-
22
22
  if (text) {
23
23
  text = DOMPurify.sanitize(text) ?? " ";
24
24
  }
25
25
  } catch (e) {
26
- const copyDataForTelemetry = { ...action,
27
- payload: { ...action.payload,
26
+ const copyDataForTelemetry = {
27
+ ...action,
28
+ payload: {
29
+ ...action.payload,
28
30
  text: undefined
29
31
  }
30
32
  };
31
33
  let errorMessage = "Failed to apply action: ";
32
-
33
34
  try {
34
35
  errorMessage += JSON.stringify(copyDataForTelemetry);
35
36
  } catch (e) {
36
37
  errorMessage += " (unable to stringify action)";
37
38
  }
38
-
39
39
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
40
40
  Event: TelemetryEvent.ProcessingSanitizationMiddlewareFailed,
41
41
  ExceptionDetails: {
@@ -45,9 +45,7 @@ const sanitizationMiddleware = _ref => {
45
45
  });
46
46
  }
47
47
  }
48
-
49
48
  return next(action);
50
49
  };
51
50
  };
52
-
53
51
  export default sanitizationMiddleware;
@@ -17,7 +17,6 @@ export class NotificationHandler {
17
17
  NotificationHandler.setFocusOnNotificationCloseButton();
18
18
  }
19
19
  }
20
-
21
20
  static dismissNotification(id) {
22
21
  if (WebChatStoreLoader.store) {
23
22
  WebChatStoreLoader.store.dispatch({
@@ -28,23 +27,18 @@ export class NotificationHandler {
28
27
  });
29
28
  }
30
29
  }
31
-
32
30
  static notifyError(id, message) {
33
31
  this.notify(id, NotificationLevel.Error, message);
34
32
  }
35
-
36
33
  static notifyWarning(id, message) {
37
34
  this.notify(id, NotificationLevel.Warning, message);
38
35
  }
39
-
40
36
  static notifyInfo(id, message) {
41
37
  this.notify(id, NotificationLevel.Info, message);
42
38
  }
43
-
44
39
  static notifySuccess(id, message) {
45
40
  this.notify(id, NotificationLevel.Success, message);
46
41
  }
47
-
48
42
  static notifyWithLevel(id, message, level) {
49
43
  if (!level) {
50
44
  this.notifyInfo(id, message);
@@ -52,30 +46,24 @@ export class NotificationHandler {
52
46
  this.notify(id, level, message);
53
47
  }
54
48
  }
55
- /* Bypass WebChat behavior and focus on banner close button */
56
-
57
49
 
50
+ /* Bypass WebChat behavior and focus on banner close button */
58
51
  static setFocusOnNotificationCloseButton() {
59
52
  const expandButton = document.querySelector(`#${HtmlIdNames.MSLiveChatWidget} .${HtmlClassNames.webChatBannerExpandButton}`);
60
-
61
53
  if (expandButton) {
62
54
  expandButton.focus();
63
55
  return;
64
56
  }
65
-
66
57
  const closeButton = document.querySelector(`#${HtmlIdNames.MSLiveChatWidget} .${HtmlClassNames.webChatBannerCloseButton}`);
67
-
68
58
  if (closeButton) {
69
59
  closeButton.focus();
70
60
  NotificationHandler.registerOnCloseEvent(closeButton);
71
61
  return;
72
62
  }
73
63
  }
74
-
75
64
  static registerOnCloseEvent(button) {
76
65
  button.onclick = () => {
77
66
  setFocusOnSendBox();
78
67
  };
79
68
  }
80
-
81
69
  }
@@ -7,26 +7,21 @@ export function createWebChatTelemetry() {
7
7
  level
8
8
  } = event;
9
9
  const loglevel = level ? level.toUpperCase() : "";
10
-
11
10
  switch (loglevel) {
12
11
  case LogLevel.DEBUG:
13
12
  TelemetryHelper.logWebChatEvent(LogLevel.DEBUG, event);
14
13
  break;
15
-
16
14
  case LogLevel.WARN:
17
15
  TelemetryHelper.logWebChatEvent(LogLevel.WARN, event);
18
16
  break;
19
-
20
17
  case LogLevel.ERROR:
21
18
  TelemetryHelper.logWebChatEvent(LogLevel.ERROR, event);
22
19
  break;
23
-
24
20
  case LogLevel.INFO:
25
21
  default:
26
22
  TelemetryHelper.logWebChatEvent(LogLevel.INFO, event);
27
23
  break;
28
24
  }
29
25
  };
30
-
31
26
  return handleTelemetry;
32
27
  }
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
3
4
  export const ChatAdapterStore = /*#__PURE__*/createContext([undefined, adapter => {}]);
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  export const ChatContextStore = /*#__PURE__*/createContext(undefined);
@@ -1,3 +1,4 @@
1
- import { createContext } from "react"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
1
+ import { createContext } from "react";
2
2
 
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
4
  export const ChatSDKStore = /*#__PURE__*/createContext(undefined);
@@ -1,5 +1,4 @@
1
1
  export let ConversationState;
2
-
3
2
  (function (ConversationState) {
4
3
  ConversationState[ConversationState["Prechat"] = 0] = "Prechat";
5
4
  ConversationState[ConversationState["Loading"] = 1] = "Loading";
@@ -1,5 +1,4 @@
1
1
  export let LiveChatWidgetActionType;
2
-
3
2
  (function (LiveChatWidgetActionType) {
4
3
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
5
4
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
@@ -7,31 +6,34 @@ export let LiveChatWidgetActionType;
7
6
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 3] = "SET_GLOBAL_DIR";
8
7
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
9
8
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
10
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
11
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
12
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
13
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
14
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
15
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
16
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
17
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 19] = "DISABLE_LOCAL_VIDEO";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 20] = "DISABLE_REMOTE_VIDEO";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 21] = "SET_CHAT_TOKEN";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SKIP_CHAT_BUTTON_RENDERING"] = 22] = "SET_SKIP_CHAT_BUTTON_RENDERING";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 23] = "SET_PROACTIVE_CHAT_PARAMS";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 31] = "SET_BOT_OAUTH_SIGNIN_ID";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 32] = "SET_WIDGET_SIZE";
9
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
10
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
11
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 8] = "SET_OUTSIDE_OPERATING_HOURS";
12
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 9] = "SET_PRE_CHAT_SURVEY_RESPONSE";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 10] = "SET_CUSTOM_CONTEXT";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 11] = "SET_SHOW_CONFIRMATION";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 12] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 13] = "SET_PRECHAT_RESPONSE_EMAIL";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 14] = "SET_AUDIO_NOTIFICATION";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 15] = "SET_E2VV_ENABLED";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 16] = "SET_POST_CHAT_CONTEXT";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 17] = "SHOW_CALLING_CONTAINER";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 18] = "SET_INCOMING_CALL";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 19] = "DISABLE_VIDEO_CALL";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 20] = "DISABLE_LOCAL_VIDEO";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 21] = "DISABLE_REMOTE_VIDEO";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 22] = "SET_CHAT_TOKEN";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 23] = "SET_START_CHAT_BUTTON_DISPLAY";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 24] = "SET_PROACTIVE_CHAT_PARAMS";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 25] = "SET_TELEMETRY_DATA";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 26] = "SET_RECONNECT_ID";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 27] = "SET_UNREAD_MESSAGE_COUNT";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 28] = "SET_FOCUS_CHAT_BUTTON";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 29] = "SET_CONVERSATION_ENDED_BY_AGENT";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 30] = "SET_WIDGET_STATE";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 31] = "SET_LIVE_CHAT_CONTEXT";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 32] = "SET_BOT_OAUTH_SIGNIN_ID";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 33] = "SET_WIDGET_SIZE";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 34] = "SET_WIDGET_INSTANCE_ID";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 35] = "SET_LIVE_CHAT_CONFIG";
37
39
  })(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
@@ -1,12 +1,14 @@
1
1
  import { ConversationState } from "./ConversationState";
2
2
  import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
3
+ import { getWidgetCacheId, isNullOrUndefined } from "../../common/utils";
4
+ import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
3
5
  export const getLiveChatWidgetContextInitialState = props => {
4
- var _props$webChatContain;
5
-
6
- if (props !== null && props !== void 0 && props.liveChatContextFromCache) {
7
- return props === null || props === void 0 ? void 0 : props.liveChatContextFromCache;
6
+ var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$webChatContain;
7
+ const widgetCacheId = getWidgetCacheId(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
8
+ const initialState = defaultClientDataStoreProvider().getData(widgetCacheId, "localStorage");
9
+ if (!isNullOrUndefined(initialState)) {
10
+ return JSON.parse(initialState);
8
11
  }
9
-
10
12
  const LiveChatWidgetContextInitialState = {
11
13
  domainStates: {
12
14
  liveChatConfig: props.chatConfig,
@@ -20,17 +22,19 @@ export const getLiveChatWidgetContextInitialState = props => {
20
22
  globalDir: "ltr",
21
23
  liveChatContext: undefined,
22
24
  customContext: undefined,
23
- widgetSize: undefined
25
+ widgetSize: undefined,
26
+ widgetInstanceId: ""
24
27
  },
25
28
  appStates: {
26
29
  conversationState: ConversationState.Closed,
27
30
  isMinimized: false,
28
- previousElementOnFocusBeforeModalOpen: null,
31
+ previousElementIdOnFocusBeforeModalOpen: null,
32
+ isStartChatFailing: false,
29
33
  outsideOperatingHours: false,
30
34
  preChatResponseEmail: "",
31
35
  isAudioMuted: null,
32
36
  newMessage: false,
33
- skipChatButtonRendering: false,
37
+ hideStartChatButton: false,
34
38
  reconnectId: undefined,
35
39
  proactiveChatStates: {
36
40
  proactiveChatBodyTitle: "",