@copart/ops-tool-kit 1.12.11 → 1.12.12-beta.1

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.
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$r = "@copart/ops-tool-kit";
50
- const version$8 = "1.12.11";
50
+ const version$8 = "1.12.12-beta.1";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -2855,10 +2855,10 @@ var BreadcrumbsProvider = /*#__PURE__*/function (_React$Component) {
2855
2855
  }(React__namespace.Component);
2856
2856
 
2857
2857
  var _class;
2858
- var _excluded$4 = ["breadcrumbs"];
2858
+ var _excluded$5 = ["breadcrumbs"];
2859
2859
  var getCrumbProps = function getCrumbProps(props) {
2860
2860
  props.breadcrumbs;
2861
- var crumbProps = _objectWithoutProperties(props, _excluded$4);
2861
+ var crumbProps = _objectWithoutProperties(props, _excluded$5);
2862
2862
  return crumbProps;
2863
2863
  };
2864
2864
  var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
@@ -23566,7 +23566,7 @@ var RoleSelector$2 = function RoleSelector(_ref) {
23566
23566
  }));
23567
23567
  };
23568
23568
 
23569
- var _excluded$3 = ["selectedYard", "name", "handleChange", "yardOptions", "label"];
23569
+ var _excluded$4 = ["selectedYard", "name", "handleChange", "yardOptions", "label"];
23570
23570
  var getDescription = function getDescription(yardOptions) {
23571
23571
  return function (code) {
23572
23572
  return yardOptions[code].yard_number;
@@ -23582,7 +23582,7 @@ var YardNumberMenu$2 = function YardNumberMenu(_ref) {
23582
23582
  handleChange = _ref.handleChange,
23583
23583
  yardOptions = _ref.yardOptions,
23584
23584
  label = _ref.label,
23585
- otherProps = _objectWithoutProperties(_ref, _excluded$3);
23585
+ otherProps = _objectWithoutProperties(_ref, _excluded$4);
23586
23586
  return /*#__PURE__*/React__default["default"].createElement("div", {
23587
23587
  className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
23588
23588
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
@@ -24526,14 +24526,14 @@ var HierarchyMenu = function HierarchyMenu(props) {
24526
24526
  });
24527
24527
  };
24528
24528
 
24529
- var _excluded$2 = ["value", "handleChange", "yardOptions", "label", "disabled"];
24529
+ var _excluded$3 = ["value", "handleChange", "yardOptions", "label", "disabled"];
24530
24530
  var YardNumberMenu$1 = function YardNumberMenu(_ref) {
24531
24531
  var value = _ref.value,
24532
24532
  handleChange = _ref.handleChange,
24533
24533
  yardOptions = _ref.yardOptions;
24534
24534
  _ref.label;
24535
24535
  var disabled = _ref.disabled,
24536
- otherProps = _objectWithoutProperties(_ref, _excluded$2);
24536
+ otherProps = _objectWithoutProperties(_ref, _excluded$3);
24537
24537
  return /*#__PURE__*/React__default["default"].createElement("div", {
24538
24538
  className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
24539
24539
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
@@ -32160,7 +32160,7 @@ var useWindowSize = function useWindowSize() {
32160
32160
  return windowSize;
32161
32161
  };
32162
32162
 
32163
- var _excluded$1 = ["count", "current", "showNavButtons", "onLeftButtonClick", "onRightButtonClick", "saveActionComponentState", "ActionComponent", "notificationsTopContainerRef", "mobileNotificationsTopContainerRef", "setNotificationHeightFlag"];
32163
+ var _excluded$2 = ["count", "current", "showNavButtons", "onLeftButtonClick", "onRightButtonClick", "saveActionComponentState", "ActionComponent", "notificationsTopContainerRef", "mobileNotificationsTopContainerRef", "setNotificationHeightFlag"];
32164
32164
  var alertBackgroundColorMapping = {
32165
32165
  alert: '#fab9b9',
32166
32166
  warning: '#f5f5cb',
@@ -32229,7 +32229,7 @@ var Banner = function Banner(props) {
32229
32229
  notificationsTopContainerRef = props.notificationsTopContainerRef,
32230
32230
  mobileNotificationsTopContainerRef = props.mobileNotificationsTopContainerRef,
32231
32231
  setNotificationHeightFlag = props.setNotificationHeightFlag,
32232
- notification = _objectWithoutProperties(props, _excluded$1);
32232
+ notification = _objectWithoutProperties(props, _excluded$2);
32233
32233
  var dismissibleFlag = notification.dismissibleFlag,
32234
32234
  onDismiss = notification.onDismiss,
32235
32235
  startsAt = notification.startsAt,
@@ -32728,7 +32728,8 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
32728
32728
  props.setSettingsVisible;
32729
32729
  var handleIconClick = props.handleIconClick,
32730
32730
  ideaNoteVisible = props.ideaNoteVisible,
32731
- mobileMenuVisible = props.mobileMenuVisible;
32731
+ mobileMenuVisible = props.mobileMenuVisible,
32732
+ chatBotVisible = props.chatBotVisible;
32732
32733
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
32733
32734
  var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
32734
32735
  showSettingsMenuByTileConfig = coreAppConfig.showSettingsMenuByTileConfig,
@@ -33009,6 +33010,23 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
33009
33010
  mobileMenuVisible: mobileMenuVisible
33010
33011
  });
33011
33012
  }
33013
+ }, {
33014
+ key: 'chatBot',
33015
+ name: 'ChatBot',
33016
+ renderIf: true,
33017
+ render: function render() {
33018
+ return /*#__PURE__*/React__default["default"].createElement("div", {
33019
+ className: "utilities_ops-app-frame_AppBarComponent_AppBar--flex-grid-items",
33020
+ onClick: function onClick() {
33021
+ return handleIconClick(ICONS.CHATBOT);
33022
+ }
33023
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
33024
+ name: "comment-sparkle-custom",
33025
+ variant: "light"
33026
+ }), chatBotVisible && /*#__PURE__*/React__default["default"].createElement("div", {
33027
+ className: "utilities_ops-app-frame_AppBarComponent_AppBar--arrowTipContainer"
33028
+ }));
33029
+ }
33012
33030
  },
33013
33031
  // {
33014
33032
  // key: 'phoneStatus',
@@ -33132,7 +33150,8 @@ var ICONS = {
33132
33150
  IDEANOTE: 'IDEANOTE',
33133
33151
  SETTINGS: 'SETTINGS',
33134
33152
  MIHELP: 'MIHELP',
33135
- MOBILE_MENU: 'MOBILE_MENU'
33153
+ MOBILE_MENU: 'MOBILE_MENU',
33154
+ CHATBOT: 'CHATBOT'
33136
33155
  };
33137
33156
  var AppBar$1 = function AppBar(props) {
33138
33157
  var _window$toolkitEnv4;
@@ -33206,7 +33225,9 @@ var AppBar$1 = function AppBar(props) {
33206
33225
  setIsNavBarOpen = props.setIsNavBarOpen,
33207
33226
  availableStatuses = props.availableStatuses,
33208
33227
  currentUserStatus = props.currentUserStatus,
33209
- onUserStatusUpdate = props.onUserStatusUpdate;
33228
+ onUserStatusUpdate = props.onUserStatusUpdate,
33229
+ chatBotVisible = props.chatBotVisible,
33230
+ setChatBotVisible = props.setChatBotVisible;
33210
33231
  var _useWindowSize = useWindowSize(),
33211
33232
  width = _useWindowSize.width;
33212
33233
  _useWindowSize.height;
@@ -33293,6 +33314,16 @@ var AppBar$1 = function AppBar(props) {
33293
33314
  }, [ideaNoteVisible]);
33294
33315
  var handleIconClick = function handleIconClick(icon) {
33295
33316
  switch (icon) {
33317
+ case ICONS.CHATBOT:
33318
+ setChatBotVisible(function (chatBotVisible) {
33319
+ return !chatBotVisible;
33320
+ });
33321
+ setNotificationsVisible(false);
33322
+ setIdeaNoteVisible(false);
33323
+ setSettingsVisible(false);
33324
+ setMihelpVisible(false);
33325
+ setMobileMenuVisible(false);
33326
+ break;
33296
33327
  case ICONS.SEARCH:
33297
33328
  setShowSearchContainer(function (showSearchContainer) {
33298
33329
  return !showSearchContainer;
@@ -33505,7 +33536,8 @@ var AppBar$1 = function AppBar(props) {
33505
33536
  setSettingsVisible: setSettingsVisible,
33506
33537
  handleIconClick: handleIconClick,
33507
33538
  ideaNoteVisible: ideaNoteVisible,
33508
- mobileMenuVisible: mobileMenuVisible
33539
+ mobileMenuVisible: mobileMenuVisible,
33540
+ chatBotVisible: chatBotVisible
33509
33541
  })),
33510
33542
  overflowSetStyles: overflowSetStyles,
33511
33543
  overflowIcon: "CollapseMenu",
@@ -36014,7 +36046,10 @@ var AppBar = function AppBar(_ref) {
36014
36046
  ActionComponent = _ref.ActionComponent,
36015
36047
  searchComponent = _ref.searchComponent,
36016
36048
  showNavIconInHeader = _ref.showNavIconInHeader,
36017
- setIsNavBarOpen = _ref.setIsNavBarOpen;
36049
+ setIsNavBarOpen = _ref.setIsNavBarOpen,
36050
+ setChatBotVisible = _ref.setChatBotVisible,
36051
+ chatBotVisible = _ref.chatBotVisible,
36052
+ onNotificationsAndHeightChange = _ref.onNotificationsAndHeightChange;
36018
36053
  SETTINGS_ITEMS[0].name = storage$1.userName;
36019
36054
 
36020
36055
  // Escape hatch for forceUpdate function
@@ -36611,6 +36646,15 @@ var AppBar = function AppBar(_ref) {
36611
36646
  clearInterval(expireNotificationsInterval);
36612
36647
  };
36613
36648
  }, [notifications]);
36649
+ React.useEffect(function () {
36650
+ if (onNotificationsAndHeightChange) {
36651
+ var _notificationsTopCont, _mobileNotificationsT;
36652
+ // Calculate sideBarTopValue on-the-fly based on notification container heights
36653
+ // Default to 48 (base header height) if refs aren't ready yet
36654
+ var calculatedHeight = notificationsTopContainerRef !== null && notificationsTopContainerRef !== void 0 && (_notificationsTopCont = notificationsTopContainerRef.current) !== null && _notificationsTopCont !== void 0 && _notificationsTopCont.offsetHeight ? notificationsTopContainerRef.current.offsetHeight + 48 : mobileNotificationsTopContainerRef !== null && mobileNotificationsTopContainerRef !== void 0 && (_mobileNotificationsT = mobileNotificationsTopContainerRef.current) !== null && _mobileNotificationsT !== void 0 && _mobileNotificationsT.offsetHeight ? mobileNotificationsTopContainerRef.current.offsetHeight + 48 : 48;
36655
+ onNotificationsAndHeightChange(notifications.length, calculatedHeight);
36656
+ }
36657
+ }, [notifications, notificationHeightFlag, onNotificationsAndHeightChange]);
36614
36658
  var STACK = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
36615
36659
  STACK = STACK || 'c';
36616
36660
  var modifiedSettings = SETTINGS_ITEMS;
@@ -36674,7 +36718,9 @@ var AppBar = function AppBar(_ref) {
36674
36718
  setIsNavBarOpen: setIsNavBarOpen,
36675
36719
  availableStatuses: availableStatuses,
36676
36720
  currentUserStatus: currentUserStatus,
36677
- onUserStatusUpdate: handleUserStatusUpdate
36721
+ onUserStatusUpdate: handleUserStatusUpdate,
36722
+ chatBotVisible: chatBotVisible,
36723
+ setChatBotVisible: setChatBotVisible
36678
36724
  }), latestRelease && /*#__PURE__*/React__default["default"].createElement(LatestReleaseDialog, {
36679
36725
  release: latestRelease,
36680
36726
  handleClose: handleReleaseClose,
@@ -57946,13 +57992,769 @@ var purify$2 = createCommonjsModule(function (module, exports) {
57946
57992
  });
57947
57993
  });
57948
57994
 
57949
- var css_248z$3 = ".utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper {\r\n position: absolute;\r\n /* right: 50px;\r\n bottom: 30px; */\r\n z-index: 9999;\r\n height: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0px;\r\n background: #1d5ab9;\r\n border-radius: 50%;\r\n width: 60px;\r\n height: 60px;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n border: 5px solid #fff;\r\n box-shadow: 0 0px 6px #c1c1c1;\r\n cursor: pointer;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n position: absolute;\r\n /* right: 0;\r\n bottom: 68px; */\r\n box-shadow: 0 0px 6px #c1c1c1;\r\n height: 600px;\r\n width: 500px;\r\n border-radius: 8px;\r\n overflow: hidden;\r\n display: flex;\r\n flex-direction: column;\r\n background: #fff;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner{\r\n position: absolute;\r\n background: rgba(0, 0, 0, 0.5);\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n right: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader {\r\n background: #1d5ab9;\r\n display: flex;\r\n justify-content: space-between;\r\n padding: 15px;\r\n align-items: center;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--title {\r\n font-size: 16px;\r\n font-weight: 600;\r\n line-height: 22px;\r\n color: #fff;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody {\r\n flex: 1;\r\n padding: 12px 36px;\r\n overflow: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatVisible {\r\n padding-top: 56px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer {\r\n padding: 8px 0;\r\n border-bottom: 1px solid #d1d1d1;\r\n display: flex;\r\n justify-content: end;\r\n align-items: center;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatVisible .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer {\r\n position: absolute;\r\n width: calc(100% - 72px);\r\n top: 57px;\r\n background: #fff;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messagesContainer {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n grid-gap: 16px;\r\n gap: 16px;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton {\r\n display: flex;\r\n align-items: center;\r\n grid-gap: 6px;\r\n gap: 6px;\r\n cursor: pointer;\r\n border: 1px solid #d1d1d1;\r\n border-radius: 4px;\r\n padding: 6px 12px;\r\n font-weight: 600;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message {\r\n display: flex;\r\n align-items: flex-start;\r\n grid-gap: 10px;\r\n gap: 10px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--user {\r\n justify-content: flex-end;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--welcomeQuestion {\r\n margin-top: 5px;\r\n margin-left: 36px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions {\r\n display: flex;\r\n flex-direction: column;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionWrapper {\r\n display: flex;\r\n flex-direction: row-reverse;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionContainer {\r\n max-width: 95%;\r\n word-break: break-all;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestion {\r\n border: 1px solid #3261bd;\r\n border-radius: 16px;\r\n padding: 6px 8px;\r\n font-size: 14px;\r\n color: #3261bd;\r\n cursor: pointer;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--agentIcon {\r\n width: 26px;\r\n border-radius: 50%;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble {\r\n background-color: #f5f5f5;\r\n border-radius: 0px 12px 12px 12px;\r\n padding: 10px 15px;\r\n max-width: 85%;\r\n font-size: 14px;\r\n line-height: 1.5;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--error {\r\n border: 1px solid #f1bbbc;\r\n background: #fdf6f6;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--user .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble {\r\n background: #3261bd;\r\n color: #fff;\r\n border-radius: 12px 0px 12px 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--feedbackContainer {\r\n display: flex;\r\n grid-gap: 8px;\r\n gap: 8px;\r\n margin-top: 10px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--feedbackContainer i {\r\n cursor: pointer;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p {\r\n margin: 0;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p a {\r\n color: #1e54ad;\r\n text-decoration: underline;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p ol,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p ul {\r\n padding-left: 15px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowFooter {\r\n border-top: 1px solid #d1d1d1;\r\n padding: 16px 24px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer {\r\n display: flex;\r\n align-items: center;\r\n border: 1px solid #ddd;\r\n border-radius: 12px;\r\n padding: 10px 15px;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--disabled {\r\n background-color: #fafafa;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input {\r\n border: none;\r\n outline: none;\r\n flex-grow: 1;\r\n font-size: 14px !important;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-webkit-input-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-moz-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-ms-input-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::placeholder {\r\n color: #757575;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n padding: 10px;\r\n width: 75px;\r\n background-color: #f5f5f5;\r\n border-radius: 0px 12px 12px 12px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot {\r\n width: 8px;\r\n height: 8px;\r\n margin: 0 3px;\r\n background-color: #3261bd;\r\n border-radius: 50%;\r\n display: inline-block;\r\n -webkit-animation: utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce 1.2s infinite ease-in-out both;\r\n animation: utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce 1.2s infinite ease-in-out both;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot:nth-child(1) {\r\n -webkit-animation-delay: -0.32s;\r\n animation-delay: -0.32s;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot:nth-child(2) {\r\n -webkit-animation-delay: -0.16s;\r\n animation-delay: -0.16s;\r\n}\r\n\r\n@-webkit-keyframes utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce {\r\n 0%,\r\n 80%,\r\n 100% {\r\n -webkit-transform: scale(0);\r\n transform: scale(0);\r\n }\r\n 40% {\r\n -webkit-transform: scale(1);\r\n transform: scale(1);\r\n }\r\n}\r\n\r\n@keyframes utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce {\r\n 0%,\r\n 80%,\r\n 100% {\r\n -webkit-transform: scale(0);\r\n transform: scale(0);\r\n }\r\n 40% {\r\n -webkit-transform: scale(1);\r\n transform: scale(1);\r\n }\r\n}\r\n\r\n@media (max-width: 575px) {\r\n /* .mihelpAgentWrapper {\r\n right: 20px;\r\n bottom: 100px;\r\n } */\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--iphoneChrome {\r\n bottom: 125px;\r\n }\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 450px;\r\n }\r\n}\r\n\r\n@media (max-width: 475px) {\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 400px;\r\n }\r\n}\r\n\r\n@media (max-width: 425px) {\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 350px;\r\n }\r\n}\r\n\r\n@media (max-width: 375px) {\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 325px;\r\n }\r\n}\r\n\r\n@media (max-width: 350px) {\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 300px;\r\n }\r\n}\r\n\r\n@media (max-width: 325px) {\r\n .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n width: 275px;\r\n }\r\n}\r\n";
57995
+ var _excluded$1 = ["options"];
57996
+ var FLOW_COMPONENTS = {
57997
+ Input: coreComponents.Input,
57998
+ DatePicker: coreComponents.DatePicker,
57999
+ TimeField: coreComponents.TimeField,
58000
+ Select: coreComponents.Select,
58001
+ ChoiceGroup: coreComponents.ChoiceGroup,
58002
+ Checkbox: coreComponents.Checkbox
58003
+ };
58004
+ var getComponent = function getComponent(name) {
58005
+ return FLOW_COMPONENTS[name] || null;
58006
+ };
58007
+ var componentAdapters = {
58008
+ Input: function Input(stepData, flowData, handlers) {
58009
+ var _stepData$props;
58010
+ return _objectSpread2({
58011
+ // Only use label from props, not from heading (heading is displayed separately)
58012
+ label: ((_stepData$props = stepData.props) === null || _stepData$props === void 0 ? void 0 : _stepData$props.label) || '',
58013
+ value: flowData[stepData.id] || '',
58014
+ onChange: function onChange(e, value) {
58015
+ var _e$target;
58016
+ var inputValue = (e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) != null ? e.target.value : value != null ? value : e;
58017
+ handlers.updateValue(stepData.id, inputValue);
58018
+ },
58019
+ error: handlers.getError(stepData.id)
58020
+ }, stepData.props);
58021
+ },
58022
+ DatePicker: function DatePicker(stepData, flowData, handlers) {
58023
+ var _stepData$validation, _stepData$props2;
58024
+ // Check if this step has been attempted (to conditionally show required validation)
58025
+ // We'll need to pass a function to check this, but for now, don't pass required initially
58026
+ // The validation will be handled by our own error display after attempt
58027
+ var hasRequired = (_stepData$validation = stepData.validation) === null || _stepData$validation === void 0 ? void 0 : _stepData$validation.some(function (r) {
58028
+ return r.type === 'required';
58029
+ });
58030
+ var error = handlers.getError(stepData.id);
58031
+ return _objectSpread2({
58032
+ // Only use label from props, not from heading (heading is displayed separately)
58033
+ label: ((_stepData$props2 = stepData.props) === null || _stepData$props2 === void 0 ? void 0 : _stepData$props2.label) || '',
58034
+ value: flowData[stepData.id] || null,
58035
+ onChange: function onChange(date) {
58036
+ return handlers.updateValue(stepData.id, date);
58037
+ },
58038
+ onError: function onError(error) {
58039
+ return handlers.setError(stepData.id, (error === null || error === void 0 ? void 0 : error.message) || error);
58040
+ },
58041
+ // Only show required validation after user has attempted to submit
58042
+ // Pass required only if there's already an error (meaning it was attempted)
58043
+ required: hasRequired && error ? true : false
58044
+ }, stepData.props);
58045
+ },
58046
+ TimeField: function TimeField(stepData, flowData, handlers) {
58047
+ var _stepData$props3;
58048
+ return _objectSpread2({
58049
+ // Only use label from props, not from heading (heading is displayed separately)
58050
+ label: ((_stepData$props3 = stepData.props) === null || _stepData$props3 === void 0 ? void 0 : _stepData$props3.label) || '',
58051
+ value: flowData[stepData.id] || '',
58052
+ onChange: function onChange(e, value) {
58053
+ var _e$target2;
58054
+ var timeValue = value != null ? value : (e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value) != null ? e.target.value : e;
58055
+ handlers.updateValue(stepData.id, timeValue);
58056
+ },
58057
+ error: handlers.getError(stepData.id)
58058
+ }, stepData.props);
58059
+ },
58060
+ Select: function Select(stepData, flowData, handlers) {
58061
+ var _stepData$props4;
58062
+ // Extract options and other props separately to avoid overriding mapped options
58063
+ var _ref = stepData.props || {},
58064
+ rawOptions = _ref.options,
58065
+ otherProps = _objectWithoutProperties(_ref, _excluded$1);
58066
+ var mappedOptions = (rawOptions || []).map(function (opt) {
58067
+ return {
58068
+ key: String(opt.value),
58069
+ text: opt.label || opt.text || String(opt.value)
58070
+ };
58071
+ });
58072
+ return _objectSpread2({
58073
+ // Only use label from props, not from heading (heading is displayed separately)
58074
+ label: ((_stepData$props4 = stepData.props) === null || _stepData$props4 === void 0 ? void 0 : _stepData$props4.label) || '',
58075
+ selectedOption: flowData[stepData.id] || undefined,
58076
+ options: mappedOptions,
58077
+ onChange: function onChange(e, option) {
58078
+ var _option$data;
58079
+ handlers.updateValue(stepData.id, option === null || option === void 0 ? void 0 : option.key);
58080
+ // Auto-navigate if nextStepId exists in option
58081
+ if (option !== null && option !== void 0 && (_option$data = option.data) !== null && _option$data !== void 0 && _option$data.nextStepId) {
58082
+ handlers.goToStep(option.data.nextStepId);
58083
+ }
58084
+ }
58085
+ }, otherProps);
58086
+ },
58087
+ ChoiceGroup: function ChoiceGroup(stepData, flowData, handlers) {
58088
+ var _stepData$props5, _stepData$props6;
58089
+ return _objectSpread2({
58090
+ // Only use label from props, not from heading (heading is displayed separately)
58091
+ label: ((_stepData$props5 = stepData.props) === null || _stepData$props5 === void 0 ? void 0 : _stepData$props5.label) || '',
58092
+ selected: flowData[stepData.id] || undefined,
58093
+ options: (stepData.options || []).map(function (opt) {
58094
+ return {
58095
+ key: String(opt.value),
58096
+ text: opt.label || String(opt.value)
58097
+ };
58098
+ }),
58099
+ onChange: function onChange(e, option) {
58100
+ var _stepData$options;
58101
+ handlers.updateValue(stepData.id, option === null || option === void 0 ? void 0 : option.key);
58102
+ // Auto-navigate if nextStepId exists in option
58103
+ var originalOption = (_stepData$options = stepData.options) === null || _stepData$options === void 0 ? void 0 : _stepData$options.find(function (o) {
58104
+ return String(o.value) === (option === null || option === void 0 ? void 0 : option.key);
58105
+ });
58106
+ if (originalOption !== null && originalOption !== void 0 && originalOption.nextStepId) {
58107
+ handlers.goToStep(originalOption.nextStepId);
58108
+ }
58109
+ },
58110
+ horizontalLayout: ((_stepData$props6 = stepData.props) === null || _stepData$props6 === void 0 ? void 0 : _stepData$props6.horizontalLayout) || false
58111
+ }, stepData.props);
58112
+ },
58113
+ Checkbox: function Checkbox(stepData, flowData, handlers) {
58114
+ var _stepData$props7;
58115
+ return _objectSpread2({
58116
+ // Only use label from props, not from heading (heading is displayed separately)
58117
+ label: ((_stepData$props7 = stepData.props) === null || _stepData$props7 === void 0 ? void 0 : _stepData$props7.label) || '',
58118
+ checked: Boolean(flowData[stepData.id]),
58119
+ onChange: function onChange(e, checked) {
58120
+ return handlers.updateValue(stepData.id, checked);
58121
+ }
58122
+ }, stepData.props);
58123
+ }
58124
+ };
58125
+ var getPropAdapter = function getPropAdapter(componentName) {
58126
+ return componentAdapters[componentName] || null;
58127
+ };
58128
+ var valueFormatters = {
58129
+ DatePicker: function DatePicker(date, stepData) {
58130
+ if (!date) return '';
58131
+ if (date instanceof Date) {
58132
+ return date.toLocaleDateString('en-US', {
58133
+ year: 'numeric',
58134
+ month: 'long',
58135
+ day: 'numeric'
58136
+ });
58137
+ }
58138
+ return String(date);
58139
+ },
58140
+ TimeField: function TimeField(time) {
58141
+ if (!time) return '';
58142
+ return typeof time === 'string' ? time : String(time);
58143
+ },
58144
+ Select: function Select(key, stepData) {
58145
+ var _stepData$props8, _stepData$props8$opti;
58146
+ if (!key) return '';
58147
+ var option = (_stepData$props8 = stepData.props) === null || _stepData$props8 === void 0 ? void 0 : (_stepData$props8$opti = _stepData$props8.options) === null || _stepData$props8$opti === void 0 ? void 0 : _stepData$props8$opti.find(function (opt) {
58148
+ return String(opt.value) === String(key);
58149
+ });
58150
+ return (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.text) || String(key);
58151
+ },
58152
+ ChoiceGroup: function ChoiceGroup(key, stepData) {
58153
+ var _stepData$options2;
58154
+ if (!key) return '';
58155
+ var option = (_stepData$options2 = stepData.options) === null || _stepData$options2 === void 0 ? void 0 : _stepData$options2.find(function (opt) {
58156
+ return String(opt.value) === String(key);
58157
+ });
58158
+ return (option === null || option === void 0 ? void 0 : option.label) || String(key);
58159
+ },
58160
+ Input: function Input(value) {
58161
+ return String(value || '');
58162
+ },
58163
+ Checkbox: function Checkbox(value, stepData) {
58164
+ // Handle multiple checkboxes (array) or single checkbox (boolean)
58165
+ if (Array.isArray(value)) {
58166
+ if (stepData !== null && stepData !== void 0 && stepData.checkboxOptions && Array.isArray(stepData.checkboxOptions)) {
58167
+ // Map selected values to their labels
58168
+ return value.map(function (v) {
58169
+ var option = stepData.checkboxOptions.find(function (opt) {
58170
+ return String(opt.value || opt.id) === String(v);
58171
+ });
58172
+ return (option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.text) || String(v);
58173
+ }).join(', ');
58174
+ }
58175
+ return value.join(', ');
58176
+ }
58177
+ return value ? 'yes' : 'no';
58178
+ }
58179
+ };
58180
+ var getValueFormatter = function getValueFormatter(componentName) {
58181
+ return valueFormatters[componentName] || function (v) {
58182
+ return String(v || '');
58183
+ };
58184
+ };
58185
+
58186
+ var validateFlowConfig = function validateFlowConfig(flowConfig) {
58187
+ var errors = [];
58188
+ var stepIds = new Set();
58189
+
58190
+ // Validate step IDs are unique
58191
+ flowConfig.steps.forEach(function (step) {
58192
+ if (stepIds.has(step.id)) {
58193
+ errors.push("Duplicate step ID: \"".concat(step.id, "\""));
58194
+ }
58195
+ stepIds.add(step.id);
58196
+ });
58197
+
58198
+ // Validate step references
58199
+ flowConfig.steps.forEach(function (step) {
58200
+ if (step.nextStepId && !stepIds.has(step.nextStepId)) {
58201
+ errors.push("Step \"".concat(step.id, "\" references non-existent step \"").concat(step.nextStepId, "\""));
58202
+ }
58203
+ });
58204
+
58205
+ // Validate component names
58206
+ flowConfig.steps.forEach(function (step) {
58207
+ if (step.component && !getComponent(step.component)) {
58208
+ errors.push("Step \"".concat(step.id, "\" uses unknown component \"").concat(step.component, "\""));
58209
+ }
58210
+ });
58211
+ return errors;
58212
+ };
58213
+ var isLastStep = function isLastStep(currentStep, steps) {
58214
+ return !currentStep.nextStepId || !steps.find(function (s) {
58215
+ return s.id === currentStep.nextStepId;
58216
+ });
58217
+ };
58218
+ var validateStep = function validateStep(step, value) {
58219
+ var errors = [];
58220
+ if (!step.validation) return errors;
58221
+ step.validation.forEach(function (rule) {
58222
+ if (rule.type === 'required') {
58223
+ // For single checkbox, required means it must be true
58224
+ // For multiple checkboxes (checkboxOptions), required means at least one must be selected
58225
+ if (step.component === 'Checkbox') {
58226
+ if (step.checkboxOptions && Array.isArray(step.checkboxOptions)) {
58227
+ // Multiple checkboxes - check if array has at least one item
58228
+ if (!Array.isArray(value) || value.length === 0) {
58229
+ errors.push(rule.message || 'Please select at least one option');
58230
+ }
58231
+ } else {
58232
+ // Single checkbox - must be true
58233
+ if (value !== true) {
58234
+ errors.push(rule.message || 'This field is required');
58235
+ }
58236
+ }
58237
+ } else {
58238
+ if (value === null || value === undefined || value === '') {
58239
+ errors.push(rule.message || 'This field is required');
58240
+ }
58241
+ }
58242
+ } else if (rule.type === 'minLength' && typeof value === 'string') {
58243
+ if (value.length < rule.value) {
58244
+ errors.push(rule.message || "Minimum length is ".concat(rule.value));
58245
+ }
58246
+ } else if (rule.type === 'pattern' && rule.value instanceof RegExp) {
58247
+ if (!rule.value.test(String(value))) {
58248
+ errors.push(rule.message || 'Invalid format');
58249
+ }
58250
+ }
58251
+ });
58252
+ return errors;
58253
+ };
58254
+ var formatAnswer = function formatAnswer(template, flowData, steps) {
58255
+ if (!template) return null;
58256
+ return template.replace(/\$\{([^}]+)\}/g, function (match, stepId) {
58257
+ var step = steps.find(function (s) {
58258
+ return s.id === stepId;
58259
+ });
58260
+ if (!step) return match; // Keep placeholder if step not found
58261
+
58262
+ var value = flowData[stepId];
58263
+ if (value === null || value === undefined) return '';
58264
+ var formatter = getValueFormatter(step.component || 'Input');
58265
+ return formatter(value, step);
58266
+ });
58267
+ };
58268
+ var useGuidedFlow = function useGuidedFlow(flowConfig) {
58269
+ var _errors$currentStep$i;
58270
+ var _useState = React.useState(0),
58271
+ _useState2 = _slicedToArray(_useState, 2),
58272
+ currentStepIndex = _useState2[0],
58273
+ setCurrentStepIndex = _useState2[1];
58274
+ var _useState3 = React.useState({}),
58275
+ _useState4 = _slicedToArray(_useState3, 2),
58276
+ flowData = _useState4[0],
58277
+ setFlowData = _useState4[1];
58278
+ var _useState5 = React.useState({}),
58279
+ _useState6 = _slicedToArray(_useState5, 2),
58280
+ errors = _useState6[0],
58281
+ setErrors = _useState6[1];
58282
+ var _useState7 = React.useState([]),
58283
+ _useState8 = _slicedToArray(_useState7, 2),
58284
+ configErrors = _useState8[0],
58285
+ setConfigErrors = _useState8[1];
58286
+ // Track if the last step was explicitly submitted - must be before early return
58287
+ var _useState9 = React.useState(false),
58288
+ _useState0 = _slicedToArray(_useState9, 2),
58289
+ lastStepSubmitted = _useState0[0],
58290
+ setLastStepSubmitted = _useState0[1];
58291
+ // Track which steps have been attempted (to show errors only after attempt)
58292
+ var _useState1 = React.useState(new Set()),
58293
+ _useState10 = _slicedToArray(_useState1, 2),
58294
+ attemptedSteps = _useState10[0],
58295
+ setAttemptedSteps = _useState10[1];
58296
+
58297
+ // Validate config on mount
58298
+ React.useEffect(function () {
58299
+ if (flowConfig) {
58300
+ var validationErrors = validateFlowConfig(flowConfig);
58301
+ setConfigErrors(validationErrors);
58302
+ }
58303
+ }, [flowConfig]);
58304
+ if (!flowConfig || !flowConfig.steps || flowConfig.steps.length === 0) {
58305
+ return {
58306
+ currentStep: null,
58307
+ flowData: {},
58308
+ errors: {},
58309
+ isComplete: false,
58310
+ configErrors: ['Invalid flow configuration'],
58311
+ updateValue: function updateValue() {},
58312
+ setError: function setError() {},
58313
+ getError: function getError() {
58314
+ return undefined;
58315
+ },
58316
+ goToNextStep: function () {
58317
+ var _goToNextStep = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee() {
58318
+ return _regenerator().w(function (_context) {
58319
+ while (1) switch (_context.n) {
58320
+ case 0:
58321
+ return _context.a(2, false);
58322
+ }
58323
+ }, _callee);
58324
+ }));
58325
+ function goToNextStep() {
58326
+ return _goToNextStep.apply(this, arguments);
58327
+ }
58328
+ return goToNextStep;
58329
+ }(),
58330
+ goToStep: function goToStep() {},
58331
+ submitStep: function () {
58332
+ var _submitStep = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
58333
+ return _regenerator().w(function (_context2) {
58334
+ while (1) switch (_context2.n) {
58335
+ case 0:
58336
+ return _context2.a(2, false);
58337
+ }
58338
+ }, _callee2);
58339
+ }));
58340
+ function submitStep() {
58341
+ return _submitStep.apply(this, arguments);
58342
+ }
58343
+ return submitStep;
58344
+ }(),
58345
+ resetFlow: function resetFlow() {},
58346
+ formatAnswer: function formatAnswer() {
58347
+ return null;
58348
+ },
58349
+ validateFlow: function validateFlow() {
58350
+ return [];
58351
+ }
58352
+ };
58353
+ }
58354
+ var currentStep = flowConfig.steps[currentStepIndex];
58355
+ var isLast = currentStep && isLastStep(currentStep, flowConfig.steps);
58356
+ // Check if current step has a value (handle arrays for multiple checkboxes)
58357
+ var currentValue = currentStep ? flowData[currentStep.id] : null;
58358
+ var hasCurrentValue = currentStep && currentValue !== undefined && currentValue !== null && (Array.isArray(currentValue) ? currentValue.length > 0 : currentValue !== '');
58359
+ var hasCurrentErrors = currentStep && ((_errors$currentStep$i = errors[currentStep.id]) === null || _errors$currentStep$i === void 0 ? void 0 : _errors$currentStep$i.length) > 0;
58360
+ // isComplete should only be true when last step is explicitly submitted, not just when value exists
58361
+ var isComplete = lastStepSubmitted && isLast && hasCurrentValue && !hasCurrentErrors;
58362
+ var updateValue = function updateValue(stepId, value) {
58363
+ setFlowData(function (prev) {
58364
+ return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty$2({}, stepId, value));
58365
+ });
58366
+ // Clear error when value changes
58367
+ setErrors(function (prev) {
58368
+ return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty$2({}, stepId, []));
58369
+ });
58370
+ };
58371
+ var setError = function setError(stepId, error) {
58372
+ setErrors(function (prev) {
58373
+ return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty$2({}, stepId, Array.isArray(error) ? error : [error]));
58374
+ });
58375
+ };
58376
+ var getError = function getError(stepId) {
58377
+ // Only return error if this step has been attempted
58378
+ if (!attemptedSteps.has(stepId)) {
58379
+ return undefined;
58380
+ }
58381
+ var stepErrors = errors[stepId];
58382
+ return stepErrors !== null && stepErrors !== void 0 && stepErrors.length ? stepErrors[0] : undefined;
58383
+ };
58384
+ var goToNextStep = /*#__PURE__*/function () {
58385
+ var _ref = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3() {
58386
+ var stepErrors, nextIndex;
58387
+ return _regenerator().w(function (_context3) {
58388
+ while (1) switch (_context3.n) {
58389
+ case 0:
58390
+ if (currentStep) {
58391
+ _context3.n = 1;
58392
+ break;
58393
+ }
58394
+ return _context3.a(2, false);
58395
+ case 1:
58396
+ // Mark this step as attempted
58397
+ setAttemptedSteps(function (prev) {
58398
+ return new Set([].concat(_toConsumableArray(prev), [currentStep.id]));
58399
+ });
58400
+ stepErrors = validateStep(currentStep, flowData[currentStep.id]);
58401
+ if (!(stepErrors.length > 0)) {
58402
+ _context3.n = 2;
58403
+ break;
58404
+ }
58405
+ setError(currentStep.id, stepErrors);
58406
+ return _context3.a(2, false);
58407
+ case 2:
58408
+ if (!isLastStep(currentStep, flowConfig.steps)) {
58409
+ _context3.n = 3;
58410
+ break;
58411
+ }
58412
+ setLastStepSubmitted(true);
58413
+ return _context3.a(2, true);
58414
+ case 3:
58415
+ if (currentStep.nextStepId) {
58416
+ nextIndex = flowConfig.steps.findIndex(function (s) {
58417
+ return s.id === currentStep.nextStepId;
58418
+ });
58419
+ if (nextIndex !== -1) {
58420
+ setCurrentStepIndex(nextIndex);
58421
+ }
58422
+ }
58423
+ return _context3.a(2, true);
58424
+ }
58425
+ }, _callee3);
58426
+ }));
58427
+ return function goToNextStep() {
58428
+ return _ref.apply(this, arguments);
58429
+ };
58430
+ }();
58431
+ var goToStep = function goToStep(stepId) {
58432
+ var stepIndex = flowConfig.steps.findIndex(function (s) {
58433
+ return s.id === stepId;
58434
+ });
58435
+ if (stepIndex !== -1) {
58436
+ setCurrentStepIndex(stepIndex);
58437
+ }
58438
+ };
58439
+ var submitStep = /*#__PURE__*/function () {
58440
+ var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4() {
58441
+ return _regenerator().w(function (_context4) {
58442
+ while (1) switch (_context4.n) {
58443
+ case 0:
58444
+ _context4.n = 1;
58445
+ return goToNextStep();
58446
+ case 1:
58447
+ return _context4.a(2, _context4.v);
58448
+ }
58449
+ }, _callee4);
58450
+ }));
58451
+ return function submitStep() {
58452
+ return _ref2.apply(this, arguments);
58453
+ };
58454
+ }();
58455
+ var resetFlow = function resetFlow() {
58456
+ setCurrentStepIndex(0);
58457
+ setFlowData({});
58458
+ setErrors({});
58459
+ setLastStepSubmitted(false);
58460
+ setAttemptedSteps(new Set());
58461
+ };
58462
+ var formatAnswerString = function formatAnswerString() {
58463
+ return formatAnswer(flowConfig.answer, flowData, flowConfig.steps);
58464
+ };
58465
+ return {
58466
+ currentStep: currentStep,
58467
+ flowData: flowData,
58468
+ errors: errors,
58469
+ isComplete: isComplete,
58470
+ configErrors: configErrors,
58471
+ updateValue: updateValue,
58472
+ setError: setError,
58473
+ getError: getError,
58474
+ goToNextStep: goToNextStep,
58475
+ goToStep: goToStep,
58476
+ submitStep: submitStep,
58477
+ resetFlow: resetFlow,
58478
+ formatAnswer: formatAnswerString,
58479
+ validateFlow: function validateFlow() {
58480
+ return validateFlowConfig(flowConfig);
58481
+ }
58482
+ };
58483
+ };
58484
+
58485
+ var css_248z$3 = ".utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow {\r\n box-shadow: 0 0px 6px #c1c1c1;\r\n overflow: hidden;\r\n display: flex;\r\n flex-direction: column;\r\n background: #fff;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner {\r\n position: absolute;\r\n background: rgba(0, 0, 0, 0.5);\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n right: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader {\r\n /* background: #1d5ab9; */\r\n display: flex;\r\n justify-content: space-between;\r\n padding: 15px;\r\n align-items: center;\r\n border-bottom: 1px solid #d1d1d1;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--title {\r\n font-size: 20px;\r\n font-weight: 700;\r\n line-height: 24px;\r\n /* color: #fff; */\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody {\r\n flex: 1;\r\n padding: 12px;\r\n overflow: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatVisible {\r\n padding-top: 56px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer {\r\n padding: 8px 0;\r\n border-bottom: 1px solid #d1d1d1;\r\n display: flex;\r\n justify-content: end;\r\n align-items: center;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatVisible .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer {\r\n position: absolute;\r\n width: calc(100% - 72px);\r\n top: 57px;\r\n background: #fff;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messagesContainer {\r\n width: 100%;\r\n display: flex;\r\n flex-direction: column;\r\n grid-gap: 16px;\r\n gap: 16px;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton {\r\n display: flex;\r\n align-items: center;\r\n grid-gap: 6px;\r\n gap: 6px;\r\n cursor: pointer;\r\n border: 1px solid #d1d1d1;\r\n border-radius: 4px;\r\n padding: 6px 12px;\r\n font-weight: 600;\r\n font-size: 14px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message {\r\n display: flex;\r\n align-items: flex-start;\r\n grid-gap: 10px;\r\n gap: 10px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--user {\r\n justify-content: flex-end;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--welcomeQuestion {\r\n margin-top: 5px;\r\n margin-left: 36px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions {\r\n display: flex;\r\n flex-direction: column;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionWrapper {\r\n display: flex;\r\n flex-direction: row-reverse;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionContainer {\r\n max-width: 95%;\r\n word-break: break-all;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestion {\r\n border: 1px solid #3261bd;\r\n border-radius: 16px;\r\n padding: 6px 8px;\r\n font-size: 14px;\r\n color: #3261bd;\r\n cursor: pointer;\r\n transition: all 0.2s ease;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestion:hover {\r\n background-color: #f5f5f5;\r\n border-color: #3261bd;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--agentIcon {\r\n width: 26px;\r\n border-radius: 50%;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble {\r\n background-color: #f5f5f5;\r\n border-radius: 0px 12px 12px 12px;\r\n padding: 10px 15px;\r\n max-width: 85%;\r\n font-size: 14px;\r\n line-height: 1.5;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--error {\r\n border: 1px solid #f1bbbc;\r\n background: #fdf6f6;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--user .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble {\r\n background: #3261bd;\r\n color: #fff;\r\n border-radius: 12px 0px 12px 12px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--feedbackContainer {\r\n display: flex;\r\n grid-gap: 8px;\r\n gap: 8px;\r\n margin-top: 10px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--feedbackContainer i {\r\n cursor: pointer;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p {\r\n margin: 0;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p a {\r\n color: #1e54ad;\r\n text-decoration: underline;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p ol,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowBody .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble p ul {\r\n padding-left: 15px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowFooter {\r\n border-top: 1px solid #d1d1d1;\r\n padding: 16px 24px;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer {\r\n display: flex;\r\n align-items: center;\r\n border: 1px solid #616161;\r\n border-radius: 4px;\r\n padding: 6px 8px;\r\n cursor: auto;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--disabled {\r\n background-color: #fafafa;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input {\r\n border: none;\r\n outline: none;\r\n flex-grow: 1;\r\n font-size: 14px !important;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-webkit-input-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-moz-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::-ms-input-placeholder {\r\n color: #757575;\r\n}\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer input:disabled::placeholder {\r\n color: #757575;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n padding: 10px;\r\n width: 75px;\r\n background-color: #f5f5f5;\r\n border-radius: 0px 12px 12px 12px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot {\r\n width: 8px;\r\n height: 8px;\r\n margin: 0 3px;\r\n background-color: #3261bd;\r\n border-radius: 50%;\r\n display: inline-block;\r\n -webkit-animation: utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce 1.2s infinite ease-in-out both;\r\n animation: utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce 1.2s infinite ease-in-out both;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot:nth-child(1) {\r\n -webkit-animation-delay: -0.32s;\r\n animation-delay: -0.32s;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot:nth-child(2) {\r\n -webkit-animation-delay: -0.16s;\r\n animation-delay: -0.16s;\r\n}\r\n\r\n@-webkit-keyframes utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce {\r\n 0%,\r\n 80%,\r\n 100% {\r\n -webkit-transform: scale(0);\r\n transform: scale(0);\r\n }\r\n 40% {\r\n -webkit-transform: scale(1);\r\n transform: scale(1);\r\n }\r\n}\r\n\r\n@keyframes utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce {\r\n 0%,\r\n 80%,\r\n 100% {\r\n -webkit-transform: scale(0);\r\n transform: scale(0);\r\n }\r\n 40% {\r\n -webkit-transform: scale(1);\r\n transform: scale(1);\r\n }\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarWrapper {\r\n height: 100vh;\r\n background-color: rgba(0,0,0,.5);\r\n display: flex;\r\n justify-content: flex-end;\r\n transition: max-width 0.25s ease-in-out, width 0.25s ease-in-out, opacity 0.25s ease-in-out;\r\n overflow: hidden;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarWrapper.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--visible {\r\n max-width: 400px;\r\n width: 400px;\r\n opacity: 1;\r\n pointer-events: auto;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarWrapper.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--hidden {\r\n max-width: 0px;\r\n width: 0px;\r\n opacity: 0;\r\n pointer-events: none;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarPanel {\r\n width: 400px;\r\n max-width: 400px;\r\n height: calc(100vh - 48px);\r\n background-color: white;\r\n overflow-y: auto;\r\n transition: -webkit-transform 0.25s ease-in-out;\r\n transition: transform 0.25s ease-in-out;\r\n transition: transform 0.25s ease-in-out, -webkit-transform 0.25s ease-in-out;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarPanel.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--visible {\r\n -webkit-transform: translateX(0);\r\n transform: translateX(0);\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarPanel.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--hidden {\r\n -webkit-transform: translateX(100%);\r\n transform: translateX(100%);\r\n}\r\n\r\n/* Flow Step Styles */\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--flowStepContainer {\r\n padding: 16px;\r\n margin: 12px 0;\r\n background-color: #fff;\r\n border-radius: 8px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepHeading {\r\n font-size: 16px;\r\n font-weight: 600;\r\n margin: 0 0 12px 0;\r\n color: #333;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepDescription {\r\n font-size: 14px;\r\n color: #666;\r\n margin: 0 0 16px 0;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionsContainer {\r\n display: flex;\r\n flex-direction: column;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n margin-top: 12px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionButton {\r\n display: flex;\r\n align-items: center;\r\n grid-gap: 12px;\r\n gap: 12px;\r\n padding: 12px 16px;\r\n border: 1px solid #d1d1d1;\r\n border-radius: 8px;\r\n background-color: #fff;\r\n cursor: pointer;\r\n transition: all 0.2s ease;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionButton:hover {\r\n background-color: #f5f5f5;\r\n border-color: #3261bd;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper {\r\n margin: 16px 0;\r\n}\r\n\r\n/* Apply border-radius to Input component */\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper input,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-TextField-fieldGroup,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-TextField-fieldGroup input {\r\n border-radius: 8px !important;\r\n}\r\n\r\n/* Apply border-radius to Select component (Dropdown) */\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Dropdown-container,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Dropdown,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Dropdown-title,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Dropdown-titleIsPlaceHolder {\r\n border-radius: 8px !important;\r\n}\r\n\r\n/* Apply border-radius to Button component */\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper button,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Button,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Button--primary,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper .ms-Button--default {\r\n border-radius: 4px !important;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--validationError {\r\n color: #d32f2f;\r\n font-size: 12px;\r\n margin-top: 8px;\r\n padding: 8px;\r\n background-color: #fdf6f6;\r\n border: 1px solid #f1bbbc;\r\n border-radius: 4px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--renderError {\r\n color: #d32f2f;\r\n font-size: 12px;\r\n margin-top: 8px;\r\n padding: 8px;\r\n background-color: #fff3cd;\r\n border: 1px solid #ffc107;\r\n border-radius: 4px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback {\r\n padding: 16px;\r\n background-color: #fff3cd;\r\n border: 1px solid #ffc107;\r\n border-radius: 4px;\r\n color: #856404;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback p {\r\n margin: 0;\r\n font-size: 14px;\r\n}\r\n\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions {\r\n margin-top: 16px;\r\n display: flex;\r\n justify-content: flex-end;\r\n}\r\n\r\n/* Apply border-radius to Button component in stepActions */\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions button,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions .ms-Button,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions .ms-Button--primary,\r\n.utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions .ms-Button--default {\r\n border-radius: 4px !important;\r\n}\r\n";
57950
58486
  styleInject(css_248z$3);
