<?php

    namespace MNM\Spitzner\Plugin;

    class SaveCheckoutEmailInSession {
        private $checkoutSession;

        public function __construct(\Magento\Checkout\Model\Session $checkoutSession)
        {
            $this->checkoutSession = $checkoutSession;
        }

        public function beforeIsEmailAvailable(\Magento\Customer\Model\AccountManagement $subject, $email, $websiteId = null)
        {
            $this->checkoutSession->setSpitznerCheckoutEmail($email);

            return null;
        }
    }
