@microsoft/omnichannel-chat-widget 1.7.4-main.f0f5d34 → 1.7.4
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/facades/FacadeChatSDK.js +298 -0
- package/lib/cjs/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +7 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/cjs/common/utils.js +2 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +15 -13
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/cjs/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/cjs/components/livechatwidget/common/endChat.js +40 -30
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +10 -6
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +2 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +54 -39
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/cjs/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +63 -40
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/cjs/contexts/FacadeChatSDKStore.js +10 -0
- package/lib/cjs/hooks/useFacadeChatSDKStore.js +17 -0
- package/lib/cjs/index.js +9 -2
- package/lib/cjs/plugins/createChatTranscript.js +2 -2
- package/lib/esm/common/facades/FacadeChatSDK.js +291 -0
- package/lib/esm/common/facades/types/IFacadeChatSDKInput.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +7 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +12 -0
- package/lib/esm/common/utils.js +2 -2
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +4 -8
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +5 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +15 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -10
- package/lib/esm/components/headerstateful/HeaderStateful.js +4 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +26 -3
- package/lib/esm/components/livechatwidget/common/authHelper.js +14 -5
- package/lib/esm/components/livechatwidget/common/createAdapter.js +9 -9
- package/lib/esm/components/livechatwidget/common/endChat.js +40 -30
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +10 -6
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +2 -4
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -12
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +5 -5
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +4 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +55 -40
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +7 -7
- package/lib/esm/components/livechatwidget/common/updateSessionDataForTelemetry.js +8 -8
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +63 -40
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
- package/lib/esm/contexts/FacadeChatSDKStore.js +4 -0
- package/lib/esm/hooks/useFacadeChatSDKStore.js +10 -0
- package/lib/esm/index.js +5 -4
- package/lib/esm/plugins/createChatTranscript.js +2 -2
- package/lib/types/common/facades/FacadeChatSDK.d.ts +71 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +13 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +9 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +7 -0
- package/lib/types/common/utils.d.ts +2 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +14 -1
- package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initCallingSdk.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +3 -2
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +5 -4
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/updateSessionDataForTelemetry.d.ts +2 -1
- package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
- package/lib/types/contexts/FacadeChatSDKStore.d.ts +1 -0
- package/lib/types/hooks/useFacadeChatSDKStore.d.ts +3 -0
- package/lib/types/index.d.ts +4 -3
- package/lib/types/plugins/createChatTranscript.d.ts +2 -1
- package/package.json +4 -2
|
@@ -57,7 +57,7 @@ var _setPostChatContextAndLoadSurvey = require("../common/setPostChatContextAndL
|
|
|
57
57
|
var _startProactiveChat = require("../common/startProactiveChat");
|
|
58
58
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
59
59
|
var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useChatContextStore"));
|
|
60
|
-
var
|
|
60
|
+
var _useFacadeChatSDKStore = _interopRequireDefault(require("../../../hooks/useFacadeChatSDKStore"));
|
|
61
61
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
62
|
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); }
|
|
63
63
|
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; }
|
|
@@ -72,7 +72,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
72
72
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
|
|
73
73
|
});
|
|
74
74
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
const
|
|
75
|
+
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
76
76
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
77
|
const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = (0, _react2.useState)(undefined);
|
|
78
78
|
const {
|
|
@@ -90,8 +90,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
90
90
|
|
|
91
91
|
// In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
|
|
92
92
|
if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
|
|
93
|
-
var
|
|
94
|
-
const broadcastServiceChannelName = (0, _utils.getBroadcastChannelName)(
|
|
93
|
+
var _facadeChatSDK$getCha, _facadeChatSDK$getCha2, _props$controlProps2;
|
|
94
|
+
const broadcastServiceChannelName = (0, _utils.getBroadcastChannelName)((_facadeChatSDK$getCha = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha === void 0 ? void 0 : (_facadeChatSDK$getCha2 = _facadeChatSDK$getCha.omnichannelConfig) === null || _facadeChatSDK$getCha2 === void 0 ? void 0 : _facadeChatSDK$getCha2.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
95
95
|
(0, _omnichannelChatComponents.BroadcastServiceInitialize)(broadcastServiceChannelName);
|
|
96
96
|
}
|
|
97
97
|
_TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer = (0, _utils.createTimer)();
|
|
@@ -126,7 +126,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
126
126
|
const startChat = async (props, localState) => {
|
|
127
127
|
const isReconnectTriggered = async () => {
|
|
128
128
|
if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
|
|
129
|
-
const noValidReconnectId = await (0, _reconnectChatHelper.handleChatReconnect)(
|
|
129
|
+
const noValidReconnectId = await (0, _reconnectChatHelper.handleChatReconnect)(facadeChatSDK, props, dispatch, setAdapter, _startChat.initStartChat, state);
|
|
130
130
|
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
131
131
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
132
132
|
payload: null
|
|
@@ -147,14 +147,20 @@ const LiveChatWidgetStateful = props => {
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
//Check if conversation state is not in wrapup or closed state
|
|
150
|
-
isChatValid = await (0, _startChat.checkIfConversationStillValid)(
|
|
150
|
+
isChatValid = await (0, _startChat.checkIfConversationStillValid)(facadeChatSDK, dispatch, state);
|
|
151
151
|
if (isChatValid === true) {
|
|
152
152
|
const reconnectTriggered = await isReconnectTriggered();
|
|
153
153
|
if (!reconnectTriggered) {
|
|
154
|
-
await (0, _startChat.initStartChat)(
|
|
154
|
+
await (0, _startChat.initStartChat)(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
|
|
155
155
|
}
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
159
|
+
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
160
|
+
payload: {
|
|
161
|
+
errorMessage: "Chat found in cache but invalid as the conversation status is inactive."
|
|
162
|
+
}
|
|
163
|
+
});
|
|
158
164
|
}
|
|
159
165
|
if (isChatValid === false) {
|
|
160
166
|
if (localState) {
|
|
@@ -165,7 +171,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
165
171
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
166
172
|
payload: null
|
|
167
173
|
});
|
|
168
|
-
await (0, _startChat.setPreChatAndInitiateChat)(
|
|
174
|
+
await (0, _startChat.setPreChatAndInitiateChat)(facadeChatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
169
175
|
}
|
|
170
176
|
return;
|
|
171
177
|
} else {
|
|
@@ -235,7 +241,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
235
241
|
});
|
|
236
242
|
}
|
|
237
243
|
if (((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_callingoptions) !== _Constants.E2VVOptions.NoCalling) {
|
|
238
|
-
(0, _initCallingSdk.initCallingSdk)(
|
|
244
|
+
(0, _initCallingSdk.initCallingSdk)(facadeChatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
239
245
|
sdkCreated && dispatch({
|
|
240
246
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
241
247
|
payload: true
|
|
@@ -267,13 +273,19 @@ const LiveChatWidgetStateful = props => {
|
|
|
267
273
|
(0, _react2.useEffect)(() => {
|
|
268
274
|
var _state$appStates6;
|
|
269
275
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates6 = state.appStates) === null || _state$appStates6 === void 0 ? void 0 : _state$appStates6.hideStartChatButton) === true) {
|
|
270
|
-
var _props$chatConfig3, _props$chatConfig3$Li;
|
|
276
|
+
var _props$chatConfig3, _props$chatConfig3$Li, _props$chatConfig4, _props$chatConfig4$Li;
|
|
271
277
|
//handle OOH pane
|
|
272
|
-
if ((props === null || props === void 0 ? void 0 : (_props$chatConfig3 = props.chatConfig) === null || _props$chatConfig3 === void 0 ? void 0 : (_props$chatConfig3$Li = _props$chatConfig3.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig3$Li === void 0 ? void 0 : _props$chatConfig3$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
278
|
+
if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig3 = props.chatConfig) === null || _props$chatConfig3 === void 0 ? void 0 : (_props$chatConfig3$Li = _props$chatConfig3.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig3$Li === void 0 ? void 0 : _props$chatConfig3$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig4 = props.chatConfig) === null || _props$chatConfig4 === void 0 ? void 0 : (_props$chatConfig4$Li = _props$chatConfig4.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig4$Li === void 0 ? void 0 : _props$chatConfig4$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
273
279
|
dispatch({
|
|
274
280
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
275
281
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
276
282
|
});
|
|
283
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
284
|
+
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
285
|
+
payload: {
|
|
286
|
+
errorMessage: "Out-of-office hours status is shown."
|
|
287
|
+
}
|
|
288
|
+
});
|
|
277
289
|
return;
|
|
278
290
|
}
|
|
279
291
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
@@ -286,7 +298,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
286
298
|
|
|
287
299
|
// useEffect for custom context
|
|
288
300
|
(0, _react2.useEffect)(() => {
|
|
289
|
-
var
|
|
301
|
+
var _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _facadeChatSDK$getCha6, _props$controlProps11;
|
|
290
302
|
// Add the custom context on receiving the SetCustomContext event
|
|
291
303
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
292
304
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -339,7 +351,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
339
351
|
if (callInProgress.current === false && dateNow - lastLWICheckTimeRef.current > _Constants.Constants.LWICheckOnVisibilityTimeout) {
|
|
340
352
|
lastLWICheckTimeRef.current = dateNow;
|
|
341
353
|
callInProgress.current = true;
|
|
342
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
354
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
343
355
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.Closed) {
|
|
344
356
|
dispatch({
|
|
345
357
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
@@ -355,19 +367,30 @@ const LiveChatWidgetStateful = props => {
|
|
|
355
367
|
}
|
|
356
368
|
});
|
|
357
369
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.NetworkReconnected).subscribe(async () => {
|
|
358
|
-
var _window2, _window2$location;
|
|
359
|
-
|
|
370
|
+
var _window2, _window2$location, _inMemoryState$appSta;
|
|
371
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
372
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
373
|
+
payload: null
|
|
374
|
+
});
|
|
375
|
+
if ((0, _utils.isThisSessionPopout)((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href) || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) !== _ConversationState.ConversationState.Active) {
|
|
360
376
|
return;
|
|
361
377
|
}
|
|
362
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
378
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
363
379
|
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.Closed) {
|
|
364
380
|
dispatch({
|
|
365
381
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
366
382
|
payload: true
|
|
367
383
|
});
|
|
384
|
+
const desc = "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)";
|
|
368
385
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
369
386
|
Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
370
|
-
Description:
|
|
387
|
+
Description: desc
|
|
388
|
+
});
|
|
389
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
390
|
+
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
391
|
+
payload: {
|
|
392
|
+
errorMessage: desc
|
|
393
|
+
}
|
|
371
394
|
});
|
|
372
395
|
}
|
|
373
396
|
});
|
|
@@ -386,9 +409,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
386
409
|
|
|
387
410
|
// Start chat from SDK Event
|
|
388
411
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
|
|
389
|
-
var _props$
|
|
412
|
+
var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4, _inMemoryState$appSta5;
|
|
390
413
|
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
391
|
-
if ((props === null || props === void 0 ? void 0 : (_props$
|
|
414
|
+
if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig5 = props.chatConfig) === null || _props$chatConfig5 === void 0 ? void 0 : (_props$chatConfig5$Li = _props$chatConfig5.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig5$Li === void 0 ? void 0 : _props$chatConfig5$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig6 = props.chatConfig) === null || _props$chatConfig6 === void 0 ? void 0 : (_props$chatConfig6$Li = _props$chatConfig6.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig6$Li === void 0 ? void 0 : _props$chatConfig6$Li.OutOfOperatingHours.toLowerCase()) === "true") {
|
|
392
415
|
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
393
416
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
394
417
|
payload: false
|
|
@@ -425,16 +448,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
425
448
|
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
426
449
|
|
|
427
450
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
428
|
-
if (((_inMemoryState$
|
|
451
|
+
if (((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === _ConversationState.ConversationState.Closed || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === _ConversationState.ConversationState.InActive || ((_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.conversationState) === _ConversationState.ConversationState.Postchat) {
|
|
429
452
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
430
453
|
eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
|
|
431
454
|
});
|
|
432
|
-
(0, _startChat.prepareStartChat)(props,
|
|
455
|
+
(0, _startChat.prepareStartChat)(props, facadeChatSDK, inMemoryState, dispatch, setAdapter);
|
|
433
456
|
return;
|
|
434
457
|
}
|
|
435
458
|
|
|
436
459
|
// If minimized, maximize the chat
|
|
437
|
-
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
460
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.isMinimized) === true) {
|
|
438
461
|
var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
|
|
439
462
|
dispatch({
|
|
440
463
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -481,7 +504,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
481
504
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
482
505
|
Description: _Constants.PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
483
506
|
});
|
|
484
|
-
(0, _endChat.endChat)(props,
|
|
507
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
485
508
|
}
|
|
486
509
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
487
510
|
eventName: _TelemetryConstants.BroadcastEvent.CloseChat
|
|
@@ -494,7 +517,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
494
517
|
});
|
|
495
518
|
|
|
496
519
|
// Listen to end chat event from other tabs
|
|
497
|
-
const endChatEventName = (0, _utils.getWidgetEndChatEventName)(
|
|
520
|
+
const endChatEventName = (0, _utils.getWidgetEndChatEventName)((_facadeChatSDK$getCha3 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : (_facadeChatSDK$getCha4 = _facadeChatSDK$getCha3.omnichannelConfig) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : _facadeChatSDK$getCha4.orgId, (_facadeChatSDK$getCha5 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : (_facadeChatSDK$getCha6 = _facadeChatSDK$getCha5.omnichannelConfig) === null || _facadeChatSDK$getCha6 === void 0 ? void 0 : _facadeChatSDK$getCha6.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
498
521
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
499
522
|
var _msg$payload10;
|
|
500
523
|
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
@@ -502,9 +525,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
502
525
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
503
526
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
504
527
|
});
|
|
505
|
-
(0, _endChat.endChat)(props,
|
|
528
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
506
529
|
(0, _endChat.endChatStateCleanUp)(dispatch);
|
|
507
|
-
(0, _endChat.chatSDKStateCleanUp)(
|
|
530
|
+
(0, _endChat.chatSDKStateCleanUp)(facadeChatSDK.getChatSDK());
|
|
508
531
|
return;
|
|
509
532
|
}
|
|
510
533
|
});
|
|
@@ -546,7 +569,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
546
569
|
(0, _react2.useEffect)(() => {
|
|
547
570
|
// On new message
|
|
548
571
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
549
|
-
|
|
572
|
+
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onNewMessage(() => {
|
|
550
573
|
// Track the message count
|
|
551
574
|
currentMessageCountRef.current++;
|
|
552
575
|
dispatch({
|
|
@@ -634,7 +657,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
634
657
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
635
658
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
636
659
|
});
|
|
637
|
-
(0, _endChat.endChat)(props,
|
|
660
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
|
|
638
661
|
return;
|
|
639
662
|
}
|
|
640
663
|
|
|
@@ -644,7 +667,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
644
667
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
645
668
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
646
669
|
});
|
|
647
|
-
(0, _endChat.endChat)(props,
|
|
670
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
648
671
|
return;
|
|
649
672
|
}
|
|
650
673
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates12 = state.appStates) === null || _state$appStates12 === void 0 ? void 0 : _state$appStates12.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates13 = state.appStates) === null || _state$appStates13 === void 0 ? void 0 : _state$appStates13.conversationEndedBy) === _Constants.ConversationEndEntity.Bot) {
|
|
@@ -655,7 +678,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
655
678
|
}
|
|
656
679
|
|
|
657
680
|
// All other cases
|
|
658
|
-
(0, _endChat.prepareEndChat)(props,
|
|
681
|
+
(0, _endChat.prepareEndChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
659
682
|
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
660
683
|
|
|
661
684
|
// Publish chat widget state
|
|
@@ -688,13 +711,13 @@ const LiveChatWidgetStateful = props => {
|
|
|
688
711
|
|
|
689
712
|
// Handle Chat disconnect cases
|
|
690
713
|
(0, _react2.useEffect)(() => {
|
|
691
|
-
var _inMemoryState$
|
|
714
|
+
var _inMemoryState$appSta6;
|
|
692
715
|
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
693
716
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
694
717
|
payload: null
|
|
695
718
|
});
|
|
696
719
|
(0, _chatDisconnectHelper.handleChatDisconnect)(props, inMemoryState, setWebChatStyles);
|
|
697
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
720
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta6 = inMemoryState.appStates) === null || _inMemoryState$appSta6 === void 0 ? void 0 : _inMemoryState$appSta6.chatDisconnectEventReceived;
|
|
698
721
|
if (chatDisconnectState && adapter) {
|
|
699
722
|
try {
|
|
700
723
|
adapter.end();
|
|
@@ -726,7 +749,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
726
749
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
727
750
|
Description: _Constants.PrepareEndChatDescriptionConstants.BrowserUnload
|
|
728
751
|
});
|
|
729
|
-
(0, _endChat.endChat)(props,
|
|
752
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
|
|
730
753
|
// Clean local storage
|
|
731
754
|
(_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
|
|
732
755
|
|
|
@@ -739,16 +762,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
739
762
|
eventName: _TelemetryConstants.BroadcastEvent.ClosePopoutWindow
|
|
740
763
|
});
|
|
741
764
|
};
|
|
742
|
-
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(
|
|
765
|
+
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(facadeChatSDK, dispatch);
|
|
743
766
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
744
|
-
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => (0, _endChat.endChat)(props,
|
|
745
|
-
const prepareStartChatRelay = () => (0, _startChat.prepareStartChat)(props,
|
|
767
|
+
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => (0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab);
|
|
768
|
+
const prepareStartChatRelay = () => (0, _startChat.prepareStartChat)(props, facadeChatSDK, state, dispatch, setAdapter);
|
|
746
769
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
747
|
-
const initStartChatRelay = (optionalParams, persistedState) => (0, _startChat.initStartChat)(
|
|
770
|
+
const initStartChatRelay = (optionalParams, persistedState) => (0, _startChat.initStartChat)(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams, persistedState);
|
|
748
771
|
const confirmationPaneProps = (0, _initConfirmationPropsComposer.initConfirmationPropsComposer)(props);
|
|
749
772
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
750
|
-
const prepareEndChatRelay = () => (0, _endChat.prepareEndChat)(props,
|
|
751
|
-
const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, state, dispatch,
|
|
773
|
+
const prepareEndChatRelay = () => (0, _endChat.prepareEndChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
774
|
+
const webChatProps = (0, _initWebChatComposer.initWebChatComposer)(props, state, dispatch, facadeChatSDK, endChatRelay);
|
|
752
775
|
const downloadTranscriptProps = (0, _createDownloadTranscriptProps.default)(props.downloadTranscriptProps, {
|
|
753
776
|
...(_defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === null || _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === void 0 ? void 0 : _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles),
|
|
754
777
|
...((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.webChatStyles)
|
|
@@ -774,7 +797,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
774
797
|
};
|
|
775
798
|
|
|
776
799
|
// Add 'omnichannel-chat-widget' OC User Agent if not already set
|
|
777
|
-
(0, _utils.setOcUserAgent)(
|
|
800
|
+
(0, _utils.setOcUserAgent)(facadeChatSDK.getChatSDK());
|
|
778
801
|
const directLine = ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine;
|
|
779
802
|
const userID = directLine.getState ? directLine === null || directLine === void 0 ? void 0 : directLine.getState("acs.userId") : "teamsvisitor";
|
|
780
803
|
|
|
@@ -42,6 +42,9 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
42
42
|
} else {
|
|
43
43
|
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
44
44
|
}
|
|
45
|
+
if (props.copilotSurveyContext) {
|
|
46
|
+
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
47
|
+
}
|
|
45
48
|
const styleProps = {
|
|
46
49
|
...props.styleProps,
|
|
47
50
|
generalStyleProps: generalStyleProps
|
|
@@ -8,9 +8,9 @@ var _Constants = require("../../common/Constants");
|
|
|
8
8
|
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _utils = require("../../common/utils");
|
|
11
|
-
var _markdownIt = _interopRequireDefault(require("markdown-it"));
|
|
12
11
|
var _ConversationState = require("../../contexts/common/ConversationState");
|
|
13
12
|
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
13
|
+
var _markdownIt = _interopRequireDefault(require("markdown-it"));
|
|
14
14
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
15
15
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
16
16
|
var _defaultGeneralPreChatSurveyPaneStyleProps = require("./common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps");
|
|
@@ -12,14 +12,16 @@ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components
|
|
|
12
12
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
13
13
|
var _utils = require("../../common/utils");
|
|
14
14
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
15
|
-
var
|
|
15
|
+
var _useFacadeChatSDKStore = _interopRequireDefault(require("../../hooks/useFacadeChatSDKStore"));
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
19
19
|
const ReconnectChatPaneStateful = props => {
|
|
20
20
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
const chatSDK = (
|
|
22
|
+
//const chatSDK: any = useChatSDKStore();
|
|
23
|
+
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
24
|
+
const chatSDK = facadeChatSDK.getChatSDK();
|
|
23
25
|
const {
|
|
24
26
|
reconnectChatProps,
|
|
25
27
|
initStartChat
|
|
@@ -55,7 +55,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
const WebChatContainerStateful = props => {
|
|
58
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2,
|
|
58
|
+
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;
|
|
59
59
|
const {
|
|
60
60
|
BasicWebChat
|
|
61
61
|
} = _botframeworkWebchat.Components;
|
|
@@ -171,6 +171,11 @@ const WebChatContainerStateful = props => {
|
|
|
171
171
|
div[class="ac-textBlock"] *,
|
|
172
172
|
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
173
173
|
|
|
174
|
+
div[class="ac-input-container"] input.ac-multichoiceInput,
|
|
175
|
+
div[class="ac-input-container"] select.ac-multichoiceInput {
|
|
176
|
+
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp7 !== void 0 && _webChatContainerProp7.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
177
|
+
}
|
|
178
|
+
|
|
174
179
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
175
180
|
background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
|
|
176
181
|
color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
|
|
@@ -180,16 +185,16 @@ const WebChatContainerStateful = props => {
|
|
|
180
185
|
div[class="ac-textBlock"] a:visited,
|
|
181
186
|
div[class="ac-textBlock"] a:hover,
|
|
182
187
|
div[class="ac-textBlock"] a:active {
|
|
183
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
188
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
|
|
184
189
|
}
|
|
185
190
|
|
|
186
|
-
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
191
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp9 === void 0 ? void 0 : _webChatContainerProp9.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
187
192
|
|
|
188
193
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
189
194
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
190
195
|
height: .75em;
|
|
191
196
|
margin-left: .25em;
|
|
192
|
-
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
197
|
+
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp10 === void 0 ? void 0 : (_webChatContainerProp11 = _webChatContainerProp10.receivedMessageAnchorStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
|
|
193
198
|
}
|
|
194
199
|
pre {
|
|
195
200
|
white-space: pre-wrap;
|
|
@@ -202,13 +207,13 @@ const WebChatContainerStateful = props => {
|
|
|
202
207
|
.ms_lcw_webchat_received_message a:visited,
|
|
203
208
|
.ms_lcw_webchat_received_message a:hover,
|
|
204
209
|
.ms_lcw_webchat_received_message a:active {
|
|
205
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
210
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
|
|
206
211
|
}
|
|
207
212
|
.ms_lcw_webchat_sent_message a:link,
|
|
208
213
|
.ms_lcw_webchat_sent_message a:visited,
|
|
209
214
|
.ms_lcw_webchat_sent_message a:hover,
|
|
210
215
|
.ms_lcw_webchat_sent_message a:active {
|
|
211
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
216
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MockChatSDK = void 0;
|
|
7
|
-
var _Constants = require("../../../common/Constants");
|
|
8
7
|
var _mockadapter = _interopRequireDefault(require("./mockadapter"));
|
|
8
|
+
var _Constants = require("../../../common/Constants");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
11
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
@@ -66,6 +66,9 @@ class MockChatSDK {
|
|
|
66
66
|
getVoiceVideoCalling() {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
+
setAuthTokenProvider() {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
69
72
|
getLiveChatConfig() {
|
|
70
73
|
return {
|
|
71
74
|
LiveWSAndLiveChatEngJoin: {
|
|
@@ -87,7 +87,8 @@ const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userM
|
|
|
87
87
|
}
|
|
88
88
|
if (isTagIncluded(card, _Constants.Constants.systemMessageTag)) {
|
|
89
89
|
return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
|
|
90
|
-
}
|
|
90
|
+
}
|
|
91
|
+
if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
|
|
91
92
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === _Constants.Constants.webchatChannelId) {
|
|
92
93
|
card.activity.text = (0, _utils.escapeHtml)(card.activity.text);
|
|
93
94
|
card.activity.channelData.isHtmlEncoded = true;
|
|
@@ -12,7 +12,7 @@ var _defaultTypingIndicatorBubbleStyles = require("./defaultStyles/defaultTyping
|
|
|
12
12
|
var _defaultTypingIndicatorContainerStyles = require("./defaultStyles/defaultTypingIndicatorContainerStyles");
|
|
13
13
|
var _defaultTypingIndicatorMessageStyles = require("./defaultStyles/defaultTypingIndicatorMessageStyles");
|
|
14
14
|
var _ = require("../../../../..");
|
|
15
|
-
var
|
|
15
|
+
var _useFacadeChatSDKStore = _interopRequireDefault(require("../../../../../hooks/useFacadeChatSDKStore"));
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
@@ -29,10 +29,10 @@ const TypingIndicator = _ref => {
|
|
|
29
29
|
activeTyping,
|
|
30
30
|
visible
|
|
31
31
|
} = _ref;
|
|
32
|
-
|
|
33
|
-
const chatSDK = (0, _useChatSDKStore.default)();
|
|
32
|
+
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
34
33
|
const [state] = (0, _.useChatContextStore)();
|
|
35
|
-
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
|
+
const debounceTyping = (0, _react.useCallback)((0, _utils.debounceLeading)(() => facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.sendTypingEvent()), []);
|
|
36
36
|
if (!activeTyping || Object.keys(activeTyping).length === 0 || ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.LiveChatVersion) === 1 && !visible) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
@@ -9,6 +9,8 @@ var _NotificationLevel = require("../enums/NotificationLevel");
|
|
|
9
9
|
var _WebChatActionType = require("../enums/WebChatActionType");
|
|
10
10
|
var _WebChatStoreLoader = require("../WebChatStoreLoader");
|
|
11
11
|
var _utils = require("../../../../common/utils");
|
|
12
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
13
|
+
var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
|
|
12
14
|
class NotificationHandler {
|
|
13
15
|
static notify(id, level, message) {
|
|
14
16
|
if (_WebChatStoreLoader.WebChatStoreLoader.store) {
|
|
@@ -34,6 +36,12 @@ class NotificationHandler {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
static notifyError(id, message) {
|
|
39
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
40
|
+
eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
|
|
41
|
+
payload: {
|
|
42
|
+
errorMessage: message
|
|
43
|
+
}
|
|
44
|
+
});
|
|
37
45
|
this.notify(id, _NotificationLevel.NotificationLevel.Error, message);
|
|
38
46
|
}
|
|
39
47
|
static notifyWarning(id, message) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FacadeChatSDKStore = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
|
|
9
|
+
const FacadeChatSDKStore = /*#__PURE__*/(0, _react.createContext)([undefined, facadeChatSDK => {}]);
|
|
10
|
+
exports.FacadeChatSDKStore = FacadeChatSDKStore;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _FacadeChatSDKStore = require("../contexts/FacadeChatSDKStore");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
const useFacadeChatSDKStore = () => {
|
|
10
|
+
const facadeChatSDK = (0, _react.useContext)(_FacadeChatSDKStore.FacadeChatSDKStore);
|
|
11
|
+
if (!facadeChatSDK) {
|
|
12
|
+
throw new Error("This hook is not called on component that is descendants of <FacadeSDKStore.Provider>, or FacadeSDKStore is not passed into LiveChatWidget component.");
|
|
13
|
+
}
|
|
14
|
+
return facadeChatSDK;
|
|
15
|
+
};
|
|
16
|
+
var _default = useFacadeChatSDKStore;
|
|
17
|
+
exports.default = _default;
|
package/lib/cjs/index.js
CHANGED
|
@@ -63,11 +63,18 @@ Object.defineProperty(exports, "useChatSDKStore", {
|
|
|
63
63
|
return _useChatSDKStore.default;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
Object.defineProperty(exports, "useFacadeChatSDKStore", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _useFacadeChatSDKStore.default;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
66
72
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
67
|
-
var _useChatContextStore = _interopRequireDefault(require("./hooks/useChatContextStore"));
|
|
68
|
-
var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore"));
|
|
69
73
|
var _utils = require("./common/utils");
|
|
70
74
|
var _ConversationState = require("./contexts/common/ConversationState");
|
|
75
|
+
var _useChatContextStore = _interopRequireDefault(require("./hooks/useChatContextStore"));
|
|
76
|
+
var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore"));
|
|
77
|
+
var _useFacadeChatSDKStore = _interopRequireDefault(require("./hooks/useFacadeChatSDKStore"));
|
|
71
78
|
var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
|
|
72
79
|
var _getMockChatSDKIfApplicable = require("./components/livechatwidget/common/getMockChatSDKIfApplicable");
|
|
73
80
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -653,7 +653,7 @@ class TranscriptHTMLBuilder {
|
|
|
653
653
|
return htmlData;
|
|
654
654
|
}
|
|
655
655
|
}
|
|
656
|
-
const createChatTranscript = async function (transcript,
|
|
656
|
+
const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
657
657
|
let renderAttachments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
658
658
|
let transcriptOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
659
659
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -680,7 +680,7 @@ const createChatTranscript = async function (transcript, chatSDK) {
|
|
|
680
680
|
id: references[0],
|
|
681
681
|
type: metadata[0].contentType
|
|
682
682
|
};
|
|
683
|
-
const blob = await
|
|
683
|
+
const blob = await facadeChatSDK.downloadFileAttachment(fileMetadata);
|
|
684
684
|
const base64 = await convertBlobToBase64(blob);
|
|
685
685
|
message.contentUrl = base64;
|
|
686
686
|
}
|