@microsoft/omnichannel-chat-widget 1.5.1-main.e2be12d → 1.6.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/lib/cjs/common/Constants.js +23 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +25 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +35 -13
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +50 -6
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +82 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +15 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +17 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
- package/lib/cjs/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -3
- package/lib/cjs/contexts/common/ConversationState.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +37 -36
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
- package/lib/cjs/contexts/common/StartChatFailureType.js +13 -0
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/cjs/controller/componentController.js +5 -1
- package/lib/esm/common/Constants.js +20 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +26 -4
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +36 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -8
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +71 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.js +8 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.js +10 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js +1 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.js +1 -0
- package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -3
- package/lib/esm/contexts/common/ConversationState.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +37 -36
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -1
- package/lib/esm/contexts/common/StartChatFailureType.js +6 -0
- package/lib/esm/contexts/createReducer.js +8 -0
- package/lib/esm/controller/componentController.js +3 -0
- package/lib/types/common/Constants.d.ts +21 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -1
- package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +3 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneGeneralStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconImageProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneIconStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneSubtitleStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/common/defaultStartChatErrorPaneTitleStyleProps.d.ts +2 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.d.ts +5 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.d.ts +6 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +14 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +8 -0
- package/lib/types/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.d.ts +10 -0
- package/lib/types/contexts/common/ConversationState.d.ts +2 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +37 -36
- package/lib/types/contexts/common/StartChatFailureType.d.ts +5 -0
- package/lib/types/controller/componentController.d.ts +1 -0
- package/package.json +5 -5
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -71
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -56
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -282
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -190
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -82
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -342
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.js +0 -69
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.js +0 -54
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.spec.js +0 -280
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.js +0 -188
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +0 -80
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.js +0 -338
- package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.spec.d.ts +0 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.spec.d.ts +0 -1
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.spec.d.ts +0 -1
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.d.ts +0 -4
- package/lib/types/components/loadingpanestateful/interfaces/IStartChatErrorPaneProps.d.ts +0 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.spec.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.spec.d.ts +0 -1
- /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
- /package/lib/cjs/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
- /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneControlProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneClassNames.js} +0 -0
- /package/lib/esm/components/{loadingpanestateful/interfaces/IStartChatErrorPaneProps.js → startchaterrorpanestateful/interfaces/IStartChatErrorPaneComponentOverrides.js} +0 -0
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Components } from "botframework-webchat";
|
|
5
|
-
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, StorageType } from "../../../common/Constants";
|
|
5
|
+
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType } from "../../../common/Constants";
|
|
6
6
|
import { Stack } from "@fluentui/react";
|
|
7
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
8
8
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
@@ -10,7 +10,7 @@ import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLo
|
|
|
10
10
|
import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
11
11
|
import { chatSDKStateCleanUp, endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
|
|
12
12
|
import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
13
|
-
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
13
|
+
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowStartChatErrorPane, 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";
|
|
16
16
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
@@ -51,8 +51,10 @@ 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 StartChatErrorPaneStateful from "../../startchaterrorpanestateful/StartChatErrorPaneStateful";
|
|
55
|
+
import { StartChatFailureType } from "../../../contexts/common/StartChatFailureType";
|
|
54
56
|
export const LiveChatWidgetStateful = props => {
|
|
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$
|
|
57
|
+
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$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
56
58
|
const [state, dispatch] = useChatContextStore();
|
|
57
59
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
60
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -185,6 +187,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
185
187
|
};
|
|
186
188
|
useEffect(() => {
|
|
187
189
|
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch, _state$appStates5;
|
|
190
|
+
dispatch({
|
|
191
|
+
type: LiveChatWidgetActionType.SET_START_CHAT_FAILING,
|
|
192
|
+
payload: false
|
|
193
|
+
});
|
|
194
|
+
dispatch({
|
|
195
|
+
type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
|
|
196
|
+
payload: StartChatFailureType.Generic
|
|
197
|
+
});
|
|
188
198
|
state.domainStates.confirmationPaneConfirmedOptionClicked = false;
|
|
189
199
|
state.domainStates.confirmationState = ConfirmationState.NotSet;
|
|
190
200
|
setupClientDataStore();
|
|
@@ -395,9 +405,23 @@ export const LiveChatWidgetStateful = props => {
|
|
|
395
405
|
|
|
396
406
|
// End chat
|
|
397
407
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
408
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
409
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
410
|
+
Description: "Received InitiateEndChat BroadcastEvent."
|
|
411
|
+
});
|
|
412
|
+
|
|
398
413
|
// This is to ensure to get latest state from cache in multitab
|
|
399
414
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
400
415
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
416
|
+
// We need to simulate states for closing chat, in order to messup with close confirmation pane.
|
|
417
|
+
dispatch({
|
|
418
|
+
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
419
|
+
payload: ConfirmationState.Ok
|
|
420
|
+
});
|
|
421
|
+
dispatch({
|
|
422
|
+
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
423
|
+
payload: false
|
|
424
|
+
});
|
|
401
425
|
dispatch({
|
|
402
426
|
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
403
427
|
payload: ConversationEndEntity.Customer
|
|
@@ -405,6 +429,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
405
429
|
} else {
|
|
406
430
|
const skipEndChatSDK = true;
|
|
407
431
|
const skipCloseChat = false;
|
|
432
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
433
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
434
|
+
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
435
|
+
});
|
|
408
436
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
409
437
|
}
|
|
410
438
|
BroadcastService.postMessage({
|
|
@@ -422,6 +450,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
422
450
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
423
451
|
var _msg$payload9;
|
|
424
452
|
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) {
|
|
453
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
454
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
455
|
+
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
456
|
+
});
|
|
425
457
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
426
458
|
endChatStateCleanUp(dispatch);
|
|
427
459
|
chatSDKStateCleanUp(chatSDK);
|
|
@@ -552,12 +584,20 @@ export const LiveChatWidgetStateful = props => {
|
|
|
552
584
|
|
|
553
585
|
// If start chat failed, and C2 is trying to close chat widget
|
|
554
586
|
if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed || (state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === ConversationState.Postchat) {
|
|
587
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
588
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
589
|
+
Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
590
|
+
});
|
|
555
591
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
|
|
556
592
|
return;
|
|
557
593
|
}
|
|
558
594
|
|
|
559
595
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
560
596
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === ConversationState.InActive) {
|
|
597
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
598
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
599
|
+
Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
600
|
+
});
|
|
561
601
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
562
602
|
return;
|
|
563
603
|
}
|
|
@@ -610,6 +650,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
610
650
|
Event: TelemetryEvent.BrowserUnloadEventStarted,
|
|
611
651
|
Description: "Browser unload event received."
|
|
612
652
|
});
|
|
653
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
654
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
655
|
+
Description: PrepareEndChatDescriptionConstants.BrowserUnload
|
|
656
|
+
});
|
|
613
657
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
|
|
614
658
|
// Clean local storage
|
|
615
659
|
(_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
|
|
@@ -699,17 +743,17 @@ export const LiveChatWidgetStateful = props => {
|
|
|
699
743
|
}, headerDraggableConfig))), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
|
|
700
744
|
loadingPaneProps: livechatProps.loadingPaneProps,
|
|
701
745
|
startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
|
|
702
|
-
})), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.
|
|
746
|
+
})), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideErrorUIPane) && shouldShowStartChatErrorPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.startChatErrorPane) || /*#__PURE__*/React.createElement(StartChatErrorPaneStateful, livechatProps.startChatErrorPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro8 = livechatProps.controlProps) !== null && _livechatProps$contro8 !== void 0 && _livechatProps$contro8.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon7 = livechatProps.componentOverrides) === null || _livechatProps$compon7 === void 0 ? void 0 : _livechatProps$compon7.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
703
747
|
reconnectChatProps: livechatProps.reconnectChatPaneProps,
|
|
704
748
|
initStartChat: initStartChatRelay
|
|
705
|
-
})), !((_livechatProps$
|
|
749
|
+
})), !((_livechatProps$contro9 = livechatProps.controlProps) !== null && _livechatProps$contro9 !== void 0 && _livechatProps$contro9.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
706
750
|
surveyProps: livechatProps.preChatSurveyPaneProps,
|
|
707
751
|
initStartChat: initStartChatRelay
|
|
708
|
-
})), !((_livechatProps$
|
|
752
|
+
})), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
709
753
|
voiceVideoCallingSdk: voiceVideoCallingSDK
|
|
710
|
-
}, livechatProps.callingContainerProps)), !((_livechatProps$
|
|
754
|
+
}, livechatProps.callingContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
711
755
|
setPostChatContext: setPostChatContextRelay,
|
|
712
756
|
prepareEndChat: prepareEndChatRelay
|
|
713
|
-
}))), !((_livechatProps$
|
|
757
|
+
}))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
|
|
714
758
|
};
|
|
715
759
|
export default LiveChatWidgetStateful;
|
|
@@ -3,10 +3,10 @@ import React, { useEffect } from "react";
|
|
|
3
3
|
import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
5
5
|
import { defaultGeneralLoadingPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps";
|
|
6
|
-
import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
|
|
7
6
|
import { findAllFocusableElement } from "../../common/utils";
|
|
8
7
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
9
8
|
import useWindowDimensions from "../../hooks/useWindowDimensions";
|
|
9
|
+
import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
export const LoadingPaneStateful = props => {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
3
|
+
import { findAllFocusableElement } from "../../common/utils";
|
|
4
|
+
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
5
|
+
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
6
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
7
|
+
import { defaultStartChatErrorPaneGeneralStyleProps } from "./common/defaultStartChatErrorPaneGeneralStyleProps";
|
|
8
|
+
import { defaultStartChatErrorPaneTitleStyleProps } from "./common/defaultStartChatErrorPaneTitleStyleProps";
|
|
9
|
+
import { defaultStartChatErrorPaneSubtitleStyleProps } from "./common/defaultStartChatErrorPaneSubtitleStyleProps";
|
|
10
|
+
import { defaultStartChatErrorPaneIconStyleProps } from "./common/defaultStartChatErrorPaneIconStyleProps";
|
|
11
|
+
import { defaultStartChatErrorPaneIconImageStyleProps } from "./common/defaultStartChatErrorPaneIconImageProps";
|
|
12
|
+
import { StartChatErrorPaneConstants } from "../../common/Constants";
|
|
13
|
+
import { StartChatFailureType } from "../../contexts/common/StartChatFailureType";
|
|
14
|
+
export const StartChatErrorPaneStateful = startChatErrorPaneProps => {
|
|
15
|
+
var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7, _startChatErrorPanePr8, _startChatErrorPanePr9, _startChatErrorPanePr10, _startChatErrorPanePr11;
|
|
16
|
+
const [state] = useChatContextStore();
|
|
17
|
+
const generalStyleProps = Object.assign({}, defaultStartChatErrorPaneGeneralStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr === void 0 ? void 0 : _startChatErrorPanePr.generalStyleProps);
|
|
18
|
+
const titleStyleProps = Object.assign({}, defaultStartChatErrorPaneTitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr2 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr2 === void 0 ? void 0 : _startChatErrorPanePr2.titleStyleProps);
|
|
19
|
+
const subtitleStyleProps = Object.assign({}, defaultStartChatErrorPaneSubtitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr3 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr3 === void 0 ? void 0 : _startChatErrorPanePr3.subtitleStyleProps);
|
|
20
|
+
const iconStyleProps = Object.assign({}, defaultStartChatErrorPaneIconStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr4 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr4 === void 0 ? void 0 : _startChatErrorPanePr4.iconStyleProps);
|
|
21
|
+
const iconImageProps = Object.assign({}, defaultStartChatErrorPaneIconImageStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr5 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr5 === void 0 ? void 0 : _startChatErrorPanePr5.iconImageProps);
|
|
22
|
+
const errorUIStyleProps = {
|
|
23
|
+
generalStyleProps: generalStyleProps,
|
|
24
|
+
titleStyleProps: titleStyleProps,
|
|
25
|
+
subtitleStyleProps: subtitleStyleProps,
|
|
26
|
+
iconStyleProps: iconStyleProps,
|
|
27
|
+
iconImageProps: iconImageProps
|
|
28
|
+
};
|
|
29
|
+
let errorPaneTitleText;
|
|
30
|
+
let errorPaneSubtitleText;
|
|
31
|
+
switch (state.domainStates.startChatFailureType) {
|
|
32
|
+
case StartChatFailureType.Unauthorized:
|
|
33
|
+
errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr6 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr6 === void 0 ? void 0 : _startChatErrorPanePr6.unauthorizedTitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedTitleText;
|
|
34
|
+
errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr7 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr7 === void 0 ? void 0 : _startChatErrorPanePr7.unauthorizedSubtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorUnauthorizedSubtitleText;
|
|
35
|
+
break;
|
|
36
|
+
case StartChatFailureType.AuthSetupError:
|
|
37
|
+
errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr8 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr8 === void 0 ? void 0 : _startChatErrorPanePr8.authSetupErrorTitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorTitleText;
|
|
38
|
+
errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr9 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr9 === void 0 ? void 0 : _startChatErrorPanePr9.authSetupErrorSubtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorAuthSetupErrorSubtitleText;
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
errorPaneTitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr10 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr10 === void 0 ? void 0 : _startChatErrorPanePr10.titleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorTitleText;
|
|
42
|
+
errorPaneSubtitleText = (startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr11 = startChatErrorPaneProps.controlProps) === null || _startChatErrorPanePr11 === void 0 ? void 0 : _startChatErrorPanePr11.subtitleText) ?? StartChatErrorPaneConstants.DefaultStartChatErrorSubtitleText;
|
|
43
|
+
}
|
|
44
|
+
const errorUIControlProps = {
|
|
45
|
+
id: StartChatErrorPaneConstants.DefaultStartChatErrorPaneId,
|
|
46
|
+
dir: state.domainStates.globalDir,
|
|
47
|
+
hideSpinner: true,
|
|
48
|
+
hideSpinnerText: true,
|
|
49
|
+
...(startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.controlProps),
|
|
50
|
+
titleText: errorPaneTitleText,
|
|
51
|
+
subtitleText: errorPaneSubtitleText
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Move focus to the first button
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const firstElement = findAllFocusableElement(`#${state.domainStates.widgetElementId}`);
|
|
57
|
+
if (firstElement && firstElement[0]) {
|
|
58
|
+
firstElement[0].focus();
|
|
59
|
+
}
|
|
60
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
61
|
+
Event: TelemetryEvent.StartChatErrorPaneLoaded,
|
|
62
|
+
Description: "Start chat error pane loaded."
|
|
63
|
+
});
|
|
64
|
+
}, []);
|
|
65
|
+
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
66
|
+
componentOverrides: startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.componentOverrides,
|
|
67
|
+
controlProps: errorUIControlProps,
|
|
68
|
+
styleProps: errorUIStyleProps
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export default StartChatErrorPaneStateful;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImageFit } from "@fluentui/react";
|
|
2
|
+
import { AlertIcon } from "../../../assets/Icons";
|
|
3
|
+
export const defaultStartChatErrorPaneIconImageStyleProps = {
|
|
4
|
+
src: AlertIcon,
|
|
5
|
+
imageFit: ImageFit.centerContain,
|
|
6
|
+
width: "86px",
|
|
7
|
+
height: "86px",
|
|
8
|
+
shouldFadeIn: false,
|
|
9
|
+
shouldStartVisible: true
|
|
10
|
+
};
|
package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneControlProps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/esm/components/startchaterrorpanestateful/interfaces/IStartChatErrorPaneStyleProps.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -47,7 +47,7 @@ const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
|
|
|
47
47
|
return () => /*#__PURE__*/React.createElement("div", {
|
|
48
48
|
key: card.activity.id,
|
|
49
49
|
style: systemMessageStyles,
|
|
50
|
-
"aria-hidden": "
|
|
50
|
+
"aria-hidden": "false",
|
|
51
51
|
dangerouslySetInnerHTML: {
|
|
52
52
|
__html: escapeHtml(card.activity.text)
|
|
53
53
|
}
|
|
@@ -93,8 +93,7 @@ export const createActivityMiddleware = (systemMessageStyleProps, userMessageSty
|
|
|
93
93
|
return function () {
|
|
94
94
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
95
|
className: card.activity.from.role === DirectLineSenderRole.User ? Constants.sentMessageClassName : Constants.receivedMessageClassName,
|
|
96
|
-
style: userMessageStyles
|
|
97
|
-
"aria-hidden": "true"
|
|
96
|
+
style: userMessageStyles
|
|
98
97
|
}, next(...args)(...arguments));
|
|
99
98
|
};
|
|
100
99
|
}
|
|
@@ -10,4 +10,5 @@ export let ConversationState;
|
|
|
10
10
|
ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
|
|
11
11
|
ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
|
|
12
12
|
ConversationState[ConversationState["Closed"] = 9] = "Closed";
|
|
13
|
+
ConversationState[ConversationState["Error"] = 10] = "Error";
|
|
13
14
|
})(ConversationState || (ConversationState = {}));
|
|
@@ -8,40 +8,41 @@ export let LiveChatWidgetActionType;
|
|
|
8
8
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
|
|
9
9
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
|
|
10
10
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
|
|
11
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
12
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
13
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
14
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
15
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
16
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
17
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
18
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
19
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
27
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
28
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
29
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
30
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
31
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
32
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
33
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
34
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
35
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
36
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
37
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
38
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
39
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
40
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
41
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
42
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
43
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
44
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
45
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
46
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
11
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 8] = "SET_START_CHAT_FAILURE_TYPE";
|
|
12
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 9] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
13
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 10] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
14
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 11] = "SET_CUSTOM_CONTEXT";
|
|
15
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 12] = "SET_SHOW_CONFIRMATION";
|
|
16
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 13] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
17
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 14] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
18
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 15] = "SET_AUDIO_NOTIFICATION";
|
|
19
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 16] = "SET_E2VV_ENABLED";
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 17] = "SET_POST_CHAT_CONTEXT";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 18] = "SHOW_CALLING_CONTAINER";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 19] = "SET_INCOMING_CALL";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 20] = "DISABLE_VIDEO_CALL";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 21] = "DISABLE_LOCAL_VIDEO";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 22] = "DISABLE_REMOTE_VIDEO";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 23] = "SET_CHAT_TOKEN";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 24] = "SET_START_CHAT_BUTTON_DISPLAY";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 25] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 26] = "SET_TELEMETRY_DATA";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 27] = "SET_RECONNECT_ID";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 28] = "SET_UNREAD_MESSAGE_COUNT";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 29] = "SET_FOCUS_CHAT_BUTTON";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 30] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 31] = "SET_CONVERSATION_ENDED_BY";
|
|
35
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 32] = "SET_WIDGET_STATE";
|
|
36
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 33] = "SET_LIVE_CHAT_CONTEXT";
|
|
37
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 34] = "SET_BOT_OAUTH_SIGNIN_ID";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 35] = "SET_WIDGET_SIZE";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 36] = "SET_WIDGET_INSTANCE_ID";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 37] = "SET_LIVE_CHAT_CONFIG";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 38] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
|
|
42
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 39] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
|
|
43
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 40] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 41] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
|
|
45
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
|
|
46
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
|
|
47
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
|
|
47
48
|
})(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
|
|
@@ -3,6 +3,7 @@ import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontain
|
|
|
3
3
|
import { getWidgetCacheIdfromProps, isNullOrUndefined } from "../../common/utils";
|
|
4
4
|
import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
|
|
5
5
|
import { ConfirmationState, Constants, ConversationEndEntity, StorageType } from "../../common/Constants";
|
|
6
|
+
import { StartChatFailureType } from "./StartChatFailureType";
|
|
6
7
|
export const getLiveChatWidgetContextInitialState = props => {
|
|
7
8
|
var _props$controlProps, _props$webChatContain;
|
|
8
9
|
const widgetCacheId = getWidgetCacheIdfromProps(props);
|
|
@@ -31,7 +32,8 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
31
32
|
initialChatSdkRequestId: "",
|
|
32
33
|
transcriptRequestId: "",
|
|
33
34
|
confirmationPaneConfirmedOptionClicked: false,
|
|
34
|
-
confirmationState: ConfirmationState.NotSet
|
|
35
|
+
confirmationState: ConfirmationState.NotSet,
|
|
36
|
+
startChatFailureType: StartChatFailureType.Generic
|
|
35
37
|
},
|
|
36
38
|
appStates: {
|
|
37
39
|
conversationState: ConversationState.Closed,
|
|
@@ -58,6 +60,7 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
58
60
|
},
|
|
59
61
|
uiStates: {
|
|
60
62
|
showConfirmationPane: false,
|
|
63
|
+
showStartChatErrorPane: false,
|
|
61
64
|
showEmailTranscriptPane: false,
|
|
62
65
|
showCallingPopup: false,
|
|
63
66
|
isIncomingCall: true,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export let StartChatFailureType;
|
|
2
|
+
(function (StartChatFailureType) {
|
|
3
|
+
StartChatFailureType["Unauthorized"] = "unauthorized";
|
|
4
|
+
StartChatFailureType["AuthSetupError"] = "authSetupError";
|
|
5
|
+
StartChatFailureType["Generic"] = "generic";
|
|
6
|
+
})(StartChatFailureType || (StartChatFailureType = {}));
|
|
@@ -61,6 +61,14 @@ export const createReducer = () => {
|
|
|
61
61
|
startChatFailed: action.payload
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
case LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE:
|
|
65
|
+
return {
|
|
66
|
+
...state,
|
|
67
|
+
domainStates: {
|
|
68
|
+
...state.domainStates,
|
|
69
|
+
startChatFailureType: action.payload
|
|
70
|
+
}
|
|
71
|
+
};
|
|
64
72
|
case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
|
|
65
73
|
return {
|
|
66
74
|
...state,
|
|
@@ -22,6 +22,9 @@ export const shouldShowWebChatContainer = state => {
|
|
|
22
22
|
export const shouldShowLoadingPane = state => {
|
|
23
23
|
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Loading;
|
|
24
24
|
};
|
|
25
|
+
export const shouldShowStartChatErrorPane = state => {
|
|
26
|
+
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Error;
|
|
27
|
+
};
|
|
25
28
|
export const shouldShowReconnectChatPane = state => {
|
|
26
29
|
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ReconnectChat;
|
|
27
30
|
};
|
|
@@ -227,6 +227,15 @@ export declare class NotificationPaneConstants {
|
|
|
227
227
|
static readonly ChatDisconnectSubtitleText = "For additional assistance, please close the chat and try again.";
|
|
228
228
|
static readonly ChromeCloseIconName = "ChromeClose";
|
|
229
229
|
}
|
|
230
|
+
export declare class StartChatErrorPaneConstants {
|
|
231
|
+
static readonly DefaultStartChatErrorPaneId = "oc-lcw-start-chat-error-pane";
|
|
232
|
+
static readonly DefaultStartChatErrorTitleText = "We are unable to load chat at this time.";
|
|
233
|
+
static readonly DefaultStartChatErrorSubtitleText = "Please try again later.";
|
|
234
|
+
static readonly DefaultStartChatErrorUnauthorizedTitleText = "Chat authentication has failed.";
|
|
235
|
+
static readonly DefaultStartChatErrorAuthSetupErrorTitleText = "Chat authentication has failed.";
|
|
236
|
+
static readonly DefaultStartChatErrorUnauthorizedSubtitleText = "UNAUTHORIZED";
|
|
237
|
+
static readonly DefaultStartChatErrorAuthSetupErrorSubtitleText = "AUTH SETUP ERROR";
|
|
238
|
+
}
|
|
230
239
|
export declare class AriaTelemetryConstants {
|
|
231
240
|
static readonly GERMANY_ENDPOINT: string;
|
|
232
241
|
static readonly GCCH_ENDPOINT: string;
|
|
@@ -245,3 +254,15 @@ export declare class WidgetLoadCustomErrorString {
|
|
|
245
254
|
static readonly AuthenticationFailedErrorString = "Authentication was not successful";
|
|
246
255
|
static readonly NetworkErrorString = "Network Error";
|
|
247
256
|
}
|
|
257
|
+
export declare class PrepareEndChatDescriptionConstants {
|
|
258
|
+
static readonly ConversationEndedByCustomerWithoutPostChat = "Conversation ended by customer. Post chat not configured or should not show.";
|
|
259
|
+
static readonly ConversationEndedByCustomerWithInvalidPostChat = "Conversation ended by customer. Post chat context is invalid.";
|
|
260
|
+
static readonly ConversationEndedBy = "Conversation ended by";
|
|
261
|
+
static readonly PrepareEndChatError = "There's an error while preparing to end chat. Closing chat widget.";
|
|
262
|
+
static readonly WidgetLoadFailedAfterSessionInit = "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.";
|
|
263
|
+
static readonly InitiateEndChatReceived = "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.";
|
|
264
|
+
static readonly EndChatReceivedFromOtherTabs = "Received EndChat BroadcastEvent from other tabs. Closing this chat.";
|
|
265
|
+
static readonly CustomerCloseChatOnFailureOrPostChat = "Customer is trying to close chat widget on start chat failure or post chat pane.";
|
|
266
|
+
static readonly CustomerCloseInactiveChat = "Chat was Inactive and customer is trying to close chat widget or refreshing the page.";
|
|
267
|
+
static readonly BrowserUnload = "Browser unload event received. Ending chat.";
|
|
268
|
+
}
|
|
@@ -110,6 +110,7 @@ export declare enum TelemetryEvent {
|
|
|
110
110
|
StartChatSDKCall = "StartChatCall",
|
|
111
111
|
StartChatEventRecevied = "StartChatEventReceived",
|
|
112
112
|
EndChatSDKCall = "EndChatSDKCall",
|
|
113
|
+
PrepareEndChat = "PrepareEndChat",
|
|
113
114
|
EndChatEventReceived = "EndChatEventReceived",
|
|
114
115
|
WindowClosed = "WindowClosed",
|
|
115
116
|
OnNewMessageFailed = "OnNewMessageFailed",
|
|
@@ -123,6 +124,7 @@ export declare enum TelemetryEvent {
|
|
|
123
124
|
ConfirmationCancelButtonClicked = "ConfirmationCancelButtonClicked",
|
|
124
125
|
ConfirmationConfirmButtonClicked = "ConfirmationConfirmButtonClicked",
|
|
125
126
|
LoadingPaneLoaded = "LoadingPaneLoaded",
|
|
127
|
+
StartChatErrorPaneLoaded = "StartChatErrorPaneLoaded",
|
|
126
128
|
EmailTranscriptLoaded = "EmailTranscriptLoaded",
|
|
127
129
|
OutOfOfficePaneLoaded = "OutOfOfficePaneLoaded",
|
|
128
130
|
ConfirmationPaneLoaded = "ConfirmationPaneLoaded",
|
package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface ILiveChatWidgetComponentOverrides {
|
|
|
6
6
|
emailTranscriptPane?: ReactNode | string;
|
|
7
7
|
header?: ReactNode | string;
|
|
8
8
|
loadingPane?: ReactNode | string;
|
|
9
|
+
startChatErrorPane?: ReactNode | string;
|
|
9
10
|
outOfOfficeHoursPane?: ReactNode | string;
|
|
10
11
|
postChatLoadingPane?: ReactNode | string;
|
|
11
12
|
postChatSurveyPane?: ReactNode | string;
|
|
@@ -15,7 +15,7 @@ import { IOOOHPaneProps } from "@microsoft/omnichannel-chat-components/lib/types
|
|
|
15
15
|
import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
|
|
16
16
|
import { IProactiveChatPaneStatefulProps } from "../../proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps";
|
|
17
17
|
import { IReconnectChatPaneStatefulProps } from "../../reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps";
|
|
18
|
-
import { IStartChatErrorPaneProps } from "../../
|
|
18
|
+
import { IStartChatErrorPaneProps } from "../../startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps";
|
|
19
19
|
import { ITelemetryConfig } from "../../../common/telemetry/interfaces/ITelemetryConfig";
|
|
20
20
|
import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
|
|
21
21
|
import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
|