DOT checker: state service recommendations + action URLs + yellow CTA

- State-level yellow checks now map to recommended services in CTA
  (IRP, IFTA, weight taxes, CA MCP, intrastate authority)
- State param passed through to order page (?state=XX)
- Action URLs rendered as "Learn more" links on check cards
- New yellow-only CTA: "Federal filings look good! Review state compliance"
  shown when no red issues but state warnings exist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-29 13:33:04 -05:00
parent 46411c09c6
commit 68d8a9c479

View file

@ -227,6 +227,7 @@ Send reset link
html += '<div>';
html += '<div class="font-semibold text-sm ' + (labelColor[st] || labelColor.unknown) + '">' + c.label + '</div>';
html += '<div class="text-sm text-gray-700 leading-relaxed mt-0.5">' + c.detail + '</div>';
if (c.action_url) html += '<a href="' + c.action_url + '" target="_blank" rel="noopener" class="text-xs text-blue-600 hover:text-blue-800 mt-1 inline-block">' + (st === 'red' ? 'Fix this &rarr;' : 'Learn more &rarr;') + '</a>';
html += '</div></div>';
});
@ -255,14 +256,29 @@ Send reset link
// CTA
var redCount = (s.red || 0);
if (redCount > 0) {
// Map red checks to recommended service slugs
// Map red + yellow checks to recommended service slugs
var recommendedServices = [];
(data.checks || []).forEach(function(c) {
if (c.status !== "red") return;
if (c.id === "mcs150") recommendedServices.push("mcs150-update");
if (c.id === "insurance_bipd" || c.id === "insurance_cargo") recommendedServices.push("dot-full-compliance");
if (c.id === "insurance_bond") recommendedServices.push("boc3-filing");
if (c.id === "authority") recommendedServices.push("mc-authority");
if (c.status === "red") {
if (c.id === "mcs150") recommendedServices.push("mcs150-update");
if (c.id === "insurance_bipd" || c.id === "insurance_cargo") recommendedServices.push("dot-full-compliance");
if (c.id === "insurance_bond") recommendedServices.push("boc3-filing");
if (c.id === "authority") recommendedServices.push("mc-authority");
}
// State-level yellow checks → recommend state services
if (c.status === "yellow") {
if (c.id === "irp") recommendedServices.push("irp-registration");
if (c.id === "ifta") recommendedServices.push("ifta-application");
if (c.id === "weight_distance_tax") {
if (data.phy_state === "OR") recommendedServices.push("or-weight-mile-tax");
else if (data.phy_state === "NY") recommendedServices.push("ny-hut-registration");
else if (data.phy_state === "KY") recommendedServices.push("ky-kyu-registration");
else if (data.phy_state === "NM") recommendedServices.push("nm-weight-distance");
else if (data.phy_state === "CT") recommendedServices.push("ct-highway-use-fee");
}
if (c.id === "state_carrier_permit" && data.phy_state === "CA") recommendedServices.push("ca-mcp-carb");
if (c.id === "intrastate_authority") recommendedServices.push("intrastate-authority");
}
});
// Always suggest MCS-150 if overdue
if ((data.checks || []).some(function(c) { return c.id === "mcs150" && c.status === "red"; }) && recommendedServices.indexOf("mcs150-update") < 0) {
@ -270,6 +286,7 @@ Send reset link
}
var svcParam = recommendedServices.length > 0 ? "&services=" + recommendedServices.join(",") : "";
if (hasInsuranceIssue) svcParam += "&ins=1";
if (data.phy_state) svcParam += "&state=" + data.phy_state;
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>';
@ -277,6 +294,15 @@ Send reset link
html += '<a href="/order/dot-compliance?dot=' + data.dot_number + svcParam + '" style="display:inline-block;padding:12px 32px;background:#f97316;color:#fff;font-weight:700;border-radius:8px;text-decoration:none;font-size:15px;box-shadow:0 4px 12px rgba(249,115,22,0.3)">Fix My DOT Filings &rarr;</a>';
html += '<p class="text-xs text-gray-400 mt-3">Or call (888) 411-0383</p>';
html += '</div>';
} else if (s.yellow > 0) {
// No red issues but yellow state-level warnings — show softer CTA
var yellowSvcParam = recommendedServices.length > 0 ? "&services=" + recommendedServices.join(",") : "";
if (data.phy_state) yellowSvcParam += "&state=" + data.phy_state;
html += '<div style="background:#f0fdf4;border:2px solid #86efac;border-radius:12px;padding:24px;text-align:center;margin-top:8px">';
html += '<h3 style="font-size:18px;font-weight:700;color:#166534;margin-bottom:4px">Federal filings look good!</h3>';
html += '<p style="font-size:14px;color:#374151;margin-bottom:12px">Your FMCSA filings are current, but you may have state-level obligations to address.</p>';
html += '<a href="/order/dot-compliance?dot=' + data.dot_number + yellowSvcParam + '" style="display:inline-block;padding:10px 28px;background:#ea580c;color:#fff;font-weight:700;border-radius:8px;text-decoration:none;font-size:14px">Review State Compliance &rarr;</a>';
html += '</div>';
} else {
html += '<div style="background:#f0fdf4;border:2px solid #86efac;border-radius:12px;padding:24px;text-align:center;margin-top:8px">';
html += '<h3 style="font-size:18px;font-weight:700;color:#166534;margin-bottom:4px">Looking good!</h3>';