57951
58487
 
58488
+ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
58489
+ function ErrorBoundary(props) {
58490
+ var _this;
58491
+ _classCallCheck$3(this, ErrorBoundary);
58492
+ _this = _callSuper(this, ErrorBoundary, [props]);
58493
+ _this.state = {
58494
+ hasError: false,
58495
+ error: null
58496
+ };
58497
+ return _this;
58498
+ }
58499
+ _inherits$2(ErrorBoundary, _React$Component);
58500
+ return _createClass$2(ErrorBoundary, [{
58501
+ key: "componentDidCatch",
58502
+ value: function componentDidCatch(error, errorInfo) {
58503
+ if (this.props.onError) {
58504
+ this.props.onError(error, errorInfo);
58505
+ }
58506
+ }
58507
+ }, {
58508
+ key: "render",
58509
+ value: function render() {
58510
+ if (this.state.hasError) {
58511
+ return this.props.fallback || /*#__PURE__*/React__default["default"].createElement("div", null, "Something went wrong");
58512
+ }
58513
+ return this.props.children;
58514
+ }
58515
+ }], [{
58516
+ key: "getDerivedStateFromError",
58517
+ value: function getDerivedStateFromError(error) {
58518
+ return {
58519
+ hasError: true,
58520
+ error: error
58521
+ };
58522
+ }
58523
+ }]);
58524
+ }(React__default["default"].Component);
58525
+ var FlowStepRenderer = function FlowStepRenderer(_ref) {
58526
+ var step = _ref.step,
58527
+ flowData = _ref.flowData,
58528
+ handlers = _ref.handlers,
58529
+ isComplete = _ref.isComplete;
58530
+ var _useState = React.useState(null),
58531
+ _useState2 = _slicedToArray(_useState, 2),
58532
+ renderError = _useState2[0],
58533
+ setRenderError = _useState2[1];
58534
+ var componentRef = React.useRef(null);
58535
+ if (!step) return null;
58536
+
58537
+ // Question step (options only, no component)
58538
+ if (step.options && !step.component) {
58539
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58540
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--flowStepContainer"
58541
+ }, step.heading && /*#__PURE__*/React__default["default"].createElement("h3", {
58542
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepHeading"
58543
+ }, step.heading), /*#__PURE__*/React__default["default"].createElement("div", {
58544
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionsContainer"
58545
+ }, step.options.map(function (option, index) {
58546
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58547
+ key: index,
58548
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionButton",
58549
+ onClick: function onClick() {
58550
+ handlers.updateValue(step.id, option.value);
58551
+ if (option.nextStepId) {
58552
+ handlers.goToStep(option.nextStepId);
58553
+ } else if (step.nextStepId) {
58554
+ handlers.goToStep(step.nextStepId);
58555
+ }
58556
+ }
58557
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, option.label));
58558
+ })));
58559
+ }
58560
+
58561
+ // Multiple checkboxes step (special case)
58562
+ if (step.component === 'Checkbox' && step.checkboxOptions && Array.isArray(step.checkboxOptions)) {
58563
+ var Checkbox = getComponent('Checkbox');
58564
+ var selectedValues = flowData[step.id] || [];
58565
+ var isArray = Array.isArray(selectedValues);
58566
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58567
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--flowStepContainer"
58568
+ }, step.heading && /*#__PURE__*/React__default["default"].createElement("h3", {
58569
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepHeading"
58570
+ }, step.heading), step.description && /*#__PURE__*/React__default["default"].createElement("p", {
58571
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepDescription"
58572
+ }, step.description), /*#__PURE__*/React__default["default"].createElement("form", {
58573
+ onSubmit: function onSubmit(e) {
58574
+ e.preventDefault();
58575
+ e.stopPropagation();
58576
+ return false;
58577
+ },
58578
+ onKeyDown: function onKeyDown(e) {
58579
+ if (e.key === 'Enter') {
58580
+ e.preventDefault();
58581
+ e.stopPropagation();
58582
+ }
58583
+ },
58584
+ style: {
58585
+ display: 'contents'
58586
+ }
58587
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
58588
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper"
58589
+ }, /*#__PURE__*/React__default["default"].createElement(ErrorBoundary, {
58590
+ fallback: /*#__PURE__*/React__default["default"].createElement("div", {
58591
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback"
58592
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "Error rendering checkboxes. Please try again.")),
58593
+ onError: function onError(error) {
58594
+ console.error('Checkbox render error:', error);
58595
+ setRenderError(error.message);
58596
+ }
58597
+ }, step.checkboxOptions.map(function (option, index) {
58598
+ var optionValue = option.value || option.id || String(index);
58599
+ var isChecked = isArray ? selectedValues.includes(optionValue) : false;
58600
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58601
+ key: index,
58602
+ style: {
58603
+ marginBottom: '12px'
58604
+ }
58605
+ }, /*#__PURE__*/React__default["default"].createElement(Checkbox, _extends$1({
58606
+ label: option.label || option.text || String(optionValue),
58607
+ checked: isChecked,
58608
+ onChange: function onChange(e, checked) {
58609
+ var currentValues = isArray ? _toConsumableArray(selectedValues) : [];
58610
+ var newValues;
58611
+ if (checked) {
58612
+ newValues = [].concat(_toConsumableArray(currentValues), [optionValue]);
58613
+ } else {
58614
+ newValues = currentValues.filter(function (v) {
58615
+ return v !== optionValue;
58616
+ });
58617
+ }
58618
+ handlers.updateValue(step.id, newValues);
58619
+ }
58620
+ }, option.props || {})));
58621
+ }))), handlers.getError(step.id) && /*#__PURE__*/React__default["default"].createElement("div", {
58622
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--validationError"
58623
+ }, handlers.getError(step.id)), renderError && /*#__PURE__*/React__default["default"].createElement("div", {
58624
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--renderError"
58625
+ }, renderError), /*#__PURE__*/React__default["default"].createElement("div", {
58626
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions"
58627
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.Button, {
58628
+ primary: true,
58629
+ type: "button",
58630
+ onClick: (/*#__PURE__*/function () {
58631
+ var _ref2 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee(e) {
58632
+ return _regenerator().w(function (_context) {
58633
+ while (1) switch (_context.n) {
58634
+ case 0:
58635
+ e.preventDefault();
58636
+ e.stopPropagation();
58637
+ _context.n = 1;
58638
+ return handlers.submitStep();
58639
+ case 1:
58640
+ _context.v;
58641
+ case 2:
58642
+ return _context.a(2);
58643
+ }
58644
+ }, _callee);
58645
+ }));
58646
+ return function (_x) {
58647
+ return _ref2.apply(this, arguments);
58648
+ };
58649
+ }()),
58650
+ disabled: isComplete
58651
+ }, isComplete ? 'Complete' : step.nextStepId ? 'Continue' : 'Submit'))));
58652
+ }
58653
+
58654
+ // Form step (with component)
58655
+ if (step.component) {
58656
+ var Component = getComponent(step.component);
58657
+ if (!Component) {
58658
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58659
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback"
58660
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "Error: Component \"", step.component, "\" not found"));
58661
+ }
58662
+ var adapter = getPropAdapter(step.component);
58663
+ if (!adapter) {
58664
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58665
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback"
58666
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "Error: No adapter found for component \"", step.component, "\""));
58667
+ }
58668
+ var adaptedProps;
58669
+ try {
58670
+ adaptedProps = adapter(step, flowData, handlers);
58671
+ } catch (error) {
58672
+ console.error('Error adapting props:', error);
58673
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58674
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback"
58675
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "Error: Failed to prepare component props"));
58676
+ }
58677
+ return /*#__PURE__*/React__default["default"].createElement("div", {
58678
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--flowStepContainer"
58679
+ }, step.heading && /*#__PURE__*/React__default["default"].createElement("h3", {
58680
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepHeading"
58681
+ }, step.heading), step.description && /*#__PURE__*/React__default["default"].createElement("p", {
58682
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepDescription"
58683
+ }, step.description), /*#__PURE__*/React__default["default"].createElement("form", {
58684
+ onSubmit: function onSubmit(e) {
58685
+ e.preventDefault();
58686
+ e.stopPropagation();
58687
+ return false;
58688
+ },
58689
+ onKeyDown: function onKeyDown(e) {
58690
+ // Prevent Enter key from submitting form
58691
+ if (e.key === 'Enter') {
58692
+ e.preventDefault();
58693
+ e.stopPropagation();
58694
+ }
58695
+ },
58696
+ style: {
58697
+ display: 'contents'
58698
+ }
58699
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
58700
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper"
58701
+ }, /*#__PURE__*/React__default["default"].createElement(ErrorBoundary, {
58702
+ fallback: /*#__PURE__*/React__default["default"].createElement("div", {
58703
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback"
58704
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "Error rendering component. Please try again.")),
58705
+ onError: function onError(error) {
58706
+ console.error('Component render error:', error);
58707
+ setRenderError(error.message);
58708
+ }
58709
+ }, /*#__PURE__*/React__default["default"].createElement(Component, _extends$1({
58710
+ ref: componentRef
58711
+ }, adaptedProps, {
58712
+ "aria-label": step.heading || "Step: ".concat(step.id),
58713
+ onKeyDown: function onKeyDown(e) {
58714
+ // Prevent Enter key from submitting when typing in input
58715
+ if (e.key === 'Enter' && e.target.tagName !== 'BUTTON') {
58716
+ e.preventDefault();
58717
+ e.stopPropagation();
58718
+ }
58719
+ }
58720
+ })))), handlers.getError(step.id) && /*#__PURE__*/React__default["default"].createElement("div", {
58721
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--validationError"
58722
+ }, handlers.getError(step.id)), renderError && /*#__PURE__*/React__default["default"].createElement("div", {
58723
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--renderError"
58724
+ }, renderError), /*#__PURE__*/React__default["default"].createElement("div", {
58725
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions"
58726
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.Button, {
58727
+ primary: true,
58728
+ type: "button",
58729
+ onClick: (/*#__PURE__*/function () {
58730
+ var _ref3 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2(e) {
58731
+ return _regenerator().w(function (_context2) {
58732
+ while (1) switch (_context2.n) {
58733
+ case 0:
58734
+ e.preventDefault();
58735
+ e.stopPropagation();
58736
+ _context2.n = 1;
58737
+ return handlers.submitStep();
58738
+ case 1:
58739
+ _context2.v;
58740
+ // If this is the last step and validation passed, flow will complete
58741
+ case 2:
58742
+ return _context2.a(2);
58743
+ }
58744
+ }, _callee2);
58745
+ }));
58746
+ return function (_x2) {
58747
+ return _ref3.apply(this, arguments);
58748
+ };
58749
+ }()),
58750
+ disabled: isComplete
58751
+ }, isComplete ? 'Complete' : step.nextStepId ? 'Continue' : 'Submit'))));
58752
+ }
58753
+ return null;
58754
+ };
58755
+
57952
58756
  var _styleModuleImportMap$2 = {
57953
58757
  "./MiHelpAgent.css": {
57954
- "mihelpAgentWrapper": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper",
57955
- "chatIcon": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
57956
58758
  "chatWindow": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
57957
58759
  "spinner": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner",
57958
58760
  "chatWindowHeader": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader",
@@ -57979,7 +58781,20 @@ var _styleModuleImportMap$2 = {
57979
58781
  "chatbotLoader": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader",
57980
58782
  "dot": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot",
57981
58783
  "bounce": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce",
57982
- "iphoneChrome": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--iphoneChrome"
58784
+ "sidebarWrapper": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarWrapper",
58785
+ "visible": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--visible",
58786
+ "hidden": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--hidden",
58787
+ "sidebarPanel": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--sidebarPanel",
58788
+ "flowStepContainer": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--flowStepContainer",
58789
+ "stepHeading": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepHeading",
58790
+ "stepDescription": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepDescription",
58791
+ "optionsContainer": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionsContainer",
58792
+ "optionButton": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--optionButton",
58793
+ "componentWrapper": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--componentWrapper",
58794
+ "validationError": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--validationError",
58795
+ "renderError": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--renderError",
58796
+ "errorFallback": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--errorFallback",
58797
+ "stepActions": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--stepActions"
57983
58798
  }
57984
58799
  };
57985
58800
  var MiHelpAgent = function MiHelpAgent(_ref) {
@@ -57996,284 +58811,66 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
57996
58811
  contextTopMessagesCount = _ref$contextTopMessag === void 0 ? 10 : _ref$contextTopMessag,
57997
58812
  _ref$contextChunks = _ref.contextChunks,
57998
58813
  contextChunks = _ref$contextChunks === void 0 ? 30 : _ref$contextChunks,
57999
- mihelpAgentRef = _ref.mihelpAgentRef;
58814
+ mihelpAgentRef = _ref.mihelpAgentRef,
58815
+ _ref$chatBotVisible = _ref.chatBotVisible,
58816
+ chatBotVisible = _ref$chatBotVisible === void 0 ? false : _ref$chatBotVisible,
58817
+ setChatBotVisible = _ref.setChatBotVisible,
58818
+ _ref$notificationsCou = _ref.notificationsCount,
58819
+ notificationsCount = _ref$notificationsCou === void 0 ? 0 : _ref$notificationsCou,
58820
+ _ref$sideBarTopValue = _ref.sideBarTopValue,
58821
+ sideBarTopValue = _ref$sideBarTopValue === void 0 ? 0 : _ref$sideBarTopValue;
58000
58822
  var _useState = React.useState(false),
58001
58823
  _useState2 = _slicedToArray(_useState, 2),
58002
- showChatWindow = _useState2[0],
58003
- setShowChatWindow = _useState2[1];
58824
+ isLoading = _useState2[0],
58825
+ setIsLoading = _useState2[1];
58004
58826
  var _useState3 = React.useState(false),
58005
58827
  _useState4 = _slicedToArray(_useState3, 2),
58006
- isLoading = _useState4[0],
58007
- setIsLoading = _useState4[1];
58828
+ isFeedbackLoading = _useState4[0],
58829
+ setIsFeedbackLoading = _useState4[1];
58008
58830
  var _useState5 = React.useState(false),
58009
58831
  _useState6 = _slicedToArray(_useState5, 2),
58010
- isFeedbackLoading = _useState6[0],
58011
- setIsFeedbackLoading = _useState6[1];
58012
- var _useState7 = React.useState(false),
58013
- _useState8 = _slicedToArray(_useState7, 2),
58014
- collectionError = _useState8[0];
58015
- _useState8[1];
58832
+ collectionError = _useState6[0];
58833
+ _useState6[1];
58016
58834
  var retryCount = React.useRef(0);
58017
58835
  var messagesContainerRef = React.useRef(null);
58018
58836
  var inputContainerRef = React.useRef(null);
58837
+ var inputRef = React.useRef(null);
58019
58838
  var spinnerRef = React.useRef(null);
58020
58839
  var welcomeQuestionRef = React.useRef(null);
58021
- var _useState9 = React.useState(false),
58840
+ var _useState7 = React.useState(false),
58841
+ _useState8 = _slicedToArray(_useState7, 2),
58842
+ messageError = _useState8[0],
58843
+ setMessageError = _useState8[1];
58844
+ var _useState9 = React.useState([]),
58022
58845
  _useState0 = _slicedToArray(_useState9, 2),
58023
- messageError = _useState0[0],
58024
- setMessageError = _useState0[1];
58846
+ conversations = _useState0[0],
58847
+ setConversations = _useState0[1];
58025
58848
  var _useState1 = React.useState([]),
58026
58849
  _useState10 = _slicedToArray(_useState1, 2),
58027
- conversations = _useState10[0],
58028
- setConversations = _useState10[1];
58029
- var _useState11 = React.useState([]),
58850
+ quickReplyList = _useState10[0],
58851
+ setQuickReplyList = _useState10[1];
58852
+ var _useState11 = React.useState(''),
58030
58853
  _useState12 = _slicedToArray(_useState11, 2),
58031
- quickReplyList = _useState12[0],
58032
- setQuickReplyList = _useState12[1];
58033
- var _useState13 = React.useState(''),
58854
+ message = _useState12[0],
58855
+ setMessage = _useState12[1];
58856
+ var _useState13 = React.useState(null),
58034
58857
  _useState14 = _slicedToArray(_useState13, 2),
58035
- message = _useState14[0],
58036
- setMessage = _useState14[1];
58858
+ currentContext = _useState14[0],
58859
+ setCurrentContext = _useState14[1];
58037
58860
  var _useState15 = React.useState(null),
58038
58861
  _useState16 = _slicedToArray(_useState15, 2),
58039
- currentContext = _useState16[0],
58040
- setCurrentContext = _useState16[1];
58041
- var _useState17 = React.useState(null),
58862
+ lastSentFromApp = _useState16[0],
58863
+ setLastSentFromApp = _useState16[1];
58864
+ var _useState17 = React.useState({}),
58042
58865
  _useState18 = _slicedToArray(_useState17, 2),
58043
- lastSentFromApp = _useState18[0],
58044
- setLastSentFromApp = _useState18[1];
58045
- var _useState19 = React.useState({}),
58866
+ feedbacks = _useState18[0],
58867
+ setFeedbacks = _useState18[1];
58868
+ var _useState19 = React.useState(null),
58046
58869
  _useState20 = _slicedToArray(_useState19, 2),
58047
- feedbacks = _useState20[0],
58048
- setFeedbacks = _useState20[1];
58049
- var _useState21 = React.useState({
58050
- x: 0,
58051
- y: 0
58052
- }),
58053
- _useState22 = _slicedToArray(_useState21, 2),
58054
- position = _useState22[0],
58055
- setPosition = _useState22[1];
58056
- var _useState23 = React.useState({
58057
- x: 50,
58058
- y: -68
58059
- }),
58060
- _useState24 = _slicedToArray(_useState23, 2),
58061
- chatPosition = _useState24[0],
58062
- setChatPosition = _useState24[1];
58063
- var _useState25 = React.useState(false),
58064
- _useState26 = _slicedToArray(_useState25, 2),
58065
- isDragging = _useState26[0],
58066
- setIsDragging = _useState26[1];
58067
- var _useState27 = React.useState({
58068
- x: 0,
58069
- y: 0
58070
- }),
58071
- _useState28 = _slicedToArray(_useState27, 2),
58072
- offset = _useState28[0],
58073
- setOffset = _useState28[1];
58074
- var _useState29 = React.useState(false),
58075
- _useState30 = _slicedToArray(_useState29, 2),
58076
- dragged = _useState30[0],
58077
- setDragged = _useState30[1];
58078
- var _useState31 = React.useState(500),
58079
- _useState32 = _slicedToArray(_useState31, 2),
58080
- chatWindowWidth = _useState32[0],
58081
- setChatWindowWidth = _useState32[1];
58082
- var _useState33 = React.useState(0),
58083
- _useState34 = _slicedToArray(_useState33, 2),
58084
- windowInnerWidthForMobile = _useState34[0],
58085
- setWindowInnerWidthForMobile = _useState34[1];
58086
- var _useState35 = React.useState(600),
58087
- _useState36 = _slicedToArray(_useState35, 2),
58088
- chatWindowHeight = _useState36[0],
58089
- setchatWindowHeight = _useState36[1]; //update this if changed in css
58090
-
58091
- var chatIconSize = 60; //update this if changed in css
58092
-
58093
- React.useEffect(function () {
58094
- var updateChatWindowWidth = function updateChatWindowWidth() {
58095
- var width = window.innerWidth;
58096
- var newWidth = 500;
58097
-
58098
- //Update these values if changed in css
58099
- if (width <= 575) newWidth = 450;
58100
- if (width <= 475) newWidth = 400;
58101
- if (width <= 425) newWidth = 350;
58102
- if (width <= 375) newWidth = 325;
58103
- if (width <= 350) newWidth = 300;
58104
- if (width <= 325) newWidth = 275;
58105
- setChatWindowWidth(newWidth);
58106
- setWindowInnerWidthForMobile(width);
58107
- };
58108
- updateChatWindowWidth();
58109
- window.addEventListener('resize', updateChatWindowWidth);
58110
- return function () {
58111
- return window.removeEventListener('resize', updateChatWindowWidth);
58112
- };
58113
- }, []);
58114
- React.useEffect(function () {
58115
- var updateInitialPosition = function updateInitialPosition() {
58116
- var bufferForMobile = window.innerWidth <= 575 ? 40 : 0;
58117
- setPosition({
58118
- x: window.innerWidth - chatIconSize + bufferForMobile,
58119
- y: window.innerHeight - chatIconSize + 30
58120
- });
58121
- };
58122
- updateInitialPosition();
58123
- window.addEventListener('resize', updateInitialPosition);
58124
- return function () {
58125
- return window.removeEventListener('resize', updateInitialPosition);
58126
- };
58127
- }, []);
58128
- var handleStart = function handleStart(e) {
58129
- var _e$target;
58130
- var target = e.target;
58131
- if (inputContainerRef.current && inputContainerRef.current.contains(target) || messagesContainerRef.current && messagesContainerRef.current.contains(target) || spinnerRef.current && spinnerRef.current.contains(target) || e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && _e$target.closest('#chatCloseIcon')) {
58132
- return;
58133
- }
58134
- e.preventDefault();
58135
- setIsDragging(true);
58136
- setDragged(false);
58137
- var clientX = e.touches ? e.touches[0].clientX : e.clientX;
58138
- var clientY = e.touches ? e.touches[0].clientY : e.clientY;
58139
- setOffset({
58140
- x: clientX - position.x,
58141
- y: clientY - position.y
58142
- });
58143
- };
58144
- var handleMove = function handleMove(e) {
58145
- var _e$target2;
58146
- if (e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.closest('#chatCloseIcon')) return;
58147
- if (isDragging) {
58148
- setDragged(true);
58149
- var clientX = e.touches ? e.touches[0].clientX : e.clientX;
58150
- var clientY = e.touches ? e.touches[0].clientY : e.clientY;
58151
- var newX = clientX - offset.x;
58152
- var newY = clientY - offset.y;
58153
-
58154
- // chat icon has to stay within set screen bounds
58155
- newX = Math.max(chatIconSize + 10, Math.min(newX, window.innerWidth - 20));
58156
- newY = Math.max(chatIconSize + 20, Math.min(newY, window.innerHeight - chatIconSize + 30));
58157
- setPosition({
58158
- x: newX,
58159
- y: newY
58160
- });
58161
- }
58162
- };
58163
- var handleEnd = function handleEnd() {
58164
- setIsDragging(false);
58165
- setTimeout(function () {
58166
- return setDragged(false);
58167
- }, 100);
58168
- };
58169
- React.useEffect(function () {
58170
- if (!isDragging) {
58171
- adjustChatWindowPosition();
58172
- if (showChatWindow) {
58173
- adjustChatIconPosition();
58174
- }
58175
- }
58176
- }, [isDragging, position, showChatWindow]);
58177
- React.useEffect(function () {
58178
- var isSmallDevice = windowInnerWidthForMobile < 1000;
58179
- if (showChatWindow && isSmallDevice && !dragged) {
58180
- adjustChatWindowPosition();
58181
- }
58182
- }, [position, dragged]);
58183
- var adjustChatWindowPosition = function adjustChatWindowPosition() {
58184
- if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) {
58185
- return setchatWindowHeight(window.innerHeight - chatIconSize - 20);
58186
- }
58187
- // if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) return
58188
- var bufferForMobile = window.innerWidth <= 575 ? 40 : 0;
58189
- // let chatX = 0 - chatIconSize + bufferForMobile
58190
- var chatX = 0 - chatIconSize;
58191
- var chatY = -chatWindowHeight - chatIconSize - 10; // Default: Open above
58192
-
58193
- // Adjust horizontally
58194
- if (position.x + chatWindowWidth > window.innerWidth + bufferForMobile) {
58195
- chatX = -chatWindowWidth; // Move left if overflowing right
58196
- }
58197
-
58198
- // Adjust vertically
58199
- if (position.y < chatWindowHeight) {
58200
- chatY = 10; // Move below if there's not enough space above
58201
- }
58202
- setChatPosition({
58203
- x: chatX,
58204
- y: chatY
58205
- });
58206
- };
58207
- var adjustChatIconPosition = function adjustChatIconPosition() {
58208
- // if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) {
58209
- // return setchatWindowHeight(500)
58210
- // }
58211
- var newX = position.x;
58212
- var newY = position.y;
58213
- var isSmallDevice = windowInnerWidthForMobile < 1000;
58214
- var middleX = windowInnerWidthForMobile / 2; // Middle of the screen
58215
- var closerToLeft = position.x < middleX; // Check if icon is closer to left or right
58216
-
58217
- // Move chat icon up if chat window is overflowing at the bottom
58218
- if (position.y < chatWindowHeight && window.innerHeight - position.y < chatWindowHeight) {
58219
- newY = position.y - (chatWindowHeight - (window.innerHeight - position.y)) - 20;
58220
- }
58221
-
58222
- // Move chat icon down if chat window is overflowing at the top
58223
- else if (position.y > chatWindowHeight && position.y < chatWindowHeight + chatIconSize + 10) {
58224
- newY = chatWindowHeight + chatIconSize + 20;
58225
- }
58226
-
58227
- // In Mobile, move chat icon to the nearest screen edge (left or right)
58228
- if (isSmallDevice) {
58229
- newX = closerToLeft ? 70 : windowInnerWidthForMobile - 10;
58230
- }
58231
- if (newX !== position.x || newY !== position.y) {
58232
- setPosition({
58233
- x: newX,
58234
- y: newY
58235
- });
58236
- }
58237
- };
58238
- React.useEffect(function () {
58239
- if (chatWindowHeight !== 600) {
58240
- adjustChatWindowPosition();
58241
- // adjustChatIconPosition()
58242
- }
58243
- }, [chatWindowHeight]);
58244
- React.useEffect(function () {
58245
- if (isDragging) {
58246
- document.addEventListener('mousemove', handleMove);
58247
- document.addEventListener('mouseup', handleEnd);
58248
- document.addEventListener('touchmove', handleMove, {
58249
- passive: false
58250
- });
58251
- document.addEventListener('touchend', handleEnd);
58252
- } else {
58253
- document.removeEventListener('mousemove', handleMove);
58254
- document.removeEventListener('mouseup', handleEnd);
58255
- document.removeEventListener('touchmove', handleMove);
58256
- document.removeEventListener('touchend', handleEnd);
58257
- }
58258
- return function () {
58259
- document.removeEventListener('mousemove', handleMove);
58260
- document.removeEventListener('mouseup', handleEnd);
58261
- document.removeEventListener('touchmove', handleMove);
58262
- document.removeEventListener('touchend', handleEnd);
58263
- };
58264
- }, [isDragging]);
58265
- var handleChatIconClick = function handleChatIconClick() {
58266
- if (!dragged) {
58267
- setShowChatWindow(function (prev) {
58268
- return !prev;
58269
- });
58270
- }
58271
- };
58272
- React.useEffect(function () {
58273
- if (showChatWindow) {
58274
- adjustChatIconPosition();
58275
- }
58276
- }, [showChatWindow]);
58870
+ activeFlow = _useState20[0],
58871
+ setActiveFlow = _useState20[1];
58872
+ var flowCompletedRef = React.useRef(false);
58873
+ var previousFlowIdRef = React.useRef(null);
58277
58874
  var saveCurrentContext = function saveCurrentContext(conversationsToBeSaved) {
58278
58875
  var _systemPrompts;
58279
58876
  var systemPrompts = conversationsToBeSaved.filter(function (c) {
@@ -58349,7 +58946,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58349
58946
  }, []);
58350
58947
  var chatBodyRef = React.useRef(null);
58351
58948
  var previousConversationLengthRef = React.useRef(conversations.length);
58352
- var previousShowChatWindowRef = React.useRef(showChatWindow);
58949
+ var previousChatBotVisibleRef = React.useRef(chatBotVisible);
58353
58950
  var scroll = function scroll() {
58354
58951
  chatBodyRef.current && chatBodyRef.current.scrollTo({
58355
58952
  top: chatBodyRef.current.scrollHeight,
@@ -58495,15 +59092,99 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58495
59092
  }();
58496
59093
  var handleReply = function handleReply(reply) {
58497
59094
  if (isLoading || collectionError || !reply) return;
59095
+
59096
+ // Check if reply is a flow config object
59097
+ if (_typeof$1(reply) === 'object' && reply !== null && reply.type === 'flow') {
59098
+ setActiveFlow(reply);
59099
+ // Add user message only, don't add agent response - just show the flow directly
59100
+ var _newConversations = _toConsumableArray(conversations);
59101
+ _newConversations.push({
59102
+ role: 'user',
59103
+ content: typeof reply === 'string' ? reply : reply.text || reply.initialMessage || ''
59104
+ });
59105
+ setConversations(_newConversations);
59106
+ setMessage('');
59107
+ return;
59108
+ }
59109
+
59110
+ // Handle plain string or quickReply object
59111
+ var replyText = typeof reply === 'string' ? reply : (reply === null || reply === void 0 ? void 0 : reply.text) || '';
59112
+ if (!replyText) return;
58498
59113
  var newConversations = _toConsumableArray(conversations);
58499
59114
  newConversations.push({
58500
59115
  role: 'user',
58501
- content: reply
59116
+ content: replyText
58502
59117
  });
58503
59118
  setConversations(newConversations);
58504
59119
  _send(newConversations);
58505
59120
  setMessage('');
58506
59121
  };
59122
+
59123
+ // Use flow hook when flow is active
59124
+ var flowHook = useGuidedFlow(activeFlow);
59125
+
59126
+ // Flow completion handler
59127
+ var handleFlowComplete = React__default["default"].useCallback(/*#__PURE__*/_asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
59128
+ var messageContent, newConversations;
59129
+ return _regenerator().w(function (_context2) {
59130
+ while (1) switch (_context2.n) {
59131
+ case 0:
59132
+ if (!(!activeFlow || !flowHook.isComplete || flowCompletedRef.current)) {
59133
+ _context2.n = 1;
59134
+ break;
59135
+ }
59136
+ return _context2.a(2);
59137
+ case 1:
59138
+ flowCompletedRef.current = true;
59139
+ if (activeFlow.answer) {
59140
+ // Use template string
59141
+ messageContent = flowHook.formatAnswer() || JSON.stringify(flowHook.flowData);
59142
+ } else {
59143
+ // Use JSON
59144
+ messageContent = JSON.stringify(flowHook.flowData);
59145
+ }
59146
+ newConversations = _toConsumableArray(conversations);
59147
+ newConversations.push({
59148
+ role: 'user',
59149
+ content: messageContent
59150
+ });
59151
+ setConversations(newConversations);
59152
+ _send(newConversations);
59153
+ setActiveFlow(null);
59154
+ flowHook.resetFlow();
59155
+ setMessage('');
59156
+ flowCompletedRef.current = false;
59157
+ case 2:
59158
+ return _context2.a(2);
59159
+ }
59160
+ }, _callee2);
59161
+ })), [activeFlow, flowHook, conversations]);
59162
+
59163
+ // Watch for flow completion
59164
+ React.useEffect(function () {
59165
+ if (activeFlow && flowHook.isComplete && !flowCompletedRef.current) {
59166
+ handleFlowComplete();
59167
+ }
59168
+ }, [flowHook.isComplete, activeFlow, handleFlowComplete]);
59169
+
59170
+ // Reset flow when switching to a different flow (but persist when sidebar closes/reopens)
59171
+ React.useEffect(function () {
59172
+ if (activeFlow) {
59173
+ // If switching to a different flow, reset the previous one
59174
+ if (previousFlowIdRef.current && previousFlowIdRef.current !== activeFlow.id) {
59175
+ flowCompletedRef.current = false;
59176
+ if (flowHook.resetFlow) {
59177
+ flowHook.resetFlow();
59178
+ }
59179
+ }
59180
+ previousFlowIdRef.current = activeFlow.id;
59181
+ } else {
59182
+ // Flow was cleared (e.g., new conversation or completion)
59183
+ previousFlowIdRef.current = null;
59184
+ }
59185
+ // Reset completion flag when flow changes
59186
+ flowCompletedRef.current = false;
59187
+ }, [activeFlow === null || activeFlow === void 0 ? void 0 : activeFlow.id, flowHook]);
58507
59188
  var handleKeyup = function handleKeyup(e) {
58508
59189
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 && !isLoading && !collectionError) {
58509
59190
  handleReply(message);
@@ -58511,15 +59192,22 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58511
59192
  };
58512
59193
  React.useEffect(function () {
58513
59194
  var conversationLengthChanged = previousConversationLengthRef.current !== conversations.length;
58514
- var chatWindowJustOpened = !previousShowChatWindowRef.current && showChatWindow && conversations.length;
58515
- if (showChatWindow && conversations.length && (conversationLengthChanged || chatWindowJustOpened)) {
58516
- scroll();
59195
+ var sidebarJustOpened = !previousChatBotVisibleRef.current && chatBotVisible;
59196
+ if (conversations.length && (conversationLengthChanged || sidebarJustOpened)) {
59197
+ // Wait for sidebar transition to complete (0.25s) before scrolling
59198
+ var scrollTimeout = setTimeout(function () {
59199
+ scroll();
59200
+ }, 250);
59201
+ return function () {
59202
+ return clearTimeout(scrollTimeout);
59203
+ };
58517
59204
  }
58518
59205
  previousConversationLengthRef.current = conversations.length;
58519
- previousShowChatWindowRef.current = showChatWindow;
58520
- }, [conversations, showChatWindow]);
59206
+ previousChatBotVisibleRef.current = chatBotVisible;
59207
+ }, [conversations.length, chatBotVisible]);
58521
59208
  React.useEffect(function () {
58522
59209
  if (messageError) {
59210
+ console.log('***scrolling 2');
58523
59211
  scroll();
58524
59212
  }
58525
59213
  }, [messageError]);
