@microsoft/omnichannel-chat-widget 0.1.0-main.7338c17 → 0.1.0-main.7b290a7
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 +3 -11
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +36 -4
- package/lib/cjs/common/telemetry/TelemetryConstants.js +39 -5
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +17 -6
- 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 +16 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -39
- package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
- package/lib/cjs/components/headerstateful/HeaderStateful.js +11 -8
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +16 -21
- package/lib/cjs/components/livechatwidget/common/endChat.js +102 -57
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +32 -7
- 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/setPostChatContextAndLoadSurvey.js +6 -5
- package/lib/cjs/components/livechatwidget/common/startChat.js +43 -30
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +91 -30
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- 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 +7 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -2
- package/lib/cjs/contexts/createReducer.js +8 -10
- package/lib/cjs/controller/componentController.js +2 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +32 -3
- package/lib/esm/common/telemetry/TelemetryConstants.js +35 -4
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +15 -6
- 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 +12 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +6 -35
- package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
- package/lib/esm/components/headerstateful/HeaderStateful.js +12 -9
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -22
- package/lib/esm/components/livechatwidget/common/endChat.js +101 -55
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +29 -8
- 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/setPostChatContextAndLoadSurvey.js +6 -5
- package/lib/esm/components/livechatwidget/common/startChat.js +43 -31
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +83 -28
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +3 -3
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- 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 +7 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -2
- package/lib/esm/contexts/createReducer.js +8 -9
- package/lib/esm/controller/componentController.js +2 -2
- package/lib/esm/plugins/newMessageEventHandler.js +82 -0
- package/lib/types/assets/Audios.d.ts +1 -0
- package/lib/types/assets/Icons.d.ts +11 -0
- package/lib/types/common/Constants.d.ts +18 -1
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +24 -3
- 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 +1 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -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/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
- 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 +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +7 -7
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +9 -11
- package/lib/cjs/assets/assets.d.js +0 -1
- package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
- package/lib/cjs/assets/icons/audioIcon.svg +0 -6
- package/lib/cjs/assets/icons/blankIcon.svg +0 -6
- package/lib/cjs/assets/icons/excelIcon.svg +0 -6
- package/lib/cjs/assets/icons/imageIcon.svg +0 -6
- package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
- package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
- package/lib/cjs/assets/icons/videoIcon.svg +0 -6
- package/lib/cjs/assets/icons/visioIcon.svg +0 -6
- package/lib/cjs/assets/icons/wordIcon.svg +0 -6
- package/lib/esm/assets/assets.d.js +0 -0
- package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/esm/assets/icons/archiveIcon.svg +0 -3
- package/lib/esm/assets/icons/audioIcon.svg +0 -6
- package/lib/esm/assets/icons/blankIcon.svg +0 -6
- package/lib/esm/assets/icons/excelIcon.svg +0 -6
- package/lib/esm/assets/icons/imageIcon.svg +0 -6
- package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/esm/assets/icons/pdfIcon.svg +0 -6
- package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
- package/lib/esm/assets/icons/videoIcon.svg +0 -6
- package/lib/esm/assets/icons/visioIcon.svg +0 -6
- package/lib/esm/assets/icons/wordIcon.svg +0 -6
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
2
1
|
import { RegisterLoggers, TelemetryManager } from "../../../common/telemetry/TelemetryManager";
|
|
2
|
+
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
3
3
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
4
4
|
import { defaultAriaConfig } from "../../../common/telemetry/defaultConfigs/defaultAriaConfig";
|
|
5
5
|
import { defaultInternalTelemetryData } from "../../../common/telemetry/defaultConfigs/defaultTelemetryInternalData";
|
|
6
6
|
import { defaultTelemetryConfiguration } from "../../../common/telemetry/defaultConfigs/defaultTelemetryConfiguration";
|
|
7
|
-
import { version as chatComponentVersion } from "@microsoft/omnichannel-chat-components/package.json";
|
|
8
|
-
import { version as chatSdkVersion } from "@microsoft/omnichannel-chat-sdk/package.json";
|
|
9
7
|
export const registerTelemetryLoggers = (props, dispatch) => {
|
|
10
8
|
var _props$liveChatContex, _props$liveChatContex2;
|
|
11
9
|
|
|
12
|
-
let widgetPackageInfo;
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
widgetPackageInfo = require("@microsoft/omnichannel-chat-widget/package.json");
|
|
16
|
-
} catch (error) {
|
|
17
|
-
widgetPackageInfo = "0.0.0-0";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
10
|
const telemetryConfig = { ...defaultTelemetryConfiguration,
|
|
21
11
|
...props.telemetryConfig
|
|
22
12
|
};
|
|
@@ -38,12 +28,13 @@ export const registerTelemetryLoggers = (props, dispatch) => {
|
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
telemetryData = TelemetryHelper.addWidgetDataToTelemetry(telemetryConfig, telemetryData);
|
|
41
|
-
telemetryData.OCChatSDKVersion =
|
|
42
|
-
telemetryData.chatComponentVersion = chatComponentVersion;
|
|
43
|
-
telemetryData.chatWidgetVersion =
|
|
31
|
+
telemetryData.OCChatSDKVersion = telemetryConfig.OCChatSDKVersion ?? "0.0.0-0";
|
|
32
|
+
telemetryData.chatComponentVersion = telemetryConfig.chatComponentVersion ?? "0.0.0-0";
|
|
33
|
+
telemetryData.chatWidgetVersion = telemetryConfig.chatWidgetVersion ?? "0.0.0-0";
|
|
44
34
|
telemetryData.orgId = (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId;
|
|
45
35
|
telemetryData.widgetId = (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId;
|
|
46
36
|
telemetryData.orgUrl = (_props$chatSDK3 = props.chatSDK) === null || _props$chatSDK3 === void 0 ? void 0 : (_props$chatSDK3$omnic = _props$chatSDK3.omnichannelConfig) === null || _props$chatSDK3$omnic === void 0 ? void 0 : _props$chatSDK3$omnic.orgUrl;
|
|
37
|
+
TelemetryManager.InternalTelemetryData = telemetryData;
|
|
47
38
|
dispatch({
|
|
48
39
|
type: LiveChatWidgetActionType.SET_TELEMETRY_DATA,
|
|
49
40
|
payload: telemetryData
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
3
|
-
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
4
|
-
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
5
2
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
6
|
-
|
|
3
|
+
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
4
|
+
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
5
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
|
|
7
7
|
export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persistedChat) => {
|
|
8
8
|
try {
|
|
9
9
|
if (!persistedChat) {
|
|
@@ -25,7 +25,8 @@ export const setPostChatContextAndLoadSurvey = async (chatSDK, dispatch, persist
|
|
|
25
25
|
exception: ex
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
}
|
|
28
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
|
+
|
|
29
30
|
|
|
30
31
|
BroadcastService.getMessageByEventName("LoadPostChatSurvey").subscribe(msg => {
|
|
31
32
|
dispatch({
|
|
@@ -8,54 +8,64 @@ import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcon
|
|
|
8
8
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
9
9
|
import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
10
10
|
import { createAdapter } from "./createAdapter";
|
|
11
|
+
import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
|
|
11
12
|
import { createTimer } from "../../../common/utils";
|
|
12
|
-
import { getReconnectIdForAuthenticatedChat } from "./reconnectChatHelper";
|
|
13
|
+
import { getReconnectIdForAuthenticatedChat, handleRedirectUnauthenticatedReconnectChat } from "./reconnectChatHelper";
|
|
13
14
|
import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
|
|
14
15
|
import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
16
|
|
|
16
17
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
18
|
+
var _props$reconnectChatP;
|
|
19
|
+
|
|
17
20
|
if (await canConnectToExistingChat(props, chatSDK, state, dispatch, setAdapter)) {
|
|
18
21
|
return;
|
|
19
|
-
} //
|
|
20
|
-
|
|
22
|
+
} // Redirecting if unauthenticated reconnect chat expired
|
|
21
23
|
|
|
22
|
-
const parseToJson = false;
|
|
23
|
-
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
24
|
-
const showPrechat = state.appStates.conversationState === ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
if ((_props$reconnectChatP = props.reconnectChatPaneProps) !== null && _props$reconnectChatP !== void 0 && _props$reconnectChatP.reconnectId) {
|
|
26
|
+
var _props$reconnectChatP2, _props$reconnectChatP3;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
dispatch({
|
|
30
|
-
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
31
|
-
payload: reconnectId
|
|
32
|
-
});
|
|
33
|
-
dispatch({
|
|
34
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
35
|
-
payload: ConversationState.ReconnectChat
|
|
36
|
-
});
|
|
37
|
-
} else if (showPrechat) {
|
|
38
|
-
dispatch({
|
|
39
|
-
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
40
|
-
payload: preChatSurveyResponse
|
|
41
|
-
});
|
|
42
|
-
dispatch({
|
|
43
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
44
|
-
payload: ConversationState.Prechat
|
|
45
|
-
});
|
|
28
|
+
await handleRedirectUnauthenticatedReconnectChat(chatSDK, dispatch, setAdapter, initStartChat, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.reconnectId, (_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.redirectInSameWindow);
|
|
46
29
|
} else {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
// Getting PreChat Survey Context
|
|
31
|
+
const parseToJson = false;
|
|
32
|
+
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
33
|
+
const showPrechat = state.appStates.conversationState === ConversationState.ProactiveChat ? preChatSurveyResponse && state.appStates.proactiveChatStates.proactiveChatEnablePrechat : preChatSurveyResponse; // Getting reconnectId for authenticated chat
|
|
34
|
+
|
|
35
|
+
const reconnectId = await getReconnectIdForAuthenticatedChat(props, chatSDK);
|
|
36
|
+
|
|
37
|
+
if (reconnectId) {
|
|
38
|
+
dispatch({
|
|
39
|
+
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
40
|
+
payload: reconnectId
|
|
41
|
+
});
|
|
42
|
+
dispatch({
|
|
43
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
44
|
+
payload: ConversationState.ReconnectChat
|
|
45
|
+
});
|
|
46
|
+
} else if (showPrechat) {
|
|
47
|
+
dispatch({
|
|
48
|
+
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
49
|
+
payload: preChatSurveyResponse
|
|
50
|
+
});
|
|
51
|
+
dispatch({
|
|
52
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
53
|
+
payload: ConversationState.Prechat
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
dispatch({
|
|
57
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
58
|
+
payload: ConversationState.Loading
|
|
59
|
+
});
|
|
60
|
+
await initStartChat(chatSDK, dispatch, setAdapter);
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
64
|
|
|
55
65
|
|
|
56
66
|
const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedState) => {
|
|
57
67
|
try {
|
|
58
|
-
var _TelemetryTimers$Widg;
|
|
68
|
+
var _newAdapter$activity$, _TelemetryTimers$Widg;
|
|
59
69
|
|
|
60
70
|
try {
|
|
61
71
|
TelemetryTimers.WidgetLoadTimer = createTimer();
|
|
@@ -74,6 +84,8 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, params, persistedSta
|
|
|
74
84
|
|
|
75
85
|
const newAdapter = await createAdapter(chatSDK);
|
|
76
86
|
setAdapter(newAdapter);
|
|
87
|
+
const chatToken = await chatSDK.getChatToken();
|
|
88
|
+
newAdapter === null || newAdapter === void 0 ? void 0 : (_newAdapter$activity$ = newAdapter.activity$) === null || _newAdapter$activity$ === void 0 ? void 0 : _newAdapter$activity$.subscribe(createOnNewAdapterActivityHandler(chatToken === null || chatToken === void 0 ? void 0 : chatToken.chatId, chatToken === null || chatToken === void 0 ? void 0 : chatToken.visitorId));
|
|
77
89
|
|
|
78
90
|
if (!persistedState) {
|
|
79
91
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
4
|
import { BroadcastService, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
5
|
import { Stack } from "@fluentui/react";
|
|
5
6
|
import React, { useEffect, useRef, useState } from "react";
|
|
6
7
|
import { createTimer, getLocaleDirection } from "../../../common/utils";
|
|
7
|
-
import { getReconnectIdForAuthenticatedChat, handleUnauthenticatedReconnectChat } from "../common/reconnectChatHelper";
|
|
8
|
+
import { getReconnectIdForAuthenticatedChat, handleUnauthenticatedReconnectChat, startUnauthenticatedReconnectChat } from "../common/reconnectChatHelper";
|
|
8
9
|
import { initStartChat, prepareStartChat } from "../common/startChat";
|
|
9
10
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
10
11
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
@@ -12,6 +13,7 @@ import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
|
12
13
|
import { Components } from "botframework-webchat";
|
|
13
14
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
14
15
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
16
|
+
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
15
17
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
16
18
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
17
19
|
import HeaderStateful from "../../headerstateful/HeaderStateful";
|
|
@@ -23,12 +25,14 @@ import PostChatSurveyPaneStateful from "../../postchatsurveypanestateful/PostCha
|
|
|
23
25
|
import PreChatSurveyPaneStateful from "../../prechatsurveypanestateful/PreChatSurveyPaneStateful";
|
|
24
26
|
import ProactiveChatPaneStateful from "../../proactivechatpanestateful/ProactiveChatPaneStateful";
|
|
25
27
|
import ReconnectChatPaneStateful from "../../reconnectchatpanestateful/ReconnectChatPaneStateful";
|
|
28
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
26
29
|
import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
27
30
|
import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
|
|
28
31
|
import { createFooter } from "../common/createFooter";
|
|
29
32
|
import { createInternetConnectionChangeHandler } from "../common/createInternetConnectionChangeHandler";
|
|
30
33
|
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
31
|
-
import {
|
|
34
|
+
import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
|
|
35
|
+
import { endChat, prepareEndChat } from "../common/endChat";
|
|
32
36
|
import { getGeneralStylesForButton } from "../common/getGeneralStylesForButton";
|
|
33
37
|
import { initCallingSdk } from "../common/initCallingSdk";
|
|
34
38
|
import { initConfirmationPropsComposer } from "../common/initConfirmationPropsComposer";
|
|
@@ -39,12 +43,8 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
39
43
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
40
44
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
41
45
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
42
|
-
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
43
|
-
import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
|
|
44
|
-
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
45
|
-
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
46
46
|
export const LiveChatWidgetStateful = props => {
|
|
47
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps5, _props$componentOverr, _props$controlProps6, _props$componentOverr2, _props$controlProps7, _props$componentOverr3, _props$controlProps8, _props$componentOverr4, _props$controlProps9, _props$componentOverr5, _props$controlProps10, _props$componentOverr6, _props$controlProps11, _props$controlProps12, _props$controlProps13, _props$
|
|
47
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps5, _props$componentOverr, _props$controlProps6, _props$componentOverr2, _props$controlProps7, _props$componentOverr3, _props$controlProps8, _props$componentOverr4, _props$controlProps9, _props$componentOverr5, _props$controlProps10, _props$componentOverr6, _props$controlProps11, _props$componentOverr7, _props$controlProps12, _props$controlProps13, _props$componentOverr8, _props$controlProps14, _props$componentOverr9, _props$controlProps15, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
48
48
|
|
|
49
49
|
const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
50
|
|
|
@@ -53,12 +53,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
53
53
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
54
54
|
}); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
55
|
|
|
56
|
-
const chatSDK = useChatSDKStore();
|
|
56
|
+
const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
|
|
57
58
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = useState(undefined);
|
|
58
59
|
const {
|
|
59
60
|
Composer
|
|
60
61
|
} = Components;
|
|
61
|
-
const canStartProactiveChat = useRef(true);
|
|
62
|
+
const canStartProactiveChat = useRef(true);
|
|
63
|
+
const canEndChat = useRef(true); // Process general styles
|
|
62
64
|
|
|
63
65
|
const generalStyles = {
|
|
64
66
|
root: Object.assign({}, getGeneralStylesForButton(state), (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyles)
|
|
@@ -80,6 +82,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
80
82
|
type: LiveChatWidgetActionType.SET_SKIP_CHAT_BUTTON_RENDERING,
|
|
81
83
|
payload: ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.skipChatButtonRendering) || false
|
|
82
84
|
});
|
|
85
|
+
dispatch({
|
|
86
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
87
|
+
payload: false
|
|
88
|
+
});
|
|
83
89
|
initCallingSdk(chatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
84
90
|
sdkCreated && dispatch({
|
|
85
91
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
@@ -90,7 +96,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
90
96
|
if (!((_props$controlProps3 = props.controlProps) !== null && _props$controlProps3 !== void 0 && _props$controlProps3.skipChatButtonRendering) && (_props$reconnectChatP = props.reconnectChatPaneProps) !== null && _props$reconnectChatP !== void 0 && _props$reconnectChatP.reconnectId) {
|
|
91
97
|
var _props$reconnectChatP2;
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
startUnauthenticatedReconnectChat(chatSDK, dispatch, setAdapter, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.reconnectId, initStartChat);
|
|
94
100
|
} // Initialize global dir
|
|
95
101
|
|
|
96
102
|
|
|
@@ -100,13 +106,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
100
106
|
payload: globalDir
|
|
101
107
|
});
|
|
102
108
|
|
|
103
|
-
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.
|
|
109
|
+
if ((_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.liveChatContext) {
|
|
104
110
|
var _state$domainStates2;
|
|
105
111
|
|
|
106
112
|
const optionalParams = {
|
|
107
|
-
liveChatContext:
|
|
108
|
-
chatToken: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.chatToken
|
|
109
|
-
}
|
|
113
|
+
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
110
114
|
};
|
|
111
115
|
initStartChat(chatSDK, dispatch, setAdapter, optionalParams);
|
|
112
116
|
}
|
|
@@ -116,9 +120,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
116
120
|
var _props$reconnectChatP3;
|
|
117
121
|
|
|
118
122
|
if ((_props$reconnectChatP3 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP3 !== void 0 && _props$reconnectChatP3.reconnectId && !state.appStates.reconnectId) {
|
|
119
|
-
var _props$reconnectChatP4;
|
|
123
|
+
var _props$reconnectChatP4, _props$reconnectChatP5;
|
|
120
124
|
|
|
121
|
-
handleUnauthenticatedReconnectChat(dispatch, (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId, initStartChat);
|
|
125
|
+
handleUnauthenticatedReconnectChat(chatSDK, dispatch, setAdapter, (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId, initStartChat, (_props$reconnectChatP5 = props.reconnectChatPaneProps) === null || _props$reconnectChatP5 === void 0 ? void 0 : _props$reconnectChatP5.redirectInSameWindow);
|
|
122
126
|
} else {
|
|
123
127
|
getReconnectIdForAuthenticatedChat(props, chatSDK).then(authReconnectId => {
|
|
124
128
|
if (authReconnectId && !state.appStates.reconnectId) {
|
|
@@ -131,6 +135,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
131
135
|
payload: ConversationState.ReconnectChat
|
|
132
136
|
});
|
|
133
137
|
} else {
|
|
138
|
+
const chatStartedSkippingChatButtonRendering = {
|
|
139
|
+
eventName: BroadcastEvent.StartChatSkippingChatButtonRendering
|
|
140
|
+
};
|
|
141
|
+
BroadcastService.postMessage(chatStartedSkippingChatButtonRendering);
|
|
134
142
|
dispatch({
|
|
135
143
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
136
144
|
payload: ConversationState.Loading
|
|
@@ -142,6 +150,17 @@ export const LiveChatWidgetStateful = props => {
|
|
|
142
150
|
}
|
|
143
151
|
}, [state.appStates.skipChatButtonRendering]);
|
|
144
152
|
useEffect(() => {
|
|
153
|
+
// Add the custom context on receiving the SetCustomContext event
|
|
154
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
155
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
156
|
+
Event: TelemetryEvent.CustomContextReceived,
|
|
157
|
+
Description: "CustomContext received."
|
|
158
|
+
});
|
|
159
|
+
dispatch({
|
|
160
|
+
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
161
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
162
|
+
});
|
|
163
|
+
});
|
|
145
164
|
BroadcastService.getMessageByEventName("StartProactiveChat").subscribe(msg => {
|
|
146
165
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
147
166
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
@@ -158,8 +177,39 @@ export const LiveChatWidgetStateful = props => {
|
|
|
158
177
|
Description: "Start proactive chat method called, when chat was already triggered."
|
|
159
178
|
});
|
|
160
179
|
}
|
|
180
|
+
}); // start chat from SDK Event
|
|
181
|
+
|
|
182
|
+
BroadcastService.getMessageByEventName("StartChat").subscribe(() => {
|
|
183
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
184
|
+
Event: TelemetryEvent.StartChatEventRecevied,
|
|
185
|
+
Description: "Start chat event received."
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if (state.appStates.isMinimized) {
|
|
189
|
+
dispatch({
|
|
190
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
191
|
+
payload: false
|
|
192
|
+
});
|
|
193
|
+
} else {
|
|
194
|
+
prepareStartChat(props, chatSDK, state, dispatch, setAdapter);
|
|
195
|
+
}
|
|
196
|
+
}); // end chat from SDK Event
|
|
197
|
+
|
|
198
|
+
BroadcastService.getMessageByEventName("EndChat").subscribe(async () => {
|
|
199
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
200
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
201
|
+
Description: "End chat event received."
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
if (canEndChat.current) {
|
|
205
|
+
prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
206
|
+
} else {
|
|
207
|
+
const skipEndChatSDK = true;
|
|
208
|
+
const skipCloseChat = false;
|
|
209
|
+
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
|
|
210
|
+
}
|
|
161
211
|
});
|
|
162
|
-
window.addEventListener("beforeunload",
|
|
212
|
+
window.addEventListener("beforeunload", () => {
|
|
163
213
|
disposeTelemetryLoggers();
|
|
164
214
|
});
|
|
165
215
|
|
|
@@ -169,11 +219,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
169
219
|
}, []);
|
|
170
220
|
useEffect(() => {
|
|
171
221
|
canStartProactiveChat.current = state.appStates.conversationState === ConversationState.Closed;
|
|
222
|
+
canEndChat.current = state.appStates.conversationState === ConversationState.Active;
|
|
172
223
|
|
|
173
224
|
if (state.appStates.conversationState === ConversationState.Active) {
|
|
174
225
|
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
|
|
175
226
|
BroadcastService.postMessage({
|
|
176
|
-
eventName:
|
|
227
|
+
eventName: BroadcastEvent.NewMessageNotification
|
|
177
228
|
});
|
|
178
229
|
});
|
|
179
230
|
} // Track the message count
|
|
@@ -198,7 +249,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
198
249
|
});
|
|
199
250
|
const customEvent = {
|
|
200
251
|
elementType: ElementType.Custom,
|
|
201
|
-
eventName:
|
|
252
|
+
eventName: BroadcastEvent.UnreadMessageCount,
|
|
202
253
|
payload: 0
|
|
203
254
|
};
|
|
204
255
|
BroadcastService.postMessage(customEvent);
|
|
@@ -208,7 +259,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
208
259
|
if (state.appStates.isMinimized && state.appStates.unreadMessageCount > 0) {
|
|
209
260
|
const customEvent = {
|
|
210
261
|
elementType: ElementType.Custom,
|
|
211
|
-
eventName:
|
|
262
|
+
eventName: BroadcastEvent.UnreadMessageCount,
|
|
212
263
|
payload: `${state.appStates.unreadMessageCount}`
|
|
213
264
|
};
|
|
214
265
|
BroadcastService.postMessage(customEvent);
|
|
@@ -223,9 +274,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
223
274
|
}, [(_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.webChatStyles]);
|
|
224
275
|
const webChatProps = initWebChatComposer(props, chatSDK, state, dispatch, setWebChatStyles);
|
|
225
276
|
|
|
226
|
-
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch);
|
|
277
|
+
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
278
|
+
|
|
227
279
|
|
|
228
|
-
const endChatRelay = () => endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
|
|
280
|
+
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat) => endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
const prepareEndChatRelay = (adapter, state) => prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
229
284
|
|
|
230
285
|
const prepareStartChatRelay = () => prepareStartChat(props, chatSDK, state, dispatch, setAdapter); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
231
286
|
|
|
@@ -236,7 +291,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
236
291
|
|
|
237
292
|
useEffect(() => {
|
|
238
293
|
const chatWidgetStateChangeEvent = {
|
|
239
|
-
eventName:
|
|
294
|
+
eventName: BroadcastEvent.ChatWidgetStateChanged,
|
|
240
295
|
payload: { ...state
|
|
241
296
|
}
|
|
242
297
|
};
|
|
@@ -263,14 +318,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
263
318
|
})), !((_props$controlProps8 = props.controlProps) !== null && _props$controlProps8 !== void 0 && _props$controlProps8.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_props$componentOverr4 = props.componentOverrides) === null || _props$componentOverr4 === void 0 ? void 0 : _props$componentOverr4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, props.loadingPaneProps)), !((_props$controlProps9 = props.controlProps) !== null && _props$controlProps9 !== void 0 && _props$controlProps9.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_props$componentOverr5 = props.componentOverrides) === null || _props$componentOverr5 === void 0 ? void 0 : _props$componentOverr5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, props.outOfOfficeHoursPaneProps)), !((_props$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_props$componentOverr6 = props.componentOverrides) === null || _props$componentOverr6 === void 0 ? void 0 : _props$componentOverr6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
264
319
|
reconnectChatProps: props.reconnectChatPaneProps,
|
|
265
320
|
initStartChat: initStartChatRelay
|
|
266
|
-
})), !((_props$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
321
|
+
})), !((_props$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_props$componentOverr7 = props.componentOverrides) === null || _props$componentOverr7 === void 0 ? void 0 : _props$componentOverr7.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
267
322
|
surveyProps: props.preChatSurveyPaneProps,
|
|
268
323
|
initStartChat: initStartChatRelay
|
|
269
|
-
}), !((_props$controlProps12 = props.controlProps) !== null && _props$controlProps12 !== void 0 && _props$controlProps12.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
324
|
+
})), !((_props$controlProps12 = props.controlProps) !== null && _props$controlProps12 !== void 0 && _props$controlProps12.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
270
325
|
voiceVideoCallingSdk: voiceVideoCallingSDK
|
|
271
|
-
}, props.callingContainerProps)), !((_props$controlProps13 = props.controlProps) !== null && _props$controlProps13 !== void 0 && _props$controlProps13.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_props$
|
|
326
|
+
}, props.callingContainerProps)), !((_props$controlProps13 = props.controlProps) !== null && _props$controlProps13 !== void 0 && _props$controlProps13.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_props$componentOverr8 = props.componentOverrides) === null || _props$componentOverr8 === void 0 ? void 0 : _props$componentOverr8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, props.webChatContainerProps)), !((_props$controlProps14 = props.controlProps) !== null && _props$controlProps14 !== void 0 && _props$controlProps14.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_props$componentOverr9 = props.componentOverrides) === null || _props$componentOverr9 === void 0 ? void 0 : _props$componentOverr9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
272
327
|
setPostChatContext: setPostChatContextRelay,
|
|
273
|
-
|
|
274
|
-
}))), !((_props$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_props$
|
|
328
|
+
prepareEndChat: prepareEndChatRelay
|
|
329
|
+
}))), !((_props$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_props$componentOverr10 = props.componentOverrides) === null || _props$componentOverr10 === void 0 ? void 0 : _props$componentOverr10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, props.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_props$componentOverr11 = props.componentOverrides) === null || _props$componentOverr11 === void 0 ? void 0 : _props$componentOverr11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, props.postChatSurveyPaneProps, props.chatSDK))), createFooter(props, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_props$componentOverr12 = props.componentOverrides) === null || _props$componentOverr12 === void 0 ? void 0 : _props$componentOverr12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, props.emailTranscriptPane))));
|
|
275
330
|
};
|
|
276
331
|
export default LiveChatWidgetStateful;
|
|
@@ -3,6 +3,8 @@ import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
|
3
3
|
import { defaultGeneralPostChatLoadingPaneStyleProps } from "./common/defaultgeneralPostChatLoadingPaneStyleProps";
|
|
4
4
|
import { findAllFocusableElement } from "../../common/utils";
|
|
5
5
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
6
|
+
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
7
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
6
8
|
export const PostChatLoadingPaneStateful = props => {
|
|
7
9
|
var _props$styleProps;
|
|
8
10
|
|
|
@@ -28,6 +30,10 @@ export const PostChatLoadingPaneStateful = props => {
|
|
|
28
30
|
if (firstElement && firstElement[0]) {
|
|
29
31
|
firstElement[0].focus();
|
|
30
32
|
}
|
|
33
|
+
|
|
34
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
35
|
+
Event: TelemetryEvent.PostChatSurveyLoadingPaneLoaded
|
|
36
|
+
});
|
|
31
37
|
}, []);
|
|
32
38
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
33
39
|
componentOverrides: props.componentOverrides,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { createTimer, setFocusOnElement } from "../../common/utils";
|
|
4
4
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -51,7 +51,7 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
51
51
|
if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
|
|
52
52
|
// TODO: BroadcastService: replace with the sdk broadcast service, when in place
|
|
53
53
|
const startPopoutChatEvent = {
|
|
54
|
-
eventName:
|
|
54
|
+
eventName: BroadcastEvent.ProactiveChatStartPopoutChat
|
|
55
55
|
};
|
|
56
56
|
BroadcastService.postMessage(startPopoutChatEvent);
|
|
57
57
|
dispatch({
|
|
@@ -69,7 +69,7 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
69
69
|
});
|
|
70
70
|
} else {
|
|
71
71
|
const proactiveChatStarted = {
|
|
72
|
-
eventName:
|
|
72
|
+
eventName: BroadcastEvent.ProactiveChatStartChat
|
|
73
73
|
};
|
|
74
74
|
BroadcastService.postMessage(proactiveChatStarted);
|
|
75
75
|
await startChat();
|
package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchiveIcon, AudioIcon, BlankIcon, ExcelIcon, ImageIcon, OneNoteIcon, PDFIcon, PowerpointIcon, VideoIcon, VisioIcon, WordIcon } from "../../../../assets/Icons";
|
|
2
2
|
import { getBrowserName, isChromiumEdge } from "./BrowserInfo";
|
|
3
|
-
import
|
|
4
|
-
import AudioIcon from "../../../../assets/icons/audioIcon.svg";
|
|
5
|
-
import BlankIcon from "../../../../assets/icons/blankIcon.svg";
|
|
6
|
-
import VideoIcon from "../../../../assets/icons/videoIcon.svg";
|
|
7
|
-
import ImageIcon from "../../../../assets/icons/imageIcon.svg";
|
|
8
|
-
import WordIcon from "../../../../assets/icons/wordIcon.svg";
|
|
9
|
-
import OneNoteIcon from "../../../../assets/icons/oneNoteIcon.svg";
|
|
10
|
-
import PowerpointIcon from "../../../../assets/icons/powerpointIcon.svg";
|
|
11
|
-
import VisioIcon from "../../../../assets/icons/visioIcon.svg";
|
|
12
|
-
import PDFIcon from "../../../../assets/icons/pdfIcon.svg";
|
|
13
|
-
import ExcelIcon from "../../../../assets/icons/excelIcon.svg";
|
|
3
|
+
import { BrowserVendor } from "../../webchatcontroller/enums/BrowserVendor";
|
|
14
4
|
import { Constants } from "../../../../common/Constants";
|
|
15
5
|
const FileAttachmentIconMap = {
|
|
16
6
|
"aac": AudioIcon,
|
|
@@ -5,59 +5,19 @@
|
|
|
5
5
|
* 1. Renders system messages differently, according to Microsoft LiveChatWidget styles
|
|
6
6
|
* 2. Changes the font size of user messages
|
|
7
7
|
* 3. Decodes certain html characters that came through from chat services
|
|
8
|
-
* 4. Triggers end conversation sequence when the chat thread is deleted
|
|
9
8
|
******/
|
|
10
|
-
import
|
|
9
|
+
import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
11
10
|
import { Constants } from "../../../../../common/Constants";
|
|
12
11
|
import { DirectLineActivityType } from "../../enums/DirectLineActivityType";
|
|
13
12
|
import { DirectLineSenderRole } from "../../enums/DirectLineSenderRole";
|
|
14
13
|
import { MessageTypes } from "../../enums/MessageType";
|
|
14
|
+
import React from "react";
|
|
15
|
+
import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
|
|
15
16
|
import { defaultSystemMessageStyles } from "./defaultStyles/defaultSystemMessageStyles";
|
|
16
17
|
import { defaultUserMessageStyles } from "./defaultStyles/defaultUserMessageStyles";
|
|
17
18
|
import { escapeHtml } from "../../../../../common/utils";
|
|
18
|
-
import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
|
|
19
|
-
import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
20
19
|
const loggedSystemMessages = new Array(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
20
|
|
|
22
|
-
const handleThreadUpdate = channelData => {
|
|
23
|
-
var _channelData$properti, _channelData$properti2;
|
|
24
|
-
|
|
25
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
26
|
-
Event: TelemetryEvent.IC3ThreadUpdateEventReceived,
|
|
27
|
-
Description: "IC3 ThreadUpdateEvent Received"
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const postConversationEndedAction = () => {
|
|
31
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
32
|
-
Event: TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
33
|
-
Description: "Conversation is ended by agent side or by timeout."
|
|
34
|
-
});
|
|
35
|
-
}; // If the Thread is deleted, then display post conversation survey if enabled.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const isThreadDeleted = (channelData === null || channelData === void 0 ? void 0 : (_channelData$properti = channelData.properties) === null || _channelData$properti === void 0 ? void 0 : (_channelData$properti2 = _channelData$properti.isdeleted) === null || _channelData$properti2 === void 0 ? void 0 : _channelData$properti2.toLowerCase()) === Constants.true;
|
|
39
|
-
|
|
40
|
-
if (isThreadDeleted) {
|
|
41
|
-
postConversationEndedAction();
|
|
42
|
-
return;
|
|
43
|
-
} //check if customer is still in the thread
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (channelData.members && channelData.members.length > 0) {
|
|
47
|
-
for (let i = 0; i < channelData.members.length; i++) {
|
|
48
|
-
const id = channelData.members[i].id;
|
|
49
|
-
const tag = channelData.members[i].tag; // In case of ACS customer is not removed from thread and has "left" tag
|
|
50
|
-
|
|
51
|
-
if (id.startsWith(Constants.visitorIdPrefix) && tag !== Constants.left) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
postConversationEndedAction();
|
|
58
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
|
|
60
|
-
|
|
61
21
|
const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
|
|
62
22
|
var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
|
|
63
23
|
|
|
@@ -108,7 +68,10 @@ export const createActivityMiddleware = (systemMessageStyleProps, userMessageSty
|
|
|
108
68
|
var _card$activity$channe3;
|
|
109
69
|
|
|
110
70
|
if (((_card$activity$channe3 = card.activity.channelData) === null || _card$activity$channe3 === void 0 ? void 0 : _card$activity$channe3.type) === MessageTypes.Thread) {
|
|
111
|
-
|
|
71
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
72
|
+
Event: TelemetryEvent.IC3ThreadUpdateEventReceived,
|
|
73
|
+
Description: "IC3 ThreadUpdateEvent Received"
|
|
74
|
+
});
|
|
112
75
|
}
|
|
113
76
|
|
|
114
77
|
return () => false;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { Constants, MimeTypes, WebChatMiddlewareConstants } from "../../../../../common/Constants";
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { getFileAttachmentIconData, isInlineMediaSupported } from "../../../common/utils/FileAttachmentIconManager";
|
|
11
|
+
import { BroadcastEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
11
12
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
12
13
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
13
14
|
import { defaultAttachmentAdaptiveCardStyles } from "./defaultStyles/defaultAtttachmentAdaptiveCardStyles";
|
|
@@ -187,7 +188,7 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
187
188
|
} catch (e) {
|
|
188
189
|
const errorData = "Unable to parse the adaptive card format";
|
|
189
190
|
BroadcastService.postMessage({
|
|
190
|
-
eventName:
|
|
191
|
+
eventName: BroadcastEvent.InvalidAdaptiveCardFormat,
|
|
191
192
|
payload: {
|
|
192
193
|
Message: errorData,
|
|
193
194
|
ExceptionDetails: e
|