import { BasketEntry } from '../../_models'; import { ComparableProduct } from '../../_types/builded/comparable-product'; import { ItemsComparator } from '../../_types/items-comparator'; import * as i0 from "@angular/core"; export declare class LegacyBasketsComparatorService { extIdToItemsComparator: { [key: string]: ItemsComparator; }; constructor(); /** * Initialize the comparison between Miam's basket and client's cart. * First create an item comparator for each product in retailer's basket, then update all ItemsComparators with the entries * from Miam's basket, and create ItemsComparators for entries whose extId hasn't got an ItemsComparator yet. * Then check for items to remove from Miam's basket & send update event to Miam */ initBasketComparator(firstMiamBasket: BasketEntry[], firstRetailerBasket: ComparableProduct[], fromRetailer: boolean): ComparableProduct[]; /** * When Miam's basket is updated, update the existing ItemsComparator with entries linked to new products, add ItemsComparators * with entries linked to existing products. * Then check for items to push to/remove from retailer's basket and return them */ updateReceivedFromMiam(miamBasket: BasketEntry[]): ComparableProduct[]; /** * If the POS is modified the back creates new basket-entries for each product, linked with the new POS * If the POS is modified without a script reload, the comparison still has the old entries + the new entries, * and thus will add double the items to the retailer's cart * So we need to check if any basket-entries are not in the basket and clean them from the comparison * @param entriesInBasket Content of the last received Miam basket */ cleanMiamEntries(miamBasket: BasketEntry[]): void; /** * For every entry in Miam's basket whose associated extId has an ItemsComparator, update the comparator with the entry * or remove the entries from the itemsComparator if they have been removed from Miam's basket */ updateEntriesFromMiam(miamBasket: BasketEntry[]): void; /** * For every entry in Miam's basket whose associated extId doesn't have an ItemsComparator, create a comparator with the right entry */ addEntriesFromMiam(miamBasket: BasketEntry[]): void; /** * Infer all products that need to be pushed to/removed from retailer's basket from the state of all ItemsComparators and return them */ resolveFromMiam(miamBasket: BasketEntry[]): ComparableProduct[]; /** * When the retailer's basket is updated, update existing ItemsComparators' retailerProducts, then delete ItemsComparators whose * retailerProduct have been removed from retailer's basket. * Then check for items to remove from Miam's basket & send update event to Miam */ updateReceivedFromRetailer(retailerBasket: ComparableProduct[]): ComparableProduct[]; /** * Fetch or create an ItemsComparator for each product in the retailer's basket and update it's retailerProduct */ updateRetailerProducts(retailerBasket: ComparableProduct[]): void; /** * Delete all ItemsComparators whose retailerProduct have been removed from retailer's basket. */ deleteRemovedRetailerProducts(retailerBasket: ComparableProduct[]): void; /** * Infer all entries that need to be removed from Miam's basket from the state of all ItemsComparators and return them * Then before the sync cycles ends, updates miam quantities for all itemsComparators with the current quantities */ resolveFromRetailer(): ComparableProduct[]; /** * reset previousQuantity to the current miamQuantity for all itemsComparators (to be called at the end of a sync cycle) */ refreshQuantities(): void; reset(): void; static ɵfac: i0.ɵɵFactoryDef; static ɵprov: i0.ɵɵInjectableDef; } //# sourceMappingURL=legacy-baskets-comparator.service.d.ts.map