import type { Outcome } from './delivery-outcome.ts'; import { OUTCOME_TEXT } from './delivery-outcome.ts'; const escape = (s: string) => s.replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]!)); /** Accessible HTML for the JavaScript-off path: a real page with a heading, the outcome, and a way back. No visitor data is echoed. */ export function outcomePage(outcome: Outcome, options: { fields?: Record; contactPath: string; telephone: string; email: string; requestId: string }): string { const text = OUTCOME_TEXT[outcome]; const fieldList = options.fields && Object.keys(options.fields).length ? `` : ''; return `${escape(text.title)} — ThatDeveloperGuy

${escape(text.title)}

${escape(text.body)}

${fieldList}

Back to the form · Call · Email

Reference ${escape(options.requestId)}

`; }