@microsoft/omnichannel-chat-widget 1.7.5 → 1.7.6-main.9b09b06

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 (57) hide show
  1. package/lib/cjs/common/facades/FacadeChatSDK.js +11 -1
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
  3. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -2
  4. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +3 -2
  5. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +5 -3
  6. package/lib/cjs/components/livechatwidget/interfaces/IFeatureConfigProps.js +1 -0
  7. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -2
  8. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +6 -0
  9. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -1
  10. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +1 -0
  11. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +7 -7
  12. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +4 -4
  13. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +7 -4
  14. package/lib/cjs/plugins/createChatTranscript.js +15 -6
  15. package/lib/esm/common/facades/FacadeChatSDK.js +11 -1
  16. package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
  17. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -2
  18. package/lib/esm/components/livechatwidget/LiveChatWidget.js +3 -2
  19. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +5 -3
  20. package/lib/esm/components/livechatwidget/interfaces/IFeatureConfigProps.js +1 -0
  21. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -2
  22. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +6 -0
  23. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +2 -1
  24. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.js +1 -0
  25. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +7 -7
  26. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware.js +4 -4
  27. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +7 -4
  28. package/lib/esm/plugins/createChatTranscript.js +15 -6
  29. package/lib/types/common/facades/FacadeChatSDK.d.ts +2 -1
  30. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  31. package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -1
  32. package/lib/types/common/telemetry/definitions/Contracts.d.ts +1 -1
  33. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -1
  34. package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
  35. package/lib/types/components/footerstateful/downloadtranscriptstateful/interfaces/IWebChatTranscriptConfig.d.ts +1 -0
  36. package/lib/types/components/livechatwidget/common/authHelper.d.ts +1 -1
  37. package/lib/types/components/livechatwidget/common/createAdapter.d.ts +1 -1
  38. package/lib/types/components/livechatwidget/common/createDownloadTranscriptProps.d.ts +2 -1
  39. package/lib/types/components/livechatwidget/common/createInternetConnectionChangeHandler.d.ts +2 -1
  40. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  41. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +1 -1
  42. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +2 -2
  43. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
  44. package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -2
  45. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -1
  46. package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
  47. package/lib/types/components/livechatwidget/interfaces/IFeatureConfigProps.d.ts +3 -0
  48. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +9 -7
  49. package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
  50. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatProps.d.ts +1 -1
  51. package/lib/types/components/webchatcontainerstateful/webchatcontroller/enums/WebChatActionType.d.ts +2 -1
  52. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
  53. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
  54. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
  55. package/lib/types/hooks/useChatSDKStore.d.ts +1 -1
  56. package/lib/types/hooks/useDebounce.d.ts +1 -1
  57. package/package.json +17 -8
@@ -26,7 +26,7 @@ class FacadeChatSDK {
26
26
  isTokenSet() {
27
27
  return !(0, _utils.isNullOrEmptyString)(this.token);
28
28
  }
29
- constructor(input) {
29
+ constructor(input, disableReauthentication) {
30
30
  _defineProperty(this, "chatSDK", void 0);
31
31
  _defineProperty(this, "chatConfig", void 0);
32
32
  _defineProperty(this, "token", "");
@@ -34,11 +34,13 @@ class FacadeChatSDK {
34
34
  _defineProperty(this, "isAuthenticated", void 0);
35
35
  _defineProperty(this, "getAuthToken", void 0);
36
36
  _defineProperty(this, "sdkMocked", void 0);
37
+ _defineProperty(this, "disableReauthentication", void 0);
37
38
  this.chatSDK = input.chatSDK;
38
39
  this.chatConfig = input.chatConfig;
39
40
  this.getAuthToken = input.getAuthToken;
40
41
  this.isAuthenticated = input.isAuthenticated;
41
42
  this.sdkMocked = input.isSDKMocked;
43
+ this.disableReauthentication = disableReauthentication;
42
44
  }
43
45
 
44
46
  //set default expiration to zero, for undefined or missed exp in jwt
@@ -103,6 +105,14 @@ class FacadeChatSDK {
103
105
  }
104
106
  }
105
107
  async tokenRing() {
108
+ if (this.disableReauthentication === true) {
109
+ // facade feature is disabled, so we are bypassing the re authentication and let it fail.
110
+ return {
111
+ result: true,
112
+ message: "Facade is disabled"
113
+ };
114
+ }
115
+
106
116
  // this is needed for storybooks, specifically for reconnect pane which requires authentication bypass
107
117
  if (this.sdkMocked === true) {
108
118
  return {
@@ -141,6 +141,7 @@ exports.TelemetryEvent = TelemetryEvent;
141
141
  TelemetryEvent["ConfirmationCancelButtonClicked"] = "ConfirmationCancelButtonClicked";
142
142
  TelemetryEvent["ConfirmationConfirmButtonClicked"] = "ConfirmationConfirmButtonClicked";
143
143
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
144
+ TelemetryEvent["LoadingPaneUnloaded"] = "LoadingPaneUnloaded";
144
145
  TelemetryEvent["StartChatErrorPaneLoaded"] = "StartChatErrorPaneLoaded";
145
146
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
146
147
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
@@ -61,22 +61,24 @@ const EmailTranscriptPaneStateful = props => {
61
61
  attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
62
62
  };
63
63
  try {
64
+ var _state$domainStates2, _state$domainStates2$;
64
65
  await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.emailLiveChatTranscript(chatTranscriptBody, {
65
66
  liveChatContext
66
67
  }));
67
- _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
68
+ _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS) ?? (_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS));
68
69
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
69
70
  Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
70
71
  Description: "Transcript sent to email successfully."
71
72
  });
72
73
  } catch (ex) {
74
+ var _state$domainStates3, _state$domainStates3$;
73
75
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
74
76
  Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
75
77
  ExceptionDetails: {
76
78
  exception: ex
77
79
  }
78
80
  });
79
- const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
81
+ const message = (0, _utils.formatTemplateString)((state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.middlewareLocalizedTexts) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
80
82
  _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
81
83
  }
82
84
  }, [props.attachmentMessage, props.bannerMessageOnError, facadeChatSDK, state.domainStates.liveChatContext]);
@@ -20,13 +20,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  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); }
21
21
  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; }
22
22
  const LiveChatWidget = props => {
23
- var _props$mock, _props$chatConfig, _props$chatConfig$Liv;
23
+ var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
24
24
  const reducer = (0, _createReducer.createReducer)();
25
25
  const [state, dispatch] = (0, _react.useReducer)(reducer, (0, _LiveChatWidgetContextInitialState.getLiveChatWidgetContextInitialState)(props));
26
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
27
  const [adapter, setAdapter] = (0, _react.useState)(undefined);
28
28
  const [facadeChatSDK, setFacadeChatSDK] = (0, _react.useState)(undefined);
29
29
  const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type);
30
+ const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
30
31
  (0, _overridePropsOnMockIfApplicable.default)(props);
31
32
  if (!props.chatConfig) {
32
33
  throw new Error("chatConfig is required");
@@ -43,7 +44,7 @@ const LiveChatWidget = props => {
43
44
  "getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
44
45
  //when type is not undefined, it means the SDK is mocked
45
46
  "isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
46
- }));
47
+ }, disableReauthentication));
47
48
  }
48
49
  return /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
49
50
  value: [facadeChatSDK, setFacadeChatSDK]
@@ -20,19 +20,21 @@ const isInternetConnected = async () => {
20
20
  return false;
21
21
  }
22
22
  };
23
- const createInternetConnectionChangeHandler = async () => {
23
+ const createInternetConnectionChangeHandler = async state => {
24
24
  const handler = async () => {
25
25
  const connected = await isInternetConnected();
26
26
  if (!connected) {
27
+ var _state$domainStates, _state$domainStates$m;
27
28
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
28
29
  Event: _TelemetryConstants.TelemetryEvent.NetworkDisconnected
29
30
  });
30
- _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
31
+ _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
31
32
  } else {
33
+ var _state$domainStates2, _state$domainStates2$;
32
34
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
33
35
  Event: _TelemetryConstants.TelemetryEvent.NetworkReconnected
34
36
  });
