From 5546c58bf035240af7e54f86ccc4e1976fcf59be Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 23 Jun 2026 13:08:41 -0500 Subject: [PATCH] =?UTF-8?q?fix(intake):=20repair=20order=20wizard=20?= =?UTF-8?q?=E2=80=94=20checkout=20was=20fully=20broken=20on=20trucking/HC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Diagnosed via live browser E2E why campaign clicks (25 checkout-page-views, 36h) produced 0 conversions. Four bugs, all blocking checkout: 1. DOTIntakeStep: a missing `});` (DFWP hydration block, commit 9718ab9 Jun 2) left the pw:step-shown listener unclosed -> 'missing ) after argument list' SYNTAX ERROR killed the whole DOT intake script. Effect: ?dot= prefill silently failed for ~3 weeks (exactly the campaign window), so every carrier had to re-type all their details. 2. ReviewStep: service slug read from `.pw-step[data-slug]` (first match), which on trucking/HC is the INTAKE step's slug ('dot-intake'/'npi-intake'), not the order. The cold-visitor order-create POST sent service_slug='dot-intake' -> API 501/400 -> 'Could not validate order', blocking checkout at the review step on EVERY multi-step vertical. Now reads `.pw-wizard[data-service]` (authoritative). Confirmed against prod: bad slug=400, correct slug=201. 3. Shared-bundle null derefs: every step's diff --git a/site/src/components/intake/steps/ClassificationWizard.astro b/site/src/components/intake/steps/ClassificationWizard.astro index 39742c3..d31602d 100644 --- a/site/src/components/intake/steps/ClassificationWizard.astro +++ b/site/src/components/intake/steps/ClassificationWizard.astro @@ -214,8 +214,11 @@ return { primary, categories: [...new Set(cats)], reason }; } - // Render Q&A - const container = document.getElementById("cw-questions")!; + // Render Q&A. This script is bundled into every order page, so the container + // is absent on pages without the classification step — bail rather than throw + // on the top-level renderQuestion(0) call below (container.appendChild → null). + const container = document.getElementById("cw-questions"); + if (container) { const answers: Record = {}; let questionIndex = 0; @@ -306,4 +309,5 @@ // Also start immediately if this is the current step renderQuestion(0); + } // end classification step guard diff --git a/site/src/components/intake/steps/DOTIntakeStep.astro b/site/src/components/intake/steps/DOTIntakeStep.astro index c9641fd..e7161df 100644 --- a/site/src/components/intake/steps/DOTIntakeStep.astro +++ b/site/src/components/intake/steps/DOTIntakeStep.astro @@ -465,6 +465,7 @@ if (dfwpRow) dfwpRow.hidden = false; if (dfwpStateEl && d.state_dfwp) dfwpStateEl.value = d.state_dfwp; } + }); // Save all data on step-next window.addEventListener("pw:step-next", (evt) => { diff --git a/site/src/components/intake/steps/EarthStationStep.astro b/site/src/components/intake/steps/EarthStationStep.astro index 2dd707f..d87ed5d 100644 --- a/site/src/components/intake/steps/EarthStationStep.astro +++ b/site/src/components/intake/steps/EarthStationStep.astro @@ -83,7 +83,8 @@ return row; } - document.getElementById("pw-add-circuit")!.addEventListener("click", () => { + const addCircuitBtn = document.getElementById("pw-add-circuit"); + if (addCircuitBtn) addCircuitBtn.addEventListener("click", () => { circuitsDiv.appendChild(newCircuitRow()); }); diff --git a/site/src/components/intake/steps/ForeignQualStep.astro b/site/src/components/intake/steps/ForeignQualStep.astro index 551ce4a..0323f05 100644 --- a/site/src/components/intake/steps/ForeignQualStep.astro +++ b/site/src/components/intake/steps/ForeignQualStep.astro @@ -90,7 +90,13 @@ diff --git a/site/src/components/intake/steps/ReviewStep.astro b/site/src/components/intake/steps/ReviewStep.astro index 25ad70d..8832fcb 100644 --- a/site/src/components/intake/steps/ReviewStep.astro +++ b/site/src/components/intake/steps/ReviewStep.astro @@ -49,7 +49,15 @@ const vertical = slugVertical(service_slug);