@copart/ops-tool-kit 1.12.12-beta.2 → 1.12.13-alpha.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.12-beta.2";
50
+ const version$8 = "1.12.13-alpha.1";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -2622,6 +2622,12 @@ var createOpsStorage = function createOpsStorage() {
2622
2622
  get userEmail() {
2623
2623
  return getLocalItem('login', 'userData.entity_mail');
2624
2624
  },
2625
+ get userCopartId() {
2626
+ return getLocalItem('login', 'userData.entity_employee_copart_id');
2627
+ },
2628
+ get userSamAccount() {
2629
+ return getLocalItem('login', 'userData.entity_sam_id');
2630
+ },
2625
2631
  get userCountry() {
2626
2632
  return getLocalItem('login', 'userData.entity_country');
2627
2633
  },
@@ -2855,10 +2861,10 @@ var BreadcrumbsProvider = /*#__PURE__*/function (_React$Component) {
2855
2861
  }(React__namespace.Component);
2856
2862
 
2857
2863
  var _class;
2858
- var _excluded$5 = ["breadcrumbs"];
2864
+ var _excluded$4 = ["breadcrumbs"];
2859
2865
  var getCrumbProps = function getCrumbProps(props) {
2860
2866
  props.breadcrumbs;
2861
- var crumbProps = _objectWithoutProperties(props, _excluded$5);
2867
+ var crumbProps = _objectWithoutProperties(props, _excluded$4);
2862
2868
  return crumbProps;
2863
2869
  };
2864
2870
  var Crumb = withBreadcrumbs(_class = /*#__PURE__*/function (_React$Component) {
@@ -21417,13 +21423,15 @@ var LogOutMenu = function LogOutMenu(_ref) {
21417
21423
  availableStatuses = _ref$availableStatuse === void 0 ? [] : _ref$availableStatuse,
21418
21424
  currentUserStatus = _ref.currentUserStatus;
21419
21425
  var getStatusColor = function getStatusColor() {
21426
+ var _currentUserStatus$to;
21420
21427
  if (!currentUserStatus || !Array.isArray(availableStatuses)) {
21421
21428
  return '#9A9B98'; // Default color
21422
21429
  }
21423
21430
  var statusObj = availableStatuses.find(function (status) {
21424
21431
  return status.status === currentUserStatus;
21425
21432
  });
21426
- return (statusObj === null || statusObj === void 0 ? void 0 : statusObj.colour) || '#BC2F32';
21433
+ var defaultColor = currentUserStatus !== null && currentUserStatus !== void 0 && (_currentUserStatus$to = currentUserStatus.toLowerCase()) !== null && _currentUserStatus$to !== void 0 && _currentUserStatus$to.includes("system") ? "#9A9B98" : '#BC2F32';
21434
+ return (statusObj === null || statusObj === void 0 ? void 0 : statusObj.colour) || defaultColor;
21427
21435
  };
21428
21436
  var statusColor = getStatusColor();
21429
21437
 
@@ -21483,9 +21491,10 @@ var ProfileDetails = function ProfileDetails(_ref) {
21483
21491
  return status.status === currentUserStatus;
21484
21492
  });
21485
21493
  if (!statusExists) {
21494
+ var _currentUserStatus$to;
21486
21495
  return [].concat(_toConsumableArray(availableStatuses), [{
21487
21496
  status: currentUserStatus,
21488
- colour: '#BC2F32',
21497
+ colour: currentUserStatus !== null && currentUserStatus !== void 0 && (_currentUserStatus$to = currentUserStatus.toLowerCase()) !== null && _currentUserStatus$to !== void 0 && _currentUserStatus$to.includes("system") ? "#9A9B98" : '#BC2F32',
21489
21498
  disabled: true
21490
21499
  }]);
21491
21500
  }
@@ -23566,7 +23575,7 @@ var RoleSelector$2 = function RoleSelector(_ref) {
23566
23575
  }));
23567
23576
  };
23568
23577
 