35
- _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
37
+ _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
36
38
  _omnichannelChatComponents.BroadcastService.postMessage({
37
39
  eventName: _TelemetryConstants.BroadcastEvent.NetworkReconnected
38
40
  });
@@ -227,7 +227,7 @@ const LiveChatWidgetStateful = props => {
227
227
  state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
228
228
  setupClientDataStore();
229
229
  (0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
230
- (0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)();
230
+ (0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)(state);
231
231
  dispatch({
232
232
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
233
233
  payload: widgetElementId
@@ -816,7 +816,7 @@ const LiveChatWidgetStateful = props => {
816
816
  const chatWidgetDraggableConfig = {
817
817
  elementId: widgetElementId,
818
818
  channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
819
- disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
819
+ disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) !== true // Draggable by default, unless explicitly disabled
820
820
  };
821
821
 
822
822
  // Disable receiving IDraggableEvent in current window
@@ -73,6 +73,12 @@ const LoadingPaneStateful = props => {
73
73
  Event: _TelemetryConstants.TelemetryEvent.UXLoadingPaneCompleted,
74
74
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
75
75
  });
76
+ return () => {
77
+ _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
78
+ Event: _TelemetryConstants.TelemetryEvent.LoadingPaneUnloaded,
79
+ Description: "Loading pane unmount."
80
+ });
81
+ };
76
82
  }, []);
77
83
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.LoadingPane, {
78
84
  componentOverrides: loadingPaneProps === null || loadingPaneProps === void 0 ? void 0 : loadingPaneProps.componentOverrides,
@@ -59,6 +59,7 @@ const defaultWebChatStyles = {
59
59
  "<3": "❤️",
60
60
  "</3": "💔",
61
61
  "<\\3": "💔"
62
- }
62
+ },
63
+ uploadMultiple: false
63
64
  };
64
65
  exports.defaultWebChatStyles = defaultWebChatStyles;
@@ -28,4 +28,5 @@ exports.WebChatActionType = WebChatActionType;
28
28
  WebChatActionType["WEB_CHAT_DISMISS_NOTIFICATION"] = "WEB_CHAT/DISMISS_NOTIFICATION";
29
29
  WebChatActionType["WEB_CHAT_SET_SEND_BOX"] = "WEB_CHAT/SET_SEND_BOX";
30
30
  WebChatActionType["WEB_CHAT_SEND_FILES"] = "WEB_CHAT/SEND_FILES";
31
+ WebChatActionType["WEB_CHAT_SET_SEND_BOX_ATTACHMENTS"] = "WEB_CHAT/SET_SEND_BOX_ATTACHMENTS";
31
32
  })(WebChatActionType || (exports.WebChatActionType = WebChatActionType = {}));
@@ -7,19 +7,19 @@ exports.createAttachmentMiddleware = void 0;
7
7
  var _Constants = require("../../../../../common/Constants");
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _FileAttachmentIconManager = require("../../../common/utils/FileAttachmentIconManager");
10
+ var _Attachment = _interopRequireDefault(require("./attachments/Attachment"));
10
11
  var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
11
12
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
13
+ var _FileScanStatus = _interopRequireDefault(require("./attachments/FileScanStatus"));
14
+ var _MaliciousAttachment = _interopRequireDefault(require("./attachments/MaliciousAttachment"));
15
+ var _NotificationHandler = require("../../notification/NotificationHandler");
16
+ var _NotificationScenarios = require("../../enums/NotificationScenarios");
17
+ var _ScanInProgressAttachment = _interopRequireDefault(require("./attachments/ScanInProgressAttachment"));
12
18
  var _WebChatActionType = require("../../enums/WebChatActionType");
13
19
  var _defaultAtttachmentAdaptiveCardStyles = require("./defaultStyles/defaultAtttachmentAdaptiveCardStyles");
14
20
  var _defaultAttachmentProps = require("../../../common/defaultProps/defaultAttachmentProps");
