ACC.connectWithPayPalPage = {

    _autoload: [['connectWithPayPalSecurityLayerPage', $('#connect-with-paypal-security-layer-page').length !== 0]],

    connectWithPayPalSecurityLayerPage: function () {
        $(`#connect-with-paypal-security-layer-cancel-button`).on(`click`, this.showSecurityLayerCancelPopup);

        $(`#connect-with-paypal-security-layer-popup-ok-button`).on(`click`, this.redirectToLoginPage);

        $(`#connect-with-paypal-security-layer-popup-cancel-button`).on(`click`, this.hideSecurityLayerCancelPopup);
    },

    showSecurityLayerCancelPopup: function () {
        let securityCancelPopup = document.getElementById(CONST.SECURITY_CANCEL_POPUP_ID);
        securityCancelPopup.hidden = false;
    },

    hideSecurityLayerCancelPopup: function () {
        let securityCancelPopup = document.getElementById(CONST.SECURITY_CANCEL_POPUP_ID);
        securityCancelPopup.hidden = true;
    },

    onASLSubmitClick: function () {
        ACC.loadingSpinner.showSpinner('connect-with-paypal-security-layer-page');
    },

    redirectToLoginPage: function () {
        let url = ACC.config.loginUrl;
        window.location = url;
    }
}