@microsoft/omnichannel-chat-widget 1.7.8-main.2e1cc2b → 1.7.8-main.7a07fc5

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.
@@ -149,6 +149,7 @@ class FacadeChatSDK {
149
149
  }
150
150
  }
151
151
  async tokenRing() {
152
+ var _this$chatSDK$chatSDK;
152
153
  if (this.disableReauthentication === true) {
153
154
  // facade feature is disabled, so we are bypassing the re authentication and let it fail.
154
155
  return {
@@ -176,7 +177,7 @@ class FacadeChatSDK {
176
177
  message: "Token is valid"
177
178
  };
178
179
  }
179
- if (this.getAuthToken === undefined) {
180
+ if (this.getAuthToken === undefined && ((_this$chatSDK$chatSDK = this.chatSDK.chatSDKConfig) === null || _this$chatSDK$chatSDK === void 0 ? void 0 : _this$chatSDK$chatSDK.getAuthToken) === undefined) {
180
181
  _TelemetryHelper.TelemetryHelper.logFacadeChatSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
181
182
  Event: _TelemetryConstants.TelemetryEvent.NewTokenFailed,
182
183
  Description: "GetAuthToken function is not present",
@@ -18,6 +18,7 @@ const getAuthClientFunction = chatConfig => {
18
18
  };
19
19
  exports.getAuthClientFunction = getAuthClientFunction;
20
20
  const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
21
+ var _chatSDK$chatSDKConfi;
21
22
  const authClientFunction = getAuthClientFunction(chatConfig);
22
23
  if (getAuthToken && authClientFunction) {
23
24
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -41,6 +42,20 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
41
42
  });
42
43
  throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
43
44
  }
45
+ } else if (chatSDK !== null && chatSDK !== void 0 && (_chatSDK$chatSDKConfi = chatSDK.chatSDKConfig) !== null && _chatSDK$chatSDKConfi !== void 0 && _chatSDK$chatSDKConfi.getAuthToken) {
46
+ var _chatSDK$chatSDKConfi2;
47
+ const token = await ((_chatSDK$chatSDKConfi2 = chatSDK.chatSDKConfig) === null || _chatSDK$chatSDKConfi2 === void 0 ? void 0 : _chatSDK$chatSDKConfi2.getAuthToken());
48
+ if ((0, _utils.isNullOrEmptyString)(token)) {
49
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
50
+ Event: _TelemetryConstants.TelemetryEvent.ReceivedNullOrEmptyToken,
51
+ Description: "getAuthToken in chat SDK returns empty string"
52
+ });
53
+ throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
54
+ }
55
+ return {
56
+ "result": true,
57
+ token
58
+ };
44
59
  }
45
60
  return {
46
61
  "result": false,
@@ -11,6 +11,7 @@ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components
11
11
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
12
12
  var _defaultgeneralOOOHPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps");
13
13
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
14
+ var _dompurify = _interopRequireDefault(require("dompurify"));
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -49,6 +50,9 @@ const OutOfOfficeHoursPaneStateful = props => {
49
50
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
50
51
  });
51
52
  }, []);
53
+ if (controlProps !== null && controlProps !== void 0 && controlProps.titleText) {
54
+ controlProps.titleText = _dompurify.default.sanitize(controlProps.titleText);
55
+ }
52
56
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.OutOfOfficeHoursPane, {
53
57
  componentOverrides: props.componentOverrides,
54
58
  controlProps: controlProps,
@@ -143,6 +143,7 @@ export class FacadeChatSDK {
143
143
  }
144
144
  }
145
145
  async tokenRing() {
146
+ var _this$chatSDK$chatSDK;
146
147
  if (this.disableReauthentication === true) {
147
148
  // facade feature is disabled, so we are bypassing the re authentication and let it fail.
148
149
  return {
@@ -170,7 +171,7 @@ export class FacadeChatSDK {
170
171
  message: "Token is valid"
171
172
  };
172
173
  }
173
- if (this.getAuthToken === undefined) {
174
+ if (this.getAuthToken === undefined && ((_this$chatSDK$chatSDK = this.chatSDK.chatSDKConfig) === null || _this$chatSDK$chatSDK === void 0 ? void 0 : _this$chatSDK$chatSDK.getAuthToken) === undefined) {
174
175
  TelemetryHelper.logFacadeChatSDKEvent(LogLevel.ERROR, {
175
176
  Event: TelemetryEvent.NewTokenFailed,
176
177
  Description: "GetAuthToken function is not present",
@@ -11,6 +11,7 @@ const getAuthClientFunction = chatConfig => {
11
11
  return authClientFunction;
12
12
  };
13
13
  const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
14
+ var _chatSDK$chatSDKConfi;
14
15
  const authClientFunction = getAuthClientFunction(chatConfig);
15
16
  if (getAuthToken && authClientFunction) {
16
17
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
@@ -34,6 +35,20 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
34
35
  });
35
36
  throw new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
36
37
  }
38
+ } else if (chatSDK !== null && chatSDK !== void 0 && (_chatSDK$chatSDKConfi = chatSDK.chatSDKConfig) !== null && _chatSDK$chatSDKConfi !== void 0 && _chatSDK$chatSDKConfi.getAuthToken) {
39
+ var _chatSDK$chatSDKConfi2;
40
+ const token = await ((_chatSDK$chatSDKConfi2 = chatSDK.chatSDKConfig) === null || _chatSDK$chatSDKConfi2 === void 0 ? void 0 : _chatSDK$chatSDKConfi2.getAuthToken());
41
+ if (isNullOrEmptyString(token)) {
42
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
43
+ Event: TelemetryEvent.ReceivedNullOrEmptyToken,
44
+ Description: "getAuthToken in chat SDK returns empty string"
45
+ });
46
+ throw new Error(WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
47
+ }
48
+ return {
49
+ "result": true,
50
+ token
51
+ };
37
52
  }
38
53
  return {
39
54
  "result": false,
@@ -5,6 +5,7 @@ import { OutOfOfficeHoursPane } from "@microsoft/omnichannel-chat-components";
5
5
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
6
6
  import { defaultGeneralStyleProps } from "./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps";
7
7
  import useChatContextStore from "../../hooks/useChatContextStore";
8
+ import DOMPurify from "dompurify";
8
9
  let uiTimer;
9
10
  export const OutOfOfficeHoursPaneStateful = props => {
10
11
  var _props$styleProps;
@@ -40,6 +41,9 @@ export const OutOfOfficeHoursPaneStateful = props => {
40
41
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
41
42
  });
42
43
  }, []);
44
+ if (controlProps !== null && controlProps !== void 0 && controlProps.titleText) {
45
+ controlProps.titleText = DOMPurify.sanitize(controlProps.titleText);
46
+ }
43
47
  return /*#__PURE__*/React.createElement(OutOfOfficeHoursPane, {
44
48
  componentOverrides: props.componentOverrides,
45
49
  controlProps: controlProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.8-main.2e1cc2b",
3
+ "version": "1.7.8-main.7a07fc5",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",