Add CALEA retail/wholesale toggle to FCC compliance checker

When CALEA SSI card shows red/amber, ask if carrier serves end users
(retail) or only other carriers (wholesale). Wholesale-only carriers
are exempt as "interconnecting carriers" under CALEA — card turns
green. Retail/both keeps the red status. Toggle integrates with
existing pending-question system (CTA waits for all toggles answered).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-29 09:38:35 -05:00
parent c6863f7eae
commit eee3af0919

View file

@ -406,6 +406,44 @@ Send reset link
});
}
// CALEA toggle — wholesale-only carriers are exempt ("interconnecting carriers")
if (!checks.querySelector(".pw-calea-toggle")) {
var caleaCards = checks.querySelectorAll(":scope > div");
caleaCards.forEach(function(card) {
if (card.textContent.indexOf("CALEA") < 0 && card.textContent.indexOf("SSI") < 0) return;
if (card.querySelector(".pw-calea-toggle")) return;
// Only show for red/amber cards (missing or needs attention)
if (!card.classList.contains("bg-red-50") && !card.classList.contains("bg-amber-50")) return;
var detail = card.querySelectorAll("p")[1];
var icon = card.querySelector("span");
var flexDiv = card.querySelector(".flex-1");
if (!flexDiv || !detail) return;
var q = document.createElement("div");
q.className = "pw-calea-toggle mt-3 flex items-center gap-2 flex-wrap";
q.innerHTML =
'<span class="text-sm font-bold text-gray-900 w-full mb-1">Do you serve end users directly (retail customers), or do you only sell to other carriers (wholesale)?</span>' +
'<button type="button" class="px-4 py-1.5 text-xs font-bold rounded-lg border-2 border-red-300 bg-red-50 text-red-700 hover:bg-red-100 hover:border-red-400 transition-colors" data-calea="retail">Retail or both</button>' +
'<button type="button" class="px-4 py-1.5 text-xs font-bold rounded-lg border-2 border-green-300 bg-green-50 text-green-700 hover:bg-green-100 hover:border-green-400 transition-colors" data-calea="wholesale">Wholesale only</button>';
flexDiv.appendChild(q);
q.addEventListener("click", function(ev) {
var b = ev.target.closest("[data-calea]");
if (!b) return;
q.remove();
if (b.dataset.calea === "wholesale") {
// Wholesale-only carriers are exempt — "interconnecting carrier" under CALEA
card.className = "bg-green-50 border-green-200 border rounded-xl p-4 flex items-start gap-3";
detail.innerHTML = 'Not required \u2014 wholesale-only carriers that serve other carriers (not end users) are generally exempt from CALEA as &ldquo;interconnecting carriers.&rdquo; CALEA applies to carriers providing service to the public.';
detail.className = "text-xs text-green-800 mt-1";
icon.className = "text-green-600 shrink-0 mt-0.5";
icon.innerHTML = '<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/></svg>';
card.dataset.caleaExempt = "true";
}
// If retail/both, leave as-is (red, needs SSI plan)
});
});
}
// Remediation CTA — rebuild if FRN changed (user searched new company)
var currentFrn = (document.getElementById("entity-frn").textContent || "").replace(/\D/g, "");
var existingCta = document.getElementById("pw-remediation-cta");
@ -433,7 +471,8 @@ Send reset link
var hasBdcQuestion = !!checks.querySelector(".pw-bdc-toggle");
var hasRmdQuestion = !!checks.querySelector(".pw-rmd-toggle");
var has499aQuestion = !!checks.querySelector(".pw-499a-toggle");
var hasPendingQuestion = hasBdcQuestion || hasRmdQuestion || has499aQuestion;
var hasCaleaQuestion = !!checks.querySelector(".pw-calea-toggle");
var hasPendingQuestion = hasBdcQuestion || hasRmdQuestion || has499aQuestion || hasCaleaQuestion;
var frn = currentFrn;
var url = "/order/fcc-compliance?services=" + services.join(",") + (frn ? "&frn=" + frn : "");
var cta = document.createElement("div");
@ -452,7 +491,7 @@ Send reset link
'<button type="button" id="pw-cta-btn" disabled class="inline-block px-6 py-2.5 bg-gray-400 text-white font-semibold rounded-lg cursor-not-allowed text-sm">Get Started \u2014 Fix ' + count + ' Item' + (count > 1 ? 's' : '') + '</button>';
// Watch for toggle removal (= answered)
var bdcWatcher = new MutationObserver(function() {
if (!checks.querySelector(".pw-bdc-toggle") && !checks.querySelector(".pw-rmd-toggle") && !checks.querySelector(".pw-499a-toggle")) {
if (!checks.querySelector(".pw-bdc-toggle") && !checks.querySelector(".pw-rmd-toggle") && !checks.querySelector(".pw-499a-toggle") && !checks.querySelector(".pw-calea-toggle")) {
bdcWatcher.disconnect();
// Re-count actionable items (red + amber)
var newServices = [];