@microsoft/omnichannel-chat-widget 1.7.7-main.8517303 → 1.7.7-main.a833758

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.
@@ -132,6 +132,7 @@ class HtmlClassNames {}
132
132
  exports.HtmlClassNames = HtmlClassNames;
133
133
  _defineProperty(HtmlClassNames, "webChatBannerCloseButton", "webchat__toast__dismissButton");
134
134
  _defineProperty(HtmlClassNames, "webChatBannerExpandButton", "webchat__toaster__expandIcon");
135
+ _defineProperty(HtmlClassNames, "webChatHistoryContainer", "webchat__basic-transcript");
135
136
  class HtmlElementSelectors {}
136
137
  exports.HtmlElementSelectors = HtmlElementSelectors;
137
138
  _defineProperty(HtmlElementSelectors, "sendBoxSelector", "textarea[data-id=\"webchat-sendbox-input\"]");
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTabIndices = exports.setOcUserAgent = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isThisSessionPopout = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
6
+ exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
7
+ exports.getDeviceType = getDeviceType;
8
+ exports.setTabIndices = exports.setOcUserAgent = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isThisSessionPopout = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = void 0;
7
9
  var _Constants = require("./Constants");
8
10
  var _TelemetryConstants = require("./telemetry/TelemetryConstants");
9
11
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
@@ -479,4 +481,14 @@ const setOcUserAgent = chatSDK => {
479
481
  }
480
482
  }
481
483
  };
482
- exports.setOcUserAgent = setOcUserAgent;
484
+ exports.setOcUserAgent = setOcUserAgent;
485
+ function getDeviceType() {
486
+ const userAgent = navigator.userAgent.toLowerCase();
487
+ if (/android/.test(userAgent)) {
488
+ return "android";
489
+ } else if (/iphone|ipad|ipod/.test(userAgent)) {
490
+ return "ios";
491
+ } else {
492
+ return "standard";
493
+ }
494
+ }
@@ -83,7 +83,12 @@ const WebChatContainerStateful = props => {
83
83
  };
84
84
  (0, _react2.useEffect)(() => {
85
85
  var _props$webChatContain, _props$webChatContain2;
86
- (0, _utils.setFocusOnSendBox)();
86
+ if ((0, _utils.getDeviceType)() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
87
+ const chatHistoryElement = document.querySelector(`.${_Constants.HtmlClassNames.webChatHistoryContainer}`);
88
+ if (chatHistoryElement) {
89
+ chatHistoryElement.setAttribute(_Constants.HtmlAttributeNames.ariaLabel, webChatContainerProps.webChatHistoryMobileAccessibilityLabel);
90
+ }
91
+ }
87
92
  dispatch({
88
93
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
89
94
  payload: webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.renderingMiddlewareProps
@@ -60,6 +60,6 @@ const defaultWebChatStyles = {
60
60
  "</3": "💔",
61
61
  "<\\3": "💔"
62
62
  },
63
- uploadMultiple: false
63
+ sendAttachmentOn: "attach"
64
64
  };
65
65
  exports.defaultWebChatStyles = defaultWebChatStyles;
@@ -70,9 +70,6 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
70
70
  }
71
71
  }
72
72
  }
73
-
74
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
- action = (0, _simpleUpdateIn.default)(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => htmlNode.innerHTML);
76
73
  } catch (e) {
77
74
  let errorMessage = "Failed to apply action: ";
78
75
  try {
@@ -89,6 +86,7 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
89
86
  });
90
87
  }
91
88
  }
89
+ action = (0, _simpleUpdateIn.default)(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => htmlNode.innerHTML);
92
90
  return action;
93
91
  };
94
92
 
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _utils = require("../common/utils");
8
8
  var _defaultLibraryScripts = _interopRequireDefault(require("../components/footerstateful/downloadtranscriptstateful/common/defaultLibraryScripts"));
9
+ var _dompurify = _interopRequireDefault(require("dompurify"));
9
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
@@ -674,7 +675,10 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
674
675
  reader.readAsDataURL(blob);
675
676
  });
676
677
  };
