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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/README.md +32 -0
  2. package/lib/cjs/common/Constants.js +8 -159
  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 +36 -22
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +14 -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 +65 -93
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +6 -44
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +10 -24
  17. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -32
  18. package/lib/cjs/components/dimlayer/DimLayer.js +0 -4
  19. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -36
  20. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -8
  21. package/lib/cjs/components/footerstateful/FooterStateful.js +11 -42
  22. package/lib/cjs/components/footerstateful/audionotificationstateful/AudioNotificationStateful.js +0 -6
  23. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -43
  24. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -8
  25. package/lib/cjs/components/headerstateful/HeaderStateful.js +16 -30
  26. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -14
  27. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +37 -0
  28. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +18 -0
  29. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  30. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +32 -0
  31. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +62 -0
  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 +10 -9
  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 +36 -43
  38. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +67 -38
  39. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +0 -3
  40. package/lib/cjs/components/livechatwidget/common/endChat.js +53 -46
  41. package/lib/cjs/components/livechatwidget/common/getGeneralStylesForButton.js +0 -6
  42. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +7 -16
  43. package/lib/cjs/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -8
  44. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +32 -53
  45. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +68 -82
  46. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +4 -17
  47. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -15
  48. package/lib/cjs/components/livechatwidget/common/shareObservable.js +41 -0
  49. package/lib/cjs/components/livechatwidget/common/startChat.js +145 -117
  50. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +0 -8
  51. package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -11
  52. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +243 -185
  53. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +4 -17
  54. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +4 -17
  55. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -17
  56. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -23
  57. package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  58. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +13 -0
  59. package/lib/cjs/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  60. package/lib/cjs/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  61. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +10 -42
  62. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +3 -33
  63. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -24
  64. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -19
  65. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -7
  66. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -6
  67. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  68. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +9 -26
  69. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -16
  70. package/lib/cjs/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -24
  71. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -15
  72. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -8
  73. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  74. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  75. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +10 -0
  76. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -4
  77. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  78. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  79. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  80. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  81. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  82. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  83. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  84. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  85. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +0 -7
  86. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -5
  87. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -37
  88. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +9 -19
  89. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -60
  90. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +7 -15
  91. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  92. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +82 -0
  93. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +10 -0
  94. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +10 -0
  95. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -3
  96. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -3
  97. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +10 -0
  98. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -9
  99. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +89 -0
  100. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -12
  101. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +6 -28
  102. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  103. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +13 -30
  104. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +3 -9
  105. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -34
  106. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -10
  107. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +1 -12
  108. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +5 -18
  109. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +1 -9
  110. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -9
  111. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +13 -34
  112. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +1 -10
  113. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +7 -11
  114. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +5 -14
  115. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -21
  116. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -12
  117. package/lib/cjs/contexts/ChatAdapterStore.js +0 -2
  118. package/lib/cjs/contexts/ChatContextStore.js +0 -2
  119. package/lib/cjs/contexts/ChatSDKStore.js +0 -2
  120. package/lib/cjs/contexts/common/ConversationState.js +3 -3
  121. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +4 -2
  122. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +11 -12
  123. package/lib/cjs/contexts/createReducer.js +145 -100
  124. package/lib/cjs/controller/componentController.js +4 -33
  125. package/lib/cjs/hooks/useChatAdapterStore.js +0 -6
  126. package/lib/cjs/hooks/useChatContextStore.js +0 -6
  127. package/lib/cjs/hooks/useChatSDKStore.js +0 -6
  128. package/lib/cjs/index.js +0 -5
  129. package/lib/cjs/plugins/newMessageEventHandler.js +15 -36
  130. package/lib/esm/common/Constants.js +8 -147
  131. package/lib/esm/common/KeyCodes.js +0 -2
  132. package/lib/esm/common/contextDataStore/DataStoreManager.js +0 -2
  133. package/lib/esm/common/storage/default/defaultCacheManager.js +16 -0
  134. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +95 -0
  135. package/lib/esm/common/storage/default/defaultInMemoryDataStore.js +70 -0
  136. package/lib/esm/common/telemetry/TelemetryConstants.js +40 -19
  137. package/lib/esm/common/telemetry/TelemetryHelper.js +14 -45
  138. package/lib/esm/common/telemetry/TelemetryManager.js +0 -18
  139. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +28 -24
  140. package/lib/esm/common/telemetry/loggers/consoleLogger.js +0 -5
  141. package/lib/esm/common/utils.js +60 -50
  142. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +6 -15
  143. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +12 -10
  144. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +9 -13
  145. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +8 -15
  146. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +6 -6
  147. package/lib/esm/components/footerstateful/FooterStateful.js +13 -23
  148. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +14 -36
  149. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +6 -6
  150. package/lib/esm/components/headerstateful/HeaderStateful.js +16 -15
  151. package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -2
  152. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +30 -0
  153. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +11 -0
  154. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  155. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +25 -0
  156. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +55 -0
  157. package/lib/esm/components/livechatwidget/common/Deferred.js +28 -0
  158. package/lib/esm/components/livechatwidget/common/authHelper.js +42 -0
  159. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -4
  160. package/lib/esm/components/livechatwidget/common/createFooter.js +4 -16
  161. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +10 -5
  162. package/lib/esm/components/livechatwidget/common/createMarkdown.js +38 -37
  163. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +69 -25
  164. package/lib/esm/components/livechatwidget/common/endChat.js +55 -30
  165. package/lib/esm/components/livechatwidget/common/getGeneralStylesForButton.js +0 -2
  166. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +9 -11
  167. package/lib/esm/components/livechatwidget/common/initConfirmationPropsComposer.js +4 -5
  168. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +35 -22
  169. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +71 -68
  170. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +4 -9
  171. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -7
  172. package/lib/esm/components/livechatwidget/common/shareObservable.js +35 -0
  173. package/lib/esm/components/livechatwidget/common/startChat.js +147 -96
  174. package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +4 -2
  175. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +247 -128
  176. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +4 -5
  177. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +4 -5
  178. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +4 -5
  179. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +32 -11
  180. package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -1
  181. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +6 -0
  182. package/lib/esm/components/postchatsurveypanestateful/enums/PostChatSurveyMode.js +0 -1
  183. package/lib/esm/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.js +1 -0
  184. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -26
  185. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +5 -9
  186. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -6
  187. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +94 -4
  188. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  189. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  190. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  191. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +9 -18
  192. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -12
  193. package/lib/esm/components/webchatcontainerstateful/common/utils/BrowserInfo.js +2 -16
  194. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +3 -5
  195. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +5 -6
  196. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  197. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  198. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -0
  199. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +0 -2
  200. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.js +0 -1
  201. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.js +0 -1
  202. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.js +0 -1
  203. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.js +0 -1
  204. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.js +0 -1
  205. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +0 -1
  206. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.js +0 -1
  207. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +0 -1
  208. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.js +2 -5
  209. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.js +0 -4
  210. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +27 -22
  211. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +11 -11
  212. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +23 -38
  213. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.js +9 -8
  214. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +34 -0
  215. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +80 -0
  216. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.js +3 -0
  217. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +3 -0
  218. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.js +2 -1
  219. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +2 -1
  220. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +3 -0
  221. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.js +3 -7
  222. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +83 -0
  223. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +3 -3
  224. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +7 -14
  225. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +3 -3
  226. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +15 -19
  227. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +5 -8
  228. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +6 -29
  229. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +3 -7
  230. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +3 -8
  231. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +5 -13
  232. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.js +3 -7
  233. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.js +3 -7
  234. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +15 -27
  235. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.js +3 -5
  236. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.js +9 -9
  237. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.js +7 -9
  238. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +1 -13
  239. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +0 -5
  240. package/lib/esm/contexts/ChatAdapterStore.js +2 -1
  241. package/lib/esm/contexts/ChatContextStore.js +2 -1
  242. package/lib/esm/contexts/ChatSDKStore.js +2 -1
  243. package/lib/esm/contexts/common/ConversationState.js +3 -3
  244. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +4 -2
  245. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +11 -8
  246. package/lib/esm/contexts/createReducer.js +145 -97
  247. package/lib/esm/controller/componentController.js +5 -4
  248. package/lib/esm/hooks/useChatAdapterStore.js +0 -4
  249. package/lib/esm/hooks/useChatContextStore.js +0 -4
  250. package/lib/esm/hooks/useChatSDKStore.js +0 -4
  251. package/lib/esm/plugins/newMessageEventHandler.js +15 -26
  252. package/lib/types/common/Constants.d.ts +8 -0
  253. package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
  254. package/lib/types/common/storage/default/defaultCacheManager.d.ts +4 -0
  255. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -0
  256. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -0
  257. package/lib/types/common/telemetry/TelemetryConstants.d.ts +25 -6
  258. package/lib/types/common/utils.d.ts +7 -3
  259. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  260. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  261. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  262. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  263. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  264. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  265. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  266. package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
  267. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -4
  268. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  269. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  270. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  271. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -2
  272. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -2
  273. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -0
  274. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +4 -0
  275. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
  276. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  277. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  278. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  279. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  280. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +4 -1
  281. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  282. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  283. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  284. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  285. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  286. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +2 -0
  287. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -0
  288. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -0
  289. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  290. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  291. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -2
  292. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +5 -2
  293. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +1 -2
  294. package/package.json +5 -4
