@microsoft/omnichannel-chat-widget 1.7.8-main.bd4de53 → 1.7.8-main.cf04c1c

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 (392) hide show
  1. package/lib/cjs/common/Constants.js +67 -20
  2. package/lib/cjs/common/KeyCodes.js +6 -1
  3. package/lib/cjs/common/contextDataStore/DataStoreManager.js +6 -1
  4. package/lib/cjs/common/facades/FacadeChatSDK.js +392 -295
  5. package/lib/cjs/common/storage/default/defaultCacheManager.js +6 -3
  6. package/lib/cjs/common/telemetry/AppInsightsEvents.js +31 -0
  7. package/lib/cjs/common/telemetry/ScenarioMarker.js +66 -0
  8. package/lib/cjs/common/telemetry/TelemetryConstants.js +155 -129
  9. package/lib/cjs/common/telemetry/TelemetryHelper.js +281 -250
  10. package/lib/cjs/common/telemetry/TelemetryManager.js +32 -12
  11. package/lib/cjs/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +11 -0
  12. package/lib/cjs/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
  13. package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +149 -0
  14. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +13 -9
  15. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +3 -2
  16. package/lib/cjs/components/footerstateful/FooterStateful.js +11 -6
  17. package/lib/cjs/components/headerstateful/HeaderStateful.js +18 -6
  18. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
  19. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +70 -58
  20. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
  21. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
  22. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
  23. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +14 -6
  24. package/lib/cjs/components/livechatwidget/common/Deferred.js +14 -6
  25. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -5
  26. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -1
  27. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +6 -3
  28. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -2
  29. package/lib/cjs/components/livechatwidget/common/startChat.js +45 -40
  30. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -4
  31. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +25 -20
  32. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +6 -4
  33. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +9 -4
  34. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
  35. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +8 -6
  36. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +7 -1
  37. package/lib/cjs/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
  38. package/lib/cjs/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
  39. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
  40. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
  41. package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +62 -52
  42. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
  47. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +5 -6
  48. package/lib/cjs/controller/componentController.js +3 -2
  49. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +118 -0
  50. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +164 -115
  51. package/lib/cjs/firstresponselatency/util.js +15 -2
  52. package/lib/cjs/plugins/createChatTranscript.js +88 -58
  53. package/lib/cjs/plugins/newMessageEventHandler.js +4 -4
  54. package/lib/esm/common/Constants.js +65 -19
  55. package/lib/esm/common/KeyCodes.js +6 -1
  56. package/lib/esm/common/contextDataStore/DataStoreManager.js +6 -1
  57. package/lib/esm/common/facades/FacadeChatSDK.js +392 -295
  58. package/lib/esm/common/storage/default/defaultCacheManager.js +6 -1
  59. package/lib/esm/common/telemetry/AppInsightsEvents.js +24 -0
  60. package/lib/esm/common/telemetry/ScenarioMarker.js +59 -0
  61. package/lib/esm/common/telemetry/TelemetryConstants.js +155 -129
  62. package/lib/esm/common/telemetry/TelemetryHelper.js +281 -250
  63. package/lib/esm/common/telemetry/TelemetryManager.js +32 -12
  64. package/lib/esm/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +4 -0
  65. package/lib/esm/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
  66. package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +139 -0
  67. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +13 -9
  68. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +3 -2
  69. package/lib/esm/components/footerstateful/FooterStateful.js +11 -6
  70. package/lib/esm/components/headerstateful/HeaderStateful.js +18 -6
  71. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
  72. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +70 -58
  73. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
  74. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
  75. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
  76. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +14 -6
  77. package/lib/esm/components/livechatwidget/common/Deferred.js +14 -6
  78. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -6
  79. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -1
  80. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +6 -3
  81. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -2
  82. package/lib/esm/components/livechatwidget/common/startChat.js +46 -41
  83. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -4
  84. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +25 -20
  85. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -4
  86. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +9 -4
  87. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
  88. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +8 -6
  89. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +7 -1
  90. package/lib/esm/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
  91. package/lib/esm/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
  92. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
  93. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
  94. package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +63 -52
  95. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
  96. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
  97. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
  98. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
  99. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
  100. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +5 -6
  101. package/lib/esm/controller/componentController.js +3 -2
  102. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +112 -0
  103. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +165 -116
  104. package/lib/esm/firstresponselatency/util.js +12 -0
  105. package/lib/esm/plugins/createChatTranscript.js +88 -58
  106. package/lib/esm/plugins/newMessageEventHandler.js +4 -4
  107. package/lib/types/assets/Audios.d.ts +1 -1
  108. package/lib/types/assets/Icons.d.ts +16 -16
  109. package/lib/types/common/Constants.d.ts +283 -277
  110. package/lib/types/common/KeyCodes.d.ts +5 -5
  111. package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -4
  112. package/lib/types/common/facades/FacadeChatSDK.d.ts +75 -74
  113. package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +13 -13
  114. package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -14
  115. package/lib/types/common/interfaces/ITimer.d.ts +3 -3
  116. package/lib/types/common/storage/default/defaultCacheManager.d.ts +5 -5
  117. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +4 -4
  118. package/lib/types/common/storage/default/defaultInMemoryDataStore.d.ts +6 -6
  119. package/lib/types/common/telemetry/AppInsightsEvents.d.ts +1 -0
  120. package/lib/types/common/telemetry/ScenarioMarker.d.ts +19 -0
  121. package/lib/types/common/telemetry/TelemetryConstants.d.ts +272 -260
  122. package/lib/types/common/telemetry/TelemetryHelper.d.ts +48 -43
  123. package/lib/types/common/telemetry/TelemetryManager.d.ts +12 -12
  124. package/lib/types/common/telemetry/defaultConfigs/defaultAppInsightsConfig.d.ts +2 -0
  125. package/lib/types/common/telemetry/defaultConfigs/defaultAriaConfig.d.ts +2 -2
  126. package/lib/types/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.d.ts +2 -2
  127. package/lib/types/common/telemetry/defaultConfigs/defaultTelemetryInternalData.d.ts +2 -2
  128. package/lib/types/common/telemetry/definitions/Contracts.d.ts +77 -77
  129. package/lib/types/common/telemetry/definitions/Payload.d.ts +105 -105
  130. package/lib/types/common/telemetry/interfaces/IAppInsightsConfig.d.ts +4 -0
  131. package/lib/types/common/telemetry/interfaces/IAriaConfigurations.d.ts +18 -18
  132. package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +6 -5
  133. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +23 -21
  134. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +48 -48
  135. package/lib/types/common/telemetry/interfaces/ITelemetryEvents.d.ts +7 -7
  136. package/lib/types/common/telemetry/loggers/appInsightsLogger.d.ts +10 -0
  137. package/lib/types/common/telemetry/loggers/ariaTelemetryLogger.d.ts +2 -2
  138. package/lib/types/common/telemetry/loggers/consoleLogger.d.ts +2 -2
  139. package/lib/types/common/utils.d.ts +49 -49
  140. package/lib/types/components/callingcontainerstateful/CallingContainerStateful.d.ts +4 -3
  141. package/lib/types/components/callingcontainerstateful/ICallingContainerStatefulProps.d.ts +4 -4
  142. package/lib/types/components/chatbuttonstateful/ChatButtonStateful.d.ts +4 -3
  143. package/lib/types/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.d.ts +2 -2
  144. package/lib/types/components/chatbuttonstateful/interfaces/IChatButtonStatefulParams.d.ts +17 -17
  145. package/lib/types/components/confirmationpanestateful/ConfirmationPaneStateful.d.ts +4 -3
  146. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +2 -2
  147. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneInputs.d.ts +4 -4
  148. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.d.ts +10 -10
  149. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +13 -13
  150. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +8 -8
  151. package/lib/types/components/dimlayer/DimLayer.d.ts +6 -5
  152. package/lib/types/components/draggable/DraggableChatWidget.d.ts +9 -9
  153. package/lib/types/components/draggable/DraggableEventEmitter.d.ts +27 -27
  154. package/lib/types/components/draggable/DraggableEventNames.d.ts +6 -6
  155. package/lib/types/components/draggable/DraggableEventReceiver.d.ts +27 -27
  156. package/lib/types/components/draggable/IDraggableElementPosition.d.ts +5 -5
  157. package/lib/types/components/draggable/IDraggableElementPositionDelta.d.ts +5 -5
  158. package/lib/types/components/draggable/IDraggableEvent.d.ts +12 -12
  159. package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.d.ts +4 -3
  160. package/lib/types/components/emailtranscriptpanestateful/interfaces/IChatTranscriptBody.d.ts +5 -5
  161. package/lib/types/components/emailtranscriptpanestateful/interfaces/IEmailTranscriptPaneProps.d.ts +11 -11
  162. package/lib/types/components/footerstateful/FooterStateful.d.ts +3 -2
  163. package/lib/types/components/footerstateful/audionotificationstateful/AudioNotificationStateful.d.ts +4 -3
  164. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationProps.d.ts +3 -3
  165. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +4 -4
  166. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +4 -4
  167. package/lib/types/components/footerstateful/downloadtranscriptstateful/common/defaultLibraryScripts.d.ts +23 -23
  168. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps.d.ts +19 -19
  169. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +14 -14
  170. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/TranscriptHtmlScripts.d.ts +33 -33
  171. package/lib/types/components/headerstateful/HeaderStateful.d.ts +4 -3
  172. package/lib/types/components/headerstateful/common/styleProps/defaultOutOfOfficeHeaderStyleProps.d.ts +2 -2
  173. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +33 -33
  174. package/lib/types/components/livechatwidget/LiveChatWidget.d.ts +4 -3
  175. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -14
  176. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +12 -12
  177. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -5
  178. package/lib/types/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.d.ts +7 -7
  179. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -6
  180. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -7
  181. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -7
  182. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -9
  183. package/lib/types/components/livechatwidget/common/authHelper.d.ts +18 -18
  184. package/lib/types/components/livechatwidget/common/chatDisconnectHelper.d.ts +4 -4
  185. package/lib/types/components/livechatwidget/common/createAdapter.d.ts +3 -3
  186. package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +25 -25
  187. package/lib/types/components/livechatwidget/common/createFooter.d.ts +4 -3
  188. package/lib/types/components/livechatwidget/common/createInternetConnectionChangeHandler.d.ts +2 -2
  189. package/lib/types/components/livechatwidget/common/createMarkdown.d.ts +2 -2
  190. package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -2
  191. package/lib/types/components/livechatwidget/common/defaultStyles/defaultLiveChatWidgetGeneralStyles.d.ts +2 -2
  192. package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -1
  193. package/lib/types/components/livechatwidget/common/endChat.d.ts +13 -13
  194. package/lib/types/components/livechatwidget/common/getGeneralStylesForButton.d.ts +3 -3
  195. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +1 -1
  196. package/lib/types/components/livechatwidget/common/helpers/markdownHelper.d.ts +2 -2
  197. package/lib/types/components/livechatwidget/common/initCallingSdk.d.ts +2 -2
  198. package/lib/types/components/livechatwidget/common/initConfirmationPropsComposer.d.ts +3 -3
  199. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +7 -7
  200. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +3 -3
  201. package/lib/types/components/livechatwidget/common/overridePropsOnMockIfApplicable.d.ts +3 -3
  202. package/lib/types/components/livechatwidget/common/persistentChatHelper.d.ts +1 -1
  203. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +12 -12
  204. package/lib/types/components/livechatwidget/common/registerTelemetryLoggers.d.ts +4 -4
  205. package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +10 -10
  206. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +4 -4
  207. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -1
  208. package/lib/types/components/livechatwidget/common/startChat.d.ts +11 -11
  209. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +6 -6
  210. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +4 -4
  211. package/lib/types/components/livechatwidget/common/updateSessionDataForTelemetry.d.ts +4 -4
  212. package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +4 -4
  213. package/lib/types/components/livechatwidget/interfaces/IDraggableChatWidgetProps.d.ts +10 -10
  214. package/lib/types/components/livechatwidget/interfaces/IFeatureConfigProps.d.ts +3 -3
  215. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +17 -17
  216. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +21 -21
  217. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +70 -68
  218. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetStyleProps.d.ts +5 -5
  219. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +8 -8
  220. package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -22
  221. package/lib/types/components/livechatwidget/interfaces/ISendBox.d.ts +12 -12
  222. package/lib/types/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.d.ts +3 -3
  223. package/lib/types/components/loadingpanestateful/LoadingPaneStateful.d.ts +3 -2
  224. package/lib/types/components/loadingpanestateful/common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps.d.ts +2 -2
  225. package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -2
  226. package/lib/types/components/notificationpanestateful/NotificationPaneStateful.d.ts +4 -3
  227. package/lib/types/components/notificationpanestateful/defaultProps/defaultChatDisconnectControlProps.d.ts +2 -2
  228. package/lib/types/components/notificationpanestateful/defaultProps/defaultChatDisconnectStyleProps.d.ts +2 -2
  229. package/lib/types/components/notificationpanestateful/interfaces/INotificationPaneStatefulProps.d.ts +13 -13
  230. package/lib/types/components/ooohpanestateful/OOOHPaneStateful.d.ts +4 -3
  231. package/lib/types/components/ooohpanestateful/common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps.d.ts +2 -2
  232. package/lib/types/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.d.ts +4 -3
  233. package/lib/types/components/postchatloadingpanestateful/common/defaultgeneralPostChatLoadingPaneStyleProps.d.ts +2 -2
  234. package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +4 -3
  235. package/lib/types/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.d.ts +2 -2
  236. package/lib/types/components/postchatsurveypanestateful/common/isValidSurveyUrl.d.ts +2 -2
  237. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +5 -5
  238. package/lib/types/components/postchatsurveypanestateful/enums/PostChatSurveyMode.d.ts +4 -4
  239. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +5 -5
  240. package/lib/types/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.d.ts +4 -3
  241. package/lib/types/components/prechatsurveypanestateful/common/defaultProps/defaultPreChatSurveyLocalizedTexts.d.ts +2 -2
  242. package/lib/types/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.d.ts +2 -2
  243. package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +5 -5
  244. package/lib/types/components/proactivechatpanestateful/ProactiveChatPaneStateful.d.ts +3 -2
  245. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -3
  246. package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps.d.ts +4 -4
  247. package/lib/types/components/reconnectchatpanestateful/ReconnectChatPaneStateful.d.ts +4 -3
  248. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatContext.d.ts +4 -4
  249. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatOptionalParams.d.ts +3 -3
  250. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulParams.d.ts +5 -5
  251. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +5 -5
  252. package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +4 -3
  253. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -2
  254. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -2
  255. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -2
  256. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -2
  257. package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -2
  258. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -5
  259. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -6
  260. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -14
  261. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -8
  262. package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -10
  263. package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +4 -3
  264. package/lib/types/components/webchatcontainerstateful/common/DemoChatAdapter.d.ts +10 -10
  265. package/lib/types/components/webchatcontainerstateful/common/DemoChatSDK.d.ts +6 -6
  266. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +8 -8
  267. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +31 -31
  268. package/lib/types/components/webchatcontainerstateful/common/MockBotCardCommandType.d.ts +6 -6
  269. package/lib/types/components/webchatcontainerstateful/common/MockBotCommand.d.ts +11 -11
  270. package/lib/types/components/webchatcontainerstateful/common/defaultProps/defaultAttachmentProps.d.ts +2 -2
  271. package/lib/types/components/webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts.d.ts +2 -2
  272. package/lib/types/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.d.ts +2 -2
  273. package/lib/types/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.d.ts +2 -2
  274. package/lib/types/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.d.ts +2 -2
  275. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -2
  276. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStatefulContainerStyles.d.ts +2 -2
  277. package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.d.ts +2 -2
  278. package/lib/types/components/webchatcontainerstateful/common/mockadapter.d.ts +14 -14
  279. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +45 -45
  280. package/lib/types/components/webchatcontainerstateful/common/utils/BrowserInfo.d.ts +5 -5
  281. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +7 -7
  282. package/lib/types/components/webchatcontainerstateful/common/utils/attachmentActivityUtils.d.ts +9 -9
  283. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +9 -9
  284. package/lib/types/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.d.ts +2 -2
  285. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +8 -8
  286. package/lib/types/components/webchatcontainerstateful/interfaces/IAttachmentProps.d.ts +5 -5
  287. package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +4 -4
  288. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -4
  289. package/lib/types/components/webchatcontainerstateful/interfaces/IDataMaskingInfo.d.ts +6 -6
  290. package/lib/types/components/webchatcontainerstateful/interfaces/IDataMaskingRule.d.ts +3 -3
  291. package/lib/types/components/webchatcontainerstateful/interfaces/IDataMaskingSetting.d.ts +4 -4
  292. package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +37 -37
  293. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatAction.d.ts +4 -4
  294. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +28 -28
  295. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +39 -39
  296. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -3
  297. package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.d.ts +3 -3
  298. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/BrowserVendor.d.ts +9 -9
  299. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineActivityType.d.ts +4 -4
  300. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/DirectLineSenderRole.d.ts +5 -5
  301. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/MessageType.d.ts +11 -11
  302. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationLevel.d.ts +6 -6
  303. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +11 -11
  304. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/SendStatus.d.ts +5 -5
  305. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.d.ts +24 -24
  306. package/lib/types/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.d.ts +9 -9
  307. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsEgressMiddleware.d.ts +2 -2
  308. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/adaptermiddlewares/formatTagsIngressMiddleware.d.ts +2 -2
  309. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +10 -10
  310. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
  311. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.d.ts +6 -6
  312. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.d.ts +3 -2
  313. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.d.ts +3 -2
  314. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.d.ts +3 -2
  315. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.d.ts +3 -2
  316. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/FileScanStatus.d.ts +6 -6
  317. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.d.ts +3 -2
  318. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.d.ts +3 -2
  319. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.d.ts +3 -2
  320. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +8 -8
  321. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -2
  322. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentContentStyles.d.ts +1 -2
  323. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDividerStyles.d.ts +1 -2
  324. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDownloadIconStyles.d.ts +1 -2
  325. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentFileNameStyles.d.ts +1 -2
  326. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentSizeStyles.d.ts +1 -2
  327. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAtttachmentAdaptiveCardStyles.d.ts +1 -2
  328. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAtttachmentIconStyles.d.ts +1 -2
  329. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAtttachmentStyles.d.ts +1 -2
  330. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarStyles.d.ts +1 -2
  331. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.d.ts +1 -2
  332. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles.d.ts +1 -2
  333. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.d.ts +1 -2
  334. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.d.ts +3 -3
  335. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.d.ts +11 -11
  336. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampContentStyles.d.ts +2 -2
  337. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampFailedStyles.d.ts +1 -2
  338. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.d.ts +1 -2
  339. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTypingIndicatorBubbleStyles.d.ts +1 -2
  340. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTypingIndicatorContainerStyles.d.ts +1 -2
  341. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTypingIndicatorMessageStyles.d.ts +1 -2
  342. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.d.ts +3 -3
  343. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageStyles.d.ts +3 -3
  344. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware.d.ts +10 -10
  345. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/index.d.ts +10 -10
  346. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.d.ts +4 -4
  347. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +4 -4
  348. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.d.ts +2 -1
  349. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.d.ts +2 -1
  350. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +2 -1
  351. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.d.ts +2 -2
  352. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.d.ts +7 -6
  353. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.d.ts +10 -10
  354. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +11 -11
  355. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.d.ts +10 -10
  356. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.d.ts +11 -11
  357. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.d.ts +11 -11
  358. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware.d.ts +10 -10
  359. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware.d.ts +10 -10
  360. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.d.ts +10 -10
  361. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator.d.ts +11 -11
  362. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware.d.ts +10 -10
  363. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware.d.ts +10 -10
  364. package/lib/types/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.d.ts +12 -12
  365. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -1
  366. package/lib/types/contexts/ChatAdapterStore.d.ts +1 -2
  367. package/lib/types/contexts/ChatContextStore.d.ts +1 -1
  368. package/lib/types/contexts/ChatSDKStore.d.ts +1 -1
  369. package/lib/types/contexts/FacadeChatSDKStore.d.ts +1 -1
  370. package/lib/types/contexts/common/ConversationState.d.ts +13 -13
  371. package/lib/types/contexts/common/ILiveChatWidgetAction.d.ts +5 -5
  372. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +63 -63
  373. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +40 -40
  374. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +48 -48
  375. package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +3 -3
  376. package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -5
  377. package/lib/types/contexts/createReducer.d.ts +4 -4
  378. package/lib/types/controller/componentController.d.ts +16 -16
  379. package/lib/types/firstresponselatency/Constants.d.ts +30 -30
  380. package/lib/types/firstresponselatency/FirstMessageTrackerFromBot.d.ts +1 -0
  381. package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +22 -17
  382. package/lib/types/firstresponselatency/util.d.ts +7 -6
  383. package/lib/types/hooks/useChatAdapterStore.d.ts +2 -2
  384. package/lib/types/hooks/useChatContextStore.d.ts +5 -5
  385. package/lib/types/hooks/useChatSDKStore.d.ts +2 -2
  386. package/lib/types/hooks/useDebounce.d.ts +3 -3
  387. package/lib/types/hooks/useFacadeChatSDKStore.d.ts +3 -3
  388. package/lib/types/hooks/useWindowDimensions.d.ts +4 -4
  389. package/lib/types/index.d.ts +11 -11
  390. package/lib/types/plugins/createChatTranscript.d.ts +3 -3
  391. package/lib/types/plugins/newMessageEventHandler.d.ts +2 -2
  392. package/package.json +41 -16
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createTrackingForFirstMessage = void 0;
7
+ var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
8
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
9
+ var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
10
+ var _util = require("./util");
11
+ // This tracker is event based, this is since we are tracking events coming from different sources
12
+ // with different timeline, therefore this is a functional approach to track the events, instead of a class based approach
13
+ const createTrackingForFirstMessage = () => {
14
+ // Reset the tracking variables
15
+ let startTracking = false;
16
+ let stopTracking = false;
17
+ let startTime = 0;
18
+ let stopTime = 0;
19
+ let stopTrackingMessage;
20
+ let flag = false;
21
+ const isMessageFromValidSender = payload => {
22
+ var _payload$tags;
23
+ // agent scenario
24
+ if (payload !== null && payload !== void 0 && (_payload$tags = payload.tags) !== null && _payload$tags !== void 0 && _payload$tags.includes("public")) {
25
+ return false;
26
+ }
27
+ return true;
28
+ };
29
+ const widgetLoadListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.WidgetLoadComplete).subscribe(() => {
30
+ if (startTracking) return;
31
+ startTracking = true;
32
+ startTime = new Date().getTime();
33
+ });
34
+ const newMessageListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.NewMessageReceived).subscribe(message => {
35
+ const payload = message.payload;
36
+
37
+ // we only care for bot, so we need to check if the message is from the bot
38
+ // pending to add typing message indicator signal detection
39
+
40
+ if (isMessageFromValidSender(payload)) {
41
+ if (startTracking && !stopTracking) {
42
+ stopTime = new Date().getTime();
43
+ const elapsedTime = stopTime - startTime;
44
+ stopTracking = true;
45
+ stopTrackingMessage = (0, _util.createTrackingMessage)(payload, "botMessage");
46
+ notifyFMLTrackingCompleted();
47
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
48
+ Event: _TelemetryConstants.TelemetryEvent.BotFirstMessageLapTrack,
49
+ Description: "First Message from Bot latency tracking",
50
+ CustomProperties: {
51
+ elapsedTime,
52
+ widgetLoadedAt: startTime,
53
+ botMessage: stopTrackingMessage
54
+ }
55
+ });
56
+ }
57
+ }
58
+
59
+ // this track only first message, if coming from the bot or not
60
+ // the only difference is that it logs only those from bot
61
+ disconnectListener();
62
+ });
63
+ const notifyFMLTrackingCompleted = () => {
64
+ ackListener();
65
+ // Retry sending until flag is true, but do not block the main thread
66
+ const interval = setInterval(() => {
67
+ if (flag) {
68
+ clearInterval(interval);
69
+ } else {
70
+ _omnichannelChatComponents.BroadcastService.postMessage({
71
+ eventName: _TelemetryConstants.BroadcastEvent.FMLTrackingCompleted,
72
+ payload: null
73
+ });
74
+ }
75
+ }, 100);
76
+ };
77
+ const ackListener = () => {
78
+ const listen = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.FMLTrackingCompletedAck).subscribe(() => {
79
+ flag = true;
80
+ listen.unsubscribe();
81
+ });
82
+ };
83
+
84
+ // Rehydrate message is received when the widget is reloaded, this is to ensure that we are not tracking messages that are not part of the current conversation
85
+ // No need to keep listerning for tracking, enforcing disconnection for the listners
86
+ const rehydrateListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.RehydrateMessageReceived).subscribe(() => {
87
+ startTracking = false;
88
+ stopTracking = false;
89
+ disconnectListener();
90
+ });
91
+
92
+ // Rehydrate message is received when the widget is reloaded, this is to ensure that we are not tracking messages that are not part of the current conversation
93
+ // No need to keep listerning for tracking, enforcing disconnection for the listners
94
+ const historyListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.HistoryMessageReceived).subscribe(() => {
95
+ startTracking = false;
96
+ stopTracking = false;
97
+ disconnectListener();
98
+ });
99
+ const offlineNetworkListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.NetworkDisconnected).subscribe(() => {
100
+ startTracking = false;
101
+ stopTracking = false;
102
+ disconnectListener();
103
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
104
+ Event: _TelemetryConstants.TelemetryEvent.BotFirstMessageLapTrackError,
105
+ Description: "Tracker Stopped due to network disconnection"
106
+ });
107
+ });
108
+
109
+ // this is to ensure that we are not tracking messages that are not part of the current conversation
110
+ const disconnectListener = () => {
111
+ historyListener.unsubscribe();
112
+ rehydrateListener.unsubscribe();
113
+ newMessageListener.unsubscribe();
114
+ widgetLoadListener.unsubscribe();
115
+ offlineNetworkListener.unsubscribe();
116
+ };
117
+ };
118
+ exports.createTrackingForFirstMessage = createTrackingForFirstMessage;
@@ -5,148 +5,197 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FirstResponseLatencyTracker = void 0;
7
7
  var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
