@microsoft/omnichannel-chat-widget 1.7.3-main.fee24eb → 1.7.3

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 (47) hide show
  1. package/lib/cjs/common/Constants.js +1 -0
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -0
  3. package/lib/cjs/components/footerstateful/FooterStateful.js +14 -3
  4. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +15 -6
  5. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +77 -0
  6. package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +2 -2
  7. package/lib/cjs/components/livechatwidget/common/createAdapter.js +15 -2
  8. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +6 -2
  9. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +2 -2
  10. package/lib/cjs/components/livechatwidget/common/helpers/markdownHelper.js +23 -0
  11. package/lib/cjs/components/livechatwidget/common/persistentChatHelper.js +2 -1
  12. package/lib/cjs/components/livechatwidget/common/startChat.js +3 -3
  13. package/lib/cjs/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
  14. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +30 -0
  15. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
  16. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +8 -0
  17. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
  18. package/lib/cjs/plugins/createChatTranscript.js +84 -0
  19. package/lib/esm/common/Constants.js +1 -0
  20. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  21. package/lib/esm/components/footerstateful/FooterStateful.js +12 -3
  22. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +15 -6
  23. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +70 -0
  24. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
  25. package/lib/esm/components/livechatwidget/common/createAdapter.js +14 -2
  26. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +6 -2
  27. package/lib/esm/components/livechatwidget/common/createMarkdown.js +2 -2
  28. package/lib/esm/components/livechatwidget/common/helpers/markdownHelper.js +15 -0
  29. package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +2 -1
  30. package/lib/esm/components/livechatwidget/common/startChat.js +3 -3
  31. package/lib/esm/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
  32. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -1
  33. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
  34. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +8 -0
  35. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
  36. package/lib/esm/plugins/createChatTranscript.js +84 -0
  37. package/lib/types/common/Constants.d.ts +1 -0
  38. package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -1
  39. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +4 -1
  40. package/lib/types/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.d.ts +7 -0
  41. package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
  42. package/lib/types/components/livechatwidget/common/helpers/markdownHelper.d.ts +2 -0
  43. package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +4 -0
  44. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +6 -0
  45. package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +4 -0
  46. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  47. package/package.json +2 -2
@@ -307,6 +307,7 @@ class WidgetLoadCustomErrorString {}
307
307
  exports.WidgetLoadCustomErrorString = WidgetLoadCustomErrorString;
308
308
  _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
309
309
  _defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
310
+ _defineProperty(WidgetLoadCustomErrorString, "CloseAdapterAfterDisconnectionErrorString", "Error trying to end/close chat adapter after the widget is back on-line, for an already disconnected session");
310
311
  class PrepareEndChatDescriptionConstants {}
311
312
  exports.PrepareEndChatDescriptionConstants = PrepareEndChatDescriptionConstants;
312
313
  _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithoutPostChat", "Conversation ended by customer. Post chat not configured or should not show.");
@@ -215,6 +215,8 @@ exports.TelemetryEvent = TelemetryEvent;
215
215
  TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
216
216
  TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
217
217
  TelemetryEvent["ChatDisconnectThreadEventReceived"] = "ChatDisconnectThreadEventReceived";
218
+ TelemetryEvent["HiddenAdaptiveCardMessageReceived"] = "HiddenAdaptiveCardMessageReceived";
219
+ TelemetryEvent["EndingAdapterAfterDisconnectionError"] = "EndingAdapterAfterDisconnectionError";
218
220
  })(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
219
221
  class TelemetryConstants {
220
222
  static map(eventTypeOrScenarioType) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.FooterStateful = void 0;
7
7
  var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
  var _AudioNotificationStateful = _interopRequireDefault(require("./audionotificationstateful/AudioNotificationStateful"));
10
10
  var _Constants = require("../../common/Constants");
11
11
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
@@ -18,9 +18,11 @@ var _DownloadTranscriptStateful = require("./downloadtranscriptstateful/Download
18
18
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
19
19
  var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ 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); }
22
+ 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; }
21
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
24
  const FooterStateful = props => {
23
- var _footerProps$controlP3, _footerProps$controlP4;
25
+ var _footerProps$controlP3, _footerProps$controlP6;
24
26
  const [state, dispatch] = (0, _useChatContextStore.default)();
25
27
  // hideFooterDisplay - the purpose of this is to keep the footer always "active",
26
28
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
@@ -87,13 +89,22 @@ const FooterStateful = props => {
87
89
  isAudioMuted: state.appStates.isAudioMuted
88
90
  }
89
91
  };
92
+ (0, _react.useEffect)(() => {
93
+ if (state.appStates.isAudioMuted === null) {
94
+ var _footerProps$controlP4, _footerProps$controlP5;
95
+ dispatch({
96
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
97
+ payload: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : (_footerProps$controlP5 = _footerProps$controlP4.audioNotificationButtonProps) === null || _footerProps$controlP5 === void 0 ? void 0 : _footerProps$controlP5.isAudioMuted) ?? false
98
+ });
99
+ }
100
+ }, []);
90
101
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hideFooterDisplay && /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Footer, {
91
102
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
92
103
  controlProps: controlProps,
93
104
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
94
105
  }), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
95
106
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
96
- isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
107
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP6 = footerProps.controlProps) === null || _footerProps$controlP6 === void 0 ? void 0 : _footerProps$controlP6.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
97
108
  }));
98
109
  };
99
110
  exports.FooterStateful = FooterStateful;
@@ -13,8 +13,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
13
13
  const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
14
14
  const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
15
15
  const delay = t => new Promise(resolve => setTimeout(resolve, t));
16
- const fetchBotAuthConfigRetries = 3;
17
- const fetchBotAuthConfigRetryInterval = 1000;
18
16
  let response;
19
17
  const extractSignInId = signInUrl => {
20
18
  const result = botOauthUrlRegex.exec(signInUrl);
@@ -43,7 +41,7 @@ const extractSasUrl = async attachment => {
43
41
  }
44
42
  return sasUrl;
45
43
  };
46
- const fetchBotAuthConfig = async retries => {
44
+ const fetchBotAuthConfig = async (retries, interval) => {
47
45
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
48
46
  Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderFetchConfig
49
47
  });
@@ -64,14 +62,25 @@ const fetchBotAuthConfig = async retries => {
64
62
  // Base Case
65
63
  throw new Error();
66
64
  }
67
- await delay(fetchBotAuthConfigRetryInterval);
68
- return await fetchBotAuthConfig(--retries);
65
+ await delay(interval);
66
+ return await fetchBotAuthConfig(--retries, interval);
69
67
  };
