export class PixelioCartAbandonRecoveryMoreRemoveFromCartHandler {
    ISCARTEMPTYACTION = "pixelio_cart_abandon_recovery_more_is_cart_empty";

    constructor(ajaxRequest, cartTimer, addToCartHandler) {
        this.ajaxRequest = ajaxRequest;
        this.cartTimer = cartTimer;
        this.addToCartHandler = addToCartHandler;
    }

    handle() {
        setTimeout(() => {
            this.ajaxRequest.makeAjaxRequest(
                this.ISCARTEMPTYACTION,
                new FormData(),
                this.cartTimer.pixelioCartAbandonRecoveryMoreHideTimer.bind(this.cartTimer)
            );

            this.addToCartHandler.setToNotAddingProduct();
        }, 2000);
    }

    isRemoveFromCartButton($button) {
        return $button.hasClass("wc-block-cart-item__remove-link") ||
            $button.hasClass("wc-block-components-quantity-selector__input");
    }
}