Fix CategoryStep crashing non-499-A intake pages

CategoryStep script runs on ALL pages using the Wizard component.
It tried to find #pw-wizard (its inner quiz div) and called
querySelectorAll on it — null on CPNI/RMD/etc pages, crashing the
entire script bundle. This prevented FRN auto-fill, officer
suggestions, and all other intake functionality.

Guard: if #pw-wizard doesn't exist, skip all CategoryStep logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-29 01:13:06 -05:00
parent acf63eb819
commit dcdc6df879

View file

@ -173,8 +173,13 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog"
import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog";
const err = document.getElementById("pw-cat-err") as HTMLDivElement;
const wizard = document.getElementById("pw-wizard") as HTMLDivElement;
const result = document.getElementById("pw-result") as HTMLDivElement;
const wizard = document.getElementById("pw-wizard") as HTMLDivElement | null;
const result = document.getElementById("pw-result") as HTMLDivElement | null;
// Guard: CategoryStep only runs on pages that have the category wizard
if (!wizard) {
// Not a 499-A page — skip all CategoryStep logic
} else {
// Wizard state
const answers: Record<string, string> = {};
@ -469,4 +474,6 @@ import { LINE_105_CATALOG, LINE_105_BY_ID } from "../../../lib/line_105_catalog"
}
err.hidden = true;
});
} // end of: if (!wizard) {} else {
</script>