@microsoft/omnichannel-chat-widget 1.6.3-main.24dce14 → 1.6.3-main.28c9415

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.
@@ -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"
@@ -165,8 +167,15 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
165
167
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
168
  const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
167
169
  var _state$domainStates;
168
- // Need to keep existing live chat context for scenarios when trnascript is downloaded after endchat
169
- const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
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
+ }
170
179
  let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
171
180
  liveChatContext
172
181
  }));
@@ -31,7 +31,7 @@ const defaultMiddlewareLocalizedTexts = {
31
31
  MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
32
32
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
33
33
  MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
34
- THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
34
+ THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
35
35
  MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
36
36
  MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
37
37
  MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
@@ -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 = ".+:.+";
@@ -158,8 +160,15 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
158
160
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
161
  export const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
160
162
  var _state$domainStates;
161
- // Need to keep existing live chat context for scenarios when trnascript is downloaded after endchat
162
- const liveChatContext = state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.liveChatContext;
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
+ }
163
172
  let data = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getLiveChatTranscript({
164
173
  liveChatContext
165
174
  }));
@@ -25,7 +25,7 @@ export const defaultMiddlewareLocalizedTexts = {
25
25
  MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
26
26
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
27
27
  MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
28
- THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Third party cookies are blocked. Reloading this page will start a new conversation.",
28
+ THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
29
29
  MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
30
30
  MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
31
31
  MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.6.3-main.24dce14",
3
+ "version": "1.6.3-main.28c9415",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@microsoft/omnichannel-chat-components": "^1.1.3",
78
- "@microsoft/omnichannel-chat-sdk": "1.7.0",
78
+ "@microsoft/omnichannel-chat-sdk": "^1.7.2",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",
81
81
  "markdown-it": "^12.3.2",