@microsoft/omnichannel-chat-widget 1.6.3-main.e6221d5 → 1.6.4-main.0fc902c
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/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
- package/lib/cjs/common/utils.js +9 -4
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +29 -24
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +9 -30
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +13 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +35 -19
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -20
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +8 -4
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +5 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDownloadIconStyles.js +1 -1
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/cjs/contexts/createReducer.js +1 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
- package/lib/esm/common/utils.js +9 -4
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +30 -25
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/esm/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -31
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +15 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +35 -19
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -20
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +8 -4
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDownloadIconStyles.js +1 -1
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/esm/contexts/createReducer.js +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
- package/lib/types/common/utils.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/package.json +6 -4
|
@@ -64,6 +64,7 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
64
64
|
BroadcastEvent["UpdateSessionDataForTelemetry"] = "UpdateSessionDataForTelemetry";
|
|
65
65
|
BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
|
|
66
66
|
BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
|
|
67
|
+
BroadcastEvent["SyncMinimize"] = "SyncMinimize";
|
|
67
68
|
})(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
|
|
68
69
|
let TelemetryEvent;
|
|
69
70
|
exports.TelemetryEvent = TelemetryEvent;
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -383,15 +383,20 @@ const debounceLeading = function (fn) {
|
|
|
383
383
|
|
|
384
384
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
385
385
|
exports.debounceLeading = debounceLeading;
|
|
386
|
-
const getConversationDetailsCall = async chatSDK
|
|
387
|
-
|
|
388
|
-
let conversationDetails = undefined;
|
|
386
|
+
const getConversationDetailsCall = async function (chatSDK) {
|
|
387
|
+
let liveChatContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
388
|
+
let conversationDetails = undefined; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
389
|
+
const optionalParams = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
390
|
+
|
|
391
|
+
if (liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.requestId && liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.chatToken) {
|
|
392
|
+
optionalParams.liveChatContext = liveChatContext;
|
|
393
|
+
}
|
|
389
394
|
try {
|
|
390
395
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
391
396
|
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallStarted,
|
|
392
397
|
Description: "Conversation details call started"
|
|
393
398
|
});
|
|
394
|
-
conversationDetails = await chatSDK.getConversationDetails();
|
|
399
|
+
conversationDetails = await chatSDK.getConversationDetails(optionalParams);
|
|
395
400
|
} catch (error) {
|
|
396
401
|
checkContactIdError(error);
|
|
397
402
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -45,33 +45,38 @@ const EmailTranscriptPaneStateful = props => {
|
|
|
45
45
|
});
|
|
46
46
|
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
47
47
|
};
|
|
48
|
+
const onSend = (0, _react.useCallback)(async email => {
|
|
49
|
+
var _state$domainStates;
|
|
50
|
+
const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
|
|
51
|
+
closeEmailTranscriptPane();
|
|
52
|
+
const chatTranscriptBody = {
|
|
53
|
+
emailAddress: email,
|
|
54
|
+
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody, {
|
|
58
|
+
liveChatContext
|
|
59
|
+
}));
|
|
60
|
+
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
61
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
62
|
+
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
63
|
+
Description: "Transcript sent to email successfully."
|
|
64
|
+
});
|
|
65
|
+
} catch (ex) {
|
|
66
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
67
|
+
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
|
|
68
|
+
ExceptionDetails: {
|
|
69
|
+
exception: ex
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
73
|
+
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
74
|
+
}
|
|
75
|
+
}, [props.attachmentMessage, props.bannerMessageOnError, chatSDK, state.domainStates.liveChatContext]);
|
|
48
76
|
const controlProps = {
|
|
49
77
|
id: "oclcw-emailTranscriptDialogContainer",
|
|
50
78
|
dir: state.domainStates.globalDir,
|
|
51
|
-
onSend
|
|
52
|
-
closeEmailTranscriptPane();
|
|
53
|
-
const chatTranscriptBody = {
|
|
54
|
-
emailAddress: email,
|
|
55
|
-
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
56
|
-
};
|
|
57
|
-
try {
|
|
58
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
|
|
59
|
-
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
60
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
61
|
-
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
62
|
-
Description: "Transcript sent to email successfully."
|
|
63
|
-
});
|
|
64
|
-
} catch (ex) {
|
|
65
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
66
|
-
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
|
|
67
|
-
ExceptionDetails: {
|
|
68
|
-
exception: ex
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
72
|
-
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
79
|
+
onSend,
|
|
75
80
|
onCancel: () => {
|
|
76
81
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
77
82
|
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptCancelButtonClicked,
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -12,6 +12,8 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
12
12
|
var _createChatTranscript = _interopRequireDefault(require("../../../plugins/createChatTranscript"));
|
|
13
13
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
14
14
|
var _utils = require("../../../common/utils");
|
|
15
|
+
var _createReducer = require("../../../contexts/createReducer");
|
|
16
|
+
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
18
|
const processDisplayName = displayName => {
|
|
17
19
|
// if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
|
|
@@ -164,12 +166,16 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
164
166
|
|
|
165
167
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
168
|
const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
|
|
167
|
-
var _state$domainStates
|
|
168
|
-
// Need to keep existing
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
var _state$domainStates;
|
|
170
|
+
// Need to keep existing live chat context for scenarios when transcript is downloaded after endchat
|
|
171
|
+
let liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
|
|
172
|
+
if (!liveChatContext) {
|
|
173
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
174
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
175
|
+
payload: null
|
|
176
|
+
});
|
|
177
|
+
liveChatContext = inMemoryState.domainStates.liveChatContext;
|
|
178
|
+
}
|
|
173
179
|
let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
|
|
174
180
|
liveChatContext
|
|
175
181
|
}));
|
|
@@ -7,6 +7,7 @@ exports.removeAuthTokenProvider = exports.handleAuthentication = exports.getAuth
|
|
|
7
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
9
9
|
var _utils = require("../../../common/utils");
|
|
10
|
+
var _Constants = require("../../../common/Constants");
|
|
10
11
|
const getAuthClientFunction = chatConfig => {
|
|
11
12
|
let authClientFunction = undefined;
|
|
12
13
|
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
@@ -32,10 +33,12 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
|
32
33
|
});
|
|
33
34
|
return true;
|
|
34
35
|
} else {
|
|
36
|
+
// instead of returning false, it's more appropiate to thrown an error to force error handling on the caller side
|
|
37
|
+
// this will help to avoid the error to be ignored and the chat to be started
|
|
35
38
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
36
39
|
Event: _TelemetryConstants.TelemetryEvent.ReceivedNullOrEmptyToken
|
|
37
40
|
});
|
|
38
|
-
|
|
41
|
+
throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
return false;
|
|
@@ -119,7 +119,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
119
119
|
Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
|
|
120
120
|
});
|
|
121
121
|
//Get auth token again if chat continued for longer time, otherwise gets 401 error
|
|
122
|
-
await
|
|
122
|
+
await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
|
|
123
123
|
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
124
124
|
} catch (ex) {
|
|
125
125
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -200,10 +200,6 @@ const callingStateCleanUp = dispatch => {
|
|
|
200
200
|
exports.callingStateCleanUp = callingStateCleanUp;
|
|
201
201
|
const endChatStateCleanUp = dispatch => {
|
|
202
202
|
// Need to clear these states immediately when chat ended from OC.
|
|
203
|
-
dispatch({
|
|
204
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
205
|
-
payload: undefined
|
|
206
|
-
});
|
|
207
203
|
dispatch({
|
|
208
204
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
209
205
|
payload: undefined
|
|
@@ -248,6 +244,12 @@ const closeChatStateCleanUp = dispatch => {
|
|
|
248
244
|
proactiveChatInNewWindow: false
|
|
249
245
|
}
|
|
250
246
|
});
|
|
247
|
+
|
|
248
|
+
// Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
|
|
249
|
+
dispatch({
|
|
250
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
251
|
+
payload: undefined
|
|
252
|
+
});
|
|
251
253
|
};
|
|
252
254
|
|
|
253
255
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -308,27 +310,6 @@ const closeChatWidget = (dispatch, props, state) => {
|
|
|
308
310
|
});
|
|
309
311
|
};
|
|
310
312
|
|
|
311
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
|
-
const handleAuthenticationIfEnabled = async (props, chatSDK) => {
|
|
313
|
-
//Unable to end chat if token has expired
|
|
314
|
-
if (props.getAuthToken) {
|
|
315
|
-
const authClientFunction = (0, _authHelper.getAuthClientFunction)(props.chatConfig);
|
|
316
|
-
if (props.getAuthToken && authClientFunction) {
|
|
317
|
-
// set auth token to chat sdk before end chat
|
|
318
|
-
const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
|
|
319
|
-
if (!authSuccess) {
|
|
320
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
321
|
-
Event: _TelemetryConstants.TelemetryEvent.GetAuthTokenFailed,
|
|
322
|
-
ExceptionDetails: {
|
|
323
|
-
exception: "Unable to get auth token during end chat"
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
throw new Error("handleAuthenticationIfEnabled:Failed to get authentication token");
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
|
|
332
313
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
333
314
|
const chatTokenCleanUp = async dispatch => {
|
|
334
315
|
//Just do cleanup here
|
|
@@ -336,10 +317,8 @@ const chatTokenCleanUp = async dispatch => {
|
|
|
336
317
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
337
318
|
payload: undefined
|
|
338
319
|
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
payload: undefined
|
|
342
|
-
});
|
|
320
|
+
|
|
321
|
+
// Need to keep liveChatContext until chat is fully closed to for transcript download/email
|
|
343
322
|
};
|
|
344
323
|
|
|
345
324
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -122,7 +122,7 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
|
122
122
|
dir: state.domainStates.globalDir,
|
|
123
123
|
locale: (0, _utils.changeLanguageCodeFormatForWebChat)((0, _omnichannelChatSdk.getLocaleStringFromId)((_state$domainStates$l4 = state.domainStates.liveChatConfig) === null || _state$domainStates$l4 === void 0 ? void 0 : (_state$domainStates$l5 = _state$domainStates$l4.ChatWidgetLanguage) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.msdyn_localeid)),
|
|
124
124
|
store: webChatStore,
|
|
125
|
-
activityMiddleware: (_props$webChatContain9 = props.webChatContainerProps) !== null && _props$webChatContain9 !== void 0 && (_props$webChatContain10 = _props$webChatContain9.renderingMiddlewareProps) !== null && _props$webChatContain10 !== void 0 && _props$webChatContain10.disableActivityMiddleware ? undefined : (0, _activityMiddleware.createActivityMiddleware)((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.systemMessageStyleProps, (_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.userMessageStyleProps),
|
|
125
|
+
activityMiddleware: (_props$webChatContain9 = props.webChatContainerProps) !== null && _props$webChatContain9 !== void 0 && (_props$webChatContain10 = _props$webChatContain9.renderingMiddlewareProps) !== null && _props$webChatContain10 !== void 0 && _props$webChatContain10.disableActivityMiddleware ? undefined : (0, _activityMiddleware.createActivityMiddleware)(renderMarkdown, (_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.systemMessageStyleProps, (_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.userMessageStyleProps),
|
|
126
126
|
attachmentMiddleware: (_props$webChatContain11 = props.webChatContainerProps) !== null && _props$webChatContain11 !== void 0 && (_props$webChatContain12 = _props$webChatContain11.renderingMiddlewareProps) !== null && _props$webChatContain12 !== void 0 && _props$webChatContain12.disableAttachmentMiddleware ? undefined : (0, _attachmentMiddleware.default)(((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : (_state$domainStates$r4 = _state$domainStates$r3.attachmentProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.enableInlinePlaying) ?? _defaultAttachmentProps.defaultAttachmentProps.enableInlinePlaying),
|
|
127
127
|
activityStatusMiddleware: (_props$webChatContain13 = props.webChatContainerProps) !== null && _props$webChatContain13 !== void 0 && (_props$webChatContain14 = _props$webChatContain13.renderingMiddlewareProps) !== null && _props$webChatContain14 !== void 0 && _props$webChatContain14.disableActivityStatusMiddleware ? undefined : (_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.activityStatusMiddleware,
|
|
128
128
|
toastMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableToastMiddleware ? undefined : (0, _toastMiddleware.default)(props.notificationPaneProps, endChat),
|
|
@@ -13,6 +13,7 @@ var _Constants = require("../../../common/Constants");
|
|
|
13
13
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
14
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
15
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
16
|
+
var _startChatErrorHandler = require("./startChatErrorHandler");
|
|
16
17
|
// Return value: should start normal chat flow when reconnect is enabled
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
19
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
@@ -21,7 +22,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
21
22
|
const isAuthenticatedChat = (_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;
|
|
22
23
|
|
|
23
24
|
// Get chat reconnect context
|
|
24
|
-
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
|
|
25
|
+
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat, dispatch);
|
|
25
26
|
|
|
26
27
|
// Redirect if enabled
|
|
27
28
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
@@ -57,7 +58,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
57
58
|
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
60
|
exports.handleChatReconnect = handleChatReconnect;
|
|
60
|
-
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat) => {
|
|
61
|
+
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat, dispatch) => {
|
|
61
62
|
try {
|
|
62
63
|
var _props$reconnectChatP4;
|
|
63
64
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -69,6 +70,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
69
70
|
};
|
|
70
71
|
// Get auth token for getting chat reconnect context
|
|
71
72
|
if (isAuthenticatedChat) {
|
|
73
|
+
// handle authentication will throw error if auth token is not available, so no need to check for response
|
|
72
74
|
await (0, _authHelper.handleAuthentication)(chatSDK, chatConfig, props.getAuthToken);
|
|
73
75
|
}
|
|
74
76
|
const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
|
|
@@ -78,7 +80,9 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
78
80
|
(0, _authHelper.removeAuthTokenProvider)(chatSDK);
|
|
79
81
|
}
|
|
80
82
|
return reconnectChatContext;
|
|
81
|
-
}
|
|
83
|
+
}
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
+
catch (error) {
|
|
82
86
|
(0, _utils.checkContactIdError)(error);
|
|
83
87
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
84
88
|
Event: _TelemetryConstants.TelemetryEvent.GetChatReconnectContextSDKCallFailed,
|
|
@@ -86,6 +90,12 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
86
90
|
exception: error
|
|
87
91
|
}
|
|
88
92
|
});
|
|
93
|
+
|
|
94
|
+
// when auth token is not available, propagate the error to stop the execution and ensure error pane is loaded
|
|
95
|
+
if ((error === null || error === void 0 ? void 0 : error.message) == _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
|
|
96
|
+
(0, _startChatErrorHandler.handleStartChatError)(dispatch, chatSDK, props, new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString), false);
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
100
|
};
|
|
91
101
|
|
|
@@ -32,7 +32,6 @@ let popoutWidgetInstanceId;
|
|
|
32
32
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
33
33
|
optionalParams = {}; //Resetting to ensure no stale values
|
|
34
34
|
widgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
35
|
-
|
|
36
35
|
// reconnect > chat from cache
|
|
37
36
|
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
|
|
38
37
|
const shouldStartChatNormally = await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
@@ -83,6 +82,7 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
83
82
|
});
|
|
84
83
|
return;
|
|
85
84
|
} else {
|
|
85
|
+
var _state$appStates;
|
|
86
86
|
dispatch({
|
|
87
87
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
88
88
|
payload: preChatSurveyResponse
|
|
@@ -91,6 +91,24 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
91
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
92
92
|
payload: _ConversationState.ConversationState.Prechat
|
|
93
93
|
});
|
|
94
|
+
|
|
95
|
+
// If minimized, maximize the chat, if the state is missing, consider it as minimized
|
|
96
|
+
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) == undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
|
|
97
|
+
var _state$domainStates2, _state$domainStates2$, _state$domainStates3, _state$domainStates3$;
|
|
98
|
+
dispatch({
|
|
99
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
100
|
+
payload: false
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// this event will notify the upper layer to maximize the widget, an event missing during multi-tab scenario.
|
|
104
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
105
|
+
eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
|
|
106
|
+
payload: {
|
|
107
|
+
height: state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.widgetSize) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.height,
|
|
108
|
+
width: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.width
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
94
112
|
return;
|
|
95
113
|
}
|
|
96
114
|
}
|
|
@@ -117,9 +135,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
117
135
|
(0, _endChat.chatSDKStateCleanUp)(chatSDK);
|
|
118
136
|
}
|
|
119
137
|
try {
|
|
120
|
-
var _state$
|
|
138
|
+
var _state$appStates2, _newAdapter$activity$;
|
|
121
139
|
// Clear disconnect state on start chat
|
|
122
|
-
(state === null || state === void 0 ? void 0 : (_state$
|
|
140
|
+
(state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.chatDisconnectEventReceived) && dispatch({
|
|
123
141
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
124
142
|
payload: false
|
|
125
143
|
});
|
|
@@ -214,7 +232,6 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
214
232
|
payload: liveChatContext
|
|
215
233
|
});
|
|
216
234
|
(0, _startChatErrorHandler.logWidgetLoadComplete)();
|
|
217
|
-
|
|
218
235
|
// Set post chat context in state
|
|
219
236
|
// Commenting this for now as post chat context is fetched during end chat
|
|
220
237
|
await (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(chatSDK, dispatch);
|
|
@@ -232,9 +249,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
232
249
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
250
|
exports.initStartChat = initStartChat;
|
|
234
251
|
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
235
|
-
var _state$
|
|
252
|
+
var _state$appStates3, _persistedState$domai6, _persistedState$appSt;
|
|
236
253
|
// By pass this function in case of popout chat
|
|
237
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
254
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.hideStartChatButton) === true) {
|
|
238
255
|
return false;
|
|
239
256
|
}
|
|
240
257
|
const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
|
|
@@ -257,17 +274,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
257
274
|
|
|
258
275
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
276
|
const setCustomContextParams = async (state, props) => {
|
|
260
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
277
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates4, _persistedState$domai8;
|
|
261
278
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
262
279
|
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;
|
|
263
280
|
//Should not set custom context for auth chat
|
|
264
281
|
if (isAuthenticatedChat) {
|
|
265
282
|
return;
|
|
266
283
|
}
|
|
267
|
-
if (state !== null && state !== void 0 && (_state$
|
|
268
|
-
var _state$
|
|
284
|
+
if (state !== null && state !== void 0 && (_state$domainStates4 = state.domainStates) !== null && _state$domainStates4 !== void 0 && _state$domainStates4.customContext) {
|
|
285
|
+
var _state$domainStates5;
|
|
269
286
|
optionalParams = Object.assign({}, optionalParams, {
|
|
270
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
287
|
+
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : _state$domainStates5.customContext))
|
|
271
288
|
});
|
|
272
289
|
return;
|
|
273
290
|
}
|
|
@@ -315,12 +332,14 @@ const canStartPopoutChat = async props => {
|
|
|
315
332
|
|
|
316
333
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
317
334
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
318
|
-
var _state$
|
|
319
|
-
const requestIdFromCache = (_state$
|
|
335
|
+
var _state$domainStates6, _state$domainStates6$, _state$domainStates7;
|
|
336
|
+
const requestIdFromCache = (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.liveChatContext) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.requestId;
|
|
337
|
+
const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : _state$domainStates7.liveChatContext;
|
|
338
|
+
|
|
320
339
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
340
|
let conversationDetails = undefined;
|
|
322
341
|
|
|
323
|
-
//Preserve current requestId
|
|
342
|
+
// Preserve current requestId
|
|
324
343
|
const currentRequestId = chatSDK.requestId ?? "";
|
|
325
344
|
dispatch({
|
|
326
345
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID,
|
|
@@ -328,9 +347,8 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
328
347
|
});
|
|
329
348
|
try {
|
|
330
349
|
chatSDK.requestId = requestIdFromCache;
|
|
331
|
-
conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
|
|
350
|
+
conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK, liveChatContext);
|
|
332
351
|
if (Object.keys(conversationDetails).length === 0) {
|
|
333
|
-
chatSDK.requestId = currentRequestId;
|
|
334
352
|
return false;
|
|
335
353
|
}
|
|
336
354
|
if (conversationDetails.state === _Constants.LiveWorkItemState.Closed || conversationDetails.state === _Constants.LiveWorkItemState.WrapUp) {
|
|
@@ -338,18 +356,16 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
338
356
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
339
357
|
payload: undefined
|
|
340
358
|
});
|
|
341
|
-
chatSDK.requestId = currentRequestId;
|
|
342
359
|
return false;
|
|
343
360
|
}
|
|
344
361
|
return true;
|
|
345
|
-
} catch (
|
|
362
|
+
} catch (error) {
|
|
346
363
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
347
364
|
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsException,
|
|
348
365
|
ExceptionDetails: {
|
|
349
|
-
exception: `Conversation is not valid: ${
|
|
366
|
+
exception: `Conversation is not valid: ${error}`
|
|
350
367
|
}
|
|
351
368
|
});
|
|
352
|
-
chatSDK.requestId = currentRequestId;
|
|
353
369
|
return false;
|
|
354
370
|
}
|
|
355
371
|
};
|
|
@@ -29,6 +29,11 @@ const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessfu
|
|
|
29
29
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
30
30
|
payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
|
|
31
31
|
});
|
|
32
|
+
// set conversation to error to enforce error UI pane
|
|
33
|
+
dispatch({
|
|
34
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
35
|
+
payload: _ConversationState.ConversationState.Error
|
|
36
|
+
});
|
|
32
37
|
logWidgetLoadCompleteWithError(ex);
|
|
33
38
|
}
|
|
34
39
|
if (ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
|
|
@@ -144,9 +144,6 @@ const LiveChatWidgetStateful = props => {
|
|
|
144
144
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
145
145
|
payload: _ConversationState.ConversationState.Loading
|
|
146
146
|
});
|
|
147
|
-
if (localState) {
|
|
148
|
-
localState.appStates.conversationState = _ConversationState.ConversationState.Loading;
|
|
149
|
-
}
|
|
150
147
|
|
|
151
148
|
//Check if conversation state is not in wrapup or closed state
|
|
152
149
|
isChatValid = await (0, _startChat.checkIfConversationStillValid)(chatSDK, dispatch, state);
|
|
@@ -163,7 +160,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
163
160
|
// adding the reconnect logic for the case when customer tries to reconnect from a new browser or InPrivate browser
|
|
164
161
|
const reconnectTriggered = await isReconnectTriggered();
|
|
165
162
|
if (!reconnectTriggered) {
|
|
166
|
-
|
|
163
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
164
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
165
|
+
payload: null
|
|
166
|
+
});
|
|
167
|
+
await (0, _startChat.setPreChatAndInitiateChat)(chatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
167
168
|
}
|
|
168
169
|
return;
|
|
169
170
|
} else {
|
|
@@ -343,31 +344,35 @@ const LiveChatWidgetStateful = props => {
|
|
|
343
344
|
}
|
|
344
345
|
});
|
|
345
346
|
|
|
347
|
+
/**
|
|
348
|
+
* This will allow to sync multiple tabs to handle minimize and maximize state,
|
|
349
|
+
* the event is expected to be emitted from scripting layer.
|
|
350
|
+
*/
|
|
351
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SyncMinimize).subscribe(msg => {
|
|
352
|
+
var _msg$payload4;
|
|
353
|
+
dispatch({
|
|
354
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
355
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload4 = msg.payload) === null || _msg$payload4 === void 0 ? void 0 : _msg$payload4.minimized
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
346
359
|
// Start chat from SDK Event
|
|
347
360
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
|
|
348
|
-
var _msg$
|
|
361
|
+
var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
349
362
|
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
350
|
-
if (!(0, _utils.isNullOrUndefined)(msg === null || msg === void 0 ? void 0 : (_msg$
|
|
363
|
+
if (!(0, _utils.isNullOrUndefined)(msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload6 = msg.payload) === null || _msg$payload6 === void 0 ? void 0 : _msg$payload6.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
351
364
|
return;
|
|
352
365
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
var _msg$payload7, _msg$payload8;
|
|
366
|
+
if (msg !== null && msg !== void 0 && (_msg$payload7 = msg.payload) !== null && _msg$payload7 !== void 0 && _msg$payload7.customContext) {
|
|
367
|
+
var _msg$payload8;
|
|
356
368
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
357
369
|
Event: _TelemetryConstants.TelemetryEvent.CustomContextReceived,
|
|
358
370
|
Description: "CustomContext received through startChat event."
|
|
359
371
|
});
|
|
360
372
|
dispatch({
|
|
361
373
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
362
|
-
payload: msg === null || msg === void 0 ? void 0 : (_msg$
|
|
374
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
363
375
|
});
|
|
364
|
-
stateWithUpdatedContext = {
|
|
365
|
-
...state,
|
|
366
|
-
domainStates: {
|
|
367
|
-
...state.domainStates,
|
|
368
|
-
customContext: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
376
|
}
|
|
372
377
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
373
378
|
Event: _TelemetryConstants.TelemetryEvent.StartChatEventRecevied,
|
|
@@ -377,13 +382,14 @@ const LiveChatWidgetStateful = props => {
|
|
|
377
382
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
378
383
|
payload: null
|
|
379
384
|
});
|
|
385
|
+
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
380
386
|
|
|
381
387
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
382
388
|
if (((_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) === _ConversationState.ConversationState.Closed || ((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === _ConversationState.ConversationState.InActive || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === _ConversationState.ConversationState.Postchat) {
|
|
383
389
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
384
390
|
eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
|
|
385
391
|
});
|
|
386
|
-
(0, _startChat.prepareStartChat)(props, chatSDK,
|
|
392
|
+
(0, _startChat.prepareStartChat)(props, chatSDK, inMemoryState, dispatch, setAdapter);
|
|
387
393
|
return;
|
|
388
394
|
}
|
|
389
395
|
|
|
@@ -450,8 +456,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
450
456
|
// Listen to end chat event from other tabs
|
|
451
457
|
const endChatEventName = (0, _utils.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) ?? "");
|
|
452
458
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
453
|
-
var _msg$
|
|
454
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
459
|
+
var _msg$payload10;
|
|
460
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
455
461
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
456
462
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
457
463
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -720,6 +726,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
720
726
|
::-webkit-scrollbar-thumb:hover {
|
|
721
727
|
background: ${scrollbarProps.thumbHoverColor};
|
|
722
728
|
}
|
|
729
|
+
}
|
|
723
730
|
`), /*#__PURE__*/_react2.default.createElement(_DraggableChatWidget.default, chatWidgetDraggableConfig, /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
724
731
|
styleOptions: {
|
|
725
732
|
...webChatStyles,
|
|
@@ -185,10 +185,10 @@ const WebChatContainerStateful = props => {
|
|
|
185
185
|
|
|
186
186
|
.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.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
187
187
|
|
|
188
|
-
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
189
|
-
background-image : url(data:image/svg+xml;base64,
|
|
190
|
-
height:
|
|
191
|
-
|
|
188
|
+
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon, img.webchat__render-markdown__external-link-icon {
|
|
189
|
+
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
|
|
190
|
+
height: .75em;
|
|
191
|
+
margin-left: .25em;
|
|
192
192
|
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp9 === void 0 ? void 0 : (_webChatContainerProp10 = _webChatContainerProp9.receivedMessageAnchorStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
|
|
193
193
|
}
|
|
194
194
|
pre {
|
|
@@ -210,6 +210,10 @@ const WebChatContainerStateful = props => {
|
|
|
210
210
|
.ms_lcw_webchat_sent_message a:active {
|
|
211
211
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp13 === void 0 ? void 0 : (_webChatContainerProp14 = _webChatContainerProp13.sentMessageAnchorStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
|
|
212
212
|
}
|
|
213
|
+
|
|
214
|
+
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
215
|
+
border-radius: 0 !important; /* Override border-radius */
|
|
216
|
+
}
|
|
213
217
|
`), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
214
218
|
styles: containerStyles
|
|
215
219
|
}, /*#__PURE__*/_react2.default.createElement(BasicWebChat, null)));
|
|
@@ -31,7 +31,7 @@ const defaultMiddlewareLocalizedTexts = {
|
|
|
31
31
|
MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
|
|
32
32
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
33
33
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
34
|
-
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "
|
|
34
|
+
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
|
|
35
35
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
36
36
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
37
37
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|