@microsoft/omnichannel-chat-widget 0.1.0-main.3bd7d37 → 0.1.0-main.3eb9e8c
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 +35 -11
- package/lib/cjs/common/Constants.js +50 -6
- package/lib/cjs/common/telemetry/TelemetryConstants.js +36 -3
- package/lib/cjs/common/telemetry/TelemetryHelper.js +13 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +16 -5
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +33 -13
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +76 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +4 -40
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -2
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +3 -9
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +16 -16
- package/lib/cjs/components/livechatwidget/common/endChat.js +93 -10
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +33 -5
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +107 -22
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +6 -17
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +138 -50
- package/lib/cjs/components/livechatwidget/interfaces/IAuthProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +223 -68
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +25 -48
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
- 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 +9 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/cjs/contexts/createReducer.js +16 -10
- package/lib/cjs/controller/componentController.js +3 -3
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +46 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +36 -3
- package/lib/esm/common/telemetry/TelemetryHelper.js +13 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +14 -5
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +1 -1
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +36 -14
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +55 -1
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +7 -38
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -2
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +3 -9
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +16 -17
- package/lib/esm/components/livechatwidget/common/endChat.js +89 -11
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +1 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +29 -6
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +98 -23
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +5 -14
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +138 -53
- package/lib/esm/components/livechatwidget/interfaces/IAuthProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +213 -72
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +23 -46
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
- 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 +9 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/esm/contexts/createReducer.js +16 -9
- package/lib/esm/controller/componentController.js +3 -3
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +25 -2
- package/lib/types/common/interfaces/IContextDataStore.d.ts +2 -2
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +30 -5
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +3 -1
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +3 -3
- package/lib/types/common/utils.d.ts +6 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +4 -4
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/IAuthProps.d.ts +4 -0
- 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/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- 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 +2 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +10 -8
- package/package.json +6 -7
|
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
34
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
35
|
|
|
36
36
|
const ChatButtonStateful = props => {
|
|
37
|
-
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
|
|
37
|
+
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
38
38
|
|
|
39
39
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
40
40
|
const {
|
|
@@ -44,20 +44,27 @@ const ChatButtonStateful = props => {
|
|
|
44
44
|
} = props; //Setting OutOfOperatingHours Flag
|
|
45
45
|
|
|
46
46
|
const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_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");
|
|
47
|
+
const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
47
48
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
48
49
|
const controlProps = {
|
|
49
50
|
id: "oc-lcw-chat-button",
|
|
50
51
|
dir: state.domainStates.globalDir,
|
|
51
52
|
titleText: "Let's Chat!",
|
|
52
53
|
subtitleText: "We're online.",
|
|
53
|
-
hideNotificationBubble:
|
|
54
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ?
|
|
54
|
+
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
55
|
+
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
55
56
|
onClick: async () => {
|
|
56
57
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
57
58
|
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
58
59
|
});
|
|
59
60
|
|
|
60
|
-
if (
|
|
61
|
+
if (proactiveChatInNewWindow.current) {
|
|
62
|
+
const proactiveChatIsInPopoutModeEvent = {
|
|
63
|
+
eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
_omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
67
|
+
} else if (state.appStates.isMinimized) {
|
|
61
68
|
dispatch({
|
|
62
69
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
63
70
|
payload: false
|
|
@@ -66,6 +73,7 @@ const ChatButtonStateful = props => {
|
|
|
66
73
|
await startChat();
|
|
67
74
|
}
|
|
68
75
|
},
|
|
76
|
+
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
69
77
|
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
70
78
|
};
|
|
71
79
|
const outOfOfficeControlProps = {
|
|
@@ -74,6 +82,10 @@ const ChatButtonStateful = props => {
|
|
|
74
82
|
titleText: "We're Offline",
|
|
75
83
|
subtitleText: "No agents available",
|
|
76
84
|
onClick: async () => {
|
|
85
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
86
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
87
|
+
});
|
|
88
|
+
|
|
77
89
|
if (state.appStates.isMinimized) {
|
|
78
90
|
dispatch({
|
|
79
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -86,6 +98,7 @@ const ChatButtonStateful = props => {
|
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
},
|
|
101
|
+
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
89
102
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
90
103
|
};
|
|
91
104
|
(0, _react.useEffect)(() => {
|
|
@@ -107,6 +120,9 @@ const ChatButtonStateful = props => {
|
|
|
107
120
|
});
|
|
108
121
|
}
|
|
109
122
|
}, []);
|
|
123
|
+
(0, _react.useEffect)(() => {
|
|
124
|
+
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
125
|
+
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
110
126
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
|
|
111
127
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
112
128
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -13,10 +13,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _utils = require("../../common/utils");
|
|
15
15
|
|
|
16
|
-
var _Constants = require("../../common/Constants");
|
|
17
|
-
|
|
18
|
-
var _ConversationState = require("../../contexts/common/ConversationState");
|
|
19
|
-
|
|
20
16
|
var _DimLayer = require("../dimlayer/DimLayer");
|
|
21
17
|
|
|
22
18
|
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
@@ -25,16 +21,12 @@ var _NotificationHandler = require("../webchatcontainerstateful/webchatcontrolle
|
|
|
25
21
|
|
|
26
22
|
var _NotificationScenarios = require("../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
|
|
27
23
|
|
|
28
|
-
var _PostChatSurveyMode = require("../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
29
|
-
|
|
30
24
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
31
25
|
|
|
32
26
|
var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
|
|
33
27
|
|
|
34
28
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
35
29
|
|
|
36
|
-
var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
|
|
37
|
-
|
|
38
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
31
|
|
|
40
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -43,21 +35,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
43
35
|
|
|
44
36
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
37
|
const ConfirmationPaneStateful = props => {
|
|
46
|
-
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
|
|
47
|
-
|
|
48
38
|
const initialTabIndexMap = new Map();
|
|
49
|
-
let elements = [];
|
|
50
|
-
|
|
51
|
-
const chatSDK = (0, _useChatSDKStore.default)();
|
|
39
|
+
let elements = [];
|
|
52
40
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
53
41
|
const {
|
|
54
|
-
|
|
42
|
+
prepareEndChat
|
|
55
43
|
} = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
44
|
|
|
58
45
|
const [adapter] = (0, _useChatAdapterStore.default)();
|
|
59
|
-
const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
|
|
60
|
-
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
|
|
61
46
|
const controlProps = {
|
|
62
47
|
id: "oc-lcw-confirmation-pane",
|
|
63
48
|
dir: state.domainStates.globalDir,
|
|
@@ -73,29 +58,8 @@ const ConfirmationPaneStateful = props => {
|
|
|
73
58
|
});
|
|
74
59
|
|
|
75
60
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === _Constants.Constants.truePascal) {
|
|
80
|
-
if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
81
|
-
const loadPostChatEvent = {
|
|
82
|
-
eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
_omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
|
|
86
|
-
} else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
|
|
87
|
-
const skipEndChatSDK = false;
|
|
88
|
-
const skipCloseChat = true;
|
|
89
|
-
await endChat(adapter, skipEndChatSDK, skipCloseChat);
|
|
90
|
-
dispatch({
|
|
91
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
92
|
-
payload: _ConversationState.ConversationState.InActive
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
97
|
-
await endChat(adapter);
|
|
98
|
-
}
|
|
61
|
+
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
62
|
+
await prepareEndChat(adapter, state);
|
|
99
63
|
} catch (ex) {
|
|
100
64
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
101
65
|
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallFailed,
|
|
@@ -123,8 +123,7 @@ const FooterStateful = props => {
|
|
|
123
123
|
styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
|
|
124
124
|
}), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
|
|
125
125
|
audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
|
|
126
|
-
|
|
127
|
-
isAudioMuted: state.appStates.isAudioMuted ?? false
|
|
126
|
+
isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
|
|
128
127
|
}));
|
|
129
128
|
};
|
|
130
129
|
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -116,8 +116,17 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
116
116
|
let fileAttachmentName = _Constants.TranscriptConstants.DefaultFileAttachmentName;
|
|
117
117
|
let dialogColor = _Constants.TranscriptConstants.CustomerDialogColor;
|
|
118
118
|
let fontColor = _Constants.TranscriptConstants.CustomerFontColor;
|
|
119
|
+
const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1;
|
|
120
|
+
const isControlMessage = value.isControlMessage && value.isControlMessage === true;
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType;
|
|
123
|
+
|
|
124
|
+
const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode;
|
|
125
|
+
|
|
126
|
+
const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.hiddenTag.toLowerCase()) !== -1;
|
|
127
|
+
const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
|
|
128
|
+
|
|
129
|
+
if (shouldIgnoreMessage) {
|
|
121
130
|
return;
|
|
122
131
|
} else if (value.from) {
|
|
123
132
|
if (value.from.application) {
|
|
@@ -138,7 +147,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
138
147
|
|
|
139
148
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
140
149
|
fileAttachmentName = value.attachments[0].name;
|
|
141
|
-
value.content = attachmentMessage
|
|
150
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
142
151
|
}
|
|
143
152
|
}
|
|
144
153
|
|
|
@@ -69,13 +69,7 @@ const HeaderStateful = props => {
|
|
|
69
69
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
70
70
|
payload: true
|
|
71
71
|
});
|
|
72
|
-
} else
|
|
73
|
-
dispatch({
|
|
74
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
|
|
75
|
-
payload: false
|
|
76
|
-
});
|
|
77
|
-
await endChat(adapter);
|
|
78
|
-
} else if (conversationState.current === _ConversationState.ConversationState.InActive) {
|
|
72
|
+
} else {
|
|
79
73
|
const skipEndChatSDK = true;
|
|
80
74
|
const skipCloseChat = false;
|
|
81
75
|
await endChat(adapter, skipEndChatSDK, skipCloseChat);
|
|
@@ -87,8 +81,8 @@ const HeaderStateful = props => {
|
|
|
87
81
|
});
|
|
88
82
|
},
|
|
89
83
|
...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
|
|
90
|
-
hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
91
|
-
hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
84
|
+
hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
85
|
+
hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
92
86
|
hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
|
|
93
87
|
};
|
|
94
88
|
const outOfOfficeControlProps = {
|
|
@@ -27,6 +27,8 @@ var _groupActivitiesMiddleware = require("../../../webchatcontainerstateful/webc
|
|
|
27
27
|
|
|
28
28
|
var _typingIndicatorMiddleware = require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware");
|
|
29
29
|
|
|
30
|
+
var _WebChatLogger = require("../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
/* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any */
|
|
@@ -272,18 +274,6 @@ const dummyDefaultProps = {
|
|
|
272
274
|
width: "50px",
|
|
273
275
|
fontSize: "18px"
|
|
274
276
|
},
|
|
275
|
-
currentCallTimerStyleProps: {
|
|
276
|
-
borderRadius: "2px",
|
|
277
|
-
margin: "1px",
|
|
278
|
-
color: "#FFFFFF",
|
|
279
|
-
paddingTop: "18px",
|
|
280
|
-
fontSize: 12,
|
|
281
|
-
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
282
|
-
backgroundColor: "darkgrey",
|
|
283
|
-
height: "45px",
|
|
284
|
-
width: "50px",
|
|
285
|
-
textAlign: "center"
|
|
286
|
-
},
|
|
287
277
|
videoTileStyleProps: {
|
|
288
278
|
width: "100%",
|
|
289
279
|
marginLeft: "auto",
|
|
@@ -347,7 +337,9 @@ const dummyDefaultProps = {
|
|
|
347
337
|
hideChatTextContainer: false,
|
|
348
338
|
hideChatSubtitle: false,
|
|
349
339
|
hideChatTitle: false,
|
|
350
|
-
hideNotificationBubble: true
|
|
340
|
+
hideNotificationBubble: true,
|
|
341
|
+
unreadMessageString: "new messages",
|
|
342
|
+
largeUnreadMessageString: "99+"
|
|
351
343
|
},
|
|
352
344
|
styleProps: {
|
|
353
345
|
generalStyleProps: {
|
|
@@ -1442,9 +1434,9 @@ const dummyDefaultProps = {
|
|
|
1442
1434
|
startNewChatButtonClassName: undefined
|
|
1443
1435
|
}
|
|
1444
1436
|
},
|
|
1445
|
-
authClientFunction: undefined,
|
|
1446
1437
|
isReconnectEnabled: undefined,
|
|
1447
|
-
reconnectId: undefined
|
|
1438
|
+
reconnectId: undefined,
|
|
1439
|
+
redirectInSameWindow: undefined
|
|
1448
1440
|
},
|
|
1449
1441
|
styleProps: {
|
|
1450
1442
|
generalStyles: {
|
|
@@ -1516,7 +1508,7 @@ const dummyDefaultProps = {
|
|
|
1516
1508
|
internalErrorBoxClass: undefined,
|
|
1517
1509
|
internalRenderErrorBox: undefined,
|
|
1518
1510
|
locale: "en-US",
|
|
1519
|
-
onTelemetry:
|
|
1511
|
+
onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
|
|
1520
1512
|
overrideLocalizedStrings: undefined,
|
|
1521
1513
|
renderMarkdown: (0, _createMarkdown.createMarkdown)(false, false),
|
|
1522
1514
|
scrollToEndButtonMiddleware: undefined,
|
|
@@ -1706,8 +1698,16 @@ const dummyDefaultProps = {
|
|
|
1706
1698
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
1707
1699
|
PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
|
|
1708
1700
|
MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
|
|
1701
|
+
},
|
|
1702
|
+
botMagicCode: {
|
|
1703
|
+
disabled: false,
|
|
1704
|
+
fwdUrl: ""
|
|
1709
1705
|
}
|
|
1710
1706
|
},
|
|
1707
|
+
authProps: {
|
|
1708
|
+
authClientFunction: undefined,
|
|
1709
|
+
setAuthTokenProviderToChatSdk: undefined
|
|
1710
|
+
},
|
|
1711
1711
|
telemetryConfig: undefined
|
|
1712
1712
|
};
|
|
1713
1713
|
exports.dummyDefaultProps = dummyDefaultProps;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.endChat = void 0;
|
|
6
|
+
exports.prepareEndChat = exports.endChat = void 0;
|
|
7
7
|
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
|
|
@@ -19,8 +19,65 @@ var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontrol
|
|
|
19
19
|
|
|
20
20
|
var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
21
21
|
|
|
22
|
+
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
23
|
+
|
|
24
|
+
var _Constants = require("../../../common/Constants");
|
|
25
|
+
|
|
26
|
+
var _utils = require("../../../common/utils");
|
|
27
|
+
|
|
22
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
const
|
|
29
|
+
const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
|
|
30
|
+
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
|
|
31
|
+
|
|
32
|
+
const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
|
|
33
|
+
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
|
|
35
|
+
let conversationDetails = undefined;
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
conversationDetails = await chatSDK.getConversationDetails();
|
|
39
|
+
} catch (erorr) {
|
|
40
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
41
|
+
Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsException,
|
|
42
|
+
ExceptionDetails: {
|
|
43
|
+
exception: `Failed to get conversation details: ${erorr}`
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === _Constants.Constants.truePascal) {
|
|
49
|
+
const skipEndChatSDK = false;
|
|
50
|
+
const skipCloseChat = true;
|
|
51
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, true);
|
|
52
|
+
|
|
53
|
+
if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
56
|
+
payload: _ConversationState.ConversationState.PostchatLoading
|
|
57
|
+
});
|
|
58
|
+
await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
|
|
59
|
+
const loadPostChatEvent = {
|
|
60
|
+
eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
|
|
64
|
+
} else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
|
|
65
|
+
dispatch({
|
|
66
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
67
|
+
payload: _ConversationState.ConversationState.InActive
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
|
|
75
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
exports.prepareEndChat = prepareEndChat;
|
|
79
|
+
|
|
80
|
+
const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
|
|
24
81
|
if (!skipEndChatSDK) {
|
|
25
82
|
try {
|
|
26
83
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -35,8 +92,24 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
35
92
|
exception: ex
|
|
36
93
|
}
|
|
37
94
|
});
|
|
95
|
+
|
|
96
|
+
postMessageToOtherTab = false;
|
|
38
97
|
}
|
|
39
|
-
}
|
|
98
|
+
} // Need to clear these states immediately when chat ended from OC.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
dispatch({
|
|
102
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
103
|
+
payload: undefined
|
|
104
|
+
});
|
|
105
|
+
dispatch({
|
|
106
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
107
|
+
payload: undefined
|
|
108
|
+
});
|
|
109
|
+
dispatch({
|
|
110
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
111
|
+
payload: undefined
|
|
112
|
+
});
|
|
40
113
|
|
|
41
114
|
if (!skipCloseChat) {
|
|
42
115
|
try {
|
|
@@ -65,17 +138,27 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
65
138
|
payload: null
|
|
66
139
|
});
|
|
67
140
|
dispatch({
|
|
68
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
69
|
-
payload:
|
|
141
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
|
|
142
|
+
payload: 0
|
|
70
143
|
});
|
|
71
144
|
dispatch({
|
|
72
|
-
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
73
|
-
payload:
|
|
145
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
146
|
+
payload: {
|
|
147
|
+
proactiveChatBodyTitle: "",
|
|
148
|
+
proactiveChatEnablePrechat: false,
|
|
149
|
+
proactiveChatInNewWindow: false
|
|
150
|
+
}
|
|
74
151
|
});
|
|
75
152
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
153
|
+
if (postMessageToOtherTab) {
|
|
154
|
+
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
|
|
155
|
+
|
|
156
|
+
const endChatEventName = (0, _utils.getWidgetEndChatEventName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId);
|
|
157
|
+
|
|
158
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
159
|
+
eventName: endChatEventName
|
|
160
|
+
});
|
|
161
|
+
}
|
|
79
162
|
} catch (error) {
|
|
80
163
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
81
164
|
Event: _TelemetryConstants.TelemetryEvent.CloseChatMethodException,
|
|
@@ -18,7 +18,7 @@ const initCallingSdk = async (chatSDK, setVoiceVideoCallingSDK) => {
|
|
|
18
18
|
const callingSDK = await chatSDK.getVoiceVideoCalling();
|
|
19
19
|
setVoiceVideoCallingSDK(callingSDK);
|
|
20
20
|
|
|
21
|
-
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.
|
|
21
|
+
_TelemetryHelper.TelemetryHelper.logCallingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
22
22
|
Event: _TelemetryConstants.TelemetryEvent.CallingSDKLoadSuccess
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initWebChatComposer = void 0;
|
|
7
7
|
|
|
8
|
-
var _botframeworkWebchat = require("botframework-webchat");
|
|
9
|
-
|
|
10
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
11
9
|
|
|
10
|
+
var _botframeworkWebchat = require("botframework-webchat");
|
|
11
|
+
|
|
12
12
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
13
|
|
|
14
14
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
@@ -17,6 +17,8 @@ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidget
|
|
|
17
17
|
|
|
18
18
|
var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
|
|
19
19
|
|
|
20
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
21
|
+
|
|
20
22
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
21
23
|
|
|
22
24
|
var _attachmentProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware"));
|
|
@@ -41,6 +43,8 @@ var _createMarkdown = require("./createMarkdown");
|
|
|
41
43
|
|
|
42
44
|
var _maxMessageSizeValidator = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator"));
|
|
43
45
|
|
|
46
|
+
var _WebChatLogger = require("../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
|
|
47
|
+
|
|
44
48
|
var _defaultAttachmentProps = require("../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps");
|
|
45
49
|
|
|
46
50
|
var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
@@ -59,11 +63,17 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
|
|
|
59
63
|
|
|
60
64
|
var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
|
|
61
65
|
|
|
66
|
+
var _cardActionMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware");
|
|
67
|
+
|
|
68
|
+
var _messageTimestampMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware"));
|
|
69
|
+
|
|
70
|
+
var _Constants = require("../../../common/Constants");
|
|
71
|
+
|
|
62
72
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
63
73
|
|
|
64
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
75
|
const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
|
|
66
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21;
|
|
76
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
|
|
67
77
|
|
|
68
78
|
const localizedTexts = { ..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
|
|
69
79
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
|
|
@@ -82,6 +92,11 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
82
92
|
const conversationEndCallback = async () => {
|
|
83
93
|
var _props$webChatContain4, _props$webChatContain5;
|
|
84
94
|
|
|
95
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
96
|
+
Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
|
|
97
|
+
Description: "Conversation is ended by agent side or by timeout."
|
|
98
|
+
});
|
|
99
|
+
|
|
85
100
|
if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
|
|
86
101
|
setWebChatStyles(styles => {
|
|
87
102
|
return { ...styles,
|
|
@@ -90,8 +105,15 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
90
105
|
});
|
|
91
106
|
}
|
|
92
107
|
|
|
108
|
+
_WebChatStoreLoader.WebChatStoreLoader.store = null;
|
|
109
|
+
|
|
93
110
|
if (isPostChatEnabled === "true") {
|
|
94
111
|
if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
|
|
112
|
+
dispatch({
|
|
113
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
114
|
+
payload: _ConversationState.ConversationState.PostchatLoading
|
|
115
|
+
});
|
|
116
|
+
await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
|
|
95
117
|
const loadPostChatEvent = {
|
|
96
118
|
eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
|
|
97
119
|
};
|
|
@@ -114,10 +136,14 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
114
136
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
115
137
|
payload: undefined
|
|
116
138
|
});
|
|
139
|
+
dispatch({
|
|
140
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
141
|
+
payload: undefined
|
|
142
|
+
});
|
|
117
143
|
};
|
|
118
144
|
|
|
119
145
|
webChatStore = (0, _botframeworkWebchat.createStore)({}, //initial state
|
|
120
|
-
_preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), _channelDataMiddleware.default, (0, _conversationEndMiddleware.default)(conversationEndCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, _htmlTextMiddleware.default, (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
+
_preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), _channelDataMiddleware.default, (0, _conversationEndMiddleware.default)(conversationEndCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), _messageTimestampMiddleware.default, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, _htmlTextMiddleware.default, (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
121
147
|
...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
|
|
122
148
|
_WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
|
|
123
149
|
} // Initialize the remaining Web Chat props
|
|
@@ -134,7 +160,9 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
|
|
|
134
160
|
avatarMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableAvatarMiddleware ? undefined : (0, _avatarMiddleware.createAvatarMiddleware)((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.avatarStyleProps, (_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.avatarTextStyleProps),
|
|
135
161
|
groupActivitiesMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
|
|
136
162
|
typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
|
|
137
|
-
|
|
163
|
+
onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
|
|
164
|
+
cardActionMiddleware: (0, _cardActionMiddleware.createCardActionMiddleware)(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
|
|
165
|
+
...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
|
|
138
166
|
};
|
|
139
167
|
return webChatProps;
|
|
140
168
|
};
|