28-11
This commit is contained in:
parent
c7f44c7754
commit
142f4f77cd
|
|
@ -166,7 +166,7 @@ function validateCVV(cvv, cardType) {
|
|||
}
|
||||
|
||||
// ZIP code validation
|
||||
function validateZipCode(zipCode) {
|
||||
function validateZipCodeRegex(zipCode) {
|
||||
return /^\d{5}(-\d{4})?$/.test(zipCode);
|
||||
}
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ async function validateStep(step) {
|
|||
|
||||
// ZIP code validation
|
||||
const zipCode = document.getElementById('card-zip').value;
|
||||
if (!validateZipCode(zipCode)) {
|
||||
if (!validateZipCodeRegex(zipCode)) {
|
||||
isValid = false;
|
||||
showError('Please enter a valid ZIP code', 'card-zip', step);
|
||||
return isValid;
|
||||
|
|
|
|||
|
|
@ -83,26 +83,26 @@ async function project_add_sf(req, res) {
|
|||
|
||||
// Send data to Salesforce API after successful registration
|
||||
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, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(created)
|
||||
});
|
||||
// const response = await fetch(salesforceUrl, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// },
|
||||
// body: JSON.stringify(created)
|
||||
// });
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
||||
}
|
||||
// if (!response.ok) {
|
||||
// const errorText = await response.text();
|
||||
// throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
||||
// }
|
||||
|
||||
const result = await response.json();
|
||||
console.log("✅ Successfully synced VA data to Salesforce:", result);
|
||||
// const result = await response.json();
|
||||
// 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, relationships: relationshipUpdate });
|
||||
// res.status(201).json({ success: true, data: created, SyncSalesforce: result });
|
||||
res.status(201).json({ success: true, data: created, relationships: relationshipUpdate });
|
||||
} catch (error) {
|
||||
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.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 }) => {
|
||||
try {
|
||||
// Verify token
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Live Screen Feed</title>
|
||||
<title>Live Screen Feed</title>
|
||||
|
||||
<style>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Mobile Toggle Button -->
|
||||
<!-- Mobile Toggle Button -->
|
||||
<div class="mobile-toggle" id="toggleBtn">
|
||||
<span></span>
|
||||
<span></span>
|
||||
|
|
@ -207,6 +207,8 @@
|
|||
clientId: clientId
|
||||
});
|
||||
|
||||
|
||||
|
||||
const sidebar = document.getElementById("sidebar");
|
||||
const toggleBtn = document.getElementById("toggleBtn");
|
||||
const overlay = document.getElementById("overlay");
|
||||
|
|
@ -229,8 +231,12 @@
|
|||
overlay.classList.remove("show");
|
||||
};
|
||||
|
||||
socket.on("connected", () => {
|
||||
socket.emit("requestVisibleApps", { token });
|
||||
});
|
||||
|
||||
/* Receive visible apps */
|
||||
socket.on("receiveVisibleApps", ({apps, vaId: senderVaId}) => {
|
||||
socket.on("receiveVisibleApps", ({ apps, vaId: senderVaId }) => {
|
||||
if (vaId !== senderVaId) return;
|
||||
|
||||
appsList.innerHTML = "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue