@microsoft/omnichannel-chat-widget 0.1.0-main.edd8c2a → 0.1.0-main.fdf1fdf

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 (216) hide show
  1. package/README.md +259 -0
  2. package/lib/cjs/assets/Audios.js +8 -0
  3. package/lib/cjs/assets/Icons.js +28 -0
  4. package/lib/cjs/common/Constants.js +54 -4
  5. package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
  6. package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
  7. package/lib/cjs/common/telemetry/TelemetryConstants.js +61 -4
  8. package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
  9. package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
  10. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  12. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +48 -15
  13. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -5
  14. package/lib/cjs/common/utils.js +89 -2
  15. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  16. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  17. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -54
  18. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  19. package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
  20. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  21. package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -10
  22. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
  23. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
  24. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  25. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
  26. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
  27. package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
  28. package/lib/cjs/components/livechatwidget/common/authHelper.js +52 -0
  29. package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
  30. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +32 -32
  31. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +30 -24
  32. package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
  33. package/lib/cjs/components/livechatwidget/common/endChat.js +142 -43
  34. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
  35. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -10
  36. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
  37. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
  38. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
  39. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  40. package/lib/cjs/components/livechatwidget/common/startChat.js +198 -41
  41. package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
  42. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +299 -72
  43. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  44. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
  45. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  46. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  47. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
  48. package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  49. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +91 -0
  50. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
  51. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
  52. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  53. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
  54. package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  55. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  60. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  61. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  62. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  63. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  64. package/lib/cjs/contexts/common/ConversationState.js +4 -2
  65. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +13 -7
  66. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +12 -4
  67. package/lib/cjs/contexts/createReducer.js +44 -10
  68. package/lib/cjs/controller/componentController.js +5 -5
  69. package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
  70. package/lib/esm/assets/Audios.js +1 -0
  71. package/lib/esm/assets/Icons.js +11 -0
  72. package/lib/esm/common/Constants.js +50 -3
  73. package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
  74. package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
  75. package/lib/esm/common/telemetry/TelemetryConstants.js +57 -3
  76. package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
  77. package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
  78. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
  79. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  80. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +50 -15
  81. package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
  82. package/lib/esm/common/utils.js +64 -1
  83. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  84. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  85. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -50
  86. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
  87. package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
  88. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  89. package/lib/esm/components/headerstateful/HeaderStateful.js +15 -11
  90. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  91. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  92. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  93. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  94. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  95. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  96. package/lib/esm/components/livechatwidget/common/authHelper.js +39 -0
  97. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  98. package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
  99. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +28 -25
  100. package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
  101. package/lib/esm/components/livechatwidget/common/endChat.js +139 -42
  102. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
  103. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +45 -11
  104. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
  105. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
  106. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
  107. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  108. package/lib/esm/components/livechatwidget/common/startChat.js +186 -39
  109. package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
  110. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +283 -77
  111. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
  112. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
  113. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  114. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
  115. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
  116. package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
  117. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +82 -0
  118. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
  119. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
  120. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
  121. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
  122. package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
  123. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  124. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  125. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  126. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  127. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  128. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  129. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  130. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  131. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  132. package/lib/esm/contexts/common/ConversationState.js +4 -2
  133. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +13 -7
  134. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +12 -4
  135. package/lib/esm/contexts/createReducer.js +44 -9
  136. package/lib/esm/controller/componentController.js +5 -5
  137. package/lib/esm/plugins/newMessageEventHandler.js +82 -0
  138. package/lib/types/assets/Audios.d.ts +1 -0
  139. package/lib/types/assets/Icons.d.ts +11 -0
  140. package/lib/types/common/Constants.d.ts +27 -1
  141. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
  142. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
  143. package/lib/types/common/telemetry/TelemetryConstants.d.ts +45 -2
  144. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  145. package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
  146. package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
  147. package/lib/types/common/telemetry/definitions/Payload.d.ts +15 -9
  148. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
  149. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
  150. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
  151. package/lib/types/common/utils.d.ts +8 -1
  152. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
  153. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  154. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -1
  155. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  156. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  157. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  158. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  159. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  160. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  161. package/lib/types/components/livechatwidget/common/authHelper.d.ts +4 -0
  162. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
  163. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  164. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  165. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  166. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  167. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  168. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
  169. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  170. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  171. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +4 -1
  172. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
  173. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
  174. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  175. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
  176. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
  177. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  178. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
  179. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  180. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
  181. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  182. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  183. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  184. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  185. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  186. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  187. package/lib/types/contexts/common/ConversationState.d.ts +4 -2
  188. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -1
  189. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +14 -8
  190. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
  191. package/package.json +13 -12
  192. package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
  193. package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
  194. package/lib/cjs/assets/icons/audioIcon.svg +0 -6
  195. package/lib/cjs/assets/icons/blankIcon.svg +0 -6
  196. package/lib/cjs/assets/icons/excelIcon.svg +0 -6
  197. package/lib/cjs/assets/icons/imageIcon.svg +0 -6
  198. package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
  199. package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
  200. package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
  201. package/lib/cjs/assets/icons/videoIcon.svg +0 -6
  202. package/lib/cjs/assets/icons/visioIcon.svg +0 -6
  203. package/lib/cjs/assets/icons/wordIcon.svg +0 -6
  204. package/lib/esm/assets/assets.d.js +0 -0
  205. package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
  206. package/lib/esm/assets/icons/archiveIcon.svg +0 -3
  207. package/lib/esm/assets/icons/audioIcon.svg +0 -6
  208. package/lib/esm/assets/icons/blankIcon.svg +0 -6
  209. package/lib/esm/assets/icons/excelIcon.svg +0 -6
  210. package/lib/esm/assets/icons/imageIcon.svg +0 -6
  211. package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
  212. package/lib/esm/assets/icons/pdfIcon.svg +0 -6
  213. package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
  214. package/lib/esm/assets/icons/videoIcon.svg +0 -6
  215. package/lib/esm/assets/icons/visioIcon.svg +0 -6
  216. package/lib/esm/assets/icons/wordIcon.svg +0 -6
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
36
  const ChatButtonStateful = props => {
37
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
37
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
38
38
 
39
39
  const [state, dispatch] = (0, _useChatContextStore.default)();
40
40
  const {
@@ -44,20 +44,27 @@ const ChatButtonStateful = props => {
44
44
  } = props; //Setting OutOfOperatingHours Flag
45
45
 
46
46
  const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.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");
47
+ const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
47
48
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
48
49
  const controlProps = {
49
50
  id: "oc-lcw-chat-button",
50
51
  dir: state.domainStates.globalDir,
51
52
  titleText: "Let's Chat!",
52
53
  subtitleText: "We're online.",
53
- hideNotificationBubble: !(state.appStates.isMinimized === true && state.appStates.unreadMessageCount > 0) || (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true,
54
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? _Constants.Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
54
+ hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
55
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
55
56
  onClick: async () => {
56
57
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
57
58
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
58
59
  });
59
60
 
60
- if (state.appStates.isMinimized) {
61
+ if (proactiveChatInNewWindow.current) {
62
+ const proactiveChatIsInPopoutModeEvent = {
63
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
64
+ };
65
+
66
+ _omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
67
+ } else if (state.appStates.isMinimized) {
61
68
  dispatch({
62
69
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
63
70
  payload: false
@@ -66,6 +73,7 @@ const ChatButtonStateful = props => {
66
73
  await startChat();
67
74
  }
68
75
  },
76
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
69
77
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
70
78
  };
71
79
  const outOfOfficeControlProps = {
@@ -74,6 +82,10 @@ const ChatButtonStateful = props => {
74
82
  titleText: "We're Offline",
75
83
  subtitleText: "No agents available",
76
84
  onClick: async () => {
85
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
86
+ Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
87
+ });
88
+
77
89
  if (state.appStates.isMinimized) {
78
90
  dispatch({
79
91
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
@@ -86,6 +98,7 @@ const ChatButtonStateful = props => {
86
98
  });
87
99
  }
88
100
  },
101
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
89
102
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
90
103
  };
91
104
  (0, _react.useEffect)(() => {
@@ -107,6 +120,9 @@ const ChatButtonStateful = props => {
107
120
  });
108
121
  }
109
122
  }, []);
123
+ (0, _react.useEffect)(() => {
124
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
125
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
110
126
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
111
127
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
112
128
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -7,15 +7,11 @@ exports.default = exports.ConfirmationPaneStateful = void 0;
7
7
 
8
8
  var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
9
9
 
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _utils = require("../../common/utils");
13
-
14
10
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
15
11
 
16
- var _Constants = require("../../common/Constants");
12
+ var _react = _interopRequireWildcard(require("react"));
17
13
 
18
- var _ConversationState = require("../../contexts/common/ConversationState");
14
+ var _utils = require("../../common/utils");
19
15
 
20
16
  var _DimLayer = require("../dimlayer/DimLayer");
21
17
 
@@ -25,16 +21,12 @@ var _NotificationHandler = require("../webchatcontainerstateful/webchatcontrolle
25
21
 
26
22
  var _NotificationScenarios = require("../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
27
23
 
28
- var _PostChatSurveyMode = require("../postchatsurveypanestateful/enums/PostChatSurveyMode");
29
-
30
24
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
31
25
 
32
26
  var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
33
27
 
34
28
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
35
29
 
36
- var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
37
-
38
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
31
 
40
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -43,26 +35,19 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
43
35
 
44
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
37
  const ConfirmationPaneStateful = props => {
46
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
47
-
48
38
  const initialTabIndexMap = new Map();
49
39
  let elements = [];
50
40
  const [state, dispatch] = (0, _useChatContextStore.default)();
51
41
  const {
52
- setPostChatContext,
53
- endChat
42
+ prepareEndChat
54
43
  } = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
44
 
56
- const chatSDK = (0, _useChatSDKStore.default)(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
-
58
45
  const [adapter] = (0, _useChatAdapterStore.default)();
59
- const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
60
- const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
61
46
  const controlProps = {
62
47
  id: "oc-lcw-confirmation-pane",
63
48
  dir: state.domainStates.globalDir,
64
49
  onConfirm: async () => {
65
- _TelemetryHelper.TelemetryHelper.logConfigDataEvent(_TelemetryConstants.LogLevel.INFO, {
50
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
66
51
  Event: _TelemetryConstants.TelemetryEvent.ConfirmationConfirmButtonClicked,
67
52
  Description: "Confirmation pane Confirm button clicked"
68
53
  });
@@ -73,40 +58,8 @@ const ConfirmationPaneStateful = props => {
73
58
  });
74
59
 
75
60
  try {
76
- //ToDo: End Chat before PostChat Context and conversation Details is set once the getPostChatContext request ID fetch issue is fixed
77
- const conversationDetails = await chatSDK.getConversationDetails(); // ToDo: Replace with CanRenderPostChat once available in conversationDetails API response
78
-
79
- if (isPostChatEnabled === "true" && postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed && conversationDetails.canRenderPostChat === _Constants.Constants.truePascal) {
80
- dispatch({
81
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
82
- payload: true
83
- });
84
- dispatch({
85
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
86
- payload: _ConversationState.ConversationState.Loading
87
- });
88
- await setPostChatContext();
89
-
90
- if (state.domainStates.postChatContext) {
91
- dispatch({
92
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
93
- payload: _ConversationState.ConversationState.Postchat
94
- });
95
- }
96
- } else {
97
- (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
98
-
99
- try {
100
- await endChat(adapter);
101
- } catch (error) {
102
- _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
103
- Event: _TelemetryConstants.TelemetryEvent.CloseChatMethodException,
104
- ExceptionDetails: {
105
- exception: `Failed to endChat: ${error}`
106
- }
107
- });
108
- }
109
- }
61
+ (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
62
+ await prepareEndChat(adapter, state);
110
63
  } catch (ex) {
111
64
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
112
65
  Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallFailed,
@@ -119,7 +72,7 @@ const ConfirmationPaneStateful = props => {
119
72
  }
120
73
  },
121
74
  onCancel: () => {
122
- _TelemetryHelper.TelemetryHelper.logConfigDataEvent(_TelemetryConstants.LogLevel.INFO, {
75
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
123
76
  Event: _TelemetryConstants.TelemetryEvent.ConfirmationCancelButtonClicked,
124
77
  Description: "Confirmation pane Cancel button clicked."
125
78
  });
@@ -95,8 +95,8 @@ const EmailTranscriptPaneStateful = props => {
95
95
  },
96
96
  onCancel: () => {
97
97
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
98
- Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptButtonClicked,
99
- Description: "Email Transcript button clicked."
98
+ Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptCancelButtonClicked,
99
+ Description: "Email Transcript cancel button clicked."
100
100
  });
101
101
 
102
102
  closeEmailTranscriptPane();
@@ -17,6 +17,8 @@ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components
17
17
 
18
18
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
19
19
 
20
+ var _Audios = require("../../assets/Audios");
21
+
20
22
  var _NotificationHandler = require("../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
21
23
 
22
24
  var _NotificationScenarios = require("../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
@@ -29,8 +31,6 @@ var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatCo
29
31
 
30
32
  var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
31
33
 
32
- var _newMessageNotification = _interopRequireDefault(require("../../assets/audios/newMessageNotification.mp3"));
33
-
34
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
35
 
36
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -122,9 +122,8 @@ const FooterStateful = props => {
122
122
  controlProps: controlProps,
123
123
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
124
124
  }), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
125
- audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _newMessageNotification.default,
126
- hideAudioNotificationButton: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false,
127
- isAudioMuted: state.appStates.isAudioMuted ?? false
125
+ audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
126
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
128
127
  }));
129
128
  };
130
129
 
@@ -116,8 +116,17 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
116
116
  let fileAttachmentName = _Constants.TranscriptConstants.DefaultFileAttachmentName;
117
117
  let dialogColor = _Constants.TranscriptConstants.CustomerDialogColor;
118
118
  let fontColor = _Constants.TranscriptConstants.CustomerFontColor;
119
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1;
120
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
119
121
 
120
- if (value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1 || value.isControlMessage && value.isControlMessage === true || value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType || value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode) {
122
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType;
123
+
124
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode;
125
+
126
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.hiddenTag.toLowerCase()) !== -1;
127
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
128
+
129
+ if (shouldIgnoreMessage) {
121
130
  return;
122
131
  } else if (value.from) {
123
132
  if (value.from.application) {
@@ -138,7 +147,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
138
147
 
139
148
  if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
140
149
  fileAttachmentName = value.attachments[0].name;
141
- value.content = attachmentMessage ?? "The following attachment was uploaded during the conversation:" + fileAttachmentName;
150
+ value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
142
151
  }
143
152
  }
144
153
 
@@ -43,6 +43,7 @@ const HeaderStateful = props => {
43
43
 
44
44
  const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.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");
45
45
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeHeaderStyleProps.defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
46
+ const conversationState = (0, _react.useRef)(state.appStates.conversationState);
46
47
  const controlProps = {
47
48
  id: "oc-lcw-header",
48
49
  dir: state.domainStates.globalDir,
@@ -63,17 +64,16 @@ const HeaderStateful = props => {
63
64
  Description: "Header Close button clicked."
64
65
  });
65
66
 
66
- if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
67
+ if (conversationState.current === _ConversationState.ConversationState.Active) {
67
68
  dispatch({
68
69
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
69
70
  payload: true
70
71
  });
71
- } else if (state.appStates.conversationState === _ConversationState.ConversationState.Postchat) {
72
- dispatch({
73
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
74
- payload: false
75
- });
76
- await endChat(adapter);
72
+ } else {
73
+ const skipEndChatSDK = true;
74
+ const skipCloseChat = false;
75
+ const postMessageToOtherTabs = true;
76
+ await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
77
77
  }
78
78
 
79
79
  dispatch({
@@ -82,8 +82,8 @@ const HeaderStateful = props => {
82
82
  });
83
83
  },
84
84
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
85
- hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
86
- hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
85
+ hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
86
+ hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
87
87
  hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
88
88
  };
89
89
  const outOfOfficeControlProps = {
@@ -105,7 +105,11 @@ const HeaderStateful = props => {
105
105
  if (state.appStates.outsideOperatingHours) {
106
106
  setOutOfOperatingHours(true);
107
107
  }
108
- }, []);
108
+
109
+ if (state.appStates.conversationState) {
110
+ conversationState.current = state.appStates.conversationState;
111
+ }
112
+ }, [state.appStates]);
109
113
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Header, {
110
114
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
111
115
  controlProps: outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ActivityStreamHandler = void 0;
7
+
8
+ var _Deferred = require("./Deferred");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ class ActivityStreamHandler {
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+
16
+ /**
17
+ * Use of a deferred pattern, to hold the execution of the activity.
18
+ *
19
+ * */
20
+ static cork() {
21
+ ActivityStreamHandler.restoreDeferred = new _Deferred.Deferred();
22
+ ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
23
+ }
24
+ /**
25
+ * Resolve the promise, releasing it to continue with the execution of the activity.
26
+ *
27
+ * */
28
+
29
+
30
+ static uncork() {
31
+ ActivityStreamHandler.restoreDeferred.resolve();
32
+ }
33
+
34
+ }
35
+
36
+ exports.ActivityStreamHandler = ActivityStreamHandler;
37
+
38
+ _defineProperty(ActivityStreamHandler, "restoreDeferred", {
39
+ resolve: () => {
40
+ return "initialState";
41
+ }
42
+ });
43
+
44
+ _defineProperty(ActivityStreamHandler, "restorePromise", void 0);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultActivitySubscriber = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ class DefaultActivitySubscriber {
11
+ constructor() {
12
+ _defineProperty(this, "observer", void 0);
13
+ }
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ async next(activity) {
17
+ this.observer.next(activity);
18
+ return false;
19
+ }
20
+
21
+ }
22
+
23
+ exports.DefaultActivitySubscriber = DefaultActivitySubscriber;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PauseActivitySubscriber = void 0;
7
+
8
+ var _ActivityStreamHandler = require("../ActivityStreamHandler");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ class PauseActivitySubscriber {
13
+ constructor() {
14
+ _defineProperty(this, "observer", void 0);
15
+ }
16
+
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ async apply(activity) {
19
+ await _ActivityStreamHandler.ActivityStreamHandler.restorePromise;
20
+ return activity;
21
+ } // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
22
+
23
+
24
+ applicable(activity) {
25
+ return true;
26
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+
28
+
29
+ async next(activity) {
30
+ if (this.applicable(activity)) {
31
+ return await this.apply(activity);
32
+ }
33
+
34
+ return activity;
35
+ }
36
+
37
+ }
38
+
39
+ exports.PauseActivitySubscriber = PauseActivitySubscriber;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChatAdapterShim = void 0;
7
+
8
+ var _DefaultActivitySubscriber = require("./ActivitySubscriber/DefaultActivitySubscriber");
9
+
10
+ var _shareObservable = require("./shareObservable");
11
+
12
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+
14
+ class ChatAdapterShim {
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ constructor(chatAdapter) {
20
+ _defineProperty(this, "chatAdapter", void 0);
21
+
22
+ _defineProperty(this, "activityObserver", void 0);
23
+
24
+ _defineProperty(this, "subscribers", void 0);
25
+
26
+ this.subscribers = [];
27
+ this.chatAdapter = { ...chatAdapter,
28
+ activity$: (0, _shareObservable.shareObservable)( // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ new window.Observable(observer => {
30
+ this.activityObserver = observer; // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+
32
+ const abortController = new window.AbortController();
33
+
34
+ (async () => {
35
+ try {
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ for await (let activity of chatAdapter.activities({
38
+ signal: abortController.signal
39
+ })) {
40
+ for (const subscriber of [...this.subscribers, new _DefaultActivitySubscriber.DefaultActivitySubscriber()]) {
41
+ subscriber.observer = this.activityObserver;
42
+ activity = await subscriber.next(activity);
43
+
44
+ if (!activity) {
45
+ break;
46
+ }
47
+ }
48
+ }
49
+
50
+ observer.complete();
51
+ } catch (error) {
52
+ observer.error(error);
53
+ }
54
+ })();
55
+
56
+ return () => {
57
+ abortController.abort();
58
+ };
59
+ }))
60
+ };
61
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+
63
+
64
+ addSubscriber(subscriber) {
65
+ this.subscribers.push(subscriber);
66
+ }
67
+
68
+ }
69
+
70
+ exports.ChatAdapterShim = ChatAdapterShim;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Deferred = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ class Deferred {
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ constructor() {
13
+ _defineProperty(this, "_promise", void 0);
14
+
15
+ _defineProperty(this, "_resolve", void 0);
16
+
17
+ _defineProperty(this, "_reject", () => {
18
+ return;
19
+ });
20
+
21
+ _defineProperty(this, "resolve", value => {
22
+ this._resolve(value);
23
+ });
24
+
25
+ _defineProperty(this, "reject", value => {
26
+ this._reject(value);
27
+ });
28
+
29
+ this._promise = new Promise((resolve, reject) => {
30
+ this._resolve = resolve;
31
+ this._reject = reject;
32
+ });
33
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+
35
+
36
+ get promise() {
37
+ return this._promise;
38
+ }
39
+
40
+ }
41
+
42
+ exports.Deferred = Deferred;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.removeAuthTokenProvider = exports.handleAuthentication = void 0;
7
+
8
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
+
10
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
11
+
12
+ var _utils = require("../../../common/utils");
13
+
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
16
+ let authClientFunction = undefined;
17
+
18
+ if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
19
+ var _chatConfig$LiveChatC;
20
+
21
+ authClientFunction = (chatConfig === null || chatConfig === void 0 ? void 0 : (_chatConfig$LiveChatC = chatConfig.LiveChatConfigAuthSettings) === null || _chatConfig$LiveChatC === void 0 ? void 0 : _chatConfig$LiveChatC.msdyn_javascriptclientfunction) ?? undefined;
22
+ }
23
+
24
+ if (getAuthToken && authClientFunction) {
25
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
26
+ Event: _TelemetryConstants.TelemetryEvent.GetAuthTokenCalled
27
+ });
28
+
29
+ const token = await getAuthToken(authClientFunction);
30
+
31
+ if (!(0, _utils.isNullOrEmptyString)(token)) {
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ chatSDK.setAuthTokenProvider(async () => {
34
+ return token;
35
+ });
36
+ } else {
37
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
38
+ Event: _TelemetryConstants.TelemetryEvent.ReceivedNullOrEmptyToken
39
+ });
40
+ }
41
+ }
42
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+
44
+
45
+ exports.handleAuthentication = handleAuthentication;
46
+
47
+ const removeAuthTokenProvider = chatSDK => {
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ chatSDK.authenticatedUserToken = null;
50
+ };
51
+
52
+ exports.removeAuthTokenProvider = removeAuthTokenProvider;
@@ -13,6 +13,10 @@ var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcont
13
13
 
14
14
  var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
15
15
 
16
+ var _ChatAdapterShim = require("./ChatAdapterShim");
17
+
18
+ var _PauseActivitySubscriber = require("./ActivitySubscriber/PauseActivitySubscriber");
19
+
16
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
21
  const createAdapter = async chatSDK => {
18
22
  const chatAdapterOptionalParams = {
@@ -34,7 +38,15 @@ const createAdapter = async chatSDK => {
34
38
  }
35
39
  }
36
40
  };
37
- return await chatSDK.createChatAdapter(chatAdapterOptionalParams);
41
+ let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams); //so far, there is no need to convert to the shim adapter when using visual tests
42
+
43
+ if (chatSDK.isMockModeOn !== true) {
44
+ adapter = new _ChatAdapterShim.ChatAdapterShim(adapter);
45
+ adapter.addSubscriber(new _PauseActivitySubscriber.PauseActivitySubscriber());
46
+ return adapter.chatAdapter;
47
+ }
48
+
49
+ return adapter;
38
50
  };
39
51
 
40
52
  exports.createAdapter = createAdapter;