@microsoft/omnichannel-chat-widget 0.1.0-main.a2e5071 → 0.1.0-main.a3902df
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 +7 -3
- 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 +4 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +5 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +3 -1
- 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/dummyDefaultProps.js +64 -13
- package/lib/cjs/components/livechatwidget/common/endChat.js +20 -2
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +13 -19
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +4 -7
- package/lib/cjs/components/livechatwidget/common/startChat.js +79 -19
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +38 -37
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +15 -2
- package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- 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/contexts/common/LiveChatWidgetActionType.js +29 -28
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +5 -2
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -0
- package/lib/esm/assets/Icons.js +2 -1
- package/lib/esm/common/Constants.js +7 -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 +4 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +5 -2
- package/lib/esm/common/telemetry/TelemetryManager.js +3 -1
- 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/dummyDefaultProps.js +64 -13
- package/lib/esm/components/livechatwidget/common/endChat.js +20 -2
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -19
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +5 -7
- package/lib/esm/components/livechatwidget/common/startChat.js +79 -19
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +39 -38
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +15 -2
- package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- 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/contexts/common/LiveChatWidgetActionType.js +29 -28
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +5 -2
- package/lib/esm/contexts/createReducer.js +8 -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 +2 -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 +5 -1
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
- 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/startChat.d.ts +3 -3
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
- package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +29 -28
- package/package.json +3 -3
|
@@ -1,17 +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 { createTimer, getBroadcastChannelName, getLocaleDirection, getStateFromCache, getWidgetCacheId, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
|
|
7
6
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
7
|
+
import { createTimer, getBroadcastChannelName, getLocaleDirection, getStateFromCache, getWidgetCacheId, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
|
|
8
|
+
import { endChat, prepareEndChat } from "../common/endChat";
|
|
8
9
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
10
|
+
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
9
11
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
10
12
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
11
13
|
import { Components } from "botframework-webchat";
|
|
12
14
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
13
15
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
14
16
|
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
17
|
+
import { Constants, E2VVOptions } from "../../../common/Constants";
|
|
15
18
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
16
19
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
17
20
|
import HeaderStateful from "../../headerstateful/HeaderStateful";
|
|
@@ -28,26 +31,23 @@ import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
|
28
31
|
import WebChatContainerStateful from "../../webchatcontainerstateful/WebChatContainerStateful";
|
|
29
32
|
import { createFooter } from "../common/createFooter";
|
|
30
33
|
import { createInternetConnectionChangeHandler } from "../common/createInternetConnectionChangeHandler";
|
|
34
|
+
import { defaultClientDataStoreProvider } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
35
|
+
import { defaultScrollBarProps } from "../common/defaultProps/defaultScrollBarProps";
|
|
31
36
|
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
32
37
|
import { disposeTelemetryLoggers } from "../common/disposeTelemetryLoggers";
|
|
33
|
-
import { endChat, prepareEndChat } from "../common/endChat";
|
|
34
38
|
import { getGeneralStylesForButton } from "../common/getGeneralStylesForButton";
|
|
35
39
|
import { initCallingSdk } from "../common/initCallingSdk";
|
|
36
40
|
import { initConfirmationPropsComposer } from "../common/initConfirmationPropsComposer";
|
|
37
41
|
import { initWebChatComposer } from "../common/initWebChatComposer";
|
|
42
|
+
import { registerBroadcastServiceForLocalStorage } from "../../../common/storage/default/defaultCacheManager";
|
|
38
43
|
import { registerTelemetryLoggers } from "../common/registerTelemetryLoggers";
|
|
39
44
|
import { setPostChatContextAndLoadSurvey } from "../common/setPostChatContextAndLoadSurvey";
|
|
40
45
|
import { startProactiveChat } from "../common/startProactiveChat";
|
|
41
46
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
42
47
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
43
48
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
44
|
-
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
45
|
-
import { registerBroadcastServiceForLocalStorage } from "../../../common/storage/default/defaultCacheManager";
|
|
46
|
-
import { defaultClientDataStoreProvider } from "../../../common/storage/default/defaultClientDataStoreProvider";
|
|
47
|
-
import { defaultScrollBarProps } from "../common/defaultProps/defaultScrollBarProps";
|
|
48
|
-
import { E2VVOptions } from "../../../common/Constants";
|
|
49
49
|
export const LiveChatWidgetStateful = props => {
|
|
50
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$
|
|
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;
|
|
51
51
|
const [state, dispatch] = useChatContextStore();
|
|
52
52
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
53
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -95,7 +95,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
95
95
|
};
|
|
96
96
|
} else {
|
|
97
97
|
activeCachedChatExist = false;
|
|
98
|
-
optionalParams =
|
|
98
|
+
optionalParams = {};
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
|
|
@@ -115,9 +115,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
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);
|
|
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
119
|
if (isChatValid === true) {
|
|
120
|
-
await initStartChat(chatSDK,
|
|
120
|
+
await initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -134,12 +134,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
136
|
useEffect(() => {
|
|
137
|
-
var _props$
|
|
137
|
+
var _props$controlProps5, _props$controlProps6, _props$controlProps7, _props$chatConfig, _props$chatConfig$Liv, _props$controlProps9, _props$chatConfig2, _props$chatConfig2$Ch;
|
|
138
138
|
// Add default localStorage support for widget
|
|
139
139
|
if (props.contextDataStore === undefined) {
|
|
140
|
-
var _chatSDK$omnichannelC2, _chatSDK$omnichannelC3, _props$
|
|
141
|
-
|
|
142
|
-
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);
|
|
143
144
|
} else {
|
|
144
145
|
DataStoreManager.clientDataStore = props.contextDataStore;
|
|
145
146
|
}
|
|
@@ -151,17 +152,17 @@ export const LiveChatWidgetStateful = props => {
|
|
|
151
152
|
});
|
|
152
153
|
dispatch({
|
|
153
154
|
type: LiveChatWidgetActionType.SET_START_CHAT_BUTTON_DISPLAY,
|
|
154
|
-
payload: ((_props$
|
|
155
|
+
payload: ((_props$controlProps5 = props.controlProps) === null || _props$controlProps5 === void 0 ? void 0 : _props$controlProps5.hideStartChatButton) || false
|
|
155
156
|
});
|
|
156
157
|
dispatch({
|
|
157
158
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
158
159
|
payload: false
|
|
159
160
|
});
|
|
160
|
-
if ((_props$
|
|
161
|
-
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;
|
|
162
163
|
dispatch({
|
|
163
164
|
type: LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID,
|
|
164
|
-
payload: (_props$
|
|
165
|
+
payload: (_props$controlProps8 = props.controlProps) === null || _props$controlProps8 === void 0 ? void 0 : _props$controlProps8.widgetInstanceId
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
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) {
|
|
@@ -174,7 +175,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
// Initialize global dir
|
|
177
|
-
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);
|
|
178
179
|
dispatch({
|
|
179
180
|
type: LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
180
181
|
payload: globalDir
|
|
@@ -200,7 +201,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
200
201
|
|
|
201
202
|
// useEffect for custom context
|
|
202
203
|
useEffect(() => {
|
|
203
|
-
var _chatSDK$omnichannelC8, _chatSDK$omnichannelC9, _props$
|
|
204
|
+
var _chatSDK$omnichannelC8, _chatSDK$omnichannelC9, _props$controlProps12;
|
|
204
205
|
// Add the custom context on receiving the SetCustomContext event
|
|
205
206
|
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
206
207
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -230,12 +231,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
230
231
|
|
|
231
232
|
// Start chat from SDK Event
|
|
232
233
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(() => {
|
|
233
|
-
var _chatSDK$omnichannelC4, _chatSDK$omnichannelC5, _props$
|
|
234
|
+
var _chatSDK$omnichannelC4, _chatSDK$omnichannelC5, _props$controlProps10;
|
|
234
235
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
235
236
|
Event: TelemetryEvent.StartChatEventRecevied,
|
|
236
237
|
Description: "Start chat event received."
|
|
237
238
|
});
|
|
238
|
-
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC4 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC4 === void 0 ? void 0 : _chatSDK$omnichannelC4.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC5 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC5 === void 0 ? void 0 : _chatSDK$omnichannelC5.widgetId, (props === null || props === void 0 ? void 0 : (_props$
|
|
239
|
+
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC4 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC4 === void 0 ? void 0 : _chatSDK$omnichannelC4.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC5 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC5 === void 0 ? void 0 : _chatSDK$omnichannelC5.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps10 = props.controlProps) === null || _props$controlProps10 === void 0 ? void 0 : _props$controlProps10.widgetInstanceId) ?? "");
|
|
239
240
|
|
|
240
241
|
// Chat not found in cache
|
|
241
242
|
if (persistedState === undefined) {
|
|
@@ -276,9 +277,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
276
277
|
// End chat
|
|
277
278
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
278
279
|
if (state.appStates.hideStartChatButton === false) {
|
|
279
|
-
var _chatSDK$omnichannelC6, _chatSDK$omnichannelC7, _props$
|
|
280
|
+
var _chatSDK$omnichannelC6, _chatSDK$omnichannelC7, _props$controlProps11;
|
|
280
281
|
// This is to ensure to get latest state from cache in multitab
|
|
281
|
-
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$
|
|
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) ?? "");
|
|
282
283
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
283
284
|
prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
284
285
|
} else {
|
|
@@ -298,7 +299,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
298
299
|
});
|
|
299
300
|
|
|
300
301
|
// Listen to end chat event from other tabs
|
|
301
|
-
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC8 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC8 === void 0 ? void 0 : _chatSDK$omnichannelC8.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC9 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC9 === void 0 ? void 0 : _chatSDK$omnichannelC9.widgetId, ((_props$
|
|
302
|
+
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC8 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC8 === void 0 ? void 0 : _chatSDK$omnichannelC8.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC9 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC9 === void 0 ? void 0 : _chatSDK$omnichannelC9.widgetId, ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "");
|
|
302
303
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(async () => {
|
|
303
304
|
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
|
|
304
305
|
return;
|
|
@@ -403,7 +404,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
403
404
|
|
|
404
405
|
// Publish chat widget state
|
|
405
406
|
useEffect(() => {
|
|
406
|
-
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$
|
|
407
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps13;
|
|
407
408
|
// Only activate these windows events when conversation state is active and chat widget is in popout mode
|
|
408
409
|
// Ghost chat scenarios
|
|
409
410
|
/* COMMENTING THIS CODE FOR PARITY WITH OLD LCW
|
|
@@ -421,7 +422,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
421
422
|
};
|
|
422
423
|
}*/
|
|
423
424
|
|
|
424
|
-
widgetStateEventName = getWidgetCacheId(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$
|
|
425
|
+
widgetStateEventName = getWidgetCacheId(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps13 = props.controlProps) === null || _props$controlProps13 === void 0 ? void 0 : _props$controlProps13.widgetInstanceId) ?? "");
|
|
425
426
|
const chatWidgetStateChangeEvent = {
|
|
426
427
|
eventName: widgetStateEventName,
|
|
427
428
|
payload: {
|
|
@@ -457,7 +458,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
457
458
|
const prepareEndChatRelay = (adapter, state) => prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
458
459
|
const prepareStartChatRelay = () => prepareStartChat(props, chatSDK, state, dispatch, setAdapter);
|
|
459
460
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
460
|
-
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK,
|
|
461
|
+
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams, persistedState);
|
|
461
462
|
const confirmationPaneProps = initConfirmationPropsComposer(props);
|
|
462
463
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
463
464
|
::-webkit-scrollbar {
|
|
@@ -483,28 +484,28 @@ export const LiveChatWidgetStateful = props => {
|
|
|
483
484
|
id: widgetElementId,
|
|
484
485
|
styles: generalStyles,
|
|
485
486
|
className: (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.className
|
|
486
|
-
}, !((_props$
|
|
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, {
|
|
487
488
|
buttonProps: props.chatButtonProps,
|
|
488
489
|
outOfOfficeButtonProps: props.outOfOfficeChatButtonProps,
|
|
489
490
|
startChat: prepareStartChatRelay
|
|
490
|
-
})), !((_props$
|
|
491
|
+
})), !((_props$controlProps16 = props.controlProps) !== null && _props$controlProps16 !== void 0 && _props$controlProps16.hideProactiveChatPane) && shouldShowProactiveChatPane(state) && (decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.proactiveChatPane) || /*#__PURE__*/React.createElement(ProactiveChatPaneStateful, {
|
|
491
492
|
proactiveChatProps: props.proactiveChatPaneProps,
|
|
492
493
|
startChat: prepareStartChatRelay
|
|
493
|
-
})), !((_props$
|
|
494
|
+
})), !((_props$controlProps17 = props.controlProps) !== null && _props$controlProps17 !== void 0 && _props$controlProps17.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.header) || /*#__PURE__*/React.createElement(HeaderStateful, {
|
|
494
495
|
headerProps: props.headerProps,
|
|
495
496
|
outOfOfficeHeaderProps: props.outOfOfficeHeaderProps,
|
|
496
497
|
endChat: endChatRelay
|
|
497
|
-
})), !((_props$
|
|
498
|
+
})), !((_props$controlProps18 = props.controlProps) !== null && _props$controlProps18 !== void 0 && _props$controlProps18.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_props$componentOverr4 = props.componentOverrides) === null || _props$componentOverr4 === void 0 ? void 0 : _props$componentOverr4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, props.loadingPaneProps)), !((_props$controlProps19 = props.controlProps) !== null && _props$controlProps19 !== void 0 && _props$controlProps19.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_props$componentOverr5 = props.componentOverrides) === null || _props$componentOverr5 === void 0 ? void 0 : _props$componentOverr5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, props.outOfOfficeHoursPaneProps)), !((_props$controlProps20 = props.controlProps) !== null && _props$controlProps20 !== void 0 && _props$controlProps20.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_props$componentOverr6 = props.componentOverrides) === null || _props$componentOverr6 === void 0 ? void 0 : _props$componentOverr6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
498
499
|
reconnectChatProps: props.reconnectChatPaneProps,
|
|
499
500
|
initStartChat: initStartChatRelay
|
|
500
|
-
})), !((_props$
|
|
501
|
+
})), !((_props$controlProps21 = props.controlProps) !== null && _props$controlProps21 !== void 0 && _props$controlProps21.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_props$componentOverr7 = props.componentOverrides) === null || _props$componentOverr7 === void 0 ? void 0 : _props$componentOverr7.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
501
502
|
surveyProps: props.preChatSurveyPaneProps,
|
|
502
503
|
initStartChat: initStartChatRelay
|
|
503
|
-
})), !((_props$
|
|
504
|
+
})), !((_props$controlProps22 = props.controlProps) !== null && _props$controlProps22 !== void 0 && _props$controlProps22.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
504
505
|
voiceVideoCallingSdk: voiceVideoCallingSDK
|
|
505
|
-
}, props.callingContainerProps)), !((_props$
|
|
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, {
|
|
506
507
|
setPostChatContext: setPostChatContextRelay,
|
|
507
508
|
prepareEndChat: prepareEndChatRelay
|
|
508
|
-
}))), !((_props$
|
|
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)))));
|
|
509
510
|
};
|
|
510
511
|
export default LiveChatWidgetStateful;
|
|
@@ -5,6 +5,7 @@ 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 { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
|
|
8
9
|
export const LoadingPaneStateful = props => {
|
|
9
10
|
var _props$styleProps;
|
|
10
11
|
const [state] = useChatContextStore();
|
|
@@ -13,11 +14,23 @@ export const LoadingPaneStateful = props => {
|
|
|
13
14
|
...props.styleProps,
|
|
14
15
|
generalStyleProps: generalStyleProps
|
|
15
16
|
};
|
|
17
|
+
const errorUIStyleProps = {
|
|
18
|
+
...errorUILoadingPaneStyleProps
|
|
19
|
+
};
|
|
16
20
|
const controlProps = {
|
|
17
21
|
id: "oc-lcw-loading-pane",
|
|
18
22
|
dir: state.domainStates.globalDir,
|
|
19
23
|
...props.controlProps
|
|
20
24
|
};
|
|
25
|
+
const errorUIControlProps = {
|
|
26
|
+
id: "oc-lcw-alert-pane",
|
|
27
|
+
dir: state.domainStates.globalDir,
|
|
28
|
+
titleText: "Chat is failing to load.",
|
|
29
|
+
subtitleText: "Please Close the chat and try again.",
|
|
30
|
+
hideSpinner: true,
|
|
31
|
+
hideSpinnerText: true,
|
|
32
|
+
...props.controlProps
|
|
33
|
+
};
|
|
21
34
|
|
|
22
35
|
// Move focus to the first button
|
|
23
36
|
useEffect(() => {
|
|
@@ -32,8 +45,8 @@ export const LoadingPaneStateful = props => {
|
|
|
32
45
|
}, []);
|
|
33
46
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
34
47
|
componentOverrides: props.componentOverrides,
|
|
35
|
-
controlProps: controlProps,
|
|
36
|
-
styleProps: styleProps
|
|
48
|
+
controlProps: state.appStates.isStartChatFailing ? errorUIControlProps : controlProps,
|
|
49
|
+
styleProps: state.appStates.isStartChatFailing ? errorUIStyleProps : styleProps
|
|
37
50
|
});
|
|
38
51
|
};
|
|
39
52
|
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
|
+
};
|
|
@@ -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
|
}
|
|
@@ -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,
|
|
@@ -229,7 +229,8 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
229
229
|
renderer: next
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
const isUnknownImageObject = contentType.toLowerCase().includes("image") && !imageExtension;
|
|
233
|
+
if (fileExtension === "txt" || isUnknownImageObject) {
|
|
233
234
|
return /*#__PURE__*/React.createElement(Attachment, {
|
|
234
235
|
iconData: iconData,
|
|
235
236
|
textCard: patchAttachment(card, {
|
|
@@ -27,13 +27,12 @@ export const DeliveredTimestamp = _ref => {
|
|
|
27
27
|
} = args;
|
|
28
28
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
29
29
|
style: contentStyles,
|
|
30
|
+
dir: dir
|
|
31
|
+
}, role === DirectLineSenderRole.Bot && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
30
32
|
dir: dir,
|
|
31
|
-
horizontal: true
|
|
32
|
-
}, role === DirectLineSenderRole.Bot && /*#__PURE__*/React.createElement("span", {
|
|
33
33
|
"aria-hidden": "false"
|
|
34
|
-
}, name), role === DirectLineSenderRole.
|
|
34
|
+
}, name, " - ", getTimestampHourMinute(timestamp))), role === DirectLineSenderRole.User && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
35
|
+
"aria-hidden": "false",
|
|
35
36
|
dir: dir
|
|
36
|
-
}, " ", getTimestampHourMinute(timestamp)
|
|
37
|
-
"aria-hidden": "false"
|
|
38
|
-
}, ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED));
|
|
37
|
+
}, " ", getTimestampHourMinute(timestamp), " - ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED)));
|
|
39
38
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import { HtmlAttributeNames } from "../../../../../../common/Constants";
|
|
3
2
|
import { KeyCodes } from "../../../../../../common/KeyCodes";
|
|
4
3
|
import { Stack } from "@fluentui/react";
|
|
5
4
|
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
@@ -50,9 +49,8 @@ export const NotDeliveredTimestamp = _ref => {
|
|
|
50
49
|
timestampWebChatNodes[1].innerText = getTimestampHourMinute(timestamp);
|
|
51
50
|
}
|
|
52
51
|
}, [timestampRef]);
|
|
53
|
-
const onRetryClick = useCallback(async
|
|
52
|
+
const onRetryClick = useCallback(async () => {
|
|
54
53
|
var _activity$channelData;
|
|
55
|
-
removeNotDeliveredTimestamp(event);
|
|
56
54
|
activity.previousClientActivityID = (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.clientActivityID;
|
|
57
55
|
await postActivity(activity);
|
|
58
56
|
focus("sendBox");
|
|
@@ -60,19 +58,9 @@ export const NotDeliveredTimestamp = _ref => {
|
|
|
60
58
|
const onRetryKeyEnter = event => {
|
|
61
59
|
if (event.code === KeyCodes.ENTER) {
|
|
62
60
|
event.preventDefault();
|
|
63
|
-
onRetryClick(
|
|
61
|
+
onRetryClick();
|
|
64
62
|
}
|
|
65
63
|
};
|
|
66
|
-
const removeNotDeliveredTimestamp = event => {
|
|
67
|
-
let parent = event.target.parentElement;
|
|
68
|
-
while (parent.tagName !== HtmlAttributeNames.listItem) {
|
|
69
|
-
parent = parent.parentElement;
|
|
70
|
-
if (parent.tagName === HtmlAttributeNames.unorderedList) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
parent.parentNode.removeChild(parent);
|
|
75
|
-
};
|
|
76
64
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
77
65
|
style: contentStyles,
|
|
78
66
|
dir: dir,
|
|
@@ -2,29 +2,20 @@ import React from "react";
|
|
|
2
2
|
import { Stack } from "@fluentui/react";
|
|
3
3
|
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
4
4
|
import { defaultTimestampContentStyles } from "../defaultStyles/defaultTimestampContentStyles";
|
|
5
|
-
import { getTimestampHourMinute } from "../../../../../../common/utils";
|
|
6
5
|
import { useChatContextStore } from "../../../../../..";
|
|
7
6
|
|
|
8
7
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
9
|
-
export const SendingTimestamp =
|
|
8
|
+
export const SendingTimestamp = () => {
|
|
10
9
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
11
|
-
let {
|
|
12
|
-
args
|
|
13
|
-
} = _ref;
|
|
14
10
|
const [state] = useChatContextStore();
|
|
15
11
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
16
12
|
const contentStyles = {
|
|
17
13
|
...defaultTimestampContentStyles,
|
|
18
14
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
19
15
|
};
|
|
20
|
-
const {
|
|
21
|
-
activity: {
|
|
22
|
-
timestamp
|
|
23
|
-
}
|
|
24
|
-
} = args;
|
|
25
16
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
26
17
|
style: contentStyles,
|
|
27
18
|
dir: dir,
|
|
28
19
|
horizontal: true
|
|
29
|
-
}, /*#__PURE__*/React.createElement("span", null, " ",
|
|
20
|
+
}, /*#__PURE__*/React.createElement("span", null, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_SENDING) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_SENDING, " "));
|
|
30
21
|
};
|