@microsoft/omnichannel-chat-widget 1.7.3 → 1.7.4-main.120159a

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 (32) hide show
  1. package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
  2. package/lib/cjs/common/telemetry/TelemetryHelper.js +2 -0
  3. package/lib/cjs/components/footerstateful/FooterStateful.js +12 -9
  4. package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -0
  5. package/lib/cjs/components/livechatwidget/common/endChat.js +20 -9
  6. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -4
  7. package/lib/cjs/components/livechatwidget/common/startChat.js +10 -4
  8. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +20 -1
  9. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
  10. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +24 -1
  11. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
  12. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
  13. package/lib/cjs/index.js +7 -0
  14. package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
  15. package/lib/esm/common/telemetry/TelemetryHelper.js +2 -0
  16. package/lib/esm/components/footerstateful/FooterStateful.js +12 -9
  17. package/lib/esm/components/headerstateful/HeaderStateful.js +4 -0
  18. package/lib/esm/components/livechatwidget/common/endChat.js +20 -9
  19. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +8 -4
  20. package/lib/esm/components/livechatwidget/common/startChat.js +11 -5
  21. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +20 -1
  22. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -6
  23. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +24 -1
  24. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +2 -1
  25. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/notification/NotificationHandler.js +8 -0
  26. package/lib/esm/index.js +1 -0
  27. package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
  28. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  29. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +20 -1
  30. package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +1 -0
  31. package/lib/types/index.d.ts +1 -0
  32. package/package.json +4 -2
@@ -65,6 +65,7 @@ exports.BroadcastEvent = BroadcastEvent;
65
65
  BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
66
66
  BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
67
67
  BroadcastEvent["SyncMinimize"] = "SyncMinimize";
68
+ BroadcastEvent["OnWidgetError"] = "OnWidgetError";
68
69
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
69
70
  let TelemetryEvent;
70
71
  exports.TelemetryEvent = TelemetryEvent;
@@ -21,6 +21,7 @@ class TelemetryHelper {
21
21
  case _TelemetryConstants.ScenarioType.WEBCHAT:
22
22
  return TelemetryHelper.conformToWebChatContract(level, input);
23
23
  case _TelemetryConstants.ScenarioType.OCCHATSDK:
24
+ case _TelemetryConstants.ScenarioType.SDK:
24
25
  return TelemetryHelper.conformToOCChatSDKContract(level, input);
25
26
  case _TelemetryConstants.ScenarioType.ACTIONS:
26
27
  return TelemetryHelper.conformToActionsContract(level, input);
@@ -156,6 +157,7 @@ class TelemetryHelper {
156
157
  event.TransactionId = payload.TransactionId;
157
158
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
158
159
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
160
+ event.Description = payload.Description;
159
161
  });
160
162
  }
161
163
  static addChatConfigDataToTelemetry(chatConfig, telemetryInternalData) {
@@ -17,12 +17,13 @@ var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
17
17
  var _DownloadTranscriptStateful = require("./downloadtranscriptstateful/DownloadTranscriptStateful");
18
18
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
19
19
  var _useChatSDKStore = _interopRequireDefault(require("../../hooks/useChatSDKStore"));
20
+ var _ConversationState = require("../../contexts/common/ConversationState");
20
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
22
  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
23
  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; }
23
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  const FooterStateful = props => {
25
- var _footerProps$controlP3, _footerProps$controlP6;
26
+ var _footerProps$controlP3;
26
27
  const [state, dispatch] = (0, _useChatContextStore.default)();
27
28
  // hideFooterDisplay - the purpose of this is to keep the footer always "active",
28
29
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
@@ -90,21 +91,23 @@ const FooterStateful = props => {
90
91
  }
91
92
  };
92
93
  (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
- });
94
+ if (state.appStates.conversationState === _ConversationState.ConversationState.Active) {
95
+ if (state.appStates.isAudioMuted === null) {
96
+ var _footerProps$controlP4, _footerProps$controlP5, _footerProps$controlP6;
97
+ dispatch({
98
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
99
+ payload: footerProps !== null && footerProps !== void 0 && (_footerProps$controlP4 = footerProps.controlProps) !== null && _footerProps$controlP4 !== void 0 && _footerProps$controlP4.hideAudioNotificationButton ? true : (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP5 = footerProps.controlProps) === null || _footerProps$controlP5 === void 0 ? void 0 : (_footerProps$controlP6 = _footerProps$controlP5.audioNotificationButtonProps) === null || _footerProps$controlP6 === void 0 ? void 0 : _footerProps$controlP6.isAudioMuted) ?? false
100
+ });
101
+ }
99
102
  }
100
- }, []);
103
+ }, [state.appStates.conversationState]);
101
104
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !hideFooterDisplay && /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Footer, {
102
105
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
103
106
  controlProps: controlProps,
104
107
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
105
108
  }), /*#__PURE__*/_react.default.createElement(_AudioNotificationStateful.default, {
106
109
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? _Audios.NewMessageNotificationSoundBase64,
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
110
+ isAudioMuted: state.appStates.isAudioMuted ?? false
108
111
  }));
109
112
  };
110
113
  exports.FooterStateful = FooterStateful;
@@ -88,6 +88,10 @@ const HeaderStateful = props => {
88
88
  text: "We're Offline"
89
89
  },