677
- let messages = transcriptMessages;
678
+ let messages = transcriptMessages.filter(message => {
679
+ message.content = _dompurify.default.sanitize(message.content);
680
+ return message.content.length > 0;
681
+ });
678
682
  if (renderAttachments) {
679
683
  messages = await Promise.all(transcriptMessages.map(async message => {
680
684
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -122,6 +122,7 @@ _defineProperty(HtmlIdNames, "MSLiveChatWidget", "MSLiveChatWidget");
122
122
  export class HtmlClassNames {}
123
123
  _defineProperty(HtmlClassNames, "webChatBannerCloseButton", "webchat__toast__dismissButton");
124
124
  _defineProperty(HtmlClassNames, "webChatBannerExpandButton", "webchat__toaster__expandIcon");
125
+ _defineProperty(HtmlClassNames, "webChatHistoryContainer", "webchat__basic-transcript");
125
126
  export class HtmlElementSelectors {}
126
127
  _defineProperty(HtmlElementSelectors, "sendBoxSelector", "textarea[data-id=\"webchat-sendbox-input\"]");
127
128
  export class HtmlAttributeNames {}
@@ -440,4 +440,14 @@ export const setOcUserAgent = chatSDK => {
440
440
  console.warn(error);
441
441
  }
442
442
  }
443
- };
443
+ };
444
+ export function getDeviceType() {
445
+ const userAgent = navigator.userAgent.toLowerCase();
446
+ if (/android/.test(userAgent)) {
447
+ return "android";
448
+ } else if (/iphone|ipad|ipod/.test(userAgent)) {
449
+ return "ios";
450
+ } else {
451
+ return "standard";
452
+ }
453
+ }
@@ -3,10 +3,10 @@
3
3
  import { Stack } from "@fluentui/react";
4
4
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
5
5
  import React, { useEffect } from "react";
6
- import { createTimer, setFocusOnSendBox } from "../../common/utils";
6
+ import { createTimer, getDeviceType, setFocusOnSendBox } from "../../common/utils";
7
7
  import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
8
8
  import { Components } from "botframework-webchat";
9
- import { Constants } from "../../common/Constants";
9
+ import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
10
10
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
11
11
  import { NotificationHandler } from "./webchatcontroller/notification/NotificationHandler";
12
12
  import { NotificationScenarios } from "./webchatcontroller/enums/NotificationScenarios";
@@ -75,7 +75,12 @@ export const WebChatContainerStateful = props => {
75
75
  };
76
76
  useEffect(() => {
77
77
  var _props$webChatContain, _props$webChatContain2;
78
- setFocusOnSendBox();
78
+ if (getDeviceType() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
79
+ const chatHistoryElement = document.querySelector(`.${HtmlClassNames.webChatHistoryContainer}`);
80
+ if (chatHistoryElement) {
81
+ chatHistoryElement.setAttribute(HtmlAttributeNames.ariaLabel, webChatContainerProps.webChatHistoryMobileAccessibilityLabel);
82
+ }
83
+ }
79
84
  dispatch({
80
85
  type: LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
81
86
  payload: webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.renderingMiddlewareProps
@@ -54,5 +54,5 @@ export const defaultWebChatStyles = {
54
54
  "</3": "💔",
55
55
  "<\\3": "💔"
56
56
  },
57
- uploadMultiple: false
57
+ sendAttachmentOn: "attach"
58
58
  };
@@ -64,9 +64,6 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
64
64
  }
65
65
  }
66
66
  }
67
-
68
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
- action = updateIn(action, [Constants.payload, Constants.activity, Constants.text], () => htmlNode.innerHTML);
70
67
  } catch (e) {
71
68
  let errorMessage = "Failed to apply action: ";
72
69
  try {
@@ -83,6 +80,7 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
83
80
  });
84
81
  }
85
82
  }
83
+ action = updateIn(action, [Constants.payload, Constants.activity, Constants.text], () => htmlNode.innerHTML);
86
84
  return action;
87
85
  };
88
86
 
@@ -5,6 +5,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
5
5
 
6
6
  import { createFileAndDownload } from "../common/utils";
7
7
  import defaultLibraryScripts from "../components/footerstateful/downloadtranscriptstateful/common/defaultLibraryScripts";
8
+ import DOMPurify from "dompurify";
8
9
  class TranscriptHTMLBuilder {
9
10
  // eslint-disable-line @typescript-eslint/no-explicit-any
10
11
 
@@ -669,7 +670,10 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
669
670
  reader.readAsDataURL(blob);
670
671
  });
671
672
  };
672
- let messages = transcriptMessages;
673
+ let messages = transcriptMessages.filter(message => {
674
+ message.content = DOMPurify.sanitize(message.content);
675
+ return message.content.length > 0;
676
+ });
673
677
  if (renderAttachments) {
674
678
  messages = await Promise.all(transcriptMessages.map(async message => {
675
679
  // eslint-disable-line @typescript-eslint/no-explicit-any
@@ -104,6 +104,7 @@ export declare class HtmlIdNames {
104
104
  export declare class HtmlClassNames {
105
105
  static readonly webChatBannerCloseButton = "webchat__toast__dismissButton";
106
106
  static readonly webChatBannerExpandButton = "webchat__toaster__expandIcon";
107
+ static readonly webChatHistoryContainer = "webchat__basic-transcript";
107
108
  }
108
109
  export declare class HtmlElementSelectors {
109
110
  static readonly sendBoxSelector = "textarea[data-id=\"webchat-sendbox-input\"]";
@@ -57,7 +57,7 @@ export declare class FacadeChatSDK {
57
57
  getCallingToken(): Promise<string>;
58
58
  getMessages(): Promise<IMessage[] | OmnichannelMessage[] | undefined>;
59
59
  getDataMaskingRules(): Promise<MaskingRules>;
60
- sendMessage(message: ChatSDKMessage): Promise<void>;
60
+ sendMessage(message: ChatSDKMessage): Promise<void | OmnichannelMessage>;
61
61
  onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams): Promise<void>;
62
62
  sendTypingEvent(): Promise<void>;
63
63
  onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
@@ -46,3 +46,4 @@ export declare const createFileAndDownload: (fileName: string, blobData: string,
46
46
  export declare const formatTemplateString: (templateMessage: string, values: any) => string;
47
47
  export declare const parseLowerCaseString: (property: string | boolean | undefined) => string;
48
48
  export declare const setOcUserAgent: (chatSDK: any) => void;
49
+ export declare function getDeviceType(): string;
@@ -24,4 +24,5 @@ export interface IWebChatContainerStatefulProps {
24
24
  hyperlinkTextOverride?: boolean;
25
25
  adaptiveCardStyles?: IAdaptiveCardStyles;
26
26
  sendBoxTextBox?: ISendBox;
27
+ webChatHistoryMobileAccessibilityLabel?: string;
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.7-main.8517303",
3
+ "version": "1.7.7-main.a833758",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -78,7 +78,7 @@
78
78
  "dependencies": {
79
79
  "@azure/core-tracing": "^1.2.0",
80
80
  "@microsoft/omnichannel-chat-components": "1.1.8",
81
- "@microsoft/omnichannel-chat-sdk": "^1.10.15",
81
+ "@microsoft/omnichannel-chat-sdk": "^1.10.17",
82
82
  "@opentelemetry/api": "^1.9.0",
83
83
  "abort-controller-es5": "^2.0.1",
84
84
  "dompurify": "^3.2.4",