@microsoft/omnichannel-chat-widget 1.6.4-main.ab88589 â 1.6.5-main.359f47b
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/components/livechatwidget/common/endChat.js +37 -16
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +26 -5
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +7 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +26 -1
- package/lib/cjs/plugins/createChatTranscript.js +7 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +37 -16
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +26 -5
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +7 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +26 -1
- package/lib/esm/plugins/createChatTranscript.js +7 -0
- package/package.json +2 -2
|
@@ -6,21 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.prepareEndChat = exports.endVoiceVideoCallIfOngoing = exports.endChatStateCleanUp = exports.endChat = exports.closeChatStateCleanUp = exports.chatSDKStateCleanUp = exports.callingStateCleanUp = void 0;
|
|
7
7
|
var _Constants = require("../../../common/Constants");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
|
-
var _authHelper = require("./authHelper");
|
|
10
9
|
var _utils = require("../../../common/utils");
|
|
11
10
|
var _renderSurveyHelpers = require("./renderSurveyHelpers");
|
|
12
11
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
14
13
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
14
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
15
|
+
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
16
16
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
17
17
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
18
|
-
var
|
|
18
|
+
var _createReducer = require("../../../contexts/createReducer");
|
|
19
|
+
var _authHelper = require("./authHelper");
|
|
20
|
+
var _reconnectChatHelper = require("./reconnectChatHelper");
|
|
19
21
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
20
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
23
|
const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
|
|
22
24
|
try {
|
|
23
25
|
var _conversationDetails$, _state$domainStates, _state$appStates3;
|
|
26
|
+
const {
|
|
27
|
+
chatConfig
|
|
28
|
+
} = props;
|
|
29
|
+
|
|
24
30
|
// Use Case: If call is ongoing, end the call by simulating end call button click
|
|
25
31
|
endVoiceVideoCallIfOngoing(chatSDK, dispatch);
|
|
26
32
|
const conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
|
|
@@ -80,12 +86,25 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
80
86
|
Description: `${_Constants.PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat} ${state === null || state === void 0 ? void 0 : (_state$appStates4 = state.appStates) === null || _state$appStates4 === void 0 ? void 0 : _state$appStates4.conversationEndedBy}.`
|
|
81
87
|
});
|
|
82
88
|
}
|
|
83
|
-
|
|
89
|
+
const persistentEnabled = (0, _reconnectChatHelper.isPersistentEnabled)(chatConfig);
|
|
90
|
+
const {
|
|
91
|
+
appStates
|
|
92
|
+
} = (0, _createReducer.executeReducer)(state, {
|
|
93
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
94
|
+
payload: undefined
|
|
95
|
+
});
|
|
96
|
+
const endedByCustomer = (appStates === null || appStates === void 0 ? void 0 : appStates.conversationEndedBy) === "Customer";
|
|
84
97
|
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
const commonParams = [props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter];
|
|
100
|
+
if (persistentEnabled && endedByCustomer) {
|
|
101
|
+
await endChat(...commonParams, true, false, true);
|
|
102
|
+
} else {
|
|
103
|
+
await endChat(...commonParams, false, true, true);
|
|
104
|
+
if (postchatContext) {
|
|
105
|
+
await (0, _renderSurveyHelpers.initiatePostChat)(props, conversationDetails, state, dispatch, postchatContext);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
89
108
|
}
|
|
90
109
|
} catch (error) {
|
|
91
110
|
var _props$controlProps;
|
|
@@ -268,15 +287,17 @@ exports.chatSDKStateCleanUp = chatSDKStateCleanUp;
|
|
|
268
287
|
const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
|
|
269
288
|
let callId = "";
|
|
270
289
|
try {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
290
|
+
if (chatSDK.isVoiceVideoCallingEnabled()) {
|
|
291
|
+
const voiceVideoCallingSdk = await chatSDK.getVoiceVideoCalling();
|
|
292
|
+
if (voiceVideoCallingSdk && voiceVideoCallingSdk.isInACall()) {
|
|
293
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
|
+
callId = voiceVideoCallingSdk.callId;
|
|
295
|
+
voiceVideoCallingSdk.stopCall();
|
|
296
|
+
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
297
|
+
Event: _TelemetryConstants.TelemetryEvent.EndCallButtonClick
|
|
298
|
+
}, callId);
|
|
299
|
+
callingStateCleanUp(dispatch);
|
|
300
|
+
}
|
|
280
301
|
}
|
|
281
302
|
} catch (error) {
|
|
282
303
|
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -63,7 +63,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
63
63
|
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; }
|
|
64
64
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
65
65
|
const LiveChatWidgetStateful = props => {
|
|
66
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$
|
|
66
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain7, _props$webChatContain8, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain9, _props$webChatContain10, _props$webChatContain11, _props$webChatContain12, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
67
67
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
69
|
const [adapter, setAdapter] = (0, _useChatAdapterStore.default)();
|
|
@@ -358,7 +358,19 @@ const LiveChatWidgetStateful = props => {
|
|
|
358
358
|
|
|
359
359
|
// Start chat from SDK Event
|
|
360
360
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
|
|
361
|
-
var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
361
|
+
var _props$chatConfig4, _props$chatConfig4$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
362
|
+
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
363
|
+
if ((props === null || props === void 0 ? void 0 : (_props$chatConfig4 = props.chatConfig) === null || _props$chatConfig4 === void 0 ? void 0 : (_props$chatConfig4$Li = _props$chatConfig4.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig4$Li === void 0 ? void 0 : _props$chatConfig4$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
364
|
+
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
365
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
366
|
+
payload: false
|
|
367
|
+
});
|
|
368
|
+
dispatch({
|
|
369
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
370
|
+
payload: _ConversationState.ConversationState.OutOfOffice
|
|
371
|
+
});
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
362
374
|
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
363
375
|
if (!(0, _utils.isNullOrUndefined)(msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload6 = msg.payload) === null || _msg$payload6 === void 0 ? void 0 : _msg$payload6.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
364
376
|
return;
|
|
@@ -652,6 +664,15 @@ const LiveChatWidgetStateful = props => {
|
|
|
652
664
|
(0, _react2.useEffect)(() => {
|
|
653
665
|
(0, _chatDisconnectHelper.handleChatDisconnect)(props, state, setWebChatStyles);
|
|
654
666
|
}, [state.appStates.chatDisconnectEventReceived]);
|
|
667
|
+
|
|
668
|
+
// if props state gets updates we need to update the renderingMiddlewareProps in the state
|
|
669
|
+
(0, _react2.useEffect)(() => {
|
|
670
|
+
var _props$webChatContain6;
|
|
671
|
+
dispatch({
|
|
672
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
|
|
673
|
+
payload: (_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.renderingMiddlewareProps
|
|
674
|
+
});
|
|
675
|
+
}, [(_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.renderingMiddlewareProps]);
|
|
655
676
|
const initiateEndChatOnBrowserUnload = () => {
|
|
656
677
|
var _DataStoreManager$cli;
|
|
657
678
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -687,7 +708,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
687
708
|
const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, state, dispatch, chatSDK, endChatRelay);
|
|
688
709
|
const downloadTranscriptProps = (0, _createDownloadTranscriptProps.default)(props.downloadTranscriptProps, {
|
|
689
710
|
...(_defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === null || _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === void 0 ? void 0 : _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles),
|
|
690
|
-
...((_props$
|
|
711
|
+
...((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.webChatStyles)
|
|
691
712
|
}, props.webChatContainerProps);
|
|
692
713
|
const livechatProps = {
|
|
693
714
|
...props,
|
|
@@ -738,8 +759,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
738
759
|
`), /*#__PURE__*/_react2.default.createElement(_DraggableChatWidget.default, chatWidgetDraggableConfig, /*#__PURE__*/_react2.default.createElement(Composer, _extends({}, webChatProps, {
|
|
739
760
|
styleOptions: {
|
|
740
761
|
...webChatStyles,
|
|
741
|
-
bubbleBackground: ((_props$
|
|
742
|
-
bubbleTextColor: ((_props$
|
|
762
|
+
bubbleBackground: ((_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : (_props$webChatContain10 = _props$webChatContain9.adaptiveCardStyles) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background,
|
|
763
|
+
bubbleTextColor: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.adaptiveCardStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color
|
|
743
764
|
},
|
|
744
765
|
directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine
|
|
745
766
|
}), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
@@ -55,7 +55,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
const WebChatContainerStateful = props => {
|
|
58
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14;
|
|
58
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _props$webChatContain9, _props$webChatContain10;
|
|
59
59
|
const {
|
|
60
60
|
BasicWebChat
|
|
61
61
|
} = _botframeworkWebchat.Components;
|
|
@@ -214,8 +214,13 @@ const WebChatContainerStateful = props => {
|
|
|
214
214
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
215
215
|
border-radius: 0 !important; /* Override border-radius */
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
.webchat__stacked-layout_container>div {
|
|
219
|
+
background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : (_props$webChatContain10 = _props$webChatContain9.containerStyles) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.background) ?? ""}
|
|
220
|
+
}
|
|
217
221
|
`), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
218
|
-
styles: containerStyles
|
|
222
|
+
styles: containerStyles,
|
|
223
|
+
className: "webchat__stacked-layout_container"
|
|
219
224
|
}, /*#__PURE__*/_react2.default.createElement(BasicWebChat, null)));
|
|
220
225
|
};
|
|
221
226
|
exports.WebChatContainerStateful = WebChatContainerStateful;
|
package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js
CHANGED
|
@@ -34,6 +34,31 @@ const defaultWebChatStyles = {
|
|
|
34
34
|
suggestedActionsStackedHeight: 125,
|
|
35
35
|
suggestedActionsStackedOverflow: "scroll",
|
|
36
36
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
37
|
-
typingAnimationDuration: 3500
|
|
37
|
+
typingAnimationDuration: 3500,
|
|
38
|
+
emojiSet: {
|
|
39
|
+
":)": "đ",
|
|
40
|
+
":-)": "đ",
|
|
41
|
+
"(:": "đ",
|
|
42
|
+
"(-:": "đ",
|
|
43
|
+
":-|": "đ",
|
|
44
|
+
":|": "đ",
|
|
45
|
+
":-(": "âšī¸",
|
|
46
|
+
":(": "âšī¸",
|
|
47
|
+
":-D": "đ",
|
|
48
|
+
":D": "đ",
|
|
49
|
+
":-p": "đ",
|
|
50
|
+
":p": "đ",
|
|
51
|
+
":-P": "đ",
|
|
52
|
+
":P": "đ",
|
|
53
|
+
":-o": "đ˛",
|
|
54
|
+
":o": "đ˛",
|
|
55
|
+
":O": "đ˛",
|
|
56
|
+
":-O": "đ˛",
|
|
57
|
+
";-)": "đ",
|
|
58
|
+
";)": "đ",
|
|
59
|
+
"<3": "â¤ī¸",
|
|
60
|
+
"</3": "đ",
|
|
61
|
+
"<\\3": "đ"
|
|
62
|
+
}
|
|
38
63
|
};
|
|
39
64
|
exports.defaultWebChatStyles = defaultWebChatStyles;
|
|
@@ -64,6 +64,12 @@ class TranscriptHTMLBuilder {
|
|
|
64
64
|
this.disableNewLineMarkdownSupport = this.options.disableNewLineMarkdownSupport;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
createMetaElement() {
|
|
68
|
+
const htmlData = `
|
|
69
|
+
<meta charset="UTF-8">
|
|
70
|
+
`;
|
|
71
|
+
return htmlData;
|
|
72
|
+
}
|
|
67
73
|
createTitleElement() {
|
|
68
74
|
const htmlData = `<title> ${this.pageTitle} </title>`;
|
|
69
75
|
return htmlData;
|
|
@@ -81,6 +87,7 @@ class TranscriptHTMLBuilder {
|
|
|
81
87
|
createHeadElement() {
|
|
82
88
|
const htmlData = `
|
|
83
89
|
<head>
|
|
90
|
+
${this.createMetaElement()}
|
|
84
91
|
${this.createTitleElement()}
|
|
85
92
|
${this.createExternalScriptElements()}
|
|
86
93
|
<script>
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
|
-
import { handleAuthentication } from "./authHelper";
|
|
4
3
|
import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
|
|
5
4
|
import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
|
|
6
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
7
6
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
8
7
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
9
8
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
9
|
+
import { TelemetryManager } from "../../../common/telemetry/TelemetryManager";
|
|
10
10
|
import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
|
|
11
11
|
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
12
|
-
import {
|
|
12
|
+
import { executeReducer } from "../../../contexts/createReducer";
|
|
13
|
+
import { handleAuthentication } from "./authHelper";
|
|
14
|
+
import { isPersistentEnabled } from "./reconnectChatHelper";
|
|
13
15
|
import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
|
|
14
16
|
|
|
15
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
18
|
const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter) => {
|
|
17
19
|
try {
|
|
18
20
|
var _conversationDetails$, _state$domainStates, _state$appStates3;
|
|
21
|
+
const {
|
|
22
|
+
chatConfig
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
19
25
|
// Use Case: If call is ongoing, end the call by simulating end call button click
|
|
20
26
|
endVoiceVideoCallIfOngoing(chatSDK, dispatch);
|
|
21
27
|
const conversationDetails = await getConversationDetailsCall(chatSDK);
|
|
@@ -75,12 +81,25 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
75
81
|
Description: `${PrepareEndChatDescriptionConstants.ConversationEndedByCustomerWithInvalidPostChat} ${state === null || state === void 0 ? void 0 : (_state$appStates4 = state.appStates) === null || _state$appStates4 === void 0 ? void 0 : _state$appStates4.conversationEndedBy}.`
|
|
76
82
|
});
|
|
77
83
|
}
|
|
78
|
-
|
|
84
|
+
const persistentEnabled = isPersistentEnabled(chatConfig);
|
|
85
|
+
const {
|
|
86
|
+
appStates
|
|
87
|
+
} = executeReducer(state, {
|
|
88
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
89
|
+
payload: undefined
|
|
90
|
+
});
|
|
91
|
+
const endedByCustomer = (appStates === null || appStates === void 0 ? void 0 : appStates.conversationEndedBy) === "Customer";
|
|
79
92
|
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
const commonParams = [props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter];
|
|
95
|
+
if (persistentEnabled && endedByCustomer) {
|
|
96
|
+
await endChat(...commonParams, true, false, true);
|
|
97
|
+
} else {
|
|
98
|
+
await endChat(...commonParams, false, true, true);
|
|
99
|
+
if (postchatContext) {
|
|
100
|
+
await initiatePostChat(props, conversationDetails, state, dispatch, postchatContext);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
84
103
|
}
|
|
85
104
|
} catch (error) {
|
|
86
105
|
var _props$controlProps;
|
|
@@ -257,15 +276,17 @@ export const chatSDKStateCleanUp = chatSDK => {
|
|
|
257
276
|
export const endVoiceVideoCallIfOngoing = async (chatSDK, dispatch) => {
|
|
258
277
|
let callId = "";
|
|
259
278
|
try {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
279
|
+
if (chatSDK.isVoiceVideoCallingEnabled()) {
|
|
280
|
+
const voiceVideoCallingSdk = await chatSDK.getVoiceVideoCalling();
|
|
281
|
+
if (voiceVideoCallingSdk && voiceVideoCallingSdk.isInACall()) {
|
|
282
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
283
|
+
callId = voiceVideoCallingSdk.callId;
|
|
284
|
+
voiceVideoCallingSdk.stopCall();
|
|
285
|
+
TelemetryHelper.logCallingEvent(LogLevel.INFO, {
|
|
286
|
+
Event: TelemetryEvent.EndCallButtonClick
|
|
287
|
+
}, callId);
|
|
288
|
+
callingStateCleanUp(dispatch);
|
|
289
|
+
}
|
|
269
290
|
}
|
|
270
291
|
} catch (error) {
|
|
271
292
|
TelemetryHelper.logCallingEvent(LogLevel.ERROR, {
|
|
@@ -55,7 +55,7 @@ import StartChatErrorPaneStateful from "../../startchaterrorpanestateful/StartCh
|
|
|
55
55
|
import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
|
|
56
56
|
import { executeReducer } from "../../../contexts/createReducer";
|
|
57
57
|
export const LiveChatWidgetStateful = props => {
|
|
58
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$
|
|
58
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain7, _props$webChatContain8, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain9, _props$webChatContain10, _props$webChatContain11, _props$webChatContain12, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
59
59
|
const [state, dispatch] = useChatContextStore();
|
|
60
60
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
61
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -350,7 +350,19 @@ export const LiveChatWidgetStateful = props => {
|
|
|
350
350
|
|
|
351
351
|
// Start chat from SDK Event
|
|
352
352
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
353
|
-
var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
353
|
+
var _props$chatConfig4, _props$chatConfig4$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
354
|
+
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
355
|
+
if ((props === null || props === void 0 ? void 0 : (_props$chatConfig4 = props.chatConfig) === null || _props$chatConfig4 === void 0 ? void 0 : (_props$chatConfig4$Li = _props$chatConfig4.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig4$Li === void 0 ? void 0 : _props$chatConfig4$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
356
|
+
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
357
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
358
|
+
payload: false
|
|
359
|
+
});
|
|
360
|
+
dispatch({
|
|
361
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
362
|
+
payload: ConversationState.OutOfOffice
|
|
363
|
+
});
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
354
366
|
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
355
367
|
if (!isNullOrUndefined(msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload6 = msg.payload) === null || _msg$payload6 === void 0 ? void 0 : _msg$payload6.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
356
368
|
return;
|
|
@@ -644,6 +656,15 @@ export const LiveChatWidgetStateful = props => {
|
|
|
644
656
|
useEffect(() => {
|
|
645
657
|
handleChatDisconnect(props, state, setWebChatStyles);
|
|
646
658
|
}, [state.appStates.chatDisconnectEventReceived]);
|
|
659
|
+
|
|
660
|
+
// if props state gets updates we need to update the renderingMiddlewareProps in the state
|
|
661
|
+
useEffect(() => {
|
|
662
|
+
var _props$webChatContain6;
|
|
663
|
+
dispatch({
|
|
664
|
+
type: LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
|
|
665
|
+
payload: (_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.renderingMiddlewareProps
|
|
666
|
+
});
|
|
667
|
+
}, [(_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.renderingMiddlewareProps]);
|
|
647
668
|
const initiateEndChatOnBrowserUnload = () => {
|
|
648
669
|
var _DataStoreManager$cli;
|
|
649
670
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -679,7 +700,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
679
700
|
const webChatProps = initWebChatComposer(props, state, dispatch, chatSDK, endChatRelay);
|
|
680
701
|
const downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
|
|
681
702
|
...(defaultWebChatContainerStatefulProps === null || defaultWebChatContainerStatefulProps === void 0 ? void 0 : defaultWebChatContainerStatefulProps.webChatStyles),
|
|
682
|
-
...((_props$
|
|
703
|
+
...((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.webChatStyles)
|
|
683
704
|
}, props.webChatContainerProps);
|
|
684
705
|
const livechatProps = {
|
|
685
706
|
...props,
|
|
@@ -730,8 +751,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
730
751
|
`), /*#__PURE__*/React.createElement(DraggableChatWidget, chatWidgetDraggableConfig, /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
731
752
|
styleOptions: {
|
|
732
753
|
...webChatStyles,
|
|
733
|
-
bubbleBackground: ((_props$
|
|
734
|
-
bubbleTextColor: ((_props$
|
|
754
|
+
bubbleBackground: ((_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : (_props$webChatContain10 = _props$webChatContain9.adaptiveCardStyles) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.background) ?? defaultAdaptiveCardStyles.background,
|
|
755
|
+
bubbleTextColor: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.adaptiveCardStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.color) ?? defaultAdaptiveCardStyles.color
|
|
735
756
|
},
|
|
736
757
|
directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
|
|
737
758
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -47,7 +47,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export const WebChatContainerStateful = props => {
|
|
50
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14;
|
|
50
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _props$webChatContain9, _props$webChatContain10;
|
|
51
51
|
const {
|
|
52
52
|
BasicWebChat
|
|
53
53
|
} = Components;
|
|
@@ -206,8 +206,13 @@ export const WebChatContainerStateful = props => {
|
|
|
206
206
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
207
207
|
border-radius: 0 !important; /* Override border-radius */
|
|
208
208
|
}
|
|
209
|
+
|
|
210
|
+
.webchat__stacked-layout_container>div {
|
|
211
|
+
background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : (_props$webChatContain10 = _props$webChatContain9.containerStyles) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.background) ?? ""}
|
|
212
|
+
}
|
|
209
213
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
210
|
-
styles: containerStyles
|
|
214
|
+
styles: containerStyles,
|
|
215
|
+
className: "webchat__stacked-layout_container"
|
|
211
216
|
}, /*#__PURE__*/React.createElement(BasicWebChat, null)));
|
|
212
217
|
};
|
|
213
218
|
export default WebChatContainerStateful;
|
package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js
CHANGED
|
@@ -28,5 +28,30 @@ export const defaultWebChatStyles = {
|
|
|
28
28
|
suggestedActionsStackedHeight: 125,
|
|
29
29
|
suggestedActionsStackedOverflow: "scroll",
|
|
30
30
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
31
|
-
typingAnimationDuration: 3500
|
|
31
|
+
typingAnimationDuration: 3500,
|
|
32
|
+
emojiSet: {
|
|
33
|
+
":)": "đ",
|
|
34
|
+
":-)": "đ",
|
|
35
|
+
"(:": "đ",
|
|
36
|
+
"(-:": "đ",
|
|
37
|
+
":-|": "đ",
|
|
38
|
+
":|": "đ",
|
|
39
|
+
":-(": "âšī¸",
|
|
40
|
+
":(": "âšī¸",
|
|
41
|
+
":-D": "đ",
|
|
42
|
+
":D": "đ",
|
|
43
|
+
":-p": "đ",
|
|
44
|
+
":p": "đ",
|
|
45
|
+
":-P": "đ",
|
|
46
|
+
":P": "đ",
|
|
47
|
+
":-o": "đ˛",
|
|
48
|
+
":o": "đ˛",
|
|
49
|
+
":O": "đ˛",
|
|
50
|
+
":-O": "đ˛",
|
|
51
|
+
";-)": "đ",
|
|
52
|
+
";)": "đ",
|
|
53
|
+
"<3": "â¤ī¸",
|
|
54
|
+
"</3": "đ",
|
|
55
|
+
"<\\3": "đ"
|
|
56
|
+
}
|
|
32
57
|
};
|
|
@@ -60,6 +60,12 @@ class TranscriptHTMLBuilder {
|
|
|
60
60
|
this.disableNewLineMarkdownSupport = this.options.disableNewLineMarkdownSupport;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
createMetaElement() {
|
|
64
|
+
const htmlData = `
|
|
65
|
+
<meta charset="UTF-8">
|
|
66
|
+
`;
|
|
67
|
+
return htmlData;
|
|
68
|
+
}
|
|
63
69
|
createTitleElement() {
|
|
64
70
|
const htmlData = `<title> ${this.pageTitle} </title>`;
|
|
65
71
|
return htmlData;
|
|
@@ -77,6 +83,7 @@ class TranscriptHTMLBuilder {
|
|
|
77
83
|
createHeadElement() {
|
|
78
84
|
const htmlData = `
|
|
79
85
|
<head>
|
|
86
|
+
${this.createMetaElement()}
|
|
80
87
|
${this.createTitleElement()}
|
|
81
88
|
${this.createExternalScriptElements()}
|
|
82
89
|
<script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5-main.359f47b",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@microsoft/omnichannel-chat-components": "1.1.5",
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "^1.8.
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "^1.8.2",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|