@@ -58540,11 +59228,29 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58540
59228
  }
58541
59229
  var replies = _toConsumableArray(quickReplies.slice(0, 3));
58542
59230
  replies.forEach(function (reply, index) {
58543
- if (typeof reply !== 'string') {
58544
- throw new Error("quickReplies[".concat(index, "] must be a string"));
58545
- }
58546
- if (reply.length > 100) {
58547
- throw new Error("quickReplies[".concat(index, "] exceeds the 100 character limit"));
59231
+ // Support both string and object types
59232
+ if (typeof reply === 'string') {
59233
+ if (reply.length > 100) {
59234
+ throw new Error("quickReplies[".concat(index, "] exceeds the 100 character limit"));
59235
+ }
59236
+ } else if (_typeof$1(reply) === 'object' && reply !== null) {
59237
+ // Validate flow config
59238
+ if (reply.type === 'flow') {
59239
+ if (!reply.id || !reply.steps || !Array.isArray(reply.steps)) {
59240
+ throw new Error("quickReplies[".concat(index, "] flow config is invalid"));
59241
+ }
59242
+ } else if (reply.type === 'quickReply') {
59243
+ if (!reply.text || typeof reply.text !== 'string') {
59244
+ throw new Error("quickReplies[".concat(index, "] quickReply must have text property"));
59245
+ }
59246
+ if (reply.text.length > 100) {
59247
+ throw new Error("quickReplies[".concat(index, "] text exceeds the 100 character limit"));
59248
+ }
59249
+ } else {
59250
+ throw new Error("quickReplies[".concat(index, "] must be a string or have type 'quickReply' or 'flow'"));
59251
+ }
59252
+ } else {
59253
+ throw new Error("quickReplies[".concat(index, "] must be a string or object"));
58548
59254
  }
58549
59255
  });
58550
59256
  setQuickReplyList(replies);
@@ -58560,14 +59266,20 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58560
59266
  storage$1.setLocalItem('mihelpAgentLastSentApp', '');
58561
59267
  setMessageError(false);
58562
59268
  setCurrentContext(null);
59269
+ // Reset active flow to show quick replies again
59270
+ setActiveFlow(null);
59271
+ flowCompletedRef.current = false;
59272
+ if (flowHook && flowHook.resetFlow) {
59273
+ flowHook.resetFlow();
59274
+ }
58563
59275
  };