15
- var _ = require("../../../../..");
16
- var _NotificationHandler = require("../../notification/NotificationHandler");
17
- var _NotificationScenarios = require("../../enums/NotificationScenarios");
18
21
  var _defaultMiddlewareLocalizedTexts = require("../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
19
- var _Attachment = _interopRequireDefault(require("./attachments/Attachment"));
20
- var _ScanInProgressAttachment = _interopRequireDefault(require("./attachments/ScanInProgressAttachment"));
21
- var _MaliciousAttachment = _interopRequireDefault(require("./attachments/MaliciousAttachment"));
22
- var _FileScanStatus = _interopRequireDefault(require("./attachments/FileScanStatus"));
22
+ var _ = require("../../../../..");
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
24
  /* eslint-disable @typescript-eslint/no-explicit-any */
25
25
  /******
@@ -17,7 +17,7 @@ const createSendFileAction = files => {
17
17
  payload: {
18
18
  files
19
19
  },
20
- type: _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES
20
+ type: _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_MESSAGE
21
21
  };
22
22
  };
23
23
 
@@ -27,9 +27,9 @@ const attachmentProcessingMiddleware = _ref => {
27
27
  dispatch
28
28
  } = _ref;
29
29
  return next => async action => {
30
- var _action$payload, _action$payload$files;
31
- if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_FILES && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$files = _action$payload.files) === null || _action$payload$files === void 0 ? void 0 : _action$payload$files.length) > 0) {
32
- const files = action.payload.files;
30
+ var _action$payload, _action$payload$attac;
31
+ if ((action === null || action === void 0 ? void 0 : action.type) === _WebChatActionType.WebChatActionType.WEB_CHAT_SEND_MESSAGE && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$attac = _action$payload.attachments) === null || _action$payload$attac === void 0 ? void 0 : _action$payload$attac.length) > 0) {
32
+ const files = action.payload.attachments;
33
33
  if (files.length === 1) {
34
34
  return next(action);
35
35
  }
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
8
+ var _Constants = require("../../../../../common/Constants");
8
9
  var _NotificationHandler = require("../../notification/NotificationHandler");
9
10
  var _NotificationScenarios = require("../../enums/NotificationScenarios");
10
- var _WebChatActionType = require("../../enums/WebChatActionType");
11
11
  var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
12
- var _Constants = require("../../../../../common/Constants");
12
+ var _WebChatActionType = require("../../enums/WebChatActionType");
13
13
  /******
14
14
  * AttachmentUploadValidatorMiddleware
15
15
  *
@@ -26,6 +26,9 @@ const validateAttachment = (action, allowedFileExtensions, maxFileSizeSupportedB
26
26
  var _action$payload, _action$payload$activ, _action$payload2, _action$payload2$acti, _action$payload2$acti2, _action$payload3, _action$payload3$acti, _action$payload3$acti2;
27
27
  const attachments = action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.attachments;
28
28
  const attachmentSizes = action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : (_action$payload2$acti2 = _action$payload2$acti.channelData) === null || _action$payload2$acti2 === void 0 ? void 0 : _action$payload2$acti2.attachmentSizes;
29
+ if (!attachments || attachments.length === 0) {
30
+ return action;
31
+ }
29
32
  if (attachments) {
30
33
  for (let i = 0; i < attachments.length; i++) {
31
34
  const maxUploadFileSize = getMaxUploadFileSize(maxFileSizeSupportedByDynamics, attachments[i].contentType);
@@ -196,11 +199,11 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxFil
196
199
  } = _ref;
197
200
  return next => action => {
198
201
  if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
199
- var _payload$activity, _payload$activity2, _payload$activity2$ch, _payload$activity3, _payload$activity3$at, _payload$activity4, _payload$activity4$ch, _payload$activity4$ch2;
202
+ var _payload$activity, _payload$activity$att, _payload$activity2, _payload$activity2$ch, _payload$activity2$ch2;
200
203
  const {
201
204
  payload
202
205
  } = action;
203
- if (payload !== null && payload !== void 0 && (_payload$activity = payload.activity) !== null && _payload$activity !== void 0 && _payload$activity.attachments && payload !== null && payload !== void 0 && (_payload$activity2 = payload.activity) !== null && _payload$activity2 !== void 0 && (_payload$activity2$ch = _payload$activity2.channelData) !== null && _payload$activity2$ch !== void 0 && _payload$activity2$ch.attachmentSizes && (payload === null || payload === void 0 ? void 0 : (_payload$activity3 = payload.activity) === null || _payload$activity3 === void 0 ? void 0 : (_payload$activity3$at = _payload$activity3.attachments) === null || _payload$activity3$at === void 0 ? void 0 : _payload$activity3$at.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity4 = payload.activity) === null || _payload$activity4 === void 0 ? void 0 : (_payload$activity4$ch = _payload$activity4.channelData) === null || _payload$activity4$ch === void 0 ? void 0 : (_payload$activity4$ch2 = _payload$activity4$ch.attachmentSizes) === null || _payload$activity4$ch2 === void 0 ? void 0 : _payload$activity4$ch2.length)) {
206
+ if (payload !== null && payload !== void 0 && payload.activity.attachments && payload.activity.attachments.length > 0 && (payload === null || payload === void 0 ? void 0 : (_payload$activity = payload.activity) === null || _payload$activity === void 0 ? void 0 : (_payload$activity$att = _payload$activity.attachments) === null || _payload$activity$att === void 0 ? void 0 : _payload$activity$att.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity2 = payload.activity) === null || _payload$activity2 === void 0 ? void 0 : (_payload$activity2$ch = _payload$activity2.channelData) === null || _payload$activity2$ch === void 0 ? void 0 : (_payload$activity2$ch2 = _payload$activity2$ch.attachmentSizes) === null || _payload$activity2$ch2 === void 0 ? void 0 : _payload$activity2$ch2.length)) {
204
207
  return next(validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts));
205
208
  }
206
209
  }
@@ -14,7 +14,7 @@ class TranscriptHTMLBuilder {
14
14
  // eslint-disable-line @typescript-eslint/no-explicit-any
15
15
 
16
16
  constructor(options) {
17
- var _this$options, _this$options2, _this$options3, _this$options4, _this$options5, _this$options6, _this$options7, _this$options8, _this$options9, _this$options10, _this$options11, _this$options12;
17
+ var _this$options, _this$options2, _this$options3, _this$options4, _this$options5, _this$options6, _this$options7, _this$options8, _this$options9, _this$options10, _this$options11, _this$options12, _this$options13;
18
18
  _defineProperty(this, "options", void 0);
19
19
  _defineProperty(this, "pageTitle", "Customer Transcript");
20
20
  _defineProperty(this, "attachmentMessage", "The following attachment was uploaded during the conversation: ");
@@ -25,6 +25,7 @@ class TranscriptHTMLBuilder {
25
25
  _defineProperty(this, "agentAvatarFontColor", "#000");
26
26
  _defineProperty(this, "customerAvatarBackgroundColor", "#2266E3");
27
27
  _defineProperty(this, "customerAvatarFontColor", "#FFF");
28
+ _defineProperty(this, "customerDisplayName", "");
28
29
  _defineProperty(this, "disableMarkdownMessageFormatting", false);
29
30
  _defineProperty(this, "disableNewLineMarkdownSupport", false);
30
31
  _defineProperty(this, "externalScripts", {});
@@ -60,13 +61,16 @@ class TranscriptHTMLBuilder {
60
61
  if ((_this$options9 = this.options) !== null && _this$options9 !== void 0 && _this$options9.customerAvatarFontColor) {
61
62
  this.customerAvatarFontColor = this.options.customerAvatarFontColor;
62
63
  }
63
- if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.disableMarkdownMessageFormatting) {
64
+ if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.customerDisplayName) {
65
+ this.customerDisplayName = this.options.customerDisplayName;
66
+ }
67
+ if ((_this$options11 = this.options) !== null && _this$options11 !== void 0 && _this$options11.disableMarkdownMessageFormatting) {
64
68
  this.disableMarkdownMessageFormatting = this.options.disableMarkdownMessageFormatting;
65
69
  }
66
- if ((_this$options11 = this.options) !== null && _this$options11 !== void 0 && _this$options11.disableNewLineMarkdownSupport) {
70
+ if ((_this$options12 = this.options) !== null && _this$options12 !== void 0 && _this$options12.disableNewLineMarkdownSupport) {
67
71
  this.disableNewLineMarkdownSupport = this.options.disableNewLineMarkdownSupport;
68
72
  }
69
- if ((_this$options12 = this.options) !== null && _this$options12 !== void 0 && _this$options12.externalScripts) {
73
+ if ((_this$options13 = this.options) !== null && _this$options13 !== void 0 && _this$options13.externalScripts) {
70
74
  this.externalScripts = this.options.externalScripts;
71
75
  }
72
76
  }
@@ -528,7 +532,12 @@ class TranscriptHTMLBuilder {
528
532
  const avatarMiddleware = () => (next) => (...args) => {
529
533
  const [card] = args;
530
534
  const {fromUser, activity} = card;
531
- const initials = getIconText(activity.from.name);
535
+ let displayName = getIconText(activity.from.name);
536
+ let customerDisplayName = '${this.customerDisplayName}';
537
+
538
+ if (fromUser && customerDisplayName) {
539
+ displayName = customerDisplayName;
540
+ }
532
541
 
533
542
  const avatarElement = React.createElement(
534
543
  "div",
@@ -536,7 +545,7 @@ class TranscriptHTMLBuilder {
536
545
  React.createElement(
537
546
  "p",
538
547
  null,
539
- \`\${initials}\`
548
+ \`\${displayName}\`
540
549
  )
541
550
  );
542
551
 
@@ -20,7 +20,7 @@ export class FacadeChatSDK {
20
20
  isTokenSet() {
21
21
  return !isNullOrEmptyString(this.token);
22
22
  }
23
- constructor(input) {
23
+ constructor(input, disableReauthentication) {
24
24
  _defineProperty(this, "chatSDK", void 0);
25
25
  _defineProperty(this, "chatConfig", void 0);
26
26
  _defineProperty(this, "token", "");
@@ -28,11 +28,13 @@ export class FacadeChatSDK {
28
28
  _defineProperty(this, "isAuthenticated", void 0);
29
29
  _defineProperty(this, "getAuthToken", void 0);
30
30
  _defineProperty(this, "sdkMocked", void 0);
31
+ _defineProperty(this, "disableReauthentication", void 0);
31
32
  this.chatSDK = input.chatSDK;
32
33
  this.chatConfig = input.chatConfig;
33
34
  this.getAuthToken = input.getAuthToken;
34
35
  this.isAuthenticated = input.isAuthenticated;
35
36
  this.sdkMocked = input.isSDKMocked;
37
+ this.disableReauthentication = disableReauthentication;
36
38
  }
37
39
 
38
40
  //set default expiration to zero, for undefined or missed exp in jwt
@@ -97,6 +99,14 @@ export class FacadeChatSDK {
97
99
  }
98
100
  }
99
101
  async tokenRing() {
102
+ if (this.disableReauthentication === true) {
103
+ // facade feature is disabled, so we are bypassing the re authentication and let it fail.
104
+ return {
105
+ result: true,
106
+ message: "Facade is disabled"
107
+ };
108
+ }
109
+
100
110
  // this is needed for storybooks, specifically for reconnect pane which requires authentication bypass
101
111
  if (this.sdkMocked === true) {
102
112
  return {
@@ -135,6 +135,7 @@ export let TelemetryEvent;
135
135
  TelemetryEvent["ConfirmationCancelButtonClicked"] = "ConfirmationCancelButtonClicked";
136
136
  TelemetryEvent["ConfirmationConfirmButtonClicked"] = "ConfirmationConfirmButtonClicked";
137
137
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
138
+ TelemetryEvent["LoadingPaneUnloaded"] = "LoadingPaneUnloaded";
138
139
  TelemetryEvent["StartChatErrorPaneLoaded"] = "StartChatErrorPaneLoaded";
139
140
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
140
141
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
@@ -52,22 +52,24 @@ export const EmailTranscriptPaneStateful = props => {
52
52
  attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
53
53
  };
54
54
  try {
55
+ var _state$domainStates2, _state$domainStates2$;
55
56
  await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.emailLiveChatTranscript(chatTranscriptBody, {
56
57
  liveChatContext
57
58
  }));
58
- NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
59
+ NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS) ?? (defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS));
59
60
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
60
61
  Event: TelemetryEvent.EmailTranscriptSent,
61
62
  Description: "Transcript sent to email successfully."
62
63
  });
63
64
  } catch (ex) {
65
+ var _state$domainStates3, _state$domainStates3$;
64
66
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
65
67
  Event: TelemetryEvent.EmailTranscriptFailed,
66
68
  ExceptionDetails: {
67
69
  exception: ex
68
70
  }
69
71
  });
70
- const message = formatTemplateString(defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
72
+ const message = formatTemplateString((state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.middlewareLocalizedTexts) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
71
73
  NotificationHandler.notifyError(NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
72
74
  }
73
75
  }, [props.attachmentMessage, props.bannerMessageOnError, facadeChatSDK, state.domainStates.liveChatContext]);
@@ -11,13 +11,14 @@ import { getMockChatSDKIfApplicable } from "./common/getMockChatSDKIfApplicable"
11
11
  import { isNullOrUndefined } from "../../common/utils";
12
12
  import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
13
13
  export const LiveChatWidget = props => {
14
- var _props$mock, _props$chatConfig, _props$chatConfig$Liv;
14
+ var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
15
15
  const reducer = createReducer();
16
16
  const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props));
17
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
18
  const [adapter, setAdapter] = useState(undefined);
19
19
  const [facadeChatSDK, setFacadeChatSDK] = useState(undefined);
20
20
  const chatSDK = getMockChatSDKIfApplicable(props.chatSDK, props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type);
21
+ const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
21
22
  overridePropsOnMockIfApplicable(props);
22
23
  if (!props.chatConfig) {
23
24
  throw new Error("chatConfig is required");
@@ -34,7 +35,7 @@ export const LiveChatWidget = props => {
34
35
  "getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
35
36
  //when type is not undefined, it means the SDK is mocked
36
37
  "isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
37
- }));
38
+ }, disableReauthentication));
38
39
  }
39
40
  return /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
40
41
  value: [facadeChatSDK, setFacadeChatSDK]
@@ -14,19 +14,21 @@ const isInternetConnected = async () => {
14
14
  return false;
15
15
  }
16
16
  };
17
- export const createInternetConnectionChangeHandler = async () => {
17
+ export const createInternetConnectionChangeHandler = async state => {
18
18
  const handler = async () => {
19
19
  const connected = await isInternetConnected();
20
20
  if (!connected) {
21
+ var _state$domainStates, _state$domainStates$m;
21
22
  TelemetryHelper.logActionEvent(LogLevel.WARN, {
22
23
  Event: TelemetryEvent.NetworkDisconnected
23
24
  });
24
- NotificationHandler.notifyError(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
25
+ NotificationHandler.notifyError(NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
25
26
  } else {
27
+ var _state$domainStates2, _state$domainStates2$;
26
28
  TelemetryHelper.logActionEvent(LogLevel.WARN, {
27
29
  Event: TelemetryEvent.NetworkReconnected
28
30
  });
29
- NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
31
+ NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
30
32
  BroadcastService.postMessage({
31
33
  eventName: BroadcastEvent.NetworkReconnected
32
34
  });
@@ -219,7 +219,7 @@ export const LiveChatWidgetStateful = props => {
219
219
  state.domainStates.confirmationState = ConfirmationState.NotSet;
220
220
  setupClientDataStore();
221
221
  registerTelemetryLoggers(props, dispatch);
222
- createInternetConnectionChangeHandler();
222
+ createInternetConnectionChangeHandler(state);
223
223
  dispatch({
224
224
  type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
225
225
  payload: widgetElementId
@@ -808,7 +808,7 @@ export const LiveChatWidgetStateful = props => {
808
808
  const chatWidgetDraggableConfig = {
809
809
  elementId: widgetElementId,
810
810
  channel: ((_props$controlProps12 = props.controlProps) === null || _props$controlProps12 === void 0 ? void 0 : _props$controlProps12.widgetInstanceId) ?? "lcw",
811
- disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) === true ?? false // Draggable by default, unless explicitly disabled
811
+ disabled: ((_props$draggableChatW = props.draggableChatWidgetProps) === null || _props$draggableChatW === void 0 ? void 0 : _props$draggableChatW.disabled) !== true // Draggable by default, unless explicitly disabled
812
812
  };
813
813
 
814
814
  // Disable receiving IDraggableEvent in current window
@@ -64,6 +64,12 @@ export const LoadingPaneStateful = props => {
64
64
  Event: TelemetryEvent.UXLoadingPaneCompleted,
65
65
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
66
66
  });
67
+ return () => {
68
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
69
+ Event: TelemetryEvent.LoadingPaneUnloaded,
70
+ Description: "Loading pane unmount."
71
+ });
72
+ };
67
73
  }, []);
68
74
  return /*#__PURE__*/React.createElement(LoadingPane, {
69
75
  componentOverrides: loadingPaneProps === null || loadingPaneProps === void 0 ? void 0 : loadingPaneProps.componentOverrides,
@@ -53,5 +53,6 @@ export const defaultWebChatStyles = {
53
53
  "<3": "❤️",
54
54
  "</3": "💔",
55
55
  "<\\3": "💔"
56
- }
56
+ },
57
+ uploadMultiple: false
57
58
  };
@@ -21,4 +21,5 @@ export let WebChatActionType;
21
21
  WebChatActionType["WEB_CHAT_DISMISS_NOTIFICATION"] = "WEB_CHAT/DISMISS_NOTIFICATION";
22
22
  WebChatActionType["WEB_CHAT_SET_SEND_BOX"] = "WEB_CHAT/SET_SEND_BOX";
23
23
  WebChatActionType["WEB_CHAT_SEND_FILES"] = "WEB_CHAT/SEND_FILES";
24
+ WebChatActionType["WEB_CHAT_SET_SEND_BOX_ATTACHMENTS"] = "WEB_CHAT/SET_SEND_BOX_ATTACHMENTS";
24
25
  })(WebChatActionType || (WebChatActionType = {}));
