@microsoft/omnichannel-chat-widget 0.1.0-main.3bd7d37 → 0.1.0-main.3c8dc3b

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 (142) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/common/Constants.js +52 -6
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +38 -3
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
  5. package/lib/cjs/common/telemetry/TelemetryManager.js +16 -5
  6. package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  7. package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  8. package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
  9. package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
  10. package/lib/cjs/common/utils.js +89 -2
  11. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  12. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
  13. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -40
  14. package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
  15. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
  16. package/lib/cjs/components/headerstateful/HeaderStateful.js +5 -10
  17. package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
  18. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
  19. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  20. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
  21. package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
  22. package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
  23. package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
  24. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +31 -30
  25. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -17
  26. package/lib/cjs/components/livechatwidget/common/endChat.js +93 -10
  27. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  28. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +32 -5
  29. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +115 -22
  30. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  31. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
  32. package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
  33. package/lib/cjs/components/livechatwidget/common/startChat.js +168 -49
  34. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +269 -69
  35. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  36. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
  37. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  38. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  39. package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
  40. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  41. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  42. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
  43. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  44. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  45. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  46. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  47. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  48. package/lib/cjs/contexts/common/ConversationState.js +3 -2
  49. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +10 -7
  50. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  51. package/lib/cjs/contexts/createReducer.js +24 -10
  52. package/lib/cjs/controller/componentController.js +3 -3
  53. package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
  54. package/lib/esm/common/Constants.js +48 -5
  55. package/lib/esm/common/telemetry/TelemetryConstants.js +38 -3
  56. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  57. package/lib/esm/common/telemetry/TelemetryManager.js +14 -5
  58. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  59. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  60. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
  61. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  62. package/lib/esm/common/utils.js +64 -1
  63. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  64. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
  65. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -38
  66. package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
  67. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  68. package/lib/esm/components/headerstateful/HeaderStateful.js +5 -10
  69. package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
  70. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
  71. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
  72. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
  73. package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
  74. package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
  75. package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
  76. package/lib/esm/components/livechatwidget/common/createMarkdown.js +31 -30
  77. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -18
  78. package/lib/esm/components/livechatwidget/common/endChat.js +89 -11
  79. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  80. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +28 -6
  81. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +104 -22
  82. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  83. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
  84. package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
  85. package/lib/esm/components/livechatwidget/common/startChat.js +164 -51
  86. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +257 -74
  87. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  88. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
  89. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  90. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  91. package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
  92. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  93. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  94. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
  95. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  96. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  97. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  98. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
  99. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  100. package/lib/esm/contexts/common/ConversationState.js +3 -2
  101. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +10 -7
  102. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  103. package/lib/esm/contexts/createReducer.js +24 -9
  104. package/lib/esm/controller/componentController.js +3 -3
  105. package/lib/esm/plugins/newMessageEventHandler.js +10 -12
  106. package/lib/types/common/Constants.d.ts +26 -2
  107. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  108. package/lib/types/common/telemetry/TelemetryConstants.d.ts +32 -5
  109. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  110. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  111. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  112. package/lib/types/common/utils.d.ts +8 -1
  113. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  114. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  115. package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
  116. package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
  117. package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
  118. package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
  119. package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
  120. package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
  121. package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
  122. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  123. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
  124. package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
  125. package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
  126. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  127. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
  128. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -1
  129. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
  130. package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
  131. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  132. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  133. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  134. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
  135. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  136. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  137. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  138. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  139. package/lib/types/contexts/common/ConversationState.d.ts +3 -2
  140. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -1
  141. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +11 -8
  142. package/package.json +8 -8
@@ -27,14 +27,16 @@ const getLiveChatWidgetContextInitialState = props => {
27
27
  postChatContext: undefined,
28
28
  telemetryInternalData: {},
29
29
  globalDir: "ltr",
30
- liveChatContext: undefined
30
+ liveChatContext: undefined,
31
+ customContext: undefined,
32
+ widgetSize: undefined,
33
+ widgetInstanceId: ""
31
34
  },