58564
59276
  var handleDownload = /*#__PURE__*/function () {
58565
- var _ref3 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
58566
- var input, originalHeight, originalOverflow, originalMaxHeight, canvas, imgData, pdf, pdfWidth, pdfHeight, padding, imgProps, imgWidth, imgHeight, heightLeft, _position, _t2;
58567
- return _regenerator().w(function (_context2) {
58568
- while (1) switch (_context2.p = _context2.n) {
59277
+ var _ref4 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3() {
59278
+ var input, originalHeight, originalOverflow, originalMaxHeight, canvas, imgData, pdf, pdfWidth, pdfHeight, padding, imgProps, imgWidth, imgHeight, heightLeft, position, _t2;
59279
+ return _regenerator().w(function (_context3) {
59280
+ while (1) switch (_context3.p = _context3.n) {
58569
59281
  case 0:
58570
- _context2.p = 0;
59282
+ _context3.p = 0;
58571
59283
  setIsFeedbackLoading(true);
58572
59284
  welcomeQuestionRef.current.style.marginLeft = '0px';
58573
59285
  input = messagesContainerRef.current; // Save original styles
@@ -58577,12 +59289,12 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58577
59289
  input.style.height = input.scrollHeight + 'px';
58578
59290
  input.style.overflow = 'visible';
58579
59291
  input.style.maxHeight = 'none';
58580
- _context2.n = 1;
59292
+ _context3.n = 1;
58581
59293
  return new Promise(function (res) {
58582
59294
  return setTimeout(res, 100);
58583
59295
  });
58584
59296
  case 1:
58585
- _context2.n = 2;
59297
+ _context3.n = 2;
58586
59298
  return html2canvas(input, {
58587
59299
  scale: 2,
58588
59300
  useCORS: true,
@@ -58592,7 +59304,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58592
59304
  }
58593
59305
  });
58594
59306
  case 2:
58595
- canvas = _context2.v;
59307
+ canvas = _context3.v;
58596
59308
  imgData = canvas.toDataURL('image/png');
58597
59309
  pdf = new E$1('p', 'mm', 'a4');
58598
59310
  pdfWidth = pdf.internal.pageSize.getWidth();
@@ -58602,13 +59314,13 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58602
59314
  imgWidth = pdfWidth - 2 * padding;
58603
59315
  imgHeight = imgProps.height * imgWidth / imgProps.width;
58604
59316
  heightLeft = imgHeight;
58605
- _position = 0;
58606
- pdf.addImage(imgData, 'PNG', padding, _position, imgWidth, imgHeight);
59317
+ position = 0;
59318
+ pdf.addImage(imgData, 'PNG', padding, position, imgWidth, imgHeight);
58607
59319
  heightLeft -= pdfHeight;
58608
59320
  while (heightLeft > 0) {
58609
- _position = heightLeft - imgHeight;
59321
+ position = heightLeft - imgHeight;
58610
59322
  pdf.addPage();
58611
- pdf.addImage(imgData, 'PNG', padding, _position, imgWidth, imgHeight);
59323
+ pdf.addImage(imgData, 'PNG', padding, position, imgWidth, imgHeight);
58612
59324
  heightLeft -= pdfHeight;
58613
59325
  }
58614
59326
  pdf.save('Conversation.pdf');
@@ -58619,29 +59331,29 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58619
59331
  input.style.maxHeight = originalMaxHeight;
58620
59332
  welcomeQuestionRef.current.style.marginLeft = '36px';
58621
59333
  setIsFeedbackLoading(false);
58622
- _context2.n = 4;
59334
+ _context3.n = 4;
58623
59335
  break;
58624
59336
  case 3:
58625
- _context2.p = 3;
58626
- _t2 = _context2.v;
59337
+ _context3.p = 3;
59338
+ _t2 = _context3.v;
58627
59339
  console.log(_t2);
58628
59340
  welcomeQuestionRef.current.style.marginLeft = '36px';
58629
59341
  setIsFeedbackLoading(false);
58630
59342
  case 4:
58631
- return _context2.a(2);
59343
+ return _context3.a(2);
58632
59344
  }
58633
- }, _callee2, null, [[0, 3]]);
59345
+ }, _callee3, null, [[0, 3]]);
58634
59346
  }));