90
90
  onMinimizeClick: () => {
91
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
92
+ Event: _TelemetryConstants.TelemetryEvent.HeaderMinimizeButtonClicked,
93
+ Description: "Header Minimize button clicked."
94
+ });
91
95
  dispatch({
92
96
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
93
97
  payload: true
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.prepareEndChat = exports.endVoiceVideoCallIfOngoing = exports.endChatStateCleanUp = exports.endChat = exports.closeChatStateCleanUp = exports.chatSDKStateCleanUp = exports.callingStateCleanUp = void 0;
7
- var _Constants = require("../../../common/Constants");
8
7
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
+ var _Constants = require("../../../common/Constants");
9
9
  var _utils = require("../../../common/utils");
10
10
  var _renderSurveyHelpers = require("./renderSurveyHelpers");
11
11
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
@@ -60,6 +60,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
60
60
  const postchatContext = (await (0, _renderSurveyHelpers.getPostChatContext)(chatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.postChatContext);
61
61
  if (postchatContext === undefined) {
62
62
  var _state$appStates2;
63
+ _omnichannelChatComponents.BroadcastService.postMessage({
64
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
65
+ payload: {
66
+ errorMessage: "Widget did not display post chat survey as getPostChatContext returned undefined."
67
+ }
68
+ });
69
+
63
70
  // For Customer intiated conversations, just close chat widget
64
71
  if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === _Constants.ConversationEndEntity.Customer) {
65
72
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -133,21 +140,25 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
133
140
  exports.prepareEndChat = prepareEndChat;
134
141
  const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
135
142
  if (!skipEndChatSDK && chatSDK.conversation) {
143
+ var _inMemoryState$appSta;
144
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
145
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
146
+ payload: null
147
+ });
148
+ const endChatOptionalParameters = {
149
+ isSessionEnded: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived
150
+ };
136
151
  try {
137
152
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
138
153
  Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
139
154
  });
140
155
  //Get auth token again if chat continued for longer time, otherwise gets 401 error
141
156
  await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
142
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
157
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat(endChatOptionalParameters));
143
158
  } catch (ex) {
144
- var _inMemoryState$appSta;
145
- const inMemoryState = (0, _createReducer.executeReducer)(state, {
146
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
147
- payload: null
148
- });
159
+ var _inMemoryState$appSta2;
149
160
  // if the chat was disconnected or ended by the agent, we don't want to log the error
150
- if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta = inMemoryState.appStates) !== null && _inMemoryState$appSta !== void 0 && _inMemoryState$appSta.chatDisconnectEventReceived)) {
161
+ if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta2 = inMemoryState.appStates) !== null && _inMemoryState$appSta2 !== void 0 && _inMemoryState$appSta2.chatDisconnectEventReceived)) {
151
162
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
152
163
  Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
153
164
  ExceptionDetails: {
@@ -164,7 +175,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
164
175
  }
165
176
  postMessageToOtherTab = false;
166
177
  } finally {
167
- await endChatStateCleanUp(dispatch);
178
+ endChatStateCleanUp(dispatch);
168
179
  }
169
180
  }
