@microsoft/omnichannel-chat-widget 1.7.8-main.9e74278 → 1.7.8-main.ab4d3b4

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 (48) hide show
  1. package/lib/cjs/common/telemetry/TelemetryConstants.js +9 -0
  2. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
  3. package/lib/cjs/components/headerstateful/HeaderStateful.js +3 -5
  4. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -1
  5. package/lib/cjs/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
  6. package/lib/cjs/components/livechatwidget/common/endChat.js +4 -18
  7. package/lib/cjs/components/livechatwidget/common/startChat.js +2 -0
  8. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +17 -11
  9. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +9 -3
  10. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +22 -6
  11. package/lib/cjs/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +28 -0
  12. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
  13. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
  14. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
  15. package/lib/cjs/firstresponselatency/Constants.js +13 -0
  16. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +118 -0
  17. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +179 -0
  18. package/lib/cjs/firstresponselatency/util.js +98 -0
  19. package/lib/cjs/plugins/createChatTranscript.js +4 -4
  20. package/lib/cjs/plugins/newMessageEventHandler.js +102 -88
  21. package/lib/esm/common/telemetry/TelemetryConstants.js +9 -0
  22. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -5
  23. package/lib/esm/components/headerstateful/HeaderStateful.js +3 -5
  24. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -1
  25. package/lib/esm/components/livechatwidget/common/chatDisconnectHelper.js +3 -1
  26. package/lib/esm/components/livechatwidget/common/endChat.js +4 -18
  27. package/lib/esm/components/livechatwidget/common/startChat.js +2 -0
  28. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +17 -11
  29. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +9 -3
  30. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +22 -6
  31. package/lib/esm/components/postchatsurveypanestateful/common/isValidSurveyUrl.js +21 -0
  32. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +4 -3
  33. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +4 -0
  34. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -6
  35. package/lib/esm/firstresponselatency/Constants.js +6 -0
  36. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +112 -0
  37. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +172 -0
  38. package/lib/esm/firstresponselatency/util.js +87 -0
  39. package/lib/esm/plugins/createChatTranscript.js +4 -4
  40. package/lib/esm/plugins/newMessageEventHandler.js +100 -86
  41. package/lib/types/common/telemetry/TelemetryConstants.d.ts +10 -1
  42. package/lib/types/components/postchatsurveypanestateful/common/isValidSurveyUrl.d.ts +2 -0
  43. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -1
  44. package/lib/types/firstresponselatency/Constants.d.ts +30 -0
  45. package/lib/types/firstresponselatency/FirstMessageTrackerFromBot.d.ts +1 -0
  46. package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +22 -0
  47. package/lib/types/firstresponselatency/util.d.ts +7 -0
  48. package/package.json +13 -3
@@ -66,6 +66,8 @@ exports.BroadcastEvent = BroadcastEvent;
66
66
  BroadcastEvent["ContactIdNotFound"] = "ContactIdNotFound";
67
67
  BroadcastEvent["SyncMinimize"] = "SyncMinimize";
68
68
  BroadcastEvent["OnWidgetError"] = "OnWidgetError";
69
+ BroadcastEvent["FMLTrackingCompletedAck"] = "FMLTrackingCompletedAck";
70
+ BroadcastEvent["FMLTrackingCompleted"] = "FMLTrackingCompleted";
69
71
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
70
72
  let TelemetryEvent;
71
73
  exports.TelemetryEvent = TelemetryEvent;
@@ -205,6 +207,11 @@ exports.TelemetryEvent = TelemetryEvent;
205
207
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
206
208
  TelemetryEvent["MessageSent"] = "MessageSent";
207
209
  TelemetryEvent["MessageReceived"] = "MessageReceived";