58635
59347
  return function handleDownload() {
58636
- return _ref3.apply(this, arguments);
59348
+ return _ref4.apply(this, arguments);
58637
59349
  };
58638
59350
  }();
58639
59351
  var updateFeedback = /*#__PURE__*/function () {
58640
- var _ref4 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(feedback, Currentconversation, conversations) {
59352
+ var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(feedback, Currentconversation, conversations) {
58641
59353
  var _storage$getLocalItem3, _storage$getLocalItem4;
58642
59354
  var payload, feedbackEndpoint, endpoint, newConversations, _t3;
58643
- return _regenerator().w(function (_context3) {
58644
- while (1) switch (_context3.p = _context3.n) {
59355
+ return _regenerator().w(function (_context4) {
59356
+ while (1) switch (_context4.p = _context4.n) {
58645
59357
  case 0:
58646
59358
  setMessageError(false);
58647
59359
  payload = {
@@ -58649,17 +59361,17 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58649
59361
  };
58650
59362
  feedbackEndpoint = (_storage$getLocalItem3 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem3 === void 0 ? void 0 : (_storage$getLocalItem4 = _storage$getLocalItem3.endpoints) === null || _storage$getLocalItem4 === void 0 ? void 0 : _storage$getLocalItem4.mihelpChatFeedback;
58651
59363
  if (feedbackEndpoint) {
58652
- _context3.n = 1;
59364
+ _context4.n = 1;
58653
59365
  break;
58654
59366
  }
58655
59367
  console.log('MiHelpAgent: feedback endpoint missing from config');
58656
59368
  setMessageError(true);
58657
- return _context3.a(2);
59369
+ return _context4.a(2);
58658
59370
  case 1:
58659
59371
  endpoint = "".concat(feedbackEndpoint, "/").concat(Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.feedbackId);
58660
59372
  setIsFeedbackLoading(true);
58661
- _context3.p = 2;
58662
- _context3.n = 3;
59373
+ _context4.p = 2;
59374
+ _context4.n = 3;
58663
59375
  return fetcher.put(endpoint, payload, {
58664
59376
  headers: {
58665
59377
  'Content-Type': 'application/json'
@@ -58673,44 +59385,44 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58673
59385
  });
58674
59386
  setConversations(newConversations);
58675
59387
  storage$1.setLocalItem('mihelpAgentConversations', newConversations);
58676
- _context3.n = 5;
59388
+ _context4.n = 5;
58677
59389
  break;
58678
59390
  case 4:
58679
- _context3.p = 4;
58680
- _t3 = _context3.v;
59391
+ _context4.p = 4;
59392
+ _t3 = _context4.v;
58681
59393
  console.log('MiHelpAgent: failed to update feedback', _t3);
58682
59394
  setMessageError(true);
58683
59395
  case 5:
58684
- _context3.p = 5;
59396
+ _context4.p = 5;
58685
59397
  setIsFeedbackLoading(false);
58686
- return _context3.f(5);
59398
+ return _context4.f(5);
58687
59399
  case 6:
58688
- return _context3.a(2);
59400
+ return _context4.a(2);
58689
59401
  }
58690
- }, _callee3, null, [[2, 4, 5, 6]]);
59402
+ }, _callee4, null, [[2, 4, 5, 6]]);
58691
59403
  }));
58692
59404
  return function updateFeedback(_x2, _x3, _x4) {
58693
- return _ref4.apply(this, arguments);
59405
+ return _ref5.apply(this, arguments);
58694
59406
  };
58695
59407
  }();
58696
59408
  var handleFeedback = /*#__PURE__*/function () {
58697
- var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(feedback, Currentconversation, conversations) {
59409
+ var _ref6 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5(feedback, Currentconversation, conversations) {
58698
59410
  var _storage$getLocalItem5, _storage$getLocalItem6;
58699
59411
  var conversationsUntilCurrentMessage, lastFeedbackIndex, chatHistoryAfterLastFeedback, chatHistoryWithoutSystemPrompts, payload, endpoint, response, newConversations, newFeedbacks, _t4;
58700
- return _regenerator().w(function (_context4) {
58701
- while (1) switch (_context4.p = _context4.n) {
59412
+ return _regenerator().w(function (_context5) {
59413
+ while (1) switch (_context5.p = _context5.n) {
58702
59414
  case 0:
58703
59415
  if (!((Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.feedback) === feedback)) {
58704
- _context4.n = 1;
59416
+ _context5.n = 1;
58705
59417
  break;
58706
59418
  }
58707
- return _context4.a(2);
59419
+ return _context5.a(2);
58708
59420
  case 1:
58709
59421
  if (!(Currentconversation !== null && Currentconversation !== void 0 && Currentconversation.feedback)) {
58710
- _context4.n = 2;
59422
+ _context5.n = 2;
58711
59423
  break;
58712
59424
  }
58713
- return _context4.a(2, updateFeedback(feedback, Currentconversation, conversations));
59425
+ return _context5.a(2, updateFeedback(feedback, Currentconversation, conversations));
58714
59426
  case 2:
58715
59427
  setMessageError(false);
58716
59428
  conversationsUntilCurrentMessage = _toConsumableArray(conversations).slice(0, conversations.findIndex(function (c) {
@@ -58735,23 +59447,23 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58735
59447
  };
58736
59448
  endpoint = (_storage$getLocalItem5 = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem5 === void 0 ? void 0 : (_storage$getLocalItem6 = _storage$getLocalItem5.endpoints) === null || _storage$getLocalItem6 === void 0 ? void 0 : _storage$getLocalItem6.mihelpChatFeedback;
58737
59449
  if (endpoint) {
58738
- _context4.n = 3;
59450
+ _context5.n = 3;
58739
59451
  break;
58740
59452
  }
58741
59453
  console.log('MiHelpAgent: feedback endpoint missing from config');
58742
59454
  setMessageError(true);
58743
- return _context4.a(2);
59455
+ return _context5.a(2);
58744
59456
  case 3:
58745
59457
  setIsFeedbackLoading(true);
58746
- _context4.p = 4;
58747
- _context4.n = 5;
59458
+ _context5.p = 4;
59459
+ _context5.n = 5;
58748
59460
  return fetcher.post(endpoint, payload, {
58749
59461
  headers: {
58750
59462
  'Content-Type': 'application/json'
58751
59463
  }
58752
59464
  });
58753
59465
  case 5:
58754
- response = _context4.v;
59466
+ response = _context5.v;
58755
59467
  newConversations = conversations.map(function (conversation) {
58756
59468
  var _response$data3;
58757
59469
  return (conversation === null || conversation === void 0 ? void 0 : conversation.id) === (Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.id) ? _objectSpread2(_objectSpread2({}, conversation), {}, {
@@ -58764,81 +59476,56 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58764
59476
  setConversations(newConversations);
58765
59477
  storage$1.setLocalItem('mihelpAgentConversations', newConversations);
58766
59478
  storage$1.setLocalItem('mihelpAgentFeedbacks', newFeedbacks);
58767
- _context4.n = 7;
59479
+ _context5.n = 7;
58768
59480
  break;
58769
59481
  case 6:
58770
- _context4.p = 6;
58771
- _t4 = _context4.v;
59482
+ _context5.p = 6;
59483
+ _t4 = _context5.v;
58772
59484
  console.log('MiHelpAgent: failed to submit feedback', _t4);
58773
59485
  setMessageError(true);
58774
59486
  case 7:
58775
- _context4.p = 7;
59487
+ _context5.p = 7;
58776
59488
  setIsFeedbackLoading(false);
58777
- return _context4.f(7);
59489
+ return _context5.f(7);
58778
59490
  case 8:
58779
- return _context4.a(2);
59491
+ return _context5.a(2);
58780
59492
  }
58781
- }, _callee4, null, [[4, 6, 7, 8]]);
59493
+ }, _callee5, null, [[4, 6, 7, 8]]);
58782
59494
  }));
58783
59495
  return function handleFeedback(_x5, _x6, _x7) {
58784
- return _ref5.apply(this, arguments);
59496
+ return _ref6.apply(this, arguments);
58785
59497
  };
58786
59498
  }();
58787
- var isChromeOnIPhone = function isChromeOnIPhone() {
58788
- var userAgent = navigator.userAgent;
58789
- var isIPhone = /iPhone/i.test(userAgent);
58790
- var isChrome = /CriOS/i.test(userAgent);
58791
- return isIPhone && isChrome;
58792
- };
58793
- var chatbotUI = /*#__PURE__*/React__default["default"].createElement("div", {
58794
- onMouseDown: handleStart,
58795
- onTouchStart: handleStart,
58796
- style: {
58797
- left: "".concat(position.x, "px"),
58798
- top: "".concat(position.y, "px"),
58799
- cursor: 'grab'
58800
- },
58801
- className: _getClassName("mihelpAgentWrapper ".concat(isChromeOnIPhone() ? 'iphoneChrome' : ''), _styleModuleImportMap$2, {
58802
- "handleMissingStyleName": "warn"
58803
- })
58804
- }, showChatWindow && /*#__PURE__*/React__default["default"].createElement("div", {
59499
+ var chatWindowContent = /*#__PURE__*/React__default["default"].createElement("div", {
58805
59500
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
58806
59501
  style: {
58807
- left: "".concat(chatPosition.x, "px"),
58808
- top: "".concat(chatPosition.y, "px"),
58809
- height: chatWindowHeight
59502
+ height: '100%',
59503
+ width: '100%',
59504
+ position: 'relative',
59505
+ left: 0,
59506
+ top: 0
58810
59507
  }
58811
59508
  }, /*#__PURE__*/React__default["default"].createElement("div", {
58812
59509
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader"
58813
59510
  }, /*#__PURE__*/React__default["default"].createElement("span", {
58814
59511
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--title"
58815
- }, "MiHelp Bot"), /*#__PURE__*/React__default["default"].createElement("span", {
58816
- onClick: function onClick() {
58817
- return setShowChatWindow(false);
58818
- },
58819
- id: "chatCloseIcon"
58820
- }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
58821
- name: "xmark",
58822
- variant: "light",
59512
+ }, "MiHelp Bot"), conversations.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
58823
59513
  style: {
58824
- color: '#fff',
58825
- fontSize: '20px',
58826
- cursor: 'pointer'
59514
+ display: 'flex',
59515
+ gap: '8px',
59516
+ alignItems: 'center'
58827
59517
  }
58828
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
58829
- ref: chatBodyRef,
58830
- className: _getClassName("chatWindowBody ".concat(conversations.length > 0 ? 'newChatVisible' : ''), _styleModuleImportMap$2, {
58831
- "handleMissingStyleName": "warn"
58832
- })
58833
- }, conversations.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
58834
- className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer"
58835
59518
  }, /*#__PURE__*/React__default["default"].createElement("div", {
58836
59519
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton",
58837
- onClick: handleDownload
59520
+ onClick: handleDownload,
59521
+ style: {
59522
+ background: 'transparent',
59523
+ border: '1px solid #D1D1D1',
59524
+ padding: '4px 12px'
59525
+ }
58838
59526
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
58839
59527
  name: "arrow-down-to-line",
58840
59528
  style: {
58841
- color: '#000',
58842
59529
  fontSize: '16px'
58843
59530
  }
58844
59531
  }), /*#__PURE__*/React__default["default"].createElement("span", null, "Export")), /*#__PURE__*/React__default["default"].createElement(coreComponents.Tooltip, {
@@ -58846,14 +59533,23 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58846
59533
  position: "leftCenter"
58847
59534
  }, /*#__PURE__*/React__default["default"].createElement("div", {
58848
59535
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton",
58849
- onClick: handleNewConversation
59536
+ onClick: handleNewConversation,
59537
+ style: {
59538
+ background: 'transparent',
59539
+ border: '1px solid #D1D1D1',
59540
+ padding: '4px 12px'
59541
+ }
58850
59542
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
58851
59543
  name: "rotate-right",
58852
59544
  style: {
58853
- color: '#000',
58854
59545
  fontSize: '16px'
58855
59546
  }
58856
- }), /*#__PURE__*/React__default["default"].createElement("span", null, "Restart Chat")))), /*#__PURE__*/React__default["default"].createElement("div", {
59547
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, "Restart"))))), /*#__PURE__*/React__default["default"].createElement("div", {
59548
+ ref: chatBodyRef,
59549
+ className: _getClassName("chatWindowBody", _styleModuleImportMap$2, {
59550
+ "handleMissingStyleName": "warn"
59551
+ })
59552
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
58857
59553
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messagesContainer",
58858
59554
  ref: messagesContainerRef
58859
59555
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -58875,10 +59571,14 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58875
59571
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble"
58876
59572
  }, /*#__PURE__*/React__default["default"].createElement("p", {
58877
59573
  "data-chat-id": "agent-message-2"
58878
- }, "How can I help you today?")))), !conversations.length && /*#__PURE__*/React__default["default"].createElement("div", {
59574
+ }, "How can I help you today?")))), !conversations.length && !activeFlow && /*#__PURE__*/React__default["default"].createElement("div", {
58879
59575
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions"
58880
59576
  }, quickReplyList.map(function (reply, i) {
59577
+ // Handle both string and object types
59578
+ var replyText = typeof reply === 'string' ? reply : reply.type === 'quickReply' ? reply.text : reply.type === 'flow' ? reply.initialMessage || reply.id : '';
59579
+ var replyKey = _typeof$1(reply) === 'object' && reply.id ? reply.id : i;
58881
59580
  return /*#__PURE__*/React__default["default"].createElement("div", {
59581
+ key: replyKey,
58882
59582
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionWrapper"
58883
59583
  }, /*#__PURE__*/React__default["default"].createElement("div", {
58884
59584
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionContainer"
@@ -58889,7 +59589,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58889
59589
  }
58890
59590
  }, /*#__PURE__*/React__default["default"].createElement("p", {
58891
59591
  "data-chat-id": "quickReply-message-".concat(i + 1)
58892
- }, reply))));
59592
+ }, replyText))));
58893
59593
  })), function () {
58894
59594
  var userCount = 0;
58895
59595
  var agentCount = 2;
@@ -58946,7 +59646,12 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58946
59646
  "data-chat-id": testId
58947
59647
  }, conversation === null || conversation === void 0 ? void 0 : conversation.content)));