170
181
  if (!skipCloseChat) {
@@ -7,6 +7,7 @@ exports.initWebChatComposer = void 0;
7
7
  var _Constants = require("../../../common/Constants");
8
8
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
9
  var _utils = require("../../../common/utils");
10
+ var _dompurify = _interopRequireDefault(require("dompurify"));
10
11
  var _HyperlinkTextOverrideRenderer = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer"));
11
12
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
12
13
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
@@ -22,8 +23,10 @@ var _conversationEndMiddleware = _interopRequireDefault(require("../../webchatco
22
23
  var _dataMaskingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware"));
23
24
  var _createMarkdown = require("./createMarkdown");
24
25
  var _maxMessageSizeValidator = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator"));
26
+ var _messageSequenceIdOverrideMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware"));
25
27
  var _messageTimestampMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware"));
26
28
  var _botframeworkWebchat = require("botframework-webchat");
29
+ var _toastMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware"));
27
30
  var _WebChatLogger = require("../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
28
31
  var _defaultAttachmentProps = require("../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps");
29
32
  var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
@@ -34,9 +37,6 @@ var _htmlPlayerMiddleware = _interopRequireDefault(require("../../webchatcontain
34
37
  var _htmlTextMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware"));
35
38
  var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware"));
36
39
  var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
37
- var _dompurify = _interopRequireDefault(require("dompurify"));
38
- var _messageSequenceIdOverrideMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware"));
39
- var _toastMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware"));
40
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
41
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
42
  const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
@@ -106,7 +106,11 @@ const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
106
106
  markdownRenderers.forEach(renderer => {
107
107
  text = renderer.render(text);
108
108
  });
109
- text = _dompurify.default.sanitize(text);
109
+ const config = {
110
+ FORBID_TAGS: ["form", "button", "script", "div", "input"],
111
+ FORBID_ATTR: ["action"]
112
+ };
113
+ text = _dompurify.default.sanitize(text, config);
110
114
  return text;
111
115
  };
112
116
  function postDomPurifyActivities() {
@@ -206,6 +206,12 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
206
206
  exception: `Failed to setup startChat: ${error}`
207
207
  }
208
208
  });
209
+ _omnichannelChatComponents.BroadcastService.postMessage({
210
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
211
+ payload: {
212
+ errorMessage: error
213
+ }
214
+ });
209
215
  isStartChatSuccessful = false;
210
216
  throw error;
211
217
  }
@@ -371,14 +377,14 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
371
377
  try {
372
378
  chatSDK.requestId = requestIdFromCache;
373
379
  conversationDetails = await (0, _utils.getConversationDetailsCall)(chatSDK, liveChatContext);
374
- if (Object.keys(conversationDetails).length === 0) {
375
- return false;
376
- }
377
- if (conversationDetails.state === _Constants.LiveWorkItemState.Closed || conversationDetails.state === _Constants.LiveWorkItemState.WrapUp) {
380
+ if (Object.keys(conversationDetails).length === 0 || (0, _utils.isNullOrUndefined)(conversationDetails.state) || conversationDetails.state === _Constants.LiveWorkItemState.Closed || conversationDetails.state === _Constants.LiveWorkItemState.WrapUp) {
378
381
  dispatch({
379
382
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
380
383
  payload: undefined
381
384
  });
385
+ if (currentRequestId) {
386
+ chatSDK.requestId = currentRequestId;
387
+ }
382
388
  return false;
383
389
  }
384
390
  return true;
@@ -155,6 +155,12 @@ const LiveChatWidgetStateful = props => {
155
155
  }
156
156
  return;
157
157
  }
158
+ _omnichannelChatComponents.BroadcastService.postMessage({
159
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
160
+ payload: {
161
+ errorMessage: "Chat found in cache but invalid as the conversation status is inactive."
162
+ }
163
+ });
158
164
  }
159
165
  if (isChatValid === false) {
160
166
  if (localState) {
@@ -274,6 +280,12 @@ const LiveChatWidgetStateful = props => {
274
280
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
275
281
  payload: _ConversationState.ConversationState.OutOfOffice
276
282
  });
283
+ _omnichannelChatComponents.BroadcastService.postMessage({
284
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
285
+ payload: {
286
+ errorMessage: "Out-of-office hours status is shown."
287
+ }
288
+ });
277
289
  return;
278
290
  }
279
291
  _omnichannelChatComponents.BroadcastService.postMessage({
@@ -365,9 +377,16 @@ const LiveChatWidgetStateful = props => {
365
377
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
366
378
  payload: true
367
379
  });
380
+ const desc = "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)";
368
381
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
369
382
  Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
370
- Description: "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)"
383
+ Description: desc
384
+ });
385
+ _omnichannelChatComponents.BroadcastService.postMessage({
386
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
387
+ payload: {
388
+ errorMessage: desc
389
+ }
371
390
  });
372
391
  }
373
392
  });
@@ -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 {
@@ -6,18 +6,41 @@ 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
+ */
16
27
  getLiveChatConfig() {
17
28
  return {
18
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",
19
37
  msdyn_postconversationsurveyenable: "false",
20
- msdyn_conversationmode: "192350000"
38
+ OutOfOperatingHours: "False",
39
+ ShowWidget: "True"
40
+ },
41
+ ChatWidgetLanguage: {
42
+ msdyn_localeid: "1033",
43
+ msdyn_languagename: "English - United States"
21
44
  }
22
45
  };
23
46
  }
@@ -87,7 +87,8 @@ const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userM
87
87
  }
88
88
  if (isTagIncluded(card, _Constants.Constants.systemMessageTag)) {
89
89
  return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
90
- } else if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
90
+ }
91
+ if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
91
92
  if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === _Constants.Constants.webchatChannelId) {
92
93
  card.activity.text = (0, _utils.escapeHtml)(card.activity.text);
93
94
  card.activity.channelData.isHtmlEncoded = true;
@@ -9,6 +9,8 @@ var _NotificationLevel = require("../enums/NotificationLevel");
9
9
  var _WebChatActionType = require("../enums/WebChatActionType");
10
10
  var _WebChatStoreLoader = require("../WebChatStoreLoader");
11
11
  var _utils = require("../../../../common/utils");
12
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
13
+ var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
12
14
  class NotificationHandler {
13
15
  static notify(id, level, message) {
14
16
  if (_WebChatStoreLoader.WebChatStoreLoader.store) {
@@ -34,6 +36,12 @@ class NotificationHandler {
34
36
  }
35
37
  }
36
38
  static notifyError(id, message) {
39
+ _omnichannelChatComponents.BroadcastService.postMessage({
40
+ eventName: _TelemetryConstants.BroadcastEvent.OnWidgetError,
41
+ payload: {
42
+ errorMessage: message
43
+ }
44
+ });
37
45
  this.notify(id, _NotificationLevel.NotificationLevel.Error, message);
38
46
  }
39
47
  static notifyWarning(id, message) {
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 }; }
@@ -60,6 +60,7 @@ export let BroadcastEvent;
60
60
  BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
61
61
  BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
62
62
  BroadcastEvent["SyncMinimize"] = "SyncMinimize";
63
+ BroadcastEvent["OnWidgetError"] = "OnWidgetError";
63
64
  })(BroadcastEvent || (BroadcastEvent = {}));
64
65
  export let TelemetryEvent;
