import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common'; /** * The payment-link email the composer opens with: the backend's prefill plus * the tokens the frontend splices the user's edits into. State, not wire shape * — `toInvoicingPaymentLinkEmailPreview` in the payload file maps onto it. */ export interface InvoicingPaymentLinkEmailPreviewData { /** Default body prefill, plain text. */ body: string; bodyToken: string; renderedHtmlTemplate: string; /** Default subject prefill. */ subject: string; subjectToken: string; to: string; } /** * Draft form state for the create/edit customer form. Held in CES so the form * flows its data from here (mirrors the bill-pay / reimbursement pattern). The * billing address is NOT part of this draft — it is captured via the shared * Address screen (`addressView`) and threaded into the save payload as * `billing_address_id` by the save epic. */ export interface InvoicingCustomerFormLocalData { autoCollection: boolean; company: string; customerType: string; email: string; firstName: string; invoiceNotes: string; lastName: string; netTermDays: string; notes: string; phone: string; preferredCurrencyCode: string; taxability: string; vatNumber: string; } export interface EditInvoicingCustomerDetailViewState extends FetchedState { editDraftById: Record; /** * The payment-link email rendered by the backend, cached per customer so * reopening the composer costs nothing. `emailPreviewCustomerId` is the cache * key — a different customer invalidates it. */ emailPreviewFetchState: FetchStateAndError; newCustomerDraft: InvoicingCustomerFormLocalData; /** * Adding promotional credits to this customer — a write against the customer, * so it lives with the rest of this screen's write state. */ promotionalCreditSubmitState: FetchStateAndError; /** Detail-load state per customer id. */ recordStateById: Record; emailPreview?: InvoicingPaymentLinkEmailPreviewData; emailPreviewCustomerId?: ID; savedCustomerId?: ID; }