const SOURCE = 'REVCON' const FORM_URL = 'https://bremus4-v1-218915104282.us-east1.run.app//form-intake' function getCookieValue(name) { const cookies = document.cookie.split(';'); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); if (cookie.startsWith(name + '=')) { return cookie.substring(name.length + 1); } } return null; } function SetLFUUID() { var LFUUID = uuidv4(); const cookies = document.cookie.split(';'); for (let i = 0; i < cookies.length; i++) { let cookie = cookies[i].trim(); if (cookie.startsWith("LFUUID=")) { console.log("Overwriting existing LFUUID cookie"); break; }} document.cookie = "LFUUID=" + LFUUID + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/"; return LFUUID; } function checkInputs(inputIds) { const emptyFields = []; inputIds.forEach(id => { const input = document.getElementById(id); if (input && input.value.trim() === '') { emptyFields.push(id); } }); return { allFilled: emptyFields.length === 0, emptyFields: emptyFields }; } function shiftSteps(cur, next) { document.getElementById('loader').style.display = 'block'; setTimeout(function() { document.getElementById('loader').style.display = 'none'; document.getElementById(cur).style.display = 'none'; document.getElementById(next).style.display = 'block'; }, 400); } function step1() { if (checkInputs(['RequestedAmount']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['RequestedAmount']).emptyFields) return 'nah' } shiftSteps(1,2) document.cookie = `form_step=2; path=/`; SetLFUUID() const data = { source: SOURCE, requested_amount: document.getElementById("RequestedAmount").value, trk: getCookieValue('trk'), sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:1 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step1_h() { if (checkInputs(['RequestedAmount']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['RequestedAmount']).emptyFields) return 'nah' } // shiftSteps(1,2) document.cookie = `form_step=2; path=/`; SetLFUUID() const data = { source: SOURCE, requested_amount: document.getElementById("RequestedAmount").value, trk: getCookieValue('trk'), sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:1 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); window.location = '/apply-continue' }) .catch(error => { console.error('Error:', error); }); } function step1_inline() { if (checkInputs(['RequestedAmount-2']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['RequestedAmount']).emptyFields) return 'nah' } // shiftSteps(1,2) document.cookie = `form_step=2; path=/`; SetLFUUID() const data = { source: SOURCE, requested_amount: document.getElementById("RequestedAmount-2").value, trk: getCookieValue('trk'), sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:1 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); window.location = '/apply-continue' }) .catch(error => { console.error('Error:', error); }); } function step2() { if (checkInputs(['Modified_Current']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['UseOfFunds']).emptyFields) return 'nah' } shiftSteps(2,3) document.cookie = `form_step=3; path=/`; const data = { source: SOURCE, modified_current_mca_payments: document.getElementById("Modified_Current").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:2 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step3() { if (checkInputs(['LastMCAStarted']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['LastMCAStarted']).emptyFields) return 'nah' } shiftSteps(3,4) document.cookie = `form_step=4; path=/`; const data = { source: SOURCE, last_mca_started: document.getElementById("LastMCAStarted").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:3 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step4() { if (checkInputs(['corporate_name','State']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['corporate_name', 'State']).emptyFields) return 'nah' } shiftSteps(4,"contactstep") document.cookie = `form_step=4; path=/`; const data = { source: SOURCE, corporate_name: document.getElementById("corporate_name").value, state: document.getElementById("State").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:4 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step3_alt() { if (checkInputs(['MostImportant']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['corporate_name', 'State']).emptyFields) return 'nah' } shiftSteps(3,"contactstep") document.cookie = `form_step=4; path=/`; const data = { source: SOURCE, corporate_name: document.getElementById("corporate_name").value, state: document.getElementById("State").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:3 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step5() { if (checkInputs(['Phone','Email', 'Full_Name']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Phone','Email', 'Full_Name']).emptyFields) return 'nah' } shiftSteps("contactstep","business") document.cookie = `form_step=6; path=/`; const data = { source: SOURCE, phone: document.getElementById("Phone").value, email: document.getElementById("Email").value, full_name: document.getElementById("Full_Name").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:5 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step4_alt() { if (checkInputs(['Phone','Email', 'Name']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Phone','Email', 'Full_Name']).emptyFields) return 'nah' } // shiftSteps("contactstep","business") document.cookie = `form_step=5; path=/`; const data = { source: SOURCE, phone: document.getElementById("Phone").value, email: document.getElementById("Email").value, full_name: document.getElementById("Name").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:4 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); window.location = '/app/apply-continue-b4' }) .catch(error => { console.error('Error:', error); }); } function step1_eidl_lookup() { if (checkInputs(['Phone','Email', 'Full_Name']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Phone','Email', 'Full_Name']).emptyFields) return 'nah' } // shiftSteps(4,6) SetLFUUID() document.cookie = `form_step=1; path=/`; const data = { source: SOURCE, company: document.getElementById("Company").value, email: document.getElementById("Email").value, full_name: document.getElementById("Full_Name").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:1 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); window.location = '/apply-continue' }) .catch(error => { console.error('Error:', error); }); } function step1_ref_p() { if (checkInputs(['Phone','Email', 'Full_Name', 'Company']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Phone','Email', 'Full_Name']).emptyFields) return 'nah' } // shiftSteps(4,6) SetLFUUID() document.cookie = `form_step=1; path=/`; const data = { source: 'FASTWAY-REFERRAL-SIGNUP', company: document.getElementById("Company").value, email: document.getElementById("Email").value, name: document.getElementById("Name").value, phone: document.getElementById("Phone").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:1 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); window.location = '/thank-you' }) .catch(error => { console.error('Error:', error); }); } function step6() { if (checkInputs(['Tax_ID','Monthly_Gross', 'Business_Start_Year', 'Business_Address_Raw']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Tax_ID','Monthly_Gross', 'Business_Start_Year', 'Business_Address_Raw']).emptyFields) return 'nah' } shiftSteps("business","owner") document.cookie = `form_step=7; path=/`; const data = { source: SOURCE, tax_id: document.getElementById("Tax_ID").value, monthly_gross: document.getElementById("Monthly_Gross").value, business_start_year: document.getElementById("Business_Start_Year").value, business_address: document.getElementById("Business_Address_Raw").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:6 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function step7() { if (checkInputs(['Full_Name_C','Home_Address_Raw', 'DOB', 'SSN']).allFilled == true) { console.log('All Filled') } else { console.log(checkInputs(['Full_Name_C','Home_Address_Raw', 'DOB', 'SSN']).emptyFields) return 'nah' } shiftSteps("owner","uploadstep") document.cookie = `form_step=8; path=/`; const data = { source: SOURCE, full_name: document.getElementById("Full_Name_C").value, home_address: document.getElementById("Home_Address_Raw").value, dob: document.getElementById("DOB").value, ssn: document.getElementById("SSN").value, sid: getCookieValue('id'), form_instance: getCookieValue('LFUUID'), location: document.location.href, step:7 }; // Send data using fetch fetch(FORM_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log('Success:', data); }) .catch(error => { console.error('Error:', error); }); } function showElementAfterDelay(elementId, delay) { setTimeout(() => { const element = document.getElementById(elementId); if (element) { element.style.display = 'block'; // Show the element } }, delay); } function triggerTimer() { showElementAfterDelay('uplater', 5000); // Set timer for 5 seconds } function send_file(file_send) { url_string = window.location.href var url = new URL(url_string); const formData = new FormData(); formData.append('file', file_send); formData.append('form',getLFUUIDFromCookie()) formData.append('name',file_send.name) formData.append('seed_id', getIdFromCookie()) formData.append('form_instance', getCookieValue('LFUUID')) const xhr = new XMLHttpRequest(); xhr.open('POST', 'https://bremus4-v1-218915104282.us-east1.run.app//file-intake'); xhr.send(formData); } function generatePreviousMonthsText() { const months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; const now = new Date(); let month = now.getMonth(); let year = now.getFullYear(); const result = []; for (let i = 0; i < 3; i++) { month--; // Move to the previous month if (month < 0) { month = 11; // Wrap around to December year--; // Adjust the year } result.push(`Business bank statement for ${months[month]} ${year}`); } return result.reverse().join('\n'); } //Load up fields, switch out innertext document.addEventListener("DOMContentLoaded", () => { let fields = [{"created": "2025-01-24 15:03:02.675000", "description": "SBA Master List ", "friendly_name": "Previous SBA Loan Amount", "id": 28, "modified": "2025-01-24 15:03:02.675749", "name": "[seed.sba_approval_data.approval_amount_pretty]", "tags": ["Numbers"], "value": "$120K "}, {"created": "2025-01-24 15:05:49.851000", "description": "Annual Revenue from Opp TR ", "friendly_name": "Annual Revenue", "id": 35, "modified": "2025-01-24 15:05:49.851598", "name": "[seed.salesforce_data.last_opp.annual_gross_estimate_pretty]", "tags": ["3"], "value": "$100K"}, {"created": "2025-01-23 21:50:54.441000", "description": "Name of Merchants Company", "friendly_name": "Company", "id": 4, "modified": "2025-01-23 21:50:54.441614", "name": "[seed.Company_Proper]", "tags": ["1"], "value": "Your business"}, {"created": "2025-01-24 15:03:24.360000", "description": "SBA Master List ", "friendly_name": "Full Date of SBA Approval ", "id": 29, "modified": "2025-01-24 15:03:24.360908", "name": "[seed.sba_approval_data.approval_date_month_year]", "tags": ["Times"], "value": "last year"}, {"created": "2025-01-23 21:59:01.590000", "description": "Does not Work Falllback", "friendly_name": "Merchants State", "id": 16, "modified": "2025-01-23 21:59:01.590664", "name": "[seed.salesforce_data.business_state]", "tags": ["Contact"], "value": "your state"}, {"created": "2025-02-11 17:01:11.371000", "description": "Static = $500K ", "friendly_name": "Highest SBA Approval Amount", "id": 44, "modified": "2025-02-11 17:01:11.371028", "name": "[highest_SBA_approval]", "tags": ["3"], "value": "$500,000"}, {"created": "2025-01-24 15:00:28.804000", "description": "Date when Merchant was converted", "friendly_name": "Converted Date", "id": 23, "modified": "2025-01-24 15:00:28.804650", "name": "[seed.salesforce_data.last_opp.close_date_sayable]", "tags": ["4"], "value": "not too long ago "}, {"created": "2025-01-30 17:04:17.536000", "description": "Does Not Work Todays Date ", "friendly_name": "Today Date", "id": 39, "modified": "2025-01-30 17:04:17.536838", "name": "[today.date]", "tags": ["Times"], "value": "02/03/2025"}, {"created": "2025-02-05 19:52:03.221000", "description": "Number AI uses to tell merchants to call them back ", "friendly_name": "AI Number used for Callbacks ", "id": 41, "modified": "2025-02-05 19:52:03.221365", "name": "[ai_call_back_phone_1]", "tags": ["3"], "value": "6506633730"}, {"created": "2025-01-23 21:56:23.586000", "description": "Person Associated with Template", "friendly_name": "Person Associated with Template", "id": 8, "modified": "2025-01-23 21:56:23.586131", "name": "[persona.name]", "tags": ["1"], "value": "Matthew"}, {"created": "2025-01-23 21:53:49.185000", "description": "Shortcut", "friendly_name": "hmul", "id": 7, "modified": "2025-01-23 21:53:49.185291", "name": "hmul", "tags": ["1"], "value": "How much are you looking for?"}, {"created": "2025-01-24 15:04:32.934000", "description": "SBA Master List ", "friendly_name": "SBA Approval Date ", "id": 34, "modified": "2025-01-24 15:04:32.934995", "name": "[seed.sba_approval_data.relative_approval_date]", "tags": ["4"], "value": "not too long ago "}, {"created": "2025-01-24 15:04:19.762000", "description": "SBA Master List ", "friendly_name": "SBA Approvl Date", "id": 33, "modified": "2025-01-24 15:04:19.762061", "name": "[seed.sba_approval_data.approval_date]", "tags": ["4"], "value": "Last year"}, {"created": "2025-01-23 21:50:43.034000", "description": "First Name of Merchant", "friendly_name": "First Name", "id": 3, "modified": "2025-01-23 21:50:43.034207", "name": "[seed.FirstName_Proper]", "tags": ["1"], "value": "there"}, {"created": "2025-01-23 21:58:35.910000", "description": "Does not work Falllback", "friendly_name": "Merchants City ", "id": 14, "modified": "2025-01-23 21:58:35.910460", "name": "[seed.salesforce_data.business_city]", "tags": ["Contact"], "value": "your city"}, {"created": "2025-01-23 21:57:56.079000", "description": "Falllback", "friendly_name": "Merchants Email", "id": 11, "modified": "2025-01-23 21:57:56.079202", "name": "[seed.email]", "tags": ["1"], "value": "your email"}, {"created": "2025-01-24 20:04:52.630000", "description": "Does not work Merchant Industry they are in ", "friendly_name": "Merchant Industry ", "id": 37, "modified": "2025-01-24 20:04:52.630832", "name": "[seed.industry]", "tags": ["1"], "value": "your industry"}, {"created": "2025-02-11 18:12:10.665000", "description": "Does not work Total Sales of a Company based on TR ", "friendly_name": "Gross Sales ", "id": 45, "modified": "2025-02-11 18:12:10.665480", "name": "[seed.salesforce_data.last_opp.gross_sales_line_1]", "tags": ["Numbers"], "value": "$800,000"}, {"created": "2025-01-24 14:57:22.376000", "description": "Next Month", "friendly_name": "Next Month ", "id": 21, "modified": "2025-01-24 14:57:22.376855", "name": "[Next_Month]", "tags": ["4"], "value": "March"}, {"created": "2025-01-23 21:58:47.327000", "description": "The state of that the area code of the phone field.", "friendly_name": "State ", "id": 15, "modified": "2025-01-23 21:58:47.327488", "name": "[seed.AreaCodeState]", "tags": ["1"], "value": "your state"}, {"created": "2025-01-24 15:04:06.984000", "description": "Previous SBA Approval Amount from SBA Master List ", "friendly_name": "Previous SBA Approval Amount", "id": 32, "modified": "2025-01-24 15:04:06.984251", "name": "[seed.sba_approval_data.approval_amount]", "tags": ["3"], "value": "$150K"}, {"created": "2025-01-24 15:00:02.582000", "description": "Previous Amount AMC Funded Merchant ", "friendly_name": "Does Not Work Previous Amount AMC Funded Merchant ", "id": 22, "modified": "2025-01-24 15:00:02.582167", "name": "[seed.salesforce_data.last_opp.funded_amount]", "tags": ["Numbers"], "value": "$100K"}, {"created": "2025-01-23 21:48:11.720911", "description": "block of system prompt text to un agentify an ai agent -- to sound less like an ai.", "friendly_name": null, "id": 2, "modified": "2025-01-23 21:48:11.720911", "name": "[AiPrompt_Unagentify_v1]", "tags": null, "value": "You never to mention that you are an Ai or an assistant. Never say \"How can I assist you?\". You are to role play as a real human."}, {"created": "2025-01-24 15:02:37.306000", "description": "Based on Time of Day ", "friendly_name": "Good Morning / Afternoon", "id": 27, "modified": "2025-01-24 15:02:37.306878", "name": "[DayGreeting]", "tags": ["4"], "value": "Good Afternoon"}, {"created": "2025-01-24 15:06:12.912000", "description": "Opp Requested Amount that looks Pretty $85K", "friendly_name": "Opp Requested Amount ", "id": 36, "modified": "2025-01-24 15:06:12.912052", "name": "[seed.salesforce_data.last_opp.requested_amount_pretty]", "tags": ["3"], "value": "$85K"}, {"created": "2025-01-24 14:57:01.973000", "description": "current month", "friendly_name": "This Month", "id": 20, "modified": "2025-01-24 14:57:01.973200", "name": "[This_Month]", "tags": ["4"], "value": "February"}, {"created": "2025-01-24 14:52:15.146000", "description": "Last Month ", "friendly_name": "Last Month", "id": 19, "modified": "2025-01-24 14:52:15.146512", "name": "[Prev_Month]", "tags": ["Times"], "value": "January"}, {"created": "2025-01-30 17:04:47.993000", "description": "AMC Hiring ", "friendly_name": "AMC Hiring Start Date", "id": 40, "modified": "2025-01-30 17:04:47.993093", "name": "[start.date]", "tags": ["4"], "value": "TBD"}, {"created": "2025-01-24 20:05:26.654000", "description": "Fallback ", "friendly_name": "Persona Name", "id": 38, "modified": "2025-01-24 20:05:26.654807", "name": "[persona.name]", "tags": ["1"], "value": "Matthew Elling"}, {"created": "2025-01-24 15:01:38.958000", "description": "Does not WORK Estimated offer we can approve Opp ", "friendly_name": "Estimated Offer", "id": 25, "modified": "2025-01-24 15:01:38.958647", "name": "[seed.Max_Offer]", "tags": ["Numbers"], "value": "$120K "}, {"created": "2025-01-24 15:03:35.150000", "description": "SBA Master List ", "friendly_name": "SBA Approval Amount", "id": 30, "modified": "2025-01-24 15:03:35.150781", "name": "[seed.sba_approval_data.approval_date_sayable]", "tags": ["Times"], "value": "not too long ago "}, {"created": "2025-01-24 15:00:46.184000", "description": "Does not work Renewals: Half the previous funding amount we funded Merchant ", "friendly_name": "Half the previous funding amount ", "id": 24, "modified": "2025-01-24 15:00:46.184628", "name": "[seed.Half_Funding_Amt]", "tags": ["Numbers"], "value": "$65K"}, {"created": "2025-01-23 21:58:23.048000", "description": "The first name of the user assigned.", "friendly_name": "Does not Work Assigned Rep Name", "id": 13, "modified": "2025-01-23 21:58:23.048772", "name": "[assigned_user.name]", "tags": ["Contact"], "value": "Matthew"}, {"created": "2025-01-23 21:58:09.895000", "description": "Falllback", "friendly_name": "Merchants Phone #", "id": 12, "modified": "2025-01-23 21:58:09.895357", "name": " [seed.phone_Formatted]", "tags": ["1"], "value": "your phone #"}, {"created": "2025-01-23 21:57:01.172000", "description": "Falllback", "friendly_name": "Merchant FICO ", "id": 9, "modified": "2025-01-23 21:57:01.172957", "name": "[seed.salesforce_data.last_opp.fico]", "tags": ["1"], "value": "650"}, {"created": "2025-01-23 21:47:48.084000", "description": "the one place that determines what shows as prime rate on all templates but also the website", "friendly_name": "Prime Rate", "id": 1, "modified": "2025-01-23 21:47:48.084359", "name": "[PrimeRate]", "tags": ["3"], "value": "7.5%"}, {"created": "2025-02-12 22:19:17.132951", "description": "test", "friendly_name": "test", "id": 47, "modified": "2025-02-12 22:19:17.132951", "name": "test field", "tags": null, "value": "test"}, {"created": "2025-01-23 22:57:20.520036", "description": null, "friendly_name": null, "id": 17, "modified": "2025-01-23 22:57:20.520036", "name": "[AiPrompt_ResponseGuidelines_v1]", "tags": null, "value": "- Present dates in a clear format (e.g., January 15, 2024). - Present currency in a clear format (e.g., 80 thousand dollars, instead of $80,000). - If a specific question is asked, do your best to answer but quickly. Output should be conversational but most importantly not too lengthy or verbose. Natural. Short. "}, {"created": "2025-01-24 15:03:50.522227", "description": "SBA Master List ", "friendly_name": "Previous SBA Bank Name", "id": 31, "modified": "2025-01-24 15:03:50.522227", "name": "[seed.sba_approval_data.bank_name]", "tags": null, "value": "your bank"}, {"created": "2025-02-10 18:32:37.393000", "description": "2 points above prime. current 9.75%", "friendly_name": "Interest Rate", "id": 42, "modified": "2025-02-10 18:32:37.393999", "name": "[InterestRate]", "tags": ["3"], "value": "9.75"}, {"created": "2025-01-24 15:01:49.501429", "description": "Missing Docs Reason", "friendly_name": "Missing Docs Reason", "id": 26, "modified": "2025-01-24 15:01:49.501429", "name": "[seed.salesforce_data.last_opp.missing_docs_reason]", "tags": null, "value": "Last 3 month bank statements "}, {"created": "2025-02-10 21:07:36.275876", "description": null, "friendly_name": null, "id": 43, "modified": "2025-02-10 21:07:36.275876", "name": "Placeholder123", "tags": null, "value": "A"}, {"created": "2025-01-23 21:53:43.827611", "description": "Persona associated with template ", "friendly_name": "Persona First Name", "id": 6, "modified": "2025-01-23 21:53:43.827611", "name": "[persona.FirstName_Proper]", "tags": null, "value": "Matthew "}, {"created": "2025-02-11 18:13:00.543000", "description": "Ordinary Business Income or Loss", "friendly_name": "Profit / Loss ", "id": 46, "modified": "2025-02-11 18:13:00.543166", "name": "[seed.salesforce_data.last_opp.net_profit_line_21]", "tags": ["1"], "value": "$625,000"}, {"created": "2025-01-23 23:47:17.130000", "description": "Quick Question", "friendly_name": "Monthly Revenue", "id": 18, "modified": "2025-01-23 23:47:17.130258", "name": "rev per month", "tags": ["1"], "value": "How much revenue are you doing per month?"}, {"created": "2025-01-23 21:57:44.924000", "description": "Requested Amount for LEADS ", "friendly_name": "Requested Amount", "id": 10, "modified": "2025-01-23 21:57:44.924231", "name": "[seed.salesforce.requested_amount]", "tags": ["3"], "value": "$80K"}, {"created": "2025-01-23 21:52:24.741000", "description": "Does not work Industry the company is registered from - from SIC Code ", "friendly_name": "Industry ", "id": 5, "modified": "2025-01-23 21:52:24.741005", "name": "[seed.Industry]", "tags": ["Contact"], "value": "your industry "}]; // Ensure safe JSON parsing function replaceTextInNode(node) { if (node.nodeType === 3) { // Text node let newContent = node.textContent; fields.forEach(field => { newContent = newContent.replace(field.name, field.value); }); if (newContent !== node.textContent) { node.textContent = newContent; } } else if (node.nodeType === 1) { // Element node // Skip script tags and form elements for security if (!['SCRIPT', 'STYLE', 'INPUT', 'TEXTAREA'].includes(node.tagName)) { Array.from(node.childNodes).forEach(replaceTextInNode); } } } try { document.querySelectorAll("h1, h2, h3, h4, h5, h6, p").forEach(element => { replaceTextInNode(element); }); } catch (error) { console.error("Error replacing text:", error); } }); // load up widgets, find by id, insert innerHTML document.addEventListener("DOMContentLoaded", () => { let widgets = []; // Ensure safe JSON parsing widgets.forEach(item => { const el = document.getElementById(item.name); if (el) el.innerHTML = item.value; }); }); // mask for requested amount currency //var inputElement = document.getElementById('RequestedAmount'); //inputElement.addEventListener('input', function (e) { // // Get the input value // var inputValue = e.target.value; // inputValue = inputValue.replace('$', ''); // // // Remove any non-numeric characters except for commas // inputValue = inputValue.replace(/[^0-9,]/g, ''); // // // Remove leading zeros // inputValue = inputValue.replace(/^0+/, ''); // // // Replace commas with an empty string to remove them // inputValue = inputValue.replace(/,/g, ''); // // // Format the number with commas and add the dollar sign // inputValue = Number(inputValue).toLocaleString(); // // // Update the input value // e.target.value = '$'+inputValue; //});