@microsoft/omnichannel-chat-widget 1.6.3-main.6248890 → 1.6.3-main.d18adce

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.
@@ -383,15 +383,20 @@ const debounceLeading = function (fn) {
383
383
 
384
384
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
385
385
  exports.debounceLeading = debounceLeading;
386
- const getConversationDetailsCall = async chatSDK => {
387
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
388
- let conversationDetails = undefined;
386
+ const getConversationDetailsCall = async function (chatSDK) {
387
+ let liveChatContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
388
+ let conversationDetails = undefined; // eslint-disable-line @typescript-eslint/no-explicit-any
389
+ const optionalParams = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
390
+
391
+ if (liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.requestId && liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.chatToken) {
392
+ optionalParams.liveChatContext = liveChatContext;
393
+ }
389
394
  try {
390
395
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
391
396
  Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallStarted,
392
397
  Description: "Conversation details call started"
393
398
  });
394
- conversationDetails = await chatSDK.getConversationDetails();
399
+ conversationDetails = await chatSDK.getConversationDetails(optionalParams);
395
400
  } catch (error) {
396
401
  checkContactIdError(error);
397
402
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
@@ -45,33 +45,38 @@ const EmailTranscriptPaneStateful = props => {
45
45
  });
46
46
  (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
47
47
  };
48
+ const onSend = (0, _react.useCallback)(async email => {
49
+ var _state$domainStates;
50
+ const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
51
+ closeEmailTranscriptPane();
52
+ const chatTranscriptBody = {
53
+ emailAddress: email,
54
+ attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
55
+ };
56
+ try {
57
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody, {
58
+ liveChatContext
59
+ }));
60
+ _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
61
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
62
+ Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
63
+ Description: "Transcript sent to email successfully."
64
+ });
65
+ } catch (ex) {
66
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
67
+ Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
68
+ ExceptionDetails: {
69
+ exception: ex
70
+ }
71
+ });
72
+ const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
73
+ _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
74
+ }
75
+ }, [props.attachmentMessage, props.bannerMessageOnError, chatSDK, state.domainStates.liveChatContext]);
48
76
  const controlProps = {
49
77
  id: "oclcw-emailTranscriptDialogContainer",
50
78
  dir: state.domainStates.globalDir,
51
- onSend: async email => {
52
- closeEmailTranscriptPane();
53
- const chatTranscriptBody = {
54
- emailAddress: email,
55
- attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
56
- };
57
- try {
58
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
59
- _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
60
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
61
- Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
62
- Description: "Transcript sent to email successfully."
63
- });
64
- } catch (ex) {
65
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
66
- Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
67
- ExceptionDetails: {
68
- exception: ex
69
- }
70
- });
71
- const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
72
- _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
73
- }
74
- },
79
+ onSend,
75
80
  onCancel: () => {
76
81
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
77
82
  Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptCancelButtonClicked,
@@ -12,6 +12,8 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
12
12
  var _createChatTranscript = _interopRequireDefault(require("../../../plugins/createChatTranscript"));
13
13
  var _dompurify = _interopRequireDefault(require("dompurify"));
14
14
  var _utils = require("../../../common/utils");
15
+ var _createReducer = require("../../../contexts/createReducer");
16
+ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
15
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
18
  const processDisplayName = displayName => {
17
19
  // if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
@@ -164,12 +166,16 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
164
166
 
165
167
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
168
  const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
167
- var _state$domainStates, _state$domainStates2, _state$domainStates2$;
168
- // Need to keep existing request id for scenarios when trnascript is downloaded after endchat
169
- const liveChatContext = {
170
- chatToken: state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.chatToken,
171
- requestId: state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.chatToken) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.requestId
172
- };
169
+ var _state$domainStates;
170
+ // Need to keep existing live chat context for scenarios when transcript is downloaded after endchat
171
+ let liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
172
+ if (!liveChatContext) {
173
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
174
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
175
+ payload: null
176
+ });
177
+ liveChatContext = inMemoryState.domainStates.liveChatContext;
178
+ }
173
179
  let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
