diff --git a/website/api/controllers/imagine/view-launch-party.js b/website/api/controllers/imagine/view-launch-party.js index 575410f391..268fdbcbc7 100644 --- a/website/api/controllers/imagine/view-launch-party.js +++ b/website/api/controllers/imagine/view-launch-party.js @@ -7,6 +7,27 @@ module.exports = { description: 'Display "Launch party" page.', + inputs: { + showForm: { + type: 'boolean', + description: 'An optional boolean that if provided with other', + defaultsTo: false + }, + emailAddress: { + type: 'string', + description: 'If provided, this value will be used to prefill the emailAddress field in the waitlist form' + }, + firstName: { + type: 'string', + description: 'If provided, this value will be used to prefill the first name field in the waitlist form' + }, + lastName: { + type: 'string', + description: 'If provided, this value will be used to prefill the last name field in the waitlist form' + } + }, + + exits: { success: { @@ -16,10 +37,27 @@ module.exports = { }, - fn: async function () { + fn: async function ({showForm, emailAddress, firstName, lastName}) { + + // If form inputs are provided via query string we'll prefill the inputs in the waitlist form. (e.g., A user is coming to this page from a personalized link in an email) + let formDataToPrefill = {}; + if(emailAddress){// Email address will always be provided if a user is coming here from an email link. + formDataToPrefill.emailAddress = emailAddress; + } + // If the first name provided is not '?' or Outreach's first name template, we'll prefill the first name in the waitlist form. + if(firstName && firstName !== '?' && firstName !== '{{first_name}}') { + formDataToPrefill.firstName = firstName; + } + // If the last name provided is not '?' or Outreach's last name template, we'll prefill the last name in the waitlist form. + if(lastName && lastName !== '?' && lastName !== '{{last_name}}') { + formDataToPrefill.lastName = lastName; + } // Respond with view. - return {}; + return { + showForm, + formDataToPrefill, + }; } diff --git a/website/assets/js/pages/imagine/launch-party.page.js b/website/assets/js/pages/imagine/launch-party.page.js index 83f1fb6a62..0aecaadaa8 100644 --- a/website/assets/js/pages/imagine/launch-party.page.js +++ b/website/assets/js/pages/imagine/launch-party.page.js @@ -22,6 +22,7 @@ parasails.registerPage('launch-party', { // Modal modal: '', + showAlternateWaitlistText: false, }, // ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗ @@ -33,8 +34,13 @@ parasails.registerPage('launch-party', { }, mounted: async function() { - if(window.location.search && window.location.search === '?showForm') { + if(this.showForm) { this.modal = 'happy-hour-waitlist'; + if(!_.isEmpty(this.formDataToPrefill)){ + // If the user came here via a personalized link in an email, we'll prefill the form with the user information (if provided) + this.formData = this.formDataToPrefill; + this.showAlternateWaitlistText = true; + } } }, diff --git a/website/views/pages/imagine/launch-party.ejs b/website/views/pages/imagine/launch-party.ejs index eea6866ce5..9a66dab854 100644 --- a/website/views/pages/imagine/launch-party.ejs +++ b/website/views/pages/imagine/launch-party.ejs @@ -92,7 +92,10 @@
- Join the wait list + + Join the wait list + RSVP +