@copart/ops-tool-kit 1.12.1-alpha.21 → 1.12.1-alpha.23

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.
@@ -32,7 +32,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
32
32
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
33
33
 
34
34
  const name$r = "@copart/ops-tool-kit";
35
- const version$7 = "1.12.1-alpha.21";
35
+ const version$7 = "1.12.1-alpha.23";
36
36
  const main$1 = "dist/ops-tool-kit.js";
37
37
  const style = "dist/ops-tool-kit.css";
38
38
  const files = [
@@ -2761,7 +2761,7 @@ var setAppContext = function setAppContext() {
2761
2761
  if (!appAuthName) throw new Error('appAuthName not found');
2762
2762
  setSessionItem("".concat(appAuthName, ":miHelpBotContext"), context);
2763
2763
  } catch (e) {
2764
- console.log("***Error while setting context ", e);
2764
+ console.log('Error while setting context ', e);
2765
2765
  }
2766
2766
  };
2767
2767
  var createOpsStorage = function createOpsStorage() {
@@ -2784,23 +2784,28 @@ var createOpsStorage = function createOpsStorage() {
2784
2784
  return value;
2785
2785
  },
2786
2786
  get appContext() {
2787
- var _window$toolkitEnv6;
2788
- var isCoreApp = (_window$toolkitEnv6 = window.toolkitEnv) !== null && _window$toolkitEnv6 !== void 0 && _window$toolkitEnv6.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
2789
- if (isCoreApp) {
2790
- return getSessionItem('opsportal-core:miHelpBotContext');
2791
- } else {
2792
- var _window$toolkitEnv7, _window$toolkitEnv8;
2793
- var appTiles = storage$1.getLocalItem('opsportal-core:config').tiles || [];
2794
- var appName = (_window$toolkitEnv7 = window.toolkitEnv) !== null && _window$toolkitEnv7 !== void 0 && _window$toolkitEnv7.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
2795
- var appData = appTiles.find(function (tile) {
2796
- if (tile.appName) {
2797
- return tile.appName === appName;
2798
- } else {
2799
- return tile.path === "/".concat(appName);
2800
- }
2801
- });
2802
- var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv8 = window.toolkitEnv) !== null && _window$toolkitEnv8 !== void 0 && _window$toolkitEnv8.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
2803
- return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : '';
2787
+ try {
2788
+ var _window$toolkitEnv6;
2789
+ var isCoreApp = (_window$toolkitEnv6 = window.toolkitEnv) !== null && _window$toolkitEnv6 !== void 0 && _window$toolkitEnv6.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
2790
+ if (isCoreApp) {
2791
+ return getSessionItem('opsportal-core:miHelpBotContext');
2792
+ } else {
2793
+ var _window$toolkitEnv7, _window$toolkitEnv8;
2794
+ var appTiles = storage$1.getLocalItem('opsportal-core:config').tiles || [];
2795
+ var appName = (_window$toolkitEnv7 = window.toolkitEnv) !== null && _window$toolkitEnv7 !== void 0 && _window$toolkitEnv7.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
2796
+ var appData = appTiles.find(function (tile) {
2797
+ if (tile.appName) {
2798
+ return tile.appName === appName;
2799
+ } else {
2800
+ return tile.path === "/".concat(appName);
2801
+ }
2802
+ });
2803
+ var appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv8 = window.toolkitEnv) !== null && _window$toolkitEnv8 !== void 0 && _window$toolkitEnv8.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
2804
+ return appAuthName ? getSessionItem("".concat(appAuthName, ":miHelpBotContext")) : '';
2805
+ }
2806
+ } catch (e) {
2807
+ console.log('App context error, ', e);
2808
+ return '';
2804
2809
  }
2805
2810
  },
2806
2811
  get config() {
@@ -2947,6 +2952,7 @@ var createOpsStorage = function createOpsStorage() {
2947
2952
  logout: function logout() {
2948
2953
  clearStorage();
2949
2954
  localStorage.removeItem('c2dEnabled');
2955
+ localStorage.removeItem('mihelpAgentConversations');
2950
2956
  window.location.assign('/logout');
2951
2957
  }
2952
2958
  };
@@ -35805,7 +35811,7 @@ var GoHome = function GoHome(props) {
35805
35811
  }, props.reason));
