import type { ComponentProps, CSSProperties, ReactNode } from 'react'; import type { UnitInput } from '../../components/Data Entry/UnitInput'; import type orderSummaryLocales from './locales/en'; export type TimeUnit = 'seconds' | 'minutes' | 'hours' | 'days' | 'months'; type PeriodProps = { hideTimeUnit: true; periodOptions?: never; valueUnitInput?: never; unitUnitInput?: TimeUnit; onChangeUnitInput?: never; } | { /** * Optional time input allowing the user to estimate their cost on different time horizon. * Pass the options to be displayed in the dropdown. */ hideTimeUnit?: false; periodOptions?: TimeUnit[]; valueUnitInput?: ComponentProps['value']; unitUnitInput?: TimeUnit; onChangeUnitInput?: (unit: string, amount: number) => void; }; type CompactProps = { compact: true; /** * This prop is only usable when `compact=true` */ backgroundProminence?: 'strong' | 'default'; } | { compact?: false; /** * This prop is only usable when `compact=true` */ backgroundProminence?: never; }; type NumberInputType = { /** * Display a number input instead of the price */ numberInput?: boolean; numberInputValue?: number | null; numberInputUnit?: string; numberInputControls?: boolean; onChangeInput?: (value: number | null) => void; }; export type PriceTypeSingle = { maxPrice: number; maxPriceWithDiscount: number; totalPrice: number; totalPriceWithDiscount: number; timeUnit: TimeUnit; }; export type PriceType = Record; export type SubCategoryType = { title?: string; icon?: ReactNode; additionalInfo?: ReactNode; price?: number; /** * List of elements to be displayed in the subcategory */ details?: ReactNode[]; discount?: number; amount?: number[] | number; amountFree?: number; /** * Set to true if the price does not depend on the time */ fixedPrice?: boolean; /** * Suffix to be displayed after the price - this will trigger to not display the overall price taking into account the amount for the subcategory. */ priceUnit?: string; /** * Hide the price for the line (it will still be counted in the general price) */ hidePrice?: boolean; /** * Custom content to display next to the price */ customContent?: ReactNode; anchor?: string; } & NumberInputType; export type ItemsType = { category: string; additionalInfo?: ReactNode; /** Information to add beneath the catecgory name */ subTitle?: ReactNode; subCategories?: SubCategoryType[]; discount?: number; /** * Hide the price of the category and display the custom content instead */ customContent?: ReactNode; /** * Whether the category price can be < 0 (e.g coupons) */ allowNegative?: boolean; anchor?: string; } & NumberInputType; export type CurrencyType = 'EUR'; export type LocalesFormatType = Intl.LocalesArgument; export type OrderSummaryProps = { items: ItemsType[]; header?: string; locales?: Record; currency?: CurrencyType; /** * Locale to format the numbers (prices) */ localeFormat?: LocalesFormatType; /** *Total applied to the final cost (due to commitment, beta...) */ discount?: number; footer?: ReactNode; children?: ReactNode; totalPriceInfo?: ReactNode; totalPriceInfoPlacement?: 'left' | 'right'; totalPriceDescription?: ReactNode; additionalInfo?: string; priceInformation?: ReactNode; hideBeforePrice?: boolean; /** * Number of fraction digit to display in the price details */ fractionDigits?: number; /** * Get the computed price for each category. * `price.category = { before: [total, totalMax], after: [totalWithDiscount, totalMaxWithDiscount]}` + * Get the total price + * Get the unitary categories- and total-prices (for 1 hour) */ onChange?: (price: PriceType, totalPrice: PriceTypeSingle, unitaryCategoriesPrice: PriceType, unitaryTotalPrice: PriceTypeSingle) => void; hideDetails?: boolean; calculatorIcon?: boolean; className?: string; ['data-testid']?: string; style?: CSSProperties; } & PeriodProps & CompactProps; export {}; //# sourceMappingURL=types.d.ts.map