70
68
  class BotAuthActivitySubscriber {
71
69
  constructor() {
70
+ let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
72
71
  _defineProperty(this, "observer", void 0);
73
72
  _defineProperty(this, "signInCardSeen", void 0);
73
+ _defineProperty(this, "fetchBotAuthConfigRetries", void 0);
74
+ _defineProperty(this, "fetchBotAuthConfigRetryInterval", void 0);
74
75
  this.signInCardSeen = new Set();
76
+ this.fetchBotAuthConfigRetries = 3;
77
+ this.fetchBotAuthConfigRetryInterval = 1000;
78
+ if (optionalParams.fetchBotAuthConfigRetries) {
79
+ this.fetchBotAuthConfigRetries = optionalParams.fetchBotAuthConfigRetries;
80
+ }
81
+ if (optionalParams.fetchBotAuthConfigRetryInterval) {
82
+ this.fetchBotAuthConfigRetryInterval = optionalParams.fetchBotAuthConfigRetryInterval;
83
+ }
75
84
  }
76
85
  applicable(activity) {
77
86
  var _activity$attachments;
@@ -110,7 +119,7 @@ class BotAuthActivitySubscriber {
110
119
  _omnichannelChatComponents.BroadcastService.postMessage(event);
111
120
  }
112
121
  try {
113
- const response = await fetchBotAuthConfig(fetchBotAuthConfigRetries);
122
+ const response = await fetchBotAuthConfig(this.fetchBotAuthConfigRetries, this.fetchBotAuthConfigRetryInterval);
114
123
  if (response === false) {
115
124
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
116
125
  Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderHideCard
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.HiddenAdaptiveCardActivitySubscriber = void 0;
7
+ var _Constants = require("../../../../common/Constants");
8
+ var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
9
+ var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
10
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
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; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
+ class HiddenAdaptiveCardActivitySubscriber {
15
+ constructor() {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ _defineProperty(this, "observer", void 0);
18
+ }
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ async apply(activity) {
21
+ const {
22
+ attachments,
23
+ attachment
24
+ } = activity;
25
+ this.observer.next(false);
26
+ _omnichannelChatComponents.BroadcastService.postMessage({
27
+ eventName: _TelemetryConstants.BroadcastEvent.NewMessageReceived,
28
+ payload: {
29
+ attachments: attachments || [attachment],
30
+ text: "Custom Event"
31
+ }
32
+ });
33
+ return;
34
+ }
35
+
36
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
37
+ applicable(activity) {
38
+ const {
39
+ attachments,
40
+ attachment
41
+ } = activity;
42
+
43
+ // Use `attachments` or `attachment` (whichever exists)
44
+ const cards = attachments || [attachment];
45
+
46
+ // Check if contentType is "AdaptiveCard"
47
+ const adaptiveCard = cards === null || cards === void 0 ? void 0 : cards.find(
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ item => _Constants.Constants.supportedAdaptiveCardContentTypes.indexOf(item === null || item === void 0 ? void 0 : item.contentType) >= 0);
50
+ if (adaptiveCard && adaptiveCard.content) {
51
+ const {
52
+ body
53
+ } = adaptiveCard.content;
54
+ if (Array.isArray(body)) {
55
+ // Check if all elements in `body` have `isVisible: false`
56
+ const allInvisible = body.every(item => item.isVisible === false);
57
+ if (allInvisible) {
58
+ _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
59
+ Event: _TelemetryConstants.TelemetryEvent.HiddenAdaptiveCardMessageReceived,
60
+ Description: "All elements in AdaptiveCard are invisible"
61
+ });
62
+ return true;
63
+ }
64
+ }
65
+ }
66
+ return false;
67
+ }
68
+
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
+ async next(activity) {
71
+ if (this.applicable(activity)) {
72
+ return await this.apply(activity);
73
+ }
74
+ return activity;
75
+ }
76
+ }
77
+ exports.HiddenAdaptiveCardActivitySubscriber = HiddenAdaptiveCardActivitySubscriber;
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.handleChatDisconnect = void 0;
7
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
7
8
  var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
8
9
  var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
9
- var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
10
- var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
11
10
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
11
+ var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
12
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
13
  const handleChatDisconnect = (props, state, setWebChatStyles) => {
14
14
  var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
@@ -11,8 +11,14 @@ var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/c
11
11
  var _ChatAdapterShim = require("./ChatAdapterShim");
12
12
  var _PauseActivitySubscriber = require("./ActivitySubscriber/PauseActivitySubscriber");
13
13
  var _BotAuthActivitySubscriber = require("./ActivitySubscriber/BotAuthActivitySubscriber");
14
+ var _HiddenAdaptiveCardActivitySubscriber = require("./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber");
15
+ const defaultBotAuthConfig = {
16
+ fetchBotAuthConfigRetries: 3,
17
+ fetchBotAuthConfigRetryInterval: 1000
18
+ };
19
+
14
20
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- const createAdapter = async chatSDK => {
21
+ const createAdapter = async (chatSDK, props) => {
16
22
  const chatAdapterOptionalParams = {
17
23
  IC3Adapter: {
18
24
  options: {
@@ -38,9 +44,16 @@ const createAdapter = async chatSDK => {
38
44
  let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams);
39
45
  //so far, there is no need to convert to the shim adapter when using visual tests
40
46
  if (chatSDK.isMockModeOn !== true) {
47
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4;
48
+ const botAuthActivitySubscriberOptionalParams = {
49
+ fetchBotAuthConfigRetries: (props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.botAuthConfig) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.fetchBotAuthConfigRetries) || defaultBotAuthConfig.fetchBotAuthConfigRetries,
50
+ fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval
51
+ };
41
52
  adapter = new _ChatAdapterShim.ChatAdapterShim(adapter);
42
53
  adapter.addSubscriber(new _PauseActivitySubscriber.PauseActivitySubscriber());
43
- adapter.addSubscriber(new _BotAuthActivitySubscriber.BotAuthActivitySubscriber());
54
+ adapter.addSubscriber(new _BotAuthActivitySubscriber.BotAuthActivitySubscriber(botAuthActivitySubscriberOptionalParams));
55
+ // Remove this code after ICM ID:544623085 is fixed
56
+ adapter.addSubscriber(new _HiddenAdaptiveCardActivitySubscriber.HiddenAdaptiveCardActivitySubscriber());
44
57
  return adapter.chatAdapter;
45
58
  }
46
59
  return adapter;
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createInternetConnectionChangeHandler = void 0;
7
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
7
9
  var _Constants = require("../../../common/Constants");
8
10
  var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
9
11
  var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
10
- var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
11
12
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
12
- var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
13
+ var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
13
14
  const isInternetConnected = async () => {
14
15
  try {
15
16
  const response = await fetch(_Constants.Constants.internetConnectionTestUrl);
@@ -32,6 +33,9 @@ const createInternetConnectionChangeHandler = async () => {
32
33
  Event: _TelemetryConstants.TelemetryEvent.NetworkReconnected
33
34
  });
34
35
  _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
36
+ _omnichannelChatComponents.BroadcastService.postMessage({
37
+ eventName: _TelemetryConstants.BroadcastEvent.NetworkReconnected
38
+ });
35
39
  }
36
40
  };
37
41
 
@@ -7,8 +7,8 @@ exports.createMarkdown = void 0;
7
7
  var _Constants = require("../../../common/Constants");
8
8
  var _markdownIt = _interopRequireDefault(require("markdown-it"));
9
9
  var _markdownItForInline = _interopRequireDefault(require("markdown-it-for-inline"));
10
- var _slackMarkdownIt = _interopRequireDefault(require("slack-markdown-it"));
11
10
  var _defaultMarkdownLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts");
11
+ var _markdownHelper = require("./helpers/markdownHelper");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
14
  const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineMarkdownSupport) => {
@@ -19,7 +19,7 @@ const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineMarkdown
19
19
  linkify: true,
20
20
  breaks: !disableNewLineMarkdownSupport
21
21
  });
22
- markdown.use(_slackMarkdownIt.default);
22
+ markdown = (0, _markdownHelper.addSlackMarkdownIt)(markdown);
23
23
  } else {
24
24
  markdown = new _markdownIt.default(_Constants.Constants.Zero, {
25
25
  html: true,
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.addSlackMarkdownIt = void 0;
7
+ var _slackMarkdownIt = _interopRequireDefault(require("slack-markdown-it"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const addSlackMarkdownIt = markdown => {
10
+ try {
11
+ markdown.use(_slackMarkdownIt.default);
12
+ } catch (e) {
13
+ // this is to support the case when slack-markdown-it
14
+ // transpiled code doesn't export default (webpack5)
15
+ if (_slackMarkdownIt.default.default.apply) {
16
+ markdown.use(_slackMarkdownIt.default.default);
17
+ } else {
18
+ console.error("Error while adding slackMarkdown plugin", e);
19
+ }
20
+ }
21
+ return markdown;
22
+ };
23
+ exports.addSlackMarkdownIt = addSlackMarkdownIt;
@@ -11,7 +11,8 @@ const shouldSetPreChatIfPersistentChat = async (chatSDK, conversationMode, showP
11
11
  let skipPreChat = false;
12
12
  if (persistentEnabled) {
13
13
  const reconnectableChatsParams = {
14
- authenticatedUserToken: chatSDK.authenticatedUserToken
14
+ authenticatedUserToken: chatSDK.authenticatedUserToken,
15
+ requestId: chatSDK.requestId
15
16
  };
16
17
  try {
17
18
  const reconnectableChatsResponse = await chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams);
@@ -209,7 +209,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
209
209
  isStartChatSuccessful = false;
210
210
  throw error;
211
211
  }
212
- await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter);
212
+ await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter, props);
213
213
 
214
214
  // Set app state to Active
215
215
  if (isStartChatSuccessful) {
@@ -260,10 +260,10 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
260
260
 
261
261
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
262
262
  exports.initStartChat = initStartChat;
263
- const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter) => {
263
+ const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter, props) => {
264
264
  var _newAdapter$activity$;
265
265
  // New adapter creation
266
- const newAdapter = await (0, _createAdapter.createAdapter)(chatSDK);
266
+ const newAdapter = await (0, _createAdapter.createAdapter)(chatSDK, props);
267
267
  setAdapter(newAdapter);
268
268
  const chatToken = await chatSDK.getChatToken();
269
269
  dispatch({
@@ -354,6 +354,23 @@ const LiveChatWidgetStateful = props => {
354
354
  }
355
355
  }
356
356
  });
357
+ _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.NetworkReconnected).subscribe(async () => {
358
+ var _window2, _window2$location;
359
+ if ((0, _utils.isThisSessionPopout)((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href)) {
360
+ return;
361
+ }
362
+ const conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK);
363
+ if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.Closed) {
364
+ dispatch({
365
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
366
+ payload: true
367
+ });
368
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
369
+ Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
370
+ Description: "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)"
371
+ });
372
+ }
373
+ });
357
374
 
358
375
  /**
359
376
  * This will allow to sync multiple tabs to handle minimize and maximize state,
@@ -671,11 +688,24 @@ const LiveChatWidgetStateful = props => {
671
688
 
672
689
  // Handle Chat disconnect cases
673
690
  (0, _react2.useEffect)(() => {
691
+ var _inMemoryState$appSta5;
674
692
  const inMemoryState = (0, _createReducer.executeReducer)(state, {
675
693
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
676
694
  payload: null
677
695
  });
678
696
  (0, _chatDisconnectHelper.handleChatDisconnect)(props, inMemoryState, setWebChatStyles);
697
+ const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.chatDisconnectEventReceived;
698
+ if (chatDisconnectState && adapter) {
699
+ try {
700
+ adapter.end();
701
+ adapter.close();
702
+ } catch (e) {
703
+ _TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.ERROR, {
704
+ Event: _TelemetryConstants.TelemetryEvent.EndingAdapterAfterDisconnectionError,
705
+ Description: _Constants.WidgetLoadCustomErrorString.CloseAdapterAfterDisconnectionErrorString
706
+ });
707
+ }
708
+ }
679
709
  }, [state.appStates.chatDisconnectEventReceived]);
680
710
 
681
711
  // if props state gets updates we need to update the renderingMiddlewareProps in the state
@@ -12,11 +12,11 @@ class DesignerChatAdapter extends _mockadapter.default {
12
12
  constructor() {
13
13
  super();
14
14
  setTimeout(() => {
15
- (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, "Id venenatis a condimentum vitae?", undefined, 0);
16
- this.postUserActivity("Diam donec adipiscing tristique risus nec feugiat in fermentum", 0);
17
- (0, _chatAdapterUtils.postSystemMessageActivity)(this.activityObserver, "We are finding the best agent for your inquiry, please hold ...", 100);
15
+ (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
16
+ this.postUserActivity("I need to change my address.", 0);
17
+ (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
18
18
  (0, _chatAdapterUtils.postSystemMessageActivity)(this.activityObserver, "John has joined the chat", 100);
19
- (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, "Neque viverra justo nec ultrices dui sapien eget mi proin", undefined, 100);
19
+ (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
20
20
  }, 1000);
21
21
  }
22
22
  postUserActivity(text) {
@@ -13,5 +13,13 @@ class DesignerChatSDK extends _mockchatsdk.MockChatSDK {
13
13
  createChatAdapter() {
14
14
  return new _DesignerChatAdapter.DesignerChatAdapter();
15
15
  }
16
+ getLiveChatConfig() {
17
+ return {
18
+ LiveWSAndLiveChatEngJoin: {
19
+ msdyn_postconversationsurveyenable: "false",
20
+ msdyn_conversationmode: "192350000"
21
+ }
22
+ };
23
+ }
16
24
  }
17
25
  exports.DesignerChatSDK = DesignerChatSDK;
@@ -376,6 +376,90 @@ class TranscriptHTMLBuilder {
376
376
  window.addEventListener("online", () => {
377
377
  document.body.innerHTML = \`${this.networkOnlineMessage} <button onclick="window.location.reload()"> Refresh </button>\`;
378
378
  });
379
+
380
+ document.addEventListener("copy", (event) => {
381
+ const clonedSelectedContent = window.getSelection().getRangeAt(0).cloneContents();
382
+ const copiedContent = document.createElement("div");
383
+ copiedContent.appendChild(clonedSelectedContent);
384
+
385
+ event.clipboardData.setData("text/plain", getAllText(copiedContent));
386
+ event.preventDefault();
387
+ });
388
+
389
+
390
+ getAllText = (element) => {
391
+ let plainText = "";
392
+ Array.from(element.childNodes).forEach((node) => {
393
+ // ignore aria-hidden elements and keyboard help text
394
+ const ariaHiddenAttr = node.attributes ? node.attributes.getNamedItem("aria-hidden") : null;
395
+ if ((ariaHiddenAttr && ariaHiddenAttr.value === "true") || node.classList && node.classList.contains("webchat__keyboard-help")) {
396
+ return;
397
+ }
398
+
399
+ // get all texts inside activity body, including message, translated message, attachment name, adaptive card content, status footer, etc.
400
+ if (node.classList && node.classList.contains("webchat__basic-transcript__activity-body")) {
401
+ plainText += this.processTranscriptActivityNode(node);
402
+ return;
403
+ }
404
+ if (node.nodeType === Node.TEXT_NODE) {
405
+ plainText += node.textContent + '\\n';
406
+ } else {
407
+ plainText += this.getAllText(node);
408
+ }
409
+ });
410
+ return plainText;
411
+ }
412
+
413
+ processTranscriptActivityNode = (node) => {
414
+ const divs = node.getElementsByTagName("div");
415
+ let plainText = "";
416
+
417
+ if (divs && divs.length > 1 && divs[1]) {
418
+ const messageRow = node.querySelector(".webchat__stacked-layout__message-row[aria-roledescription='message']");
419
+ const author = node.querySelector(".message-name");
420
+ const attachmentRow = node.querySelector(".webchat__stacked-layout__attachment-row[aria-roledescription='attachment']");
421
+
422
+ if (messageRow) {
423
+ let message = messageRow.getElementsByClassName("webchat__text-content__markdown");
424
+
425
+ if (message.length === 0) {
426
+ message = messageRow.getElementsByClassName("markdown");
427
+ }
428
+
429
+ if (message.length > 0) {
430
+ plainText += author.textContent + '\\n' + message[0].textContent + '\\n';
431
+ }
432
+ } else if (attachmentRow) {
433
+ const attachment = attachmentRow.getElementsByClassName("webchat__fileContent__fileName");
434
+ const adaptiveCard = this.getAdaptiveCardContent(attachmentRow.querySelector(".ac-container.ac-adaptiveCard"));
435
+
436
+ plainText += attachment && attachment.length > 0 ? author.textContent +'\\n' + attachment[0].textContent +'\\n': author.textContent +'\\n' + adaptiveCard +'\\n';
437
+ }
438
+
439
+ const statusElements = node.getElementsByClassName("webchat__stacked-layout__status");
440
+ if (statusElements.length > 0) {
441
+ const timestampelement = statusElements[0].querySelector(".message-timestamp");
442
+ plainText += timestampelement ? timestampelement.textContent+'\\n\\n' : '\\n';
443
+ }
444
+ }
445
+
446
+ return plainText;
447
+ }
448
+
449
+ getAdaptiveCardContent = (node) => {
450
+ if (!node) {
451
+ return undefined;
452
+ }
453
+
454
+ let plainText = "";
455
+ const rows = node.querySelectorAll(".ac-textBlock p");
456
+ rows.forEach((row) => {
457
+ plainText += row.textContent+ '\\n';
458
+ });
459
+
460
+ return plainText;
461
+ }
462
+
379
463
  <\/script>
380
464
  <div id="transcript"></div>
381
465
  <script>
@@ -276,6 +276,7 @@ _defineProperty(WidgetLoadTelemetryMessage, "PersistedStateRetrievedMessage", "P
276
276
  export class WidgetLoadCustomErrorString {}
277
277
  _defineProperty(WidgetLoadCustomErrorString, "AuthenticationFailedErrorString", "Authentication was not successful");
278
278
  _defineProperty(WidgetLoadCustomErrorString, "NetworkErrorString", "Network Error");
279
+ _defineProperty(WidgetLoadCustomErrorString, "CloseAdapterAfterDisconnectionErrorString", "Error trying to end/close chat adapter after the widget is back on-line, for an already disconnected session");
279
280
  export class PrepareEndChatDescriptionConstants {}
280
281
  _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithoutPostChat", "Conversation ended by customer. Post chat not configured or should not show.");
281
282
  _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedByCustomerWithInvalidPostChat", "Conversation ended by customer. Post chat context is invalid.");
@@ -209,6 +209,8 @@ export let TelemetryEvent;
209
209
  TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
210
210
  TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
211
211
  TelemetryEvent["ChatDisconnectThreadEventReceived"] = "ChatDisconnectThreadEventReceived";
212
+ TelemetryEvent["HiddenAdaptiveCardMessageReceived"] = "HiddenAdaptiveCardMessageReceived";
213
+ TelemetryEvent["EndingAdapterAfterDisconnectionError"] = "EndingAdapterAfterDisconnectionError";
212
214
  })(TelemetryEvent || (TelemetryEvent = {}));
213
215
  export class TelemetryConstants {
214
216
  static map(eventTypeOrScenarioType) {
@@ -1,5 +1,5 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React from "react";
2
+ import React, { useEffect } from "react";
3
3
  import AudioNotificationStateful from "./audionotificationstateful/AudioNotificationStateful";
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { Footer } from "@microsoft/omnichannel-chat-components";
@@ -14,7 +14,7 @@ import useChatSDKStore from "../../hooks/useChatSDKStore";
14
14
 
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  export const FooterStateful = props => {
17
- var _footerProps$controlP3, _footerProps$controlP4;
17
+ var _footerProps$controlP3, _footerProps$controlP6;
18
18
  const [state, dispatch] = useChatContextStore();
19
19
  // hideFooterDisplay - the purpose of this is to keep the footer always "active",
20
20
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
@@ -81,13 +81,22 @@ export const FooterStateful = props => {
81
81
  isAudioMuted: state.appStates.isAudioMuted
82
82
  }
83
83
  };
84
+ useEffect(() => {
85
+ if (state.appStates.isAudioMuted === null) {
86
+ var _footerProps$controlP4, _footerProps$controlP5;
87
+ dispatch({
88
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
89
+ payload: (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : (_footerProps$controlP5 = _footerProps$controlP4.audioNotificationButtonProps) === null || _footerProps$controlP5 === void 0 ? void 0 : _footerProps$controlP5.isAudioMuted) ?? false
90
+ });
91
+ }
92
+ }, []);
84
93
  return /*#__PURE__*/React.createElement(React.Fragment, null, !hideFooterDisplay && /*#__PURE__*/React.createElement(Footer, {
85
94
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
86
95
  controlProps: controlProps,
87
96
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
88
97
  }), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
89
98
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
90
- isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
99
+ isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP6 = footerProps.controlProps) === null || _footerProps$controlP6 === void 0 ? void 0 : _footerProps$controlP6.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
91
100
  }));
