import { Event } from "../../event/core/event"; import { OrderProduct } from "../../event/types/page/confirmation"; import { CartProduct } from "../types/base/cart-event"; /** * Error thrown whenever the user tries to send a * closed batch request. * * @class BatchAlreadyClosedError * @extends {Error} */ export declare class BatchAlreadyClosedError extends Error { /** * Creates an instance of BatchAlreadyClosedError. * * @memberof BatchAlreadyClosedError */ constructor(); } /** * A Batch event builder. * * Use this class to send multiple events at once, * without opening unnecessary requests. The batch * can only be sent once. * * @export * @class BatchEventBuilder */ export declare class BatchEventBuilder { /** * Start a new batch. * * @static * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ static start(): BatchEventBuilder; events: Event[]; private closed; /** * Push all events to the server. This method can * only be called once pper batch, otherwise a * `BatchAlreadyClosedError` will be thrown. * * @return {Promise} * @memberof BatchEventBuilder */ push(): Promise; /** * Append a generic Event to the batch request. * * @param {Event} event Event to be appended. * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ withEvent(event: Event): BatchEventBuilder; /** * Append an Order Confirmation Event. * * @param {string} orderId Order's ID. * @param {OrderProduct[]} [products=[]] Products bought. * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ withPageConfirmationEvent(orderId: string, products?: OrderProduct[]): BatchEventBuilder; /** * Append a Cart Pageview Event. * * @param {CartProduct[]} [products=[]] Product's inside the cart. * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ withCartPageviewEvent(products?: CartProduct[]): BatchEventBuilder; /** * Append a Home Pageview Event. * * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ withHomePageViewEvent(): BatchEventBuilder; /** * Append a User Login Event. * * @param {string} email User's email. * @param {boolean} [allowMailMarketing=true] Wheter mail sould be sent to this user. * @return {BatchEventBuilder} * @memberof BatchEventBuilder */ withUserLoginEvent(email: string, allowMailMarketing?: boolean): BatchEventBuilder; }