174
180
  liveChatContext
175
181
  }));
@@ -200,10 +200,6 @@ const callingStateCleanUp = dispatch => {
200
200
  exports.callingStateCleanUp = callingStateCleanUp;
201
201
  const endChatStateCleanUp = dispatch => {
202
202
  // Need to clear these states immediately when chat ended from OC.
203
- dispatch({
204
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
205
- payload: undefined
206
- });
207
203
  dispatch({
208
204
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
209
205
  payload: undefined
@@ -248,6 +244,12 @@ const closeChatStateCleanUp = dispatch => {
248
244
  proactiveChatInNewWindow: false
249
245
  }
250
246
  });
247
+
248
+ // Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
249
+ dispatch({
250
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
251
+ payload: undefined
252
+ });
251
253
  };
252
254
 
253
255
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -315,10 +317,8 @@ const chatTokenCleanUp = async dispatch => {
315
317
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
316
318
  payload: undefined
317
319
  });
318
- dispatch({
319
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
320
- payload: undefined
321
- });
320
+
321
+ // Need to keep liveChatContext until chat is fully closed to for transcript download/email
322
322
  };
323
323
 
324
324
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -332,12 +332,14 @@ const canStartPopoutChat = async props => {
332
332
 
333
333
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
334
334
  const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
335
- var _state$domainStates6, _state$domainStates6$;
335
+ var _state$domainStates6, _state$domainStates6$, _state$domainStates7;
336
336
  const requestIdFromCache = (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.liveChatContext) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.requestId;
337
+ const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : _state$domainStates7.liveChatContext;
338
+
337
339
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
338
340
  let conversationDetails = undefined;
339
341
 
340
- //Preserve current requestId
342
+ // Preserve current requestId
341
343
  const currentRequestId = chatSDK.requestId ?? "";
342
344
  dispatch({
343
345
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID,
@@ -345,9 +347,8 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
345
347
  });
346
348
  try {
347
349
  chatSDK.requestId = requestIdFromCache;
348
- conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
350
+ conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK, liveChatContext);
349
351
  if (Object.keys(conversationDetails).length === 0) {
350
- chatSDK.requestId = currentRequestId;
351
352
  return false;
352
353
  }
353
354
  if (conversationDetails.state === _Constants.LiveWorkItemState.Closed || conversationDetails.state === _Constants.LiveWorkItemState.WrapUp) {
@@ -355,7 +356,6 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
355
356
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
356
357
  payload: undefined
357
358
  });
358
- chatSDK.requestId = currentRequestId;
359
359
  return false;
360
360
  }
361
361
  return true;
@@ -366,7 +366,6 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
366
366
  exception: `Conversation is not valid: ${error}`
367
367
  }
368
368
  });
369
- chatSDK.requestId = currentRequestId;
370
369
  return false;
371
370
  }
372
371
  };
@@ -351,15 +351,20 @@ export const debounceLeading = function (fn) {
351
351
  };
352
352
 
