Simplify paid intake review flow

This commit is contained in:
justin 2026-06-04 13:05:21 -05:00
parent 74acda7171
commit fcb56a4707
15 changed files with 16 additions and 49 deletions

View file

@ -197,6 +197,11 @@ const STEP_LABELS: Record<string, string> = {
}
.pw-btn-plain { background: #e2e8f0; color: #1f2937; }
.pw-btn:disabled { opacity: 0.5; cursor: not-allowed; }
html.pw-paid-intake .pw-price-banner,
html.pw-paid-intake .pw-taxdeduct,
html.pw-paid-intake .pw-tvalue {
display: none !important;
}
</style>
<script>
@ -334,7 +339,9 @@ const STEP_LABELS: Record<string, string> = {
// ── Pre-fill from order data when accessed via token (paid batch order) ──
// Also remove the "payment" step since payment is already done.
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has("token") || urlParams.has("order")) {
const paidIntakeMode = urlParams.has("token") || urlParams.has("order");
if (paidIntakeMode) {
document.documentElement.classList.add("pw-paid-intake");
const payIdx = steps.indexOf("payment");
if (payIdx >= 0) {
steps.splice(payIdx, 1);
@ -490,7 +497,9 @@ const STEP_LABELS: Record<string, string> = {
});
(document.getElementById("pw-back") as HTMLButtonElement).disabled = idx === 0;
const nextBtn = document.getElementById("pw-next") as HTMLButtonElement;
nextBtn.textContent = idx === steps.length - 1 ? "Finish" : "Next →";
nextBtn.textContent = idx === steps.length - 1
? (paidIntakeMode ? "Submit Intake" : "Finish")
: "Next →";
// Scroll to page title (above the wizard)
const pageTitle = document.querySelector("main h1, .pw-order-intro h1");
(pageTitle || wizard).scrollIntoView({ behavior: "smooth", block: "start" });
@ -558,7 +567,7 @@ const STEP_LABELS: Record<string, string> = {
}).catch(() => {}); // silent — don't block the user
}
async function submitIntake(state: IntakeState) {
async function submitIntake(state: IntakeState) {
const nextBtn = document.getElementById("pw-next") as HTMLButtonElement;
nextBtn.disabled = true;
nextBtn.textContent = "Submitting...";
@ -580,7 +589,7 @@ const STEP_LABELS: Record<string, string> = {
if (!email || !name) {
alert("Please enter your business name and email before finishing.");
nextBtn.disabled = false;
nextBtn.textContent = "Finish";
nextBtn.textContent = paidIntakeMode ? "Submit Intake" : "Finish";
return;
}
try {
@ -645,7 +654,7 @@ const STEP_LABELS: Record<string, string> = {
} catch (e: any) {
alert("Could not start checkout: " + (e.message || "please try again."));
nextBtn.disabled = false;
nextBtn.textContent = "Finish";
nextBtn.textContent = paidIntakeMode ? "Submit Intake" : "Finish";
return;
}
}
@ -686,12 +695,12 @@ const STEP_LABELS: Record<string, string> = {
const err = await saveResp.json().catch(() => ({}));
alert(err.error || "Failed to submit. Please try again.");
nextBtn.disabled = false;
nextBtn.textContent = "Finish";
nextBtn.textContent = paidIntakeMode ? "Submit Intake" : "Finish";
}
} catch (e) {
alert("Network error. Please try again.");
nextBtn.disabled = false;
nextBtn.textContent = "Finish";
nextBtn.textContent = paidIntakeMode ? "Submit Intake" : "Finish";
}
}