import { EventType } from "../../../event/core/event"; import { CartEvent } from "../base/cart-event"; /** * Session Cart Remove Event. * * Should be used whenever the user adds a new product to the basket. * Should be sent with info about the product the user just removed * from the basket. * * @export * @class SessionCartRemoveEvent * @extends {Event} */ export class SessionCartRemoveEvent extends CartEvent { public type: EventType = EventType.SessionCartRemove; /** * Creates an instance of SessionCartRemoveEvent. * * @memberof SessionCartRemoveEvent */ constructor(public locale?: string, public channel?: string) { super(); } /** * Push this SessionCartRemoveEvent event to the server. * * If no products are passed before this method is called * nothing will be done. * * @return {Promise} * @memberof SessionCartRemoveEvent */ public async push(): Promise { if (this.products.length > 0) { return super.push(); } // If no products were added to this event, do nothing. return Promise.resolve(null); } }