@microsoft/omnichannel-chat-widget 1.4.1-main.9949bfd → 1.4.1-main.a860a86
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/chatDisconnectHelper.js +3 -2
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -2
- package/lib/cjs/components/livechatwidget/common/startChat.js +7 -1
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +0 -2
- package/lib/esm/components/livechatwidget/common/startChat.js +8 -2
- package/package.json +2 -2
|
@@ -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,8 +17,6 @@ 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
|
|
|
@@ -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;
|
|
@@ -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,8 +12,6 @@ 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
|
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.4.1-main.
|
|
3
|
+
"version": "1.4.1-main.a860a86",
|
|
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.0.9",
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.5.
|
|
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",
|