@microsoft/omnichannel-chat-widget 1.8.4-main.7bdb634 → 1.8.4-main.810d050

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 (168) hide show
  1. package/README.md +40 -3
  2. package/lib/cjs/common/Constants.js +8 -0
  3. package/lib/cjs/common/facades/FacadeChatSDK.js +235 -9
  4. package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
  5. package/lib/cjs/common/telemetry/TelemetryConstants.js +29 -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/xssUtils.js +23 -51
  9. package/lib/cjs/common/utils.js +106 -17
  10. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
  11. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +22 -2
  12. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +2 -1
  13. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +32 -13
  14. package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
  15. package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
  16. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +9 -1
  17. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
  18. package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +2 -1
  19. package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +34 -19
  20. package/lib/cjs/components/livechatwidget/common/authHelper.js +44 -4
  21. package/lib/cjs/components/livechatwidget/common/createAdapter.js +3 -2
  22. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +96 -5
  23. package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
  24. package/lib/cjs/components/livechatwidget/common/endChat.js +32 -9
  25. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +190 -2
  26. package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
  27. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  28. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  29. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  30. package/lib/cjs/components/livechatwidget/common/startChat.js +36 -15
  31. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
  32. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +245 -31
  33. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +15 -3
  34. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +38 -8
  35. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +76 -5
  36. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +2 -1
  37. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +0 -1
  38. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +165 -41
  39. package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +121 -14
  40. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +5 -1
  41. package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
  42. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +5 -1
  43. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
  44. package/lib/cjs/components/webchatcontainerstateful/common/utils/citationA11y.js +195 -0
  45. package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
  46. package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +19 -9
  48. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
  49. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +169 -156
  50. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +33 -9
  51. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  52. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +168 -0
  53. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  54. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
  55. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
  56. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -12
  57. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +81 -0
  58. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +29 -1
  59. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
  60. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +77 -11
  61. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
  62. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
  63. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +13 -2
  64. package/lib/cjs/contexts/createReducer.js +30 -0
  65. package/lib/cjs/controller/componentController.js +13 -1
  66. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  67. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  68. package/lib/cjs/plugins/newMessageEventHandler.js +24 -4
  69. package/lib/esm/common/Constants.js +8 -0
  70. package/lib/esm/common/facades/FacadeChatSDK.js +236 -10
  71. package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
  72. package/lib/esm/common/telemetry/TelemetryConstants.js +27 -1
  73. package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
  74. package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +30 -14
  75. package/lib/esm/common/utils/xssUtils.js +23 -51
  76. package/lib/esm/common/utils.js +99 -14
  77. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
  78. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +22 -2
  79. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +2 -1
  80. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +33 -14
  81. package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
  82. package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
  83. package/lib/esm/components/livechatwidget/LiveChatWidget.js +9 -1
  84. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
  85. package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +2 -1
  86. package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +34 -19
  87. package/lib/esm/components/livechatwidget/common/authHelper.js +44 -4
  88. package/lib/esm/components/livechatwidget/common/createAdapter.js +3 -2
  89. package/lib/esm/components/livechatwidget/common/createMarkdown.js +96 -5
  90. package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
  91. package/lib/esm/components/livechatwidget/common/endChat.js +32 -9
  92. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +190 -2
  93. package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
  94. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
  95. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
  96. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
  97. package/lib/esm/components/livechatwidget/common/startChat.js +38 -17
  98. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
  99. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +247 -33
  100. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +16 -4
  101. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +40 -10
  102. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +78 -7
  103. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +2 -1
  104. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -2
  105. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +166 -45
  106. package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +121 -14
  107. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +5 -1
  108. package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +2 -1
  109. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +5 -1
  110. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -2
  111. package/lib/esm/components/webchatcontainerstateful/common/utils/citationA11y.js +188 -0
  112. package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
  113. package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
  114. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +19 -9
  115. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
  116. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +169 -160
  117. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +30 -7
  118. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  119. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.js +160 -0
  120. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  121. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +8 -3
  122. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultTimestampRetryStyles.js +8 -1
  123. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -12
  124. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.js +74 -0
  125. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +29 -1
  126. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -0
  127. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
  128. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +77 -11
  129. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +55 -1
  130. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
  131. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +13 -2
  132. package/lib/esm/contexts/createReducer.js +30 -0
  133. package/lib/esm/controller/componentController.js +13 -1
  134. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
  135. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
  136. package/lib/esm/plugins/newMessageEventHandler.js +24 -4
  137. package/lib/types/common/Constants.d.ts +7 -0
  138. package/lib/types/common/facades/FacadeChatSDK.d.ts +29 -0
  139. package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +3 -1
  140. package/lib/types/common/telemetry/TelemetryConstants.d.ts +25 -2
  141. package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
  142. package/lib/types/common/utils/xssUtils.d.ts +5 -21
  143. package/lib/types/common/utils.d.ts +12 -2
  144. package/lib/types/components/errorboundary/ErrorBoundary.d.ts +1 -1
  145. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +1 -0
  146. package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +2 -1
  147. package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
  148. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
  149. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
  150. package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +1 -0
  151. package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +5 -1
  152. package/lib/types/components/webchatcontainerstateful/common/utils/citationA11y.d.ts +1 -0
  153. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +3 -0
  154. package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +7 -0
  155. package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
  156. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +7 -0
  157. package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +1 -2
  158. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +15 -39
  159. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +4 -1
  160. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AdaptiveCardAccessibilityWrapper.d.ts +18 -0
  161. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.d.ts +3 -0
  162. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentSentAnnouncementMiddleware.d.ts +12 -0
  163. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
  164. package/lib/types/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.d.ts +7 -0
  165. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  166. package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +22 -0
  167. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
  168. package/package.json +37 -9
