28-11
This commit is contained in:
parent
c7f44c7754
commit
142f4f77cd
|
|
@ -166,7 +166,7 @@ function validateCVV(cvv, cardType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZIP code validation
|
// ZIP code validation
|
||||||
function validateZipCode(zipCode) {
|
function validateZipCodeRegex(zipCode) {
|
||||||
return /^\d{5}(-\d{4})?$/.test(zipCode);
|
return /^\d{5}(-\d{4})?$/.test(zipCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ async function validateStep(step) {
|
||||||
|
|
||||||
// ZIP code validation
|
// ZIP code validation
|
||||||
const zipCode = document.getElementById('card-zip').value;
|
const zipCode = document.getElementById('card-zip').value;
|
||||||
if (!validateZipCode(zipCode)) {
|
if (!validateZipCodeRegex(zipCode)) {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
showError('Please enter a valid ZIP code', 'card-zip', step);
|
showError('Please enter a valid ZIP code', 'card-zip', step);
|
||||||
return isValid;
|
return isValid;
|
||||||
|
|
|
||||||
|
|
@ -83,26 +83,26 @@ async function project_add_sf(req, res) {
|
||||||
|
|
||||||
// Send data to Salesforce API after successful registration
|
// Send data to Salesforce API after successful registration
|
||||||
try {
|
try {
|
||||||
const salesforceUrl = `${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/`;
|
// const salesforceUrl = `${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/`;
|
||||||
|
|
||||||
const response = await fetch(salesforceUrl, {
|
// const response = await fetch(salesforceUrl, {
|
||||||
method: 'POST',
|
// method: 'POST',
|
||||||
headers: {
|
// headers: {
|
||||||
'Content-Type': 'application/json',
|
// 'Content-Type': 'application/json',
|
||||||
},
|
// },
|
||||||
body: JSON.stringify(created)
|
// body: JSON.stringify(created)
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (!response.ok) {
|
// if (!response.ok) {
|
||||||
const errorText = await response.text();
|
// const errorText = await response.text();
|
||||||
throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
// throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const result = await response.json();
|
// const result = await response.json();
|
||||||
console.log("✅ Successfully synced VA data to Salesforce:", result);
|
// console.log("✅ Successfully synced VA data to Salesforce:", result);
|
||||||
|
|
||||||
res.status(201).json({ success: true, data: created, SyncSalesforce: result });
|
// res.status(201).json({ success: true, data: created, SyncSalesforce: result });
|
||||||
// res.status(201).json({ success: true, data: created, relationships: relationshipUpdate });
|
res.status(201).json({ success: true, data: created, relationships: relationshipUpdate });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("❌ Failed to sync with Salesforce:", error.message);
|
console.error("❌ Failed to sync with Salesforce:", error.message);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -380,6 +380,36 @@ io.on("connection", (socket) => {
|
||||||
socket.to(vaSocketRespectToClient.get(`${clientId}-${vaId}-${projectId}-va`)).emit("appToCapture", { appTitle });
|
socket.to(vaSocketRespectToClient.get(`${clientId}-${vaId}-${projectId}-va`)).emit("appToCapture", { appTitle });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on("requestVisibleApps", async ({ token }) => {
|
||||||
|
try {
|
||||||
|
// Verify token
|
||||||
|
const decoded = jwt.verify(token, process.env.JWT_SECRET_ACCESS_TOKEN);
|
||||||
|
const vaEmail = decoded.email;
|
||||||
|
|
||||||
|
// Find VA in DB
|
||||||
|
const vaUser = await VAModel.findOne({ "userDetails.email": vaEmail });
|
||||||
|
if (!vaUser) {
|
||||||
|
console.log("❌ Unauthorized VA");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const vaId = vaUser._id.toString();
|
||||||
|
console.log("🟢 Received Apps from VA:", vaId);
|
||||||
|
|
||||||
|
// Broadcast image only to allowed clients
|
||||||
|
for (let [_, clientSocket] of io.sockets.sockets) {
|
||||||
|
if (
|
||||||
|
clientSocket.data.role === "client" &&
|
||||||
|
clientSocket.data.allowedVAs?.includes(vaId)
|
||||||
|
) {
|
||||||
|
clientSocket.emit("captureAppsTracker");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("❌ Token verification failed:", err.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
socket.on("getVisibleApps", async ({ token, apps }) => {
|
socket.on("getVisibleApps", async ({ token, apps }) => {
|
||||||
try {
|
try {
|
||||||
// Verify token
|
// Verify token
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Live Screen Feed</title>
|
<title>Live Screen Feed</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Mobile Toggle Button -->
|
<!-- Mobile Toggle Button -->
|
||||||
<div class="mobile-toggle" id="toggleBtn">
|
<div class="mobile-toggle" id="toggleBtn">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span></span>
|
<span></span>
|
||||||
|
|
@ -207,6 +207,8 @@
|
||||||
clientId: clientId
|
clientId: clientId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const sidebar = document.getElementById("sidebar");
|
const sidebar = document.getElementById("sidebar");
|
||||||
const toggleBtn = document.getElementById("toggleBtn");
|
const toggleBtn = document.getElementById("toggleBtn");
|
||||||
const overlay = document.getElementById("overlay");
|
const overlay = document.getElementById("overlay");
|
||||||
|
|
@ -229,8 +231,12 @@
|
||||||
overlay.classList.remove("show");
|
overlay.classList.remove("show");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
socket.on("connected", () => {
|
||||||
|
socket.emit("requestVisibleApps", { token });
|
||||||
|
});
|
||||||
|
|
||||||
/* Receive visible apps */
|
/* Receive visible apps */
|
||||||
socket.on("receiveVisibleApps", ({apps, vaId: senderVaId}) => {
|
socket.on("receiveVisibleApps", ({ apps, vaId: senderVaId }) => {
|
||||||
if (vaId !== senderVaId) return;
|
if (vaId !== senderVaId) return;
|
||||||
|
|
||||||
appsList.innerHTML = "";
|
appsList.innerHTML = "";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue