seahaven-ap/packages/shared/src/csv.ts
Adam Moussa 46b570352a
feat(shared): add payment ladder and CSV domain package (AP-13) (#11)
* feat(shared): add payment ladder and CSV domain package

Introduce @seahaven-ap/shared via npm workspaces so FE and future API share
payments-dashboard-compatible status ladders, pay-date helpers, and CSV headers.

* fix(web): build shared package before vite dev

Ensure fresh npm ci && npm run dev (and Playwright webServer) can resolve
@seahaven-ap/shared dist exports that are gitignored.
2026-08-10 19:28:02 -04:00

41 lines
1.2 KiB
TypeScript

/**
* Fixed CSV header contract for payments-dashboard ProcessPaymentCsv compatibility.
* Column names and export order must not drift.
*/
export const PAYMENT_CSV_HEADER = {
checkNumber: "Check Number",
method: "Method",
status: "Status",
sendPaymentOn: "Send Payment On",
amountInUsd: "Amount in USD",
amount: "Amount",
payee: "Payee",
invoiceNumbers: "Invoice Numbers",
companySubsidiary: "Company/Subsidiary",
} as const;
export type PaymentCsvHeaderKey = keyof typeof PAYMENT_CSV_HEADER;
/** Ordered headers for export / golden-file alignment (AP-17). */
export const PAYMENT_CSV_HEADERS = [
PAYMENT_CSV_HEADER.checkNumber,
PAYMENT_CSV_HEADER.method,
PAYMENT_CSV_HEADER.status,
PAYMENT_CSV_HEADER.sendPaymentOn,
PAYMENT_CSV_HEADER.amountInUsd,
PAYMENT_CSV_HEADER.amount,
PAYMENT_CSV_HEADER.payee,
PAYMENT_CSV_HEADER.invoiceNumbers,
PAYMENT_CSV_HEADER.companySubsidiary,
] as const;
export type PaymentCsvHeader = (typeof PAYMENT_CSV_HEADERS)[number];
/** Method display values the consumer branches on (Check vs ACH). */
export const PAYMENT_CSV_METHODS = {
check: "Check",
ach: "ACH",
} as const;
export type PaymentCsvMethod = (typeof PAYMENT_CSV_METHODS)[keyof typeof PAYMENT_CSV_METHODS];