32
35
  appStates: {
33
36
  conversationState: _ConversationState.ConversationState.Closed,
34
37
  isMinimized: false,
35
38
  previousElementOnFocusBeforeModalOpen: null,
36
39
  outsideOperatingHours: false,
37
- shouldShowPostChat: false,
38
40
  preChatResponseEmail: "",
39
41
  isAudioMuted: null,
40
42
  newMessage: false,
@@ -7,8 +7,6 @@ exports.createReducer = void 0;
7
7
 
8
8
  var _LiveChatWidgetActionType = require("./common/LiveChatWidgetActionType");
9
9
 
10
- var _TelemetryManager = require("../common/telemetry/TelemetryManager");
11
-
12
10
  /* eslint-disable indent */
13
11
  const createReducer = () => {
14
12
  const reducer = (state, action) => {
@@ -71,6 +69,14 @@ const createReducer = () => {
71
69
  }
72
70
  };
73
71
 
72
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
73
+ return { ...state,
74
+ domainStates: { ...state.domainStates,
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ customContext: action.payload
77
+ }
78
+ };
79
+
74
80
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
75
81
  return { ...state,
76
82
  appStates: { ...state.appStates,
@@ -93,13 +99,6 @@ const createReducer = () => {
93
99
  }
94
100
  };
95
101
 
96
- case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT:
97
- return { ...state,
98
- appStates: { ...state.appStates,
99
- shouldShowPostChat: action.payload
100
- }
101
- };
102
-
103
102
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
104
103
  return { ...state,
105
104
  uiStates: { ...state.uiStates,
@@ -197,7 +196,6 @@ const createReducer = () => {
197
196
  };
198
197
 
199
198
  case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA:
200
- _TelemetryManager.TelemetryManager.InternalTelemetryData = action.payload;
201
199
  return { ...state,
202
200
  domainStates: { ...state.domainStates,
203
201
  telemetryInternalData: action.payload
@@ -237,6 +235,22 @@ const createReducer = () => {
237
235
  }
238
236
  };
239
237
 
238
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
239
+ return { ...state,
240
+ domainStates: { ...state.domainStates,
241
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
+ widgetSize: action.payload
243
+ }
244
+ };
245
+
246
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
247
+ return { ...state,
248
+ domainStates: { ...state.domainStates,
249
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
250
+ widgetInstanceId: action.payload
251
+ }
252
+ };
253
+
240
254
  default:
241
255
  return state;
242
256
  }
@@ -8,7 +8,7 @@ exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = expor
8
8
  var _ConversationState = require("../contexts/common/ConversationState");
9
9
 
10
10
  const shouldShowChatButton = state => {
11
- return state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed;
11
+ return (state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
12
12
  };
13
13
 
14
14
  exports.shouldShowChatButton = shouldShowChatButton;
@@ -44,7 +44,7 @@ const shouldShowWebChatContainer = state => {
44
44
  exports.shouldShowWebChatContainer = shouldShowWebChatContainer;
45
45
 
46
46
  const shouldShowLoadingPane = state => {
47
- return !state.appStates.isMinimized && !state.appStates.shouldShowPostChat && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
47
+ return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
48
48
  };
49
49
 
50
50
  exports.shouldShowLoadingPane = shouldShowLoadingPane;
@@ -56,7 +56,7 @@ const shouldShowReconnectChatPane = state => {
56
56
  exports.shouldShowReconnectChatPane = shouldShowReconnectChatPane;
57
57
 
58
58
  const shouldShowPostChatLoadingPane = state => {
59
- return !state.appStates.isMinimized && state.appStates.shouldShowPostChat && state.appStates.conversationState === _ConversationState.ConversationState.Loading;
59
+ return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading;
60
60
  };
61
61
 
62
62
  exports.shouldShowPostChatLoadingPane = shouldShowPostChatLoadingPane;
@@ -13,8 +13,6 @@ var _Constants = require("../common/Constants");
13
13
 
14
14
  var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
15
15
 
16
- var _TelemetryManager = require("../common/telemetry/TelemetryManager");
17
-
18
16
  const createOnNewAdapterActivityHandler = (chatId, userId) => {
19
17
  const onNewAdapterActivityHandler = activity => {
20
18
  var _activity$channelData, _activity$channelData2, _activity$channelData3;
@@ -29,18 +27,16 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
29
27
 
30
28
  const raiseMessageEvent = activity => {
31
29
  if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
32
- var _TelemetryManager$Int, _activity$from;
30
+ var _text, _text2, _activity$channelData4, _activity$from;
33
31
 
34
32
  const payload = {
33
+ // To identify hidden contents vs empty content
35
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- text: activity === null || activity === void 0 ? void 0 : activity.text,
37
- id: activity === null || activity === void 0 ? void 0 : activity.id,
35
+ text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
38
36
  type: activity === null || activity === void 0 ? void 0 : activity.type,
39
37
  timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
40
- chatId: chatId,
41
38
  userId: userId,
42
- conversationId: ((_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId) ?? "",
43
- channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
39
+ tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
44
40
  messageType: ""
45
41
  };
46
42
 
@@ -59,18 +55,18 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
59
55
  Description: "New message sent"
60
56
  });
61
57
  } else {
62
- var _activity$channelData4, _activity$channelData5;
58
+ var _activity$channelData5, _activity$channelData6;
63
59
 
64
- if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(_Constants.Constants.systemMessageTag)) {
60
+ if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.systemMessageTag)) {
65
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
62
  payload.messageType = _Constants.Constants.systemMessageTag;
67
63
  } else {
68
- var _activity$channelData6, _activity$channelData7, _activity$channelData8;
64
+ var _activity$channelData7, _activity$channelData8, _activity$channelData9;
69
65
 
70
66
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
67
  const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
68
 
73
- const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.tags) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
+ const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
70
 
75
71
  const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
76
72
 
@@ -90,7 +86,8 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
90
86
 
91
87
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
92
88
  Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
93
- Description: "New message received"
89
+ Description: "New message received",
90
+ Data: payload
94
91
  });
95
92
  }
96
93
  }
@@ -4,6 +4,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
 
5
5
  export class Constants {}
6
6
 
7
+ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
8
+
9
+ _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
10
+
7
11
  _defineProperty(Constants, "systemMessageTag", "system");
8
12
 
9
13
  _defineProperty(Constants, "userMessageTag", "user");
@@ -12,6 +16,8 @@ _defineProperty(Constants, "historyMessageTag", "history");
12
16
 
13
17
  _defineProperty(Constants, "agentEndConversationMessageTag", "agentendconversation");
14
18
 
19
+ _defineProperty(Constants, "supervisorForceCloseMessageTag", "supervisorforceclosedconversation");
20
+
15
21
  _defineProperty(Constants, "receivedMessageClassName", "ms_lcw_webchat_received_message");
16
22
 
17
23
  _defineProperty(Constants, "sentMessageClassName", "ms_lcw_webchat_sent_message");
@@ -34,8 +40,6 @@ _defineProperty(Constants, "false", "false");
34
40
 
35
41
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
36
42
 
37
- _defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
38
-
39
43
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
40
44
 
41
45
  _defineProperty(Constants, "ChannelId", "lcw");
@@ -70,6 +74,14 @@ _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
70
74
 
71
75
  _defineProperty(Constants, "message", "message");
72
76
 
77
+ _defineProperty(Constants, "hiddenTag", "Hidden");
78
+
79
+ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
80
+
81
+ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
82
+
83
+ _defineProperty(Constants, "publicMessageTag", "public");
84
+
73
85
  _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
74
86
 
75
87
  _defineProperty(Constants, "maxUploadFileSize", "500000");
@@ -120,8 +132,6 @@ _defineProperty(Constants, "InputSubmit", "InputSubmit");
120
132
 
121
133
  _defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
122
134
 
123
- _defineProperty(Constants, "redirectPageRequest", "redirectPageRequest");
124
-
125
135
  _defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
126
136
 
127
137
  _defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
@@ -146,6 +156,12 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
146
156
 
147
157
  _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
148
158
 
159
+ _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
160
+
161
+ _defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
162
+
163
+ _defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
164
+
149
165
  export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[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]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
150
166
  export class HtmlIdNames {}
151
167
 
@@ -255,6 +271,15 @@ export let ChatSDKError;
255
271
  ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
256
272
  })(ChatSDKError || (ChatSDKError = {}));
257
273
 
274
+ export let EnvironmentVersion;
275
+
276
+ (function (EnvironmentVersion) {
277
+ EnvironmentVersion["prod"] = "prod";
278
+ EnvironmentVersion["dogfood"] = "df";
279
+ EnvironmentVersion["int"] = "int";
280
+ EnvironmentVersion["test"] = "test";
281
+ })(EnvironmentVersion || (EnvironmentVersion = {}));
282
+
258
283
  export class TranscriptConstants {}
259
284
 
260
285
  _defineProperty(TranscriptConstants, "ChatTranscriptsBodyColor", "#F5F5F5");
@@ -275,4 +300,22 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
275
300
 
276
301
  _defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
277
302
 
278
- _defineProperty(TranscriptConstants, "AgentFontColor", "white");
303
+ _defineProperty(TranscriptConstants, "AgentFontColor", "white");
304
+
305
+ export class AriaTelemetryConstants {}
306
+
307
+ _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
308
+
309
+ _defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
310
+
311
+ _defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
312
+
313
+ _defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
314
+
315
+ _defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
316
+
317
+ _defineProperty(AriaTelemetryConstants, "Public", "Public");
318
+
319
+ _defineProperty(AriaTelemetryConstants, "EU", "Europe");
320
+
321
+ _defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
@@ -26,15 +26,29 @@ export let BroadcastEvent; // Events being logged
26
26
 
27
27
  (function (BroadcastEvent) {
28
28
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
29
- BroadcastEvent["EndChat"] = "EndChat";
29
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
30
30
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
31
31
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
32
- BroadcastEvent["ChatWidgetStateChanged"] = "ChatWidgetStateChanged";
32
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
33
33
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
34
34
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
35
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
36
+ BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
35
37
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
36
38
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
37
39
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
40
+ BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
41
+ BroadcastEvent["StartChat"] = "StartChat";
42
+ BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
43
+ BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
44
+ BroadcastEvent["InitiateEndChat"] = "InitiateEndChat";
45
+ BroadcastEvent["SetCustomContext"] = "SetCustomContext";
46
+ BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
47
+ BroadcastEvent["MaximizeChat"] = "MaximizeChat";
48
+ BroadcastEvent["ChatInitiated"] = "ChatInitiated";
49
+ BroadcastEvent["CloseChat"] = "CloseChat";
50
+ BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
51
+ BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
38
52
  })(BroadcastEvent || (BroadcastEvent = {}));
39
53
 
40
54
  export let TelemetryEvent;
@@ -85,7 +99,10 @@ export let TelemetryEvent;
85
99
  TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
86
100
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
87
101
  TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
88
- TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
102
+ TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
103
+ TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
104
+ TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
105
+ TelemetryEvent["WindowClosed"] = "WindowClosed";
89
106
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
90
107
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
91
108
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -99,6 +116,7 @@ export let TelemetryEvent;
99
116
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
100
117
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
101
118
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
119
+ TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
102
120
  TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
103
121
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
104
122
  TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
@@ -109,6 +127,12 @@ export let TelemetryEvent;
109
127
  TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
110
128
  TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
111
129
  TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
130
+ TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
131
+ TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
132
+ TelemetryEvent["GetConversationDetailsException"] = "GetConversationDetailsException";
133
+ TelemetryEvent["BrowserUnloadEventStarted"] = "BrowserUnloadEventStarted";
134
+ TelemetryEvent["GetAuthTokenCalled"] = "GetAuthTokenCalled";
135
+ TelemetryEvent["ReceivedNullOrEmptyToken"] = "ReceivedNullOrEmptyToken";
112
136
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
113
137
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
114
138
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
@@ -120,6 +144,7 @@ export let TelemetryEvent;
120
144
  TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
121
145
  TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
122
146
  TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
147
+ TelemetryEvent["WebChatEvent"] = "WebChatEvent";
123
148
  TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
124
149
  TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
125
150
  TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
@@ -133,6 +158,7 @@ export let TelemetryEvent;
133
158
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
134
159
  TelemetryEvent["MessageSent"] = "MessageSent";
135
160
  TelemetryEvent["MessageReceived"] = "MessageReceived";
161
+ TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
136
162
  })(TelemetryEvent || (TelemetryEvent = {}));
