export class PixelioCartAbandonRecoveryMoreIdleHandler {
    IDLEMAX = 2;

    constructor(exitPopup, eventTracker, popupVisibilityHandler) {
        this.idleTime = 0;

        this.exitPopup = exitPopup;
        this.eventTracker = eventTracker;
        this.popupVisibilityHandler = popupVisibilityHandler;
    }

    resetIdleTime() {
        this.idleTime = 0;
    }

    incrementIdleTime() {
        this.idleTime++;

        if (this.idleTime !== this.IDLEMAX) {
            return;
        }

        if (!this.popupVisibilityHandler.canShowPopup()) {
            return;
        }

        this.exitPopup.startTimer = true;
        this.exitPopup.pixelioCartAbandonRecoveryMoreShow();

        this.popupVisibilityHandler.setToShown();

        this.eventTracker.track("popup_view");
    }
}