@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.1bfa518

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 (204) hide show
  1. package/README.md +27 -0
  2. package/lib/cjs/common/Constants.js +9 -0
  3. package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
  4. package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
  5. package/lib/cjs/common/telemetry/TelemetryConstants.js +49 -2
  6. package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
  7. package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +29 -13
  8. package/lib/cjs/common/utils/SecureEventBus.js +307 -0
  9. package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
  10. package/lib/cjs/common/utils.js +14 -1
  11. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
  12. package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
  13. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +218 -0
  14. package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
  15. package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  16. package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
  17. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
  18. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
  19. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  20. package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
  21. package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +290 -0
  22. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  23. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +17 -0
  24. package/lib/cjs/components/livechatwidget/common/endChat.js +54 -12
  25. package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  26. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
  27. package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
  28. package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  29. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  30. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  31. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  32. package/lib/cjs/components/livechatwidget/common/startChat.js +10 -5
  33. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
  34. package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
  35. package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  36. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +152 -33
  37. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +37 -8
  38. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
  39. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +135 -26
  40. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  41. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  42. package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
  43. package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
  44. package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +103 -0
  45. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
  46. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
  47. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  48. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
  49. package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
  50. package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +57 -0
  51. package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  52. package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  53. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +121 -0
  54. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
  55. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1058 -0
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
  60. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  61. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
  62. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  63. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
  64. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
  65. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
  66. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
  67. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +102 -30
  68. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
  69. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  70. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +47 -45
  71. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
  72. package/lib/cjs/contexts/createReducer.js +30 -0
  73. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  74. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  75. package/lib/cjs/index.js +9 -1
  76. package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
  77. package/lib/esm/common/Constants.js +9 -0
  78. package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
  79. package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
  80. package/lib/esm/common/telemetry/TelemetryConstants.js +47 -1
  81. package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
  82. package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +30 -14
  83. package/lib/esm/common/utils/SecureEventBus.js +328 -0
  84. package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
  85. package/lib/esm/common/utils.js +11 -0
  86. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
  87. package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
  88. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +207 -0
  89. package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
  90. package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  91. package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
  92. package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
  93. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
  94. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  95. package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
  96. package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +283 -0
  97. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  98. package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +10 -0
  99. package/lib/esm/components/livechatwidget/common/endChat.js +55 -13
  100. package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  101. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
  102. package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
  103. package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  104. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  105. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  106. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  107. package/lib/esm/components/livechatwidget/common/startChat.js +12 -7
  108. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
  109. package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
  110. package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
  111. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +153 -34
  112. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +39 -10
  113. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
  114. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +135 -27
  115. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  116. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  117. package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
  118. package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
  119. package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +96 -0
  120. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
  121. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
  122. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  123. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
  124. package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
  125. package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +49 -0
  126. package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  127. package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  128. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +114 -0
  129. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
  130. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
  131. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1080 -0
  132. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
  133. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
  134. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
  135. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  136. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
  137. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  138. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
  139. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
  140. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
  141. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
  142. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +103 -30
  143. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
  144. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  145. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +47 -45
  146. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
  147. package/lib/esm/contexts/createReducer.js +30 -0
  148. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  149. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  150. package/lib/esm/index.js +1 -0
  151. package/lib/esm/plugins/newMessageEventHandler.js +4 -1
  152. package/lib/types/common/Constants.d.ts +8 -0
  153. package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
  154. package/lib/types/common/telemetry/TelemetryConstants.d.ts +44 -2
  155. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
  156. package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
  157. package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
  158. package/lib/types/common/utils.d.ts +9 -1
  159. package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
  160. package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
  161. package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
  162. package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
  163. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
  164. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
  165. package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
  166. package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
  167. package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
  168. package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
  169. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
  170. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
  171. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
  172. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -1
  173. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
  174. package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +11 -0
  175. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
  176. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
  177. package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
  178. package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
  179. package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
  180. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
  181. package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
  182. package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
  183. package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
  184. package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
  185. package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +6 -0
  186. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
  187. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
  188. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
  189. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
  190. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
  191. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
  192. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
  193. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
  194. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
  195. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
  196. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
  197. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  198. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
  199. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +47 -45
  200. package/lib/types/index.d.ts +1 -0
  201. package/package.json +3 -3
  202. /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  203. /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  204. /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