92
101
  };
93
102
  export default FooterStateful;
@@ -9,8 +9,6 @@ import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
9
9
  const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
10
10
  const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
11
11
  const delay = t => new Promise(resolve => setTimeout(resolve, t));
12
- const fetchBotAuthConfigRetries = 3;
13
- const fetchBotAuthConfigRetryInterval = 1000;
14
12
  let response;
15
13
  const extractSignInId = signInUrl => {
16
14
  const result = botOauthUrlRegex.exec(signInUrl);
@@ -39,7 +37,7 @@ const extractSasUrl = async attachment => {
39
37
  }
40
38
  return sasUrl;
41
39
  };
42
- const fetchBotAuthConfig = async retries => {
40
+ const fetchBotAuthConfig = async (retries, interval) => {
43
41
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
44
42
  Event: TelemetryEvent.SetBotAuthProviderFetchConfig
45
43
  });
@@ -60,14 +58,25 @@ const fetchBotAuthConfig = async retries => {
60
58
  // Base Case
61
59
  throw new Error();
62
60
  }
63
- await delay(fetchBotAuthConfigRetryInterval);
64
- return await fetchBotAuthConfig(--retries);
61
+ await delay(interval);
62
+ return await fetchBotAuthConfig(--retries, interval);
65
63
  };
