@microsoft/omnichannel-chat-widget 1.7.8-main.7a07fc5 → 1.7.8-main.8428c08
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 +66 -20
- package/lib/cjs/common/KeyCodes.js +6 -1
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/cjs/common/facades/FacadeChatSDK.js +392 -295
- package/lib/cjs/common/storage/default/defaultCacheManager.js +6 -3
- package/lib/cjs/common/telemetry/ScenarioMarker.js +66 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +179 -148
- package/lib/cjs/common/telemetry/TelemetryHelper.js +281 -250
- package/lib/cjs/common/telemetry/TelemetryManager.js +31 -11
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +11 -0
- package/lib/cjs/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +119 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +17 -14
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -4
- package/lib/cjs/components/footerstateful/FooterStateful.js +13 -8
- package/lib/cjs/components/headerstateful/HeaderStateful.js +24 -14
- 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/registerTelemetryLoggers.js +3 -1
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +7 -4
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -26
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +7 -6
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -20
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +12 -8
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -10
- package/lib/cjs/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +28 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -7
- 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 +92 -62
- package/lib/cjs/plugins/newMessageEventHandler.js +102 -88
- package/lib/esm/common/Constants.js +64 -19
- package/lib/esm/common/KeyCodes.js +6 -1
- package/lib/esm/common/contextDataStore/DataStoreManager.js +6 -1
- package/lib/esm/common/facades/FacadeChatSDK.js +392 -295
- package/lib/esm/common/storage/default/defaultCacheManager.js +6 -1
- package/lib/esm/common/telemetry/ScenarioMarker.js +59 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +179 -148
- package/lib/esm/common/telemetry/TelemetryHelper.js +281 -250
- package/lib/esm/common/telemetry/TelemetryManager.js +31 -11
- package/lib/esm/common/telemetry/defaultConfigs/defaultAppInsightsConfig.js +4 -0
- package/lib/esm/common/telemetry/interfaces/IAppInsightsConfig.js +1 -0
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +111 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -14
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -4
- package/lib/esm/components/footerstateful/FooterStateful.js +13 -8
- package/lib/esm/components/headerstateful/HeaderStateful.js +24 -14
- 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/registerTelemetryLoggers.js +3 -1
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +7 -4
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +7 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +6 -27
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -6
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -20
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +12 -8
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -10
- package/lib/esm/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +21 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +9 -6
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -7
- 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 +92 -62
- package/lib/esm/plugins/newMessageEventHandler.js +100 -86
- package/lib/types/common/Constants.d.ts +5 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +1 -0
- package/lib/types/common/telemetry/ScenarioMarker.d.ts +19 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +50 -33
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +5 -0
- package/lib/types/common/telemetry/defaultConfigs/defaultAppInsightsConfig.d.ts +2 -0
- package/lib/types/common/telemetry/interfaces/IAppInsightsConfig.d.ts +4 -0
- package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
- package/lib/types/common/telemetry/loggers/appInsightsLogger.d.ts +5 -0
- package/lib/types/components/callingcontainerstateful/CallingContainerStateful.d.ts +2 -1
- package/lib/types/components/chatbuttonstateful/ChatButtonStateful.d.ts +2 -1
- package/lib/types/components/confirmationpanestateful/ConfirmationPaneStateful.d.ts +2 -1
- package/lib/types/components/dimlayer/DimLayer.d.ts +2 -1
- package/lib/types/components/draggable/DraggableChatWidget.d.ts +2 -2
- package/lib/types/components/draggable/DraggableEventEmitter.d.ts +2 -2
- package/lib/types/components/draggable/DraggableEventReceiver.d.ts +2 -2
- package/lib/types/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.d.ts +2 -1
- package/lib/types/components/footerstateful/FooterStateful.d.ts +2 -1
- package/lib/types/components/footerstateful/audionotificationstateful/AudioNotificationStateful.d.ts +2 -1
- package/lib/types/components/headerstateful/HeaderStateful.d.ts +2 -1
- package/lib/types/components/livechatwidget/LiveChatWidget.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/createFooter.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/loadingpanestateful/LoadingPaneStateful.d.ts +2 -1
- package/lib/types/components/notificationpanestateful/NotificationPaneStateful.d.ts +2 -1
- package/lib/types/components/ooohpanestateful/OOOHPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/common/isValidSurveyUrl.d.ts +2 -0
- package/lib/types/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.d.ts +2 -1
- package/lib/types/components/proactivechatpanestateful/ProactiveChatPaneStateful.d.ts +2 -1
- package/lib/types/components/reconnectchatpanestateful/ReconnectChatPaneStateful.d.ts +2 -1
- package/lib/types/components/startchaterrorpanestateful/StartChatErrorPaneStateful.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/WebChatContainerStateful.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +2 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Attachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentContent.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/AttachmentIcon.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/DownloadBlockedAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/MaliciousAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/ScanInProgressAttachment.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachments/Spinner.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.d.ts +2 -1
- 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 +27 -13
|
@@ -8,14 +8,18 @@ var _utils = require("../common/utils");
|
|
|
8
8
|
var _defaultLibraryScripts = _interopRequireDefault(require("../components/footerstateful/downloadtranscriptstateful/common/defaultLibraryScripts"));
|
|
9
9
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
+
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); } }
|
|
13
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
14
|
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; }
|
|
12
15
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
16
|
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); }
|
|
14
|
-
|
|
17
|
+
let TranscriptHTMLBuilder = /*#__PURE__*/function () {
|
|
15
18
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
function TranscriptHTMLBuilder(options) {
|
|
18
21
|
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;
|
|
22
|
+
_classCallCheck(this, TranscriptHTMLBuilder);
|
|
19
23
|
_defineProperty(this, "options", void 0);
|
|
20
24
|
_defineProperty(this, "pageTitle", "Customer Transcript");
|
|
21
25
|
_defineProperty(this, "attachmentMessage", "The following attachment was uploaded during the conversation: ");
|
|
@@ -75,59 +79,79 @@ class TranscriptHTMLBuilder {
|
|
|
75
79
|
this.externalScripts = this.options.externalScripts;
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
_createClass(TranscriptHTMLBuilder, [{
|
|
83
|
+
key: "createMetaElement",
|
|
84
|
+
value: function createMetaElement() {
|
|
85
|
+
const htmlData = `
|
|
80
86
|
<meta charset="UTF-8">
|
|
81
87
|
`;
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
88
|
+
return htmlData;
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "createTitleElement",
|
|
92
|
+
value: function createTitleElement() {
|
|
93
|
+
const htmlData = `<title> ${this.pageTitle} </title>`;
|
|
94
|
+
return htmlData;
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "createScriptElement",
|
|
98
|
+
value: function createScriptElement(src) {
|
|
99
|
+
let integrity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
100
|
+
let crossOrigin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
101
|
+
let referrerPolicy = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
102
|
+
return `<script src="${src}" ${integrity ? `integrity="${integrity}"` : ""} ${crossOrigin ? `crossorigin="${crossOrigin}"` : ""} ${referrerPolicy ? `referrerpolicy="${referrerPolicy}"` : ""}><\/script>`;
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "createWebChatScriptElement",
|
|
106
|
+
value: function createWebChatScriptElement() {
|
|
107
|
+
var _this$externalScripts, _this$externalScripts2, _this$externalScripts3, _this$externalScripts4, _this$externalScripts5, _this$externalScripts6, _this$externalScripts7, _this$externalScripts8, _this$externalScripts9, _this$externalScripts10;
|
|
108
|
+
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.default.botframeworkWebChat.src);
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "createRxJsScriptElement",
|
|
112
|
+
value: function createRxJsScriptElement() {
|
|
113
|
+
var _this$externalScripts11, _this$externalScripts12, _this$externalScripts13, _this$externalScripts14, _this$externalScripts15, _this$externalScripts16, _this$externalScripts17, _this$externalScripts18, _this$externalScripts19, _this$externalScripts20;
|
|
114
|
+
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.default.rxJs.src, _defaultLibraryScripts.default.rxJs.integrity, _defaultLibraryScripts.default.rxJs.crossOrigin, _defaultLibraryScripts.default.rxJs.referrerPolicy);
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "createReactScriptElement",
|
|
118
|
+
value: function createReactScriptElement() {
|
|
119
|
+
var _this$externalScripts21, _this$externalScripts22, _this$externalScripts23, _this$externalScripts24, _this$externalScripts25, _this$externalScripts26, _this$externalScripts27, _this$externalScripts28, _this$externalScripts29, _this$externalScripts30;
|
|
120
|
+
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.default.react.src);
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "createReactDomScriptElement",
|
|
124
|
+
value: function createReactDomScriptElement() {
|
|
125
|
+
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;
|
|
126
|
+
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.default.reactDom.src);
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "createMarkdownItScriptElement",
|
|
130
|
+
value: function createMarkdownItScriptElement() {
|
|
131
|
+
var _this$externalScripts43, _this$externalScripts44, _this$externalScripts45, _this$externalScripts46, _this$externalScripts47, _this$externalScripts48, _this$externalScripts49, _this$externalScripts50, _this$externalScripts51, _this$externalScripts52;
|
|
132
|
+
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.default.markdownIt.src, _defaultLibraryScripts.default.markdownIt.integrity, _defaultLibraryScripts.default.markdownIt.crossOrigin);
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "createExternalScriptElements",
|
|
136
|
+
value: function createExternalScriptElements() {
|
|
137
|
+
const webChatScript = this.createWebChatScriptElement();
|
|
138
|
+
const rxJsScript = this.createRxJsScriptElement();
|
|
139
|
+
const reactScript = this.createReactScriptElement();
|
|
140
|
+
const reactDomScript = this.createReactDomScriptElement();
|
|
141
|
+
const markdownItScript = this.createMarkdownItScriptElement();
|
|
142
|
+
const htmlData = `
|
|
121
143
|
${webChatScript}
|
|
122
144
|
${rxJsScript}
|
|
123
145
|
${reactScript}
|
|
124
146
|
${reactDomScript}
|
|
125
147
|
${markdownItScript}
|
|
126
148
|
`;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
return htmlData;
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "createHeadElement",
|
|
153
|
+
value: function createHeadElement() {
|
|
154
|
+
const htmlData = `
|
|
131
155
|
<head>
|
|
132
156
|
${this.createMetaElement()}
|
|
133
157
|
${this.createTitleElement()}
|
|
@@ -173,7 +197,7 @@ class TranscriptHTMLBuilder {
|
|
|
173
197
|
<script>
|
|
174
198
|
class Translator {
|
|
175
199
|
static convertTranscriptMessageToActivity(message) {
|
|
176
|
-
const {created, OriginalMessageId, id, isControlMessage, content, tags, from, attachments, amsMetadata, amsReferences} = message;
|
|
200
|
+
const {created, OriginalMessageId, id, isControlMessage, content, tags, from, attachments, amsMetadata, amsReferences, amsreferences} = message;
|
|
177
201
|
|
|
178
202
|
//it's required to convert the id to a number, otherwise the webchat will not render the messages in the correct order
|
|
179
203
|
// if the OrginalMessageId is not present, we can use the id as the sequence id, which is always present.
|
|
@@ -220,7 +244,7 @@ class TranscriptHTMLBuilder {
|
|
|
220
244
|
}
|
|
221
245
|
|
|
222
246
|
// Attachments
|
|
223
|
-
if (amsReferences && amsMetadata) {
|
|
247
|
+
if ((amsReferences || amsreferences) && amsMetadata) {
|
|
224
248
|
const metadata = JSON.parse(amsMetadata);
|
|
225
249
|
const { fileName } = metadata[0];
|
|
226
250
|
const text = \`${this.attachmentMessage}\${fileName}\`;
|
|
@@ -244,7 +268,7 @@ class TranscriptHTMLBuilder {
|
|
|
244
268
|
// Message
|
|
245
269
|
if (content) {
|
|
246
270
|
// Adaptive card formatting
|
|
247
|
-
if (content.includes('"
|
|
271
|
+
if (content.includes('"attachments"') || content.includes('"suggestedActions"')) {
|
|
248
272
|
try {
|
|
249
273
|
const partialActivity = JSON.parse(content);
|
|
250
274
|
return {
|
|
@@ -367,10 +391,12 @@ class TranscriptHTMLBuilder {
|
|
|
367
391
|
<\/style>
|
|
368
392
|
</head>
|
|
369
393
|
`;
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
394
|
+
return htmlData;
|
|
395
|
+
}
|
|
396
|
+
}, {
|
|
397
|
+
key: "createBodyElement",
|
|
398
|
+
value: function createBodyElement() {
|
|
399
|
+
const htmlData = `
|
|
374
400
|
<body>
|
|
375
401
|
<script>
|
|
376
402
|
if (!navigator.onLine) {
|
|
@@ -651,18 +677,22 @@ class TranscriptHTMLBuilder {
|
|
|
651
677
|
<\/script>
|
|
652
678
|
</body>
|
|
653
679
|
`;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
680
|
+
return htmlData;
|
|
681
|
+
}
|
|
682
|
+
}, {
|
|
683
|
+
key: "createHTML",
|
|
684
|
+
value: function createHTML() {
|
|
685
|
+
const htmlData = `
|
|
658
686
|
<html>
|
|
659
687
|
${this.createHeadElement()}
|
|
660
688
|
${this.createBodyElement()}
|
|
661
689
|
</html>
|
|
662
690
|
`;
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
691
|
+
return htmlData;
|
|
692
|
+
}
|
|
693
|
+
}]);
|
|
694
|
+
return TranscriptHTMLBuilder;
|
|
695
|
+
}();
|
|
666
696
|
const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
667
697
|
let renderAttachments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
668
698
|
let transcriptOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -683,7 +713,7 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
|
683
713
|
messages = await Promise.all(transcriptMessages.map(async message => {
|
|
684
714
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
685
715
|
const {
|
|
686
|
-
amsReferences,
|
|
716
|
+
amsReferences = message.amsreferences,
|
|
687
717
|
amsMetadata
|
|
688
718
|
} = message;
|
|
689
719
|
if (amsReferences && amsMetadata) {
|
|
@@ -5,102 +5,116 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createOnNewAdapterActivityHandler = void 0;
|
|
7
7
|
var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _Constants = require("../firstresponselatency/Constants");
|
|
9
|
+
var _util = require("../firstresponselatency/util");
|
|
8
10
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
9
|
-
var
|
|
11
|
+
var _Constants2 = require("../common/Constants");
|
|
12
|
+
var _FirstResponseLatencyTracker = require("../firstresponselatency/FirstResponseLatencyTracker");
|
|
10
13
|
var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
|
|
11
14
|
var _TelemetryManager = require("../common/telemetry/TelemetryManager");
|
|
12
15
|
const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
16
|
+
// Hooking the message tracker in the listener, a bit invasive but easier to control.
|
|
17
|
+
const firstResponseLatencyTracker = new _FirstResponseLatencyTracker.FirstResponseLatencyTracker();
|
|
18
|
+
// epoch time in utc for when start to listen.
|
|
19
|
+
// 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.
|
|
20
|
+
// 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
|
|
21
|
+
const startTime = new Date().getTime();
|
|
22
|
+
let isHistoryMessageReceivedEventRaised = false;
|
|
13
23
|
const onNewAdapterActivityHandler = activity => {
|
|
14
|
-
|
|
15
|
-
const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message;
|
|
16
|
-
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.Constants.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
|
|
17
|
-
raiseMessageEvent(activity, isHistoryMessage);
|
|
24
|
+
raiseMessageEvent(activity);
|
|
18
25
|
};
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
const userSendMessageStrategy = activity => {
|
|
27
|
+
var _TelemetryManager$Int;
|
|
28
|
+
const payload = (0, _util.buildMessagePayload)(activity, userId);
|
|
21
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
27
|
-
chatId: activity === null || activity === void 0 ? void 0 : (_activity$conversatio = activity.conversation) === null || _activity$conversatio === void 0 ? void 0 : _activity$conversatio.id,
|
|
28
|
-
conversationId: (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId,
|
|
29
|
-
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
30
|
-
isChatComplete: false,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
text: activity === null || activity === void 0 ? void 0 : activity.text,
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
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 : []
|
|
35
|
-
};
|
|
30
|
+
payload.messageType = _Constants2.Constants.userMessageTag;
|
|
31
|
+
const newMessageSentEvent = {
|
|
32
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageSent,
|
|
33
|
+
payload: (0, _util.polyfillMessagePayloadForEvent)(activity, payload, (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId)
|
|
36
34
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
35
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageSentEvent);
|
|
36
|
+
if (!(0, _util.isHistoryMessage)(activity, startTime)) {
|
|
37
|
+
firstResponseLatencyTracker.startClock(payload);
|
|
38
|
+
}
|
|
39
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
40
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageSentCompleted,
|
|
41
|
+
Description: "New message sent"
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const systemMessageStrategy = activity => {
|
|
45
|
+
const payload = (0, _util.buildMessagePayload)(activity, userId);
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
payload.messageType = _Constants2.Constants.systemMessageTag;
|
|
48
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
49
|
+
Event: _TelemetryConstants.TelemetryEvent.SystemMessageReceivedCompleted,
|
|
50
|
+
Description: "System message received"
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const historyMessageStrategy = payload => {
|
|
54
|
+
const newMessageReceivedEvent = {
|
|
55
|
+
eventName: _TelemetryConstants.BroadcastEvent.HistoryMessageReceived,
|
|
56
|
+
payload: payload
|
|
57
|
+
};
|
|
58
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
|
|
59
|
+
if (!isHistoryMessageReceivedEventRaised) {
|
|
60
|
+
// this is needed for reload scenarios, it helps to identify the last message received before the reload
|
|
61
|
+
isHistoryMessageReceivedEventRaised = true;
|
|
62
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
63
|
+
Event: _TelemetryConstants.TelemetryEvent.RehydrateMessageReceivedCompleted,
|
|
64
|
+
Description: "History message received",
|
|
65
|
+
CustomProperties: payload
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const isValidMessage = activity => {
|
|
70
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
+
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text);
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
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;
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
77
|
+
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
};
|
|
82
|
+
const receivedMessageStrategy = activity => {
|
|
83
|
+
var _TelemetryManager$Int3;
|
|
84
|
+
if (!isValidMessage(activity)) return;
|
|
85
|
+
const isHistoryMessageReceived = (0, _util.isHistoryMessage)(activity, startTime);
|
|
86
|
+
const payload = (0, _util.buildMessagePayload)(activity, userId);
|
|
87
|
+
payload.messageType = _Constants2.Constants.userMessageTag;
|
|
88
|
+
if (isHistoryMessageReceived) {
|
|
89
|
+
var _TelemetryManager$Int2;
|
|
90
|
+
historyMessageStrategy((0, _util.polyfillMessagePayloadForEvent)(activity, payload, (_TelemetryManager$Int2 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.conversationId));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
firstResponseLatencyTracker.stopClock(payload);
|
|
94
|
+
const newMessageReceivedEvent = {
|
|
95
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
|
|
96
|
+
payload: (0, _util.polyfillMessagePayloadForEvent)(activity, payload, (_TelemetryManager$Int3 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : _TelemetryManager$Int3.conversationId)
|
|
97
|
+
};
|
|
98
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
|
|
99
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
100
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageReceivedCompleted,
|
|
101
|
+
Description: "New message received",
|
|
102
|
+
CustomProperties: payload
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
const raiseMessageEvent = activity => {
|
|
106
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants2.Constants.message) {
|
|
107
|
+
const scenarioType = (0, _util.getScenarioType)(activity);
|
|
108
|
+
switch (scenarioType) {
|
|
109
|
+
case _Constants.ScenarioType.UserSendMessageStrategy:
|
|
110
|
+
userSendMessageStrategy(activity);
|
|
111
|
+
break;
|
|
112
|
+
case _Constants.ScenarioType.SystemMessageStrategy:
|
|
113
|
+
systemMessageStrategy(activity);
|
|
114
|
+
break;
|
|
115
|
+
case _Constants.ScenarioType.ReceivedMessageStrategy:
|
|
116
|
+
receivedMessageStrategy(activity);
|
|
117
|
+
break;
|
|
104
118
|
}
|
|
105
119
|
}
|
|
106
120
|
};
|