import { Observable } from 'rxjs'; import { BasketEntry } from '../../_models'; import { ComparableProduct } from '../../_types/builded/comparable-product'; import { BasketsService } from '../baskets.service'; import { SuppliersService } from '../suppliers.service'; import { LegacyBasketsComparatorService } from './legacy-baskets-comparator.service'; import * as i0 from "@angular/core"; export declare class LegacyBasketsSynchronizerService { private comparatorService; private basketsService; private supplierService; private firstMiamBasket; private firstRetailerBasket; private isProcessingRetailerEvent; private ignoreUpdatesFromMiam; private firstMiamBasketProcess; /** * This method needs to be passed to Miam by the retailer */ pushBasketEntriesToBasket: (entries: any[]) => void; constructor(comparatorService: LegacyBasketsComparatorService, basketsService: BasketsService, supplierService: SuppliersService); /** * The scan-list is not supposed to add product to the retailer's cart before it is confirmed so the easiest way to prevent this is to * ignore updates from Miam until then. * When stopping ignoring updates from Miam, trigger and update from Miam */ set ignoreMiam(ignore: boolean); /** * This method needs to be passed to Miam by the retailer */ pushProductsToBasket: (comparableProducts: ComparableProduct[]) => void; /** * Start listening on Miam's basket */ listenToMiam(): void; processMiamBasket(miamBasket: BasketEntry[]): void; /** * Process the new basket from Miam * @param miamBasket entries from updated basket */ miamBasketChanged(miamBasket: BasketEntry[]): void; /** * Initialize the first basket on Miam's side, then try to initialize the basket sync */ initFirstMiamBasket(miamActiveBasket: BasketEntry[]): void; /** * Initialize the first basket on retailer's side, then try to initialize the basket sync */ initFirstRetailerBasket(retailerBasket: ComparableProduct[]): void; /** * Initialize the basket sync if both baskets have been received, by initializing the comparator */ initIfPossible(): void; /** * @returns true is first baskets have been received for Miam & retailer */ isReady(): boolean; resetMiam(): void; /** * Calls pushProductsToBasket if there are changes that need to be notified to the retailer */ sendUpdateToRetailer(itemsToAdd: ComparableProduct[]): void; pushBasketEntriesAndManagePFTs(itemsToAdd: ComparableProduct[]): void; /** * Remove entries from Miam's basket if there are entries that need to be removed */ sendUpdateToMiam(entriesToRemove: ComparableProduct[]): void; /** * Only in the scan-list can entries with no selectedItem can be added to the basket. If there are any when the retailer * sends an update, return them so we can add them to entriesToRemove */ entriesToClean(): Observable; /** * Process the new basket from the retailer * @param retailerBasket current basket of the retailer */ retailerBasketChanged(retailerBasket: ComparableProduct[]): void; /** * Handle Payment and confirm Miam's basket before restarting the synchronization by resetting retailer's basket * Which means the next retailer's basket received will init the comparator again, which will in turn init the * items comparison * @param total of the user's cart */ handlePayment(total: number): void; static ɵfac: i0.ɵɵFactoryDef; static ɵprov: i0.ɵɵInjectableDef; } //# sourceMappingURL=legacy-baskets-synchronizer.service.d.ts.map