Skip to content

feat(useContractorSignatureForm): add contractor W-9 signature form hook#2318

Open
serikjensen wants to merge 1 commit into
mainfrom
feat/contractor-w9-signature-form-hook
Open

feat(useContractorSignatureForm): add contractor W-9 signature form hook#2318
serikjensen wants to merge 1 commit into
mainfrom
feat/contractor-w9-signature-form-hook

Conversation

@serikjensen

@serikjensen serikjensen commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Adds the headless useContractorSignatureForm hook — the data/validation/field layer for signing a contractor document (W-9). This is the first of two PRs; the Contractor.SignatureForm component that consumes it follows in a stacked PR.

  • Static field surface (form.Fields) with presence-based gating: core fields are always present, API-variable fields are exposed only when the API returns them (undefined otherwise) — a defensive guard against API divergence.
  • Collapses the seven federal tax-classification checkboxes into a single required radio group with conditional LLC-code and "Other" sub-fields, mapping the selection back to the W-9 wire format on submit.
  • SSN/EIN format validation with an N/A sentinel; omits untouched redacted TINs on submit so the backend falls back to the real profile value.
  • Consolidates the duplicate EIN regex into a shared EIN_REGEX (helpers/validations.ts), now also consumed by contractorDetailsSchema.
  • Adds a placeholder field-metadata property for masked-value display.
  • onSubmit returns HookSubmitResult<DocumentSigned>, so DocumentSigned is re-exported through the public API models.

Test plan

  • npm run test -- --run src/components/Contractor/Documents/SignatureForm/useContractorSignatureForm (43 passing)
  • npx tsc --noEmit
  • npm run derive (API report + docs regenerated, 0 errors)
  • Component wiring verified in the stacked follow-up PR

Separated this into smaller PRs, but worked on both together and verified this hook with the UI as follows:

Screen.Recording.2026-06-30.at.4.52.45.PM.mov

Made with Cursor

Headless hook for signing a contractor document (W-9). Declares the field
surface statically with presence-based gating for API-variable fields,
collapses the seven tax-classification checkboxes into a single radio group
with conditional LLC-code/Other sub-fields, and maps the selection back to the
W-9 wire format on submit. Adds SSN/EIN format validation with an "N/A"
sentinel, consolidates the shared EIN_REGEX, and exposes a field-metadata
placeholder for masked values.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant