@microsoft/omnichannel-chat-widget 1.7.3-main.3d9027c → 1.7.3-main.4c1722d
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 +2 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +6 -1
- 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/getMockChatSDKIfApplicable.js +26 -0
- package/lib/cjs/components/livechatwidget/common/helpers/markdownHelper.js +23 -0
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +41 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +28 -27
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +6 -6
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -3
- package/lib/cjs/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +7 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +30 -0
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatAdapter.js +87 -0
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatSDK.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +41 -0
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/MockBotCardCommandType.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/common/MockBotCommand.js +19 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/attachmentActivityUtils.js +71 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +90 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
- package/lib/cjs/plugins/createChatTranscript.js +84 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -2
- package/lib/esm/common/Constants.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +6 -1
- 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/getMockChatSDKIfApplicable.js +20 -0
- package/lib/esm/components/livechatwidget/common/helpers/markdownHelper.js +15 -0
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +34 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +28 -27
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +7 -2
- package/lib/esm/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +6 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -1
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatAdapter.js +79 -0
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatSDK.js +10 -0
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +33 -0
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +10 -0
- package/lib/esm/components/webchatcontainerstateful/common/MockBotCardCommandType.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/common/MockBotCommand.js +12 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/attachmentActivityUtils.js +61 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +77 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
- package/lib/esm/plugins/createChatTranscript.js +84 -0
- package/lib/esm/plugins/newMessageEventHandler.js +4 -2
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -1
- 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/getMockChatSDKIfApplicable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/helpers/markdownHelper.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/overridePropsOnMockIfApplicable.d.ts +3 -0
- package/lib/types/components/livechatwidget/common/updateSessionDataForTelemetry.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +4 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/common/DemoChatAdapter.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/common/DemoChatSDK.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/common/MockBotCardCommandType.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/common/MockBotCommand.d.ts +11 -0
- package/lib/types/components/webchatcontainerstateful/common/mockadapter.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/attachmentActivityUtils.d.ts +9 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +9 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { uuidv4 } from "@microsoft/omnichannel-chat-sdk";
|
|
2
|
+
export const customerUser = {
|
|
3
|
+
id: "usedId",
|
|
4
|
+
name: "User",
|
|
5
|
+
role: "user"
|
|
6
|
+
};
|
|
7
|
+
export const botUser = {
|
|
8
|
+
id: "botId",
|
|
9
|
+
name: "Bot",
|
|
10
|
+
role: "bot"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// WebChat expects an "echo" activity to confirm the message has been sent successfully
|
|
14
|
+
export const postEchoActivity = function (activityObserver, activity, user) {
|
|
15
|
+
let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
|
|
16
|
+
const echoActivity = {
|
|
17
|
+
...activity,
|
|
18
|
+
id: uuidv4(),
|
|
19
|
+
from: {
|
|
20
|
+
...activity.from,
|
|
21
|
+
...user
|
|
22
|
+
},
|
|
23
|
+
timestamp: new Date().toISOString()
|
|
24
|
+
};
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next(echoActivity); // mock message sent activity
|
|
27
|
+
}, delay);
|
|
28
|
+
};
|
|
29
|
+
export const postBotMessageActivity = function (activityObserver, text) {
|
|
30
|
+
let tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
31
|
+
let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
|
|
34
|
+
id: uuidv4(),
|
|
35
|
+
from: {
|
|
36
|
+
...botUser
|
|
37
|
+
},
|
|
38
|
+
text,
|
|
39
|
+
type: "message",
|
|
40
|
+
channelData: {
|
|
41
|
+
tags
|
|
42
|
+
},
|
|
43
|
+
timestamp: new Date().toISOString()
|
|
44
|
+
});
|
|
45
|
+
}, delay);
|
|
46
|
+
};
|
|
47
|
+
export const postSystemMessageActivity = function (activityObserver, text) {
|
|
48
|
+
let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
|
|
49
|
+
postBotMessageActivity(activityObserver, text, "system", delay);
|
|
50
|
+
};
|
|
51
|
+
export const postBotTypingActivity = function (activityObserver) {
|
|
52
|
+
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
|
|
55
|
+
id: uuidv4(),
|
|
56
|
+
from: {
|
|
57
|
+
...botUser
|
|
58
|
+
},
|
|
59
|
+
type: "typing"
|
|
60
|
+
});
|
|
61
|
+
}, delay);
|
|
62
|
+
};
|
|
63
|
+
export const postBotAttachmentActivity = function (activityObserver) {
|
|
64
|
+
let attachments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
65
|
+
let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
|
|
68
|
+
id: uuidv4(),
|
|
69
|
+
from: {
|
|
70
|
+
...botUser
|
|
71
|
+
},
|
|
72
|
+
attachments,
|
|
73
|
+
type: "message",
|
|
74
|
+
timestamp: new Date().toISOString()
|
|
75
|
+
});
|
|
76
|
+
}, delay);
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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>
|
|
@@ -14,7 +14,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
14
14
|
const raiseMessageEvent = (activity, isHistoryMessage) => {
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
const polyfillMessagePayloadForEvent = payload => {
|
|
17
|
-
var _activity$conversatio, _TelemetryManager$Int;
|
|
17
|
+
var _activity$conversatio, _TelemetryManager$Int, _attachments;
|
|
18
18
|
return {
|
|
19
19
|
...payload,
|
|
20
20
|
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
@@ -23,7 +23,9 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
23
23
|
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
24
24
|
isChatComplete: false,
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
text: activity === null || activity === void 0 ? void 0 : activity.text
|
|
26
|
+
text: activity === null || activity === void 0 ? void 0 : activity.text,
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
attachment: (activity === null || activity === void 0 ? void 0 : (_attachments = activity.attachments) === null || _attachments === void 0 ? void 0 : _attachments.length) >= 1 ? activity === null || activity === void 0 ? void 0 : activity.attachments : []
|
|
27
29
|
};
|
|
28
30
|
};
|
|
29
31
|
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
|
|
@@ -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.";
|
|
@@ -201,7 +201,9 @@ export declare enum TelemetryEvent {
|
|
|
201
201
|
PostChatContextCallFailed = "PostChatContextCallFailed",
|
|
202
202
|
PostChatSurveyLoadingPaneLoaded = "PostChatSurveyLoadingPaneLoaded",
|
|
203
203
|
PostChatSurveyLoaded = "PostChatSurveyLoaded",
|
|
204
|
-
ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived"
|
|
204
|
+
ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived",
|
|
205
|
+
HiddenAdaptiveCardMessageReceived = "HiddenAdaptiveCardMessageReceived",
|
|
206
|
+
EndingAdapterAfterDisconnectionError = "EndingAdapterAfterDisconnectionError"
|
|
205
207
|
}
|
|
206
208
|
export interface TelemetryInput {
|
|
207
209
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getMockChatSDKIfApplicable: (chatSDK: any, type?: string | undefined) => any;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const updateTelemetryData: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
@@ -25,6 +25,7 @@ import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestatef
|
|
|
25
25
|
import { IScrollBarProps } from "./IScrollBarProps";
|
|
26
26
|
import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
|
|
27
27
|
import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
|
|
28
|
+
import { IMockProps } from "./IMockProps";
|
|
28
29
|
export interface ILiveChatWidgetProps {
|
|
29
30
|
audioNotificationProps?: IAudioNotificationProps;
|
|
30
31
|
callingContainerProps?: ICallingContainerProps;
|
|
@@ -61,4 +62,5 @@ export interface ILiveChatWidgetProps {
|
|
|
61
62
|
allowSdkChatSupport?: boolean;
|
|
62
63
|
initialCustomContext?: any;
|
|
63
64
|
draggableChatWidgetProps?: IDraggableChatWidgetProps;
|
|
65
|
+
mock?: IMockProps;
|
|
64
66
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "rxjs/add/operator/share";
|
|
2
|
+
import "rxjs/add/observable/of";
|
|
3
|
+
import { Message } from "botframework-directlinejs";
|
|
4
|
+
import { Observable } from "rxjs/Observable";
|
|
5
|
+
import MockAdapter from "./mockadapter";
|
|
6
|
+
export declare class DemoChatAdapter extends MockAdapter {
|
|
7
|
+
constructor();
|
|
8
|
+
private postBotCommandsActivity;
|
|
9
|
+
postActivity(activity: Message): Observable<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Message } from "botframework-directlinejs";
|
|
2
|
+
import { Observable } from "rxjs/Observable";
|
|
3
|
+
import MockAdapter from "./mockadapter";
|
|
4
|
+
export declare class DesignerChatAdapter extends MockAdapter {
|
|
5
|
+
constructor();
|
|
6
|
+
private postUserActivity;
|
|
7
|
+
postActivity(activity: Message): Observable<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare enum MockBotCommand {
|
|
2
|
+
Bot = "/bot",
|
|
3
|
+
Card = "/card",
|
|
4
|
+
Help = "/help",
|
|
5
|
+
SendAttachment = "send attachment",
|
|
6
|
+
SendBotMessage = "send bot message",
|
|
7
|
+
SendSystemMessage = "send system message",
|
|
8
|
+
SendTyping = "send typing",
|
|
9
|
+
System = "/system"
|
|
10
|
+
}
|
|
11
|
+
export default MockBotCommand;
|
|
@@ -3,8 +3,9 @@ import "rxjs/add/observable/of";
|
|
|
3
3
|
import { Activity, ConnectionStatus, Message } from "botframework-directlinejs";
|
|
4
4
|
import { BehaviorSubject } from "rxjs";
|
|
5
5
|
import { Observable } from "rxjs/Observable";
|
|
6
|
+
import { Subscriber } from "rxjs/Subscriber";
|
|
6
7
|
export default class MockAdapter {
|
|
7
|
-
|
|
8
|
+
activityObserver?: Subscriber<Activity>;
|
|
8
9
|
activity$: Observable<Activity>;
|
|
9
10
|
connectionStatus$: BehaviorSubject<ConnectionStatus>;
|
|
10
11
|
constructor();
|
|
@@ -8,6 +8,12 @@ export declare class MockChatSDK {
|
|
|
8
8
|
orgId: string;
|
|
9
9
|
orgUrl: string;
|
|
10
10
|
};
|
|
11
|
+
initialize(): Promise<{
|
|
12
|
+
LiveWSAndLiveChatEngJoin: {
|
|
13
|
+
msdyn_postconversationsurveyenable: string;
|
|
14
|
+
msdyn_conversationmode: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
11
17
|
startChat(): Promise<void>;
|
|
12
18
|
endChat(): null;
|
|
13
19
|
getChatToken(): null;
|
package/lib/types/components/webchatcontainerstateful/common/utils/attachmentActivityUtils.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HeroCard, Signin, Thumbnail } from "botframework-directlinejs";
|
|
2
|
+
export declare const createJpgFileAttachment: () => {
|
|
3
|
+
contentType: string;
|
|
4
|
+
name: string;
|
|
5
|
+
contentUrl: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const createHeroCardAttachment: () => HeroCard;
|
|
8
|
+
export declare const createThumbnailCardAttachment: () => Thumbnail;
|
|
9
|
+
export declare const createSigninCardAttachment: () => Signin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Activity, Attachment, Message, User } from "botframework-directlinejs";
|
|
2
|
+
import { Subscriber } from "rxjs/Subscriber";
|
|
3
|
+
export declare const customerUser: User;
|
|
4
|
+
export declare const botUser: User;
|
|
5
|
+
export declare const postEchoActivity: (activityObserver: Subscriber<Activity> | undefined, activity: Message, user: User, delay?: number) => void;
|
|
6
|
+
export declare const postBotMessageActivity: (activityObserver: Subscriber<Activity> | undefined, text: string, tags?: string, delay?: number) => void;
|
|
7
|
+
export declare const postSystemMessageActivity: (activityObserver: Subscriber<Activity> | undefined, text: string, delay?: number) => void;
|
|
8
|
+
export declare const postBotTypingActivity: (activityObserver: Subscriber<Activity> | undefined, delay?: number) => void;
|
|
9
|
+
export declare const postBotAttachmentActivity: (activityObserver: Subscriber<Activity> | undefined, attachments?: Attachment[], delay?: number) => void;
|
package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { IStyle } from "@fluentui/react";
|
|
|
5
5
|
import { IWebChatProps } from "./IWebChatProps";
|
|
6
6
|
import { StyleOptions } from "botframework-webchat-api";
|
|
7
7
|
import { IAdaptiveCardStyles } from "./IAdaptiveCardStyles";
|
|
8
|
+
import { IBotAuthConfig } from "./IBotAuthConfig";
|
|
8
9
|
export interface IWebChatContainerStatefulProps {
|
|
9
10
|
containerStyles?: IStyle;
|
|
10
11
|
disableNewLineMarkdownSupport?: boolean;
|
|
@@ -16,6 +17,7 @@ export interface IWebChatContainerStatefulProps {
|
|
|
16
17
|
renderingMiddlewareProps?: IRenderingMiddlewareProps;
|
|
17
18
|
localizedTexts?: ILiveChatWidgetLocalizedTexts;
|
|
18
19
|
botMagicCode?: IBotMagicCodeConfig;
|
|
20
|
+
botAuthConfig?: IBotAuthConfig;
|
|
19
21
|
hyperlinkTextOverride?: boolean;
|
|
20
22
|
adaptiveCardStyles?: IAdaptiveCardStyles;
|
|
21
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.7.3-main.
|
|
3
|
+
"version": "1.7.3-main.4c1722d",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@microsoft/omnichannel-chat-components": "1.1.5",
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "^1.9.
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "^1.9.10",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.5.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|