@microsoft/omnichannel-chat-widget 1.5.1-main.76c6a71 → 1.5.1-main.e2be12d
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 +10 -8
- package/lib/cjs/common/telemetry/TelemetryConstants.js +0 -2
- package/lib/cjs/common/utils.js +2 -1
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
- package/lib/cjs/components/livechatwidget/common/endChat.js +16 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +16 -84
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +198 -0
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +282 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -10
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +0 -8
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +1 -1
- package/lib/esm/common/Constants.js +7 -6
- package/lib/esm/common/telemetry/TelemetryConstants.js +0 -2
- package/lib/esm/common/utils.js +3 -2
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +31 -16
- package/lib/esm/components/livechatwidget/common/endChat.js +14 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +17 -85
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +191 -0
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +280 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +3 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +0 -8
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +1 -1
- package/lib/types/common/Constants.d.ts +8 -4
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +0 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +1 -0
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ import React, { useEffect, useRef, useState } from "react";
|
|
|
8
8
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
9
9
|
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
|
|
10
10
|
import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
11
|
-
import { endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
|
|
11
|
+
import { chatSDKStateCleanUp, endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
|
|
12
12
|
import { handleChatReconnect, isPersistentEnabled, 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";
|
|
@@ -51,7 +51,6 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
|
51
51
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
52
52
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
53
53
|
import { defaultAdaptiveCardStyles } from "../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles";
|
|
54
|
-
import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
|
|
55
54
|
export const LiveChatWidgetStateful = props => {
|
|
56
55
|
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
56
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -425,12 +424,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
425
424
|
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) {
|
|
426
425
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
427
426
|
endChatStateCleanUp(dispatch);
|
|
428
|
-
|
|
429
|
-
chatSDK.requestId = uuidv4();
|
|
430
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
431
|
-
chatSDK.chatToken = {};
|
|
432
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
-
chatSDK.reconnectId = null;
|
|
427
|
+
chatSDKStateCleanUp(chatSDK);
|
|
434
428
|
return;
|
|
435
429
|
}
|
|
436
430
|
});
|
|
@@ -608,9 +602,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
608
602
|
|
|
609
603
|
// Handle Chat disconnect cases
|
|
610
604
|
useEffect(() => {
|
|
611
|
-
|
|
612
|
-
handleChatDisconnect(props, state, setWebChatStyles);
|
|
613
|
-
}
|
|
605
|
+
handleChatDisconnect(props, state, setWebChatStyles);
|
|
614
606
|
}, [state.appStates.chatDisconnectEventReceived]);
|
|
615
607
|
const initiateEndChatOnBrowserUnload = () => {
|
|
616
608
|
var _DataStoreManager$cli;
|
|
@@ -11,7 +11,6 @@ import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/Teleme
|
|
|
11
11
|
import { Constants } from "../../../../../common/Constants";
|
|
12
12
|
import { DirectLineActivityType } from "../../enums/DirectLineActivityType";
|
|
13
13
|
import { DirectLineSenderRole } from "../../enums/DirectLineSenderRole";
|
|
14
|
-
import { MessageTypes } from "../../enums/MessageType";
|
|
15
14
|
import React from "react";
|
|
16
15
|
import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
|
|
17
16
|
import { defaultSystemMessageStyles } from "./defaultStyles/defaultSystemMessageStyles";
|
|
@@ -74,13 +73,6 @@ export const createActivityMiddleware = (systemMessageStyleProps, userMessageSty
|
|
|
74
73
|
if (card.activity) {
|
|
75
74
|
var _card$activity$from;
|
|
76
75
|
if (((_card$activity$from = card.activity.from) === null || _card$activity$from === void 0 ? void 0 : _card$activity$from.role) === DirectLineSenderRole.Channel) {
|
|
77
|
-
var _card$activity$channe3;
|
|
78
|
-
if (((_card$activity$channe3 = card.activity.channelData) === null || _card$activity$channe3 === void 0 ? void 0 : _card$activity$channe3.type) === MessageTypes.Thread) {
|
|
79
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
80
|
-
Event: TelemetryEvent.IC3ThreadUpdateEventReceived,
|
|
81
|
-
Description: "IC3 ThreadUpdateEvent Received"
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
76
|
return () => false;
|
|
85
77
|
}
|
|
86
78
|
if (isTagIncluded(card, Constants.hiddenTag)) {
|
|
@@ -20,7 +20,7 @@ describe("activityMiddleware test", () => {
|
|
|
20
20
|
};
|
|
21
21
|
const results = createActivityMiddleware()()(next)(args);
|
|
22
22
|
expect(results()).toEqual(false);
|
|
23
|
-
expect(TelemetryHelper.logActionEvent).toHaveBeenCalledTimes(
|
|
23
|
+
expect(TelemetryHelper.logActionEvent).toHaveBeenCalledTimes(0);
|
|
24
24
|
});
|
|
25
25
|
it("createActivityMiddleware() with Hidden tag should return nothing", () => {
|
|
26
26
|
spyOn(TelemetryHelper, "logActionEvent").and.callFake(() => false);
|
|
@@ -160,10 +160,6 @@ export declare class LocaleConstants {
|
|
|
160
160
|
export declare enum ElementType {
|
|
161
161
|
CallingContainerSDK = "CallingContainerSDK"
|
|
162
162
|
}
|
|
163
|
-
export declare enum ChatSDKError {
|
|
164
|
-
WidgetUseOutsideOperatingHour = "WidgetUseOutsideOperatingHour",
|
|
165
|
-
AuthContactIdNotFoundFailure = "AuthContactIdNotFoundFailure"
|
|
166
|
-
}
|
|
167
163
|
export declare enum EnvironmentVersion {
|
|
168
164
|
prod = "prod",
|
|
169
165
|
dogfood = "df",
|
|
@@ -241,3 +237,11 @@ export declare class AriaTelemetryConstants {
|
|
|
241
237
|
static readonly EU: string;
|
|
242
238
|
static readonly lcwEUDomainNames: Array<string>;
|
|
243
239
|
}
|
|
240
|
+
export declare class WidgetLoadTelemetryMessage {
|
|
241
|
+
static readonly OOOHMessage = "Widget is OOOH";
|
|
242
|
+
static readonly PersistedStateRetrievedMessage = "Persisted state retrieved";
|
|
243
|
+
}
|
|
244
|
+
export declare class WidgetLoadCustomErrorString {
|
|
245
|
+
static readonly AuthenticationFailedErrorString = "Authentication was not successful";
|
|
246
|
+
static readonly NetworkErrorString = "Network Error";
|
|
247
|
+
}
|
|
@@ -120,7 +120,6 @@ export declare enum TelemetryEvent {
|
|
|
120
120
|
ErrorUIPaneLoaded = "ErrorUIPaneLoaded",
|
|
121
121
|
DownloadTranscriptFailed = "DownloadTranscriptFailed",
|
|
122
122
|
StartChatFailed = "StartChatFailed",
|
|
123
|
-
IC3ThreadUpdateEventReceived = "IC3ThreadUpdateEventReceived",
|
|
124
123
|
ConfirmationCancelButtonClicked = "ConfirmationCancelButtonClicked",
|
|
125
124
|
ConfirmationConfirmButtonClicked = "ConfirmationConfirmButtonClicked",
|
|
126
125
|
LoadingPaneLoaded = "LoadingPaneLoaded",
|
|
@@ -4,8 +4,9 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
|
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any) => Promise<void>;
|
|
6
6
|
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined) => Promise<void>;
|
|
7
|
-
export declare const callingStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) =>
|
|
8
|
-
export declare const endChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) =>
|
|
9
|
-
export declare const closeChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) =>
|
|
7
|
+
export declare const callingStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
|
|
8
|
+
export declare const endChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
|
|
9
|
+
export declare const closeChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
|
|
10
|
+
export declare const chatSDKStateCleanUp: (chatSDK: any) => void;
|
|
10
11
|
export declare const endVoiceVideoCallIfOngoing: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
11
12
|
export { prepareEndChat, endChat };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
+
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
4
|
+
export declare const handleStartChatError: (dispatch: Dispatch<ILiveChatWidgetAction>, chatSDK: any, props: ILiveChatWidgetProps | undefined, ex: any, isStartChatSuccessful: boolean) => void;
|
|
5
|
+
export declare const logWidgetLoadComplete: (additionalMessage?: string | undefined) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.5.1-main.
|
|
3
|
+
"version": "1.5.1-main.e2be12d",
|
|
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.
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.6.1",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|