Fix 3 bugs: BDC undo, JSON parse safety, price formatting

1. BDC Yes/No buttons now have "Change answer" undo — clicking
   Yes or No is reversible without re-running the check
2. intake_data JSON.parse wrapped in try/catch with error logging
   instead of silently returning empty object
3. All CTA price displays use .toFixed(2) for consistent formatting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
justin 2026-04-27 15:13:18 -05:00
parent a7d7fee154
commit 75ea2c5c6f
2 changed files with 49 additions and 26 deletions

View file

@ -1716,7 +1716,16 @@ async function sendComplianceIntakeEmail(
if (!customerEmail) return;
const firstName = customerName.split(" ")[0] || customerName;
const intake = orders[0].intake_data ? (typeof orders[0].intake_data === "string" ? JSON.parse(orders[0].intake_data as string) : orders[0].intake_data) as Record<string, unknown> : {};
let intake: Record<string, unknown> = {};
if (orders[0].intake_data) {
try {
intake = typeof orders[0].intake_data === "string"
? JSON.parse(orders[0].intake_data as string)
: orders[0].intake_data as Record<string, unknown>;
} catch (parseErr) {
console.error(`[checkout] intake_data JSON parse failed for ${orderId}:`, parseErr);
}
}
const entityName = (intake.entity_name as string) || customerName;
const frn = (intake.frn as string) || "";