import { InvoicingCustomer, InvoicingCustomerFormLocalData, InvoicingNamedOption } from '@zeniai/client-epic-state'; /** * Web-components glue for the customer form. CES owns the draft `LocalData`, the * save payload, and — via `/1.0/config` — the option lists and their labels; this * module maps those to {@link PickerValue} options and converts between the * form's UI value shapes and CES `LocalData`. The billing address is NOT part of these values — * it is captured via the shared Address screen. Shared by the create/edit form * page and the inline edit on the customer detail page so the two never drift. */ export interface PickerValue { allOptions: { label: string; value: string; }[]; selectedOption?: string; } export interface InvoicingCustomerFormOptions { customerType: { label: string; value: string; }[]; netTerms: { label: string; value: string; }[]; taxability: { label: string; value: string; }[]; } /** The config option lists the customer form's three pickers are built from. */ export interface InvoicingCustomerFormConfig { customerTypeOptions: InvoicingNamedOption[]; netTermDayOptions: InvoicingNamedOption[]; taxabilityOptions: InvoicingNamedOption[]; } /** Select options straight off `/1.0/config`; the backend `name` is the label. */ export declare const buildInvoicingCustomerFormOptions: ({ customerTypeOptions, netTermDayOptions, taxabilityOptions, }: InvoicingCustomerFormConfig) => InvoicingCustomerFormOptions; /** * Create/edit form values (billing address lives in the Address screen). * * Reuses the CES `LocalData` field names verbatim — only the fields whose * *shape* differs on the form (the three pickers) are overridden. Every plain * field (firstName, lastName, email, …) flows through by identity, so adding a * field to the CES type needs no mapper change. `preferredCurrencyCode` is * fixed to USD and not surfaced in the UI, so it is dropped from the form * values and reconstructed on the way back for the request body. */ export type CustomerFormValues = Omit & { customerType: PickerValue; netTermDays: PickerValue; taxability: PickerValue; }; export declare const localDataToCustomerFormValues: (localData: InvoicingCustomerFormLocalData, options: InvoicingCustomerFormOptions) => CustomerFormValues; export declare const customerFormValuesToLocalData: (values: CustomerFormValues) => InvoicingCustomerFormLocalData; /** Values used by the inline edit on the customer detail page. */ export interface CustomerEditValues { auto_collection: boolean; company: string; email: string; first_name: string; invoice_notes: string; last_name: string; net_terms: PickerValue; notes: string; phone: string; taxability: PickerValue; vat_number: string; } export declare const localDataToCustomerEditValues: (localData: InvoicingCustomerFormLocalData, options: InvoicingCustomerFormOptions) => CustomerEditValues; export declare const customerEditValuesToLocalData: (values: CustomerEditValues, base: InvoicingCustomerFormLocalData) => InvoicingCustomerFormLocalData; /** Seed the detail-page inline edit form from an existing customer entity. */ export declare const buildCustomerEditDefaults: (config: InvoicingCustomerFormConfig, customer?: InvoicingCustomer) => CustomerEditValues;