@microsoft/omnichannel-chat-widget 0.1.0-main.c461296 → 0.1.0-main.ceb1702

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 (104) hide show
  1. package/README.md +35 -11
  2. package/lib/cjs/common/Constants.js +46 -6
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +32 -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 +30 -2
  11. package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  12. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
  13. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -39
  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 +1 -7
  17. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -15
  18. package/lib/cjs/components/livechatwidget/common/endChat.js +63 -12
  19. package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
  20. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +15 -3
  21. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
  22. package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
  23. package/lib/cjs/components/livechatwidget/common/startChat.js +82 -26
  24. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +200 -43
  25. package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
  26. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -6
  27. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
  28. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  29. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  30. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
  36. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +9 -7
  37. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  38. package/lib/cjs/contexts/createReducer.js +16 -10
  39. package/lib/cjs/controller/componentController.js +1 -1
  40. package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
  41. package/lib/esm/common/Constants.js +42 -5
  42. package/lib/esm/common/telemetry/TelemetryConstants.js +32 -3
  43. package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
  44. package/lib/esm/common/telemetry/TelemetryManager.js +14 -5
  45. package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
  46. package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
  47. package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
  48. package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
  49. package/lib/esm/common/utils.js +19 -1
  50. package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
  51. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +18 -7
  52. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -37
  53. package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
  54. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
  55. package/lib/esm/components/headerstateful/HeaderStateful.js +1 -7
  56. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -16
  57. package/lib/esm/components/livechatwidget/common/endChat.js +59 -13
  58. package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
  59. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -4
  60. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
  61. package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
  62. package/lib/esm/components/livechatwidget/common/startChat.js +82 -30
  63. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +188 -46
  64. package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
  65. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -8
  66. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
  67. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  68. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  69. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  70. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  71. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  72. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  73. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  74. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
  75. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +9 -7
  76. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -1
  77. package/lib/esm/contexts/createReducer.js +16 -9
  78. package/lib/esm/controller/componentController.js +1 -1
  79. package/lib/esm/plugins/newMessageEventHandler.js +10 -12
  80. package/lib/types/common/Constants.d.ts +23 -2
  81. package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
  82. package/lib/types/common/telemetry/TelemetryConstants.d.ts +27 -5
  83. package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
  84. package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
  85. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
  86. package/lib/types/common/utils.d.ts +3 -0
  87. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
  88. package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
  89. package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
  90. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
  91. package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -1
  92. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
  93. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
  94. package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -0
  95. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  96. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  97. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  98. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  99. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  100. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  101. package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
  102. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
  103. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +10 -8
  104. package/package.json +6 -7