8
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
8
9
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
13
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
14
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
15
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
- class FirstResponseLatencyTracker {
13
- constructor() {
16
+ let FirstResponseLatencyTracker = /*#__PURE__*/function () {
17
+ function FirstResponseLatencyTracker() {
18
+ _classCallCheck(this, FirstResponseLatencyTracker);
14
19
  _defineProperty(this, "isABotConversation", false);
15
20
  _defineProperty(this, "isStarted", false);
16
21
  _defineProperty(this, "isEnded", false);
17
22
  _defineProperty(this, "startTrackingMessage", void 0);
18
23
  _defineProperty(this, "stopTrackingMessage", void 0);
24
+ _defineProperty(this, "isReady", false);
25
+ _defineProperty(this, "offlineNetworkListener", _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.NetworkDisconnected).subscribe(() => {
26
+ this.isStarted = false;
27
+ this.isEnded = false;
28
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
29
+ Event: _TelemetryConstants.TelemetryEvent.MessageStopLapTrackError,
30
+ Description: "Tracker Stopped due to network disconnection"
31
+ });
32
+ }));
33
+ _defineProperty(this, "fmltrackingListener", _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.FMLTrackingCompleted).subscribe(() => {
34
+ this.isReady = true;
35
+ _omnichannelChatComponents.BroadcastService.postMessage({
36
+ eventName: _TelemetryConstants.BroadcastEvent.FMLTrackingCompletedAck,
37
+ payload: null
38
+ });
39
+ }));
40
+ // Rehydrate message is received when the widget is reloaded, this is to ensure that we are not tracking messages that are not part of the current conversation
41
+ // No need to keep listerning for tracking, enforcing disconnection for the listners
42
+ _defineProperty(this, "rehydrateListener", _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.RehydrateMessageReceived).subscribe(() => {
43
+ this.isReady = true;
44
+ }));
45
+ // Rehydrate message is received when the widget is reloaded, this is to ensure that we are not tracking messages that are not part of the current conversation
46
+ // No need to keep listerning for tracking, enforcing disconnection for the listners
47
+ _defineProperty(this, "historyListener", _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.HistoryMessageReceived).subscribe(() => {
48
+ this.isReady = true;
49
+ }));
19
50
  // this is a workaround to ensure in reload we track effectively the messages