210
+ TelemetryEvent["MessageLapTrack"] = "MessageLapTrack";
211
+ TelemetryEvent["BotFirstMessageLapTrack"] = "BotFirstMessageLapTrackError";
212
+ TelemetryEvent["BotFirstMessageLapTrackError"] = "BotFirstMessageLapTrack";
213
+ TelemetryEvent["MessageStartLapTrackError"] = "MessageStartLapTrackError";
214
+ TelemetryEvent["MessageStopLapTrackError"] = "MessageStopLapTrackError";
208
215
  TelemetryEvent["SystemMessageReceived"] = "SystemMessageReceived";
209
216
  TelemetryEvent["RehydrateMessageReceived"] = "RehydrateMessageReceived";
210
217
  TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
@@ -219,6 +226,8 @@ exports.TelemetryEvent = TelemetryEvent;
219
226
  TelemetryEvent["PostChatContextCallFailed"] = "PostChatContextCallFailed";
220
227
  TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
221
228
  TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
229
+ TelemetryEvent["PostChatSurveyUrlValidationCompleted"] = "PostChatSurveyUrlValidationCompleted";
230
+ TelemetryEvent["PostChatSurveyUrlValidationFailed"] = "PostChatSurveyUrlValidationFailed";
222
231
  TelemetryEvent["ChatDisconnectThreadEventReceived"] = "ChatDisconnectThreadEventReceived";
223
232
  TelemetryEvent["HiddenAdaptiveCardMessageReceived"] = "HiddenAdaptiveCardMessageReceived";
224
233
  TelemetryEvent["EndingAdapterAfterDisconnectionError"] = "EndingAdapterAfterDisconnectionError";
@@ -20,7 +20,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
20
20
  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
21
  let uiTimer;