@@ -8,19 +8,19 @@
8
8
  import { Constants, MimeTypes, WebChatMiddlewareConstants } from "../../../../../common/Constants";
9
9
  import React from "react";
10
10
  import { getFileAttachmentIconData, isInlineMediaSupported } from "../../../common/utils/FileAttachmentIconManager";
11
+ import Attachment from "./attachments/Attachment";
11
12
  import { BroadcastEvent } from "../../../../../common/telemetry/TelemetryConstants";
12
13
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
14
+ import FileScanStatus from "./attachments/FileScanStatus";
15
+ import MaliciousAttachment from "./attachments/MaliciousAttachment";
16
+ import { NotificationHandler } from "../../notification/NotificationHandler";
17
+ import { NotificationScenarios } from "../../enums/NotificationScenarios";
18
+ import ScanInProgressAttachment from "./attachments/ScanInProgressAttachment";
13
19
  import { WebChatActionType } from "../../enums/WebChatActionType";
14
20
  import { defaultAttachmentAdaptiveCardStyles } from "./defaultStyles/defaultAtttachmentAdaptiveCardStyles";
15
21
  import { defaultAttachmentProps } from "../../../common/defaultProps/defaultAttachmentProps";
16
- import { useChatContextStore } from "../../../../..";
17
- import { NotificationHandler } from "../../notification/NotificationHandler";
18
- import { NotificationScenarios } from "../../enums/NotificationScenarios";
19
22
  import { defaultMiddlewareLocalizedTexts } from "../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
20
- import Attachment from "./attachments/Attachment";
21
- import ScanInProgressAttachment from "./attachments/ScanInProgressAttachment";
22
- import MaliciousAttachment from "./attachments/MaliciousAttachment";
23
- import FileScanStatus from "./attachments/FileScanStatus";
23
+ import { useChatContextStore } from "../../../../..";
24
24
 
