@microsoft/omnichannel-chat-widget 1.7.3-main.fee24eb → 1.7.4-main.0574a04
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 +1 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/cjs/components/footerstateful/FooterStateful.js +17 -3
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +15 -6
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +77 -0
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +2 -2
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +15 -2
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +6 -2
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +2 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +20 -9
- package/lib/cjs/components/livechatwidget/common/helpers/markdownHelper.js +23 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/cjs/components/livechatwidget/common/persistentChatHelper.js +2 -1
- package/lib/cjs/components/livechatwidget/common/startChat.js +9 -3
- package/lib/cjs/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +49 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +31 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/plugins/createChatTranscript.js +84 -0
- package/lib/esm/common/Constants.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/components/footerstateful/FooterStateful.js +15 -3
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +15 -6
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +70 -0
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
- package/lib/esm/components/livechatwidget/common/createAdapter.js +14 -2
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +6 -2
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +2 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +20 -9
- package/lib/esm/components/livechatwidget/common/helpers/markdownHelper.js +15 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
- package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +2 -1
- package/lib/esm/components/livechatwidget/common/startChat.js +9 -3
- package/lib/esm/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +50 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +31 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/plugins/createChatTranscript.js +84 -0
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +5 -2
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/helpers/markdownHelper.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +25 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +4 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
1
2
|
import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
|
|
2
|
-
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
|
|
4
4
|
import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
|
|
5
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -55,6 +55,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
55
55
|
const postchatContext = (await getPostChatContext(chatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.postChatContext);
|
|
56
56
|
if (postchatContext === undefined) {
|
|
57
57
|
var _state$appStates2;
|
|
58
|
+
BroadcastService.postMessage({
|
|
59
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
60
|
+
payload: {
|
|
61
|
+
errorMessage: "Widget did not display post chat survey as getPostChatContext returned undefined."
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
58
65
|
// For Customer intiated conversations, just close chat widget
|
|
59
66
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === ConversationEndEntity.Customer) {
|
|
60
67
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -127,21 +134,25 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
|
|
|
127
134
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
135
|
const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
|
|
129
136
|
if (!skipEndChatSDK && chatSDK.conversation) {
|
|
137
|
+
var _inMemoryState$appSta;
|
|
138
|
+
const inMemoryState = executeReducer(state, {
|
|
139
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
140
|
+
payload: null
|
|
141
|
+
});
|
|
142
|
+
const endChatOptionalParameters = {
|
|
143
|
+
isSessionEnded: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived
|
|
144
|
+
};
|
|
130
145
|
try {
|
|
131
146
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
132
147
|
Event: TelemetryEvent.EndChatSDKCall
|
|
133
148
|
});
|
|
134
149
|
//Get auth token again if chat continued for longer time, otherwise gets 401 error
|
|
135
150
|
await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
|
|
136
|
-
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
|
|
151
|
+
await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat(endChatOptionalParameters));
|
|
137
152
|
} catch (ex) {
|
|
138
|
-
var _inMemoryState$
|
|
139
|
-
const inMemoryState = executeReducer(state, {
|
|
140
|
-
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
141
|
-
payload: null
|
|
142
|
-
});
|
|
153
|
+
var _inMemoryState$appSta2;
|
|
143
154
|
// if the chat was disconnected or ended by the agent, we don't want to log the error
|
|
144
|
-
if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$
|
|
155
|
+
if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta2 = inMemoryState.appStates) !== null && _inMemoryState$appSta2 !== void 0 && _inMemoryState$appSta2.chatDisconnectEventReceived)) {
|
|
145
156
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
146
157
|
Event: TelemetryEvent.EndChatSDKCallFailed,
|
|
147
158
|
ExceptionDetails: {
|
|
@@ -158,7 +169,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
|
|
|
158
169
|
}
|
|
159
170
|
postMessageToOtherTab = false;
|
|
160
171
|
} finally {
|
|
161
|
-
|
|
172
|
+
endChatStateCleanUp(dispatch);
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
175
|
if (!skipCloseChat) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import SlackMarkdown from "slack-markdown-it";
|
|
2
|
+
export const addSlackMarkdownIt = markdown => {
|
|
3
|
+
try {
|
|
4
|
+
markdown.use(SlackMarkdown);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
// this is to support the case when slack-markdown-it
|
|
7
|
+
// transpiled code doesn't export default (webpack5)
|
|
8
|
+
if (SlackMarkdown.default.apply) {
|
|
9
|
+
markdown.use(SlackMarkdown.default);
|
|
10
|
+
} else {
|
|
11
|
+
console.error("Error while adding slackMarkdown plugin", e);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return markdown;
|
|
15
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { changeLanguageCodeFormatForWebChat, getConversationDetailsCall } from "../../../common/utils";
|
|
4
|
+
import DOMPurify from "dompurify";
|
|
4
5
|
import HyperlinkTextOverrideRenderer from "../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer";
|
|
5
6
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
6
7
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
@@ -16,8 +17,10 @@ import createConversationEndMiddleware from "../../webchatcontainerstateful/webc
|
|
|
16
17
|
import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
|
|
17
18
|
import { createMarkdown } from "./createMarkdown";
|
|
18
19
|
import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
|
|
20
|
+
import createMessageSequenceIdOverrideMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
|
|
19
21
|
import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
|
|
20
22
|
import { createStore } from "botframework-webchat";
|
|
23
|
+
import createToastMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
|
|
21
24
|
import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
|
|
22
25
|
import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
|
|
23
26
|
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
@@ -28,9 +31,6 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
|
|
|
28
31
|
import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
|
|
29
32
|
import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
|
|
30
33
|
import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
|
|
31
|
-
import DOMPurify from "dompurify";
|
|
32
|
-
import createMessageSequenceIdOverrideMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
|
|
33
|
-
import createToastMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
|
|
34
34
|
|
|
35
35
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
36
|
export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
|
|
@@ -100,7 +100,11 @@ export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) =>
|
|
|
100
100
|
markdownRenderers.forEach(renderer => {
|
|
101
101
|
text = renderer.render(text);
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
const config = {
|
|
104
|
+
FORBID_TAGS: ["form", "button", "script", "div"],
|
|
105
|
+
FORBID_ATTR: ["action"]
|
|
106
|
+
};
|
|
107
|
+
text = DOMPurify.sanitize(text, config);
|
|
104
108
|
return text;
|
|
105
109
|
};
|
|
106
110
|
function postDomPurifyActivities() {
|
|
@@ -6,7 +6,8 @@ export const shouldSetPreChatIfPersistentChat = async (chatSDK, conversationMode
|
|
|
6
6
|
let skipPreChat = false;
|
|
7
7
|
if (persistentEnabled) {
|
|
8
8
|
const reconnectableChatsParams = {
|
|
9
|
-
authenticatedUserToken: chatSDK.authenticatedUserToken
|
|
9
|
+
authenticatedUserToken: chatSDK.authenticatedUserToken,
|
|
10
|
+
requestId: chatSDK.requestId
|
|
10
11
|
};
|
|
11
12
|
try {
|
|
12
13
|
const reconnectableChatsResponse = await chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams);
|
|
@@ -199,10 +199,16 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
199
199
|
exception: `Failed to setup startChat: ${error}`
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
|
+
BroadcastService.postMessage({
|
|
203
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
204
|
+
payload: {
|
|
205
|
+
errorMessage: error
|
|
206
|
+
}
|
|
207
|
+
});
|
|
202
208
|
isStartChatSuccessful = false;
|
|
203
209
|
throw error;
|
|
204
210
|
}
|
|
205
|
-
await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter);
|
|
211
|
+
await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter, props);
|
|
206
212
|
|
|
207
213
|
// Set app state to Active
|
|
208
214
|
if (isStartChatSuccessful) {
|
|
@@ -252,10 +258,10 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
|
|
|
252
258
|
};
|
|
253
259
|
|
|
254
260
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
-
const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter) => {
|
|
261
|
+
const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter, props) => {
|
|
256
262
|
var _newAdapter$activity$;
|
|
257
263
|
// New adapter creation
|
|
258
|
-
const newAdapter = await createAdapter(chatSDK);
|
|
264
|
+
const newAdapter = await createAdapter(chatSDK, props);
|
|
259
265
|
setAdapter(newAdapter);
|
|
260
266
|
const chatToken = await chatSDK.getChatToken();
|
|
261
267
|
dispatch({
|
package/lib/esm/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Components } from "botframework-webchat";
|
|
5
|
-
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType } from "../../../common/Constants";
|
|
5
|
+
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType, WidgetLoadCustomErrorString } from "../../../common/Constants";
|
|
6
6
|
import { Stack } from "@fluentui/react";
|
|
7
7
|
import React, { useEffect, useRef, useState } from "react";
|
|
8
8
|
import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
|
|
@@ -147,6 +147,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
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) {
|
|
@@ -266,6 +272,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
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({
|
|
@@ -346,6 +358,30 @@ export const LiveChatWidgetStateful = props => {
|
|
|
346
358
|
}
|
|
347
359
|
}
|
|
348
360
|
});
|
|
361
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.NetworkReconnected).subscribe(async () => {
|
|
362
|
+
var _window2, _window2$location;
|
|
363
|
+
if (isThisSessionPopout((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href)) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const conversationDetails = await getConversationDetailsCall(chatSDK);
|
|
367
|
+
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
|
|
368
|
+
dispatch({
|
|
369
|
+
type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
370
|
+
payload: true
|
|
371
|
+
});
|
|
372
|
+
const desc = "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)";
|
|
373
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
374
|
+
Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
375
|
+
Description: desc
|
|
376
|
+
});
|
|
377
|
+
BroadcastService.postMessage({
|
|
378
|
+
eventName: BroadcastEvent.OnWidgetError,
|
|
379
|
+
payload: {
|
|
380
|
+
errorMessage: desc
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
});
|
|
349
385
|
|
|
350
386
|
/**
|
|
351
387
|
* This will allow to sync multiple tabs to handle minimize and maximize state,
|
|
@@ -663,11 +699,24 @@ export const LiveChatWidgetStateful = props => {
|
|
|
663
699
|
|
|
664
700
|
// Handle Chat disconnect cases
|
|
665
701
|
useEffect(() => {
|
|
702
|
+
var _inMemoryState$appSta5;
|
|
666
703
|
const inMemoryState = executeReducer(state, {
|
|
667
704
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
668
705
|
payload: null
|
|
669
706
|
});
|
|
670
707
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
708
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.chatDisconnectEventReceived;
|
|
709
|
+
if (chatDisconnectState && adapter) {
|
|
710
|
+
try {
|
|
711
|
+
adapter.end();
|
|
712
|
+
adapter.close();
|
|
713
|
+
} catch (e) {
|
|
714
|
+
TelemetryHelper.logWebChatEvent(LogLevel.ERROR, {
|
|
715
|
+
Event: TelemetryEvent.EndingAdapterAfterDisconnectionError,
|
|
716
|
+
Description: WidgetLoadCustomErrorString.CloseAdapterAfterDisconnectionErrorString
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}
|
|
671
720
|
}, [state.appStates.chatDisconnectEventReceived]);
|
|
672
721
|
|
|
673
722
|
// if props state gets updates we need to update the renderingMiddlewareProps in the state
|
|
@@ -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 {
|
|
@@ -5,11 +5,11 @@ export class DesignerChatAdapter extends MockAdapter {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
setTimeout(() => {
|
|
8
|
-
postBotMessageActivity(this.activityObserver, "
|
|
9
|
-
this.postUserActivity("
|
|
10
|
-
|
|
8
|
+
postBotMessageActivity(this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
|
|
9
|
+
this.postUserActivity("I need to change my address.", 0);
|
|
10
|
+
postBotMessageActivity(this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
|
|
11
11
|
postSystemMessageActivity(this.activityObserver, "John has joined the chat", 100);
|
|
12
|
-
postBotMessageActivity(this.activityObserver, "
|
|
12
|
+
postBotMessageActivity(this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
|
|
13
13
|
}, 1000);
|
|
14
14
|
}
|
|
15
15
|
postUserActivity(text) {
|
|
@@ -1,10 +1,41 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
4
|
import { DesignerChatAdapter } from "./DesignerChatAdapter";
|
|
2
5
|
import { MockChatSDK } from "./mockchatsdk";
|
|
3
6
|
export class DesignerChatSDK extends MockChatSDK {
|
|
4
7
|
constructor() {
|
|
5
8
|
super();
|
|
9
|
+
_defineProperty(this, "localeId", this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
|
|
6
10
|
}
|
|
7
11
|
createChatAdapter() {
|
|
8
12
|
return new DesignerChatAdapter();
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* If the widget is running in designer mode, we mock the initialize response. We don't want
|
|
16
|
+
* any interactions with a real server in when designing LCW widget visually in Modern Admin.
|
|
17
|
+
*
|
|
18
|
+
* - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
|
|
19
|
+
* - msdyn_callingoptions was changed to disable calling functionality
|
|
20
|
+
*/
|
|
21
|
+
getLiveChatConfig() {
|
|
22
|
+
return {
|
|
23
|
+
LiveWSAndLiveChatEngJoin: {
|
|
24
|
+
msdyn_widgetthemecolor: "19236002",
|
|
25
|
+
// msdyn_callingoptions was changed to disable calling functionality
|
|
26
|
+
msdyn_callingoptions: "192350000",
|
|
27
|
+
msdyn_widgettitle: "Let\u0027s chat",
|
|
28
|
+
msdyn_conversationmode: "192350000",
|
|
29
|
+
msdyn_avatarurl: "https://oc-cdn-ocprod.azureedge.net/livechatwidget/images/chatIcon.svg",
|
|
30
|
+
msdyn_name: "Let's Chat",
|
|
31
|
+
msdyn_postconversationsurveyenable: "false",
|
|
32
|
+
OutOfOperatingHours: "False",
|
|
33
|
+
ShowWidget: "True"
|
|
34
|
+
},
|
|
35
|
+
ChatWidgetLanguage: {
|
|
36
|
+
msdyn_localeid: "1033",
|
|
37
|
+
msdyn_languagename: "English - United States"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
10
41
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|
|
@@ -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) {
|
package/lib/esm/index.js
CHANGED
|
@@ -4,5 +4,6 @@ import useChatSDKStore from "./hooks/useChatSDKStore";
|
|
|
4
4
|
import { getWidgetCacheId, getWidgetEndChatEventName } from "./common/utils";
|
|
5
5
|
import { ConversationState } from "./contexts/common/ConversationState";
|
|
6
6
|
export { default as LiveChatWidget } from "./components/livechatwidget/LiveChatWidget";
|
|
7
|
+
export { getMockChatSDKIfApplicable } from "./components/livechatwidget/common/getMockChatSDKIfApplicable";
|
|
7
8
|
export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore };
|
|
8
9
|
export { getWidgetCacheId, getWidgetEndChatEventName, ConversationState };
|
|
@@ -371,6 +371,90 @@ class TranscriptHTMLBuilder {
|
|
|
371
371
|
window.addEventListener("online", () => {
|
|
372
372
|
document.body.innerHTML = \`${this.networkOnlineMessage} <button onclick="window.location.reload()"> Refresh </button>\`;
|
|
373
373
|
});
|
|
374
|
+
|
|
375
|
+
document.addEventListener("copy", (event) => {
|
|
376
|
+
const clonedSelectedContent = window.getSelection().getRangeAt(0).cloneContents();
|
|
377
|
+
const copiedContent = document.createElement("div");
|
|
378
|
+
copiedContent.appendChild(clonedSelectedContent);
|
|
379
|
+
|
|
380
|
+
event.clipboardData.setData("text/plain", getAllText(copiedContent));
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
getAllText = (element) => {
|
|
386
|
+
let plainText = "";
|
|
387
|
+
Array.from(element.childNodes).forEach((node) => {
|
|
388
|
+
// ignore aria-hidden elements and keyboard help text
|
|
389
|
+
const ariaHiddenAttr = node.attributes ? node.attributes.getNamedItem("aria-hidden") : null;
|
|
390
|
+
if ((ariaHiddenAttr && ariaHiddenAttr.value === "true") || node.classList && node.classList.contains("webchat__keyboard-help")) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// get all texts inside activity body, including message, translated message, attachment name, adaptive card content, status footer, etc.
|
|
395
|
+
if (node.classList && node.classList.contains("webchat__basic-transcript__activity-body")) {
|
|
396
|
+
plainText += this.processTranscriptActivityNode(node);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
400
|
+
plainText += node.textContent + '\\n';
|
|
401
|
+
} else {
|
|
402
|
+
plainText += this.getAllText(node);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
return plainText;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
processTranscriptActivityNode = (node) => {
|
|
409
|
+
const divs = node.getElementsByTagName("div");
|
|
410
|
+
let plainText = "";
|
|
411
|
+
|
|
412
|
+
if (divs && divs.length > 1 && divs[1]) {
|
|
413
|
+
const messageRow = node.querySelector(".webchat__stacked-layout__message-row[aria-roledescription='message']");
|
|
414
|
+
const author = node.querySelector(".message-name");
|
|
415
|
+
const attachmentRow = node.querySelector(".webchat__stacked-layout__attachment-row[aria-roledescription='attachment']");
|
|
416
|
+
|
|
417
|
+
if (messageRow) {
|
|
418
|
+
let message = messageRow.getElementsByClassName("webchat__text-content__markdown");
|
|
419
|
+
|
|
420
|
+
if (message.length === 0) {
|
|
421
|
+
message = messageRow.getElementsByClassName("markdown");
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (message.length > 0) {
|
|
425
|
+
plainText += author.textContent + '\\n' + message[0].textContent + '\\n';
|
|
426
|
+
}
|
|
427
|
+
} else if (attachmentRow) {
|
|
428
|
+
const attachment = attachmentRow.getElementsByClassName("webchat__fileContent__fileName");
|
|
429
|
+
const adaptiveCard = this.getAdaptiveCardContent(attachmentRow.querySelector(".ac-container.ac-adaptiveCard"));
|
|
430
|
+
|
|
431
|
+
plainText += attachment && attachment.length > 0 ? author.textContent +'\\n' + attachment[0].textContent +'\\n': author.textContent +'\\n' + adaptiveCard +'\\n';
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const statusElements = node.getElementsByClassName("webchat__stacked-layout__status");
|
|
435
|
+
if (statusElements.length > 0) {
|
|
436
|
+
const timestampelement = statusElements[0].querySelector(".message-timestamp");
|
|
437
|
+
plainText += timestampelement ? timestampelement.textContent+'\\n\\n' : '\\n';
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
return plainText;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
getAdaptiveCardContent = (node) => {
|
|
445
|
+
if (!node) {
|
|
446
|
+
return undefined;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
let plainText = "";
|
|
450
|
+
const rows = node.querySelectorAll(".ac-textBlock p");
|
|
451
|
+
rows.forEach((row) => {
|
|
452
|
+
plainText += row.textContent+ '\\n';
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
return plainText;
|
|
456
|
+
}
|
|
457
|
+
|
|
374
458
|
<\/script>
|
|
375
459
|
<div id="transcript"></div>
|
|
376
460
|
<script>
|
|
@@ -254,6 +254,7 @@ export declare class WidgetLoadTelemetryMessage {
|
|
|
254
254
|
export declare class WidgetLoadCustomErrorString {
|
|
255
255
|
static readonly AuthenticationFailedErrorString = "Authentication was not successful";
|
|
256
256
|
static readonly NetworkErrorString = "Network Error";
|
|
257
|
+
static readonly CloseAdapterAfterDisconnectionErrorString = "Error trying to end/close chat adapter after the widget is back on-line, for an already disconnected session";
|
|
257
258
|
}
|
|
258
259
|
export declare class PrepareEndChatDescriptionConstants {
|
|
259
260
|
static readonly ConversationEndedByCustomerWithoutPostChat = "Conversation ended by customer. Post chat not configured or should not show.";
|
|
@@ -53,7 +53,8 @@ export declare enum BroadcastEvent {
|
|
|
53
53
|
UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
|
|
54
54
|
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
|
|
55
55
|
ContactIdNotFound = "ContactIdNotFound",
|
|
56
|
-
SyncMinimize = "SyncMinimize"
|
|
56
|
+
SyncMinimize = "SyncMinimize",
|
|
57
|
+
OnWidgetError = "OnWidgetError"
|
|
57
58
|
}
|
|
58
59
|
export declare enum TelemetryEvent {
|
|
59
60
|
CallAdded = "CallAdded",
|
|
@@ -201,7 +202,9 @@ export declare enum TelemetryEvent {
|
|
|
201
202
|
PostChatContextCallFailed = "PostChatContextCallFailed",
|
|
202
203
|
PostChatSurveyLoadingPaneLoaded = "PostChatSurveyLoadingPaneLoaded",
|
|
203
204
|
PostChatSurveyLoaded = "PostChatSurveyLoaded",
|
|
204
|
-
ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived"
|
|
205
|
+
ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived",
|
|
206
|
+
HiddenAdaptiveCardMessageReceived = "HiddenAdaptiveCardMessageReceived",
|
|
207
|
+
EndingAdapterAfterDisconnectionError = "EndingAdapterAfterDisconnectionError"
|
|
205
208
|
}
|
|
206
209
|
export interface TelemetryInput {
|
|
207
210
|
scenarioType: ScenarioType;
|
package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IActivitySubscriber } from "./IActivitySubscriber";
|
|
2
|
+
import { IBotAuthActivitySubscriberOptionalParams } from "../../interfaces/IBotAuthActivitySubscriberOptionalParams";
|
|
2
3
|
export declare class BotAuthActivitySubscriber implements IActivitySubscriber {
|
|
3
4
|
observer: any;
|
|
4
5
|
private signInCardSeen;
|
|
5
|
-
|
|
6
|
+
private fetchBotAuthConfigRetries;
|
|
7
|
+
private fetchBotAuthConfigRetryInterval;
|
|
8
|
+
constructor(optionalParams?: IBotAuthActivitySubscriberOptionalParams);
|
|
6
9
|
applicable(activity: any): boolean;
|
|
7
10
|
apply(activity: any): Promise<any>;
|
|
8
11
|
next(activity: any): Promise<any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IActivitySubscriber } from "./IActivitySubscriber";
|
|
2
|
+
export declare class HiddenAdaptiveCardActivitySubscriber implements IActivitySubscriber {
|
|
3
|
+
observer: any;
|
|
4
|
+
apply(activity: any): Promise<void>;
|
|
5
|
+
applicable(activity: any): boolean;
|
|
6
|
+
next(activity: any): Promise<any>;
|
|
7
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
2
|
+
export declare const createAdapter: (chatSDK: any, props?: ILiveChatWidgetProps | undefined) => Promise<any>;
|
|
@@ -3,4 +3,29 @@ import { MockChatSDK } from "./mockchatsdk";
|
|
|
3
3
|
export declare class DesignerChatSDK extends MockChatSDK {
|
|
4
4
|
constructor();
|
|
5
5
|
createChatAdapter(): DesignerChatAdapter;
|
|
6
|
+
localeId: string;
|
|
7
|
+
/**
|
|
8
|
+
* If the widget is running in designer mode, we mock the initialize response. We don't want
|
|
9
|
+
* any interactions with a real server in when designing LCW widget visually in Modern Admin.
|
|
10
|
+
*
|
|
11
|
+
* - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
|
|
12
|
+
* - msdyn_callingoptions was changed to disable calling functionality
|
|
13
|
+
*/
|
|
14
|
+
getLiveChatConfig(): {
|
|
15
|
+
LiveWSAndLiveChatEngJoin: {
|
|
16
|
+
msdyn_widgetthemecolor: string;
|
|
17
|
+
msdyn_callingoptions: string;
|
|
18
|
+
msdyn_widgettitle: string;
|
|
19
|
+
msdyn_conversationmode: string;
|
|
20
|
+
msdyn_avatarurl: string;
|
|
21
|
+
msdyn_name: string;
|
|
22
|
+
msdyn_postconversationsurveyenable: string;
|
|
23
|
+
OutOfOperatingHours: string;
|
|
24
|
+
ShowWidget: string;
|
|
25
|
+
};
|
|
26
|
+
ChatWidgetLanguage: {
|
|
27
|
+
msdyn_localeid: string;
|
|
28
|
+
msdyn_languagename: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
6
31
|
}
|