65
66
  (function (TelemetryEvent) {
@@ -15,6 +15,7 @@ export class TelemetryHelper {
15
15
  case ScenarioType.WEBCHAT:
16
16
  return TelemetryHelper.conformToWebChatContract(level, input);
17
17
  case ScenarioType.OCCHATSDK:
18
+ case ScenarioType.SDK:
18
19
  return TelemetryHelper.conformToOCChatSDKContract(level, input);
19
20
  case ScenarioType.ACTIONS:
20
21
  return TelemetryHelper.conformToActionsContract(level, input);
@@ -150,6 +151,7 @@ export class TelemetryHelper {
150
151
  event.TransactionId = payload.TransactionId;
151
152
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
152
153
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
154
+ event.Description = payload.Description;
153
155
  });
154
156
  }
155
157
  static addChatConfigDataToTelemetry(chatConfig, telemetryInternalData) {
@@ -11,10 +11,11 @@ import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
11
11
  import { downloadTranscript } from "./downloadtranscriptstateful/DownloadTranscriptStateful";
12
12
  import useChatContextStore from "../../hooks/useChatContextStore";
13
13
  import useChatSDKStore from "../../hooks/useChatSDKStore";
14
+ import { ConversationState } from "../../contexts/common/ConversationState";
14
15
 
15
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
17
  export const FooterStateful = props => {
17
- var _footerProps$controlP3, _footerProps$controlP6;
18
+ var _footerProps$controlP3;
18
19
  const [state, dispatch] = useChatContextStore();
19
20
  // hideFooterDisplay - the purpose of this is to keep the footer always "active",
20
21
  // but hide it visually in certain states (e.g., loading state) and show in some other states (e.g. active state).
@@ -82,21 +83,23 @@ export const FooterStateful = props => {
82
83
  }
83
84
  };
84
85
  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
- });
86
+ if (state.appStates.conversationState === ConversationState.Active) {
87
+ if (state.appStates.isAudioMuted === null) {
88
+ var _footerProps$controlP4, _footerProps$controlP5, _footerProps$controlP6;
89
+ dispatch({
90
+ type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
91
+ payload: footerProps !== null && footerProps !== void 0 && (_footerProps$controlP4 = footerProps.controlProps) !== null && _footerProps$controlP4 !== void 0 && _footerProps$controlP4.hideAudioNotificationButton ? true : (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP5 = footerProps.controlProps) === null || _footerProps$controlP5 === void 0 ? void 0 : (_footerProps$controlP6 = _footerProps$controlP5.audioNotificationButtonProps) === null || _footerProps$controlP6 === void 0 ? void 0 : _footerProps$controlP6.isAudioMuted) ?? false
92
+ });
93
+ }
91
94
  }
92
- }, []);
95
+ }, [state.appStates.conversationState]);
93
96
  return /*#__PURE__*/React.createElement(React.Fragment, null, !hideFooterDisplay && /*#__PURE__*/React.createElement(Footer, {
94
97
  componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
95
98
  controlProps: controlProps,
96
99
  styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
97
100
  }), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
98
101
  audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
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
102
+ isAudioMuted: state.appStates.isAudioMuted ?? false
100
103
  }));
101
104
  };
102
105
  export default FooterStateful;
@@ -79,6 +79,10 @@ export const HeaderStateful = props => {
79
79
  text: "We're Offline"
80
80
  },
