@microsoft/omnichannel-chat-widget 0.1.0-main.8b6c0d8 → 0.1.0-main.c461296
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/README.md +235 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +6 -0
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
- package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +25 -3
- package/lib/cjs/common/telemetry/TelemetryHelper.js +9 -4
- package/lib/cjs/common/telemetry/TelemetryManager.js +12 -4
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +3 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +8 -1
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +24 -35
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +3 -3
- package/lib/cjs/components/headerstateful/HeaderStateful.js +12 -3
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +38 -33
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +65 -49
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +26 -9
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +18 -3
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
- package/lib/cjs/components/livechatwidget/common/startChat.js +77 -27
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -18
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +28 -11
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +10 -4
- package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +9 -46
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +4 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +11 -4
- package/lib/cjs/contexts/createReducer.js +27 -0
- package/lib/cjs/controller/componentController.js +2 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +102 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +6 -0
- package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
- package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +21 -2
- package/lib/esm/common/telemetry/TelemetryHelper.js +9 -4
- package/lib/esm/common/telemetry/TelemetryManager.js +8 -4
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +14 -1
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +3 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +9 -1
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +22 -34
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +3 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +13 -4
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +36 -33
- package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +64 -45
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +23 -9
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +18 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
- package/lib/esm/components/livechatwidget/common/startChat.js +71 -23
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +40 -17
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +26 -10
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +9 -5
- package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -44
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +4 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +11 -4
- package/lib/esm/contexts/createReducer.js +27 -0
- package/lib/esm/controller/componentController.js +2 -2
- package/lib/esm/plugins/newMessageEventHandler.js +84 -0
- package/lib/types/assets/Audios.d.ts +1 -0
- package/lib/types/assets/Icons.d.ts +11 -0
- package/lib/types/common/Constants.d.ts +3 -0
- package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +17 -1
- package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +3 -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/interfaces/ITelemetryConfig.d.ts +12 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
- package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -1
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +3 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +5 -1
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +7 -6
- package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
- package/lib/cjs/assets/icons/audioIcon.svg +0 -6
- package/lib/cjs/assets/icons/blankIcon.svg +0 -6
- package/lib/cjs/assets/icons/excelIcon.svg +0 -6
- package/lib/cjs/assets/icons/imageIcon.svg +0 -6
- package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
- package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
- package/lib/cjs/assets/icons/videoIcon.svg +0 -6
- package/lib/cjs/assets/icons/visioIcon.svg +0 -6
- package/lib/cjs/assets/icons/wordIcon.svg +0 -6
- package/lib/esm/assets/assets.d.js +0 -0
- package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/esm/assets/icons/archiveIcon.svg +0 -3
- package/lib/esm/assets/icons/audioIcon.svg +0 -6
- package/lib/esm/assets/icons/blankIcon.svg +0 -6
- package/lib/esm/assets/icons/excelIcon.svg +0 -6
- package/lib/esm/assets/icons/imageIcon.svg +0 -6
- package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/esm/assets/icons/pdfIcon.svg +0 -6
- package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
- package/lib/esm/assets/icons/videoIcon.svg +0 -6
- package/lib/esm/assets/icons/visioIcon.svg +0 -6
- package/lib/esm/assets/icons/wordIcon.svg +0 -6
|
@@ -51,7 +51,7 @@ const ProactiveChatPaneStateful = props => {
|
|
|
51
51
|
payload: _ConversationState.ConversationState.Closed
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
_TelemetryHelper.TelemetryHelper.
|
|
54
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
55
55
|
Event: _TelemetryConstants.TelemetryEvent.ProactiveChatRejected,
|
|
56
56
|
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed,
|
|
57
57
|
Description: "Proactive chat invitation timed out."
|
|
@@ -75,14 +75,14 @@ const ProactiveChatPaneStateful = props => {
|
|
|
75
75
|
if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
|
|
76
76
|
// TODO: BroadcastService: replace with the sdk broadcast service, when in place
|
|
77
77
|
const startPopoutChatEvent = {
|
|
78
|
-
eventName:
|
|
78
|
+
eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatStartPopoutChat
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
_omnichannelChatComponents.BroadcastService.postMessage(startPopoutChatEvent);
|
|
82
82
|
|
|
83
83
|
dispatch({
|
|
84
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
85
|
-
payload:
|
|
84
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
85
|
+
payload: _ConversationState.ConversationState.Closed
|
|
86
86
|
});
|
|
87
87
|
} else if (((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True") {
|
|
88
88
|
dispatch({
|
|
@@ -94,6 +94,12 @@ const ProactiveChatPaneStateful = props => {
|
|
|
94
94
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
95
95
|
});
|
|
96
96
|
} else {
|
|
97
|
+
const proactiveChatStarted = {
|
|
98
|
+
eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatStartChat
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_omnichannelChatComponents.BroadcastService.postMessage(proactiveChatStarted);
|
|
102
|
+
|
|
97
103
|
await startChat();
|
|
98
104
|
}
|
|
99
105
|
},
|
package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js
CHANGED
|
@@ -5,85 +5,63 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isInlineMediaSupported = exports.getFileAttachmentIconData = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _Icons = require("../../../../assets/Icons");
|
|
9
9
|
|
|
10
10
|
var _BrowserInfo = require("./BrowserInfo");
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var _audioIcon = _interopRequireDefault(require("../../../../assets/icons/audioIcon.svg"));
|
|
15
|
-
|
|
16
|
-
var _blankIcon = _interopRequireDefault(require("../../../../assets/icons/blankIcon.svg"));
|
|
17
|
-
|
|
18
|
-
var _videoIcon = _interopRequireDefault(require("../../../../assets/icons/videoIcon.svg"));
|
|
19
|
-
|
|
20
|
-
var _imageIcon = _interopRequireDefault(require("../../../../assets/icons/imageIcon.svg"));
|
|
21
|
-
|
|
22
|
-
var _wordIcon = _interopRequireDefault(require("../../../../assets/icons/wordIcon.svg"));
|
|
23
|
-
|
|
24
|
-
var _oneNoteIcon = _interopRequireDefault(require("../../../../assets/icons/oneNoteIcon.svg"));
|
|
25
|
-
|
|
26
|
-
var _powerpointIcon = _interopRequireDefault(require("../../../../assets/icons/powerpointIcon.svg"));
|
|
27
|
-
|
|
28
|
-
var _visioIcon = _interopRequireDefault(require("../../../../assets/icons/visioIcon.svg"));
|
|
29
|
-
|
|
30
|
-
var _pdfIcon = _interopRequireDefault(require("../../../../assets/icons/pdfIcon.svg"));
|
|
31
|
-
|
|
32
|
-
var _excelIcon = _interopRequireDefault(require("../../../../assets/icons/excelIcon.svg"));
|
|
12
|
+
var _BrowserVendor = require("../../webchatcontroller/enums/BrowserVendor");
|
|
33
13
|
|
|
34
14
|
var _Constants = require("../../../../common/Constants");
|
|
35
15
|
|
|
36
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
16
|
const FileAttachmentIconMap = {
|
|
39
|
-
"aac":
|
|
40
|
-
"aiff":
|
|
41
|
-
"alac":
|
|
42
|
-
"avchd":
|
|
43
|
-
"avi":
|
|
44
|
-
"bmp":
|
|
45
|
-
"doc":
|
|
46
|
-
"docx":
|
|
47
|
-
"flac":
|
|
48
|
-
"flv":
|
|
49
|
-
"gif":
|
|
50
|
-
"jiff":
|
|
51
|
-
"jpeg":
|
|
52
|
-
"jpg":
|
|
53
|
-
"mpe":
|
|
54
|
-
"mpeg":
|
|
55
|
-
"mpg":
|
|
56
|
-
"mpv":
|
|
57
|
-
"mp2":
|
|
58
|
-
"mp3":
|
|
59
|
-
"mp4":
|
|
60
|
-
"m4p":
|
|
61
|
-
"m4v":
|
|
62
|
-
"mov":
|
|
63
|
-
"one":
|
|
64
|
-
"pcm":
|
|
65
|
-
"pdf":
|
|
66
|
-
"png":
|
|
67
|
-
"ppt":
|
|
68
|
-
"pptx":
|
|
69
|
-
"qt":
|
|
70
|
-
"rar":
|
|
71
|
-
"swf":
|
|
72
|
-
"tar":
|
|
73
|
-
"tar.gz":
|
|
74
|
-
"tgz":
|
|
75
|
-
"txt":
|
|
76
|
-
"vsd":
|
|
77
|
-
"vsdx":
|
|
78
|
-
"wav":
|
|
79
|
-
"webm":
|
|
80
|
-
"wma":
|
|
81
|
-
"wmv":
|
|
82
|
-
"xls":
|
|
83
|
-
"xlsx":
|
|
84
|
-
"zip":
|
|
85
|
-
"zipx":
|
|
86
|
-
"7z":
|
|
17
|
+
"aac": _Icons.AudioIcon,
|
|
18
|
+
"aiff": _Icons.AudioIcon,
|
|
19
|
+
"alac": _Icons.AudioIcon,
|
|
20
|
+
"avchd": _Icons.VideoIcon,
|
|
21
|
+
"avi": _Icons.VideoIcon,
|
|
22
|
+
"bmp": _Icons.ImageIcon,
|
|
23
|
+
"doc": _Icons.WordIcon,
|
|
24
|
+
"docx": _Icons.WordIcon,
|
|
25
|
+
"flac": _Icons.AudioIcon,
|
|
26
|
+
"flv": _Icons.VideoIcon,
|
|
27
|
+
"gif": _Icons.ImageIcon,
|
|
28
|
+
"jiff": _Icons.ImageIcon,
|
|
29
|
+
"jpeg": _Icons.ImageIcon,
|
|
30
|
+
"jpg": _Icons.ImageIcon,
|
|
31
|
+
"mpe": _Icons.VideoIcon,
|
|
32
|
+
"mpeg": _Icons.VideoIcon,
|
|
33
|
+
"mpg": _Icons.VideoIcon,
|
|
34
|
+
"mpv": _Icons.VideoIcon,
|
|
35
|
+
"mp2": _Icons.AudioIcon,
|
|
36
|
+
"mp3": _Icons.AudioIcon,
|
|
37
|
+
"mp4": _Icons.VideoIcon,
|
|
38
|
+
"m4p": _Icons.VideoIcon,
|
|
39
|
+
"m4v": _Icons.VideoIcon,
|
|
40
|
+
"mov": _Icons.VideoIcon,
|
|
41
|
+
"one": _Icons.OneNoteIcon,
|
|
42
|
+
"pcm": _Icons.AudioIcon,
|
|
43
|
+
"pdf": _Icons.PDFIcon,
|
|
44
|
+
"png": _Icons.ImageIcon,
|
|
45
|
+
"ppt": _Icons.PowerpointIcon,
|
|
46
|
+
"pptx": _Icons.PowerpointIcon,
|
|
47
|
+
"qt": _Icons.VideoIcon,
|
|
48
|
+
"rar": _Icons.ArchiveIcon,
|
|
49
|
+
"swf": _Icons.VideoIcon,
|
|
50
|
+
"tar": _Icons.ArchiveIcon,
|
|
51
|
+
"tar.gz": _Icons.ArchiveIcon,
|
|
52
|
+
"tgz": _Icons.ArchiveIcon,
|
|
53
|
+
"txt": _Icons.BlankIcon,
|
|
54
|
+
"vsd": _Icons.VisioIcon,
|
|
55
|
+
"vsdx": _Icons.VisioIcon,
|
|
56
|
+
"wav": _Icons.AudioIcon,
|
|
57
|
+
"webm": _Icons.VideoIcon,
|
|
58
|
+
"wma": _Icons.AudioIcon,
|
|
59
|
+
"wmv": _Icons.VideoIcon,
|
|
60
|
+
"xls": _Icons.ExcelIcon,
|
|
61
|
+
"xlsx": _Icons.ExcelIcon,
|
|
62
|
+
"zip": _Icons.ArchiveIcon,
|
|
63
|
+
"zipx": _Icons.ArchiveIcon,
|
|
64
|
+
"7z": _Icons.ArchiveIcon
|
|
87
65
|
};
|
|
88
66
|
/**
|
|
89
67
|
* Get file attachment icon image depending on extension.
|
|
@@ -94,7 +72,7 @@ const FileAttachmentIconMap = {
|
|
|
94
72
|
const getFileAttachmentIconData = extension => {
|
|
95
73
|
const key = extension.startsWith(".") ? extension.slice(1) : extension || "";
|
|
96
74
|
|
|
97
|
-
const icon = FileAttachmentIconMap[key.toLowerCase()] ||
|
|
75
|
+
const icon = FileAttachmentIconMap[key.toLowerCase()] || _Icons.BlankIcon;
|
|
98
76
|
|
|
99
77
|
return icon;
|
|
100
78
|
}; // Check if browser supports inline media playing for current media format
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createActivityMiddleware = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
|
|
10
10
|
var _Constants = require("../../../../../common/Constants");
|
|
11
11
|
|
|
@@ -15,16 +15,16 @@ var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
|
15
15
|
|
|
16
16
|
var _MessageType = require("../../enums/MessageType");
|
|
17
17
|
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
20
|
+
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
21
|
+
|
|
18
22
|
var _defaultSystemMessageStyles = require("./defaultStyles/defaultSystemMessageStyles");
|
|
19
23
|
|
|
20
24
|
var _defaultUserMessageStyles = require("./defaultStyles/defaultUserMessageStyles");
|
|
21
25
|
|
|
22
26
|
var _utils = require("../../../../../common/utils");
|
|
23
27
|
|
|
24
|
-
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
25
|
-
|
|
26
|
-
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
27
|
-
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
30
|
/******
|
|
@@ -34,49 +34,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
34
34
|
* 1. Renders system messages differently, according to Microsoft LiveChatWidget styles
|
|
35
35
|
* 2. Changes the font size of user messages
|
|
36
36
|
* 3. Decodes certain html characters that came through from chat services
|
|
37
|
-
* 4. Triggers end conversation sequence when the chat thread is deleted
|
|
38
37
|
******/
|
|
39
38
|
const loggedSystemMessages = new Array(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
39
|
|
|
41
|
-
const handleThreadUpdate = channelData => {
|
|
42
|
-
var _channelData$properti, _channelData$properti2;
|
|
43
|
-
|
|
44
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
45
|
-
Event: _TelemetryConstants.TelemetryEvent.IC3ThreadUpdateEventReceived,
|
|
46
|
-
Description: "IC3 ThreadUpdateEvent Received"
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const postConversationEndedAction = () => {
|
|
50
|
-
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
51
|
-
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
52
|
-
Description: "Conversation is ended by agent side or by timeout."
|
|
53
|
-
});
|
|
54
|
-
}; // If the Thread is deleted, then display post conversation survey if enabled.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const isThreadDeleted = (channelData === null || channelData === void 0 ? void 0 : (_channelData$properti = channelData.properties) === null || _channelData$properti === void 0 ? void 0 : (_channelData$properti2 = _channelData$properti.isdeleted) === null || _channelData$properti2 === void 0 ? void 0 : _channelData$properti2.toLowerCase()) === _Constants.Constants.true;
|
|
58
|
-
|
|
59
|
-
if (isThreadDeleted) {
|
|
60
|
-
postConversationEndedAction();
|
|
61
|
-
return;
|
|
62
|
-
} //check if customer is still in the thread
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (channelData.members && channelData.members.length > 0) {
|
|
66
|
-
for (let i = 0; i < channelData.members.length; i++) {
|
|
67
|
-
const id = channelData.members[i].id;
|
|
68
|
-
const tag = channelData.members[i].tag; // In case of ACS customer is not removed from thread and has "left" tag
|
|
69
|
-
|
|
70
|
-
if (id.startsWith(_Constants.Constants.visitorIdPrefix) && tag !== _Constants.Constants.left) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
postConversationEndedAction();
|
|
77
|
-
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
-
|
|
79
|
-
|
|
80
40
|
const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
|
|
81
41
|
var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
|
|
82
42
|
|
|
@@ -129,7 +89,10 @@ const createActivityMiddleware = (systemMessageStyleProps, userMessageStyleProps
|
|
|
129
89
|
var _card$activity$channe3;
|
|
130
90
|
|
|
131
91
|
if (((_card$activity$channe3 = card.activity.channelData) === null || _card$activity$channe3 === void 0 ? void 0 : _card$activity$channe3.type) === _MessageType.MessageTypes.Thread) {
|
|
132
|
-
|
|
92
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
93
|
+
Event: _TelemetryConstants.TelemetryEvent.IC3ThreadUpdateEventReceived,
|
|
94
|
+
Description: "IC3 ThreadUpdateEvent Received"
|
|
95
|
+
});
|
|
133
96
|
}
|
|
134
97
|
|
|
135
98
|
return () => false;
|
|
@@ -11,6 +11,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
11
11
|
|
|
12
12
|
var _FileAttachmentIconManager = require("../../../common/utils/FileAttachmentIconManager");
|
|
13
13
|
|
|
14
|
+
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
15
|
+
|
|
14
16
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
15
17
|
|
|
16
18
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
@@ -211,7 +213,7 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
211
213
|
const errorData = "Unable to parse the adaptive card format";
|
|
212
214
|
|
|
213
215
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
214
|
-
eventName:
|
|
216
|
+
eventName: _TelemetryConstants.BroadcastEvent.InvalidAdaptiveCardFormat,
|
|
215
217
|
payload: {
|
|
216
218
|
Message: errorData,
|
|
217
219
|
ExceptionDetails: e
|
|
@@ -28,22 +28,22 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
|
28
28
|
var _action$payload;
|
|
29
29
|
|
|
30
30
|
if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
31
|
-
var _activity$from, _activity$from2, _activity$
|
|
31
|
+
var _activity$from, _activity$from2, _activity$channelData7, _activity$channelData8;
|
|
32
32
|
|
|
33
33
|
const activity = action.payload.activity;
|
|
34
34
|
|
|
35
35
|
if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _DirectLineSenderRole.DirectLineSenderRole.Bot && activity.channelId === "ACS_CHANNEL") {
|
|
36
|
-
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4;
|
|
36
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
|
|
37
37
|
|
|
38
38
|
// ACS
|
|
39
|
-
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag)) {
|
|
39
|
+
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.supervisorForceCloseMessageTag))) {
|
|
40
40
|
conversationEndCallback();
|
|
41
41
|
}
|
|
42
|
-
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$
|
|
43
|
-
var _activity$
|
|
42
|
+
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === _MessageType.MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
|
|
43
|
+
var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
|
|
44
44
|
|
|
45
45
|
// IC3
|
|
46
|
-
if (((_activity$
|
|
46
|
+
if (((_activity$channelData9 = activity.channelData) === null || _activity$channelData9 === void 0 ? void 0 : (_activity$channelData10 = _activity$channelData9.properties) === null || _activity$channelData10 === void 0 ? void 0 : _activity$channelData10.isdeleted) === _Constants.Constants.truePascal || !((_activity$channelData11 = activity.channelData) !== null && _activity$channelData11 !== void 0 && (_activity$channelData12 = _activity$channelData11.properties) !== null && _activity$channelData12 !== void 0 && _activity$channelData12.containsExternalEntitiesListeningAll)) {
|
|
47
47
|
conversationEndCallback();
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -14,6 +14,7 @@ exports.ConversationState = ConversationState;
|
|
|
14
14
|
ConversationState[ConversationState["OutOfOffice"] = 3] = "OutOfOffice";
|
|
15
15
|
ConversationState[ConversationState["ProactiveChat"] = 4] = "ProactiveChat";
|
|
16
16
|
ConversationState[ConversationState["Active"] = 5] = "Active";
|
|
17
|
-
ConversationState[ConversationState["
|
|
18
|
-
ConversationState[ConversationState["
|
|
17
|
+
ConversationState[ConversationState["InActive"] = 6] = "InActive";
|
|
18
|
+
ConversationState[ConversationState["Postchat"] = 7] = "Postchat";
|
|
19
|
+
ConversationState[ConversationState["Closed"] = 8] = "Closed";
|
|
19
20
|
})(ConversationState || (exports.ConversationState = ConversationState = {}));
|
|
@@ -35,4 +35,8 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
35
35
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 24] = "SET_TELEMETRY_DATA";
|
|
36
36
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 25] = "SET_RECONNECT_ID";
|
|
37
37
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 26] = "SET_UNREAD_MESSAGE_COUNT";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 27] = "SET_FOCUS_CHAT_BUTTON";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
|
|
38
42
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -12,6 +12,10 @@ var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontaine
|
|
|
12
12
|
const getLiveChatWidgetContextInitialState = props => {
|
|
13
13
|
var _props$webChatContain;
|
|
14
14
|
|
|
15
|
+
if (props !== null && props !== void 0 && props.liveChatContextFromCache) {
|
|
16
|
+
return props === null || props === void 0 ? void 0 : props.liveChatContextFromCache;
|
|
17
|
+
}
|
|
18
|
+
|
|
15
19
|
const LiveChatWidgetContextInitialState = {
|
|
16
20
|
domainStates: {
|
|
17
21
|
liveChatConfig: props.chatConfig,
|
|
@@ -22,7 +26,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
22
26
|
chatToken: undefined,
|
|
23
27
|
postChatContext: undefined,
|
|
24
28
|
telemetryInternalData: {},
|
|
25
|
-
globalDir: "ltr"
|
|
29
|
+
globalDir: "ltr",
|
|
30
|
+
liveChatContext: undefined
|
|
26
31
|
},
|
|
27
32
|
appStates: {
|
|
28
33
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
@@ -41,7 +46,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
41
46
|
proactiveChatInNewWindow: false
|
|
42
47
|
},
|
|
43
48
|
e2vvEnabled: false,
|
|
44
|
-
unreadMessageCount: 0
|
|
49
|
+
unreadMessageCount: 0,
|
|
50
|
+
conversationEndedByAgent: false
|
|
45
51
|
},
|
|
46
52
|
uiStates: {
|
|
47
53
|
showConfirmationPane: false,
|
|
@@ -50,10 +56,11 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
50
56
|
isIncomingCall: true,
|
|
51
57
|
disableVideoCall: true,
|
|
52
58
|
disableRemoteVideo: true,
|
|
53
|
-
disableSelfVideo: true
|
|
59
|
+
disableSelfVideo: true,
|
|
60
|
+
focusChatButton: false
|
|
54
61
|
}
|
|
55
62
|
};
|
|
56
|
-
return
|
|
63
|
+
return LiveChatWidgetContextInitialState;
|
|
57
64
|
};
|
|
58
65
|
|
|
59
66
|
exports.getLiveChatWidgetContextInitialState = getLiveChatWidgetContextInitialState;
|
|
@@ -114,6 +114,13 @@ const createReducer = () => {
|
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_FOCUS_CHAT_BUTTON:
|
|
118
|
+
return { ...state,
|
|
119
|
+
uiStates: { ...state.uiStates,
|
|
120
|
+
focusChatButton: action.payload
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
117
124
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.DISABLE_VIDEO_CALL:
|
|
118
125
|
return { ...state,
|
|
119
126
|
uiStates: { ...state.uiStates,
|
|
@@ -138,6 +145,7 @@ const createReducer = () => {
|
|
|
138
145
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN:
|
|
139
146
|
return { ...state,
|
|
140
147
|
domainStates: { ...state.domainStates,
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
141
149
|
chatToken: action.payload
|
|
142
150
|
}
|
|
143
151
|
};
|
|
@@ -210,6 +218,25 @@ const createReducer = () => {
|
|
|
210
218
|
}
|
|
211
219
|
};
|
|
212
220
|
|
|
221
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
|
|
222
|
+
return { ...state,
|
|
223
|
+
domainStates: { ...state.domainStates,
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
225
|
+
liveChatContext: action.payload
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE:
|
|
230
|
+
return { ...action.payload
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
|
|
234
|
+
return { ...state,
|
|
235
|
+
appStates: { ...state.appStates,
|
|
236
|
+
conversationEndedByAgent: action.payload
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
|
|
213
240
|
default:
|
|
214
241
|
return state;
|
|
215
242
|
}
|
|
@@ -26,7 +26,7 @@ const shouldShowHeader = state => {
|
|
|
26
26
|
exports.shouldShowHeader = shouldShowHeader;
|
|
27
27
|
|
|
28
28
|
const shouldShowFooter = state => {
|
|
29
|
-
return !state.appStates.isMinimized && state.appStates.conversationState === _ConversationState.ConversationState.Active;
|
|
29
|
+
return !state.appStates.isMinimized && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
exports.shouldShowFooter = shouldShowFooter;
|
|
@@ -38,7 +38,7 @@ const shouldShowEmailTranscriptPane = state => {
|
|
|
38
38
|
exports.shouldShowEmailTranscriptPane = shouldShowEmailTranscriptPane;
|
|
39
39
|
|
|
40
40
|
const shouldShowWebChatContainer = state => {
|
|
41
|
-
return state.appStates.conversationState === _ConversationState.ConversationState.Active;
|
|
41
|
+
return state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.InActive;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
exports.shouldShowWebChatContainer = shouldShowWebChatContainer;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createOnNewAdapterActivityHandler = void 0;
|
|
7
|
+
|
|
8
|
+
var _TelemetryConstants = require("../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
10
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
11
|
+
|
|
12
|
+
var _Constants = require("../common/Constants");
|
|
13
|
+
|
|
14
|
+
var _TelemetryHelper = require("../common/telemetry/TelemetryHelper");
|
|
15
|
+
|
|
16
|
+
var _TelemetryManager = require("../common/telemetry/TelemetryManager");
|
|
17
|
+
|
|
18
|
+
const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
19
|
+
const onNewAdapterActivityHandler = activity => {
|
|
20
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
21
|
+
|
|
22
|
+
const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message;
|
|
23
|
+
const isNotHistoryMessage = isActivityMessage && !(activity !== null && activity !== void 0 && (_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.historyMessageTag)) && !(activity !== null && activity !== void 0 && (_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && _activity$channelData3.fromList);
|
|
24
|
+
|
|
25
|
+
if (isNotHistoryMessage) {
|
|
26
|
+
raiseMessageEvent(activity);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const raiseMessageEvent = activity => {
|
|
31
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
|
|
32
|
+
var _TelemetryManager$Int, _activity$from;
|
|
33
|
+
|
|
34
|
+
const payload = {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
text: activity === null || activity === void 0 ? void 0 : activity.text,
|
|
37
|
+
id: activity === null || activity === void 0 ? void 0 : activity.id,
|
|
38
|
+
type: activity === null || activity === void 0 ? void 0 : activity.type,
|
|
39
|
+
timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
|
|
40
|
+
chatId: chatId,
|
|
41
|
+
userId: userId,
|
|
42
|
+
conversationId: ((_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId) ?? "",
|
|
43
|
+
channelData: activity === null || activity === void 0 ? void 0 : activity.channelData,
|
|
44
|
+
messageType: ""
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if ((activity === null || activity === void 0 ? void 0 : (_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _Constants.Constants.userMessageTag) {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
payload.messageType = _Constants.Constants.userMessageTag;
|
|
50
|
+
const newMessageSentEvent = {
|
|
51
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageSent,
|
|
52
|
+
payload: payload
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageSentEvent);
|
|
56
|
+
|
|
57
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
58
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageSent,
|
|
59
|
+
Description: "New message sent"
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
var _activity$channelData4, _activity$channelData5;
|
|
63
|
+
|
|
64
|
+
if (activity !== null && activity !== void 0 && (_activity$channelData4 = activity.channelData) !== null && _activity$channelData4 !== void 0 && (_activity$channelData5 = _activity$channelData4.tags) !== null && _activity$channelData5 !== void 0 && _activity$channelData5.includes(_Constants.Constants.systemMessageTag)) {
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
|
+
payload.messageType = _Constants.Constants.systemMessageTag;
|
|
67
|
+
} else {
|
|
68
|
+
var _activity$channelData6, _activity$channelData7, _activity$channelData8;
|
|
69
|
+
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
+
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
+
|
|
73
|
+
const messageHasNoTags = !(activity !== null && activity !== void 0 && activity.channelData) || !(activity !== null && activity !== void 0 && (_activity$channelData6 = activity.channelData) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.tags) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : (_activity$channelData8 = _activity$channelData7.tags) === null || _activity$channelData8 === void 0 ? void 0 : _activity$channelData8.length) === 0; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
74
|
+
|
|
75
|
+
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
76
|
+
|
|
77
|
+
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
payload.messageType = _Constants.Constants.userMessageTag;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const newMessageReceivedEvent = {
|
|
85
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
|
|
86
|
+
payload: payload
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
|
|
90
|
+
|
|
91
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
92
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
|
|
93
|
+
Description: "New message received"
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return onNewAdapterActivityHandler;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
exports.createOnNewAdapterActivityHandler = createOnNewAdapterActivityHandler;
|