25
25
  /**
26
26
  * Patch card with different attachment data.
@@ -12,7 +12,7 @@ const createSendFileAction = files => {
12
12
  payload: {
13
13
  files
14
14
  },
15
- type: WebChatActionType.WEB_CHAT_SEND_FILES
15
+ type: WebChatActionType.WEB_CHAT_SEND_MESSAGE
16
16
  };
17
17
  };
18
18
 
@@ -22,9 +22,9 @@ const attachmentProcessingMiddleware = _ref => {
22
22
  dispatch
23
23
  } = _ref;
24
24
  return next => async action => {
25
- var _action$payload, _action$payload$files;
26
- if ((action === null || action === void 0 ? void 0 : action.type) === WebChatActionType.WEB_CHAT_SEND_FILES && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$files = _action$payload.files) === null || _action$payload$files === void 0 ? void 0 : _action$payload$files.length) > 0) {
27
- const files = action.payload.files;
25
+ var _action$payload, _action$payload$attac;
26
+ if ((action === null || action === void 0 ? void 0 : action.type) === WebChatActionType.WEB_CHAT_SEND_MESSAGE && (action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$attac = _action$payload.attachments) === null || _action$payload$attac === void 0 ? void 0 : _action$payload$attac.length) > 0) {
27
+ const files = action.payload.attachments;
28
28
  if (files.length === 1) {
29
29
  return next(action);
30
30
  }
@@ -5,11 +5,11 @@
5
5
  ******/
6
6
 
7
7
  import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
8
+ import { AMSConstants } from "../../../../../common/Constants";
8
9
  import { NotificationHandler } from "../../notification/NotificationHandler";
9
10
  import { NotificationScenarios } from "../../enums/NotificationScenarios";
10
- import { WebChatActionType } from "../../enums/WebChatActionType";
11
11
  import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
12
- import { AMSConstants } from "../../../../../common/Constants";
12
+ import { WebChatActionType } from "../../enums/WebChatActionType";
13
13
  const MBtoBRatio = 1000000;
14
14
 
