Fix DOT intake: retry init until wizard found + null-safe PWIntake

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-05-30 15:29:42 -05:00
parent 7fe3311921
commit d55384975e

View file

@ -266,7 +266,7 @@
function showRelevantSections() {
const PW = (window as any).PWIntake;
const state = PW.get();
const state = PW?.get?.() || {};
// Get service slug from wizard element or state
const wizardEl = document.querySelector(".pw-wizard[data-service]");
const pageSlug = wizardEl?.getAttribute("data-service") || "";
@ -300,12 +300,13 @@
}
}
// Show sections on DOM ready and on step-shown
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", showRelevantSections);
} else {
// Show sections — retry until wizard element is found
function initSections() {
const wizardEl = document.querySelector(".pw-wizard[data-service]");
if (!wizardEl) { setTimeout(initSections, 100); return; }
showRelevantSections();
}
initSections();
window.addEventListener("pw:step-shown", (evt: any) => {
if (evt.detail.step !== "dot-intake") return;
showRelevantSections();