@microsoft/omnichannel-chat-widget 1.0.3-main.c925679 → 1.0.4-main.6e79f24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -1
- package/lib/cjs/common/telemetry/TelemetryManager.js +5 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -10
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +4 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +3 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +20 -17
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +20 -20
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +4 -4
- package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/esm/common/telemetry/TelemetryConstants.js +1 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +5 -2
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +3 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +3 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +20 -17
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +21 -21
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +4 -4
- package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,6 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
36
36
|
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
37
37
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
38
38
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
39
|
-
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
40
39
|
BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
|
|
41
40
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
42
41
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
@@ -108,6 +107,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
108
107
|
TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
|
|
109
108
|
TelemetryEvent["EndChatSucceeded"] = "EndChatSucceeded";
|
|
110
109
|
TelemetryEvent["EndChatFailed"] = "EndChatFailed";
|
|
110
|
+
TelemetryEvent["SetCustomContext"] = "SetCustomContext";
|
|
111
111
|
TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
|
|
112
112
|
TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
|
|
113
113
|
TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
|
|
@@ -64,14 +64,17 @@ const RegisterLoggers = () => {
|
|
|
64
64
|
};
|
|
65
65
|
const logTelemetry = telemetryEvent => {
|
|
66
66
|
loggers.map(logger => {
|
|
67
|
-
var _payload;
|
|
67
|
+
var _payload, _telemetryInput$paylo;
|
|
68
68
|
const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
|
|
69
69
|
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? _TelemetryConstants.ScenarioType.UNDEFINED;
|
|
70
70
|
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
71
71
|
telemetryInput.telemetryInfo = {
|
|
72
72
|
telemetryInfo: _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
//Do not log events without an Event Name
|
|
75
|
+
if (telemetryInput !== null && telemetryInput !== void 0 && (_telemetryInput$paylo = telemetryInput.payload) !== null && _telemetryInput$paylo !== void 0 && _telemetryInput$paylo.Event) {
|
|
76
|
+
logger.log(logLevel, telemetryInput);
|
|
77
|
+
}
|
|
75
78
|
});
|
|
76
79
|
};
|
|
77
80
|
return registerLoggers();
|
|
@@ -28,7 +28,6 @@ const ChatButtonStateful = props => {
|
|
|
28
28
|
} = props;
|
|
29
29
|
//Setting OutOfOperatingHours Flag
|
|
30
30
|
const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_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.OutOfOperatingHours) === "True");
|
|
31
|
-
const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
32
31
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
33
32
|
const controlProps = {
|
|
34
33
|
id: "oc-lcw-chat-button",
|
|
@@ -41,12 +40,7 @@ const ChatButtonStateful = props => {
|
|
|
41
40
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
42
41
|
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
43
42
|
});
|
|
44
|
-
if (
|
|
45
|
-
const proactiveChatIsInPopoutModeEvent = {
|
|
46
|
-
eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
47
|
-
};
|
|
48
|
-
_omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
49
|
-
} else if (state.appStates.isMinimized) {
|
|
43
|
+
if (state.appStates.isMinimized) {
|
|
50
44
|
dispatch({
|
|
51
45
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
52
46
|
payload: false
|
|
@@ -99,9 +93,6 @@ const ChatButtonStateful = props => {
|
|
|
99
93
|
});
|
|
100
94
|
}
|
|
101
95
|
}, []);
|
|
102
|
-
(0, _react.useEffect)(() => {
|
|
103
|
-
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
104
|
-
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
105
96
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
|
|
106
97
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
107
98
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -9,6 +9,8 @@ var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcont
|
|
|
9
9
|
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
10
10
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
11
11
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
12
|
+
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
const processDisplayName = displayName => {
|
|
13
15
|
// if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
|
|
14
16
|
const displayNameRegex = ".+:.+";
|
|
@@ -64,6 +66,8 @@ const processContent = (transcriptContent, isAgentChat, renderMarkDown) => {
|
|
|
64
66
|
}
|
|
65
67
|
if (renderMarkDown) {
|
|
66
68
|
transcriptContent = renderMarkDown(transcriptContent);
|
|
69
|
+
} else {
|
|
70
|
+
transcriptContent = _dompurify.default.sanitize(transcriptContent);
|
|
67
71
|
}
|
|
68
72
|
return transcriptContent;
|
|
69
73
|
};
|
|
@@ -1196,7 +1196,13 @@ const dummyDefaultProps = {
|
|
|
1196
1196
|
borderRadius: "0 0 4px 4px",
|
|
1197
1197
|
borderWidth: "3px",
|
|
1198
1198
|
backgroundColor: "#FFFFFF",
|
|
1199
|
-
borderColor: "#F1F1F1"
|
|
1199
|
+
borderColor: "#F1F1F1",
|
|
1200
|
+
position: "initial",
|
|
1201
|
+
height: "100%",
|
|
1202
|
+
width: "100%",
|
|
1203
|
+
left: "0%",
|
|
1204
|
+
top: "0%",
|
|
1205
|
+
display: "contents"
|
|
1200
1206
|
}
|
|
1201
1207
|
},
|
|
1202
1208
|
isCustomerVoiceSurveyCompact: undefined
|
|
@@ -35,6 +35,7 @@ var _messageTimestampMiddleware = _interopRequireDefault(require("../../webchatc
|
|
|
35
35
|
var _Constants = require("../../../common/Constants");
|
|
36
36
|
var _endChat = require("./endChat");
|
|
37
37
|
var _HyperlinkTextOverrideRenderer = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer"));
|
|
38
|
+
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
38
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
41
|
const initWebChatComposer = (props, state, dispatch, chatSDK) => {
|
|
@@ -91,6 +92,8 @@ const initWebChatComposer = (props, state, dispatch, chatSDK) => {
|
|
|
91
92
|
markdownRenderers.forEach(renderer => {
|
|
92
93
|
text = renderer.render(text);
|
|
93
94
|
});
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
|
+
text = _dompurify.default.sanitize(text);
|
|
94
97
|
return text;
|
|
95
98
|
};
|
|
96
99
|
|
|
@@ -130,7 +130,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
130
130
|
try {
|
|
131
131
|
var _window$Microsoft, _window$Microsoft$Dyn, _window$Microsoft$Dyn2, _window$Microsoft$Dyn3;
|
|
132
132
|
// Set custom context params
|
|
133
|
-
setCustomContextParams();
|
|
133
|
+
setCustomContextParams(props);
|
|
134
134
|
const defaultOptionalParams = {
|
|
135
135
|
sendDefaultInitContext: true,
|
|
136
136
|
isProactiveChat: !!(params !== null && params !== void 0 && params.isProactiveChat),
|
|
@@ -286,24 +286,27 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
286
286
|
};
|
|
287
287
|
|
|
288
288
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
|
-
const setCustomContextParams =
|
|
290
|
-
var _persistedState$domai8;
|
|
289
|
+
const setCustomContextParams = props => {
|
|
290
|
+
var _props$chatConfig, _props$chatConfig$Liv, _persistedState$domai8;
|
|
291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
|
+
const isAuthenticatedChat = props !== null && props !== void 0 && (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
293
|
+
//Should not set custom context for auth chat
|
|
294
|
+
if (isAuthenticatedChat) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if ((0, _utils.isNullOrEmptyString)(widgetInstanceId)) {
|
|
298
|
+
widgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
299
|
+
}
|
|
291
300
|
// Add custom context only for unauthenticated chat
|
|
292
301
|
const persistedState = (0, _utils.getStateFromCache)(widgetInstanceId);
|
|
293
302
|
if (!(0, _utils.isUndefinedOrEmpty)(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai8 = persistedState.domainStates) === null || _persistedState$domai8 === void 0 ? void 0 : _persistedState$domai8.customContext)) {
|
|
294
|
-
var _persistedState$domai9
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
ExceptionDetails: {
|
|
300
|
-
exception: errorMessage
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
throw new Error(errorMessage);
|
|
304
|
-
}
|
|
303
|
+
var _persistedState$domai9;
|
|
304
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
305
|
+
Event: _TelemetryConstants.TelemetryEvent.SetCustomContext,
|
|
306
|
+
Description: "Setting custom context for unauthenicated chat"
|
|
307
|
+
});
|
|
305
308
|
optionalParams = Object.assign({}, optionalParams, {
|
|
306
|
-
customContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$
|
|
309
|
+
customContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai9 = persistedState.domainStates) === null || _persistedState$domai9 === void 0 ? void 0 : _persistedState$domai9.customContext
|
|
307
310
|
});
|
|
308
311
|
}
|
|
309
312
|
};
|
|
@@ -313,9 +316,9 @@ const canStartPopoutChat = async props => {
|
|
|
313
316
|
}
|
|
314
317
|
popoutWidgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props, true);
|
|
315
318
|
if (!(0, _utils.isNullOrEmptyString)(popoutWidgetInstanceId)) {
|
|
316
|
-
var _persistedState$
|
|
319
|
+
var _persistedState$domai10, _persistedState$appSt2;
|
|
317
320
|
const persistedState = (0, _utils.getStateFromCache)(popoutWidgetInstanceId);
|
|
318
|
-
if (persistedState && !(0, _utils.isUndefinedOrEmpty)(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$
|
|
321
|
+
if (persistedState && !(0, _utils.isUndefinedOrEmpty)(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai10 = persistedState.domainStates) === null || _persistedState$domai10 === void 0 ? void 0 : _persistedState$domai10.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt2 = persistedState.appStates) === null || _persistedState$appSt2 === void 0 ? void 0 : _persistedState$appSt2.conversationState) === _ConversationState.ConversationState.Active) {
|
|
319
322
|
// Initiate popout chat
|
|
320
323
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
321
324
|
eventName: _TelemetryConstants.BroadcastEvent.InitiateStartChatInPopoutMode
|
|
@@ -6,20 +6,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.LiveChatWidgetStateful = void 0;
|
|
7
7
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
9
|
+
var _botframeworkWebchat = require("botframework-webchat");
|
|
10
|
+
var _Constants = require("../../../common/Constants");
|
|
9
11
|
var _react = require("@fluentui/react");
|
|
10
12
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
13
|
var _startChat = require("../common/startChat");
|
|
12
14
|
var _utils = require("../../../common/utils");
|
|
13
15
|
var _endChat = require("../common/endChat");
|
|
16
|
+
var _reconnectChatHelper = require("../common/reconnectChatHelper");
|
|
14
17
|
var _componentController = require("../../../controller/componentController");
|
|
15
18
|
var _ActivityStreamHandler = require("../common/ActivityStreamHandler");
|
|
16
19
|
var _CallingContainerStateful = _interopRequireDefault(require("../../callingcontainerstateful/CallingContainerStateful"));
|
|
17
20
|
var _ChatButtonStateful = _interopRequireDefault(require("../../chatbuttonstateful/ChatButtonStateful"));
|
|
18
|
-
var _botframeworkWebchat = require("botframework-webchat");
|
|
19
21
|
var _ConfirmationPaneStateful = _interopRequireDefault(require("../../confirmationpanestateful/ConfirmationPaneStateful"));
|
|
20
22
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
21
23
|
var _DataStoreManager = require("../../../common/contextDataStore/DataStoreManager");
|
|
22
|
-
var _Constants = require("../../../common/Constants");
|
|
23
24
|
var _EmailTranscriptPaneStateful = _interopRequireDefault(require("../../emailtranscriptpanestateful/EmailTranscriptPaneStateful"));
|
|
24
25
|
var _HeaderStateful = _interopRequireDefault(require("../../headerstateful/HeaderStateful"));
|
|
25
26
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
@@ -51,13 +52,12 @@ var _startProactiveChat = require("../common/startProactiveChat");
|
|
|
51
52
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
52
53
|
var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useChatContextStore"));
|
|
53
54
|
var _useChatSDKStore = _interopRequireDefault(require("../../../hooks/useChatSDKStore"));
|
|
54
|
-
var _reconnectChatHelper = require("../common/reconnectChatHelper");
|
|
55
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
56
|
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); }
|
|
57
57
|
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; }
|
|
58
58
|
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); }
|
|
59
59
|
const LiveChatWidgetStateful = props => {
|
|
60
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$
|
|
60
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$styleProps2, _props$controlProps11, _props$controlProps12, _props$componentOverr, _props$controlProps13, _props$componentOverr2, _props$controlProps14, _props$componentOverr3, _props$controlProps15, _props$componentOverr4, _props$controlProps16, _props$componentOverr5, _props$controlProps17, _props$componentOverr6, _props$controlProps18, _props$componentOverr7, _props$controlProps19, _props$controlProps20, _props$componentOverr8, _props$controlProps21, _props$componentOverr9, _props$controlProps22, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
61
61
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
62
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
63
|
const [adapter, setAdapter] = (0, _useChatAdapterStore.default)();
|
|
@@ -368,7 +368,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
368
368
|
// This is to ensure to get latest state from cache in multitab
|
|
369
369
|
const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
|
|
370
370
|
if (persistedState && persistedState.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
371
|
-
(
|
|
371
|
+
dispatch({
|
|
372
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
373
|
+
payload: _Constants.ConversationEndEntity.Customer
|
|
374
|
+
});
|
|
372
375
|
} else {
|
|
373
376
|
const skipEndChatSDK = true;
|
|
374
377
|
const skipCloseChat = false;
|
|
@@ -506,36 +509,33 @@ const LiveChatWidgetStateful = props => {
|
|
|
506
509
|
}
|
|
507
510
|
}, [state.domainStates.confirmationState]);
|
|
508
511
|
(0, _react2.useEffect)(() => {
|
|
509
|
-
var _state$appStates8, _state$appStates9;
|
|
510
|
-
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates9 = state.appStates) === null || _state$appStates9 === void 0 ? void 0 : _state$appStates9.conversationEndedBy) === _Constants.ConversationEndEntity.Bot) {
|
|
511
|
-
dispatch({
|
|
512
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
513
|
-
payload: _ConversationState.ConversationState.InActive
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
}, [state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationEndedBy]);
|
|
517
|
-
(0, _react2.useEffect)(() => {
|
|
518
|
-
var _state$appStates11, _state$appStates12, _state$appStates13, _state$appStates14;
|
|
512
|
+
var _state$appStates8, _state$appStates9, _state$appStates10, _state$appStates11, _state$appStates12, _state$appStates13;
|
|
519
513
|
// Do not process anything during initialization
|
|
520
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
514
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === _Constants.ConversationEndEntity.NotSet) {
|
|
521
515
|
return;
|
|
522
516
|
}
|
|
523
517
|
|
|
524
518
|
// If start chat failed, and C2 is trying to close chat widget
|
|
525
|
-
if (state !== null && state !== void 0 && (_state$
|
|
519
|
+
if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed) {
|
|
526
520
|
(0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
527
521
|
return;
|
|
528
522
|
}
|
|
529
523
|
|
|
530
524
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
531
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
525
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === _ConversationState.ConversationState.Postchat || (state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === _ConversationState.ConversationState.InActive) {
|
|
532
526
|
(0, _endChat.endChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
533
527
|
return;
|
|
534
528
|
}
|
|
529
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates12 = state.appStates) === null || _state$appStates12 === void 0 ? void 0 : _state$appStates12.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates13 = state.appStates) === null || _state$appStates13 === void 0 ? void 0 : _state$appStates13.conversationEndedBy) === _Constants.ConversationEndEntity.Bot) {
|
|
530
|
+
dispatch({
|
|
531
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
532
|
+
payload: _ConversationState.ConversationState.InActive
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
535
|
|
|
536
|
-
//All other cases
|
|
536
|
+
// All other cases
|
|
537
537
|
(0, _endChat.prepareEndChat)(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, uwid.current);
|
|
538
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
538
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
539
539
|
|
|
540
540
|
// Publish chat widget state
|
|
541
541
|
(0, _react2.useEffect)(() => {
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.PostChatSurveyPaneStateful = void 0;
|
|
7
7
|
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Constants = require("../../common/Constants");
|
|
10
|
+
var _CustomerVoiceEvents = require("./enums/CustomerVoiceEvents");
|
|
11
|
+
var _PostChatSurveyMode = require("./enums/PostChatSurveyMode");
|
|
9
12
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
10
13
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
11
14
|
var _defaultgeneralPostChatSurveyPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps");
|
|
12
15
|
var _utils = require("../../common/utils");
|
|
13
16
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
14
|
-
var _PostChatSurveyMode = require("./enums/PostChatSurveyMode");
|
|
15
|
-
var _CustomerVoiceEvents = require("./enums/CustomerVoiceEvents");
|
|
16
|
-
var _Constants = require("../../common/Constants");
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
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); }
|
|
19
19
|
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; }
|
|
@@ -30,7 +30,7 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
30
30
|
var _props$styleProps, _state$appStates, _state$appStates2, _props$controlProps;
|
|
31
31
|
const [state] = (0, _useChatContextStore.default)();
|
|
32
32
|
const generalStyleProps = Object.assign({}, _defaultgeneralPostChatSurveyPaneStyleProps.defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
33
|
-
display: state.appStates.isMinimized ? "none" : ""
|
|
33
|
+
display: state.appStates.isMinimized ? "none" : "contents"
|
|
34
34
|
});
|
|
35
35
|
let surveyInviteLink = "";
|
|
36
36
|
const surveyMode = (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.selectedSurveyMode) === _PostChatSurveyMode.PostChatSurveyMode.Embed;
|
|
@@ -11,7 +11,6 @@ const defaultGeneralPostChatSurveyPaneStyleProps = {
|
|
|
11
11
|
left: "0%",
|
|
12
12
|
top: "0%",
|
|
13
13
|
borderRadius: "0 0 4px 4px",
|
|
14
|
-
borderWidth: "0px"
|
|
15
|
-
maxHeight: "calc(100% - 80px)"
|
|
14
|
+
borderWidth: "0px"
|
|
16
15
|
};
|
|
17
16
|
exports.defaultGeneralPostChatSurveyPaneStyleProps = defaultGeneralPostChatSurveyPaneStyleProps;
|
|
@@ -31,7 +31,6 @@ export let BroadcastEvent;
|
|
|
31
31
|
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
32
32
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
33
33
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
34
|
-
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
35
34
|
BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
|
|
36
35
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
37
36
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
@@ -102,6 +101,7 @@ export let TelemetryEvent;
|
|
|
102
101
|
TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
|
|
103
102
|
TelemetryEvent["EndChatSucceeded"] = "EndChatSucceeded";
|
|
104
103
|
TelemetryEvent["EndChatFailed"] = "EndChatFailed";
|
|
104
|
+
TelemetryEvent["SetCustomContext"] = "SetCustomContext";
|
|
105
105
|
TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
|
|
106
106
|
TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
|
|
107
107
|
TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
|
|
@@ -55,14 +55,17 @@ export const RegisterLoggers = () => {
|
|
|
55
55
|
};
|
|
56
56
|
const logTelemetry = telemetryEvent => {
|
|
57
57
|
loggers.map(logger => {
|
|
58
|
-
var _payload;
|
|
58
|
+
var _payload, _telemetryInput$paylo;
|
|
59
59
|
const logLevel = telemetryEvent.logLevel ?? LogLevel.INFO;
|
|
60
60
|
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? ScenarioType.UNDEFINED;
|
|
61
61
|
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
62
62
|
telemetryInput.telemetryInfo = {
|
|
63
63
|
telemetryInfo: TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
//Do not log events without an Event Name
|
|
66
|
+
if (telemetryInput !== null && telemetryInput !== void 0 && (_telemetryInput$paylo = telemetryInput.payload) !== null && _telemetryInput$paylo !== void 0 && _telemetryInput$paylo.Event) {
|
|
67
|
+
logger.log(logLevel, telemetryInput);
|
|
68
|
+
}
|
|
66
69
|
});
|
|
67
70
|
};
|
|
68
71
|
return registerLoggers();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useEffect,
|
|
3
|
-
import {
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
5
5
|
import { setFocusOnElement } from "../../common/utils";
|
|
6
6
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
@@ -19,7 +19,6 @@ export const ChatButtonStateful = props => {
|
|
|
19
19
|
} = props;
|
|
20
20
|
//Setting OutOfOperatingHours Flag
|
|
21
21
|
const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_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.OutOfOperatingHours) === "True");
|
|
22
|
-
const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
23
22
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
24
23
|
const controlProps = {
|
|
25
24
|
id: "oc-lcw-chat-button",
|
|
@@ -32,12 +31,7 @@ export const ChatButtonStateful = props => {
|
|
|
32
31
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
33
32
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
34
33
|
});
|
|
35
|
-
if (
|
|
36
|
-
const proactiveChatIsInPopoutModeEvent = {
|
|
37
|
-
eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
38
|
-
};
|
|
39
|
-
BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
40
|
-
} else if (state.appStates.isMinimized) {
|
|
34
|
+
if (state.appStates.isMinimized) {
|
|
41
35
|
dispatch({
|
|
42
36
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
43
37
|
payload: false
|
|
@@ -90,9 +84,6 @@ export const ChatButtonStateful = props => {
|
|
|
90
84
|
});
|
|
91
85
|
}
|
|
92
86
|
}, []);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
95
|
-
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
96
87
|
return /*#__PURE__*/React.createElement(ChatButton, {
|
|
97
88
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
98
89
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -3,6 +3,7 @@ import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcon
|
|
|
3
3
|
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
4
4
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
5
5
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
6
|
+
import DOMPurify from "dompurify";
|
|
6
7
|
const processDisplayName = displayName => {
|
|
7
8
|
// if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
|
|
8
9
|
const displayNameRegex = ".+:.+";
|
|
@@ -58,6 +59,8 @@ const processContent = (transcriptContent, isAgentChat, renderMarkDown) => {
|
|
|
58
59
|
}
|
|
59
60
|
if (renderMarkDown) {
|
|
60
61
|
transcriptContent = renderMarkDown(transcriptContent);
|
|
62
|
+
} else {
|
|
63
|
+
transcriptContent = DOMPurify.sanitize(transcriptContent);
|
|
61
64
|
}
|
|
62
65
|
return transcriptContent;
|
|
63
66
|
};
|
|
@@ -1190,7 +1190,13 @@ export const dummyDefaultProps = {
|
|
|
1190
1190
|
borderRadius: "0 0 4px 4px",
|
|
1191
1191
|
borderWidth: "3px",
|
|
1192
1192
|
backgroundColor: "#FFFFFF",
|
|
1193
|
-
borderColor: "#F1F1F1"
|
|
1193
|
+
borderColor: "#F1F1F1",
|
|
1194
|
+
position: "initial",
|
|
1195
|
+
height: "100%",
|
|
1196
|
+
width: "100%",
|
|
1197
|
+
left: "0%",
|
|
1198
|
+
top: "0%",
|
|
1199
|
+
display: "contents"
|
|
1194
1200
|
}
|
|
1195
1201
|
},
|
|
1196
1202
|
isCustomerVoiceSurveyCompact: undefined
|
|
@@ -29,6 +29,7 @@ import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/web
|
|
|
29
29
|
import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
|
|
30
30
|
import { getConversationDetails } from "./endChat";
|
|
31
31
|
import HyperlinkTextOverrideRenderer from "../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer";
|
|
32
|
+
import DOMPurify from "dompurify";
|
|
32
33
|
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
35
|
export const initWebChatComposer = (props, state, dispatch, chatSDK) => {
|
|
@@ -85,6 +86,8 @@ export const initWebChatComposer = (props, state, dispatch, chatSDK) => {
|
|
|
85
86
|
markdownRenderers.forEach(renderer => {
|
|
86
87
|
text = renderer.render(text);
|
|
87
88
|
});
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
text = DOMPurify.sanitize(text);
|
|
88
91
|
return text;
|
|
89
92
|
};
|
|
90
93
|
|
|
@@ -123,7 +123,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
123
123
|
try {
|
|
124
124
|
var _window$Microsoft, _window$Microsoft$Dyn, _window$Microsoft$Dyn2, _window$Microsoft$Dyn3;
|
|
125
125
|
// Set custom context params
|
|
126
|
-
setCustomContextParams();
|
|
126
|
+
setCustomContextParams(props);
|
|
127
127
|
const defaultOptionalParams = {
|
|
128
128
|
sendDefaultInitContext: true,
|
|
129
129
|
isProactiveChat: !!(params !== null && params !== void 0 && params.isProactiveChat),
|
|
@@ -278,24 +278,27 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
278
278
|
};
|
|
279
279
|
|
|
280
280
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
|
-
const setCustomContextParams =
|
|
282
|
-
var _persistedState$domai8;
|
|
281
|
+
const setCustomContextParams = props => {
|
|
282
|
+
var _props$chatConfig, _props$chatConfig$Liv, _persistedState$domai8;
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
284
|
+
const isAuthenticatedChat = props !== null && props !== void 0 && (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
285
|
+
//Should not set custom context for auth chat
|
|
286
|
+
if (isAuthenticatedChat) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (isNullOrEmptyString(widgetInstanceId)) {
|
|
290
|
+
widgetInstanceId = getWidgetCacheIdfromProps(props);
|
|
291
|
+
}
|
|
283
292
|
// Add custom context only for unauthenticated chat
|
|
284
293
|
const persistedState = getStateFromCache(widgetInstanceId);
|
|
285
294
|
if (!isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai8 = persistedState.domainStates) === null || _persistedState$domai8 === void 0 ? void 0 : _persistedState$domai8.customContext)) {
|
|
286
|
-
var _persistedState$domai9
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
ExceptionDetails: {
|
|
292
|
-
exception: errorMessage
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
throw new Error(errorMessage);
|
|
296
|
-
}
|
|
295
|
+
var _persistedState$domai9;
|
|
296
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
297
|
+
Event: TelemetryEvent.SetCustomContext,
|
|
298
|
+
Description: "Setting custom context for unauthenicated chat"
|
|
299
|
+
});
|
|
297
300
|
optionalParams = Object.assign({}, optionalParams, {
|
|
298
|
-
customContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$
|
|
301
|
+
customContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai9 = persistedState.domainStates) === null || _persistedState$domai9 === void 0 ? void 0 : _persistedState$domai9.customContext
|
|
299
302
|
});
|
|
300
303
|
}
|
|
301
304
|
};
|
|
@@ -305,9 +308,9 @@ const canStartPopoutChat = async props => {
|
|
|
305
308
|
}
|
|
306
309
|
popoutWidgetInstanceId = getWidgetCacheIdfromProps(props, true);
|
|
307
310
|
if (!isNullOrEmptyString(popoutWidgetInstanceId)) {
|
|
308
|
-
var _persistedState$
|
|
311
|
+
var _persistedState$domai10, _persistedState$appSt2;
|
|
309
312
|
const persistedState = getStateFromCache(popoutWidgetInstanceId);
|
|
310
|
-
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$
|
|
313
|
+
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai10 = persistedState.domainStates) === null || _persistedState$domai10 === void 0 ? void 0 : _persistedState$domai10.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt2 = persistedState.appStates) === null || _persistedState$appSt2 === void 0 ? void 0 : _persistedState$appSt2.conversationState) === ConversationState.Active) {
|
|
311
314
|
// Initiate popout chat
|
|
312
315
|
BroadcastService.postMessage({
|
|
313
316
|
eventName: BroadcastEvent.InitiateStartChatInPopoutMode
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
|
+
import { Components } from "botframework-webchat";
|
|
5
|
+
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, StorageType } from "../../../common/Constants";
|
|
4
6
|
import { Stack } from "@fluentui/react";
|
|
5
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
6
8
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
7
|
-
import { createTimer, getBroadcastChannelName, getLocaleDirection, getStateFromCache, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty,
|
|
9
|
+
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty, newGuid } from "../../../common/utils";
|
|
8
10
|
import { endChat, prepareEndChat } from "../common/endChat";
|
|
11
|
+
import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
9
12
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
10
13
|
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
11
14
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
12
15
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
13
|
-
import { Components } from "botframework-webchat";
|
|
14
16
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
15
17
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
16
18
|
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
17
|
-
import { Constants, E2VVOptions, StorageType, LiveWorkItemState, ConversationEndEntity, ConfirmationState } from "../../../common/Constants";
|
|
18
19
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
19
20
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
20
21
|
import HeaderStateful from "../../headerstateful/HeaderStateful";
|
|
@@ -47,9 +48,8 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
47
48
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
48
49
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
49
50
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
50
|
-
import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
51
51
|
export const LiveChatWidgetStateful = props => {
|
|
52
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$
|
|
52
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$styleProps2, _props$controlProps11, _props$controlProps12, _props$componentOverr, _props$controlProps13, _props$componentOverr2, _props$controlProps14, _props$componentOverr3, _props$controlProps15, _props$componentOverr4, _props$controlProps16, _props$componentOverr5, _props$controlProps17, _props$componentOverr6, _props$controlProps18, _props$componentOverr7, _props$controlProps19, _props$controlProps20, _props$componentOverr8, _props$controlProps21, _props$componentOverr9, _props$controlProps22, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
53
53
|
const [state, dispatch] = useChatContextStore();
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
55
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -360,7 +360,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
360
360
|
// This is to ensure to get latest state from cache in multitab
|
|
361
361
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
362
362
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
363
|
-
|
|
363
|
+
dispatch({
|
|
364
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
365
|
+
payload: ConversationEndEntity.Customer
|
|
366
|
+
});
|
|
364
367
|
} else {
|
|
365
368
|
const skipEndChatSDK = true;
|
|
366
369
|
const skipCloseChat = false;
|
|
@@ -498,36 +501,33 @@ export const LiveChatWidgetStateful = props => {
|
|
|
498
501
|
}
|
|
499
502
|
}, [state.domainStates.confirmationState]);
|
|
500
503
|
useEffect(() => {
|
|
501
|
-
var _state$appStates8, _state$appStates9;
|
|
502
|
-
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates9 = state.appStates) === null || _state$appStates9 === void 0 ? void 0 : _state$appStates9.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
503
|
-
dispatch({
|
|
504
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
505
|
-
payload: ConversationState.InActive
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
}, [state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationEndedBy]);
|
|
509
|
-
useEffect(() => {
|
|
510
|
-
var _state$appStates11, _state$appStates12, _state$appStates13, _state$appStates14;
|
|
504
|
+
var _state$appStates8, _state$appStates9, _state$appStates10, _state$appStates11, _state$appStates12, _state$appStates13;
|
|
511
505
|
// Do not process anything during initialization
|
|
512
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
506
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === ConversationEndEntity.NotSet) {
|
|
513
507
|
return;
|
|
514
508
|
}
|
|
515
509
|
|
|
516
510
|
// If start chat failed, and C2 is trying to close chat widget
|
|
517
|
-
if (state !== null && state !== void 0 && (_state$
|
|
511
|
+
if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed) {
|
|
518
512
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
519
513
|
return;
|
|
520
514
|
}
|
|
521
515
|
|
|
522
516
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
523
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
517
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === ConversationState.Postchat || (state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === ConversationState.InActive) {
|
|
524
518
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
525
519
|
return;
|
|
526
520
|
}
|
|
521
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates12 = state.appStates) === null || _state$appStates12 === void 0 ? void 0 : _state$appStates12.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates13 = state.appStates) === null || _state$appStates13 === void 0 ? void 0 : _state$appStates13.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
522
|
+
dispatch({
|
|
523
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
524
|
+
payload: ConversationState.InActive
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
527
|
|
|
528
|
-
//All other cases
|
|
528
|
+
// All other cases
|
|
529
529
|
prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, uwid.current);
|
|
530
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
530
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
531
531
|
|
|
532
532
|
// Publish chat widget state
|
|
533
533
|
useEffect(() => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { ConversationEndEntity } from "../../common/Constants";
|
|
4
|
+
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
5
|
+
import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
3
6
|
import { PostChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
4
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
5
8
|
import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps";
|
|
6
9
|
import { findAllFocusableElement } from "../../common/utils";
|
|
7
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
-
import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
9
|
-
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
10
|
-
import { ConversationEndEntity } from "../../common/Constants";
|
|
11
11
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
12
12
|
let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
13
13
|
const surveyLink = `${surveyInviteLink}
|
|
@@ -21,7 +21,7 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
21
21
|
var _props$styleProps, _state$appStates, _state$appStates2, _props$controlProps;
|
|
22
22
|
const [state] = useChatContextStore();
|
|
23
23
|
const generalStyleProps = Object.assign({}, defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
24
|
-
display: state.appStates.isMinimized ? "none" : ""
|
|
24
|
+
display: state.appStates.isMinimized ? "none" : "contents"
|
|
25
25
|
});
|
|
26
26
|
let surveyInviteLink = "";
|
|
27
27
|
const surveyMode = (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.selectedSurveyMode) === PostChatSurveyMode.Embed;
|
|
@@ -25,7 +25,6 @@ export declare enum BroadcastEvent {
|
|
|
25
25
|
StartProactiveChat = "StartProactiveChat",
|
|
26
26
|
ProactiveChatStartChat = "ProactiveChatStartChat",
|
|
27
27
|
ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
|
|
28
|
-
ProactiveChatIsInPopoutMode = "ProactiveChatIsInPopoutMode",
|
|
29
28
|
ResetProactiveChatParams = "ResetProactiveChatParams",
|
|
30
29
|
InvalidAdaptiveCardFormat = "InvalidAdaptiveCardFormat",
|
|
31
30
|
NewMessageSent = "NewMessageSent",
|
|
@@ -95,6 +94,7 @@ export declare enum TelemetryEvent {
|
|
|
95
94
|
ChatVisibilityChanged = "ChatVisibilityChanged",
|
|
96
95
|
EndChatSucceeded = "EndChatSucceeded",
|
|
97
96
|
EndChatFailed = "EndChatFailed",
|
|
97
|
+
SetCustomContext = "SetCustomContext",
|
|
98
98
|
WebChatLoaded = "WebChatLoaded",
|
|
99
99
|
LCWChatButtonClicked = "LCWChatButtonClicked",
|
|
100
100
|
LCWChatButtonShow = "LCWChatButtonShow",
|