23569
- var _excluded$4 = ["selectedYard", "name", "handleChange", "yardOptions", "label"];
23578
+ var _excluded$3 = ["selectedYard", "name", "handleChange", "yardOptions", "label"];
23570
23579
  var getDescription = function getDescription(yardOptions) {
23571
23580
  return function (code) {
23572
23581
  return yardOptions[code].yard_number;
@@ -23582,7 +23591,7 @@ var YardNumberMenu$2 = function YardNumberMenu(_ref) {
23582
23591
  handleChange = _ref.handleChange,
23583
23592
  yardOptions = _ref.yardOptions,
23584
23593
  label = _ref.label,
23585
- otherProps = _objectWithoutProperties(_ref, _excluded$4);
23594
+ otherProps = _objectWithoutProperties(_ref, _excluded$3);
23586
23595
  return /*#__PURE__*/React__default["default"].createElement("div", {
23587
23596
  className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
23588
23597
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
@@ -24526,14 +24535,14 @@ var HierarchyMenu = function HierarchyMenu(props) {
24526
24535
  });
24527
24536
  };
24528
24537
 
24529
- var _excluded$3 = ["value", "handleChange", "yardOptions", "label", "disabled"];
24538
+ var _excluded$2 = ["value", "handleChange", "yardOptions", "label", "disabled"];
24530
24539
  var YardNumberMenu$1 = function YardNumberMenu(_ref) {
24531
24540
  var value = _ref.value,
24532
24541
  handleChange = _ref.handleChange,
24533
24542
  yardOptions = _ref.yardOptions;
24534
24543
  _ref.label;
24535
24544
  var disabled = _ref.disabled,
24536
- otherProps = _objectWithoutProperties(_ref, _excluded$3);
24545
+ otherProps = _objectWithoutProperties(_ref, _excluded$2);
24537
24546
  return /*#__PURE__*/React__default["default"].createElement("div", {
24538
24547
  className: "utilities_ops-app-frame_AppBarComponent_Settings_SettingsView--col-1-1"
24539
24548
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.AutoSelect, _extends$1({}, otherProps, {
@@ -32160,7 +32169,7 @@ var useWindowSize = function useWindowSize() {
32160
32169
  return windowSize;
32161
32170
  };
32162
32171
 
32163
- var _excluded$2 = ["count", "current", "showNavButtons", "onLeftButtonClick", "onRightButtonClick", "saveActionComponentState", "ActionComponent", "notificationsTopContainerRef", "mobileNotificationsTopContainerRef", "setNotificationHeightFlag"];
32172
+ var _excluded$1 = ["count", "current", "showNavButtons", "onLeftButtonClick", "onRightButtonClick", "saveActionComponentState", "ActionComponent", "notificationsTopContainerRef", "mobileNotificationsTopContainerRef", "setNotificationHeightFlag"];
32164
32173
  var alertBackgroundColorMapping = {
32165
32174
  alert: '#fab9b9',
32166
32175
  warning: '#f5f5cb',
@@ -32229,7 +32238,7 @@ var Banner = function Banner(props) {
32229
32238
  notificationsTopContainerRef = props.notificationsTopContainerRef,
32230
32239
  mobileNotificationsTopContainerRef = props.mobileNotificationsTopContainerRef,
32231
32240
  setNotificationHeightFlag = props.setNotificationHeightFlag,
32232
- notification = _objectWithoutProperties(props, _excluded$2);
32241
+ notification = _objectWithoutProperties(props, _excluded$1);
32233
32242
  var dismissibleFlag = notification.dismissibleFlag,
32234
32243
  onDismiss = notification.onDismiss,
32235
32244
  startsAt = notification.startsAt,
@@ -32728,8 +32737,7 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
32728
32737
  props.setSettingsVisible;
32729
32738
  var handleIconClick = props.handleIconClick,
32730
32739
  ideaNoteVisible = props.ideaNoteVisible,
32731
- mobileMenuVisible = props.mobileMenuVisible,
32732
- chatBotVisible = props.chatBotVisible;
32740
+ mobileMenuVisible = props.mobileMenuVisible;
32733
32741
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
32734
32742
  var enableNewToolkitFeatures = coreAppConfig.enableNewToolkitFeatures,
32735
32743
  showSettingsMenuByTileConfig = coreAppConfig.showSettingsMenuByTileConfig,
@@ -33010,23 +33018,6 @@ var generateAppBarElements = function generateAppBarElements(props, showCallout)
33010
33018
  mobileMenuVisible: mobileMenuVisible
33011
33019
  });
33012
33020
  }
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
- }
33030
33021
  },
33031
33022
  // {
33032
33023
  // key: 'phoneStatus',
@@ -33150,8 +33141,7 @@ var ICONS = {
33150
33141
  IDEANOTE: 'IDEANOTE',
33151
33142
  SETTINGS: 'SETTINGS',
33152
33143
  MIHELP: 'MIHELP',
33153
- MOBILE_MENU: 'MOBILE_MENU',
33154
- CHATBOT: 'CHATBOT'
33144
+ MOBILE_MENU: 'MOBILE_MENU'
33155
33145
  };
33156
33146
  var AppBar$1 = function AppBar(props) {
33157
33147
  var _window$toolkitEnv4;
@@ -33225,9 +33215,7 @@ var AppBar$1 = function AppBar(props) {
33225
33215
  setIsNavBarOpen = props.setIsNavBarOpen,
33226
33216
  availableStatuses = props.availableStatuses,
33227
33217
  currentUserStatus = props.currentUserStatus,
33228
- onUserStatusUpdate = props.onUserStatusUpdate,
33229
- chatBotVisible = props.chatBotVisible,
33230
- setChatBotVisible = props.setChatBotVisible;
33218
+ onUserStatusUpdate = props.onUserStatusUpdate;
33231
33219
  var _useWindowSize = useWindowSize(),
33232
33220
  width = _useWindowSize.width;
33233
33221
  _useWindowSize.height;
@@ -33314,16 +33302,6 @@ var AppBar$1 = function AppBar(props) {
33314
33302
  }, [ideaNoteVisible]);
33315
33303
  var handleIconClick = function handleIconClick(icon) {
33316
33304
  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;
33327
33305
  case ICONS.SEARCH:
33328
33306
  setShowSearchContainer(function (showSearchContainer) {
33329
33307
  return !showSearchContainer;
@@ -33536,8 +33514,7 @@ var AppBar$1 = function AppBar(props) {
33536
33514
  setSettingsVisible: setSettingsVisible,
33537
33515
  handleIconClick: handleIconClick,
33538
33516
  ideaNoteVisible: ideaNoteVisible,
33539
- mobileMenuVisible: mobileMenuVisible,
33540
- chatBotVisible: chatBotVisible
33517
+ mobileMenuVisible: mobileMenuVisible
33541
33518
  })),
33542
33519
  overflowSetStyles: overflowSetStyles,
33543
33520
  overflowIcon: "CollapseMenu",
@@ -35179,6 +35156,41 @@ function LatestReleaseDialog(_ref) {
35179
35156
  })))));
35180
35157
  }
35181
35158
 
35159
+ var SystemOfflineDialog = function SystemOfflineDialog(_ref) {
35160
+ var isOpen = _ref.isOpen,
35161
+ onClose = _ref.onClose,
35162
+ onMakeAvailable = _ref.onMakeAvailable,
35163
+ onStayOffline = _ref.onStayOffline;
35164
+ var handleStayOffline = function handleStayOffline() {
35165
+ onStayOffline === null || onStayOffline === void 0 ? void 0 : onStayOffline();
35166
+ onClose === null || onClose === void 0 ? void 0 : onClose();
35167
+ };
35168
+ var handleMakeAvailable = function handleMakeAvailable() {
35169
+ onMakeAvailable === null || onMakeAvailable === void 0 ? void 0 : onMakeAvailable();
35170
+ onClose === null || onClose === void 0 ? void 0 : onClose();
35171
+ };
35172
+ return /*#__PURE__*/React__default["default"].createElement(coreComponents.Dialog, {
35173
+ title: "The system marked you as offline",
35174
+ isOpen: isOpen,
35175
+ dismiss: handleStayOffline
35176
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
35177
+ style: {
35178
+ padding: '20px'
35179
+ }
35180
+ }, /*#__PURE__*/React__default["default"].createElement("p", null, "You've been marked offline by the system. Would you like to make yourself available?"), /*#__PURE__*/React__default["default"].createElement("div", {
35181
+ style: {
35182
+ display: 'flex',
35183
+ justifyContent: 'flex-end',
35184
+ marginTop: '16px'
35185
+ }
35186
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.Button, {
35187
+ primary: true,
35188
+ onClick: handleMakeAvailable
35189
+ }, "Yes"), /*#__PURE__*/React__default["default"].createElement(coreComponents.Button, {
35190
+ onClick: handleStayOffline
35191
+ }, "Stay offline"))));
35192
+ };
35193
+
35182
35194
  var naiveFallback = function () {
35183
35195
  if (typeof self === "object" && self) return self;
35184
35196
  if (typeof window === "object" && window) return window;
@@ -35645,7 +35657,7 @@ var fetchAvailableStatuses = /*#__PURE__*/function () {
35645
35657
  coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
35646
35658
  endpoints = coreAppConfig.endpoints;
35647
35659
  email = storage$1.userEmail || '';
35648
- endpoint = frontEndUtils.string.substitute(endpoints.getAvailableStatusesByUser, {
35660
+ endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getAvailableStatusesByUser, {
35649
35661
  email: email
35650
35662
  });
35651
35663
  _context.p = 1;
@@ -35678,7 +35690,7 @@ var fetchUserStatus = /*#__PURE__*/function () {
35678
35690
  coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
35679
35691
  endpoints = coreAppConfig.endpoints;
35680
35692
  email = storage$1.userEmail || '';
35681
- endpoint = frontEndUtils.string.substitute(endpoints.getUserStatus, {
35693
+ endpoint = frontEndUtils.string.substitute(endpoints === null || endpoints === void 0 ? void 0 : endpoints.getUserStatus, {
35682
35694
  email: email
35683
35695
  });
35684
35696
  _context2.p = 1;
@@ -35710,7 +35722,7 @@ var updateUserStatus = /*#__PURE__*/function () {
35710
35722
  case 0:
35711
35723
  coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
35712
35724
  endpoints = coreAppConfig.endpoints;
35713
- endpoint = endpoints.updateUserStatus;
35725
+ endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.updateUserStatus;
35714
35726
  requestBody = {
35715
35727
  status: statusId,
35716
35728
  email: storage$1.userEmail,
@@ -35738,6 +35750,359 @@ var updateUserStatus = /*#__PURE__*/function () {
35738
35750
  return _ref3.apply(this, arguments);
35739
35751
  };
35740
35752
  }();
35753
+ var sendHeartBeat = /*#__PURE__*/function () {
35754
+ var _ref4 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4() {
35755
+ var coreAppConfig, endpoints, endpoint, requestBody, _t4;
35756
+ return _regenerator().w(function (_context4) {
35757
+ while (1) switch (_context4.p = _context4.n) {
35758
+ case 0:
35759
+ coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
35760
+ endpoints = coreAppConfig.endpoints;
35761
+ endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendHeartBeat;
35762
+ requestBody = {
35763
+ email: storage$1.userEmail,
35764
+ timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
35765
+ copartId: storage$1.userCopartId,
35766
+ samAccount: storage$1.userSamAccount
35767
+ };
35768
+ _context4.p = 1;
35769
+ _context4.n = 2;
35770
+ return fetcher.post(endpoint, requestBody);
35771
+ case 2:
35772
+ _context4.n = 4;
35773
+ break;
35774
+ case 3:
35775
+ _context4.p = 3;
35776
+ _t4 = _context4.v;
35777
+ console.error('Failed to send heart beat:', _t4);
35778
+ case 4:
35779
+ return _context4.a(2);
35780
+ }
35781
+ }, _callee4, null, [[1, 3]]);
35782
+ }));
35783
+ return function sendHeartBeat() {
35784
+ return _ref4.apply(this, arguments);
35785
+ };
35786
+ }();
35787
+ var sendUserInteractionEvent = /*#__PURE__*/function () {
35788
+ var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5() {
35789
+ var didInteract,
35790
+ coreAppConfig,
35791
+ endpoints,
35792
+ endpoint,
35793
+ requestBody,
35794
+ _args5 = arguments,
35795
+ _t5;
35796
+ return _regenerator().w(function (_context5) {
35797
+ while (1) switch (_context5.p = _context5.n) {
35798
+ case 0:
35799
+ didInteract = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
35800
+ coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
35801
+ endpoints = coreAppConfig.endpoints;
35802
+ endpoint = endpoints === null || endpoints === void 0 ? void 0 : endpoints.sendUserInteractionEvent;
35803
+ requestBody = {
35804
+ email: storage$1.userEmail,
35805
+ timeStamp: moment.utc().format('YYYY-MM-DD HH:mm:ss'),
35806
+ copartId: storage$1.userCopartId,
35807
+ samAccount: storage$1.userSamAccount,
35808
+ userConnectivity: didInteract
35809
+ };
35810
+ _context5.p = 1;
35811
+ _context5.n = 2;
35812
+ return fetcher.post(endpoint, requestBody);
35813
+ case 2:
35814
+ _context5.n = 4;
35815
+ break;
35816
+ case 3:
35817
+ _context5.p = 3;
35818
+ _t5 = _context5.v;
35819
+ console.error('Failed to send user interaction event:', _t5);
35820
+ case 4:
35821
+ return _context5.a(2);
35822
+ }
35823
+ }, _callee5, null, [[1, 3]]);
35824
+ }));
35825
+ return function sendUserInteractionEvent() {
35826
+ return _ref5.apply(this, arguments);
35827
+ };
35828
+ }();
35829
+
35830
+ /**
35831
+ * Single-heartbeat / single-user-interaction across tabs (leader election)
35832
+ * - One tab becomes leader and sends heartbeat + user interaction events
35833
+ * - Other tabs are followers
35834
+ * - If leader dies, re-election happens automatically
35835
+ * - Uses BroadcastChannel + localStorage (works in Chrome, Edge, Firefox, Safari 15.4+)
35836
+ */
35837
+
35838
+ var LOCK_KEY_PREFIX = 'ops_hb_leader_lock:';
35839
+ var CHANNEL_PREFIX = 'ops_hb_channel:';
35840
+ var LAST_INTERACTION_KEY_PREFIX = 'ops_hb_last_interaction:';
35841
+ var LOCK_TTL_MS = 15000;
35842
+ var RENEW_EVERY_MS = 5000;
35843
+ var ELECTION_INTERVAL_MS = 4000;
35844
+ var JITTER_MS = 800;
35845
+ var STORAGE_TEST_KEY = 'ops_hb_storage_test';
35846
+ var isStorageAvailable = function isStorageAvailable() {
35847
+ try {
35848
+ localStorage.setItem(STORAGE_TEST_KEY, '1');
35849
+ var ok = localStorage.getItem(STORAGE_TEST_KEY) === '1';
35850
+ localStorage.removeItem(STORAGE_TEST_KEY);
35851
+ return ok;
35852
+ } catch (error) {
35853
+ console.error('[TabLeaderCoordinator] Storage availability check failed:', error);
35854
+ return false;
35855
+ }
35856
+ };
35857
+ var getTabId = function getTabId() {
35858
+ if (typeof crypto !== 'undefined' && crypto.randomUUID) {
35859
+ return crypto.randomUUID();
35860
+ }
35861
+ return "tab_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2));
35862
+ };
35863
+
35864
+ // In-memory fallback when localStorage is disabled (per-tab)
35865
+ var fallbackInteractionStore = new Map();
35866
+
35867
+ /**
35868
+ * Records user interaction timestamp. Call from ANY tab on user interaction.
35869
+ * When localStorage works: leader reads this to determine if user was active.
35870
+ * When localStorage disabled: each tab uses its own in-memory store for per-tab fallback.
35871
+ * @param {string} userKey - Unique user identifier (e.g. email)
35872
+ */
35873
+ var recordUserInteraction = function recordUserInteraction(userKey) {
35874
+ if (!userKey) return;
35875
+ var ts = Date.now();
35876
+ var key = "".concat(LAST_INTERACTION_KEY_PREFIX).concat(userKey);
35877
+ try {
35878
+ localStorage.setItem(key, String(ts));
35879
+ } catch (error) {
35880
+ console.error('[TabLeaderCoordinator] recordUserInteraction localStorage failed:', error);
35881
+ fallbackInteractionStore.set(userKey, ts);
35882
+ }
35883
+ };
35884
+ var getLastInteractionTime = function getLastInteractionTime(userKey, useFallback) {
35885
+ if (useFallback) {
35886
+ return fallbackInteractionStore.get(userKey) || null;
35887
+ }
35888
+ try {
35889
+ var val = localStorage.getItem("".concat(LAST_INTERACTION_KEY_PREFIX).concat(userKey));
35890
+ return val ? parseInt(val, 10) : null;
35891
+ } catch (error) {
35892
+ console.error('[TabLeaderCoordinator] getLastInteractionTime failed:', error);
35893
+ return null;
35894
+ }
35895
+ };
35896
+
35897
+ /**
35898
+ * Starts the tab leader coordinator. Only the leader tab will call onHeartbeat and onUserInteractionCheck.
35899
+ * When localStorage is disabled (e.g. strict privacy mode), falls back to per-tab behavior: each tab sends
35900
+ * heartbeat and user interaction events independently.
35901
+ * @param {Object} options
35902
+ * @param {() => Promise<void>} options.onHeartbeat - Called periodically by leader
35903
+ * @param {(didInteract: boolean) => Promise<void>} options.onUserInteractionCheck - Called periodically by leader with interaction status
35904
+ * @param {number} options.heartBeatIntervalMs - Heartbeat interval in ms
35905
+ * @param {number} options.userInteractionIntervalMs - User interaction check interval in ms
35906
+ * @param {string} options.userKey - User identifier for lock/channel keys (e.g. storage.userEmail)
35907
+ * @returns {() => void} Stop function - call to release lock and cleanup
35908
+ */
35909
+ var startTabLeaderCoordinator = function startTabLeaderCoordinator(_ref) {
35910
+ var onHeartbeat = _ref.onHeartbeat,
35911
+ onUserInteractionCheck = _ref.onUserInteractionCheck,
35912
+ heartBeatIntervalMs = _ref.heartBeatIntervalMs,
35913
+ userInteractionIntervalMs = _ref.userInteractionIntervalMs,
35914
+ userKey = _ref.userKey;
35915
+ if (!userKey) return function () {};
35916
+ var runPerTabFallback = function runPerTabFallback() {
35917
+ onHeartbeat === null || onHeartbeat === void 0 ? void 0 : onHeartbeat().catch(function (error) {
35918
+ console.error('[TabLeaderCoordinator] onHeartbeat failed:', error);
35919
+ });
35920
+ var hadInteraction = function hadInteraction() {
35921
+ var last = getLastInteractionTime(userKey, true);
35922
+ if (last == null) return false;
35923
+ return Date.now() - last < userInteractionIntervalMs;
35924
+ };
35925
+ onUserInteractionCheck === null || onUserInteractionCheck === void 0 ? void 0 : onUserInteractionCheck(hadInteraction()).catch(function (error) {
35926
+ console.error('[TabLeaderCoordinator] onUserInteractionCheck failed:', error);
35927
+ });
35928
+ var hbTimer = setInterval(function () {
35929
+ return onHeartbeat === null || onHeartbeat === void 0 ? void 0 : onHeartbeat().catch(function (error) {
35930
+ console.error('[TabLeaderCoordinator] onHeartbeat failed:', error);
35931
+ });
35932
+ }, heartBeatIntervalMs);
35933
+ var interactionTimer = setInterval(function () {
35934
+ onUserInteractionCheck === null || onUserInteractionCheck === void 0 ? void 0 : onUserInteractionCheck(hadInteraction()).catch(function (error) {
35935
+ console.error('[TabLeaderCoordinator] onUserInteractionCheck failed:', error);
35936
+ });
35937
+ }, userInteractionIntervalMs);
35938
+ return function () {
35939
+ clearInterval(hbTimer);
35940
+ clearInterval(interactionTimer);
35941
+ };
35942
+ };
35943
+ if (!isStorageAvailable()) {
35944
+ return runPerTabFallback();
35945
+ }
35946
+ var LOCK_KEY = "".concat(LOCK_KEY_PREFIX).concat(userKey);
35947
+ var CH_NAME = "".concat(CHANNEL_PREFIX).concat(userKey);
35948
+ var TAB_ID = getTabId();
35949
+ var bc = null;
35950
+ try {
35951
+ bc = typeof BroadcastChannel !== 'undefined' ? new BroadcastChannel(CH_NAME) : null;
35952
+ } catch (error) {
35953
+ console.error('[TabLeaderCoordinator] BroadcastChannel creation failed:', error);
35954
+ bc = null;
35955
+ }
35956
+ var isLeader = false;
35957
+ var renewTimer = null;
35958
+ var heartbeatTimer = null;
35959
+ var interactionCheckTimer = null;
35960
+ var electionTimer = null;
35961
+ var now = function now() {
35962
+ return Date.now();
35963
+ };
35964
+ var readLock = function readLock() {
35965
+ try {
35966
+ return JSON.parse(localStorage.getItem(LOCK_KEY) || 'null');
35967
+ } catch (error) {
35968
+ console.error('[TabLeaderCoordinator] readLock failed:', error);
35969
+ return null;
35970
+ }
35971
+ };
35972
+ var writeLock = function writeLock(ownerId) {
35973
+ try {
35974
+ localStorage.setItem(LOCK_KEY, JSON.stringify({
35975
+ ownerId: ownerId,
35976
+ expiresAt: now() + LOCK_TTL_MS
35977
+ }));
35978
+ } catch (error) {
35979
+ console.error('[TabLeaderCoordinator] writeLock failed:', error);
35980
+ }
35981
+ };
35982
+ var clearLockIfMine = function clearLockIfMine() {
35983
+ var lock = readLock();
35984
+ if ((lock === null || lock === void 0 ? void 0 : lock.ownerId) === TAB_ID) {
35985
+ try {
35986
+ localStorage.removeItem(LOCK_KEY);
35987
+ } catch (error) {
35988
+ console.error('[TabLeaderCoordinator] clearLockIfMine failed:', error);
35989
+ }
35990
+ }
35991
+ };
35992
+ var runUserInteractionCheck = function runUserInteractionCheck() {
35993
+ var last = getLastInteractionTime(userKey, false);
35994
+ var checkWindowStart = now() - userInteractionIntervalMs;
35995
+ var hadInteraction = last != null && !Number.isNaN(last) && last >= checkWindowStart;
35996
+ onUserInteractionCheck === null || onUserInteractionCheck === void 0 ? void 0 : onUserInteractionCheck(!!hadInteraction).catch(function (error) {
35997
+ console.error('[TabLeaderCoordinator] onUserInteractionCheck failed:', error);
35998
+ });
35999
+ };
36000
+ var becomeLeader = function becomeLeader() {
36001
+ if (isLeader) return;
36002
+ isLeader = true;
36003
+ if (bc) {
36004
+ try {
36005
+ bc.postMessage({
36006
+ type: 'LEADER',
36007
+ tabId: TAB_ID,
36008
+ at: now()
36009
+ });
36010
+ } catch (error) {
36011
+ console.error('[TabLeaderCoordinator] BroadcastChannel postMessage failed:', error);
36012
+ }
36013
+ }
36014
+
36015
+ // Renew lock periodically
36016
+ renewTimer = setInterval(function () {
36017
+ var lock = readLock();
36018
+ if (!lock || lock.ownerId !== TAB_ID) {
36019
+ becomeFollower();
36020
+ return;
36021
+ }
36022
+ writeLock(TAB_ID);
36023
+ }, RENEW_EVERY_MS);
36024
+
36025
+ // Heartbeat (only leader)
36026
+ heartbeatTimer = setInterval(function () {
36027
+ onHeartbeat === null || onHeartbeat === void 0 ? void 0 : onHeartbeat().catch(function (error) {
36028
+ console.error('[TabLeaderCoordinator] onHeartbeat failed:', error);
36029
+ });
36030
+ }, heartBeatIntervalMs);
36031
+
36032
+ // User interaction check (only leader)
36033
+ interactionCheckTimer = setInterval(runUserInteractionCheck, userInteractionIntervalMs);
36034
+
36035
+ // Immediate calls on becoming leader
36036
+ onHeartbeat === null || onHeartbeat === void 0 ? void 0 : onHeartbeat().catch(function (error) {
36037
+ console.error('[TabLeaderCoordinator] onHeartbeat failed:', error);
36038
+ });
36039
+ runUserInteractionCheck();
36040
+ };
36041
+ var becomeFollower = function becomeFollower() {
36042
+ if (!isLeader) return;
36043
+ isLeader = false;
36044
+ if (renewTimer) clearInterval(renewTimer);
36045
+ if (heartbeatTimer) clearInterval(heartbeatTimer);
36046
+ if (interactionCheckTimer) clearInterval(interactionCheckTimer);
36047
+ renewTimer = heartbeatTimer = interactionCheckTimer = null;
36048
+ };
36049
+ var tryBecomeLeader = function tryBecomeLeader() {
36050
+ var lock = readLock();
36051
+ var expired = !lock || lock.expiresAt <= now();
36052
+ if (expired) {
36053
+ writeLock(TAB_ID);
36054
+ var verify = readLock();
36055
+ if ((verify === null || verify === void 0 ? void 0 : verify.ownerId) === TAB_ID) {
36056
+ becomeLeader();
36057
+ } else {
36058
+ becomeFollower();
36059
+ }
36060
+ } else if (lock.ownerId === TAB_ID) {
36061
+ becomeLeader();
36062
+ } else {
36063
+ becomeFollower();
36064
+ }
36065
+ };
36066
+ var handleStorage = function handleStorage(e) {
36067
+ if (e.key === LOCK_KEY) {
36068
+ var lock = readLock();
36069
+ if ((lock === null || lock === void 0 ? void 0 : lock.ownerId) === TAB_ID) {
36070
+ becomeLeader();
36071
+ } else {
36072
+ becomeFollower();
36073
+ }
36074
+ }
36075
+ };
36076
+ var handleBeforeUnload = function handleBeforeUnload() {
36077
+ if (isLeader) clearLockIfMine();
36078
+ if (bc) bc.close();
36079
+ };
36080
+ if (bc) {
36081
+ bc.onmessage = function (e) {
36082
+ var _e$data;
36083
+ if ((e === null || e === void 0 ? void 0 : (_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.type) === 'LEADER' && e.data.tabId !== TAB_ID) {
36084
+ var lock = readLock();
36085
+ if ((lock === null || lock === void 0 ? void 0 : lock.ownerId) !== TAB_ID) becomeFollower();
36086
+ }
36087
+ };
36088
+ }
36089
+ window.addEventListener('storage', handleStorage);
36090
+ window.addEventListener('beforeunload', handleBeforeUnload);
36091
+ window.addEventListener('pagehide', handleBeforeUnload);
36092
+ electionTimer = setInterval(function () {
36093
+ setTimeout(tryBecomeLeader, Math.random() * JITTER_MS);
36094
+ }, ELECTION_INTERVAL_MS);
36095
+ tryBecomeLeader();
36096
+ return function () {
36097
+ window.removeEventListener('storage', handleStorage);
36098
+ window.removeEventListener('beforeunload', handleBeforeUnload);
36099
+ window.removeEventListener('pagehide', handleBeforeUnload);
36100
+ if (electionTimer) clearInterval(electionTimer);
36101
+ if (isLeader) clearLockIfMine();
36102
+ becomeFollower();
36103
+ if (bc) bc.close();
36104
+ };
36105
+ };
35741
36106
 
35742
36107
  var css_248z$6 = ".utilities_ops-app-frame_ErrorNotification_ErrorNotification--notificationWrapper {\r\n display: flex;\r\n width: -webkit-fit-content;\r\n width: -moz-fit-content;\r\n width: fit-content;\r\n background-color: #f1f1f1;\r\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\r\n border-radius: 4px;\r\n -webkit-animation: utilities_ops-app-frame_ErrorNotification_ErrorNotification--slideUp 0.3s ease-out;\r\n animation: utilities_ops-app-frame_ErrorNotification_ErrorNotification--slideUp 0.3s ease-out;\r\n pointer-events: auto;\r\n}\r\n\r\n@-webkit-keyframes utilities_ops-app-frame_ErrorNotification_ErrorNotification--slideUp {\r\n from {\r\n -webkit-transform: translateY(100%);\r\n transform: translateY(100%);\r\n opacity: 0;\r\n }\r\n to {\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n opacity: 1;\r\n }\r\n}\r\n\r\n@keyframes utilities_ops-app-frame_ErrorNotification_ErrorNotification--slideUp {\r\n from {\r\n -webkit-transform: translateY(100%);\r\n transform: translateY(100%);\r\n opacity: 0;\r\n }\r\n to {\r\n -webkit-transform: translateY(0);\r\n transform: translateY(0);\r\n opacity: 1;\r\n }\r\n}\r\n\r\n";
35743
36108
  styleInject(css_248z$6);
@@ -36029,6 +36394,33 @@ if (!enableNewToolkitFeatures) SETTINGS_ITEMS.splice(1, 0, {
36029
36394
  key: 'settings',
36030
36395
  name: 'Settings'
36031
36396
  });
36397
+ var isSystemMarkedOffline = function isSystemMarkedOffline(status) {
36398
+ if (!status || typeof status !== 'string') return false;
36399
+ var normalized = String(status).trim().toLowerCase();
36400
+ // Match "Offline(System)", "Offline (System)", "offline - system", unicode variants, etc.
36401
+ var hasOffline = normalized.includes('offline');
36402
+ var hasSystem = normalized.includes('system');
36403
+ return hasOffline && hasSystem;
36404
+ };
36405
+ var getOfflineStatusFromAvailable = function getOfflineStatusFromAvailable(statuses) {
36406
+ if (!Array.isArray(statuses) || statuses.length === 0) return 'Offline';
36407
+ var statusList = statuses.map(function (s) {
36408
+ return s.status;
36409
+ });
36410
+ var offlineIndex = statusList.findIndex(function (s) {
36411
+ var _s$toLowerCase;
36412
+ return s === null || s === void 0 ? void 0 : (_s$toLowerCase = s.toLowerCase) === null || _s$toLowerCase === void 0 ? void 0 : _s$toLowerCase.call(s).includes('offline');
36413
+ });
36414
+ return offlineIndex !== -1 ? statusList[offlineIndex] : 'Offline';
36415
+ };
36416
+ var getAvailableStatusFromStatuses = function getAvailableStatusFromStatuses(statuses) {
36417
+ if (!Array.isArray(statuses) || statuses.length === 0) return 'Available';
36418
+ var found = statuses.find(function (s) {
36419
+ var _s$status, _s$status$toLowerCase;
36420
+ return (s === null || s === void 0 ? void 0 : (_s$status = s.status) === null || _s$status === void 0 ? void 0 : (_s$status$toLowerCase = _s$status.toLowerCase) === null || _s$status$toLowerCase === void 0 ? void 0 : _s$status$toLowerCase.call(_s$status)) === 'available';
36421
+ });
36422
+ return (found === null || found === void 0 ? void 0 : found.status) || 'Available';
36423
+ };
36032
36424
  var CountryFlag = function CountryFlag() {
36033
36425
  var _storage$activeCountr;
36034
36426
  return /*#__PURE__*/React__default["default"].createElement(Flag, {
@@ -36046,10 +36438,7 @@ var AppBar = function AppBar(_ref) {
36046
36438
  ActionComponent = _ref.ActionComponent,
36047
36439
  searchComponent = _ref.searchComponent,
36048
36440
  showNavIconInHeader = _ref.showNavIconInHeader,
36049
- setIsNavBarOpen = _ref.setIsNavBarOpen,
36050
- setChatBotVisible = _ref.setChatBotVisible,
36051
- chatBotVisible = _ref.chatBotVisible,
36052
- onNotificationsAndHeightChange = _ref.onNotificationsAndHeightChange;
36441
+ setIsNavBarOpen = _ref.setIsNavBarOpen;
36053
36442
  SETTINGS_ITEMS[0].name = storage$1.userName;
36054
36443
 
36055
36444
  // Escape hatch for forceUpdate function
@@ -36297,6 +36686,10 @@ var AppBar = function AppBar(_ref) {
36297
36686
  _useState24 = _slicedToArray(_useState23, 2),
36298
36687
  currentUserStatus = _useState24[0],
36299
36688
  setCurrentUserStatus = _useState24[1];
36689
+ var _useState25 = React.useState(false),
36690
+ _useState26 = _slicedToArray(_useState25, 2),
36691
+ showSystemOfflineDialog = _useState26[0],
36692
+ setShowSystemOfflineDialog = _useState26[1];
36300
36693
  React.useEffect(function () {
36301
36694
  listOfAllNotificationsRef.current = listOfAllNotifications;
36302
36695
  }, [listOfAllNotifications]);
@@ -36459,6 +36852,21 @@ var AppBar = function AppBar(_ref) {
36459
36852
  setCurrentUserStatus(newStatus);
36460
36853
  storage$1.setLocalItem('dashboard', newStatus, 'userAvailability');
36461
36854
  };
36855
+ React.useEffect(function () {
36856
+ if (isSystemMarkedOffline(currentUserStatus) && !isUserStatusHidden()) {
36857
+ setShowSystemOfflineDialog(true);
36858
+ } else {
36859
+ setShowSystemOfflineDialog(false);
36860
+ }
36861
+ }, [currentUserStatus]);
36862
+ var handleSystemOfflineMakeAvailable = function handleSystemOfflineMakeAvailable() {
36863
+ var availableStatus = getAvailableStatusFromStatuses(availableStatuses);
36864
+ handleUserStatusUpdate(availableStatus);
36865
+ };
36866
+ var handleSystemOfflineStayOffline = function handleSystemOfflineStayOffline() {
36867
+ var offlineStatus = getOfflineStatusFromAvailable(availableStatuses);
36868
+ handleUserStatusUpdate(offlineStatus);
36869
+ };
36462
36870
  var _reConnectSocket = function reConnectSocket() {
36463
36871
  if (socketRetryCountRef.current < 15) {
36464
36872
  socketRetryCountRef.current = socketRetryCountRef.current + 1;
@@ -36524,7 +36932,7 @@ var AppBar = function AppBar(_ref) {
36524
36932
  }
36525
36933
  var loadUserStatus = /*#__PURE__*/function () {
36526
36934
  var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4() {
36527
- var statuses, userStatus, statusList, statusListLower, isValidStatus, finalStatus, offlineIndex, updatedStatus, _t4, _t5;
36935
+ var _userStatus$toLowerCa, statuses, userStatus, statusList, statusListLower, isSystemAssignedStatus, isValidStatus, finalStatus, offlineIndex, updatedStatus, _t4, _t5;
36528
36936
  return _regenerator().w(function (_context4) {
36529
36937
  while (1) switch (_context4.p = _context4.n) {
36530
36938
  case 0:
@@ -36551,7 +36959,8 @@ var AppBar = function AppBar(_ref) {
36551
36959
  statusListLower = statusList.map(function (s) {
36552
36960
  return s.toLowerCase();
36553
36961
  });
36554
- isValidStatus = userStatus && statusListLower.includes(userStatus.toLowerCase());
36962
+ isSystemAssignedStatus = userStatus && (userStatus === null || userStatus === void 0 ? void 0 : (_userStatus$toLowerCa = userStatus.toLowerCase()) === null || _userStatus$toLowerCa === void 0 ? void 0 : _userStatus$toLowerCa.includes("system"));
36963
+ isValidStatus = userStatus && (statusListLower.includes(userStatus.toLowerCase()) || isSystemAssignedStatus);
36555
36964
  finalStatus = userStatus;
36556
36965
  if (isValidStatus) {
36557
36966
  _context4.n = 8;
@@ -36647,14 +37056,50 @@ var AppBar = function AppBar(_ref) {
36647
37056
  };
36648
37057
  }, [notifications]);
36649
37058
  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]);
37059
+ var heartBeatEnabledStatuses = ((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatEnabledStatuses) || ['available']).map(function (s) {
37060
+ var _s$toLowerCase2;
37061
+ return (s === null || s === void 0 ? void 0 : (_s$toLowerCase2 = s.toLowerCase) === null || _s$toLowerCase2 === void 0 ? void 0 : _s$toLowerCase2.call(s)) || '';
37062
+ });
37063
+ var isStatusEnabled = currentUserStatus && heartBeatEnabledStatuses.includes(currentUserStatus.toLowerCase());
37064
+ if (isUserStatusHidden() || !isStatusEnabled) return;
37065
+ var MIN_HEARTBEAT_MS = 5000;
37066
+ var MIN_INTERACTION_MS = 10000;
37067
+ var heartBeatIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatInterval, 10) || 30) * 1000, MIN_HEARTBEAT_MS);
37068
+ var userInteractionIntervalMs = Math.max((parseInt(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.userInteractionInterval, 10) || 60) * 1000, MIN_INTERACTION_MS);
37069
+ var userKey = storage$1.userEmail || '';
37070
+ var updateLastInteractionTime = function updateLastInteractionTime() {
37071
+ recordUserInteraction(userKey);
37072
+ };
37073
+ var handleVisibilityChange = function handleVisibilityChange() {
37074
+ if (document.visibilityState === 'visible') {
37075
+ updateLastInteractionTime();
37076
+ }
37077
+ };
37078
+ var interactionEvents = ['click', 'keydown', 'keypress', 'scroll', 'mousemove', 'mousedown', 'touchstart'];
37079
+ recordUserInteraction(userKey);
37080
+ interactionEvents.forEach(function (event) {
37081
+ document.addEventListener(event, updateLastInteractionTime, {
37082
+ passive: true
37083
+ });
37084
+ });
37085
+ document.addEventListener('visibilitychange', handleVisibilityChange);
37086
+ var stopCoordinator = startTabLeaderCoordinator({
37087
+ onHeartbeat: sendHeartBeat,
37088
+ onUserInteractionCheck: function onUserInteractionCheck(didInteract) {
37089
+ return sendUserInteractionEvent(didInteract);
37090
+ },
37091
+ heartBeatIntervalMs: heartBeatIntervalMs,
37092
+ userInteractionIntervalMs: userInteractionIntervalMs,
37093
+ userKey: userKey
37094
+ });
37095
+ return function () {
37096
+ interactionEvents.forEach(function (event) {
37097
+ document.removeEventListener(event, updateLastInteractionTime);
37098
+ });
37099
+ document.removeEventListener('visibilitychange', handleVisibilityChange);
37100
+ stopCoordinator();
37101
+ };
37102
+ }, [currentUserStatus]);
36658
37103
  var STACK = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.STACK ? window.toolkitEnv.STACK : process.env.STACK;
36659
37104
  STACK = STACK || 'c';
36660
37105
  var modifiedSettings = SETTINGS_ITEMS;
@@ -36718,13 +37163,18 @@ var AppBar = function AppBar(_ref) {
36718
37163
  setIsNavBarOpen: setIsNavBarOpen,
36719
37164
  availableStatuses: availableStatuses,
36720
37165
  currentUserStatus: currentUserStatus,
36721
- onUserStatusUpdate: handleUserStatusUpdate,
36722
- chatBotVisible: chatBotVisible,
36723
- setChatBotVisible: setChatBotVisible
37166
+ onUserStatusUpdate: handleUserStatusUpdate
36724
37167
  }), latestRelease && /*#__PURE__*/React__default["default"].createElement(LatestReleaseDialog, {
36725
37168
  release: latestRelease,
36726
37169
  handleClose: handleReleaseClose,
36727
37170
  mihelpAppPath: mihelpAppPath
37171
+ }), showSystemOfflineDialog && /*#__PURE__*/React__default["default"].createElement(SystemOfflineDialog, {
37172
+ isOpen: showSystemOfflineDialog,
37173
+ onClose: function onClose() {
37174
+ return setShowSystemOfflineDialog(false);
37175
+ },
37176
+ onMakeAvailable: handleSystemOfflineMakeAvailable,
37177
+ onStayOffline: handleSystemOfflineStayOffline
36728
37178
  }));
36729
37179
  };
36730
37180
  AppBar.defaultProps = {
@@ -57992,769 +58442,13 @@ var purify$2 = createCommonjsModule(function (module, exports) {
57992
58442
  });
57993
58443
  });
57994
58444
 
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";
58445
+ 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";
58486
58446
  styleInject(css_248z$3);
58487
58447
 
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
-
58756
58448
  var _styleModuleImportMap$2 = {
58757
58449
  "./MiHelpAgent.css": {
58450
+ "mihelpAgentWrapper": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--mihelpAgentWrapper",
58451
+ "chatIcon": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
58758
58452
  "chatWindow": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
58759
58453
  "spinner": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner",
58760
58454
  "chatWindowHeader": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader",
@@ -58781,20 +58475,7 @@ var _styleModuleImportMap$2 = {
58781
58475
  "chatbotLoader": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatbotLoader",
58782
58476
  "dot": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--dot",
58783
58477
  "bounce": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--bounce",
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"
58478
+ "iphoneChrome": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--iphoneChrome"
58798
58479
  }
58799
58480
  };
58800
58481
  var MiHelpAgent = function MiHelpAgent(_ref) {
@@ -58811,66 +58492,284 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58811
58492
  contextTopMessagesCount = _ref$contextTopMessag === void 0 ? 10 : _ref$contextTopMessag,
58812
58493
  _ref$contextChunks = _ref.contextChunks,
58813
58494
  contextChunks = _ref$contextChunks === void 0 ? 30 : _ref$contextChunks,
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;
58495
+ mihelpAgentRef = _ref.mihelpAgentRef;
58822
58496
  var _useState = React.useState(false),
58823
58497
  _useState2 = _slicedToArray(_useState, 2),
58824
- isLoading = _useState2[0],
58825
- setIsLoading = _useState2[1];
58498
+ showChatWindow = _useState2[0],
58499
+ setShowChatWindow = _useState2[1];
58826
58500
  var _useState3 = React.useState(false),
58827
58501
  _useState4 = _slicedToArray(_useState3, 2),
58828
- isFeedbackLoading = _useState4[0],
58829
- setIsFeedbackLoading = _useState4[1];
58502
+ isLoading = _useState4[0],
58503
+ setIsLoading = _useState4[1];
58830
58504
  var _useState5 = React.useState(false),
58831
58505
  _useState6 = _slicedToArray(_useState5, 2),
58832
- collectionError = _useState6[0];
58833
- _useState6[1];
58506
+ isFeedbackLoading = _useState6[0],
58507
+ setIsFeedbackLoading = _useState6[1];
58508
+ var _useState7 = React.useState(false),
58509
+ _useState8 = _slicedToArray(_useState7, 2),
58510
+ collectionError = _useState8[0];
58511
+ _useState8[1];
58834
58512
  var retryCount = React.useRef(0);
58835
58513
  var messagesContainerRef = React.useRef(null);
58836
58514
  var inputContainerRef = React.useRef(null);
58837
- var inputRef = React.useRef(null);
58838
58515
  var spinnerRef = React.useRef(null);
58839
58516
  var welcomeQuestionRef = React.useRef(null);
58840
- var _useState7 = React.useState(false),
58841
- _useState8 = _slicedToArray(_useState7, 2),
58842
- messageError = _useState8[0],
58843
- setMessageError = _useState8[1];
58844
- var _useState9 = React.useState([]),
58517
+ var _useState9 = React.useState(false),
58845
58518
  _useState0 = _slicedToArray(_useState9, 2),
58846
- conversations = _useState0[0],
58847
- setConversations = _useState0[1];
58519
+ messageError = _useState0[0],
58520
+ setMessageError = _useState0[1];
58848
58521
  var _useState1 = React.useState([]),
58849
58522
  _useState10 = _slicedToArray(_useState1, 2),
58850
- quickReplyList = _useState10[0],
58851
- setQuickReplyList = _useState10[1];
58852
- var _useState11 = React.useState(''),
58523
+ conversations = _useState10[0],
58524
+ setConversations = _useState10[1];
58525
+ var _useState11 = React.useState([]),
58853
58526
  _useState12 = _slicedToArray(_useState11, 2),
58854
- message = _useState12[0],
58855
- setMessage = _useState12[1];
58856
- var _useState13 = React.useState(null),
58527
+ quickReplyList = _useState12[0],
58528
+ setQuickReplyList = _useState12[1];
58529
+ var _useState13 = React.useState(''),
58857
58530
  _useState14 = _slicedToArray(_useState13, 2),
58858
- currentContext = _useState14[0],
58859
- setCurrentContext = _useState14[1];
58531
+ message = _useState14[0],
58532
+ setMessage = _useState14[1];
58860
58533
  var _useState15 = React.useState(null),
58861
58534
  _useState16 = _slicedToArray(_useState15, 2),
58862
- lastSentFromApp = _useState16[0],
58863
- setLastSentFromApp = _useState16[1];
58864
- var _useState17 = React.useState({}),
58535
+ currentContext = _useState16[0],
58536
+ setCurrentContext = _useState16[1];
58537
+ var _useState17 = React.useState(null),
58865
58538
  _useState18 = _slicedToArray(_useState17, 2),
58866
- feedbacks = _useState18[0],
58867
- setFeedbacks = _useState18[1];
58868
- var _useState19 = React.useState(null),
58539
+ lastSentFromApp = _useState18[0],
58540
+ setLastSentFromApp = _useState18[1];
58541
+ var _useState19 = React.useState({}),
58869
58542
  _useState20 = _slicedToArray(_useState19, 2),
58870
- activeFlow = _useState20[0],
58871
- setActiveFlow = _useState20[1];
58872
- var flowCompletedRef = React.useRef(false);
58873
- var previousFlowIdRef = React.useRef(null);
58543
+ feedbacks = _useState20[0],
58544
+ setFeedbacks = _useState20[1];
58545
+ var _useState21 = React.useState({
58546
+ x: 0,
58547
+ y: 0
58548
+ }),
58549
+ _useState22 = _slicedToArray(_useState21, 2),
58550
+ position = _useState22[0],
58551
+ setPosition = _useState22[1];
58552
+ var _useState23 = React.useState({
58553
+ x: 50,
58554
+ y: -68
58555
+ }),
58556
+ _useState24 = _slicedToArray(_useState23, 2),
58557
+ chatPosition = _useState24[0],
58558
+ setChatPosition = _useState24[1];
58559
+ var _useState25 = React.useState(false),
58560
+ _useState26 = _slicedToArray(_useState25, 2),
58561
+ isDragging = _useState26[0],
58562
+ setIsDragging = _useState26[1];
58563
+ var _useState27 = React.useState({
58564
+ x: 0,
58565
+ y: 0
58566
+ }),
58567
+ _useState28 = _slicedToArray(_useState27, 2),
58568
+ offset = _useState28[0],
58569
+ setOffset = _useState28[1];
58570
+ var _useState29 = React.useState(false),
58571
+ _useState30 = _slicedToArray(_useState29, 2),
58572
+ dragged = _useState30[0],
58573
+ setDragged = _useState30[1];
58574
+ var _useState31 = React.useState(500),
58575
+ _useState32 = _slicedToArray(_useState31, 2),
58576
+ chatWindowWidth = _useState32[0],
58577
+ setChatWindowWidth = _useState32[1];
58578
+ var _useState33 = React.useState(0),
58579
+ _useState34 = _slicedToArray(_useState33, 2),
58580
+ windowInnerWidthForMobile = _useState34[0],
58581
+ setWindowInnerWidthForMobile = _useState34[1];
58582
+ var _useState35 = React.useState(600),
58583
+ _useState36 = _slicedToArray(_useState35, 2),
58584
+ chatWindowHeight = _useState36[0],
58585
+ setchatWindowHeight = _useState36[1]; //update this if changed in css
58586
+
58587
+ var chatIconSize = 60; //update this if changed in css
58588
+
58589
+ React.useEffect(function () {
58590
+ var updateChatWindowWidth = function updateChatWindowWidth() {
58591
+ var width = window.innerWidth;
58592
+ var newWidth = 500;
58593
+
58594
+ //Update these values if changed in css
58595
+ if (width <= 575) newWidth = 450;
58596
+ if (width <= 475) newWidth = 400;
58597
+ if (width <= 425) newWidth = 350;
58598
+ if (width <= 375) newWidth = 325;
58599
+ if (width <= 350) newWidth = 300;
58600
+ if (width <= 325) newWidth = 275;
58601
+ setChatWindowWidth(newWidth);
58602
+ setWindowInnerWidthForMobile(width);
58603
+ };
58604
+ updateChatWindowWidth();
58605
+ window.addEventListener('resize', updateChatWindowWidth);
58606
+ return function () {
58607
+ return window.removeEventListener('resize', updateChatWindowWidth);
58608
+ };
58609
+ }, []);
58610
+ React.useEffect(function () {
58611
+ var updateInitialPosition = function updateInitialPosition() {
58612
+ var bufferForMobile = window.innerWidth <= 575 ? 40 : 0;
58613
+ setPosition({
58614
+ x: window.innerWidth - chatIconSize + bufferForMobile,
58615
+ y: window.innerHeight - chatIconSize + 30
58616
+ });
58617
+ };
58618
+ updateInitialPosition();
58619
+ window.addEventListener('resize', updateInitialPosition);
58620
+ return function () {
58621
+ return window.removeEventListener('resize', updateInitialPosition);
58622
+ };
58623
+ }, []);
58624
+ var handleStart = function handleStart(e) {
58625
+ var _e$target;
58626
+ var target = e.target;
58627
+ 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')) {
58628
+ return;
58629
+ }
58630
+ e.preventDefault();
58631
+ setIsDragging(true);
58632
+ setDragged(false);
58633
+ var clientX = e.touches ? e.touches[0].clientX : e.clientX;
58634
+ var clientY = e.touches ? e.touches[0].clientY : e.clientY;
58635
+ setOffset({
58636
+ x: clientX - position.x,
58637
+ y: clientY - position.y
58638
+ });
58639
+ };
58640
+ var handleMove = function handleMove(e) {
58641
+ var _e$target2;
58642
+ if (e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.closest('#chatCloseIcon')) return;
58643
+ if (isDragging) {
58644
+ setDragged(true);
58645
+ var clientX = e.touches ? e.touches[0].clientX : e.clientX;
58646
+ var clientY = e.touches ? e.touches[0].clientY : e.clientY;
58647
+ var newX = clientX - offset.x;
58648
+ var newY = clientY - offset.y;
58649
+
58650
+ // chat icon has to stay within set screen bounds
58651
+ newX = Math.max(chatIconSize + 10, Math.min(newX, window.innerWidth - 20));
58652
+ newY = Math.max(chatIconSize + 20, Math.min(newY, window.innerHeight - chatIconSize + 30));
58653
+ setPosition({
58654
+ x: newX,
58655
+ y: newY
58656
+ });
58657
+ }
58658
+ };
58659
+ var handleEnd = function handleEnd() {
58660
+ setIsDragging(false);
58661
+ setTimeout(function () {
58662
+ return setDragged(false);
58663
+ }, 100);
58664
+ };
58665
+ React.useEffect(function () {
58666
+ if (!isDragging) {
58667
+ adjustChatWindowPosition();
58668
+ if (showChatWindow) {
58669
+ adjustChatIconPosition();
58670
+ }
58671
+ }
58672
+ }, [isDragging, position, showChatWindow]);
58673
+ React.useEffect(function () {
58674
+ var isSmallDevice = windowInnerWidthForMobile < 1000;
58675
+ if (showChatWindow && isSmallDevice && !dragged) {
58676
+ adjustChatWindowPosition();
58677
+ }
58678
+ }, [position, dragged]);
58679
+ var adjustChatWindowPosition = function adjustChatWindowPosition() {
58680
+ if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) {
58681
+ return setchatWindowHeight(window.innerHeight - chatIconSize - 20);
58682
+ }
58683
+ // if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) return
58684
+ var bufferForMobile = window.innerWidth <= 575 ? 40 : 0;
58685
+ // let chatX = 0 - chatIconSize + bufferForMobile
58686
+ var chatX = 0 - chatIconSize;
58687
+ var chatY = -chatWindowHeight - chatIconSize - 10; // Default: Open above
58688
+
58689
+ // Adjust horizontally
58690
+ if (position.x + chatWindowWidth > window.innerWidth + bufferForMobile) {
58691
+ chatX = -chatWindowWidth; // Move left if overflowing right
58692
+ }
58693
+
58694
+ // Adjust vertically
58695
+ if (position.y < chatWindowHeight) {
58696
+ chatY = 10; // Move below if there's not enough space above
58697
+ }
58698
+ setChatPosition({
58699
+ x: chatX,
58700
+ y: chatY
58701
+ });
58702
+ };
58703
+ var adjustChatIconPosition = function adjustChatIconPosition() {
58704
+ // if (chatWindowHeight + chatIconSize + 20 > window.innerHeight) {
58705
+ // return setchatWindowHeight(500)
58706
+ // }
58707
+ var newX = position.x;
58708
+ var newY = position.y;
58709
+ var isSmallDevice = windowInnerWidthForMobile < 1000;
58710
+ var middleX = windowInnerWidthForMobile / 2; // Middle of the screen
58711
+ var closerToLeft = position.x < middleX; // Check if icon is closer to left or right
58712
+
58713
+ // Move chat icon up if chat window is overflowing at the bottom
58714
+ if (position.y < chatWindowHeight && window.innerHeight - position.y < chatWindowHeight) {
58715
+ newY = position.y - (chatWindowHeight - (window.innerHeight - position.y)) - 20;
58716
+ }
58717
+
58718
+ // Move chat icon down if chat window is overflowing at the top
58719
+ else if (position.y > chatWindowHeight && position.y < chatWindowHeight + chatIconSize + 10) {
58720
+ newY = chatWindowHeight + chatIconSize + 20;
58721
+ }
58722
+
58723
+ // In Mobile, move chat icon to the nearest screen edge (left or right)
58724
+ if (isSmallDevice) {
58725
+ newX = closerToLeft ? 70 : windowInnerWidthForMobile - 10;
58726
+ }
58727
+ if (newX !== position.x || newY !== position.y) {
58728
+ setPosition({
58729
+ x: newX,
58730
+ y: newY
58731
+ });
58732
+ }
58733
+ };
58734
+ React.useEffect(function () {
58735
+ if (chatWindowHeight !== 600) {
58736
+ adjustChatWindowPosition();
58737
+ // adjustChatIconPosition()
58738
+ }
58739
+ }, [chatWindowHeight]);
58740
+ React.useEffect(function () {
58741
+ if (isDragging) {
58742
+ document.addEventListener('mousemove', handleMove);
58743
+ document.addEventListener('mouseup', handleEnd);
58744
+ document.addEventListener('touchmove', handleMove, {
58745
+ passive: false
58746
+ });
58747
+ document.addEventListener('touchend', handleEnd);
58748
+ } else {
58749
+ document.removeEventListener('mousemove', handleMove);
58750
+ document.removeEventListener('mouseup', handleEnd);
58751
+ document.removeEventListener('touchmove', handleMove);
58752
+ document.removeEventListener('touchend', handleEnd);
58753
+ }
58754
+ return function () {
58755
+ document.removeEventListener('mousemove', handleMove);
58756
+ document.removeEventListener('mouseup', handleEnd);
58757
+ document.removeEventListener('touchmove', handleMove);
58758
+ document.removeEventListener('touchend', handleEnd);
58759
+ };
58760
+ }, [isDragging]);
58761
+ var handleChatIconClick = function handleChatIconClick() {
58762
+ if (!dragged) {
58763
+ setShowChatWindow(function (prev) {
58764
+ return !prev;
58765
+ });
58766
+ }
58767
+ };
58768
+ React.useEffect(function () {
58769
+ if (showChatWindow) {
58770
+ adjustChatIconPosition();
58771
+ }
58772
+ }, [showChatWindow]);
58874
58773
  var saveCurrentContext = function saveCurrentContext(conversationsToBeSaved) {
58875
58774
  var _systemPrompts;
58876
58775
  var systemPrompts = conversationsToBeSaved.filter(function (c) {
@@ -58946,7 +58845,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
58946
58845
  }, []);
58947
58846
  var chatBodyRef = React.useRef(null);
58948
58847
  var previousConversationLengthRef = React.useRef(conversations.length);
58949
- var previousChatBotVisibleRef = React.useRef(chatBotVisible);
58848
+ var previousShowChatWindowRef = React.useRef(showChatWindow);
58950
58849
  var scroll = function scroll() {
58951
58850
  chatBodyRef.current && chatBodyRef.current.scrollTo({
58952
58851
  top: chatBodyRef.current.scrollHeight,
@@ -59092,99 +58991,15 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59092
58991
  }();
59093
58992
  var handleReply = function handleReply(reply) {
59094
58993
  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;
59113
58994
  var newConversations = _toConsumableArray(conversations);
59114
58995
  newConversations.push({
59115
58996
  role: 'user',
59116
- content: replyText
58997
+ content: reply
59117
58998
  });
59118
58999
  setConversations(newConversations);
59119
59000
  _send(newConversations);
59120
59001
  setMessage('');
59121
59002
  };
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]);
59188
59003
  var handleKeyup = function handleKeyup(e) {
59189
59004
  if ((e === null || e === void 0 ? void 0 : e.keyCode) === 13 && !isLoading && !collectionError) {
59190
59005
  handleReply(message);
@@ -59192,22 +59007,15 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59192
59007
  };
59193
59008
  React.useEffect(function () {
59194
59009
  var conversationLengthChanged = previousConversationLengthRef.current !== conversations.length;
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
- };
59010
+ var chatWindowJustOpened = !previousShowChatWindowRef.current && showChatWindow && conversations.length;
59011
+ if (showChatWindow && conversations.length && (conversationLengthChanged || chatWindowJustOpened)) {
59012
+ scroll();
59204
59013
  }
59205
59014
  previousConversationLengthRef.current = conversations.length;
59206
- previousChatBotVisibleRef.current = chatBotVisible;
59207
- }, [conversations.length, chatBotVisible]);
59015
+ previousShowChatWindowRef.current = showChatWindow;
59016
+ }, [conversations, showChatWindow]);
59208
59017
  React.useEffect(function () {
59209
59018
  if (messageError) {
59210
- console.log('***scrolling 2');
59211
59019
  scroll();
59212
59020
  }
59213
59021
  }, [messageError]);
@@ -59228,29 +59036,11 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59228
59036
  }
59229
59037
  var replies = _toConsumableArray(quickReplies.slice(0, 3));
59230
59038
  replies.forEach(function (reply, index) {
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"));
59039
+ if (typeof reply !== 'string') {
59040
+ throw new Error("quickReplies[".concat(index, "] must be a string"));
59041
+ }
59042
+ if (reply.length > 100) {
59043
+ throw new Error("quickReplies[".concat(index, "] exceeds the 100 character limit"));
59254
59044
  }
59255
59045
  });
59256
59046
  setQuickReplyList(replies);
@@ -59266,20 +59056,14 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59266
59056
  storage$1.setLocalItem('mihelpAgentLastSentApp', '');
59267
59057
  setMessageError(false);
59268
59058
  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
- }
59275
59059
  };
59276
59060
  var handleDownload = /*#__PURE__*/function () {
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) {
59061
+ var _ref3 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee2() {
59062
+ var input, originalHeight, originalOverflow, originalMaxHeight, canvas, imgData, pdf, pdfWidth, pdfHeight, padding, imgProps, imgWidth, imgHeight, heightLeft, _position, _t2;
59063
+ return _regenerator().w(function (_context2) {
59064
+ while (1) switch (_context2.p = _context2.n) {
59281
59065
  case 0:
59282
- _context3.p = 0;
59066
+ _context2.p = 0;
59283
59067
  setIsFeedbackLoading(true);
59284
59068
  welcomeQuestionRef.current.style.marginLeft = '0px';
59285
59069
  input = messagesContainerRef.current; // Save original styles
@@ -59289,12 +59073,12 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59289
59073
  input.style.height = input.scrollHeight + 'px';
59290
59074
  input.style.overflow = 'visible';
59291
59075
  input.style.maxHeight = 'none';
59292
- _context3.n = 1;
59076
+ _context2.n = 1;
59293
59077
  return new Promise(function (res) {
59294
59078
  return setTimeout(res, 100);
59295
59079
  });
59296
59080
  case 1:
59297
- _context3.n = 2;
59081
+ _context2.n = 2;
59298
59082
  return html2canvas(input, {
59299
59083
  scale: 2,
59300
59084
  useCORS: true,
@@ -59304,7 +59088,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59304
59088
  }
59305
59089
  });
59306
59090
  case 2:
59307
- canvas = _context3.v;
59091
+ canvas = _context2.v;
59308
59092
  imgData = canvas.toDataURL('image/png');
59309
59093
  pdf = new E$1('p', 'mm', 'a4');
59310
59094
  pdfWidth = pdf.internal.pageSize.getWidth();
@@ -59314,13 +59098,13 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59314
59098
  imgWidth = pdfWidth - 2 * padding;
59315
59099
  imgHeight = imgProps.height * imgWidth / imgProps.width;
59316
59100
  heightLeft = imgHeight;
59317
- position = 0;
59318
- pdf.addImage(imgData, 'PNG', padding, position, imgWidth, imgHeight);
59101
+ _position = 0;
59102
+ pdf.addImage(imgData, 'PNG', padding, _position, imgWidth, imgHeight);
59319
59103
  heightLeft -= pdfHeight;
59320
59104
  while (heightLeft > 0) {
59321
- position = heightLeft - imgHeight;
59105
+ _position = heightLeft - imgHeight;
59322
59106
  pdf.addPage();
59323
- pdf.addImage(imgData, 'PNG', padding, position, imgWidth, imgHeight);
59107
+ pdf.addImage(imgData, 'PNG', padding, _position, imgWidth, imgHeight);
59324
59108
  heightLeft -= pdfHeight;
59325
59109
  }
59326
59110
  pdf.save('Conversation.pdf');
@@ -59331,29 +59115,29 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59331
59115
  input.style.maxHeight = originalMaxHeight;
59332
59116
  welcomeQuestionRef.current.style.marginLeft = '36px';
59333
59117
  setIsFeedbackLoading(false);
59334
- _context3.n = 4;
59118
+ _context2.n = 4;
59335
59119
  break;
59336
59120
  case 3:
59337
- _context3.p = 3;
59338
- _t2 = _context3.v;
59121
+ _context2.p = 3;
59122
+ _t2 = _context2.v;
59339
59123
  console.log(_t2);
59340
59124
  welcomeQuestionRef.current.style.marginLeft = '36px';
59341
59125
  setIsFeedbackLoading(false);
59342
59126
  case 4:
59343
- return _context3.a(2);
59127
+ return _context2.a(2);
59344
59128
  }
59345
- }, _callee3, null, [[0, 3]]);
59129
+ }, _callee2, null, [[0, 3]]);
59346
59130
  }));
