medusa-plugin-abandoned-cart
Version:
Medusa plugin for abandoned cart tracking and recovery
28 lines (27 loc) • 1.61 kB
TypeScript
import { Cart, EventBusService, Logger, TransactionBaseService } from "@medusajs/medusa";
import CartRepository from "@medusajs/medusa/dist/repositories/cart";
import type SendGridService from "medusa-plugin-sendgrid-typescript/dist/services/sendgrid";
import { AutomatedAbandonedCart, PluginOptions, TransformedCart } from "../types";
export default class AbandonedCartService extends TransactionBaseService {
static LIFE_TIME: import("awilix").LifetimeType;
protected cartRepository: typeof CartRepository;
protected sendGridService: SendGridService | undefined;
protected eventBusService: EventBusService | undefined;
logger: Logger;
options_: PluginOptions;
constructor(container: any, options: PluginOptions);
getCartLocale(cart: TransformedCart): string;
sendAbandonedCartEmail(id: string, interval?: number): Promise<{
success: boolean;
message: string;
}>;
checkTypeOfOptions: (options: PluginOptions) => options is AutomatedAbandonedCart;
humanPrice_(amount: number | null | undefined, currency: string): string;
queryBuilder: (type: "getCount" | "getMany", take: number, skip: number, dateLimit?: number, fromAdmin?: boolean) => Promise<Cart[]> | Promise<number>;
setCartsAsCompleted(cartsIds: string[]): Promise<void>;
retrieveAbandonedCarts(take?: string | number, skip?: string | number, dateLimit?: number, fromAdmin?: boolean): Promise<{
abandoned_carts: TransformedCart | TransformedCart[];
total_carts: number;
}>;
transformCart: (cart: Cart[] | Cart) => TransformedCart[] | TransformedCart;
}