@@ -1,24 +1,23 @@
1
1
  import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
2
+ import { DataStoreManager } from "./contextDataStore/DataStoreManager";
2
3
  import { KeyCodes } from "./KeyCodes";
3
4
  import { BroadcastEvent } from "./telemetry/TelemetryConstants";
4
-
5
+ import { Md5 } from "md5-typescript";
5
6
  const getElementBySelector = selector => {
6
7
  let element;
7
-
8
8
  if (typeof selector === "string") {
9
9
  element = document.querySelector(selector);
10
10
  } else {
11
11
  element = selector;
12
12
  }
13
-
14
13
  return element;
15
- }; // The purpose of this function is:
14
+ };
15
+
16
+ // The purpose of this function is:
16
17
  // - to make elements not focusable, when confirmation pane or email transcript pane are showing,
17
18
  // - to set their initial tab indices back after confirmation pane or email transcript pane are closed
18
19
  // Otherwise, the user will be able to click on the screen and tab through different buttons or other elements, even though
19
20
  // these dialogs are showing
20
-
21
-
22
21
  export const setTabIndices = (elements, tabIndexMap, shouldBeFocusable) => {
23
22
  if (elements) {
24
23
  if (shouldBeFocusable) {
@@ -27,7 +26,6 @@ export const setTabIndices = (elements, tabIndexMap, shouldBeFocusable) => {
27
26
  elements[index].tabIndex = tabIndexMap.get(elements[index].id);
28
27
  }
29
28
  }
30
-
31
29
  tabIndexMap.clear();
32
30
  } else {
33
31
  for (let index = 0; index < elements.length; index++) {
@@ -39,64 +37,49 @@ export const setTabIndices = (elements, tabIndexMap, shouldBeFocusable) => {
39
37
  };
40
38
  export const findParentFocusableElementsWithoutChildContainer = elementId => {
41
39
  const childContainer = document.getElementById(elementId);
42
-
43
40
  if (!childContainer) {
44
41
  return null;
45
42
  }
46
-
47
43
  const parentContainer = childContainer.parentElement;
48
-
49
44
  if (!parentContainer) {
50
45
  return null;
51
46
  }
52
-
53
47
  const parentFocusableElements = findAllFocusableElement(parentContainer);
54
-
55
48
  if (!parentFocusableElements) {
56
49
  return null;
57
50
  }
58
-
59
51
  for (let index = 0; index < parentFocusableElements.length; index++) {
60
52
  if (childContainer.contains(parentFocusableElements[index])) {
61
53
  parentFocusableElements.splice(index, 1);
62
54
  index--;
63
55
  }
64
56
  }
65
-
66
57
  return parentFocusableElements;
67
58
  };
68
59
  export const findAllFocusableElement = parent => {
69
60
  const container = getElementBySelector(parent);
70
-
71
61
  if (container !== null) {
72
62
  return Array.prototype.slice.call(container.querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]"));
73
63
  }
74
-
75
64
  return null;
76
65
  };
77
66
  export const preventFocusToMoveOutOfElement = elementId => {
78
67
  const container = document.getElementById(elementId);
79
-
80
68
  if (!container) {
81
69
  return;
82
70
  }
83
-
84
71
  const focusableElements = findAllFocusableElement(container);
85
-
86
72
  if (!focusableElements) {
87
73
  return;
88
74
  }
89
-
90
75
  const firstFocusableElement = focusableElements[0];
91
76
  const lastFocusableElement = focusableElements[focusableElements.length - 1];
92
-
93
77
  firstFocusableElement.onkeydown = e => {
94
78
  if (e.shiftKey && e.key === KeyCodes.TAB) {
95
79
  e.preventDefault();
96
80
  lastFocusableElement === null || lastFocusableElement === void 0 ? void 0 : lastFocusableElement.focus();
97
81
  }
98
82
  };
99
-
100
83
  lastFocusableElement.onkeydown = e => {
101
84
  if (!e.shiftKey && e.key === KeyCodes.TAB) {
102
85
  e.preventDefault();
@@ -127,14 +110,12 @@ export const escapeHtml = inputString => {
127
110
  export const getIconText = text => {
128
111
  if (text) {
129
112
  const initials = text.split(/\s/).reduce((response, word) => response += word.slice(0, 1), "");
130
-
131
113
  if (initials.length > 1) {
132
114
  return initials.substring(0, 2).toUpperCase();
133
115
  } else {
134
116
  return text.substring(0, 2).toUpperCase();
135
117
  }
136
118
  }
137
-
138
119
  return "";
139
120
  };
140
121
  export const getLocaleDirection = localeLCID => {
@@ -150,20 +131,16 @@ export const getTimestampHourMinute = timestampStr => {
150
131
  const minuteFormat = "2-digit";
151
132
  const date = new Date(timestampStr);
152
133
  const now = new Date();
153
-
154
134
  if (isNaN(date.getTime())) {
155
135
  return "";
156
136
  }
157
-
158
137
  if (date.getFullYear() !== now.getFullYear()) {
159
138
  yearFormat = "numeric";
160
139
  monthDayFormat = "2-digit";
161
140
  }
162
-
163
141
  if (date.getMonth() !== now.getMonth() || date.getDate() !== now.getDate()) {
164
142
  monthDayFormat = "2-digit";
165
143
  }
166
-
167
144
  return date.toLocaleTimeString(navigator.language, {
168
145
  year: yearFormat,
169
146
  month: monthDayFormat,
@@ -177,7 +154,6 @@ export const parseAdaptiveCardPayload = (payload, requiredFieldMissingMessage) =
177
154
  try {
178
155
  const parsedPayload = JSON.parse(payload.replace(/&#42;/g, "*"));
179
156
  const body = parsedPayload.body;
180
-
181
157
  if (body) {
182
158
  //Parse ID field into available options and add required error messages
183
159
  for (const fields of body) {
@@ -185,23 +161,21 @@ export const parseAdaptiveCardPayload = (payload, requiredFieldMissingMessage) =
185
161
  const parsedId = JSON.parse(fields.id);
186
162
  fields.id = parsedId.Id;
187
163
  fields.isRequired = parsedId.IsRequired ?? false;
188
-
189
164
  if (fields.isRequired) {
190
165
  fields.errorMessage = requiredFieldMissingMessage.replace("{0}", parsedId.Name ?? "");
191
166
  }
192
167
  }
193
168
  }
194
169
  }
195
-
196
170
  return JSON.stringify(parsedPayload);
197
171
  } catch (ex) {
198
172
  throw new Error(`Adaptive card pase error: ${ex}`);
199
173
  }
200
174
  }
201
-
202
175
  return payload;
203
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
+ };
204
177
 
178
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
179
  export const extractPreChatSurveyResponseValues = (preChatSurvey, values) => {
206
180
  if (preChatSurvey && preChatSurvey !== "{}" && values) {
207
181
  try {
@@ -211,14 +185,13 @@ export const extractPreChatSurveyResponseValues = (preChatSurvey, values) => {
211
185
  "Type": Constants.InputSubmit
212
186
  };
213
187
  const computedValues = [];
214
-
215
188
  for (const val of values) {
216
189
  const index = val.index;
217
190
  const Id = body[index].id;
218
191
  computedValues[Id] = val.value;
219
192
  }
220
-
221
- const finalPayload = { ...type,
193
+ const finalPayload = {
194
+ ...type,
222
195
  ...computedValues
223
196
  };
224
197
  return finalPayload;
@@ -226,10 +199,10 @@ export const extractPreChatSurveyResponseValues = (preChatSurvey, values) => {
226
199
  throw new Error(`PreChatSurvey Response parse error: ${ex}`);
227
200
  }
228
201
  }
229
-
230
202
  return {};
231
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
203
+ };
232
204
 
205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
206
  export const isNullOrUndefined = obj => {
234
207
  return obj === null || obj === undefined;
235
208
  };
@@ -240,26 +213,21 @@ export const newGuid = () => {
240
213
  //RFC 4122 canonical representation Version-4 xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B
241
214
  const guidPattern = Constants.GuidPattern;
242
215
  let newGuid = "";
243
-
244
216
  for (let i = 0; i < guidPattern.length; i++) {
245
217
  const randomString = Math.floor(Math.random() * Date.now());
246
-
247
218
  switch (guidPattern[i]) {
248
219
  case "x":
249
220
  newGuid += randomString.toString(16).substring(0, 4);
250
221
  break;
251
222
  //get 4 digit
252
-
253
223
  case "m":
254
224
  newGuid += randomString.toString(16).substring(0, 3);
255
225
  break;
256
226
  //Get 3 digit
257
-
258
227
  case "y":
259
228
  newGuid += (randomString & 0x3 | 0x8).toString(16);
260
229
  break;
261
230
  // To get only one of 8, 9, A, or B
262
-
263
231
  default:
264
232
  newGuid += guidPattern[i];
265
233
  //Default "-" and "4"
@@ -275,23 +243,65 @@ export const createTimer = () => {
275
243
  const ms = new Date().getTime() - timeStart;
276
244
  return ms;
277
245
  }
278
-
279
246
  };
280
- }; // Returns the domain of the org
281
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
247
+ };
282
248
 
249
+ // Returns the domain of the org
250
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
283
251
  export const getDomain = hostValue => {
284
252
  for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
285
253
  if (hostValue.endsWith(AriaTelemetryConstants.lcwEUDomainNames[i])) {
286
254
  return AriaTelemetryConstants.EU;
287
255
  }
288
256
  }
289
-
290
257
  return AriaTelemetryConstants.Public;
291
258
  };
292
- export const getWidgetCacheId = (orgId, widgetId) => {
293
- return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
259
+ export const getWidgetCacheId = (orgId, widgetId, widgetInstanceId) => {
260
+ const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
261
+ return Md5.init(widgetCacheId);
294
262
  };
295
- export const getWidgetEndChatEventName = (orgId, widgetId) => {
263
+ export const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) => {
264
+ if (!isNullOrEmptyString(widgetInstanceId)) {
265
+ return `${BroadcastEvent.ChatEnded}_${widgetInstanceId}_${orgId}_${widgetId}`;
266
+ }
296
267
  return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
268
+ };
269
+
270
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
271
+ export const getStateFromCache = (orgId, widgetId, widgetInstanceId) => {
272
+ // Getting updated state from cache
273
+ try {
274
+ if (DataStoreManager.clientDataStore) {
275
+ var _DataStoreManager$cli;
276
+ const widgetStateEventName = getWidgetCacheId(orgId, widgetId, widgetInstanceId);
277
+ const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
278
+ const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
279
+ return persistedState;
280
+ } else {
281
+ return null;
282
+ }
283
+ } catch (error) {
284
+ console.log(error);
285
+ return null;
286
+ }
287
+ };
288
+
289
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
290
+ export const isUndefinedOrEmpty = object => {
291
+ if (object) {
292
+ if (Object.keys(object).length === 0) {
293
+ return true;
294
+ }
295
+ return false;
296
+ } else {
297
+ return true;
298
+ }
299
+ };
300
+
301
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
302
+ export const addDelayInMs = ms => {
303
+ return new Promise(resolve => setTimeout(resolve, ms));
304
+ };
305
+ export const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
306
+ return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
297
307
  };
@@ -7,17 +7,17 @@ import useChatContextStore from "../../hooks/useChatContextStore";
7
7
  import useChatSDKStore from "../../hooks/useChatSDKStore";
8
8
  export const CallingContainerStateful = props => {
9
9
  var _props$controlProps, _props$controlProps2, _props$controlProps2$, _props$controlProps3, _props$controlProps3$, _props$controlProps3$2, _props$controlProps4, _props$controlProps4$, _props$controlProps4$2, _props$controlProps5;
10
-
11
10
  //TODO : Close button confirmation implmentation is pending
12
- const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
11
 
14
- const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const [state, dispatch] = useChatContextStore();
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ const chatSDK = useChatSDKStore();
15
15
 
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
17
  const {
17
18
  voiceVideoCallingSdk
18
19
  } = props;
19
20
  let callId;
20
-
21
21
  const resetCallingStates = reset => {
22
22
  if (reset) {
23
23
  dispatch({
@@ -42,12 +42,10 @@ export const CallingContainerStateful = props => {
42
42
  });
43
43
  }
44
44
  };
45
-
46
45
  useEffect(() => {
47
46
  const init = async () => {
48
47
  try {
49
48
  var _controlProps$current, _controlProps$current2, _controlProps$current3, _controlProps$current4;
50
-
51
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
50
  TelemetryHelper.callId = callId;
53
51
  await voiceVideoCallingSdk.initialize({
@@ -65,7 +63,6 @@ export const CallingContainerStateful = props => {
65
63
  });
66
64
  }
67
65
  };
68
-
69
66
  init().then(() => {
70
67
  if (voiceVideoCallingSdk) {
71
68
  TelemetryHelper.logCallingEvent(LogLevel.INFO, {
@@ -131,14 +128,12 @@ export const CallingContainerStateful = props => {
131
128
  }, callId);
132
129
  const isRemoteVideoDisabled = !voiceVideoCallingSdk.isRemoteVideoEnabled();
133
130
  const isLocalVideoDisabled = !voiceVideoCallingSdk.isLocalVideoEnabled();
134
-
135
131
  if (isRemoteVideoDisabled && isLocalVideoDisabled) {
136
132
  dispatch({
137
133
  type: LiveChatWidgetActionType.DISABLE_VIDEO_CALL,
138
134
  payload: true
139
135
  });
140
136
  }
141
-
142
137
  dispatch({
143
138
  type: LiveChatWidgetActionType.DISABLE_REMOTE_VIDEO,
144
139
  payload: isRemoteVideoDisabled
@@ -150,14 +145,12 @@ export const CallingContainerStateful = props => {
150
145
  }, callId);
151
146
  const isLocalVideoDisabled = !voiceVideoCallingSdk.isLocalVideoEnabled();
152
147
  const isRemoteVideoDisabled = !voiceVideoCallingSdk.isRemoteVideoEnabled();
153
-
154
148
  if (isRemoteVideoDisabled && isLocalVideoDisabled) {
155
149
  dispatch({
156
150
  type: LiveChatWidgetActionType.DISABLE_VIDEO_CALL,
157
151
  payload: true
158
152
  });
159
153
  }
160
-
161
154
  dispatch({
162
155
  type: LiveChatWidgetActionType.DISABLE_LOCAL_VIDEO,
163
156
  payload: isLocalVideoDisabled
@@ -183,7 +176,6 @@ export const CallingContainerStateful = props => {
183
176
  } else {
184
177
  voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
185
178
  }
186
-
187
179
  voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
188
180
  dispatch({
189
181
  type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
@@ -231,7 +223,6 @@ export const CallingContainerStateful = props => {
231
223
  }
232
224
  }, callId);
233
225
  }
234
-
235
226
  dispatch({
236
227
  type: LiveChatWidgetActionType.SET_INCOMING_CALL,
237
228
  payload: false
@@ -257,7 +248,6 @@ export const CallingContainerStateful = props => {
257
248
  }
258
249
  }, callId);
259
250
  }
260
-
261
251
  dispatch({
262
252
  type: LiveChatWidgetActionType.SET_INCOMING_CALL,
263
253
  payload: false
@@ -317,7 +307,8 @@ export const CallingContainerStateful = props => {
317
307
  }, callId);
318
308
  }
319
309
  }, []),
320
- nonActionIds: { ...(props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : (_props$controlProps2$ = _props$controlProps2.currentCallControlProps) === null || _props$controlProps2$ === void 0 ? void 0 : _props$controlProps2$.nonActionIds),
310
+ nonActionIds: {
311
+ ...(props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : (_props$controlProps2$ = _props$controlProps2.currentCallControlProps) === null || _props$controlProps2$ === void 0 ? void 0 : _props$controlProps2$.nonActionIds),
321
312
  selfVideoTileId: (props === null || props === void 0 ? void 0 : (_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : (_props$controlProps3$ = _props$controlProps3.currentCallControlProps) === null || _props$controlProps3$ === void 0 ? void 0 : (_props$controlProps3$2 = _props$controlProps3$.nonActionIds) === null || _props$controlProps3$2 === void 0 ? void 0 : _props$controlProps3$2.selfVideoTileId) ?? "selfVideo",
322
313
  remoteVideoTileId: (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : (_props$controlProps4$ = _props$controlProps4.currentCallControlProps) === null || _props$controlProps4$ === void 0 ? void 0 : (_props$controlProps4$2 = _props$controlProps4$.nonActionIds) === null || _props$controlProps4$2 === void 0 ? void 0 : _props$controlProps4$2.remoteVideoTileId) ?? "remoteVideo"
323
314
  },
@@ -1,6 +1,6 @@
1
1
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
3
- import { ChatButton } from "@microsoft/omnichannel-chat-components";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import { BroadcastService, ChatButton } from "@microsoft/omnichannel-chat-components";
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { setFocusOnElement } from "../../common/utils";
6
6
  import { ConversationState } from "../../contexts/common/ConversationState";
@@ -9,18 +9,17 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
9
9
  import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
10
10
  import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
11
11
  import useChatContextStore from "../../hooks/useChatContextStore";
12
- import { BroadcastService } from "@microsoft/omnichannel-chat-components";
13
12
  export const ChatButtonStateful = props => {
14
13
  var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
15
-
16
14
  const [state, dispatch] = useChatContextStore();
17
15
  const {
18
16
  buttonProps,
19
17
  outOfOfficeButtonProps,
20
18
  startChat
21
- } = props; //Setting OutOfOperatingHours Flag
22
-
19
+ } = props;
20
+ //Setting OutOfOperatingHours Flag
23
21
  const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
22
+ const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
24
23
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
25
24
  const controlProps = {
26
25
  id: "oc-lcw-chat-button",
@@ -33,8 +32,7 @@ export const ChatButtonStateful = props => {
33
32
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
34
33
  Event: TelemetryEvent.LCWChatButtonClicked
35
34
  });
36
-
37
- if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
35
+ if (proactiveChatInNewWindow.current) {
38
36
  const proactiveChatIsInPopoutModeEvent = {
39
37
  eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
40
38
  };
@@ -57,6 +55,9 @@ export const ChatButtonStateful = props => {
57
55
  titleText: "We're Offline",
58
56
  subtitleText: "No agents available",
59
57
  onClick: async () => {
58
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
59
+ Event: TelemetryEvent.LCWChatButtonClicked
60
+ });
60
61
  if (state.appStates.isMinimized) {
61
62
  dispatch({
62
63
  type: LiveChatWidgetActionType.SET_MINIMIZED,
@@ -76,12 +77,10 @@ export const ChatButtonStateful = props => {
76
77
  if (state.appStates.outsideOperatingHours) {
77
78
  setOutOfOperatingHours(true);
78
79
  }
79
-
80
80
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
81
81
  Event: TelemetryEvent.LCWChatButtonShow,
82
82
  ElapsedTimeInMilliseconds: TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed
83
83
  });
84
-
85
84
  if (state.uiStates.focusChatButton) {
86
85
  setFocusOnElement(document.getElementById((controlProps === null || controlProps === void 0 ? void 0 : controlProps.id) ?? "oc-lcw-chat-button"));
87
86
  } else {
@@ -91,6 +90,9 @@ export const ChatButtonStateful = props => {
91
90
  });
92
91
  }
93
92
  }, []);
93
+ useEffect(() => {
94
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
95
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
94
96
  return /*#__PURE__*/React.createElement(ChatButton, {
95
97
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
96
98
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -8,17 +8,17 @@ import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroll
8
8
  import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
9
9
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
10
10
  import useChatAdapterStore from "../../hooks/useChatAdapterStore";
11
- import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ import useChatContextStore from "../../hooks/useChatContextStore";
12
12
 
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
14
  export const ConfirmationPaneStateful = props => {
14
15
  const initialTabIndexMap = new Map();
15
16
  let elements = [];
16
17
  const [state, dispatch] = useChatContextStore();
17
18
  const {
18
19
  prepareEndChat
19
- } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ } = props;
20
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
-
22
22
  const [adapter] = useChatAdapterStore();
23
23
  const controlProps = {
24
24
  id: "oc-lcw-confirmation-pane",
@@ -32,7 +32,6 @@ export const ConfirmationPaneStateful = props => {
32
32
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
33
33
  payload: false
34
34
  });
35
-
36
35
  try {
37
36
  setTabIndices(elements, initialTabIndexMap, true);
38
37
  await prepareEndChat(adapter, state);
@@ -55,31 +54,28 @@ export const ConfirmationPaneStateful = props => {
55
54
  type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
56
55
  payload: false
57
56
  });
58
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
59
-
60
- if (previousFocused) {
61
- setFocusOnElement(previousFocused);
57
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
58
+ if (previousFocusedElementId) {
59
+ setFocusOnElement("#" + previousFocusedElementId);
62
60
  dispatch({
63
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
61
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
64
62
  payload: null
65
63
  });
66
64
  } else {
67
65
  setFocusOnSendBox();
68
66
  }
69
-
70
67
  setTabIndices(elements, initialTabIndexMap, true);
71
68
  },
72
69
  ...(props === null || props === void 0 ? void 0 : props.controlProps)
73
- }; // Move focus to the first button
70
+ };
74
71
 
72
+ // Move focus to the first button
75
73
  useEffect(() => {
76
74
  preventFocusToMoveOutOfElement(controlProps.id);
77
75
  const focusableElements = findAllFocusableElement(`#${controlProps.id}`);
78
-
79
76
  if (focusableElements) {
80
77
  focusableElements[0].focus();
81
78
  }
82
-
83
79
  elements = findParentFocusableElementsWithoutChildContainer(controlProps.id);
84
80
  setTabIndices(elements, initialTabIndexMap, false);
85
81
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
@@ -12,34 +12,29 @@ import useChatContextStore from "../../hooks/useChatContextStore";
12
12
  import useChatSDKStore from "../../hooks/useChatSDKStore";
13
13
  export const EmailTranscriptPaneStateful = props => {
14
14
  var _props$controlProps;
15
-
16
15
  const initialTabIndexMap = new Map();
17
16
  let elements = [];
18
- const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
-
17
+ const [state, dispatch] = useChatContextStore();
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
19
  const chatSDK = useChatSDKStore();
21
20
  const [initialEmail, setInitialEmail] = useState("");
22
-
23
21
  const closeEmailTranscriptPane = () => {
24
22
  dispatch({
25
23
  type: LiveChatWidgetActionType.SET_SHOW_EMAIL_TRANSCRIPT_PANE,
26
24
  payload: false
27
25
  });
28
- const previousFocused = state.appStates.previousElementOnFocusBeforeModalOpen;
29
-
30
- if (previousFocused) {
31
- setFocusOnElement(previousFocused);
26
+ const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
27
+ if (previousFocusedElementId) {
28
+ setFocusOnElement("#" + previousFocusedElementId);
32
29
  } else {
33
30
  setFocusOnSendBox();
34
31
  }
35
-
36
32
  dispatch({
37
- type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT,
33
+ type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
38
34
  payload: null
39
35
  });
40
36
  setTabIndices(elements, initialTabIndexMap, true);
41
37
  };
42
-
43
38
  const controlProps = {
44
39
  id: "oclcw-emailTranscriptDialogContainer",
45
40
  dir: state.domainStates.globalDir,
@@ -49,7 +44,6 @@ export const EmailTranscriptPaneStateful = props => {
49
44
  emailAddress: email,
50
45
  attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
51
46
  };
52
-
53
47
  try {
54
48
  await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
55
49
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
@@ -78,16 +72,15 @@ export const EmailTranscriptPaneStateful = props => {
78
72
  },
79
73
  ...props.controlProps,
80
74
  inputInitialText: ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.inputInitialText) ?? initialEmail
81
- }; // Move focus to the first button
75
+ };
82
76
 
77
+ // Move focus to the first button
83
78
  useEffect(() => {
84
79
  preventFocusToMoveOutOfElement(controlProps.id);
85
80
  const focusableElements = findAllFocusableElement(`#${controlProps.id}`);
86
-
87
81
  if (focusableElements) {
88
82
  focusableElements[0].focus();
89
83
  }
90
-
91
84
  elements = findParentFocusableElementsWithoutChildContainer(controlProps.id);
92
85
  setTabIndices(elements, initialTabIndexMap, false);
93
86
  setInitialEmail(state.appStates.preChatResponseEmail);
@@ -19,10 +19,10 @@ describe("EmailTranscriptPaneStateful unit test", () => {
19
19
  attachmentMessage: "sample",
20
20
  locale: "sample"
21
21
  };
22
-
23
22
  try {
24
23
  await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
25
- expect(chatSDK.emailLiveChatTranscript).toHaveBeenCalledTimes(1); // eslint-disable-next-line no-empty
24
+ expect(chatSDK.emailLiveChatTranscript).toHaveBeenCalledTimes(1);
25
+ // eslint-disable-next-line no-empty
26
26
  } catch (ex) {}
27
27
  });
28
28
  it("Method emailLiveChatTranscript throws exception", async () => {
@@ -39,9 +39,9 @@ describe("EmailTranscriptPaneStateful unit test", () => {
39
39
  attachmentMessage: "sample",
40
40
  locale: "sample"
41
41
  };
42
-
43
42
  try {
44
- await chatSDK.emailLiveChatTranscript(chatTranscriptBody); // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
45
  } catch (ex) {
46
46
  expect(ex.message).toEqual(errorMessage);
47
47
  }
@@ -59,9 +59,9 @@ describe("EmailTranscriptPaneStateful unit test", () => {
59
59
  attachmentMessage: "sample",
60
60
  locale: "sample"
61
61
  };
62
-
63
62
  try {
64
- await chatSDK.emailLiveChatTranscript(chatTranscriptBody); // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
+ await chatSDK.emailLiveChatTranscript(chatTranscriptBody);
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
65
  } catch (ex) {
66
66
  expect(ex.message).toEqual(errorMessage);
67
67
  }