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

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 (53) 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/WebChatContainerStateful.js +11 -6
  16. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
  17. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +31 -0
  18. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
  19. package/lib/cjs/index.js +7 -0
  20. package/lib/cjs/plugins/createChatTranscript.js +84 -0
  21. package/lib/esm/common/Constants.js +1 -0
  22. package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
  23. package/lib/esm/components/footerstateful/FooterStateful.js +12 -3
  24. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +15 -6
  25. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.js +70 -0
  26. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -2
  27. package/lib/esm/components/livechatwidget/common/createAdapter.js +14 -2
  28. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +6 -2
  29. package/lib/esm/components/livechatwidget/common/createMarkdown.js +2 -2
  30. package/lib/esm/components/livechatwidget/common/helpers/markdownHelper.js +15 -0
  31. package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +2 -1
  32. package/lib/esm/components/livechatwidget/common/startChat.js +3 -3
  33. package/lib/esm/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.js +1 -0
  34. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +31 -1
  35. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
  36. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +4 -4
  37. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +31 -0
  38. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotAuthConfig.js +1 -0
  39. package/lib/esm/index.js +1 -0
  40. package/lib/esm/plugins/createChatTranscript.js +84 -0
  41. package/lib/types/common/Constants.d.ts +1 -0
  42. package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -1
  43. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +4 -1
  44. package/lib/types/components/livechatwidget/common/ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber.d.ts +7 -0
  45. package/lib/types/components/livechatwidget/common/createAdapter.d.ts +2 -1
  46. package/lib/types/components/livechatwidget/common/helpers/markdownHelper.d.ts +2 -0
  47. package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +4 -0
  48. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +25 -0
  49. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
  50. package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +4 -0
  51. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  52. package/lib/types/index.d.ts +1 -0
  53. 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
@@ -55,7 +55,7 @@ const createMagicCodeSuccessResponse = signin => {
55
55
  };
56
56
  };
57
57
  const WebChatContainerStateful = props => {
58
- var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _props$webChatContain9, _props$webChatContain10;
58
+ var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _props$webChatContain9, _props$webChatContain10;
59
59
  const {
60
60
  BasicWebChat
61
61
  } = _botframeworkWebchat.Components;
@@ -171,6 +171,11 @@ const WebChatContainerStateful = props => {
171
171
  div[class="ac-textBlock"] *,
172
172
  div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.textWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.textWhiteSpace}}
173
173
 
174
+ div[class="ac-input-container"] input.ac-multichoiceInput,
175
+ div[class="ac-input-container"] select.ac-multichoiceInput {
176
+ ${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp7 !== void 0 && _webChatContainerProp7.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
177
+ }
178
+
174
179
  .ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
175
180
  background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
176
181
  color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
@@ -180,16 +185,16 @@ const WebChatContainerStateful = props => {
180
185
  div[class="ac-textBlock"] a:visited,
181
186
  div[class="ac-textBlock"] a:hover,
182
187
  div[class="ac-textBlock"] a:active {
183
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
188
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.anchorColor) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.anchorColor};
184
189
  }
185
190
 
186
- .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
191
+ .webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp9 === void 0 ? void 0 : _webChatContainerProp9.buttonWhiteSpace) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
187
192
 
188
193
  .ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
189
194
  background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
190
195
  height: .75em;
191
196
  margin-left: .25em;
192
- filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp9 === void 0 ? void 0 : (_webChatContainerProp10 = _webChatContainerProp9.receivedMessageAnchorStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
197
+ filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp10 === void 0 ? void 0 : (_webChatContainerProp11 = _webChatContainerProp10.receivedMessageAnchorStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.filter) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.filter)};
193
198
  }