20
51
  // we do have a mechanism in place to prevent log agent messages.
21
52
  this.isABotConversation = true;
22
53
  }
23
- createTrackingMessage(payload, type) {
24
- return {
25
- Id: payload.Id,
26
- role: payload.role,
27
- timestamp: payload === null || payload === void 0 ? void 0 : payload.timestamp,
28
- tags: payload.tags,
29
- messageType: payload.messageType,
30
- text: payload.text,
31
- type: type,
32
- checkTime: new Date().getTime()
33
- };
34
- }
35
-
36
- // Tracking Functions
37
- startTracking(payload) {
38
- // this prevents to initiate tracking for multiple incoming messages
39
- if (this.isStarted) {
40
- return;
41
- }
42
- // this is to ensure we track only messages where bot is engaged
43
- if (!this.isABotConversation) {
44
- return;
54
+ _createClass(FirstResponseLatencyTracker, [{
55
+ key: "createTrackingMessage",
56
+ value: function createTrackingMessage(payload, type) {
57
+ return {
58
+ Id: payload.Id,
59
+ role: payload.role,
60
+ timestamp: payload === null || payload === void 0 ? void 0 : payload.timestamp,
61
+ tags: payload.tags,
62
+ messageType: payload.messageType,
63
+ text: payload.text,
64
+ type: type,
65
+ checkTime: new Date().getTime()
66
+ };
45
67
  }
46
68
 
47
- // control of states to prevent clashing of messages
48
- this.isStarted = true;
49
- this.isEnded = false;
50
-
51
- // The idea of using types is to enrich telemetry data
52
- this.startTrackingMessage = this.createTrackingMessage(payload, "userMessage");
53
- }
54
- handleAgentMessage(payload) {
55
- var _payload$tags;
56
- // this tag so far is only present in agent messages
57
- if (payload !== null && payload !== void 0 && (_payload$tags = payload.tags) !== null && _payload$tags !== void 0 && _payload$tags.includes("public")) {
58
- this.deregister();
59
- }
60
- }
61
- stopTracking(payload) {
62
- var _this$stopTrackingMes, _this$startTrackingMe;
63
- // this prevents execution for multiple incoming messages from the bot.
64
- if (this.isEnded && !this.isStarted) {
65
- return;
69
+ // Tracking Functions
70
+ }, {
71
+ key: "startTracking",
72
+ value: function startTracking(payload) {
73
+ if (!this.isReady) return;
74
+ // this prevents to initiate tracking for multiple incoming messages
75
+ if (this.isStarted) {
76
+ return;
77
+ }
78
+ // this is to ensure we track only messages where bot is engaged
79
+ if (!this.isABotConversation) {
80
+ return;
81
+ }
82
+ // control of states to prevent clashing of messages
83
+ this.isStarted = true;
84
+ this.isEnded = false;
85
+ // The idea of using types is to enrich telemetry data
86
+ this.startTrackingMessage = this.createTrackingMessage(payload, "userMessage");
66
87
  }
67
-
68
- // control of states to prevent clashing of messages
69
- this.isEnded = true;
70
- this.isStarted = false;
71
-
72
- // The idea of using types is to enrich telemetry data
73
- this.stopTrackingMessage = this.createTrackingMessage(payload, "botMessage");
74
- // calculating elapsed time
75
- const elapsedTime = (((_this$stopTrackingMes = this.stopTrackingMessage) === null || _this$stopTrackingMes === void 0 ? void 0 : _this$stopTrackingMes.checkTime) ?? 0) - (((_this$startTrackingMe = this.startTrackingMessage) === null || _this$startTrackingMe === void 0 ? void 0 : _this$startTrackingMe.checkTime) ?? 0);
76
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
77
- Event: _TelemetryConstants.TelemetryEvent.MessageLapTrack,
78
- Description: "First response latency tracking",
79
- CustomProperties: {
80
- elapsedTime,
81
- userMessage: this.startTrackingMessage,
82
- botMessage: this.stopTrackingMessage
88
+ }, {
89
+ key: "handleAgentMessage",
90
+ value: function handleAgentMessage(payload) {
91
+ var _payload$tags;
92
+ // this tag so far is only present in agent messages
93
+ if (payload !== null && payload !== void 0 && (_payload$tags = payload.tags) !== null && _payload$tags !== void 0 && _payload$tags.includes("public")) {
94
+ this.deregister();
83
95
  }
84
- });
85
- }
86
-
87
- // mechanism to ensure we track only allowed conversations
88
- isMessageFromValidSender(payload) {
89
- var _payload$tags2;
90
- // agent scenario
91
- if (payload !== null && payload !== void 0 && (_payload$tags2 = payload.tags) !== null && _payload$tags2 !== void 0 && _payload$tags2.includes("public")) {
92
- this.handleAgentMessage(payload);
93
- return false;
94
96
  }
95
- return true;
96
- }
97
- startClock(payload) {
98
- try {
99
- if (!payload || !payload.Id) {
100
- throw new Error("Invalid payload");
97
+ }, {
98
+ key: "stopTracking",
99
+ value: function stopTracking(payload) {
100
+ var _this$stopTrackingMes, _this$startTrackingMe;
101
+ // this prevents execution for multiple incoming messages from the bot.
102
+ if (this.isEnded && !this.isStarted) {
103
+ return;
101
104
  }
102
- // in the case of a reload, tracker will be paused, until last history message is received
103
- // this is because we dont have a way to identidy send messages as part of the history
104
- //if (this.inPause) return;
105
- this.startTracking(payload);
106
- } catch (e) {
107
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
108
- Event: _TelemetryConstants.TelemetryEvent.MessageStartLapTrackError,
109
- Description: "Error while starting the clock",
110
- ExceptionDetails: e,
105
+
106
+ // control of states to prevent clashing of messages
107
+ this.isEnded = true;
108
+ this.isStarted = false;
109
+
110
+ // The idea of using types is to enrich telemetry data
111
+ this.stopTrackingMessage = this.createTrackingMessage(payload, "botMessage");
112
+ // calculating elapsed time
113
+ const elapsedTime = (((_this$stopTrackingMes = this.stopTrackingMessage) === null || _this$stopTrackingMes === void 0 ? void 0 : _this$stopTrackingMes.checkTime) ?? 0) - (((_this$startTrackingMe = this.startTrackingMessage) === null || _this$startTrackingMe === void 0 ? void 0 : _this$startTrackingMe.checkTime) ?? 0);
114
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
115
+ Event: _TelemetryConstants.TelemetryEvent.MessageLapTrack,
116
+ Description: "First response latency tracking",
111
117
  CustomProperties: {
112
- payload: payload
118
+ elapsedTime,
119
+ userMessage: this.startTrackingMessage,
120
+ botMessage: this.stopTrackingMessage
113
121
  }
114
122
  });
115
123
  }
116
- }
117
- stopClock(payload) {
118
- try {
119
- if (!payload || !payload.Id) {
120
- throw new Error("Invalid payload");
124
+
125
+ // mechanism to ensure we track only allowed conversations
126
+ }, {
127
+ key: "isMessageFromValidSender",
128
+ value: function isMessageFromValidSender(payload) {
129
+ var _payload$tags2;
130
+ // agent scenario
131
+ if (payload !== null && payload !== void 0 && (_payload$tags2 = payload.tags) !== null && _payload$tags2 !== void 0 && _payload$tags2.includes("public")) {
132
+ this.handleAgentMessage(payload);
133
+ return false;
121
134
  }
122
- if (!this.isMessageFromValidSender(payload)) return;
123
- if (this.isABotConversation && this.isStarted) {
124
- this.stopTracking(payload);
135
+ return true;
136
+ }
137
+ }, {
138
+ key: "startClock",
139
+ value: function startClock(payload) {
140
+ try {
141
+ if (!payload || !payload.Id) {
142
+ throw new Error("Invalid payload");
143
+ }
144
+ this.startTracking(payload);
145
+ } catch (e) {
146
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
147
+ Event: _TelemetryConstants.TelemetryEvent.MessageStartLapTrackError,
148
+ Description: "Error while starting the clock",
149
+ ExceptionDetails: e,
150
+ CustomProperties: {
151
+ payload: payload
152
+ }
153
+ });
125
154
  }
126
- } catch (e) {
127
- console.error("FRL : error while trying to stop the tracker", e);
128
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
129
- Event: _TelemetryConstants.TelemetryEvent.MessageStopLapTrackError,
130
- Description: "Error while stopping the clock",
131
- ExceptionDetails: e,
132
- CustomProperties: {
133
- payload: payload
155
+ }
156
+ }, {
157
+ key: "stopClock",
158
+ value: function stopClock(payload) {
159
+ try {
160
+ if (!payload || !payload.Id) {
161
+ throw new Error("Invalid payload");
134
162
  }
135
- });
136
- //reset state
137
- this.startTrackingMessage = undefined;
138
- this.stopTrackingMessage = undefined;
163
+ if (!this.isMessageFromValidSender(payload)) return;
164
+ if (this.isABotConversation && this.isStarted) {
165
+ this.stopTracking(payload);
166
+ }
167
+ } catch (e) {
168
+ console.error("FRL : error while trying to stop the tracker", e);
169
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
170
+ Event: _TelemetryConstants.TelemetryEvent.MessageStopLapTrackError,
171
+ Description: "Error while stopping the clock",
172
+ ExceptionDetails: e,
173
+ CustomProperties: {
174
+ payload: payload
175
+ }
176
+ });
177
+ //reset state
178
+ this.startTrackingMessage = undefined;
179
+ this.stopTrackingMessage = undefined;
180
+ this.isStarted = false;
181
+ this.isEnded = false;
182
+ }
183
+ }
184
+ }, {
185
+ key: "deregister",
186
+ value: function deregister() {
187
+ // Reset State
188
+ this.isABotConversation = false;
139
189
  this.isStarted = false;
140
190
  this.isEnded = false;
191
+ this.startTrackingMessage = undefined;
192
+ this.stopTrackingMessage = undefined;
193
+ this.offlineNetworkListener.unsubscribe();
194
+ this.fmltrackingListener.unsubscribe();
195
+ this.rehydrateListener.unsubscribe();
196
+ this.historyListener.unsubscribe();
141
197
  }
142
- }
143
- deregister() {
144
- // Reset State
145
- this.isABotConversation = false;
146
- this.isStarted = false;
147
- this.isEnded = false;
148
- this.startTrackingMessage = undefined;
149
- this.stopTrackingMessage = undefined;
150
- }
151
- }
198
+ }]);
199
+ return FirstResponseLatencyTracker;
200
+ }();
152
201
  exports.FirstResponseLatencyTracker = FirstResponseLatencyTracker;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.polyfillMessagePayloadForEvent = exports.isHistoryMessage = exports.getScenarioType = exports.buildMessagePayload = void 0;
6
+ exports.polyfillMessagePayloadForEvent = exports.isHistoryMessage = exports.getScenarioType = exports.createTrackingMessage = exports.buildMessagePayload = void 0;
7
7
  var _Constants = require("./Constants");
8
8
  var _Constants2 = require("../common/Constants");
9
9
  const isHistoryMessage = (activity, startTime) => {
@@ -82,4 +82,17 @@ const getScenarioType = activity => {
82
82
  }
83
83
  return _Constants.ScenarioType.ReceivedMessageStrategy;
84
84
  };
85
- exports.getScenarioType = getScenarioType;
85
+ exports.getScenarioType = getScenarioType;
86
+ const createTrackingMessage = (payload, type) => {
87
+ return {
88
+ Id: payload.Id,
89
+ role: payload.role,
90
+ timestamp: payload === null || payload === void 0 ? void 0 : payload.timestamp,
91
+ tags: payload.tags,
92
+ messageType: payload.messageType,
93
+ text: payload.text,
94
+ type: type,
95
+ checkTime: new Date().getTime()
96
+ };
97
+ };
98
+ exports.createTrackingMessage = createTrackingMessage;