@spartacus/core
Version:
Spartacus - the core framework
62 lines (61 loc) • 2.86 kB
TypeScript
import { Store } from '@ngrx/store';
import { BehaviorSubject, Observable } from 'rxjs';
import { UserIdService } from '../../auth/user-auth/facade/user-id.service';
import { Cart } from '../../model/cart.model';
import { OrderEntry } from '../../model/order.model';
import { BaseSiteService } from '../../site-context/facade/base-site.service';
import { UserService } from '../../user/facade/user.service';
import { CartConfigService } from '../services/cart-config.service';
import { StateWithMultiCart } from '../store/multi-cart-state';
import { MultiCartService } from './multi-cart.service';
import * as i0 from "@angular/core";
export declare class SelectiveCartService {
protected store: Store<StateWithMultiCart>;
protected userService: UserService;
protected multiCartService: MultiCartService;
protected baseSiteService: BaseSiteService;
protected cartConfigService: CartConfigService;
protected userIdService: UserIdService;
protected customerId: string;
protected userId: string;
protected cartId: string;
protected selectiveCart$: Observable<Cart>;
protected cartId$: BehaviorSubject<string>;
protected readonly PREVIOUS_USER_ID_INITIAL_VALUE = "PREVIOUS_USER_ID_INITIAL_VALUE";
protected previousUserId: string;
protected cartSelector$: Observable<import("../../state/utils/processes-loader").ProcessesLoaderState<Cart>>;
constructor(store: Store<StateWithMultiCart>, userService: UserService, multiCartService: MultiCartService, baseSiteService: BaseSiteService, cartConfigService: CartConfigService, userIdService: UserIdService);
getCart(): Observable<Cart>;
getEntries(): Observable<OrderEntry[]>;
/**
* Returns true when selective cart is stable (not loading and not pending processes on cart)
*/
isStable(): Observable<boolean>;
/**
* Loads logged user's selective cart
*/
protected load(): void;
addEntry(productCode: string, quantity: number): void;
removeEntry(entry: OrderEntry): void;
updateEntry(entryNumber: number, quantity: number): void;
getEntry(productCode: string): Observable<OrderEntry>;
/**
* Indicates if selectiveCart feature is enabled based on cart configuration.
*/
isEnabled(): boolean;
/**
* Indicates if given cart is empty.
* Returns true is cart is undefined, null or is an empty object.
*/
protected isEmpty(cart: Cart): boolean;
/**
* Indicates if a given user is logged in on account different than preceding user account
*/
protected isJustLoggedIn(userId: string): boolean;
/**
* Indicates if given user is logged in
*/
protected isLoggedIn(userId: string): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<SelectiveCartService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<SelectiveCartService>;
}