15
15
  /*
@@ -20,6 +20,9 @@ const validateAttachment = (action, allowedFileExtensions, maxFileSizeSupportedB
20
20
  var _action$payload, _action$payload$activ, _action$payload2, _action$payload2$acti, _action$payload2$acti2, _action$payload3, _action$payload3$acti, _action$payload3$acti2;
21
21
  const attachments = action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$activ = _action$payload.activity) === null || _action$payload$activ === void 0 ? void 0 : _action$payload$activ.attachments;
22
22
  const attachmentSizes = action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : (_action$payload2$acti2 = _action$payload2$acti.channelData) === null || _action$payload2$acti2 === void 0 ? void 0 : _action$payload2$acti2.attachmentSizes;
23
+ if (!attachments || attachments.length === 0) {
24
+ return action;
25
+ }
23
26
  if (attachments) {
24
27
  for (let i = 0; i < attachments.length; i++) {
25
28
  const maxUploadFileSize = getMaxUploadFileSize(maxFileSizeSupportedByDynamics, attachments[i].contentType);
@@ -190,11 +193,11 @@ const createAttachmentUploadValidatorMiddleware = (allowedFileExtensions, maxFil
190
193
  } = _ref;
191
194
  return next => action => {
192
195
  if (action.type === WebChatActionType.DIRECT_LINE_POST_ACTIVITY) {
193
- var _payload$activity, _payload$activity2, _payload$activity2$ch, _payload$activity3, _payload$activity3$at, _payload$activity4, _payload$activity4$ch, _payload$activity4$ch2;
196
+ var _payload$activity, _payload$activity$att, _payload$activity2, _payload$activity2$ch, _payload$activity2$ch2;
194
197
  const {
195
198
  payload
196
199
  } = action;
197
- if (payload !== null && payload !== void 0 && (_payload$activity = payload.activity) !== null && _payload$activity !== void 0 && _payload$activity.attachments && payload !== null && payload !== void 0 && (_payload$activity2 = payload.activity) !== null && _payload$activity2 !== void 0 && (_payload$activity2$ch = _payload$activity2.channelData) !== null && _payload$activity2$ch !== void 0 && _payload$activity2$ch.attachmentSizes && (payload === null || payload === void 0 ? void 0 : (_payload$activity3 = payload.activity) === null || _payload$activity3 === void 0 ? void 0 : (_payload$activity3$at = _payload$activity3.attachments) === null || _payload$activity3$at === void 0 ? void 0 : _payload$activity3$at.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity4 = payload.activity) === null || _payload$activity4 === void 0 ? void 0 : (_payload$activity4$ch = _payload$activity4.channelData) === null || _payload$activity4$ch === void 0 ? void 0 : (_payload$activity4$ch2 = _payload$activity4$ch.attachmentSizes) === null || _payload$activity4$ch2 === void 0 ? void 0 : _payload$activity4$ch2.length)) {
200
+ if (payload !== null && payload !== void 0 && payload.activity.attachments && payload.activity.attachments.length > 0 && (payload === null || payload === void 0 ? void 0 : (_payload$activity = payload.activity) === null || _payload$activity === void 0 ? void 0 : (_payload$activity$att = _payload$activity.attachments) === null || _payload$activity$att === void 0 ? void 0 : _payload$activity$att.length) === (payload === null || payload === void 0 ? void 0 : (_payload$activity2 = payload.activity) === null || _payload$activity2 === void 0 ? void 0 : (_payload$activity2$ch = _payload$activity2.channelData) === null || _payload$activity2$ch === void 0 ? void 0 : (_payload$activity2$ch2 = _payload$activity2$ch.attachmentSizes) === null || _payload$activity2$ch2 === void 0 ? void 0 : _payload$activity2$ch2.length)) {
198
201
  return next(validateAttachment(action, allowedFileExtensions, maxFileSizeSupportedByDynamics, localizedTexts));
199
202
  }
200
203
  }
@@ -9,7 +9,7 @@ class TranscriptHTMLBuilder {
9
9
  // eslint-disable-line @typescript-eslint/no-explicit-any
10
10
 
11
11
  constructor(options) {
12
- var _this$options, _this$options2, _this$options3, _this$options4, _this$options5, _this$options6, _this$options7, _this$options8, _this$options9, _this$options10, _this$options11, _this$options12;
12
+ var _this$options, _this$options2, _this$options3, _this$options4, _this$options5, _this$options6, _this$options7, _this$options8, _this$options9, _this$options10, _this$options11, _this$options12, _this$options13;
13
13
  _defineProperty(this, "options", void 0);
14
14
  _defineProperty(this, "pageTitle", "Customer Transcript");
15
15
  _defineProperty(this, "attachmentMessage", "The following attachment was uploaded during the conversation: ");
@@ -20,6 +20,7 @@ class TranscriptHTMLBuilder {
20
20
  _defineProperty(this, "agentAvatarFontColor", "#000");
21
21
  _defineProperty(this, "customerAvatarBackgroundColor", "#2266E3");
22
22
  _defineProperty(this, "customerAvatarFontColor", "#FFF");
23
+ _defineProperty(this, "customerDisplayName", "");
23
24
  _defineProperty(this, "disableMarkdownMessageFormatting", false);
24
25
  _defineProperty(this, "disableNewLineMarkdownSupport", false);
25
26
  _defineProperty(this, "externalScripts", {});
@@ -55,13 +56,16 @@ class TranscriptHTMLBuilder {
55
56
  if ((_this$options9 = this.options) !== null && _this$options9 !== void 0 && _this$options9.customerAvatarFontColor) {
56
57
  this.customerAvatarFontColor = this.options.customerAvatarFontColor;
57
58
  }
58
- if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.disableMarkdownMessageFormatting) {
59
+ if ((_this$options10 = this.options) !== null && _this$options10 !== void 0 && _this$options10.customerDisplayName) {
60
+ this.customerDisplayName = this.options.customerDisplayName;
61
+ }
62
+ if ((_this$options11 = this.options) !== null && _this$options11 !== void 0 && _this$options11.disableMarkdownMessageFormatting) {
59
63
  this.disableMarkdownMessageFormatting = this.options.disableMarkdownMessageFormatting;
60
64
  }
61
- if ((_this$options11 = this.options) !== null && _this$options11 !== void 0 && _this$options11.disableNewLineMarkdownSupport) {
65
+ if ((_this$options12 = this.options) !== null && _this$options12 !== void 0 && _this$options12.disableNewLineMarkdownSupport) {
62
66
  this.disableNewLineMarkdownSupport = this.options.disableNewLineMarkdownSupport;
63
67
  }
64
- if ((_this$options12 = this.options) !== null && _this$options12 !== void 0 && _this$options12.externalScripts) {
68
+ if ((_this$options13 = this.options) !== null && _this$options13 !== void 0 && _this$options13.externalScripts) {
65
69
  this.externalScripts = this.options.externalScripts;
66
70
  }
67
71
  }
@@ -523,7 +527,12 @@ class TranscriptHTMLBuilder {
523
527
  const avatarMiddleware = () => (next) => (...args) => {
524
528
  const [card] = args;
525
529
  const {fromUser, activity} = card;
526
- const initials = getIconText(activity.from.name);
530
+ let displayName = getIconText(activity.from.name);
531
+ let customerDisplayName = '${this.customerDisplayName}';
532
+
533
+ if (fromUser && customerDisplayName) {
534
+ displayName = customerDisplayName;
535
+ }
527
536
 
528
537
  const avatarElement = React.createElement(
529
538
  "div",
@@ -531,7 +540,7 @@ class TranscriptHTMLBuilder {
531
540
  React.createElement(
532
541
  "p",
533
542
  null,
534
- \`\${initials}\`
543
+ \`\${displayName}\`
535
544
  )
536
545
  );
537
546
 
@@ -32,11 +32,12 @@ export declare class FacadeChatSDK {
32
32
  private isAuthenticated;
33
33
  private getAuthToken?;
34
34
  private sdkMocked;
35
+ private disableReauthentication;
35
36
  isSDKMocked(): boolean;
36
37
  getChatSDK(): OmnichannelChatSDK;
37
38
  destroy(): void;
38
39
  isTokenSet(): boolean;
39
- constructor(input: IFacadeChatSDKInput);
40
+ constructor(input: IFacadeChatSDKInput, disableReauthentication: boolean);
40
41
  private convertExpiration;
41
42
  private isTokenExpired;
42
43
  private setToken;
@@ -128,6 +128,7 @@ export declare enum TelemetryEvent {
128
128
  ConfirmationCancelButtonClicked = "ConfirmationCancelButtonClicked",
129
129
  ConfirmationConfirmButtonClicked = "ConfirmationConfirmButtonClicked",
130
130
  LoadingPaneLoaded = "LoadingPaneLoaded",
131
+ LoadingPaneUnloaded = "LoadingPaneUnloaded",
131
132
  StartChatErrorPaneLoaded = "StartChatErrorPaneLoaded",
132
133
  EmailTranscriptLoaded = "EmailTranscriptLoaded",
133
134
  OutOfOfficePaneLoaded = "OutOfOfficePaneLoaded",
@@ -31,7 +31,7 @@ export declare class TelemetryHelper {
31
31
  static addWidgetDataToTelemetry(telemetryConfig: ITelemetryConfig, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
32
32
  static addSessionDataToTelemetry(chatSession: LiveChatContext, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
33
33
  static addConversationDataToTelemetry(liveWorkItem: LiveWorkItemDetails, telemetryInternalData: IInternalTelemetryData): IInternalTelemetryData;
34
- static logCallingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper, callId?: string | undefined) => void;
34
+ static logCallingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper, callId?: string) => void;
35
35
  static logLoadingEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
36
36
  static logUIEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
37
37
  static logActionEvent: (logLevel: LogLevel, payload: TelemetryEventWrapper) => void;
@@ -74,4 +74,4 @@ export interface ACSAdapterContract extends BaseContract {
74
74
  Event?: string;
75
75
  ErrorCode?: string;
76
76
  }
77
- export declare type TelemetryContract = OCChatSDKContract | IC3ClientContract | ActionsContract | LoadContract | WebChatContract | ConfigValidationContract | CallingContract | ACSAdapterContract | BaseContract | any;
77
+ export type TelemetryContract = OCChatSDKContract | IC3ClientContract | ActionsContract | LoadContract | WebChatContract | ConfigValidationContract | CallingContract | ACSAdapterContract | BaseContract | any;
@@ -102,4 +102,4 @@ export interface FacadeChatSDKTelemetryData extends BaseTelemetryData {
102
102
  ExceptionDetails?: object;
103
103
  Description?: string;
104
104
  }
105
- export declare type TelemetryData = ConfigValidationTelemetryData | OCChatSDKTelemetryData | IC3ClientTelemetryData | LoadTelemetryData | ActionTelemetryData | WebChatTelemetryData | CallingTelemetryData | MessageProcessingErrorData;
105
+ export type TelemetryData = ConfigValidationTelemetryData | OCChatSDKTelemetryData | IC3ClientTelemetryData | LoadTelemetryData | ActionTelemetryData | WebChatTelemetryData | CallingTelemetryData | MessageProcessingErrorData;
@@ -1,4 +1,4 @@
1
1
  import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
2
2
  import { IDownloadTranscriptProps } from "./interfaces/IDownloadTranscriptProps";
3
3
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
4
- export declare const downloadTranscript: (facadeChatSDK: FacadeChatSDK, downloadTranscriptProps: IDownloadTranscriptProps, state?: ILiveChatWidgetContext | undefined) => Promise<void>;
4
+ export declare const downloadTranscript: (facadeChatSDK: FacadeChatSDK, downloadTranscriptProps: IDownloadTranscriptProps, state?: ILiveChatWidgetContext) => Promise<void>;
@@ -10,4 +10,5 @@ export interface IWebChatTranscriptConfig {
10
10
  agentAvatarFontColor?: string;
11
11
  customerAvatarBackgroundColor?: string;
12
12
  customerAvatarFontColor?: string;
13
+ customerDisplayName?: string;
13
14
  }
@@ -1,7 +1,7 @@
1
1
  import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
2
2
  import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
3
3
  declare const getAuthClientFunction: (chatConfig: ChatConfig | undefined) => string | undefined;
4
- declare const handleAuthentication: (chatSDK: OmnichannelChatSDK, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string | undefined) => Promise<string | null>) | undefined) => Promise<{
4
+ declare const handleAuthentication: (chatSDK: OmnichannelChatSDK, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string) => Promise<string | null>) | undefined) => Promise<{
5
5
  result: boolean;
6
6
  token: string | null;
7
7
  error?: undefined;
@@ -1,3 +1,3 @@
1
1
  import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
2
2
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
3
- export declare const createAdapter: (facadeChatSDK: FacadeChatSDK, props?: ILiveChatWidgetProps | undefined) => Promise<any>;
3
+ export declare const createAdapter: (facadeChatSDK: FacadeChatSDK, props?: ILiveChatWidgetProps) => Promise<any>;
@@ -1,7 +1,7 @@
1
1
  import { StyleOptions } from "botframework-webchat-api";
2
2
  import { IDownloadTranscriptProps } from "../../footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps";
3
3
  import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
4
- declare const createDownloadTranscriptProps: (downloadTranscriptProps: IDownloadTranscriptProps, webChatStyles: StyleOptions, webChatContainerProps?: IWebChatContainerStatefulProps | undefined) => {
4
+ declare const createDownloadTranscriptProps: (downloadTranscriptProps: IDownloadTranscriptProps, webChatStyles: StyleOptions, webChatContainerProps?: IWebChatContainerStatefulProps) => {
5
5
  webChatTranscript: {
6
6
  disableNewLineMarkdownSupport: boolean | undefined;
7
7
  disableMarkdownMessageFormatting: boolean | undefined;
@@ -16,6 +16,7 @@ declare const createDownloadTranscriptProps: (downloadTranscriptProps: IDownload
16
16
  attachmentMessage?: string | undefined;
17
17
  networkOnlineMessage?: string | undefined;
18
18
  networkOfflineMessage?: string | undefined;
19
+ customerDisplayName?: string | undefined;
19
20
  };
20
21
  attachmentMessage?: string | undefined;
21
22
  bannerMessageOnError?: string | undefined;
@@ -1 +1,2 @@
1
- export declare const createInternetConnectionChangeHandler: () => Promise<void>;
1
+ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
2
+ export declare const createInternetConnectionChangeHandler: (state: ILiveChatWidgetContext) => Promise<void>;
@@ -4,7 +4,7 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
4
4
  import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
5
5
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
6
6
  declare const prepareEndChat: (props: ILiveChatWidgetProps, facadeChatSDK: FacadeChatSDK, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any) => Promise<void>;
7
- declare const endChat: (props: ILiveChatWidgetProps, facadeChatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined) => Promise<void>;
7
+ declare const endChat: (props: ILiveChatWidgetProps, facadeChatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean, skipCloseChat?: boolean, postMessageToOtherTab?: boolean) => Promise<void>;
8
8
  export declare const callingStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
9
9
  export declare const endChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
10
10
  export declare const closeChatStateCleanUp: (dispatch: Dispatch<ILiveChatWidgetAction>) => void;
@@ -1 +1 @@
1
- export declare const getMockChatSDKIfApplicable: (chatSDK: any, type?: string | undefined) => any;
1
+ export declare const getMockChatSDKIfApplicable: (chatSDK: any, type?: string) => any;
@@ -7,6 +7,6 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
7
7
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
8
8
  declare const handleChatReconnect: (facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<boolean>;
9
9
  declare const getChatReconnectContext: (facadeChatSDK: FacadeChatSDK, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<import("@microsoft/omnichannel-chat-sdk/lib/core/ChatReconnectContext").default | undefined>;
10
- declare const isReconnectEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
11
- declare const isPersistentEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
10
+ declare const isReconnectEnabled: (chatConfig?: ChatConfig) => boolean;
11
+ declare const isPersistentEnabled: (chatConfig?: ChatConfig) => boolean;
12
12
  export { handleChatReconnect, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
@@ -1,4 +1,4 @@
1
1
  import { Dispatch } from "react";
2
2
  import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
3
3
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
4
- export declare const setPostChatContextAndLoadSurvey: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean | undefined) => Promise<void>;
4
+ export declare const setPostChatContextAndLoadSurvey: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean) => Promise<void>;
@@ -5,7 +5,7 @@ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidget
5
5
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
6
6
  import StartChatOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/StartChatOptionalParams";
7
7
  declare const prepareStartChat: (props: ILiveChatWidgetProps, facadeChatSDK: FacadeChatSDK, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
8
- declare const setPreChatAndInitiateChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | undefined, proactiveChatEnablePrechatState?: boolean | undefined, state?: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps | undefined) => Promise<void>;
9
- declare const initStartChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, state: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps | undefined, params?: StartChatOptionalParams | undefined, persistedState?: any) => Promise<void>;
8
+ declare const setPreChatAndInitiateChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | false, proactiveChatEnablePrechatState?: boolean | false, state?: ILiveChatWidgetContext, props?: ILiveChatWidgetProps) => Promise<void>;
9
+ declare const initStartChat: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, state: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps, params?: StartChatOptionalParams, persistedState?: any) => Promise<void>;
10
10
  declare const checkIfConversationStillValid: (facadeChatSDK: FacadeChatSDK, dispatch: Dispatch<ILiveChatWidgetAction>, state: ILiveChatWidgetContext) => Promise<boolean>;
11
11
  export { prepareStartChat, initStartChat, setPreChatAndInitiateChat, checkIfConversationStillValid };
@@ -3,4 +3,4 @@ import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
3
3
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
4
4
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
5
5
  export declare const handleStartChatError: (dispatch: Dispatch<ILiveChatWidgetAction>, facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps | undefined, ex: any, isStartChatSuccessful: boolean) => void;
6
- export declare const logWidgetLoadComplete: (additionalMessage?: string | undefined) => void;
6
+ export declare const logWidgetLoadComplete: (additionalMessage?: string) => void;
@@ -1,4 +1,4 @@
1
1
  import { Dispatch } from "react";
2
2
  import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
3
3
  import { IProactiveChatNotificationConfig } from "../../proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig";
4
- export declare const startProactiveChat: (dispatch: Dispatch<ILiveChatWidgetAction>, notificationConfig?: IProactiveChatNotificationConfig | undefined, enablePreChat?: boolean | undefined, inNewWindow?: boolean | undefined) => void;
4
+ export declare const startProactiveChat: (dispatch: Dispatch<ILiveChatWidgetAction>, notificationConfig?: IProactiveChatNotificationConfig, enablePreChat?: boolean, inNewWindow?: boolean) => void;
@@ -0,0 +1,3 @@
1
+ export interface IFeatureConfigProps {
2
+ disableReauthentication?: boolean;
3
+ }
@@ -3,29 +3,30 @@ import { IAudioNotificationProps } from "../../footerstateful/audionotifications
3
3
  import { ICallingContainerProps } from "@microsoft/omnichannel-chat-components/lib/types/components/callingcontainer/interfaces/ICallingContainerProps";
4
4
  import { IChatButtonProps } from "@microsoft/omnichannel-chat-components/lib/types/components/chatbutton/interfaces/IChatButtonProps";
5
5
  import { IConfirmationPaneStatefulProps } from "../../confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps";
6
+ import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
6
7
  import { IDownloadTranscriptProps } from "../../footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps";
8
+ import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
7
9
  import { IEmailTranscriptPaneProps } from "../../emailtranscriptpanestateful/interfaces/IEmailTranscriptPaneProps";
10
+ import { IFeatureConfigProps } from "./IFeatureConfigProps";
8
11
  import { IFooterProps } from "@microsoft/omnichannel-chat-components/lib/types/components/footer/interfaces/IFooterProps";
9
12
  import { IHeaderProps } from "@microsoft/omnichannel-chat-components/lib/types/components/header/interfaces/IHeaderProps";
10
13
  import { ILiveChatWidgetComponentOverrides } from "./ILiveChatWidgetComponentOverrides";
14
+ import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
11
15
  import { ILiveChatWidgetControlProps } from "./ILiveChatWidgetControlProps";
12
16
  import { ILiveChatWidgetStyleProps } from "./ILiveChatWidgetStyleProps";
13
17
  import { ILoadingPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/loadingpane/interfaces/ILoadingPaneProps";
18
+ import { IMockProps } from "./IMockProps";
19
+ import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
14
20
  import { IOOOHPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/outofofficehourspane/interfaces/IOOOHPaneProps";
21
+ import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
15
22
  import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
16
23
  import { IProactiveChatPaneStatefulProps } from "../../proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps";
17
24
  import { IReconnectChatPaneStatefulProps } from "../../reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps";
25
+ import { IScrollBarProps } from "./IScrollBarProps";
18
26
  import { IStartChatErrorPaneProps } from "../../startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps";
19
27
  import { ITelemetryConfig } from "../../../common/telemetry/interfaces/ITelemetryConfig";
20
28
  import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
21
29
  import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
22
- import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
23
- import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
24
- import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
25
- import { IScrollBarProps } from "./IScrollBarProps";
26
- import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
27
- import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
28
- import { IMockProps } from "./IMockProps";
29
30
  export interface ILiveChatWidgetProps {
30
31
  audioNotificationProps?: IAudioNotificationProps;
31
32
  callingContainerProps?: ICallingContainerProps;
@@ -63,4 +64,5 @@ export interface ILiveChatWidgetProps {
63
64
  initialCustomContext?: any;
64
65
  draggableChatWidgetProps?: IDraggableChatWidgetProps;
65
66
  mock?: IMockProps;
67
+ featureConfigProps?: IFeatureConfigProps;
66
68
  }
@@ -3,5 +3,5 @@
3
3
  *
4
4
  * @param extension File extension
5
5
  */
