Expand description
The contact form’s rules: what a valid email and phone are, the request the form sends, and what the worker’s answer means.
The worker behind ENDPOINT applies the same rules (services/leads/src/lead.js), and both
walk one set of vectors (crates/logicaffeine_tests/tests/fixtures/lead_vectors.json), so the
page never refuses what the worker would take, or sends what it would refuse.
Structs§
- Field
Errors - What is wrong with each field; nothing when both are fine.
- Phone
- A phone as the worker stores it: the trimmed number as typed, and its digits alone.
Enums§
- Email
Error - Outcome
- What the worker’s answer means for the form.
- Phone
Error
Constants§
- ENDPOINT
- Where the form sends its request.
- SOURCE
- The form’s tag in every request, so the team can tell where a request came from. The page’s tag on the wire. It keeps its old name: the lead worker is deployed on it, and a lead from the contact page is the same lead.
- TURNSTILE_
ACTION - The action the form’s Turnstile widget stamps on its token; the worker’s siteverify check refuses a token that carries any other.
Functions§
- request_
body - The JSON the worker reads,
{ email, phone, turnstile_token, source, website }, or what is wrong with the fields. The honeypot (website) rides untouched: the worker decides what a filled one means. - trim_
field valuewithout leading or trailing Unicode white space or byte-order marks.str::trimkeeps U+FEFF, which a paste from some apps carries, so it is not the rule.- validate_
email - A valid email: the trimmed local part as typed,
@, the domain lower-cased. - validate_
phone - A phone is optional: nothing, or only white space, is no phone.