@microsoft/omnichannel-chat-widget 0.1.0-main.47ede4d → 0.1.0-main.5063558
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.
- package/README.md +32 -0
- package/lib/cjs/common/Constants.js +50 -6
- package/lib/cjs/common/telemetry/TelemetryConstants.js +38 -3
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -1
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +89 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -40
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +5 -10
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +52 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -17
- package/lib/cjs/components/livechatwidget/common/endChat.js +93 -10
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +27 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -15
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +157 -50
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +272 -72
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +10 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/cjs/contexts/createReducer.js +24 -7
- package/lib/cjs/controller/componentController.js +3 -3
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +46 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +38 -3
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +9 -1
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +64 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -38
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +5 -10
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +39 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -18
- package/lib/esm/components/livechatwidget/common/endChat.js +89 -11
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -5
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -13
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +152 -53
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +260 -77
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +10 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/esm/contexts/createReducer.js +24 -7
- package/lib/esm/controller/componentController.js +3 -3
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +25 -2
- package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +32 -5
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
- package/lib/types/common/utils.d.ts +8 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +4 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -1
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +11 -8
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
1. [Installation](#installation)
|
|
12
12
|
1. [Example Usage](#example-usage)
|
|
13
13
|
1. [Components](#components)
|
|
14
|
+
1. [Common Scenarios](#common-scenarios)
|
|
15
|
+
- [Disable Bot Magic Code](#disable-bot-magic-code)
|
|
14
16
|
1. [See Also](#see-also)
|
|
15
17
|
|
|
16
18
|
## Introduction
|
|
@@ -218,6 +220,36 @@ const customizedFooterProp: IFooterProps = {
|
|
|
218
220
|
|
|
219
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.
|
|
220
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
|
+
|
|
221
253
|
## See Also
|
|
222
254
|
|
|
223
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,12 @@ _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
|
+
|
|
170
|
+
_defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
|
|
171
|
+
|
|
172
|
+
_defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
|
|
173
|
+
|
|
160
174
|
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
175
|
exports.Regex = Regex;
|
|
162
176
|
|
|
@@ -284,6 +298,16 @@ exports.ChatSDKError = ChatSDKError;
|
|
|
284
298
|
ChatSDKError["WidgetUseOutsideOperatingHour"] = "WidgetUseOutsideOperatingHour";
|
|
285
299
|
})(ChatSDKError || (exports.ChatSDKError = ChatSDKError = {}));
|
|
286
300
|
|
|
301
|
+
let EnvironmentVersion;
|
|
302
|
+
exports.EnvironmentVersion = EnvironmentVersion;
|
|
303
|
+
|
|
304
|
+
(function (EnvironmentVersion) {
|
|
305
|
+
EnvironmentVersion["prod"] = "prod";
|
|
306
|
+
EnvironmentVersion["dogfood"] = "df";
|
|
307
|
+
EnvironmentVersion["int"] = "int";
|
|
308
|
+
EnvironmentVersion["test"] = "test";
|
|
309
|
+
})(EnvironmentVersion || (exports.EnvironmentVersion = EnvironmentVersion = {}));
|
|
310
|
+
|
|
287
311
|
class TranscriptConstants {}
|
|
288
312
|
|
|
289
313
|
exports.TranscriptConstants = TranscriptConstants;
|
|
@@ -306,4 +330,24 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
|
|
|
306
330
|
|
|
307
331
|
_defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
|
|
308
332
|
|
|
309
|
-
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
333
|
+
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
334
|
+
|
|
335
|
+
class AriaTelemetryConstants {}
|
|
336
|
+
|
|
337
|
+
exports.AriaTelemetryConstants = AriaTelemetryConstants;
|
|
338
|
+
|
|
339
|
+
_defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
|
|
340
|
+
|
|
341
|
+
_defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
|
|
342
|
+
|
|
343
|
+
_defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
|
|
344
|
+
|
|
345
|
+
_defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
|
|
346
|
+
|
|
347
|
+
_defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
|
|
348
|
+
|
|
349
|
+
_defineProperty(AriaTelemetryConstants, "Public", "Public");
|
|
350
|
+
|
|
351
|
+
_defineProperty(AriaTelemetryConstants, "EU", "Europe");
|
|
352
|
+
|
|
353
|
+
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
@@ -37,15 +37,29 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
37
37
|
|
|
38
38
|
(function (BroadcastEvent) {
|
|
39
39
|
BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
|
|
40
|
-
BroadcastEvent["
|
|
40
|
+
BroadcastEvent["ChatEnded"] = "ChatEnded";
|
|
41
41
|
BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
|
|
42
42
|
BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
|
|
43
|
-
BroadcastEvent["
|
|
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";
|
|
62
|
+
BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
|
|
49
63
|
})(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
|
|
50
64
|
|
|
51
65
|
let TelemetryEvent;
|
|
@@ -97,7 +111,10 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
97
111
|
TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
|
|
98
112
|
TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
|
|
99
113
|
TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
|
|
100
|
-
TelemetryEvent["
|
|
114
|
+
TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
|
|
115
|
+
TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
|
|
116
|
+
TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
|
|
117
|
+
TelemetryEvent["WindowClosed"] = "WindowClosed";
|
|
101
118
|
TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
|
|
102
119
|
TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
|
|
103
120
|
TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
|
|
@@ -111,6 +128,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
111
128
|
TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
|
|
112
129
|
TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
|
|
113
130
|
TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
|
|
131
|
+
TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
|
|
114
132
|
TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
|
|
115
133
|
TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
|
|
116
134
|
TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
|
|
@@ -121,6 +139,12 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
121
139
|
TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
|
|
122
140
|
TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
|
|
123
141
|
TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
|
|
142
|
+
TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
|
|
143
|
+
TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
|
|
144
|
+
TelemetryEvent["GetConversationDetailsException"] = "GetConversationDetailsException";
|
|
145
|
+
TelemetryEvent["BrowserUnloadEventStarted"] = "BrowserUnloadEventStarted";
|
|
146
|
+
TelemetryEvent["GetAuthTokenCalled"] = "GetAuthTokenCalled";
|
|
147
|
+
TelemetryEvent["ReceivedNullOrEmptyToken"] = "ReceivedNullOrEmptyToken";
|
|
124
148
|
TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
|
|
125
149
|
TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
|
|
126
150
|
TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
|
|
@@ -132,6 +156,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
132
156
|
TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
|
|
133
157
|
TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
|
|
134
158
|
TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
|
|
159
|
+
TelemetryEvent["WebChatEvent"] = "WebChatEvent";
|
|
135
160
|
TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
|
|
136
161
|
TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
|
|
137
162
|
TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
|
|
@@ -145,6 +170,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
145
170
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
146
171
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
147
172
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
173
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
148
174
|
})(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
|
|
149
175
|
|
|
150
176
|
class TelemetryConstants {
|
|
@@ -160,6 +186,7 @@ class TelemetryConstants {
|
|
|
160
186
|
case TelemetryEvent.LCWChatButtonShow:
|
|
161
187
|
case TelemetryEvent.PrechatSurveyLoaded:
|
|
162
188
|
case TelemetryEvent.LoadingPaneLoaded:
|
|
189
|
+
case TelemetryEvent.PostChatSurveyLoadingPaneLoaded:
|
|
163
190
|
case TelemetryEvent.PostChatSurveyLoaded:
|
|
164
191
|
case TelemetryEvent.EmailTranscriptLoaded:
|
|
165
192
|
case TelemetryEvent.OutOfOfficePaneLoaded:
|
|
@@ -186,15 +213,23 @@ class TelemetryConstants {
|
|
|
186
213
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
187
214
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
188
215
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
216
|
+
case TelemetryEvent.MessageSent:
|
|
217
|
+
case TelemetryEvent.MessageReceived:
|
|
218
|
+
case TelemetryEvent.CustomContextReceived:
|
|
219
|
+
case TelemetryEvent.BrowserUnloadEventStarted:
|
|
189
220
|
return ScenarioType.ACTIONS;
|
|
190
221
|
|
|
191
222
|
case TelemetryEvent.StartChatSDKCall:
|
|
223
|
+
case TelemetryEvent.StartChatEventRecevied:
|
|
192
224
|
case TelemetryEvent.StartChatMethodException:
|
|
193
225
|
case TelemetryEvent.CloseChatMethodException:
|
|
226
|
+
case TelemetryEvent.StartProactiveChatEventReceived:
|
|
194
227
|
case TelemetryEvent.StartProactiveChatMethodFailed:
|
|
195
228
|
case TelemetryEvent.OnNewMessageFailed:
|
|
196
229
|
case TelemetryEvent.OnNewMessageAudioNotificationFailed:
|
|
197
230
|
case TelemetryEvent.GetConversationDetailsCallFailed:
|
|
231
|
+
case TelemetryEvent.EndChatSDKCall:
|
|
232
|
+
case TelemetryEvent.EndChatEventReceived:
|
|
198
233
|
case TelemetryEvent.EndChatSDKCallFailed:
|
|
199
234
|
case TelemetryEvent.PostChatContextCallFailed:
|
|
200
235
|
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
|
});
|
|
@@ -15,6 +15,8 @@ var _consoleLogger = require("./loggers/consoleLogger");
|
|
|
15
15
|
|
|
16
16
|
var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
|
|
17
17
|
|
|
18
|
+
var _TelemetryHelper = require("./TelemetryHelper");
|
|
19
|
+
|
|
18
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; }
|
|
19
21
|
|
|
20
22
|
class TelemetryTimers {}
|
|
@@ -88,8 +90,15 @@ const RegisterLoggers = () => {
|
|
|
88
90
|
|
|
89
91
|
const logTelemetry = telemetryEvent => {
|
|
90
92
|
loggers.map(logger => {
|
|
93
|
+
var _payload;
|
|
94
|
+
|
|
91
95
|
const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
|
|
92
|
-
|
|
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);
|
|
93
102
|
});
|
|
94
103
|
};
|
|
95
104
|
|
|
@@ -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
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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) {
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,12 +3,18 @@
|
|
|
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.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getBroadcastChannelName = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
|
|
8
8
|
var _Constants = require("./Constants");
|
|
9
9
|
|
|
10
|
+
var _DataStoreManager = require("./contextDataStore/DataStoreManager");
|
|
11
|
+
|
|
10
12
|
var _KeyCodes = require("./KeyCodes");
|
|
11
13
|
|
|
14
|
+
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
15
|
+
|
|
16
|
+
var _md5Typescript = require("md5-typescript");
|
|
17
|
+
|
|
12
18
|
const getElementBySelector = selector => {
|
|
13
19
|
let element;
|
|
14
20
|
|
|
@@ -332,6 +338,87 @@ const createTimer = () => {
|
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
};
|
|
341
|
+
}; // Returns the domain of the org
|
|
342
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
exports.createTimer = createTimer;
|
|
346
|
+
|
|
347
|
+
const getDomain = hostValue => {
|
|
348
|
+
for (let i = 0; i < _Constants.AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
349
|
+
if (hostValue.endsWith(_Constants.AriaTelemetryConstants.lcwEUDomainNames[i])) {
|
|
350
|
+
return _Constants.AriaTelemetryConstants.EU;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return _Constants.AriaTelemetryConstants.Public;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
exports.getDomain = getDomain;
|
|
358
|
+
|
|
359
|
+
const getWidgetCacheId = (orgId, widgetId, widgetInstanceId) => {
|
|
360
|
+
const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
361
|
+
return _md5Typescript.Md5.init(widgetCacheId);
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
exports.getWidgetCacheId = getWidgetCacheId;
|
|
365
|
+
|
|
366
|
+
const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) => {
|
|
367
|
+
if (!isNullOrEmptyString(widgetInstanceId)) {
|
|
368
|
+
return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
372
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
exports.getWidgetEndChatEventName = getWidgetEndChatEventName;
|
|
376
|
+
|
|
377
|
+
const getStateFromCache = (orgId, widgetId, widgetInstanceId) => {
|
|
378
|
+
// Getting updated state from cache
|
|
379
|
+
try {
|
|
380
|
+
if (_DataStoreManager.DataStoreManager.clientDataStore) {
|
|
381
|
+
var _DataStoreManager$cli;
|
|
382
|
+
|
|
383
|
+
const widgetStateEventName = getWidgetCacheId(orgId, widgetId, widgetInstanceId);
|
|
384
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
|
|
385
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
386
|
+
return persistedState;
|
|
387
|
+
} else {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
} catch (error) {
|
|
391
|
+
console.log(error);
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
394
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
exports.getStateFromCache = getStateFromCache;
|
|
398
|
+
|
|
399
|
+
const isUndefinedOrEmpty = object => {
|
|
400
|
+
if (object) {
|
|
401
|
+
if (Object.keys(object).length === 0) {
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return false;
|
|
406
|
+
} else {
|
|
407
|
+
return true;
|
|
408
|
+
}
|
|
409
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
exports.isUndefinedOrEmpty = isUndefinedOrEmpty;
|
|
413
|
+
|
|
414
|
+
const addDelayInMs = ms => {
|
|
415
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
exports.addDelayInMs = addDelayInMs;
|
|
419
|
+
|
|
420
|
+
const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
|
|
421
|
+
return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
|
|
335
422
|
};
|
|
336
423
|
|
|
337
|
-
exports.
|
|
424
|
+
exports.getBroadcastChannelName = getBroadcastChannelName;
|
|
@@ -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:
|
|
54
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ?
|
|
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 (
|
|
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 = {
|
|
@@ -74,6 +82,10 @@ const ChatButtonStateful = props => {
|
|
|
74
82
|
titleText: "We're Offline",
|
|
75
83
|
subtitleText: "No agents available",
|
|
76
84
|
onClick: async () => {
|
|
85
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
86
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
87
|
+
});
|
|
88
|
+
|
|
77
89
|
if (state.appStates.isMinimized) {
|
|
78
90
|
dispatch({
|
|
79
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -86,6 +98,7 @@ const ChatButtonStateful = props => {
|
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
},
|
|
101
|
+
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
102
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
90
103
|
};
|
|
91
104
|
(0, _react.useEffect)(() => {
|
|
@@ -107,6 +120,9 @@ const ChatButtonStateful = props => {
|
|
|
107
120
|
});
|
|
108
121
|
}
|
|
109
122
|
}, []);
|
|
123
|
+
(0, _react.useEffect)(() => {
|
|
124
|
+
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
125
|
+
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
110
126
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
|
|
111
127
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
112
128
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|