@microsoft/omnichannel-chat-widget 1.0.5 → 1.0.6-main.886ccec
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 +13 -9
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- 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 +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 +13 -9
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +6 -0
- 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/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/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 +1 -1
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, _props$styleProps2, _props$controlProps11, _props$controlProps12, _props$componentOverr, _props$controlProps13, _props$componentOverr2, _props$controlProps14, _props$componentOverr3, _props$controlProps15, _props$componentOverr4, _props$controlProps16, _props$componentOverr5, _props$controlProps17, _props$componentOverr6, _props$controlProps18, _props$componentOverr7, _props$controlProps19, _props$controlProps20, _props$componentOverr8, _props$controlProps21, _props$componentOverr9, _props$controlProps22, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
53
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _state$appStates7, _props$webChatContain5, _state$appStates14, _props$webChatContain6, _props$webChatContain7, _props$styleProps2, _props$controlProps11, _props$controlProps12, _props$componentOverr, _props$controlProps13, _props$componentOverr2, _props$controlProps14, _props$componentOverr3, _props$controlProps15, _props$componentOverr4, _props$controlProps16, _props$componentOverr5, _props$controlProps17, _props$componentOverr6, _props$controlProps18, _props$componentOverr7, _props$controlProps19, _props$controlProps20, _props$componentOverr8, _props$controlProps21, _props$componentOverr9, _props$controlProps22, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
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,26 +601,30 @@ 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
|
+
props.downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
|
|
605
|
+
...defaultWebChatContainerStatefulProps.webChatStyles,
|
|
606
|
+
...((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.webChatStyles)
|
|
607
|
+
}, props.webChatContainerProps);
|
|
604
608
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
605
609
|
::-webkit-scrollbar {
|
|
606
610
|
width: ${scrollbarProps.width};
|
|
607
611
|
}
|
|
608
|
-
|
|
612
|
+
|
|
609
613
|
::-webkit-scrollbar-track {
|
|
610
614
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
611
615
|
}
|
|
612
|
-
|
|
616
|
+
|
|
613
617
|
::-webkit-scrollbar-thumb {
|
|
614
618
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
615
619
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
616
620
|
}
|
|
617
|
-
|
|
621
|
+
|
|
618
622
|
::-webkit-scrollbar-thumb:hover {
|
|
619
623
|
background: ${scrollbarProps.thumbHoverColor};
|
|
620
|
-
}
|
|
624
|
+
}
|
|
621
625
|
`), /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
622
626
|
styleOptions: webChatStyles,
|
|
623
|
-
directLine: ((_props$
|
|
627
|
+
directLine: ((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
|
|
624
628
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
625
629
|
id: widgetElementId,
|
|
626
630
|
styles: generalStyles,
|
|
@@ -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;
|
|
@@ -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
|
};
|