import { AutoEncoder, PartialWithoutMethods } from '@simonbackx/simple-encoding'; import { SimpleError, SimpleErrors } from '@simonbackx/simple-errors'; import { CartReservedSeat } from '../SeatingPlan.js'; import { Cart } from './Cart.js'; import { StockDefinition } from './CartStockHelper.js'; import { ProductDiscountSettings } from './Discount.js'; import { Option, OptionMenu, Product, ProductPrice } from './Product.js'; import { Webshop } from './Webshop.js'; import { WebshopFieldAnswer } from './WebshopField.js'; import { UitpasNumberAndPrice } from './UitpasNumberAndPrice.js'; export declare class CartItemPrice extends AutoEncoder { price: number; fixedDiscount: number; percentageDiscount: number; get discountedPrice(): number; } export declare class CartItemOption extends AutoEncoder { option: Option; optionMenu: OptionMenu; } export declare class CartItem extends AutoEncoder { id: string; product: Product; productPrice: ProductPrice; options: CartItemOption[]; fieldAnswers: WebshopFieldAnswer[]; seats: CartReservedSeat[]; amount: number; /** * Discounts that are actually applied */ discounts: ProductDiscountSettings[]; /** * When an order is correctly placed, we store the reserved amount in the stock here. * We need this to check the stock changes when an order is edited after placement. */ reservedAmount: number; /** * Holds a list of what we reserved a stock for (which produce prices and which options specifically so we don't reserve the same thing multiple times or revert when it wasn't reserved earlier) */ reservedOptions: Map; /** * Holds a list of what we reserved a stock for (which produce prices and which options specifically so we don't reserve the same thing multiple times or revert when it wasn't reserved earlier) */ reservedPrices: Map; /** * When the seats are successfully reserved, we store them here * This makes editing seats possible because we know we can still use these seats even if they are blocked normally */ reservedSeats: CartReservedSeat[]; /** * @deprecated * Saved unitPrice (migration needed) */ unitPrice: number | null; /** * Detailed list of prices */ calculatedPrices: CartItemPrice[]; /** * In case this product is a UiTPAS social tarrif, * we hold a list of UiTPAS numbers (length is equal to amount) * and the price of the social tarrif for this uitpas number. * * In case this is not a UiTPAS social tarrif, this will be an empty array. */ uitpasNumbers: UitpasNumberAndPrice[]; /** * Show an error in the cart for recovery */ cartError: SimpleError | SimpleErrors | null; /** * @deprecated */ get price(): number | null; getReservedAmountPrice(priceId: string): number; getReservedAmountOption(optionId: string): number; static createDefault(product: Product, cart: Cart, webshop: Webshop, data: { admin: boolean; }): CartItem; static create(this: T, object: PartialWithoutMethods): InstanceType; /** * Unique identifier to check if two cart items are the same */ get code(): string; get codeWithoutFields(): string; /** * Return total amount of same product in the given cart. Always includes the current item, even when it isn't in the cart. Doesn't count it twice */ getTotalAmount(cart: Cart): number; /** * Note: this resets any discounts that are applied to the cart item */ calculatePrices(cart: Cart): void; private calculateUnitPrice; calculateOptionsPrice(cart: Cart, priceBeforeOptions: number): number; /** * @deprecated * Use this method if you need temporary prices in case it is not yet calculated */ getUnitPrice(cart: Cart): number; getPriceWithDiscounts(): number; getPriceWithoutDiscounts(): number; /** * @deprecated: use other systems * Prices that are only applicable to some amount, but not all (e.g. seat extra prices) */ getPartialExtraPrice(cart: Cart): number; /** * @deprecated use getPriceWithDiscounts instead for clarity */ getPrice(): number; private getUnitPriceCombinationsWithoutDiscount; private getUnitPriceCombinationsWithDiscount; get formattedAmount(): string | null; /** * Without discounts */ getFormattedPriceWithoutDiscount(): string; getFormattedPriceWithDiscount(): string | null; getDiffName(): string; getDiffValue(): string; private priceCombinationToString; /** * Used for statistics */ get descriptionWithoutFields(): string; get descriptionWithoutDate(): string; get description(): string; validateAnswers(): void; /** * Update self to the newest available data, and throw error if something failed (only after refreshing other ones) */ refresh(webshop: Webshop): void; getFixedStockDefinitions(oldItem: CartItem | null | undefined, cart: Cart, webshop: Webshop, admin: boolean): StockDefinition[]; /** * Return all the stock definitions for this cart item with the currently selected options * = calculate how much you can order with these options */ getAvailableStock(oldItem: CartItem | null | undefined, cart: Cart, webshop: Webshop, admin: boolean): StockDefinition[]; getMaximumRemaining(oldItem: CartItem | null | undefined, cart: Cart, webshop: Webshop, admin: boolean): number | null; validateUitpasNumbers(): void; /** * Update self to the newest available data and throw if it was not able to recover */ validate(webshop: Webshop, cart: Cart, { refresh, admin, validateSeats }?: { refresh?: boolean; admin?: boolean; validateSeats?: boolean; }): void; } //# sourceMappingURL=CartItem.d.ts.map