import { Amount } from '../../../commonStateTypes/amount'; import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common'; /** A single pricing tier within a price point (values kept as raw strings). */ export interface InvoicingCatalogItemFormTier { endingUnit: string; packageSize: string; pricingType: string; startingUnit: string; /** Unset until entered, so a blank field is distinguishable from a real 0. */ price?: Amount; } /** A price point of a catalog item. */ export interface InvoicingCatalogItemFormSubFamily { /** Accounting integration is per price point: the API carries * `accounting_detail` on each product, not on the parent item. */ accountingCategory: string; accountingCode: string; billingCycles: string; description: string; freeQuantity: string; id: string; invoiceNotes: string; isTaxable: boolean; name: string; period: string; periodUnit: string; priceCode: string; pricingModel: string; prorationType: string; showDescriptionInInvoices: boolean; showDescriptionInQuotes: boolean; sku: string; tiers: InvoicingCatalogItemFormTier[]; trialEndAction: string; trialPeriod: string; trialPeriodUnit: string; /** Unset until entered, so a blank field is distinguishable from a real 0. */ priceDollars?: Amount; } /** * Draft form state for the create/edit catalog item (plan / add-on / one-time * charge) form. Held in CES so the form flows its data from here (mirrors the * customer form pattern). `catalogType` is `plan` | `addon` | `charge`; the * every type is persisted as a parent catalog item through `/catalog/plans`. */ export interface InvoicingCatalogItemFormLocalData { applicableItems: string[]; catalogType: string; description: string; externalId: string; itemApplicability: string; name: string; productCode: string; subFamilies: InvoicingCatalogItemFormSubFamily[]; unit: string; } export type InvoicingCatalogItemKind = 'plan'; export interface EditInvoicingCatalogItemDetailViewState extends FetchedState { /** * Lifecycle action (archive, activate, …) fetch state per catalog item id. * A price-point action is keyed on its parent item, so the item's page and * its row in the list both see one busy flag. */ actionStateById: Record; /** Inline-edit drafts, keyed by catalog item id. */ editDraftById: Record; newItemDraft: InvoicingCatalogItemFormLocalData; /** * Detail-load state per catalog item id. Keyed rather than a single slot, so * opening one item after another cannot read the previous item's status as * this one's. */ recordStateById: Record; savedItemId?: ID; savedKind?: InvoicingCatalogItemKind; }