Skip to content

fix(sdk): align proposal detail contract + document routes with deployed API#74

Merged
kerem-acer merged 1 commit into
mainfrom
fix/proposal-detail-contract-gaps
Jun 10, 2026
Merged

fix(sdk): align proposal detail contract + document routes with deployed API#74
kerem-acer merged 1 commit into
mainfrom
fix/proposal-detail-contract-gaps

Conversation

@kerem-acer

Copy link
Copy Markdown
Contributor

Summary

Preparation for the agent-panel proposal detail page surfaced several places where the TS SDK drifted from the deployed InsurUp API. Source of truth for every change: the core repo (GetProposalDetailResult.cs, InsurUpApiEndpoints.cs, AddManualProductEndpoint.cs, and the official C# SDK's DefaultInsurUpClient.Proposal.cs).

Contract fixes — GetProposalByIdResult

The deployed GET /proposals/{id} returns fields the TS type didn't model:

  • proposal level: agentBranchId, policyStartDate, policyEndDate
  • per product: hasUndamagedDiscountRate, isManual, manualPdfUrl, optimalCoverage
  • coverageGroups[] inner shape was wrong: had coverage: Coverage; the wire sends coverageTable: CoverageTable (+ optional description). The old field never existed at runtime, so this is a fix, not a break.

Route fixes (would 404 against the deployed API)

Method Was Now
getProposalProductPremiumDetail …/premium-detail/{n} …/premiums/{n}
fetchProposalInformationFormDocument …/information-form …/information-form-document
sendProposalInformationFormDocument …/information-form/send …/information-form-document/send
generateCustomerProposalDocumentPdf proposals/{id}/customer-document-pdf proposals/{id}/products/customer-document-pdf

New

  • proposals.addManualProduct(request, pdf?) — multipart POST to proposals/{id}/products/manual with PascalCase form fields + optional PDF under file (mirrors the C# SDK exactly, incl. AllowFileUploads binding on the endpoint).
  • Optional language on both document fetch requests, appended as ?language= (parity with C# AppendLanguageQuery; the legacy panel's per-branch PDF language menu depends on it).

Test Plan

  • bun run typecheck (all packages)
  • bun run build (all packages)
  • bun run test — 894 tests green, incl. new proposal-client.spec.ts covering the manual-product multipart shape, fixed routes, and language query
  • bun run lint + bun run format:check

🤖 Generated with Claude Code

…yed API

GetProposalByIdResult was missing fields the deployed /proposals/{id}
endpoint returns (verified against InsurUp core GetProposalDetailResult):
agentBranchId, policyStartDate/policyEndDate, per-product
hasUndamagedDiscountRate / isManual / manualPdfUrl / optimalCoverage, and
coverageGroups carried a wrong inner shape (coverage: Coverage instead of
coverageTable: CoverageTable + description).

Route fixes (source of truth: InsurUpApiEndpoints.cs):
- premium detail: premium-detail/{n} -> premiums/{n}
- information form fetch/send: information-form -> information-form-document
- customer document pdf: missing /products/ segment

New:
- proposals.addManualProduct() — multipart POST to
  proposals/{id}/products/manual with PascalCase form fields + optional
  PDF under 'file', matching the official C# SDK wire shape
- optional language on both document fetch requests, appended as ?language=

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kerem-acer kerem-acer merged commit 7f714e3 into main Jun 10, 2026
2 checks passed
@kerem-acer kerem-acer deleted the fix/proposal-detail-contract-gaps branch June 10, 2026 05:08
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