@microsoft/omnichannel-chat-widget 1.8.1-main.5ac9acf → 1.8.1-main.6ec59e7
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/facades/FacadeChatSDK.js +7 -49
- package/lib/cjs/common/telemetry/TelemetryConstants.js +0 -3
- package/lib/cjs/common/telemetry/TelemetryManager.js +2 -2
- package/lib/cjs/common/utils.js +0 -3
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +3 -7
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -15
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +1 -1
- package/lib/cjs/components/livechatwidget/common/persistentChatHelper.js +5 -12
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +2 -2
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +9 -55
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
- package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
- package/lib/esm/common/facades/FacadeChatSDK.js +7 -49
- package/lib/esm/common/telemetry/TelemetryConstants.js +0 -3
- package/lib/esm/common/telemetry/TelemetryManager.js +2 -2
- package/lib/esm/common/utils.js +0 -3
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +3 -7
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +5 -16
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +1 -1
- package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +5 -12
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +0 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +2 -2
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +8 -53
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
- package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
- package/lib/types/common/facades/FacadeChatSDK.d.ts +0 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +0 -3
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/persistentChatHelper.d.ts +1 -2
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +0 -1
- package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +1 -2
- package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +0 -1
- package/package.json +2 -2
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +0 -68
- package/lib/esm/components/errorboundary/ErrorBoundary.js +0 -59
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +0 -14
|
@@ -109,7 +109,7 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
109
109
|
token: last3digits
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
throw new Error("
|
|
112
|
+
throw new Error("Invalid token format, must be in JWT format");
|
|
113
113
|
}
|
|
114
114
|
try {
|
|
115
115
|
const payload = this.enforceBase64Encoding(tokenParts[1]);
|
|
@@ -131,9 +131,9 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
131
131
|
token: last3digits
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
throw new Error("
|
|
134
|
+
throw new Error("Invalid token payload, payload is not valid JSON");
|
|
135
135
|
} catch (e) {
|
|
136
|
-
console.error("
|
|
136
|
+
console.error("Failed to decode token", e);
|
|
137
137
|
_TelemetryHelper.TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
138
138
|
Event: _TelemetryConstants.TelemetryEvent.NewTokenValidationFailed,
|
|
139
139
|
Description: "Failed to decode token",
|
|
@@ -142,7 +142,7 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
142
142
|
token: last3digits
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
throw new Error("
|
|
145
|
+
throw new Error("Failed to decode token");
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}, {
|
|
@@ -166,7 +166,7 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
166
166
|
"Token": last3digits
|
|
167
167
|
}
|
|
168
168
|
});
|
|
169
|
-
throw new Error(
|
|
169
|
+
throw new Error(`New token is already expired, with epoch time ${this.expiration} , last 3 digits of token: ${last3digits}`);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}
|
|
@@ -280,9 +280,9 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
280
280
|
if (pingResponse.result === true) {
|
|
281
281
|
return fn();
|
|
282
282
|
}
|
|
283
|
-
const executionErrorMessage =
|
|
283
|
+
const executionErrorMessage = `Authentication failed: Process to get a token failed for ${functionName}, ${pingResponse.message}`;
|
|
284
284
|
//telemetry is already logged in tokenRing, so no need to log again, just return the error and communicate to the console
|
|
285
|
-
console.error(
|
|
285
|
+
console.error(executionErrorMessage);
|
|
286
286
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
287
287
|
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
288
288
|
payload: {
|
|
@@ -445,48 +445,6 @@ let FacadeChatSDK = /*#__PURE__*/function () {
|
|
|
445
445
|
let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
446
446
|
return this.validateAndExecuteCall("getAgentAvailability", () => this.chatSDK.getAgentAvailability(optionalParams));
|
|
447
447
|
}
|
|
448
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
449
|
-
}, {
|
|
450
|
-
key: "getReconnectableChats",
|
|
451
|
-
value: async function getReconnectableChats() {
|
|
452
|
-
let reconnectableChatsParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
453
|
-
/**
|
|
454
|
-
*
|
|
455
|
-
* This is a particular case, we dont expose getReconnectableChats in the SDK,
|
|
456
|
-
* The only way to use is by tunneling directly from the SDK to OCSDK,
|
|
457
|
-
*
|
|
458
|
-
* In case of prechat, the function is called before any formal authentication is made,
|
|
459
|
-
* this is an specific case for persistent chats, to prevent the survey be loaded again for an on going chat,
|
|
460
|
-
*
|
|
461
|
-
* In this case, we check for existance of the token , otherwise we perform the authentication, error is propagated in case of issues.
|
|
462
|
-
*
|
|
463
|
-
* Once the token is obtained , this will be added to the params to call the function.
|
|
464
|
-
*
|
|
465
|
-
* This is a particular case, should not be taken as pattern.
|
|
466
|
-
*
|
|
467
|
-
*/
|
|
468
|
-
|
|
469
|
-
if (this.token === null || this.token === "") {
|
|
470
|
-
// If token is not set, try to get it using tokenRing
|
|
471
|
-
const pingResponse = await this.tokenRing();
|
|
472
|
-
if (pingResponse.result === false) {
|
|
473
|
-
const errorMessage = "Authentication Setup Error: Token validation failed for reconnectable chats";
|
|
474
|
-
//telemetry is already logged in tokenRing, so no need to log again, just return the error and communicate to the console
|
|
475
|
-
console.error(`Authentication failed: Process to get a token failed for getReconnectableChats, ${pingResponse.message}`);
|
|
476
|
-
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
477
|
-
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
478
|
-
payload: {
|
|
479
|
-
errorMessage: errorMessage
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
throw new Error(errorMessage);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
// Always override the token in params regardless of how getReconnectableChats was called
|
|
487
|
-
reconnectableChatsParams.authenticatedUserToken = this.token;
|
|
488
|
-
return this.validateAndExecuteCall("getReconnectableChats", () => this.chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams));
|
|
489
|
-
}
|
|
490
448
|
}]);
|
|
491
449
|
return FacadeChatSDK;
|
|
492
450
|
}();
|
|
@@ -112,8 +112,6 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
112
112
|
TelemetryEvent["DisconnectEndChatSDKCallFailed"] = "DisconnectEndChatSDKCallFailed";
|
|
113
113
|
TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
|
|
114
114
|
TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
|
|
115
|
-
TelemetryEvent["CheckContactIdError"] = "checkContactIdError";
|
|
116
|
-
TelemetryEvent["GetChatReconnectContextSDKCallSucceeded"] = "GetChatReconnectContextSDKCallSucceeded";
|
|
117
115
|
TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
|
|
118
116
|
TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
|
|
119
117
|
TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
|
|
@@ -181,7 +179,6 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
181
179
|
TelemetryEvent["CustomerVoiceResponsePageLoaded"] = "CustomerVoiceResponsePageLoaded";
|
|
182
180
|
TelemetryEvent["CustomerVoiceFormResponseSubmitted"] = "CustomerVoiceFormResponseSubmitted";
|
|
183
181
|
TelemetryEvent["CustomerVoiceFormResponseError"] = "CustomerVoiceFormResponseError";
|
|
184
|
-
TelemetryEvent["CustomerVoiceFormsError"] = "CustomerVoiceFormsError";
|
|
185
182
|
TelemetryEvent["BotAuthActivityEmptySasUrl"] = "BotAuthActivityEmptySasUrl";
|
|
186
183
|
TelemetryEvent["SetBotAuthProviderFetchConfig"] = "SetBotAuthProviderFetchConfig";
|
|
187
184
|
TelemetryEvent["SetBotAuthProviderHideCard"] = "SetBotAuthProviderHideCard";
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.disposeLoggers = exports.TelemetryTimers = exports.TelemetryManager = exports.RegisterLoggers = void 0;
|
|
7
7
|
var _TelemetryConstants = require("./TelemetryConstants");
|
|
8
8
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
9
|
-
var _TelemetryHelper = require("./TelemetryHelper");
|
|
10
|
-
var _appInsightsLogger = require("./loggers/appInsightsLogger");
|
|
11
9
|
var _ariaTelemetryLogger = require("./loggers/ariaTelemetryLogger");
|
|
12
10
|
var _consoleLogger = require("./loggers/consoleLogger");
|
|
13
11
|
var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
|
|
12
|
+
var _TelemetryHelper = require("./TelemetryHelper");
|
|
13
|
+
var _appInsightsLogger = require("./loggers/appInsightsLogger");
|
|
14
14
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
15
15
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
16
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -421,9 +421,6 @@ const getConversationDetailsCall = async function (facadeChatSDK) {
|
|
|
421
421
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
422
422
|
exports.getConversationDetailsCall = getConversationDetailsCall;
|
|
423
423
|
const checkContactIdError = e => {
|
|
424
|
-
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
425
|
-
Event: _TelemetryConstants.TelemetryEvent.CheckContactIdError
|
|
426
|
-
});
|
|
427
424
|
if ((e === null || e === void 0 ? void 0 : e.message) === _omnichannelChatSdk.ChatSDKErrorName.AuthContactIdNotFoundFailure) {
|
|
428
425
|
const contactIdNotFoundErrorEvent = {
|
|
429
426
|
eventName: _TelemetryConstants.BroadcastEvent.ContactIdNotFound,
|
|
@@ -84,13 +84,9 @@ const ConfirmationPaneStateful = props => {
|
|
|
84
84
|
(0, _react.useEffect)(() => {
|
|
85
85
|
(0, _utils.preventFocusToMoveOutOfElement)(controlProps.id);
|
|
86
86
|
const focusableElements = (0, _utils.findAllFocusableElement)(`#${controlProps.id}`);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
preventScroll: true
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
87
|
+
if (focusableElements) {
|
|
88
|
+
focusableElements[0].focus();
|
|
89
|
+
}
|
|
94
90
|
elements = (0, _utils.findParentFocusableElementsWithoutChildContainer)(controlProps.id);
|
|
95
91
|
(0, _utils.setTabIndices)(elements, initialTabIndexMap, false);
|
|
96
92
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -8,7 +8,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _ChatAdapterStore = require("../../contexts/ChatAdapterStore");
|
|
9
9
|
var _ChatContextStore = require("../../contexts/ChatContextStore");
|
|
10
10
|
var _ChatSDKStore = require("../../contexts/ChatSDKStore");
|
|
11
|
-
var _ErrorBoundary = _interopRequireDefault(require("../errorboundary/ErrorBoundary"));
|
|
12
11
|
var _FacadeChatSDK = require("../../common/facades/FacadeChatSDK");
|
|
13
12
|
var _FacadeChatSDKStore = require("../../contexts/FacadeChatSDKStore");
|
|
14
13
|
var _LiveChatWidgetStateful = _interopRequireDefault(require("./livechatwidgetstateful/LiveChatWidgetStateful"));
|
|
@@ -16,15 +15,12 @@ var _createReducer = require("../../contexts/createReducer");
|
|
|
16
15
|
var _LiveChatWidgetContextInitialState = require("../../contexts/common/LiveChatWidgetContextInitialState");
|
|
17
16
|
var _getMockChatSDKIfApplicable = require("./common/getMockChatSDKIfApplicable");
|
|
18
17
|
var _utils = require("../../common/utils");
|
|
19
|
-
var _liveChatConfigUtils = require("./common/liveChatConfigUtils");
|
|
20
|
-
var _startChatErrorHandler = require("./common/startChatErrorHandler");
|
|
21
18
|
var _overridePropsOnMockIfApplicable = _interopRequireDefault(require("./common/overridePropsOnMockIfApplicable"));
|
|
22
|
-
var _registerTelemetryLoggers = require("./common/registerTelemetryLoggers");
|
|
23
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
22
|
const LiveChatWidget = props => {
|
|
27
|
-
var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv
|
|
23
|
+
var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
|
|
28
24
|
const reducer = (0, _createReducer.createReducer)();
|
|
29
25
|
const [state, dispatch] = (0, _react.useReducer)(reducer, (0, _LiveChatWidgetContextInitialState.getLiveChatWidgetContextInitialState)(props));
|
|
30
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -38,7 +34,7 @@ const LiveChatWidget = props => {
|
|
|
38
34
|
}
|
|
39
35
|
|
|
40
36
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
-
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)
|
|
37
|
+
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);
|
|
42
38
|
if (!facadeChatSDK) {
|
|
43
39
|
var _props$mock2;
|
|
44
40
|
setFacadeChatSDK(new _FacadeChatSDK.FacadeChatSDK({
|
|
@@ -50,14 +46,7 @@ const LiveChatWidget = props => {
|
|
|
50
46
|
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
|
|
51
47
|
}, disableReauthentication));
|
|
52
48
|
}
|
|
53
|
-
|
|
54
|
-
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
55
|
-
}, [dispatch]);
|
|
56
|
-
return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, {
|
|
57
|
-
onError: error => {
|
|
58
|
-
(0, _startChatErrorHandler.logWidgetLoadWithUnexpectedError)(error);
|
|
59
|
-
}
|
|
60
|
-
}, /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
61
50
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
62
51
|
}, /*#__PURE__*/_react.default.createElement(_ChatSDKStore.ChatSDKStore.Provider, {
|
|
63
52
|
value: chatSDK
|
|
@@ -65,7 +54,7 @@ const LiveChatWidget = props => {
|
|
|
65
54
|
value: [adapter, setAdapter]
|
|
66
55
|
}, /*#__PURE__*/_react.default.createElement(_ChatContextStore.ChatContextStore.Provider, {
|
|
67
56
|
value: [state, dispatch]
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props)))))
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props)))));
|
|
69
58
|
};
|
|
70
59
|
exports.LiveChatWidget = LiveChatWidget;
|
|
71
60
|
var _default = LiveChatWidget;
|
|
@@ -13,7 +13,7 @@ const isPostChatSurveyEnabled = async facadeChatSDK => {
|
|
|
13
13
|
return postChatEnabled === "true";
|
|
14
14
|
};
|
|
15
15
|
exports.isPostChatSurveyEnabled = isPostChatSurveyEnabled;
|
|
16
|
-
const isPersistentChatEnabled = conversationMode => {
|
|
16
|
+
const isPersistentChatEnabled = async conversationMode => {
|
|
17
17
|
if ((0, _utils.isNullOrUndefined)(conversationMode)) {
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
@@ -6,23 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.shouldSetPreChatIfPersistentChat = void 0;
|
|
7
7
|
var _liveChatConfigUtils = require("./liveChatConfigUtils");
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
-
const shouldSetPreChatIfPersistentChat = async (
|
|
10
|
-
const persistentEnabled = (0, _liveChatConfigUtils.isPersistentChatEnabled)(conversationMode);
|
|
9
|
+
const shouldSetPreChatIfPersistentChat = async (chatSDK, conversationMode, showPreChat) => {
|
|
10
|
+
const persistentEnabled = await (0, _liveChatConfigUtils.isPersistentChatEnabled)(conversationMode);
|
|
11
11
|
let skipPreChat = false;
|
|
12
12
|
if (persistentEnabled) {
|
|
13
|
-
// Access private properties using type assertions
|
|
14
|
-
const chatSDK = facadeChatSDK.getChatSDK();
|
|
15
|
-
|
|
16
|
-
// Use type assertion to bypass private access restriction
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
const sdkAsAny = chatSDK;
|
|
19
|
-
// most likely this is not set , the facade will take care of it
|
|
20
13
|
const reconnectableChatsParams = {
|
|
21
|
-
authenticatedUserToken:
|
|
22
|
-
requestId:
|
|
14
|
+
authenticatedUserToken: chatSDK.authenticatedUserToken,
|
|
15
|
+
requestId: chatSDK.requestId
|
|
23
16
|
};
|
|
24
17
|
try {
|
|
25
|
-
const reconnectableChatsResponse = await
|
|
18
|
+
const reconnectableChatsResponse = await chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams);
|
|
26
19
|
if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
|
|
27
20
|
// Skip rendering prechat on existing persistent chat session
|
|
28
21
|
skipPreChat = true;
|
|
@@ -73,10 +73,6 @@ const getChatReconnectContext = async (facadeChatSDK, chatConfig, props, isAuthe
|
|
|
73
73
|
// AuthToken will be reset later at start chat
|
|
74
74
|
(0, _authHelper.removeAuthTokenProvider)(facadeChatSDK.getChatSDK());
|
|
75
75
|
}
|
|
76
|
-
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
77
|
-
Event: _TelemetryConstants.TelemetryEvent.GetChatReconnectContextSDKCallSucceeded,
|
|
78
|
-
Description: "Reconnect context SDK call succeeded"
|
|
79
|
-
});
|
|
80
76
|
return reconnectChatContext;
|
|
81
77
|
}
|
|
82
78
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -75,7 +75,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
75
75
|
const parseToJson = false;
|
|
76
76
|
const preChatSurveyResponse = (props === null || props === void 0 ? void 0 : (_props$preChatSurveyP = props.preChatSurveyPaneProps) === null || _props$preChatSurveyP === void 0 ? void 0 : (_props$preChatSurveyP2 = _props$preChatSurveyP.controlProps) === null || _props$preChatSurveyP2 === void 0 ? void 0 : _props$preChatSurveyP2.payload) ?? (await facadeChatSDK.getPreChatSurvey(parseToJson));
|
|
77
77
|
let showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
|
|
78
|
-
showPrechat = await (0, _persistentChatHelper.shouldSetPreChatIfPersistentChat)(facadeChatSDK, state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_conversationmode, showPrechat);
|
|
78
|
+
showPrechat = await (0, _persistentChatHelper.shouldSetPreChatIfPersistentChat)(facadeChatSDK.getChatSDK(), state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_conversationmode, showPrechat);
|
|
79
79
|
if (showPrechat) {
|
|
80
80
|
var _state$domainStates2, _state$domainStates2$, _state$domainStates2$2, _state$domainStates2$3;
|
|
81
81
|
const isOutOfOperatingHours = (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.liveChatConfig) === null || _state$domainStates2$ === void 0 ? void 0 : (_state$domainStates2$2 = _state$domainStates2$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates2$2 === void 0 ? void 0 : (_state$domainStates2$3 = _state$domainStates2$2.OutOfOperatingHours) === null || _state$domainStates2$3 === void 0 ? void 0 : _state$domainStates2$3.toString().toLowerCase()) === "true";
|
|
@@ -163,7 +163,7 @@ exports.setPreChatAndInitiateChat = setPreChatAndInitiateChat;
|
|
|
163
163
|
const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props, params, persistedState) => {
|
|
164
164
|
var _state$domainStates7, _state$domainStates7$, _state$domainStates7$2;
|
|
165
165
|
let isStartChatSuccessful = false;
|
|
166
|
-
const persistentChatEnabled = (0, _liveChatConfigUtils.isPersistentChatEnabled)(state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : (_state$domainStates7$ = _state$domainStates7.liveChatConfig) === null || _state$domainStates7$ === void 0 ? void 0 : (_state$domainStates7$2 = _state$domainStates7$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates7$2 === void 0 ? void 0 : _state$domainStates7$2.msdyn_conversationmode);
|
|
166
|
+
const persistentChatEnabled = await (0, _liveChatConfigUtils.isPersistentChatEnabled)(state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : (_state$domainStates7$ = _state$domainStates7.liveChatConfig) === null || _state$domainStates7$ === void 0 ? void 0 : (_state$domainStates7$2 = _state$domainStates7$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates7$2 === void 0 ? void 0 : _state$domainStates7$2.msdyn_conversationmode);
|
|
167
167
|
if ((state === null || state === void 0 ? void 0 : state.appStates.conversationState) === _ConversationState.ConversationState.Closed) {
|
|
168
168
|
// Preventive reset to avoid starting chat with previous requestId which could potentially cause problems
|
|
169
169
|
(0, _endChat.chatSDKStateCleanUp)(facadeChatSDK.getChatSDK());
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.logWidgetLoadComplete = exports.handleStartChatError = void 0;
|
|
7
7
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _Constants = require("../../../common/Constants");
|
|
@@ -15,11 +15,6 @@ var _StartChatFailureType = require("../../../contexts/common/StartChatFailureTy
|
|
|
15
15
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
16
16
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
17
17
|
var _utils = require("../../../common/utils");
|
|
18
|
-
// Helper function to check if error is authentication-related
|
|
19
|
-
const isAuthenticationError = errorMessage => {
|
|
20
|
-
return errorMessage === _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString || errorMessage.startsWith("Authentication Setup Error:") || errorMessage.includes("Token validation failed") || errorMessage.includes("Authentication token");
|
|
21
|
-
};
|
|
22
|
-
|
|
23
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
19
|
const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStartChatSuccessful) => {
|
|
25
20
|
var _props$controlProps;
|
|
@@ -28,16 +23,19 @@ const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStartChatSuc
|
|
|
28
23
|
return;
|
|
29
24
|
}
|
|
30
25
|
|
|
31
|
-
// Handle
|
|
32
|
-
if (
|
|
26
|
+
// Handle internal or misc errors
|
|
27
|
+
if (ex.message === _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
|
|
33
28
|
dispatch({
|
|
34
29
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
35
30
|
payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
|
|
36
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
|
+
});
|
|
37
37
|
logWidgetLoadCompleteWithError(ex);
|
|
38
|
-
// Don't return early - let the generic error handling logic handle hideErrorUIPane and telemetry
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
if (ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
|
|
42
40
|
logWidgetLoadCompleteWithError(ex);
|
|
43
41
|
}
|
|
@@ -60,11 +58,8 @@ const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStartChatSuc
|
|
|
60
58
|
case _omnichannelChatSdk.ChatSDKErrorName.UninitializedChatSDK:
|
|
61
59
|
handleUninitializedChatSDK(ex);
|
|
62
60
|
break;
|
|
61
|
+
// Handle the case indicating failure to retrieve an authenticated chat conversation
|
|
63
62
|
case _omnichannelChatSdk.ChatSDKErrorName.AuthenticatedChatConversationRetrievalFailure:
|
|
64
|
-
dispatch({
|
|
65
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
66
|
-
payload: _StartChatFailureType.StartChatFailureType.Unauthorized
|
|
67
|
-
});
|
|
68
63
|
logWidgetLoadCompleteWithError(ex);
|
|
69
64
|
break;
|
|
70
65
|
case _omnichannelChatSdk.ChatSDKErrorName.InvalidConversation:
|
|
@@ -117,9 +112,6 @@ const logWidgetLoadFailed = ex => {
|
|
|
117
112
|
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
118
113
|
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
119
114
|
}
|
|
120
|
-
if (ex !== null && ex !== void 0 && ex.exceptionDetails) {
|
|
121
|
-
exDetails.ChatSDKExceptionDetails = ex.exceptionDetails;
|
|
122
|
-
}
|
|
123
115
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
124
116
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
125
117
|
Description: "Widget load complete with error",
|
|
@@ -149,9 +141,6 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
149
141
|
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
150
142
|
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
151
143
|
}
|
|
152
|
-
if (ex !== null && ex !== void 0 && ex.exceptionDetails) {
|
|
153
|
-
exDetails.ChatSDKExceptionDetails = ex.exceptionDetails;
|
|
154
|
-
}
|
|
155
144
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
156
145
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
157
146
|
Description: "Widget load complete with error",
|
|
@@ -159,37 +148,8 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
159
148
|
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
160
149
|
});
|
|
161
150
|
};
|
|
162
|
-
const logWidgetLoadWithUnexpectedError = ex => {
|
|
163
|
-
var _TelemetryTimers$Widg4;
|
|
164
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
165
|
-
const details = {
|
|
166
|
-
message: (ex === null || ex === void 0 ? void 0 : ex.message) || "An unexpected error occurred",
|
|
167
|
-
stack: (ex === null || ex === void 0 ? void 0 : ex.stack) || "No stack trace available"
|
|
168
|
-
};
|
|
169
|
-
let additionalDetails = "";
|
|
170
|
-
try {
|
|
171
|
-
additionalDetails = JSON.stringify(details);
|
|
172
|
-
} catch (error) {
|
|
173
|
-
additionalDetails = "Failed to stringify error details";
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
177
|
-
const exDetails = {
|
|
178
|
-
Exception: `Widget load with unexpected error: ${additionalDetails}`
|
|
179
|
-
};
|
|
180
|
-
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
181
|
-
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
182
|
-
}
|
|
183
|
-
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
184
|
-
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
185
|
-
Description: "Widget load with unexpected error",
|
|
186
|
-
ExceptionDetails: exDetails,
|
|
187
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
151
|
|
|
191
152
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
|
-
exports.logWidgetLoadWithUnexpectedError = logWidgetLoadWithUnexpectedError;
|
|
193
153
|
const forceEndChat = facadeChatSDK => {
|
|
194
154
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
195
155
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
@@ -240,12 +200,6 @@ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
|
|
|
240
200
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
241
201
|
payload: _StartChatFailureType.StartChatFailureType.Unauthorized
|
|
242
202
|
});
|
|
243
|
-
} else {
|
|
244
|
-
// For other authentication-related token retrieval failures, set as AuthSetupError
|
|
245
|
-
dispatch({
|
|
246
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
247
|
-
payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
|
|
248
|
-
});
|
|
249
203
|
}
|
|
250
204
|
logWidgetLoadCompleteWithError(ex);
|
|
251
205
|
}
|
|
@@ -52,6 +52,7 @@ var _initCallingSdk = require("../common/initCallingSdk");
|
|
|
52
52
|
var _initConfirmationPropsComposer = require("../common/initConfirmationPropsComposer");
|
|
53
53
|
var _initWebChatComposer = require("../common/initWebChatComposer");
|
|
54
54
|
var _defaultCacheManager = require("../../../common/storage/default/defaultCacheManager");
|
|
55
|
+
var _registerTelemetryLoggers = require("../common/registerTelemetryLoggers");
|
|
55
56
|
var _setPostChatContextAndLoadSurvey = require("../common/setPostChatContextAndLoadSurvey");
|
|
56
57
|
var _startProactiveChat = require("../common/startProactiveChat");
|
|
57
58
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
@@ -63,7 +64,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
63
64
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
64
65
|
let uiTimer;
|
|
65
66
|
const LiveChatWidgetStateful = props => {
|
|
66
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$
|
|
67
|
+
var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _props$webChatContain17, _props$webChatContain18, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
67
68
|
(0, _react2.useEffect)(() => {
|
|
68
69
|
uiTimer = (0, _utils.createTimer)();
|
|
69
70
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -82,13 +83,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
82
83
|
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
83
84
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
85
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = (0, _react2.useState)(undefined);
|
|
85
|
-
const [conversationId, setConversationId] = (0, _react2.useState)("");
|
|
86
86
|
const {
|
|
87
87
|
Composer
|
|
88
88
|
} = _botframeworkWebchat.Components;
|
|
89
89
|
const canStartProactiveChat = (0, _react2.useRef)(true);
|
|
90
|
-
const bubbleBackground = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.webChatStyles) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.bubbleBackground) ?? ((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.adaptiveCardStyles) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background;
|
|
91
|
-
const bubbleTextColor = ((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : (_props$webChatContain7 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.bubbleTextColor) ?? ((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : (_props$webChatContain9 = _props$webChatContain8.adaptiveCardStyles) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color;
|
|
92
90
|
|
|
93
91
|
// Process general styles
|
|
94
92
|
const generalStyles = {
|
|
@@ -97,7 +95,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
97
95
|
|
|
98
96
|
//Scrollbar styles
|
|
99
97
|
const scrollbarProps = Object.assign({}, _defaultScrollBarProps.defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
|
|
100
|
-
const sendBoxTextArea = props === null || props === void 0 ? void 0 : (_props$
|
|
98
|
+
const sendBoxTextArea = props === null || props === void 0 ? void 0 : (_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.sendBoxTextBox) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.textarea;
|
|
101
99
|
|
|
102
100
|
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
103
101
|
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
@@ -230,6 +228,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
230
228
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
231
229
|
state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
|
|
232
230
|
setupClientDataStore();
|
|
231
|
+
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
233
232
|
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)(state);
|
|
234
233
|
dispatch({
|
|
235
234
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
@@ -579,14 +578,6 @@ const LiveChatWidgetStateful = props => {
|
|
|
579
578
|
});
|
|
580
579
|
});
|
|
581
580
|
|
|
582
|
-
// Retrieve convId
|
|
583
|
-
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
584
|
-
var _msg$payload11, _msg$payload11$liveWo;
|
|
585
|
-
if ((_msg$payload11 = msg.payload) !== null && _msg$payload11 !== void 0 && (_msg$payload11$liveWo = _msg$payload11.liveWorkItem) !== null && _msg$payload11$liveWo !== void 0 && _msg$payload11$liveWo.conversationId) {
|
|
586
|
-
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
|
|
590
581
|
// Check for TPC and log in telemetry if blocked
|
|
591
582
|
(0, _defaultClientDataStoreProvider.isCookieAllowed)();
|
|
592
583
|
return () => {
|
|
@@ -633,8 +624,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
633
624
|
});
|
|
634
625
|
}
|
|
635
626
|
if (state.appStates.conversationState === _ConversationState.ConversationState.InActive) {
|
|
636
|
-
var _props$
|
|
637
|
-
if ((props === null || props === void 0 ? void 0 : (_props$
|
|
627
|
+
var _props$webChatContain4, _props$webChatContain5;
|
|
628
|
+
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
|
|
638
629
|
setWebChatStyles(styles => {
|
|
639
630
|
return {
|
|
640
631
|
...styles,
|
|
@@ -678,12 +669,12 @@ const LiveChatWidgetStateful = props => {
|
|
|
678
669
|
}
|
|
679
670
|
}, [state.appStates.unreadMessageCount]);
|
|
680
671
|
(0, _react2.useEffect)(() => {
|
|
681
|
-
var _props$
|
|
672
|
+
var _props$webChatContain6;
|
|
682
673
|
setWebChatStyles({
|
|
683
674
|
...webChatStyles,
|
|
684
|
-
...((_props$
|
|
675
|
+
...((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.webChatStyles)
|
|
685
676
|
});
|
|
686
|
-
}, [(_props$
|
|
677
|
+
}, [(_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.webChatStyles]);
|
|
687
678
|
(0, _react2.useEffect)(() => {
|
|
688
679
|
//Confirmation pane dismissing through OK option, so proceed with end chat
|
|
689
680
|
if (state.domainStates.confirmationState === _Constants.ConfirmationState.Ok) {
|
|
@@ -782,12 +773,12 @@ const LiveChatWidgetStateful = props => {
|
|
|
782
773
|
|
|
783
774
|
// if props state gets updates we need to update the renderingMiddlewareProps in the state
|
|
784
775
|
(0, _react2.useEffect)(() => {
|
|
785
|
-
var _props$
|
|
776
|
+
var _props$webChatContain8;
|
|
786
777
|
dispatch({
|
|
787
778
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
|
|
788
|
-
payload: (_props$
|
|
779
|
+
payload: (_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.renderingMiddlewareProps
|
|
789
780
|
});
|
|
790
|
-
}, [(_props$
|
|
781
|
+
}, [(_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.renderingMiddlewareProps]);
|
|
791
782
|
(0, _react2.useEffect)(() => {
|
|
792
783
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
793
784
|
Event: _TelemetryConstants.TelemetryEvent.UXLiveChatWidgetCompleted,
|
|
@@ -830,7 +821,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
830
821
|
const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, state, dispatch, facadeChatSDK, endChatRelay);
|
|
831
822
|
const downloadTranscriptProps = (0, _createDownloadTranscriptProps.default)(props.downloadTranscriptProps, {
|
|
832
823
|
...(_defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === null || _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === void 0 ? void 0 : _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles),
|
|
833
|
-
...((_props$
|
|
824
|
+
...((_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.webChatStyles)
|
|
834
825
|
}, props.webChatContainerProps);
|
|
835
826
|
const livechatProps = {
|
|
836
827
|
...props,
|
|
@@ -856,11 +847,6 @@ const LiveChatWidgetStateful = props => {
|
|
|
856
847
|
(0, _utils.setOcUserAgent)(facadeChatSDK.getChatSDK());
|
|
857
848
|
const directLine = ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine;
|
|
858
849
|
const userID = directLine.getState ? directLine === null || directLine === void 0 ? void 0 : directLine.getState("acs.userId") : "teamsvisitor";
|
|
859
|
-
const styleOptions = _react2.default.useMemo(() => ({
|
|
860
|
-
...webChatStyles,
|
|
861
|
-
bubbleBackground,
|
|
862
|
-
bubbleTextColor
|
|
863
|
-
}), [webChatStyles, bubbleBackground, bubbleTextColor]);
|
|
864
850
|
|
|
865
851
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
866
852
|
return directLine && /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
@@ -899,7 +885,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
899
885
|
}`}
|
|
900
886
|
`), /*#__PURE__*/_react2.default.createElement(_DraggableChatWidget.default, chatWidgetDraggableConfig, /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
901
887
|
userID: userID,
|
|
902
|
-
styleOptions:
|
|
888
|
+
styleOptions: {
|
|
889
|
+
...webChatStyles,
|
|
890
|
+
bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.webChatStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.bubbleBackground) ?? ((_props$webChatContain13 = props.webChatContainerProps) === null || _props$webChatContain13 === void 0 ? void 0 : (_props$webChatContain14 = _props$webChatContain13.adaptiveCardStyles) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background,
|
|
891
|
+
bubbleTextColor: ((_props$webChatContain15 = props.webChatContainerProps) === null || _props$webChatContain15 === void 0 ? void 0 : (_props$webChatContain16 = _props$webChatContain15.webChatStyles) === null || _props$webChatContain16 === void 0 ? void 0 : _props$webChatContain16.bubbleTextColor) ?? ((_props$webChatContain17 = props.webChatContainerProps) === null || _props$webChatContain17 === void 0 ? void 0 : (_props$webChatContain18 = _props$webChatContain17.adaptiveCardStyles) === null || _props$webChatContain18 === void 0 ? void 0 : _props$webChatContain18.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color
|
|
892
|
+
},
|
|
903
893
|
directLine: directLine
|
|
904
894
|
}), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
905
895
|
id: widgetElementId,
|
|
@@ -930,9 +920,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
930
920
|
}, livechatProps.callingContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideWebChatContainer) && (0, _componentController.shouldShowWebChatContainer)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.webChatContainer) || /*#__PURE__*/_react2.default.createElement(_WebChatContainerStateful.default, livechatProps)), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hideConfirmationPane) && (0, _componentController.shouldShowConfirmationPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.confirmationPane) || /*#__PURE__*/_react2.default.createElement(_ConfirmationPaneStateful.default, _extends({}, confirmationPaneProps, {
|
|
931
921
|
setPostChatContext: setPostChatContextRelay,
|
|
932
922
|
prepareEndChat: prepareEndChatRelay
|
|
933
|
-
}))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && (0, _componentController.shouldShowPostChatLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/_react2.default.createElement(_PostChatLoadingPaneStateful.default, livechatProps.postChatLoadingPaneProps)), (0, _componentController.shouldShowPostChatSurveyPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/_react2.default.createElement(_PostChatSurveyPaneStateful.default, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK,
|
|
934
|
-
customerVoiceSurveyCorrelationId: conversationId
|
|
935
|
-
}))), (0, _createFooter.createFooter)(livechatProps, state), (0, _componentController.shouldShowEmailTranscriptPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/_react2.default.createElement(_EmailTranscriptPaneStateful.default, livechatProps.emailTranscriptPane))))));
|
|
923
|
+
}))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && (0, _componentController.shouldShowPostChatLoadingPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/_react2.default.createElement(_PostChatLoadingPaneStateful.default, livechatProps.postChatLoadingPaneProps)), (0, _componentController.shouldShowPostChatSurveyPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/_react2.default.createElement(_PostChatSurveyPaneStateful.default, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), (0, _createFooter.createFooter)(livechatProps, state), (0, _componentController.shouldShowEmailTranscriptPane)(state) && ((0, _omnichannelChatComponents.decodeComponentString)((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/_react2.default.createElement(_EmailTranscriptPaneStateful.default, livechatProps.emailTranscriptPane))))));
|
|
936
924
|
};
|
|
937
925
|
exports.LiveChatWidgetStateful = LiveChatWidgetStateful;
|
|
938
926
|
var _default = LiveChatWidgetStateful;
|