@microsoft/omnichannel-chat-widget 0.1.0-main.c461296 → 0.1.0-main.d80ebb6
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 +35 -11
- package/lib/cjs/common/Constants.js +46 -6
- package/lib/cjs/common/telemetry/TelemetryConstants.js +27 -2
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +16 -5
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -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 +30 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -39
- 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 +1 -7
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -15
- package/lib/cjs/components/livechatwidget/common/endChat.js +63 -12
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +15 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
- package/lib/cjs/components/livechatwidget/common/startChat.js +87 -39
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +113 -21
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +4 -5
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -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/mesageTimestampMiddleware.js +116 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +8 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/cjs/contexts/createReducer.js +8 -10
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +42 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +27 -2
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +14 -5
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -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 +19 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +18 -6
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -37
- 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 +1 -7
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +12 -16
- package/lib/esm/components/livechatwidget/common/endChat.js +58 -13
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -4
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
- package/lib/esm/components/livechatwidget/common/startChat.js +90 -44
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +106 -24
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -7
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +16 -0
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -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/mesageTimestampMiddleware.js +106 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +8 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/esm/contexts/createReducer.js +8 -9
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +23 -2
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +22 -4
- 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 +3 -0
- 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/livechatwidget/common/endChat.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.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/mesageTimestampMiddleware.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +9 -8
- package/package.json +6 -7
|
@@ -26,15 +26,24 @@ export let BroadcastEvent; // Events being logged
|
|
|
26
26
|
|
|
27
27
|
(function (BroadcastEvent) {
|
|
28
28
|
BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
|
|
29
|
-
BroadcastEvent["
|
|
29
|
+
BroadcastEvent["ChatEnded"] = "ChatEnded";
|
|
30
30
|
BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
|
|
31
31
|
BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
|
|
32
|
-
BroadcastEvent["
|
|
32
|
+
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
33
33
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
34
34
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
35
|
+
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
36
|
+
BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
|
|
35
37
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
36
38
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
37
39
|
BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
|
|
40
|
+
BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
|
|
41
|
+
BroadcastEvent["StartChat"] = "StartChat";
|
|
42
|
+
BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
|
|
43
|
+
BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
|
|
44
|
+
BroadcastEvent["EndChat"] = "EndChat";
|
|
45
|
+
BroadcastEvent["SetCustomContext"] = "SetCustomContext";
|
|
46
|
+
BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
|
|
38
47
|
})(BroadcastEvent || (BroadcastEvent = {}));
|
|
39
48
|
|
|
40
49
|
export let TelemetryEvent;
|
|
@@ -85,7 +94,10 @@ export let TelemetryEvent;
|
|
|
85
94
|
TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
|
|
86
95
|
TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
|
|
87
96
|
TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
|
|
97
|
+
TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
|
|
88
98
|
TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
|
|
99
|
+
TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
|
|
100
|
+
TelemetryEvent["WindowClosed"] = "WindowClosed";
|
|
89
101
|
TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
|
|
90
102
|
TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
|
|
91
103
|
TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
|
|
@@ -99,6 +111,7 @@ export let TelemetryEvent;
|
|
|
99
111
|
TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
|
|
100
112
|
TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
|
|
101
113
|
TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
|
|
114
|
+
TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
|
|
102
115
|
TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
|
|
103
116
|
TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
|
|
104
117
|
TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
|
|
@@ -109,6 +122,8 @@ export let TelemetryEvent;
|
|
|
109
122
|
TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
|
|
110
123
|
TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
|
|
111
124
|
TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
|
|
125
|
+
TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
|
|
126
|
+
TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
|
|
112
127
|
TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
|
|
113
128
|
TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
|
|
114
129
|
TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
|
|
@@ -120,6 +135,7 @@ export let TelemetryEvent;
|
|
|
120
135
|
TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
|
|
121
136
|
TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
|
|
122
137
|
TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
|
|
138
|
+
TelemetryEvent["WebChatEvent"] = "WebChatEvent";
|
|
123
139
|
TelemetryEvent["PreChatSurveyStartChatMethodFailed"] = "PreChatSurveyStartChatMethodFailed";
|
|
124
140
|
TelemetryEvent["ChatAlreadyTriggered"] = "ChatAlreadyTriggered";
|
|
125
141
|
TelemetryEvent["StartProactiveChatEventReceived"] = "StartProactiveChatEventReceived";
|
|
@@ -133,6 +149,7 @@ export let TelemetryEvent;
|
|
|
133
149
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
134
150
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
135
151
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
152
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
136
153
|
})(TelemetryEvent || (TelemetryEvent = {}));
|
|
137
154
|
|
|
138
155
|
export class TelemetryConstants {
|
|
@@ -148,6 +165,7 @@ export class TelemetryConstants {
|
|
|
148
165
|
case TelemetryEvent.LCWChatButtonShow:
|
|
149
166
|
case TelemetryEvent.PrechatSurveyLoaded:
|
|
150
167
|
case TelemetryEvent.LoadingPaneLoaded:
|
|
168
|
+
case TelemetryEvent.PostChatSurveyLoadingPaneLoaded:
|
|
151
169
|
case TelemetryEvent.PostChatSurveyLoaded:
|
|
152
170
|
case TelemetryEvent.EmailTranscriptLoaded:
|
|
153
171
|
case TelemetryEvent.OutOfOfficePaneLoaded:
|
|
@@ -174,15 +192,22 @@ export class TelemetryConstants {
|
|
|
174
192
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
175
193
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
176
194
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
195
|
+
case TelemetryEvent.MessageSent:
|
|
196
|
+
case TelemetryEvent.MessageReceived:
|
|
197
|
+
case TelemetryEvent.CustomContextReceived:
|
|
177
198
|
return ScenarioType.ACTIONS;
|
|
178
199
|
|
|
179
200
|
case TelemetryEvent.StartChatSDKCall:
|
|
201
|
+
case TelemetryEvent.StartChatEventRecevied:
|
|
180
202
|
case TelemetryEvent.StartChatMethodException:
|
|
181
203
|
case TelemetryEvent.CloseChatMethodException:
|
|
204
|
+
case TelemetryEvent.StartProactiveChatEventReceived:
|
|
182
205
|
case TelemetryEvent.StartProactiveChatMethodFailed:
|
|
183
206
|
case TelemetryEvent.OnNewMessageFailed:
|
|
184
207
|
case TelemetryEvent.OnNewMessageAudioNotificationFailed:
|
|
185
208
|
case TelemetryEvent.GetConversationDetailsCallFailed:
|
|
209
|
+
case TelemetryEvent.EndChatSDKCall:
|
|
210
|
+
case TelemetryEvent.EndChatEventReceived:
|
|
186
211
|
case TelemetryEvent.EndChatSDKCallFailed:
|
|
187
212
|
case TelemetryEvent.PostChatContextCallFailed:
|
|
188
213
|
case TelemetryEvent.PostChatContextCallSucceed:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
|
-
import { ScenarioType } from "./TelemetryConstants";
|
|
3
|
+
import { ScenarioType, TelemetryEvent } from "./TelemetryConstants";
|
|
4
4
|
import { newGuid } from "../utils";
|
|
5
5
|
import { TelemetryManager } from "./TelemetryManager";
|
|
6
6
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -259,4 +259,16 @@ _defineProperty(TelemetryHelper, "logConfigDataEvent", (logLevel, payload) => {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
BroadcastService.postMessage(telemetryEvent);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
_defineProperty(TelemetryHelper, "logWebChatEvent", (logLevel, payload) => {
|
|
265
|
+
const telemetryEvent = {
|
|
266
|
+
eventName: TelemetryEvent.WebChatEvent,
|
|
267
|
+
logLevel: logLevel,
|
|
268
|
+
payload: { ...payload,
|
|
269
|
+
type: TelemetryEvent.WebChatEvent,
|
|
270
|
+
scenarioType: ScenarioType.WEBCHAT
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
BroadcastService.postMessage(telemetryEvent);
|
|
262
274
|
});
|
|
@@ -4,6 +4,8 @@ import { LogLevel, ScenarioType, TelemetryConstants, TelemetryEvent } from "./Te
|
|
|
4
4
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
5
5
|
import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
|
|
6
6
|
import { consoleLogger } from "./loggers/consoleLogger";
|
|
7
|
+
import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
|
|
8
|
+
import { TelemetryHelper } from "./TelemetryHelper";
|
|
7
9
|
export class TelemetryTimers {}
|
|
8
10
|
|
|
9
11
|
_defineProperty(TelemetryTimers, "LcwLoadToChatButtonTimer", void 0);
|
|
@@ -26,7 +28,7 @@ export const RegisterLoggers = () => {
|
|
|
26
28
|
const registerLoggers = () => {
|
|
27
29
|
var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
|
|
28
30
|
|
|
29
|
-
if (
|
|
31
|
+
if (((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : (_TelemetryManager$Int2 = _TelemetryManager$Int.telemetryConfig) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.disableConsoleLog) === false || ((_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : (_TelemetryManager$Int4 = _TelemetryManager$Int3.telemetryConfig) === null || _TelemetryManager$Int4 === void 0 ? void 0 : _TelemetryManager$Int4.telemetryDisabled) === false) {
|
|
30
32
|
BroadcastService.getAnyMessage().subscribe(event => {
|
|
31
33
|
if (event.payload && event.eventName in TelemetryEvent) {
|
|
32
34
|
logTelemetry(event);
|
|
@@ -34,17 +36,17 @@ export const RegisterLoggers = () => {
|
|
|
34
36
|
});
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
if (
|
|
39
|
+
if (((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int5 === void 0 ? void 0 : (_TelemetryManager$Int6 = _TelemetryManager$Int5.telemetryConfig) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.disableConsoleLog) === false) {
|
|
38
40
|
loggers.push(consoleLogger());
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
if (
|
|
43
|
+
if (((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : (_TelemetryManager$Int8 = _TelemetryManager$Int7.telemetryConfig) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.telemetryDisabled) === false) {
|
|
42
44
|
var _TelemetryManager$Int9, _TelemetryManager$Int18, _TelemetryManager$Int19;
|
|
43
45
|
|
|
44
46
|
if ((_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int9 !== void 0 && _TelemetryManager$Int9.ariaConfig) {
|
|
45
47
|
var _TelemetryManager$Int10, _TelemetryManager$Int11, _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17;
|
|
46
48
|
|
|
47
|
-
loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : (_TelemetryManager$Int11 = _TelemetryManager$Int10.ariaConfig) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.ariaTelemetryKey) ??
|
|
49
|
+
loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : (_TelemetryManager$Int11 = _TelemetryManager$Int10.ariaConfig) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.ariaTelemetryKey) ?? defaultAriaConfig.ariaTelemetryKey, ((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : (_TelemetryManager$Int13 = _TelemetryManager$Int12.ariaConfig) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.disableCookieUsage) ?? defaultAriaConfig.disableCookieUsage, ((_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : (_TelemetryManager$Int15 = _TelemetryManager$Int14.ariaConfig) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.collectorUriForTelemetry) ?? defaultAriaConfig.collectorUriForTelemetry, ((_TelemetryManager$Int16 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : (_TelemetryManager$Int17 = _TelemetryManager$Int16.ariaConfig) === null || _TelemetryManager$Int17 === void 0 ? void 0 : _TelemetryManager$Int17.ariaTelemetryApplicationName) ?? defaultAriaConfig.ariaTelemetryApplicationName));
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
const customLoggers = (_TelemetryManager$Int18 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int18 === void 0 ? void 0 : (_TelemetryManager$Int19 = _TelemetryManager$Int18.telemetryConfig) === null || _TelemetryManager$Int19 === void 0 ? void 0 : _TelemetryManager$Int19.telemetryLoggers;
|
|
@@ -67,8 +69,15 @@ export const RegisterLoggers = () => {
|
|
|
67
69
|
|
|
68
70
|
const logTelemetry = telemetryEvent => {
|
|
69
71
|
loggers.map(logger => {
|
|
72
|
+
var _payload;
|
|
73
|
+
|
|
70
74
|
const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
|
|
71
|
-
|
|
75
|
+
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
|
|
76
|
+
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
77
|
+
telemetryInput.telemetryInfo = {
|
|
78
|
+
telemetryInfo: TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
79
|
+
};
|
|
80
|
+
logger.log(logLevel, telemetryInput);
|
|
72
81
|
});
|
|
73
82
|
};
|
|
74
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const defaultAriaConfig = {
|
|
2
2
|
collectorUriForTelemetry: "",
|
|
3
3
|
ariaTelemetryKey: "c7655518acf1403f93ff6b9f77942f0a-d01a02fd-6b50-4de3-a566-62eda11f93bc-7083",
|
|
4
|
-
ariaTelemetryApplicationName: "",
|
|
4
|
+
ariaTelemetryApplicationName: "D365_Omnichannel_Client_Public_Prod",
|
|
5
5
|
disableCookieUsage: true
|
|
6
6
|
};
|
|
@@ -3,5 +3,8 @@ export const defaultTelemetryConfiguration = {
|
|
|
3
3
|
telemetryDisabled: false,
|
|
4
4
|
disableConsoleLog: false,
|
|
5
5
|
telemetryLoggers: [],
|
|
6
|
-
ariaConfigurations: defaultAriaConfig
|
|
6
|
+
ariaConfigurations: defaultAriaConfig,
|
|
7
|
+
chatWidgetVersion: "0.0.0-0",
|
|
8
|
+
chatComponentVersion: "0.0.0-0",
|
|
9
|
+
OCChatSDKVersion: "0.0.0-0"
|
|
7
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
1
|
+
import { getDomain, isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
2
2
|
import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties";
|
|
3
3
|
import AWTLogManager from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager";
|
|
4
4
|
import { AWTPiiKind } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
|
|
5
|
-
import { Constants } from "../../Constants";
|
|
6
|
-
import {
|
|
5
|
+
import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
|
|
6
|
+
import { TelemetryManager } from "../TelemetryManager";
|
|
7
7
|
export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
8
8
|
let _logger;
|
|
9
9
|
|
|
@@ -15,6 +15,21 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
15
15
|
|
|
16
16
|
if (!isNullOrEmptyString(collectiorUriForTelemetry)) {
|
|
17
17
|
configuration.collectorUri = collectiorUriForTelemetry;
|
|
18
|
+
} else {
|
|
19
|
+
if (TelemetryManager.InternalTelemetryData.environmentVersion == EnvironmentVersion.prod) {
|
|
20
|
+
var _TelemetryManager$Int;
|
|
21
|
+
|
|
22
|
+
const orgUrl = (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
|
|
23
|
+
|
|
24
|
+
if (!isNullOrUndefined(orgUrl)) {
|
|
25
|
+
// If the given org is a Production EU org, modify the Aria collector uri
|
|
26
|
+
const region = getDomain(orgUrl);
|
|
27
|
+
|
|
28
|
+
if (region === AriaTelemetryConstants.EU) {
|
|
29
|
+
configuration.collectorUri = AriaTelemetryConstants.EUROPE_ENDPOINT;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
try {
|
|
@@ -33,18 +48,25 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
33
48
|
|
|
34
49
|
const ariaLogger = {
|
|
35
50
|
log: (logLevel, telemetryInput) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
for (const key of Object.keys(event)) {
|
|
42
|
-
property = typeof event[key] === "object" ? JSON.stringify(event[key]) : event[key];
|
|
43
|
-
eventProperties.setProperty(key, property);
|
|
44
|
-
}
|
|
51
|
+
try {
|
|
52
|
+
let property;
|
|
53
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
54
|
+
const eventProperties = new AWTEventProperties();
|
|
55
|
+
eventProperties.setName(telemetryInput.scenarioType);
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
if (telemetryInfo) {
|
|
58
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
59
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
60
|
+
eventProperties.setProperty(key, property);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
69
|
+
}
|
|
48
70
|
},
|
|
49
71
|
dispose: () => {
|
|
50
72
|
AWTLogManager.flush(function () {
|
|
@@ -4,27 +4,28 @@ export const consoleLogger = () => {
|
|
|
4
4
|
const consoleLogger = {
|
|
5
5
|
log: (logLevel, telemetryInput) => {
|
|
6
6
|
const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
|
|
7
|
+
const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
|
|
7
8
|
|
|
8
9
|
try {
|
|
9
10
|
switch (logLevel) {
|
|
10
11
|
case LogLevel.INFO:
|
|
11
|
-
console.info(Constants.LiveChatWidget, payload);
|
|
12
|
+
console.info(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
12
13
|
break;
|
|
13
14
|
|
|
14
15
|
case LogLevel.DEBUG:
|
|
15
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
16
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
16
17
|
break;
|
|
17
18
|
|
|
18
19
|
case LogLevel.WARN:
|
|
19
|
-
console.warn(Constants.LiveChatWidget, payload);
|
|
20
|
+
console.warn(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
20
21
|
break;
|
|
21
22
|
|
|
22
23
|
case LogLevel.ERROR:
|
|
23
|
-
console.error(Constants.LiveChatWidget, payload);
|
|
24
|
+
console.error(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
24
25
|
break;
|
|
25
26
|
|
|
26
27
|
default:
|
|
27
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
28
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
} catch (ex) {
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Constants, LocaleConstants } from "./Constants";
|
|
1
|
+
import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
|
|
2
2
|
import { KeyCodes } from "./KeyCodes";
|
|
3
|
+
import { BroadcastEvent } from "./telemetry/TelemetryConstants";
|
|
3
4
|
|
|
4
5
|
const getElementBySelector = selector => {
|
|
5
6
|
let element;
|
|
@@ -276,4 +277,21 @@ export const createTimer = () => {
|
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
};
|
|
280
|
+
}; // Returns the domain of the org
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
282
|
+
|
|
283
|
+
export const getDomain = hostValue => {
|
|
284
|
+
for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
285
|
+
if (hostValue.endsWith(AriaTelemetryConstants.lcwEUDomainNames[i])) {
|
|
286
|
+
return AriaTelemetryConstants.EU;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return AriaTelemetryConstants.Public;
|
|
291
|
+
};
|
|
292
|
+
export const getWidgetCacheId = (orgId, widgetId) => {
|
|
293
|
+
return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
|
|
294
|
+
};
|
|
295
|
+
export const getWidgetEndChatEventName = (orgId, widgetId) => {
|
|
296
|
+
return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
279
297
|
};
|
|
@@ -177,6 +177,20 @@ export const CallingContainerStateful = props => {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
+
window.addEventListener("beforeunload", () => {
|
|
181
|
+
if (state.uiStates.isIncomingCall) {
|
|
182
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
183
|
+
} else {
|
|
184
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
188
|
+
dispatch({
|
|
189
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
190
|
+
payload: false
|
|
191
|
+
});
|
|
192
|
+
resetCallingStates(true);
|
|
193
|
+
});
|
|
180
194
|
}, []);
|
|
181
195
|
const controlProps = {
|
|
182
196
|
id: "oc-lcw-callingcontainer",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
5
5
|
import { setFocusOnElement } from "../../common/utils";
|
|
@@ -9,8 +9,9 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
9
9
|
import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
|
|
10
10
|
import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
|
+
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
12
13
|
export const ChatButtonStateful = props => {
|
|
13
|
-
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
|
|
14
|
+
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
14
15
|
|
|
15
16
|
const [state, dispatch] = useChatContextStore();
|
|
16
17
|
const {
|
|
@@ -20,20 +21,26 @@ export const ChatButtonStateful = props => {
|
|
|
20
21
|
} = props; //Setting OutOfOperatingHours Flag
|
|
21
22
|
|
|
22
23
|
const [outOfOperatingHours, setOutOfOperatingHours] = 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");
|
|
24
|
+
const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
23
25
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
24
26
|
const controlProps = {
|
|
25
27
|
id: "oc-lcw-chat-button",
|
|
26
28
|
dir: state.domainStates.globalDir,
|
|
27
29
|
titleText: "Let's Chat!",
|
|
28
30
|
subtitleText: "We're online.",
|
|
29
|
-
hideNotificationBubble:
|
|
30
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ?
|
|
31
|
+
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,
|
|
32
|
+
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > 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",
|
|
31
33
|
onClick: async () => {
|
|
32
34
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
33
35
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
34
36
|
});
|
|
35
37
|
|
|
36
|
-
if (
|
|
38
|
+
if (proactiveChatInNewWindow.current) {
|
|
39
|
+
const proactiveChatIsInPopoutModeEvent = {
|
|
40
|
+
eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
41
|
+
};
|
|
42
|
+
BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
43
|
+
} else if (state.appStates.isMinimized) {
|
|
37
44
|
dispatch({
|
|
38
45
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
39
46
|
payload: false
|
|
@@ -42,6 +49,7 @@ export const ChatButtonStateful = props => {
|
|
|
42
49
|
await startChat();
|
|
43
50
|
}
|
|
44
51
|
},
|
|
52
|
+
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,
|
|
45
53
|
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
46
54
|
};
|
|
47
55
|
const outOfOfficeControlProps = {
|
|
@@ -62,6 +70,7 @@ export const ChatButtonStateful = props => {
|
|
|
62
70
|
});
|
|
63
71
|
}
|
|
64
72
|
},
|
|
73
|
+
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,
|
|
65
74
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
66
75
|
};
|
|
67
76
|
useEffect(() => {
|
|
@@ -83,6 +92,9 @@ export const ChatButtonStateful = props => {
|
|
|
83
92
|
});
|
|
84
93
|
}
|
|
85
94
|
}, []);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
97
|
+
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
86
98
|
return /*#__PURE__*/React.createElement(ChatButton, {
|
|
87
99
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
88
100
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
|
|
5
|
-
import { Constants } from "../../common/Constants";
|
|
6
|
-
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
7
5
|
import { DimLayer } from "../dimlayer/DimLayer";
|
|
8
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
9
7
|
import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
10
8
|
import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
11
|
-
import { PostChatSurveyMode } from "../postchatsurveypanestateful/enums/PostChatSurveyMode";
|
|
12
9
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
13
10
|
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
14
|
-
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
15
|
-
import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
12
|
|
|
17
13
|
export const ConfirmationPaneStateful = props => {
|
|
18
|
-
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
|
|
19
|
-
|
|
20
14
|
const initialTabIndexMap = new Map();
|
|
21
|
-
let elements = [];
|
|
22
|
-
|
|
23
|
-
const chatSDK = useChatSDKStore();
|
|
15
|
+
let elements = [];
|
|
24
16
|
const [state, dispatch] = useChatContextStore();
|
|
25
17
|
const {
|
|
26
|
-
|
|
18
|
+
prepareEndChat
|
|
27
19
|
} = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
21
|
|
|
30
22
|
const [adapter] = useChatAdapterStore();
|
|
31
|
-
const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
|
|
32
|
-
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
|
|
33
23
|
const controlProps = {
|
|
34
24
|
id: "oc-lcw-confirmation-pane",
|
|
35
25
|
dir: state.domainStates.globalDir,
|
|
@@ -44,28 +34,8 @@ export const ConfirmationPaneStateful = props => {
|
|
|
44
34
|
});
|
|
45
35
|
|
|
46
36
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === Constants.truePascal) {
|
|
51
|
-
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
52
|
-
const loadPostChatEvent = {
|
|
53
|
-
eventName: BroadcastEvent.LoadPostChatSurvey
|
|
54
|
-
};
|
|
55
|
-
BroadcastService.postMessage(loadPostChatEvent);
|
|
56
|
-
} else if (postChatSurveyMode === PostChatSurveyMode.Link) {
|
|
57
|
-
const skipEndChatSDK = false;
|
|
58
|
-
const skipCloseChat = true;
|
|
59
|
-
await endChat(adapter, skipEndChatSDK, skipCloseChat);
|
|
60
|
-
dispatch({
|
|
61
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
62
|
-
payload: ConversationState.InActive
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
setTabIndices(elements, initialTabIndexMap, true);
|
|
67
|
-
await endChat(adapter);
|
|
68
|
-
}
|
|
37
|
+
setTabIndices(elements, initialTabIndexMap, true);
|
|
38
|
+
await prepareEndChat(adapter, state);
|
|
69
39
|
} catch (ex) {
|
|
70
40
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
71
41
|
Event: TelemetryEvent.GetConversationDetailsCallFailed,
|
|
@@ -97,8 +97,7 @@ export const FooterStateful = props => {
|
|
|
97
97
|
styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
|
|
98
98
|
}), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
|
|
99
99
|
audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
|
|
100
|
-
|
|
101
|
-
isAudioMuted: state.appStates.isAudioMuted ?? false
|
|
100
|
+
isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
|
|
102
101
|
}));
|
|
103
102
|
};
|
|
104
103
|
export default FooterStateful;
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -105,8 +105,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
105
105
|
let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
|
|
106
106
|
let dialogColor = TranscriptConstants.CustomerDialogColor;
|
|
107
107
|
let fontColor = TranscriptConstants.CustomerFontColor;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
|
|
109
|
+
const isControlMessage = value.isControlMessage && value.isControlMessage === true;
|
|
110
|
+
const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
|
|
111
|
+
const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
|
|
112
|
+
const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
|
|
113
|
+
const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
|
|
114
|
+
|
|
115
|
+
if (shouldIgnoreMessage) {
|
|
110
116
|
return;
|
|
111
117
|
} else if (value.from) {
|
|
112
118
|
if (value.from.application) {
|
|
@@ -127,7 +133,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
127
133
|
|
|
128
134
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
129
135
|
fileAttachmentName = value.attachments[0].name;
|
|
130
|
-
value.content = attachmentMessage
|
|
136
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
|
|
@@ -46,13 +46,7 @@ export const HeaderStateful = props => {
|
|
|
46
46
|
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
47
47
|
payload: true
|
|
48
48
|
});
|
|
49
|
-
} else
|
|
50
|
-
dispatch({
|
|
51
|
-
type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
|
|
52
|
-
payload: false
|
|
53
|
-
});
|
|
54
|
-
await endChat(adapter);
|
|
55
|
-
} else if (conversationState.current === ConversationState.InActive) {
|
|
49
|
+
} else {
|
|
56
50
|
const skipEndChatSDK = true;
|
|
57
51
|
const skipCloseChat = false;
|
|
58
52
|
await endChat(adapter, skipEndChatSDK, skipCloseChat);
|