package/README.md CHANGED
@@ -11,8 +11,9 @@
11
11
  1. [Installation](#installation)
12
12
  1. [Example Usage](#example-usage)
13
13
  1. [Components](#components)
14
- 1. [Telemetry](#telemetry)
15
- 1. [Features](#features)
14
+ 1. [Common Scenarios](#common-scenarios)
15
+ - [Disable Bot Magic Code](#disable-bot-magic-code)
16
+ 1. [See Also](#see-also)
16
17
 
17
18
  ## Introduction
18
19
 
@@ -84,15 +85,7 @@ const render = async () => {
84
85
  }
85
86
  },
86
87
  chatSDK: chatSDK, // mandatory
87
- chatConfig: chatConfig, // mandatory
88
- telemetryConfig: { //mandatory
89
- orgId: omnichannelConfig.orgId,
90
- orgUrl: omnichannelConfig.orgUrl,
91
- appId: omnichannelConfig.widgetId,
92
- OCChatSDKVersion: chatSdkVersion,
93
- chatComponentVersion: chatComponentVersion,
94
- chatWidgetVersion: chatWidgetVersion
95
- }
88
+ chatConfig: chatConfig // mandatory
96
89
  };
97
90
 
98
91
  ReactDOM.render(
@@ -134,6 +127,7 @@ These are components that are included in the ```@microsoft/omnichannel-chat-com
134
127
 
135
128
  | Component | Default Usage | Interface |
136
129
  | ----- | -------- | ----- |
130
+ | WebChatContainer | The default wrapper around BotFramework's [WebChat](https://github.com/microsoft/BotFramework-WebChat), which is the message container we are using | [IWebChatContainerStatefulProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.ts) |
137
131
  | LiveChatWidget | The default widget that stitches the UI components with Chat SDK | [ILiveChatWidgetProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/livechatwidget/interfaces/ILiveChatWidgetProps.ts) |
138
132
 
139
133
  Some of the interfaces listed in the Stateless table have Stateful counterparts defined in the ```@microsoft/omnichannel-chat-widget``` package. For example, [IConfirmationPaneStatefulProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.ts) extends [IConfirmationPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/confirmationpane/interfaces/IConfirmationPaneProps.ts) with additional attributes that only makes sense in the stateful context.
@@ -226,6 +220,36 @@ const customizedFooterProp: IFooterProps = {
226
220
 
227
221
  > :pushpin: Note that [WebChat hooks](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/HOOKS.md) can also be used in any custom components.
228
222
 
223
+ ## Common Scenarios
224
+
225
+ ### Disable Bot Magic Code
226
+
227
+ Configuration to disable the default behaviour of having to type the magic code in the conversation to complete the sign-in proccess with a bot. Instead, the magic code will be sent to the bot behind the scenes.
228
+
229
+ 1. Add [MagicCodeForwarder.html](sample/MagicCodeForwarder.html) in the same location as the chat widget
230
+
231
+ 2. Add `botMagicCode` configuration to disable default magic code feature
232
+
233
+ > :exclamation: `fwdUrl` **MUST** have the same `origin` as the chat widget URL
234
+
235
+ ```js
236
+ const liveChatWidgetProps = {
237
+ chatSDK: chatSDK, // mandatory
238
+ chatConfig: chatConfig, // mandatory
239
+ webChatContainerProps: {
240
+ botMagicCode: {
241
+ disabled: true,
242
+ fwdUrl: 'http://localhost:8000/sample/MagicCodeForwarder.html'
243
+ }
244
+ },
245
+ };
246
+
247
+ ReactDOM.render(
248
+ <LiveChatWidget {...liveChatWidgetProps}/>,
249
+ document.getElementById("my-container")
250
+ );
251
+ ```
252
+
229
253
  ## See Also
230
254
 
231
255
  [Telemetry](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Telemetry.md)\
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.ElementType = exports.Constants = exports.ChatSDKError = void 0;
6
+ exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.Constants = exports.ChatSDKError = exports.AriaTelemetryConstants = void 0;
7
7
 
8
8
  var _class;
9
9
 
@@ -13,6 +13,10 @@ class Constants {}
13
13
 
14
14
  exports.Constants = Constants;
15
15
 
16
+ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
17
+
18
+ _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
19
+
16
20
  _defineProperty(Constants, "systemMessageTag", "system");
17
21
 
18
22
  _defineProperty(Constants, "userMessageTag", "user");
@@ -45,8 +49,6 @@ _defineProperty(Constants, "false", "false");
45
49
 
46
50
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
47
51
 
48
- _defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
49
-
50
52
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
51
53
 
52
54
  _defineProperty(Constants, "ChannelId", "lcw");
@@ -81,6 +83,14 @@ _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
81
83
 
82
84
  _defineProperty(Constants, "message", "message");
83
85
 
86
+ _defineProperty(Constants, "hiddenTag", "Hidden");
87
+
88
+ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
89
+
90
+ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
91
+
92
+ _defineProperty(Constants, "publicMessageTag", "public");
93
+
84
94
  _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"]);
85
95
 
86
96
  _defineProperty(Constants, "maxUploadFileSize", "500000");
@@ -131,8 +141,6 @@ _defineProperty(Constants, "InputSubmit", "InputSubmit");
131
141
 
132
142
  _defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
133
143
 
134
- _defineProperty(Constants, "redirectPageRequest", "redirectPageRequest");
135
-
136
144
  _defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
137
145
 
138
146
  _defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
@@ -157,6 +165,8 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
157
165
 
158
166
  _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
159
167
 
168
+ _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
169
+
160
170
  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);
161
171
  exports.Regex = Regex;
162
172
 
@@ -284,6 +294,16 @@ exports.ChatSDKError = ChatSDKError;
284
294
  ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
285
295
  })(ChatSDKError || (exports.ChatSDKError = ChatSDKError = {}));
286
296
 
297
+ let EnvironmentVersion;
298
+ exports.EnvironmentVersion = EnvironmentVersion;
299
+
300
+ (function (EnvironmentVersion) {
301
+ EnvironmentVersion["prod"] = "prod";
302
+ EnvironmentVersion["dogfood"] = "df";
303
+ EnvironmentVersion["int"] = "int";
304
+ EnvironmentVersion["test"] = "test";
305
+ })(EnvironmentVersion || (exports.EnvironmentVersion = EnvironmentVersion = {}));
306
+
287
307
  class TranscriptConstants {}
288
308
 
289
309
  exports.TranscriptConstants = TranscriptConstants;
@@ -306,4 +326,24 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
306
326
 
307
327
  _defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
308
328
 
309
- _defineProperty(TranscriptConstants, "AgentFontColor", "white");
329
+ _defineProperty(TranscriptConstants, "AgentFontColor", "white");
330
+
331
+ class AriaTelemetryConstants {}
332
+
333
+ exports.AriaTelemetryConstants = AriaTelemetryConstants;
334
+
335
+ _defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
336
+
337
+ _defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
338
+
339
+ _defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
340
+
341
+ _defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
342
+
343
+ _defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
344
+
345
+ _defineProperty(AriaTelemetryConstants, "Public", "Public");
346
+
347
+ _defineProperty(AriaTelemetryConstants, "EU", "Europe");
348
+
349
+ _defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
@@ -37,15 +37,28 @@ exports.BroadcastEvent = BroadcastEvent;
37
37
 
38
38
  (function (BroadcastEvent) {
39
39
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
40
- BroadcastEvent["EndChat"] = "EndChat";
40
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
41
41
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
42
42
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
43
- BroadcastEvent["ChatWidgetStateChanged"] = "ChatWidgetStateChanged";
43
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
44
44
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
45
45
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
46
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
47
+ BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
46
48
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
47
49
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
48
50
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
51
+ BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
52
+ BroadcastEvent["StartChat"] = "StartChat";
53
+ BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
54
+ BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
55
+ BroadcastEvent["InitiateEndChat"] = "InitiateEndChat";
56
+ BroadcastEvent["SetCustomContext"] = "SetCustomContext";
57
+ BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
58
+ BroadcastEvent["MaximizeChat"] = "MaximizeChat";
59
+ BroadcastEvent["ChatInitiated"] = "ChatInitiated";
60
+ BroadcastEvent["CloseChat"] = "CloseChat";
61
+ BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
49
62
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
50
63
 
51
64
  let TelemetryEvent;
@@ -97,7 +110,10 @@ exports.TelemetryEvent = TelemetryEvent;
97
110
  TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
98
111
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
99
112
  TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
100
- TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
113
+ TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
114
+ TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
115
+ TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
116
+ TelemetryEvent["WindowClosed"] = "WindowClosed";
101
117
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
102
118
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
103
119
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -111,6 +127,7 @@ exports.TelemetryEvent = TelemetryEvent;
111
127
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
112
128
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
113
129
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
130
+ TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
114
131
  TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
115
132
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
116
133
  TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
@@ -121,6 +138,8 @@ exports.TelemetryEvent = TelemetryEvent;
121
138
  TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
122
139
  TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
123
140
  TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
141
+ TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
142
+ TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
124
143
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
125
144
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
126
145
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
@@ -132,6 +151,7 @@ exports.TelemetryEvent = TelemetryEvent;
132
151
  TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
133
152
  TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
134
153
  TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
154
+ TelemetryEvent["WebChatEvent"] = "WebChatEvent";
135
155
  TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
136
156
  TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
137
157
  TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
@@ -145,6 +165,7 @@ exports.TelemetryEvent = TelemetryEvent;
145
165
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
146
166
  TelemetryEvent["MessageSent"] = "MessageSent";
147
167
  TelemetryEvent["MessageReceived"] = "MessageReceived";
168
+ TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
148
169
  })(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
149
170
 
150
171
  class TelemetryConstants {
@@ -160,6 +181,7 @@ class TelemetryConstants {
160
181
  case TelemetryEvent.LCWChatButtonShow:
161
182
  case TelemetryEvent.PrechatSurveyLoaded:
162
183
  case TelemetryEvent.LoadingPaneLoaded:
184
+ case TelemetryEvent.PostChatSurveyLoadingPaneLoaded:
163
185
  case TelemetryEvent.PostChatSurveyLoaded:
164
186
  case TelemetryEvent.EmailTranscriptLoaded:
165
187
  case TelemetryEvent.OutOfOfficePaneLoaded:
@@ -186,15 +208,22 @@ class TelemetryConstants {
186
208
  case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
187
209
  case TelemetryEvent.HeaderCloseButtonClicked:
188
210
  case TelemetryEvent.HeaderMinimizeButtonClicked:
211
+ case TelemetryEvent.MessageSent:
212
+ case TelemetryEvent.MessageReceived:
213
+ case TelemetryEvent.CustomContextReceived:
189
214
  return ScenarioType.ACTIONS;
190
215
 
191
216
  case TelemetryEvent.StartChatSDKCall:
217
+ case TelemetryEvent.StartChatEventRecevied:
192
218
  case TelemetryEvent.StartChatMethodException:
193
219
  case TelemetryEvent.CloseChatMethodException:
220
+ case TelemetryEvent.StartProactiveChatEventReceived:
194
221
  case TelemetryEvent.StartProactiveChatMethodFailed:
195
222
  case TelemetryEvent.OnNewMessageFailed:
196
223
  case TelemetryEvent.OnNewMessageAudioNotificationFailed:
197
224
  case TelemetryEvent.GetConversationDetailsCallFailed:
225
+ case TelemetryEvent.EndChatSDKCall:
226
+ case TelemetryEvent.EndChatEventReceived:
198
227
  case TelemetryEvent.EndChatSDKCallFailed:
199
228
  case TelemetryEvent.PostChatContextCallFailed:
200
229
  case TelemetryEvent.PostChatContextCallSucceed:
@@ -276,5 +276,18 @@ _defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
276
276
  }
277
277
  };
278
278
 
279
+ _omnichannelChatComponents.BroadcastService.postMessage(telemetryEvent);
280
+ });
281
+
282
+ _defineProperty(TelemetryHelper, "logWebChatEvent", (logLevel, payload) => {
283
+ const telemetryEvent = {
284
+ eventName: _TelemetryConstants.TelemetryEvent.WebChatEvent,
285
+ logLevel: logLevel,
286
+ payload: { ...payload,
287
+ type: _TelemetryConstants.TelemetryEvent.WebChatEvent,
288
+ scenarioType: _TelemetryConstants.ScenarioType.WEBCHAT
289
+ }
290
+ };
291
+
279
292
  _omnichannelChatComponents.BroadcastService.postMessage(telemetryEvent);
280
293
  });
@@ -13,6 +13,10 @@ var _ariaTelemetryLogger = require("./loggers/ariaTelemetryLogger");
13
13
 
14
14
  var _consoleLogger = require("./loggers/consoleLogger");
15
15
 
16
+ var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
17
+
18
+ var _TelemetryHelper = require("./TelemetryHelper");
19
+
16
20
  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; }
17
21
 
18
22
  class TelemetryTimers {}
@@ -45,7 +49,7 @@ const RegisterLoggers = () => {
45
49
  const registerLoggers = () => {
46
50
  var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
47
51
 
48
- 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)) {
52
+ 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) {
49
53
  _omnichannelChatComponents.BroadcastService.getAnyMessage().subscribe(event => {
50
54
  if (event.payload && event.eventName in _TelemetryConstants.TelemetryEvent) {
51
55
  logTelemetry(event);
@@ -53,17 +57,17 @@ const RegisterLoggers = () => {
53
57
  });
54
58
  }
55
59
 
56
- if (!((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int5 !== void 0 && (_TelemetryManager$Int6 = _TelemetryManager$Int5.telemetryConfig) !== null && _TelemetryManager$Int6 !== void 0 && _TelemetryManager$Int6.disableConsoleLog)) {
60
+ 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) {
57
61
  loggers.push((0, _consoleLogger.consoleLogger)());
58
62
  }
59
63
 
60
- if (!((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int7 !== void 0 && (_TelemetryManager$Int8 = _TelemetryManager$Int7.telemetryConfig) !== null && _TelemetryManager$Int8 !== void 0 && _TelemetryManager$Int8.telemetryDisabled)) {
64
+ 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) {
61
65
  var _TelemetryManager$Int9, _TelemetryManager$Int18, _TelemetryManager$Int19;
62
66
 
63
67
  if ((_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int9 !== void 0 && _TelemetryManager$Int9.ariaConfig) {
64
68
  var _TelemetryManager$Int10, _TelemetryManager$Int11, _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17;
65
69
 
66
- loggers.push((0, _ariaTelemetryLogger.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"));
70
+ loggers.push((0, _ariaTelemetryLogger.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.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.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.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.defaultAriaConfig.ariaTelemetryApplicationName));
67
71
  }
68
72
 
69
73
  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;
@@ -86,8 +90,15 @@ const RegisterLoggers = () => {
86
90
 
87
91
  const logTelemetry = telemetryEvent => {
88
92
  loggers.map(logger => {
93
+ var _payload;
94
+
89
95
  const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
90
- logger.log(logLevel, parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload));
96
+ const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? _TelemetryConstants.ScenarioType.UNDEFINED;
97
+ const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
98
+ telemetryInput.telemetryInfo = {
99
+ telemetryInfo: _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
100
+ };
101
+ logger.log(logLevel, telemetryInput);
91
102
  });
92
103
  };
93
104
 
@@ -7,7 +7,7 @@ exports.defaultAriaConfig = void 0;
7
7
  const defaultAriaConfig = {
8
8
  collectorUriForTelemetry: "",
9
9
  ariaTelemetryKey: "c7655518acf1403f93ff6b9f77942f0a-d01a02fd-6b50-4de3-a566-62eda11f93bc-7083",
10
- ariaTelemetryApplicationName: "",
10
+ ariaTelemetryApplicationName: "D365_Omnichannel_Client_Public_Prod",
11
11
  disableCookieUsage: true
12
12
  };
13
13
  exports.defaultAriaConfig = defaultAriaConfig;
@@ -11,6 +11,9 @@ const defaultTelemetryConfiguration = {
11
11
  telemetryDisabled: false,
12
12
  disableConsoleLog: false,
13
13
  telemetryLoggers: [],
14
- ariaConfigurations: _defaultAriaConfig.defaultAriaConfig
14
+ ariaConfigurations: _defaultAriaConfig.defaultAriaConfig,
15
+ chatWidgetVersion: "0.0.0-0",
16
+ chatComponentVersion: "0.0.0-0",
17
+ OCChatSDKVersion: "0.0.0-0"
15
18
  };
16
19
  exports.defaultTelemetryConfiguration = defaultTelemetryConfiguration;
@@ -15,7 +15,7 @@ var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/E
15
15
 
16
16
  var _Constants = require("../../Constants");
17
17
 
18
- var _TelemetryHelper = require("../TelemetryHelper");
18
+ var _TelemetryManager = require("../TelemetryManager");
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
@@ -30,6 +30,21 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
30
30
 
31
31
  if (!(0, _utils.isNullOrEmptyString)(collectiorUriForTelemetry)) {
32
32
  configuration.collectorUri = collectiorUriForTelemetry;
33
+ } else {
34
+ if (_TelemetryManager.TelemetryManager.InternalTelemetryData.environmentVersion == _Constants.EnvironmentVersion.prod) {
35
+ var _TelemetryManager$Int;
36
+
37
+ const orgUrl = (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
38
+
39
+ if (!(0, _utils.isNullOrUndefined)(orgUrl)) {
40
+ // If the given org is a Production EU org, modify the Aria collector uri
41
+ const region = (0, _utils.getDomain)(orgUrl);
42
+
43
+ if (region === _Constants.AriaTelemetryConstants.EU) {
44
+ configuration.collectorUri = _Constants.AriaTelemetryConstants.EUROPE_ENDPOINT;
45
+ }
46
+ }
47
+ }
33
48
  }
34
49
 
35
50
  try {
@@ -48,20 +63,25 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
48
63
 
49
64
  const ariaLogger = {
50
65
  log: (logLevel, telemetryInput) => {
51
- let property;
52
- const eventProperties = new _AWTEventProperties.default();
53
-
54
- const event = _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
55
-
56
- eventProperties.setName(telemetryInput.scenarioType);
66
+ try {
67
+ let property;
68
+ const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
69
+ const eventProperties = new _AWTEventProperties.default();
70
+ eventProperties.setName(telemetryInput.scenarioType);
71
+
72
+ if (telemetryInfo) {
73
+ for (const key of Object.keys(telemetryInfo)) {
74
+ property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
75
+ eventProperties.setProperty(key, property);
76
+ }
77
+
78
+ eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
79
+ }
57
80
 
58
- for (const key of Object.keys(event)) {
59
- property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
60
- eventProperties.setProperty(key, property);
81
+ logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
82
+ } catch (error) {
83
+ console.error("Error in logging telemetry to Aria logger:" + error);
61
84
  }
62
-
63
- eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
64
- logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
65
85
  },
66
86
  dispose: () => {
67
87
  _AWTLogManager.default.flush(function () {
@@ -13,27 +13,28 @@ const consoleLogger = () => {
13
13
  const consoleLogger = {
14
14
  log: (logLevel, telemetryInput) => {
15
15
  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 : "";
16
+ 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 : "";
16
17
 
17
18
  try {
18
19
  switch (logLevel) {
19
20
  case _TelemetryConstants.LogLevel.INFO:
20
- console.info(_Constants.Constants.LiveChatWidget, payload);
21
+ console.info(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
21
22
  break;
22
23
 
23
24
  case _TelemetryConstants.LogLevel.DEBUG:
24
- console.debug(_Constants.Constants.LiveChatWidget, payload);
25
+ console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
25
26
  break;
26
27
 
27
28
  case _TelemetryConstants.LogLevel.WARN:
28
- console.warn(_Constants.Constants.LiveChatWidget, payload);
29
+ console.warn(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
29
30
  break;
30
31
 
31
32
  case _TelemetryConstants.LogLevel.ERROR:
32
- console.error(_Constants.Constants.LiveChatWidget, payload);
33
+ console.error(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
33
34
  break;
34
35
 
35
36
  default:
36
- console.debug(_Constants.Constants.LiveChatWidget, payload);
37
+ console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
37
38
  break;
38
39
  }
39
40
  } catch (ex) {
@@ -3,12 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
6
+ exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
7
7
 
8
8
  var _Constants = require("./Constants");
9
9
 
10
10
  var _KeyCodes = require("./KeyCodes");
11
11
 
12
+ var _TelemetryConstants = require("./telemetry/TelemetryConstants");
13
+
12
14
  const getElementBySelector = selector => {
13
15
  let element;
14
16
 
@@ -332,6 +334,32 @@ const createTimer = () => {
332
334
  }
333
335
 
334
336
  };
337
+ }; // Returns the domain of the org
338
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
+
340
+
341
+ exports.createTimer = createTimer;
342
+
343
+ const getDomain = hostValue => {
344
+ for (let i = 0; i < _Constants.AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
345
+ if (hostValue.endsWith(_Constants.AriaTelemetryConstants.lcwEUDomainNames[i])) {
346
+ return _Constants.AriaTelemetryConstants.EU;
347
+ }
348
+ }
349
+
350
+ return _Constants.AriaTelemetryConstants.Public;
351
+ };
352
+
353
+ exports.getDomain = getDomain;
354
+
355
+ const getWidgetCacheId = (orgId, widgetId) => {
356
+ return `${_Constants.Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
357
+ };
358
+
359
+ exports.getWidgetCacheId = getWidgetCacheId;
360
+
361
+ const getWidgetEndChatEventName = (orgId, widgetId) => {
362
+ return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
335
363
  };
336
364
 
337
- exports.createTimer = createTimer;
365
+ exports.getWidgetEndChatEventName = getWidgetEndChatEventName;
@@ -206,6 +206,20 @@ const CallingContainerStateful = props => {
206
206
  });
207
207
  }
208
208
  });
209
+ window.addEventListener("beforeunload", () => {
210
+ if (state.uiStates.isIncomingCall) {
211
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
212
+ } else {
213
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
214
+ }
215
+
216
+ voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
217
+ dispatch({
218
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
219
+ payload: false
220
+ });
221
+ resetCallingStates(true);
222
+ });
209
223
  }, []);
210
224
  const controlProps = {
211
225
  id: "oc-lcw-callingcontainer",
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
34
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
35
 
36
36
  const ChatButtonStateful = props => {
37
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
37
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
38
38
 
39
39
  const [state, dispatch] = (0, _useChatContextStore.default)();
40
40
  const {
@@ -44,20 +44,27 @@ const ChatButtonStateful = props => {
44
44
  } = props; //Setting OutOfOperatingHours Flag
45
45
 
46
46
  const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
47
+ const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
47
48
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
48
49
  const controlProps = {
49
50
  id: "oc-lcw-chat-button",
50
51
  dir: state.domainStates.globalDir,
51
52
  titleText: "Let's Chat!",
52
53
  subtitleText: "We're online.",
53
- hideNotificationBubble: !(state.appStates.isMinimized === true && state.appStates.unreadMessageCount > 0) || (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true,
54
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? _Constants.Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
54
+ hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
55
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
55
56
  onClick: async () => {
56
57
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
57
58
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
58
59
  });
59
60
 
60
- if (state.appStates.isMinimized) {
61
+ if (proactiveChatInNewWindow.current) {
62
+ const proactiveChatIsInPopoutModeEvent = {
63
+ eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
64
+ };
65
+
66
+ _omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
67
+ } else if (state.appStates.isMinimized) {
61
68
  dispatch({
62
69
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
63
70
  payload: false
@@ -66,6 +73,7 @@ const ChatButtonStateful = props => {
66
73
  await startChat();
67
74
  }
68
75
  },
76
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
69
77
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
70
78
  };
71
79
  const outOfOfficeControlProps = {
@@ -86,6 +94,7 @@ const ChatButtonStateful = props => {
86
94
  });
87
95
  }
88
96
  },
97
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
89
98
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
90
99
  };
91
100
  (0, _react.useEffect)(() => {
@@ -107,6 +116,9 @@ const ChatButtonStateful = props => {
107
116
  });
108
117
  }
109
118
  }, []);
119
+ (0, _react.useEffect)(() => {
120
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
121
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
110
122
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
111
123
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
112
124
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,