@microsoft/omnichannel-chat-widget 1.7.4-main.f0f5d34 → 1.7.5-main.290ba08
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/facades/FacadeChatSDK.js +298 -0
- package/lib/cjs/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +7 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/cjs/common/utils.js +2 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +15 -13
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/cjs/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/cjs/components/livechatwidget/common/endChat.js +40 -30
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +15 -11
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +2 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +54 -39
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +63 -40
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/index.js +115 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +3 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +3 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +2 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/cjs/contexts/FacadeChatSDKStore.js +10 -0
- package/lib/cjs/hooks/useFacadeChatSDKStore.js +17 -0
- package/lib/cjs/index.js +34 -2
- package/lib/cjs/plugins/createChatTranscript.js +2 -2
- package/lib/esm/common/facades/FacadeChatSDK.js +291 -0
- package/lib/esm/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +7 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/esm/common/utils.js +2 -2
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +15 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/esm/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/esm/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/esm/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/esm/components/livechatwidget/common/endChat.js +40 -30
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +12 -8
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +2 -4
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +55 -40
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +63 -40
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/index.js +10 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.js +2 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +2 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.js +2 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/esm/contexts/FacadeChatSDKStore.js +4 -0
- package/lib/esm/hooks/useFacadeChatSDKStore.js +10 -0
- package/lib/esm/index.js +6 -4
- package/lib/esm/plugins/createChatTranscript.js +2 -2
- package/lib/types/common/facades/FacadeChatSDK.d.ts +71 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +13 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +9 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +7 -0
- package/lib/types/common/utils.d.ts +2 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +14 -1
- package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initCallingSdk.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/updateSessionDataForTelemetry.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/index.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware.d.ts +1 -2
- package/lib/types/contexts/FacadeChatSDKStore.d.ts +1 -0
- package/lib/types/hooks/useFacadeChatSDKStore.d.ts +3 -0
- package/lib/types/index.d.ts +5 -3
- package/lib/types/plugins/createChatTranscript.d.ts +2 -1
- package/package.json +4 -2
|
@@ -53,7 +53,7 @@ import { setPostChatContextAndLoadSurvey } from "../common/setPostChatContextAnd
|
|
|
53
53
|
import { startProactiveChat } from "../common/startProactiveChat";
|
|
54
54
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
55
55
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
56
|
-
import
|
|
56
|
+
import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
|
|
57
57
|
export const LiveChatWidgetStateful = props => {
|
|
58
58
|
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain7, _props$webChatContain8, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain9, _props$webChatContain10, _props$webChatContain11, _props$webChatContain12, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
59
59
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -64,7 +64,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
64
64
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
65
65
|
});
|
|
66
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
const
|
|
67
|
+
const [facadeChatSDK] = useFacadeSDKStore();
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
69
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = useState(undefined);
|
|
70
70
|
const {
|
|
@@ -82,8 +82,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
82
82
|
|
|
83
83
|
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
84
84
|
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
85
|
-
var
|
|
86
|
-
const broadcastServiceChannelName = getBroadcastChannelName(
|
|
85
|
+
var _facadeChatSDK$getCha, _facadeChatSDK$getCha2, _props$controlProps2;
|
|
86
|
+
const broadcastServiceChannelName = getBroadcastChannelName((_facadeChatSDK$getCha = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha === void 0 ? void 0 : (_facadeChatSDK$getCha2 = _facadeChatSDK$getCha.omnichannelConfig) === null || _facadeChatSDK$getCha2 === void 0 ? void 0 : _facadeChatSDK$getCha2.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
87
87
|
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
88
88
|
}
|
|
89
89
|
TelemetryTimers.LcwLoadToChatButtonTimer = createTimer();
|
|
@@ -118,7 +118,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
118
118
|
const startChat = async (props, localState) => {
|
|
119
119
|
const isReconnectTriggered = async () => {
|
|
120
120
|
if (isReconnectEnabled(props.chatConfig) === true && !isPersistentEnabled(props.chatConfig)) {
|
|
121
|
-
const noValidReconnectId = await handleChatReconnect(
|
|
121
|
+
const noValidReconnectId = await handleChatReconnect(facadeChatSDK, props, dispatch, setAdapter, initStartChat, state);
|
|
122
122
|
const inMemoryState = executeReducer(state, {
|
|
123
123
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
124
124
|
payload: null
|
|
@@ -139,14 +139,20 @@ export const LiveChatWidgetStateful = props => {
|
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
//Check if conversation state is not in wrapup or closed state
|
|
142
|
-
isChatValid = await checkIfConversationStillValid(
|
|
142
|
+
isChatValid = await checkIfConversationStillValid(facadeChatSDK, dispatch, state);
|
|
143
143
|
if (isChatValid === true) {
|
|
144
144
|
const reconnectTriggered = await isReconnectTriggered();
|
|
145
145
|
if (!reconnectTriggered) {
|
|
146
|
-
await initStartChat(
|
|
146
|
+
await initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
|
|
147
147
|
}
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
+
BroadcastService.postMessage({
|
|
151
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
152
|
+
payload: {
|
|
153
|
+
errorMessage: "Chat found in cache but invalid as the conversation status is inactive."
|
|
154
|
+
}
|
|
155
|
+
});
|
|
150
156
|
}
|
|
151
157
|
if (isChatValid === false) {
|
|
152
158
|
if (localState) {
|
|
@@ -157,7 +163,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
157
163
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
158
164
|
payload: null
|
|
159
165
|
});
|
|
160
|
-
await setPreChatAndInitiateChat(
|
|
166
|
+
await setPreChatAndInitiateChat(facadeChatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
161
167
|
}
|
|
162
168
|
return;
|
|
163
169
|
} else {
|
|
@@ -227,7 +233,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
227
233
|
});
|
|
228
234
|
}
|
|
229
235
|
if (((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_callingoptions) !== E2VVOptions.NoCalling) {
|
|
230
|
-
initCallingSdk(
|
|
236
|
+
initCallingSdk(facadeChatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
231
237
|
sdkCreated && dispatch({
|
|
232
238
|
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
233
239
|
payload: true
|
|
@@ -259,13 +265,19 @@ export const LiveChatWidgetStateful = props => {
|
|
|
259
265
|
useEffect(() => {
|
|
260
266
|
var _state$appStates6;
|
|
261
267
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates6 = state.appStates) === null || _state$appStates6 === void 0 ? void 0 : _state$appStates6.hideStartChatButton) === true) {
|
|
262
|
-
var _props$chatConfig3, _props$chatConfig3$Li;
|
|
268
|
+
var _props$chatConfig3, _props$chatConfig3$Li, _props$chatConfig4, _props$chatConfig4$Li;
|
|
263
269
|
//handle OOH pane
|
|
264
|
-
if ((props === null || props === void 0 ? void 0 : (_props$chatConfig3 = props.chatConfig) === null || _props$chatConfig3 === void 0 ? void 0 : (_props$chatConfig3$Li = _props$chatConfig3.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig3$Li === void 0 ? void 0 : _props$chatConfig3$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
270
|
+
if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig3 = props.chatConfig) === null || _props$chatConfig3 === void 0 ? void 0 : (_props$chatConfig3$Li = _props$chatConfig3.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig3$Li === void 0 ? void 0 : _props$chatConfig3$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig4 = props.chatConfig) === null || _props$chatConfig4 === void 0 ? void 0 : (_props$chatConfig4$Li = _props$chatConfig4.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig4$Li === void 0 ? void 0 : _props$chatConfig4$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
265
271
|
dispatch({
|
|
266
272
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
267
273
|
payload: ConversationState.OutOfOffice
|
|
268
274
|
});
|
|
275
|
+
BroadcastService.postMessage({
|
|
276
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
277
|
+
payload: {
|
|
278
|
+
errorMessage: "Out-of-office hours status is shown."
|
|
279
|
+
}
|
|
280
|
+
});
|
|
269
281
|
return;
|
|
270
282
|
}
|
|
271
283
|
BroadcastService.postMessage({
|
|
@@ -278,7 +290,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
278
290
|
|
|
279
291
|
// useEffect for custom context
|
|
280
292
|
useEffect(() => {
|
|
281
|
-
var
|
|
293
|
+
var _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _facadeChatSDK$getCha6, _props$controlProps11;
|
|
282
294
|
// Add the custom context on receiving the SetCustomContext event
|
|
283
295
|
BroadcastService.getMessageByEventName(BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
284
296
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -331,7 +343,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
331
343
|
if (callInProgress.current === false && dateNow - lastLWICheckTimeRef.current > Constants.LWICheckOnVisibilityTimeout) {
|
|
332
344
|
lastLWICheckTimeRef.current = dateNow;
|
|
333
345
|
callInProgress.current = true;
|
|
334
|
-
const conversationDetails = await getConversationDetailsCall(
|
|
346
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
335
347
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
|
|
336
348
|
dispatch({
|
|
337
349
|
type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
@@ -347,19 +359,30 @@ export const LiveChatWidgetStateful = props => {
|
|
|
347
359
|
}
|
|
348
360
|
});
|
|
349
361
|
BroadcastService.getMessageByEventName(BroadcastEvent.NetworkReconnected).subscribe(async () => {
|
|
350
|
-
var _window2, _window2$location;
|
|
351
|
-
|
|
362
|
+
var _window2, _window2$location, _inMemoryState$appSta;
|
|
363
|
+
const inMemoryState = executeReducer(state, {
|
|
364
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
365
|
+
payload: null
|
|
366
|
+
});
|
|
367
|
+
if (isThisSessionPopout((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href) || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) !== ConversationState.Active) {
|
|
352
368
|
return;
|
|
353
369
|
}
|
|
354
|
-
const conversationDetails = await getConversationDetailsCall(
|
|
370
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
355
371
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
|
|
356
372
|
dispatch({
|
|
357
373
|
type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
358
374
|
payload: true
|
|
359
375
|
});
|
|
376
|
+
const desc = "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)";
|
|
360
377
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
361
378
|
Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
362
|
-
Description:
|
|
379
|
+
Description: desc
|
|
380
|
+
});
|
|
381
|
+
BroadcastService.postMessage({
|
|
382
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
383
|
+
payload: {
|
|
384
|
+
errorMessage: desc
|
|
385
|
+
}
|
|
363
386
|
});
|
|
364
387
|
}
|
|
365
388
|
});
|
|
@@ -378,9 +401,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
378
401
|
|
|
379
402
|
// Start chat from SDK Event
|
|
380
403
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
381
|
-
var _props$
|
|
404
|
+
var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4, _inMemoryState$appSta5;
|
|
382
405
|
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
383
|
-
if ((props === null || props === void 0 ? void 0 : (_props$
|
|
406
|
+
if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig5 = props.chatConfig) === null || _props$chatConfig5 === void 0 ? void 0 : (_props$chatConfig5$Li = _props$chatConfig5.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig5$Li === void 0 ? void 0 : _props$chatConfig5$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig6 = props.chatConfig) === null || _props$chatConfig6 === void 0 ? void 0 : (_props$chatConfig6$Li = _props$chatConfig6.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig6$Li === void 0 ? void 0 : _props$chatConfig6$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
384
407
|
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
385
408
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
386
409
|
payload: false
|
|
@@ -417,16 +440,16 @@ export const LiveChatWidgetStateful = props => {
|
|
|
417
440
|
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
418
441
|
|
|
419
442
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
420
|
-
if (((_inMemoryState$
|
|
443
|
+
if (((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === ConversationState.Closed || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === ConversationState.InActive || ((_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.conversationState) === ConversationState.Postchat) {
|
|
421
444
|
BroadcastService.postMessage({
|
|
422
445
|
eventName: BroadcastEvent.ChatInitiated
|
|
423
446
|
});
|
|
424
|
-
prepareStartChat(props,
|
|
447
|
+
prepareStartChat(props, facadeChatSDK, inMemoryState, dispatch, setAdapter);
|
|
425
448
|
return;
|
|
426
449
|
}
|
|
427
450
|
|
|
428
451
|
// If minimized, maximize the chat
|
|
429
|
-
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
452
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.isMinimized) === true) {
|
|
430
453
|
var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
|
|
431
454
|
dispatch({
|
|
432
455
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -473,7 +496,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
473
496
|
Event: TelemetryEvent.PrepareEndChat,
|
|
474
497
|
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
475
498
|
});
|
|
476
|
-
endChat(props,
|
|
499
|
+
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
477
500
|
}
|
|
478
501
|
BroadcastService.postMessage({
|
|
479
502
|
eventName: BroadcastEvent.CloseChat
|
|
@@ -486,7 +509,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
486
509
|
});
|
|
487
510
|
|
|
488
511
|
// Listen to end chat event from other tabs
|
|
489
|
-
const endChatEventName = getWidgetEndChatEventName(
|
|
512
|
+
const endChatEventName = getWidgetEndChatEventName((_facadeChatSDK$getCha3 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : (_facadeChatSDK$getCha4 = _facadeChatSDK$getCha3.omnichannelConfig) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : _facadeChatSDK$getCha4.orgId, (_facadeChatSDK$getCha5 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : (_facadeChatSDK$getCha6 = _facadeChatSDK$getCha5.omnichannelConfig) === null || _facadeChatSDK$getCha6 === void 0 ? void 0 : _facadeChatSDK$getCha6.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
490
513
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
491
514
|
var _msg$payload10;
|
|
492
515
|
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
@@ -494,9 +517,9 @@ export const LiveChatWidgetStateful = props => {
|
|
|
494
517
|
Event: TelemetryEvent.PrepareEndChat,
|
|
495
518
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
496
519
|
});
|
|
497
|
-
endChat(props,
|
|
520
|
+
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
498
521
|
endChatStateCleanUp(dispatch);
|
|
499
|
-
chatSDKStateCleanUp(
|
|
522
|
+
chatSDKStateCleanUp(facadeChatSDK.getChatSDK());
|
|
500
523
|
return;
|
|
501
524
|
}
|
|
502
525
|
});
|
|
@@ -538,7 +561,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
538
561
|
useEffect(() => {
|
|
539
562
|
// On new message
|
|
540
563
|
if (state.appStates.conversationState === ConversationState.Active) {
|
|
541
|
-
|
|
564
|
+
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onNewMessage(() => {
|
|
542
565
|
// Track the message count
|
|
543
566
|
currentMessageCountRef.current++;
|
|
544
567
|
dispatch({
|
|
@@ -626,7 +649,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
626
649
|
Event: TelemetryEvent.PrepareEndChat,
|
|
627
650
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
628
651
|
});
|
|
629
|
-
endChat(props,
|
|
652
|
+
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
|
|
630
653
|
return;
|
|
631
654
|
}
|
|
632
655
|
|
|
@@ -636,7 +659,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
636
659
|
Event: TelemetryEvent.PrepareEndChat,
|
|
637
660
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
638
661
|
});
|
|
639
|
-
endChat(props,
|
|
662
|
+
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
640
663
|
return;
|
|
641
664
|
}
|
|
642
665
|
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) {
|
|
@@ -647,7 +670,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
647
670
|
}
|
|
648
671
|
|
|
649
672
|
// All other cases
|
|
650
|
-
prepareEndChat(props,
|
|
673
|
+
prepareEndChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
651
674
|
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
652
675
|
|
|
653
676
|
// Publish chat widget state
|
|
@@ -680,13 +703,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
680
703
|
|
|
681
704
|
// Handle Chat disconnect cases
|
|
682
705
|
useEffect(() => {
|
|
683
|
-
var _inMemoryState$
|
|
706
|
+
var _inMemoryState$appSta6;
|
|
684
707
|
const inMemoryState = executeReducer(state, {
|
|
685
708
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
686
709
|
payload: null
|
|
687
710
|
});
|
|
688
711
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
689
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
712
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta6 = inMemoryState.appStates) === null || _inMemoryState$appSta6 === void 0 ? void 0 : _inMemoryState$appSta6.chatDisconnectEventReceived;
|
|
690
713
|
if (chatDisconnectState && adapter) {
|
|
691
714
|
try {
|
|
692
715
|
adapter.end();
|
|
@@ -718,7 +741,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
718
741
|
Event: TelemetryEvent.PrepareEndChat,
|
|
719
742
|
Description: PrepareEndChatDescriptionConstants.BrowserUnload
|
|
720
743
|
});
|
|
721
|
-
endChat(props,
|
|
744
|
+
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
|
|
722
745
|
// Clean local storage
|
|
723
746
|
(_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
|
|
724
747
|
|
|
@@ -731,16 +754,16 @@ export const LiveChatWidgetStateful = props => {
|
|
|
731
754
|
eventName: BroadcastEvent.ClosePopoutWindow
|
|
732
755
|
});
|
|
733
756
|
};
|
|
734
|
-
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(
|
|
757
|
+
const setPostChatContextRelay = () => setPostChatContextAndLoadSurvey(facadeChatSDK, dispatch);
|
|
735
758
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
736
|
-
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => endChat(props,
|
|
737
|
-
const prepareStartChatRelay = () => prepareStartChat(props,
|
|
759
|
+
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab);
|
|
760
|
+
const prepareStartChatRelay = () => prepareStartChat(props, facadeChatSDK, state, dispatch, setAdapter);
|
|
738
761
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
739
|
-
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(
|
|
762
|
+
const initStartChatRelay = (optionalParams, persistedState) => initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams, persistedState);
|
|
740
763
|
const confirmationPaneProps = initConfirmationPropsComposer(props);
|
|
741
764
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
742
|
-
const prepareEndChatRelay = () => prepareEndChat(props,
|
|
743
|
-
const webChatProps = initWebChatComposer(props, state, dispatch,
|
|
765
|
+
const prepareEndChatRelay = () => prepareEndChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
766
|
+
const webChatProps = initWebChatComposer(props, state, dispatch, facadeChatSDK, endChatRelay);
|
|
744
767
|
const downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
|
|
745
768
|
...(defaultWebChatContainerStatefulProps === null || defaultWebChatContainerStatefulProps === void 0 ? void 0 : defaultWebChatContainerStatefulProps.webChatStyles),
|
|
746
769
|
...((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.webChatStyles)
|
|
@@ -766,7 +789,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
766
789
|
};
|
|
767
790
|
|
|
768
791
|
// Add 'omnichannel-chat-widget' OC User Agent if not already set
|
|
769
|
-
setOcUserAgent(
|
|
792
|
+
setOcUserAgent(facadeChatSDK.getChatSDK());
|
|
770
793
|
const directLine = ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine;
|
|
771
794
|
const userID = directLine.getState ? directLine === null || directLine === void 0 ? void 0 : directLine.getState("acs.userId") : "teamsvisitor";
|
|
772
795
|
|
|
@@ -33,6 +33,9 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
33
33
|
} else {
|
|
34
34
|
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
35
35
|
}
|
|
36
|
+
if (props.copilotSurveyContext) {
|
|
37
|
+
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
38
|
+
}
|
|
36
39
|
const styleProps = {
|
|
37
40
|
...props.styleProps,
|
|
38
41
|
generalStyleProps: generalStyleProps
|
|
@@ -2,9 +2,9 @@ import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import { extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
5
|
-
import MarkdownIt from "markdown-it";
|
|
6
5
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
7
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
7
|
+
import MarkdownIt from "markdown-it";
|
|
8
8
|
import { PreChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
9
9
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
10
10
|
import { defaultGeneralPreChatSurveyPaneStyleProps } from "./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps";
|
|
@@ -6,11 +6,13 @@ import { ReconnectChatPane } from "@microsoft/omnichannel-chat-components";
|
|
|
6
6
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
7
7
|
import { setFocusOnElement } from "../../common/utils";
|
|
8
8
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
9
|
-
import
|
|
9
|
+
import useFacadeChatSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
10
10
|
export const ReconnectChatPaneStateful = props => {
|
|
11
11
|
const [state, dispatch] = useChatContextStore();
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const chatSDK = useChatSDKStore();
|
|
13
|
+
//const chatSDK: any = useChatSDKStore();
|
|
14
|
+
const [facadeChatSDK] = useFacadeChatSDKStore();
|
|
15
|
+
const chatSDK = facadeChatSDK.getChatSDK();
|
|
14
16
|
const {
|
|
15
17
|
reconnectChatProps,
|
|
16
18
|
initStartChat
|
|
@@ -47,7 +47,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
export const WebChatContainerStateful = props => {
|
|
50
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2,
|
|
50
|
+
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _props$webChatContain9, _props$webChatContain10;
|
|
51
51
|
const {
|
|
52
52
|
BasicWebChat
|
|
53
53
|
} = Components;
|
|
@@ -163,6 +163,11 @@ export const WebChatContainerStateful = props => {
|
|
|
163
163
|
div[class="ac-textBlock"] *,
|
|
164
164
|
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
165
165
|
|
|
166
|
+
div[class="ac-input-container"] input.ac-multichoiceInput,
|
|
167
|
+
div[class="ac-input-container"] select.ac-multichoiceInput {
|
|
168
|
+
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp7 !== void 0 && _webChatContainerProp7.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
169
|
+
}
|
|
170
|
+
|
|
166
171
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
167
172
|
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
168
173
|
color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
@@ -172,16 +177,16 @@ export const WebChatContainerStateful = props => {
|
|
|
172
177
|
div[class="ac-textBlock"] a:visited,
|
|
173
178
|
div[class="ac-textBlock"] a:hover,
|
|
174
179
|
div[class="ac-textBlock"] a:active {
|
|
175
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
180
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
183
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp9 === void 0 ? void 0 : _webChatContainerProp9.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
179
184
|
|
|
180
185
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
181
186
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
182
187
|
height: .75em;
|
|
183
188
|
margin-left: .25em;
|
|
184
|
-
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
189
|
+
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp10 === void 0 ? void 0 : (_webChatContainerProp11 = _webChatContainerProp10.receivedMessageAnchorStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.filter) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
185
190
|
}
|
|
186
191
|
pre {
|
|
187
192
|
white-space: pre-wrap;
|
|
@@ -194,13 +199,13 @@ export const WebChatContainerStateful = props => {
|
|
|
194
199
|
.ms_lcw_webchat_received_message a:visited,
|
|
195
200
|
.ms_lcw_webchat_received_message a:hover,
|
|
196
201
|
.ms_lcw_webchat_received_message a:active {
|
|
197
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
202
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
198
203
|
}
|
|
199
204
|
.ms_lcw_webchat_sent_message a:link,
|
|
200
205
|
.ms_lcw_webchat_sent_message a:visited,
|
|
201
206
|
.ms_lcw_webchat_sent_message a:hover,
|
|
202
207
|
.ms_lcw_webchat_sent_message a:active {
|
|
203
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
208
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
204
209
|
}
|
|
205
210
|
|
|
206
211
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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
|
-
import { ParticipantType } from "../../../common/Constants";
|
|
5
4
|
import MockAdapter from "./mockadapter";
|
|
5
|
+
import { ParticipantType } from "../../../common/Constants";
|
|
6
6
|
export class MockChatSDK {
|
|
7
7
|
constructor() {
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -59,6 +59,9 @@ export class MockChatSDK {
|
|
|
59
59
|
getVoiceVideoCalling() {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
|
+
setAuthTokenProvider() {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
62
65
|
getLiveChatConfig() {
|
|
63
66
|
return {
|
|
64
67
|
LiveWSAndLiveChatEngJoin: {
|
|
@@ -80,7 +80,8 @@ export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps
|
|
|
80
80
|
}
|
|
81
81
|
if (isTagIncluded(card, Constants.systemMessageTag)) {
|
|
82
82
|
return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
|
|
83
|
-
}
|
|
83
|
+
}
|
|
84
|
+
if (card.activity.text && card.activity.type === DirectLineActivityType.Message) {
|
|
84
85
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === Constants.webchatChannelId) {
|
|
85
86
|
card.activity.text = escapeHtml(card.activity.text);
|
|
86
87
|
card.activity.channelData.isHtmlEncoded = true;
|
|
@@ -55,7 +55,7 @@ const genPreviewCardWithAttachment = (card, iconData, next) => {
|
|
|
55
55
|
renderer: next
|
|
56
56
|
});
|
|
57
57
|
};
|
|
58
|
-
const createAttachmentMiddleware = enableInlinePlaying => {
|
|
58
|
+
export const createAttachmentMiddleware = enableInlinePlaying => {
|
|
59
59
|
// eslint-disable-next-line react/display-name
|
|
60
60
|
const attachmentMiddleware = () => next => function () {
|
|
61
61
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _card$activity$channe;
|
|
@@ -192,5 +192,4 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
192
192
|
});
|
|
193
193
|
};
|
|
194
194
|
return attachmentMiddleware;
|
|
195
|
-
};
|
|
196
|
-
export default createAttachmentMiddleware;
|
|
195
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./activityMiddleware";
|
|
2
|
+
export * from "./activityStatusMiddleware";
|
|
3
|
+
export * from "./attachmentMiddleware";
|
|
4
|
+
export * from "./avatarMiddleware";
|
|
5
|
+
export * from "./cardActionMiddleware";
|
|
6
|
+
export * from "./groupActivitiesMiddleware";
|
|
7
|
+
export * from "./messageSequenceIdOverrideMiddleware";
|
|
8
|
+
export * from "./messageTimestampMiddleware";
|
|
9
|
+
export * from "./toastMiddleware";
|
|
10
|
+
export * from "./typingIndicatorMiddleware";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
2
2
|
import { Constants } from "../../../../../common/Constants";
|
|
3
3
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
4
|
-
const createMessageSequenceIdOverrideMiddleware = _ref => {
|
|
4
|
+
export const createMessageSequenceIdOverrideMiddleware = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
dispatch
|
|
7
7
|
} = _ref;
|
|
@@ -54,5 +54,4 @@ const extractOriginalMessageId = action => {
|
|
|
54
54
|
const lookupOriginalMessageId = action => {
|
|
55
55
|
var _action$payload4, _action$payload4$acti, _action$payload4$acti2, _action$payload4$acti3;
|
|
56
56
|
return action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : (_action$payload4$acti2 = _action$payload4$acti.channelData) === null || _action$payload4$acti2 === void 0 ? void 0 : (_action$payload4$acti3 = _action$payload4$acti2.metadata) === null || _action$payload4$acti3 === void 0 ? void 0 : _action$payload4$acti3.OriginalMessageId;
|
|
57
|
-
};
|
|
58
|
-
export default createMessageSequenceIdOverrideMiddleware;
|
|
57
|
+
};
|
|
@@ -2,7 +2,7 @@ import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
|
2
2
|
import { Constants } from "../../../../../common/Constants";
|
|
3
3
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
5
|
-
const createMessageTimeStampMiddleware = _ref => {
|
|
5
|
+
export const createMessageTimeStampMiddleware = _ref => {
|
|
6
6
|
let {
|
|
7
7
|
dispatch
|
|
8
8
|
} = _ref;
|
|
@@ -79,5 +79,4 @@ const tagLookup = (action, tag) => {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return null;
|
|
82
|
-
};
|
|
83
|
-
export default createMessageTimeStampMiddleware;
|
|
82
|
+
};
|
|
@@ -3,7 +3,7 @@ import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
|
3
3
|
import NotificationPaneStateful from "../../../../notificationpanestateful/NotificationPaneStateful";
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const createToastMiddleware = (notificationPaneProps, endChat) => {
|
|
6
|
+
export const createToastMiddleware = (notificationPaneProps, endChat) => {
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/display-name
|
|
8
8
|
const toastMiddleware = () => next => card => {
|
|
9
9
|
const {
|
|
@@ -24,5 +24,4 @@ const createToastMiddleware = (notificationPaneProps, endChat) => {
|
|
|
24
24
|
return next(card);
|
|
25
25
|
};
|
|
26
26
|
return toastMiddleware;
|
|
27
|
-
};
|
|
28
|
-
export default createToastMiddleware;
|
|
27
|
+
};
|
|
@@ -12,7 +12,7 @@ import { defaultTypingIndicatorBubbleStyles } from "./defaultStyles/defaultTypin
|
|
|
12
12
|
import { defaultTypingIndicatorContainerStyles } from "./defaultStyles/defaultTypingIndicatorContainerStyles";
|
|
13
13
|
import { defaultTypingIndicatorMessageStyles } from "./defaultStyles/defaultTypingIndicatorMessageStyles";
|
|
14
14
|
import { useChatContextStore } from "../../../../..";
|
|
15
|
-
import
|
|
15
|
+
import useFacadeSDKStore from "../../../../../hooks/useFacadeChatSDKStore";
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
const TypingIndicator = _ref => {
|
|
@@ -21,10 +21,10 @@ const TypingIndicator = _ref => {
|
|
|
21
21
|
activeTyping,
|
|
22
22
|
visible
|
|
23
23
|
} = _ref;
|
|
24
|
-
|
|
25
|
-
const chatSDK = useChatSDKStore();
|
|
24
|
+
const [facadeChatSDK] = useFacadeSDKStore();
|
|
26
25
|
const [state] = useChatContextStore();
|
|
27
|
-
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const debounceTyping = useCallback(debounceLeading(() => facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.sendTypingEvent()), []);
|
|
28
28
|
if (!activeTyping || Object.keys(activeTyping).length === 0 || ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.LiveChatVersion) === 1 && !visible) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -3,6 +3,8 @@ import { NotificationLevel } from "../enums/NotificationLevel";
|
|
|
3
3
|
import { WebChatActionType } from "../enums/WebChatActionType";
|
|
4
4
|
import { WebChatStoreLoader } from "../WebChatStoreLoader";
|
|
5
5
|
import { setFocusOnSendBox } from "../../../../common/utils";
|
|
6
|
+
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
7
|
+
import { BroadcastEvent } from "../../../../common/telemetry/TelemetryConstants";
|
|
6
8
|
export class NotificationHandler {
|
|
7
9
|
static notify(id, level, message) {
|
|
8
10
|
if (WebChatStoreLoader.store) {
|
|
@@ -28,6 +30,12 @@ export class NotificationHandler {
|
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
static notifyError(id, message) {
|
|
33
|
+
BroadcastService.postMessage({
|
|
34
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
35
|
+
payload: {
|
|
36
|
+
errorMessage: message
|
|
37
|
+
}
|
|
38
|
+
});
|
|
31
39
|
this.notify(id, NotificationLevel.Error, message);
|
|
32
40
|
}
|
|
33
41
|
static notifyWarning(id, message) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
4
|
+
export const FacadeChatSDKStore = /*#__PURE__*/createContext([undefined, facadeChatSDK => {}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FacadeChatSDKStore } from "../contexts/FacadeChatSDKStore";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
const useFacadeChatSDKStore = () => {
|
|
4
|
+
const facadeChatSDK = useContext(FacadeChatSDKStore);
|
|
5
|
+
if (!facadeChatSDK) {
|
|
6
|
+
throw new Error("This hook is not called on component that is descendants of <FacadeSDKStore.Provider>, or FacadeSDKStore is not passed into LiveChatWidget component.");
|
|
7
|
+
}
|
|
8
|
+
return facadeChatSDK;
|
|
9
|
+
};
|
|
10
|
+
export default useFacadeChatSDKStore;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { BroadcastService, decodeComponentString, encodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
2
|
-
import useChatContextStore from "./hooks/useChatContextStore";
|
|
3
|
-
import useChatSDKStore from "./hooks/useChatSDKStore";
|
|
4
2
|
import { getWidgetCacheId, getWidgetEndChatEventName } from "./common/utils";
|
|
5
3
|
import { ConversationState } from "./contexts/common/ConversationState";
|
|
4
|
+
import useChatContextStore from "./hooks/useChatContextStore";
|
|
5
|
+
import useChatSDKStore from "./hooks/useChatSDKStore";
|
|
6
|
+
import useFacadeChatSDKStore from "./hooks/useFacadeChatSDKStore";
|
|
6
7
|
export { default as LiveChatWidget } from "./components/livechatwidget/LiveChatWidget";
|
|
7
8
|
export { getMockChatSDKIfApplicable } from "./components/livechatwidget/common/getMockChatSDKIfApplicable";
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
9
|
+
export { getWidgetCacheId, getWidgetEndChatEventName, ConversationState };
|
|
10
|
+
export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore, useFacadeChatSDKStore };
|
|
11
|
+
export * from "./components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares";
|