remove unnecessary dependencies
This commit is contained in:
parent
316cdf5f34
commit
354a375722
31
package.json
31
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",
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 (
|
||||
<CContainer>
|
||||
<CRow className="mt-3">
|
||||
@ -169,43 +68,6 @@ const AddCampaign = () => {
|
||||
<div style={{ fontSize: "22px" }} className="fw-bold">
|
||||
Add Campaign
|
||||
</div>
|
||||
{/* <div className="page-title-right">
|
||||
<div className="page-title-right">
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
style={{
|
||||
fontWeight: "bold",
|
||||
marginBottom: "1rem",
|
||||
textTransform: "capitalize",
|
||||
}}
|
||||
onClick={() => {
|
||||
handleSubmit();
|
||||
}}
|
||||
// disabled={
|
||||
// data.address_Line_1.trim() === "" ||
|
||||
// data.address_Line_2.trim() === "" ||
|
||||
// data.userType === "" ||
|
||||
// data.language === "" ||
|
||||
// data.country === "" ||
|
||||
// data.state === "" ||
|
||||
// data.city === "" ||
|
||||
// data.pincode.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() === ""
|
||||
// }
|
||||
>
|
||||
{loading ? "Loading" : "Add Now"}
|
||||
</Button>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</CCol>
|
||||
</CRow>
|
||||
@ -232,15 +94,6 @@ const AddCampaign = () => {
|
||||
{viewState === 4 && (
|
||||
<Preview props={{ data, setData, handleView }} />
|
||||
)}
|
||||
{/* {viewState === 4 && (
|
||||
<BAddress
|
||||
data={{ data, setData }}
|
||||
handleView={handleView}
|
||||
// productId={productId}
|
||||
// data={{ images, setImages }}
|
||||
loading={{ loading, setLoading }}
|
||||
/>
|
||||
)} */}
|
||||
{viewState === 5 && (
|
||||
<Videos props={{ data, setData, handleView }} />
|
||||
)}
|
||||
@ -270,17 +123,6 @@ const AddCampaign = () => {
|
||||
>
|
||||
Basic Details
|
||||
</button>
|
||||
{/*<button
|
||||
className={
|
||||
viewState === 2
|
||||
? "btn btn-light"
|
||||
: "btn btn-info text-white"
|
||||
}
|
||||
type="button"
|
||||
onClick={() => handleView(2)}
|
||||
>
|
||||
Select Purpose
|
||||
</button>*/}
|
||||
<button
|
||||
className={
|
||||
viewState === 2
|
||||
|
@ -1,8 +1,14 @@
|
||||
import React, { useState } from "react";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import axios from "axios";
|
||||
import toast from "react-hot-toast";
|
||||
import { isAutheticated } from "src/auth";
|
||||
|
||||
const Video = ({ props }) => {
|
||||
const token = isAutheticated();
|
||||
const { data, setData, handleView } = props;
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [videos, setVideos] = useState({});
|
||||
|
||||
const handleVideoUpload = (e, index) => {
|
||||
const file = e.target.files[0];
|
||||
@ -12,6 +18,10 @@ const Video = ({ props }) => {
|
||||
i === index ? { ...video, title: URL.createObjectURL(file) } : video
|
||||
),
|
||||
}));
|
||||
setVideos((prev) => ({
|
||||
...prev,
|
||||
[e.target.id]: file,
|
||||
}));
|
||||
};
|
||||
|
||||
const addRecord = () => {
|
||||
@ -30,6 +40,50 @@ const Video = ({ props }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
setIsLoading(true);
|
||||
|
||||
const selectedVideos = Object.values(videos);
|
||||
|
||||
if (!selectedVideos || selectedVideos.length === 0) {
|
||||
console.error("No videos to merge.");
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
// console.log(selectedVideos);
|
||||
selectedVideos.forEach((video) => {
|
||||
formData.append("videos", video);
|
||||
// console.log(Object.fromEntries(formData));
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await axios.post("/api/campaign/merge", formData, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
"Content-Type": "multipart/form-data",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
});
|
||||
|
||||
if (response.status === 200) {
|
||||
console.log("Video merged successfully");
|
||||
setIsLoading(false);
|
||||
handleView(6);
|
||||
} else {
|
||||
console.log("Failed to merge videos");
|
||||
setIsLoading(false);
|
||||
toast.error("Failed to merge videos");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("An error occurred while merging videos:", error);
|
||||
setIsLoading(false);
|
||||
toast.error(error.message);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
@ -71,13 +125,7 @@ const Video = ({ props }) => {
|
||||
marginBottom: "1rem",
|
||||
textTransform: "capitalize",
|
||||
}}
|
||||
onClick={() => {
|
||||
if (data?.videos === null) {
|
||||
toast.error("Fill all details");
|
||||
} else {
|
||||
handleView(6);
|
||||
}
|
||||
}}
|
||||
onClick={() => props.handleView(6)}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
@ -103,6 +151,7 @@ const Video = ({ props }) => {
|
||||
className="form-control"
|
||||
id={`videoTitle${index + 1}`}
|
||||
onChange={(e) => handleVideoUpload(e, index)}
|
||||
accept=".mp4"
|
||||
/>
|
||||
{index >= 2 && (
|
||||
<div className="col-12">
|
||||
@ -128,8 +177,8 @@ const Video = ({ props }) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-12">
|
||||
<button onClick={addRecord} className="btn btn-primary">
|
||||
Merge Videos
|
||||
<button onClick={handleSubmit} className="btn btn-primary">
|
||||
{isLoading ? "Merging" : "Merge Videos"}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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 (
|
||||
<div className="container">
|
||||
<div className="row">
|
||||
@ -221,6 +165,15 @@ const VideoTemplate = ({ props }) => {
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col-sm-12 col-md-12 col-lg-12">
|
||||
<div>
|
||||
<a
|
||||
style={{ padding: "10px", backgroundColor: "#f5f5f5" }}
|
||||
href={audioUrl}
|
||||
target="_blank"
|
||||
>
|
||||
{audioUrl ? audioUrl : null}
|
||||
</a>
|
||||
</div>
|
||||
<GridContainer>
|
||||
<GridItem
|
||||
style={{
|
||||
|
Loading…
Reference in New Issue
Block a user