Fix CTA not including RMD quality issues in remediation list

- Always rebuild CTA when observer fires (removes stale CTA first)
- Check both label and full card text for service detection
- Add dedup guards on service list

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-28 03:24:08 -05:00
parent 1d564b2fdb
commit 31a84b95e3

View file

@ -409,23 +409,26 @@ Send reset link
// 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");
if (existingCta && existingCta.dataset.frn && existingCta.dataset.frn !== currentFrn) {
if (existingCta) {
// Remove CTA if FRN changed or if we need to rebuild
existingCta.remove();
existingCta = null;
}
if (!existingCta) {
{
var actionCards = checks.querySelectorAll(":scope > .bg-red-50, :scope > .bg-amber-50");
if (actionCards.length > 0) {
var services = [];
actionCards.forEach(function(rc) {
var t = rc.textContent;
var t = rc.textContent || "";
var lbl = rc.querySelector("p") ? rc.querySelector("p").textContent : "";
if (lbl.indexOf("CPNI") >= 0) services.push("cpni");
else if (lbl.indexOf("499-Q") >= 0) services.push("499q");
else if (lbl.indexOf("499-A") >= 0) services.push("499a");
else if (lbl.indexOf("RMD") >= 0 && services.indexOf("rmd") < 0) services.push("rmd");
else if (lbl.indexOf("STIR") >= 0) services.push("stir");
else if (lbl.indexOf("Broadband") >= 0 || lbl.indexOf("BDC") >= 0) services.push("bdc");
// Check both label and full text to catch quality sub-checks
var combined = lbl + " " + t;
if (combined.indexOf("CPNI") >= 0) services.push("cpni");
else if (combined.indexOf("499-Q") >= 0) services.push("499q");
else if (combined.indexOf("499-A") >= 0 && services.indexOf("499a") < 0) services.push("499a");
else if (combined.indexOf("RMD") >= 0 && services.indexOf("rmd") < 0) services.push("rmd");
else if (combined.indexOf("STIR") >= 0) services.push("stir");
else if ((combined.indexOf("Broadband") >= 0 || combined.indexOf("BDC") >= 0) && services.indexOf("bdc") < 0) services.push("bdc");
});
if (services.length > 0) {
var hasBdcQuestion = !!checks.querySelector(".pw-bdc-toggle");