353
353
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
354
- export const getConversationDetailsCall = async chatSDK => {
355
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
356
- let conversationDetails = undefined;
354
+ export const getConversationDetailsCall = async function (chatSDK) {
355
+ let liveChatContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
356
+ let conversationDetails = undefined; // eslint-disable-line @typescript-eslint/no-explicit-any
357
+ const optionalParams = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
358
+
359
+ if (liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.requestId && liveChatContext !== null && liveChatContext !== void 0 && liveChatContext.chatToken) {
360
+ optionalParams.liveChatContext = liveChatContext;
361
+ }
357
362
  try {
358
363
  TelemetryHelper.logSDKEvent(LogLevel.INFO, {
359
364
  Event: TelemetryEvent.GetConversationDetailsCallStarted,
360
365
  Description: "Conversation details call started"
361
366
  });
362
- conversationDetails = await chatSDK.getConversationDetails();
367
+ conversationDetails = await chatSDK.getConversationDetails(optionalParams);
363
368
  } catch (error) {
364
369
  checkContactIdError(error);
365
370
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
@@ -1,5 +1,5 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
2
+ import React, { useCallback, useEffect, useState } from "react";
3
3
  import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, formatTemplateString, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
4
4
  import { DimLayer } from "../dimlayer/DimLayer";
5
5
  import { InputValidationPane } from "@microsoft/omnichannel-chat-components";
@@ -36,33 +36,38 @@ export const EmailTranscriptPaneStateful = props => {
36
36
  });
37
37
  setTabIndices(elements, initialTabIndexMap, true);
38
38
  };
39
+ const onSend = useCallback(async email => {
40
+ var _state$domainStates;
41
+ const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
42
+ closeEmailTranscriptPane();
43
+ const chatTranscriptBody = {
44
+ emailAddress: email,
45
+ attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
46
+ };
47
+ try {
48
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody, {
49
+ liveChatContext
50
+ }));
51
+ NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
52
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
53
+ Event: TelemetryEvent.EmailTranscriptSent,
54
+ Description: "Transcript sent to email successfully."
55
+ });
56
+ } catch (ex) {
57
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
58
+ Event: TelemetryEvent.EmailTranscriptFailed,
59
+ ExceptionDetails: {
60
+ exception: ex
61
+ }
62
+ });
63
+ const message = formatTemplateString(defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
64
+ NotificationHandler.notifyError(NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
65
+ }
66
+ }, [props.attachmentMessage, props.bannerMessageOnError, chatSDK, state.domainStates.liveChatContext]);
39
67
  const controlProps = {
40
68
  id: "oclcw-emailTranscriptDialogContainer",
41
69
  dir: state.domainStates.globalDir,
42
- onSend: async email => {
43
- closeEmailTranscriptPane();
44
- const chatTranscriptBody = {
45
- emailAddress: email,
46
- attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
47
- };
48
- try {
49
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.emailLiveChatTranscript(chatTranscriptBody));
50
- NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
51
- TelemetryHelper.logActionEvent(LogLevel.INFO, {
52
- Event: TelemetryEvent.EmailTranscriptSent,
53
- Description: "Transcript sent to email successfully."
54
- });
55
- } catch (ex) {
56
- TelemetryHelper.logActionEvent(LogLevel.ERROR, {
57
- Event: TelemetryEvent.EmailTranscriptFailed,
58
- ExceptionDetails: {
59
- exception: ex
60
- }
61
- });
62
- const message = formatTemplateString(defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
63
- NotificationHandler.notifyError(NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
64
- }
65
- },
70
+ onSend,
66
71
  onCancel: () => {
67
72
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
68
73
  Event: TelemetryEvent.EmailTranscriptCancelButtonClicked,
@@ -6,6 +6,8 @@ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryCon
6
6
  import createChatTranscript from "../../../plugins/createChatTranscript";
7
7
  import DOMPurify from "dompurify";
8
8
  import { createFileAndDownload, isNullOrUndefined } from "../../../common/utils";
9
+ import { executeReducer } from "../../../contexts/createReducer";
10
+ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
9
11
  const processDisplayName = displayName => {
10
12
  // if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
11
13
  const displayNameRegex = ".+:.+";
@@ -157,12 +159,16 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
157
159
 
158
160
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
161
  export const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
160
- var _state$domainStates, _state$domainStates2, _state$domainStates2$;
161
- // Need to keep existing request id for scenarios when trnascript is downloaded after endchat
162
- const liveChatContext = {
163
- chatToken: state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.chatToken,
164
- requestId: state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.chatToken) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.requestId
165
- };
162
+ var _state$domainStates;
163
+ // Need to keep existing live chat context for scenarios when transcript is downloaded after endchat
164
+ let liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
165
+ if (!liveChatContext) {
166
+ const inMemoryState = executeReducer(state, {
167
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
168
+ payload: null
169
+ });
170
+ liveChatContext = inMemoryState.domainStates.liveChatContext;
171
+ }
166
172
  let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
167
173
  liveChatContext
168
174
  }));
