@microsoft/omnichannel-chat-widget 1.7.4-main.0574a04 → 1.7.4-main.1f61ac6
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 +6 -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 +4 -5
- 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 +21 -22
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +3 -3
- 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 +48 -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 +43 -39
- 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/common/mockchatsdk.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- 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 +6 -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 +4 -5
- 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 +21 -22
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +3 -3
- 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 +49 -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 +43 -39
- 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/common/mockchatsdk.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +4 -4
- 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 +7 -1
- 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/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 +2 -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,11 +147,11 @@ 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
|
}
|
|
@@ -171,7 +171,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
171
171
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
172
172
|
payload: null
|
|
173
173
|
});
|
|
174
|
-
await (0, _startChat.setPreChatAndInitiateChat)(
|
|
174
|
+
await (0, _startChat.setPreChatAndInitiateChat)(facadeChatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
175
175
|
}
|
|
176
176
|
return;
|
|
177
177
|
} else {
|
|
@@ -241,7 +241,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
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) {
|
|
244
|
-
(0, _initCallingSdk.initCallingSdk)(
|
|
244
|
+
(0, _initCallingSdk.initCallingSdk)(facadeChatSDK, setVoiceVideoCallingSDK).then(sdkCreated => {
|
|
245
245
|
sdkCreated && dispatch({
|
|
246
246
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
247
247
|
payload: true
|
|
@@ -273,9 +273,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
273
273
|
(0, _react2.useEffect)(() => {
|
|
274
274
|
var _state$appStates6;
|
|
275
275
|
if ((state === null || state === void 0 ? void 0 : (_state$appStates6 = state.appStates) === null || _state$appStates6 === void 0 ? void 0 : _state$appStates6.hideStartChatButton) === true) {
|
|
276
|
-
var _props$chatConfig3, _props$chatConfig3$Li;
|
|
276
|
+
var _props$chatConfig3, _props$chatConfig3$Li, _props$chatConfig4, _props$chatConfig4$Li;
|
|
277
277
|
//handle OOH pane
|
|
278
|
-
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") {
|
|
279
279
|
dispatch({
|
|
280
280
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
281
281
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
@@ -298,7 +298,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
298
298
|
|
|
299
299
|
// useEffect for custom context
|
|
300
300
|
(0, _react2.useEffect)(() => {
|
|
301
|
-
var
|
|
301
|
+
var _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _facadeChatSDK$getCha6, _props$controlProps11;
|
|
302
302
|
// Add the custom context on receiving the SetCustomContext event
|
|
303
303
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.SetCustomContext).subscribe(msg => {
|
|
304
304
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -351,7 +351,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
351
351
|
if (callInProgress.current === false && dateNow - lastLWICheckTimeRef.current > _Constants.Constants.LWICheckOnVisibilityTimeout) {
|
|
352
352
|
lastLWICheckTimeRef.current = dateNow;
|
|
353
353
|
callInProgress.current = true;
|
|
354
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
354
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
355
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) {
|
|
356
356
|
dispatch({
|
|
357
357
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
@@ -367,11 +367,15 @@ const LiveChatWidgetStateful = props => {
|
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
369
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.NetworkReconnected).subscribe(async () => {
|
|
370
|
-
var _window2, _window2$location;
|
|
371
|
-
|
|
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) {
|
|
372
376
|
return;
|
|
373
377
|
}
|
|
374
|
-
const conversationDetails = await (0, _utils.getConversationDetailsCall)(
|
|
378
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
375
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) {
|
|
376
380
|
dispatch({
|
|
377
381
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
|
|
@@ -405,9 +409,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
405
409
|
|
|
406
410
|
// Start chat from SDK Event
|
|
407
411
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
|
|
408
|
-
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;
|
|
409
413
|
// If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
|
|
410
|
-
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") {
|
|
411
415
|
(state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
|
|
412
416
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
413
417
|
payload: false
|
|
@@ -444,16 +448,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
444
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;
|
|
445
449
|
|
|
446
450
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
447
|
-
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) {
|
|
448
452
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
449
453
|
eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
|
|
450
454
|
});
|
|
451
|
-
(0, _startChat.prepareStartChat)(props,
|
|
455
|
+
(0, _startChat.prepareStartChat)(props, facadeChatSDK, inMemoryState, dispatch, setAdapter);
|
|
452
456
|
return;
|
|
453
457
|
}
|
|
454
458
|
|
|
455
459
|
// If minimized, maximize the chat
|
|
456
|
-
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) {
|
|
457
461
|
var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
|
|
458
462
|
dispatch({
|
|
459
463
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -500,7 +504,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
500
504
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
501
505
|
Description: _Constants.PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
502
506
|
});
|
|
503
|
-
(0, _endChat.endChat)(props,
|
|
507
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
504
508
|
}
|
|
505
509
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
506
510
|
eventName: _TelemetryConstants.BroadcastEvent.CloseChat
|
|
@@ -513,7 +517,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
513
517
|
});
|
|
514
518
|
|
|
515
519
|
// Listen to end chat event from other tabs
|
|
516
|
-
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) ?? "");
|
|
517
521
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
518
522
|
var _msg$payload10;
|
|
519
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) {
|
|
@@ -521,9 +525,9 @@ const LiveChatWidgetStateful = props => {
|
|
|
521
525
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
522
526
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
523
527
|
});
|
|
524
|
-
(0, _endChat.endChat)(props,
|
|
528
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, false);
|
|
525
529
|
(0, _endChat.endChatStateCleanUp)(dispatch);
|
|
526
|
-
(0, _endChat.chatSDKStateCleanUp)(
|
|
530
|
+
(0, _endChat.chatSDKStateCleanUp)(facadeChatSDK.getChatSDK());
|
|
527
531
|
return;
|
|
528
532
|
}
|
|
529
533
|
});
|
|
@@ -565,7 +569,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
565
569
|
(0, _react2.useEffect)(() => {
|
|
566
570
|
// On new message
|
|
567
571
|
if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
568
|
-
|
|
572
|
+
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onNewMessage(() => {
|
|
569
573
|
// Track the message count
|
|
570
574
|
currentMessageCountRef.current++;
|
|
571
575
|
dispatch({
|
|
@@ -653,7 +657,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
653
657
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
654
658
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
655
659
|
});
|
|
656
|
-
(0, _endChat.endChat)(props,
|
|
660
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, true, false, true);
|
|
657
661
|
return;
|
|
658
662
|
}
|
|
659
663
|
|
|
@@ -663,7 +667,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
663
667
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
664
668
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
665
669
|
});
|
|
666
|
-
(0, _endChat.endChat)(props,
|
|
670
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
667
671
|
return;
|
|
668
672
|
}
|
|
669
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) {
|
|
@@ -674,7 +678,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
674
678
|
}
|
|
675
679
|
|
|
676
680
|
// All other cases
|
|
677
|
-
(0, _endChat.prepareEndChat)(props,
|
|
681
|
+
(0, _endChat.prepareEndChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
678
682
|
}, [state === null || state === void 0 ? void 0 : (_state$appStates14 = state.appStates) === null || _state$appStates14 === void 0 ? void 0 : _state$appStates14.conversationEndedBy]);
|
|
679
683
|
|
|
680
684
|
// Publish chat widget state
|
|
@@ -707,13 +711,13 @@ const LiveChatWidgetStateful = props => {
|
|
|
707
711
|
|
|
708
712
|
// Handle Chat disconnect cases
|
|
709
713
|
(0, _react2.useEffect)(() => {
|
|
710
|
-
var _inMemoryState$
|
|
714
|
+
var _inMemoryState$appSta6;
|
|
711
715
|
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
712
716
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
713
717
|
payload: null
|
|
714
718
|
});
|
|
715
719
|
(0, _chatDisconnectHelper.handleChatDisconnect)(props, inMemoryState, setWebChatStyles);
|
|
716
|
-
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;
|
|
717
721
|
if (chatDisconnectState && adapter) {
|
|
718
722
|
try {
|
|
719
723
|
adapter.end();
|
|
@@ -745,7 +749,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
745
749
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
746
750
|
Description: _Constants.PrepareEndChatDescriptionConstants.BrowserUnload
|
|
747
751
|
});
|
|
748
|
-
(0, _endChat.endChat)(props,
|
|
752
|
+
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, false);
|
|
749
753
|
// Clean local storage
|
|
750
754
|
(_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.removeData(widgetStateEventId);
|
|
751
755
|
|
|
@@ -758,16 +762,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
758
762
|
eventName: _TelemetryConstants.BroadcastEvent.ClosePopoutWindow
|
|
759
763
|
});
|
|
760
764
|
};
|
|
761
|
-
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(
|
|
765
|
+
const setPostChatContextRelay = () => (0, _setPostChatContextAndLoadSurvey.setPostChatContextAndLoadSurvey)(facadeChatSDK, dispatch);
|
|
762
766
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
763
|
-
const endChatRelay = (adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => (0, _endChat.endChat)(props,
|
|
764
|
-
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);
|
|
765
769
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
766
|
-
const initStartChatRelay = (optionalParams, persistedState) => (0, _startChat.initStartChat)(
|
|
770
|
+
const initStartChatRelay = (optionalParams, persistedState) => (0, _startChat.initStartChat)(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams, persistedState);
|
|
767
771
|
const confirmationPaneProps = (0, _initConfirmationPropsComposer.initConfirmationPropsComposer)(props);
|
|
768
772
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
769
|
-
const prepareEndChatRelay = () => (0, _endChat.prepareEndChat)(props,
|
|
770
|
-
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);
|
|
771
775
|
const downloadTranscriptProps = (0, _createDownloadTranscriptProps.default)(props.downloadTranscriptProps, {
|
|
772
776
|
...(_defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === null || _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps === void 0 ? void 0 : _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles),
|
|
773
777
|
...((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.webChatStyles)
|
|
@@ -793,7 +797,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
793
797
|
};
|
|
794
798
|
|
|
795
799
|
// Add 'omnichannel-chat-widget' OC User Agent if not already set
|
|
796
|
-
(0, _utils.setOcUserAgent)(
|
|
800
|
+
(0, _utils.setOcUserAgent)(facadeChatSDK.getChatSDK());
|
|
797
801
|
const directLine = ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.directLine;
|
|
798
802
|
const userID = directLine.getState ? directLine === null || directLine === void 0 ? void 0 : directLine.getState("acs.userId") : "teamsvisitor";
|
|
799
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
|
|
@@ -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: {
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|