81
81
  onMinimizeClick: () => {
82
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
83
+ Event: TelemetryEvent.HeaderMinimizeButtonClicked,
84
+ Description: "Header Minimize button clicked."
85
+ });
82
86
  dispatch({
83
87
  type: LiveChatWidgetActionType.SET_MINIMIZED,
84
88
  payload: true
@@ -1,5 +1,5 @@
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
1
2
  import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
2
- import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
4
4
  import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
5
5
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
@@ -55,6 +55,13 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
55
55
  const postchatContext = (await getPostChatContext(chatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : _state$domainStates.postChatContext);
56
56
  if (postchatContext === undefined) {
57
57
  var _state$appStates2;
58
+ BroadcastService.postMessage({
59
+ eventName: BroadcastEvent.OnWidgetError,
60
+ payload: {
61
+ errorMessage: "Widget did not display post chat survey as getPostChatContext returned undefined."
62
+ }
63
+ });
64
+
58
65
  // For Customer intiated conversations, just close chat widget
59
66
  if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === ConversationEndEntity.Customer) {
60
67
  TelemetryHelper.logSDKEvent(LogLevel.INFO, {
@@ -127,21 +134,25 @@ const prepareEndChat = async (props, chatSDK, state, dispatch, setAdapter, setWe
127
134
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
135
  const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
129
136
  if (!skipEndChatSDK && chatSDK.conversation) {
137
+ var _inMemoryState$appSta;
138
+ const inMemoryState = executeReducer(state, {
139
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
140
+ payload: null
141
+ });
142
+ const endChatOptionalParameters = {
143
+ isSessionEnded: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived
144
+ };
130
145
  try {
131
146
  TelemetryHelper.logSDKEvent(LogLevel.INFO, {
132
147
  Event: TelemetryEvent.EndChatSDKCall
133
148
  });
134
149
  //Get auth token again if chat continued for longer time, otherwise gets 401 error
135
150
  await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
136
- await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
151
+ await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat(endChatOptionalParameters));
137
152
  } catch (ex) {
138
- var _inMemoryState$appSta;
139
- const inMemoryState = executeReducer(state, {
140
- type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
141
- payload: null
142
- });
153
+ var _inMemoryState$appSta2;
143
154
  // if the chat was disconnected or ended by the agent, we don't want to log the error
144
- if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta = inMemoryState.appStates) !== null && _inMemoryState$appSta !== void 0 && _inMemoryState$appSta.chatDisconnectEventReceived)) {
155
+ if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta2 = inMemoryState.appStates) !== null && _inMemoryState$appSta2 !== void 0 && _inMemoryState$appSta2.chatDisconnectEventReceived)) {
145
156
  TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
146
157
  Event: TelemetryEvent.EndChatSDKCallFailed,
147
158
  ExceptionDetails: {
@@ -158,7 +169,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
158
169
  }
159
170
  postMessageToOtherTab = false;
160
171
  } finally {
161
- await endChatStateCleanUp(dispatch);
172
+ endChatStateCleanUp(dispatch);
162
173
  }
163
174
  }
164
175
  if (!skipCloseChat) {
@@ -1,6 +1,7 @@
1
1
  import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
2
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { changeLanguageCodeFormatForWebChat, getConversationDetailsCall } from "../../../common/utils";
4
+ import DOMPurify from "dompurify";
4
5
  import HyperlinkTextOverrideRenderer from "../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer";
5
6
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
6
7
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
@@ -16,8 +17,10 @@ import createConversationEndMiddleware from "../../webchatcontainerstateful/webc
16
17
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
17
18
  import { createMarkdown } from "./createMarkdown";
18
19
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
+ import createMessageSequenceIdOverrideMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
19
21
  import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
20
22
  import { createStore } from "botframework-webchat";
23
+ import createToastMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
21
24
  import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
22
25
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
23
26
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
@@ -28,9 +31,6 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
28
31
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
29
32
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
30
33
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
31
- import DOMPurify from "dompurify";
32
- import createMessageSequenceIdOverrideMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
33
- import createToastMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
34
34
 
35
35
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
36
  export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) => {
@@ -100,7 +100,11 @@ export const initWebChatComposer = (props, state, dispatch, chatSDK, endChat) =>
100
100
  markdownRenderers.forEach(renderer => {
101
101
  text = renderer.render(text);
102
102
  });
103
- text = DOMPurify.sanitize(text);
103
+ const config = {
104
+ FORBID_TAGS: ["form", "button", "script", "div", "input"],
105
+ FORBID_ATTR: ["action"]
106
+ };
107
+ text = DOMPurify.sanitize(text, config);
104
108
  return text;
105
109
  };
106
110
  function postDomPurifyActivities() {
@@ -1,6 +1,6 @@
1
1
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
2
  import { Constants, LiveWorkItemState, WidgetLoadCustomErrorString, WidgetLoadTelemetryMessage } from "../../../common/Constants";
3
- import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isUndefinedOrEmpty } from "../../../common/utils";
3
+ import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
4
4
  import { getAuthClientFunction, handleAuthentication } from "./authHelper";
5
5
  import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
6
6
  import { handleStartChatError, logWidgetLoadComplete } from "./startChatErrorHandler";
@@ -199,6 +199,12 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
199
199
  exception: `Failed to setup startChat: ${error}`
200
200
  }
201
201
  });
202
+ BroadcastService.postMessage({
203
+ eventName: BroadcastEvent.OnWidgetError,
204
+ payload: {
205
+ errorMessage: error
206
+ }
207
+ });
202
208
  isStartChatSuccessful = false;
203
209
  throw error;
204
210
  }
@@ -363,14 +369,14 @@ const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
363
369
  try {
364
370
  chatSDK.requestId = requestIdFromCache;
365
371
  conversationDetails = await getConversationDetailsCall(chatSDK, liveChatContext);
366
- if (Object.keys(conversationDetails).length === 0) {
367
- return false;
368
- }
369
- if (conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
372
+ if (Object.keys(conversationDetails).length === 0 || isNullOrUndefined(conversationDetails.state) || conversationDetails.state === LiveWorkItemState.Closed || conversationDetails.state === LiveWorkItemState.WrapUp) {
370
373
  dispatch({
371
374
  type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
372
375
  payload: undefined
373
376
  });
377
+ if (currentRequestId) {
378
+ chatSDK.requestId = currentRequestId;
379
+ }
374
380
  return false;
375
381
  }
376
382
  return true;
@@ -147,6 +147,12 @@ export const LiveChatWidgetStateful = props => {
147
147
  }
148
148
  return;
149
149
  }
150
+ BroadcastService.postMessage({
151
+ eventName: BroadcastEvent.OnWidgetError,
152
+ payload: {
153
+ errorMessage: "Chat found in cache but invalid as the conversation status is inactive."
154
+ }
155
+ });
150
156
  }
151
157
  if (isChatValid === false) {
152
158
  if (localState) {
@@ -266,6 +272,12 @@ export const LiveChatWidgetStateful = props => {
266
272
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
267
273
  payload: ConversationState.OutOfOffice
268
274
  });
275
+ BroadcastService.postMessage({
276
+ eventName: BroadcastEvent.OnWidgetError,
277
+ payload: {
278
+ errorMessage: "Out-of-office hours status is shown."
279
+ }
280
+ });
269
281
  return;
270
282
  }