137
163
 
138
164
  export class TelemetryConstants {
@@ -148,6 +174,7 @@ export class TelemetryConstants {
148
174
  case TelemetryEvent.LCWChatButtonShow:
149
175
  case TelemetryEvent.PrechatSurveyLoaded:
150
176
  case TelemetryEvent.LoadingPaneLoaded:
177
+ case TelemetryEvent.PostChatSurveyLoadingPaneLoaded:
151
178
  case TelemetryEvent.PostChatSurveyLoaded:
152
179
  case TelemetryEvent.EmailTranscriptLoaded:
153
180
  case TelemetryEvent.OutOfOfficePaneLoaded:
@@ -174,15 +201,23 @@ export class TelemetryConstants {
174
201
  case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
175
202
  case TelemetryEvent.HeaderCloseButtonClicked:
176
203
  case TelemetryEvent.HeaderMinimizeButtonClicked:
204
+ case TelemetryEvent.MessageSent:
205
+ case TelemetryEvent.MessageReceived:
206
+ case TelemetryEvent.CustomContextReceived:
207
+ case TelemetryEvent.BrowserUnloadEventStarted:
177
208
  return ScenarioType.ACTIONS;
178
209
 
179
210
  case TelemetryEvent.StartChatSDKCall:
211
+ case TelemetryEvent.StartChatEventRecevied:
180
212
  case TelemetryEvent.StartChatMethodException:
181
213
  case TelemetryEvent.CloseChatMethodException:
214
+ case TelemetryEvent.StartProactiveChatEventReceived:
182
215
  case TelemetryEvent.StartProactiveChatMethodFailed:
183
216
  case TelemetryEvent.OnNewMessageFailed:
184
217
  case TelemetryEvent.OnNewMessageAudioNotificationFailed:
185
218
  case TelemetryEvent.GetConversationDetailsCallFailed:
219
+ case TelemetryEvent.EndChatSDKCall:
220
+ case TelemetryEvent.EndChatEventReceived:
186
221
  case TelemetryEvent.EndChatSDKCallFailed:
187
222
  case TelemetryEvent.PostChatContextCallFailed:
188
223
  case TelemetryEvent.PostChatContextCallSucceed:
@@ -1,6 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- import { ScenarioType } from "./TelemetryConstants";
3
+ import { ScenarioType, TelemetryEvent } from "./TelemetryConstants";
4
4
  import { newGuid } from "../utils";
5
5
  import { TelemetryManager } from "./TelemetryManager";
6
6
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
@@ -259,4 +259,16 @@ _defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
259
259
  }
260
260
  };
261
261
  BroadcastService.postMessage(telemetryEvent);
262
+ });
263
+
264
+ _defineProperty(TelemetryHelper, "logWebChatEvent", (logLevel, payload) => {
265
+ const telemetryEvent = {
266
+ eventName: TelemetryEvent.WebChatEvent,
267
+ logLevel: logLevel,
268
+ payload: { ...payload,
269
+ type: TelemetryEvent.WebChatEvent,
270
+ scenarioType: ScenarioType.WEBCHAT
271
+ }
272
+ };
273
+ BroadcastService.postMessage(telemetryEvent);
262
274
  });