194
199
  pre {
195
200
  white-space: pre-wrap;
@@ -202,13 +207,13 @@ const WebChatContainerStateful = props => {
202
207
  .ms_lcw_webchat_received_message a:visited,
203
208
  .ms_lcw_webchat_received_message a:hover,
204
209
  .ms_lcw_webchat_received_message a:active {
205
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp11 === void 0 ? void 0 : (_webChatContainerProp12 = _webChatContainerProp11.receivedMessageAnchorStyles) === null || _webChatContainerProp12 === void 0 ? void 0 : _webChatContainerProp12.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
210
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.color) ?? (_defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === null || _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles === void 0 ? void 0 : _defaultReceivedMessageAnchorStyles.defaultReceivedMessageAnchorStyles.color)};
206
211
  }
207
212
  .ms_lcw_webchat_sent_message a:link,
208
213
  .ms_lcw_webchat_sent_message a:visited,
209
214
  .ms_lcw_webchat_sent_message a:hover,
210
215
  .ms_lcw_webchat_sent_message a:active {
211
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp13 === void 0 ? void 0 : (_webChatContainerProp14 = _webChatContainerProp13.sentMessageAnchorStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
216
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.color) ?? (_defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === null || _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles === void 0 ? void 0 : _defaultSentMessageAnchorStyles.defaultSentMessageAnchorStyles.color)};
212
217
  }
213
218
 
214
219
  .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
@@ -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) {
@@ -6,12 +6,43 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.DesignerChatSDK = void 0;
7
7
  var _DesignerChatAdapter = require("./DesignerChatAdapter");
8
8
  var _mockchatsdk = require("./mockchatsdk");
9
+ 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; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ 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); }
9
12
  class DesignerChatSDK extends _mockchatsdk.MockChatSDK {
10
13
  constructor() {
11
14
  super();
15
+ _defineProperty(this, "localeId", this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
12
16
  }
13
17
  createChatAdapter() {
14
18
  return new _DesignerChatAdapter.DesignerChatAdapter();
15
19
  }
20
+ /**
21
+ * If the widget is running in designer mode, we mock the initialize response. We don't want
22
+ * any interactions with a real server in when designing LCW widget visually in Modern Admin.
23
+ *
24
+ * - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
25
+ * - msdyn_callingoptions was changed to disable calling functionality
26
+ */
27
+ getLiveChatConfig() {
28
+ return {
29
+ LiveWSAndLiveChatEngJoin: {
30
+ msdyn_widgetthemecolor: "19236002",
31
+ // msdyn_callingoptions was changed to disable calling functionality
32
+ msdyn_callingoptions: "192350000",
33
+ msdyn_widgettitle: "Let\u0027s chat",
34
+ msdyn_conversationmode: "192350000",
35
+ msdyn_avatarurl: "https://oc-cdn-ocprod.azureedge.net/livechatwidget/images/chatIcon.svg",
36
+ msdyn_name: "Let's Chat",
37
+ msdyn_postconversationsurveyenable: "false",
38
+ OutOfOperatingHours: "False",
39
+ ShowWidget: "True"
40
+ },
41
+ ChatWidgetLanguage: {
42
+ msdyn_localeid: "1033",
43
+ msdyn_languagename: "English - United States"
44
+ }
45
+ };
46
+ }
16
47
  }
17
48
  exports.DesignerChatSDK = DesignerChatSDK;
package/lib/cjs/index.js CHANGED
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "encodeComponentString", {
33
33
  return _omnichannelChatComponents.encodeComponentString;
34
34
  }
35
35
  });
36
+ Object.defineProperty(exports, "getMockChatSDKIfApplicable", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable;
40
+ }
41
+ });
36
42
  Object.defineProperty(exports, "getWidgetCacheId", {
37
43
  enumerable: true,
38
44
  get: function () {
@@ -63,4 +69,5 @@ var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore")
63
69
  var _utils = require("./common/utils");
64
70
  var _ConversationState = require("./contexts/common/ConversationState");
65
71
  var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
72
+ var _getMockChatSDKIfApplicable = require("./components/livechatwidget/common/getMockChatSDKIfApplicable");
66
73
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }