@microsoft/omnichannel-chat-widget 1.8.1-main.6ec59e7 → 1.8.1-main.f0e9e2f
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 +3 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +2 -2
- package/lib/cjs/common/utils.js +3 -0
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +68 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +12 -2
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +4 -0
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +30 -1
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +12 -3
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +14 -5
- package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +2 -2
- package/lib/esm/common/utils.js +3 -0
- package/lib/esm/components/errorboundary/ErrorBoundary.js +59 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +13 -3
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +4 -0
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +28 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +12 -3
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +14 -5
- package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -0
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +1 -0
- package/package.json +1 -1
|
@@ -112,6 +112,8 @@ 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";
|
|
115
117
|
TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
|
|
116
118
|
TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
|
|
117
119
|
TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
|
|
@@ -179,6 +181,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
179
181
|
TelemetryEvent["CustomerVoiceResponsePageLoaded"] = "CustomerVoiceResponsePageLoaded";
|
|
180
182
|
TelemetryEvent["CustomerVoiceFormResponseSubmitted"] = "CustomerVoiceFormResponseSubmitted";
|
|
181
183
|
TelemetryEvent["CustomerVoiceFormResponseError"] = "CustomerVoiceFormResponseError";
|
|
184
|
+
TelemetryEvent["CustomerVoiceFormsError"] = "CustomerVoiceFormsError";
|
|
182
185
|
TelemetryEvent["BotAuthActivityEmptySasUrl"] = "BotAuthActivityEmptySasUrl";
|
|
183
186
|
TelemetryEvent["SetBotAuthProviderFetchConfig"] = "SetBotAuthProviderFetchConfig";
|
|
184
187
|
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");
|
|
9
11
|
var _ariaTelemetryLogger = require("./loggers/ariaTelemetryLogger");
|
|
10
12
|
var _consoleLogger = require("./loggers/consoleLogger");
|
|
11
13
|
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,6 +421,9 @@ 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
|
+
});
|
|
424
427
|
if ((e === null || e === void 0 ? void 0 : e.message) === _omnichannelChatSdk.ChatSDKErrorName.AuthContactIdNotFoundFailure) {
|
|
425
428
|
const contactIdNotFoundErrorEvent = {
|
|
426
429
|
eventName: _TelemetryConstants.BroadcastEvent.ContactIdNotFound,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
17
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
18
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
const RenderChildrenFunction = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
children
|
|
25
|
+
} = _ref;
|
|
26
|
+
return typeof children === 'function' ? children() : children;
|
|
27
|
+
};
|
|
28
|
+
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
29
|
+
_inherits(ErrorBoundary, _Component);
|
|
30
|
+
var _super = _createSuper(ErrorBoundary);
|
|
31
|
+
function ErrorBoundary(props) {
|
|
32
|
+
var _this;
|
|
33
|
+
_classCallCheck(this, ErrorBoundary);
|
|
34
|
+
_this = _super.call(this, props);
|
|
35
|
+
_this.state = {
|
|
36
|
+
hasError: false
|
|
37
|
+
};
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
_createClass(ErrorBoundary, [{
|
|
41
|
+
key: "componentDidCatch",
|
|
42
|
+
value: function componentDidCatch(error) {
|
|
43
|
+
const {
|
|
44
|
+
onError
|
|
45
|
+
} = this.props;
|
|
46
|
+
this.setState({
|
|
47
|
+
hasError: true
|
|
48
|
+
});
|
|
49
|
+
if (onError) {
|
|
50
|
+
onError(error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "render",
|
|
55
|
+
value: function render() {
|
|
56
|
+
const {
|
|
57
|
+
children
|
|
58
|
+
} = this.props;
|
|
59
|
+
const {
|
|
60
|
+
hasError
|
|
61
|
+
} = this.state;
|
|
62
|
+
return !hasError && /*#__PURE__*/_react.default.createElement(RenderChildrenFunction, null, children);
|
|
63
|
+
}
|
|
64
|
+
}]);
|
|
65
|
+
return ErrorBoundary;
|
|
66
|
+
}(_react.Component);
|
|
67
|
+
var _default = ErrorBoundary;
|
|
68
|
+
exports.default = _default;
|
|
@@ -8,6 +8,7 @@ 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"));
|
|
11
12
|
var _FacadeChatSDK = require("../../common/facades/FacadeChatSDK");
|
|
12
13
|
var _FacadeChatSDKStore = require("../../contexts/FacadeChatSDKStore");
|
|
13
14
|
var _LiveChatWidgetStateful = _interopRequireDefault(require("./livechatwidgetstateful/LiveChatWidgetStateful"));
|
|
@@ -16,6 +17,8 @@ var _LiveChatWidgetContextInitialState = require("../../contexts/common/LiveChat
|
|
|
16
17
|
var _getMockChatSDKIfApplicable = require("./common/getMockChatSDKIfApplicable");
|
|
17
18
|
var _utils = require("../../common/utils");
|
|
18
19
|
var _overridePropsOnMockIfApplicable = _interopRequireDefault(require("./common/overridePropsOnMockIfApplicable"));
|
|
20
|
+
var _registerTelemetryLoggers = require("./common/registerTelemetryLoggers");
|
|
21
|
+
var _startChatErrorHandler = require("./common/startChatErrorHandler");
|
|
19
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
23
|
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); }
|
|
21
24
|
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; }
|
|
@@ -46,7 +49,14 @@ const LiveChatWidget = props => {
|
|
|
46
49
|
"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)
|
|
47
50
|
}, disableReauthentication));
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
(0, _react.useEffect)(() => {
|
|
53
|
+
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
54
|
+
}, [dispatch]);
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, {
|
|
56
|
+
onError: error => {
|
|
57
|
+
(0, _startChatErrorHandler.logWidgetLoadWithUnexpectedError)(error);
|
|
58
|
+
}
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
50
60
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
51
61
|
}, /*#__PURE__*/_react.default.createElement(_ChatSDKStore.ChatSDKStore.Provider, {
|
|
52
62
|
value: chatSDK
|
|
@@ -54,7 +64,7 @@ const LiveChatWidget = props => {
|
|
|
54
64
|
value: [adapter, setAdapter]
|
|
55
65
|
}, /*#__PURE__*/_react.default.createElement(_ChatContextStore.ChatContextStore.Provider, {
|
|
56
66
|
value: [state, dispatch]
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props)))));
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props))))));
|
|
58
68
|
};
|
|
59
69
|
exports.LiveChatWidget = LiveChatWidget;
|
|
60
70
|
var _default = LiveChatWidget;
|
|
@@ -73,6 +73,10 @@ 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
|
+
});
|
|
76
80
|
return reconnectChatContext;
|
|
77
81
|
}
|
|
78
82
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.logWidgetLoadComplete = exports.handleStartChatError = void 0;
|
|
6
|
+
exports.logWidgetLoadWithUnexpectedError = 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");
|
|
@@ -148,8 +148,37 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
148
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
|
|
149
149
|
});
|
|
150
150
|
};
|
|
151
|
+
const logWidgetLoadWithUnexpectedError = ex => {
|
|
152
|
+
var _TelemetryTimers$Widg4;
|
|
153
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
154
|
+
const details = {
|
|
155
|
+
message: (ex === null || ex === void 0 ? void 0 : ex.message) || "An unexpected error occurred",
|
|
156
|
+
stack: (ex === null || ex === void 0 ? void 0 : ex.stack) || "No stack trace available"
|
|
157
|
+
};
|
|
158
|
+
let additionalDetails = "";
|
|
159
|
+
try {
|
|
160
|
+
additionalDetails = JSON.stringify(details);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
additionalDetails = "Failed to stringify error details";
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
166
|
+
const exDetails = {
|
|
167
|
+
Exception: `Widget load with unexpected error: ${additionalDetails}`
|
|
168
|
+
};
|
|
169
|
+
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
170
|
+
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
171
|
+
}
|
|
172
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
173
|
+
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
174
|
+
Description: "Widget load with unexpected error",
|
|
175
|
+
ExceptionDetails: exDetails,
|
|
176
|
+
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
|
|
177
|
+
});
|
|
178
|
+
};
|
|
151
179
|
|
|
152
180
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
+
exports.logWidgetLoadWithUnexpectedError = logWidgetLoadWithUnexpectedError;
|
|
153
182
|
const forceEndChat = facadeChatSDK => {
|
|
154
183
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
155
184
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
@@ -52,7 +52,6 @@ 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");
|
|
56
55
|
var _setPostChatContextAndLoadSurvey = require("../common/setPostChatContextAndLoadSurvey");
|
|
57
56
|
var _startProactiveChat = require("../common/startProactiveChat");
|
|
58
57
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
@@ -83,6 +82,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
83
82
|
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
84
83
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
84
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = (0, _react2.useState)(undefined);
|
|
85
|
+
const [conversationId, setConversationId] = (0, _react2.useState)("");
|
|
86
86
|
const {
|
|
87
87
|
Composer
|
|
88
88
|
} = _botframeworkWebchat.Components;
|
|
@@ -228,7 +228,6 @@ const LiveChatWidgetStateful = props => {
|
|
|
228
228
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
229
229
|
state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
|
|
230
230
|
setupClientDataStore();
|
|
231
|
-
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
232
231
|
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)(state);
|
|
233
232
|
dispatch({
|
|
234
233
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
@@ -578,6 +577,14 @@ const LiveChatWidgetStateful = props => {
|
|
|
578
577
|
});
|
|
579
578
|
});
|
|
580
579
|
|
|
580
|
+
// Retrieve convId
|
|
581
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
582
|
+
var _msg$payload11, _msg$payload11$liveWo;
|
|
583
|
+
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) {
|
|
584
|
+
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
|
|
581
588
|
// Check for TPC and log in telemetry if blocked
|
|
582
589
|
(0, _defaultClientDataStoreProvider.isCookieAllowed)();
|
|
583
590
|
return () => {
|
|
@@ -920,7 +927,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
920
927
|
}, 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, {
|
|
921
928
|
setPostChatContext: setPostChatContextRelay,
|
|
922
929
|
prepareEndChat: prepareEndChatRelay
|
|
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
|
|
930
|
+
}))), !((_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, {
|
|
931
|
+
customerVoiceSurveyCorrelationId: conversationId
|
|
932
|
+
}))), (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))))));
|
|
924
933
|
};
|
|
925
934
|
exports.LiveChatWidgetStateful = LiveChatWidgetStateful;
|
|
926
935
|
var _default = LiveChatWidgetStateful;
|
|
@@ -18,13 +18,14 @@ var _isValidSurveyUrl = _interopRequireDefault(require("./common/isValidSurveyUr
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
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); }
|
|
20
20
|
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; }
|
|
21
|
-
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
22
|
-
let showMultiLingual = arguments.length >
|
|
21
|
+
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
|
|
22
|
+
let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
23
23
|
const surveyLinkParams = new URLSearchParams({
|
|
24
24
|
embed: isEmbed.toString(),
|
|
25
25
|
compact: (compact ?? true).toString(),
|
|
26
26
|
lang: locale ?? "en-us",
|
|
27
|
-
showmultilingual: (showMultiLingual ?? false).toString()
|
|
27
|
+
showmultilingual: (showMultiLingual ?? false).toString(),
|
|
28
|
+
cvResponsePageRequestId: customerVoiceSurveyCorrelationId
|
|
28
29
|
});
|
|
29
30
|
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
30
31
|
};
|
|
@@ -40,9 +41,9 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
40
41
|
// Bot survey enabled
|
|
41
42
|
state.appStates.postChatParticipantType === _Constants.ParticipantType.Bot) {
|
|
42
43
|
// Only Bot has engaged
|
|
43
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
44
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
44
45
|
} else {
|
|
45
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
46
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
46
47
|
}
|
|
47
48
|
if (props.copilotSurveyContext) {
|
|
48
49
|
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
@@ -105,6 +106,14 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
105
106
|
message: "Customer Voice form response error."
|
|
106
107
|
}
|
|
107
108
|
});
|
|
109
|
+
} else if (typeof data === "string" && data.startsWith(_CustomerVoiceEvents.CustomerVoiceEvents.FormsError)) {
|
|
110
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
111
|
+
Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceFormsError,
|
|
112
|
+
Description: "Customer Voice failed to load with forms error.",
|
|
113
|
+
ExceptionDetails: {
|
|
114
|
+
message: `Customer Voice forms error details: ${data}`
|
|
115
|
+
}
|
|
116
|
+
});
|
|
108
117
|
}
|
|
109
118
|
});
|
|
110
119
|
}, []);
|
|
@@ -10,4 +10,5 @@ exports.CustomerVoiceEvents = CustomerVoiceEvents;
|
|
|
10
10
|
CustomerVoiceEvents["ResponsePageLoaded"] = "ResponsePageLoaded";
|
|
11
11
|
CustomerVoiceEvents["FormResponseSubmitted"] = "FormResponseSubmitted";
|
|
12
12
|
CustomerVoiceEvents["FormResponseError"] = "FormResponseError";
|
|
13
|
+
CustomerVoiceEvents["FormsError"] = "FormsError";
|
|
13
14
|
})(CustomerVoiceEvents || (exports.CustomerVoiceEvents = CustomerVoiceEvents = {}));
|
|
@@ -106,6 +106,8 @@ export let TelemetryEvent;
|
|
|
106
106
|
TelemetryEvent["DisconnectEndChatSDKCallFailed"] = "DisconnectEndChatSDKCallFailed";
|
|
107
107
|
TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
|
|
108
108
|
TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
|
|
109
|
+
TelemetryEvent["CheckContactIdError"] = "checkContactIdError";
|
|
110
|
+
TelemetryEvent["GetChatReconnectContextSDKCallSucceeded"] = "GetChatReconnectContextSDKCallSucceeded";
|
|
109
111
|
TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
|
|
110
112
|
TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
|
|
111
113
|
TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
|
|
@@ -173,6 +175,7 @@ export let TelemetryEvent;
|
|
|
173
175
|
TelemetryEvent["CustomerVoiceResponsePageLoaded"] = "CustomerVoiceResponsePageLoaded";
|
|
174
176
|
TelemetryEvent["CustomerVoiceFormResponseSubmitted"] = "CustomerVoiceFormResponseSubmitted";
|
|
175
177
|
TelemetryEvent["CustomerVoiceFormResponseError"] = "CustomerVoiceFormResponseError";
|
|
178
|
+
TelemetryEvent["CustomerVoiceFormsError"] = "CustomerVoiceFormsError";
|
|
176
179
|
TelemetryEvent["BotAuthActivityEmptySasUrl"] = "BotAuthActivityEmptySasUrl";
|
|
177
180
|
TelemetryEvent["SetBotAuthProviderFetchConfig"] = "SetBotAuthProviderFetchConfig";
|
|
178
181
|
TelemetryEvent["SetBotAuthProviderHideCard"] = "SetBotAuthProviderHideCard";
|
|
@@ -6,11 +6,11 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import { LogLevel, ScenarioType, TelemetryConstants, TelemetryEvent } from "./TelemetryConstants";
|
|
8
8
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
9
|
+
import { TelemetryHelper } from "./TelemetryHelper";
|
|
10
|
+
import { appInsightsLogger } from "./loggers/appInsightsLogger";
|
|
9
11
|
import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
|
|
10
12
|
import { consoleLogger } from "./loggers/consoleLogger";
|
|
11
13
|
import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
|
|
12
|
-
import { TelemetryHelper } from "./TelemetryHelper";
|
|
13
|
-
import { appInsightsLogger } from "./loggers/appInsightsLogger";
|
|
14
14
|
export let TelemetryTimers = /*#__PURE__*/_createClass(function TelemetryTimers() {
|
|
15
15
|
_classCallCheck(this, TelemetryTimers);
|
|
16
16
|
});
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -385,6 +385,9 @@ export const getConversationDetailsCall = async function (facadeChatSDK) {
|
|
|
385
385
|
|
|
386
386
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
387
387
|
export const checkContactIdError = e => {
|
|
388
|
+
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
389
|
+
Event: TelemetryEvent.CheckContactIdError
|
|
390
|
+
});
|
|
388
391
|
if ((e === null || e === void 0 ? void 0 : e.message) === ChatSDKErrorName.AuthContactIdNotFoundFailure) {
|
|
389
392
|
const contactIdNotFoundErrorEvent = {
|
|
390
393
|
eventName: BroadcastEvent.ContactIdNotFound,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
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); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
10
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
+
import React, { Component } from 'react';
|
|
14
|
+
const RenderChildrenFunction = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
children
|
|
17
|
+
} = _ref;
|
|
18
|
+
return typeof children === 'function' ? children() : children;
|
|
19
|
+
};
|
|
20
|
+
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
21
|
+
_inherits(ErrorBoundary, _Component);
|
|
22
|
+
var _super = _createSuper(ErrorBoundary);
|
|
23
|
+
function ErrorBoundary(props) {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, ErrorBoundary);
|
|
26
|
+
_this = _super.call(this, props);
|
|
27
|
+
_this.state = {
|
|
28
|
+
hasError: false
|
|
29
|
+
};
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
_createClass(ErrorBoundary, [{
|
|
33
|
+
key: "componentDidCatch",
|
|
34
|
+
value: function componentDidCatch(error) {
|
|
35
|
+
const {
|
|
36
|
+
onError
|
|
37
|
+
} = this.props;
|
|
38
|
+
this.setState({
|
|
39
|
+
hasError: true
|
|
40
|
+
});
|
|
41
|
+
if (onError) {
|
|
42
|
+
onError(error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, {
|
|
46
|
+
key: "render",
|
|
47
|
+
value: function render() {
|
|
48
|
+
const {
|
|
49
|
+
children
|
|
50
|
+
} = this.props;
|
|
51
|
+
const {
|
|
52
|
+
hasError
|
|
53
|
+
} = this.state;
|
|
54
|
+
return !hasError && /*#__PURE__*/React.createElement(RenderChildrenFunction, null, children);
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
return ErrorBoundary;
|
|
58
|
+
}(Component);
|
|
59
|
+
export default ErrorBoundary;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { useReducer, useState } from "react";
|
|
1
|
+
import React, { useEffect, useReducer, useState } from "react";
|
|
2
2
|
import { ChatAdapterStore } from "../../contexts/ChatAdapterStore";
|
|
3
3
|
import { ChatContextStore } from "../../contexts/ChatContextStore";
|
|
4
4
|
import { ChatSDKStore } from "../../contexts/ChatSDKStore";
|
|
5
|
+
import ErrorBoundary from "../errorboundary/ErrorBoundary";
|
|
5
6
|
import { FacadeChatSDK } from "../../common/facades/FacadeChatSDK";
|
|
6
7
|
import { FacadeChatSDKStore } from "../../contexts/FacadeChatSDKStore";
|
|
7
8
|
import LiveChatWidgetStateful from "./livechatwidgetstateful/LiveChatWidgetStateful";
|
|
@@ -10,6 +11,8 @@ import { getLiveChatWidgetContextInitialState } from "../../contexts/common/Live
|
|
|
10
11
|
import { getMockChatSDKIfApplicable } from "./common/getMockChatSDKIfApplicable";
|
|
11
12
|
import { isNullOrUndefined } from "../../common/utils";
|
|
12
13
|
import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
|
|
14
|
+
import { registerTelemetryLoggers } from "./common/registerTelemetryLoggers";
|
|
15
|
+
import { logWidgetLoadWithUnexpectedError } from "./common/startChatErrorHandler";
|
|
13
16
|
export const LiveChatWidget = props => {
|
|
14
17
|
var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
|
|
15
18
|
const reducer = createReducer();
|
|
@@ -37,7 +40,14 @@ export const LiveChatWidget = props => {
|
|
|
37
40
|
"isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
|
|
38
41
|
}, disableReauthentication));
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
registerTelemetryLoggers(props, dispatch);
|
|
45
|
+
}, [dispatch]);
|
|
46
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
47
|
+
onError: error => {
|
|
48
|
+
logWidgetLoadWithUnexpectedError(error);
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
|
|
41
51
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
42
52
|
}, /*#__PURE__*/React.createElement(ChatSDKStore.Provider, {
|
|
43
53
|
value: chatSDK
|
|
@@ -45,6 +55,6 @@ export const LiveChatWidget = props => {
|
|
|
45
55
|
value: [adapter, setAdapter]
|
|
46
56
|
}, /*#__PURE__*/React.createElement(ChatContextStore.Provider, {
|
|
47
57
|
value: [state, dispatch]
|
|
48
|
-
}, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props)))));
|
|
58
|
+
}, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props))))));
|
|
49
59
|
};
|
|
50
60
|
export default LiveChatWidget;
|
|
@@ -67,6 +67,10 @@ const getChatReconnectContext = async (facadeChatSDK, chatConfig, props, isAuthe
|
|
|
67
67
|
// AuthToken will be reset later at start chat
|
|
68
68
|
removeAuthTokenProvider(facadeChatSDK.getChatSDK());
|
|
69
69
|
}
|
|
70
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
71
|
+
Event: TelemetryEvent.GetChatReconnectContextSDKCallSucceeded,
|
|
72
|
+
Description: "Reconnect context SDK call succeeded"
|
|
73
|
+
});
|
|
70
74
|
return reconnectChatContext;
|
|
71
75
|
}
|
|
72
76
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -141,6 +141,34 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
141
141
|
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
+
export const logWidgetLoadWithUnexpectedError = ex => {
|
|
145
|
+
var _TelemetryTimers$Widg4;
|
|
146
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
147
|
+
const details = {
|
|
148
|
+
message: (ex === null || ex === void 0 ? void 0 : ex.message) || "An unexpected error occurred",
|
|
149
|
+
stack: (ex === null || ex === void 0 ? void 0 : ex.stack) || "No stack trace available"
|
|
150
|
+
};
|
|
151
|
+
let additionalDetails = "";
|
|
152
|
+
try {
|
|
153
|
+
additionalDetails = JSON.stringify(details);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
additionalDetails = "Failed to stringify error details";
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
+
const exDetails = {
|
|
160
|
+
Exception: `Widget load with unexpected error: ${additionalDetails}`
|
|
161
|
+
};
|
|
162
|
+
if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
|
|
163
|
+
exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
|
|
164
|
+
}
|
|
165
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
|
|
166
|
+
Event: TelemetryEvent.WidgetLoadFailed,
|
|
167
|
+
Description: "Widget load with unexpected error",
|
|
168
|
+
ExceptionDetails: exDetails,
|
|
169
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
170
|
+
});
|
|
171
|
+
};
|
|
144
172
|
|
|
145
173
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
174
|
const forceEndChat = facadeChatSDK => {
|
|
@@ -48,7 +48,6 @@ import { initCallingSdk } from "../common/initCallingSdk";
|
|
|
48
48
|
import { initConfirmationPropsComposer } from "../common/initConfirmationPropsComposer";
|
|
49
49
|
import { initWebChatComposer } from "../common/initWebChatComposer";
|
|
50
50
|
import { registerBroadcastServiceForStorage } from "../../../common/storage/default/defaultCacheManager";
|
|
51
|
-
import { registerTelemetryLoggers } from "../common/registerTelemetryLoggers";
|
|
52
51
|
import { setPostChatContextAndLoadSurvey } from "../common/setPostChatContextAndLoadSurvey";
|
|
53
52
|
import { startProactiveChat } from "../common/startProactiveChat";
|
|
54
53
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
@@ -75,6 +74,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
75
74
|
const [facadeChatSDK] = useFacadeSDKStore();
|
|
76
75
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
76
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = useState(undefined);
|
|
77
|
+
const [conversationId, setConversationId] = useState("");
|
|
78
78
|
const {
|
|
79
79
|
Composer
|
|
80
80
|
} = Components;
|
|
@@ -220,7 +220,6 @@ export const LiveChatWidgetStateful = props => {
|
|
|
220
220
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
221
221
|
state.domainStates.confirmationState = ConfirmationState.NotSet;
|
|
222
222
|
setupClientDataStore();
|
|
223
|
-
registerTelemetryLoggers(props, dispatch);
|
|
224
223
|
createInternetConnectionChangeHandler(state);
|
|
225
224
|
dispatch({
|
|
226
225
|
type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
@@ -570,6 +569,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
570
569
|
});
|
|
571
570
|
});
|
|
572
571
|
|
|
572
|
+
// Retrieve convId
|
|
573
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
574
|
+
var _msg$payload11, _msg$payload11$liveWo;
|
|
575
|
+
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) {
|
|
576
|
+
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
573
580
|
// Check for TPC and log in telemetry if blocked
|
|
574
581
|
isCookieAllowed();
|
|
575
582
|
return () => {
|
|
@@ -912,6 +919,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
912
919
|
}, livechatProps.callingContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
913
920
|
setPostChatContext: setPostChatContextRelay,
|
|
914
921
|
prepareEndChat: prepareEndChatRelay
|
|
915
|
-
}))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK
|
|
922
|
+
}))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK, {
|
|
923
|
+
customerVoiceSurveyCorrelationId: conversationId
|
|
924
|
+
}))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
|
|
916
925
|
};
|
|
917
926
|
export default LiveChatWidgetStateful;
|
|
@@ -9,13 +9,14 @@ import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyl
|
|
|
9
9
|
import { findAllFocusableElement } from "../../common/utils";
|
|
10
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
11
11
|
import isValidSurveyUrl from "./common/isValidSurveyUrl";
|
|
12
|
-
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
13
|
-
let showMultiLingual = arguments.length >
|
|
12
|
+
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
|
|
13
|
+
let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
14
14
|
const surveyLinkParams = new URLSearchParams({
|
|
15
15
|
embed: isEmbed.toString(),
|
|
16
16
|
compact: (compact ?? true).toString(),
|
|
17
17
|
lang: locale ?? "en-us",
|
|
18
|
-
showmultilingual: (showMultiLingual ?? false).toString()
|
|
18
|
+
showmultilingual: (showMultiLingual ?? false).toString(),
|
|
19
|
+
cvResponsePageRequestId: customerVoiceSurveyCorrelationId
|
|
19
20
|
});
|
|
20
21
|
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
21
22
|
};
|
|
@@ -31,9 +32,9 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
31
32
|
// Bot survey enabled
|
|
32
33
|
state.appStates.postChatParticipantType === ParticipantType.Bot) {
|
|
33
34
|
// Only Bot has engaged
|
|
34
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
35
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
35
36
|
} else {
|
|
36
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
37
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
37
38
|
}
|
|
38
39
|
if (props.copilotSurveyContext) {
|
|
39
40
|
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
@@ -96,6 +97,14 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
96
97
|
message: "Customer Voice form response error."
|
|
97
98
|
}
|
|
98
99
|
});
|
|
100
|
+
} else if (typeof data === "string" && data.startsWith(CustomerVoiceEvents.FormsError)) {
|
|
101
|
+
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.ERROR, {
|
|
102
|
+
Event: TelemetryEvent.CustomerVoiceFormsError,
|
|
103
|
+
Description: "Customer Voice failed to load with forms error.",
|
|
104
|
+
ExceptionDetails: {
|
|
105
|
+
message: `Customer Voice forms error details: ${data}`
|
|
106
|
+
}
|
|
107
|
+
});
|
|
99
108
|
}
|
|
100
109
|
});
|
|
101
110
|
}, []);
|
|
@@ -3,4 +3,5 @@ export let CustomerVoiceEvents;
|
|
|
3
3
|
CustomerVoiceEvents["ResponsePageLoaded"] = "ResponsePageLoaded";
|
|
4
4
|
CustomerVoiceEvents["FormResponseSubmitted"] = "FormResponseSubmitted";
|
|
5
5
|
CustomerVoiceEvents["FormResponseError"] = "FormResponseError";
|
|
6
|
+
CustomerVoiceEvents["FormsError"] = "FormsError";
|
|
6
7
|
})(CustomerVoiceEvents || (CustomerVoiceEvents = {}));
|
|
@@ -94,6 +94,8 @@ export declare enum TelemetryEvent {
|
|
|
94
94
|
DisconnectEndChatSDKCallFailed = "DisconnectEndChatSDKCallFailed",
|
|
95
95
|
GetChatReconnectContextSDKCallStarted = "GetChatReconnectContextSDKCallStarted",
|
|
96
96
|
GetChatReconnectContextSDKCallFailed = "GetChatReconnectContextSDKCallFailed",
|
|
97
|
+
CheckContactIdError = "checkContactIdError",
|
|
98
|
+
GetChatReconnectContextSDKCallSucceeded = "GetChatReconnectContextSDKCallSucceeded",
|
|
97
99
|
ParseAdaptiveCardFailed = "ParseAdaptiveCardFailed",
|
|
98
100
|
ClientDataStoreProviderFailed = "ClientDataStoreProviderFailed",
|
|
99
101
|
InMemoryDataStoreFailed = "InMemoryDataStoreFailed",
|
|
@@ -161,6 +163,7 @@ export declare enum TelemetryEvent {
|
|
|
161
163
|
CustomerVoiceResponsePageLoaded = "CustomerVoiceResponsePageLoaded",
|
|
162
164
|
CustomerVoiceFormResponseSubmitted = "CustomerVoiceFormResponseSubmitted",
|
|
163
165
|
CustomerVoiceFormResponseError = "CustomerVoiceFormResponseError",
|
|
166
|
+
CustomerVoiceFormsError = "CustomerVoiceFormsError",
|
|
164
167
|
BotAuthActivityEmptySasUrl = "BotAuthActivityEmptySasUrl",
|
|
165
168
|
SetBotAuthProviderFetchConfig = "SetBotAuthProviderFetchConfig",
|
|
166
169
|
SetBotAuthProviderHideCard = "SetBotAuthProviderHideCard",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
interface ErrorBoundaryProps {
|
|
3
|
+
children: React.ReactNode | (() => React.ReactNode);
|
|
4
|
+
onError?: (error: Error) => void;
|
|
5
|
+
}
|
|
6
|
+
interface ErrorBoundaryState {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
10
|
+
constructor(props: ErrorBoundaryProps);
|
|
11
|
+
componentDidCatch(error: Error): void;
|
|
12
|
+
render(): false | React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default ErrorBoundary;
|
|
@@ -4,3 +4,4 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
export declare const handleStartChatError: (dispatch: Dispatch<ILiveChatWidgetAction>, facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps | undefined, ex: any, isStartChatSuccessful: boolean) => void;
|
|
6
6
|
export declare const logWidgetLoadComplete: (additionalMessage?: string) => void;
|
|
7
|
+
export declare const logWidgetLoadWithUnexpectedError: (ex: any) => void;
|
|
@@ -2,4 +2,5 @@ import { IPostChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components
|
|
|
2
2
|
export interface IPostChatSurveyPaneStatefulProps extends IPostChatSurveyPaneProps {
|
|
3
3
|
isCustomerVoiceSurveyCompact?: boolean;
|
|
4
4
|
copilotSurveyContext?: Record<string, string>;
|
|
5
|
+
customerVoiceSurveyCorrelationId?: string;
|
|
5
6
|
}
|