35806
35812
  };
35807
35813
 
35808
- 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}\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.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}\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}\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 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 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}\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 .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--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";
35814
+ 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}\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.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}\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}\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 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}\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 .utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--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";
35809
35815
  styleInject(css_248z$3);
35810
35816
 
35811
35817
  var _styleModuleImportMap$2 = {
@@ -35830,6 +35836,7 @@ var _styleModuleImportMap$2 = {
35830
35836
  "agentIcon": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--agentIcon",
35831
35837
  "messageBubble": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--messageBubble",
35832
35838
  "error": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--error",
35839
+ "feedbackContainer": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--feedbackContainer",
35833
35840
  "chatWindowFooter": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowFooter",
35834
35841
  "inputContainer": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--inputContainer",
35835
35842
  "disabled": "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--disabled",
@@ -35845,7 +35852,10 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
35845
35852
  _ref$collection = _ref.collection,
35846
35853
  collection = _ref$collection === void 0 ? '' : _ref$collection,
35847
35854
  _ref$systemPrompt = _ref.systemPrompt,
35848
- systemPrompt = _ref$systemPrompt === void 0 ? '' : _ref$systemPrompt;
35855
+ systemPrompt = _ref$systemPrompt === void 0 ? '' : _ref$systemPrompt,
35856
+ _ref$contextMessagesC = _ref.contextMessagesCount,
35857
+ contextMessagesCount = _ref$contextMessagesC === void 0 ? 5 : _ref$contextMessagesC,
35858
+ mihelpAgentRef = _ref.mihelpAgentRef;
35849
35859
  var _useState = React.useState(false),
35850
35860
  _useState2 = _slicedToArray(_useState, 2),
35851
35861
  showChatWindow = _useState2[0],
@@ -35875,10 +35885,190 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
35875
35885
  _useState14 = _slicedToArray(_useState13, 2),
35876
35886
  message = _useState14[0],
35877
35887
  setMessage = _useState14[1];
35888
+ var _useState15 = React.useState(null),
35889
+ _useState16 = _slicedToArray(_useState15, 2),
35890
+ currentContext = _useState16[0],
35891
+ setCurrentContext = _useState16[1];
35892
+ var _useState17 = React.useState({}),
35893
+ _useState18 = _slicedToArray(_useState17, 2);
35894
+ _useState18[0];
35895
+ var setFeedbacks = _useState18[1];
35896
+ var _useState19 = React.useState({
35897
+ x: 0,
35898
+ y: 0
35899
+ }),
35900
+ _useState20 = _slicedToArray(_useState19, 2),
35901
+ position = _useState20[0],
35902
+ setPosition = _useState20[1];
35903
+ var _useState21 = React.useState({
35904
+ x: 50,
35905
+ y: -68
35906
+ }),
35907
+ _useState22 = _slicedToArray(_useState21, 2),
35908
+ chatPosition = _useState22[0],
35909
+ setChatPosition = _useState22[1];
35910
+ var _useState23 = React.useState(false),
35911
+ _useState24 = _slicedToArray(_useState23, 2),
35912
+ isDragging = _useState24[0],
35913
+ setIsDragging = _useState24[1];
35914
+ var _useState25 = React.useState({
35915
+ x: 0,
35916
+ y: 0
35917
+ }),
35918
+ _useState26 = _slicedToArray(_useState25, 2),
35919
+ offset = _useState26[0],
35920
+ setOffset = _useState26[1];
35921
+ var _useState27 = React.useState(false),
35922
+ _useState28 = _slicedToArray(_useState27, 2),
35923
+ dragged = _useState28[0],
35924
+ setDragged = _useState28[1];
35925
+ var _useState29 = React.useState(500),
35926
+ _useState30 = _slicedToArray(_useState29, 2),
35927
+ chatWindowWidth = _useState30[0],
35928
+ setChatWindowWidth = _useState30[1];
35929
+ var chatWindowHeight = 600; //update this if changed in css
35930
+ var chatIconSize = 60; //update this if changed in css
35931
+
35932
+ React.useEffect(function () {
35933
+ var updateChatWindowWidth = function updateChatWindowWidth() {
35934
+ var width = window.innerWidth;
35935
+ var newWidth = 500;
35936
+
35937
+ //Update these values if changed in css
35938
+ if (width <= 575) newWidth = 450;
35939
+ if (width <= 475) newWidth = 400;
35940
+ if (width <= 425) newWidth = 350;
35941
+ if (width <= 375) newWidth = 325;
35942
+ if (width <= 350) newWidth = 300;
35943
+ if (width <= 325) newWidth = 275;
35944
+ setChatWindowWidth(newWidth);
35945
+ };
35946
+ updateChatWindowWidth();
35947
+ window.addEventListener('resize', updateChatWindowWidth);
35948
+ return function () {
35949
+ return window.removeEventListener('resize', updateChatWindowWidth);
35950
+ };
35951
+ }, []);
35952
+ React.useEffect(function () {
35953
+ var updateInitialPosition = function updateInitialPosition() {
35954
+ setPosition({
35955
+ x: window.innerWidth - chatIconSize,
35956
+ y: window.innerHeight - 70 - chatIconSize
35957
+ });
35958
+ };
35959
+ updateInitialPosition();
35960
+ window.addEventListener('resize', updateInitialPosition);
35961
+ return function () {
35962
+ return window.removeEventListener('resize', updateInitialPosition);
35963
+ };
35964
+ }, []);
35965
+ var handleMouseDown = function handleMouseDown(e) {
35966
+ setIsDragging(true);
35967
+ setDragged(false);
35968
+ setOffset({
35969
+ x: e.clientX - position.x,
35970
+ y: e.clientY - position.y
35971
+ });
35972
+ };
35973
+ var handleMouseMove = function handleMouseMove(e) {
35974
+ if (isDragging) {
35975
+ setDragged(true);
35976
+ var newX = e.clientX - offset.x;
35977
+ var newY = e.clientY - offset.y;
35978
+
35979
+ // chat icon has to stay within set screen bounds
35980
+ newX = Math.max(chatIconSize + 10, Math.min(newX, window.innerWidth - chatIconSize));
35981
+ newY = Math.max(0, Math.min(newY, window.innerHeight - chatIconSize - 50));
35982
+ setPosition({
35983
+ x: newX,
35984
+ y: newY
35985
+ });
35986
+ }
35987
+ };
35988
+ var handleMouseUp = function handleMouseUp() {
35989
+ setIsDragging(false);
35990
+ setTimeout(function () {
35991
+ return setDragged(false);
35992
+ }, 100);
35993
+ adjustChatWindowPosition();
35994
+ };
35995
+ var adjustChatWindowPosition = function adjustChatWindowPosition() {
35996
+ var chatX = 0 - chatIconSize;
35997
+ var chatY = -chatWindowHeight - chatIconSize - 10; // Default: Open above
35998
+
35999
+ // Adjust horizontally
36000
+ if (position.x + chatWindowWidth > window.innerWidth) {
36001
+ chatX = -chatWindowWidth; // Move left if overflowing right
36002
+ }
36003
+
36004
+ // Adjust vertically
36005
+ if (position.y < chatWindowHeight) {
36006
+ chatY = 10; // Move below if there's not enough space above
36007
+ }
36008
+
36009
+ setChatPosition({
36010
+ x: chatX,
36011
+ y: chatY
36012
+ });
36013
+ };
36014
+ React.useEffect(function () {
36015
+ if (isDragging) {
36016
+ document.addEventListener('mousemove', handleMouseMove);
36017
+ document.addEventListener('mouseup', handleMouseUp);
36018
+ } else {
36019
+ document.removeEventListener('mousemove', handleMouseMove);
36020
+ document.removeEventListener('mouseup', handleMouseUp);
36021
+ }
36022
+ return function () {
36023
+ document.removeEventListener('mousemove', handleMouseMove);
36024
+ document.removeEventListener('mouseup', handleMouseUp);
36025
+ };
36026
+ }, [isDragging]);
36027
+ var handleChatIconClick = function handleChatIconClick() {
36028
+ if (!dragged) {
36029
+ setShowChatWindow(function (prev) {
36030
+ return !prev;
36031
+ });
36032
+ }
36033
+ };
35878
36034
  React.useEffect(function () {
35879
- var conversationsFromSession = storage$1.getSessionItem('mihelpAgentConversations');
36035
+ var conversationsFromSession = storage$1.getLocalItem('mihelpAgentConversations');
35880
36036
  var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
35881
36037
  setConversations(conversationsToBeSaved);
36038
+ var feedbacksFromSession = storage$1.getLocalItem('mihelpAgentFeedbacks');
36039
+ var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
36040
+ setFeedbacks(feedbacksToBeSaved);
36041
+ if (conversationsToBeSaved.length) {
36042
+ var _systemPrompts;
36043
+ var systemPrompts = conversationsToBeSaved.filter(function (c) {
36044
+ return (c === null || c === void 0 ? void 0 : c.role) === 'system';
36045
+ });
36046
+ var latestPrompt = ((_systemPrompts = systemPrompts[systemPrompts.length - 1]) === null || _systemPrompts === void 0 ? void 0 : _systemPrompts.content) || '';
36047
+ var match = latestPrompt.match(/<context>\s*([\s\S]*?)\s*<\/context>/);
36048
+ if (match) {
36049
+ var latestContext = {};
36050
+ try {
36051
+ latestContext = JSON.parse(match[1]);
36052
+ } catch (e) {
36053
+ console.log('context parse error', e);
36054
+ }
36055
+ if (!isEmpty$2(latestContext)) {
36056
+ setCurrentContext(latestContext);
36057
+ }
36058
+ } else {
36059
+ console.log('No context found');
36060
+ }
36061
+ }
36062
+ if (mihelpAgentRef && _typeof(mihelpAgentRef) === 'object') {
36063
+ mihelpAgentRef.current = {
36064
+ openChat: function openChat() {
36065
+ return setShowChatWindow(true);
36066
+ },
36067
+ closeChat: function closeChat() {
36068
+ return setShowChatWindow(false);
36069
+ }
36070
+ };
36071
+ }
35882
36072
  }, []);
35883
36073
  var chatBodyRef = React.useRef(null);
35884
36074
  var scroll = function scroll() {
@@ -35894,7 +36084,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
35894
36084
  context = storage$1.appContext;
35895
36085
  }
35896
36086
  } catch (e) {
35897
- console.log('App context error, ', storage$1.appContext);
36087
+ console.log('App context error');
35898
36088
  }
35899
36089
  return frontEndUtils.string.substitute(systemPrompt, {
35900
36090
  appContext: JSON.stringify(context)
@@ -35902,7 +36092,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
35902
36092
  };
35903
36093
  var send = /*#__PURE__*/function () {
35904
36094
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(messages) {
35905
- var _storage$getLocalItem, _storage$getLocalItem2, _response$data, newMessages, payload, endpoint, response, newConversations;
36095
+ var _window$toolkitEnv, _window$toolkitEnv2, _window$toolkitEnv3, _storage$getLocalItem, _storage$getLocalItem2, _response$data, newMessages, isCoreApp, appTiles, appName, appData, appAuthName, messagesWithOutId, payload, endpoint, response, newConversations;
35906
36096
  return _regeneratorRuntime().wrap(function _callee$(_context) {
35907
36097
  while (1) switch (_context.prev = _context.next) {
35908
36098
  case 0:
@@ -35911,53 +36101,84 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
35911
36101
  _context.prev = 2;
35912
36102
  newMessages = _toConsumableArray(messages);
35913
36103
  if (systemPrompt && typeof systemPrompt === 'string') {
35914
- newMessages.unshift({
35915
- role: 'system',
35916
- content: getSystemPrompt()
35917
- });
36104
+ if (!currentContext) {
36105
+ newMessages.unshift({
36106
+ role: 'system',
36107
+ content: getSystemPrompt()
36108
+ });
36109
+ if (!isEmpty$2(storage$1.appContext)) {
36110
+ setCurrentContext(storage$1.appContext);
36111
+ }
36112
+ } else if (!equals$1(currentContext, storage$1.appContext)) {
36113
+ setCurrentContext(storage$1.appContext);
36114
+ newMessages.splice(newMessages.length - 1, 0, {
36115
+ role: 'system',
36116
+ content: getSystemPrompt()
36117
+ });
36118
+ }
35918
36119
  }
36120
+ isCoreApp = (_window$toolkitEnv = window.toolkitEnv) !== null && _window$toolkitEnv !== void 0 && _window$toolkitEnv.IS_CORE_APP ? window.toolkitEnv.IS_CORE_APP : process.env.IS_CORE_APP;
36121
+ appTiles = storage$1.getLocalItem('opsportal-core:config').tiles || [];
36122
+ appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
36123
+ appData = appTiles.find(function (tile) {
36124
+ if (tile.appName) {
36125
+ return tile.appName === appName;
36126
+ } else {
36127
+ return tile.path === "/".concat(appName);
36128
+ }
36129
+ });
36130
+ appAuthName = appData ? appData.appAuthName : (_window$toolkitEnv3 = window.toolkitEnv) !== null && _window$toolkitEnv3 !== void 0 && _window$toolkitEnv3.APP_AUTH_NAME ? window.toolkitEnv.APP_AUTH_NAME : process.env.APP_AUTH_NAME;
36131
+ messagesWithOutId = newMessages.map(function (m) {
36132
+ return {
36133
+ role: m === null || m === void 0 ? void 0 : m.role,
36134
+ content: m === null || m === void 0 ? void 0 : m.content
36135
+ };
36136
+ });
35919
36137
  payload = {
35920
- messages: newMessages,
35921
- collection: collection
36138
+ messages: messagesWithOutId,
36139
+ collection: collection,
36140
+ last_n: contextMessagesCount,
36141
+ appName: isCoreApp ? 'g2Home' : appAuthName
35922
36142
  };
35923
36143
  endpoint = (_storage$getLocalItem = storage$1.getLocalItem('opsportal-core:config')) === null || _storage$getLocalItem === void 0 ? void 0 : (_storage$getLocalItem2 = _storage$getLocalItem.endpoints) === null || _storage$getLocalItem2 === void 0 ? void 0 : _storage$getLocalItem2.mihelpChat;
35924
- _context.next = 9;
36144
+ _context.next = 15;
35925
36145
  return fetcher.post(endpoint, payload, {
35926
36146
  headers: {
35927
36147
  'Content-Type': 'application/json'
35928
36148
  }
35929
36149
  });
35930
- case 9:
36150
+ case 15:
35931
36151
  response = _context.sent;
35932
36152
  setIsLoading(false);
35933
- newConversations = [].concat(_toConsumableArray(messages), [{
36153
+ newConversations = [].concat(_toConsumableArray(newMessages), [{
35934
36154
  role: 'assistant',
35935
- content: response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.content
36155
+ content: response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.content,
36156
+ id: nonSecure()
35936
36157
  }]);
35937
36158
  setConversations(newConversations);
35938
- storage$1.setSessionItem('mihelpAgentConversations', newConversations);
35939
- _context.next = 28;
36159
+ storage$1.setLocalItem('mihelpAgentConversations', newConversations);
36160
+ _context.next = 34;
35940
36161
  break;
35941
- case 16:
35942
- _context.prev = 16;
36162
+ case 22:
36163
+ _context.prev = 22;
35943
36164
  _context.t0 = _context["catch"](2);
35944
36165
  if (!(retryCount.current < 3)) {
35945
- _context.next = 24;
36166
+ _context.next = 30;
35946
36167
  break;
35947
36168
  }
35948
36169
  retryCount.current++;
35949
36170
  send(messages);
35950
36171
  return _context.abrupt("return");
35951
- case 24:
36172
+ case 30:
35952
36173
  retryCount.current = 0;
35953
36174
  setMessageError(true);
35954
36175
  setIsLoading(false);
35955
36176
  console.log(_context.t0);
35956
- case 28:
36177
+ case 34:
35957
36178
  case "end":
35958
36179
  return _context.stop();
35959
36180
  }
35960
- }, _callee, null, [[2, 16]]);
36181
+ }, _callee, null, [[2, 22]]);
35961
36182
  }));
35962
36183
  return function send(_x) {
35963
36184
  return _ref2.apply(this, arguments);
@@ -36013,7 +36234,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
36013
36234
  }, [quickReplies]);
36014
36235
  var handleNewConversation = function handleNewConversation() {
36015
36236
  setConversations([]);
36016
- storage$1.setSessionItem('mihelpAgentConversations', []);
36237
+ storage$1.setLocalItem('mihelpAgentConversations', []);
36238
+ storage$1.setLocalItem('mihelpAgentFeedbacks', {});
36017
36239
  setMessageError(false);
36018
36240
  };
36019
36241
  var isChromeOnIPhone = function isChromeOnIPhone() {
@@ -36023,11 +36245,21 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
36023
36245
  return isIPhone && isChrome;
36024
36246
  };
36025
36247
  return /*#__PURE__*/React__default["default"].createElement("div", {
36248
+ onMouseDown: handleMouseDown,
36249
+ style: {
36250
+ left: "".concat(position.x, "px"),
36251
+ top: "".concat(position.y, "px"),
36252
+ cursor: 'grab'
36253
+ },
36026
36254
  className: _getClassName("mihelpAgentWrapper ".concat(isChromeOnIPhone() ? 'iphoneChrome' : ''), _styleModuleImportMap$2, {
36027
36255
  "handleMissingStyleName": "warn"
36028
36256
  })
36029
36257
  }, showChatWindow && /*#__PURE__*/React__default["default"].createElement("div", {
36030
- className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow"
36258
+ className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
36259
+ style: {
36260
+ left: "".concat(chatPosition.x, "px"),
36261
+ top: "".concat(chatPosition.y, "px")
36262
+ }
36031
36263
  }, /*#__PURE__*/React__default["default"].createElement("div", {
36032
36264
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader"
36033
36265
  }, /*#__PURE__*/React__default["default"].createElement("span", {
@@ -36101,7 +36333,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
36101
36333
  })), function () {
36102
36334
  var userCount = 0;
36103
36335
  var agentCount = 2;
36104
- return conversations.map(function (conversation) {
36336
+ return conversations.filter(function (c) {
36337
+ return (c === null || c === void 0 ? void 0 : c.role) !== 'system';
36338
+ }).map(function (conversation) {
36105
36339
  var isUser = (conversation === null || conversation === void 0 ? void 0 : conversation.role) === 'user';
36106
36340
  var testId = isUser ? "user-message-".concat(++userCount) : "agent-message-".concat(++agentCount);
36107
36341
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -36182,9 +36416,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
36182
36416
  disabled: isLoading || collectionError
36183
36417
  }))))), /*#__PURE__*/React__default["default"].createElement("span", {
36184
36418
  className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
36185
- onClick: function onClick() {
36186
- return setShowChatWindow(!showChatWindow);
36187
- }
36419
+ onClick: handleChatIconClick
36188
36420
  }, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
36189
36421
  name: "comment-sparkle-custom",
36190
36422
  variant: "light",
@@ -47158,7 +47390,7 @@ var SCROLL = {
47158
47390
  var NO_SCROLL = {};
47159
47391
  var defaultSystemPrompt = 'Format all of the subsequent AI responses in valid HTML5, without markdown code blocks or any additional formatting, ensuring that the response consists only of raw HTML tags. Format your response in this structure:<html> <p> Your answer here </p> </html>';
47160
47392
  var AppFrame = function AppFrame(props) {
47161
- var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3;
47393
+ var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3, _props$mihelpAgentPro4, _props$mihelpAgentPro5;
47162
47394
  // Check if the child AppBar is mounted
47163
47395
  var _useState = React.useState(false),
47164
47396
  _useState2 = _slicedToArray(_useState, 2),
@@ -47258,7 +47490,9 @@ var AppFrame = function AppFrame(props) {
47258
47490
  }, props.children), chatBotEnabled && /*#__PURE__*/React__default["default"].createElement(MiHelpAgent, {
47259
47491
  quickReplies: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro = props.mihelpAgentProps) === null || _props$mihelpAgentPro === void 0 ? void 0 : _props$mihelpAgentPro.quickReplies,
47260
47492
  collection: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro2 = props.mihelpAgentProps) === null || _props$mihelpAgentPro2 === void 0 ? void 0 : _props$mihelpAgentPro2.collection,
47261
- systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt
47493
+ systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt,
47494
+ contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro4 = props.mihelpAgentProps) === null || _props$mihelpAgentPro4 === void 0 ? void 0 : _props$mihelpAgentPro4.contextMessagesCount,
47495
+ mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.mihelpAgentRef
47262
47496
  }))))));
47263
47497
  };
47264
47498
  AppFrame.defaultProps = {