UNPKG

@chiper-inc/ecommerce-lib

Version:
136 lines (135 loc) 5.67 kB
import { Item, ItemOptions, ItemType } from "./item"; import { Price, PriceOptions } from "./price"; export declare class Measurement { readonly unit: string; readonly quantity: number; constructor(unit: string, quantity: number); toJSON(): { unit: string; quantity: number; }; } export type ProductOptions = ItemOptions & { prices: Price[]; retailPrice: number; measurement: Measurement; sku: string; sponsored: boolean; referenceId: number; ledgerAccount: string; description: string; lowStock: boolean; brandName: string; minQuantity: number; maxQuantity?: number; referencePromotionId?: number; chiperPrice?: number; oldPrice?: number; clusterCode?: string; isKvi?: boolean; partnerId?: number; citrusAdId?: string; }; export type ProductRaw = Omit<ProductOptions, "prices"> & { prices: PriceOptions[]; type: ItemType; }; export declare class Product extends Item { private _prices; readonly measurement: Measurement; readonly sku: string; readonly sponsored: boolean; readonly referenceId: number; readonly ledgerAccount: string; readonly description: string; readonly lowStock: boolean; readonly brandName: string; readonly minQuantity: number; readonly retailPrice: number; readonly _maxQuantity?: number; readonly referencePromotionId?: number; private readonly _chiperPrice?; readonly oldPrice?: number; readonly clusterCode?: string; readonly isKvi?: boolean; readonly partnerId?: number; readonly citrusAdId?: string; constructor({ stock, quantity, multipleQuantity, name, image, id, warehouseId, packagingType, prices, measurement, sku, sponsored, referenceId, ledgerAccount, description, lowStock, brandName, minQuantity, maxQuantity, retailPrice, referencePromotionId, chiperPrice, oldPrice, clusterCode, isKvi, partnerId, citrusAdId }: ProductOptions, rate: number, isBackend?: boolean, isOffline?: boolean, offlinePrices?: any); get prices(): Price[]; set prices(prices: Price[]); get maxQuantity(): number | undefined; get total(): number | null; get subtotal(): number | null; /** * Set the quantity and updates the prices quantities * * @param quantity the quantity */ set quantity(quantity: number | undefined); get quantity(): number | undefined; static from({ id, name, stock, warehouseId, medium, packagingType, multipleQuantity, prices, quantity, measurement, sku, sponsored, citrusAdId, referenceId, ledgerAccount, description, lowStock, brandName, minQuantity, maximumQuantity, chiperPrice, oldPrice, clusterCode, isKvi, partnerId, }: any, rate: number, isBackend?: boolean, isOffline?: boolean, offlinePrices?: any): Product; static fromShopCart({ multipleQuantity, prices, discountedTotal, managerPrice, discountedSubtotal, stock, quantity, medium, id, warehouseId, packagingType, sku, sponsored, citrusAdId, referenceId, ledgerAccount, description, lowStock, customerTotal, brandName, minQuantity, customerMeasurement, customerMeasurementUnit, name, }: any, rate: number): Product; static fromCatalog({ stock, multipleQuantity, name, medium, id, warehouseId, packagingType, prices, primaryPackaging, sku, sponsored, referenceId, ledgerAccount, description, customerPrice, lowStock, brandName, minQuantity, maxQuantity, maximumQuantity, discountedMaximumQuantity, scheduleEndDate, quantity, isKvi, partnerId, citrusAdId }: any, rate: number): Product; static fromPromoDetail({ id, multipleQuantity, sku, displayName, measurementUnit, salesUnit, packagingType, prices, warehouseId, stock, image, medium, partnerId }: any, rate: number): Product; get discountExpirationDate(): Date | undefined | null; get regularPrice(): number; get totalDollars(): number | null; get regularPriceDolar(): number; get discountedPrice(): number | undefined; /** price without taxes */ get price(): number; get chiperPrice(): number; increase(): void; decrease(): void; clone(): Product; toJSON(): { brandName: string; description: string; prices: { customerTotal: number; ico: number; iva: number; base: number; subtotal: number; managerSubtotal: number; total: number; measurementTotal: number; externalId: number | undefined; maxQuantity: number | undefined; discountedExternalId: number | null; expireDate: Date | null | undefined; quantity: number | undefined; discount: number | null; }[]; retailPrice: number; ledgerAccount: string; lowStock: boolean; maxQuantity: number | undefined; maximumQuantity: number | undefined; measurement: Measurement; referenceId: number; sku: string; sponsored: boolean; citrusAdId: string; clusterCode: string | undefined; isKvi: boolean | undefined; partnerId: number | undefined; id: string | number; warehouseId: number; type: ItemType; name: string; stock: number; quantity: number | undefined; image: string; medium: string; packagingType: string; minQuantity: number; multipleQuantity: number; total: number | null; subtotal: number | null; regularPrice: number; discountedPrice: number | undefined; totalDollars: number | null; regularPriceDolar: number; }; }