@microsoft/omnichannel-chat-widget 1.7.8-main.29ce174 → 1.7.8-main.50111af
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 +57 -18
- package/lib/cjs/common/KeyCodes.js +6 -1
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/cjs/common/facades/FacadeChatSDK.js +385 -292
- package/lib/cjs/common/storage/default/defaultCacheManager.js +6 -3
- package/lib/cjs/common/telemetry/TelemetryConstants.js +137 -116
- package/lib/cjs/common/telemetry/TelemetryHelper.js +219 -181
- package/lib/cjs/common/telemetry/TelemetryManager.js +9 -2
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
- package/lib/cjs/components/headerstateful/HeaderStateful.js +3 -5
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +14 -6
- package/lib/cjs/components/livechatwidget/common/Deferred.js +14 -6
- package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +4 -18
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -5
- package/lib/cjs/components/livechatwidget/common/startChat.js +2 -23
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +3 -3
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +6 -4
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +7 -6
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
- package/lib/cjs/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +62 -52
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
- package/lib/cjs/firstresponselatency/Constants.js +13 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +118 -0
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +201 -0
- package/lib/cjs/firstresponselatency/util.js +98 -0
- package/lib/cjs/plugins/createChatTranscript.js +88 -58
- package/lib/cjs/plugins/newMessageEventHandler.js +102 -88
- package/lib/esm/common/Constants.js +57 -18
- package/lib/esm/common/KeyCodes.js +6 -1
- package/lib/esm/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/esm/common/facades/FacadeChatSDK.js +385 -292
- package/lib/esm/common/storage/default/defaultCacheManager.js +6 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +137 -116
- package/lib/esm/common/telemetry/TelemetryHelper.js +219 -181
- package/lib/esm/common/telemetry/TelemetryManager.js +9 -2
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
- package/lib/esm/components/headerstateful/HeaderStateful.js +3 -5
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +32 -19
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +71 -56
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +17 -8
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +65 -52
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +31 -18
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +14 -6
- package/lib/esm/components/livechatwidget/common/Deferred.js +14 -6
- package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +4 -18
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +1 -6
- package/lib/esm/components/livechatwidget/common/startChat.js +3 -24
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +3 -3
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -4
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +7 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatAdapter.js +88 -65
- package/lib/esm/components/webchatcontainerstateful/common/DemoChatSDK.js +26 -7
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +49 -26
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +57 -35
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +63 -52
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +95 -61
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +53 -39
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +88 -60
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
- package/lib/esm/firstresponselatency/Constants.js +6 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +112 -0
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +194 -0
- package/lib/esm/firstresponselatency/util.js +87 -0
- package/lib/esm/plugins/createChatTranscript.js +88 -58
- package/lib/esm/plugins/newMessageEventHandler.js +100 -86
- package/lib/types/common/facades/FacadeChatSDK.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +8 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -1
- package/lib/types/firstresponselatency/Constants.d.ts +30 -0
- package/lib/types/firstresponselatency/FirstMessageTrackerFromBot.d.ts +1 -0
- package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +22 -0
- package/lib/types/firstresponselatency/util.d.ts +7 -0
- package/package.json +18 -6
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
1
4
|
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
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
6
|
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); }
|
|
@@ -6,11 +9,12 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
6
9
|
import { createFileAndDownload } from "../common/utils";
|
|
7
10
|
import defaultLibraryScripts from "../components/footerstateful/downloadtranscriptstateful/common/defaultLibraryScripts";
|
|
8
11
|
import DOMPurify from "dompurify";
|
|
9
|
-
|
|
12
|
+
let TranscriptHTMLBuilder = /*#__PURE__*/function () {
|
|
10
13
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
function TranscriptHTMLBuilder(options) {
|
|
13
16
|
var _this$options, _this$options2, _this$options3, _this$options4, _this$options5, _this$options6, _this$options7, _this$options8, _this$options9, _this$options10, _this$options11, _this$options12, _this$options13;
|
|
17
|
+
_classCallCheck(this, TranscriptHTMLBuilder);
|
|
14
18
|
_defineProperty(this, "options", void 0);
|
|
15
19
|
_defineProperty(this, "pageTitle", "Customer Transcript");
|
|
16
20
|
_defineProperty(this, "attachmentMessage", "The following attachment was uploaded during the conversation: ");
|
|
@@ -70,59 +74,79 @@ class TranscriptHTMLBuilder {
|
|
|
70
74
|
this.externalScripts = this.options.externalScripts;
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
|
|
74
|
-
|
|
77
|
+
_createClass(TranscriptHTMLBuilder, [{
|
|
78
|
+
key: "createMetaElement",
|
|
79
|
+
value: function createMetaElement() {
|
|
80
|
+
const htmlData = `
|
|
75
81
|
<meta charset="UTF-8">
|
|
76
82
|
`;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
83
|
+
return htmlData;
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "createTitleElement",
|
|
87
|
+
value: function createTitleElement() {
|
|
88
|
+
const htmlData = `<title> ${this.pageTitle} </title>`;
|
|
89
|
+
return htmlData;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "createScriptElement",
|
|
93
|
+
value: function createScriptElement(src) {
|
|
94
|
+
let integrity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
95
|
+
let crossOrigin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
96
|
+
let referrerPolicy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
97
|
+
return `<script src="${src}" ${integrity ? `integrity="${integrity}"` : ""} ${crossOrigin ? `crossorigin="${crossOrigin}"` : ""} ${referrerPolicy ? `referrerpolicy="${referrerPolicy}"` : ""}><\/script>`;
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "createWebChatScriptElement",
|
|
101
|
+
value: function createWebChatScriptElement() {
|
|
102
|
+
var _this$externalScripts, _this$externalScripts2, _this$externalScripts3, _this$externalScripts4, _this$externalScripts5, _this$externalScripts6, _this$externalScripts7, _this$externalScripts8, _this$externalScripts9, _this$externalScripts10;
|
|
103
|
+
return (_this$externalScripts = this.externalScripts) !== null && _this$externalScripts !== void 0 && (_this$externalScripts2 = _this$externalScripts.botframeworkWebChat) !== null && _this$externalScripts2 !== void 0 && _this$externalScripts2.src ? this.createScriptElement((_this$externalScripts3 = this.externalScripts) === null || _this$externalScripts3 === void 0 ? void 0 : (_this$externalScripts4 = _this$externalScripts3.botframeworkWebChat) === null || _this$externalScripts4 === void 0 ? void 0 : _this$externalScripts4.src, (_this$externalScripts5 = this.externalScripts) === null || _this$externalScripts5 === void 0 ? void 0 : (_this$externalScripts6 = _this$externalScripts5.botframeworkWebChat) === null || _this$externalScripts6 === void 0 ? void 0 : _this$externalScripts6.integrity, (_this$externalScripts7 = this.externalScripts) === null || _this$externalScripts7 === void 0 ? void 0 : (_this$externalScripts8 = _this$externalScripts7.botframeworkWebChat) === null || _this$externalScripts8 === void 0 ? void 0 : _this$externalScripts8.crossOrigin, (_this$externalScripts9 = this.externalScripts) === null || _this$externalScripts9 === void 0 ? void 0 : (_this$externalScripts10 = _this$externalScripts9.botframeworkWebChat) === null || _this$externalScripts10 === void 0 ? void 0 : _this$externalScripts10.referrerPolicy) : this.createScriptElement(defaultLibraryScripts.botframeworkWebChat.src);
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "createRxJsScriptElement",
|
|
107
|
+
value: function createRxJsScriptElement() {
|
|
108
|
+
var _this$externalScripts11, _this$externalScripts12, _this$externalScripts13, _this$externalScripts14, _this$externalScripts15, _this$externalScripts16, _this$externalScripts17, _this$externalScripts18, _this$externalScripts19, _this$externalScripts20;
|
|
109
|
+
return (_this$externalScripts11 = this.externalScripts) !== null && _this$externalScripts11 !== void 0 && (_this$externalScripts12 = _this$externalScripts11.rxJs) !== null && _this$externalScripts12 !== void 0 && _this$externalScripts12.src ? this.createScriptElement((_this$externalScripts13 = this.externalScripts) === null || _this$externalScripts13 === void 0 ? void 0 : (_this$externalScripts14 = _this$externalScripts13.rxJs) === null || _this$externalScripts14 === void 0 ? void 0 : _this$externalScripts14.src, (_this$externalScripts15 = this.externalScripts) === null || _this$externalScripts15 === void 0 ? void 0 : (_this$externalScripts16 = _this$externalScripts15.rxJs) === null || _this$externalScripts16 === void 0 ? void 0 : _this$externalScripts16.integrity, (_this$externalScripts17 = this.externalScripts) === null || _this$externalScripts17 === void 0 ? void 0 : (_this$externalScripts18 = _this$externalScripts17.rxJs) === null || _this$externalScripts18 === void 0 ? void 0 : _this$externalScripts18.crossOrigin, (_this$externalScripts19 = this.externalScripts) === null || _this$externalScripts19 === void 0 ? void 0 : (_this$externalScripts20 = _this$externalScripts19.rxJs) === null || _this$externalScripts20 === void 0 ? void 0 : _this$externalScripts20.referrerPolicy) : this.createScriptElement(defaultLibraryScripts.rxJs.src, defaultLibraryScripts.rxJs.integrity, defaultLibraryScripts.rxJs.crossOrigin, defaultLibraryScripts.rxJs.referrerPolicy);
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "createReactScriptElement",
|
|
113
|
+
value: function createReactScriptElement() {
|
|
114
|
+
var _this$externalScripts21, _this$externalScripts22, _this$externalScripts23, _this$externalScripts24, _this$externalScripts25, _this$externalScripts26, _this$externalScripts27, _this$externalScripts28, _this$externalScripts29, _this$externalScripts30;
|
|
115
|
+
return (_this$externalScripts21 = this.externalScripts) !== null && _this$externalScripts21 !== void 0 && (_this$externalScripts22 = _this$externalScripts21.react) !== null && _this$externalScripts22 !== void 0 && _this$externalScripts22.src ? this.createScriptElement((_this$externalScripts23 = this.externalScripts) === null || _this$externalScripts23 === void 0 ? void 0 : (_this$externalScripts24 = _this$externalScripts23.react) === null || _this$externalScripts24 === void 0 ? void 0 : _this$externalScripts24.src, (_this$externalScripts25 = this.externalScripts) === null || _this$externalScripts25 === void 0 ? void 0 : (_this$externalScripts26 = _this$externalScripts25.react) === null || _this$externalScripts26 === void 0 ? void 0 : _this$externalScripts26.integrity, (_this$externalScripts27 = this.externalScripts) === null || _this$externalScripts27 === void 0 ? void 0 : (_this$externalScripts28 = _this$externalScripts27.react) === null || _this$externalScripts28 === void 0 ? void 0 : _this$externalScripts28.crossOrigin, (_this$externalScripts29 = this.externalScripts) === null || _this$externalScripts29 === void 0 ? void 0 : (_this$externalScripts30 = _this$externalScripts29.react) === null || _this$externalScripts30 === void 0 ? void 0 : _this$externalScripts30.referrerPolicy) : this.createScriptElement(defaultLibraryScripts.react.src);
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "createReactDomScriptElement",
|
|
119
|
+
value: function createReactDomScriptElement() {
|
|
120
|
+
var _this$externalScripts31, _this$externalScripts32, _this$externalScripts33, _this$externalScripts34, _this$externalScripts35, _this$externalScripts36, _this$externalScripts37, _this$externalScripts38, _this$externalScripts39, _this$externalScripts40, _this$externalScripts41, _this$externalScripts42;
|
|
121
|
+
return (_this$externalScripts31 = this.externalScripts) !== null && _this$externalScripts31 !== void 0 && (_this$externalScripts32 = _this$externalScripts31.reactDom) !== null && _this$externalScripts32 !== void 0 && _this$externalScripts32.src ? this.createScriptElement((_this$externalScripts33 = this.externalScripts) === null || _this$externalScripts33 === void 0 ? void 0 : (_this$externalScripts34 = _this$externalScripts33.reactDom) === null || _this$externalScripts34 === void 0 ? void 0 : _this$externalScripts34.src, (_this$externalScripts35 = this.externalScripts) === null || _this$externalScripts35 === void 0 ? void 0 : (_this$externalScripts36 = _this$externalScripts35.reactDom) === null || _this$externalScripts36 === void 0 ? void 0 : _this$externalScripts36.integrity, (_this$externalScripts37 = this.externalScripts) === null || _this$externalScripts37 === void 0 ? void 0 : (_this$externalScripts38 = _this$externalScripts37.reactDom) === null || _this$externalScripts38 === void 0 ? void 0 : _this$externalScripts38.crossOrigin, (_this$externalScripts39 = this.externalScripts) === null || _this$externalScripts39 === void 0 ? void 0 : (_this$externalScripts40 = _this$externalScripts39.reactDom) === null || _this$externalScripts40 === void 0 ? void 0 : _this$externalScripts40.referrerPolicy) : this.createScriptElement(((_this$externalScripts41 = this.externalScripts) === null || _this$externalScripts41 === void 0 ? void 0 : (_this$externalScripts42 = _this$externalScripts41.reactDom) === null || _this$externalScripts42 === void 0 ? void 0 : _this$externalScripts42.src) ?? defaultLibraryScripts.reactDom.src);
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
key: "createMarkdownItScriptElement",
|
|
125
|
+
value: function createMarkdownItScriptElement() {
|
|
126
|
+
var _this$externalScripts43, _this$externalScripts44, _this$externalScripts45, _this$externalScripts46, _this$externalScripts47, _this$externalScripts48, _this$externalScripts49, _this$externalScripts50, _this$externalScripts51, _this$externalScripts52;
|
|
127
|
+
return (_this$externalScripts43 = this.externalScripts) !== null && _this$externalScripts43 !== void 0 && (_this$externalScripts44 = _this$externalScripts43.markdownIt) !== null && _this$externalScripts44 !== void 0 && _this$externalScripts44.src ? this.createScriptElement((_this$externalScripts45 = this.externalScripts) === null || _this$externalScripts45 === void 0 ? void 0 : (_this$externalScripts46 = _this$externalScripts45.markdownIt) === null || _this$externalScripts46 === void 0 ? void 0 : _this$externalScripts46.src, (_this$externalScripts47 = this.externalScripts) === null || _this$externalScripts47 === void 0 ? void 0 : (_this$externalScripts48 = _this$externalScripts47.markdownIt) === null || _this$externalScripts48 === void 0 ? void 0 : _this$externalScripts48.integrity, (_this$externalScripts49 = this.externalScripts) === null || _this$externalScripts49 === void 0 ? void 0 : (_this$externalScripts50 = _this$externalScripts49.markdownIt) === null || _this$externalScripts50 === void 0 ? void 0 : _this$externalScripts50.crossOrigin, (_this$externalScripts51 = this.externalScripts) === null || _this$externalScripts51 === void 0 ? void 0 : (_this$externalScripts52 = _this$externalScripts51.markdownIt) === null || _this$externalScripts52 === void 0 ? void 0 : _this$externalScripts52.referrerPolicy) : this.createScriptElement(defaultLibraryScripts.markdownIt.src, defaultLibraryScripts.markdownIt.integrity, defaultLibraryScripts.markdownIt.crossOrigin);
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "createExternalScriptElements",
|
|
131
|
+
value: function createExternalScriptElements() {
|
|
132
|
+
const webChatScript = this.createWebChatScriptElement();
|
|
133
|
+
const rxJsScript = this.createRxJsScriptElement();
|
|
134
|
+
const reactScript = this.createReactScriptElement();
|
|
135
|
+
const reactDomScript = this.createReactDomScriptElement();
|
|
136
|
+
const markdownItScript = this.createMarkdownItScriptElement();
|
|
137
|
+
const htmlData = `
|
|
116
138
|
${webChatScript}
|
|
117
139
|
${rxJsScript}
|
|
118
140
|
${reactScript}
|
|
119
141
|
${reactDomScript}
|
|
120
142
|
${markdownItScript}
|
|
121
143
|
`;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
144
|
+
return htmlData;
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "createHeadElement",
|
|
148
|
+
value: function createHeadElement() {
|
|
149
|
+
const htmlData = `
|
|
126
150
|
<head>
|
|
127
151
|
${this.createMetaElement()}
|
|
128
152
|
${this.createTitleElement()}
|
|
@@ -362,10 +386,12 @@ class TranscriptHTMLBuilder {
|
|
|
362
386
|
<\/style>
|
|
363
387
|
</head>
|
|
364
388
|
`;
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
389
|
+
return htmlData;
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
key: "createBodyElement",
|
|
393
|
+
value: function createBodyElement() {
|
|
394
|
+
const htmlData = `
|
|
369
395
|
<body>
|
|
370
396
|
<script>
|
|
371
397
|
if (!navigator.onLine) {
|
|
@@ -646,18 +672,22 @@ class TranscriptHTMLBuilder {
|
|
|
646
672
|
<\/script>
|
|
647
673
|
</body>
|
|
648
674
|
`;
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
675
|
+
return htmlData;
|
|
676
|
+
}
|
|
677
|
+
}, {
|
|
678
|
+
key: "createHTML",
|
|
679
|
+
value: function createHTML() {
|
|
680
|
+
const htmlData = `
|
|
653
681
|
<html>
|
|
654
682
|
${this.createHeadElement()}
|
|
655
683
|
${this.createBodyElement()}
|
|
656
684
|
</html>
|
|
657
685
|
`;
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
686
|
+
return htmlData;
|
|
687
|
+
}
|
|
688
|
+
}]);
|
|
689
|
+
return TranscriptHTMLBuilder;
|
|
690
|
+
}();
|
|
661
691
|
const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
662
692
|
let renderAttachments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
663
693
|
let transcriptOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -1,100 +1,114 @@
|
|
|
1
1
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ScenarioType } from "../firstresponselatency/Constants";
|
|
3
|
+
import { buildMessagePayload, getScenarioType, isHistoryMessage, polyfillMessagePayloadForEvent } from "../firstresponselatency/util";
|
|
2
4
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
3
5
|
import { Constants } from "../common/Constants";
|
|
6
|
+
import { FirstResponseLatencyTracker } from "../firstresponselatency/FirstResponseLatencyTracker";
|
|
4
7
|
import { TelemetryHelper } from "../common/telemetry/TelemetryHelper";
|
|
5
8
|
import { TelemetryManager } from "../common/telemetry/TelemetryManager";
|
|
6
9
|
export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
10
|
+
// Hooking the message tracker in the listener, a bit invasive but easier to control.
|
|
11
|
+
const firstResponseLatencyTracker = new FirstResponseLatencyTracker();
|
|
12
|
+
// epoch time in utc for when start to listen.
|
|
13
|
+
// We dont longer have a mechanism to know if a message is history or new, so any message older than the time we start listening will be considered a history message.
|
|
14
|
+
// this is a workaround for the fact that we dont have a way to identify if a message is history or new, and it will provide consistency across different scenarios
|
|
15
|
+
const startTime = new Date().getTime();
|
|
16
|
+
let isHistoryMessageReceivedEventRaised = false;
|
|
7
17
|
const onNewAdapterActivityHandler = activity => {
|
|
8
|
-
|
|
9
|
-
const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message;
|
|
10
|
-
const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
|
|
11
|
-
raiseMessageEvent(activity, isHistoryMessage);
|
|
18
|
+
raiseMessageEvent(activity);
|
|
12
19
|
};
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
const userSendMessageStrategy = activity => {
|
|
21
|
+
var _TelemetryManager$Int;
|
|
22
|
+
const payload = buildMessagePayload(activity, userId);
|
|
15
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
21
|
-
chatId: activity === null || activity === void 0 ? void 0 : (_activity$conversatio = activity.conversation) === null || _activity$conversatio === void 0 ? void 0 : _activity$conversatio.id,
|
|
22
|
-
conversationId: (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId,
|
|
23
|
-
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
24
|
-
isChatComplete: false,
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
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 : []
|
|
29
|
-
};
|
|
24
|
+
payload.messageType = Constants.userMessageTag;
|
|
25
|
+
const newMessageSentEvent = {
|
|
26
|
+
eventName: BroadcastEvent.NewMessageSent,
|
|
27
|
+
payload: polyfillMessagePayloadForEvent(activity, payload, (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId)
|
|
30
28
|
};
|
|
29
|
+
BroadcastService.postMessage(newMessageSentEvent);
|
|
30
|
+
if (!isHistoryMessage(activity, startTime)) {
|
|
31
|
+
firstResponseLatencyTracker.startClock(payload);
|
|
32
|
+
}
|
|
33
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
34
|
+
Event: TelemetryEvent.MessageSent,
|
|
35
|
+
Description: "New message sent"
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const systemMessageStrategy = activity => {
|
|
39
|
+
const payload = buildMessagePayload(activity, userId);
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
payload.messageType = Constants.systemMessageTag;
|
|
42
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
43
|
+
Event: TelemetryEvent.SystemMessageReceived,
|
|
44
|
+
Description: "System message received"
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const historyMessageStrategy = payload => {
|
|
48
|
+
const newMessageReceivedEvent = {
|
|
49
|
+
eventName: BroadcastEvent.HistoryMessageReceived,
|
|
50
|
+
payload: payload
|
|
51
|
+
};
|
|
52
|
+
BroadcastService.postMessage(newMessageReceivedEvent);
|
|
53
|
+
if (!isHistoryMessageReceivedEventRaised) {
|
|
54
|
+
// this is needed for reload scenarios, it helps to identify the last message received before the reload
|
|
55
|
+
isHistoryMessageReceivedEventRaised = true;
|
|
56
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
57
|
+
Event: TelemetryEvent.RehydrateMessageReceived,
|
|
58
|
+
Description: "History message received",
|
|
59
|
+
CustomProperties: payload
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const isValidMessage = activity => {
|
|
64
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && _activity$channelData.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData2 = activity.channelData) === null || _activity$channelData2 === void 0 ? void 0 : (_activity$channelData3 = _activity$channelData2.tags) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.length) === 0;
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
71
|
+
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
const receivedMessageStrategy = activity => {
|
|
77
|
+
var _TelemetryManager$Int3;
|
|
78
|
+
if (!isValidMessage(activity)) return;
|
|
79
|
+
const isHistoryMessageReceived = isHistoryMessage(activity, startTime);
|
|
80
|
+
const payload = buildMessagePayload(activity, userId);
|
|
81
|
+
payload.messageType = Constants.userMessageTag;
|
|
82
|
+
if (isHistoryMessageReceived) {
|
|
83
|
+
var _TelemetryManager$Int2;
|
|
84
|
+
historyMessageStrategy(polyfillMessagePayloadForEvent(activity, payload, (_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.conversationId));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
firstResponseLatencyTracker.stopClock(payload);
|
|
88
|
+
const newMessageReceivedEvent = {
|
|
89
|
+
eventName: BroadcastEvent.NewMessageReceived,
|
|
90
|
+
payload: polyfillMessagePayloadForEvent(activity, payload, (_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : _TelemetryManager$Int3.conversationId)
|
|
91
|
+
};
|
|
92
|
+
BroadcastService.postMessage(newMessageReceivedEvent);
|
|
93
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
94
|
+
Event: TelemetryEvent.MessageReceived,
|
|
95
|
+
Description: "New message received",
|
|
96
|
+
CustomProperties: payload
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const raiseMessageEvent = activity => {
|
|
31
100
|
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === Constants.userMessageTag) {
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
payload.messageType = Constants.userMessageTag;
|
|
46
|
-
const newMessageSentEvent = {
|
|
47
|
-
eventName: BroadcastEvent.NewMessageSent,
|
|
48
|
-
payload: polyfillMessagePayloadForEvent(payload)
|
|
49
|
-
};
|
|
50
|
-
BroadcastService.postMessage(newMessageSentEvent);
|
|
51
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
52
|
-
Event: TelemetryEvent.MessageSent,
|
|
53
|
-
Description: "New message sent"
|
|
54
|
-
});
|
|
55
|
-
} else {
|
|
56
|
-
var _activity$channelData5, _activity$channelData6;
|
|
57
|
-
if (activity !== null && activity !== void 0 && (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.systemMessageTag)) {
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
payload.messageType = Constants.systemMessageTag;
|
|
60
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
61
|
-
Event: TelemetryEvent.SystemMessageReceived,
|
|
62
|
-
Description: "System message received"
|
|
63
|
-
});
|
|
64
|
-
} else {
|
|
65
|
-
var _activity$channelData7, _activity$channelData8, _activity$channelData9;
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
-
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData7 = activity.channelData) !== null && _activity$channelData7 !== void 0 && _activity$channelData7.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData8 = activity.channelData) === null || _activity$channelData8 === void 0 ? void 0 : (_activity$channelData9 = _activity$channelData8.tags) === null || _activity$channelData9 === void 0 ? void 0 : _activity$channelData9.length) === 0;
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
-
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
72
|
-
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
payload.messageType = Constants.userMessageTag;
|
|
76
|
-
}
|
|
77
|
-
const newMessageReceivedEvent = {
|
|
78
|
-
eventName: isHistoryMessage ? BroadcastEvent.HistoryMessageReceived : BroadcastEvent.NewMessageReceived,
|
|
79
|
-
payload: polyfillMessagePayloadForEvent(payload)
|
|
80
|
-
};
|
|
81
|
-
BroadcastService.postMessage(newMessageReceivedEvent);
|
|
82
|
-
if (!isHistoryMessage) {
|
|
83
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
84
|
-
Event: TelemetryEvent.MessageReceived,
|
|
85
|
-
Description: "New message received",
|
|
86
|
-
CustomProperties: payload
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
if (!isHistoryMessageReceivedEventRasied) {
|
|
90
|
-
isHistoryMessageReceivedEventRasied = true;
|
|
91
|
-
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
92
|
-
Event: TelemetryEvent.RehydrateMessageReceived,
|
|
93
|
-
Description: "History message received",
|
|
94
|
-
CustomProperties: payload
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
101
|
+
const scenarioType = getScenarioType(activity);
|
|
102
|
+
switch (scenarioType) {
|
|
103
|
+
case ScenarioType.UserSendMessageStrategy:
|
|
104
|
+
userSendMessageStrategy(activity);
|
|
105
|
+
break;
|
|
106
|
+
case ScenarioType.SystemMessageStrategy:
|
|
107
|
+
systemMessageStrategy(activity);
|
|
108
|
+
break;
|
|
109
|
+
case ScenarioType.ReceivedMessageStrategy:
|
|
110
|
+
receivedMessageStrategy(activity);
|
|
111
|
+
break;
|
|
98
112
|
}
|
|
99
113
|
}
|
|
100
114
|
};
|
|
@@ -43,6 +43,7 @@ export declare class FacadeChatSDK {
|
|
|
43
43
|
private enforceBase64Encoding;
|
|
44
44
|
private extractExpFromToken;
|
|
45
45
|
private setToken;
|
|
46
|
+
private corroborateTokenIsSet;
|
|
46
47
|
private tokenRing;
|
|
47
48
|
private validateAndExecuteCall;
|
|
48
49
|
initialize(optionalParams?: InitializeOptionalParams): Promise<ChatConfig>;
|
|
@@ -54,7 +54,9 @@ export declare enum BroadcastEvent {
|
|
|
54
54
|
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
|
|
55
55
|
ContactIdNotFound = "ContactIdNotFound",
|
|
56
56
|
SyncMinimize = "SyncMinimize",
|
|
57
|
-
OnWidgetError = "OnWidgetError"
|
|
57
|
+
OnWidgetError = "OnWidgetError",
|
|
58
|
+
FMLTrackingCompletedAck = "FMLTrackingCompletedAck",
|
|
59
|
+
FMLTrackingCompleted = "FMLTrackingCompleted"
|
|
58
60
|
}
|
|
59
61
|
export declare enum TelemetryEvent {
|
|
60
62
|
CallAdded = "CallAdded",
|
|
@@ -192,6 +194,11 @@ export declare enum TelemetryEvent {
|
|
|
192
194
|
ReconnectChatMinimize = "ReconnectChatMinimize",
|
|
193
195
|
MessageSent = "MessageSent",
|
|
194
196
|
MessageReceived = "MessageReceived",
|
|
197
|
+
MessageLapTrack = "MessageLapTrack",
|
|
198
|
+
BotFirstMessageLapTrack = "BotFirstMessageLapTrack",
|
|
199
|
+
BotFirstMessageLapTrackError = "BotFirstMessageLapTrackError",
|
|
200
|
+
MessageStartLapTrackError = "MessageStartLapTrackError",
|
|
201
|
+
MessageStopLapTrackError = "MessageStopLapTrackError",
|
|
195
202
|
SystemMessageReceived = "SystemMessageReceived",
|
|
196
203
|
RehydrateMessageReceived = "RehydrateMessageReceived",
|
|
197
204
|
CustomContextReceived = "CustomContextReceived",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityMiddleware, ActivityStatusMiddleware, AttachmentForScreenReaderMiddleware, AttachmentMiddleware, AvatarMiddleware, CardActionMiddleware, GroupActivitiesMiddleware, ScrollToEndButtonMiddleware, ToastMiddleware, TypingIndicatorMiddleware, WebSpeechPonyfillFactory } from "botframework-webchat-api";
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
2
3
|
import { DirectLineActivity, OneOrMany } from "botframework-webchat-core";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
4
|
export interface IWebChatProps {
|
|
5
5
|
activityMiddleware?: OneOrMany<ActivityMiddleware>;
|
|
6
6
|
activityStatusMiddleware?: OneOrMany<ActivityStatusMiddleware>;
|
|
@@ -15,7 +15,7 @@ export interface IWebChatProps {
|
|
|
15
15
|
downscaleImageToDataURL?: (blob: Blob, maxWidth: number, maxHeight: number, type: string, quality: number) => Promise<URL>;
|
|
16
16
|
grammars?: any;
|
|
17
17
|
groupActivitiesMiddleware?: OneOrMany<GroupActivitiesMiddleware>;
|
|
18
|
-
internalErrorBoxClass?:
|
|
18
|
+
internalErrorBoxClass?: ComponentType<any>;
|
|
19
19
|
internalRenderErrorBox?: any;
|
|
20
20
|
locale?: string;
|
|
21
21
|
onTelemetry?: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ConfirmationState, ConversationEndEntity, ParticipantType } from "../../common/Constants";
|
|
1
2
|
import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
|
|
2
3
|
import { ConversationState } from "./ConversationState";
|
|
3
4
|
import { IInternalTelemetryData } from "../../common/telemetry/interfaces/IInternalTelemetryData";
|
|
4
5
|
import { ILiveChatWidgetLocalizedTexts } from "./ILiveChatWidgetLocalizedTexts";
|
|
5
6
|
import { IRenderingMiddlewareProps } from "../../components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps";
|
|
6
|
-
import { ConfirmationState, ConversationEndEntity, ParticipantType } from "../../common/Constants";
|
|
7
7
|
import { StartChatFailureType } from "./StartChatFailureType";
|
|
8
8
|
export interface ILiveChatWidgetContext {
|
|
9
9
|
domainStates: {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare enum ScenarioType {
|
|
2
|
+
UserSendMessageStrategy = "UserSendMessageStrategy",
|
|
3
|
+
SystemMessageStrategy = "SystemMessageStrategy",
|
|
4
|
+
ReceivedMessageStrategy = "ReceivedMessageStrategy"
|
|
5
|
+
}
|
|
6
|
+
export type MessagePayload = {
|
|
7
|
+
text: string;
|
|
8
|
+
type: string;
|
|
9
|
+
timestamp?: string | undefined;
|
|
10
|
+
userId: string;
|
|
11
|
+
tags: string[];
|
|
12
|
+
messageType: string;
|
|
13
|
+
Id: string | undefined;
|
|
14
|
+
role: string | undefined;
|
|
15
|
+
channelData?: any;
|
|
16
|
+
chatId?: string;
|
|
17
|
+
conversationId?: string;
|
|
18
|
+
isChatComplete: boolean;
|
|
19
|
+
attachment?: any[];
|
|
20
|
+
};
|
|
21
|
+
export type TrackingMessage = {
|
|
22
|
+
Id: string | undefined;
|
|
23
|
+
role: string | undefined;
|
|
24
|
+
timestamp: string | undefined;
|
|
25
|
+
tags: string[];
|
|
26
|
+
messageType: string;
|
|
27
|
+
text: string;
|
|
28
|
+
checkTime?: number;
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createTrackingForFirstMessage: () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MessagePayload } from "./Constants";
|
|
2
|
+
export declare class FirstResponseLatencyTracker {
|
|
3
|
+
private isABotConversation;
|
|
4
|
+
private isStarted;
|
|
5
|
+
private isEnded;
|
|
6
|
+
private startTrackingMessage?;
|
|
7
|
+
private stopTrackingMessage?;
|
|
8
|
+
private isReady;
|
|
9
|
+
constructor();
|
|
10
|
+
private createTrackingMessage;
|
|
11
|
+
private startTracking;
|
|
12
|
+
private handleAgentMessage;
|
|
13
|
+
private stopTracking;
|
|
14
|
+
private isMessageFromValidSender;
|
|
15
|
+
startClock(payload: MessagePayload): void;
|
|
16
|
+
stopClock(payload: MessagePayload): void;
|
|
17
|
+
private offlineNetworkListener;
|
|
18
|
+
private fmltrackingListener;
|
|
19
|
+
private rehydrateListener;
|
|
20
|
+
private historyListener;
|
|
21
|
+
private deregister;
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MessagePayload, ScenarioType, TrackingMessage } from "./Constants";
|
|
2
|
+
import { IActivity } from "botframework-directlinejs";
|
|
3
|
+
export declare const isHistoryMessage: (activity: IActivity, startTime: number) => boolean;
|
|
4
|
+
export declare const buildMessagePayload: (activity: IActivity, userId: string) => MessagePayload;
|
|
5
|
+
export declare const polyfillMessagePayloadForEvent: (activity: IActivity, payload: MessagePayload, conversationId?: string) => MessagePayload;
|
|
6
|
+
export declare const getScenarioType: (activity: IActivity) => ScenarioType;
|
|
7
|
+
export declare const createTrackingMessage: (payload: MessagePayload, type: string) => TrackingMessage;
|