@microsoft/omnichannel-chat-widget 0.1.0-main.edd8c2a → 0.1.0-main.fb426ed
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 +227 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +38 -4
- 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 +42 -3
- package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
- package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +48 -15
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/cjs/common/utils.js +16 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -54
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +11 -8
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +3 -4
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +18 -22
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +103 -50
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +33 -9
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +105 -20
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +26 -24
- package/lib/cjs/components/livechatwidget/common/startChat.js +128 -54
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +120 -33
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +25 -10
- 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/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +10 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +10 -3
- package/lib/cjs/contexts/createReducer.js +28 -10
- package/lib/cjs/controller/componentController.js +2 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +34 -3
- 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 +38 -2
- package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
- package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +50 -15
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/esm/common/utils.js +12 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +1 -1
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -50
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +1 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +12 -9
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +3 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +16 -23
- package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +101 -47
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +29 -9
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +94 -20
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +23 -22
- package/lib/esm/components/livechatwidget/common/startChat.js +123 -51
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +111 -34
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +23 -9
- 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/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +10 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +10 -3
- package/lib/esm/contexts/createReducer.js +28 -9
- package/lib/esm/controller/componentController.js +2 -2
- package/lib/esm/plugins/newMessageEventHandler.js +82 -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 +19 -1
- 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 +27 -1
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- 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 +15 -9
- 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/common/utils.d.ts +1 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -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 +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -2
- 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/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- 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/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -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/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- 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 +11 -8
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +11 -11
- 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
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
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWebChatTelemetry = createWebChatTelemetry;
|
|
7
|
+
|
|
8
|
+
var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
|
|
9
|
+
|
|
10
|
+
var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
|
|
11
|
+
|
|
12
|
+
function createWebChatTelemetry() {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const handleTelemetry = event => {
|
|
15
|
+
const {
|
|
16
|
+
level
|
|
17
|
+
} = event;
|
|
18
|
+
const loglevel = level ? level.toUpperCase() : "";
|
|
19
|
+
|
|
20
|
+
switch (loglevel) {
|
|
21
|
+
case _TelemetryConstants.LogLevel.DEBUG:
|
|
22
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.DEBUG, event);
|
|
23
|
+
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case _TelemetryConstants.LogLevel.WARN:
|
|
27
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.WARN, event);
|
|
28
|
+
|
|
29
|
+
break;
|
|
30
|
+
|
|
31
|
+
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.ERROR, event);
|
|
33
|
+
|
|
34
|
+
break;
|
|
35
|
+
|
|
36
|
+
case _TelemetryConstants.LogLevel.INFO:
|
|
37
|
+
default:
|
|
38
|
+
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.INFO, event);
|
|
39
|
+
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return handleTelemetry;
|
|
45
|
+
}
|
|
@@ -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 = {}));
|
|
@@ -17,13 +17,13 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
17
17
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT";
|
|
18
18
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 7] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
19
19
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 8] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 9] = "SET_CUSTOM_CONTEXT";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 10] = "SET_SHOW_CONFIRMATION";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 11] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 12] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 13] = "SET_AUDIO_NOTIFICATION";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 14] = "SET_E2VV_ENABLED";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 15] = "SET_POST_CHAT_CONTEXT";
|
|
27
27
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 16] = "SHOW_CALLING_CONTAINER";
|
|
28
28
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 17] = "SET_INCOMING_CALL";
|
|
29
29
|
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 18] = "DISABLE_VIDEO_CALL";
|
|
@@ -36,4 +36,7 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
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
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";
|
|
39
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,9 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
22
26
|
chatToken: undefined,
|
|
23
27
|
postChatContext: undefined,
|
|
24
28
|
telemetryInternalData: {},
|
|
25
|
-
globalDir: "ltr"
|
|
29
|
+
globalDir: "ltr",
|
|
30
|
+
liveChatContext: undefined,
|
|
31
|
+
customContext: undefined
|
|
26
32
|
},
|
|
27
33
|
appStates: {
|
|
28
34
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
@@ -41,7 +47,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
41
47
|
proactiveChatInNewWindow: false
|
|
42
48
|
},
|
|
43
49
|
e2vvEnabled: false,
|
|
44
|
-
unreadMessageCount: 0
|
|
50
|
+
unreadMessageCount: 0,
|
|
51
|
+
conversationEndedByAgent: false
|
|
45
52
|
},
|
|
46
53
|
uiStates: {
|
|
47
54
|
showConfirmationPane: false,
|
|
@@ -54,7 +61,7 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
54
61
|
focusChatButton: false
|
|
55
62
|
}
|
|
56
63
|
};
|
|
57
|
-
return
|
|
64
|
+
return LiveChatWidgetContextInitialState;
|
|
58
65
|
};
|
|
59
66
|
|
|
60
67
|
exports.getLiveChatWidgetContextInitialState = getLiveChatWidgetContextInitialState;
|
|
@@ -7,8 +7,6 @@ exports.createReducer = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _LiveChatWidgetActionType = require("./common/LiveChatWidgetActionType");
|
|
9
9
|
|
|
10
|
-
var _TelemetryManager = require("../common/telemetry/TelemetryManager");
|
|
11
|
-
|
|
12
10
|
/* eslint-disable indent */
|
|
13
11
|
const createReducer = () => {
|
|
14
12
|
const reducer = (state, action) => {
|
|
@@ -71,6 +69,14 @@ const createReducer = () => {
|
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
71
|
|
|
72
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT:
|
|
73
|
+
return { ...state,
|
|
74
|
+
domainStates: { ...state.domainStates,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
customContext: action.payload
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
74
80
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT:
|
|
75
81
|
return { ...state,
|
|
76
82
|
appStates: { ...state.appStates,
|
|
@@ -93,13 +99,6 @@ const createReducer = () => {
|
|
|
93
99
|
}
|
|
94
100
|
};
|
|
95
101
|
|
|
96
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT:
|
|
97
|
-
return { ...state,
|
|
98
|
-
appStates: { ...state.appStates,
|
|
99
|
-
shouldShowPostChat: action.payload
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
102
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SHOW_CALLING_CONTAINER:
|
|
104
103
|
return { ...state,
|
|
105
104
|
uiStates: { ...state.uiStates,
|
|
@@ -145,6 +144,7 @@ const createReducer = () => {
|
|
|
145
144
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN:
|
|
146
145
|
return { ...state,
|
|
147
146
|
domainStates: { ...state.domainStates,
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
148
|
chatToken: action.payload
|
|
149
149
|
}
|
|
150
150
|
};
|
|
@@ -196,7 +196,6 @@ const createReducer = () => {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_TELEMETRY_DATA:
|
|
199
|
-
_TelemetryManager.TelemetryManager.InternalTelemetryData = action.payload;
|
|
200
199
|
return { ...state,
|
|
201
200
|
domainStates: { ...state.domainStates,
|
|
202
201
|
telemetryInternalData: action.payload
|
|
@@ -217,6 +216,25 @@ const createReducer = () => {
|
|
|
217
216
|
}
|
|
218
217
|
};
|
|
219
218
|
|
|
219
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT:
|
|
220
|
+
return { ...state,
|
|
221
|
+
domainStates: { ...state.domainStates,
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
223
|
+
liveChatContext: action.payload
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_STATE:
|
|
228
|
+
return { ...action.payload
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT:
|
|
232
|
+
return { ...state,
|
|
233
|
+
appStates: { ...state.appStates,
|
|
234
|
+
conversationEndedByAgent: action.payload
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
220
238
|
default:
|
|
221
239
|
return state;
|
|
222
240
|
}
|
|
@@ -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,99 @@
|
|
|
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
|
+
const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
17
|
+
const onNewAdapterActivityHandler = activity => {
|
|
18
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3;
|
|
19
|
+
|
|
20
|
+
const isActivityMessage = (activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message;
|
|
21
|
+
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);
|
|
22
|
+
|
|
23
|
+
if (isNotHistoryMessage) {
|
|
24
|
+
raiseMessageEvent(activity);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const raiseMessageEvent = activity => {
|
|
29
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === _Constants.Constants.message) {
|
|
30
|
+
var _text, _text2, _activity$channelData4, _activity$from;
|
|
31
|
+
|
|
32
|
+
const payload = {
|
|
33
|
+
// To identify hidden contents vs empty content
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
text: (activity === null || activity === void 0 ? void 0 : (_text = activity.text) === null || _text === void 0 ? void 0 : _text.length) >= 1 ? `*contents hidden (${activity === null || activity === void 0 ? void 0 : (_text2 = activity.text) === null || _text2 === void 0 ? void 0 : _text2.length} chars)*` : "",
|
|
36
|
+
type: activity === null || activity === void 0 ? void 0 : activity.type,
|
|
37
|
+
timestamp: activity === null || activity === void 0 ? void 0 : activity.timestamp,
|
|
38
|
+
userId: userId,
|
|
39
|
+
tags: activity === null || activity === void 0 ? void 0 : (_activity$channelData4 = activity.channelData) === null || _activity$channelData4 === void 0 ? void 0 : _activity$channelData4.tags,
|
|
40
|
+
messageType: ""
|
|
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.Constants.userMessageTag) {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
payload.messageType = _Constants.Constants.userMessageTag;
|
|
46
|
+
const newMessageSentEvent = {
|
|
47
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageSent,
|
|
48
|
+
payload: payload
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageSentEvent);
|
|
52
|
+
|
|
53
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
54
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageSent,
|
|
55
|
+
Description: "New message sent"
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
var _activity$channelData5, _activity$channelData6;
|
|
59
|
+
|
|
60
|
+
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.Constants.systemMessageTag)) {
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
payload.messageType = _Constants.Constants.systemMessageTag;
|
|
63
|
+
} else {
|
|
64
|
+
var _activity$channelData7, _activity$channelData8, _activity$channelData9;
|
|
65
|
+
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
67
|
+
const messageHasNoText = !(activity !== null && activity !== void 0 && activity.text); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
+
|
|
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; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
|
|
71
|
+
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
72
|
+
|
|
73
|
+
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
payload.messageType = _Constants.Constants.userMessageTag;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const newMessageReceivedEvent = {
|
|
81
|
+
eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
|
|
82
|
+
payload: payload
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
_omnichannelChatComponents.BroadcastService.postMessage(newMessageReceivedEvent);
|
|
86
|
+
|
|
87
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
88
|
+
Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
|
|
89
|
+
Description: "New message received",
|
|
90
|
+
Data: payload
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return onNewAdapterActivityHandler;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
exports.createOnNewAdapterActivityHandler = createOnNewAdapterActivityHandler;
|