@copart/ops-tool-kit 1.12.1-alpha.22 → 1.12.1-alpha.24
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.
- package/dist/ops-tool-kit.js +296 -51
- package/dist/ops-tool-kit.js.map +1 -1
- package/package.json +1 -1
package/dist/ops-tool-kit.js
CHANGED
|
@@ -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.
|
|
35
|
+
const version$7 = "1.12.1-alpha.24";
|
|
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(
|
|
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
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
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 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";
|
|
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 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.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",
|
|
@@ -35847,7 +35854,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
35847
35854
|
_ref$systemPrompt = _ref.systemPrompt,
|
|
35848
35855
|
systemPrompt = _ref$systemPrompt === void 0 ? '' : _ref$systemPrompt,
|
|
35849
35856
|
_ref$contextMessagesC = _ref.contextMessagesCount,
|
|
35850
|
-
contextMessagesCount = _ref$contextMessagesC === void 0 ? 5 : _ref$contextMessagesC
|
|
35857
|
+
contextMessagesCount = _ref$contextMessagesC === void 0 ? 5 : _ref$contextMessagesC,
|
|
35858
|
+
mihelpAgentRef = _ref.mihelpAgentRef;
|
|
35851
35859
|
var _useState = React.useState(false),
|
|
35852
35860
|
_useState2 = _slicedToArray(_useState, 2),
|
|
35853
35861
|
showChatWindow = _useState2[0],
|
|
@@ -35877,10 +35885,203 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
35877
35885
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
35878
35886
|
message = _useState14[0],
|
|
35879
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 - chatIconSize + 30
|
|
35957
|
+
});
|
|
35958
|
+
};
|
|
35959
|
+
updateInitialPosition();
|
|
35960
|
+
window.addEventListener('resize', updateInitialPosition);
|
|
35961
|
+
return function () {
|
|
35962
|
+
return window.removeEventListener('resize', updateInitialPosition);
|
|
35963
|
+
};
|
|
35964
|
+
}, []);
|
|
35965
|
+
var handleStart = function handleStart(e) {
|
|
35966
|
+
e.preventDefault();
|
|
35967
|
+
setIsDragging(true);
|
|
35968
|
+
setDragged(false);
|
|
35969
|
+
var clientX = e.touches ? e.touches[0].clientX : e.clientX;
|
|
35970
|
+
var clientY = e.touches ? e.touches[0].clientY : e.clientY;
|
|
35971
|
+
setOffset({
|
|
35972
|
+
x: clientX - position.x,
|
|
35973
|
+
y: clientY - position.y
|
|
35974
|
+
});
|
|
35975
|
+
};
|
|
35976
|
+
var handleMove = function handleMove(e) {
|
|
35977
|
+
if (isDragging) {
|
|
35978
|
+
setDragged(true);
|
|
35979
|
+
var clientX = e.touches ? e.touches[0].clientX : e.clientX;
|
|
35980
|
+
var clientY = e.touches ? e.touches[0].clientY : e.clientY;
|
|
35981
|
+
var newX = clientX - offset.x;
|
|
35982
|
+
var newY = clientY - offset.y;
|
|
35983
|
+
|
|
35984
|
+
// chat icon has to stay within set screen bounds
|
|
35985
|
+
newX = Math.max(chatIconSize + 10, Math.min(newX, window.innerWidth - 20));
|
|
35986
|
+
newY = Math.max(chatIconSize + 20, Math.min(newY, window.innerHeight - chatIconSize + 30));
|
|
35987
|
+
setPosition({
|
|
35988
|
+
x: newX,
|
|
35989
|
+
y: newY
|
|
35990
|
+
});
|
|
35991
|
+
}
|
|
35992
|
+
};
|
|
35993
|
+
var handleEnd = function handleEnd() {
|
|
35994
|
+
setIsDragging(false);
|
|
35995
|
+
setTimeout(function () {
|
|
35996
|
+
return setDragged(false);
|
|
35997
|
+
}, 100);
|
|
35998
|
+
adjustChatWindowPosition();
|
|
35999
|
+
};
|
|
36000
|
+
var adjustChatWindowPosition = function adjustChatWindowPosition() {
|
|
36001
|
+
var chatX = 0 - chatIconSize;
|
|
36002
|
+
var chatY = -chatWindowHeight - chatIconSize - 10; // Default: Open above
|
|
36003
|
+
|
|
36004
|
+
// Adjust horizontally
|
|
36005
|
+
if (position.x + chatWindowWidth > window.innerWidth) {
|
|
36006
|
+
chatX = -chatWindowWidth; // Move left if overflowing right
|
|
36007
|
+
}
|
|
36008
|
+
|
|
36009
|
+
// Adjust vertically
|
|
36010
|
+
if (position.y < chatWindowHeight) {
|
|
36011
|
+
chatY = 10; // Move below if there's not enough space above
|
|
36012
|
+
}
|
|
36013
|
+
|
|
36014
|
+
setChatPosition({
|
|
36015
|
+
x: chatX,
|
|
36016
|
+
y: chatY
|
|
36017
|
+
});
|
|
36018
|
+
};
|
|
35880
36019
|
React.useEffect(function () {
|
|
35881
|
-
|
|
36020
|
+
if (isDragging) {
|
|
36021
|
+
document.addEventListener('mousemove', handleMove);
|
|
36022
|
+
document.addEventListener('mouseup', handleEnd);
|
|
36023
|
+
document.addEventListener('touchmove', handleMove, {
|
|
36024
|
+
passive: false
|
|
36025
|
+
});
|
|
36026
|
+
document.addEventListener('touchend', handleEnd);
|
|
36027
|
+
} else {
|
|
36028
|
+
document.removeEventListener('mousemove', handleMove);
|
|
36029
|
+
document.removeEventListener('mouseup', handleEnd);
|
|
36030
|
+
document.removeEventListener('touchmove', handleMove);
|
|
36031
|
+
document.removeEventListener('touchend', handleEnd);
|
|
36032
|
+
}
|
|
36033
|
+
return function () {
|
|
36034
|
+
document.removeEventListener('mousemove', handleMove);
|
|
36035
|
+
document.removeEventListener('mouseup', handleEnd);
|
|
36036
|
+
document.removeEventListener('touchmove', handleMove);
|
|
36037
|
+
document.removeEventListener('touchend', handleEnd);
|
|
36038
|
+
};
|
|
36039
|
+
}, [isDragging]);
|
|
36040
|
+
var handleChatIconClick = function handleChatIconClick() {
|
|
36041
|
+
if (!dragged) {
|
|
36042
|
+
setShowChatWindow(function (prev) {
|
|
36043
|
+
return !prev;
|
|
36044
|
+
});
|
|
36045
|
+
}
|
|
36046
|
+
};
|
|
36047
|
+
React.useEffect(function () {
|
|
36048
|
+
var conversationsFromSession = storage$1.getLocalItem('mihelpAgentConversations');
|
|
35882
36049
|
var conversationsToBeSaved = !isEmpty$2(conversationsFromSession) ? conversationsFromSession : [];
|
|
35883
36050
|
setConversations(conversationsToBeSaved);
|
|
36051
|
+
var feedbacksFromSession = storage$1.getLocalItem('mihelpAgentFeedbacks');
|
|
36052
|
+
var feedbacksToBeSaved = !isEmpty$2(feedbacksFromSession) ? feedbacksFromSession : {};
|
|
36053
|
+
setFeedbacks(feedbacksToBeSaved);
|
|
36054
|
+
if (conversationsToBeSaved.length) {
|
|
36055
|
+
var _systemPrompts;
|
|
36056
|
+
var systemPrompts = conversationsToBeSaved.filter(function (c) {
|
|
36057
|
+
return (c === null || c === void 0 ? void 0 : c.role) === 'system';
|
|
36058
|
+
});
|
|
36059
|
+
var latestPrompt = ((_systemPrompts = systemPrompts[systemPrompts.length - 1]) === null || _systemPrompts === void 0 ? void 0 : _systemPrompts.content) || '';
|
|
36060
|
+
var match = latestPrompt.match(/<context>\s*([\s\S]*?)\s*<\/context>/);
|
|
36061
|
+
if (match) {
|
|
36062
|
+
var latestContext = {};
|
|
36063
|
+
try {
|
|
36064
|
+
latestContext = JSON.parse(match[1]);
|
|
36065
|
+
} catch (e) {
|
|
36066
|
+
console.log('context parse error', e);
|
|
36067
|
+
}
|
|
36068
|
+
if (!isEmpty$2(latestContext)) {
|
|
36069
|
+
setCurrentContext(latestContext);
|
|
36070
|
+
}
|
|
36071
|
+
} else {
|
|
36072
|
+
console.log('No context found');
|
|
36073
|
+
}
|
|
36074
|
+
}
|
|
36075
|
+
if (mihelpAgentRef && _typeof(mihelpAgentRef) === 'object') {
|
|
36076
|
+
mihelpAgentRef.current = {
|
|
36077
|
+
openChat: function openChat() {
|
|
36078
|
+
return setShowChatWindow(true);
|
|
36079
|
+
},
|
|
36080
|
+
closeChat: function closeChat() {
|
|
36081
|
+
return setShowChatWindow(false);
|
|
36082
|
+
}
|
|
36083
|
+
};
|
|
36084
|
+
}
|
|
35884
36085
|
}, []);
|
|
35885
36086
|
var chatBodyRef = React.useRef(null);
|
|
35886
36087
|
var scroll = function scroll() {
|
|
@@ -35896,7 +36097,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
35896
36097
|
context = storage$1.appContext;
|
|
35897
36098
|
}
|
|
35898
36099
|
} catch (e) {
|
|
35899
|
-
console.log('App context error
|
|
36100
|
+
console.log('App context error');
|
|
35900
36101
|
}
|
|
35901
36102
|
return frontEndUtils.string.substitute(systemPrompt, {
|
|
35902
36103
|
appContext: JSON.stringify(context)
|
|
@@ -35904,7 +36105,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
35904
36105
|
};
|
|
35905
36106
|
var send = /*#__PURE__*/function () {
|
|
35906
36107
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(messages) {
|
|
35907
|
-
var _storage$getLocalItem, _storage$getLocalItem2, _response$data, newMessages, payload, endpoint, response, newConversations;
|
|
36108
|
+
var _window$toolkitEnv, _window$toolkitEnv2, _window$toolkitEnv3, _storage$getLocalItem, _storage$getLocalItem2, _response$data, newMessages, isCoreApp, appTiles, appName, appData, appAuthName, messagesWithOutId, payload, endpoint, response, newConversations;
|
|
35908
36109
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35909
36110
|
while (1) switch (_context.prev = _context.next) {
|
|
35910
36111
|
case 0:
|
|
@@ -35913,54 +36114,84 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
35913
36114
|
_context.prev = 2;
|
|
35914
36115
|
newMessages = _toConsumableArray(messages);
|
|
35915
36116
|
if (systemPrompt && typeof systemPrompt === 'string') {
|
|
35916
|
-
|
|
35917
|
-
|
|
35918
|
-
|
|
35919
|
-
|
|
36117
|
+
if (!currentContext) {
|
|
36118
|
+
newMessages.unshift({
|
|
36119
|
+
role: 'system',
|
|
36120
|
+
content: getSystemPrompt()
|
|
36121
|
+
});
|
|
36122
|
+
if (!isEmpty$2(storage$1.appContext)) {
|
|
36123
|
+
setCurrentContext(storage$1.appContext);
|
|
36124
|
+
}
|
|
36125
|
+
} else if (!equals$1(currentContext, storage$1.appContext)) {
|
|
36126
|
+
setCurrentContext(storage$1.appContext);
|
|
36127
|
+
newMessages.splice(newMessages.length - 1, 0, {
|
|
36128
|
+
role: 'system',
|
|
36129
|
+
content: getSystemPrompt()
|
|
36130
|
+
});
|
|
36131
|
+
}
|
|
35920
36132
|
}
|
|
36133
|
+
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;
|
|
36134
|
+
appTiles = storage$1.getLocalItem('opsportal-core:config').tiles || [];
|
|
36135
|
+
appName = (_window$toolkitEnv2 = window.toolkitEnv) !== null && _window$toolkitEnv2 !== void 0 && _window$toolkitEnv2.APP_NAME ? window.toolkitEnv.APP_NAME : process.env.APP_NAME;
|
|
36136
|
+
appData = appTiles.find(function (tile) {
|
|
36137
|
+
if (tile.appName) {
|
|
36138
|
+
return tile.appName === appName;
|
|
36139
|
+
} else {
|
|
36140
|
+
return tile.path === "/".concat(appName);
|
|
36141
|
+
}
|
|
36142
|
+
});
|
|
36143
|
+
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;
|
|
36144
|
+
messagesWithOutId = newMessages.map(function (m) {
|
|
36145
|
+
return {
|
|
36146
|
+
role: m === null || m === void 0 ? void 0 : m.role,
|
|
36147
|
+
content: m === null || m === void 0 ? void 0 : m.content
|
|
36148
|
+
};
|
|
36149
|
+
});
|
|
35921
36150
|
payload = {
|
|
35922
|
-
messages:
|
|
36151
|
+
messages: messagesWithOutId,
|
|
35923
36152
|
collection: collection,
|
|
35924
|
-
last_n: contextMessagesCount
|
|
36153
|
+
last_n: contextMessagesCount,
|
|
36154
|
+
appName: isCoreApp ? 'g2Home' : appAuthName
|
|
35925
36155
|
};
|
|
35926
36156
|
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;
|
|
35927
|
-
_context.next =
|
|
36157
|
+
_context.next = 15;
|
|
35928
36158
|
return fetcher.post(endpoint, payload, {
|
|
35929
36159
|
headers: {
|
|
35930
36160
|
'Content-Type': 'application/json'
|
|
35931
36161
|
}
|
|
35932
36162
|
});
|
|
35933
|
-
case
|
|
36163
|
+
case 15:
|
|
35934
36164
|
response = _context.sent;
|
|
35935
36165
|
setIsLoading(false);
|
|
35936
|
-
newConversations = [].concat(_toConsumableArray(
|
|
36166
|
+
newConversations = [].concat(_toConsumableArray(newMessages), [{
|
|
35937
36167
|
role: 'assistant',
|
|
35938
|
-
content: response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.content
|
|
36168
|
+
content: response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.content,
|
|
36169
|
+
id: nonSecure()
|
|
35939
36170
|
}]);
|
|
35940
36171
|
setConversations(newConversations);
|
|
35941
|
-
storage$1.
|
|
35942
|
-
_context.next =
|
|
36172
|
+
storage$1.setLocalItem('mihelpAgentConversations', newConversations);
|
|
36173
|
+
_context.next = 34;
|
|
35943
36174
|
break;
|
|
35944
|
-
case
|
|
35945
|
-
_context.prev =
|
|
36175
|
+
case 22:
|
|
36176
|
+
_context.prev = 22;
|
|
35946
36177
|
_context.t0 = _context["catch"](2);
|
|
35947
36178
|
if (!(retryCount.current < 3)) {
|
|
35948
|
-
_context.next =
|
|
36179
|
+
_context.next = 30;
|
|
35949
36180
|
break;
|
|
35950
36181
|
}
|
|
35951
36182
|
retryCount.current++;
|
|
35952
36183
|
send(messages);
|
|
35953
36184
|
return _context.abrupt("return");
|
|
35954
|
-
case
|
|
36185
|
+
case 30:
|
|
35955
36186
|
retryCount.current = 0;
|
|
35956
36187
|
setMessageError(true);
|
|
35957
36188
|
setIsLoading(false);
|
|
35958
36189
|
console.log(_context.t0);
|
|
35959
|
-
case
|
|
36190
|
+
case 34:
|
|
35960
36191
|
case "end":
|
|
35961
36192
|
return _context.stop();
|
|
35962
36193
|
}
|
|
35963
|
-
}, _callee, null, [[2,
|
|
36194
|
+
}, _callee, null, [[2, 22]]);
|
|
35964
36195
|
}));
|
|
35965
36196
|
return function send(_x) {
|
|
35966
36197
|
return _ref2.apply(this, arguments);
|
|
@@ -36016,7 +36247,8 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
36016
36247
|
}, [quickReplies]);
|
|
36017
36248
|
var handleNewConversation = function handleNewConversation() {
|
|
36018
36249
|
setConversations([]);
|
|
36019
|
-
storage$1.
|
|
36250
|
+
storage$1.setLocalItem('mihelpAgentConversations', []);
|
|
36251
|
+
storage$1.setLocalItem('mihelpAgentFeedbacks', {});
|
|
36020
36252
|
setMessageError(false);
|
|
36021
36253
|
};
|
|
36022
36254
|
var isChromeOnIPhone = function isChromeOnIPhone() {
|
|
@@ -36025,12 +36257,23 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
36025
36257
|
var isChrome = /CriOS/i.test(userAgent);
|
|
36026
36258
|
return isIPhone && isChrome;
|
|
36027
36259
|
};
|
|
36028
|
-
|
|
36260
|
+
var chatbotUI = /*#__PURE__*/React__default["default"].createElement("div", {
|
|
36261
|
+
onMouseDown: handleStart,
|
|
36262
|
+
onTouchStart: handleStart,
|
|
36263
|
+
style: {
|
|
36264
|
+
left: "".concat(position.x, "px"),
|
|
36265
|
+
top: "".concat(position.y, "px"),
|
|
36266
|
+
cursor: 'grab'
|
|
36267
|
+
},
|
|
36029
36268
|
className: _getClassName("mihelpAgentWrapper ".concat(isChromeOnIPhone() ? 'iphoneChrome' : ''), _styleModuleImportMap$2, {
|
|
36030
36269
|
"handleMissingStyleName": "warn"
|
|
36031
36270
|
})
|
|
36032
36271
|
}, showChatWindow && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
36033
|
-
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow"
|
|
36272
|
+
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindow",
|
|
36273
|
+
style: {
|
|
36274
|
+
left: "".concat(chatPosition.x, "px"),
|
|
36275
|
+
top: "".concat(chatPosition.y, "px")
|
|
36276
|
+
}
|
|
36034
36277
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
36035
36278
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatWindowHeader"
|
|
36036
36279
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -36104,7 +36347,9 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
36104
36347
|
})), function () {
|
|
36105
36348
|
var userCount = 0;
|
|
36106
36349
|
var agentCount = 2;
|
|
36107
|
-
return conversations.
|
|
36350
|
+
return conversations.filter(function (c) {
|
|
36351
|
+
return (c === null || c === void 0 ? void 0 : c.role) !== 'system';
|
|
36352
|
+
}).map(function (conversation) {
|
|
36108
36353
|
var isUser = (conversation === null || conversation === void 0 ? void 0 : conversation.role) === 'user';
|
|
36109
36354
|
var testId = isUser ? "user-message-".concat(++userCount) : "agent-message-".concat(++agentCount);
|
|
36110
36355
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -36185,9 +36430,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
36185
36430
|
disabled: isLoading || collectionError
|
|
36186
36431
|
}))))), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
36187
36432
|
className: "utilities_ops-app-frame_MiHelpAgent_MiHelpAgent--chatIcon",
|
|
36188
|
-
onClick:
|
|
36189
|
-
return setShowChatWindow(!showChatWindow);
|
|
36190
|
-
}
|
|
36433
|
+
onClick: handleChatIconClick
|
|
36191
36434
|
}, /*#__PURE__*/React__default["default"].createElement(coreComponents.IconV2, {
|
|
36192
36435
|
name: "comment-sparkle-custom",
|
|
36193
36436
|
variant: "light",
|
|
@@ -36196,6 +36439,7 @@ var MiHelpAgent = function MiHelpAgent(_ref) {
|
|
|
36196
36439
|
fontSize: '22px'
|
|
36197
36440
|
}
|
|
36198
36441
|
})));
|
|
36442
|
+
return ReactDOM__default["default"].createPortal(chatbotUI, document.body);
|
|
36199
36443
|
};
|
|
36200
36444
|
|
|
36201
36445
|
/**
|
|
@@ -47161,7 +47405,7 @@ var SCROLL = {
|
|
|
47161
47405
|
var NO_SCROLL = {};
|
|
47162
47406
|
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>';
|
|
47163
47407
|
var AppFrame = function AppFrame(props) {
|
|
47164
|
-
var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3, _props$mihelpAgentPro4;
|
|
47408
|
+
var _props$mihelpAgentPro, _props$mihelpAgentPro2, _props$mihelpAgentPro3, _props$mihelpAgentPro4, _props$mihelpAgentPro5;
|
|
47165
47409
|
// Check if the child AppBar is mounted
|
|
47166
47410
|
var _useState = React.useState(false),
|
|
47167
47411
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -47262,7 +47506,8 @@ var AppFrame = function AppFrame(props) {
|
|
|
47262
47506
|
quickReplies: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro = props.mihelpAgentProps) === null || _props$mihelpAgentPro === void 0 ? void 0 : _props$mihelpAgentPro.quickReplies,
|
|
47263
47507
|
collection: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro2 = props.mihelpAgentProps) === null || _props$mihelpAgentPro2 === void 0 ? void 0 : _props$mihelpAgentPro2.collection,
|
|
47264
47508
|
systemPrompt: (props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro3 = props.mihelpAgentProps) === null || _props$mihelpAgentPro3 === void 0 ? void 0 : _props$mihelpAgentPro3.systemPrompt) || defaultSystemPrompt,
|
|
47265
|
-
contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro4 = props.mihelpAgentProps) === null || _props$mihelpAgentPro4 === void 0 ? void 0 : _props$mihelpAgentPro4.contextMessagesCount
|
|
47509
|
+
contextMessagesCount: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro4 = props.mihelpAgentProps) === null || _props$mihelpAgentPro4 === void 0 ? void 0 : _props$mihelpAgentPro4.contextMessagesCount,
|
|
47510
|
+
mihelpAgentRef: props === null || props === void 0 ? void 0 : (_props$mihelpAgentPro5 = props.mihelpAgentProps) === null || _props$mihelpAgentPro5 === void 0 ? void 0 : _props$mihelpAgentPro5.mihelpAgentRef
|
|
47266
47511
|
}))))));
|
|
47267
47512
|
};
|
|
47268
47513
|
AppFrame.defaultProps = {
|