@microsoft/omnichannel-chat-widget 1.0.3-main.c925679 → 1.0.4-main.337860d
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 +4 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -1
- package/lib/cjs/common/telemetry/TelemetryManager.js +5 -2
- package/lib/cjs/common/utils.js +22 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -10
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -6
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +32 -43
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +7 -8
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +2 -1
- package/lib/cjs/components/livechatwidget/common/startChat.js +61 -20
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -1
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +20 -20
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +4 -4
- package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/esm/common/Constants.js +4 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +2 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +5 -2
- package/lib/esm/common/utils.js +20 -1
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +7 -6
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +31 -41
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +7 -8
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +2 -1
- package/lib/esm/components/livechatwidget/common/startChat.js +62 -21
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +2 -1
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +21 -21
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +4 -4
- package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/types/common/Constants.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -2
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +2 -3
- package/package.json +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import { ChatSDKError, LiveWorkItemState } from "../../../common/Constants";
|
|
3
|
-
import { createTimer, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
|
|
2
|
+
import { ChatSDKError, Constants, LiveWorkItemState } from "../../../common/Constants";
|
|
3
|
+
import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
|
|
4
4
|
import { getAuthClientFunction, handleAuthentication } from "./authHelper";
|
|
5
5
|
import { ActivityStreamHandler } from "./ActivityStreamHandler";
|
|
6
6
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -123,7 +123,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
123
123
|
try {
|
|
124
124
|
var _window$Microsoft, _window$Microsoft$Dyn, _window$Microsoft$Dyn2, _window$Microsoft$Dyn3;
|
|
125
125
|
// Set custom context params
|
|
126
|
-
setCustomContextParams();
|
|
126
|
+
await setCustomContextParams(props);
|
|
127
127
|
const defaultOptionalParams = {
|
|
128
128
|
sendDefaultInitContext: true,
|
|
129
129
|
isProactiveChat: !!(params !== null && params !== void 0 && params.isProactiveChat),
|
|
@@ -133,6 +133,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
133
133
|
await chatSDK.startChat(startChatOptionalParams);
|
|
134
134
|
isStartChatSuccessful = true;
|
|
135
135
|
} catch (error) {
|
|
136
|
+
checkContactIdError(error);
|
|
136
137
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
137
138
|
Event: TelemetryEvent.StartChatMethodException,
|
|
138
139
|
ExceptionDetails: {
|
|
@@ -278,25 +279,35 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
|
|
|
278
279
|
};
|
|
279
280
|
|
|
280
281
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
281
|
-
const setCustomContextParams =
|
|
282
|
-
var _persistedState$domai8;
|
|
282
|
+
const setCustomContextParams = async props => {
|
|
283
|
+
var _props$chatConfig, _props$chatConfig$Liv, _persistedState$domai8;
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
+
const isAuthenticatedChat = props !== null && props !== void 0 && (_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction ? true : false;
|
|
286
|
+
//Should not set custom context for auth chat
|
|
287
|
+
if (isAuthenticatedChat) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (isNullOrEmptyString(widgetInstanceId)) {
|
|
291
|
+
widgetInstanceId = getWidgetCacheIdfromProps(props);
|
|
292
|
+
}
|
|
283
293
|
// Add custom context only for unauthenticated chat
|
|
284
294
|
const persistedState = getStateFromCache(widgetInstanceId);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
ExceptionDetails: {
|
|
292
|
-
exception: errorMessage
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
throw new Error(errorMessage);
|
|
296
|
-
}
|
|
295
|
+
const customContextLocal = (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai8 = persistedState.domainStates) === null || _persistedState$domai8 === void 0 ? void 0 : _persistedState$domai8.customContext) ?? (props === null || props === void 0 ? void 0 : props.initialCustomContext);
|
|
296
|
+
if (customContextLocal) {
|
|
297
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
298
|
+
Event: TelemetryEvent.SettingCustomContext,
|
|
299
|
+
Description: "Setting custom context for unauthenticated chat"
|
|
300
|
+
});
|
|
297
301
|
optionalParams = Object.assign({}, optionalParams, {
|
|
298
|
-
customContext:
|
|
302
|
+
customContext: customContextLocal
|
|
299
303
|
});
|
|
304
|
+
} else {
|
|
305
|
+
const customContextFromParent = await getInitContextParamsForPopout();
|
|
306
|
+
if (!isUndefinedOrEmpty(customContextFromParent === null || customContextFromParent === void 0 ? void 0 : customContextFromParent.contextVariables)) {
|
|
307
|
+
optionalParams = Object.assign({}, optionalParams, {
|
|
308
|
+
customContext: customContextFromParent.contextVariables
|
|
309
|
+
});
|
|
310
|
+
}
|
|
300
311
|
}
|
|
301
312
|
};
|
|
302
313
|
const canStartPopoutChat = async props => {
|
|
@@ -305,9 +316,9 @@ const canStartPopoutChat = async props => {
|
|
|
305
316
|
}
|
|
306
317
|
popoutWidgetInstanceId = getWidgetCacheIdfromProps(props, true);
|
|
307
318
|
if (!isNullOrEmptyString(popoutWidgetInstanceId)) {
|
|
308
|
-
var _persistedState$
|
|
319
|
+
var _persistedState$domai9, _persistedState$appSt2;
|
|
309
320
|
const persistedState = getStateFromCache(popoutWidgetInstanceId);
|
|
310
|
-
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$
|
|
321
|
+
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai9 = persistedState.domainStates) === null || _persistedState$domai9 === void 0 ? void 0 : _persistedState$domai9.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt2 = persistedState.appStates) === null || _persistedState$appSt2 === void 0 ? void 0 : _persistedState$appSt2.conversationState) === ConversationState.Active) {
|
|
311
322
|
// Initiate popout chat
|
|
312
323
|
BroadcastService.postMessage({
|
|
313
324
|
eventName: BroadcastEvent.InitiateStartChatInPopoutMode
|
|
@@ -333,7 +344,7 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
333
344
|
});
|
|
334
345
|
try {
|
|
335
346
|
chatSDK.requestId = requestIdFromCache;
|
|
336
|
-
conversationDetails = await chatSDK
|
|
347
|
+
conversationDetails = await getConversationDetailsCall(chatSDK);
|
|
337
348
|
if (Object.keys(conversationDetails).length === 0) {
|
|
338
349
|
chatSDK.requestId = currentRequestId;
|
|
339
350
|
return false;
|
|
@@ -358,4 +369,34 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
|
|
|
358
369
|
return false;
|
|
359
370
|
}
|
|
360
371
|
};
|
|
372
|
+
|
|
373
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
374
|
+
const getInitContextParamsForPopout = async () => {
|
|
375
|
+
return window.opener ? await getInitContextParamForPopoutFromOuterScope(window.opener) : null;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
379
|
+
const getInitContextParamForPopoutFromOuterScope = async scope => {
|
|
380
|
+
let payload;
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
|
+
let waitPromiseResolve;
|
|
383
|
+
const waitPromise = new Promise((res, rej) => {
|
|
384
|
+
waitPromiseResolve = res;
|
|
385
|
+
setTimeout(() => rej("Failed to find method in outer scope"), 5000);
|
|
386
|
+
}).catch(rej => console.warn(rej));
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
388
|
+
const getInitContextParamsFromParent = e => {
|
|
389
|
+
if (e.data && e.data.messageName == Constants.InitContextParamsResponse) {
|
|
390
|
+
payload = e.data.payload;
|
|
391
|
+
waitPromiseResolve();
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
window.addEventListener("message", getInitContextParamsFromParent, false);
|
|
395
|
+
scope.postMessage({
|
|
396
|
+
messageName: Constants.InitContextParamsResponse
|
|
397
|
+
}, "*");
|
|
398
|
+
await waitPromise;
|
|
399
|
+
window.removeEventListener("message", getInitContextParamsFromParent, false);
|
|
400
|
+
return payload;
|
|
401
|
+
};
|
|
361
402
|
export { prepareStartChat, initStartChat, setPreChatAndInitiateChat, checkIfConversationStillValid };
|
|
@@ -3,6 +3,7 @@ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
|
3
3
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
4
4
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
5
5
|
import { TelemetryManager } from "../../../common/telemetry/TelemetryManager";
|
|
6
|
+
import { getConversationDetailsCall } from "../../../common/utils";
|
|
6
7
|
|
|
7
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
9
|
export const updateSessionDataForTelemetry = async (chatSDK, dispatch) => {
|
|
@@ -28,7 +29,7 @@ export const updateSessionDataForTelemetry = async (chatSDK, dispatch) => {
|
|
|
28
29
|
const updateConversationDataForTelemetry = async (chatSDK, dispatch) => {
|
|
29
30
|
if (chatSDK) {
|
|
30
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
-
const liveWorkItem = await chatSDK
|
|
32
|
+
const liveWorkItem = await getConversationDetailsCall(chatSDK);
|
|
32
33
|
const telemetryData = TelemetryHelper.addConversationDataToTelemetry(liveWorkItem, TelemetryManager.InternalTelemetryData);
|
|
33
34
|
dispatch({
|
|
34
35
|
type: LiveChatWidgetActionType.SET_TELEMETRY_DATA,
|
|
@@ -1,20 +1,21 @@
|
|
|
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
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
|
+
import { Components } from "botframework-webchat";
|
|
5
|
+
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, StorageType } from "../../../common/Constants";
|
|
4
6
|
import { Stack } from "@fluentui/react";
|
|
5
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
6
8
|
import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
|
|
7
|
-
import { createTimer, getBroadcastChannelName, getLocaleDirection, getStateFromCache, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty,
|
|
9
|
+
import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isUndefinedOrEmpty, newGuid } from "../../../common/utils";
|
|
8
10
|
import { endChat, prepareEndChat } from "../common/endChat";
|
|
11
|
+
import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
9
12
|
import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowWebChatContainer } from "../../../controller/componentController";
|
|
10
13
|
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
11
14
|
import CallingContainerStateful from "../../callingcontainerstateful/CallingContainerStateful";
|
|
12
15
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
13
|
-
import { Components } from "botframework-webchat";
|
|
14
16
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
15
17
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
16
18
|
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
17
|
-
import { Constants, E2VVOptions, StorageType, LiveWorkItemState, ConversationEndEntity, ConfirmationState } from "../../../common/Constants";
|
|
18
19
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
19
20
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
20
21
|
import HeaderStateful from "../../headerstateful/HeaderStateful";
|
|
@@ -47,9 +48,8 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
47
48
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
48
49
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
49
50
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
50
|
-
import { handleChatReconnect, isReconnectEnabled } from "../common/reconnectChatHelper";
|
|
51
51
|
export const LiveChatWidgetStateful = props => {
|
|
52
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$
|
|
52
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$styleProps2, _props$controlProps11, _props$controlProps12, _props$componentOverr, _props$controlProps13, _props$componentOverr2, _props$controlProps14, _props$componentOverr3, _props$controlProps15, _props$componentOverr4, _props$controlProps16, _props$componentOverr5, _props$controlProps17, _props$componentOverr6, _props$controlProps18, _props$componentOverr7, _props$controlProps19, _props$controlProps20, _props$componentOverr8, _props$controlProps21, _props$componentOverr9, _props$controlProps22, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
53
53
|
const [state, dispatch] = useChatContextStore();
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
55
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -360,7 +360,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
360
360
|
// This is to ensure to get latest state from cache in multitab
|
|
361
361
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
362
362
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
363
|
-
|
|
363
|
+
dispatch({
|
|
364
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
|
|
365
|
+
payload: ConversationEndEntity.Customer
|
|
366
|
+
});
|
|
364
367
|
} else {
|
|
365
368
|
const skipEndChatSDK = true;
|
|
366
369
|
const skipCloseChat = false;
|
|
@@ -498,36 +501,33 @@ export const LiveChatWidgetStateful = props => {
|
|
|
498
501
|
}
|
|
499
502
|
}, [state.domainStates.confirmationState]);
|
|
500
503
|
useEffect(() => {
|
|
501
|
-
var _state$appStates8, _state$appStates9;
|
|
502
|
-
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates9 = state.appStates) === null || _state$appStates9 === void 0 ? void 0 : _state$appStates9.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
503
|
-
dispatch({
|
|
504
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
505
|
-
payload: ConversationState.InActive
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
}, [state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationEndedBy]);
|
|
509
|
-
useEffect(() => {
|
|
510
|
-
var _state$appStates11, _state$appStates12, _state$appStates13, _state$appStates14;
|
|
504
|
+
var _state$appStates8, _state$appStates9, _state$appStates10, _state$appStates11, _state$appStates12, _state$appStates13;
|
|
511
505
|
// Do not process anything during initialization
|
|
512
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
506
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy) === ConversationEndEntity.NotSet) {
|
|
513
507
|
return;
|
|
514
508
|
}
|
|
515
509
|
|
|
516
510
|
// If start chat failed, and C2 is trying to close chat widget
|
|
517
|
-
if (state !== null && state !== void 0 && (_state$
|
|
511
|
+
if (state !== null && state !== void 0 && (_state$appStates9 = state.appStates) !== null && _state$appStates9 !== void 0 && _state$appStates9.startChatFailed) {
|
|
518
512
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
519
513
|
return;
|
|
520
514
|
}
|
|
521
515
|
|
|
522
516
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
523
|
-
if ((state === null || state === void 0 ? void 0 : (_state$
|
|
517
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates10 = state.appStates) === null || _state$appStates10 === void 0 ? void 0 : _state$appStates10.conversationState) === ConversationState.Postchat || (state === null || state === void 0 ? void 0 : (_state$appStates11 = state.appStates) === null || _state$appStates11 === void 0 ? void 0 : _state$appStates11.conversationState) === ConversationState.InActive) {
|
|
524
518
|
endChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true, uwid.current);
|
|
525
519
|
return;
|
|
526
520
|
}
|
|
521
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates12 = state.appStates) === null || _state$appStates12 === void 0 ? void 0 : _state$appStates12.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates13 = state.appStates) === null || _state$appStates13 === void 0 ? void 0 : _state$appStates13.conversationEndedBy) === ConversationEndEntity.Bot) {
|
|
522
|
+
dispatch({
|
|
523
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
524
|
+
payload: ConversationState.InActive
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
527
|
|
|
528
|
-
//All other cases
|
|
528
|
+
// All other cases
|
|
529
529
|
prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, uwid.current);
|
|
530
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
530
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
531
531
|
|
|
532
532
|
// Publish chat widget state
|
|
533
533
|
useEffect(() => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { ConversationEndEntity } from "../../common/Constants";
|
|
4
|
+
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
5
|
+
import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
3
6
|
import { PostChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
4
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
5
8
|
import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps";
|
|
6
9
|
import { findAllFocusableElement } from "../../common/utils";
|
|
7
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
-
import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
9
|
-
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
10
|
-
import { ConversationEndEntity } from "../../common/Constants";
|
|
11
11
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
12
12
|
let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
13
13
|
const surveyLink = `${surveyInviteLink}
|
|
@@ -21,7 +21,7 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
21
21
|
var _props$styleProps, _state$appStates, _state$appStates2, _props$controlProps;
|
|
22
22
|
const [state] = useChatContextStore();
|
|
23
23
|
const generalStyleProps = Object.assign({}, defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
24
|
-
display: state.appStates.isMinimized ? "none" : ""
|
|
24
|
+
display: state.appStates.isMinimized ? "none" : "contents"
|
|
25
25
|
});
|
|
26
26
|
let surveyInviteLink = "";
|
|
27
27
|
const surveyMode = (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.selectedSurveyMode) === PostChatSurveyMode.Embed;
|
|
@@ -84,6 +84,7 @@ export declare class Constants {
|
|
|
84
84
|
static readonly SessionCacheSuffix = "session";
|
|
85
85
|
static readonly PopoutCacheSuffix = "popout";
|
|
86
86
|
static readonly LWICheckOnVisibilityTimeout: number;
|
|
87
|
+
static readonly InitContextParamsResponse = "initContextParamsResponse";
|
|
87
88
|
}
|
|
88
89
|
export declare const Regex: {
|
|
89
90
|
new (): {};
|
|
@@ -154,7 +155,8 @@ export declare enum ElementType {
|
|
|
154
155
|
CallingContainerSDK = "CallingContainerSDK"
|
|
155
156
|
}
|
|
156
157
|
export declare enum ChatSDKError {
|
|
157
|
-
WidgetUseOutsideOperatingHour = "WidgetUseOutsideOperatingHour"
|
|
158
|
+
WidgetUseOutsideOperatingHour = "WidgetUseOutsideOperatingHour",
|
|
159
|
+
AuthContactIdNotFoundFailure = "AuthContactIdNotFoundFailure"
|
|
158
160
|
}
|
|
159
161
|
export declare enum EnvironmentVersion {
|
|
160
162
|
prod = "prod",
|
|
@@ -25,7 +25,6 @@ export declare enum BroadcastEvent {
|
|
|
25
25
|
StartProactiveChat = "StartProactiveChat",
|
|
26
26
|
ProactiveChatStartChat = "ProactiveChatStartChat",
|
|
27
27
|
ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
|
|
28
|
-
ProactiveChatIsInPopoutMode = "ProactiveChatIsInPopoutMode",
|
|
29
28
|
ResetProactiveChatParams = "ResetProactiveChatParams",
|
|
30
29
|
InvalidAdaptiveCardFormat = "InvalidAdaptiveCardFormat",
|
|
31
30
|
NewMessageSent = "NewMessageSent",
|
|
@@ -52,7 +51,8 @@ export declare enum BroadcastEvent {
|
|
|
52
51
|
InitiateStartChatInPopoutMode = "InitiateStartChatInPopoutMode",
|
|
53
52
|
HideChatVisibilityChangeEvent = "hideChatVisibilityChangeEvent",
|
|
54
53
|
UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
|
|
55
|
-
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry"
|
|
54
|
+
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
|
|
55
|
+
ContactIdNotFound = "ContactIdNotFound"
|
|
56
56
|
}
|
|
57
57
|
export declare enum TelemetryEvent {
|
|
58
58
|
CallAdded = "CallAdded",
|
|
@@ -95,6 +95,7 @@ export declare enum TelemetryEvent {
|
|
|
95
95
|
ChatVisibilityChanged = "ChatVisibilityChanged",
|
|
96
96
|
EndChatSucceeded = "EndChatSucceeded",
|
|
97
97
|
EndChatFailed = "EndChatFailed",
|
|
98
|
+
SettingCustomContext = "SettingCustomContext",
|
|
98
99
|
WebChatLoaded = "WebChatLoaded",
|
|
99
100
|
LCWChatButtonClicked = "LCWChatButtonClicked",
|
|
100
101
|
LCWChatButtonShow = "LCWChatButtonShow",
|
|
@@ -31,3 +31,4 @@ export declare const getBroadcastChannelName: (widgetId: string, widgetInstanceI
|
|
|
31
31
|
export declare const getWidgetCacheIdfromProps: (props: any, popoutChat?: boolean) => string;
|
|
32
32
|
export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[]) => void;
|
|
33
33
|
export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
|
|
34
|
+
export declare const checkContactIdError: (e: any) => void;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
-
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
4
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
|
+
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, uwid: string) => Promise<void>;
|
|
6
6
|
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined, uwid?: string) => Promise<void>;
|
|
7
|
-
|
|
8
|
-
export { prepareEndChat, endChat, getConversationDetails };
|
|
7
|
+
export { prepareEndChat, endChat };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4-main.337860d",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,9 +74,8 @@
|
|
|
74
74
|
"webpack-cli": "^4.9.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@
|
|
78
|
-
"@microsoft/omnichannel-chat-
|
|
79
|
-
"@microsoft/omnichannel-chat-sdk": "1.3.0",
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "^1.0.1",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.4.1",
|
|
80
79
|
"abort-controller-es5": "^2.0.1",
|
|
81
80
|
"dompurify": "^2.3.4",
|
|
82
81
|
"markdown-it": "^12.3.2",
|