66
64
  export class BotAuthActivitySubscriber {
67
65
  constructor() {
66
+ let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
68
67
  _defineProperty(this, "observer", void 0);
69
68
  _defineProperty(this, "signInCardSeen", void 0);
69
+ _defineProperty(this, "fetchBotAuthConfigRetries", void 0);
70
+ _defineProperty(this, "fetchBotAuthConfigRetryInterval", void 0);
70
71
  this.signInCardSeen = new Set();
72
+ this.fetchBotAuthConfigRetries = 3;
73
+ this.fetchBotAuthConfigRetryInterval = 1000;
74
+ if (optionalParams.fetchBotAuthConfigRetries) {
75
+ this.fetchBotAuthConfigRetries = optionalParams.fetchBotAuthConfigRetries;
76
+ }
77
+ if (optionalParams.fetchBotAuthConfigRetryInterval) {
78
+ this.fetchBotAuthConfigRetryInterval = optionalParams.fetchBotAuthConfigRetryInterval;
79
+ }
71
80
  }
72
81
  applicable(activity) {
73
82
  var _activity$attachments;
@@ -106,7 +115,7 @@ export class BotAuthActivitySubscriber {
106
115
  BroadcastService.postMessage(event);
107
116
  }
108
117
  try {
109
- const response = await fetchBotAuthConfig(fetchBotAuthConfigRetries);
118
+ const response = await fetchBotAuthConfig(this.fetchBotAuthConfigRetries, this.fetchBotAuthConfigRetryInterval);
110
119
  if (response === false) {
111
120
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
112
121
  Event: TelemetryEvent.SetBotAuthProviderHideCard
@@ -0,0 +1,70 @@
1
+ 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; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+ import { Constants } from "../../../../common/Constants";
5
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../../common/telemetry/TelemetryConstants";
6
+ import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
7
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
8
+ export class HiddenAdaptiveCardActivitySubscriber {
9
+ constructor() {
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ _defineProperty(this, "observer", void 0);
12
+ }
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ async apply(activity) {
15
+ const {
16
+ attachments,
17
+ attachment
18
+ } = activity;
19
+ this.observer.next(false);
20
+ BroadcastService.postMessage({
21
+ eventName: BroadcastEvent.NewMessageReceived,
22
+ payload: {
23
+ attachments: attachments || [attachment],
24
+ text: "Custom Event"
25
+ }
26
+ });
27
+ return;
28
+ }
29
+
30
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
31
+ applicable(activity) {
32
+ const {
33
+ attachments,
34
+ attachment
35
+ } = activity;
36
+
37
+ // Use `attachments` or `attachment` (whichever exists)
38
+ const cards = attachments || [attachment];
39
+
40
+ // Check if contentType is "AdaptiveCard"
41
+ const adaptiveCard = cards === null || cards === void 0 ? void 0 : cards.find(
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ item => Constants.supportedAdaptiveCardContentTypes.indexOf(item === null || item === void 0 ? void 0 : item.contentType) >= 0);
44
+ if (adaptiveCard && adaptiveCard.content) {
45
+ const {
46
+ body
47
+ } = adaptiveCard.content;
48
+ if (Array.isArray(body)) {
49
+ // Check if all elements in `body` have `isVisible: false`
50
+ const allInvisible = body.every(item => item.isVisible === false);
51
+ if (allInvisible) {
52
+ TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
53
+ Event: TelemetryEvent.HiddenAdaptiveCardMessageReceived,
54
+ Description: "All elements in AdaptiveCard are invisible"
55
+ });
56
+ return true;
57
+ }
58
+ }
59
+ }
60
+ return false;
61
+ }
62
+
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
+ async next(activity) {
65
+ if (this.applicable(activity)) {
66
+ return await this.apply(activity);
67
+ }
68
+ return activity;
69
+ }
70
+ }
@@ -1,8 +1,9 @@
1
+ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
2
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
2
3
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
3
- import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
4
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
5
4
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
5
+ import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
6
+
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  const handleChatDisconnect = (props, state, setWebChatStyles) => {
8
9
  var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
@@ -5,9 +5,14 @@ import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/
5
5
  import { ChatAdapterShim } from "./ChatAdapterShim";
6
6
  import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber";
7
7
  import { BotAuthActivitySubscriber } from "./ActivitySubscriber/BotAuthActivitySubscriber";
8
+ import { HiddenAdaptiveCardActivitySubscriber } from "./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber";
9
+ const defaultBotAuthConfig = {
10
+ fetchBotAuthConfigRetries: 3,
11
+ fetchBotAuthConfigRetryInterval: 1000
12
+ };
8
13
 
9
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- export const createAdapter = async chatSDK => {
15
+ export const createAdapter = async (chatSDK, props) => {
11
16
  const chatAdapterOptionalParams = {
12
17
  IC3Adapter: {
13
18
  options: {
@@ -33,9 +38,16 @@ export const createAdapter = async chatSDK => {
33
38
  let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams);
34
39
  //so far, there is no need to convert to the shim adapter when using visual tests
35
40
  if (chatSDK.isMockModeOn !== true) {
41
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4;
42
+ const botAuthActivitySubscriberOptionalParams = {
43
+ fetchBotAuthConfigRetries: (props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.botAuthConfig) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.fetchBotAuthConfigRetries) || defaultBotAuthConfig.fetchBotAuthConfigRetries,
44
+ fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval
45
+ };
36
46
  adapter = new ChatAdapterShim(adapter);
37
47
  adapter.addSubscriber(new PauseActivitySubscriber());
38
- adapter.addSubscriber(new BotAuthActivitySubscriber());
48
+ adapter.addSubscriber(new BotAuthActivitySubscriber(botAuthActivitySubscriberOptionalParams));
49
+ // Remove this code after ICM ID:544623085 is fixed
50
+ adapter.addSubscriber(new HiddenAdaptiveCardActivitySubscriber());
39
51
  return adapter.chatAdapter;
40
52
  }
41
53
  return adapter;
@@ -1,9 +1,10 @@
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
1
3
  import { Constants } from "../../../common/Constants";
2
4
  import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
3
5
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
4
- import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
5
6
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
6
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
7
+ import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
7
8
  const isInternetConnected = async () => {
8
9
  try {
9
10
  const response = await fetch(Constants.internetConnectionTestUrl);
@@ -26,6 +27,9 @@ export const createInternetConnectionChangeHandler = async () => {
26
27
  Event: TelemetryEvent.NetworkReconnected
27
28
  });
28
29
  NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
30
+ BroadcastService.postMessage({
31
+ eventName: BroadcastEvent.NetworkReconnected
32
+ });
29
33
  }
30
34
  };
31
35
 
@@ -1,8 +1,8 @@
1
1
  import { Constants } from "../../../common/Constants";
2
2
  import MarkdownIt from "markdown-it";
3
3
  import MarkdownItForInline from "markdown-it-for-inline";
4
- import MarkdownSlack from "slack-markdown-it";
5
4
  import { defaultMarkdownLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMarkdownLocalizedTexts";
5
+ import { addSlackMarkdownIt } from "./helpers/markdownHelper";
6
6
 
7
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
8
  export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineMarkdownSupport) => {
@@ -13,7 +13,7 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
13
13
  linkify: true,
14
14
  breaks: !disableNewLineMarkdownSupport
15
15
  });
16
- markdown.use(MarkdownSlack);
16
+ markdown = addSlackMarkdownIt(markdown);
17
17
  } else {
18
18
  markdown = new MarkdownIt(Constants.Zero, {
19
19
  html: true,
@@ -0,0 +1,15 @@
1
+ import SlackMarkdown from "slack-markdown-it";
2
+ export const addSlackMarkdownIt = markdown => {
3
+ try {
4
+ markdown.use(SlackMarkdown);
5
+ } catch (e) {
6
+ // this is to support the case when slack-markdown-it
7
+ // transpiled code doesn't export default (webpack5)
8
+ if (SlackMarkdown.default.apply) {
9
+ markdown.use(SlackMarkdown.default);
10
+ } else {
11
+ console.error("Error while adding slackMarkdown plugin", e);
12
+ }
13
+ }
14
+ return markdown;
15
+ };
@@ -6,7 +6,8 @@ export const shouldSetPreChatIfPersistentChat = async (chatSDK, conversationMode
6
6
  let skipPreChat = false;
7
7
  if (persistentEnabled) {
8
8
  const reconnectableChatsParams = {
9
- authenticatedUserToken: chatSDK.authenticatedUserToken
9
+ authenticatedUserToken: chatSDK.authenticatedUserToken,
10
+ requestId: chatSDK.requestId
10
11
  };
11
12
  try {
12
13
  const reconnectableChatsResponse = await chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams);
@@ -202,7 +202,7 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
202
202
  isStartChatSuccessful = false;
203
203
  throw error;
204
204
  }
205
- await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter);
205
+ await createAdapterAndSubscribe(chatSDK, dispatch, setAdapter, props);
206
206
 
207
207
  // Set app state to Active
208
208
  if (isStartChatSuccessful) {
@@ -252,10 +252,10 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
252
252
  };
253
253
 
254
254
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
- const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter) => {
255
+ const createAdapterAndSubscribe = async (chatSDK, dispatch, setAdapter, props) => {
256
256
  var _newAdapter$activity$;
257
257
  // New adapter creation
258
- const newAdapter = await createAdapter(chatSDK);
258
+ const newAdapter = await createAdapter(chatSDK, props);
259
259
  setAdapter(newAdapter);
260
260
  const chatToken = await chatSDK.getChatToken();
261
261
  dispatch({
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
4
4
  import { Components } from "botframework-webchat";
5
- import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType } from "../../../common/Constants";
5
+ import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType, WidgetLoadCustomErrorString } from "../../../common/Constants";
6
6
  import { Stack } from "@fluentui/react";
7
7
  import React, { useEffect, useRef, useState } from "react";
8
8
  import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
@@ -346,6 +346,23 @@ export const LiveChatWidgetStateful = props => {
346
346
  }
347
347
  }
348
348
  });
349
+ BroadcastService.getMessageByEventName(BroadcastEvent.NetworkReconnected).subscribe(async () => {
350
+ var _window2, _window2$location;
351
+ if (isThisSessionPopout((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$location = _window2.location) === null || _window2$location === void 0 ? void 0 : _window2$location.href)) {
352
+ return;
353
+ }
354
+ const conversationDetails = await getConversationDetailsCall(chatSDK);
355
+ if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
356
+ dispatch({
357
+ type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
358
+ payload: true
359
+ });
360
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
361
+ Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
362
+ Description: "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)"
363
+ });
364
+ }
365
+ });
349
366
 
350
367
  /**
351
368
  * This will allow to sync multiple tabs to handle minimize and maximize state,
@@ -663,11 +680,24 @@ export const LiveChatWidgetStateful = props => {
663
680
 
664
681
  // Handle Chat disconnect cases
665
682
  useEffect(() => {
683
+ var _inMemoryState$appSta5;
666
684
  const inMemoryState = executeReducer(state, {
667
685
  type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
668
686
  payload: null
669
687
  });
670
688
  handleChatDisconnect(props, inMemoryState, setWebChatStyles);
689
+ const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.chatDisconnectEventReceived;
690
+ if (chatDisconnectState && adapter) {
691
+ try {
692
+ adapter.end();
693
+ adapter.close();
694
+ } catch (e) {
695
+ TelemetryHelper.logWebChatEvent(LogLevel.ERROR, {
696
+ Event: TelemetryEvent.EndingAdapterAfterDisconnectionError,
697
+ Description: WidgetLoadCustomErrorString.CloseAdapterAfterDisconnectionErrorString
698
+ });
699
+ }
700
+ }
671
701
  }, [state.appStates.chatDisconnectEventReceived]);
672
702
 
673
703
  // if props state gets updates we need to update the renderingMiddlewareProps in the state
@@ -5,11 +5,11 @@ export class DesignerChatAdapter extends MockAdapter {
5
5
  constructor() {
6
6
  super();
7
7
  setTimeout(() => {
8
- postBotMessageActivity(this.activityObserver, "Id venenatis a condimentum vitae?", undefined, 0);
9
- this.postUserActivity("Diam donec adipiscing tristique risus nec feugiat in fermentum", 0);
10
- postSystemMessageActivity(this.activityObserver, "We are finding the best agent for your inquiry, please hold ...", 100);
8
+ postBotMessageActivity(this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
9
+ this.postUserActivity("I need to change my address.", 0);
10
+ postBotMessageActivity(this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
11
11
  postSystemMessageActivity(this.activityObserver, "John has joined the chat", 100);
12
- postBotMessageActivity(this.activityObserver, "Neque viverra justo nec ultrices dui sapien eget mi proin", undefined, 100);
12
+ postBotMessageActivity(this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
13
13
  }, 1000);
14
14
  }
15
15
  postUserActivity(text) {
@@ -7,4 +7,12 @@ export class DesignerChatSDK extends MockChatSDK {
7
7
  createChatAdapter() {
8
8
  return new DesignerChatAdapter();
9
9
  }
10
+ getLiveChatConfig() {
11
+ return {
12
+ LiveWSAndLiveChatEngJoin: {
13
+ msdyn_postconversationsurveyenable: "false",
14
+ msdyn_conversationmode: "192350000"
15
+ }
16
+ };
17
+ }
10
18
  }
@@ -371,6 +371,90 @@ class TranscriptHTMLBuilder {
371
371
  window.addEventListener("online", () => {
372
372
  document.body.innerHTML = \`${this.networkOnlineMessage} <button onclick="window.location.reload()"> Refresh </button>\`;
373
373
  });
374
+
375
+ document.addEventListener("copy", (event) => {
376
+ const clonedSelectedContent = window.getSelection().getRangeAt(0).cloneContents();
377
+ const copiedContent = document.createElement("div");
378
+ copiedContent.appendChild(clonedSelectedContent);
379
+
380
+ event.clipboardData.setData("text/plain", getAllText(copiedContent));
381
+ event.preventDefault();
382
+ });
383
+
384
+
385
+ getAllText = (element) => {
386
+ let plainText = "";
387
+ Array.from(element.childNodes).forEach((node) => {
388
+ // ignore aria-hidden elements and keyboard help text
389
+ const ariaHiddenAttr = node.attributes ? node.attributes.getNamedItem("aria-hidden") : null;
390
+ if ((ariaHiddenAttr && ariaHiddenAttr.value === "true") || node.classList && node.classList.contains("webchat__keyboard-help")) {
391
+ return;
392
+ }
393
+
394
+ // get all texts inside activity body, including message, translated message, attachment name, adaptive card content, status footer, etc.
395
+ if (node.classList && node.classList.contains("webchat__basic-transcript__activity-body")) {
396
+ plainText += this.processTranscriptActivityNode(node);
397
+ return;
398
+ }
399
+ if (node.nodeType === Node.TEXT_NODE) {
400
+ plainText += node.textContent + '\\n';
401
+ } else {
402
+ plainText += this.getAllText(node);
403
+ }
404
+ });
405
+ return plainText;
406
+ }
407
+
408
+ processTranscriptActivityNode = (node) => {
409
+ const divs = node.getElementsByTagName("div");
410
+ let plainText = "";
411
+
412
+ if (divs && divs.length > 1 && divs[1]) {
413
+ const messageRow = node.querySelector(".webchat__stacked-layout__message-row[aria-roledescription='message']");
414
+ const author = node.querySelector(".message-name");
415
+ const attachmentRow = node.querySelector(".webchat__stacked-layout__attachment-row[aria-roledescription='attachment']");
416
+
417
+ if (messageRow) {
418
+ let message = messageRow.getElementsByClassName("webchat__text-content__markdown");
419
+
420
+ if (message.length === 0) {
421
+ message = messageRow.getElementsByClassName("markdown");
422
+ }
423
+
424
+ if (message.length > 0) {
425
+ plainText += author.textContent + '\\n' + message[0].textContent + '\\n';
426
+ }
427
+ } else if (attachmentRow) {
428
+ const attachment = attachmentRow.getElementsByClassName("webchat__fileContent__fileName");
429
+ const adaptiveCard = this.getAdaptiveCardContent(attachmentRow.querySelector(".ac-container.ac-adaptiveCard"));
430
+
431
+ plainText += attachment && attachment.length > 0 ? author.textContent +'\\n' + attachment[0].textContent +'\\n': author.textContent +'\\n' + adaptiveCard +'\\n';
432
+ }
433
+
434
+ const statusElements = node.getElementsByClassName("webchat__stacked-layout__status");
435
+ if (statusElements.length > 0) {
436
+ const timestampelement = statusElements[0].querySelector(".message-timestamp");
437
+ plainText += timestampelement ? timestampelement.textContent+'\\n\\n' : '\\n';
438
+ }
439
+ }
440
+
441
+ return plainText;
442
+ }
443
+
444
+ getAdaptiveCardContent = (node) => {
445
+ if (!node) {
446
+ return undefined;
447
+ }
448
+
449
+ let plainText = "";
450
+ const rows = node.querySelectorAll(".ac-textBlock p");
451
+ rows.forEach((row) => {
452
+ plainText += row.textContent+ '\\n';
453
+ });
454
+
455
+ return plainText;
456
+ }
457
+
374
458
  <\/script>
375
459
  <div id="transcript"></div>
376
460
  <script>
@@ -254,6 +254,7 @@ export declare class WidgetLoadTelemetryMessage {
254
254
  export declare class WidgetLoadCustomErrorString {
255
255
  static readonly AuthenticationFailedErrorString = "Authentication was not successful";
256
256
  static readonly NetworkErrorString = "Network Error";
257
+ static readonly CloseAdapterAfterDisconnectionErrorString = "Error trying to end/close chat adapter after the widget is back on-line, for an already disconnected session";
257
258
  }
258
259
  export declare class PrepareEndChatDescriptionConstants {
259
260
  static readonly ConversationEndedByCustomerWithoutPostChat = "Conversation ended by customer. Post chat not configured or should not show.";
@@ -201,7 +201,9 @@ export declare enum TelemetryEvent {
201
201
  PostChatContextCallFailed = "PostChatContextCallFailed",
202
202
  PostChatSurveyLoadingPaneLoaded = "PostChatSurveyLoadingPaneLoaded",
203
203
  PostChatSurveyLoaded = "PostChatSurveyLoaded",
204
- ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived"
204
+ ChatDisconnectThreadEventReceived = "ChatDisconnectThreadEventReceived",
205
+ HiddenAdaptiveCardMessageReceived = "HiddenAdaptiveCardMessageReceived",
206
+ EndingAdapterAfterDisconnectionError = "EndingAdapterAfterDisconnectionError"
205
207
  }
206
208
  export interface TelemetryInput {
207
209
  scenarioType: ScenarioType;
@@ -1,8 +1,11 @@
1
1
  import { IActivitySubscriber } from "./IActivitySubscriber";
2
+ import { IBotAuthActivitySubscriberOptionalParams } from "../../interfaces/IBotAuthActivitySubscriberOptionalParams";
2
3
  export declare class BotAuthActivitySubscriber implements IActivitySubscriber {
3
4
  observer: any;
4
5
  private signInCardSeen;
5
- constructor();
6
+ private fetchBotAuthConfigRetries;
7
+ private fetchBotAuthConfigRetryInterval;
8
+ constructor(optionalParams?: IBotAuthActivitySubscriberOptionalParams);
6
9
  applicable(activity: any): boolean;
7
10
  apply(activity: any): Promise<any>;
8
11
  next(activity: any): Promise<any>;
@@ -0,0 +1,7 @@
1
+ import { IActivitySubscriber } from "./IActivitySubscriber";
2
+ export declare class HiddenAdaptiveCardActivitySubscriber implements IActivitySubscriber {
3
+ observer: any;
4
+ apply(activity: any): Promise<void>;
5
+ applicable(activity: any): boolean;
6
+ next(activity: any): Promise<any>;
7
+ }
@@ -1 +1,2 @@
1
- export declare const createAdapter: (chatSDK: any) => Promise<any>;
1
+ import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
2
+ export declare const createAdapter: (chatSDK: any, props?: ILiveChatWidgetProps | undefined) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ import MarkdownIt from "markdown-it";
2
+ export declare const addSlackMarkdownIt: (markdown: MarkdownIt) => MarkdownIt;
@@ -0,0 +1,4 @@
1
+ export interface IBotAuthActivitySubscriberOptionalParams {
2
+ fetchBotAuthConfigRetries?: number;
3
+ fetchBotAuthConfigRetryInterval?: number;
4
+ }
@@ -3,4 +3,10 @@ import { MockChatSDK } from "./mockchatsdk";
3
3
  export declare class DesignerChatSDK extends MockChatSDK {
4
4
  constructor();
5
5
  createChatAdapter(): DesignerChatAdapter;
6
+ getLiveChatConfig(): {
7
+ LiveWSAndLiveChatEngJoin: {
8
+ msdyn_postconversationsurveyenable: string;
9
+ msdyn_conversationmode: string;
10
+ };
11
+ };
6
12
  }
@@ -0,0 +1,4 @@
1
+ export interface IBotAuthConfig {
2
+ fetchBotAuthConfigRetries?: number;
3
+ fetchBotAuthConfigRetryInterval?: number;
4
+ }
@@ -5,6 +5,7 @@ import { IStyle } from "@fluentui/react";
5
5
  import { IWebChatProps } from "./IWebChatProps";
6
6
  import { StyleOptions } from "botframework-webchat-api";
7
7
  import { IAdaptiveCardStyles } from "./IAdaptiveCardStyles";
8
+ import { IBotAuthConfig } from "./IBotAuthConfig";
8
9
  export interface IWebChatContainerStatefulProps {
9
10
  containerStyles?: IStyle;
10
11
  disableNewLineMarkdownSupport?: boolean;
@@ -16,6 +17,7 @@ export interface IWebChatContainerStatefulProps {
16
17
  renderingMiddlewareProps?: IRenderingMiddlewareProps;
17
18
  localizedTexts?: ILiveChatWidgetLocalizedTexts;
18
19
  botMagicCode?: IBotMagicCodeConfig;
20
+ botAuthConfig?: IBotAuthConfig;
19
21
  hyperlinkTextOverride?: boolean;
20
22
  adaptiveCardStyles?: IAdaptiveCardStyles;
21
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.3-main.fee24eb",
3
+ "version": "1.7.3",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@microsoft/omnichannel-chat-components": "1.1.5",
78
- "@microsoft/omnichannel-chat-sdk": "^1.9.6",
78
+ "@microsoft/omnichannel-chat-sdk": "^1.10.1",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.5.4",
81
81
  "markdown-it": "^12.3.2",