import type { ContactMessageType, SubmitContactMessageInput } from "@batch-cooking/shared"; /** * Builds the `POST /contact` payload (issue #80) from the two things the * user picked in the form — the message `type` and its text — plus the two * pieces of context captured automatically: the path they're on * (`window.location.pathname`) and the running app version * (`__APP_VERSION__`, injected by `vite.config.ts`). Kept out of * `ContactPage` so those ambient reads sit in one unit-testable place. * * The user-agent is deliberately NOT set here — the API reads it straight * from the request header, never trusting the client for it (see * `submitContactMessageSchema`, which omits it). */ export function buildContactMessageInput( type: ContactMessageType, message: string, ): SubmitContactMessageInput { return { type, message, pageUrl: window.location.pathname, appVersion: __APP_VERSION__, }; }