package/README.md CHANGED
@@ -177,7 +177,7 @@ Header's and Footer's child components consist of three parts:
177
177
  1. "middleGroup" - adding child components in the middle of the Header/Footer
178
178
  1. "rightGroup" - adding child components at the right of the Header/Footer
179
179
 
180
- By default Header has the header icon and title on the left and minimize and close buttons on the right, and Footer has Download Transcript and Email Transcript buttons on the left and audio notification button on the right. These components can be overriden with [ComponentOverrides](#ComponentOverrides). In addition, other custom child components can be added to both Header and Footer by creating custom react nodes and adding them to attributes "leftGroup", "middleGroup" or "rightGroup" of "controlProps".
180
+ By default Header has the header icon and title on the left and minimize and close buttons on the right, and Footer has Download Transcript and Email Transcript buttons on the left and audio notification button on the right. These components can be overriden with [ComponentOverrides](#componentoverrides). In addition, other custom child components can be added to both Header and Footer by creating custom react nodes and adding them to attributes "leftGroup", "middleGroup" or "rightGroup" of "controlProps".
181
181
 
182
182
  ```js
183
183
  const buttonStyleProps: IButtonStyles = {
@@ -224,8 +224,10 @@ const customizedFooterProp: IFooterProps = {
224
224
  > :pushpin: Note that [WebChat hooks](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/HOOKS.md) can also be used in any custom components.
225
225
 
226
226
  #### Bidirectional Custom Events
227
+
227
228
  - Sending events from a hosting web page to bots/agents
228
- - Register a function to post event
229
+ - Register a function to post event
230
+
229
231
  ```js
230
232
  //define sendCustomEvent function
231
233
  const sendCustomEvent = (payload) => {
@@ -253,7 +255,9 @@ const customizedFooterProp: IFooterProps = {
253
255
  }
254
256
  })
255
257
  ```
256
- - Receiving events from bots/agents
258
+
259
+ - Receiving events from bots/agents
260
+
257
261
  ```js
258
262
  //define setOnCustomEvent function
259
263
  const setOnCustomEvent = (callback) => {
@@ -268,6 +272,38 @@ const customizedFooterProp: IFooterProps = {
268
272
  setOnCustomEvent((event) => console.log(event));
269
273
  ```
270
274
 
275
+ #### Trigger initiateEndChat event
276
+
277
+ Customer can trigger the initiateEndChat event via BroadcastService to end a chat session.
278
+ When needed, the payload below could be triggered:
279
+
280
+ ```js
281
+ const endChatEvent = {
282
+ eventName: "InitiateEndChat",
283
+ payload: {
284
+ skipSessionCloseForPersistentChat: true
285
+ } //optional payload
286
+ };
287
+ BroadcastService.postMessage(endChatEvent);
288
+ ```
289
+
290
+ The payload of the event is optional, only needed when force closing of a persistent chat session is not required.
291
+ When chat widget receives the event without any payload, it will:
292
+
293
+ 1. set the widget to closed state, the widget panel will be minimized. Post chat survey will not be displayed.
294
+ 2. trigger a sessionclose service network request to OmniChannel services.
295
+
296
+ If skipSessionCloseForPersistentChat is set to true. The session close network request will not be triggered, instead, if postChat survey is available, post chat survey will be displayed.
297
+
298
+ After successfully processed initiateEndChat event. The CloseChat event is broadcasted.
299
+
300
+ ```js
301
+ BroadcastService.getMessageByEventName("CloseChat").subscribe(async (msg) => {
302
+ console.log("close chat received: ", msg);
303
+ //more actions to unmount component and resources
304
+ })
305
+ ```
306
+
271
307
  ## See Also
272
308
 
273
309
  [Customizations Dev Guide](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/customizations/getstarted.md)\
@@ -275,6 +311,7 @@ const customizedFooterProp: IFooterProps = {
275
311
  [Create LiveChatWidget with Webpack5 and TypeScript](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/BuildingUsingWebpack5.md)\
276
312
  [Omnichannel Features](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Features.md)\
277
313
  [How to Add Visual Regression Tests](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/VisualRegressionTestingGuide.md)\
314
+ [Accessibility Tooling](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/accessibility/README.md)\
278
315
  [Security](https://github.com/microsoft/omnichannel-chat-widget/blob/main/SECURITY.md)\
279
316
  [Third Party Cookie Support](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Tpc.md)\
280
317
  [Storybook](https://microsoft.github.io/omnichannel-chat-widget/docs/storybook/)
@@ -68,6 +68,7 @@ _defineProperty(Constants, "queuePositionMessageTag", "queueposition");
68
68
  _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
69
69
  _defineProperty(Constants, "message", "message");
70
70
  _defineProperty(Constants, "hiddenTag", "Hidden");
71
+ _defineProperty(Constants, "typing", "typing");
71
72
  // messageTimestampMiddleware
72
73
  _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
73
74
  _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
@@ -81,6 +82,8 @@ _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|m
81
82
  _defineProperty(Constants, "videoMediaRegex", /(\.)(avchd|avi|flv|mpe|mpeg|mpg|mpv|mp4|m4p|m4v|mov|qt|swf|webm|wmv)$/i);
82
83
  _defineProperty(Constants, "chromeSupportedInlineMediaRegex", /(\.)(aac|mp3|wav|mp4)$/i);
83
84
  _defineProperty(Constants, "firefoxSupportedInlineMediaRegex", /(\.)(aac|flac|mp3|wav|mp4|mov)$/i);
85
+ _defineProperty(Constants, "AdaptiveCardType", "adaptivecard");
86
+ _defineProperty(Constants, "SuggestedActionsType", "suggestedactions");
84
87
  // calling container event names
85
88
  _defineProperty(Constants, "CallAdded", "callAdded");
86
89
  _defineProperty(Constants, "LocalVideoStreamAdded", "localVideoStreamAdded");
@@ -142,6 +145,10 @@ _defineProperty(Constants, "customEventName", "customEventName");
142
145
  _defineProperty(Constants, "customEventValue", "customEventValue");
143
146
  _defineProperty(Constants, "Hidden", "Hidden");
144
147
  _defineProperty(Constants, "EndConversationDueToOverflow", "endconversationduetooverflow");
148
+ _defineProperty(Constants, "SkipSessionCloseForPersistentChatFlag", "skipSessionCloseForPersistentChat");
149
+ // Minimum font-size for input fields to prevent iOS Safari auto-zoom on focus
150
+ _defineProperty(Constants, "minInputFontSizePx", 16);
151
+ _defineProperty(Constants, "minInputFontSize", "16px");
145
152
  const Regex = (_class = /*#__PURE__*/_createClass(function Regex() {
146
153
  _classCallCheck(this, Regex);
147
154
  }), _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);
@@ -377,6 +384,7 @@ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedBy", "Conv
377
384
  _defineProperty(PrepareEndChatDescriptionConstants, "PrepareEndChatError", "There's an error while preparing to end chat. Closing chat widget.");
378
385
  _defineProperty(PrepareEndChatDescriptionConstants, "WidgetLoadFailedAfterSessionInit", "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.");
379
386
  _defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceived", "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.");
387
+ _defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceivedActiveChat", "Received InitiateEndChat BroadcastEvent while conversation state is Active. Updating conversation states.");
380
388
  _defineProperty(PrepareEndChatDescriptionConstants, "EndChatReceivedFromOtherTabs", "Received EndChat BroadcastEvent from other tabs. Closing this chat.");
381
389
  _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseChatOnFailureOrPostChat", "Customer is trying to close chat widget on start chat failure or post chat pane.");
382
390
  _defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseInactiveChat", "Chat was Inactive and customer is trying to close chat widget or refreshing the page.");
@@ -26,6 +26,8 @@ let FacadeChatSDK = /*#__PURE__*/function () {
26
26
  _defineProperty(this, "getAuthToken", void 0);
27
27
  _defineProperty(this, "sdkMocked", void 0);
28
28
  _defineProperty(this, "disableReauthentication", void 0);
29
+ // Stays true so CASE 1 re-triggers on every startChat to set deferInitialAuth
30
+ _defineProperty(this, "pendingMidAuthUnauthenticatedState", false);
29
31
  this.chatSDK = input.chatSDK;
30
32
  this.chatConfig = input.chatConfig;
31
33
  this.getAuthToken = input.getAuthToken;
@@ -50,6 +52,12 @@ let FacadeChatSDK = /*#__PURE__*/function () {
50
52
  value: function destroy() {
51
53
  this.token = null;
52
54
  this.expiration = 0;
55
+ if ((0, _authHelper.isMidAuthEnabled)(this.chatConfig)) {
56
+ this.pendingMidAuthUnauthenticatedState = false;
57
+ this.isAuthenticated = true;
58
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
+ this.chatSDK.deferInitialAuth = false;
60
+ }
53
61
  }
54
62
  }, {
55
63
  key: "isTokenSet",
@@ -214,6 +222,10 @@ let FacadeChatSDK = /*#__PURE__*/function () {
214
222
  message: "Token is valid"
215
223
  };
216
224
  }
225
+
226
+ // Token missing or expired - need to get a new one via getAuthToken
227
+ // For mid-auth: getAuthToken receives { isMidAuthEnabled: true } so customer implementations
228
+ // can check portal state and return null for logged-out users
217
229
  _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
218
230
  Event: _TelemetryConstants.TelemetryEvent.NewTokenValidationStarted,
219
231
  Description: "Token validation started."
@@ -234,6 +246,7 @@ let FacadeChatSDK = /*#__PURE__*/function () {
234
246
  this.token = "";
235
247
  this.expiration = 0;
236
248
  try {
249
+ var _ring$error, _ring$error2;
237
250
  const ring = await (0, _authHelper.handleAuthentication)(this.chatSDK, this.chatConfig, this.getAuthToken);
238
251
  if ((ring === null || ring === void 0 ? void 0 : ring.result) === true && ring !== null && ring !== void 0 && ring.token) {
239
252
  await this.setToken(ring.token);
@@ -248,18 +261,35 @@ let FacadeChatSDK = /*#__PURE__*/function () {
248
261
  result: true,
249
262
  message: "New Token obtained"
250
263
  };
251
- } else {
252
- var _ring$error, _ring$error2;
253
- _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
254
- Event: _TelemetryConstants.TelemetryEvent.NewTokenValidationFailed,
255
- Description: (_ring$error = ring.error) === null || _ring$error === void 0 ? void 0 : _ring$error.message,
256
- ExceptionDetails: ring === null || ring === void 0 ? void 0 : ring.error
264
+ }
265
+
266
+ // Mid-auth: no token available - set pending flag for startChat to handle
267
+ const isEmptyTokenWithoutError = (0, _utils.isNullOrEmptyString)(ring === null || ring === void 0 ? void 0 : ring.token) && ((ring === null || ring === void 0 ? void 0 : ring.result) === true || (ring === null || ring === void 0 ? void 0 : ring.result) === false && !(ring !== null && ring !== void 0 && ring.error));
268
+ if ((0, _authHelper.isMidAuthEnabled)(this.chatConfig) && isEmptyTokenWithoutError) {
269
+ // Clear Facade and SDK token state so API calls use unauthenticated endpoints
270
+ this.token = "";
271
+ this.expiration = 0;
272
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
273
+ this.chatSDK.authenticatedUserToken = null;
274
+ this.pendingMidAuthUnauthenticatedState = true;
275
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
276
+ Event: _TelemetryConstants.TelemetryEvent.NewTokenValidationCompleted,
277
+ Description: "Mid-auth enabled: no token returned; proceeding as unauthenticated"
257
278
  });
258
279
  return {
259
- result: false,
260
- message: (ring === null || ring === void 0 ? void 0 : (_ring$error2 = ring.error) === null || _ring$error2 === void 0 ? void 0 : _ring$error2.message) || "Failed to get token"
280
+ result: true,
281
+ message: "Mid-auth: proceeding as unauthenticated"
261
282
  };
262
283
  }
284
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
285
+ Event: _TelemetryConstants.TelemetryEvent.NewTokenValidationFailed,
286
+ Description: (_ring$error = ring.error) === null || _ring$error === void 0 ? void 0 : _ring$error.message,
287
+ ExceptionDetails: ring === null || ring === void 0 ? void 0 : ring.error
288
+ });
289
+ return {
290
+ result: false,
291
+ message: (ring === null || ring === void 0 ? void 0 : (_ring$error2 = ring.error) === null || _ring$error2 === void 0 ? void 0 : _ring$error2.message) || "Failed to get token"
292
+ };
263
293
  } catch (e) {
264
294
  console.error("Unexpected error while getting token", e);
265
295
  _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
@@ -273,6 +303,155 @@ let FacadeChatSDK = /*#__PURE__*/function () {
273
303
  };
274
304
  }
275
305
  }
306
+
307
+ /**
308
+ * Sets unauthenticated state for mid-auth flow.
309
+ * Clears SDK internal state to prevent reconnection to previous authenticated session.
310
+ */
311
+ }, {
312
+ key: "setMidAuthUnauthenticatedState",
313
+ value: function setMidAuthUnauthenticatedState() {
314
+ var _sdk$chatToken, _sdk$chatToken2;
315
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
316
+ const sdk = this.chatSDK;
317
+ const hadExistingChat = !!((_sdk$chatToken = sdk.chatToken) !== null && _sdk$chatToken !== void 0 && _sdk$chatToken.chatId);
318
+ const previousChatId = (_sdk$chatToken2 = sdk.chatToken) === null || _sdk$chatToken2 === void 0 ? void 0 : _sdk$chatToken2.chatId;
319
+ this.clearAuthState();
320
+
321
+ // Clear SDK internal state for fresh unauthenticated chat
322
+ sdk.chatToken = {};
323
+ sdk.reconnectId = null;
324
+ sdk.requestId = null;
325
+ sdk.sessionId = null;
326
+ sdk.conversation = null;
327
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
328
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthReset,
329
+ Description: hadExistingChat ? "Mid-auth without token: local state cleared" : "Mid-auth: initialized as unauthenticated (no prior chat)",
330
+ Data: hadExistingChat ? {
331
+ previousChatId
332
+ } : undefined
333
+ });
334
+ }
335
+
336
+ /** Clears authentication state in both FacadeChatSDK and underlying SDK */
337
+ }, {
338
+ key: "clearAuthState",
339
+ value: function clearAuthState() {
340
+ this.token = "";
341
+ this.expiration = 0;
342
+ this.isAuthenticated = false;
343
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
344
+ this.chatSDK.authenticatedUserToken = null;
345
+ }
346
+
347
+ /**
348
+ * Migrates conversation from unauthenticated to authenticated via authenticateChat.
349
+ * Called after startChat() when user has a valid token but the backend conversation
350
+ * was started as unauthenticated.
351
+ */
352
+ }, {
353
+ key: "migrateConversationToAuthenticated",
354
+ value: async function migrateConversationToAuthenticated() {
355
+ try {
356
+ await this.chatSDK.authenticateChat(this.token, {
357
+ refreshChatToken: true
358
+ });
359
+ this.isAuthenticated = true;
360
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
361
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthSucceeded,
362
+ Description: "Mid-auth: authenticateChat completed, conversation migrated to authenticated"
363
+ });
364
+ } catch (e) {
365
+ // Non-fatal: Chat is already active via startChat, will retry on next reconnect
366
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.WARN, {
367
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthFailed,
368
+ Description: "Mid-auth: authenticateChat returned error after startChat, chat still active",
369
+ ExceptionDetails: {
370
+ message: e === null || e === void 0 ? void 0 : e.message
371
+ }
372
+ });
373
+ }
374
+ }
375
+
376
+ /**
377
+ * Configures SDK auth state before startChat.
378
+ * CASE 1: Pending unauthenticated (no token) - sets deferInitialAuth=true
379
+ * CASE 2: Authenticated with valid token - sets SDK token and deferInitialAuth based on scenario
380
+ */
381
+ }, {
382
+ key: "configureMidAuthState",
383
+ value: function configureMidAuthState(isReconnect, wasPreviousSessionAuthenticated) {
384
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
+ const sdk = this.chatSDK;
386
+
387
+ // CASE 1: No token available (user not logged in)
388
+ // pendingMidAuthUnauthenticatedState stays true until user logs in (cleared in tokenRing)
389
+ if (this.pendingMidAuthUnauthenticatedState) {
390
+ const shouldClear = this.handlePendingUnauthenticatedState(wasPreviousSessionAuthenticated);
391
+ sdk.deferInitialAuth = true;
392
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
393
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthReset,
394
+ Description: "Mid-auth configureMidAuthState: CASE 1 - unauthenticated, deferInitialAuth=true",
395
+ Data: {
396
+ isReconnect: String(isReconnect),
397
+ wasPreviousSessionAuthenticated: String(wasPreviousSessionAuthenticated),
398
+ shouldClearReconnectParams: String(shouldClear)
399
+ }
400
+ });
401
+ return {
402
+ shouldClearReconnectParams: shouldClear
403
+ };
404
+ }
405
+
406
+ // CASE 2: Authenticated with valid token
407
+ if (this.isTokenSet() && !this.isTokenExpired()) {
408
+ this.handleAuthenticatedState(isReconnect, wasPreviousSessionAuthenticated);
409
+ }
410
+ return {
411
+ shouldClearReconnectParams: false
412
+ };
413
+ }
414
+
415
+ /**
416
+ * CASE 1 handler: Returns true if reconnect params should be cleared (Auth -> Unauth transition)
417
+ */
418
+ }, {
419
+ key: "handlePendingUnauthenticatedState",
420
+ value: function handlePendingUnauthenticatedState(wasPreviousSessionAuthenticated) {
421
+ if (wasPreviousSessionAuthenticated) {
422
+ // Auth -> Unauth: user logged out, clear state for fresh chat
423
+ this.setMidAuthUnauthenticatedState();
424
+ return true;
425
+ }
426
+
427
+ // Unauth -> Unauth: keep liveChatContext for reconnection
428
+ this.isAuthenticated = false;
429
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
430
+ this.chatSDK.authenticatedUserToken = null;
431
+ return false;
432
+ }
433
+
434
+ /**
435
+ * CASE 2 handler: Sets deferInitialAuth only for reconnects to unauthenticated sessions (need migration).
436
+ * For new chats or reconnects to authenticated sessions, SDK handles auth internally.
437
+ */
438
+ }, {
439
+ key: "handleAuthenticatedState",
440
+ value: function handleAuthenticatedState(isReconnect, wasPreviousSessionAuthenticated) {
441
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
442
+ const sdk = this.chatSDK;
443
+ sdk.authenticatedUserToken = this.token;
444
+ if (isReconnect && !wasPreviousSessionAuthenticated) {
445
+ sdk.deferInitialAuth = true;
446
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
447
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthSucceeded,
448
+ Description: "Mid-auth handleAuthenticatedState: CASE 2 - reconnect to unauth session, deferInitialAuth=true (migration needed)"
449
+ });
450
+ } else {
451
+ // Reset to prevent inheriting deferInitialAuth=true from a previous unauthenticated chat
452
+ sdk.deferInitialAuth = false;
453
+ }
454
+ }
276
455
  }, {
277
456
  key: "validateAndExecuteCall",
278
457
  value: async function validateAndExecuteCall(functionName, fn) {
@@ -307,7 +486,53 @@ let FacadeChatSDK = /*#__PURE__*/function () {
307
486
  key: "startChat",
308
487
  value: async function startChat() {
309
488
  let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
310
- return this.validateAndExecuteCall("startChat", () => this.chatSDK.startChat(optionalParams));
489
+ const midAuthEnabled = (0, _authHelper.isMidAuthEnabled)(this.chatConfig);
490
+ const isReconnect = !!optionalParams.liveChatContext || !!optionalParams.reconnectId;
491
+ const wasPreviousSessionAuthenticated = optionalParams.wasAuthenticated === true;
492
+ return this.validateAndExecuteCall("startChat", async () => {
493
+ if (midAuthEnabled) {
494
+ const {
495
+ shouldClearReconnectParams
496
+ } = this.configureMidAuthState(isReconnect, wasPreviousSessionAuthenticated);
497
+ if (shouldClearReconnectParams) {
498
+ delete optionalParams.liveChatContext;
499
+ delete optionalParams.reconnectId;
500
+ }
501
+ }
502
+ await this.chatSDK.startChat(optionalParams);
503
+
504
+ // Migrate to authenticated if needed (reconnects to unauthenticated sessions only)
505
+ if (midAuthEnabled) {
506
+ const shouldMigrateToAuth = isReconnect && this.isTokenSet() && !this.isTokenExpired() && !wasPreviousSessionAuthenticated;
507
+ if (shouldMigrateToAuth) {
508
+ _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
509
+ Event: _TelemetryConstants.TelemetryEvent.MidConversationAuthSucceeded,
510
+ Description: "Mid-auth startChat: initiating migration to authenticated",
511
+ Data: {
512
+ isReconnect: String(isReconnect),
513
+ wasPreviousSessionAuthenticated: String(wasPreviousSessionAuthenticated)
514
+ }
515
+ });
516
+ await this.migrateConversationToAuthenticated();
517
+ }
518
+ }
519
+
520
+ // Broadcast final auth state after startChat completes (only on state change)
521
+ if (midAuthEnabled) {
522
+ const isAuthenticatedAfterStart = this.isTokenSet() && !this.isTokenExpired();
523
+ const authStateChanged = !isReconnect || isAuthenticatedAfterStart !== wasPreviousSessionAuthenticated;
524
+ if (authStateChanged) {
525
+ _omnichannelChatComponents.BroadcastService.postMessage({
526
+ eventName: isAuthenticatedAfterStart ? _TelemetryConstants.BroadcastEvent.MidConversationAuthSucceeded : _TelemetryConstants.BroadcastEvent.MidConversationAuthReset,
527
+ payload: {
528
+ isAuthenticated: isAuthenticatedAfterStart,
529
+ isStartChatComplete: true,
530
+ isReconnect
531
+ }
532
+ });
533
+ }
534
+ }
535
+ });
311
536
  }
312
537
  }, {
313
538
  key: "endChat",
@@ -445,6 +670,7 @@ let FacadeChatSDK = /*#__PURE__*/function () {
445
670
  let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
446
671
  return this.validateAndExecuteCall("getAgentAvailability", () => this.chatSDK.getAgentAvailability(optionalParams));
447
672
  }
673
+
448
674
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
449
675
  }, {
450
676
  key: "getReconnectableChats",
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.AppInsightsEventMapping = void 0;
7
7
  const AppInsightsEventMapping = {
8
8
  "LCWChatButtonClicked": "LCWChatButtonActionStarted",
9
- "WidgetLoadStarted": "WidgetStartChatStarted",
10
- "WidgetLoadComplete": "WidgetStartChatCompleted",
11
- "WidgetLoadFailed": "WidgetStartChatFailed",
12
- "PrechatSubmitted": "PrechatSubmitCompleted",
13
- "StartChatEventRecevied": "StartChatEventReceivedCompleted",
9
+ "UXLCWChatButtonLoadingStart": "LiveChatWidgetChatButtonLoadingStarted",
10
+ "UXLCWChatButtonLoadingCompleted": "LiveChatWidgetChatButtonLoadingCompleted",
11
+ "UXPrechatPaneStart": "PrechatSurveyStarted",
12
+ "UXPrechatPaneCompleted": "PrechatSurveyCompleted",
13
+ "PrechatSubmitted": "PrechatSurveySubmitCompleted",
14
14
  "EndChatEventReceived": "EndChatEventReceivedCompleted",
15
15
  "EmailTranscriptSent": "EmailTranscriptActionCompleted",
16
16
  "EmailTranscriptFailed": "EmailTranscriptActionFailed",
@@ -18,14 +18,19 @@ const AppInsightsEventMapping = {
18
18
  "HeaderMinimizeButtonClicked": "MinimizeChatActionStarted",
19
19
  "DownloadTranscriptButtonClicked": "DownloadTranscriptActionStarted",
20
20
  "EmailTranscriptButtonClicked": "EmailTranscriptButtonActionStarted",
21
- "CustomerVoiceFormResponseSubmitted": "CustomerVoiceFormResponseSubmitCompleted",
22
- "StartProactiveChatEventReceived": "StartProactiveChatEventReceivedCompleted",
23
21
  "ProactiveChatRejected": "ProactiveChatTimeOutCompleted",
24
22
  "MessageSent": "MessageSentCompleted",
25
23
  "MessageReceived": "MessageReceivedCompleted",
26
24
  "SystemMessageReceived": "SystemMessageReceivedCompleted",
27
- "RehydrateMessageReceived": "RehydrateMessageReceivedCompleted",
25
+ "RehydrateMessageReceived": "ChatHistoryMessageReceivedCompleted",
28
26
  "CustomContextReceived": "CustomContextReceivedCompleted",
29
- "PostChatContextCallSucceed": "PostChatContextCallCompleted"
27
+ "NewTokenValidationStarted": "AuthTokenValidationStarted",
28
+ "NewTokenValidationCompleted": "AuthTokenValidationCompleted",
29
+ "NewTokenValidationFailed": "AuthTokenValidationFailed",
30
+ "UXPostChatPaneStarted": "PostChatSurveyStarted",
31
+ "UXPostChatPaneCompleted": "PostChatSurveyCompleted",
32
+ "WidgetLoadStarted": "ChatSessionInitializationStarted",
33
+ "WidgetLoadComplete": "ChatSessionInitializationCompleted",
34
+ "WidgetLoadFailed": "ChatSessionInitializationFailed"
30
35
  };
31
36
  exports.AppInsightsEventMapping = AppInsightsEventMapping;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TelemetryEvent = exports.TelemetryConstants = exports.ScenarioType = exports.LogLevel = exports.BroadcastEvent = void 0;
6
+ exports.TelemetryEvent = exports.TelemetryConstants = exports.ScenarioType = exports.LogLevel = exports.ConversationStage = exports.BroadcastEvent = void 0;
7
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
8
  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); } }
9
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -74,6 +74,8 @@ exports.BroadcastEvent = BroadcastEvent;
74
74
  BroadcastEvent["FMLTrackingCompletedAck"] = "FMLTrackingCompletedAck";
75
75
  BroadcastEvent["FMLTrackingCompleted"] = "FMLTrackingCompleted";
76
76
  BroadcastEvent["PersistentConversationReset"] = "PersistentConversationReset";
77
+ BroadcastEvent["MidConversationAuthSucceeded"] = "MidConversationAuthSucceeded";
78
+ BroadcastEvent["MidConversationAuthReset"] = "MidConversationAuthReset";
77
79
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
78
80
  let TelemetryEvent;
79
81
  exports.TelemetryEvent = TelemetryEvent;
@@ -108,6 +110,9 @@ exports.TelemetryEvent = TelemetryEvent;
108
110
  TelemetryEvent["CallingSDKInitFailed"] = "CallingSDKInitFailed";
109
111
  TelemetryEvent["CallingSDKLoadSuccess"] = "CallingSDKLoadSuccess";
110
112
  TelemetryEvent["CallingSDKLoadFailed"] = "CallingSDKLoadFailed";
113
+ TelemetryEvent["MidConversationAuthSucceeded"] = "MidConversationAuthSucceeded";
114
+ TelemetryEvent["MidConversationAuthFailed"] = "MidConversationAuthFailed";
115
+ TelemetryEvent["MidConversationAuthReset"] = "MidConversationAuthReset";
111
116
  TelemetryEvent["GetConversationDetailsCallStarted"] = "GetConversationDetailsCallStarted";
112
117
  TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
113
118
  TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
@@ -124,6 +129,7 @@ exports.TelemetryEvent = TelemetryEvent;
124
129
  TelemetryEvent["EndChatFailed"] = "EndChatFailed";
125
130
  TelemetryEvent["SettingCustomContext"] = "SettingCustomContext";
126
131
  TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
132
+ TelemetryEvent["PersistentChatHistoryEnabled"] = "PersistentChatHistoryEnabled";
127
133
  TelemetryEvent["LCWChatButtonActionCompleted"] = "LCWChatButtonActionCompleted";
128
134
  TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
129
135
  TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
@@ -196,6 +202,7 @@ exports.TelemetryEvent = TelemetryEvent;
196
202
  TelemetryEvent["QueueOverflowEvent"] = "QueueOverflowEvent";
197
203
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
198
204
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
205
+ TelemetryEvent["HTMLSanitized"] = "HTMLSanitized";
199
206
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
200
207
  TelemetryEvent["AttachmentUploadValidatorMiddlewareFailed"] = "AttachmentUploadValidatorMiddlewareFailed";
201
208
  TelemetryEvent["CitationMiddlewareFailed"] = "CitationMiddlewareFailed";
@@ -288,6 +295,8 @@ exports.TelemetryEvent = TelemetryEvent;
288
295
  TelemetryEvent["UXCitationPaneCompleted"] = "UXCitationPaneCompleted";
289
296
  TelemetryEvent["UXLiveChatWidgetStart"] = "UXLiveChatWidgetStart";
290
297
  TelemetryEvent["UXLiveChatWidgetCompleted"] = "UXLiveChatWidgetCompleted";
298
+ TelemetryEvent["UXPostChatPaneStarted"] = "UXPostChatPaneStarted";
299
+ TelemetryEvent["UXPostChatPaneCompleted"] = "UXPostChatPaneCompleted";
291
300
  TelemetryEvent["AppInsightsInitialized"] = "AppInsightsInitialized";
292
301
  TelemetryEvent["AppInsightsInitFailed"] = "AppInsightsInitFailed";
293
302
  TelemetryEvent["ConvertPersistentChatHistoryMessageToActivityFailed"] = "ConvertPersistentChatHistoryMessageToActivityFailed";
@@ -303,6 +312,7 @@ exports.TelemetryEvent = TelemetryEvent;
303
312
  TelemetryEvent["LCWPersistentConversationHandlerInitialized"] = "LCWPersistentConversationHandlerInitialized";
304
313
  TelemetryEvent["LCWPersistentHistoryPullBlocked"] = "LCWPersistentHistoryPullBlocked";
305
314
  TelemetryEvent["LCWPersistentHistoryPullCompleted"] = "LCWPersistentHistoryPullCompleted";
315
+ TelemetryEvent["LCWPersistentHistoryReturnedNull"] = "LCWPersistentHistoryReturnedNull";
306
316
  TelemetryEvent["LCWLazyLoadInitializationStarted"] = "LCWLazyLoadInitializationStarted";
307
317
  TelemetryEvent["LCWLazyLoadContainerNotFound"] = "LCWLazyLoadContainerNotFound";
308
318
  TelemetryEvent["LCWLazyLoadInitializationCompleted"] = "LCWLazyLoadInitializationCompleted";
@@ -312,10 +322,18 @@ exports.TelemetryEvent = TelemetryEvent;
312
322
  TelemetryEvent["LCWLazyLoadActivityMounted"] = "LCWLazyLoadActivityMounted";
313
323
  TelemetryEvent["LCWLazyLoadReset"] = "LCWLazyLoadReset";
314
324
  TelemetryEvent["LCWLazyLoadNoMoreHistory"] = "LCWLazyLoadNoMoreHistory";
325
+ TelemetryEvent["LCWLazyLoadHistoryError"] = "LCWLazyLoadHistoryError";
315
326
  TelemetryEvent["LCWLazyLoadDestroyed"] = "LCWLazyLoadDestroyed";
327
+ TelemetryEvent["LCWLazyLoadTriggerFired"] = "LCWLazyLoadTriggerFired";
328
+ TelemetryEvent["LCWLazyLoadBatchReceived"] = "LCWLazyLoadBatchReceived";
329
+ TelemetryEvent["LCWLazyLoadInitialLoadComplete"] = "LCWLazyLoadInitialLoadComplete";
330
+ TelemetryEvent["LCWLazyLoadScrollAnchorApplied"] = "LCWLazyLoadScrollAnchorApplied";
316
331
  TelemetryEvent["SecureEventBusUnauthorizedDispatch"] = "SecureEventBusUnauthorizedDispatch";
317
332
  TelemetryEvent["SecureEventBusListenerError"] = "SecureEventBusListenerError";
318
333
  TelemetryEvent["SecureEventBusDispatchError"] = "SecureEventBusDispatchError";
334
+ TelemetryEvent["StartChatComplete"] = "StartChatComplete";
335
+ TelemetryEvent["AgentJoinedConversation"] = "AgentJoinedConversation";
336
+ TelemetryEvent["BrowserTabHidden"] = "BrowserTabHidden";
319
337
  })(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
320
338
  let TelemetryConstants = /*#__PURE__*/function () {
321
339
  function TelemetryConstants() {
@@ -386,6 +404,8 @@ let TelemetryConstants = /*#__PURE__*/function () {
386
404
  case TelemetryEvent.SecureEventBusUnauthorizedDispatch:
387
405
  case TelemetryEvent.SecureEventBusListenerError:
388
406
  case TelemetryEvent.SecureEventBusDispatchError:
407
+ case TelemetryEvent.AgentJoinedConversation:
408
+ case TelemetryEvent.BrowserTabHidden:
389
409
  return ScenarioType.ACTIONS;
390
410
  case TelemetryEvent.StartChatSDKCall:
391
411
  case TelemetryEvent.StartChatEventReceived:
@@ -446,4 +466,11 @@ let TelemetryConstants = /*#__PURE__*/function () {
446
466
  }]);
447
467
  return TelemetryConstants;
448
468
  }();
449
- exports.TelemetryConstants = TelemetryConstants;
469
+ exports.TelemetryConstants = TelemetryConstants;
470
+ let ConversationStage;
471
+ exports.ConversationStage = ConversationStage;
472
+ (function (ConversationStage) {
473
+ ConversationStage["Initialization"] = "Initialization";
474
+ ConversationStage["CSREngagement"] = "CSR Engagement";
475
+ ConversationStage["ConversationEnd"] = "Conversation End";
476
+ })(ConversationStage || (exports.ConversationStage = ConversationStage = {}));
@@ -50,7 +50,7 @@ const RegisterLoggers = () => {
50
50
  loggers.push((0, _consoleLogger.consoleLogger)());
51
51
  }
52
52
  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) {
53
- var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23;
53
+ var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23, _TelemetryManager$Int24, _TelemetryManager$Int25, _TelemetryManager$Int26;
54
54
  if ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int11 !== void 0 && _TelemetryManager$Int11.ariaConfig) {
55
55
  var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17, _TelemetryManager$Int18, _TelemetryManager$Int19;
56
56
  loggers.push((0, _ariaTelemetryLogger.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.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.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.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.defaultAriaConfig.ariaTelemetryApplicationName));
@@ -61,12 +61,15 @@ const RegisterLoggers = () => {
61
61
  loggers.push(logger);
62
62
  });
63
63
  }
64
- 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) {
65
- var _TelemetryManager$Int24;
66
- if ((_TelemetryManager$Int24 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int24 !== void 0 && _TelemetryManager$Int24.appInsightsConfig.appInsightsKey) {
67
- var _TelemetryManager$Int25;
68
- loggers.push((0, _appInsightsLogger.appInsightsLogger)((_TelemetryManager$Int25 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int25 === void 0 ? void 0 : _TelemetryManager$Int25.appInsightsConfig.appInsightsKey));
69
- }
64
+ const chatConfigAppInsightsKey = (_TelemetryManager$Int22 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int22 === void 0 ? void 0 : _TelemetryManager$Int22.chatConfigAppInsightsKey;
65
+ 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;
66
+ // when chatConfig has AppInsightsInstrumentationKey
67
+ if (chatConfigAppInsightsKey) {
68
+ loggers.push((0, _appInsightsLogger.appInsightsLogger)(chatConfigAppInsightsKey));
69
+ }
70
+ // when key set through appInsightsConfig
71
+ 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) {
72
+ loggers.push((0, _appInsightsLogger.appInsightsLogger)(appInsightsKeyFromUser));
70
73
  }
71
74
  }
72
75
  };