corp-check: wire overdue CTA to the real renewal order + prefill entity

The corporation-check overdue result now links to /order/annual-report-filing
(or /order/entity-reinstatement for dissolved) with ?legal_name=&state=&entity_number=,
instead of dead-ending at /contact. The order Wizard reads those params and
seeds the entity step so the funnel opens pre-filled. Completes the tool->order->
checkout path proven e2e on dev.
This commit is contained in:
justin 2026-07-01 09:33:36 -05:00
parent 3e133d8c46
commit 9323dd642e
2 changed files with 52 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -396,6 +396,34 @@ const STEP_LABELS: Record<string, string> = {
return;
}
// ── Pre-fill from ?legal_name=&state= (corporate renewal CTA links) ──
// The /tools/corporation-check overdue result links to
// /order/annual-report-filing?legal_name=ACME%20LLC&state=CT&entity_number=...
// Seed the entity so the wizard opens pre-populated. Best-effort; only fills
// empties (loadState merge preserves anything the visitor types).
const legalNameParam = (params.get("legal_name") || "").trim();
const stateParam = (params.get("state") || "").trim().toUpperCase();
if (legalNameParam && !token && !orderParam) {
try {
const state = loadState();
if (!state.name) state.name = legalNameParam;
state.intake_data = {
...state.intake_data,
legal_name: state.intake_data?.legal_name || legalNameParam,
entity_name: state.intake_data?.entity_name || legalNameParam,
address_state: state.intake_data?.address_state || stateParam,
base_state: state.intake_data?.base_state || stateParam,
entity_number: state.intake_data?.entity_number || (params.get("entity_number") || "").trim(),
};
state.entity = {
...state.entity,
legal_name: state.entity?.legal_name || legalNameParam,
address_state: state.entity?.address_state || stateParam,
};
saveState(state);
} catch { /* prefill is best-effort; never block the form */ }
}
if (!token && !orderParam) return;
const API = (window as any).__PW_API || "";