22
22
  const ChatButtonStateful = props => {
23
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
23
+ var _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
24
24
  // this is to ensure the telemetry is set only once and start the load timer
25
25
  (0, _react.useEffect)(() => {
26
26
  uiTimer = (0, _utils.createTimer)();
@@ -37,7 +37,8 @@ const ChatButtonStateful = props => {
37
37
  startChat
38
38
  } = props;
39
39
  //Setting OutOfOperatingHours Flag
40
- const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
40
+ //Setting OutOfOperatingHours Flag - to string conversion to normalize the value (could be boolean from other states or string directly from config)
41
+ const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(state.appStates.outsideOperatingHours);
41
42
  const ref = (0, _react.useRef)(() => {
42
43
  return;
43
44
  });
@@ -96,9 +97,7 @@ const ChatButtonStateful = props => {
96
97
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
97
98
  };
98
99
  (0, _react.useEffect)(() => {
99
- if (state.appStates.outsideOperatingHours) {
100
- setOutOfOperatingHours(true);
101
- }
100
+ setOutOfOperatingHours(state.appStates.outsideOperatingHours);
102
101
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
103
102
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonShow,
104
103
  ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer.milliSecondsElapsed
@@ -21,7 +21,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
22
  let uiTimer;
23
23
  const HeaderStateful = props => {
24
- var _state$domainStates$l, _state$domainStates$l2, _state$domainStates, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro, _state$domainStates3;
24
+ var _state$domainStates, _headerProps$controlP, _headerProps$controlP2, _headerProps$controlP3, _outOfOfficeHeaderPro, _state$domainStates3;
25
25
  (0, _react.useEffect)(() => {
26
26
  uiTimer = (0, _utils.createTimer)();
27
27
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -37,7 +37,7 @@ const HeaderStateful = props => {
37
37
  endChat
38
38
  } = props;
39
39
  //Setting OutOfOperatingHours Flag
40
- const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
40
+ const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(state.appStates.outsideOperatingHours);
41
41
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeHeaderStyleProps.defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
42
42
 
43
43
  // For some reason state object is not getting updated values in this component
@@ -109,9 +109,7 @@ const HeaderStateful = props => {
109
109
  hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice || (outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : (_outOfOfficeHeaderPro = outOfOfficeHeaderProps.controlProps) === null || _outOfOfficeHeaderPro === void 0 ? void 0 : _outOfOfficeHeaderPro.hideCloseButton)
110
110
  };
111
111
  (0, _react.useEffect)(() => {
112
- if (state.appStates.outsideOperatingHours) {
113
- setOutOfOperatingHours(true);
114
- }
112
+ setOutOfOperatingHours(state.appStates.outsideOperatingHours);
115
113
  }, []);
116
114
  (0, _react.useEffect)(() => {
117
115
  var _state$domainStates2;
@@ -7,6 +7,7 @@ exports.BotAuthActivitySubscriber = void 0;
7
7
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
8
8
  var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
9
9
  var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
10
+ var _TelemetryManager = require("../../../../common/telemetry/TelemetryManager");
10
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; }
11
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
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); }
@@ -87,6 +88,7 @@ class BotAuthActivitySubscriber {
87
88
  return (activity === null || activity === void 0 ? void 0 : (_activity$attachments = activity.attachments) === null || _activity$attachments === void 0 ? void 0 : _activity$attachments.length) > 0 && activity.attachments[0] && supportedSignInCardContentTypes.indexOf(activity.attachments[0].contentType) >= 0;
88
89
  }
89
90
  async apply(activity) {
91
+ var _TelemetryManager$Int;
90
92
  this.observer.next(false); // Hides card
91
93
  const attachment = activity.attachments[0];
92
94
  const signInUrl = attachment.content.buttons[0].value;
@@ -106,7 +108,8 @@ class BotAuthActivitySubscriber {
106
108
  const event = {
107
109
  eventName: _TelemetryConstants.BroadcastEvent.SigninCardReceived,
108
110
  payload: {
109
- sasUrl
111
+ sasUrl,
112
+ conversationId: (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.conversationId
110
113
  }
111
114
  };
112
115
  if (!sasUrl) {
@@ -11,7 +11,7 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
11
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
- var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
14
+ var _state$appStates, _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4;
15
15
  const chatDisconnectState = state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.chatDisconnectEventReceived;
16
16
  const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
17
17
  const hideSendBoxOnConversationEnd = props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd;
@@ -32,6 +32,8 @@ const handleChatDisconnect = (props, state, setWebChatStyles) => {
32
32
  });
33
33
  break;
34
34
  case false:
35
+ // this means customer on purpose wants to hide the send box, we should not override it
36
+ if ((props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.webChatStyles) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.hideSendBox) === true) return;
35
37
  if (hideSendBoxOnConversationEnd !== false) {
36
38
  setWebChatStyles(styles => {
37
39
  return {
@@ -209,7 +209,7 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
209
209
  payload: undefined
210
210
  });
211
211
  // Always allow to close the chat for embedded mode irrespective of end chat errors
212
- closeChatWidget(dispatch, props, state);
212
+ closeChatWidget(dispatch);
213
213
  facadeChatSDK.destroy();
214
214
  }
215
215
  }
@@ -339,21 +339,7 @@ const endVoiceVideoCallIfOngoing = async (facadeChatSDK, dispatch) => {
339
339
  }
340
340
  };
341
341
  exports.endVoiceVideoCallIfOngoing = endVoiceVideoCallIfOngoing;
342
- const closeChatWidget = (dispatch, props, state) => {
343
- var _state$appStates5;
344
- if (state !== null && state !== void 0 && (_state$appStates5 = state.appStates) !== null && _state$appStates5 !== void 0 && _state$appStates5.hideStartChatButton) {
345
- var _props$controlProps2, _props$controlProps3;
346
- // Only close chat if header is enabled for popout
347
- // TODO : This condition needs to be removed eventually when the filler UX is ready for popout, removing this condition would show a blank screen for OOB Widget
348
- if ((props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.hideHeader) === undefined || (props === null || props === void 0 ? void 0 : (_props$controlProps3 = props.controlProps) === null || _props$controlProps3 === void 0 ? void 0 : _props$controlProps3.hideHeader) === false) {
349
- dispatch({
350
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
351
- payload: _ConversationState.ConversationState.Closed
352
- });
353
- }
354
- return;
355
- }
356
-
342
+ const closeChatWidget = dispatch => {
357
343
  // Embedded chat
358
344
  dispatch({
359
345
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
@@ -373,6 +359,6 @@ const chatTokenCleanUp = async dispatch => {
373
359
  };
374
360
 
375
361
  const getEndChatEventName = async (facadeChatSDK, props) => {
376
- var _facadeChatSDK$getCha2, _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _props$controlProps4;
377
- return (0, _utils.getWidgetEndChatEventName)((_facadeChatSDK$getCha2 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha2 === void 0 ? void 0 : (_facadeChatSDK$getCha3 = _facadeChatSDK$getCha2.omnichannelConfig) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : _facadeChatSDK$getCha3.orgId, (_facadeChatSDK$getCha4 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : (_facadeChatSDK$getCha5 = _facadeChatSDK$getCha4.omnichannelConfig) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : _facadeChatSDK$getCha5.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps4 = props.controlProps) === null || _props$controlProps4 === void 0 ? void 0 : _props$controlProps4.widgetInstanceId) ?? "");
362
+ var _facadeChatSDK$getCha2, _facadeChatSDK$getCha3, _facadeChatSDK$getCha4, _facadeChatSDK$getCha5, _props$controlProps2;
363
+ return (0, _utils.getWidgetEndChatEventName)((_facadeChatSDK$getCha2 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha2 === void 0 ? void 0 : (_facadeChatSDK$getCha3 = _facadeChatSDK$getCha2.omnichannelConfig) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : _facadeChatSDK$getCha3.orgId, (_facadeChatSDK$getCha4 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : (_facadeChatSDK$getCha5 = _facadeChatSDK$getCha4.omnichannelConfig) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : _facadeChatSDK$getCha5.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
378
364
  };
@@ -19,6 +19,7 @@ var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
19
19
  var _endChat = require("./endChat");
20
20
  var _createAdapter = require("./createAdapter");
21
21
  var _newMessageEventHandler = require("../../../plugins/newMessageEventHandler");
22
+ var _FirstMessageTrackerFromBot = require("../../../firstresponselatency/FirstMessageTrackerFromBot");
22
23
  var _liveChatConfigUtils = require("./liveChatConfigUtils");
23
24
  var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
24
25
  var _persistentChatHelper = require("./persistentChatHelper");
@@ -151,6 +152,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
151
152
  const optionalParams = {
152
153
  isProactiveChat
153
154
  };
155
+ (0, _FirstMessageTrackerFromBot.createTrackingForFirstMessage)();
154
156
  await initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
155
157
  };
156
158
 
@@ -64,7 +64,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
64
64
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
65
65
  let uiTimer;
66
66
  const LiveChatWidgetStateful = props => {
67
- var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
67
+ var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _props$webChatContain17, _props$webChatContain18, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
68
68
  (0, _react2.useEffect)(() => {
69
69
  uiTimer = (0, _utils.createTimer)();
70
70
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -417,7 +417,7 @@ const LiveChatWidgetStateful = props => {
417
417
 
418
418
  // Start chat from SDK Event
419
419
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
420
- var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4, _inMemoryState$appSta5;
420
+ var _props$chatConfig5, _props$chatConfig5$Li, _props$chatConfig6, _props$chatConfig6$Li, _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3;
421
421
  // If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
422
422
  if (typeof (props === null || props === void 0 ? void 0 : (_props$chatConfig5 = props.chatConfig) === null || _props$chatConfig5 === void 0 ? void 0 : (_props$chatConfig5$Li = _props$chatConfig5.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig5$Li === void 0 ? void 0 : _props$chatConfig5$Li.OutOfOperatingHours) === "string" && (props === null || props === void 0 ? void 0 : (_props$chatConfig6 = props.chatConfig) === null || _props$chatConfig6 === void 0 ? void 0 : (_props$chatConfig6$Li = _props$chatConfig6.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig6$Li === void 0 ? void 0 : _props$chatConfig6$Li.OutOfOperatingHours.toLowerCase()) === "true") {
423
423
  (state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
@@ -455,8 +455,14 @@ const LiveChatWidgetStateful = props => {
455
455
  });
456
456
  inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
457
457
 
458
- // Only initiate new chat if widget runtime state is one of the followings
459
- if (((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === _ConversationState.ConversationState.Closed || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === _ConversationState.ConversationState.InActive || ((_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.conversationState) === _ConversationState.ConversationState.Postchat) {
458
+ /*
459
+ * If the conversation is in closed state then we start a new chat,
460
+ * else if the conversation is in active state then we maximize the chat
461
+ * If the conversation is in inactive or postchat state then we maximize the chat.
462
+ *
463
+ * To start a new chat, it needs to be called via the close button or close chat via SDK.
464
+ **/
465
+ if (((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === _ConversationState.ConversationState.Closed) {
460
466
  _omnichannelChatComponents.BroadcastService.postMessage({
461
467
  eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
462
468
  });
@@ -465,7 +471,7 @@ const LiveChatWidgetStateful = props => {
465
471
  }
466
472
 
467
473
  // If minimized, maximize the chat
468
- if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.isMinimized) === true) {
474
+ if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.isMinimized) === true) {
469
475
  var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
470
476
  dispatch({
471
477
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
@@ -593,12 +599,12 @@ const LiveChatWidgetStateful = props => {
593
599
  disablePolling: true
594
600
  });
595
601
  facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onAgentEndSession(event => {
596
- var _inMemoryState$appSta6;
602
+ var _inMemoryState$appSta4;
597
603
  const inMemoryState = (0, _createReducer.executeReducer)(state, {
598
604
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
599
605
  payload: null
600
606
  });
601
- if ("participantsRemoved" in event && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta6 = inMemoryState.appStates) === null || _inMemoryState$appSta6 === void 0 ? void 0 : _inMemoryState$appSta6.conversationState) === _ConversationState.ConversationState.Active) {
607
+ if ("participantsRemoved" in event && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.conversationState) === _ConversationState.ConversationState.Active) {
602
608
  setWebChatStyles(styles => {
603
609
  return {
604
610
  ...styles,
@@ -741,13 +747,13 @@ const LiveChatWidgetStateful = props => {
741
747
 
742
748
  // Handle Chat disconnect cases
743
749
  (0, _react2.useEffect)(() => {
744
- var _inMemoryState$appSta7;
750
+ var _inMemoryState$appSta5;
745
751
  const inMemoryState = (0, _createReducer.executeReducer)(state, {
746
752
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
747
753
  payload: null
748
754
  });
749
755
  (0, _chatDisconnectHelper.handleChatDisconnect)(props, inMemoryState, setWebChatStyles);
750
- const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta7 = inMemoryState.appStates) === null || _inMemoryState$appSta7 === void 0 ? void 0 : _inMemoryState$appSta7.chatDisconnectEventReceived;
756
+ const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta5 = inMemoryState.appStates) === null || _inMemoryState$appSta5 === void 0 ? void 0 : _inMemoryState$appSta5.chatDisconnectEventReceived;
751
757
  if (chatDisconnectState && adapter) {
752
758
  try {
753
759
  adapter.end();
@@ -876,8 +882,8 @@ const LiveChatWidgetStateful = props => {
876
882
  userID: userID,
877
883
  styleOptions: {
878
884
  ...webChatStyles,
879
- bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.adaptiveCardStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background,
880
- bubbleTextColor: ((_props$webChatContain13 = props.webChatContainerProps) === null || _props$webChatContain13 === void 0 ? void 0 : (_props$webChatContain14 = _props$webChatContain13.adaptiveCardStyles) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color
885
+ bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.webChatStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.bubbleBackground) ?? ((_props$webChatContain13 = props.webChatContainerProps) === null || _props$webChatContain13 === void 0 ? void 0 : (_props$webChatContain14 = _props$webChatContain13.adaptiveCardStyles) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.background) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.background,
886
+ bubbleTextColor: ((_props$webChatContain15 = props.webChatContainerProps) === null || _props$webChatContain15 === void 0 ? void 0 : (_props$webChatContain16 = _props$webChatContain15.webChatStyles) === null || _props$webChatContain16 === void 0 ? void 0 : _props$webChatContain16.bubbleTextColor) ?? ((_props$webChatContain17 = props.webChatContainerProps) === null || _props$webChatContain17 === void 0 ? void 0 : (_props$webChatContain18 = _props$webChatContain17.adaptiveCardStyles) === null || _props$webChatContain18 === void 0 ? void 0 : _props$webChatContain18.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color
881
887
  },
882
888
  directLine: directLine
883
889
  }), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
@@ -7,6 +7,7 @@ exports.default = exports.OutOfOfficeHoursPaneStateful = void 0;
7
7
  var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _utils = require("../../common/utils");
10
+ var _dompurify = _interopRequireDefault(require("dompurify"));
10
11
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
11
12
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
12
13
  var _defaultgeneralOOOHPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps");
@@ -37,9 +38,11 @@ const OutOfOfficeHoursPaneStateful = props => {
37
38
 
38
39
  // Move focus to the first button
39
40
  (0, _react.useEffect)(() => {
40
- const firstElement = (0, _utils.findAllFocusableElement)(`#${state.domainStates.widgetElementId}`);
41
- if (firstElement && firstElement[0]) {
42
- firstElement[0].focus();
41
+ if (state.domainStates.widgetElementId !== null && state.domainStates.widgetElementId !== undefined && state.domainStates.widgetElementId.trim() !== "") {
42
+ const firstElement = (0, _utils.findAllFocusableElement)(`#${state.domainStates.widgetElementId}`);
43
+ if (firstElement && firstElement[0]) {
44
+ firstElement[0].focus();
45
+ }
43
46
  }
44
47
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
45
48
  Event: _TelemetryConstants.TelemetryEvent.OutOfOfficePaneLoaded
@@ -49,6 +52,9 @@ const OutOfOfficeHoursPaneStateful = props => {
49
52
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
50
53
  });
51
54
  }, []);
55
+ if (controlProps !== null && controlProps !== void 0 && controlProps.titleText) {
56
+ controlProps.titleText = _dompurify.default.sanitize(controlProps.titleText);
57
+ }
52
58
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.OutOfOfficeHoursPane, {
53
59
  componentOverrides: props.componentOverrides,
54
60
  controlProps: controlProps,
@@ -14,17 +14,19 @@ var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
14
14
  var _defaultgeneralPostChatSurveyPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps");
15
15
  var _utils = require("../../common/utils");
16
16
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
17
+ var _isValidSurveyUrl = _interopRequireDefault(require("./common/isValidSurveyUrl"));
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  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); }
19
20
  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; }
20
21
  const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
21
22
  let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
22
- const surveyLink = `${surveyInviteLink}
23
- &embed=${isEmbed.toString()}
24
- &compact=${compact.toString() ?? "true"}
25
- &lang=${locale ?? "en-us"}
26
- &showmultilingual=${showMultiLingual.toString() ?? "false"}`;
27
- return surveyLink;
23
+ const surveyLinkParams = new URLSearchParams({
24
+ embed: isEmbed.toString(),
25
+ compact: (compact ?? true).toString(),
26
+ lang: locale ?? "en-us",
27
+ showmultilingual: (showMultiLingual ?? false).toString()
28
+ });
29
+ return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
28
30
  };
29
31
  const PostChatSurveyPaneStateful = props => {
30
32
  var _props$styleProps, _state$appStates, _props$controlProps;
@@ -54,6 +56,20 @@ const PostChatSurveyPaneStateful = props => {
54
56
  surveyURL: ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.surveyURL) ?? surveyInviteLink,
55
57
  ...props.controlProps
56
58
  };
59
+ if (controlProps.surveyURL) {
60
+ if (!(0, _isValidSurveyUrl.default)(controlProps.surveyURL)) {
61
+ _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.ERROR, {
62
+ Event: _TelemetryConstants.TelemetryEvent.PostChatSurveyUrlValidationFailed,
63
+ Description: `${controlProps.surveyURL} is not a valid Survey URL`
64
+ });
65
+ controlProps.surveyURL = "";
66
+ } else {
67
+ _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
68
+ Event: _TelemetryConstants.TelemetryEvent.PostChatSurveyUrlValidationCompleted,
69
+ Description: `${controlProps.surveyURL} is a valid Survey URL`
70
+ });
71
+ }
72
+ }
57
73
 
58
74
  // Move focus to the first button
59
75
  (0, _react.useEffect)(() => {
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _utils = require("../../../common/utils");
8
+ const validRootDomains = ["microsoft.com", "microsoft.us", "appsplatform.us", "powervirtualagents.cn"];
9
+ const isValidSurveyUrl = url => {
10
+ if ((0, _utils.isNullOrEmptyString)(url)) {
11
+ return false;
12
+ }
13
+ try {
14
+ const objectUrl = new URL(url);
15
+ if (!objectUrl.origin || objectUrl.origin === "null") {
16
+ return false;
17
+ }
18
+ const validDomain = validRootDomains.find(domain => objectUrl.origin.endsWith(domain));
19
+ if (validDomain) {
20
+ return true;
21
+ }
22
+ } catch (error) {
23
+ return false;
24
+ }
25
+ return false;
26
+ };
27
+ var _default = isValidSurveyUrl;
28
+ exports.default = _default;
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.WebChatContainerStateful = void 0;
7
+ var _Constants = require("../../common/Constants");
7
8
  var _react = require("@fluentui/react");
8
9
  var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
9
10
  var _react2 = _interopRequireWildcard(require("react"));
10
11
  var _utils = require("../../common/utils");
11
12
  var _BotMagicCodeStore = require("./webchatcontroller/BotMagicCodeStore");
12
13
  var _botframeworkWebchat = require("botframework-webchat");
13
- var _Constants = require("../../common/Constants");
14
14
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
15
15
  var _NotificationHandler = require("./webchatcontroller/notification/NotificationHandler");
16
16
  var _NotificationScenarios = require("./webchatcontroller/enums/NotificationScenarios");
@@ -56,7 +56,7 @@ const createMagicCodeSuccessResponse = signin => {
56
56
  };
57
57
  };
58
58
  const WebChatContainerStateful = props => {
59
- 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
+ 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, _webChatContainerProp16, _props$webChatContain9, _props$webChatContain10;
60
60
  (0, _react2.useEffect)(() => {
61
61
  uiTimer = (0, _utils.createTimer)();
62
62
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -241,8 +241,9 @@ const WebChatContainerStateful = props => {
241
241
  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)};
242
242
  }
243
243
 
244
+ // we had a nasty bug long time ago with crashing borders messing with the sendbox, so if customer adds this value, they need to deal with that
244
245
  .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
245
- border-radius: 0 !important; /* Override border-radius */
246
+ border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp16 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp16 === void 0 ? void 0 : _webChatContainerProp16.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
246
247
  }
247
248
 
248
249
  .webchat__stacked-layout_container>div {
@@ -41,6 +41,10 @@ const DeliveredTimestamp = _ref => {
41
41
  return /*#__PURE__*/_react.default.createElement("span", {
42
42
  dir: "ltr"
43
43
  }, (0, _utils.getTimestampHourMinute)(timestamp));
44
+ } else {
45
+ return /*#__PURE__*/_react.default.createElement("span", {
46
+ dir: dir
47
+ }, (0, _utils.getTimestampHourMinute)(timestamp));
44
48
  }
45
49
  return timeString;
46
50
  };
@@ -4,14 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLiveChatWidgetContextInitialState = void 0;
7
- var _ConversationState = require("./ConversationState");
8
- var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
9
- var _utils = require("../../common/utils");
10
- var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
11
7
  var _Constants = require("../../common/Constants");
8
+ var _utils = require("../../common/utils");
9
+ var _ConversationState = require("./ConversationState");
12
10
  var _StartChatFailureType = require("./StartChatFailureType");
11
+ var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
12
+ var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
13
13
  const getLiveChatWidgetContextInitialState = props => {
14
14
  var _props$controlProps, _props$webChatContain;
15
+ const isOutsideOperatingHours = () => {
16
+ var _props$chatConfig, _props$chatConfig$Liv, _props$chatConfig$Liv2;
17
+ return ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : (_props$chatConfig$Liv2 = _props$chatConfig$Liv.OutOfOperatingHours) === null || _props$chatConfig$Liv2 === void 0 ? void 0 : _props$chatConfig$Liv2.toString().toLowerCase()) === "true";
18
+ };
15
19
  const widgetCacheId = (0, _utils.getWidgetCacheIdfromProps)(props);
16
20
  const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.cacheTtlInMins) ?? _Constants.Constants.CacheTtlInMinutes;
17
21
  const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? _Constants.StorageType.sessionStorage : _Constants.StorageType.localStorage;
@@ -28,6 +32,14 @@ const getLiveChatWidgetContextInitialState = props => {
28
32
  if (initialStateFromCache.appStates.conversationState === _ConversationState.ConversationState.Prechat) {
29
33
  initialStateFromCache.appStates.conversationState = _ConversationState.ConversationState.Closed;
30
34
  }
35
+
36
+ // we are always setting the chatConfig from the props to avoid any issues with the cache
37
+ initialStateFromCache.domainStates.liveChatConfig = props.chatConfig;
38
+
39
+ // Cache the result of isOutsideOperatingHours() to ensure consistency
40
+ const outsideOperatingHours = isOutsideOperatingHours();
41
+ initialStateFromCache.appStates.outsideOperatingHours = outsideOperatingHours;
42
+ initialStateFromCache.appStates.conversationState = outsideOperatingHours ? _ConversationState.ConversationState.OutOfOffice : initialStateFromCache.appStates.conversationState;
31
43
  return initialStateFromCache;
32
44
  }
33
45
  const LiveChatWidgetContextInitialState = {
@@ -52,11 +64,11 @@ const getLiveChatWidgetContextInitialState = props => {
52
64
  startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic
53
65
  },
54
66
  appStates: {
55
- conversationState: _ConversationState.ConversationState.Closed,
67
+ conversationState: isOutsideOperatingHours() ? _ConversationState.ConversationState.OutOfOffice : _ConversationState.ConversationState.Closed,
56
68
  isMinimized: undefined,
57
69
  previousElementIdOnFocusBeforeModalOpen: null,
58
70
  startChatFailed: false,
59
- outsideOperatingHours: false,
71
+ outsideOperatingHours: isOutsideOperatingHours(),
60
72
  preChatResponseEmail: "",
61
73
  isAudioMuted: null,
62
74
  newMessage: false,
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ScenarioType = void 0;
7
+ let ScenarioType;
8
+ exports.ScenarioType = ScenarioType;
9
+ (function (ScenarioType) {
10
+ ScenarioType["UserSendMessageStrategy"] = "UserSendMessageStrategy";
11
+ ScenarioType["SystemMessageStrategy"] = "SystemMessageStrategy";
12
+ ScenarioType["ReceivedMessageStrategy"] = "ReceivedMessageStrategy";
13
+ })(ScenarioType || (exports.ScenarioType = ScenarioType = {}));