@microsoft/omnichannel-chat-widget 0.1.0-main.1f10a2e → 0.1.0-main.3cfca4d
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 +2 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +4 -0
- package/lib/cjs/common/utils.js +48 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -0
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +49 -17
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +9 -0
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +115 -80
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +80 -84
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +4 -8
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -1
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +0 -1
- package/lib/cjs/controller/componentController.js +3 -3
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +4 -0
- package/lib/esm/common/utils.js +36 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +50 -18
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +10 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +114 -80
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +80 -84
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -8
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -1
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +0 -1
- package/lib/esm/controller/componentController.js +3 -3
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +4 -1
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -1
- package/lib/types/common/utils.d.ts +3 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
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
|
|
|
3
3
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
4
4
|
import { BroadcastService, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
5
5
|
import { Stack } from "@fluentui/react";
|
|
6
6
|
import React, { useEffect, useRef, useState } from "react";
|
|
7
|
-
import { createTimer, getLocaleDirection, getWidgetCacheId, getWidgetEndChatEventName } from "../../../common/utils";
|
|
7
|
+
import { createTimer, getLocaleDirection, getStateFromCache, getWidgetCacheId, getWidgetEndChatEventName, isUndefinedOrEmpty } from "../../../common/utils";
|
|
8
8
|
import { getReconnectIdForAuthenticatedChat, handleUnauthenticatedReconnectChat, startUnauthenticatedReconnectChat } from "../common/reconnectChatHelper";
|
|
9
|
-
import { initStartChat, prepareStartChat } from "../common/startChat";
|
|
9
|
+
import { initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
10
10
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
11
11
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
12
12
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
@@ -44,7 +44,7 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
|
44
44
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
45
45
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
46
46
|
export const LiveChatWidgetStateful = props => {
|
|
47
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps5, _props$componentOverr, _props$
|
|
47
|
+
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps5, _props$controlProps6, _props$componentOverr, _props$controlProps7, _props$componentOverr2, _props$controlProps8, _props$componentOverr3, _props$controlProps9, _props$componentOverr4, _props$controlProps10, _props$componentOverr5, _props$controlProps11, _props$componentOverr6, _props$controlProps12, _props$componentOverr7, _props$controlProps13, _props$controlProps14, _props$componentOverr8, _props$controlProps15, _props$componentOverr9, _props$controlProps16, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
48
48
|
|
|
49
49
|
const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
50
|
|
|
@@ -59,8 +59,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
59
59
|
const {
|
|
60
60
|
Composer
|
|
61
61
|
} = Components;
|
|
62
|
-
const canStartProactiveChat = useRef(true);
|
|
63
|
-
const canEndChat = useRef(true); // Process general styles
|
|
62
|
+
const canStartProactiveChat = useRef(true); // Process general styles
|
|
64
63
|
|
|
65
64
|
const generalStyles = {
|
|
66
65
|
root: Object.assign({}, getGeneralStylesForButton(state), (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyles)
|
|
@@ -71,9 +70,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
71
70
|
let widgetStateEventName = "";
|
|
72
71
|
|
|
73
72
|
const initiateEndChatOnBrowserUnload = () => {
|
|
74
|
-
var _DataStoreManager$cli;
|
|
73
|
+
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2, _DataStoreManager$cli;
|
|
75
74
|
|
|
76
|
-
|
|
75
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
76
|
+
Event: TelemetryEvent.BrowserUnloadEventStarted,
|
|
77
|
+
Description: "Browser unload event received."
|
|
78
|
+
});
|
|
79
|
+
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId); // End chat if the chat is still active and browser closed
|
|
77
80
|
|
|
78
81
|
if (persistedState.appStates.conversationState === ConversationState.Active) {
|
|
79
82
|
//Browser close scenario/no room for PCS/so just end chat and notify agent immidiately
|
|
@@ -81,22 +84,15 @@ export const LiveChatWidgetStateful = props => {
|
|
|
81
84
|
} // Clean local storage
|
|
82
85
|
|
|
83
86
|
|
|
84
|
-
(_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventName, "localStorage");
|
|
85
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const getStateFromCache = () => {
|
|
89
|
-
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2, _DataStoreManager$cli2;
|
|
87
|
+
(_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventName, "localStorage"); //Message for clearing window[popouTab]
|
|
90
88
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
95
|
-
return persistedState;
|
|
89
|
+
BroadcastService.postMessage({
|
|
90
|
+
eventName: BroadcastEvent.ClosePopoutWindow
|
|
91
|
+
});
|
|
96
92
|
};
|
|
97
93
|
|
|
98
94
|
useEffect(() => {
|
|
99
|
-
var _props$controlProps2, _props$controlProps3, _props$reconnectChatP, _props$controlProps4, _props$chatConfig, _props$chatConfig$Cha,
|
|
95
|
+
var _props$controlProps2, _props$controlProps3, _props$reconnectChatP, _props$controlProps4, _props$chatConfig, _props$chatConfig$Cha, _props$chatConfig2, _props$chatConfig2$Li;
|
|
100
96
|
|
|
101
97
|
registerTelemetryLoggers(props, dispatch);
|
|
102
98
|
createInternetConnectionChangeHandler();
|
|
@@ -131,15 +127,28 @@ export const LiveChatWidgetStateful = props => {
|
|
|
131
127
|
dispatch({
|
|
132
128
|
type: LiveChatWidgetActionType.SET_GLOBAL_DIR,
|
|
133
129
|
payload: globalDir
|
|
134
|
-
});
|
|
130
|
+
}); //Check if auth settings enabled, do not connect to existing chat from cache during refresh/re-load
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
var _state$domainStates2;
|
|
133
|
+
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;
|
|
138
134
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
if (!isAuthenticationSettingsEnabled) {
|
|
136
|
+
var _state$domainStates;
|
|
137
|
+
|
|
138
|
+
if (!isUndefinedOrEmpty((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext) && state.appStates.conversationState === ConversationState.Active) {
|
|
139
|
+
var _state$domainStates2;
|
|
140
|
+
|
|
141
|
+
const optionalParams = {
|
|
142
|
+
liveChatContext: (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.liveChatContext
|
|
143
|
+
};
|
|
144
|
+
initStartChat(chatSDK, dispatch, setAdapter, optionalParams);
|
|
145
|
+
} else {
|
|
146
|
+
// All other case should show start chat button, skipChatButtonRendering will take care of it own
|
|
147
|
+
dispatch({
|
|
148
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
149
|
+
payload: ConversationState.Closed
|
|
150
|
+
});
|
|
151
|
+
}
|
|
143
152
|
}
|
|
144
153
|
}, []); // useEffect for when skip chat button rendering
|
|
145
154
|
|
|
@@ -171,11 +180,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
171
180
|
eventName: BroadcastEvent.StartChatSkippingChatButtonRendering
|
|
172
181
|
};
|
|
173
182
|
BroadcastService.postMessage(chatStartedSkippingChatButtonRendering);
|
|
174
|
-
dispatch
|
|
175
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
176
|
-
payload: ConversationState.Loading
|
|
177
|
-
});
|
|
178
|
-
initStartChat(chatSDK, dispatch, setAdapter);
|
|
183
|
+
setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter);
|
|
179
184
|
}
|
|
180
185
|
});
|
|
181
186
|
}
|
|
@@ -183,7 +188,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
183
188
|
}, [state.appStates.skipChatButtonRendering]); // useEffect for when skip chat button rendering
|
|
184
189
|
|
|
185
190
|
useEffect(() => {
|
|
186
|
-
var _chatSDK$
|
|
191
|
+
var _chatSDK$omnichannelC7, _chatSDK$omnichannelC8;
|
|
187
192
|
|
|
188
193
|
// Add the custom context on receiving the SetCustomContext event
|
|
189
194
|
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
@@ -215,13 +220,16 @@ export const LiveChatWidgetStateful = props => {
|
|
|
215
220
|
}); // Start chat from SDK Event
|
|
216
221
|
|
|
217
222
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(() => {
|
|
223
|
+
var _chatSDK$omnichannelC3, _chatSDK$omnichannelC4;
|
|
224
|
+
|
|
218
225
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
219
226
|
Event: TelemetryEvent.StartChatEventRecevied,
|
|
220
227
|
Description: "Start chat event received."
|
|
221
228
|
});
|
|
222
|
-
const persistedState = getStateFromCache();
|
|
229
|
+
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC4 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC4 === void 0 ? void 0 : _chatSDK$omnichannelC4.widgetId);
|
|
223
230
|
|
|
224
|
-
if (persistedState.appStates.conversationState === ConversationState.Closed || persistedState.appStates.conversationState === ConversationState.InActive || persistedState.appStates.conversationState === ConversationState.Postchat) {
|
|
231
|
+
if (persistedState && (persistedState.appStates.conversationState === ConversationState.Closed || persistedState.appStates.conversationState === ConversationState.InActive || persistedState.appStates.conversationState === ConversationState.Postchat)) {
|
|
232
|
+
// Embedded mode
|
|
225
233
|
BroadcastService.postMessage({
|
|
226
234
|
eventName: BroadcastEvent.ChatInitiated
|
|
227
235
|
});
|
|
@@ -229,6 +237,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
229
237
|
} else {
|
|
230
238
|
var _persistedState$domai, _persistedState$domai2, _persistedState$domai3, _persistedState$domai4;
|
|
231
239
|
|
|
240
|
+
// Minimize to Maximize
|
|
232
241
|
dispatch({
|
|
233
242
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
234
243
|
payload: false
|
|
@@ -244,49 +253,38 @@ export const LiveChatWidgetStateful = props => {
|
|
|
244
253
|
}); // End chat
|
|
245
254
|
|
|
246
255
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
247
|
-
if (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
256
|
+
if (state.appStates.skipChatButtonRendering !== true) {
|
|
257
|
+
var _chatSDK$omnichannelC5, _chatSDK$omnichannelC6;
|
|
258
|
+
|
|
259
|
+
// This is to ensure to get latest state from cache in multitab
|
|
260
|
+
const persistedState = getStateFromCache(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC5 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC5 === void 0 ? void 0 : _chatSDK$omnichannelC5.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC6 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC6 === void 0 ? void 0 : _chatSDK$omnichannelC6.widgetId);
|
|
261
|
+
|
|
262
|
+
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
263
|
+
prepareEndChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
|
|
264
|
+
} else {
|
|
265
|
+
const skipEndChatSDK = true;
|
|
266
|
+
const skipCloseChat = false;
|
|
267
|
+
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
|
|
268
|
+
}
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
BroadcastService.postMessage({
|
|
256
272
|
eventName: BroadcastEvent.CloseChat
|
|
257
273
|
});
|
|
258
|
-
});
|
|
274
|
+
}); // End chat on browser unload
|
|
275
|
+
|
|
259
276
|
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChatOnBrowserUnload).subscribe(() => {
|
|
260
277
|
initiateEndChatOnBrowserUnload();
|
|
261
|
-
}); // reset proactive chat params
|
|
262
|
-
|
|
263
|
-
BroadcastService.getMessageByEventName(BroadcastEvent.ResetProactiveChatParams).subscribe(async () => {
|
|
264
|
-
dispatch({
|
|
265
|
-
type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
266
|
-
payload: {
|
|
267
|
-
proactiveChatBodyTitle: "",
|
|
268
|
-
proactiveChatEnablePrechat: false,
|
|
269
|
-
proactiveChatInNewWindow: false
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
278
|
}); // Listen to end chat event from other tabs
|
|
273
279
|
|
|
274
|
-
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$
|
|
280
|
+
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC7 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC7 === void 0 ? void 0 : _chatSDK$omnichannelC7.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC8 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC8 === void 0 ? void 0 : _chatSDK$omnichannelC8.widgetId);
|
|
275
281
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(async () => {
|
|
276
282
|
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, false);
|
|
277
|
-
}); //
|
|
278
|
-
|
|
279
|
-
window.addEventListener("beforeunload", () => {
|
|
280
|
-
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
281
|
-
Event: TelemetryEvent.WindowClosed,
|
|
282
|
-
Description: "Closed window."
|
|
283
|
-
});
|
|
284
|
-
disposeTelemetryLoggers();
|
|
285
|
-
});
|
|
283
|
+
}); // When conversation ended by agent
|
|
286
284
|
|
|
287
285
|
if (state.appStates.conversationEndedByAgent) {
|
|
288
286
|
endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
|
|
289
|
-
} //Listen to WidgetSize
|
|
287
|
+
} //Listen to WidgetSize, used for minimize to maximize
|
|
290
288
|
|
|
291
289
|
|
|
292
290
|
BroadcastService.getMessageByEventName("WidgetSize").subscribe(msg => {
|
|
@@ -295,25 +293,23 @@ export const LiveChatWidgetStateful = props => {
|
|
|
295
293
|
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
296
294
|
});
|
|
297
295
|
});
|
|
296
|
+
return () => {
|
|
297
|
+
disposeTelemetryLoggers();
|
|
298
|
+
};
|
|
298
299
|
}, []);
|
|
299
300
|
useEffect(() => {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (state.appStates.conversationState === ConversationState.Active) {
|
|
303
|
-
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
|
|
304
|
-
BroadcastService.postMessage({
|
|
305
|
-
eventName: BroadcastEvent.NewMessageNotification
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
} // Track the message count
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
// On new message
|
|
311
302
|
if (state.appStates.conversationState === ConversationState.Active) {
|
|
312
303
|
chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.onNewMessage(() => {
|
|
304
|
+
// Track the message count
|
|
313
305
|
currentMessageCountRef.current++;
|
|
314
306
|
dispatch({
|
|
315
307
|
type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
|
|
316
308
|
payload: currentMessageCountRef.current + 1
|
|
309
|
+
}); // New message notification
|
|
310
|
+
|
|
311
|
+
BroadcastService.postMessage({
|
|
312
|
+
eventName: BroadcastEvent.NewMessageNotification
|
|
317
313
|
});
|
|
318
314
|
});
|
|
319
315
|
}
|
|
@@ -337,7 +333,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
337
333
|
}, [state.appStates.isMinimized]); // Broadcast the UnreadMessageCount state on any change.
|
|
338
334
|
|
|
339
335
|
useEffect(() => {
|
|
340
|
-
if (state.appStates.isMinimized && state.appStates.unreadMessageCount > 0) {
|
|
336
|
+
if (state.appStates.isMinimized === true && state.appStates.unreadMessageCount > 0) {
|
|
341
337
|
const customEvent = {
|
|
342
338
|
elementType: ElementType.Custom,
|
|
343
339
|
eventName: BroadcastEvent.UnreadMessageCount,
|
|
@@ -388,28 +384,28 @@ export const LiveChatWidgetStateful = props => {
|
|
|
388
384
|
id: widgetElementId,
|
|
389
385
|
styles: generalStyles,
|
|
390
386
|
className: (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.className
|
|
391
|
-
}, !((_props$controlProps5 = props.controlProps) !== null && _props$controlProps5 !== void 0 && _props$controlProps5.hideChatButton) && shouldShowChatButton(state) && (decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.chatButton) || /*#__PURE__*/React.createElement(ChatButtonStateful, {
|
|
387
|
+
}, !((_props$controlProps5 = props.controlProps) !== null && _props$controlProps5 !== void 0 && _props$controlProps5.hideChatButton) && !((_props$controlProps6 = props.controlProps) !== null && _props$controlProps6 !== void 0 && _props$controlProps6.skipChatButtonRendering) && shouldShowChatButton(state) && (decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.chatButton) || /*#__PURE__*/React.createElement(ChatButtonStateful, {
|
|
392
388
|
buttonProps: props.chatButtonProps,
|
|
393
389
|
outOfOfficeButtonProps: props.outOfOfficeChatButtonProps,
|
|
394
390
|
startChat: prepareStartChatRelay
|
|
395
|
-
})), !((_props$
|
|
391
|
+
})), !((_props$controlProps7 = props.controlProps) !== null && _props$controlProps7 !== void 0 && _props$controlProps7.hideProactiveChatPane) && shouldShowProactiveChatPane(state) && (decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.proactiveChatPane) || /*#__PURE__*/React.createElement(ProactiveChatPaneStateful, {
|
|
396
392
|
proactiveChatProps: props.proactiveChatPaneProps,
|
|
397
393
|
startChat: prepareStartChatRelay
|
|
398
|
-
})), !((_props$
|
|
394
|
+
})), !((_props$controlProps8 = props.controlProps) !== null && _props$controlProps8 !== void 0 && _props$controlProps8.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_props$componentOverr3 = props.componentOverrides) === null || _props$componentOverr3 === void 0 ? void 0 : _props$componentOverr3.header) || /*#__PURE__*/React.createElement(HeaderStateful, {
|
|
399
395
|
headerProps: props.headerProps,
|
|
400
396
|
outOfOfficeHeaderProps: props.outOfOfficeHeaderProps,
|
|
401
397
|
endChat: endChatRelay
|
|
402
|
-
})), !((_props$
|
|
398
|
+
})), !((_props$controlProps9 = props.controlProps) !== null && _props$controlProps9 !== void 0 && _props$controlProps9.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$controlProps10 = props.controlProps) !== null && _props$controlProps10 !== void 0 && _props$controlProps10.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$controlProps11 = props.controlProps) !== null && _props$controlProps11 !== void 0 && _props$controlProps11.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_props$componentOverr6 = props.componentOverrides) === null || _props$componentOverr6 === void 0 ? void 0 : _props$componentOverr6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
403
399
|
reconnectChatProps: props.reconnectChatPaneProps,
|
|
404
400
|
initStartChat: initStartChatRelay
|
|
405
|
-
})), !((_props$
|
|
401
|
+
})), !((_props$controlProps12 = props.controlProps) !== null && _props$controlProps12 !== void 0 && _props$controlProps12.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_props$componentOverr7 = props.componentOverrides) === null || _props$componentOverr7 === void 0 ? void 0 : _props$componentOverr7.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
406
402
|
surveyProps: props.preChatSurveyPaneProps,
|
|
407
403
|
initStartChat: initStartChatRelay
|
|
408
|
-
})), !((_props$
|
|
404
|
+
})), !((_props$controlProps13 = props.controlProps) !== null && _props$controlProps13 !== void 0 && _props$controlProps13.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
409
405
|
voiceVideoCallingSdk: voiceVideoCallingSDK
|
|
410
|
-
}, props.callingContainerProps)), !((_props$
|
|
406
|
+
}, props.callingContainerProps)), !((_props$controlProps14 = props.controlProps) !== null && _props$controlProps14 !== void 0 && _props$controlProps14.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$controlProps15 = props.controlProps) !== null && _props$controlProps15 !== void 0 && _props$controlProps15.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_props$componentOverr9 = props.componentOverrides) === null || _props$componentOverr9 === void 0 ? void 0 : _props$componentOverr9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
411
407
|
setPostChatContext: setPostChatContextRelay,
|
|
412
408
|
prepareEndChat: prepareEndChatRelay
|
|
413
|
-
}))), !((_props$
|
|
409
|
+
}))), !((_props$controlProps16 = props.controlProps) !== null && _props$controlProps16 !== void 0 && _props$controlProps16.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))));
|
|
414
410
|
};
|
|
415
411
|
export default LiveChatWidgetStateful;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import { extractPreChatSurveyResponseValues, findAllFocusableElement,
|
|
4
|
+
import { extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
5
5
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
6
|
-
import { DataStoreManager } from "../../common/contextDataStore/DataStoreManager";
|
|
7
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
8
7
|
import { PreChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
9
8
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
@@ -67,14 +66,12 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
try {
|
|
70
|
-
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2,
|
|
69
|
+
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _persistedState$domai, _persistedState$appSt;
|
|
71
70
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
75
|
-
let optionalParams = {};
|
|
71
|
+
const persistedState = getStateFromCache(((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$t = _state$domainStates.telemetryInternalData) === null || _state$domainStates$t === void 0 ? void 0 : _state$domainStates$t.orgId) ?? "", ((_state$domainStates$t2 = state.domainStates.telemetryInternalData) === null || _state$domainStates$t2 === void 0 ? void 0 : _state$domainStates$t2.widgetId) ?? "");
|
|
72
|
+
let optionalParams = {}; //Connect to Active chats and chat is not popout
|
|
76
73
|
|
|
77
|
-
if (persistedState
|
|
74
|
+
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.skipChatButtonRendering) {
|
|
78
75
|
var _persistedState$domai2;
|
|
79
76
|
|
|
80
77
|
optionalParams = {
|
|
@@ -103,7 +103,7 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
103
103
|
});
|
|
104
104
|
},
|
|
105
105
|
...(proactiveChatProps === null || proactiveChatProps === void 0 ? void 0 : proactiveChatProps.controlProps),
|
|
106
|
-
bodyTitleText: state.appStates.proactiveChatStates.proactiveChatBodyTitle
|
|
106
|
+
bodyTitleText: state.appStates.proactiveChatStates.proactiveChatBodyTitle ? state.appStates.proactiveChatStates.proactiveChatBodyTitle : proactiveChatProps === null || proactiveChatProps === void 0 ? void 0 : (_proactiveChatProps$c = proactiveChatProps.controlProps) === null || _proactiveChatProps$c === void 0 ? void 0 : _proactiveChatProps$c.bodyTitleText
|
|
107
107
|
};
|
|
108
108
|
useEffect(() => {
|
|
109
109
|
setFocusOnElement(document.getElementById(controlProps.id + "-startbutton"));
|
|
@@ -8,6 +8,7 @@ export let ConversationState;
|
|
|
8
8
|
ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
|
|
9
9
|
ConversationState[ConversationState["Active"] = 5] = "Active";
|
|
10
10
|
ConversationState[ConversationState["InActive"] = 6] = "InActive";
|
|
11
|
-
ConversationState[ConversationState["
|
|
12
|
-
ConversationState[ConversationState["
|
|
11
|
+
ConversationState[ConversationState["PostchatLoading"] = 7] = "PostchatLoading";
|
|
12
|
+
ConversationState[ConversationState["Postchat"] = 8] = "Postchat";
|
|
13
|
+
ConversationState[ConversationState["Closed"] = 9] = "Closed";
|
|
13
14
|
})(ConversationState || (ConversationState = {}));
|
|
@@ -27,7 +27,6 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
27
27
|
isMinimized: false,
|
|
28
28
|
previousElementOnFocusBeforeModalOpen: null,
|
|
29
29
|
outsideOperatingHours: false,
|
|
30
|
-
shouldShowPostChat: false,
|
|
31
30
|
preChatResponseEmail: "",
|
|
32
31
|
isAudioMuted: null,
|
|
33
32
|
newMessage: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConversationState } from "../contexts/common/ConversationState";
|
|
2
2
|
export const shouldShowChatButton = state => {
|
|
3
|
-
return state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed;
|
|
3
|
+
return (state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
|
|
4
4
|
};
|
|
5
5
|
export const shouldShowProactiveChatPane = state => {
|
|
6
6
|
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ProactiveChat;
|
|
@@ -18,13 +18,13 @@ export const shouldShowWebChatContainer = state => {
|
|
|
18
18
|
return state.appStates.conversationState === ConversationState.Active || state.appStates.conversationState === ConversationState.InActive;
|
|
19
19
|
};
|
|
20
20
|
export const shouldShowLoadingPane = state => {
|
|
21
|
-
return !state.appStates.isMinimized &&
|
|
21
|
+
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.Loading;
|
|
22
22
|
};
|
|
23
23
|
export const shouldShowReconnectChatPane = state => {
|
|
24
24
|
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.ReconnectChat;
|
|
25
25
|
};
|
|
26
26
|
export const shouldShowPostChatLoadingPane = state => {
|
|
27
|
-
return !state.appStates.isMinimized && state.appStates.
|
|
27
|
+
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.PostchatLoading;
|
|
28
28
|
};
|
|
29
29
|
export const shouldShowOutOfOfficeHoursPane = state => {
|
|
30
30
|
return !state.appStates.isMinimized && state.appStates.conversationState === ConversationState.OutOfOffice;
|
|
@@ -76,6 +76,7 @@ export declare class Constants {
|
|
|
76
76
|
static readonly internetConnectionTestUrl = "https://ocsdk-prod.azureedge.net/public/connecttest.txt";
|
|
77
77
|
static readonly internetConnectionTestUrlText = "Omnichannel Connect Test";
|
|
78
78
|
static readonly ChatWidgetStateChangedPrefix = "ChatWidgetStateChanged";
|
|
79
|
+
static readonly PostChatLoadingDurationInMs = 2000;
|
|
79
80
|
}
|
|
80
81
|
export declare const Regex: {
|
|
81
82
|
new (): {};
|
|
@@ -40,7 +40,8 @@ export declare enum BroadcastEvent {
|
|
|
40
40
|
MaximizeChat = "MaximizeChat",
|
|
41
41
|
ChatInitiated = "ChatInitiated",
|
|
42
42
|
CloseChat = "CloseChat",
|
|
43
|
-
InitiateEndChatOnBrowserUnload = "InitiateEndChatOnBrowserUnload"
|
|
43
|
+
InitiateEndChatOnBrowserUnload = "InitiateEndChatOnBrowserUnload",
|
|
44
|
+
ClosePopoutWindow = "ClosePopoutWindow"
|
|
44
45
|
}
|
|
45
46
|
export declare enum TelemetryEvent {
|
|
46
47
|
CallAdded = "CallAdded",
|
|
@@ -118,6 +119,8 @@ export declare enum TelemetryEvent {
|
|
|
118
119
|
AudioToggleButtonClicked = "AudioToggleButtonClicked",
|
|
119
120
|
SuppressBotMagicCodeSucceeded = "SuppressBotMagicCodeSucceeded",
|
|
120
121
|
SuppressBotMagicCodeFailed = "SuppressBotMagicCodeFailed",
|
|
122
|
+
GetConversationDetailsException = "GetConversationDetailsException",
|
|
123
|
+
BrowserUnloadEventStarted = "BrowserUnloadEventStarted",
|
|
121
124
|
ProcessingHTMLTextMiddlewareFailed = "ProcessingHTMLTextMiddlewareFailed",
|
|
122
125
|
ProcessingSanitizationMiddlewareFailed = "ProcessingSanitizationMiddlewareFailed",
|
|
123
126
|
FormatTagsMiddlewareJSONStringifyFailed = "FormatTagsMiddlewareJSONStringifyFailed",
|
|
@@ -31,7 +31,7 @@ export declare class TelemetryHelper {
|
|
|
31
31
|
static addWidgetDataToTelemetry(telemetryConfig: ITelemetryConfig, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
|
|
32
32
|
static addSessionDataToTelemetry(chatSession: LiveChatContext, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
|
|
33
33
|
static addConversationDataToTelemetry(liveWorkItem: LiveWorkItemDetails, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
|
|
34
|
-
static logCallingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper, callId?: string
|
|
34
|
+
static logCallingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper, callId?: string) => void;
|
|
35
35
|
static logLoadingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
|
|
36
36
|
static logActionEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
|
|
37
37
|
static logSDKEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
|
|
@@ -24,3 +24,6 @@ export declare const createTimer: () => ITimer;
|
|
|
24
24
|
export declare const getDomain: (hostValue: any) => string;
|
|
25
25
|
export declare const getWidgetCacheId: (orgId: string, widgetId: string) => string;
|
|
26
26
|
export declare const getWidgetEndChatEventName: (orgId: string, widgetId: string) => string;
|
|
27
|
+
export declare const getStateFromCache: (orgId: string, widgetId: string) => any;
|
|
28
|
+
export declare const isUndefinedOrEmpty: (object: any) => boolean;
|
|
29
|
+
export declare const addDelayInMs: (ms: number) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const downloadTranscript: (chatSDK: any, renderMarkDown?: ((transcriptContent: string) => string) | undefined, bannerMessageOnError?: string
|
|
1
|
+
export declare const downloadTranscript: (chatSDK: any, renderMarkDown?: ((transcriptContent: string) => string) | undefined, bannerMessageOnError?: string, attachmentMessage?: string) => Promise<void>;
|
|
@@ -3,5 +3,5 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
3
3
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
4
4
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
5
5
|
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, state: ILiveChatWidgetContext) => Promise<void>;
|
|
6
|
-
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, skipEndChatSDK?: boolean
|
|
6
|
+
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, skipEndChatSDK?: boolean, skipCloseChat?: boolean, postMessageToOtherTab?: boolean) => Promise<void>;
|
|
7
7
|
export { prepareEndChat, endChat };
|
|
@@ -2,7 +2,7 @@ import "regenerator-runtime/runtime";
|
|
|
2
2
|
import { Dispatch } from "react";
|
|
3
3
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
|
-
declare const getChatReconnectContext: (chatSDK: any, reconnectId?: string
|
|
5
|
+
declare const getChatReconnectContext: (chatSDK: any, reconnectId?: string) => Promise<any>;
|
|
6
6
|
declare const getReconnectIdForAuthenticatedChat: (props: ILiveChatWidgetProps, chatSDK: any) => Promise<string | undefined>;
|
|
7
7
|
declare const handleUnauthenticatedReconnectChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, reconnectId: string, initStartChat: any, redirectInSameWindow: boolean | undefined) => Promise<void>;
|
|
8
8
|
declare const startUnauthenticatedReconnectChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, reconnectId: string, initStartChat: any) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
-
export declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean
|
|
3
|
+
export declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean) => Promise<void>;
|
|
@@ -3,5 +3,6 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
3
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
declare const prepareStartChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
|
|
6
|
+
declare const setPreChatAndInitiateChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | false, proactiveChatEnablePrechatState?: boolean | false) => Promise<void>;
|
|
6
7
|
declare const initStartChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, params?: any, persistedState?: any) => Promise<void>;
|
|
7
|
-
export { prepareStartChat, initStartChat };
|
|
8
|
+
export { prepareStartChat, initStartChat, setPreChatAndInitiateChat };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
3
|
import { IProactiveChatNotificationConfig } from "../../proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig";
|
|
4
|
-
export declare const startProactiveChat: (dispatch: Dispatch<ILiveChatWidgetAction>, notificationConfig?: IProactiveChatNotificationConfig
|
|
4
|
+
export declare const startProactiveChat: (dispatch: Dispatch<ILiveChatWidgetAction>, notificationConfig?: IProactiveChatNotificationConfig, enablePreChat?: boolean, inNewWindow?: boolean) => void;
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* 3. Decodes certain html characters that came through from chat services
|
|
8
8
|
******/
|
|
9
9
|
import React from "react";
|
|
10
|
-
export declare const createActivityMiddleware: (systemMessageStyleProps?: React.CSSProperties
|
|
10
|
+
export declare const createActivityMiddleware: (systemMessageStyleProps?: React.CSSProperties, userMessageStyleProps?: React.CSSProperties) => () => (next: any) => (...args: any) => any;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* 1. Renders the first two letters of the sender as the profile pic
|
|
6
6
|
******/
|
|
7
7
|
import React from "react";
|
|
8
|
-
export declare const createAvatarMiddleware: (avatarStyleProps?: React.CSSProperties
|
|
8
|
+
export declare const createAvatarMiddleware: (avatarStyleProps?: React.CSSProperties, avatarTextStyleProps?: React.CSSProperties) => () => (next: any) => (args_0: any) => false | (() => JSX.Element);
|
|
@@ -23,7 +23,6 @@ export interface ILiveChatWidgetContext {
|
|
|
23
23
|
isMinimized: boolean;
|
|
24
24
|
previousElementOnFocusBeforeModalOpen: HTMLElement | null;
|
|
25
25
|
outsideOperatingHours: boolean;
|
|
26
|
-
shouldShowPostChat: boolean;
|
|
27
26
|
preChatResponseEmail: string;
|
|
28
27
|
isAudioMuted: boolean | null;
|
|
29
28
|
newMessage: boolean;
|