271
283
  BroadcastService.postMessage({
@@ -357,9 +369,16 @@ export const LiveChatWidgetStateful = props => {
357
369
  type: LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED,
358
370
  payload: true
359
371
  });
372
+ const desc = "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)";
360
373
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
361
374
  Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
362
- Description: "Chat disconnected due to timeout, user went offline or blocked the device (including closing laptop)"
375
+ Description: desc
376
+ });
377
+ BroadcastService.postMessage({
378
+ eventName: BroadcastEvent.OnWidgetError,
379
+ payload: {
380
+ errorMessage: desc
381
+ }
363
382
  });
364
383
  }
365
384
  });
@@ -47,7 +47,7 @@ const createMagicCodeSuccessResponse = signin => {
47
47
  };
48
48
  };
49
49
  export const WebChatContainerStateful = props => {
50
- 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;
50
+ 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;
51
51
  const {
52
52
  BasicWebChat
53
53
  } = Components;
@@ -163,6 +163,11 @@ export const WebChatContainerStateful = props => {
163
163
  div[class="ac-textBlock"] *,
164
164
  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.textWhiteSpace}}
165
165
 
166
+ div[class="ac-input-container"] input.ac-multichoiceInput,
167
+ div[class="ac-input-container"] select.ac-multichoiceInput {
168
+ ${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp7 !== void 0 && _webChatContainerProp7.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
169
+ }
170
+
166
171
  .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 {
167
172
  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.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
168
173
  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.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
@@ -172,16 +177,16 @@ export const WebChatContainerStateful = props => {
172
177
  div[class="ac-textBlock"] a:visited,
173
178
  div[class="ac-textBlock"] a:hover,
174
179
  div[class="ac-textBlock"] a:active {
175
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
180
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
176
181
  }
177
182
 
178
- .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.buttonWhiteSpace} !important;}
183
+ .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.buttonWhiteSpace} !important;}
179
184
 
180
185
  .ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
181
186
  background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik03LjI1MDEgNC41MDAxN0gxMC43NDk1QzExLjE2MzcgNC41MDAxNyAxMS40OTk1IDQuODM1OTYgMTEuNDk5NSA1LjI1MDE3QzExLjQ5OTUgNS42Mjk4NiAxMS4yMTczIDUuOTQzNjYgMTAuODUxMyA1Ljk5MzMyTDEwLjc0OTUgNi4wMDAxN0g3LjI0OTc0QzYuMDcwNzkgNS45OTk2MSA1LjEwMzQ5IDYuOTA2NTYgNS4wMDc4NiA4LjA2MTEyTDUuMDAwMjggOC4yMjAwM0w1LjAwMzEyIDE2Ljc1MDdDNS4wMDM0MyAxNy45NDE1IDUuOTI4ODUgMTguOTE2MSA3LjA5OTY2IDE4Ljk5NDlMNy4yNTM3MSAxOS4wMDAxTDE1Ljc1MTggMTguOTg4NEMxNi45NDE1IDE4Ljk4NjggMTcuOTE0NSAxOC4wNjIgMTcuOTkzNSAxNi44OTIzTDE3Ljk5ODcgMTYuNzM4NFYxMy4yMzIxQzE3Ljk5ODcgMTIuODE3OSAxOC4zMzQ1IDEyLjQ4MjEgMTguNzQ4NyAxMi40ODIxQzE5LjEyODQgMTIuNDgyMSAxOS40NDIyIDEyLjc2NDMgMTkuNDkxOCAxMy4xMzAzTDE5LjQ5ODcgMTMuMjMyMVYxNi43Mzg0QzE5LjQ5ODcgMTguNzQwNyAxNy45MjkzIDIwLjM3NjkgMTUuOTUyOCAyMC40ODI5TDE1Ljc1MzggMjAuNDg4NEw3LjI1ODI3IDIwLjUwMDFMNy4wNTQ5NSAyMC40OTQ5QzUuMTQyMzkgMjAuMzk1NCAzLjYwODk1IDE4Ljg2MjcgMy41MDgzNyAxNi45NTAyTDMuNTAzMTIgMTYuNzUxMUwzLjUwMDg5IDguMjUyN0wzLjUwNTI5IDguMDUwMkMzLjYwNTM5IDYuMTM3NDkgNS4xMzg2NyA0LjYwNDQ5IDcuMDUwOTYgNC41MDUyN0w3LjI1MDEgNC41MDAxN0gxMC43NDk1SDcuMjUwMVpNMTMuNzQ4MSAzLjAwMTQ2TDIwLjMwMTggMy4wMDE5N0wyMC40MDE0IDMuMDE1NzVMMjAuNTAyMiAzLjA0MzkzTDIwLjU1OSAzLjA2ODAzQzIwLjYxMjIgMy4wOTEyMiAyMC42NjM0IDMuMTIxNjMgMjAuNzExMSAzLjE1ODg1TDIwLjc4MDQgMy4yMjE1NkwyMC44NjQxIDMuMzIwMTRMMjAuOTE4MyAzLjQxMDI1TDIwLjk1NyAzLjUwMDU3TDIwLjk3NjIgMy41NjQ3NkwyMC45ODk4IDMuNjI4NjJMMjAuOTk5MiAzLjcyMjgyTDIwLjk5OTcgMTAuMjU1NEMyMC45OTk3IDEwLjY2OTYgMjAuNjYzOSAxMS4wMDU0IDIwLjI0OTcgMTEuMDA1NEMxOS44NyAxMS4wMDU0IDE5LjU1NjIgMTAuNzIzMiAxOS41MDY1IDEwLjM1NzFMMTkuNDk5NyAxMC4yNTU0TDE5LjQ5ODkgNS41NjE0N0wxMi4yNzk3IDEyLjc4NDdDMTIuMDEzNCAxMy4wNTEgMTEuNTk2OCAxMy4wNzUzIDExLjMwMzEgMTIuODU3NUwxMS4yMTkgMTIuNzg0OUMxMC45NTI3IDEyLjUxODcgMTAuOTI4NCAxMi4xMDIxIDExLjE0NjIgMTEuODA4NEwxMS4yMTg4IDExLjcyNDNMMTguNDM2OSA0LjUwMTQ2SDEzLjc0ODFDMTMuMzY4NCA0LjUwMTQ2IDEzLjA1NDYgNC4yMTkzMSAxMy4wMDUgMy44NTMyNEwxMi45OTgxIDMuNzUxNDZDMTIuOTk4MSAzLjM3MTc3IDEzLjI4MDMgMy4wNTc5NyAxMy42NDY0IDMuMDA4MzFMMTMuNzQ4MSAzLjAwMTQ2WiIgZmlsbD0iI0ZGRkZGRiIgLz48L3N2Zz4) !important;
