@microsoft/omnichannel-chat-widget 1.7.5-main.290ba08 → 1.7.6-main.aac589b
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/telemetry/TelemetryConstants.js +32 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +10 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +15 -1
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +14 -2
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +12 -0
- package/lib/cjs/components/footerstateful/FooterStateful.js +15 -0
- package/lib/cjs/components/headerstateful/HeaderStateful.js +16 -2
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -3
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +20 -2
- package/lib/cjs/components/notificationpanestateful/NotificationPaneStateful.js +21 -7
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +12 -1
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +14 -3
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -0
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +12 -0
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +12 -1
- package/lib/cjs/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +19 -8
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +14 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +7 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +4 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +7 -4
- package/lib/cjs/plugins/createChatTranscript.js +15 -6
- package/lib/esm/common/telemetry/TelemetryConstants.js +32 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +10 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +15 -1
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +14 -3
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +13 -1
- package/lib/esm/components/footerstateful/FooterStateful.js +14 -0
- package/lib/esm/components/headerstateful/HeaderStateful.js +16 -2
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -3
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +19 -2
- package/lib/esm/components/notificationpanestateful/NotificationPaneStateful.js +21 -7
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +12 -1
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +14 -3
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -1
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +11 -0
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +12 -1
- package/lib/esm/components/startchaterrorpanestateful/StartChatErrorPaneStateful.js +19 -8
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +14 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +7 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +4 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +7 -4
- package/lib/esm/plugins/createChatTranscript.js +15 -6
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +33 -1
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -1
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +1 -1
- package/lib/types/common/telemetry/definitions/Payload.d.ts +14 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/createAdapter.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +2 -2
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -2
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
- package/lib/types/hooks/useChatSDKStore.d.ts +1 -1
- package/lib/types/hooks/useDebounce.d.ts +1 -1
- package/package.json +17 -8
|
@@ -54,8 +54,15 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
54
54
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
55
55
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
56
56
|
import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
|
|
57
|
+
let uiTimer;
|
|
57
58
|
export const LiveChatWidgetStateful = props => {
|
|
58
59
|
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain7, _props$webChatContain8, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain9, _props$webChatContain10, _props$webChatContain11, _props$webChatContain12, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
uiTimer = createTimer();
|
|
62
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
63
|
+
Event: TelemetryEvent.UXLivechatwidgetStart
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
59
66
|
const [state, dispatch] = useChatContextStore();
|
|
60
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
68
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -574,6 +581,26 @@ export const LiveChatWidgetStateful = props => {
|
|
|
574
581
|
eventName: BroadcastEvent.NewMessageNotification
|
|
575
582
|
});
|
|
576
583
|
});
|
|
584
|
+
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onAgentEndSession(event => {
|
|
585
|
+
var _inMemoryState$appSta6;
|
|
586
|
+
const inMemoryState = executeReducer(state, {
|
|
587
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
588
|
+
payload: null
|
|
589
|
+
});
|
|
590
|
+
if ("participantsRemoved" in event && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta6 = inMemoryState.appStates) === null || _inMemoryState$appSta6 === void 0 ? void 0 : _inMemoryState$appSta6.conversationState) === ConversationState.Active) {
|
|
591
|
+
setWebChatStyles(styles => {
|
|
592
|
+
return {
|
|
593
|
+
...styles,
|
|
594
|
+
hideSendBox: true
|
|
595
|
+
};
|
|
596
|
+
});
|
|
597
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
598
|
+
Event: TelemetryEvent.ParticipantsRemovedEvent,
|
|
599
|
+
Description: "Participants removed event received."
|
|
600
|
+
});
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
577
604
|
}
|
|
578
605
|
if (state.appStates.conversationState === ConversationState.InActive) {
|
|
579
606
|
var _props$webChatContain2, _props$webChatContain3;
|
|
@@ -703,13 +730,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
703
730
|
|
|
704
731
|
// Handle Chat disconnect cases
|
|
705
732
|
useEffect(() => {
|
|
706
|
-
var _inMemoryState$
|
|
733
|
+
var _inMemoryState$appSta7;
|
|
707
734
|
const inMemoryState = executeReducer(state, {
|
|
708
735
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
709
736
|
payload: null
|
|
710
737
|
});
|
|
711
738
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
712
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
739
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta7 = inMemoryState.appStates) === null || _inMemoryState$appSta7 === void 0 ? void 0 : _inMemoryState$appSta7.chatDisconnectEventReceived;
|
|
713
740
|
if (chatDisconnectState && adapter) {
|
|
714
741
|
try {
|
|
715
742
|
adapter.end();
|
|
@@ -731,6 +758,12 @@ export const LiveChatWidgetStateful = props => {
|
|
|
731
758
|
payload: (_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.renderingMiddlewareProps
|
|
732
759
|
});
|
|
733
760
|
}, [(_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.renderingMiddlewareProps]);
|
|
761
|
+
useEffect(() => {
|
|
762
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
763
|
+
Event: TelemetryEvent.UXLivechatwidgetCompleted,
|
|
764
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
765
|
+
});
|
|
766
|
+
}, []);
|
|
734
767
|
const initiateEndChatOnBrowserUnload = () => {
|
|
735
768
|
var _DataStoreManager$cli;
|
|
736
769
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
@@ -775,7 +808,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
775
808
|
const chatWidgetDraggableConfig = {
|
|
776
809
|
elementId: widgetElementId,
|
|
777
810
|
channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
|
|
778
|
-
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled)
|
|
811
|
+
disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) !== true // Draggable by default, unless explicitly disabled
|
|
779
812
|
};
|
|
780
813
|
|
|
781
814
|
// Disable receiving IDraggableEvent in current window
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
3
4
|
import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
4
5
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
5
6
|
import { defaultGeneralLoadingPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps";
|
|
6
|
-
import {
|
|
7
|
+
import { errorUILoadingPaneStyleProps } from "./common/errorUIStyleProps/errorUILoadingPaneStyleProps";
|
|
7
8
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
9
|
import useWindowDimensions from "../../hooks/useWindowDimensions";
|
|
9
|
-
|
|
10
|
+
let uiTimer;
|
|
10
11
|
|
|
11
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
13
|
export const LoadingPaneStateful = props => {
|
|
13
14
|
var _loadingPaneProps$sty, _startChatErrorPanePr, _startChatErrorPanePr2;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
uiTimer = createTimer();
|
|
17
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
18
|
+
Event: TelemetryEvent.UXLoadingPaneStart
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
14
21
|
const [state] = useChatContextStore();
|
|
15
22
|
const {
|
|
16
23
|
loadingPaneProps,
|
|
@@ -53,6 +60,16 @@ export const LoadingPaneStateful = props => {
|
|
|
53
60
|
Event: TelemetryEvent.LoadingPaneLoaded,
|
|
54
61
|
Description: "Loading pane loaded."
|
|
55
62
|
});
|
|
63
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
64
|
+
Event: TelemetryEvent.UXLoadingPaneCompleted,
|
|
65
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
66
|
+
});
|
|
67
|
+
return () => {
|
|
68
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
69
|
+
Event: TelemetryEvent.LoadingPaneUnloaded,
|
|
70
|
+
Description: "Loading pane unmount."
|
|
71
|
+
});
|
|
72
|
+
};
|
|
56
73
|
}, []);
|
|
57
74
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
58
75
|
componentOverrides: loadingPaneProps === null || loadingPaneProps === void 0 ? void 0 : loadingPaneProps.componentOverrides,
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
+
import { ConfirmationState, NotificationPaneConstants } from "../../common/Constants";
|
|
2
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
3
|
import React, { useEffect, useRef } from "react";
|
|
4
|
+
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
2
5
|
import { NotificationPane } from "@microsoft/omnichannel-chat-components";
|
|
6
|
+
import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
7
|
+
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
8
|
+
import { createTimer } from "../../common/utils";
|
|
9
|
+
import { defaultChatDisconnectControlProps } from "./defaultProps/defaultChatDisconnectControlProps";
|
|
10
|
+
import { defaultChatDisconnectStyleProps } from "./defaultProps/defaultChatDisconnectStyleProps";
|
|
3
11
|
import { hooks } from "botframework-webchat";
|
|
4
12
|
import { useCallback } from "react";
|
|
5
|
-
import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
6
13
|
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
7
14
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
-
|
|
9
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
10
|
-
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
11
|
-
import { ConfirmationState, NotificationPaneConstants } from "../../common/Constants";
|
|
12
|
-
import { defaultChatDisconnectStyleProps } from "./defaultProps/defaultChatDisconnectStyleProps";
|
|
13
|
-
import { defaultChatDisconnectControlProps } from "./defaultProps/defaultChatDisconnectControlProps";
|
|
15
|
+
let uiTimer;
|
|
14
16
|
export const NotificationPaneStateful = props => {
|
|
15
17
|
var _state$domainStates, _state$domainStates3;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
uiTimer = createTimer();
|
|
20
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
21
|
+
Event: TelemetryEvent.UXNotificationPaneStart
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
16
24
|
const {
|
|
17
25
|
notificationPaneProps,
|
|
18
26
|
notificationScenarioType,
|
|
@@ -162,6 +170,12 @@ export const NotificationPaneStateful = props => {
|
|
|
162
170
|
// TODO additional scenarios to be added...
|
|
163
171
|
}
|
|
164
172
|
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
175
|
+
Event: TelemetryEvent.UXNotificationPaneCompleted,
|
|
176
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
177
|
+
});
|
|
178
|
+
}, []);
|
|
165
179
|
return /*#__PURE__*/React.createElement(NotificationPane, genericPropsObj);
|
|
166
180
|
};
|
|
167
181
|
export default NotificationPaneStateful;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
3
4
|
import { OutOfOfficeHoursPane } from "@microsoft/omnichannel-chat-components";
|
|
4
5
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
5
6
|
import { defaultGeneralStyleProps } from "./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps";
|
|
6
|
-
import { findAllFocusableElement } from "../../common/utils";
|
|
7
7
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
8
|
+
let uiTimer;
|
|
8
9
|
export const OutOfOfficeHoursPaneStateful = props => {
|
|
9
10
|
var _props$styleProps;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
uiTimer = createTimer();
|
|
13
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
14
|
+
Event: TelemetryEvent.UXOOHPaneStart
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
10
17
|
const [state] = useChatContextStore();
|
|
11
18
|
const generalStyleProps = Object.assign({}, defaultGeneralStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps);
|
|
12
19
|
const styleProps = {
|
|
@@ -28,6 +35,10 @@ export const OutOfOfficeHoursPaneStateful = props => {
|
|
|
28
35
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
29
36
|
Event: TelemetryEvent.OutOfOfficePaneLoaded
|
|
30
37
|
});
|
|
38
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
39
|
+
Event: TelemetryEvent.UXOOHPaneCompleted,
|
|
40
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
41
|
+
});
|
|
31
42
|
}, []);
|
|
32
43
|
return /*#__PURE__*/React.createElement(OutOfOfficeHoursPane, {
|
|
33
44
|
componentOverrides: props.componentOverrides,
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
2
4
|
import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
5
|
+
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
3
6
|
import { defaultGeneralPostChatLoadingPaneStyleProps } from "./common/defaultgeneralPostChatLoadingPaneStyleProps";
|
|
4
|
-
import { findAllFocusableElement } from "../../common/utils";
|
|
5
7
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
6
|
-
|
|
7
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
8
|
+
let uiTimer;
|
|
8
9
|
export const PostChatLoadingPaneStateful = props => {
|
|
9
10
|
var _props$styleProps;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
uiTimer = createTimer();
|
|
13
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
14
|
+
Event: TelemetryEvent.UXPostChatLoadingPaneStart
|
|
15
|
+
});
|
|
16
|
+
}, []);
|
|
10
17
|
const [state] = useChatContextStore();
|
|
11
18
|
const generalStyleProps = Object.assign({}, defaultGeneralPostChatLoadingPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps);
|
|
12
19
|
const styleProps = {
|
|
@@ -33,6 +40,10 @@ export const PostChatLoadingPaneStateful = props => {
|
|
|
33
40
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
34
41
|
Event: TelemetryEvent.PostChatSurveyLoadingPaneLoaded
|
|
35
42
|
});
|
|
43
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
44
|
+
Event: TelemetryEvent.UXPostChatLoadingPaneCompleted,
|
|
45
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
46
|
+
});
|
|
36
47
|
}, []);
|
|
37
48
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
38
49
|
componentOverrides: props.componentOverrides,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import { extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
4
|
+
import { createTimer, extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
5
5
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
6
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
7
7
|
import MarkdownIt from "markdown-it";
|
|
@@ -10,10 +10,18 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
|
10
10
|
import { defaultGeneralPreChatSurveyPaneStyleProps } from "./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps";
|
|
11
11
|
import { defaultPreChatSurveyLocalizedTexts } from "./common/defaultProps/defaultPreChatSurveyLocalizedTexts";
|
|
12
12
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
13
|
+
let uiTimer;
|
|
13
14
|
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
16
|
export const PreChatSurveyPaneStateful = props => {
|
|
16
17
|
var _surveyProps$stylePro, _props$surveyProps, _props$surveyProps$co;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
uiTimer = createTimer();
|
|
20
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
21
|
+
Event: TelemetryEvent.UXPrechatPaneStart
|
|
22
|
+
});
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
17
25
|
// Set MarkDown global variable to be used for prechat adaptive cards
|
|
18
26
|
window["markdownit"] = MarkdownIt;
|
|
19
27
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -136,6 +144,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
136
144
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
137
145
|
Event: TelemetryEvent.PrechatSurveyLoaded
|
|
138
146
|
});
|
|
147
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
148
|
+
Event: TelemetryEvent.UXPrechatPaneCompleted,
|
|
149
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
150
|
+
});
|
|
139
151
|
}, []);
|
|
140
152
|
return /*#__PURE__*/React.createElement(PreChatSurveyPane, {
|
|
141
153
|
controlProps: controlProps,
|
|
@@ -9,10 +9,17 @@ import { ProactiveChatPane } from "@microsoft/omnichannel-chat-components";
|
|
|
9
9
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
10
10
|
import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
|
+
let uiTimer;
|
|
12
13
|
|
|
13
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
15
|
export const ProactiveChatPaneStateful = props => {
|
|
15
16
|
var _proactiveChatProps$c;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
uiTimer = createTimer();
|
|
19
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
20
|
+
Event: TelemetryEvent.UXProactiveChatPaneStart
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
16
23
|
const [state, dispatch] = useChatContextStore();
|
|
17
24
|
const {
|
|
18
25
|
proactiveChatProps,
|
|
@@ -114,6 +121,10 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
114
121
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
115
122
|
Event: TelemetryEvent.ProactiveChatPaneLoaded
|
|
116
123
|
});
|
|
124
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
125
|
+
Event: TelemetryEvent.UXProactiveChatCompleted,
|
|
126
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
127
|
+
});
|
|
117
128
|
return () => {
|
|
118
129
|
clearTimeout(timeoutEvent);
|
|
119
130
|
};
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { createTimer, setFocusOnElement } from "../../common/utils";
|
|
3
4
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
4
5
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
5
6
|
import { ReconnectChatPane } from "@microsoft/omnichannel-chat-components";
|
|
6
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
7
|
-
import { setFocusOnElement } from "../../common/utils";
|
|
8
8
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
9
9
|
import useFacadeChatSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
10
|
+
let uiTimer;
|
|
10
11
|
export const ReconnectChatPaneStateful = props => {
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
uiTimer = createTimer();
|
|
14
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
15
|
+
Event: TelemetryEvent.UXReconnectChatPaneStart,
|
|
16
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
17
|
+
});
|
|
18
|
+
}, []);
|
|
11
19
|
const [state, dispatch] = useChatContextStore();
|
|
12
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
21
|
//const chatSDK: any = useChatSDKStore();
|
|
@@ -91,6 +99,9 @@ export const ReconnectChatPaneStateful = props => {
|
|
|
91
99
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
92
100
|
Event: TelemetryEvent.ReconnectChatPaneLoaded
|
|
93
101
|
});
|
|
102
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
103
|
+
Event: TelemetryEvent.UXReconnectChatCompleted
|
|
104
|
+
});
|
|
94
105
|
}, []);
|
|
95
106
|
return /*#__PURE__*/React.createElement(ReconnectChatPane, {
|
|
96
107
|
componentOverrides: reconnectChatProps === null || reconnectChatProps === void 0 ? void 0 : reconnectChatProps.componentOverrides,
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
2
|
import React, { useEffect } from "react";
|
|
3
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
2
4
|
import { LoadingPane } from "@microsoft/omnichannel-chat-components";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
+
import { StartChatErrorPaneConstants } from "../../common/Constants";
|
|
6
|
+
import { StartChatFailureType } from "../../contexts/common/StartChatFailureType";
|
|
5
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
6
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
7
8
|
import { defaultStartChatErrorPaneGeneralStyleProps } from "./common/defaultStartChatErrorPaneGeneralStyleProps";
|
|
8
|
-
import { defaultStartChatErrorPaneTitleStyleProps } from "./common/defaultStartChatErrorPaneTitleStyleProps";
|
|
9
|
-
import { defaultStartChatErrorPaneSubtitleStyleProps } from "./common/defaultStartChatErrorPaneSubtitleStyleProps";
|
|
10
|
-
import { defaultStartChatErrorPaneIconStyleProps } from "./common/defaultStartChatErrorPaneIconStyleProps";
|
|
11
9
|
import { defaultStartChatErrorPaneIconImageStyleProps } from "./common/defaultStartChatErrorPaneIconImageProps";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { defaultStartChatErrorPaneIconStyleProps } from "./common/defaultStartChatErrorPaneIconStyleProps";
|
|
11
|
+
import { defaultStartChatErrorPaneSubtitleStyleProps } from "./common/defaultStartChatErrorPaneSubtitleStyleProps";
|
|
12
|
+
import { defaultStartChatErrorPaneTitleStyleProps } from "./common/defaultStartChatErrorPaneTitleStyleProps";
|
|
13
|
+
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
14
|
+
let uiTimer;
|
|
14
15
|
export const StartChatErrorPaneStateful = startChatErrorPaneProps => {
|
|
15
16
|
var _startChatErrorPanePr, _startChatErrorPanePr2, _startChatErrorPanePr3, _startChatErrorPanePr4, _startChatErrorPanePr5, _startChatErrorPanePr6, _startChatErrorPanePr7, _startChatErrorPanePr8, _startChatErrorPanePr9, _startChatErrorPanePr10, _startChatErrorPanePr11;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
uiTimer = createTimer();
|
|
19
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
20
|
+
Event: TelemetryEvent.UXStartChatErrorPaneStart
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
16
23
|
const [state] = useChatContextStore();
|
|
17
24
|
const generalStyleProps = Object.assign({}, defaultStartChatErrorPaneGeneralStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr === void 0 ? void 0 : _startChatErrorPanePr.generalStyleProps);
|
|
18
25
|
const titleStyleProps = Object.assign({}, defaultStartChatErrorPaneTitleStyleProps, startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : (_startChatErrorPanePr2 = startChatErrorPaneProps.styleProps) === null || _startChatErrorPanePr2 === void 0 ? void 0 : _startChatErrorPanePr2.titleStyleProps);
|
|
@@ -61,6 +68,10 @@ export const StartChatErrorPaneStateful = startChatErrorPaneProps => {
|
|
|
61
68
|
Event: TelemetryEvent.StartChatErrorPaneLoaded,
|
|
62
69
|
Description: "Start chat error pane loaded."
|
|
63
70
|
});
|
|
71
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
72
|
+
Event: TelemetryEvent.UXStartChatErrorCompleted,
|
|
73
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
74
|
+
});
|
|
64
75
|
}, []);
|
|
65
76
|
return /*#__PURE__*/React.createElement(LoadingPane, {
|
|
66
77
|
componentOverrides: startChatErrorPaneProps === null || startChatErrorPaneProps === void 0 ? void 0 : startChatErrorPaneProps.componentOverrides,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Stack } from "@fluentui/react";
|
|
4
4
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
5
5
|
import React, { useEffect } from "react";
|
|
6
|
+
import { createTimer, setFocusOnSendBox } from "../../common/utils";
|
|
6
7
|
import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
|
|
7
8
|
import { Components } from "botframework-webchat";
|
|
8
9
|
import { Constants } from "../../common/Constants";
|
|
@@ -19,8 +20,8 @@ import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/
|
|
|
19
20
|
import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
|
|
20
21
|
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
21
22
|
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
22
|
-
import { setFocusOnSendBox } from "../../common/utils";
|
|
23
23
|
import { useChatContextStore } from "../..";
|
|
24
|
+
let uiTimer;
|
|
24
25
|
const broadcastChannelMessageEvent = "message";
|
|
25
26
|
const postActivity = activity => {
|
|
26
27
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -48,6 +49,12 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
48
49
|
};
|
|
49
50
|
export const WebChatContainerStateful = props => {
|
|
50
51
|
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _props$webChatContain9, _props$webChatContain10;
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
uiTimer = createTimer();
|
|
54
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
55
|
+
Event: TelemetryEvent.UXWebchatContainerCompleted
|
|
56
|
+
});
|
|
57
|
+
}, []);
|
|
51
58
|
const {
|
|
52
59
|
BasicWebChat
|
|
53
60
|
} = Components;
|
|
@@ -143,6 +150,12 @@ export const WebChatContainerStateful = props => {
|
|
|
143
150
|
};
|
|
144
151
|
magicCodeBroadcastChannel.addEventListener(broadcastChannelMessageEvent, eventListener);
|
|
145
152
|
}, []);
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
155
|
+
Event: TelemetryEvent.UXWebchatContainerCompleted,
|
|
156
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
157
|
+
});
|
|
158
|
+
}, []);
|
|
146
159
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
147
160
|
.webchat__stacked-layout__content .ac-pushButton {
|
|
148
161
|
cursor: pointer;
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js
CHANGED
|
@@ -21,4 +21,5 @@ export let WebChatActionType;
|
|
|
21
21
|
WebChatActionType["WEB_CHAT_DISMISS_NOTIFICATION"] = "WEB_CHAT/DISMISS_NOTIFICATION";
|
|
22
22
|
WebChatActionType["WEB_CHAT_SET_SEND_BOX"] = "WEB_CHAT/SET_SEND_BOX";
|
|
23
23
|
WebChatActionType["WEB_CHAT_SEND_FILES"] = "WEB_CHAT/SEND_FILES";
|
|
24
|
+
WebChatActionType["WEB_CHAT_SET_SEND_BOX_ATTACHMENTS"] = "WEB_CHAT/SET_SEND_BOX_ATTACHMENTS";
|
|
24
25
|
})(WebChatActionType || (WebChatActionType = {}));
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
import { Constants, MimeTypes, WebChatMiddlewareConstants } from "../../../../../common/Constants";
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { getFileAttachmentIconData, isInlineMediaSupported } from "../../../common/utils/FileAttachmentIconManager";
|
|
11
|
+
import Attachment from "./attachments/Attachment";
|
|
11
12
|
import { BroadcastEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
12
13
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
14
|
+
import FileScanStatus from "./attachments/FileScanStatus";
|
|
15
|
+
import MaliciousAttachment from "./attachments/MaliciousAttachment";
|
|
16
|
+
import { NotificationHandler } from "../../notification/NotificationHandler";
|
|
17
|
+
import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
18
|
+
import ScanInProgressAttachment from "./attachments/ScanInProgressAttachment";
|
|
13
19
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
14
20
|
import { defaultAttachmentAdaptiveCardStyles } from "./defaultStyles/defaultAtttachmentAdaptiveCardStyles";
|
|
15
21
|
import { defaultAttachmentProps } from "../../../common/defaultProps/defaultAttachmentProps";
|
|
16
|
-
import { useChatContextStore } from "../../../../..";
|
|
17
|
-
import { NotificationHandler } from "../../notification/NotificationHandler";
|
|
18
|
-
import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
19
22
|
import { defaultMiddlewareLocalizedTexts } from "../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
20
|
-
import
|
|
21
|
-
import ScanInProgressAttachment from "./attachments/ScanInProgressAttachment";
|
|
22
|
-
import MaliciousAttachment from "./attachments/MaliciousAttachment";
|
|
23
|
-
import FileScanStatus from "./attachments/FileScanStatus";
|
|
23
|
+
import { useChatContextStore } from "../../../../..";
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Patch card with different attachment data.
|
|
@@ -12,7 +12,7 @@ const createSendFileAction = files => {
|
|
|
12
12
|
payload: {
|
|
13
13
|
files
|
|
14
14
|
},
|
|
15
|
-
type: WebChatActionType.
|
|
15
|
+
type: WebChatActionType.WEB_CHAT_SEND_MESSAGE
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -22,9 +22,9 @@ const attachmentProcessingMiddleware = _ref => {
|
|
|
22
22
|
dispatch
|
|
23
23
|
} = _ref;
|
|
24
24
|
return next => async action => {
|
|
25
|
-
var _action$payload, _action$payload$
|
|
26
|
-
if ((action === null || action === void 0 ? void 0 : action.type) === WebChatActionType.
|
|
27
|
-
const files = action.payload.
|
|
25
|
+
var _action$payload, _action$payload$attac;
|
|
26
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === WebChatActionType.WEB_CHAT_SEND_MESSAGE && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$attac = _action$payload.attachments) === null || _action$payload$attac === void 0 ? void 0 : _action$payload$attac.length) > 0) {
|
|
27
|
+
const files = action.payload.attachments;
|
|
28
28
|
if (files.length === 1) {
|
|
29
29
|
return next(action);
|
|
30
30
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
******/
|
|
6
6
|
|
|
7
7
|
import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
8
|
+
import { AMSConstants } from "../../../../../common/Constants";
|
|
8
9
|
import { NotificationHandler } from "../../notification/NotificationHandler";
|
|
9
10
|
import { NotificationScenarios } from "../../enums/NotificationScenarios";
|
|
10
|
-
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
11
11
|
import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
|
|
12
|
-
import {
|
|
12
|
+
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
13
13
|
const MBtoBRatio = 1000000;
|
|
14
14
|
|
|
15
15
|
/*
|
|
@@ -20,6 +20,9 @@ const validateAttachment = (action, allowedFileExtensions, maxFileSizeSupportedB
|
|
|
20
20
|
var _action$payload, _action$payload$activ, _action$payload2, _action$payload2$acti, _action$payload2$acti2, _action$payload3, _action$payload3$acti, _action$payload3$acti2;
|
|
21
21
|
const attachments = action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.attachments;
|
|
22
22
|
const attachmentSizes = action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : (_action$payload2$acti2 = _action$payload2$acti.channelData) === null || _action$payload2$acti2 === void 0 ? void 0 : _action$payload2$acti2.attachmentSizes;
|
|
23
|
+
if (!attachments || attachments.length === 0) {
|
|
24
|
+
return action;
|
|
25
|
+
}
|
|
23
26
|
if (attachments) {
|
|
24
27
|
for (let i = 0; i < attachments.length; i++) {
|
|
25
28
|
const maxUploadFileSize = getMaxUploadFileSize(maxFileSizeSupportedByDynamics, attachments[i].contentType);
|
|
@@ -190,11 +193,11 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxFil
|
|
|
190
193
|
} = _ref;
|
|
191
194
|
return next => action => {
|
|
192
195
|
if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
|
|
193
|
-
var _payload$activity, _payload$
|
|
196
|
+
var _payload$activity, _payload$activity$att, _payload$activity2, _payload$activity2$ch, _payload$activity2$ch2;
|
|
194
197
|
const {
|
|
195
198
|
payload
|
|
196
199
|
} = action;
|
|
197
|
-
if (payload !== null && payload !== void 0 &&
|
|
200
|
+
if (payload !== null && payload !== void 0 && payload.activity.attachments && payload.activity.attachments.length > 0 && (payload === null || payload === void 0 ? void 0 : (_payload$activity = payload.activity) === null || _payload$activity === void 0 ? void 0 : (_payload$activity$att = _payload$activity.attachments) === null || _payload$activity$att === void 0 ? void 0 : _payload$activity$att.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity2 = payload.activity) === null || _payload$activity2 === void 0 ? void 0 : (_payload$activity2$ch = _payload$activity2.channelData) === null || _payload$activity2$ch === void 0 ? void 0 : (_payload$activity2$ch2 = _payload$activity2$ch.attachmentSizes) === null || _payload$activity2$ch2 === void 0 ? void 0 : _payload$activity2$ch2.length)) {
|
|
198
201
|
return next(validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts));
|
|
199
202
|
}
|
|
200
203
|
}
|
|
@@ -9,7 +9,7 @@ class TranscriptHTMLBuilder {
|
|
|
9
9
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
10
10
|
|
|
11
11
|
constructor(options) {
|
|
12
|
-
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;
|
|
12
|
+
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;
|
|
13
13
|
_defineProperty(this, "options", void 0);
|
|
14
14
|
_defineProperty(this, "pageTitle", "Customer Transcript");
|
|
15
15
|
_defineProperty(this, "attachmentMessage", "The following attachment was uploaded during the conversation: ");
|
|
@@ -20,6 +20,7 @@ class TranscriptHTMLBuilder {
|
|
|
20
20
|
_defineProperty(this, "agentAvatarFontColor", "#000");
|
|
21
21
|
_defineProperty(this, "customerAvatarBackgroundColor", "#2266E3");
|
|
22
22
|
_defineProperty(this, "customerAvatarFontColor", "#FFF");
|
|
23
|
+
_defineProperty(this, "customerDisplayName", "");
|
|
23
24
|
_defineProperty(this, "disableMarkdownMessageFormatting", false);
|
|
24
25
|
_defineProperty(this, "disableNewLineMarkdownSupport", false);
|
|
25
26
|
_defineProperty(this, "externalScripts", {});
|
|
@@ -55,13 +56,16 @@ class TranscriptHTMLBuilder {
|
|
|
55
56
|
if ((_this$options9 = this.options) !== null && _this$options9 !== void 0 && _this$options9.customerAvatarFontColor) {
|
|
56
57
|
this.customerAvatarFontColor = this.options.customerAvatarFontColor;
|
|
57
58
|
}
|
|
58
|
-
if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.
|
|
59
|
+
if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.customerDisplayName) {
|
|
60
|
+
this.customerDisplayName = this.options.customerDisplayName;
|
|
61
|
+
}
|
|
62
|
+
if ((_this$options11 = this.options) !== null && _this$options11 !== void 0 && _this$options11.disableMarkdownMessageFormatting) {
|
|
59
63
|
this.disableMarkdownMessageFormatting = this.options.disableMarkdownMessageFormatting;
|
|
60
64
|
}
|
|
61
|
-
if ((_this$
|
|
65
|
+
if ((_this$options12 = this.options) !== null && _this$options12 !== void 0 && _this$options12.disableNewLineMarkdownSupport) {
|
|
62
66
|
this.disableNewLineMarkdownSupport = this.options.disableNewLineMarkdownSupport;
|
|
63
67
|
}
|
|
64
|
-
if ((_this$
|
|
68
|
+
if ((_this$options13 = this.options) !== null && _this$options13 !== void 0 && _this$options13.externalScripts) {
|
|
65
69
|
this.externalScripts = this.options.externalScripts;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
@@ -523,7 +527,12 @@ class TranscriptHTMLBuilder {
|
|
|
523
527
|
const avatarMiddleware = () => (next) => (...args) => {
|
|
524
528
|
const [card] = args;
|
|
525
529
|
const {fromUser, activity} = card;
|
|
526
|
-
|
|
530
|
+
let displayName = getIconText(activity.from.name);
|
|
531
|
+
let customerDisplayName = '${this.customerDisplayName}';
|
|
532
|
+
|
|
533
|
+
if (fromUser && customerDisplayName) {
|
|
534
|
+
displayName = customerDisplayName;
|
|
535
|
+
}
|
|
527
536
|
|
|
528
537
|
const avatarElement = React.createElement(
|
|
529
538
|
"div",
|
|
@@ -531,7 +540,7 @@ class TranscriptHTMLBuilder {
|
|
|
531
540
|
React.createElement(
|
|
532
541
|
"p",
|
|
533
542
|
null,
|
|
534
|
-
\`\${
|
|
543
|
+
\`\${displayName}\`
|
|
535
544
|
)
|
|
536
545
|
);
|
|
537
546
|
|