@@ -10,49 +10,51 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
10
10
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
11
11
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
12
12
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MIDDLEWARE_LOCALIZED_TEXTS"] = 2] = "SET_MIDDLEWARE_LOCALIZED_TEXTS";
13
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 3] = "SET_GLOBAL_DIR";
14
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
15
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
16
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
17
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
18
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 8] = "SET_START_CHAT_FAILURE_TYPE";
19
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 9] = "SET_OUTSIDE_OPERATING_HOURS";
20
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 10] = "SET_PRE_CHAT_SURVEY_RESPONSE";
21
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 11] = "SET_CUSTOM_CONTEXT";
22
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 12] = "SET_SHOW_CONFIRMATION";
23
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 13] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
24
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 14] = "SET_PRECHAT_RESPONSE_EMAIL";
25
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 15] = "SET_AUDIO_NOTIFICATION";
26
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 16] = "SET_E2VV_ENABLED";
27
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 17] = "SET_POST_CHAT_CONTEXT";
28
- LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 18] = "SHOW_CALLING_CONTAINER";
29
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 19] = "SET_INCOMING_CALL";
30
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 20] = "DISABLE_VIDEO_CALL";
31
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 21] = "DISABLE_LOCAL_VIDEO";
32
- LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 22] = "DISABLE_REMOTE_VIDEO";
33
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 23] = "SET_CHAT_TOKEN";
34
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 24] = "SET_START_CHAT_BUTTON_DISPLAY";
35
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 25] = "SET_PROACTIVE_CHAT_PARAMS";
36
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 26] = "SET_TELEMETRY_DATA";
37
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 27] = "SET_RECONNECT_ID";
38
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 28] = "SET_UNREAD_MESSAGE_COUNT";
39
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 29] = "SET_FOCUS_CHAT_BUTTON";
40
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 30] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
41
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 31] = "SET_CONVERSATION_ENDED_BY";
42
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 32] = "SET_WIDGET_STATE";
43
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 33] = "SET_LIVE_CHAT_CONTEXT";
44
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 34] = "SET_BOT_OAUTH_SIGNIN_ID";
45
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 35] = "SET_WIDGET_SIZE";
46
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 36] = "SET_WIDGET_INSTANCE_ID";
47
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 37] = "SET_LIVE_CHAT_CONFIG";
48
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 38] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
49
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 39] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
50
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 40] = "SET_SHOULD_USE_BOT_SURVEY";
51
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 41] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
52
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
53
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
54
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
55
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 45] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
56
- LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 46] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
57
- LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 47] = "GET_IN_MEMORY_STATE";
13
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CITATIONS"] = 3] = "SET_CITATIONS";
14
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 4] = "SET_GLOBAL_DIR";
15
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 5] = "SET_MINIMIZED";
16
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 6] = "SET_CONVERSATION_STATE";
17
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 7] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
18
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 8] = "SET_START_CHAT_FAILING";
19
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 9] = "SET_START_CHAT_FAILURE_TYPE";
20
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 10] = "SET_OUTSIDE_OPERATING_HOURS";
21
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 11] = "SET_PRE_CHAT_SURVEY_RESPONSE";
22
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 12] = "SET_CUSTOM_CONTEXT";
23
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 13] = "SET_SHOW_CONFIRMATION";
24
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 14] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
25
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 15] = "SET_PRECHAT_RESPONSE_EMAIL";
26
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 16] = "SET_AUDIO_NOTIFICATION";
27
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 17] = "SET_E2VV_ENABLED";
28
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 18] = "SET_POST_CHAT_CONTEXT";
29
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 19] = "SHOW_CALLING_CONTAINER";
30
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 20] = "SET_INCOMING_CALL";
31
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 21] = "DISABLE_VIDEO_CALL";
32
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 22] = "DISABLE_LOCAL_VIDEO";
33
+ LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 23] = "DISABLE_REMOTE_VIDEO";
34
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 24] = "SET_CHAT_TOKEN";
35
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 25] = "SET_START_CHAT_BUTTON_DISPLAY";
36
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 26] = "SET_PROACTIVE_CHAT_PARAMS";
37
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 27] = "SET_TELEMETRY_DATA";
38
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 28] = "SET_RECONNECT_ID";
39
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 29] = "SET_UNREAD_MESSAGE_COUNT";
40
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 30] = "SET_FOCUS_CHAT_BUTTON";
41
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 31] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 32] = "SET_CONVERSATION_ENDED_BY";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 33] = "SET_WIDGET_STATE";
44
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 34] = "SET_LIVE_CHAT_CONTEXT";
45
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 35] = "SET_BOT_OAUTH_SIGNIN_ID";
46
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 36] = "SET_WIDGET_SIZE";
47
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 37] = "SET_WIDGET_INSTANCE_ID";
48
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 38] = "SET_LIVE_CHAT_CONFIG";
49
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 39] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
50
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 40] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
51
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 41] = "SET_SHOULD_USE_BOT_SURVEY";
52
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 42] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
53
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 43] = "SET_SURVEY_MODE";
54
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 44] = "SET_CONFIRMATION_STATE";
55
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 45] = "SET_POST_CHAT_PARTICIPANT_TYPE";
56
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
57
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
58
+ LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
59
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_AVATAR_INITIALS"] = 49] = "SET_BOT_AVATAR_INITIALS";
58
60
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
@@ -10,6 +10,7 @@ var _ConversationState = require("./ConversationState");
10
10
  var _StartChatFailureType = require("./StartChatFailureType");
11
11
  var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
12
12
  var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
