@microsoft/omnichannel-chat-widget 1.4.1-main.e6586cc → 1.5.0
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/README.md +1 -1
- package/lib/cjs/common/utils.js +19 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +8 -11
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -1
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +1 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +36 -16
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -17
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +22 -9
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
- package/lib/esm/common/utils.js +16 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +8 -11
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -2
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +37 -17
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -17
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +22 -9
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js +1 -0
- package/lib/types/common/utils.d.ts +9 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +9 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ These are components that are included in the ```@microsoft/omnichannel-chat-com
|
|
|
125
125
|
| ProactiveChatSurveyPane | A pane that holds more information than a normal chat button and can be configured to proactively pop up | [IProactiveChatPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/proactivechatpane/interfaces/IProactiveChatPaneProps.ts) |
|
|
126
126
|
| ReconnectChatPane | The pane that shows up when the customer is re-connecting to the chat to add additional conversation | [IReconnectChatPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/reconnectchatpane/interfaces/IReconnectChatPaneProps.ts) |
|
|
127
127
|
|
|
128
|
-
> :warning: Because the components extend Microsoft's [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/) components, the base interface for all the ```styleProps``` in the above table is [IStyle](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IStyle.ts), which extends the [IRawStyleBase](https://
|
|
128
|
+
> :warning: Because the components extend Microsoft's [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/) components, the base interface for all the ```styleProps``` in the above table is [IStyle](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IStyle.ts), which extends the [IRawStyleBase](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IRawStyleBase.ts#L280) interface, which is the most useful reference.
|
|
129
129
|
|
|
130
130
|
### Stateful Components
|
|
131
131
|
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
6
|
+
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
var _Constants = require("./Constants");
|
|
8
8
|
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
9
9
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -431,4 +431,21 @@ const createFileAndDownload = (fileName, blobData, mimeType) => {
|
|
|
431
431
|
aElement.click();
|
|
432
432
|
document.body.removeChild(aElement);
|
|
433
433
|
};
|
|
434
|
-
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
*
|
|
437
|
+
* Replace placeholders with format {0}..{n} , in a string with values
|
|
438
|
+
*
|
|
439
|
+
* @param template String with placeholders to be replaced
|
|
440
|
+
* @param values array of values to replace the placeholders
|
|
441
|
+
* @returns formatted string with replaced values
|
|
442
|
+
*/
|
|
443
|
+
// use of any for values as array of any type is passed
|
|
444
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
445
|
+
exports.createFileAndDownload = createFileAndDownload;
|
|
446
|
+
const formatTemplateString = (templateMessage, values) => {
|
|
447
|
+
return templateMessage.replace(/{(\d+)}/g, (match, index) => {
|
|
448
|
+
return typeof values[index] !== "undefined" ? values[index] : match;
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
exports.formatTemplateString = formatTemplateString;
|
|
@@ -65,17 +65,14 @@ const ChatButtonStateful = props => {
|
|
|
65
65
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
66
66
|
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
67
67
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
payload: _ConversationState.ConversationState.OutOfOffice
|
|
77
|
-
});
|
|
78
|
-
}
|
|
68
|
+
state.appStates.isMinimized && dispatch({
|
|
69
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
70
|
+
payload: false
|
|
71
|
+
});
|
|
72
|
+
dispatch({
|
|
73
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
74
|
+
payload: _ConversationState.ConversationState.OutOfOffice
|
|
75
|
+
});
|
|
79
76
|
},
|
|
80
77
|
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
81
78
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
@@ -16,6 +16,7 @@ var _Constants = require("../../common/Constants");
|
|
|
16
16
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
17
17
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
18
18
|
var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
|
|
19
|
+
var _defaultMiddlewareLocalizedTexts = require("../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
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
22
|
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; }
|
|
@@ -55,6 +56,7 @@ const EmailTranscriptPaneStateful = props => {
|
|
|
55
56
|
};
|
|
56
57
|
try {
|
|
57
58
|
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
|
|
59
|
+
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
58
60
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
59
61
|
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
60
62
|
Description: "Transcript sent to email successfully."
|
|
@@ -66,7 +68,8 @@ const EmailTranscriptPaneStateful = props => {
|
|
|
66
68
|
exception: ex
|
|
67
69
|
}
|
|
68
70
|
});
|
|
69
|
-
|
|
71
|
+
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
72
|
+
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
70
73
|
}
|
|
71
74
|
},
|
|
72
75
|
onCancel: () => {
|
|
@@ -13,7 +13,8 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
|
13
13
|
const handleChatDisconnect = (props, state, setWebChatStyles) => {
|
|
14
14
|
var _state$appStates;
|
|
15
15
|
if (state !== null && state !== void 0 && (_state$appStates = state.appStates) !== null && _state$appStates !== void 0 && _state$appStates.chatDisconnectEventReceived) {
|
|
16
|
-
var _props$webChatContain, _props$webChatContain2;
|
|
16
|
+
var _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
|
|
17
|
+
const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
|
|
17
18
|
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
|
|
18
19
|
setWebChatStyles(styles => {
|
|
19
20
|
return {
|
|
@@ -22,7 +23,7 @@ const handleChatDisconnect = (props, state, setWebChatStyles) => {
|
|
|
22
23
|
};
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
_NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.ChatDisconnect,
|
|
26
|
+
_NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
|
|
26
27
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
27
28
|
Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
28
29
|
Description: "Chat disconnected due to timeout, left or removed."
|
|
@@ -17,15 +17,13 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
19
19
|
var _props$chatConfig, _props$chatConfig$Liv;
|
|
20
|
-
if (!isReconnectEnabled(props.chatConfig) || isPersistentEnabled(props.chatConfig)) return false;
|
|
21
|
-
|
|
22
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
21
|
const isAuthenticatedChat = (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
24
22
|
|
|
25
23
|
// Get chat reconnect context
|
|
26
24
|
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
|
|
27
25
|
|
|
28
|
-
//Redirect if enabled
|
|
26
|
+
// Redirect if enabled
|
|
29
27
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
30
28
|
var _props$reconnectChatP;
|
|
31
29
|
redirectPage(reconnectChatContext.redirectURL, (_props$reconnectChatP = props.reconnectChatPaneProps) === null || _props$reconnectChatP === void 0 ? void 0 : _props$reconnectChatP.redirectInSameWindow);
|
|
@@ -34,7 +34,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
34
34
|
widgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
35
35
|
|
|
36
36
|
// reconnect > chat from cache
|
|
37
|
-
|
|
37
|
+
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
|
|
38
|
+
const shouldStartChatNormally = await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
39
|
+
if (!shouldStartChatNormally) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
39
45
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat) {
|
|
40
46
|
return;
|
|
@@ -69,15 +75,29 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
69
75
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
70
76
|
const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
|
|
71
77
|
if (showPrechat) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
var _state$domainStates, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3;
|
|
79
|
+
const isOutOfOperatingHours = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : (_state$domainStates$l3 = _state$domainStates$l2.OutOfOperatingHours) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.toLowerCase()) === "true";
|
|
80
|
+
if (isOutOfOperatingHours) {
|
|
81
|
+
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
82
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
83
|
+
payload: false
|
|
84
|
+
});
|
|
85
|
+
dispatch({
|
|
86
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
87
|
+
payload: _ConversationState.ConversationState.OutOfOffice
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
} else {
|
|
91
|
+
dispatch({
|
|
92
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
93
|
+
payload: preChatSurveyResponse
|
|
94
|
+
});
|
|
95
|
+
dispatch({
|
|
96
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
97
|
+
payload: _ConversationState.ConversationState.Prechat
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
//Initiate start chat
|
|
@@ -303,17 +323,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
303
323
|
|
|
304
324
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
305
325
|
const setCustomContextParams = async (state, props) => {
|
|
306
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
326
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates2, _persistedState$domai8;
|
|
307
327
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
328
|
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;
|
|
309
329
|
//Should not set custom context for auth chat
|
|
310
330
|
if (isAuthenticatedChat) {
|
|
311
331
|
return;
|
|
312
332
|
}
|
|
313
|
-
if (state !== null && state !== void 0 && (_state$
|
|
314
|
-
var _state$
|
|
333
|
+
if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.customContext) {
|
|
334
|
+
var _state$domainStates3;
|
|
315
335
|
optionalParams = Object.assign({}, optionalParams, {
|
|
316
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
336
|
+
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.customContext))
|
|
317
337
|
});
|
|
318
338
|
return;
|
|
319
339
|
}
|
|
@@ -361,8 +381,8 @@ const canStartPopoutChat = async props => {
|
|
|
361
381
|
|
|
362
382
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
363
383
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
364
|
-
var _state$
|
|
365
|
-
const requestIdFromCache = (_state$
|
|
384
|
+
var _state$domainStates4, _state$domainStates4$;
|
|
385
|
+
const requestIdFromCache = (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.liveChatContext) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.requestId;
|
|
366
386
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
367
387
|
let conversationDetails = undefined;
|
|
368
388
|
|
|
@@ -61,7 +61,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
61
61
|
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; }
|
|
62
62
|
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); }
|
|
63
63
|
const LiveChatWidgetStateful = props => {
|
|
64
|
-
var _props$webChatContain, _props$styleProps,
|
|
64
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$webChatContain10, _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$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
65
65
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
66
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
67
|
const [adapter, setAdapter] = (0, _useChatAdapterStore.default)();
|
|
@@ -85,10 +85,15 @@ const LiveChatWidgetStateful = props => {
|
|
|
85
85
|
|
|
86
86
|
//Scrollbar styles
|
|
87
87
|
const scrollbarProps = Object.assign({}, _defaultScrollBarProps.defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
|
|
89
|
+
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
90
|
+
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
91
|
+
var _chatSDK$omnichannelC, _props$controlProps2;
|
|
92
|
+
const broadcastServiceChannelName = (0, _utils.getBroadcastChannelName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
93
|
+
(0, _omnichannelChatComponents.BroadcastServiceInitialize)(broadcastServiceChannelName);
|
|
94
|
+
}
|
|
90
95
|
_TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer = (0, _utils.createTimer)();
|
|
91
|
-
const widgetElementId = ((_props$
|
|
96
|
+
const widgetElementId = ((_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.id) || "oc-lcw";
|
|
92
97
|
const currentMessageCountRef = (0, _react2.useRef)(0);
|
|
93
98
|
let widgetStateEventId = "";
|
|
94
99
|
const lastLWICheckTimeRef = (0, _react2.useRef)(0);
|
|
@@ -178,8 +183,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
178
183
|
// Add default localStorage support for widget
|
|
179
184
|
const widgetCacheId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
180
185
|
if (props.contextDataStore === undefined) {
|
|
181
|
-
var _props$
|
|
182
|
-
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$
|
|
186
|
+
var _props$controlProps4;
|
|
187
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.cacheTtlInMins) ?? _Constants.Constants.CacheTtlInMinutes;
|
|
183
188
|
const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? _Constants.StorageType.sessionStorage : _Constants.StorageType.localStorage;
|
|
184
189
|
_DataStoreManager.DataStoreManager.clientDataStore = (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)(cacheTtlInMins, storageType);
|
|
185
190
|
(0, _defaultCacheManager.registerBroadcastServiceForStorage)(widgetCacheId, cacheTtlInMins, storageType);
|
|
@@ -188,7 +193,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
188
193
|
}
|
|
189
194
|
};
|
|
190
195
|
(0, _react2.useEffect)(() => {
|
|
191
|
-
var _props$
|
|
196
|
+
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch, _state$appStates5;
|
|
192
197
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
193
198
|
state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
|
|
194
199
|
setupClientDataStore();
|
|
@@ -200,17 +205,17 @@ const LiveChatWidgetStateful = props => {
|
|
|
200
205
|
});
|
|
201
206
|
dispatch({
|
|
202
207
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY,
|
|
203
|
-
payload: ((_props$
|
|
208
|
+
payload: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.hideStartChatButton) || false
|
|
204
209
|
});
|
|
205
210
|
dispatch({
|
|
206
211
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
207
212
|
payload: false
|
|
208
213
|
});
|
|
209
|
-
if ((_props$
|
|
210
|
-
var _props$
|
|
214
|
+
if ((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.widgetInstanceId && !(0, _utils.isNullOrEmptyString)((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.widgetInstanceId)) {
|
|
215
|
+
var _props$controlProps8;
|
|
211
216
|
dispatch({
|
|
212
217
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID,
|
|
213
|
-
payload: (_props$
|
|
218
|
+
payload: (_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.widgetInstanceId
|
|
214
219
|
});
|
|
215
220
|
}
|
|
216
221
|
if (((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_callingoptions) !== _Constants.E2VVOptions.NoCalling) {
|
|
@@ -229,7 +234,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
// Initialize global dir
|
|
232
|
-
const globalDir = ((_props$
|
|
237
|
+
const globalDir = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.dir) ?? (0, _utils.getLocaleDirection)((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Ch = _props$chatConfig2.ChatWidgetLanguage) === null || _props$chatConfig2$Ch === void 0 ? void 0 : _props$chatConfig2$Ch.msdyn_localeid);
|
|
233
238
|
dispatch({
|
|
234
239
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
235
240
|
payload: globalDir
|
|
@@ -265,7 +270,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
265
270
|
|
|
266
271
|
// useEffect for custom context
|
|
267
272
|
(0, _react2.useEffect)(() => {
|
|
268
|
-
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$
|
|
273
|
+
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$controlProps11;
|
|
269
274
|
// Add the custom context on receiving the SetCustomContext event
|
|
270
275
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
271
276
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -298,8 +303,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
298
303
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.HideChatVisibilityChangeEvent).subscribe(async event => {
|
|
299
304
|
var _event$payload;
|
|
300
305
|
if ((event === null || event === void 0 ? void 0 : (_event$payload = event.payload) === null || _event$payload === void 0 ? void 0 : _event$payload.isChatHidden) !== undefined) {
|
|
301
|
-
var _props$
|
|
302
|
-
if ((_props$
|
|
306
|
+
var _props$controlProps10;
|
|
307
|
+
if ((_props$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.hideStartChatButton) {
|
|
303
308
|
var _event$payload2;
|
|
304
309
|
dispatch({
|
|
305
310
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -422,7 +427,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
422
427
|
});
|
|
423
428
|
|
|
424
429
|
// Listen to end chat event from other tabs
|
|
425
|
-
const endChatEventName = (0, _utils.getWidgetEndChatEventName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$
|
|
430
|
+
const endChatEventName = (0, _utils.getWidgetEndChatEventName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
426
431
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
427
432
|
var _msg$payload9;
|
|
428
433
|
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
@@ -654,7 +659,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
654
659
|
};
|
|
655
660
|
const chatWidgetDraggableConfig = {
|
|
656
661
|
elementId: widgetElementId,
|
|
657
|
-
channel: ((_props$
|
|
662
|
+
channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
|
|
658
663
|
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
|
|
659
664
|
};
|
|
660
665
|
|
|
@@ -55,13 +55,11 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
const WebChatContainerStateful = props => {
|
|
58
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _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;
|
|
59
59
|
const {
|
|
60
60
|
BasicWebChat
|
|
61
61
|
} = _botframeworkWebchat.Components;
|
|
62
62
|
const [state, dispatch] = (0, _.useChatContextStore)();
|
|
63
|
-
const magicCodeBroadcastChannel = new window.BroadcastChannel(_Constants.Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
64
|
-
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(_Constants.Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
65
63
|
const {
|
|
66
64
|
webChatContainerProps,
|
|
67
65
|
contextDataStore
|
|
@@ -69,7 +67,7 @@ const WebChatContainerStateful = props => {
|
|
|
69
67
|
const containerStyles = {
|
|
70
68
|
root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
71
69
|
display: state.appStates.isMinimized ? "none" : ""
|
|
72
|
-
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
70
|
+
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
73
71
|
};
|
|
74
72
|
|
|
75
73
|
const localizedTexts = {
|
|
@@ -103,6 +101,21 @@ const WebChatContainerStateful = props => {
|
|
|
103
101
|
}
|
|
104
102
|
}, []);
|
|
105
103
|
(0, _react2.useEffect)(() => {
|
|
104
|
+
var _props$webChatContain3, _props$webChatContain4;
|
|
105
|
+
if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain4 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!window.BroadcastChannel) {
|
|
109
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
110
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
111
|
+
Event: _TelemetryConstants.TelemetryEvent.SuppressBotMagicCodeFailed,
|
|
112
|
+
Description: "BroadcastChannel not supported by default on current browser"
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const magicCodeBroadcastChannel = new window.BroadcastChannel(_Constants.Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
117
|
+
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(_Constants.Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
118
|
+
|
|
106
119
|
const eventListener = event => {
|
|
107
120
|
// eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
|
|
108
121
|
const {
|
|
@@ -156,8 +169,8 @@ const WebChatContainerStateful = props => {
|
|
|
156
169
|
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
157
170
|
|
|
158
171
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
159
|
-
background-color: ${((_props$
|
|
160
|
-
color:${((_props$
|
|
172
|
+
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
173
|
+
color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
161
174
|
}
|
|
162
175
|
|
|
163
176
|
div[class="ac-textBlock"] a:link,
|
|
@@ -165,11 +178,11 @@ const WebChatContainerStateful = props => {
|
|
|
165
178
|
div[class="ac-textBlock"] a:hover,
|
|
166
179
|
div[class="ac-textBlock"] a:active {
|
|
167
180
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
|
|
168
|
-
}
|
|
181
|
+
}
|
|
169
182
|
|
|
170
183
|
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
171
184
|
|
|
172
|
-
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
185
|
+
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
173
186
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
174
187
|
height: '.75em';
|
|
175
188
|
marginLeft: '.25em';
|
|
@@ -187,7 +200,7 @@ const WebChatContainerStateful = props => {
|
|
|
187
200
|
.ms_lcw_webchat_received_message a:hover,
|
|
188
201
|
.ms_lcw_webchat_received_message a:active {
|
|
189
202
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
|
|
190
|
-
}
|
|
203
|
+
}
|
|
191
204
|
.ms_lcw_webchat_sent_message a:link,
|
|
192
205
|
.ms_lcw_webchat_sent_message a:visited,
|
|
193
206
|
.ms_lcw_webchat_sent_message a:hover,
|
|
@@ -32,6 +32,8 @@ const defaultMiddlewareLocalizedTexts = {
|
|
|
32
32
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
33
33
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
34
34
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
|
|
35
|
-
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware."
|
|
35
|
+
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
36
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
37
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|
|
36
38
|
};
|
|
37
39
|
exports.defaultMiddlewareLocalizedTexts = defaultMiddlewareLocalizedTexts;
|
package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.NotificationScenarios = NotificationScenarios;
|
|
|
10
10
|
NotificationScenarios["Connection"] = "connection";
|
|
11
11
|
NotificationScenarios["DownloadTranscriptError"] = "download transcript";
|
|
12
12
|
NotificationScenarios["EmailTranscriptError"] = "email transcript";
|
|
13
|
+
NotificationScenarios["EmailAddressSaved"] = "email address saved";
|
|
13
14
|
NotificationScenarios["AttachmentError"] = "attachment";
|
|
14
15
|
NotificationScenarios["InternetConnection"] = "internet connection";
|
|
15
16
|
NotificationScenarios["MaxSizeError"] = "max size";
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -396,4 +396,20 @@ export const createFileAndDownload = (fileName, blobData, mimeType) => {
|
|
|
396
396
|
document.body.appendChild(aElement);
|
|
397
397
|
aElement.click();
|
|
398
398
|
document.body.removeChild(aElement);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
*
|
|
403
|
+
* Replace placeholders with format {0}..{n} , in a string with values
|
|
404
|
+
*
|
|
405
|
+
* @param template String with placeholders to be replaced
|
|
406
|
+
* @param values array of values to replace the placeholders
|
|
407
|
+
* @returns formatted string with replaced values
|
|
408
|
+
*/
|
|
409
|
+
// use of any for values as array of any type is passed
|
|
410
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
411
|
+
export const formatTemplateString = (templateMessage, values) => {
|
|
412
|
+
return templateMessage.replace(/{(\d+)}/g, (match, index) => {
|
|
413
|
+
return typeof values[index] !== "undefined" ? values[index] : match;
|
|
414
|
+
});
|
|
399
415
|
};
|
|
@@ -56,17 +56,14 @@ export const ChatButtonStateful = props => {
|
|
|
56
56
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
57
57
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
58
58
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
payload: ConversationState.OutOfOffice
|
|
68
|
-
});
|
|
69
|
-
}
|
|
59
|
+
state.appStates.isMinimized && dispatch({
|
|
60
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
61
|
+
payload: false
|
|
62
|
+
});
|
|
63
|
+
dispatch({
|
|
64
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
65
|
+
payload: ConversationState.OutOfOffice
|
|
66
|
+
});
|
|
70
67
|
},
|
|
71
68
|
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
72
69
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
|
-
import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
|
|
3
|
+
import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, formatTemplateString, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
|
|
4
4
|
import { DimLayer } from "../dimlayer/DimLayer";
|
|
5
5
|
import { InputValidationPane } from "@microsoft/omnichannel-chat-components";
|
|
6
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
@@ -10,6 +10,7 @@ import { Regex } from "../../common/Constants";
|
|
|
10
10
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
12
|
import useChatSDKStore from "../../hooks/useChatSDKStore";
|
|
13
|
+
import { defaultMiddlewareLocalizedTexts } from "../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
13
14
|
export const EmailTranscriptPaneStateful = props => {
|
|
14
15
|
var _props$controlProps;
|
|
15
16
|
const initialTabIndexMap = new Map();
|
|
@@ -46,6 +47,7 @@ export const EmailTranscriptPaneStateful = props => {
|
|
|
46
47
|
};
|
|
47
48
|
try {
|
|
48
49
|
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
|
|
50
|
+
NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
49
51
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
50
52
|
Event: TelemetryEvent.EmailTranscriptSent,
|
|
51
53
|
Description: "Transcript sent to email successfully."
|
|
@@ -57,7 +59,8 @@ export const EmailTranscriptPaneStateful = props => {
|
|
|
57
59
|
exception: ex
|
|
58
60
|
}
|
|
59
61
|
});
|
|
60
|
-
|
|
62
|
+
const message = formatTemplateString(defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
63
|
+
NotificationHandler.notifyError(NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
61
64
|
}
|
|
62
65
|
},
|
|
63
66
|
onCancel: () => {
|
|
@@ -7,7 +7,8 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
|
7
7
|
const handleChatDisconnect = (props, state, setWebChatStyles) => {
|
|
8
8
|
var _state$appStates;
|
|
9
9
|
if (state !== null && state !== void 0 && (_state$appStates = state.appStates) !== null && _state$appStates !== void 0 && _state$appStates.chatDisconnectEventReceived) {
|
|
10
|
-
var _props$webChatContain, _props$webChatContain2;
|
|
10
|
+
var _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
|
|
11
|
+
const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
|
|
11
12
|
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
|
|
12
13
|
setWebChatStyles(styles => {
|
|
13
14
|
return {
|
|
@@ -16,7 +17,7 @@ const handleChatDisconnect = (props, state, setWebChatStyles) => {
|
|
|
16
17
|
};
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect,
|
|
20
|
+
NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
|
|
20
21
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
21
22
|
Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
22
23
|
Description: "Chat disconnected due to timeout, left or removed."
|
|
@@ -12,15 +12,13 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
13
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
14
14
|
var _props$chatConfig, _props$chatConfig$Liv;
|
|
15
|
-
if (!isReconnectEnabled(props.chatConfig) || isPersistentEnabled(props.chatConfig)) return false;
|
|
16
|
-
|
|
17
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
16
|
const isAuthenticatedChat = (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
19
17
|
|
|
20
18
|
// Get chat reconnect context
|
|
21
19
|
const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
|
|
22
20
|
|
|
23
|
-
//Redirect if enabled
|
|
21
|
+
// Redirect if enabled
|
|
24
22
|
if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
|
|
25
23
|
var _props$reconnectChatP;
|
|
26
24
|
redirectPage(reconnectChatContext.redirectURL, (_props$reconnectChatP = props.reconnectChatPaneProps) === null || _props$reconnectChatP === void 0 ? void 0 : _props$reconnectChatP.redirectInSameWindow);
|
|
@@ -12,7 +12,7 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
|
12
12
|
import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
13
13
|
import { createAdapter } from "./createAdapter";
|
|
14
14
|
import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
|
|
15
|
-
import { handleChatReconnect } from "./reconnectChatHelper";
|
|
15
|
+
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
|
|
16
16
|
import { setPostChatContextAndLoadSurvey } from "./setPostChatContextAndLoadSurvey";
|
|
17
17
|
import { updateSessionDataForTelemetry } from "./updateSessionDataForTelemetry";
|
|
18
18
|
|
|
@@ -29,7 +29,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
29
29
|
widgetInstanceId = getWidgetCacheIdfromProps(props);
|
|
30
30
|
|
|
31
31
|
// reconnect > chat from cache
|
|
32
|
-
|
|
32
|
+
if (isReconnectEnabled(props.chatConfig) === true && !isPersistentEnabled(props.chatConfig)) {
|
|
33
|
+
const shouldStartChatNormally = await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
34
|
+
if (!shouldStartChatNormally) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
34
40
|
if (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.ReconnectChat) {
|
|
35
41
|
return;
|
|
@@ -63,15 +69,29 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
63
69
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
64
70
|
const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
|
|
65
71
|
if (showPrechat) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
var _state$domainStates, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3;
|
|
73
|
+
const isOutOfOperatingHours = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : (_state$domainStates$l3 = _state$domainStates$l2.OutOfOperatingHours) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.toLowerCase()) === "true";
|
|
74
|
+
if (isOutOfOperatingHours) {
|
|
75
|
+
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
76
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
77
|
+
payload: false
|
|
78
|
+
});
|
|
79
|
+
dispatch({
|
|
80
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
81
|
+
payload: ConversationState.OutOfOffice
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
} else {
|
|
85
|
+
dispatch({
|
|
86
|
+
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
87
|
+
payload: preChatSurveyResponse
|
|
88
|
+
});
|
|
89
|
+
dispatch({
|
|
90
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
91
|
+
payload: ConversationState.Prechat
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
75
95
|
}
|
|
76
96
|
|
|
77
97
|
//Initiate start chat
|
|
@@ -295,17 +315,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
295
315
|
|
|
296
316
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
317
|
const setCustomContextParams = async (state, props) => {
|
|
298
|
-
var _props$chatConfig, _props$chatConfig$Liv, _state$
|
|
318
|
+
var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates2, _persistedState$domai8;
|
|
299
319
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
320
|
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;
|
|
301
321
|
//Should not set custom context for auth chat
|
|
302
322
|
if (isAuthenticatedChat) {
|
|
303
323
|
return;
|
|
304
324
|
}
|
|
305
|
-
if (state !== null && state !== void 0 && (_state$
|
|
306
|
-
var _state$
|
|
325
|
+
if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.customContext) {
|
|
326
|
+
var _state$domainStates3;
|
|
307
327
|
optionalParams = Object.assign({}, optionalParams, {
|
|
308
|
-
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$
|
|
328
|
+
customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.customContext))
|
|
309
329
|
});
|
|
310
330
|
return;
|
|
311
331
|
}
|
|
@@ -353,8 +373,8 @@ const canStartPopoutChat = async props => {
|
|
|
353
373
|
|
|
354
374
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
355
375
|
const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
356
|
-
var _state$
|
|
357
|
-
const requestIdFromCache = (_state$
|
|
376
|
+
var _state$domainStates4, _state$domainStates4$;
|
|
377
|
+
const requestIdFromCache = (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.liveChatContext) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.requestId;
|
|
358
378
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
359
379
|
let conversationDetails = undefined;
|
|
360
380
|
|
|
@@ -53,7 +53,7 @@ import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
|
53
53
|
import { defaultAdaptiveCardStyles } from "../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles";
|
|
54
54
|
import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
|
|
55
55
|
export const LiveChatWidgetStateful = props => {
|
|
56
|
-
var _props$webChatContain, _props$styleProps,
|
|
56
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$webChatContain10, _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$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
57
57
|
const [state, dispatch] = useChatContextStore();
|
|
58
58
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
59
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -77,10 +77,15 @@ export const LiveChatWidgetStateful = props => {
|
|
|
77
77
|
|
|
78
78
|
//Scrollbar styles
|
|
79
79
|
const scrollbarProps = Object.assign({}, defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
|
|
81
|
+
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
82
|
+
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
83
|
+
var _chatSDK$omnichannelC, _props$controlProps2;
|
|
84
|
+
const broadcastServiceChannelName = getBroadcastChannelName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
85
|
+
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
86
|
+
}
|
|
82
87
|
TelemetryTimers.LcwLoadToChatButtonTimer = createTimer();
|
|
83
|
-
const widgetElementId = ((_props$
|
|
88
|
+
const widgetElementId = ((_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.id) || "oc-lcw";
|
|
84
89
|
const currentMessageCountRef = useRef(0);
|
|
85
90
|
let widgetStateEventId = "";
|
|
86
91
|
const lastLWICheckTimeRef = useRef(0);
|
|
@@ -170,8 +175,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
170
175
|
// Add default localStorage support for widget
|
|
171
176
|
const widgetCacheId = getWidgetCacheIdfromProps(props);
|
|
172
177
|
if (props.contextDataStore === undefined) {
|
|
173
|
-
var _props$
|
|
174
|
-
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$
|
|
178
|
+
var _props$controlProps4;
|
|
179
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.cacheTtlInMins) ?? Constants.CacheTtlInMinutes;
|
|
175
180
|
const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? StorageType.sessionStorage : StorageType.localStorage;
|
|
176
181
|
DataStoreManager.clientDataStore = defaultClientDataStoreProvider(cacheTtlInMins, storageType);
|
|
177
182
|
registerBroadcastServiceForStorage(widgetCacheId, cacheTtlInMins, storageType);
|
|
@@ -180,7 +185,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
180
185
|
}
|
|
181
186
|
};
|
|
182
187
|
useEffect(() => {
|
|
183
|
-
var _props$
|
|
188
|
+
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch, _state$appStates5;
|
|
184
189
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
185
190
|
state.domainStates.confirmationState = ConfirmationState.NotSet;
|
|
186
191
|
setupClientDataStore();
|
|
@@ -192,17 +197,17 @@ export const LiveChatWidgetStateful = props => {
|
|
|
192
197
|
});
|
|
193
198
|
dispatch({
|
|
194
199
|
type: LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY,
|
|
195
|
-
payload: ((_props$
|
|
200
|
+
payload: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.hideStartChatButton) || false
|
|
196
201
|
});
|
|
197
202
|
dispatch({
|
|
198
203
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
199
204
|
payload: false
|
|
200
205
|
});
|
|
201
|
-
if ((_props$
|
|
202
|
-
var _props$
|
|
206
|
+
if ((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.widgetInstanceId && !isNullOrEmptyString((_props$controlProps7 = props.controlProps) === null || _props$controlProps7 === void 0 ? void 0 : _props$controlProps7.widgetInstanceId)) {
|
|
207
|
+
var _props$controlProps8;
|
|
203
208
|
dispatch({
|
|
204
209
|
type: LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID,
|
|
205
|
-
payload: (_props$
|
|
210
|
+
payload: (_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.widgetInstanceId
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
213
|
if (((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_callingoptions) !== E2VVOptions.NoCalling) {
|
|
@@ -221,7 +226,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
221
226
|
}
|
|
222
227
|
|
|
223
228
|
// Initialize global dir
|
|
224
|
-
const globalDir = ((_props$
|
|
229
|
+
const globalDir = ((_props$controlProps9 = props.controlProps) === null || _props$controlProps9 === void 0 ? void 0 : _props$controlProps9.dir) ?? getLocaleDirection((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Ch = _props$chatConfig2.ChatWidgetLanguage) === null || _props$chatConfig2$Ch === void 0 ? void 0 : _props$chatConfig2$Ch.msdyn_localeid);
|
|
225
230
|
dispatch({
|
|
226
231
|
type: LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
227
232
|
payload: globalDir
|
|
@@ -257,7 +262,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
257
262
|
|
|
258
263
|
// useEffect for custom context
|
|
259
264
|
useEffect(() => {
|
|
260
|
-
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$
|
|
265
|
+
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$controlProps11;
|
|
261
266
|
// Add the custom context on receiving the SetCustomContext event
|
|
262
267
|
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
263
268
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -290,8 +295,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
290
295
|
BroadcastService.getMessageByEventName(BroadcastEvent.HideChatVisibilityChangeEvent).subscribe(async event => {
|
|
291
296
|
var _event$payload;
|
|
292
297
|
if ((event === null || event === void 0 ? void 0 : (_event$payload = event.payload) === null || _event$payload === void 0 ? void 0 : _event$payload.isChatHidden) !== undefined) {
|
|
293
|
-
var _props$
|
|
294
|
-
if ((_props$
|
|
298
|
+
var _props$controlProps10;
|
|
299
|
+
if ((_props$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.hideStartChatButton) {
|
|
295
300
|
var _event$payload2;
|
|
296
301
|
dispatch({
|
|
297
302
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -414,7 +419,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
414
419
|
});
|
|
415
420
|
|
|
416
421
|
// Listen to end chat event from other tabs
|
|
417
|
-
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$
|
|
422
|
+
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
418
423
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
419
424
|
var _msg$payload9;
|
|
420
425
|
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
@@ -646,7 +651,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
646
651
|
};
|
|
647
652
|
const chatWidgetDraggableConfig = {
|
|
648
653
|
elementId: widgetElementId,
|
|
649
|
-
channel: ((_props$
|
|
654
|
+
channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
|
|
650
655
|
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
|
|
651
656
|
};
|
|
652
657
|
|
|
@@ -47,13 +47,11 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export const WebChatContainerStateful = props => {
|
|
50
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _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;
|
|
51
51
|
const {
|
|
52
52
|
BasicWebChat
|
|
53
53
|
} = Components;
|
|
54
54
|
const [state, dispatch] = useChatContextStore();
|
|
55
|
-
const magicCodeBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
56
|
-
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
57
55
|
const {
|
|
58
56
|
webChatContainerProps,
|
|
59
57
|
contextDataStore
|
|
@@ -61,7 +59,7 @@ export const WebChatContainerStateful = props => {
|
|
|
61
59
|
const containerStyles = {
|
|
62
60
|
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
63
61
|
display: state.appStates.isMinimized ? "none" : ""
|
|
64
|
-
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
62
|
+
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
const localizedTexts = {
|
|
@@ -95,6 +93,21 @@ export const WebChatContainerStateful = props => {
|
|
|
95
93
|
}
|
|
96
94
|
}, []);
|
|
97
95
|
useEffect(() => {
|
|
96
|
+
var _props$webChatContain3, _props$webChatContain4;
|
|
97
|
+
if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain4 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!window.BroadcastChannel) {
|
|
101
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
102
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
103
|
+
Event: TelemetryEvent.SuppressBotMagicCodeFailed,
|
|
104
|
+
Description: "BroadcastChannel not supported by default on current browser"
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const magicCodeBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
109
|
+
const magicCodeResponseBroadcastChannel = new window.BroadcastChannel(Constants.magicCodeResponseBroadcastChannel); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
110
|
+
|
|
98
111
|
const eventListener = event => {
|
|
99
112
|
// eslint-disable-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-function
|
|
100
113
|
const {
|
|
@@ -148,8 +161,8 @@ export const WebChatContainerStateful = props => {
|
|
|
148
161
|
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
149
162
|
|
|
150
163
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
151
|
-
background-color: ${((_props$
|
|
152
|
-
color:${((_props$
|
|
164
|
+
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
165
|
+
color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
div[class="ac-textBlock"] a:link,
|
|
@@ -157,11 +170,11 @@ export const WebChatContainerStateful = props => {
|
|
|
157
170
|
div[class="ac-textBlock"] a:hover,
|
|
158
171
|
div[class="ac-textBlock"] a:active {
|
|
159
172
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
160
|
-
}
|
|
173
|
+
}
|
|
161
174
|
|
|
162
175
|
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
163
176
|
|
|
164
|
-
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
177
|
+
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
165
178
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
166
179
|
height: '.75em';
|
|
167
180
|
marginLeft: '.25em';
|
|
@@ -179,7 +192,7 @@ export const WebChatContainerStateful = props => {
|
|
|
179
192
|
.ms_lcw_webchat_received_message a:hover,
|
|
180
193
|
.ms_lcw_webchat_received_message a:active {
|
|
181
194
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
182
|
-
}
|
|
195
|
+
}
|
|
183
196
|
.ms_lcw_webchat_sent_message a:link,
|
|
184
197
|
.ms_lcw_webchat_sent_message a:visited,
|
|
185
198
|
.ms_lcw_webchat_sent_message a:hover,
|
|
@@ -26,5 +26,7 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
26
26
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
27
27
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
28
28
|
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
|
|
29
|
-
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware."
|
|
29
|
+
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
30
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
31
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|
|
30
32
|
};
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios.js
CHANGED
|
@@ -3,6 +3,7 @@ export let NotificationScenarios;
|
|
|
3
3
|
NotificationScenarios["Connection"] = "connection";
|
|
4
4
|
NotificationScenarios["DownloadTranscriptError"] = "download transcript";
|
|
5
5
|
NotificationScenarios["EmailTranscriptError"] = "email transcript";
|
|
6
|
+
NotificationScenarios["EmailAddressSaved"] = "email address saved";
|
|
6
7
|
NotificationScenarios["AttachmentError"] = "attachment";
|
|
7
8
|
NotificationScenarios["InternetConnection"] = "internet connection";
|
|
8
9
|
NotificationScenarios["MaxSizeError"] = "max size";
|
|
@@ -33,3 +33,12 @@ export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[])
|
|
|
33
33
|
export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
|
|
34
34
|
export declare const checkContactIdError: (e: any) => void;
|
|
35
35
|
export declare const createFileAndDownload: (fileName: string, blobData: string, mimeType: string) => void;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* Replace placeholders with format {0}..{n} , in a string with values
|
|
39
|
+
*
|
|
40
|
+
* @param template String with placeholders to be replaced
|
|
41
|
+
* @param values array of values to replace the placeholders
|
|
42
|
+
* @returns formatted string with replaced values
|
|
43
|
+
*/
|
|
44
|
+
export declare const formatTemplateString: (templateMessage: string, values: any) => string;
|
|
@@ -2,6 +2,7 @@ export declare enum NotificationScenarios {
|
|
|
2
2
|
Connection = "connection",
|
|
3
3
|
DownloadTranscriptError = "download transcript",
|
|
4
4
|
EmailTranscriptError = "email transcript",
|
|
5
|
+
EmailAddressSaved = "email address saved",
|
|
5
6
|
AttachmentError = "attachment",
|
|
6
7
|
InternetConnection = "internet connection",
|
|
7
8
|
MaxSizeError = "max size",
|
|
@@ -28,4 +28,13 @@ export interface ILiveChatWidgetLocalizedTexts {
|
|
|
28
28
|
* e.g. "{0} has been blocked because the file may contain a malware."
|
|
29
29
|
*/
|
|
30
30
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Success message, indicating the email address introduced has been registered to receive the transcript.
|
|
33
|
+
*/
|
|
34
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Error message, indicating the email address introduced couldnt be registered.
|
|
37
|
+
* {0} - e-mail address introduced
|
|
38
|
+
*/
|
|
39
|
+
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR?: string;
|
|
31
40
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"webpack-cli": "^4.9.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "^1.0.
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.5.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^1.0.9",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.5.7",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|