@@ -4,6 +4,8 @@ import { LogLevel, ScenarioType, TelemetryConstants, TelemetryEvent } from "./Te
4
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
5
  import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
6
6
  import { consoleLogger } from "./loggers/consoleLogger";
7
+ import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
8
+ import { TelemetryHelper } from "./TelemetryHelper";
7
9
  export class TelemetryTimers {}
8
10
 
9
11
  _defineProperty(TelemetryTimers, "LcwLoadToChatButtonTimer", void 0);
@@ -26,7 +28,7 @@ export const RegisterLoggers = () => {
26
28
  const registerLoggers = () => {
27
29
  var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
28
30
 
29
- if (!((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int !== void 0 && (_TelemetryManager$Int2 = _TelemetryManager$Int.telemetryConfig) !== null && _TelemetryManager$Int2 !== void 0 && _TelemetryManager$Int2.disableConsoleLog) || !((_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int3 !== void 0 && (_TelemetryManager$Int4 = _TelemetryManager$Int3.telemetryConfig) !== null && _TelemetryManager$Int4 !== void 0 && _TelemetryManager$Int4.telemetryDisabled)) {
31
+ if (((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : (_TelemetryManager$Int2 = _TelemetryManager$Int.telemetryConfig) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.disableConsoleLog) === false || ((_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : (_TelemetryManager$Int4 = _TelemetryManager$Int3.telemetryConfig) === null || _TelemetryManager$Int4 === void 0 ? void 0 : _TelemetryManager$Int4.telemetryDisabled) === false) {
30
32
  BroadcastService.getAnyMessage().subscribe(event => {
31
33
  if (event.payload && event.eventName in TelemetryEvent) {
32
34
  logTelemetry(event);
@@ -34,17 +36,17 @@ export const RegisterLoggers = () => {
34
36
  });
35
37
  }
36
38
 
37
- if (!((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int5 !== void 0 && (_TelemetryManager$Int6 = _TelemetryManager$Int5.telemetryConfig) !== null && _TelemetryManager$Int6 !== void 0 && _TelemetryManager$Int6.disableConsoleLog)) {
39
+ if (((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int5 === void 0 ? void 0 : (_TelemetryManager$Int6 = _TelemetryManager$Int5.telemetryConfig) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.disableConsoleLog) === false) {
38
40
  loggers.push(consoleLogger());
39
41
  }
40
42
 
41
- if (!((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int7 !== void 0 && (_TelemetryManager$Int8 = _TelemetryManager$Int7.telemetryConfig) !== null && _TelemetryManager$Int8 !== void 0 && _TelemetryManager$Int8.telemetryDisabled)) {
43
+ if (((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : (_TelemetryManager$Int8 = _TelemetryManager$Int7.telemetryConfig) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.telemetryDisabled) === false) {
42
44
  var _TelemetryManager$Int9, _TelemetryManager$Int18, _TelemetryManager$Int19;
43
45
 
44
46
  if ((_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int9 !== void 0 && _TelemetryManager$Int9.ariaConfig) {
45
47
  var _TelemetryManager$Int10, _TelemetryManager$Int11, _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17;
46
48
 
47
- loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : (_TelemetryManager$Int11 = _TelemetryManager$Int10.ariaConfig) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.ariaTelemetryKey) ?? "", ((_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.disableCookieUsage) ?? false, ((_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.collectorUriForTelemetry) ?? "", ((_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.ariaTelemetryApplicationName) ?? "OmniChannelProd_Web"));
49
+ loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : (_TelemetryManager$Int11 = _TelemetryManager$Int10.ariaConfig) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.ariaTelemetryKey) ?? defaultAriaConfig.ariaTelemetryKey, ((_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.disableCookieUsage) ?? defaultAriaConfig.disableCookieUsage, ((_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.collectorUriForTelemetry) ?? defaultAriaConfig.collectorUriForTelemetry, ((_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.ariaTelemetryApplicationName) ?? defaultAriaConfig.ariaTelemetryApplicationName));
48
50
  }
49
51
 
50
52
  const customLoggers = (_TelemetryManager$Int18 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int18 === void 0 ? void 0 : (_TelemetryManager$Int19 = _TelemetryManager$Int18.telemetryConfig) === null || _TelemetryManager$Int19 === void 0 ? void 0 : _TelemetryManager$Int19.telemetryLoggers;
@@ -67,8 +69,15 @@ export const RegisterLoggers = () => {
67
69
 
68
70
  const logTelemetry = telemetryEvent => {
69
71
  loggers.map(logger => {
72
+ var _payload;
73
+
70
74
  const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
71
- logger.log(logLevel, parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload));
75
+ const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
76
+ const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
77
+ telemetryInput.telemetryInfo = {
78
+ telemetryInfo: TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
79
+ };
80
+ logger.log(logLevel, telemetryInput);
72
81
  });
73
82
  };
74
83
 
@@ -1,6 +1,6 @@
1
1
  export const defaultAriaConfig = {
2
2
  collectorUriForTelemetry: "",
3
3
  ariaTelemetryKey: "c7655518acf1403f93ff6b9f77942f0a-d01a02fd-6b50-4de3-a566-62eda11f93bc-7083",
4
- ariaTelemetryApplicationName: "",
4
+ ariaTelemetryApplicationName: "D365_Omnichannel_Client_Public_Prod",
5
5
  disableCookieUsage: true
6
6
  };
@@ -3,5 +3,8 @@ export const defaultTelemetryConfiguration = {
3
3
  telemetryDisabled: false,
4
4
  disableConsoleLog: false,
5
5
  telemetryLoggers: [],
6
- ariaConfigurations: defaultAriaConfig
6
+ ariaConfigurations: defaultAriaConfig,
7
+ chatWidgetVersion: "0.0.0-0",
8
+ chatComponentVersion: "0.0.0-0",
9
+ OCChatSDKVersion: "0.0.0-0"
7
10
  };
@@ -1,9 +1,9 @@
1
- import { isNullOrEmptyString, isNullOrUndefined } from "../../utils";
1
+ import { getDomain, isNullOrEmptyString, isNullOrUndefined } from "../../utils";
2
2
  import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties";
3
3
  import AWTLogManager from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager";
4
4
  import { AWTPiiKind } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
5
- import { Constants } from "../../Constants";
6
- import { TelemetryHelper } from "../TelemetryHelper";
5
+ import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
6
+ import { TelemetryManager } from "../TelemetryManager";
7
7
  export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
8
8
  let _logger;
9
9
 
@@ -15,6 +15,21 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
15
15
 
16
16
  if (!isNullOrEmptyString(collectiorUriForTelemetry)) {
17
17
  configuration.collectorUri = collectiorUriForTelemetry;
18
+ } else {
19
+ if (TelemetryManager.InternalTelemetryData.environmentVersion == EnvironmentVersion.prod) {
20
+ var _TelemetryManager$Int;
21
+
22
+ const orgUrl = (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
23
+
24
+ if (!isNullOrUndefined(orgUrl)) {
25
+ // If the given org is a Production EU org, modify the Aria collector uri
26
+ const region = getDomain(orgUrl);
27
+
28
+ if (region === AriaTelemetryConstants.EU) {
29
+ configuration.collectorUri = AriaTelemetryConstants.EUROPE_ENDPOINT;
30
+ }
31
+ }
32
+ }
18
33
  }
19
34
 
20
35
  try {
@@ -33,18 +48,25 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
33
48
 
34
49
  const ariaLogger = {
35
50
  log: (logLevel, telemetryInput) => {
36
- let property;
37
- const eventProperties = new AWTEventProperties();
38
- const event = TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
39
- eventProperties.setName(telemetryInput.scenarioType);
40
-
41
- for (const key of Object.keys(event)) {
42
- property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
43
- eventProperties.setProperty(key, property);
44
- }
51
+ try {
52
+ let property;
53
+ const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
54
+ const eventProperties = new AWTEventProperties();
55
+ eventProperties.setName(telemetryInput.scenarioType);
45
56
 
46
- eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
47
- logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
57
+ if (telemetryInfo) {
58
+ for (const key of Object.keys(telemetryInfo)) {
59
+ property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
60
+ eventProperties.setProperty(key, property);
61
+ }
62
+
63
+ eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
64
+ }
65
+
66
+ logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
67
+ } catch (error) {
68
+ console.error("Error in logging telemetry to Aria logger:" + error);
69
+ }
48
70
  },
49
71
  dispose: () => {
50
72
  AWTLogManager.flush(function () {
@@ -4,27 +4,28 @@ export const consoleLogger = () => {
4
4
  const consoleLogger = {
5
5
  log: (logLevel, telemetryInput) => {
6
6
  const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
7
+ const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
7
8
 
8
9
  try {
9
10
  switch (logLevel) {
10
11
  case LogLevel.INFO:
11
- console.info(Constants.LiveChatWidget, payload);
12
+ console.info(Constants.LiveChatWidget, payload, telemetryInfo);
12
13
  break;
13
14
 
14
15
  case LogLevel.DEBUG:
15
- console.debug(Constants.LiveChatWidget, payload);
16
+ console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
16
17
  break;
17
18
 
18
19
  case LogLevel.WARN:
19
- console.warn(Constants.LiveChatWidget, payload);
20
+ console.warn(Constants.LiveChatWidget, payload, telemetryInfo);
20
21
  break;
21
22
 
22
23
  case LogLevel.ERROR:
23
- console.error(Constants.LiveChatWidget, payload);
24
+ console.error(Constants.LiveChatWidget, payload, telemetryInfo);
24
25
  break;
25
26
 
26
27
  default:
27
- console.debug(Constants.LiveChatWidget, payload);
28
+ console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
28
29
  break;
29
30
  }
30
31
  } catch (ex) {