UNPKG

@spartacus/core

Version:

Spartacus - the core framework

45 lines (44 loc) 1.84 kB
import { ActionsSubject } from '@ngrx/store'; import { Observable } from 'rxjs'; import { EventService } from '../../event/event.service'; import { ActionToEventMapping } from '../../state/event/action-to-event-mapping'; import { ActiveCartService } from '../facade/active-cart.service'; import * as i0 from "@angular/core"; /** * Registers events for the active cart */ export declare class CartEventBuilder { protected actionsSubject: ActionsSubject; protected event: EventService; protected activeCartService: ActiveCartService; constructor(actionsSubject: ActionsSubject, event: EventService, activeCartService: ActiveCartService); /** * Registers events for the active cart */ protected register(): void; /** * Register events for adding entry to the active cart */ protected registerAddEntry(): void; protected registerRemoveEntry(): void; protected registerUpdateEntry(): void; protected registerMergeCartSuccess(): void; /** * Registers a stream of target events mapped from the source actions that contain the cart id equal to the active cart id. * * @param mapping mapping declaration - from `action` string type to `event` class type * (an with optional `factory` function - by default `action.payload` will be assigned to the properties of the event instance). */ protected registerMapped<T>(mapping: ActionToEventMapping<T>): () => void; /** * Returns a stream of actions only of a given type(s) * * @param actionType type(s) of actions */ protected getAction(actionType: string | string[]): Observable<{ type: string; payload?: any; }>; static ɵfac: i0.ɵɵFactoryDeclaration<CartEventBuilder, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CartEventBuilder>; }