6
- export declare const getFileAttachmentIconData: (extension: string) => unknown;
6
+ export declare const getFileAttachmentIconData: (extension: string) => {};
7
7
  export declare const isInlineMediaSupported: (attachmentName: string) => boolean;
@@ -12,7 +12,7 @@ export interface IWebChatProps {
12
12
  children?: ReactNode;
13
13
  dir?: string;
14
14
  disabled?: boolean;
15
- downscaleImageToDataURL?: (blob: Blob, maxWidth: number, maxHeight: number, type: string, quality: number) => string;
15
+ downscaleImageToDataURL?: (blob: Blob, maxWidth: number, maxHeight: number, type: string, quality: number) => Promise<URL>;
16
16
  grammars?: any;
17
17
  groupActivitiesMiddleware?: OneOrMany<GroupActivitiesMiddleware>;
18
18
  internalErrorBoxClass?: React.Component | Function;
@@ -19,5 +19,6 @@ export declare enum WebChatActionType {
19
19
  WEB_CHAT_SET_NOTIFICATION = "WEB_CHAT/SET_NOTIFICATION",
20
20
  WEB_CHAT_DISMISS_NOTIFICATION = "WEB_CHAT/DISMISS_NOTIFICATION",
21
21
  WEB_CHAT_SET_SEND_BOX = "WEB_CHAT/SET_SEND_BOX",
22
- WEB_CHAT_SEND_FILES = "WEB_CHAT/SEND_FILES"
22
+ WEB_CHAT_SEND_FILES = "WEB_CHAT/SEND_FILES",
23
+ WEB_CHAT_SET_SEND_BOX_ATTACHMENTS = "WEB_CHAT/SET_SEND_BOX_ATTACHMENTS"
23
24
  }
@@ -7,4 +7,4 @@
7
7
  * 3. Decodes certain html characters that came through from chat services
8
8
  ******/
9
9
  import React from "react";
10
- export declare const createActivityMiddleware: (renderMarkdown: (text: string) => string, systemMessageStyleProps?: React.CSSProperties | undefined, userMessageStyleProps?: React.CSSProperties | undefined) => () => (next: any) => (...args: any) => any;
10
+ export declare const createActivityMiddleware: (renderMarkdown: (text: string) => string, systemMessageStyleProps?: React.CSSProperties, userMessageStyleProps?: React.CSSProperties) => () => (next: any) => (...args: any) => any;
@@ -5,4 +5,4 @@
5
5
  * 1. Renders the first two letters of the sender as the profile pic
6
6
  ******/
7
7
  import React from "react";
8
- export declare const createAvatarMiddleware: (avatarStyleProps?: React.CSSProperties | undefined, avatarTextStyleProps?: React.CSSProperties | undefined) => () => (next: any) => (args_0: any) => false | (() => JSX.Element);
8
+ export declare const createAvatarMiddleware: (avatarStyleProps?: React.CSSProperties, avatarTextStyleProps?: React.CSSProperties) => () => (next: any) => (args_0: any) => false | (() => JSX.Element);
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Checks if the attachment being uploaded satisfies Omnichannel's requirement on file extensions and file size.
5
5
  ******/
6
- import { IWebChatAction } from "../../../interfaces/IWebChatAction";
7
6
  import { ILiveChatWidgetLocalizedTexts } from "../../../../../contexts/common/ILiveChatWidgetLocalizedTexts";
7
+ import { IWebChatAction } from "../../../interfaces/IWebChatAction";
8
8
  declare const createAttachmentUploadValidatorMiddleware: (allowedFileExtensions: string, maxFileSizeSupportedByDynamics: string, localizedTexts: ILiveChatWidgetLocalizedTexts) => ({ dispatch }: {
9
9
  dispatch: any;
10
10
  }) => (next: any) => (action: IWebChatAction) => any;
@@ -1,2 +1,2 @@
1
- declare const useChatSDKStore: () => unknown;
1
+ declare const useChatSDKStore: () => {};
2
2
  export default useChatSDKStore;
@@ -1,3 +1,3 @@
1
- declare type FunctionType = (...args: unknown[]) => void;
1
+ type FunctionType = (...args: unknown[]) => void;
2
2
  export default function useDebounce<Fn extends FunctionType>(func: Fn, delay?: number): Fn;
3
3
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.5",
3
+ "version": "1.7.6-main.9b09b06",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -60,26 +60,28 @@
60
60
  "jest-dom": "^4.0.0",
61
61
  "jest-image-snapshot": "^4.5.1",
62
62
  "json": "^11.0.0",
63
- "playwright": "^1.16.3",
63
+ "p-defer": "^4.0.1",
64
+ "playwright": "^1.20.0",
64
65
  "postcss": "^8.3.9",
65
66
  "react": "^17.0.2",
67
+ "react-docgen-typescript-plugin": "^1.0.8",
66
68
  "react-dom": "^17.0.2",
67
69
  "react-test-renderer": "^17.0.2",
68
70
  "storybook-addon-playwright": "^4.9.2",
69
71
  "swiper": "^9.0.5",
70
72
  "terser-webpack-plugin": "^4.2.3",
71
73
  "ts-loader": "^9.2.6",
72
- "typescript": "4.6.4",
74
+ "typescript": "4.9.5",
73
75
  "webpack": "^4.44.2",
74
76
  "webpack-cli": "^4.9.2"
75
77
  },
