import { FetchState, FetchStateAndError, ID } from '../../../commonStateTypes/common'; import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport'; import { InvoicingCoupon } from '../../../entity/invoicing/coupon/couponState'; import { InvoicingDiscountLifecycleActionOption, InvoicingFieldHelpByCode, InvoicingFormOption } from '../../../entity/invoicing/invoicingCommonPayload'; import { RootState } from '../../../rootStateTypes'; import { InvoicingCouponFormLocalData } from './editInvoicingCouponDetailViewState'; export interface EditInvoicingCouponDetailView extends SelectorView { /** * The in-flight lifecycle action (archive, activate, …) for this coupon, so * the screen does not reach for the action slice itself. */ actionState: FetchStateAndError; /** Config-owned; folded in so the screen reads one selector. */ configFetchState: FetchState; discountLifecycleActionOptions: InvoicingDiscountLifecycleActionOption[]; /** * Backend help copy for this screen's field group, keyed by field code. * Folded in here so the screen never reaches for the config view itself. */ fieldHelp: InvoicingFieldHelpByCode; /** * Every request the page renders from, reduced to one state: the record and * the config behind its dropdowns and field help. The page holds a skeleton * until this is `Completed`, so the form mounts once with real values. */ pageFetchState: FetchStateAndError; /** * Loading the coupon, as distinct from this view's own `fetchState`, which * tracks the save. */ recordState: FetchStateAndError; coupon?: InvoicingCoupon; savedCouponId?: ID; } export declare const getEditInvoicingCouponDetailViewState: (state: RootState, couponId?: ID) => EditInvoicingCouponDetailView; export interface InvoicingCouponFormView extends EditInvoicingCouponDetailView { applyOnOptions: InvoicingFormOption[]; discountTypeOptions: InvoicingFormOption[]; durationTypeOptions: InvoicingFormOption[]; /** * Backend help copy for this screen's field group, keyed by field code. * Folded in here so the screen never reaches for the config view itself. */ fieldHelp: InvoicingFieldHelpByCode; localData: InvoicingCouponFormLocalData; mode: 'create' | 'edit'; periodUnitOptions: InvoicingFormOption[]; } /** * Bundled view for the discount form screen: the edit view (save state + the * coupon to prefill in edit mode), the draft `localData` (seeded from the * existing coupon in edit mode until the user edits), and the CES-owned * select-option lists the form renders. */ export declare const getInvoicingCouponFormView: (state: RootState, couponId?: ID) => InvoicingCouponFormView;