58948
59648
  });
58949
- }(), isLoading && /*#__PURE__*/React__default["default"].createElement("div", {
59649
+ }(), activeFlow && flowHook.currentStep && /*#__PURE__*/React__default["default"].createElement(FlowStepRenderer, {
59650
+ step: flowHook.currentStep,
59651
+ flowData: flowHook.flowData,
59652
+ handlers: flowHook,
59653
+ isComplete: flowHook.isComplete
59654
+ }), isLoading && /*#__PURE__*/React__default["default"].createElement("div", {
58950
59655
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message"
58951
59656
  }, /*#__PURE__*/React__default["default"].createElement("img", {
58952
59657
  src: "/assets/images/mihelpIcons/icon-sparkle.svg",
@@ -58980,10 +59685,15 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58980
59685
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowFooter"
58981
59686
  }, /*#__PURE__*/React__default["default"].createElement("div", {
58982
59687
  ref: inputContainerRef,
58983
- className: _getClassName("inputContainer ".concat(collectionError ? 'disabled' : ''), _styleModuleImportMap$2, {
59688
+ onClick: function onClick() {
59689
+ var _inputRef$current;
59690
+ return !activeFlow && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus());
59691
+ },
59692
+ className: _getClassName("inputContainer ".concat(collectionError || activeFlow !== null ? 'disabled' : ''), _styleModuleImportMap$2, {
58984
59693
  "handleMissingStyleName": "warn"
58985
59694
  })
58986
59695
  }, /*#__PURE__*/React__default["default"].createElement("input", {
59696
+ ref: inputRef,
58987
59697
  type: "text",
58988
59698
  placeholder: "Ask a Question",
58989
59699
  value: message,
@@ -58991,10 +59701,13 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58991
59701
  return setMessage(e.target.value);
58992
59702
  },
58993
59703
  onKeyUp: handleKeyup,
58994
- disabled: collectionError
59704
+ disabled: collectionError || activeFlow !== null
58995
59705
  }), /*#__PURE__*/React__default["default"].createElement("span", {
58996
- onClick: function onClick() {
58997
- return handleReply(message);
59706
+ onClick: function onClick(e) {
59707
+ e.stopPropagation();
59708
+ if (!activeFlow) {
59709
+ handleReply(message);
59710
+ }
58998
59711
  }
58999
59712
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59000
59713
  name: "paper-plane-top",
@@ -59002,26 +59715,33 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59002
59715
  style: {
59003
59716
  color: '#616161',
59004
59717
  fontSize: '20px',
59005
- cursor: isLoading || collectionError ? 'auto' : 'pointer'
59718
+ cursor: isLoading || collectionError || activeFlow !== null ? 'auto' : 'pointer'
59006
59719
  },
59007
- disabled: isLoading || collectionError
59720
+ disabled: isLoading || collectionError || activeFlow !== null
59008
59721
  })))), isFeedbackLoading && /*#__PURE__*/React__default["default"].createElement("div", {
59009
59722
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner",
59010
59723
  ref: spinnerRef
59011
59724
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.Spinner, {
59012
59725
  size: "60px"
59013
- }))), /*#__PURE__*/React__default["default"].createElement("span", {
59014
- className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
59015
- onClick: handleChatIconClick
59016
- }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59017
- name: "comment-sparkle-custom",
59018
- variant: "light",
59019
- style: {
59020
- color: '#fff',
59021
- fontSize: '22px'
59022
- }
59023
59726
  })));
