@microsoft/omnichannel-chat-widget 1.0.5 → 1.0.6-main.ec7a5f0

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.
Files changed (29) hide show
  1. package/lib/cjs/common/utils.js +17 -2
  2. package/lib/cjs/components/footerstateful/FooterStateful.js +2 -2
  3. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +21 -12
  4. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
  5. package/lib/cjs/components/livechatwidget/common/createDownloadTranscriptProps.js +27 -0
  6. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -1
  7. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +13 -9
  8. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +12 -10
  9. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
  10. package/lib/cjs/plugins/createChatTranscript.js +548 -0
  11. package/lib/esm/common/utils.js +15 -1
  12. package/lib/esm/components/footerstateful/FooterStateful.js +2 -2
  13. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +22 -13
  14. package/lib/esm/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.js +1 -0
  15. package/lib/esm/components/livechatwidget/common/createDownloadTranscriptProps.js +20 -0
  16. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -1
  17. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +13 -9
  18. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +12 -10
  19. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
  20. package/lib/esm/plugins/createChatTranscript.js +543 -0
  21. package/lib/types/common/utils.d.ts +1 -0
  22. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
  23. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps.d.ts +5 -0
  24. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +13 -0
  25. package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +24 -0
  26. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +2 -0
  27. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +1 -0
  28. package/lib/types/plugins/createChatTranscript.d.ts +2 -0
  29. package/package.json +1 -1
@@ -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
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
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$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine
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,
@@ -1,22 +1,22 @@
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 { Components } from "botframework-webchat";
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
20
  const broadcastChannelMessageEvent = "message";
21
21
  const postActivity = activity => {
22
22
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -43,7 +43,7 @@ const createMagicCodeSuccessResponse = signin => {
43
43
  };
44
44
  };
45
45
  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;
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
47
  const {
48
48
  BasicWebChat
49
49
  } = Components;
@@ -124,7 +124,9 @@ export const WebChatContainerStateful = props => {
124
124
  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
125
  }
126
126
 
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};}
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}; 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}}
128
+
129
+ .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
130
 
129
131
  .ms_lcw_webchat_received_message img.webchat__markdown__external-link-icon {
130
132
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEg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NzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
@@ -1,4 +1,6 @@
1
1
  export const defaultAdaptiveCardStyles = {
2
2
  background: "white",
3
- color: "black"
3
+ color: "black",
4
+ textWhiteSpace: "normal",
5
+ buttonWhiteSpace: "normal"
4
6
  };