59347
59131
  return function handleDownload() {
59348
- return _ref4.apply(this, arguments);
59132
+ return _ref3.apply(this, arguments);
59349
59133
  };
59350
59134
  }();
59351
59135
  var updateFeedback = /*#__PURE__*/function () {
59352
- var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(feedback, Currentconversation, conversations) {
59136
+ var _ref4 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee3(feedback, Currentconversation, conversations) {
59353
59137
  var _storage$getLocalItem3, _storage$getLocalItem4;
59354
59138
  var payload, feedbackEndpoint, endpoint, newConversations, _t3;
59355
- return _regenerator().w(function (_context4) {
59356
- while (1) switch (_context4.p = _context4.n) {
59139
+ return _regenerator().w(function (_context3) {
59140
+ while (1) switch (_context3.p = _context3.n) {
59357
59141
  case 0:
59358
59142
  setMessageError(false);
59359
59143
  payload = {
@@ -59361,17 +59145,17 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59361
59145
  };
59362
59146
  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;
59363
59147
  if (feedbackEndpoint) {
59364
- _context4.n = 1;
59148
+ _context3.n = 1;
59365
59149
  break;
59366
59150
  }
59367
59151
  console.log('MiHelpAgent: feedback endpoint missing from config');
59368
59152
  setMessageError(true);
59369
- return _context4.a(2);
59153
+ return _context3.a(2);
59370
59154
  case 1:
59371
59155
  endpoint = "".concat(feedbackEndpoint, "/").concat(Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.feedbackId);
59372
59156
  setIsFeedbackLoading(true);
59373
- _context4.p = 2;
59374
- _context4.n = 3;
59157
+ _context3.p = 2;
59158
+ _context3.n = 3;
59375
59159
  return fetcher.put(endpoint, payload, {
59376
59160
  headers: {
59377
59161
  'Content-Type': 'application/json'
@@ -59385,44 +59169,44 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59385
59169
  });
59386
59170
  setConversations(newConversations);
59387
59171
  storage$1.setLocalItem('mihelpAgentConversations', newConversations);
59388
- _context4.n = 5;
59172
+ _context3.n = 5;
59389
59173
  break;
59390
59174
  case 4:
59391
- _context4.p = 4;
59392
- _t3 = _context4.v;
59175
+ _context3.p = 4;
59176
+ _t3 = _context3.v;
59393
59177
  console.log('MiHelpAgent: failed to update feedback', _t3);
59394
59178
  setMessageError(true);
59395
59179
  case 5:
59396
- _context4.p = 5;
59180
+ _context3.p = 5;
59397
59181
  setIsFeedbackLoading(false);
59398
- return _context4.f(5);
59182
+ return _context3.f(5);
59399
59183
  case 6:
59400
- return _context4.a(2);
59184
+ return _context3.a(2);
59401
59185
  }
59402
- }, _callee4, null, [[2, 4, 5, 6]]);
59186
+ }, _callee3, null, [[2, 4, 5, 6]]);
59403
59187
  }));
59404
59188
  return function updateFeedback(_x2, _x3, _x4) {
59405
- return _ref5.apply(this, arguments);
59189
+ return _ref4.apply(this, arguments);
59406
59190
  };
59407
59191
  }();
59408
59192
  var handleFeedback = /*#__PURE__*/function () {
59409
- var _ref6 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee5(feedback, Currentconversation, conversations) {
59193
+ var _ref5 = _asyncToGenerator$1(/*#__PURE__*/_regenerator().m(function _callee4(feedback, Currentconversation, conversations) {
59410
59194
  var _storage$getLocalItem5, _storage$getLocalItem6;
59411
59195
  var conversationsUntilCurrentMessage, lastFeedbackIndex, chatHistoryAfterLastFeedback, chatHistoryWithoutSystemPrompts, payload, endpoint, response, newConversations, newFeedbacks, _t4;
59412
- return _regenerator().w(function (_context5) {
59413
- while (1) switch (_context5.p = _context5.n) {
59196
+ return _regenerator().w(function (_context4) {
59197
+ while (1) switch (_context4.p = _context4.n) {
59414
59198
  case 0:
59415
59199
  if (!((Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.feedback) === feedback)) {
59416
- _context5.n = 1;
59200
+ _context4.n = 1;
59417
59201
  break;
59418
59202
  }
59419
- return _context5.a(2);
59203
+ return _context4.a(2);
59420
59204
  case 1:
59421
59205
  if (!(Currentconversation !== null && Currentconversation !== void 0 && Currentconversation.feedback)) {
59422
- _context5.n = 2;
59206
+ _context4.n = 2;
59423
59207
  break;
59424
59208
  }
59425
- return _context5.a(2, updateFeedback(feedback, Currentconversation, conversations));
59209
+ return _context4.a(2, updateFeedback(feedback, Currentconversation, conversations));
59426
59210
  case 2:
59427
59211
  setMessageError(false);
59428
59212
  conversationsUntilCurrentMessage = _toConsumableArray(conversations).slice(0, conversations.findIndex(function (c) {
@@ -59447,23 +59231,23 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59447
59231
  };
59448
59232
  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;
59449
59233
  if (endpoint) {
59450
- _context5.n = 3;
59234
+ _context4.n = 3;
59451
59235
  break;
59452
59236
  }
59453
59237
  console.log('MiHelpAgent: feedback endpoint missing from config');
59454
59238
  setMessageError(true);
59455
- return _context5.a(2);
59239
+ return _context4.a(2);
59456
59240
  case 3:
59457
59241
  setIsFeedbackLoading(true);
59458
- _context5.p = 4;
59459
- _context5.n = 5;
59242
+ _context4.p = 4;
59243
+ _context4.n = 5;
59460
59244
  return fetcher.post(endpoint, payload, {
59461
59245
  headers: {
59462
59246
  'Content-Type': 'application/json'
59463
59247
  }
59464
59248
  });
59465
59249
  case 5:
59466
- response = _context5.v;
59250
+ response = _context4.v;
59467
59251
  newConversations = conversations.map(function (conversation) {
59468
59252
  var _response$data3;
59469
59253
  return (conversation === null || conversation === void 0 ? void 0 : conversation.id) === (Currentconversation === null || Currentconversation === void 0 ? void 0 : Currentconversation.id) ? _objectSpread2(_objectSpread2({}, conversation), {}, {
@@ -59476,56 +59260,81 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59476
59260
  setConversations(newConversations);
59477
59261
  storage$1.setLocalItem('mihelpAgentConversations', newConversations);
59478
59262
  storage$1.setLocalItem('mihelpAgentFeedbacks', newFeedbacks);
59479
- _context5.n = 7;
59263
+ _context4.n = 7;
59480
59264
  break;
59481
59265
  case 6:
59482
- _context5.p = 6;
59483
- _t4 = _context5.v;
59266
+ _context4.p = 6;
59267
+ _t4 = _context4.v;
59484
59268
  console.log('MiHelpAgent: failed to submit feedback', _t4);
59485
59269
  setMessageError(true);
59486
59270
  case 7:
59487
- _context5.p = 7;
59271
+ _context4.p = 7;
59488
59272
  setIsFeedbackLoading(false);
59489
- return _context5.f(7);
59273
+ return _context4.f(7);
59490
59274
  case 8:
59491
- return _context5.a(2);
59275
+ return _context4.a(2);
59492
59276
  }
59493
- }, _callee5, null, [[4, 6, 7, 8]]);
59277
+ }, _callee4, null, [[4, 6, 7, 8]]);
59494
59278
  }));
59495
59279
  return function handleFeedback(_x5, _x6, _x7) {
59496
- return _ref6.apply(this, arguments);
59280
+ return _ref5.apply(this, arguments);
59497
59281
  };
59498
59282
  }();
59499
- var chatWindowContent = /*#__PURE__*/React__default["default"].createElement("div", {
59283
+ var isChromeOnIPhone = function isChromeOnIPhone() {
59284
+ var userAgent = navigator.userAgent;
59285
+ var isIPhone = /iPhone/i.test(userAgent);
59286
+ var isChrome = /CriOS/i.test(userAgent);
59287
+ return isIPhone && isChrome;
59288
+ };
59289
+ var chatbotUI = /*#__PURE__*/React__default["default"].createElement("div", {
59290
+ onMouseDown: handleStart,
59291
+ onTouchStart: handleStart,
59292
+ style: {
59293
+ left: "".concat(position.x, "px"),
59294
+ top: "".concat(position.y, "px"),
59295
+ cursor: 'grab'
59296
+ },
59297
+ className: _getClassName("mihelpAgentWrapper ".concat(isChromeOnIPhone() ? 'iphoneChrome' : ''), _styleModuleImportMap$2, {
59298
+ "handleMissingStyleName": "warn"
59299
+ })
59300
+ }, showChatWindow && /*#__PURE__*/React__default["default"].createElement("div", {
59500
59301
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
59501
59302
  style: {
59502
- height: '100%',
59503
- width: '100%',
59504
- position: 'relative',
59505
- left: 0,
59506
- top: 0
59303
+ left: "".concat(chatPosition.x, "px"),
59304
+ top: "".concat(chatPosition.y, "px"),
59305
+ height: chatWindowHeight
59507
59306
  }
59508
59307
  }, /*#__PURE__*/React__default["default"].createElement("div", {
59509
59308
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader"
59510
59309
  }, /*#__PURE__*/React__default["default"].createElement("span", {
59511
59310
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--title"
59512
- }, "MiHelp Bot"), conversations.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
59311
+ }, "MiHelp Bot"), /*#__PURE__*/React__default["default"].createElement("span", {
59312
+ onClick: function onClick() {
59313
+ return setShowChatWindow(false);
59314
+ },
59315
+ id: "chatCloseIcon"
59316
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59317
+ name: "xmark",
59318
+ variant: "light",
59513
59319
  style: {
59514
- display: 'flex',
59515
- gap: '8px',
59516
- alignItems: 'center'
59320
+ color: '#fff',
59321
+ fontSize: '20px',
59322
+ cursor: 'pointer'
59517
59323
  }
59324
+ }))), /*#__PURE__*/React__default["default"].createElement("div", {
59325
+ ref: chatBodyRef,
59326
+ className: _getClassName("chatWindowBody ".concat(conversations.length > 0 ? 'newChatVisible' : ''), _styleModuleImportMap$2, {
59327
+ "handleMissingStyleName": "warn"
59328
+ })
59329
+ }, conversations.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
59330
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatContainer"
59518
59331
  }, /*#__PURE__*/React__default["default"].createElement("div", {
59519
59332
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton",
59520
- onClick: handleDownload,
59521
- style: {
59522
- background: 'transparent',
59523
- border: '1px solid #D1D1D1',
59524
- padding: '4px 12px'
59525
- }
59333
+ onClick: handleDownload
59526
59334
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59527
59335
  name: "arrow-down-to-line",
59528
59336
  style: {
59337
+ color: '#000',
59529
59338
  fontSize: '16px'
59530
59339
  }
59531
59340
  }), /*#__PURE__*/React__default["default"].createElement("span", null, "Export")), /*#__PURE__*/React__default["default"].createElement(coreComponents.Tooltip, {
@@ -59533,23 +59342,14 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59533
59342
  position: "leftCenter"
59534
59343
  }, /*#__PURE__*/React__default["default"].createElement("div", {
59535
59344
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--newChatButton",
59536
- onClick: handleNewConversation,
59537
- style: {
59538
- background: 'transparent',
59539
- border: '1px solid #D1D1D1',
59540
- padding: '4px 12px'
59541
- }
59345
+ onClick: handleNewConversation
59542
59346
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59543
59347
  name: "rotate-right",
59544
59348
  style: {
59349
+ color: '#000',
59545
59350
  fontSize: '16px'
59546
59351
  }
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", {
59352
+ }), /*#__PURE__*/React__default["default"].createElement("span", null, "Restart Chat")))), /*#__PURE__*/React__default["default"].createElement("div", {
59553
59353
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messagesContainer",
59554
59354
  ref: messagesContainerRef
59555
59355
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -59571,14 +59371,10 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59571
59371
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble"
59572
59372
  }, /*#__PURE__*/React__default["default"].createElement("p", {
59573
59373
  "data-chat-id": "agent-message-2"
59574
- }, "How can I help you today?")))), !conversations.length && !activeFlow && /*#__PURE__*/React__default["default"].createElement("div", {
59374
+ }, "How can I help you today?")))), !conversations.length && /*#__PURE__*/React__default["default"].createElement("div", {
59575
59375
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestions"
59576
59376
  }, 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;
59580
59377
  return /*#__PURE__*/React__default["default"].createElement("div", {
59581
- key: replyKey,
59582
59378
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionWrapper"
59583
59379
  }, /*#__PURE__*/React__default["default"].createElement("div", {
59584
59380
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--quickQuestionContainer"
@@ -59589,7 +59385,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59589
59385
  }
59590
59386
  }, /*#__PURE__*/React__default["default"].createElement("p", {
59591
59387
  "data-chat-id": "quickReply-message-".concat(i + 1)
59592
- }, replyText))));
59388
+ }, reply))));
59593
59389
  })), function () {
59594
59390
  var userCount = 0;
59595
59391
  var agentCount = 2;
@@ -59646,12 +59442,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59646
59442
  "data-chat-id": testId
59647
59443
  }, conversation === null || conversation === void 0 ? void 0 : conversation.content)));
