@microsoft/omnichannel-chat-widget 1.4.1-main.f29a6ae → 1.5.1-main.132e1c6
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 +1 -1
- package/lib/cjs/common/utils.js +19 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +8 -11
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -1
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +18 -15
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +1 -3
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +11 -9
- package/lib/cjs/components/livechatwidget/common/startChat.js +36 -16
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +46 -32
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +22 -9
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
- package/lib/esm/common/utils.js +16 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +8 -11
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -2
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +18 -18
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -3
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +11 -9
- package/lib/esm/components/livechatwidget/common/startChat.js +37 -17
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +49 -35
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +22 -9
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
- package/lib/types/common/utils.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +5 -2
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +9 -0
- package/package.json +3 -3
|
@@ -42,24 +42,25 @@ const setSurveyMode = async (props, participantType, state, dispatch) => {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
const renderSurvey = async (postChatContext, dispatch) => {
|
|
46
48
|
if (postChatSurveyMode === PostChatSurveyMode.Link) {
|
|
47
49
|
setWidgetStateToInactive(dispatch);
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
52
|
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
51
|
-
await embedModePostChatWorkflow(
|
|
53
|
+
await embedModePostChatWorkflow(postChatContext, dispatch);
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
// Function for embed mode postchat workflow which is essentially same for both customer and agent
|
|
56
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
-
const embedModePostChatWorkflow = async (
|
|
58
|
-
var _state$domainStates2;
|
|
59
|
+
const embedModePostChatWorkflow = async (postChatContext, dispatch) => {
|
|
59
60
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
60
61
|
Event: TelemetryEvent.EmbedModePostChatWorkflowStarted
|
|
61
62
|
});
|
|
62
|
-
if (
|
|
63
|
+
if (postChatContext) {
|
|
63
64
|
dispatch({
|
|
64
65
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
65
66
|
payload: ConversationState.PostchatLoading
|
|
@@ -70,7 +71,7 @@ const embedModePostChatWorkflow = async (state, dispatch) => {
|
|
|
70
71
|
payload: ConversationState.Postchat
|
|
71
72
|
});
|
|
72
73
|
} else {
|
|
73
|
-
const error = `Conversation was Ended but App State was not set correctly: postChatContext = ${
|
|
74
|
+
const error = `Conversation was Ended but App State was not set correctly: postChatContext = ${postChatContext}`;
|
|
74
75
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
75
76
|
Event: TelemetryEvent.AppStatesException,
|
|
76
77
|
ExceptionDetails: {
|
|
@@ -86,7 +87,7 @@ const initiatePostChat = async (props, conversationDetailsParam, state, dispatch
|
|
|
86
87
|
conversationDetails = conversationDetailsParam;
|
|
87
88
|
const participantType = ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.participantType) ?? postchatContext.participantType;
|
|
88
89
|
await setSurveyMode(props, participantType, state, dispatch);
|
|
89
|
-
await renderSurvey(
|
|
90
|
+
await renderSurvey(postchatContext, dispatch);
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -99,8 +100,8 @@ const isPostChatEnabled = (props, state) => {
|
|
|
99
100
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
101
|
const getPostChatContext = async (chatSDK, state, dispatch) => {
|
|
101
102
|
try {
|
|
102
|
-
var _state$
|
|
103
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
103
|
+
var _state$domainStates2;
|
|
104
|
+
if ((state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.postChatContext) === undefined) {
|
|
104
105
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
105
106
|
const context = await chatSDK.getPostChatSurveyContext();
|
|
106
107
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -111,6 +112,7 @@ const getPostChatContext = async (chatSDK, state, dispatch) => {
|
|
|
111
112
|
type: LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
|
|
112
113
|
payload: context
|
|
113
114
|
});
|
|
115
|
+
return context;
|
|
114
116
|
}
|
|
115
117
|
} catch (error) {
|
|
116
118
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -12,7 +12,7 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
|
12
12
|
import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
13
13
|
import { createAdapter } from "./createAdapter";
|
|
14
14
|
import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
|
|
15
|
-
import { handleChatReconnect } from "./reconnectChatHelper";
|
|
15
|
+
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
|
|
16
16
|
import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
|
|
17
17
|
import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry";
|
|
18
18
|
|
|
@@ -29,7 +29,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
29
29
|
widgetInstanceId = getWidgetCacheIdfromProps(props);
|
|
30
30
|
|
|
31
31
|
// reconnect > chat from cache
|
|
32
|
-
|
|
32
|
+
if (isReconnectEnabled(props.chatConfig) === true && !isPersistentEnabled(props.chatConfig)) {
|
|
33
|
+
const shouldStartChatNormally = await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
34
|
+
if (!shouldStartChatNormally) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
34
40
|
if (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.ReconnectChat) {
|
|
35
41
|
return;
|
|
@@ -63,15 +69,29 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
63
69
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
64
70
|
const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
|
|
65
71
|
if (showPrechat) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
var _state$domainStates, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3;
|
|
73
|
+
const isOutOfOperatingHours = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_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$l3 = _state$domainStates$l2.OutOfOperatingHours) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.toLowerCase()) === "true";
|
|
74
|
+
if (isOutOfOperatingHours) {
|
|
75
|
+
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
76
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
77
|
+
payload: false
|
|
78
|
+
});
|
|
79
|
+
dispatch({
|
|
80
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
81
|
+
payload: ConversationState.OutOfOffice
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
} else {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
87
|
+
payload: preChatSurveyResponse
|
|
88
|
+
});
|
|
89
|
+
dispatch({
|
|
90
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
91
|
+
payload: ConversationState.Prechat
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
//Initiate start chat
|
|
@@ -295,17 +315,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
295
315
|
|
|
296
316
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
317
|
const setCustomContextParams = async (state, props) => {
|
|
298
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
318
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates2, _persistedState$domai8;
|
|
299
319
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
320
|
const isAuthenticatedChat = props !== null && props !== void 0 && (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
301
321
|
//Should not set custom context for auth chat
|
|
302
322
|
if (isAuthenticatedChat) {
|
|
303
323
|
return;
|
|
304
324
|
}
|
|
305
|
-
if (state !== null && state !== void 0 && (_state$
|
|
306
|
-
var _state$
|
|
325
|
+
if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.customContext) {
|
|
326
|
+
var _state$domainStates3;
|
|
307
327
|
optionalParams = Object.assign({}, optionalParams, {
|
|
308
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
328
|
+
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.customContext))
|
|
309
329
|
});
|
|
310
330
|
return;
|
|
311
331
|
}
|
|
@@ -353,8 +373,8 @@ const canStartPopoutChat = async props => {
|
|
|
353
373
|
|
|
354
374
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
355
375
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
356
|
-
var _state$
|
|
357
|
-
const requestIdFromCache = (_state$
|
|
376
|
+
var _state$domainStates4, _state$domainStates4$;
|
|
377
|
+
const requestIdFromCache = (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.liveChatContext) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.requestId;
|
|
358
378
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
359
379
|
let conversationDetails = undefined;
|
|
360
380
|
|
|
@@ -6,9 +6,9 @@ import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveW
|
|
|
6
6
|
import { Stack } from "@fluentui/react";
|
|
7
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
8
8
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
9
|
-
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString,
|
|
9
|
+
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
|
|
10
10
|
import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
11
|
-
import { endChat, prepareEndChat } from "../common/endChat";
|
|
11
|
+
import { endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
|
|
12
12
|
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
13
13
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
14
14
|
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
@@ -30,7 +30,7 @@ import PreChatSurveyPaneStateful from "../../prechatsurveypanestateful/PreChatSu
|
|
|
30
30
|
import ProactiveChatPaneStateful from "../../proactivechatpanestateful/ProactiveChatPaneStateful";
|
|
31
31
|
import ReconnectChatPaneStateful from "../../reconnectchatpanestateful/ReconnectChatPaneStateful";
|
|
32
32
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
33
|
-
import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
33
|
+
import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
34
34
|
import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
|
|
35
35
|
import createDownloadTranscriptProps from "../common/createDownloadTranscriptProps";
|
|
36
36
|
import { createFooter } from "../common/createFooter";
|
|
@@ -51,8 +51,9 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
|
51
51
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
52
52
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
53
53
|
import { defaultAdaptiveCardStyles } from "../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles";
|
|
54
|
+
import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
|
|
54
55
|
export const LiveChatWidgetStateful = props => {
|
|
55
|
-
var _props$webChatContain, _props$styleProps,
|
|
56
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$webChatContain10, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
56
57
|
const [state, dispatch] = useChatContextStore();
|
|
57
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
59
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -76,17 +77,20 @@ export const LiveChatWidgetStateful = props => {
|
|
|
76
77
|
|
|
77
78
|
//Scrollbar styles
|
|
78
79
|
const scrollbarProps = Object.assign({}, defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
|
|
81
|
+
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
82
|
+
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
83
|
+
var _chatSDK$omnichannelC, _props$controlProps2;
|
|
84
|
+
const broadcastServiceChannelName = getBroadcastChannelName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
85
|
+
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
86
|
+
}
|
|
81
87
|
TelemetryTimers.LcwLoadToChatButtonTimer = createTimer();
|
|
82
|
-
const widgetElementId = ((_props$
|
|
88
|
+
const widgetElementId = ((_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.id) || "oc-lcw";
|
|
83
89
|
const currentMessageCountRef = useRef(0);
|
|
84
90
|
let widgetStateEventId = "";
|
|
85
91
|
const lastLWICheckTimeRef = useRef(0);
|
|
86
92
|
let optionalParams;
|
|
87
93
|
let activeCachedChatExist = false;
|
|
88
|
-
const uwid = useRef(""); // its an uniqueid per chatr instance
|
|
89
|
-
|
|
90
94
|
const setOptionalParams = () => {
|
|
91
95
|
var _state$appStates, _state$domainStates, _state$appStates3;
|
|
92
96
|
if (!isUndefinedOrEmpty((_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.reconnectId)) {
|
|
@@ -171,8 +175,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
171
175
|
// Add default localStorage support for widget
|
|
172
176
|
const widgetCacheId = getWidgetCacheIdfromProps(props);
|
|
173
177
|
if (props.contextDataStore === undefined) {
|
|
174
|
-
var _props$
|
|
175
|
-
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$
|
|
178
|
+
var _props$controlProps4;
|
|
179
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.cacheTtlInMins) ?? Constants.CacheTtlInMinutes;
|
|
176
180
|
const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? StorageType.sessionStorage : StorageType.localStorage;
|
|
177
181
|
DataStoreManager.clientDataStore = defaultClientDataStoreProvider(cacheTtlInMins, storageType);
|
|
178
182
|
registerBroadcastServiceForStorage(widgetCacheId, cacheTtlInMins, storageType);
|
|
@@ -181,30 +185,29 @@ export const LiveChatWidgetStateful = props => {
|
|
|
181
185
|
}
|
|
182
186
|
};
|
|
183
187
|
useEffect(() => {
|
|
184
|
-
var _props$
|
|
188
|
+
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch, _state$appStates5;
|
|
185
189
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
186
190
|
state.domainStates.confirmationState = ConfirmationState.NotSet;
|
|
187
191
|
setupClientDataStore();
|
|
188
192
|
registerTelemetryLoggers(props, dispatch);
|
|
189
193
|
createInternetConnectionChangeHandler();
|
|
190
|
-
uwid.current = newGuid();
|
|
191
194
|
dispatch({
|
|
192
195
|
type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
193
196
|
payload: widgetElementId
|
|
194
197
|
});
|
|
195
198
|
dispatch({
|
|
196
199
|
type: LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY,
|
|
197
|
-
payload: ((_props$
|
|
200
|
+
payload: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.hideStartChatButton) || false
|
|
198
201
|
});
|
|
199
202
|
dispatch({
|
|
200
203
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
201
204
|
payload: false
|
|
202
205
|
});
|
|
203
|
-
if ((_props$
|
|
204
|
-
var _props$
|
|
206
|
+
if ((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.widgetInstanceId && !isNullOrEmptyString((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.widgetInstanceId)) {
|
|
207
|
+
var _props$controlProps8;
|
|
205
208
|
dispatch({
|
|
206
209
|
type: LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID,
|
|
207
|
-
payload: (_props$
|
|
210
|
+
payload: (_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.widgetInstanceId
|
|
208
211
|
});
|
|
209
212
|
}
|
|
210
213
|
if (((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_callingoptions) !== E2VVOptions.NoCalling) {
|
|
@@ -223,7 +226,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
// Initialize global dir
|
|
226
|
-
const globalDir = ((_props$
|
|
229
|
+
const globalDir = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.dir) ?? getLocaleDirection((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Ch = _props$chatConfig2.ChatWidgetLanguage) === null || _props$chatConfig2$Ch === void 0 ? void 0 : _props$chatConfig2$Ch.msdyn_localeid);
|
|
227
230
|
dispatch({
|
|
228
231
|
type: LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
229
232
|
payload: globalDir
|
|
@@ -259,7 +262,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
259
262
|
|
|
260
263
|
// useEffect for custom context
|
|
261
264
|
useEffect(() => {
|
|
262
|
-
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$
|
|
265
|
+
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$controlProps11;
|
|
263
266
|
// Add the custom context on receiving the SetCustomContext event
|
|
264
267
|
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
265
268
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -292,8 +295,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
292
295
|
BroadcastService.getMessageByEventName(BroadcastEvent.HideChatVisibilityChangeEvent).subscribe(async event => {
|
|
293
296
|
var _event$payload;
|
|
294
297
|
if ((event === null || event === void 0 ? void 0 : (_event$payload = event.payload) === null || _event$payload === void 0 ? void 0 : _event$payload.isChatHidden) !== undefined) {
|
|
295
|
-
var _props$
|
|
296
|
-
if ((_props$
|
|
298
|
+
var _props$controlProps10;
|
|
299
|
+
if ((_props$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.hideStartChatButton) {
|
|
297
300
|
var _event$payload2;
|
|
298
301
|
dispatch({
|
|
299
302
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -320,23 +323,27 @@ export const LiveChatWidgetStateful = props => {
|
|
|
320
323
|
|
|
321
324
|
// Start chat from SDK Event
|
|
322
325
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
323
|
-
var _msg$payload4;
|
|
326
|
+
var _msg$payload4, _msg$payload5, _msg$payload6;
|
|
327
|
+
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
328
|
+
if (!isNullOrUndefined(msg === null || msg === void 0 ? void 0 : (_msg$payload4 = msg.payload) === null || _msg$payload4 === void 0 ? void 0 : _msg$payload4.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
324
331
|
let stateWithUpdatedContext = state;
|
|
325
|
-
if (msg !== null && msg !== void 0 && (_msg$
|
|
326
|
-
var _msg$
|
|
332
|
+
if (msg !== null && msg !== void 0 && (_msg$payload6 = msg.payload) !== null && _msg$payload6 !== void 0 && _msg$payload6.customContext) {
|
|
333
|
+
var _msg$payload7, _msg$payload8;
|
|
327
334
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
328
335
|
Event: TelemetryEvent.CustomContextReceived,
|
|
329
336
|
Description: "CustomContext received through startChat event."
|
|
330
337
|
});
|
|
331
338
|
dispatch({
|
|
332
339
|
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
333
|
-
payload: msg === null || msg === void 0 ? void 0 : (_msg$
|
|
340
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload7 = msg.payload) === null || _msg$payload7 === void 0 ? void 0 : _msg$payload7.customContext
|
|
334
341
|
});
|
|
335
342
|
stateWithUpdatedContext = {
|
|
336
343
|
...state,
|
|
337
344
|
domainStates: {
|
|
338
345
|
...state.domainStates,
|
|
339
|
-
customContext: msg === null || msg === void 0 ? void 0 : (_msg$
|
|
346
|
+
customContext: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
340
347
|
}
|
|
341
348
|
};
|
|
342
349
|
}
|
|
@@ -412,11 +419,18 @@ export const LiveChatWidgetStateful = props => {
|
|
|
412
419
|
});
|
|
413
420
|
|
|
414
421
|
// Listen to end chat event from other tabs
|
|
415
|
-
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$
|
|
422
|
+
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
416
423
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
417
|
-
|
|
418
|
-
if (msg.payload !==
|
|
424
|
+
var _msg$payload9;
|
|
425
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
419
426
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
427
|
+
endChatStateCleanUp(dispatch);
|
|
428
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
429
|
+
chatSDK.requestId = uuidv4();
|
|
430
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
431
|
+
chatSDK.chatToken = {};
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
+
chatSDK.reconnectId = null;
|
|
420
434
|
return;
|
|
421
435
|
}
|
|
422
436
|
});
|
|
@@ -544,13 +558,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
544
558
|
|
|
545
559
|
// If start chat failed, and C2 is trying to close chat widget
|
|
546
560
|
if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed || (state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === ConversationState.Postchat) {
|
|
547
|
-
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true
|
|
561
|
+
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
|
|
548
562
|
return;
|
|
549
563
|
}
|
|
550
564
|
|
|
551
565
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
552
566
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === ConversationState.InActive) {
|
|
553
|
-
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true
|
|
567
|
+
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
554
568
|
return;
|
|
555
569
|
}
|
|
556
570
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates12 = state.appStates) === null || _state$appStates12 === void 0 ? void 0 : _state$appStates12.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates13 = state.appStates) === null || _state$appStates13 === void 0 ? void 0 : _state$appStates13.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
@@ -561,7 +575,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
561
575
|
}
|
|
562
576
|
|
|
563
577
|
// All other cases
|
|
564
|
-
prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter
|
|
578
|
+
prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
565
579
|
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
566
580
|
|
|
567
581
|
// Publish chat widget state
|
|
@@ -619,13 +633,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
619
633
|
};
|
|
620
634
|
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch);
|
|
621
635
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
622
|
-
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab
|
|
636
|
+
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab);
|
|
623
637
|
const prepareStartChatRelay = () => prepareStartChat(props, chatSDK, state, dispatch, setAdapter);
|
|
624
638
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
625
639
|
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK, dispatch, setAdapter, state, props, optionalParams, persistedState);
|
|
626
640
|
const confirmationPaneProps = initConfirmationPropsComposer(props);
|
|
627
641
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
628
|
-
const prepareEndChatRelay = () => prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter
|
|
642
|
+
const prepareEndChatRelay = () => prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
629
643
|
const webChatProps = initWebChatComposer(props, state, dispatch, chatSDK, endChatRelay);
|
|
630
644
|
const downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
|
|
631
645
|
...(defaultWebChatContainerStatefulProps === null || defaultWebChatContainerStatefulProps === void 0 ? void 0 : defaultWebChatContainerStatefulProps.webChatStyles),
|
|
@@ -637,7 +651,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
637
651
|
};
|
|
638
652
|
const chatWidgetDraggableConfig = {
|
|
639
653
|
elementId: widgetElementId,
|
|
640
|
-
channel: ((_props$
|
|
654
|
+
channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
|
|
641
655
|
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
|
|
642
656
|
};
|
|
643
657
|
|
|
@@ -47,13 +47,11 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export const WebChatContainerStateful = props => {
|
|
50
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$
|
|
50
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14;
|
|
51
51
|
const {
|
|
52
52
|
BasicWebChat
|
|
53
53
|
} = Components;
|
|
54
54
|
const [state, dispatch] = useChatContextStore();
|
|
55
|
-
const magicCodeBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
56
|
-
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
57
55
|
const {
|
|
58
56
|
webChatContainerProps,
|
|
59
57
|
contextDataStore
|
|
@@ -61,7 +59,7 @@ export const WebChatContainerStateful = props => {
|
|
|
61
59
|
const containerStyles = {
|
|
62
60
|
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
63
61
|
display: state.appStates.isMinimized ? "none" : ""
|
|
64
|
-
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
62
|
+
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
const localizedTexts = {
|
|
@@ -95,6 +93,21 @@ export const WebChatContainerStateful = props => {
|
|
|
95
93
|
}
|
|
96
94
|
}, []);
|
|
97
95
|
useEffect(() => {
|
|
96
|
+
var _props$webChatContain3, _props$webChatContain4;
|
|
97
|
+
if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain4 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!window.BroadcastChannel) {
|
|
101
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
102
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
103
|
+
Event: TelemetryEvent.SuppressBotMagicCodeFailed,
|
|
104
|
+
Description: "BroadcastChannel not supported by default on current browser"
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const magicCodeBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
109
|
+
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
110
|
+
|
|
98
111
|
const eventListener = event => {
|
|
99
112
|
// eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
|
|
100
113
|
const {
|
|
@@ -148,8 +161,8 @@ export const WebChatContainerStateful = props => {
|
|
|
148
161
|
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
149
162
|
|
|
150
163
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
151
|
-
background-color: ${((_props$
|
|
152
|
-
color:${((_props$
|
|
164
|
+
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
165
|
+
color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
div[class="ac-textBlock"] a:link,
|
|
@@ -157,11 +170,11 @@ export const WebChatContainerStateful = props => {
|
|
|
157
170
|
div[class="ac-textBlock"] a:hover,
|
|
158
171
|
div[class="ac-textBlock"] a:active {
|
|
159
172
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
160
|
-
}
|
|
173
|
+
}
|
|
161
174
|
|
|
162
175
|
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
163
176
|
|
|
164
|
-
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
177
|
+
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
165
178
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
166
179
|
height: '.75em';
|
|
167
180
|
marginLeft: '.25em';
|
|
@@ -179,7 +192,7 @@ export const WebChatContainerStateful = props => {
|
|
|
179
192
|
.ms_lcw_webchat_received_message a:hover,
|
|
180
193
|
.ms_lcw_webchat_received_message a:active {
|
|
181
194
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
182
|
-
}
|
|
195
|
+
}
|
|
183
196
|
.ms_lcw_webchat_sent_message a:link,
|
|
184
197
|
.ms_lcw_webchat_sent_message a:visited,
|
|
185
198
|
.ms_lcw_webchat_sent_message a:hover,
|
|
@@ -26,5 +26,7 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
26
26
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
27
27
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
28
28
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
|
|
29
|
-
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware."
|
|
29
|
+
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
30
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
31
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|
|
30
32
|
};
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js
CHANGED
|
@@ -3,6 +3,7 @@ export let NotificationScenarios;
|
|
|
3
3
|
NotificationScenarios["Connection"] = "connection";
|
|
4
4
|
NotificationScenarios["DownloadTranscriptError"] = "download transcript";
|
|
5
5
|
NotificationScenarios["EmailTranscriptError"] = "email transcript";
|
|
6
|
+
NotificationScenarios["EmailAddressSaved"] = "email address saved";
|
|
6
7
|
NotificationScenarios["AttachmentError"] = "attachment";
|
|
7
8
|
NotificationScenarios["InternetConnection"] = "internet connection";
|
|
8
9
|
NotificationScenarios["MaxSizeError"] = "max size";
|
|
@@ -33,3 +33,12 @@ export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[])
|
|
|
33
33
|
export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
|
|
34
34
|
export declare const checkContactIdError: (e: any) => void;
|
|
35
35
|
export declare const createFileAndDownload: (fileName: string, blobData: string, mimeType: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* Replace placeholders with format {0}..{n} , in a string with values
|
|
39
|
+
*
|
|
40
|
+
* @param template String with placeholders to be replaced
|
|
41
|
+
* @param values array of values to replace the placeholders
|
|
42
|
+
* @returns formatted string with replaced values
|
|
43
|
+
*/
|
|
44
|
+
export declare const formatTemplateString: (templateMessage: string, values: any) => string;
|
|
@@ -2,7 +2,10 @@ import { Dispatch } from "react";
|
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
|
-
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any
|
|
6
|
-
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined
|
|
5
|
+
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any) => Promise<void>;
|
|
6
|
+
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined) => Promise<void>;
|
|
7
|
+
export declare const callingStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
8
|
+
export declare const endChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
9
|
+
export declare const closeChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
7
10
|
export declare const endVoiceVideoCallIfOngoing: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
8
11
|
export { prepareEndChat, endChat };
|
|
@@ -4,6 +4,6 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
|
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
declare const initiatePostChat: (props: ILiveChatWidgetProps, conversationDetailsParam: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, postchatContext: any) => Promise<void>;
|
|
6
6
|
declare const isPostChatEnabled: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext) => boolean;
|
|
7
|
-
declare const getPostChatContext: (chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<
|
|
7
|
+
declare const getPostChatContext: (chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<any>;
|
|
8
8
|
declare const setWidgetStateToInactive: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
9
9
|
export { initiatePostChat, setWidgetStateToInactive, getPostChatContext, isPostChatEnabled as checkPostChatEnabled };
|
|
@@ -2,6 +2,7 @@ export declare enum NotificationScenarios {
|
|
|
2
2
|
Connection = "connection",
|
|
3
3
|
DownloadTranscriptError = "download transcript",
|
|
4
4
|
EmailTranscriptError = "email transcript",
|
|
5
|
+
EmailAddressSaved = "email address saved",
|
|
5
6
|
AttachmentError = "attachment",
|
|
6
7
|
InternetConnection = "internet connection",
|
|
7
8
|
MaxSizeError = "max size",
|
|
@@ -28,4 +28,13 @@ export interface ILiveChatWidgetLocalizedTexts {
|
|
|
28
28
|
* e.g. "{0} has been blocked because the file may contain a malware."
|
|
29
29
|
*/
|
|
30
30
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Success message, indicating the email address introduced has been registered to receive the transcript.
|
|
33
|
+
*/
|
|
34
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Error message, indicating the email address introduced couldnt be registered.
|
|
37
|
+
* {0} - e-mail address introduced
|
|
38
|
+
*/
|
|
39
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR?: string;
|
|
31
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1-main.132e1c6",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"webpack-cli": "^4.9.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "^1.0.
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.5.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^1.0.9",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.5.7",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|