diff --git a/frontend/src/components/Billing.jsx b/frontend/src/components/Billing.jsx index 26b88ca5..d5b33aca 100644 --- a/frontend/src/components/Billing.jsx +++ b/frontend/src/components/Billing.jsx @@ -26,7 +26,8 @@ import { Tooltip, DialogContentText, DialogActions, - LinearProgress + LinearProgress, + Slider } from "@mui/material"; import { useNavigate, Link, json } from "react-router-dom"; @@ -880,6 +881,305 @@ const Billing = (props) => { ) } + const ConsultationManagement = (props) => { + const { globalUrl, userdata, selectedOrganization, } = props; + + const [inputHour, setInputHour] = React.useState( + selectedOrganization.Billing && + selectedOrganization.Billing.Consultation && + selectedOrganization.Billing.Consultation.hours !== undefined && + selectedOrganization.Billing.Consultation.hours !== "" + ? selectedOrganization.Billing.Consultation.hours + : 0 + ); + + const [inputMinutes, setInputMinutes] = React.useState( + selectedOrganization.Billing && + selectedOrganization.Billing.Consultation && + selectedOrganization.Billing.Consultation.minutes !== undefined && + selectedOrganization.Billing.Consultation.minutes !== "" + ? selectedOrganization.Billing.Consultation.minutes + : 0 + ); + + const [editConsultation, setEditConsultation] = React.useState(false); + const [openUpgradePlan, setOpenUpgradePlan] = React.useState(false); + const [consultationHours, setConsultationHours] = React.useState(5); + const [message, setMessage] = React.useState(""); + const [hovered, setHovered] = React.useState(false) + + const formatedHours = String(inputHour).padStart(2, "0") + const formatedMinutes = String(inputMinutes).padStart(2, "0") + + const handleHourChange = (event) => { + setInputHour(parseInt(event.target.value, 10)); + }; + + const handleMinuteChange = (event) => { + setInputMinutes(parseInt(event.target.value, 10)); + }; + const toggleEditMode = () => { + setEditConsultation(!editConsultation); + }; + + const handleCancel = () => { + setEditConsultation(false); + }; + + const handleSave = () => { + + toast("Saving consultation hours. Please wait.") + + const url = `${globalUrl}/api/v1/orgs/${selectedOrganization.id}`; + const data = { + org_id: selectedOrganization.id, + Billing: { + Consultation: { + hours: String(inputHour), + minutes: String(inputMinutes), + }, + } + }; + + fetch(url, { + body: JSON.stringify(data), + mode: "cors", + method: "POST", + credentials: "include", + crossDomain: true, + withCredentials: true, + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }) + .then((response) => { + if (response.status !== 200) { + console.log("Error in response"); + } + return response.json(); + }) + .then((responseJson) => { + console.log("Response from consultation save: ", responseJson); + if (responseJson.success === true) { + toast.success("Consultation hours saved successfully"); + setEditConsultation(false); + } else { + toast.error("Failed saving consultation hours."); + } + }) + .catch((error) => { + console.log("Error: ", error); + }); + } + + const handleUpgradeConsultation = () => { + + toast("Sending request for consultation hours. Please wait.") + + const url = `${globalUrl}/api/v1/orgs/${selectedOrganization.id}/consultation`; + const data = { + org_id: selectedOrganization.id, + consultationHours: String(consultationHours), + message: message, + }; + + fetch(url, { + body: JSON.stringify(data), + mode: "cors", + method: "POST", + credentials: "include", + crossDomain: true, + withCredentials: true, + headers: { + "Content-Type": "application/json; charset=utf-8", + }, + }) + .then((response) => { + if (response.status !== 200) { + console.log("Error in response"); + } + return response.json(); + }) + .then((responseJson) => { + console.log("Response from consultation save: ", responseJson); + if (responseJson.success === true) { + toast.success("Thank you for your request. We will get back to you soon."); + setOpenUpgradePlan(false); + setEditConsultation(false); + } else { + toast.error("Failed sending consultation hours request. Please try again later."); + } + }) + .catch((error) => { + console.log("Error: ", error); + }); + } + + var newPaperstyle = JSON.parse(JSON.stringify(paperStyle)) + + return ( + setHovered(true)} + onMouseLeave={() => setHovered(false)}> + + Professional Services + + + + Consultation & Management + +
+ + Current Plan includes total {inputHour} hours and {inputMinutes} minutes of consultation and management by our experts. + +
+ {editConsultation ? + <> + + : + + + : + + {`${formatedHours}h:${formatedMinutes}m`} + } +
+ {userdata.support === true ? +
+ {editConsultation ? ( + + ) : ( + + )} + {editConsultation && } +
+ : null} + + Features + +
    +
  • + + Debug/Create workflows with our experts + +
  • +
  • + + Ask questions and get help with your workflows and integrations by our experts + +
  • +
+
+ + setOpenUpgradePlan(false)} + fullWidth + style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }} + PaperProps={{ + style: { + width: 500, + margin: 0, + } + }} + > + + Upgrade Consultation Plan + + + + Enter the total hours of consultation you want to include in your plan. + +
+ setConsultationHours(val)} + aria-labelledby="continuous-slider" + step={5} + min={5} + max={50} + style={{ width: '80%', color: theme.palette.primary.main }} // Adding primary color for better visibility + marks + valueLabelDisplay="auto" + /> +
+ + If you have any additional requirements or questions, please leave a message below. + + setMessage(e.target.value)} + /> + +
+
+
+ ) + } const addDealModal = ( { /> : null} + {isCloud && billingInfo.subscription !== undefined && billingInfo.subscription !== null ? isChildOrg ? null : + : null} {isCloud && selectedOrganization.subscriptions !== undefined && diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 4d73ebdd..d59c25ac 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -1751,7 +1751,6 @@ const ParsedAction = (props) => { } const params = workflow.actions[key].parameters - console.log(params) if (params === null || params === undefined) { continue } diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index 889a407b..21237ec6 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -6731,7 +6731,8 @@ const releaseToConnectLabel = "Release to Connect" const parentlabel = parentNode.data("label").toLowerCase().replace(" ", "_") const parentname = parentNode.data("app_name").toLowerCase().replace(" ", "_") - if (!parentlabel.startsWith(parentname)) { + if (!parentlabel.startsWith(parentname)+"_") { + console.log("Return 1") return } @@ -6755,13 +6756,14 @@ const releaseToConnectLabel = "Release to Connect" } if (curapp.actions[startIndex].name !== parentActionname) { + console.log("Return 2") return } break } - //const parentAction = parentNode.data("name") + console.log("CONTINUE EVEN WHEN FIELDS ARE FILLED") const iconInfo = { icon: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z", @@ -12491,15 +12493,10 @@ const releaseToConnectLabel = "Release to Connect" let appIdsInWorkflow = []; Object.entries(workflowApps).forEach(([key, value]) => { - console.log("VALUE: ", value) appIdsInWorkflow.push(value.app_id); }) appIdsInWorkflow = [...new Set(appIdsInWorkflow)]; - - console.log("appIdsInWorkflow: ", appIdsInWorkflow) - - console.log("authData: ", authData, "workflowApps: ", workflowApps) // loop through the authData and create transformedData which looks like: // appId: [auth1, auth2, ...] @@ -12518,8 +12515,6 @@ const releaseToConnectLabel = "Release to Connect" }); - console.log("transformedData: ", transformedData) - return transformedData; }; @@ -12535,7 +12530,6 @@ const releaseToConnectLabel = "Release to Connect" const handleShowingValue = (appName) => { let mappingWithName = {} let listWithValues = workflow.triggers[selectedTriggerIndex].parameters[5]?.value.split(";").filter(e => e).map(e => e.split("=")) - console.log("LIST WITH VALUES: ", listWithValues) if (listWithValues === undefined || listWithValues === null || listWithValues.length === 0) { return "no-overrides"; } @@ -12614,10 +12608,15 @@ const releaseToConnectLabel = "Release to Connect" return (
- {Object.entries(transformedAuthData).map(([appId, authList]) => ( + {Object.entries(transformedAuthData).map(([appId, authList]) => { + if (authList === undefined || authList === null || authList.length < 2) { + return null; + } + + return (