@microsoft/omnichannel-chat-widget 0.1.0-main.bf74329 → 0.1.0-main.c1bbb91
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/assets/Icons.js +4 -2
- package/lib/cjs/common/Constants.js +24 -4
- package/lib/cjs/common/KeyCodes.js +3 -1
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -1
- package/lib/cjs/common/storage/default/defaultCacheManager.js +5 -3
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +15 -6
- package/lib/cjs/common/telemetry/TelemetryConstants.js +12 -5
- package/lib/cjs/common/telemetry/TelemetryHelper.js +7 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +3 -1
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +2 -2
- package/lib/cjs/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +6 -4
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +3 -1
- package/lib/cjs/components/livechatwidget/common/Deferred.js +3 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +14 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +67 -16
- package/lib/cjs/components/livechatwidget/common/endChat.js +42 -2
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +13 -19
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +75 -114
- package/lib/cjs/components/livechatwidget/common/startChat.js +162 -45
- package/lib/cjs/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +152 -116
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
- package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +2 -2
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +12 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +29 -27
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +6 -3
- package/lib/cjs/contexts/createReducer.js +19 -2
- package/lib/cjs/controller/componentController.js +1 -1
- package/lib/cjs/hooks/useDebounce.js +28 -0
- package/lib/cjs/hooks/useWindowDimensions.js +30 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -0
- package/lib/esm/assets/Icons.js +2 -1
- package/lib/esm/common/Constants.js +21 -3
- package/lib/esm/common/KeyCodes.js +3 -1
- package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -1
- package/lib/esm/common/storage/default/defaultCacheManager.js +5 -3
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
- package/lib/esm/common/telemetry/TelemetryConstants.js +12 -5
- package/lib/esm/common/telemetry/TelemetryHelper.js +7 -2
- package/lib/esm/common/telemetry/TelemetryManager.js +3 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +2 -2
- package/lib/esm/components/chatbuttonstateful/common/styleProps/defaultOutOfOfficeChatButtonStyleProps.js +3 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +6 -4
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +3 -1
- package/lib/esm/components/livechatwidget/common/Deferred.js +3 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultScrollBarProps.js +7 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +67 -16
- package/lib/esm/components/livechatwidget/common/endChat.js +42 -2
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -19
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +72 -109
- package/lib/esm/components/livechatwidget/common/startChat.js +161 -45
- package/lib/esm/components/livechatwidget/interfaces/IScrollBarProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +153 -117
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
- package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +2 -2
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +12 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +29 -27
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +6 -3
- package/lib/esm/contexts/createReducer.js +19 -2
- package/lib/esm/controller/componentController.js +1 -1
- package/lib/esm/hooks/useDebounce.js +22 -0
- package/lib/esm/hooks/useWindowDimensions.js +23 -0
- package/lib/esm/plugins/newMessageEventHandler.js +4 -0
- package/lib/types/assets/Icons.d.ts +1 -0
- package/lib/types/common/Constants.d.ts +14 -0
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +11 -4
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +4 -4
- package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultScrollBarProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -7
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +3 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IScrollBarProps.d.ts +22 -0
- package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +29 -27
- package/lib/types/hooks/useDebounce.d.ts +3 -0
- package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
- package/package.json +3 -3
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
|
-
import { BroadcastService,
|
|
3
|
+
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Stack } from "@fluentui/react";
|
|
5
5
|
import React, { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
6
7
|
import { createTimer, getBroadcastChannelName, getLocaleDirection, getStateFromCache, getWidgetCacheId, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
|
|
7
|
-
import {
|
|
8
|
-
import { initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
8
|
+
import { endChat, prepareEndChat } from "../common/endChat";
|
|
9
9
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
10
|
+
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
10
11
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
11
12
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
12
13
|
import { Components } from "botframework-webchat";
|
|
13
14
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
14
15
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
15
16
|
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
17
|
+
import { Constants, E2VVOptions } from "../../../common/Constants";
|
|
16
18
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
17
19
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
18
20
|
import HeaderStateful from "../../headerstateful/HeaderStateful";
|
|
@@ -29,22 +31,21 @@ import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
|
29
31
|
import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
|
|
30
32
|
import { createFooter } from "../common/createFooter";
|
|
31
33
|
import { createInternetConnectionChangeHandler } from "../common/createInternetConnectionChangeHandler";
|
|
34
|
+
import { defaultClientDataStoreProvider } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
35
|
+
import { defaultScrollBarProps } from "../common/defaultProps/defaultScrollBarProps";
|
|
32
36
|
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
33
37
|
import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
|
|
34
|
-
import { endChat, prepareEndChat } from "../common/endChat";
|
|
35
38
|
import { getGeneralStylesForButton } from "../common/getGeneralStylesForButton";
|
|
36
39
|
import { initCallingSdk } from "../common/initCallingSdk";
|
|
37
40
|
import { initConfirmationPropsComposer } from "../common/initConfirmationPropsComposer";
|
|
38
41
|
import { initWebChatComposer } from "../common/initWebChatComposer";
|
|
42
|
+
import { registerBroadcastServiceForLocalStorage } from "../../../common/storage/default/defaultCacheManager";
|
|
39
43
|
import { registerTelemetryLoggers } from "../common/registerTelemetryLoggers";
|
|
40
44
|
import { setPostChatContextAndLoadSurvey } from "../common/setPostChatContextAndLoadSurvey";
|
|
41
45
|
import { startProactiveChat } from "../common/startProactiveChat";
|
|
42
46
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
43
47
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
44
48
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
45
|
-
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
46
|
-
import { registerBroadcastServiceForLocalStorage } from "../../../common/storage/default/defaultCacheManager";
|
|
47
|
-
import { defaultClientDataStoreProvider } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
48
49
|
export const LiveChatWidgetStateful = props => {
|
|
49
50
|
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps14, _props$controlProps15, _props$componentOverr, _props$controlProps16, _props$componentOverr2, _props$controlProps17, _props$componentOverr3, _props$controlProps18, _props$componentOverr4, _props$controlProps19, _props$componentOverr5, _props$controlProps20, _props$componentOverr6, _props$controlProps21, _props$componentOverr7, _props$controlProps22, _props$controlProps23, _props$componentOverr8, _props$controlProps24, _props$componentOverr9, _props$controlProps25, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
50
51
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -67,38 +68,79 @@ export const LiveChatWidgetStateful = props => {
|
|
|
67
68
|
const generalStyles = {
|
|
68
69
|
root: Object.assign({}, getGeneralStylesForButton(state), (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyles)
|
|
69
70
|
};
|
|
71
|
+
|
|
72
|
+
//Scrollbar styles
|
|
73
|
+
const scrollbarProps = Object.assign({}, defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
|
|
70
74
|
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$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
71
75
|
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
72
76
|
TelemetryTimers.LcwLoadToChatButtonTimer = createTimer();
|
|
73
77
|
const widgetElementId = ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.id) || "oc-lcw";
|
|
74
78
|
const currentMessageCountRef = useRef(0);
|
|
75
79
|
let widgetStateEventName = "";
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
let optionalParams;
|
|
82
|
+
let activeCachedChatExist = false;
|
|
83
|
+
const setOptionalParams = () => {
|
|
84
|
+
var _state$appStates, _state$domainStates;
|
|
85
|
+
if (!isUndefinedOrEmpty((_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.reconnectId)) {
|
|
86
|
+
activeCachedChatExist = true;
|
|
87
|
+
optionalParams = {
|
|
88
|
+
reconnectId: state.appStates.reconnectId
|
|
89
|
+
};
|
|
90
|
+
} else if (!isUndefinedOrEmpty((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext)) {
|
|
91
|
+
var _state$domainStates2;
|
|
92
|
+
activeCachedChatExist = true;
|
|
93
|
+
optionalParams = {
|
|
94
|
+
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
95
|
+
};
|
|
96
|
+
} else {
|
|
97
|
+
activeCachedChatExist = false;
|
|
98
|
+
optionalParams = {};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
85
101
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
+
const startChat = async (props, localState) => {
|
|
104
|
+
let isChatValid = false;
|
|
105
|
+
|
|
106
|
+
//Start a chat from cache/reconnectid
|
|
107
|
+
if (activeCachedChatExist === true) {
|
|
108
|
+
var _state$domainStates3, _state$domainStates3$;
|
|
109
|
+
dispatch({
|
|
110
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
111
|
+
payload: ConversationState.Loading
|
|
112
|
+
});
|
|
113
|
+
if (localState) {
|
|
114
|
+
localState.appStates.conversationState = ConversationState.Loading;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//Check if conversation state is not in wrapup or closed state
|
|
118
|
+
isChatValid = await checkIfConversationStillValid(chatSDK, props, (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.liveChatContext) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.requestId, dispatch);
|
|
119
|
+
if (isChatValid === true) {
|
|
120
|
+
await initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (isChatValid === false) {
|
|
125
|
+
if (localState) {
|
|
126
|
+
await setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter, undefined, undefined, localState, props);
|
|
127
|
+
return;
|
|
128
|
+
} else {
|
|
129
|
+
dispatch({
|
|
130
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
131
|
+
payload: ConversationState.Closed
|
|
132
|
+
});
|
|
133
|
+
}
|
|
89
134
|
}
|
|
90
|
-
//Message for clearing window[popouTab]
|
|
91
|
-
BroadcastService.postMessage({
|
|
92
|
-
eventName: BroadcastEvent.ClosePopoutWindow
|
|
93
|
-
});
|
|
94
135
|
};
|
|
95
136
|
useEffect(() => {
|
|
96
|
-
var _props$
|
|
137
|
+
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch;
|
|
97
138
|
// Add default localStorage support for widget
|
|
98
139
|
if (props.contextDataStore === undefined) {
|
|
99
|
-
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$
|
|
100
|
-
|
|
101
|
-
DataStoreManager.clientDataStore = defaultClientDataStoreProvider();
|
|
140
|
+
var _props$controlProps3, _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$controlProps4;
|
|
141
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.cacheTtlInMins) ?? Constants.CacheTtlInMinutes;
|
|
142
|
+
DataStoreManager.clientDataStore = defaultClientDataStoreProvider(cacheTtlInMins);
|
|
143
|
+
registerBroadcastServiceForLocalStorage(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 === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.widgetInstanceId) ?? "", cacheTtlInMins);
|
|
102
144
|
} else {
|
|
103
145
|
DataStoreManager.clientDataStore = props.contextDataStore;
|
|
104
146
|
}
|
|
@@ -109,117 +151,55 @@ export const LiveChatWidgetStateful = props => {
|
|
|
109
151
|
payload: widgetElementId
|
|
110
152
|
});
|
|
111
153
|
dispatch({
|
|
112
|
-
type: LiveChatWidgetActionType.
|
|
113
|
-
payload: ((_props$
|
|
154
|
+
type: LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY,
|
|
155
|
+
payload: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.hideStartChatButton) || false
|
|
114
156
|
});
|
|
115
157
|
dispatch({
|
|
116
158
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
117
159
|
payload: false
|
|
118
160
|
});
|
|
119
|
-
if ((_props$
|
|
120
|
-
var _props$
|
|
161
|
+
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)) {
|
|
162
|
+
var _props$controlProps8;
|
|
121
163
|
dispatch({
|
|
122
164
|
type: LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID,
|
|
123
|
-
payload: (_props$
|
|
165
|
+
payload: (_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.widgetInstanceId
|
|
124
166
|
});
|
|
125
167
|
}
|
|
126
|
-
|
|
127
|
-
sdkCreated
|
|
128
|
-
|
|
129
|
-
|
|
168
|
+
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) {
|
|
169
|
+
initCallingSdk(chatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
170
|
+
sdkCreated && dispatch({
|
|
171
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
172
|
+
payload: true
|
|
173
|
+
});
|
|
130
174
|
});
|
|
131
|
-
}
|
|
175
|
+
}
|
|
132
176
|
|
|
133
177
|
// Initialize global dir
|
|
134
|
-
const globalDir = ((_props$
|
|
178
|
+
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);
|
|
135
179
|
dispatch({
|
|
136
180
|
type: LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
137
181
|
payload: globalDir
|
|
138
182
|
});
|
|
139
|
-
|
|
140
|
-
var _props$reconnectChatP2, _props$reconnectChatP3;
|
|
141
|
-
startUnauthenticatedReconnectChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.isReconnectEnabled, (_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.reconnectId, initStartChat);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
183
|
+
setOptionalParams();
|
|
144
184
|
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const isAuthenticationSettingsEnabled = (_props$chatConfig2 = props.chatConfig) !== null && _props$chatConfig2 !== void 0 && (_props$chatConfig2$Li = _props$chatConfig2.LiveChatConfigAuthSettings) !== null && _props$chatConfig2$Li !== void 0 && _props$chatConfig2$Li.msdyn_javascriptclientfunction ? true : false;
|
|
149
|
-
if (!state.appStates.skipChatButtonRendering && state.appStates.conversationState === ConversationState.Active && isAuthenticationSettingsEnabled === true && (_props$reconnectChatP4 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP4 !== void 0 && _props$reconnectChatP4.isReconnectEnabled) {
|
|
150
|
-
getReconnectIdForAuthenticatedChat(props, chatSDK).then(authReconnectId => {
|
|
151
|
-
if (authReconnectId && !state.appStates.reconnectId) {
|
|
152
|
-
dispatch({
|
|
153
|
-
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
154
|
-
payload: authReconnectId
|
|
155
|
-
});
|
|
156
|
-
dispatch({
|
|
157
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
158
|
-
payload: ConversationState.ReconnectChat
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return;
|
|
185
|
+
// Unauth chat
|
|
186
|
+
if (state.appStates.hideStartChatButton === false) {
|
|
187
|
+
startChat(props);
|
|
163
188
|
}
|
|
164
|
-
if (!state.appStates.skipChatButtonRendering && !isUndefinedOrEmpty((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext) && state.appStates.conversationState === ConversationState.Active) {
|
|
165
|
-
var _state$domainStates2;
|
|
166
|
-
const optionalParams = {
|
|
167
|
-
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
168
|
-
};
|
|
169
|
-
initStartChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, optionalParams);
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// All other case should show start chat button, skipChatButtonRendering will take care of it own
|
|
174
|
-
dispatch({
|
|
175
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
176
|
-
payload: ConversationState.Closed
|
|
177
|
-
});
|
|
178
189
|
}, []);
|
|
179
190
|
|
|
180
191
|
// useEffect for when skip chat button rendering
|
|
181
192
|
useEffect(() => {
|
|
182
|
-
if (state.appStates.
|
|
183
|
-
var _props$reconnectChatP5;
|
|
193
|
+
if (state.appStates.hideStartChatButton === true) {
|
|
184
194
|
BroadcastService.postMessage({
|
|
185
195
|
eventName: BroadcastEvent.ChatInitiated
|
|
186
196
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
handleUnauthenticatedReconnectChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP6 = props.reconnectChatPaneProps) === null || _props$reconnectChatP6 === void 0 ? void 0 : _props$reconnectChatP6.isReconnectEnabled, (_props$reconnectChatP7 = props.reconnectChatPaneProps) === null || _props$reconnectChatP7 === void 0 ? void 0 : _props$reconnectChatP7.reconnectId, initStartChat, (_props$reconnectChatP8 = props.reconnectChatPaneProps) === null || _props$reconnectChatP8 === void 0 ? void 0 : _props$reconnectChatP8.redirectInSameWindow);
|
|
190
|
-
} else {
|
|
191
|
-
getReconnectIdForAuthenticatedChat(props, chatSDK).then(authReconnectId => {
|
|
192
|
-
if (authReconnectId && !state.appStates.reconnectId) {
|
|
193
|
-
dispatch({
|
|
194
|
-
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
195
|
-
payload: authReconnectId
|
|
196
|
-
});
|
|
197
|
-
dispatch({
|
|
198
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
199
|
-
payload: ConversationState.ReconnectChat
|
|
200
|
-
});
|
|
201
|
-
} else {
|
|
202
|
-
var _state$domainStates3;
|
|
203
|
-
const chatStartedSkippingChatButtonRendering = {
|
|
204
|
-
eventName: BroadcastEvent.StartChatSkippingChatButtonRendering
|
|
205
|
-
};
|
|
206
|
-
BroadcastService.postMessage(chatStartedSkippingChatButtonRendering);
|
|
207
|
-
if (!isUndefinedOrEmpty((_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.liveChatContext) && state.appStates.conversationState === ConversationState.Active) {
|
|
208
|
-
var _state$domainStates4;
|
|
209
|
-
const optionalParams = {
|
|
210
|
-
liveChatContext: (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : _state$domainStates4.liveChatContext
|
|
211
|
-
};
|
|
212
|
-
initStartChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, optionalParams);
|
|
213
|
-
} else {
|
|
214
|
-
setPreChatAndInitiateChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
197
|
+
//Pass the state to avoid getting stale state
|
|
198
|
+
startChat(props, state);
|
|
219
199
|
}
|
|
220
|
-
}, [state.appStates.
|
|
200
|
+
}, [state.appStates.hideStartChatButton]);
|
|
221
201
|
|
|
222
|
-
// useEffect for
|
|
202
|
+
// useEffect for custom context
|
|
223
203
|
useEffect(() => {
|
|
224
204
|
var _chatSDK$omnichannelC8, _chatSDK$omnichannelC9, _props$controlProps12;
|
|
225
205
|
// Add the custom context on receiving the SetCustomContext event
|
|
@@ -296,7 +276,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
296
276
|
|
|
297
277
|
// End chat
|
|
298
278
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
299
|
-
if (state.appStates.
|
|
279
|
+
if (state.appStates.hideStartChatButton === false) {
|
|
300
280
|
var _chatSDK$omnichannelC6, _chatSDK$omnichannelC7, _props$controlProps11;
|
|
301
281
|
// This is to ensure to get latest state from cache in multitab
|
|
302
282
|
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC6 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC6 === void 0 ? void 0 : _chatSDK$omnichannelC6.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC7 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC7 === void 0 ? void 0 : _chatSDK$omnichannelC7.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
@@ -337,6 +317,26 @@ export const LiveChatWidgetStateful = props => {
|
|
|
337
317
|
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
338
318
|
});
|
|
339
319
|
});
|
|
320
|
+
|
|
321
|
+
// Reset state variables
|
|
322
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.RaiseErrorEvent).subscribe(() => {
|
|
323
|
+
dispatch({
|
|
324
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONFIG,
|
|
325
|
+
payload: undefined
|
|
326
|
+
});
|
|
327
|
+
dispatch({
|
|
328
|
+
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
329
|
+
payload: undefined
|
|
330
|
+
});
|
|
331
|
+
dispatch({
|
|
332
|
+
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
333
|
+
payload: undefined
|
|
334
|
+
});
|
|
335
|
+
dispatch({
|
|
336
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
337
|
+
payload: undefined
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
340
|
return () => {
|
|
341
341
|
disposeTelemetryLoggers();
|
|
342
342
|
};
|
|
@@ -409,7 +409,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
409
409
|
// Ghost chat scenarios
|
|
410
410
|
/* COMMENTING THIS CODE FOR PARITY WITH OLD LCW
|
|
411
411
|
if (state.appStates.conversationState === ConversationState.Active &&
|
|
412
|
-
props.controlProps?.
|
|
412
|
+
props.controlProps?.hideStartChatButton === true) {
|
|
413
413
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
414
414
|
|
|
415
415
|
window.onbeforeunload = function () {
|
|
@@ -431,6 +431,25 @@ export const LiveChatWidgetStateful = props => {
|
|
|
431
431
|
};
|
|
432
432
|
BroadcastService.postMessage(chatWidgetStateChangeEvent);
|
|
433
433
|
}, [state]);
|
|
434
|
+
const initiateEndChatOnBrowserUnload = () => {
|
|
435
|
+
var _DataStoreManager$cli;
|
|
436
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
437
|
+
Event: TelemetryEvent.BrowserUnloadEventStarted,
|
|
438
|
+
Description: "Browser unload event received."
|
|
439
|
+
});
|
|
440
|
+
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
|
|
441
|
+
// Clean local storage
|
|
442
|
+
(_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventName, "localStorage");
|
|
443
|
+
|
|
444
|
+
//Dispose calling instance
|
|
445
|
+
if (voiceVideoCallingSDK) {
|
|
446
|
+
voiceVideoCallingSDK === null || voiceVideoCallingSDK === void 0 ? void 0 : voiceVideoCallingSDK.close();
|
|
447
|
+
}
|
|
448
|
+
//Message for clearing window[popouTab]
|
|
449
|
+
BroadcastService.postMessage({
|
|
450
|
+
eventName: BroadcastEvent.ClosePopoutWindow
|
|
451
|
+
});
|
|
452
|
+
};
|
|
434
453
|
const webChatProps = initWebChatComposer(props, chatSDK, state, dispatch, setWebChatStyles);
|
|
435
454
|
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(chatSDK, dispatch);
|
|
436
455
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -439,16 +458,33 @@ export const LiveChatWidgetStateful = props => {
|
|
|
439
458
|
const prepareEndChatRelay = (adapter, state) => prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
440
459
|
const prepareStartChatRelay = () => prepareStartChat(props, chatSDK, state, dispatch, setAdapter);
|
|
441
460
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
442
|
-
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK,
|
|
461
|
+
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams, persistedState);
|
|
443
462
|
const confirmationPaneProps = initConfirmationPropsComposer(props);
|
|
444
|
-
return /*#__PURE__*/React.createElement(
|
|
463
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
464
|
+
::-webkit-scrollbar {
|
|
465
|
+
width: ${scrollbarProps.width};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
::-webkit-scrollbar-track {
|
|
469
|
+
background: ${scrollbarProps.trackBackgroundColor};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
::-webkit-scrollbar-thumb {
|
|
473
|
+
background: ${scrollbarProps.thumbBackgroundColor};
|
|
474
|
+
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
::-webkit-scrollbar-thumb:hover {
|
|
478
|
+
background: ${scrollbarProps.thumbHoverColor};
|
|
479
|
+
}
|
|
480
|
+
`), /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
445
481
|
styleOptions: webChatStyles,
|
|
446
482
|
directLine: ((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
|
|
447
483
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
448
484
|
id: widgetElementId,
|
|
449
485
|
styles: generalStyles,
|
|
450
486
|
className: (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.className
|
|
451
|
-
}, !((_props$controlProps14 = props.controlProps) !== null && _props$controlProps14 !== void 0 && _props$controlProps14.hideChatButton) && !((_props$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.
|
|
487
|
+
}, !((_props$controlProps14 = props.controlProps) !== null && _props$controlProps14 !== void 0 && _props$controlProps14.hideChatButton) && !((_props$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.hideStartChatButton) && shouldShowChatButton(state) && (decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.chatButton) || /*#__PURE__*/React.createElement(ChatButtonStateful, {
|
|
452
488
|
buttonProps: props.chatButtonProps,
|
|
453
489
|
outOfOfficeButtonProps: props.outOfOfficeChatButtonProps,
|
|
454
490
|
startChat: prepareStartChatRelay
|
|
@@ -470,6 +506,6 @@ export const LiveChatWidgetStateful = props => {
|
|
|
470
506
|
}, props.callingContainerProps)), !((_props$controlProps23 = props.controlProps) !== null && _props$controlProps23 !== void 0 && _props$controlProps23.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_props$componentOverr8 = props.componentOverrides) === null || _props$componentOverr8 === void 0 ? void 0 : _props$componentOverr8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, props.webChatContainerProps)), !((_props$controlProps24 = props.controlProps) !== null && _props$controlProps24 !== void 0 && _props$controlProps24.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_props$componentOverr9 = props.componentOverrides) === null || _props$componentOverr9 === void 0 ? void 0 : _props$componentOverr9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
471
507
|
setPostChatContext: setPostChatContextRelay,
|
|
472
508
|
prepareEndChat: prepareEndChatRelay
|
|
473
|
-
}))), !((_props$controlProps25 = props.controlProps) !== null && _props$controlProps25 !== void 0 && _props$controlProps25.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_props$componentOverr10 = props.componentOverrides) === null || _props$componentOverr10 === void 0 ? void 0 : _props$componentOverr10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, props.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_props$componentOverr11 = props.componentOverrides) === null || _props$componentOverr11 === void 0 ? void 0 : _props$componentOverr11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, props.postChatSurveyPaneProps, props.chatSDK))), createFooter(props, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_props$componentOverr12 = props.componentOverrides) === null || _props$componentOverr12 === void 0 ? void 0 : _props$componentOverr12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, props.emailTranscriptPane))));
|
|
509
|
+
}))), !((_props$controlProps25 = props.controlProps) !== null && _props$controlProps25 !== void 0 && _props$controlProps25.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_props$componentOverr10 = props.componentOverrides) === null || _props$componentOverr10 === void 0 ? void 0 : _props$componentOverr10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, props.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_props$componentOverr11 = props.componentOverrides) === null || _props$componentOverr11 === void 0 ? void 0 : _props$componentOverr11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, props.postChatSurveyPaneProps, props.chatSDK))), createFooter(props, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_props$componentOverr12 = props.componentOverrides) === null || _props$componentOverr12 === void 0 ? void 0 : _props$componentOverr12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, props.emailTranscriptPane)))));
|
|
474
510
|
};
|
|
475
511
|
export default LiveChatWidgetStateful;
|
|
@@ -5,6 +5,8 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
5
5
|
import { defaultGeneralLoadingPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps";
|
|
6
6
|
import { findAllFocusableElement } from "../../common/utils";
|
|
7
7
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
+
import useWindowDimensions from "../../hooks/useWindowDimensions";
|
|
9
|
+
import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
|
|
8
10
|
export const LoadingPaneStateful = props => {
|
|
9
11
|
var _props$styleProps;
|
|
10
12
|
const [state] = useChatContextStore();
|
|
@@ -13,11 +15,27 @@ export const LoadingPaneStateful = props => {
|
|
|
13
15
|
...props.styleProps,
|
|
14
16
|
generalStyleProps: generalStyleProps
|
|
15
17
|
};
|
|
18
|
+
const errorUIStyleProps = {
|
|
19
|
+
...errorUILoadingPaneStyleProps
|
|
20
|
+
};
|
|
16
21
|
const controlProps = {
|
|
17
22
|
id: "oc-lcw-loading-pane",
|
|
18
23
|
dir: state.domainStates.globalDir,
|
|
19
24
|
...props.controlProps
|
|
20
25
|
};
|
|
26
|
+
const errorUIControlProps = {
|
|
27
|
+
id: "oc-lcw-alert-pane",
|
|
28
|
+
dir: state.domainStates.globalDir,
|
|
29
|
+
titleText: "Chat is failing to load.",
|
|
30
|
+
subtitleText: "Please Close the chat and try again.",
|
|
31
|
+
hideSpinner: true,
|
|
32
|
+
hideSpinnerText: true,
|
|
33
|
+
...props.controlProps
|
|
34
|
+
};
|
|
35
|
+
const {
|
|
36
|
+
height,
|
|
37
|
+
width
|
|
38
|
+
} = useWindowDimensions();
|
|
21
39
|
|
|
22
40
|
// Move focus to the first button
|
|
23
41
|
useEffect(() => {
|
|
@@ -32,8 +50,10 @@ export const LoadingPaneStateful = props => {
|
|
|
32
50
|
}, []);
|
|
33
51
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
34
52
|
componentOverrides: props.componentOverrides,
|
|
35
|
-
controlProps: controlProps,
|
|
36
|
-
styleProps: styleProps
|
|
53
|
+
controlProps: state.appStates.isStartChatFailing ? errorUIControlProps : controlProps,
|
|
54
|
+
styleProps: state.appStates.isStartChatFailing ? errorUIStyleProps : styleProps,
|
|
55
|
+
windowWidth: width,
|
|
56
|
+
windowHeight: height
|
|
37
57
|
});
|
|
38
58
|
};
|
|
39
59
|
export default LoadingPaneStateful;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ImageFit } from "@fluentui/react";
|
|
2
|
+
import { AlertIcon } from "../../../../assets/Icons";
|
|
3
|
+
export const errorUILoadingPaneStyleProps = {
|
|
4
|
+
generalStyleProps: {
|
|
5
|
+
position: "initial",
|
|
6
|
+
width: "100%",
|
|
7
|
+
height: "100%",
|
|
8
|
+
left: "0%",
|
|
9
|
+
top: "0%",
|
|
10
|
+
borderRadius: "0 0 4px 4px",
|
|
11
|
+
borderWidth: "0px",
|
|
12
|
+
backgroundColor: "#FFFFFF"
|
|
13
|
+
},
|
|
14
|
+
titleStyleProps: {
|
|
15
|
+
fontFamily: "'Segoe UI',Arial,sans-serif",
|
|
16
|
+
fontWeight: "normal",
|
|
17
|
+
fontSize: "18px",
|
|
18
|
+
color: "#36454F",
|
|
19
|
+
textAlign: "center",
|
|
20
|
+
display: "flex",
|
|
21
|
+
order: 2,
|
|
22
|
+
alignSelf: "auto"
|
|
23
|
+
},
|
|
24
|
+
subtitleStyleProps: {
|
|
25
|
+
fontFamily: "'Segoe UI',Arial,sans-serif",
|
|
26
|
+
fontWeight: "normal",
|
|
27
|
+
fontSize: "18px",
|
|
28
|
+
color: "#36454F",
|
|
29
|
+
textAlign: "center",
|
|
30
|
+
display: "flex",
|
|
31
|
+
order: 3,
|
|
32
|
+
alignSelf: "auto"
|
|
33
|
+
},
|
|
34
|
+
iconStyleProps: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
order: 1,
|
|
37
|
+
alignSelf: "auto",
|
|
38
|
+
backgroundColor: "#FFFFFF",
|
|
39
|
+
boxShadow: "#FFFFFF 0px 0px 0px 0px",
|
|
40
|
+
margin: "0px 0px 0px 0px"
|
|
41
|
+
},
|
|
42
|
+
iconImageProps: {
|
|
43
|
+
src: AlertIcon,
|
|
44
|
+
imageFit: ImageFit.center,
|
|
45
|
+
width: "86px",
|
|
46
|
+
height: "86px",
|
|
47
|
+
shouldFadeIn: false,
|
|
48
|
+
shouldStartVisible: true
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -69,7 +69,7 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
69
69
|
let optionalParams = {};
|
|
70
70
|
|
|
71
71
|
//Connect to Active chats and chat is not popout
|
|
72
|
-
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === ConversationState.Active &&
|
|
72
|
+
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === ConversationState.Active && state.appStates.hideStartChatButton === false) {
|
|
73
73
|
var _persistedState$domai2;
|
|
74
74
|
optionalParams = {
|
|
75
75
|
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
@@ -112,7 +112,7 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
112
112
|
}
|
|
113
113
|
if (current && current.tagName.toLowerCase() == HtmlAttributeNames.div && current.childElementCount > 0) {
|
|
114
114
|
const input = current.children[0].children;
|
|
115
|
-
if (input
|
|
115
|
+
if ((input === null || input === void 0 ? void 0 : input.length) > 0 && input[0].className != HtmlAttributeNames.adaptiveCardToggleInputClassName && input[0].className != HtmlAttributeNames.adaptiveCardActionSetClassName) {
|
|
116
116
|
input[0].setAttribute(HtmlAttributeNames.ariaLabel, value);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -26,6 +26,10 @@ export const ReconnectChatPaneStateful = props => {
|
|
|
26
26
|
};
|
|
27
27
|
await initStartChat(optionalParams);
|
|
28
28
|
} else {
|
|
29
|
+
dispatch({
|
|
30
|
+
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
31
|
+
payload: undefined
|
|
32
|
+
});
|
|
29
33
|
const parseToJson = false;
|
|
30
34
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
31
35
|
if (preChatSurveyResponse) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
4
|
import "rxjs/add/operator/share";
|
|
3
5
|
import "rxjs/add/observable/of";
|
|
4
6
|
import { ConnectionStatus } from "botframework-directlinejs";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
4
|
import MockAdapter from "./mockadapter";
|
|
3
5
|
export class MockChatSDK {
|
|
4
6
|
constructor() {
|
package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js
CHANGED
|
@@ -6,6 +6,7 @@ const FileAttachmentIconMap = {
|
|
|
6
6
|
"aac": AudioIcon,
|
|
7
7
|
"aiff": AudioIcon,
|
|
8
8
|
"alac": AudioIcon,
|
|
9
|
+
"amr": AudioIcon,
|
|
9
10
|
"avchd": VideoIcon,
|
|
10
11
|
"avi": VideoIcon,
|
|
11
12
|
"bmp": ImageIcon,
|
|
@@ -44,6 +45,7 @@ const FileAttachmentIconMap = {
|
|
|
44
45
|
"vsdx": VisioIcon,
|
|
45
46
|
"wav": AudioIcon,
|
|
46
47
|
"webm": VideoIcon,
|
|
48
|
+
"webp": ImageIcon,
|
|
47
49
|
"wma": AudioIcon,
|
|
48
50
|
"wmv": VideoIcon,
|
|
49
51
|
"xls": ExcelIcon,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
4
|
export class BotMagicCodeStore {}
|
|
3
5
|
_defineProperty(BotMagicCodeStore, "botOAuthSignInId", "");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
|
+
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; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
2
4
|
export class WebChatStoreLoader {}
|
|
3
5
|
_defineProperty(WebChatStoreLoader, "store", void 0);
|
|
@@ -51,9 +51,7 @@ export const activityStatusMiddleware = () => next => args => {
|
|
|
51
51
|
style: {
|
|
52
52
|
padding: "2px"
|
|
53
53
|
}
|
|
54
|
-
}, sendState === SendStatus.Sending && /*#__PURE__*/React.createElement(SendingTimestamp, {
|
|
55
|
-
args: args
|
|
56
|
-
}), sendState === SendStatus.SendFailed && /*#__PURE__*/React.createElement(NotDeliveredTimestamp, {
|
|
54
|
+
}, sendState === SendStatus.Sending && /*#__PURE__*/React.createElement(SendingTimestamp, null), sendState === SendStatus.SendFailed && /*#__PURE__*/React.createElement(NotDeliveredTimestamp, {
|
|
57
55
|
args: args
|
|
58
56
|
}), sendState === SendStatus.Sent && /*#__PURE__*/React.createElement(DeliveredTimestamp, {
|
|
59
57
|
args: args,
|