diff --git a/package.json b/package.json index 691136c..c7f65bd 100644 --- a/package.json +++ b/package.json @@ -30,52 +30,23 @@ "coreui_library_short_version": "4.1" }, "dependencies": { - "@ckeditor/ckeditor5-build-classic": "^35.2.1", - "@ckeditor/ckeditor5-react": "^5.0.2", - "@coreui/chartjs": "^3.0.0", "@coreui/coreui": "^4.1.0", "@coreui/icons": "^2.1.0", - "@coreui/icons-react": "^2.0.0", "@coreui/react": "^4.3.0", - "@coreui/react-chartjs": "^2.0.0", "@coreui/utils": "^1.3.1", "@material-ui/core": "^4.12.4", - "@material-ui/data-grid": "^4.0.0-alpha.37", "@mui/material": "^5.11.12", "@reduxjs/toolkit": "^1.9.2", - "@wojtekmaj/enzyme-adapter-react-17": "^0.6.5", "axios": "^0.25.0", - "bootstrap": "^5.1.3", - "chart.js": "^3.6.0", - "classnames": "^2.3.1", - "core-js": "^3.19.1", - "country-state-city": "^3.1.2", - "enzyme": "^3.11.0", - "file-saver": "^2.0.5", "prop-types": "^15.7.2", "react": "18.0.0", - "react-app-polyfill": "^2.0.0", "react-bootstrap": "^2.7.0", - "react-date-picker": "^8.4.0", - "react-datepicker": "^4.8.0", "react-dom": "^18.0.0", - "react-hot-toast": "^2.4.0", - "react-multistep": "^5.5.8", - "react-paginate": "^8.1.3", - "react-qr-code": "^2.0.11", "react-redux": "^7.2.9", "react-router-dom": "^6.7.0", - "react-spinners": "^0.11.0", - "react-time-picker": "^4.5.0", - "react-to-print": "^2.14.11", "redux": "4.1.2", "serve": "^13.0.2", - "simplebar-react": "^2.3.6", - "styled-components": "^6.0.8", - "sweetalert": "^2.1.2", - "sweetalert2": "^11.4.0", - "webpack": "4.44.2", - "xlsx": "^0.18.0" + "styled-components": "^6.0.8" }, "devDependencies": { "auto-changelog": "~2.3.0", diff --git a/src/index.js b/src/index.js index 5d0cb24..6fbca94 100644 --- a/src/index.js +++ b/src/index.js @@ -14,8 +14,8 @@ import { createRoot } from "react-dom/client"; const setupAxios = () => { //axios.defaults.baseURL = 'https://bolo-api.checkapp.one/' - // axios.defaults.baseURL = "http://localhost:8000"; - axios.defaults.baseURL = "https://crowded-sweatpants-elk.cyclic.cloud/"; //->latest deployed + axios.defaults.baseURL = "http://localhost:8000"; + // axios.defaults.baseURL = "https://crowded-sweatpants-elk.cyclic.cloud/"; //->latest deployed axios.defaults.headers = { "Cache-Control": "no-cache,no-store", diff --git a/src/routes.js b/src/routes.js index 483dbe2..01f8b98 100644 --- a/src/routes.js +++ b/src/routes.js @@ -142,10 +142,6 @@ const routes = [ name: "view healthcare providers", element: ViewHealthCareProvider, }, - - - - { path: "//campaigns", name: "campaigns", @@ -167,10 +163,6 @@ const routes = [ element: ViewHealthCareProvider, }, - - - - // { path: '/franchisee/view/:id', name: 'view franchisee', element: ViewFra }, //Contact Requests diff --git a/src/views/Campaigns/AddCampaign.js b/src/views/Campaigns/AddCampaign.js index bc99feb..a4a3b74 100644 --- a/src/views/Campaigns/AddCampaign.js +++ b/src/views/Campaigns/AddCampaign.js @@ -11,14 +11,10 @@ import { CContainer, CRow, } from "@coreui/react"; -// import SelectPurpose from "../Business/multiform/SelectPurpose.js"; -// import SelectBusiness from "../Business/multiform/SelectBusiness.js"; -// import Contacts from "../Business/multiform/Contacts.js"; -// import BAddress from "../Business/multiform/BAddress.js"; + import Button from "@material-ui/core/Button"; import { isAutheticated } from "src/auth"; -// import DoctorInfo from "../Business/multiform/DoctorInfo.js"; import BasicDetaiils from "./BasicDetaiils.js"; import ContactDetails from "./ContactDetails.js"; import Preview from "./Preview.js"; @@ -31,10 +27,7 @@ const AddCampaign = () => { const token = isAutheticated(); const [productId, setProductId] = useState(""); const [viewState, setViewState] = useState(1); - // const [WebsiteURL, setWebsiteURL] = useState('https://bolo.ai.in/') - const [loading, setLoading] = useState(false); - const [data, setData] = useState({ WebsiteURL: "https://bolo.ai.in/", campaignName: "", @@ -60,100 +53,6 @@ const AddCampaign = () => { if (viewState === n) return; setViewState(n); }; - // const handleSubmit = () => { - - // if ( - // data.address_Line_1.trim() === "" || - // data.address_Line_2.trim() === "" || - // data.userType === "" || - // data.language === "" || - // data.country === "" || - // data.state === "" || - // data.city === "" || - // data.pincode.trim() === "" || - // //Contacts - // // data.image === '' || - // // data.imageURL.trim() === '' || - // (data.userName.trim() === "" - // // && - // // (data.contact_Person_Name.trim() === "" || - // // data.specialization === "") - // ) || - // data.email.trim() === "" || - // // data.short_url.trim() === "" || - // data.contact_Number === "" - // // || data.contact_Person_Name.trim() === "" - // ) { - // swal({ - // title: "Warning", - // text: "Fill all mandatory fields", - // icon: "error", - // button: "Close", - // dangerMode: true, - // }); - // return; - // } - // setLoading(true); - // const formData = new FormData(); - // formData.set("address_Line_1", data.address_Line_1); - // formData.set("address_Line_2", data.address_Line_2); - - // formData.set("purpose", data.purpose); - // formData.set("userType", data.userType); - // // formData.set("language", data.language); - - // formData.set("country", data.country); - // formData.set("city", data.city); - // formData.set("state", data.state); - - // formData.set("pincode", data.pincode); - // //contacts - // formData.set("userName", data.userName); - // formData.set("email", data.email); - - // formData.set("contact_Number", data.contact_Number); - // formData.set("contact_Person_Name", data.contact_Person_Name); - - // formData.set("specialization", data.specialization); - - // formData.set("url", data.WebsiteURL); - // formData.set("short_url", data.short_url); - - // axios - // .post(`/api/businesses/add`, formData, { - // headers: { - // Authorization: `Bearer ${token}`, - // "Content-Type": "multipart/formdata", - // "Access-Control-Allow-Origin": "*", - // }, - // }) - // .then((res) => { - // swal({ - // title: "Added", - // text: res?.data?.message - // ? res?.data?.message - // : "Business added successfully!", - // icon: "success", - // button: "Return", - // }); - // setLoading(false); - // navigate("/users", { replace: true }); - // }) - // .catch((err) => { - // setLoading(false); - // const message = err.response?.data?.message || "Something went wrong!"; - // swal({ - // title: "Warning", - // text: message, - // icon: "error", - // button: "Retry", - // dangerMode: true, - // }); - // }); - // }; - - // console.log(data); - return ( @@ -169,43 +68,6 @@ const AddCampaign = () => {
Add Campaign
- {/*
-
- -
-
*/}
@@ -232,15 +94,6 @@ const AddCampaign = () => { {viewState === 4 && ( )} - {/* {viewState === 4 && ( - - )} */} {viewState === 5 && ( )} @@ -270,17 +123,6 @@ const AddCampaign = () => { > Basic Details - {/**/} @@ -103,6 +151,7 @@ const Video = ({ props }) => { className="form-control" id={`videoTitle${index + 1}`} onChange={(e) => handleVideoUpload(e, index)} + accept=".mp4" /> {index >= 2 && (
@@ -128,8 +177,8 @@ const Video = ({ props }) => {
-
diff --git a/src/views/Campaigns/VideoTemplate.js b/src/views/Campaigns/VideoTemplate.js index d78c4ca..2cf09d2 100644 --- a/src/views/Campaigns/VideoTemplate.js +++ b/src/views/Campaigns/VideoTemplate.js @@ -53,6 +53,7 @@ const VideoTemplate = ({ props }) => { const [selectedFile, setSelectedFile] = useState(null); const [isLoading, setIsLoading] = useState(false); const [transcribedText, setTranscribedText] = useState(""); + const [audioUrl, setAudioUrl] = useState(); const handleVideoUpload = async (e) => { const file = e.target.files[0]; @@ -70,7 +71,7 @@ const VideoTemplate = ({ props }) => { const formData = new FormData(); // console.log(data.video); formData.append("videoTemplate", data.video); - + // console.log(Object.fromEntries(formData)); const response = await axios.post("/api/campaign/convert", formData, { headers: { Authorization: `Bearer ${token}`, @@ -79,8 +80,9 @@ const VideoTemplate = ({ props }) => { }, }); - const { success, message, text } = response.data; + const { success, message, text, audio } = response.data; if (success) { + setAudioUrl(audio); setTranscribedText(text); setIsLoading(false); swal({ @@ -115,64 +117,6 @@ const VideoTemplate = ({ props }) => { setSelectedFile(null); }; - const extractText = async (e) => { - e.preventDefault(); - - if (data.video === null) { - swal({ - title: "Error", - text: "Please upload video", - icon: "error", - button: "Close", - }); - return; - } - setIsLoading(true); - try { - const formData = new FormData(); - // console.log(data.video); - formData.append("videoTemplate", data.video); - - const response = await axios.post("/api/campaign/convert", formData, { - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "multipart/form-data", - "Access-Control-Allow-Origin": "*", - }, - }); - - const { success, message, text } = response.data; - if (success) { - setTranscribedText(text); - setIsLoading(false); - swal({ - title: "Converted", - text: "Text Extracted Successfully", - icon: "success", - button: "Close", - }); - } else { - swal({ - title: "API Error", - text: message, - icon: "error", - button: "Close", - }); - setIsLoading(false); - console.log("API Error:", message); - } - } catch (error) { - swal({ - title: "Network Error", - text: error.message, - icon: "error", - button: "Close", - }); - setIsLoading(false); - console.log("Network Error:", error.message); - } - }; - return (
@@ -221,6 +165,15 @@ const VideoTemplate = ({ props }) => {