import { Amount } from '../../../commonStateTypes/amount'; import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common'; /** * Draft form state for the create/edit subscription form. Held in CES so the * form flows its data from here (mirrors the customer form / bill-pay pattern). * The shipping address is NOT part of this draft — it is captured via the shared * Address screen (`addressView`) and threaded into the save payload as * `shipping_address` by the save epic. */ export interface InvoicingSubscriptionFormLocalData { addonPriceCodes: string[]; /** * Per-add-on quantity, keyed by item price code. Only the codes currently in * `addonPriceCodes` are read when the save payload is built, so a code left * behind by a deselect is inert; a missing key bills as 1. */ addonQuantities: Record; autoCollection: boolean; chargePriceCodes: string[]; /** Per-charge quantity, keyed by item price code. See `addonQuantities`. */ chargeQuantities: Record; couponId: string; customerId: string; planPriceCode: string; planQuantity: number; poNumber: string; preferredCurrencyCode: string; /** * Number of paid billing cycles including the first invoice, held as a string * so an empty field stays distinguishable from a real 0. Empty means "no * limit set here" — the payload omits it and the backend falls back to the * plan's `billing_cycles` (renewing forever when the plan has no limit). */ remainingBillingCycles: string; /** `YYYY-MM-DD`. Empty falls back to today when the payload is built. */ startedAt: string; trialEnd: string; /** Unset until the user enters one, so an explicit 0 stays distinguishable. */ setupFee?: Amount; } export interface EditInvoicingSubscriptionDetailViewState extends FetchedState { /** Lifecycle action fetch state per subscription id. */ actionStateById: Record; editDraftById: Record; newSubscriptionDraft: InvoicingSubscriptionFormLocalData; /** Detail-load state per subscription id. */ recordStateById: Record; savedSubscriptionId?: ID; }