59648
59444
  });
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", {
59445
+ }(), isLoading && /*#__PURE__*/React__default["default"].createElement("div", {
59655
59446
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--message"
59656
59447
  }, /*#__PURE__*/React__default["default"].createElement("img", {
59657
59448
  src: "/assets/images/mihelpIcons/icon-sparkle.svg",
@@ -59685,15 +59476,10 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59685
59476
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowFooter"
59686
59477
  }, /*#__PURE__*/React__default["default"].createElement("div", {
59687
59478
  ref: inputContainerRef,
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, {
59479
+ className: _getClassName("inputContainer ".concat(collectionError ? 'disabled' : ''), _styleModuleImportMap$2, {
59693
59480
  "handleMissingStyleName": "warn"
59694
59481
  })
59695
59482
  }, /*#__PURE__*/React__default["default"].createElement("input", {
59696
- ref: inputRef,
59697
59483
  type: "text",
59698
59484
  placeholder: "Ask a Question",
59699
59485
  value: message,
@@ -59701,13 +59487,10 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59701
59487
  return setMessage(e.target.value);
59702
59488
  },
59703
59489
  onKeyUp: handleKeyup,
59704
- disabled: collectionError || activeFlow !== null
59490
+ disabled: collectionError
59705
59491
  }), /*#__PURE__*/React__default["default"].createElement("span", {
59706
- onClick: function onClick(e) {
59707
- e.stopPropagation();
59708
- if (!activeFlow) {
59709
- handleReply(message);
59710
- }
59492
+ onClick: function onClick() {
59493
+ return handleReply(message);
59711
59494
  }
59712
59495
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59713
59496
  name: "paper-plane-top",
@@ -59715,33 +59498,26 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
59715
59498
  style: {
59716
59499
  color: '#616161',
59717
59500
  fontSize: '20px',
59718
- cursor: isLoading || collectionError || activeFlow !== null ? 'auto' : 'pointer'
59501
+ cursor: isLoading || collectionError ? 'auto' : 'pointer'
59719
59502
  },
59720
- disabled: isLoading || collectionError || activeFlow !== null
59503
+ disabled: isLoading || collectionError
59721
59504
  })))), isFeedbackLoading && /*#__PURE__*/React__default["default"].createElement("div", {
59722
59505
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--spinner",
59723
59506
  ref: spinnerRef
59724
59507
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.Spinner, {
59725
59508
  size: "60px"
59726
- })));
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
- },
59509
+ }))), /*#__PURE__*/React__default["default"].createElement("span", {
59510
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
59511
+ onClick: handleChatIconClick
59512
+ }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
59513
+ name: "comment-sparkle-custom",
59514
+ variant: "light",
59738
59515
  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));