13
+ var _defaultWebChatStyles = require("../../components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles");
13
14
  const getLiveChatWidgetContextInitialState = props => {
14
15
  var _props$controlProps, _props$webChatContain;
15
16
  const isOutsideOperatingHours = () => {
@@ -39,12 +40,18 @@ const getLiveChatWidgetContextInitialState = props => {
39
40
  initialStateFromCache.domainStates.liveChatConfig = props.chatConfig;
40
41
  // Cache the result of isOutsideOperatingHours() to ensure consistency
41
42
  initialStateFromCache.appStates.outsideOperatingHours = outsideOperatingHours;
43
+ // Backward compatibility: if botAvatarInitials not cached (older sessions), seed with default
44
+ if (!initialStateFromCache.domainStates.botAvatarInitials) {
45
+ initialStateFromCache.domainStates.botAvatarInitials = _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials;
46
+ }
42
47
  return initialStateFromCache;
43
48
  }
44
49
  const LiveChatWidgetContextInitialState = {
45
50
  domainStates: {
46
51
  liveChatConfig: props.chatConfig,
47
52
  widgetElementId: "",
53
+ // Map of citation id => content injected by citations middleware
54
+ citations: {},
48
55
  renderingMiddlewareProps: (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.renderingMiddlewareProps,
49
56
  middlewareLocalizedTexts: _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
50
57
  preChatSurveyResponse: "{}",
@@ -60,7 +67,8 @@ const getLiveChatWidgetContextInitialState = props => {
60
67
  transcriptRequestId: "",
61
68
  confirmationPaneConfirmedOptionClicked: false,
62
69
  confirmationState: _Constants.ConfirmationState.NotSet,
63
- startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic
70
+ startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic,
71
+ botAvatarInitials: _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials
64
72
  },
65
73
  appStates: {
66
74
  conversationState: _ConversationState.ConversationState.Closed,
@@ -70,6 +70,21 @@ const reducer = (state, action) => {
70
70
  middlewareLocalizedTexts: action.payload
71
71
  }
72
72
  };
73
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS:
74
+ inMemory = {
75
+ ...inMemory,
76
+ domainStates: {
77
+ ...inMemory.domainStates,
78
+ citations: action.payload
79
+ }
80
+ };
81
+ return {
82
+ ...state,
83
+ domainStates: {
84
+ ...state.domainStates,
85
+ citations: action.payload
86
+ }
87
+ };
73
88
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_GLOBAL_DIR:
74
89
  inMemory = {
75
90
  ...inMemory,
@@ -547,6 +562,21 @@ const reducer = (state, action) => {
547
562
  widgetSize: action.payload
548
563
  }
549
564
  };
565
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_BOT_AVATAR_INITIALS:
566
+ inMemory = {
567
+ ...inMemory,
568
+ domainStates: {
569
+ ...inMemory.domainStates,
570
+ botAvatarInitials: action.payload
571
+ }
572
+ };
573
+ return {
574
+ ...state,
575
+ domainStates: {
576
+ ...state.domainStates,
577
+ botAvatarInitials: action.payload
578
+ }
579
+ };
550
580
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
551
581
  inMemory = {
552
582
  ...inMemory,
@@ -36,7 +36,7 @@ const createTrackingForFirstMessage = () => {
36
36
  * Starts tracking the time for the first bot message after widget loads.
37
37
  * Sets a 5-second timeout to auto-reset if no bot message is received.
38
38
  */
39
- const widgetLoadListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.WidgetLoadComplete).subscribe(() => {
39
+ const widgetLoadListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.TelemetryEvent.StartChatComplete).subscribe(() => {
40
40
  if (isTracking) return;
41
41
  isTracking = true;
42
42
  startTime = new Date().getTime();
@@ -91,7 +91,8 @@ const createTrackingForFirstMessage = () => {
91
91
  CustomProperties: {
92
92
  elapsedTime,
93
93
  widgetLoadedAt: startTime,
94
- botMessage: stopTrackingMessage
94
+ botMessage: stopTrackingMessage,
95
+ type: payload === null || payload === void 0 ? void 0 : payload.type
95
96
  }
96
97
  });
97
98
  disconnectListener();
@@ -7,6 +7,7 @@ exports.FirstResponseLatencyTracker = void 0;
7
7
  var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
8
8
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
9
9
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
10
+ var _Constants = require("../common/Constants");
10
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
12
  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
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -133,7 +134,8 @@ let FirstResponseLatencyTracker = /*#__PURE__*/function () {
133
134
  CustomProperties: {
134
135
  elapsedTime,
135
136
  userMessage: this.startTrackingMessage,
136
- botMessage: this.stopTrackingMessage
137
+ botMessage: this.stopTrackingMessage,
138
+ type: payload === null || payload === void 0 ? void 0 : payload.type
137
139
  }
138
140
  });
139
141
  }
@@ -174,7 +176,9 @@ let FirstResponseLatencyTracker = /*#__PURE__*/function () {
174
176
  value: function stopClock(payload) {
175
177
  try {
176
178
  if (!payload || !payload.Id) {
177
- throw new Error("Invalid payload");
179
+ if ((payload === null || payload === void 0 ? void 0 : payload.type) !== _Constants.Constants.typing) {
180
+ throw new Error("Invalid payload");
181
+ }
178
182
  }
179
183
 
180
184
  // Only allow stopTracking if sender is valid and tracking is active
package/lib/cjs/index.js CHANGED
@@ -14,7 +14,8 @@ var _exportNames = {
14
14
  useChatSDKStore: true,
15
15
  useFacadeChatSDKStore: true,
16
16
  LiveChatWidget: true,
17
- getMockChatSDKIfApplicable: true
17
+ getMockChatSDKIfApplicable: true,
18
+ LiveChatWidgetMockType: true
18
19
  };
19
20
  Object.defineProperty(exports, "BroadcastService", {
20
21
  enumerable: true,
@@ -34,6 +35,12 @@ Object.defineProperty(exports, "LiveChatWidget", {
34
35
  return _LiveChatWidget.default;
35
36
  }
36
37
  });
38
+ Object.defineProperty(exports, "LiveChatWidgetMockType", {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _IMockProps.LiveChatWidgetMockType;
42
+ }
43
+ });
37
44
  Object.defineProperty(exports, "decodeComponentString", {
38
45
  enumerable: true,
39
46
  get: function () {
@@ -90,6 +97,7 @@ var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore")
90
97
  var _useFacadeChatSDKStore = _interopRequireDefault(require("./hooks/useFacadeChatSDKStore"));
91
98
  var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
92
99
  var _getMockChatSDKIfApplicable = require("./components/livechatwidget/common/getMockChatSDKIfApplicable");
100
+ var _IMockProps = require("./components/livechatwidget/interfaces/IMockProps");
93
101
  var _renderingmiddlewares = require("./components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares");
94
102
  Object.keys(_renderingmiddlewares).forEach(function (key) {
95
103
  if (key === "default" || key === "__esModule") return;
@@ -84,6 +84,9 @@ const createOnNewAdapterActivityHandler = (chatId, userId, startTime) => {
84
84
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
85
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
86
86
  if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
87
+ if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants2.Constants.typing) {
88
+ return true;
89
+ }
87
90
  return false;
88
91
  }
89
92
  return true;
@@ -112,7 +115,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId, startTime) => {
112
115
  });
113
116
  };
114
117
  const raiseMessageEvent = activity => {
115
- if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants2.Constants.message) {
118
+ if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants2.Constants.message || (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants2.Constants.typing) {
116
119
  const scenarioType = (0, _util.getScenarioType)(activity);
117
120
  switch (scenarioType) {
118
121
  case _Constants.ScenarioType.UserSendMessageStrategy:
@@ -38,6 +38,10 @@ _defineProperty(Constants, "botParticipantTypeTag", "Bot");
38
38
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
39
39
  _defineProperty(Constants, "ChannelId", "lcw");
40
40
  _defineProperty(Constants, "CustomerTag", "FromCustomer");
41
+ // LCW only tags (Only applicable on client-side for additional processing, not recognized by service)
42
+ _defineProperty(Constants, "persistentChatHistoryMessageTag", "PersistentChatHistory");
43
+ _defineProperty(Constants, "persistentChatHistoryMessagePullTriggerTag", "PersistentChatHistoryMessagePullTrigger");
44
+ _defineProperty(Constants, "conversationDividerTag", "ConversationDivider");
41
45
  // gifUploadMiddleware
42
46
  _defineProperty(Constants, "GifContentType", "image/gif");
43
47
  // htmlPlayerMiddleware
@@ -57,6 +61,7 @@ _defineProperty(Constants, "queuePositionMessageTag", "queueposition");
57
61
  _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
58
62
  _defineProperty(Constants, "message", "message");
59
63
  _defineProperty(Constants, "hiddenTag", "Hidden");
64
+ _defineProperty(Constants, "typing", "typing");
60
65
  // messageTimestampMiddleware
61
66
  _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
62
67
  _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
@@ -131,6 +136,7 @@ _defineProperty(Constants, "customEventName", "customEventName");
131
136
  _defineProperty(Constants, "customEventValue", "customEventValue");
132
137
  _defineProperty(Constants, "Hidden", "Hidden");
133
138
  _defineProperty(Constants, "EndConversationDueToOverflow", "endconversationduetooverflow");
139
+ _defineProperty(Constants, "SkipSessionCloseForPersistentChatFlag", "skipSessionCloseForPersistentChat");
134
140
  export const Regex = (_class = /*#__PURE__*/_createClass(function Regex() {
135
141
  _classCallCheck(this, Regex);
136
142
  }), _defineProperty(_class, "EmailRegex", "^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\])$"), _class);
@@ -184,6 +190,8 @@ _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
184
190
  _defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
185
191
  _defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
186
192
  _defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-actionSet");
193
+ _defineProperty(HtmlAttributeNames, "ocwCitationPaneClassName", "ocw-citation-pane");
194
+ _defineProperty(HtmlAttributeNames, "ocwCitationPaneTitle", "Citation");
187
195
  export let WebChatMiddlewareConstants = /*#__PURE__*/_createClass(function WebChatMiddlewareConstants() {
188
196
  _classCallCheck(this, WebChatMiddlewareConstants);
189
197
  });
@@ -338,6 +346,7 @@ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedBy", "Conv
338
346
  _defineProperty(PrepareEndChatDescriptionConstants, "PrepareEndChatError", "There's an error while preparing to end chat. Closing chat widget.");
339
347
  _defineProperty(PrepareEndChatDescriptionConstants, "WidgetLoadFailedAfterSessionInit", "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.");
340
348
  _defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceived", "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.");
349
+ _defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceivedActiveChat", "Received InitiateEndChat BroadcastEvent while conversation state is Active. Updating conversation states.");
341
350
  _defineProperty(PrepareEndChatDescriptionConstants, "EndChatReceivedFromOtherTabs", "Received EndChat BroadcastEvent from other tabs. Closing this chat.");
342
351
  _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseChatOnFailureOrPostChat", "Customer is trying to close chat widget on start chat failure or post chat pane.");
343
352
  _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseInactiveChat", "Chat was Inactive and customer is trying to close chat widget or refreshing the page.");
@@ -481,6 +481,12 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
481
481
  reconnectableChatsParams.authenticatedUserToken = this.token;
482
482
  return this.validateAndExecuteCall("getReconnectableChats", () => this.chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams));
483
483
  }
484
+ }, {
485
+ key: "fetchPersistentConversationHistory",
486
+ value: async function fetchPersistentConversationHistory() {
487
+ let getPersistentChatHistoryOptionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
488
+ return this.validateAndExecuteCall("getPersistentChatHistory", () => this.chatSDK.getPersistentChatHistory(getPersistentChatHistoryOptionalParams));
489
+ }
484
490
  }]);
485
491
  return FacadeChatSDK;
486
492
  }();
@@ -1,10 +1,10 @@
1
1
  export const AppInsightsEventMapping = {
2
2
  "LCWChatButtonClicked": "LCWChatButtonActionStarted",
3
- "WidgetLoadStarted": "WidgetStartChatStarted",
4
- "WidgetLoadComplete": "WidgetStartChatCompleted",
5
- "WidgetLoadFailed": "WidgetStartChatFailed",
6
- "PrechatSubmitted": "PrechatSubmitCompleted",
7
- "StartChatEventRecevied": "StartChatEventReceivedCompleted",
3
+ "UXLCWChatButtonLoadingStart": "LiveChatWidgetChatButtonLoadingStarted",
4
+ "UXLCWChatButtonLoadingCompleted": "LiveChatWidgetChatButtonLoadingCompleted",
5
+ "UXPrechatPaneStart": "PrechatSurveyStarted",
6
+ "UXPrechatPaneCompleted": "PrechatSurveyCompleted",
7
+ "PrechatSubmitted": "PrechatSurveySubmitCompleted",
8
8
  "EndChatEventReceived": "EndChatEventReceivedCompleted",
9
9
  "EmailTranscriptSent": "EmailTranscriptActionCompleted",
10
10
  "EmailTranscriptFailed": "EmailTranscriptActionFailed",
@@ -12,13 +12,18 @@ export const AppInsightsEventMapping = {
12
12
  "HeaderMinimizeButtonClicked": "MinimizeChatActionStarted",
13
13
  "DownloadTranscriptButtonClicked": "DownloadTranscriptActionStarted",
14
14
  "EmailTranscriptButtonClicked": "EmailTranscriptButtonActionStarted",
15
- "CustomerVoiceFormResponseSubmitted": "CustomerVoiceFormResponseSubmitCompleted",
16
- "StartProactiveChatEventReceived": "StartProactiveChatEventReceivedCompleted",
17
15
  "ProactiveChatRejected": "ProactiveChatTimeOutCompleted",
18
16
  "MessageSent": "MessageSentCompleted",
19
17
  "MessageReceived": "MessageReceivedCompleted",
20
18
  "SystemMessageReceived": "SystemMessageReceivedCompleted",
21
- "RehydrateMessageReceived": "RehydrateMessageReceivedCompleted",
19
+ "RehydrateMessageReceived": "ChatHistoryMessageReceivedCompleted",
22
20
  "CustomContextReceived": "CustomContextReceivedCompleted",
23
- "PostChatContextCallSucceed": "PostChatContextCallCompleted"
21
+ "NewTokenValidationStarted": "AuthTokenValidationStarted",
22
+ "NewTokenValidationCompleted": "AuthTokenValidationCompleted",
23
+ "NewTokenValidationFailed": "AuthTokenValidationFailed",
24
+ "UXPostChatPaneStarted": "PostChatSurveyStarted",
25
+ "UXPostChatPaneCompleted": "PostChatSurveyCompleted",
26
+ "WidgetLoadStarted": "ChatSessionInitializationStarted",
27
+ "WidgetLoadComplete": "ChatSessionInitializationCompleted",
28
+ "WidgetLoadFailed": "ChatSessionInitializationFailed"
24
29
  };
@@ -68,9 +68,11 @@ export let BroadcastEvent;
68
68
  BroadcastEvent["OnWidgetError"] = "OnWidgetError";
69
69
  BroadcastEvent["FMLTrackingCompletedAck"] = "FMLTrackingCompletedAck";
70
70
  BroadcastEvent["FMLTrackingCompleted"] = "FMLTrackingCompleted";
71
+ BroadcastEvent["PersistentConversationReset"] = "PersistentConversationReset";
71
72
  })(BroadcastEvent || (BroadcastEvent = {}));
72
73
  export let TelemetryEvent;
73
74
  (function (TelemetryEvent) {
75
+ TelemetryEvent["FetchPersistentChatHistoryFailed"] = "FetchPersistentChatHistoryFailed";
74
76
  TelemetryEvent["CallAdded"] = "CallAdded";
75
77
  TelemetryEvent["LocalVideoStreamAdded"] = "LocalVideoStreamAdded";
76
78
  TelemetryEvent["LocalVideoStreamRemoved"] = "LocalVideoStreamRemoved";
@@ -116,6 +118,7 @@ export let TelemetryEvent;
116
118
  TelemetryEvent["EndChatFailed"] = "EndChatFailed";
117
119
  TelemetryEvent["SettingCustomContext"] = "SettingCustomContext";
118
120
  TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
121
+ TelemetryEvent["PersistentChatHistoryEnabled"] = "PersistentChatHistoryEnabled";
119
122
  TelemetryEvent["LCWChatButtonActionCompleted"] = "LCWChatButtonActionCompleted";
120
123
  TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
121
124
  TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
@@ -148,6 +151,7 @@ export let TelemetryEvent;
148
151
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
149
152
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
150
153
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
154
+ TelemetryEvent["CitationPaneLoaded"] = "CitationPaneLoaded";
151
155
  TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
152
156
  TelemetryEvent["ReconnectChatPaneLoaded"] = "ReconnectChatPaneLoaded";
153
157
  TelemetryEvent["HeaderCloseButtonClicked"] = "HeaderCloseButtonClicked";
@@ -274,11 +278,44 @@ export let TelemetryEvent;
274
278
  TelemetryEvent["UXLCWChatButtonLoadingStart"] = "UXLCWChatButtonLoadingStart";
275
279
  TelemetryEvent["UXLCWChatButtonLoadingCompleted"] = "UXLCWChatButtonLoadingCompleted";
276
280
  TelemetryEvent["UXConfirmationPaneStart"] = "UXConfirmationPaneStart";
281
+ TelemetryEvent["UXCitationPaneStart"] = "UXCitationPaneStart";
277
282
  TelemetryEvent["UXConfirmationPaneCompleted"] = "UXConfirmationPaneCompleted";
283
+ TelemetryEvent["UXCitationPaneCompleted"] = "UXCitationPaneCompleted";
278
284
  TelemetryEvent["UXLiveChatWidgetStart"] = "UXLiveChatWidgetStart";
279
285
  TelemetryEvent["UXLiveChatWidgetCompleted"] = "UXLiveChatWidgetCompleted";
286
+ TelemetryEvent["UXPostChatPaneStarted"] = "UXPostChatPaneStarted";
287
+ TelemetryEvent["UXPostChatPaneCompleted"] = "UXPostChatPaneCompleted";
280
288
  TelemetryEvent["AppInsightsInitialized"] = "AppInsightsInitialized";
281
289
  TelemetryEvent["AppInsightsInitFailed"] = "AppInsightsInitFailed";
290
+ TelemetryEvent["ConvertPersistentChatHistoryMessageToActivityFailed"] = "ConvertPersistentChatHistoryMessageToActivityFailed";
291
+ TelemetryEvent["UXLCWPersistentChatHistoryInitialized"] = "UXLCWPersistentChatHistoryInitialized";
292
+ TelemetryEvent["LCWPersistentChatHistoryFetchStarted"] = "LCWPersistentChatHistoryFetchStarted";
293
+ TelemetryEvent["LCWPersistentChatHistoryFetchCompleted"] = "LCWPersistentChatHistoryFetchCompleted";
294
+ TelemetryEvent["LCWPersistentChatHistoryFetchFailed"] = "LCWPersistentChatHistoryFetchFailed";
295
+ TelemetryEvent["LCWWebChatStorePollingStarted"] = "LCWWebChatStorePollingStarted";
296
+ TelemetryEvent["LCWWebChatStoreReady"] = "LCWWebChatStoreReady";
297
+ TelemetryEvent["LCWWebChatConnected"] = "LCWWebChatConnected";
298
+ TelemetryEvent["LCWWebChatDisconnected"] = "LCWWebChatDisconnected";
299
+ TelemetryEvent["LCWWebChatConnectionCheckFailed"] = "LCWWebChatConnectionCheckFailed";
300
+ TelemetryEvent["LCWPersistentConversationHandlerInitialized"] = "LCWPersistentConversationHandlerInitialized";
301
+ TelemetryEvent["LCWPersistentHistoryPullBlocked"] = "LCWPersistentHistoryPullBlocked";
302
+ TelemetryEvent["LCWPersistentHistoryPullCompleted"] = "LCWPersistentHistoryPullCompleted";
303
+ TelemetryEvent["LCWPersistentHistoryReturnedNull"] = "LCWPersistentHistoryReturnedNull";
304
+ TelemetryEvent["LCWLazyLoadInitializationStarted"] = "LCWLazyLoadInitializationStarted";
305
+ TelemetryEvent["LCWLazyLoadContainerNotFound"] = "LCWLazyLoadContainerNotFound";
306
+ TelemetryEvent["LCWLazyLoadInitializationCompleted"] = "LCWLazyLoadInitializationCompleted";
307
+ TelemetryEvent["LCWLazyLoadSessionMetrics"] = "LCWLazyLoadSessionMetrics";
308
+ TelemetryEvent["LCWLazyLoadTargetElementNotFound"] = "LCWLazyLoadTargetElementNotFound";
309
+ TelemetryEvent["LCWLazyLoadScrollFailed"] = "LCWLazyLoadScrollFailed";
310
+ TelemetryEvent["LCWLazyLoadActivityMounted"] = "LCWLazyLoadActivityMounted";
311
+ TelemetryEvent["LCWLazyLoadReset"] = "LCWLazyLoadReset";
312
+ TelemetryEvent["LCWLazyLoadNoMoreHistory"] = "LCWLazyLoadNoMoreHistory";
313
+ TelemetryEvent["LCWLazyLoadHistoryError"] = "LCWLazyLoadHistoryError";
314
+ TelemetryEvent["LCWLazyLoadDestroyed"] = "LCWLazyLoadDestroyed";
315
+ TelemetryEvent["SecureEventBusUnauthorizedDispatch"] = "SecureEventBusUnauthorizedDispatch";
316
+ TelemetryEvent["SecureEventBusListenerError"] = "SecureEventBusListenerError";
317
+ TelemetryEvent["SecureEventBusDispatchError"] = "SecureEventBusDispatchError";
318
+ TelemetryEvent["StartChatComplete"] = "StartChatComplete";
282
319
  })(TelemetryEvent || (TelemetryEvent = {}));
283
320
  export let TelemetryConstants = /*#__PURE__*/function () {
284
321
  function TelemetryConstants() {
@@ -346,6 +383,9 @@ export let TelemetryConstants = /*#__PURE__*/function () {
346
383
  case TelemetryEvent.PostChatWorkflowFromAgent:
347
384
  case TelemetryEvent.PostChatWorkflowFromBot:
348
385
  case TelemetryEvent.AppStatesException:
386
+ case TelemetryEvent.SecureEventBusUnauthorizedDispatch:
387
+ case TelemetryEvent.SecureEventBusListenerError:
388
+ case TelemetryEvent.SecureEventBusDispatchError:
349
389
  return ScenarioType.ACTIONS;
350
390
  case TelemetryEvent.StartChatSDKCall:
351
391
  case TelemetryEvent.StartChatEventReceived:
@@ -405,4 +445,10 @@ export let TelemetryConstants = /*#__PURE__*/function () {
405
445
  }
406
446
  }]);
407
447
  return TelemetryConstants;
408
- }();
448
+ }();
449
+ export let ConversationStage;
450
+ (function (ConversationStage) {
451
+ ConversationStage["Initialization"] = "Initialization";
452
+ ConversationStage["CSREngagement"] = "CSR Engagement";
453
+ ConversationStage["ConversationEnd"] = "Conversation End";
454
+ })(ConversationStage || (ConversationStage = {}));
@@ -41,7 +41,7 @@ export const RegisterLoggers = () => {
41
41
  loggers.push(consoleLogger());
42
42
  }
43
43
  if (((_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : (_TelemetryManager$Int10 = _TelemetryManager$Int9.telemetryConfig) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.telemetryDisabled) === false) {
44
- var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23;
44
+ var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23, _TelemetryManager$Int24, _TelemetryManager$Int25, _TelemetryManager$Int26;
45
45
  if ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int11 !== void 0 && _TelemetryManager$Int11.ariaConfig) {
46
46
  var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17, _TelemetryManager$Int18, _TelemetryManager$Int19;
47
47
  loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : (_TelemetryManager$Int13 = _TelemetryManager$Int12.ariaConfig) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.ariaTelemetryKey) ?? defaultAriaConfig.ariaTelemetryKey, ((_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : (_TelemetryManager$Int15 = _TelemetryManager$Int14.ariaConfig) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.disableCookieUsage) ?? defaultAriaConfig.disableCookieUsage, ((_TelemetryManager$Int16 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : (_TelemetryManager$Int17 = _TelemetryManager$Int16.ariaConfig) === null || _TelemetryManager$Int17 === void 0 ? void 0 : _TelemetryManager$Int17.collectorUriForTelemetry) ?? defaultAriaConfig.collectorUriForTelemetry, ((_TelemetryManager$Int18 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int18 === void 0 ? void 0 : (_TelemetryManager$Int19 = _TelemetryManager$Int18.ariaConfig) === null || _TelemetryManager$Int19 === void 0 ? void 0 : _TelemetryManager$Int19.ariaTelemetryApplicationName) ?? defaultAriaConfig.ariaTelemetryApplicationName));
@@ -52,12 +52,15 @@ export const RegisterLoggers = () => {
52
52
  loggers.push(logger);
53
53
  });
54
54
  }
55
- if (((_TelemetryManager$Int22 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int22 === void 0 ? void 0 : (_TelemetryManager$Int23 = _TelemetryManager$Int22.appInsightsConfig) === null || _TelemetryManager$Int23 === void 0 ? void 0 : _TelemetryManager$Int23.appInsightsDisabled) === false) {
56
- var _TelemetryManager$Int24;
57
- if ((_TelemetryManager$Int24 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int24 !== void 0 && _TelemetryManager$Int24.appInsightsConfig.appInsightsKey) {
58
- var _TelemetryManager$Int25;
59
- loggers.push(appInsightsLogger((_TelemetryManager$Int25 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int25 === void 0 ? void 0 : _TelemetryManager$Int25.appInsightsConfig.appInsightsKey));
60
- }
55
+ const chatConfigAppInsightsKey = (_TelemetryManager$Int22 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int22 === void 0 ? void 0 : _TelemetryManager$Int22.chatConfigAppInsightsKey;
56
+ const appInsightsKeyFromUser = (_TelemetryManager$Int23 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int23 === void 0 ? void 0 : (_TelemetryManager$Int24 = _TelemetryManager$Int23.appInsightsConfig) === null || _TelemetryManager$Int24 === void 0 ? void 0 : _TelemetryManager$Int24.appInsightsKey;
57
+ // when chatConfig has AppInsightsInstrumentationKey
58
+ if (chatConfigAppInsightsKey) {
59
+ loggers.push(appInsightsLogger(chatConfigAppInsightsKey));
60
+ }
61
+ // when key set through appInsightsConfig
62
+ else if (appInsightsKeyFromUser && ((_TelemetryManager$Int25 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int25 === void 0 ? void 0 : (_TelemetryManager$Int26 = _TelemetryManager$Int25.appInsightsConfig) === null || _TelemetryManager$Int26 === void 0 ? void 0 : _TelemetryManager$Int26.appInsightsDisabled) === false) {
63
+ loggers.push(appInsightsLogger(appInsightsKeyFromUser));
61
64
  }
62
65
  }
63
66
  };
@@ -1,19 +1,16 @@
1
- import { LogLevel, TelemetryEvent } from "../TelemetryConstants";
1
+ import { ConversationStage, LogLevel, TelemetryEvent } from "../TelemetryConstants";
2
2
  import ScenarioMarker from "../ScenarioMarker";
3
3
  import { TelemetryHelper } from "../TelemetryHelper";
4
4
  import { AppInsightsTelemetryMessage } from "../../Constants";
5
5
  import { AppInsightsEventMapping } from "../AppInsightsEvents";
6
6
  var AllowedKeys;
7
7
  (function (AllowedKeys) {
8
- AllowedKeys["LogLevel"] = "LogLevel";
9
- AllowedKeys["Description"] = "Description";
10
- AllowedKeys["ExceptionDetails"] = "ExceptionDetails";
11
- AllowedKeys["ChannelId"] = "ChannelId";
8
+ AllowedKeys["OrganizationId"] = "powerplatform.analytics.resource.organization.id";
9
+ AllowedKeys["ConversationId"] = "powerplatform.analytics.resource.id";
10
+ AllowedKeys["ElapsedTimeInMilliseconds"] = "Duration";
11
+ AllowedKeys["Description"] = "omnichannel.description";
12
+ AllowedKeys["ChannelId"] = "omnichannel.channel.type";
12
13
  AllowedKeys["LCWRuntimeId"] = "ClientSessionId";
13
- AllowedKeys["ConversationId"] = "LiveWorkItemId";
14
- AllowedKeys["ChatId"] = "ChatThreadId";
15
- AllowedKeys["OrganizationId"] = "OrganizationId";
16
- AllowedKeys["ElapsedTimeInMilliseconds"] = "DurationInMilliseconds";
17
14
  })(AllowedKeys || (AllowedKeys = {}));
18
15
  let initializationPromise = null;
19
16
  export const appInsightsLogger = appInsightsKey => {
@@ -86,11 +83,11 @@ export const appInsightsLogger = appInsightsKey => {
86
83
  if (!_logger) return;
87
84
  const eventName = telemetryInput === null || telemetryInput === void 0 ? void 0 : (_telemetryInput$paylo = telemetryInput.payload) === null || _telemetryInput$paylo === void 0 ? void 0 : _telemetryInput$paylo.Event;
88
85
  const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : (_telemetryInput$telem = telemetryInput.telemetryInfo) === null || _telemetryInput$telem === void 0 ? void 0 : _telemetryInput$telem.telemetryInfo;
89
- const eventProperties = setEventProperties(telemetryInfo);
90
86
  if (eventName) {
91
87
  const trackingEventName = getTrackingEventName(logLevel, eventName);
92
- _logger.trackEvent({
93
- name: trackingEventName,
88
+ const eventProperties = setEventProperties(trackingEventName, telemetryInfo);
89
+ _logger.trackTrace({
90
+ message: trackingEventName,
94
91
  properties: eventProperties
95
92
  });
96
93
  }
@@ -107,17 +104,36 @@ export const appInsightsLogger = appInsightsKey => {
107
104
  };
108
105
 
109
106
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
- function setEventProperties(telemetryInfo) {
107
+ function setEventProperties(eventName, telemetryInfo) {
111
108
  const eventProperties = {};
112
109
  if (telemetryInfo) {
113
110
  for (const key in AllowedKeys) {
114
- const finalKey = AllowedKeys[key]; // get renamed keys for LCWRuntimeId, ConversationId, ChatId
111
+ const finalKey = AllowedKeys[key]; // get renamed keys for LCWRuntimeId, ConversationId
115
112
  const value = telemetryInfo[key];
116
113
  if (value !== undefined && value !== null && value !== "") {
117
114
  eventProperties[finalKey] = value;
118
115
  }
119
116
  }
120
117
  }
118
+ // Include exception details in description for error events
119
+ if (telemetryInfo !== null && telemetryInfo !== void 0 && telemetryInfo.ExceptionDetails) {
120
+ eventProperties[AllowedKeys.Description] = JSON.stringify(telemetryInfo.ExceptionDetails);
121
+ }
122
+ const customProperties = (() => {
123
+ if (!(telemetryInfo !== null && telemetryInfo !== void 0 && telemetryInfo.CustomProperties)) {
124
+ return {};
125
+ }
126
+ try {
127
+ return typeof telemetryInfo.CustomProperties === "string" ? JSON.parse(telemetryInfo.CustomProperties) : telemetryInfo.CustomProperties;
128
+ } catch (error) {
129
+ console.warn("Failed to parse CustomProperties:", error);
130
+ return {};
131
+ }
132
+ })();
133
+ // Additional properties
134
+ eventProperties["ConversationStage"] = customProperties.ConversationStage ?? ConversationStage.CSREngagement;
135
+ eventProperties["Scenario"] = "Conversation Diagnostics";
136
+ eventProperties["powerplatform.analytics.subscenario"] = eventName.includes(": ") ? eventName.split(": ")[1] : eventName;
121
137
  return eventProperties;
122
138
  }
123
139
  function getTrackingEventName(logLevel, eventName) {