Insurance referral on order page + fix MCS-150 date display

- Order page: insurance referral checkbox (pre-checked) shown when
  ?ins=1 from checker or carrier has insurance gap. Flag stored
  in intake_data.insurance_referral_requested.
- Checker CTA passes &ins=1 when insurance issues found.
- MCS-150: use mcs150Outdated=N from FMCSA API to show green even
  without exact date. Fixes "Filing date not available" for carriers
  not in local census.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-29 00:12:28 -05:00
parent 2e45a59133
commit 3d4c72f259
3 changed files with 44 additions and 6 deletions

View file

@ -109,10 +109,17 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
id: "mcs150",
label: "MCS-150 Biennial Update",
status: "red",
detail: `OVERDUE — last filed ${mcs150Date || "unknown date"}. The MCS-150 must be updated every 2 years. `
+ `Failure to update can result in USDOT deactivation and fines up to $1,000/day (capped at $10,000). `
+ `File at: https://safer.fmcsa.dot.gov/CompanyUpdateSearch.aspx`,
action_url: "https://safer.fmcsa.dot.gov/CompanyUpdateSearch.aspx",
detail: `OVERDUE${mcs150Date ? " — last filed " + mcs150Date : ""}. The MCS-150 must be updated every 2 years. `
+ `Failure to update can result in USDOT deactivation and fines up to $1,000/day (capped at $10,000).`,
action_url: "https://portal.fmcsa.dot.gov/login",
});
} else if (carrier && carrier.mcs150Outdated === "N") {
// API confirms not outdated — show green even without exact date
checks.push({
id: "mcs150",
label: "MCS-150 Biennial Update",
status: "green",
detail: `Current${mcs150Date ? " — last filed " + mcs150Date : ""}.`,
});
} else if (mcs150Date) {
checks.push({
@ -126,7 +133,7 @@ router.get("/api/v1/dot/lookup", async (req, res) => {
id: "mcs150",
label: "MCS-150 Biennial Update",
status: "unknown",
detail: "Filing date not available. Verify at SAFER.",
detail: "Could not determine MCS-150 status. Verify at the FMCSA Portal.",
});
}
}

View file

@ -171,6 +171,19 @@
</div>
<!-- Insurance referral (shown if carrier has insurance issue and didn't submit on checker page) -->
<div id="pw-ins-referral" class="mt-4" hidden>
<div style="background:#eff6ff;border:2px solid #93c5fd;border-radius:12px;padding:16px">
<label style="display:flex;align-items:flex-start;gap:12px;cursor:pointer">
<input type="checkbox" id="ins-referral-check" checked style="margin-top:4px;width:18px;height:18px;accent-color:#2563eb">
<div>
<span style="font-weight:700;color:#1e3a5f;font-size:14px">Also get a free trucking insurance quote</span>
<p style="font-size:12px;color:#1d4ed8;margin-top:4px">We noticed your FMCSA insurance filing has a gap. Check this box and we'll connect you with a licensed trucking insurance agent — no extra charge, no obligation.</p>
</div>
</label>
</div>
</div>
<!-- Total + checkout -->
<div id="pw-total-section" class="mt-6 bg-white border border-gray-200 rounded-xl p-6 shadow-sm" hidden>
<div id="pw-total-rows"></div>
@ -233,6 +246,12 @@ var promoFromUrl = params.get("code") || params.get("promo") || "";
function usd(cents) { return "$" + (cents / 100).toLocaleString("en-US", {minimumFractionDigits: 2}); }
// Show insurance referral if ?ins=1 from checker page
var showInsReferral = params.get("ins") === "1";
if (showInsReferral) {
document.getElementById("pw-ins-referral").hidden = false;
}
// Pre-fill entity info
if (dot) {
fetch(API + "/api/v1/dot/lookup?dot=" + dot).then(function(r) { return r.json(); }).then(function(d) {
@ -241,6 +260,13 @@ if (dot) {
document.getElementById("pw-entity-dot").textContent = "DOT# " + dot;
document.getElementById("pw-entity-bar").hidden = false;
}
// Also show insurance referral if carrier has insurance issues
if (!showInsReferral && d.checks) {
var hasInsIssue = d.checks.some(function(c) { return c.id && c.id.indexOf("insurance") === 0 && c.status === "red"; });
if (hasInsIssue) {
document.getElementById("pw-ins-referral").hidden = false;
}
}
}).catch(function() {});
}
if (emailFromUrl) { var e = document.getElementById("pw-email"); if (e) e.value = emailFromUrl; }
@ -301,7 +327,11 @@ document.getElementById("pw-batch-form").addEventListener("submit", function(e)
customer_email: document.getElementById("pw-email").value.trim(),
customer_phone: document.getElementById("pw-phone").value.trim() || undefined,
discount_code: document.getElementById("pw-promo").value.trim() || undefined,
intake_data: { dot_number: dot, source: "dot-compliance-remediation" },
intake_data: {
dot_number: dot,
source: "dot-compliance-remediation",
insurance_referral_requested: document.getElementById("ins-referral-check")?.checked || false,
},
engagement_accepted: true
};

View file

@ -269,6 +269,7 @@ Send reset link
recommendedServices.push("mcs150-update");
}
var svcParam = recommendedServices.length > 0 ? "&services=" + recommendedServices.join(",") : "";
if (hasInsuranceIssue) svcParam += "&ins=1";
html += '<div style="background:linear-gradient(135deg,#fff7ed,#ffedd5);border:2px solid #f97316;border-radius:12px;padding:24px;text-align:center;margin-top:8px">';
html += '<h3 style="font-size:18px;font-weight:700;color:#111827;margin-bottom:8px">' + redCount + ' compliance issue' + (redCount > 1 ? 's' : '') + ' found</h3>';