@@ -192,10 +192,6 @@ export const callingStateCleanUp = dispatch => {
192
192
  };
193
193
  export const endChatStateCleanUp = dispatch => {
194
194
  // Need to clear these states immediately when chat ended from OC.
195
- dispatch({
196
- type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
197
- payload: undefined
198
- });
199
195
  dispatch({
200
196
  type: LiveChatWidgetActionType.SET_RECONNECT_ID,
201
197
  payload: undefined
@@ -239,6 +235,12 @@ export const closeChatStateCleanUp = dispatch => {
239
235
  proactiveChatInNewWindow: false
240
236
  }
241
237
  });
238
+
239
+ // Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
240
+ dispatch({
241
+ type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
242
+ payload: undefined
243
+ });
242
244
  };
243
245
 
244
246
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -303,10 +305,8 @@ const chatTokenCleanUp = async dispatch => {
303
305
  type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
304
306
  payload: undefined
305
307
  });
306
- dispatch({
307
- type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
308
- payload: undefined
309
- });
308
+
309
+ // Need to keep liveChatContext until chat is fully closed to for transcript download/email
310
310
  };
311
311
 
312
312
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -324,12 +324,14 @@ const canStartPopoutChat = async props => {
324
324
 
325
325
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
326
  const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
327
- var _state$domainStates6, _state$domainStates6$;
327
+ var _state$domainStates6, _state$domainStates6$, _state$domainStates7;
328
328
  const requestIdFromCache = (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.liveChatContext) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.requestId;
329
+ const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : _state$domainStates7.liveChatContext;
330
+
329
331
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
330
332
  let conversationDetails = undefined;
331
333
 
332
- //Preserve current requestId
334
+ // Preserve current requestId
333
335
  const currentRequestId = chatSDK.requestId ?? "";
334
336
  dispatch({
335
337
  type: LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID,
@@ -337,9 +339,8 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
337
339
  });
338
340
  try {
339
341
  chatSDK.requestId = requestIdFromCache;
340
- conversationDetails = await getConversationDetailsCall(chatSDK);
342
+ conversationDetails = await getConversationDetailsCall(chatSDK, liveChatContext);
341
343
  if (Object.keys(conversationDetails).length === 0) {
342
- chatSDK.requestId = currentRequestId;
343
344
  return false;
344
345
  }
345
346
  if (conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
@@ -347,7 +348,6 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
347
348
  type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
348
349
  payload: undefined
349
350
  });
350
- chatSDK.requestId = currentRequestId;
351
351
  return false;
352
352
  }
353
353
  return true;
@@ -358,7 +358,6 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
358
358
  exception: `Conversation is not valid: ${error}`
359
359
  }
360
360
  });
361
- chatSDK.requestId = currentRequestId;
362
361
  return false;
363
362
  }
364
363
  };
@@ -30,7 +30,7 @@ export declare const addDelayInMs: (ms: number) => Promise<void>;
30
30
  export declare const getBroadcastChannelName: (widgetId: string, widgetInstanceId: string) => string;
31
31
  export declare const getWidgetCacheIdfromProps: (props: any, popoutChat?: boolean) => string;
32
32
  export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[]) => void;
33
- export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
33
+ export declare const getConversationDetailsCall: (chatSDK: any, liveChatContext?: any) => Promise<any>;
34
34
  export declare const checkContactIdError: (e: any) => void;
35
35
  export declare const createFileAndDownload: (fileName: string, blobData: string, mimeType: string) => void;
36
36
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.6.3-main.6248890",
3
+ "version": "1.6.3-main.d18adce",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,8 +74,8 @@
74
74
  "webpack-cli": "^4.9.2"
75
75
  },
76
76
  "dependencies": {
77
- "@microsoft/omnichannel-chat-components": "^1.1.2",
78
- "@microsoft/omnichannel-chat-sdk": "1.6.3",
77
+ "@microsoft/omnichannel-chat-components": "^1.1.3",
78
+ "@microsoft/omnichannel-chat-sdk": "1.7.0",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",
81
81
  "markdown-it": "^12.3.2",