59516
+ color: '#fff',
59517
+ fontSize: '22px'
59518
+ }
59519
+ })));
59520
+ return ReactDOM__default["default"].createPortal(chatbotUI, document.body);
59745
59521
  };
59746
59522
 
59747
59523
  /**
@@ -71031,9 +70807,9 @@ var AppFrame = function AppFrame(props) {
71031
70807
  chatBotEnabled = _useState4[0],
71032
70808
  setChatBotEnabled = _useState4[1];
71033
70809
  var _useState5 = React.useState(false),
71034
- _useState6 = _slicedToArray(_useState5, 2);
71035
- _useState6[0];
71036
- var setIsLandscapeInMobile = _useState6[1];
70810
+ _useState6 = _slicedToArray(_useState5, 2),
70811
+ isLandscapeInMobile = _useState6[0],
70812
+ setIsLandscapeInMobile = _useState6[1];
71037
70813
  // const [activeSubmenu, setActiveSubmenu] = useState(null)
71038
70814
  var _useState7 = React.useState([]),
71039
70815
  _useState8 = _slicedToArray(_useState7, 2),
@@ -71048,18 +70824,6 @@ var AppFrame = function AppFrame(props) {
71048
70824
  _useState10 = _slicedToArray(_useState1, 2),
71049
70825
  isNavBarOpen = _useState10[0],
71050
70826
  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];
71063
70827
  var setChatBotEnableStatus = function setChatBotEnableStatus() {
71064
70828
  var coreAppConfig = storage$1.getLocalItem('opsportal-core:config');
71065
70829
  var tileData = findAppData(coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tiles, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.tileOverrides) || {};
@@ -71158,7 +70922,7 @@ var AppFrame = function AppFrame(props) {
71158
70922
  var isThirdLevelOpen = props.showLevel3Navigation && (activeSubmenu === null || activeSubmenu === void 0 ? void 0 : activeSubmenu.length) > 1;
71159
70923
  var navigationWidth = props.showLevel3Navigation ? isThirdLevelOpen && showNavigationCounts ? '100px' : baseWidth : activeSubmenu !== null && activeSubmenu !== void 0 && activeSubmenu.length && showNavigationCounts ? '100px' : baseWidth;
71160
70924
  return /*#__PURE__*/React__default["default"].createElement(ErrorNotificationProvider, null, /*#__PURE__*/React__default["default"].createElement("div", {
71161
- className: ((chatBotVisible ? 'chatBotVisible' : '') ? (chatBotVisible ? 'chatBotVisible' : '') + " " : "") + "utilities_ops-app-frame_AppFrame_AppFrame--AppFrame",
70925
+ className: "utilities_ops-app-frame_AppFrame_AppFrame--AppFrame",
71162
70926
  style: props.handleScrolling ? SCROLL : NO_SCROLL
71163
70927
  }, /*#__PURE__*/React__default["default"].createElement(BreadcrumbsProvider, {
71164
70928
  history: props.history
@@ -71177,13 +70941,7 @@ var AppFrame = function AppFrame(props) {
71177
70941
  ActionComponent: props === null || props === void 0 ? void 0 : props.ActionComponent,
71178
70942
  searchComponent: props.searchComponent,
71179
70943
  showNavIconInHeader: props === null || props === void 0 ? void 0 : props.showNavIconInHeader,
71180
- setIsNavBarOpen: setIsNavBarOpen,
71181
- chatBotVisible: chatBotVisible,
71182
- setChatBotVisible: setChatBotVisible,
71183
- onNotificationsAndHeightChange: function onNotificationsAndHeightChange(count, height) {
71184
- setNotificationsCount(count || 0);
71185
- setSideBarTopValue(height || 0);
71186
- }
70944
+ setIsNavBarOpen: setIsNavBarOpen
71187
70945
  })), /*#__PURE__*/React__default["default"].createElement("main", {
71188
70946
  className: "utilities_ops-app-frame_AppFrame_AppFrame--AppContainer"
71189
70947
  }, props.showNavigation && storage$1.isAuthenticated ? /*#__PURE__*/React__default["default"].createElement(NavigationBar, {
@@ -71204,23 +70962,12 @@ var AppFrame = function AppFrame(props) {
71204
70962
  isNavBarOpen: isNavBarOpen,
71205
70963
  showLevel3Navigation: props.showLevel3Navigation
71206
70964
  }) : null, /*#__PURE__*/React__default["default"].createElement("div", {
71207
- style: {
71208
- display: 'grid',
71209
- gridTemplateColumns: chatBotEnabled ? '1fr auto' : '1fr',
71210
- height: '100%',
71211
- position: 'relative',
71212
- minWidth: 0
71213
- }
71214
- }, /*#__PURE__*/React__default["default"].createElement("div", {
71215
70965
  style: {
71216
70966
  marginLeft: props.showNavigation && !(props !== null && props !== void 0 && props.showNavIconInHeader) ? navigationWidth : '0px',
71217
70967
  height: '100%',
71218
- transition: 'all 0.5s ease-in-out',
71219
- minWidth: 0,
71220
- width: '100%',
71221
- overflow: 'hidden'
70968
+ transition: 'all 0.5s ease-in-out'
71222
70969
  }
71223
- }, props.children), chatBotEnabled && /*#__PURE__*/React__default["default"].createElement(MiHelpAgent, {
70970
+ }, props.children), chatBotEnabled && !isLandscapeInMobile && /*#__PURE__*/React__default["default"].createElement(MiHelpAgent, {
71224
70971
  quickReplies: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro = props.mihelpAgentProps) === null || _props$mihelpAgentPro === void 0 ? void 0 : _props$mihelpAgentPro.quickReplies,
71225
70972
  collection: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro2 = props.mihelpAgentProps) === null || _props$mihelpAgentPro2 === void 0 ? void 0 : _props$mihelpAgentPro2.collection,
71226
70973
  systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt,
@@ -71228,12 +70975,8 @@ var AppFrame = function AppFrame(props) {
71228
70975
  contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.contextMessagesCount,
71229
70976
  contextTopMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro6 = props.mihelpAgentProps) === null || _props$mihelpAgentPro6 === void 0 ? void 0 : _props$mihelpAgentPro6.contextTopMessagesCount,
71230
70977
  contextChunks: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro7 = props.mihelpAgentProps) === null || _props$mihelpAgentPro7 === void 0 ? void 0 : _props$mihelpAgentPro7.contextChunksCount,
71231
- mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro8 = props.mihelpAgentProps) === null || _props$mihelpAgentPro8 === void 0 ? void 0 : _props$mihelpAgentPro8.mihelpAgentRef,
71232
- chatBotVisible: chatBotVisible,
71233
- setChatBotVisible: setChatBotVisible,
71234
- notificationsCount: notificationsCount,
71235
- sideBarTopValue: sideBarTopValue
71236
- }))))))));
70978
+ mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro8 = props.mihelpAgentProps) === null || _props$mihelpAgentPro8 === void 0 ? void 0 : _props$mihelpAgentPro8.mihelpAgentRef
70979
+ })))))));
71237
70980
  };
71238
70981
  AppFrame.defaultProps = {
71239
70982
  handleScrolling: true,