@microsoft/omnichannel-chat-widget 1.0.5-main.d908c85 → 1.0.6-main.0c19ff3
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/Constants.js +1 -0
- package/lib/cjs/common/telemetry/TelemetryHelper.js +19 -17
- package/lib/cjs/common/utils.js +17 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +2 -2
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +21 -12
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
- package/lib/cjs/components/livechatwidget/common/createDownloadTranscriptProps.js +27 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -1
- package/lib/cjs/components/livechatwidget/common/startChat.js +27 -12
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -28
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +5 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +21 -11
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.js +10 -0
- package/lib/cjs/plugins/createChatTranscript.js +548 -0
- package/lib/esm/common/Constants.js +1 -0
- package/lib/esm/common/telemetry/TelemetryHelper.js +19 -17
- package/lib/esm/common/utils.js +15 -1
- package/lib/esm/components/footerstateful/FooterStateful.js +2 -2
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +22 -13
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
- package/lib/esm/components/livechatwidget/common/createDownloadTranscriptProps.js +20 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -1
- package/lib/esm/components/livechatwidget/common/startChat.js +27 -12
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -28
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +5 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +21 -11
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.js +3 -0
- package/lib/esm/plugins/createChatTranscript.js +543 -0
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +3 -3
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps.d.ts +5 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +13 -0
- package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +24 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IRenderingMiddlewareProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles.d.ts +2 -0
- package/lib/types/plugins/createChatTranscript.d.ts +2 -0
- package/package.json +3 -3
|
@@ -2,9 +2,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
4
|
import { ScenarioType, TelemetryEvent } from "./TelemetryConstants";
|
|
5
|
-
import { newGuid } from "../utils";
|
|
6
|
-
import { TelemetryManager } from "./TelemetryManager";
|
|
7
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
6
|
+
import { TelemetryManager } from "./TelemetryManager";
|
|
7
|
+
import { newGuid } from "../utils";
|
|
8
8
|
export class TelemetryHelper {
|
|
9
9
|
static buildTelemetryEvent(level, input) {
|
|
10
10
|
switch (input.scenarioType) {
|
|
@@ -30,15 +30,16 @@ export class TelemetryHelper {
|
|
|
30
30
|
static populateBasicProperties(level,
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
32
|
telemetryData) {
|
|
33
|
-
var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7;
|
|
33
|
+
var _TelemetryManager$Int, _TelemetryManager$Int2, _TelemetryManager$Int3, _TelemetryManager$Int4, _TelemetryManager$Int5, _TelemetryManager$Int6, _TelemetryManager$Int7, _TelemetryManager$Int8;
|
|
34
34
|
return {
|
|
35
35
|
WidgetId: ((_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.widgetId) ?? "",
|
|
36
36
|
ChatId: ((_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.chatId) ?? "",
|
|
37
37
|
ChannelId: ((_TelemetryManager$Int3 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int3 === void 0 ? void 0 : _TelemetryManager$Int3.channelId) ?? "lcw2.0",
|
|
38
38
|
ConversationId: ((_TelemetryManager$Int4 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int4 === void 0 ? void 0 : _TelemetryManager$Int4.conversationId) ?? "",
|
|
39
39
|
OrganizationId: ((_TelemetryManager$Int5 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int5 === void 0 ? void 0 : _TelemetryManager$Int5.orgId) ?? "",
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
OrganizationUrl: ((_TelemetryManager$Int6 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int6 === void 0 ? void 0 : _TelemetryManager$Int6.orgUrl) ?? "",
|
|
41
|
+
LCWRuntimeId: ((_TelemetryManager$Int7 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int7 === void 0 ? void 0 : _TelemetryManager$Int7.lcwRuntimeId) ?? "",
|
|
42
|
+
CurrentRequestId: ((_TelemetryManager$Int8 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int8 === void 0 ? void 0 : _TelemetryManager$Int8.currentRequestId) ?? "",
|
|
42
43
|
LogLevel: level
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -73,40 +74,41 @@ export class TelemetryHelper {
|
|
|
73
74
|
static conformToConfigValidationContract(level, input) {
|
|
74
75
|
const payload = input.payload;
|
|
75
76
|
return TelemetryHelper.populate(level, payload, event => {
|
|
76
|
-
var _TelemetryManager$
|
|
77
|
+
var _TelemetryManager$Int9, _TelemetryManager$Int10, _TelemetryManager$Int11;
|
|
77
78
|
event.Event = payload.Event;
|
|
78
79
|
event.RequestId = payload.RequestId;
|
|
79
|
-
event.LCWVersion = (_TelemetryManager$
|
|
80
|
+
event.LCWVersion = (_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : _TelemetryManager$Int9.environmentVersion;
|
|
80
81
|
event.CloudType = payload.CloudType;
|
|
81
|
-
event.Domain = (_TelemetryManager$
|
|
82
|
+
event.Domain = (_TelemetryManager$Int10 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.hostName;
|
|
82
83
|
event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
|
|
83
84
|
event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
|
|
84
|
-
event.Language = ((_TelemetryManager$
|
|
85
|
+
event.Language = ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int11 === void 0 ? void 0 : _TelemetryManager$Int11.chatWidgetLocaleLCID) || "";
|
|
85
86
|
event.Description = payload.Data;
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
static conformToLoadContract(level, input) {
|
|
89
90
|
const payload = input.payload;
|
|
90
91
|
return TelemetryHelper.populate(level, payload, event => {
|
|
91
|
-
var _TelemetryManager$
|
|
92
|
+
var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14;
|
|
92
93
|
event.Event = payload.Event;
|
|
94
|
+
event.Description = payload.Description;
|
|
93
95
|
event.ResourcePath = payload.ResourcePath;
|
|
94
96
|
event.WidgetState = payload.WidgetState;
|
|
95
97
|
event.ChatState = payload.ChatState;
|
|
96
98
|
event.ChatType = payload.ChatType;
|
|
97
99
|
event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
|
|
98
100
|
event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
|
|
99
|
-
event.OCChatSDKVersion = ((_TelemetryManager$
|
|
100
|
-
event.OCChatWidgetVersion = ((_TelemetryManager$
|
|
101
|
-
event.OCChatComponentsVersion = ((_TelemetryManager$
|
|
101
|
+
event.OCChatSDKVersion = ((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : _TelemetryManager$Int12.OCChatSDKVersion) ?? "";
|
|
102
|
+
event.OCChatWidgetVersion = ((_TelemetryManager$Int13 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.chatWidgetVersion) ?? "";
|
|
103
|
+
event.OCChatComponentsVersion = ((_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : _TelemetryManager$Int14.chatComponentVersion) ?? "";
|
|
102
104
|
});
|
|
103
105
|
}
|
|
104
106
|
static conformToIC3ClientContract(level, input) {
|
|
105
107
|
const payload = input.payload;
|
|
106
108
|
return TelemetryHelper.populate(level, payload, event => {
|
|
107
|
-
var _TelemetryManager$
|
|
109
|
+
var _TelemetryManager$Int15;
|
|
108
110
|
event.Event = payload.Event;
|
|
109
|
-
event.IC3ClientVersion = (_TelemetryManager$
|
|
111
|
+
event.IC3ClientVersion = (_TelemetryManager$Int15 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.IC3ClientVersion;
|
|
110
112
|
event.SubscriptionId = payload.SubscriptionId;
|
|
111
113
|
event.EndpointUrl = payload.EndpointUrl;
|
|
112
114
|
event.EndpointId = payload.EndpointId;
|
|
@@ -212,14 +214,14 @@ _defineProperty(TelemetryHelper, "logActionEvent", (logLevel, payload) => {
|
|
|
212
214
|
BroadcastService.postMessage(telemetryEvent);
|
|
213
215
|
});
|
|
214
216
|
_defineProperty(TelemetryHelper, "logSDKEvent", (logLevel, payload) => {
|
|
215
|
-
var _TelemetryManager$
|
|
217
|
+
var _TelemetryManager$Int16;
|
|
216
218
|
const telemetryEvent = {
|
|
217
219
|
eventName: (payload === null || payload === void 0 ? void 0 : payload.Event) ?? "",
|
|
218
220
|
logLevel: logLevel,
|
|
219
221
|
payload: {
|
|
220
222
|
...payload,
|
|
221
223
|
TransactionId: newGuid(),
|
|
222
|
-
RequestId: (_TelemetryManager$
|
|
224
|
+
RequestId: (_TelemetryManager$Int16 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : _TelemetryManager$Int16.currentRequestId
|
|
223
225
|
}
|
|
224
226
|
};
|
|
225
227
|
BroadcastService.postMessage(telemetryEvent);
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _this = this;
|
|
2
|
-
import { AriaTelemetryConstants, ChatSDKError, Constants, LocaleConstants } from "./Constants";
|
|
2
|
+
import { AriaTelemetryConstants, ChatSDKError, Constants, HtmlAttributeNames, LocaleConstants } from "./Constants";
|
|
3
3
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "./telemetry/TelemetryConstants";
|
|
4
4
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
5
5
|
import { DataStoreManager } from "./contextDataStore/DataStoreManager";
|
|
@@ -382,4 +382,18 @@ export const checkContactIdError = e => {
|
|
|
382
382
|
};
|
|
383
383
|
BroadcastService.postMessage(contactIdNotFoundErrorEvent);
|
|
384
384
|
}
|
|
385
|
+
};
|
|
386
|
+
export const createFileAndDownload = (fileName, blobData, mimeType) => {
|
|
387
|
+
const aElement = document.createElement("a");
|
|
388
|
+
const blob = new Blob([blobData], {
|
|
389
|
+
type: mimeType
|
|
390
|
+
});
|
|
391
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
392
|
+
aElement.setAttribute(HtmlAttributeNames.href, objectUrl);
|
|
393
|
+
aElement.setAttribute(HtmlAttributeNames.download, fileName);
|
|
394
|
+
aElement.setAttribute(HtmlAttributeNames.ariaHidden, "true");
|
|
395
|
+
aElement.style.display = "none";
|
|
396
|
+
document.body.appendChild(aElement);
|
|
397
|
+
aElement.click();
|
|
398
|
+
document.body.removeChild(aElement);
|
|
385
399
|
};
|
|
@@ -16,7 +16,7 @@ import useChatSDKStore from "../../hooks/useChatSDKStore";
|
|
|
16
16
|
export const FooterStateful = props => {
|
|
17
17
|
var _footerProps$controlP3, _footerProps$controlP4;
|
|
18
18
|
const [state, dispatch] = useChatContextStore();
|
|
19
|
-
// hideFooterDisplay - the purpose of this is to keep the footer always "active",
|
|
19
|
+
// hideFooterDisplay - the purpose of this is to keep the footer always "active",
|
|
20
20
|
// but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
|
|
21
21
|
// The reason for this approach is to make sure that state variables for audio notification work correctly after minimizing
|
|
22
22
|
const {
|
|
@@ -36,7 +36,7 @@ export const FooterStateful = props => {
|
|
|
36
36
|
Event: TelemetryEvent.DownloadTranscriptButtonClicked,
|
|
37
37
|
Description: "Download Transcript button clicked."
|
|
38
38
|
});
|
|
39
|
-
await downloadTranscript(chatSDK, downloadTranscriptProps
|
|
39
|
+
await downloadTranscript(chatSDK, downloadTranscriptProps, state);
|
|
40
40
|
} catch (ex) {
|
|
41
41
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
42
42
|
Event: TelemetryEvent.DownloadTranscriptFailed,
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Constants,
|
|
1
|
+
import { Constants, TranscriptConstants } from "../../../common/Constants";
|
|
2
2
|
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
3
3
|
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
4
4
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
5
5
|
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
6
|
+
import createChatTranscript from "../../../plugins/createChatTranscript";
|
|
6
7
|
import DOMPurify from "dompurify";
|
|
8
|
+
import { createFileAndDownload, isNullOrUndefined } from "../../../common/utils";
|
|
7
9
|
const processDisplayName = displayName => {
|
|
8
10
|
// if displayname matches "teamsvisitor:<some alphanumeric string>", we replace it with "Customer"
|
|
9
11
|
const displayNameRegex = ".+:.+";
|
|
@@ -154,7 +156,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
154
156
|
};
|
|
155
157
|
|
|
156
158
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
|
-
export const downloadTranscript = async (chatSDK,
|
|
159
|
+
export const downloadTranscript = async (chatSDK, downloadTranscriptProps, state) => {
|
|
158
160
|
var _state$domainStates, _state$domainStates2, _state$domainStates2$;
|
|
159
161
|
// Need to keep existing request id for scenarios when trnascript is downloaded after endchat
|
|
160
162
|
const liveChatContext = {
|
|
@@ -167,18 +169,25 @@ export const downloadTranscript = async (chatSDK, renderMarkDown, bannerMessageO
|
|
|
167
169
|
if (typeof data === Constants.String) {
|
|
168
170
|
data = JSON.parse(data);
|
|
169
171
|
}
|
|
172
|
+
const {
|
|
173
|
+
bannerMessageOnError,
|
|
174
|
+
renderMarkDown,
|
|
175
|
+
attachmentMessage,
|
|
176
|
+
webChatTranscript
|
|
177
|
+
} = downloadTranscriptProps;
|
|
170
178
|
if (data[Constants.ChatMessagesJson] !== null && data[Constants.ChatMessagesJson] !== undefined) {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
const useWebChatTranscript = isNullOrUndefined(webChatTranscript === null || webChatTranscript === void 0 ? void 0 : webChatTranscript.disabled) || (webChatTranscript === null || webChatTranscript === void 0 ? void 0 : webChatTranscript.disabled) === false;
|
|
180
|
+
if (useWebChatTranscript) {
|
|
181
|
+
const transcriptOptions = {
|
|
182
|
+
...webChatTranscript
|
|
183
|
+
};
|
|
184
|
+
await createChatTranscript(data[Constants.ChatMessagesJson], chatSDK, false, transcriptOptions);
|
|
185
|
+
} else {
|
|
186
|
+
// Legacy Transcript
|
|
187
|
+
const chatTranscripts = window.btoa(encodeURIComponent(beautifyChatTranscripts(data[Constants.ChatMessagesJson], renderMarkDown, attachmentMessage)));
|
|
188
|
+
const byteCharacters = decodeURIComponent(window.atob(chatTranscripts));
|
|
189
|
+
createFileAndDownload(TranscriptConstants.ChatTranscriptDownloadFile, byteCharacters, "text/html;charset=utf-8");
|
|
190
|
+
}
|
|
182
191
|
} else {
|
|
183
192
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
184
193
|
Event: TelemetryEvent.DownloadTranscriptResponseNullOrUndefined,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
2
|
+
const createDownloadTranscriptProps = (downloadTranscriptProps, webChatStyles, webChatContainerProps) => {
|
|
3
|
+
const disableNewLineMarkdownSupport = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.disableNewLineMarkdownSupport) ?? defaultWebChatContainerStatefulProps.disableNewLineMarkdownSupport;
|
|
4
|
+
const disableMarkdownMessageFormatting = (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.disableMarkdownMessageFormatting) ?? defaultWebChatContainerStatefulProps.disableMarkdownMessageFormatting;
|
|
5
|
+
const props = {
|
|
6
|
+
...downloadTranscriptProps,
|
|
7
|
+
webChatTranscript: {
|
|
8
|
+
...(downloadTranscriptProps === null || downloadTranscriptProps === void 0 ? void 0 : downloadTranscriptProps.webChatTranscript),
|
|
9
|
+
disableNewLineMarkdownSupport,
|
|
10
|
+
disableMarkdownMessageFormatting,
|
|
11
|
+
transcriptBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.backgroundColor,
|
|
12
|
+
agentAvatarBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleBackground,
|
|
13
|
+
agentAvatarFontColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleTextColor,
|
|
14
|
+
customerAvatarBackgroundColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleFromUserBackground,
|
|
15
|
+
customerAvatarFontColor: webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.bubbleFromUserTextColor
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return props;
|
|
19
|
+
};
|
|
20
|
+
export default createDownloadTranscriptProps;
|
|
@@ -595,7 +595,15 @@ export const dummyDefaultProps = {
|
|
|
595
595
|
downloadTranscriptProps: {
|
|
596
596
|
bannerMessageOnError: "Download transcript failed.",
|
|
597
597
|
renderMarkDown: undefined,
|
|
598
|
-
attachmentMessage: "The following attachment was uploaded during the conversation:"
|
|
598
|
+
attachmentMessage: "The following attachment was uploaded during the conversation:",
|
|
599
|
+
webChatTranscript: {
|
|
600
|
+
disabled: false,
|
|
601
|
+
fileName: "transcript",
|
|
602
|
+
pageTitle: "Customer Transcript",
|
|
603
|
+
attachmentMessage: "The following attachment was uploaded during the conversation: ",
|
|
604
|
+
networkOnlineMessage: "Connection restored. Please refresh the page",
|
|
605
|
+
networkOfflineMessage: "Network Error. Please make sure you are connected to the internet."
|
|
606
|
+
}
|
|
599
607
|
},
|
|
600
608
|
emailTranscriptPane: {
|
|
601
609
|
componentOverrides: {
|
|
@@ -55,12 +55,13 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
|
|
|
55
55
|
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
57
|
const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProactiveChat, proactiveChatEnablePrechatState, state, props) => {
|
|
58
|
+
var _props$controlProps;
|
|
58
59
|
//Handle reconnect scenario
|
|
59
60
|
|
|
60
61
|
// Getting prechat Survey Context
|
|
61
62
|
const parseToJson = false;
|
|
62
63
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
63
|
-
const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse;
|
|
64
|
+
const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
|
|
64
65
|
if (showPrechat) {
|
|
65
66
|
dispatch({
|
|
66
67
|
type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
|
|
@@ -86,13 +87,13 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
|
|
|
86
87
|
|
|
87
88
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
89
|
const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persistedState) => {
|
|
89
|
-
var _props$
|
|
90
|
+
var _props$controlProps2;
|
|
90
91
|
let isStartChatSuccessful = false;
|
|
91
92
|
const chatConfig = props === null || props === void 0 ? void 0 : props.chatConfig;
|
|
92
93
|
const getAuthToken = props === null || props === void 0 ? void 0 : props.getAuthToken;
|
|
93
|
-
const hideErrorUIPane = props === null || props === void 0 ? void 0 : (_props$
|
|
94
|
+
const hideErrorUIPane = props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.hideErrorUIPane;
|
|
94
95
|
try {
|
|
95
|
-
var _newAdapter$activity$, _TelemetryTimers$
|
|
96
|
+
var _newAdapter$activity$, _TelemetryTimers$Widg2;
|
|
96
97
|
//Start widget load timer
|
|
97
98
|
TelemetryTimers.WidgetLoadTimer = createTimer();
|
|
98
99
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
@@ -168,10 +169,16 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
171
|
if (persistedState) {
|
|
172
|
+
var _TelemetryTimers$Widg;
|
|
171
173
|
dispatch({
|
|
172
174
|
type: LiveChatWidgetActionType.SET_WIDGET_STATE,
|
|
173
175
|
payload: persistedState
|
|
174
176
|
});
|
|
177
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
178
|
+
Event: TelemetryEvent.WidgetLoadComplete,
|
|
179
|
+
Description: "Widget load complete. Persisted state retrieved",
|
|
180
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
|
|
181
|
+
});
|
|
175
182
|
await setPostChatContextAndLoadSurvey(chatSDK, dispatch, true);
|
|
176
183
|
return;
|
|
177
184
|
}
|
|
@@ -185,7 +192,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
185
192
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
186
193
|
Event: TelemetryEvent.WidgetLoadComplete,
|
|
187
194
|
Description: "Widget load complete",
|
|
188
|
-
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$
|
|
195
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg2 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg2 === void 0 ? void 0 : _TelemetryTimers$Widg2.milliSecondsElapsed
|
|
189
196
|
});
|
|
190
197
|
|
|
191
198
|
// Set post chat context in state
|
|
@@ -195,15 +202,10 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
195
202
|
// Updating chat session detail for telemetry
|
|
196
203
|
await updateSessionDataForTelemetry(chatSDK, dispatch);
|
|
197
204
|
} catch (ex) {
|
|
198
|
-
|
|
199
|
-
Event: TelemetryEvent.WidgetLoadFailed,
|
|
200
|
-
ExceptionDetails: {
|
|
201
|
-
Exception: `Widget load Failed: ${ex}`
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
NotificationHandler.notifyError(NotificationScenarios.Connection, "Start Chat Failed: " + ex);
|
|
205
|
+
var _TelemetryTimers$Widg4;
|
|
205
206
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
207
|
if (ex.message === ChatSDKError.WidgetUseOutsideOperatingHour) {
|
|
208
|
+
var _TelemetryTimers$Widg3;
|
|
207
209
|
dispatch({
|
|
208
210
|
type: LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS,
|
|
209
211
|
payload: true
|
|
@@ -212,8 +214,21 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, props, params, persi
|
|
|
212
214
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
213
215
|
payload: ConversationState.OutOfOffice
|
|
214
216
|
});
|
|
217
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
218
|
+
Event: TelemetryEvent.WidgetLoadComplete,
|
|
219
|
+
Description: "Widget load complete. Widget is OOOH.",
|
|
220
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
221
|
+
});
|
|
215
222
|
return;
|
|
216
223
|
}
|
|
224
|
+
TelemetryHelper.logLoadingEvent(LogLevel.ERROR, {
|
|
225
|
+
Event: TelemetryEvent.WidgetLoadFailed,
|
|
226
|
+
ExceptionDetails: {
|
|
227
|
+
Exception: `Widget load Failed: ${ex}`
|
|
228
|
+
},
|
|
229
|
+
ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
230
|
+
});
|
|
231
|
+
NotificationHandler.notifyError(NotificationScenarios.Connection, "Start Chat Failed: " + ex);
|
|
217
232
|
dispatch({
|
|
218
233
|
type: LiveChatWidgetActionType.SET_START_CHAT_FAILING,
|
|
219
234
|
payload: true
|
|
@@ -15,6 +15,7 @@ import CallingContainerStateful from "../../callingcontainerstateful/CallingCont
|
|
|
15
15
|
import ChatButtonStateful from "../../chatbuttonstateful/ChatButtonStateful";
|
|
16
16
|
import ConfirmationPaneStateful from "../../confirmationpanestateful/ConfirmationPaneStateful";
|
|
17
17
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
18
|
+
import createDownloadTranscriptProps from "../common/createDownloadTranscriptProps";
|
|
18
19
|
import { DataStoreManager } from "../../../common/contextDataStore/DataStoreManager";
|
|
19
20
|
import { ElementType } from "@microsoft/omnichannel-chat-components";
|
|
20
21
|
import EmailTranscriptPaneStateful from "../../emailtranscriptpanestateful/EmailTranscriptPaneStateful";
|
|
@@ -49,7 +50,7 @@ import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
|
49
50
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
50
51
|
import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
51
52
|
export const LiveChatWidgetStateful = props => {
|
|
52
|
-
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6,
|
|
53
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$contro10, _livechatProps$compon8, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$compon11, _livechatProps$compon12;
|
|
53
54
|
const [state, dispatch] = useChatContextStore();
|
|
54
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
56
|
const [adapter, setAdapter] = useChatAdapterStore();
|
|
@@ -545,12 +546,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
545
546
|
if (state.appStates.conversationState === ConversationState.Active &&
|
|
546
547
|
props.controlProps?.hideStartChatButton === true) {
|
|
547
548
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
548
|
-
|
|
549
|
-
window.onbeforeunload = function () {
|
|
549
|
+
window.onbeforeunload = function () {
|
|
550
550
|
const prompt = Constants.BrowserUnloadConfirmationMessage;
|
|
551
551
|
return prompt;
|
|
552
552
|
};
|
|
553
|
-
|
|
553
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
554
554
|
window.onunload = function () {
|
|
555
555
|
initiateEndChatOnBrowserUnload();
|
|
556
556
|
};
|
|
@@ -601,55 +601,63 @@ export const LiveChatWidgetStateful = props => {
|
|
|
601
601
|
const confirmationPaneProps = initConfirmationPropsComposer(props);
|
|
602
602
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
603
603
|
const prepareEndChatRelay = () => prepareEndChat(props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, uwid.current);
|
|
604
|
+
const downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
|
|
605
|
+
...(defaultWebChatContainerStatefulProps === null || defaultWebChatContainerStatefulProps === void 0 ? void 0 : defaultWebChatContainerStatefulProps.webChatStyles),
|
|
606
|
+
...((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.webChatStyles)
|
|
607
|
+
}, props.webChatContainerProps);
|
|
608
|
+
const livechatProps = {
|
|
609
|
+
...props,
|
|
610
|
+
downloadTranscriptProps
|
|
611
|
+
};
|
|
604
612
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
605
613
|
::-webkit-scrollbar {
|
|
606
614
|
width: ${scrollbarProps.width};
|
|
607
615
|
}
|
|
608
|
-
|
|
616
|
+
|
|
609
617
|
::-webkit-scrollbar-track {
|
|
610
618
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
611
619
|
}
|
|
612
|
-
|
|
620
|
+
|
|
613
621
|
::-webkit-scrollbar-thumb {
|
|
614
622
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
615
623
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
616
624
|
}
|
|
617
|
-
|
|
625
|
+
|
|
618
626
|
::-webkit-scrollbar-thumb:hover {
|
|
619
627
|
background: ${scrollbarProps.thumbHoverColor};
|
|
620
|
-
}
|
|
628
|
+
}
|
|
621
629
|
`), /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
622
630
|
styleOptions: webChatStyles,
|
|
623
|
-
directLine: ((
|
|
631
|
+
directLine: ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
|
|
624
632
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
625
633
|
id: widgetElementId,
|
|
626
634
|
styles: generalStyles,
|
|
627
|
-
className: (
|
|
628
|
-
}, !((
|
|
629
|
-
buttonProps:
|
|
630
|
-
outOfOfficeButtonProps:
|
|
635
|
+
className: (_livechatProps$styleP = livechatProps.styleProps) === null || _livechatProps$styleP === void 0 ? void 0 : _livechatProps$styleP.className
|
|
636
|
+
}, !((_livechatProps$contro = livechatProps.controlProps) !== null && _livechatProps$contro !== void 0 && _livechatProps$contro.hideChatButton) && !((_livechatProps$contro2 = livechatProps.controlProps) !== null && _livechatProps$contro2 !== void 0 && _livechatProps$contro2.hideStartChatButton) && shouldShowChatButton(state) && (decodeComponentString((_livechatProps$compon = livechatProps.componentOverrides) === null || _livechatProps$compon === void 0 ? void 0 : _livechatProps$compon.chatButton) || /*#__PURE__*/React.createElement(ChatButtonStateful, {
|
|
637
|
+
buttonProps: livechatProps.chatButtonProps,
|
|
638
|
+
outOfOfficeButtonProps: livechatProps.outOfOfficeChatButtonProps,
|
|
631
639
|
startChat: prepareStartChatRelay
|
|
632
|
-
})), !((
|
|
633
|
-
proactiveChatProps:
|
|
640
|
+
})), !((_livechatProps$contro3 = livechatProps.controlProps) !== null && _livechatProps$contro3 !== void 0 && _livechatProps$contro3.hideProactiveChatPane) && shouldShowProactiveChatPane(state) && (decodeComponentString((_livechatProps$compon2 = livechatProps.componentOverrides) === null || _livechatProps$compon2 === void 0 ? void 0 : _livechatProps$compon2.proactiveChatPane) || /*#__PURE__*/React.createElement(ProactiveChatPaneStateful, {
|
|
641
|
+
proactiveChatProps: livechatProps.proactiveChatPaneProps,
|
|
634
642
|
startChat: prepareStartChatRelay
|
|
635
|
-
})), !((
|
|
636
|
-
headerProps:
|
|
637
|
-
outOfOfficeHeaderProps:
|
|
643
|
+
})), !((_livechatProps$contro4 = livechatProps.controlProps) !== null && _livechatProps$contro4 !== void 0 && _livechatProps$contro4.hideHeader) && shouldShowHeader(state) && (decodeComponentString((_livechatProps$compon3 = livechatProps.componentOverrides) === null || _livechatProps$compon3 === void 0 ? void 0 : _livechatProps$compon3.header) || /*#__PURE__*/React.createElement(HeaderStateful, {
|
|
644
|
+
headerProps: livechatProps.headerProps,
|
|
645
|
+
outOfOfficeHeaderProps: livechatProps.outOfOfficeHeaderProps,
|
|
638
646
|
endChat: endChatRelay
|
|
639
|
-
})), !((
|
|
640
|
-
loadingPaneProps:
|
|
641
|
-
startChatErrorPaneProps:
|
|
642
|
-
})), !((
|
|
643
|
-
reconnectChatProps:
|
|
647
|
+
})), !((_livechatProps$contro5 = livechatProps.controlProps) !== null && _livechatProps$contro5 !== void 0 && _livechatProps$contro5.hideLoadingPane) && shouldShowLoadingPane(state) && (decodeComponentString((_livechatProps$compon4 = livechatProps.componentOverrides) === null || _livechatProps$compon4 === void 0 ? void 0 : _livechatProps$compon4.loadingPane) || /*#__PURE__*/React.createElement(LoadingPaneStateful, {
|
|
648
|
+
loadingPaneProps: livechatProps.loadingPaneProps,
|
|
649
|
+
startChatErrorPaneProps: livechatProps.startChatErrorPaneProps
|
|
650
|
+
})), !((_livechatProps$contro6 = livechatProps.controlProps) !== null && _livechatProps$contro6 !== void 0 && _livechatProps$contro6.hideOutOfOfficeHoursPane) && shouldShowOutOfOfficeHoursPane(state) && (decodeComponentString((_livechatProps$compon5 = livechatProps.componentOverrides) === null || _livechatProps$compon5 === void 0 ? void 0 : _livechatProps$compon5.outOfOfficeHoursPane) || /*#__PURE__*/React.createElement(OutOfOfficeHoursPaneStateful, livechatProps.outOfOfficeHoursPaneProps)), !((_livechatProps$contro7 = livechatProps.controlProps) !== null && _livechatProps$contro7 !== void 0 && _livechatProps$contro7.hideReconnectChatPane) && shouldShowReconnectChatPane(state) && (decodeComponentString((_livechatProps$compon6 = livechatProps.componentOverrides) === null || _livechatProps$compon6 === void 0 ? void 0 : _livechatProps$compon6.reconnectChatPane) || /*#__PURE__*/React.createElement(ReconnectChatPaneStateful, {
|
|
651
|
+
reconnectChatProps: livechatProps.reconnectChatPaneProps,
|
|
644
652
|
initStartChat: initStartChatRelay
|
|
645
|
-
})), !((
|
|
646
|
-
surveyProps:
|
|
653
|
+
})), !((_livechatProps$contro8 = livechatProps.controlProps) !== null && _livechatProps$contro8 !== void 0 && _livechatProps$contro8.hidePreChatSurveyPane) && shouldShowPreChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon7 = livechatProps.componentOverrides) === null || _livechatProps$compon7 === void 0 ? void 0 : _livechatProps$compon7.preChatSurveyPane) || /*#__PURE__*/React.createElement(PreChatSurveyPaneStateful, {
|
|
654
|
+
surveyProps: livechatProps.preChatSurveyPaneProps,
|
|
647
655
|
initStartChat: initStartChatRelay
|
|
648
|
-
})), !((
|
|
656
|
+
})), !((_livechatProps$contro9 = livechatProps.controlProps) !== null && _livechatProps$contro9 !== void 0 && _livechatProps$contro9.hideCallingContainer) && shouldShowCallingContainer(state) && /*#__PURE__*/React.createElement(CallingContainerStateful, _extends({
|
|
649
657
|
voiceVideoCallingSdk: voiceVideoCallingSDK
|
|
650
|
-
},
|
|
658
|
+
}, livechatProps.callingContainerProps)), !((_livechatProps$contro10 = livechatProps.controlProps) !== null && _livechatProps$contro10 !== void 0 && _livechatProps$contro10.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon8 = livechatProps.componentOverrides) === null || _livechatProps$compon8 === void 0 ? void 0 : _livechatProps$compon8.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps.webChatContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
|
|
651
659
|
setPostChatContext: setPostChatContextRelay,
|
|
652
660
|
prepareEndChat: prepareEndChatRelay
|
|
653
|
-
}))), !((
|
|
661
|
+
}))), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane)))));
|
|
654
662
|
};
|
|
655
663
|
export default LiveChatWidgetStateful;
|
|
@@ -113,6 +113,12 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
113
113
|
const current = children[index];
|
|
114
114
|
if (current && current.className == HtmlAttributeNames.adaptiveCardTextBlockClassName) {
|
|
115
115
|
value = current.innerHTML;
|
|
116
|
+
if (current.childElementCount > 0) {
|
|
117
|
+
const paragraph = current.children[0];
|
|
118
|
+
if (paragraph.tagName.toLowerCase() == HtmlAttributeNames.pTagName) {
|
|
119
|
+
value = paragraph.innerHTML;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
if (current && current.tagName.toLowerCase() == HtmlAttributeNames.div && current.childElementCount > 0) {
|
|
118
124
|
const input = current.children[0].children;
|
|
@@ -53,9 +53,13 @@ export const ProactiveChatPaneStateful = props => {
|
|
|
53
53
|
Description: "Proactive chat accepted."
|
|
54
54
|
});
|
|
55
55
|
if (state.appStates.proactiveChatStates.proactiveChatInNewWindow) {
|
|
56
|
+
var _state$appStates, _state$appStates$proa;
|
|
56
57
|
// TODO: BroadcastService: replace with the sdk broadcast service, when in place
|
|
57
58
|
const startPopoutChatEvent = {
|
|
58
|
-
eventName: BroadcastEvent.ProactiveChatStartPopoutChat
|
|
59
|
+
eventName: BroadcastEvent.ProactiveChatStartPopoutChat,
|
|
60
|
+
payload: {
|
|
61
|
+
enablePrechat: (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : (_state$appStates$proa = _state$appStates.proactiveChatStates) === null || _state$appStates$proa === void 0 ? void 0 : _state$appStates$proa.proactiveChatEnablePrechat) === true
|
|
62
|
+
}
|
|
59
63
|
};
|
|
60
64
|
BroadcastService.postMessage(startPopoutChatEvent);
|
|
61
65
|
dispatch({
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { Stack } from "@fluentui/react";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
|
|
5
5
|
import { BroadcastChannel } from "broadcast-channel";
|
|
6
|
+
import { Components } from "botframework-webchat";
|
|
7
|
+
import { Constants } from "../../common/Constants";
|
|
6
8
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
7
9
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
8
|
-
import { defaultMiddlewareLocalizedTexts } from "./common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
9
|
-
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
10
|
-
import { setFocusOnSendBox } from "../../common/utils";
|
|
11
|
-
import { useChatContextStore } from "../..";
|
|
12
10
|
import { WebChatActionType } from "./webchatcontroller/enums/WebChatActionType";
|
|
13
11
|
import { WebChatStoreLoader } from "./webchatcontroller/WebChatStoreLoader";
|
|
14
|
-
import { Constants } from "../../common/Constants";
|
|
15
|
-
import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
|
|
16
12
|
import { defaultAdaptiveCardStyles } from "./common/defaultStyles/defaultAdaptiveCardStyles";
|
|
13
|
+
import { defaultMiddlewareLocalizedTexts } from "./common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
17
14
|
import { defaultReceivedMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles";
|
|
18
|
-
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
19
15
|
import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
|
|
16
|
+
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
17
|
+
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
18
|
+
import { setFocusOnSendBox } from "../../common/utils";
|
|
19
|
+
import { useChatContextStore } from "../..";
|
|
20
|
+
import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSentMessageAnchorStyles";
|
|
20
21
|
const broadcastChannelMessageEvent = "message";
|
|
21
22
|
const postActivity = activity => {
|
|
22
23
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -43,7 +44,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
43
44
|
};
|
|
44
45
|
};
|
|
45
46
|
export const WebChatContainerStateful = props => {
|
|
46
|
-
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8;
|
|
47
|
+
var _props$adaptiveCardSt, _props$renderingMiddl, _props$renderingMiddl2, _props$renderingMiddl3, _props$renderingMiddl4, _props$adaptiveCardSt2, _props$adaptiveCardSt3, _props$adaptiveCardSt4, _props$renderingMiddl5, _props$renderingMiddl6, _props$renderingMiddl7, _props$renderingMiddl8, _props$renderingMiddl9, _props$renderingMiddl10;
|
|
47
48
|
const {
|
|
48
49
|
BasicWebChat
|
|
49
50
|
} = Components;
|
|
@@ -124,7 +125,9 @@ export const WebChatContainerStateful = props => {
|
|
|
124
125
|
max-width: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl3 = props.renderingMiddlewareProps) === null || _props$renderingMiddl3 === void 0 ? void 0 : (_props$renderingMiddl4 = _props$renderingMiddl3.systemMessageBoxStyles) === null || _props$renderingMiddl4 === void 0 ? void 0 : _props$renderingMiddl4.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
div[class="ac-textBlock"]>p{color:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt2 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt2 === void 0 ? void 0 : _props$adaptiveCardSt2.color) ?? defaultAdaptiveCardStyles.color};}
|
|
128
|
+
div[class="ac-textBlock"]>p{color:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt2 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt2 === void 0 ? void 0 : _props$adaptiveCardSt2.color) ?? defaultAdaptiveCardStyles.color}; white-space:${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt3 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt3 === void 0 ? void 0 : _props$adaptiveCardSt3.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
129
|
+
|
|
130
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(props === null || props === void 0 ? void 0 : (_props$adaptiveCardSt4 = props.adaptiveCardStyles) === null || _props$adaptiveCardSt4 === void 0 ? void 0 : _props$adaptiveCardSt4.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
128
131
|
|
|
129
132
|
.ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
|
|
130
133
|
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
|
|
@@ -144,7 +147,14 @@ export const WebChatContainerStateful = props => {
|
|
|
144
147
|
.ms_lcw_webchat_received_message a:hover,
|
|
145
148
|
.ms_lcw_webchat_received_message a:active {
|
|
146
149
|
color: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl7 = props.renderingMiddlewareProps) === null || _props$renderingMiddl7 === void 0 ? void 0 : (_props$renderingMiddl8 = _props$renderingMiddl7.receivedMessageAnchorStyles) === null || _props$renderingMiddl8 === void 0 ? void 0 : _props$renderingMiddl8.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
147
|
-
}
|
|
150
|
+
}
|
|
151
|
+
.ms_lcw_webchat_sent_message a:link,
|
|
152
|
+
.ms_lcw_webchat_sent_message a:visited,
|
|
153
|
+
.ms_lcw_webchat_sent_message a:hover,
|
|
154
|
+
.ms_lcw_webchat_sent_message a:active {
|
|
155
|
+
color: ${(props === null || props === void 0 ? void 0 : (_props$renderingMiddl9 = props.renderingMiddlewareProps) === null || _props$renderingMiddl9 === void 0 ? void 0 : (_props$renderingMiddl10 = _props$renderingMiddl9.sentMessageAnchorStyles) === null || _props$renderingMiddl10 === void 0 ? void 0 : _props$renderingMiddl10.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
156
|
+
}
|
|
157
|
+
`), /*#__PURE__*/React.createElement(Stack, {
|
|
148
158
|
styles: containerStyles
|
|
149
159
|
}, /*#__PURE__*/React.createElement(BasicWebChat, null)));
|
|
150
160
|
};
|