@microsoft/omnichannel-chat-widget 1.2.2-main.9c5ff6c → 1.2.2-main.ea7e6ed
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/Constants.js +1 -7
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +2 -12
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -2
- package/lib/esm/common/Constants.js +0 -5
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +2 -11
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +3 -3
- package/lib/types/common/Constants.d.ts +0 -4
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -2
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.StorageType = exports.Regex = exports.ParticipantType = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.
|
|
6
|
+
exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.StorageType = exports.Regex = exports.ParticipantType = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.ConversationEndEntity = exports.Constants = exports.ConfirmationState = exports.ChatSDKError = exports.AriaTelemetryConstants = exports.AMSConstants = void 0;
|
|
7
7
|
var _class;
|
|
8
8
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
@@ -208,12 +208,6 @@ exports.E2VVOptions = E2VVOptions;
|
|
|
208
208
|
E2VVOptions["VideoAndVoiceCalling"] = "192350001";
|
|
209
209
|
E2VVOptions["VoiceOnly"] = "192350002";
|
|
210
210
|
})(E2VVOptions || (exports.E2VVOptions = E2VVOptions = {}));
|
|
211
|
-
let ConversationMode;
|
|
212
|
-
exports.ConversationMode = ConversationMode;
|
|
213
|
-
(function (ConversationMode) {
|
|
214
|
-
ConversationMode["Regular"] = "192350000";
|
|
215
|
-
ConversationMode["Persistent"] = "192350001";
|
|
216
|
-
})(ConversationMode || (exports.ConversationMode = ConversationMode = {}));
|
|
217
211
|
let LiveWorkItemState;
|
|
218
212
|
exports.LiveWorkItemState = LiveWorkItemState;
|
|
219
213
|
(function (LiveWorkItemState) {
|
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isReconnectEnabled = exports.
|
|
6
|
+
exports.isReconnectEnabled = exports.handleChatReconnect = exports.getChatReconnectContext = void 0;
|
|
7
7
|
require("regenerator-runtime/runtime");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _utils = require("../../../common/utils");
|
|
10
10
|
var _authHelper = require("./authHelper");
|
|
11
11
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
12
|
-
var _Constants = require("../../../common/Constants");
|
|
13
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
14
13
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
14
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
16
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
16
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
18
17
|
var _props$chatConfig, _props$chatConfig$Liv;
|
|
19
|
-
if (!isReconnectEnabled(props.chatConfig)
|
|
18
|
+
if (!isReconnectEnabled(props.chatConfig)) return;
|
|
20
19
|
|
|
21
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
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;
|
|
@@ -129,15 +128,6 @@ const isReconnectEnabled = chatConfig => {
|
|
|
129
128
|
return false;
|
|
130
129
|
};
|
|
131
130
|
exports.isReconnectEnabled = isReconnectEnabled;
|
|
132
|
-
const isPersistentEnabled = chatConfig => {
|
|
133
|
-
if (chatConfig) {
|
|
134
|
-
var _chatConfig$LiveWSAnd3, _chatConfig$LiveWSAnd4;
|
|
135
|
-
const persistentEnabled = ((_chatConfig$LiveWSAnd3 = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd3 === void 0 ? void 0 : (_chatConfig$LiveWSAnd4 = _chatConfig$LiveWSAnd3.msdyn_conversationmode) === null || _chatConfig$LiveWSAnd4 === void 0 ? void 0 : _chatConfig$LiveWSAnd4.toLowerCase()) === _Constants.ConversationMode.Persistent;
|
|
136
|
-
return persistentEnabled;
|
|
137
|
-
}
|
|
138
|
-
return false;
|
|
139
|
-
};
|
|
140
|
-
exports.isPersistentEnabled = isPersistentEnabled;
|
|
141
131
|
const hasReconnectId = reconnectAvailabilityResponse => {
|
|
142
132
|
return reconnectAvailabilityResponse && !(0, _utils.isNullOrUndefined)(reconnectAvailabilityResponse.reconnectId);
|
|
143
133
|
};
|
|
@@ -131,7 +131,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
131
131
|
isChatValid = await (0, _startChat.checkIfConversationStillValid)(chatSDK, dispatch, state);
|
|
132
132
|
if (isChatValid === true) {
|
|
133
133
|
//Check if reconnect enabled
|
|
134
|
-
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true
|
|
134
|
+
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true) {
|
|
135
135
|
await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, _startChat.initStartChat, state);
|
|
136
136
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
137
137
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat) {
|
|
@@ -145,7 +145,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
145
145
|
if (isChatValid === false) {
|
|
146
146
|
if (localState) {
|
|
147
147
|
// adding the reconnect logic for the case when customer tries to reconnect from a new browser or InPrivate browser
|
|
148
|
-
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true
|
|
148
|
+
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true) {
|
|
149
149
|
await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, _startChat.initStartChat, state);
|
|
150
150
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
151
151
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat) {
|
|
@@ -188,11 +188,6 @@ export let E2VVOptions;
|
|
|
188
188
|
E2VVOptions["VideoAndVoiceCalling"] = "192350001";
|
|
189
189
|
E2VVOptions["VoiceOnly"] = "192350002";
|
|
190
190
|
})(E2VVOptions || (E2VVOptions = {}));
|
|
191
|
-
export let ConversationMode;
|
|
192
|
-
(function (ConversationMode) {
|
|
193
|
-
ConversationMode["Regular"] = "192350000";
|
|
194
|
-
ConversationMode["Persistent"] = "192350001";
|
|
195
|
-
})(ConversationMode || (ConversationMode = {}));
|
|
196
191
|
export let LiveWorkItemState;
|
|
197
192
|
(function (LiveWorkItemState) {
|
|
198
193
|
LiveWorkItemState["Active"] = "Active";
|
|
@@ -3,7 +3,6 @@ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/teleme
|
|
|
3
3
|
import { checkContactIdError, isNullOrEmptyString, isNullOrUndefined } from "../../../common/utils";
|
|
4
4
|
import { handleAuthentication, removeAuthTokenProvider } from "./authHelper";
|
|
5
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
6
|
-
import { ConversationMode } from "../../../common/Constants";
|
|
7
6
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
8
7
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
9
8
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
@@ -11,7 +10,7 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
11
|
const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
|
|
13
12
|
var _props$chatConfig, _props$chatConfig$Liv;
|
|
14
|
-
if (!isReconnectEnabled(props.chatConfig)
|
|
13
|
+
if (!isReconnectEnabled(props.chatConfig)) return;
|
|
15
14
|
|
|
16
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
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;
|
|
@@ -121,15 +120,7 @@ const isReconnectEnabled = chatConfig => {
|
|
|
121
120
|
}
|
|
122
121
|
return false;
|
|
123
122
|
};
|
|
124
|
-
const isPersistentEnabled = chatConfig => {
|
|
125
|
-
if (chatConfig) {
|
|
126
|
-
var _chatConfig$LiveWSAnd3, _chatConfig$LiveWSAnd4;
|
|
127
|
-
const persistentEnabled = ((_chatConfig$LiveWSAnd3 = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd3 === void 0 ? void 0 : (_chatConfig$LiveWSAnd4 = _chatConfig$LiveWSAnd3.msdyn_conversationmode) === null || _chatConfig$LiveWSAnd4 === void 0 ? void 0 : _chatConfig$LiveWSAnd4.toLowerCase()) === ConversationMode.Persistent;
|
|
128
|
-
return persistentEnabled;
|
|
129
|
-
}
|
|
130
|
-
return false;
|
|
131
|
-
};
|
|
132
123
|
const hasReconnectId = reconnectAvailabilityResponse => {
|
|
133
124
|
return reconnectAvailabilityResponse && !isNullOrUndefined(reconnectAvailabilityResponse.reconnectId);
|
|
134
125
|
};
|
|
135
|
-
export { handleChatReconnect, isReconnectEnabled,
|
|
126
|
+
export { handleChatReconnect, isReconnectEnabled, getChatReconnectContext };
|
|
@@ -9,7 +9,7 @@ import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreC
|
|
|
9
9
|
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty, newGuid } from "../../../common/utils";
|
|
10
10
|
import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
11
11
|
import { endChat, prepareEndChat } from "../common/endChat";
|
|
12
|
-
import { handleChatReconnect,
|
|
12
|
+
import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
13
13
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
14
14
|
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
15
15
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
@@ -123,7 +123,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
123
123
|
isChatValid = await checkIfConversationStillValid(chatSDK, dispatch, state);
|
|
124
124
|
if (isChatValid === true) {
|
|
125
125
|
//Check if reconnect enabled
|
|
126
|
-
if (isReconnectEnabled(props.chatConfig) === true
|
|
126
|
+
if (isReconnectEnabled(props.chatConfig) === true) {
|
|
127
127
|
await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
128
128
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
129
129
|
if (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.ReconnectChat) {
|
|
@@ -137,7 +137,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
137
137
|
if (isChatValid === false) {
|
|
138
138
|
if (localState) {
|
|
139
139
|
// adding the reconnect logic for the case when customer tries to reconnect from a new browser or InPrivate browser
|
|
140
|
-
if (isReconnectEnabled(props.chatConfig) === true
|
|
140
|
+
if (isReconnectEnabled(props.chatConfig) === true) {
|
|
141
141
|
await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
142
142
|
// If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
|
|
143
143
|
if (state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.ReconnectChat) {
|
|
@@ -171,10 +171,6 @@ export declare enum E2VVOptions {
|
|
|
171
171
|
VideoAndVoiceCalling = "192350001",
|
|
172
172
|
VoiceOnly = "192350002"
|
|
173
173
|
}
|
|
174
|
-
export declare enum ConversationMode {
|
|
175
|
-
Regular = "192350000",
|
|
176
|
-
Persistent = "192350001"
|
|
177
|
-
}
|
|
178
174
|
export declare enum LiveWorkItemState {
|
|
179
175
|
Active = "Active",
|
|
180
176
|
Closed = "Closed",
|
|
@@ -6,5 +6,4 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
|
|
|
6
6
|
declare const handleChatReconnect: (chatSDK: any, props: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<void>;
|
|
7
7
|
declare const getChatReconnectContext: (chatSDK: any, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean) => Promise<any>;
|
|
8
8
|
declare const isReconnectEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
|
|
9
|
-
|
|
10
|
-
export { handleChatReconnect, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
|
|
9
|
+
export { handleChatReconnect, isReconnectEnabled, getChatReconnectContext };
|