76
78
  "dependencies": {
77
79
  "@azure/core-tracing": "^1.2.0",
78
- "@microsoft/omnichannel-chat-components": "1.1.5",
79
- "@microsoft/omnichannel-chat-sdk": "^1.10.9",
80
+ "@microsoft/omnichannel-chat-components": "1.1.8",
81
+ "@microsoft/omnichannel-chat-sdk": "^1.10.11",
80
82
  "@opentelemetry/api": "^1.9.0",
81
83
  "abort-controller-es5": "^2.0.1",
82
- "dompurify": "^2.5.4",
84
+ "dompurify": "^3.2.4",
83
85
  "markdown-it": "^12.3.2",
84
86
  "markdown-it-attrs": "^4.1.6",
85
87
  "markdown-it-attrs-es5": "^2.0.2",
@@ -99,7 +101,7 @@
99
101
  "test:unit": "jest -c jest.config.unit.cjs --env=jsdom --runInBand --force-exit",
100
102
  "test:e2e": "cd automation_tests && yarn test",
101
103
  "test:e2e:build": "yarn build-sample && cd automation_tests && yarn test",
102
- "test:visual": "jest -c jest.config.visual.cjs",
104
+ "test:visual": "jest -c jest.config.visual.cjs --verbose",
103
105
  "test:all": "yarn test:unit && yarn test:visual",
104
106
  "build:esm": "babel ./src --config-file ./babel.esm.config.json --out-dir lib/esm --extensions .ts,.js,.tsx --ignore **/*.test.ts,**/*.stories.tsx,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx",
105
107
  "build:cjs": "babel ./src --config-file ./babel.config.json --out-dir lib/cjs --extensions .ts,.js,.tsx --ignore **/*.test.ts,**/*.stories.tsx,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx",
@@ -109,7 +111,8 @@
109
111
  "build-sample": "yarn build && webpack --config ./webpack.config.cjs",
110
112
  "build-sample:dev": "yarn build && webpack --config ./webpack.dev.config.cjs",
111
113
  "test:visual:build": "yarn build-storybook && yarn test:visual",
112
- "lint": "yarn eslint . --max-warnings=0"
114
+ "lint": "yarn eslint . --max-warnings=0",
115
+ "pretest:visual": "yarn playwright install"
113
116
  },
114
117
  "resolutions": {
115
118
  "**/url-parse": "1.5.9",
@@ -117,5 +120,11 @@
117
120
  "**/abort-controller-es5": "^2.0.1",
118
121
  "**/minimist": "1.2.6",
119
122
  "**/sanitize-html": "2.12.1"
123
+ },
124
+ "jest": {
125
+ "verbose": true,
126
+ "reporters": [
127
+ "default"
128
+ ]
120
129
  }
121
130
  }