An error has occurred

{{terminalError}}

The Download

Sign up for your daily dose of what's up in emerging technology.

By signing up, you agree to our Privacy Policy.

Thanks!

We appreciate you signing up.

const emailForm = document.querySelector('.pn-template__email-wrapper'); const userEmailInput = document.querySelector('.pn-template__email'); const emailError = document.querySelector('.pn-template__error'); const userSubmit = document.querySelector('#submit-button'); const userFakeSubmit = document.querySelector('#fake-button'); const errorIcon = document.querySelector('#error-icon'); const checkEmail = function (inputData) { const regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return regex.test(inputData); }; userEmailInput.addEventListener('input', () => { emailForm.classList.remove('pn-template__email-wrapper--bad'); emailError.innerText = ''; errorIcon.style.display = 'none'; if (checkEmail(userEmailInput.value)) { userFakeSubmit.hidden = true; userSubmit.hidden = false; } else { userSubmit.hidden = true; userFakeSubmit.hidden = false; } }); userFakeSubmit.addEventListener('click', () => { if (! checkEmail(userEmailInput.value)) { emailForm.classList.add('pn-template__email-wrapper--bad'); errorIcon.style.display = 'block'; userEmailInput.focus(); if ('' === userEmailInput.value) { emailError.innerText = 'Please enter a valid email address'; } else { emailError.innerText = 'Please enter a valid email address'; } } else { emailForm.classList.remove('pn-template__email-wrapper--bad'); emailError.innerText = ''; errorIcon.style.display = 'none'; } }); // Listener to receive the message from the frontend. window.addEventListener('message', (e) => { const formSection = document.querySelector('.pn-template__state--first'); const thanksSection = document.querySelector('.pn-template__state--second'); const emailError = document.querySelector('.pn-template__error'); const firstButton = document.querySelector('#first-close-button'); const secondButton = document.querySelector('#second-close-button'); // Verify that the message is coming from Piano. if ('undefined' !== typeof e.data.piano) { // Get the object with the result. const result = e.data.piano; if (result.success) { // Subscription succeeded. // Hide the form section. if (firstButton) { firstButton.style.display = 'none'; } formSection.style.display = 'none'; // Show the thanks section. thanksSection.style.display = 'block'; } else { // Subscription failed. // Display error. emailError.innerText = result.message; } } }, false);