182
187
  height: .75em;
183
188
  margin-left: .25em;
184
- 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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
189
+ 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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
185
190
  }
186
191
  pre {
187
192
  white-space: pre-wrap;
@@ -194,13 +199,13 @@ export const WebChatContainerStateful = props => {
194
199
  .ms_lcw_webchat_received_message a:visited,
195
200
  .ms_lcw_webchat_received_message a:hover,
196
201
  .ms_lcw_webchat_received_message a:active {
197
- 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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
202
+ 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 === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
198
203
  }
199
204
  .ms_lcw_webchat_sent_message a:link,
200
205
  .ms_lcw_webchat_sent_message a:visited,
201
206
  .ms_lcw_webchat_sent_message a:hover,
202
207
  .ms_lcw_webchat_sent_message a:active {
203
- 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 === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
208
+ 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 === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
204
209
  }
205
210
 
206
211
  .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
@@ -1,17 +1,40 @@
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); }
1
4
  import { DesignerChatAdapter } from "./DesignerChatAdapter";
2
5
  import { MockChatSDK } from "./mockchatsdk";
3
6
  export class DesignerChatSDK extends MockChatSDK {
4
7
  constructor() {
5
8
  super();
9
+ _defineProperty(this, "localeId", this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
6
10
  }
7
11
  createChatAdapter() {
8
12
  return new DesignerChatAdapter();
9
13
  }
14
+ /**
15
+ * If the widget is running in designer mode, we mock the initialize response. We don't want
16
+ * any interactions with a real server in when designing LCW widget visually in Modern Admin.
17
+ *
18
+ * - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
19
+ * - msdyn_callingoptions was changed to disable calling functionality
20
+ */
10
21
  getLiveChatConfig() {
11
22
  return {
12
23
  LiveWSAndLiveChatEngJoin: {
24
+ msdyn_widgetthemecolor: "19236002",
25
+ // msdyn_callingoptions was changed to disable calling functionality
26
+ msdyn_callingoptions: "192350000",
27
+ msdyn_widgettitle: "Let\u0027s chat",
28
+ msdyn_conversationmode: "192350000",
29
+ msdyn_avatarurl: "https://oc-cdn-ocprod.azureedge.net/livechatwidget/images/chatIcon.svg",
30
+ msdyn_name: "Let's Chat",
13
31
  msdyn_postconversationsurveyenable: "false",
14
- msdyn_conversationmode: "192350000"
32
+ OutOfOperatingHours: "False",
33
+ ShowWidget: "True"
34
+ },
35
+ ChatWidgetLanguage: {
36
+ msdyn_localeid: "1033",
37
+ msdyn_languagename: "English - United States"
15
38
  }
16
39
  };
17
40
  }
@@ -80,7 +80,8 @@ export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps
80
80
  }
81
81
  if (isTagIncluded(card, Constants.systemMessageTag)) {
82
82
  return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
83
- } else if (card.activity.text && card.activity.type === DirectLineActivityType.Message) {
83
+ }
84
+ if (card.activity.text && card.activity.type === DirectLineActivityType.Message) {
84
85
  if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === Constants.webchatChannelId) {
85
86
  card.activity.text = escapeHtml(card.activity.text);
86
87
  card.activity.channelData.isHtmlEncoded = true;
@@ -3,6 +3,8 @@ import { NotificationLevel } from "../enums/NotificationLevel";
3
3
  import { WebChatActionType } from "../enums/WebChatActionType";
4
4
  import { WebChatStoreLoader } from "../WebChatStoreLoader";
5
5
  import { setFocusOnSendBox } from "../../../../common/utils";
6
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
7
+ import { BroadcastEvent } from "../../../../common/telemetry/TelemetryConstants";
6
8
  export class NotificationHandler {
7
9
  static notify(id, level, message) {
8
10
  if (WebChatStoreLoader.store) {
@@ -28,6 +30,12 @@ export class NotificationHandler {
28
30
  }
29
31
  }
30
32
  static notifyError(id, message) {
33
+ BroadcastService.postMessage({
34
+ eventName: BroadcastEvent.OnWidgetError,
35
+ payload: {
36
+ errorMessage: message
37
+ }
38
+ });
31
39
  this.notify(id, NotificationLevel.Error, message);
32
40
  }
33
41
  static notifyWarning(id, message) {
package/lib/esm/index.js CHANGED
@@ -4,5 +4,6 @@ import useChatSDKStore from "./hooks/useChatSDKStore";
4
4
  import { getWidgetCacheId, getWidgetEndChatEventName } from "./common/utils";
5
5
  import { ConversationState } from "./contexts/common/ConversationState";
6
6
  export { default as LiveChatWidget } from "./components/livechatwidget/LiveChatWidget";
7
+ export { getMockChatSDKIfApplicable } from "./components/livechatwidget/common/getMockChatSDKIfApplicable";
7
8
  export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore };
8
9
  export { getWidgetCacheId, getWidgetEndChatEventName, ConversationState };
@@ -53,7 +53,8 @@ export declare enum BroadcastEvent {
53
53
  UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
54
54
  UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
55
55
  ContactIdNotFound = "ContactIdNotFound",
56
- SyncMinimize = "SyncMinimize"
56
+ SyncMinimize = "SyncMinimize",
57
+ OnWidgetError = "OnWidgetError"
57
58
  }
58
59
  export declare enum TelemetryEvent {
59
60
  CallAdded = "CallAdded",
@@ -34,6 +34,7 @@ export interface OCChatSDKTelemetryData extends BaseTelemetryData {
34
34
  ElapsedTimeInMilliseconds?: number;
35
35
  TransactionId: string;
36
36
  ExceptionDetails?: object;
37
+ Description?: string;
37
38
  }
38
39
  export interface IC3ClientTelemetryData extends BaseTelemetryData {
39
40
  SubscriptionId?: string;
@@ -3,10 +3,29 @@ import { MockChatSDK } from "./mockchatsdk";
3
3
  export declare class DesignerChatSDK extends MockChatSDK {
4
4
  constructor();
5
5
  createChatAdapter(): DesignerChatAdapter;
6
+ localeId: string;
7
+ /**
8
+ * If the widget is running in designer mode, we mock the initialize response. We don't want
9
+ * any interactions with a real server in when designing LCW widget visually in Modern Admin.
10
+ *
11
+ * - All GUIDs were changed to 00000000-0000-0000-0000-000000000000.
12
+ * - msdyn_callingoptions was changed to disable calling functionality
13
+ */
6
14
  getLiveChatConfig(): {
7
15
  LiveWSAndLiveChatEngJoin: {
8
- msdyn_postconversationsurveyenable: string;
16
+ msdyn_widgetthemecolor: string;
17
+ msdyn_callingoptions: string;
18
+ msdyn_widgettitle: string;
9
19
  msdyn_conversationmode: string;
20
+ msdyn_avatarurl: string;
21
+ msdyn_name: string;
22
+ msdyn_postconversationsurveyenable: string;
23
+ OutOfOperatingHours: string;
24
+ ShowWidget: string;
25
+ };
26
+ ChatWidgetLanguage: {
27
+ msdyn_localeid: string;
28
+ msdyn_languagename: string;
10
29
  };
11
30
  };
12
31
  }
@@ -4,4 +4,5 @@ export interface IAdaptiveCardStyles {
4
4
  anchorColor?: string;
5
5
  buttonWhiteSpace?: string;
6
6
  textWhiteSpace?: string;
7
+ choiceInputPadding?: string;
7
8
  }
@@ -4,5 +4,6 @@ import useChatSDKStore from "./hooks/useChatSDKStore";
4
4
  import { getWidgetCacheId, getWidgetEndChatEventName } from "./common/utils";
5
5
  import { ConversationState } from "./contexts/common/ConversationState";
6
6
  export { default as LiveChatWidget } from "./components/livechatwidget/LiveChatWidget";
7
+ export { getMockChatSDKIfApplicable } from "./components/livechatwidget/common/getMockChatSDKIfApplicable";
7
8
  export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore };
8
9
  export { getWidgetCacheId, getWidgetEndChatEventName, ConversationState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.3",
3
+ "version": "1.7.4-main.120159a",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -74,8 +74,10 @@
74
74
  "webpack-cli": "^4.9.2"
75
75
  },
76
76
  "dependencies": {
77
+ "@azure/core-tracing": "^1.2.0",
77
78
  "@microsoft/omnichannel-chat-components": "1.1.5",
78
- "@microsoft/omnichannel-chat-sdk": "^1.10.1",
79
+ "@microsoft/omnichannel-chat-sdk": "^1.10.4",
80
+ "@opentelemetry/api": "^1.9.0",
79
81
  "abort-controller-es5": "^2.0.1",
80
82
  "dompurify": "^2.5.4",
81
83
  "markdown-it": "^12.3.2",