@microsoft/omnichannel-chat-widget 1.0.3-main.527b216 → 1.0.3-main.8b82e52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/Constants.js +54 -1
- package/lib/cjs/common/storage/default/defaultCacheManager.js +7 -6
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/cjs/common/telemetry/TelemetryConstants.js +6 -1
- package/lib/cjs/common/utils.js +27 -5
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -10
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -1
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +2 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +197 -99
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +29 -27
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +139 -0
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -255
- package/lib/cjs/components/livechatwidget/common/startChat.js +70 -57
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +162 -100
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +15 -5
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +16 -13
- package/lib/cjs/contexts/createReducer.js +13 -23
- package/lib/cjs/controller/componentController.js +2 -1
- package/lib/cjs/index.js +20 -0
- package/lib/esm/common/Constants.js +49 -0
- package/lib/esm/common/storage/default/defaultCacheManager.js +5 -4
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/esm/common/telemetry/TelemetryConstants.js +6 -1
- package/lib/esm/common/utils.js +25 -4
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -13
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -1
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +2 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +196 -99
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +29 -27
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +130 -0
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -255
- package/lib/esm/components/livechatwidget/common/startChat.js +71 -58
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +164 -102
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +15 -5
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -15
- package/lib/esm/contexts/createReducer.js +13 -23
- package/lib/esm/controller/componentController.js +2 -1
- package/lib/esm/index.js +4 -1
- package/lib/types/common/Constants.d.ts +21 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +3 -3
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +2 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -1
- package/lib/types/common/utils.d.ts +3 -2
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +6 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -6
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +4 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +8 -7
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +2 -1
- package/lib/types/index.d.ts +3 -0
- package/package.json +2 -1
- package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +0 -36
- package/lib/cjs/contexts/common/ConversationEndEntity.js +0 -12
- package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +0 -30
- package/lib/esm/contexts/common/ConversationEndEntity.js +0 -5
- package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +0 -6
- package/lib/types/contexts/common/ConversationEndEntity.d.ts +0 -4
|
@@ -31,7 +31,6 @@ export let BroadcastEvent;
|
|
|
31
31
|
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
32
32
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
33
33
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
34
|
-
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
35
34
|
BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
|
|
36
35
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
37
36
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
@@ -54,6 +53,8 @@ export let BroadcastEvent;
|
|
|
54
53
|
BroadcastEvent["SigninCardReceived"] = "SignInCardReceived";
|
|
55
54
|
BroadcastEvent["BotAuthConfigRequest"] = "BotAuthConfigRequest";
|
|
56
55
|
BroadcastEvent["BotAuthConfigResponse"] = "BotAuthConfigResponse";
|
|
56
|
+
BroadcastEvent["RemoveWidgetDataFromCache"] = "RemoveWidgetDataFromCache";
|
|
57
|
+
BroadcastEvent["InitiateStartChatInPopoutMode"] = "InitiateStartChatInPopoutMode";
|
|
57
58
|
BroadcastEvent["HideChatVisibilityChangeEvent"] = "hideChatVisibilityChangeEvent";
|
|
58
59
|
BroadcastEvent["UpdateSessionDataForTelemetry"] = "UpdateSessionDataForTelemetry";
|
|
59
60
|
BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
|
|
@@ -89,13 +90,17 @@ export let TelemetryEvent;
|
|
|
89
90
|
TelemetryEvent["CallingSDKInitFailed"] = "CallingSDKInitFailed";
|
|
90
91
|
TelemetryEvent["CallingSDKLoadSuccess"] = "CallingSDKLoadSuccess";
|
|
91
92
|
TelemetryEvent["CallingSDKLoadFailed"] = "CallingSDKLoadFailed";
|
|
93
|
+
TelemetryEvent["GetConversationDetailsCallStarted"] = "GetConversationDetailsCallStarted";
|
|
92
94
|
TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
|
|
93
95
|
TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
|
|
96
|
+
TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
|
|
94
97
|
TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
|
|
95
98
|
TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
|
|
96
99
|
TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
|
|
97
100
|
TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
|
|
98
101
|
TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
|
|
102
|
+
TelemetryEvent["EndChatSucceeded"] = "EndChatSucceeded";
|
|
103
|
+
TelemetryEvent["EndChatFailed"] = "EndChatFailed";
|
|
99
104
|
TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
|
|
100
105
|
TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
|
|
101
106
|
TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -258,7 +258,11 @@ export const getDomain = hostValue => {
|
|
|
258
258
|
}
|
|
259
259
|
return AriaTelemetryConstants.Public;
|
|
260
260
|
};
|
|
261
|
-
export const getWidgetCacheId = (orgId, widgetId, widgetInstanceId)
|
|
261
|
+
export const getWidgetCacheId = function (orgId, widgetId, widgetInstanceId) {
|
|
262
|
+
let popoutChat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
263
|
+
if (popoutChat) {
|
|
264
|
+
widgetInstanceId = widgetInstanceId + Constants.PopoutCacheSuffix;
|
|
265
|
+
}
|
|
262
266
|
const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
263
267
|
return Md5.init(widgetCacheId);
|
|
264
268
|
};
|
|
@@ -270,13 +274,13 @@ export const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) =>
|
|
|
270
274
|
};
|
|
271
275
|
|
|
272
276
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
273
|
-
export const getStateFromCache =
|
|
277
|
+
export const getStateFromCache = widgetCacheId => {
|
|
274
278
|
// Getting updated state from cache
|
|
275
279
|
try {
|
|
276
280
|
if (DataStoreManager.clientDataStore) {
|
|
277
281
|
var _DataStoreManager$cli;
|
|
278
|
-
const widgetStateEventName =
|
|
279
|
-
const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName
|
|
282
|
+
const widgetStateEventName = widgetCacheId;
|
|
283
|
+
const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName);
|
|
280
284
|
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
281
285
|
return persistedState;
|
|
282
286
|
} else {
|
|
@@ -308,6 +312,23 @@ export const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
|
|
|
308
312
|
return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
|
|
309
313
|
};
|
|
310
314
|
|
|
315
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
316
|
+
export const getWidgetCacheIdfromProps = function (props) {
|
|
317
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$controlProps2;
|
|
318
|
+
let popoutChat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
319
|
+
const orgId = 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;
|
|
320
|
+
const widgetId = 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;
|
|
321
|
+
let widgetInstanceId = (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "";
|
|
322
|
+
if (props.useSessionStorage) {
|
|
323
|
+
widgetInstanceId = widgetInstanceId + Constants.SessionCacheSuffix;
|
|
324
|
+
}
|
|
325
|
+
if (props !== null && props !== void 0 && (_props$controlProps2 = props.controlProps) !== null && _props$controlProps2 !== void 0 && _props$controlProps2.hideStartChatButton || popoutChat === true) {
|
|
326
|
+
popoutChat = true;
|
|
327
|
+
}
|
|
328
|
+
const widgetCacheId = getWidgetCacheId(orgId, widgetId, widgetInstanceId, popoutChat);
|
|
329
|
+
return widgetCacheId;
|
|
330
|
+
};
|
|
331
|
+
|
|
311
332
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
333
|
export const debounceLeading = function (fn) {
|
|
313
334
|
let ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3000;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { useEffect,
|
|
3
|
-
import {
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
5
5
|
import { setFocusOnElement } from "../../common/utils";
|
|
6
6
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
@@ -19,7 +19,6 @@ export const ChatButtonStateful = props => {
|
|
|
19
19
|
} = props;
|
|
20
20
|
//Setting OutOfOperatingHours Flag
|
|
21
21
|
const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
|
|
22
|
-
const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
23
22
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
24
23
|
const controlProps = {
|
|
25
24
|
id: "oc-lcw-chat-button",
|
|
@@ -32,12 +31,7 @@ export const ChatButtonStateful = props => {
|
|
|
32
31
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
33
32
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
34
33
|
});
|
|
35
|
-
if (
|
|
36
|
-
const proactiveChatIsInPopoutModeEvent = {
|
|
37
|
-
eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
38
|
-
};
|
|
39
|
-
BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
40
|
-
} else if (state.appStates.isMinimized) {
|
|
34
|
+
if (state.appStates.isMinimized) {
|
|
41
35
|
dispatch({
|
|
42
36
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
43
37
|
payload: false
|
|
@@ -90,9 +84,6 @@ export const ChatButtonStateful = props => {
|
|
|
90
84
|
});
|
|
91
85
|
}
|
|
92
86
|
}, []);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
95
|
-
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
96
87
|
return /*#__PURE__*/React.createElement(ChatButton, {
|
|
97
88
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
98
89
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -5,9 +5,8 @@ import { findAllFocusableElement, findParentFocusableElementsWithoutChildContain
|
|
|
5
5
|
import { DimLayer } from "../dimlayer/DimLayer";
|
|
6
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
7
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
8
|
-
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
9
8
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
10
|
-
import {
|
|
9
|
+
import { ConfirmationState } from "../../common/Constants";
|
|
11
10
|
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
12
|
export const ConfirmationPaneStateful = props => {
|
|
@@ -15,7 +14,6 @@ export const ConfirmationPaneStateful = props => {
|
|
|
15
14
|
let elements = [];
|
|
16
15
|
const [state, dispatch] = useChatContextStore();
|
|
17
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
18
|
-
const [adapter] = useChatAdapterStore();
|
|
19
17
|
const controlProps = {
|
|
20
18
|
id: "oc-lcw-confirmation-pane",
|
|
21
19
|
dir: state.domainStates.globalDir,
|
|
@@ -28,11 +26,11 @@ export const ConfirmationPaneStateful = props => {
|
|
|
28
26
|
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
29
27
|
payload: false
|
|
30
28
|
});
|
|
31
|
-
setTabIndices(elements, initialTabIndexMap, true);
|
|
32
29
|
dispatch({
|
|
33
|
-
type: LiveChatWidgetActionType.
|
|
34
|
-
payload:
|
|
30
|
+
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
31
|
+
payload: ConfirmationState.Ok
|
|
35
32
|
});
|
|
33
|
+
setTabIndices(elements, initialTabIndexMap, true);
|
|
36
34
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
37
35
|
Event: TelemetryEvent.ConversationEndedByCustomer,
|
|
38
36
|
Description: "Conversation is ended by customer."
|
|
@@ -47,6 +45,10 @@ export const ConfirmationPaneStateful = props => {
|
|
|
47
45
|
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
48
46
|
payload: false
|
|
49
47
|
});
|
|
48
|
+
dispatch({
|
|
49
|
+
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
50
|
+
payload: ConfirmationState.Cancel
|
|
51
|
+
});
|
|
50
52
|
const previousFocusedElementId = state.appStates.previousElementIdOnFocusBeforeModalOpen;
|
|
51
53
|
if (previousFocusedElementId) {
|
|
52
54
|
setFocusOnElement("#" + previousFocusedElementId);
|
|
@@ -36,7 +36,7 @@ export const FooterStateful = props => {
|
|
|
36
36
|
Event: TelemetryEvent.DownloadTranscriptButtonClicked,
|
|
37
37
|
Description: "Download Transcript button clicked."
|
|
38
38
|
});
|
|
39
|
-
await downloadTranscript(chatSDK, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.renderMarkDown, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.bannerMessageOnError, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.attachmentMessage);
|
|
39
|
+
await downloadTranscript(chatSDK, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.renderMarkDown, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.bannerMessageOnError, downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.attachmentMessage, state);
|
|
40
40
|
} catch (ex) {
|
|
41
41
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
42
42
|
Event: TelemetryEvent.DownloadTranscriptFailed,
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -151,8 +151,15 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
|
-
export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageOnError, attachmentMessage) => {
|
|
154
|
+
export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageOnError, attachmentMessage, state) => {
|
|
155
|
+
var _state$domainStates, _state$domainStates2, _state$domainStates2$;
|
|
156
|
+
// Need to keep existing request id for scenarios when trnascript is downloaded after endchat
|
|
157
|
+
const existingRequestId = chatSDK.requestId;
|
|
158
|
+
chatSDK.chatToken = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.chatToken;
|
|
159
|
+
chatSDK.requestId = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.chatToken) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.requestId;
|
|
155
160
|
let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript());
|
|
161
|
+
// This is used for allowing to start next chat
|
|
162
|
+
chatSDK.requestId = existingRequestId;
|
|
156
163
|
if (typeof data === Constants.String) {
|
|
157
164
|
data = JSON.parse(data);
|
|
158
165
|
}
|
|
@@ -7,9 +7,9 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
7
7
|
import { defaultOutOfOfficeHeaderStyleProps } from "./common/styleProps/defaultOutOfOfficeHeaderStyleProps";
|
|
8
8
|
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
9
9
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
10
|
-
import {
|
|
10
|
+
import { ConfirmationState } from "../../common/Constants";
|
|
11
11
|
export const HeaderStateful = props => {
|
|
12
|
-
var _state$domainStates$l, _state$domainStates$l2, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro;
|
|
12
|
+
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro, _state$domainStates3;
|
|
13
13
|
const [state, dispatch] = useChatContextStore();
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
15
|
const [adapter] = useChatAdapterStore();
|
|
@@ -21,8 +21,9 @@ export const HeaderStateful = props => {
|
|
|
21
21
|
//Setting OutOfOperatingHours Flag
|
|
22
22
|
const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
|
|
23
23
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
// For some reason state object is not getting updated values in this component
|
|
26
|
+
const localConfirmationPaneState = useRef(state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.confirmationState);
|
|
26
27
|
const controlProps = {
|
|
27
28
|
id: "oc-lcw-header",
|
|
28
29
|
dir: state.domainStates.globalDir,
|
|
@@ -42,7 +43,7 @@ export const HeaderStateful = props => {
|
|
|
42
43
|
Event: TelemetryEvent.HeaderCloseButtonClicked,
|
|
43
44
|
Description: "Header Close button clicked."
|
|
44
45
|
});
|
|
45
|
-
if (
|
|
46
|
+
if (localConfirmationPaneState.current !== ConfirmationState.Ok) {
|
|
46
47
|
dispatch({
|
|
47
48
|
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
48
49
|
payload: true
|
|
@@ -62,9 +63,9 @@ export const HeaderStateful = props => {
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
|
|
65
|
-
hideTitle: state.appStates.conversationState === ConversationState.Loading && !state.appStates.
|
|
66
|
-
hideIcon: state.appStates.conversationState === ConversationState.Loading && !state.appStates.
|
|
67
|
-
hideCloseButton: state.appStates.conversationState === ConversationState.Loading && !state.appStates.
|
|
66
|
+
hideTitle: state.appStates.conversationState === ConversationState.Loading && !state.appStates.startChatFailed || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
67
|
+
hideIcon: state.appStates.conversationState === ConversationState.Loading && !state.appStates.startChatFailed || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
68
|
+
hideCloseButton: state.appStates.conversationState === ConversationState.Loading && !state.appStates.startChatFailed || state.appStates.conversationState === ConversationState.PostchatLoading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
|
|
68
69
|
};
|
|
69
70
|
const outOfOfficeControlProps = {
|
|
70
71
|
id: "oc-lcw-header",
|
|
@@ -85,11 +86,11 @@ export const HeaderStateful = props => {
|
|
|
85
86
|
if (state.appStates.outsideOperatingHours) {
|
|
86
87
|
setOutOfOperatingHours(true);
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}, [state.
|
|
89
|
+
}, []);
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
var _state$domainStates2;
|
|
92
|
+
localConfirmationPaneState.current = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.confirmationState;
|
|
93
|
+
}, [state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.confirmationState]);
|
|
93
94
|
return /*#__PURE__*/React.createElement(Header, {
|
|
94
95
|
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
95
96
|
controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js
CHANGED
|
@@ -3,6 +3,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
3
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); }
|
|
4
4
|
export class DefaultActivitySubscriber {
|
|
5
5
|
constructor() {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
7
|
_defineProperty(this, "observer", void 0);
|
|
7
8
|
}
|
|
8
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js
CHANGED
|
@@ -4,6 +4,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
4
4
|
import { ActivityStreamHandler } from "../ActivityStreamHandler";
|
|
5
5
|
export class PauseActivitySubscriber {
|
|
6
6
|
constructor() {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
8
|
_defineProperty(this, "observer", void 0);
|
|
8
9
|
}
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -10,9 +10,11 @@ export class Deferred {
|
|
|
10
10
|
_defineProperty(this, "_reject", () => {
|
|
11
11
|
return;
|
|
12
12
|
});
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
_defineProperty(this, "resolve", value => {
|
|
14
15
|
this._resolve(value);
|
|
15
16
|
});
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
18
|
_defineProperty(this, "reject", value => {
|
|
17
19
|
this._reject(value);
|
|
18
20
|
});
|
|
@@ -21,9 +23,6 @@ export class Deferred {
|
|
|
21
23
|
this._reject = reject;
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
|
|
27
26
|
get promise() {
|
|
28
27
|
return this._promise;
|
|
29
28
|
}
|