@microsoft/omnichannel-chat-widget 1.6.3-main.18ee949 → 1.6.3-main.5c53935
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 +6 -2
- package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +1 -22
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +13 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +31 -14
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +26 -20
- package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
- 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 +3 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +2 -23
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +15 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +31 -14
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +26 -20
- package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
- 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 -0
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
- package/package.json +3 -3
|
@@ -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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
6
|
+
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
var _Constants = require("./Constants");
|
|
8
8
|
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
9
9
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -449,4 +449,8 @@ const formatTemplateString = (templateMessage, values) => {
|
|
|
449
449
|
return typeof values[index] !== "undefined" ? values[index] : match;
|
|
450
450
|
});
|
|
451
451
|
};
|
|
452
|
-
exports.formatTemplateString = formatTemplateString;
|
|
452
|
+
exports.formatTemplateString = formatTemplateString;
|
|
453
|
+
const parseLowerCaseString = property => {
|
|
454
|
+
return String(property).toLowerCase();
|
|
455
|
+
};
|
|
456
|
+
exports.parseLowerCaseString = parseLowerCaseString;
|
|
@@ -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, {
|
|
@@ -308,27 +308,6 @@ const closeChatWidget = (dispatch, props, state) => {
|
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
310
|
|
|
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
311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
333
312
|
const chatTokenCleanUp = async dispatch => {
|
|
334
313
|
//Just do cleanup here
|
|
@@ -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,8 +332,8 @@ 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$;
|
|
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;
|
|
320
337
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
338
|
let conversationDetails = undefined;
|
|
322
339
|
|
|
@@ -342,11 +359,11 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
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
369
|
chatSDK.requestId = currentRequestId;
|
|
@@ -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."
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isMaskingforCustomer = void 0;
|
|
7
|
+
var _utils = require("../../../../common/utils");
|
|
7
8
|
const isMaskingforCustomer = maskingInfo => {
|
|
8
9
|
var _maskingInfo$setting;
|
|
9
10
|
// If the masking info (containing masking setting and masking rules) is missing or empty, return false.
|
|
@@ -14,8 +15,9 @@ const isMaskingforCustomer = maskingInfo => {
|
|
|
14
15
|
|
|
15
16
|
// If the masking rules are provided and;
|
|
16
17
|
// If the masking setting is NOT null and masking for customer is NOT null, return the configuration
|
|
17
|
-
if ((_maskingInfo$setting = maskingInfo.setting)
|
|
18
|
-
|
|
18
|
+
if (!(0, _utils.isNullOrUndefined)((_maskingInfo$setting = maskingInfo.setting) === null || _maskingInfo$setting === void 0 ? void 0 : _maskingInfo$setting.msdyn_maskforcustomer)) {
|
|
19
|
+
var _maskingInfo$setting2;
|
|
20
|
+
return (0, _utils.parseLowerCaseString)(maskingInfo === null || maskingInfo === void 0 ? void 0 : (_maskingInfo$setting2 = maskingInfo.setting) === null || _maskingInfo$setting2 === void 0 ? void 0 : _maskingInfo$setting2.msdyn_maskforcustomer) === "true";
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
// In all other cases, even if masking setting is missing, return true to apply the masking for backward compatibility (i.e. in old versions, OC does not have masking info settings)
|
|
@@ -18,6 +18,16 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
18
18
|
const initialState = (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)(cacheTtlInMins, storageType).getData(widgetCacheId);
|
|
19
19
|
if (!(0, _utils.isNullOrUndefined)(initialState)) {
|
|
20
20
|
const initialStateFromCache = JSON.parse(initialState);
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* this step is needed to avoid the pre-chat pane to be injected in the DOM when the widget is reloaded, because wont be visible
|
|
24
|
+
* and it will be blocking all elements behind it
|
|
25
|
+
* as part of the flow, the pre-chat will be detected and then it will be displayed properly
|
|
26
|
+
* this case is only and only for pre-chat pane.
|
|
27
|
+
* **/
|
|
28
|
+
if (initialStateFromCache.appStates.conversationState === _ConversationState.ConversationState.Prechat) {
|
|
29
|
+
initialStateFromCache.appStates.conversationState = _ConversationState.ConversationState.Closed;
|
|
30
|
+
}
|
|
21
31
|
return initialStateFromCache;
|
|
22
32
|
}
|
|
23
33
|
const LiveChatWidgetContextInitialState = {
|
|
@@ -59,6 +59,7 @@ export let BroadcastEvent;
|
|
|
59
59
|
BroadcastEvent["UpdateSessionDataForTelemetry"] = "UpdateSessionDataForTelemetry";
|
|
60
60
|
BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
|
|
61
61
|
BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
|
|
62
|
+
BroadcastEvent["SyncMinimize"] = "SyncMinimize";
|
|
62
63
|
})(BroadcastEvent || (BroadcastEvent = {}));
|
|
63
64
|
export let TelemetryEvent;
|
|
64
65
|
(function (TelemetryEvent) {
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -413,4 +413,7 @@ export const formatTemplateString = (templateMessage, values) => {
|
|
|
413
413
|
return templateMessage.replace(/{(\d+)}/g, (match, index) => {
|
|
414
414
|
return typeof values[index] !== "undefined" ? values[index] : match;
|
|
415
415
|
});
|
|
416
|
+
};
|
|
417
|
+
export const parseLowerCaseString = property => {
|
|
418
|
+
return String(property).toLowerCase();
|
|
416
419
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
3
3
|
import { isNullOrEmptyString } from "../../../common/utils";
|
|
4
|
+
import { WidgetLoadCustomErrorString } from "../../../common/Constants";
|
|
4
5
|
const getAuthClientFunction = chatConfig => {
|
|
5
6
|
let authClientFunction = undefined;
|
|
6
7
|
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
@@ -25,10 +26,12 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
|
25
26
|
});
|
|
26
27
|
return true;
|
|
27
28
|
} else {
|
|
29
|
+
// instead of returning false, it's more appropiate to thrown an error to force error handling on the caller side
|
|
30
|
+
// this will help to avoid the error to be ignored and the chat to be started
|
|
28
31
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
29
32
|
Event: TelemetryEvent.ReceivedNullOrEmptyToken
|
|
30
33
|
});
|
|
31
|
-
|
|
34
|
+
throw new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
|
-
import {
|
|
3
|
+
import { handleAuthentication } from "./authHelper";
|
|
4
4
|
import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
|
|
5
5
|
import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
|
|
6
6
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -113,7 +113,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
113
113
|
Event: TelemetryEvent.EndChatSDKCall
|
|
114
114
|
});
|
|
115
115
|
//Get auth token again if chat continued for longer time, otherwise gets 401 error
|
|
116
|
-
await
|
|
116
|
+
await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
|
|
117
117
|
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
118
118
|
} catch (ex) {
|
|
119
119
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
@@ -296,27 +296,6 @@ const closeChatWidget = (dispatch, props, state) => {
|
|
|
296
296
|
});
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
|
-
const handleAuthenticationIfEnabled = async (props, chatSDK) => {
|
|
301
|
-
//Unable to end chat if token has expired
|
|
302
|
-
if (props.getAuthToken) {
|
|
303
|
-
const authClientFunction = getAuthClientFunction(props.chatConfig);
|
|
304
|
-
if (props.getAuthToken && authClientFunction) {
|
|
305
|
-
// set auth token to chat sdk before end chat
|
|
306
|
-
const authSuccess = await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
|
|
307
|
-
if (!authSuccess) {
|
|
308
|
-
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
309
|
-
Event: TelemetryEvent.GetAuthTokenFailed,
|
|
310
|
-
ExceptionDetails: {
|
|
311
|
-
exception: "Unable to get auth token during end chat"
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
throw new Error("handleAuthenticationIfEnabled:Failed to get authentication token");
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
299
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
300
|
const chatTokenCleanUp = async dispatch => {
|
|
322
301
|
//Just do cleanup here
|
|
@@ -3,10 +3,12 @@ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/teleme
|
|
|
3
3
|
import { checkContactIdError, isNullOrEmptyString, isNullOrUndefined } from "../../../common/utils";
|
|
4
4
|
import { handleAuthentication, removeAuthTokenProvider } from "./authHelper";
|
|
5
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
6
|
-
import { ConversationMode } from "../../../common/Constants";
|
|
6
|
+
import { ConversationMode, WidgetLoadCustomErrorString } from "../../../common/Constants";
|
|
7
7
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
8
8
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
9
9
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
10
|
+
import { handleStartChatError } from "./startChatErrorHandler";
|
|
11
|
+
|
|
10
12
|
// Return value: should start normal chat flow when reconnect is enabled
|
|
11
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
14
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
@@ -15,7 +17,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
15
17
|
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;
|
|
16
18
|
|
|
17
19
|
// Get chat reconnect context
|
|
18
|
-
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
|
|
20
|
+
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat, dispatch);
|
|
19
21
|
|
|
20
22
|
// Redirect if enabled
|
|
21
23
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
@@ -50,7 +52,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
|
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat) => {
|
|
55
|
+
const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat, dispatch) => {
|
|
54
56
|
try {
|
|
55
57
|
var _props$reconnectChatP4;
|
|
56
58
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -62,6 +64,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
62
64
|
};
|
|
63
65
|
// Get auth token for getting chat reconnect context
|
|
64
66
|
if (isAuthenticatedChat) {
|
|
67
|
+
// handle authentication will throw error if auth token is not available, so no need to check for response
|
|
65
68
|
await handleAuthentication(chatSDK, chatConfig, props.getAuthToken);
|
|
66
69
|
}
|
|
67
70
|
const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
|
|
@@ -71,7 +74,9 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
71
74
|
removeAuthTokenProvider(chatSDK);
|
|
72
75
|
}
|
|
73
76
|
return reconnectChatContext;
|
|
74
|
-
}
|
|
77
|
+
}
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
catch (error) {
|
|
75
80
|
checkContactIdError(error);
|
|
76
81
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
77
82
|
Event: TelemetryEvent.GetChatReconnectContextSDKCallFailed,
|
|
@@ -79,6 +84,12 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
|
|
|
79
84
|
exception: error
|
|
80
85
|
}
|
|
81
86
|
});
|
|
87
|
+
|
|
88
|
+
// when auth token is not available, propagate the error to stop the execution and ensure error pane is loaded
|
|
89
|
+
if ((error === null || error === void 0 ? void 0 : error.message) == WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
|
|
90
|
+
handleStartChatError(dispatch, chatSDK, props, new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString), false);
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
82
93
|
}
|
|
83
94
|
};
|
|
84
95
|
|
|
@@ -27,7 +27,6 @@ let popoutWidgetInstanceId;
|
|
|
27
27
|
const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
28
28
|
optionalParams = {}; //Resetting to ensure no stale values
|
|
29
29
|
widgetInstanceId = getWidgetCacheIdfromProps(props);
|
|
30
|
-
|
|
31
30
|
// reconnect > chat from cache
|
|
32
31
|
if (isReconnectEnabled(props.chatConfig) === true && !isPersistentEnabled(props.chatConfig)) {
|
|
33
32
|
const shouldStartChatNormally = await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
@@ -77,6 +76,7 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
77
76
|
});
|
|
78
77
|
return;
|
|
79
78
|
} else {
|
|
79
|
+
var _state$appStates;
|
|
80
80
|
dispatch({
|
|
81
81
|
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
82
82
|
payload: preChatSurveyResponse
|
|
@@ -85,6 +85,24 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
85
85
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
86
86
|
payload: ConversationState.Prechat
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
// If minimized, maximize the chat, if the state is missing, consider it as minimized
|
|
90
|
+
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) {
|
|
91
|
+
var _state$domainStates2, _state$domainStates2$, _state$domainStates3, _state$domainStates3$;
|
|
92
|
+
dispatch({
|
|
93
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
94
|
+
payload: false
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// this event will notify the upper layer to maximize the widget, an event missing during multi-tab scenario.
|
|
98
|
+
BroadcastService.postMessage({
|
|
99
|
+
eventName: BroadcastEvent.MaximizeChat,
|
|
100
|
+
payload: {
|
|
101
|
+
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,
|
|
102
|
+
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
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
88
106
|
return;
|
|
89
107
|
}
|
|
90
108
|
}
|
|
@@ -110,9 +128,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
110
128
|
chatSDKStateCleanUp(chatSDK);
|
|
111
129
|
}
|
|
112
130
|
try {
|
|
113
|
-
var _state$
|
|
131
|
+
var _state$appStates2, _newAdapter$activity$;
|
|
114
132
|
// Clear disconnect state on start chat
|
|
115
|
-
(state === null || state === void 0 ? void 0 : (_state$
|
|
133
|
+
(state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.chatDisconnectEventReceived) && dispatch({
|
|
116
134
|
type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
117
135
|
payload: false
|
|
118
136
|
});
|
|
@@ -207,7 +225,6 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
207
225
|
payload: liveChatContext
|
|
208
226
|
});
|
|
209
227
|
logWidgetLoadComplete();
|
|
210
|
-
|
|
211
228
|
// Set post chat context in state
|
|
212
229
|
// Commenting this for now as post chat context is fetched during end chat
|
|
213
230
|
await setPostChatContextAndLoadSurvey(chatSDK, dispatch);
|
|
@@ -224,9 +241,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
224
241
|
|
|
225
242
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
243
|
const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdapter) => {
|
|
227
|
-
var _state$
|
|
244
|
+
var _state$appStates3, _persistedState$domai6, _persistedState$appSt;
|
|
228
245
|
// By pass this function in case of popout chat
|
|
229
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
246
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.hideStartChatButton) === true) {
|
|
230
247
|
return false;
|
|
231
248
|
}
|
|
232
249
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
@@ -249,17 +266,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
249
266
|
|
|
250
267
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
251
268
|
const setCustomContextParams = async (state, props) => {
|
|
252
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
269
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates4, _persistedState$domai8;
|
|
253
270
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
254
271
|
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;
|
|
255
272
|
//Should not set custom context for auth chat
|
|
256
273
|
if (isAuthenticatedChat) {
|
|
257
274
|
return;
|
|
258
275
|
}
|
|
259
|
-
if (state !== null && state !== void 0 && (_state$
|
|
260
|
-
var _state$
|
|
276
|
+
if (state !== null && state !== void 0 && (_state$domainStates4 = state.domainStates) !== null && _state$domainStates4 !== void 0 && _state$domainStates4.customContext) {
|
|
277
|
+
var _state$domainStates5;
|
|
261
278
|
optionalParams = Object.assign({}, optionalParams, {
|
|
262
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
279
|
+
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))
|
|
263
280
|
});
|
|
264
281
|
return;
|
|
265
282
|
}
|
|
@@ -307,8 +324,8 @@ const canStartPopoutChat = async props => {
|
|
|
307
324
|
|
|
308
325
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
326
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
310
|
-
var _state$
|
|
311
|
-
const requestIdFromCache = (_state$
|
|
327
|
+
var _state$domainStates6, _state$domainStates6$;
|
|
328
|
+
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;
|
|
312
329
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
313
330
|
let conversationDetails = undefined;
|
|
314
331
|
|
|
@@ -334,11 +351,11 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
334
351
|
return false;
|
|
335
352
|
}
|
|
336
353
|
return true;
|
|
337
|
-
} catch (
|
|
354
|
+
} catch (error) {
|
|
338
355
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
339
356
|
Event: TelemetryEvent.GetConversationDetailsException,
|
|
340
357
|
ExceptionDetails: {
|
|
341
|
-
exception: `Conversation is not valid: ${
|
|
358
|
+
exception: `Conversation is not valid: ${error}`
|
|
342
359
|
}
|
|
343
360
|
});
|
|
344
361
|
chatSDK.requestId = currentRequestId;
|
|
@@ -24,6 +24,11 @@ export const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSu
|
|
|
24
24
|
type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
25
25
|
payload: StartChatFailureType.AuthSetupError
|
|
26
26
|
});
|
|
27
|
+
// set conversation to error to enforce error UI pane
|
|
28
|
+
dispatch({
|
|
29
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
30
|
+
payload: ConversationState.Error
|
|
31
|
+
});
|
|
27
32
|
logWidgetLoadCompleteWithError(ex);
|
|
28
33
|
}
|
|
29
34
|
if (ex.message === WidgetLoadCustomErrorString.NetworkErrorString) {
|
|
@@ -136,9 +136,6 @@ export const LiveChatWidgetStateful = props => {
|
|
|
136
136
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
137
137
|
payload: ConversationState.Loading
|
|
138
138
|
});
|
|
139
|
-
if (localState) {
|
|
140
|
-
localState.appStates.conversationState = ConversationState.Loading;
|
|
141
|
-
}
|
|
142
139
|
|
|
143
140
|
//Check if conversation state is not in wrapup or closed state
|
|
144
141
|
isChatValid = await checkIfConversationStillValid(chatSDK, dispatch, state);
|
|
@@ -155,7 +152,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
155
152
|
// adding the reconnect logic for the case when customer tries to reconnect from a new browser or InPrivate browser
|
|
156
153
|
const reconnectTriggered = await isReconnectTriggered();
|
|
157
154
|
if (!reconnectTriggered) {
|
|
158
|
-
|
|
155
|
+
const inMemoryState = executeReducer(state, {
|
|
156
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
157
|
+
payload: null
|
|
158
|
+
});
|
|
159
|
+
await setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
159
160
|
}
|
|
160
161
|
return;
|
|
161
162
|
} else {
|
|
@@ -335,31 +336,35 @@ export const LiveChatWidgetStateful = props => {
|
|
|
335
336
|
}
|
|
336
337
|
});
|
|
337
338
|
|
|
339
|
+
/**
|
|
340
|
+
* This will allow to sync multiple tabs to handle minimize and maximize state,
|
|
341
|
+
* the event is expected to be emitted from scripting layer.
|
|
342
|
+
*/
|
|
343
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.SyncMinimize).subscribe(msg => {
|
|
344
|
+
var _msg$payload4;
|
|
345
|
+
dispatch({
|
|
346
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
347
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload4 = msg.payload) === null || _msg$payload4 === void 0 ? void 0 : _msg$payload4.minimized
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
|
|
338
351
|
// Start chat from SDK Event
|
|
339
352
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
340
|
-
var _msg$
|
|
353
|
+
var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
341
354
|
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
342
|
-
if (!isNullOrUndefined(msg === null || msg === void 0 ? void 0 : (_msg$
|
|
355
|
+
if (!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.InternalTelemetryData.lcwRuntimeId) {
|
|
343
356
|
return;
|
|
344
357
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var _msg$payload7, _msg$payload8;
|
|
358
|
+
if (msg !== null && msg !== void 0 && (_msg$payload7 = msg.payload) !== null && _msg$payload7 !== void 0 && _msg$payload7.customContext) {
|
|
359
|
+
var _msg$payload8;
|
|
348
360
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
349
361
|
Event: TelemetryEvent.CustomContextReceived,
|
|
350
362
|
Description: "CustomContext received through startChat event."
|
|
351
363
|
});
|
|
352
364
|
dispatch({
|
|
353
365
|
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
354
|
-
payload: msg === null || msg === void 0 ? void 0 : (_msg$
|
|
366
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
355
367
|
});
|
|
356
|
-
stateWithUpdatedContext = {
|
|
357
|
-
...state,
|
|
358
|
-
domainStates: {
|
|
359
|
-
...state.domainStates,
|
|
360
|
-
customContext: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
368
|
}
|
|
364
369
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
365
370
|
Event: TelemetryEvent.StartChatEventRecevied,
|
|
@@ -369,13 +374,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
369
374
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
370
375
|
payload: null
|
|
371
376
|
});
|
|
377
|
+
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
372
378
|
|
|
373
379
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
374
380
|
if (((_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) === ConversationState.Closed || ((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === ConversationState.InActive || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === ConversationState.Postchat) {
|
|
375
381
|
BroadcastService.postMessage({
|
|
376
382
|
eventName: BroadcastEvent.ChatInitiated
|
|
377
383
|
});
|
|
378
|
-
prepareStartChat(props, chatSDK,
|
|
384
|
+
prepareStartChat(props, chatSDK, inMemoryState, dispatch, setAdapter);
|
|
379
385
|
return;
|
|
380
386
|
}
|
|
381
387
|
|
|
@@ -442,8 +448,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
442
448
|
// Listen to end chat event from other tabs
|
|
443
449
|
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) ?? "");
|
|
444
450
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
445
|
-
var _msg$
|
|
446
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
451
|
+
var _msg$payload10;
|
|
452
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
447
453
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
448
454
|
Event: TelemetryEvent.PrepareEndChat,
|
|
449
455
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isNullOrUndefined, parseLowerCaseString } from "../../../../common/utils";
|
|
1
2
|
export const isMaskingforCustomer = maskingInfo => {
|
|
2
3
|
var _maskingInfo$setting;
|
|
3
4
|
// If the masking info (containing masking setting and masking rules) is missing or empty, return false.
|
|
@@ -8,8 +9,9 @@ export const isMaskingforCustomer = maskingInfo => {
|
|
|
8
9
|
|
|
9
10
|
// If the masking rules are provided and;
|
|
10
11
|
// If the masking setting is NOT null and masking for customer is NOT null, return the configuration
|
|
11
|
-
if ((_maskingInfo$setting = maskingInfo.setting)
|
|
12
|
-
|
|
12
|
+
if (!isNullOrUndefined((_maskingInfo$setting = maskingInfo.setting) === null || _maskingInfo$setting === void 0 ? void 0 : _maskingInfo$setting.msdyn_maskforcustomer)) {
|
|
13
|
+
var _maskingInfo$setting2;
|
|
14
|
+
return parseLowerCaseString(maskingInfo === null || maskingInfo === void 0 ? void 0 : (_maskingInfo$setting2 = maskingInfo.setting) === null || _maskingInfo$setting2 === void 0 ? void 0 : _maskingInfo$setting2.msdyn_maskforcustomer) === "true";
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
// In all other cases, even if masking setting is missing, return true to apply the masking for backward compatibility (i.e. in old versions, OC does not have masking info settings)
|
|
@@ -12,6 +12,16 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
12
12
|
const initialState = defaultClientDataStoreProvider(cacheTtlInMins, storageType).getData(widgetCacheId);
|
|
13
13
|
if (!isNullOrUndefined(initialState)) {
|
|
14
14
|
const initialStateFromCache = JSON.parse(initialState);
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* this step is needed to avoid the pre-chat pane to be injected in the DOM when the widget is reloaded, because wont be visible
|
|
18
|
+
* and it will be blocking all elements behind it
|
|
19
|
+
* as part of the flow, the pre-chat will be detected and then it will be displayed properly
|
|
20
|
+
* this case is only and only for pre-chat pane.
|
|
21
|
+
* **/
|
|
22
|
+
if (initialStateFromCache.appStates.conversationState === ConversationState.Prechat) {
|
|
23
|
+
initialStateFromCache.appStates.conversationState = ConversationState.Closed;
|
|
24
|
+
}
|
|
15
25
|
return initialStateFromCache;
|
|
16
26
|
}
|
|
17
27
|
const LiveChatWidgetContextInitialState = {
|
|
@@ -52,7 +52,8 @@ export declare enum BroadcastEvent {
|
|
|
52
52
|
HideChatVisibilityChangeEvent = "hideChatVisibilityChangeEvent",
|
|
53
53
|
UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
|
|
54
54
|
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
|
|
55
|
-
ContactIdNotFound = "ContactIdNotFound"
|
|
55
|
+
ContactIdNotFound = "ContactIdNotFound",
|
|
56
|
+
SyncMinimize = "SyncMinimize"
|
|
56
57
|
}
|
|
57
58
|
export declare enum TelemetryEvent {
|
|
58
59
|
CallAdded = "CallAdded",
|
|
@@ -42,3 +42,4 @@ export declare const createFileAndDownload: (fileName: string, blobData: string,
|
|
|
42
42
|
* @returns formatted string with replaced values
|
|
43
43
|
*/
|
|
44
44
|
export declare const formatTemplateString: (templateMessage: string, values: any) => string;
|
|
45
|
+
export declare const parseLowerCaseString: (property: string | boolean | undefined) => string;
|
|
@@ -5,7 +5,7 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
5
5
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
6
6
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
7
7
|
declare const handleChatReconnect: (chatSDK: any, props: ILiveChatWidgetProps, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<boolean>;
|
|
8
|
-
declare const getChatReconnectContext: (chatSDK: any, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean) => Promise<any>;
|
|
8
|
+
declare const getChatReconnectContext: (chatSDK: any, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<any>;
|
|
9
9
|
declare const isReconnectEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
|
|
10
10
|
declare const isPersistentEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
|
|
11
11
|
export { handleChatReconnect, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.6.3-main.
|
|
3
|
+
"version": "1.6.3-main.5c53935",
|
|
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.1.
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.6.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^1.1.2",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.6.3",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|