@microsoft/omnichannel-chat-widget 1.0.6-main.ffb4e2a → 1.1.0
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 +16 -15
- 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/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -28
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +10 -2
- 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 +16 -15
- 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/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -28
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +10 -2
- 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/definitions/Contracts.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/IRenderingMiddlewareProps.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 +2 -2
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: {
|
|
@@ -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;
|
|
@@ -17,6 +17,7 @@ import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/ren
|
|
|
17
17
|
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
18
18
|
import { setFocusOnSendBox } from "../../common/utils";
|
|
19
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$adaptiveCardSt3, _props$adaptiveCardSt4, _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;
|
|
@@ -146,7 +147,14 @@ export const WebChatContainerStateful = props => {
|
|
|
146
147
|
.ms_lcw_webchat_received_message a:hover,
|
|
147
148
|
.ms_lcw_webchat_received_message a:active {
|
|
148
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)};
|
|
149
|
-
}
|
|
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, {
|
|
150
158
|
styles: containerStyles
|
|
151
159
|
}, /*#__PURE__*/React.createElement(BasicWebChat, null)));
|
|
152
160
|
};
|