59024
- return ReactDOM__default["default"].createPortal(chatbotUI, document.body);
59727
+ return /*#__PURE__*/React__default["default"].createElement("div", {
59728
+ onClick: function onClick() {
59729
+ return setChatBotVisible && setChatBotVisible(false);
59730
+ },
59731
+ className: _getClassName("sidebarWrapper ".concat(chatBotVisible ? 'visible' : 'hidden'), _styleModuleImportMap$2, {
59732
+ "handleMissingStyleName": "warn"
59733
+ })
59734
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
59735
+ onClick: function onClick(e) {
59736
+ return e.stopPropagation();
59737
+ },
59738
+ style: {
59739
+ height: "calc(100dvh - ".concat(notificationsCount ? sideBarTopValue : 48, "px)")
59740
+ },
59741
+ className: _getClassName("sidebarPanel ".concat(chatBotVisible ? 'visible' : 'hidden'), _styleModuleImportMap$2, {
59742
+ "handleMissingStyleName": "warn"
59743
+ })
59744
+ }, chatWindowContent));
59025
59745
  };
59026
59746
 
59027
59747
  /**
@@ -70311,9 +71031,9 @@ var AppFrame = function AppFrame(props) {
70311
71031
  chatBotEnabled = _useState4[0],
70312
71032
  setChatBotEnabled = _useState4[1];
70313
71033
  var _useState5 = React.useState(false),
70314
- _useState6 = _slicedToArray(_useState5, 2),
70315
- isLandscapeInMobile = _useState6[0],
70316
- setIsLandscapeInMobile = _useState6[1];
71034
+ _useState6 = _slicedToArray(_useState5, 2);
71035
+ _useState6[0];
71036
+ var setIsLandscapeInMobile = _useState6[1];
70317
71037
  // const [activeSubmenu, setActiveSubmenu] = useState(null)
70318
71038
  var _useState7 = React.useState([]),
70319
71039
  _useState8 = _slicedToArray(_useState7, 2),
@@ -70328,6 +71048,18 @@ var AppFrame = function AppFrame(props) {
70328
71048
  _useState10 = _slicedToArray(_useState1, 2),
70329
71049
  isNavBarOpen = _useState10[0],
70330
71050
  setIsNavBarOpen = _useState10[1];
71051
+ var _useState11 = React.useState(false),
71052
+ _useState12 = _slicedToArray(_useState11, 2),
71053
+ chatBotVisible = _useState12[0],
71054
+ setChatBotVisible = _useState12[1];
71055
+ var _useState13 = React.useState(0),
71056
+ _useState14 = _slicedToArray(_useState13, 2),
71057
+ notificationsCount = _useState14[0],
71058
+ setNotificationsCount = _useState14[1];
71059
+ var _useState15 = React.useState(0),
71060
+ _useState16 = _slicedToArray(_useState15, 2),
71061
+ sideBarTopValue = _useState16[0],
71062
+ setSideBarTopValue = _useState16[1];
70331
71063
  var setChatBotEnableStatus = function setChatBotEnableStatus() {
70332
71064
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
70333
71065
  var tileData = findAppData(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || {};
@@ -70445,7 +71177,13 @@ var AppFrame = function AppFrame(props) {
70445
71177
  ActionComponent: props === null || props === void 0 ? void 0 : props.ActionComponent,
70446
71178
  searchComponent: props.searchComponent,
70447
71179
  showNavIconInHeader: props === null || props === void 0 ? void 0 : props.showNavIconInHeader,
70448
- setIsNavBarOpen: setIsNavBarOpen
71180
+ setIsNavBarOpen: setIsNavBarOpen,
71181
+ chatBotVisible: chatBotVisible,
71182
+ setChatBotVisible: setChatBotVisible,
71183
+ onNotificationsAndHeightChange: function onNotificationsAndHeightChange(count, height) {
71184
+ setNotificationsCount(count || 0);
71185
+ setSideBarTopValue(height || 0);
71186
+ }
70449
71187
  })), /*#__PURE__*/React__default["default"].createElement("main", {
70450
71188
  className: "utilities_ops-app-frame_AppFrame_AppFrame--AppContainer"
70451
71189
  }, props.showNavigation && storage$1.isAuthenticated ? /*#__PURE__*/React__default["default"].createElement(NavigationBar, {
@@ -70466,12 +71204,19 @@ var AppFrame = function AppFrame(props) {
70466
71204
  isNavBarOpen: isNavBarOpen,
70467
71205
  showLevel3Navigation: props.showLevel3Navigation
70468
71206
  }) : null, /*#__PURE__*/React__default["default"].createElement("div", {
71207
+ style: {
71208
+ display: 'flex',
71209
+ height: '100%',
71210
+ position: 'relative'
71211
+ }
71212
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
70469
71213
  style: {
70470
71214
  marginLeft: props.showNavigation && !(props !== null && props !== void 0 && props.showNavIconInHeader) ? navigationWidth : '0px',
70471
71215
  height: '100%',
70472
- transition: 'all 0.5s ease-in-out'
71216
+ transition: 'all 0.5s ease-in-out',
71217
+ flex: 1
70473
71218
  }
70474
- }, props.children), chatBotEnabled && !isLandscapeInMobile && /*#__PURE__*/React__default["default"].createElement(MiHelpAgent, {
71219
+ }, props.children), chatBotEnabled && /*#__PURE__*/React__default["default"].createElement(MiHelpAgent, {
70475
71220
  quickReplies: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro = props.mihelpAgentProps) === null || _props$mihelpAgentPro === void 0 ? void 0 : _props$mihelpAgentPro.quickReplies,
70476
71221
  collection: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro2 = props.mihelpAgentProps) === null || _props$mihelpAgentPro2 === void 0 ? void 0 : _props$mihelpAgentPro2.collection,
70477
71222
  systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt,
@@ -70479,8 +71224,12 @@ var AppFrame = function AppFrame(props) {
70479
71224
  contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.contextMessagesCount,
70480
71225
  contextTopMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro6 = props.mihelpAgentProps) === null || _props$mihelpAgentPro6 === void 0 ? void 0 : _props$mihelpAgentPro6.contextTopMessagesCount,
70481
71226
  contextChunks: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro7 = props.mihelpAgentProps) === null || _props$mihelpAgentPro7 === void 0 ? void 0 : _props$mihelpAgentPro7.contextChunksCount,
70482
- mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro8 = props.mihelpAgentProps) === null || _props$mihelpAgentPro8 === void 0 ? void 0 : _props$mihelpAgentPro8.mihelpAgentRef
70483
- })))))));
71227
+ mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro8 = props.mihelpAgentProps) === null || _props$mihelpAgentPro8 === void 0 ? void 0 : _props$mihelpAgentPro8.mihelpAgentRef,
71228
+ chatBotVisible: chatBotVisible,
71229
+ setChatBotVisible: setChatBotVisible,
71230
+ notificationsCount: notificationsCount,
71231
+ sideBarTopValue: sideBarTopValue
71232
+ }))))))));
70484
71233
  };
70485
71234
  AppFrame.defaultProps = {
70486
71235
  handleScrolling: true,