From 9bd023dbbf4b544f40b8d7c4b75d5db3f994f10e Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 6 Jan 2023 18:37:10 -0600 Subject: [PATCH] Website: Add optional inputs to Fleet Sandbox registration form. (#9203) cc: @alexmitchellii Changes: - Added optional inputs to the Fleet Sandbox signup page: - First name - Last name - Organization - Updated signup.js to send the optional inputs to the Zapier webhook Co-authored-by: Mike McNeil --- website/api/controllers/entrance/signup.js | 6 +++--- .../js/pages/try-fleet/register.page.js | 21 +++++++++++++++---- .../styles/pages/try-fleet/register.less | 16 ++++++++++++++ website/views/pages/try-fleet/register.ejs | 10 +++++++++ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/website/api/controllers/entrance/signup.js b/website/api/controllers/entrance/signup.js index 69aaeda765..994a350db8 100644 --- a/website/api/controllers/entrance/signup.js +++ b/website/api/controllers/entrance/signup.js @@ -184,9 +184,9 @@ the account verification message.)`, 'https://hooks.zapier.com/hooks/catch/3627242/bqsf4rj/', { 'emailAddress': newEmailAddress, - 'organization': signupReason === 'Buy a license' ? organization : '?', - 'firstName': signupReason === 'Buy a license' ? firstName : '?', - 'lastName': signupReason === 'Buy a license' ? lastName : '?', + 'organization': organization ? organization : '?',// « organization input is optional + 'firstName': firstName !== emailAddress.split('@')[0] ? firstName : '?',// « firstName input is always set, but it might have just been a guess based on email. And if was a guess, let's just use "?" instead. + 'lastName': lastName !== emailAddress.split('@')[1] ? lastName : '?',// « lastName input is always set, like firstName 'signupReason': signupReason, 'webhookSecret': sails.config.custom.zapierSandboxWebhookSecret } diff --git a/website/assets/js/pages/try-fleet/register.page.js b/website/assets/js/pages/try-fleet/register.page.js index 28d6885e64..87c9750b08 100644 --- a/website/assets/js/pages/try-fleet/register.page.js +++ b/website/assets/js/pages/try-fleet/register.page.js @@ -42,10 +42,23 @@ parasails.registerPage('register', { // Using handle-submitting to add firstName, and lastName values to our formData before sending it to signup.js handleSubmittingRegisterForm: async function(argins) { - argins.firstName = argins.emailAddress.split('@')[0]; - argins.lastName = argins.emailAddress.split('@')[1]; - argins.signupReason = 'Try Fleet Sandbox'; - return await Cloud.signup.with(argins); + // Creating a copy of the formdata to submit to the signup action. Otherwise, any changes to the formData before we call our signup action would be visible to the user. + let signupArgins = _.clone(argins); + if(!this.formData.firstName){ + if(this.formData.lastName) {// If a user provided a lastName but no firstName, we'll set the firstName to '?' instead of a fragment of the users email address. + signupArgins.firstName = '?'; + } else { + signupArgins.firstName = argins.emailAddress.split('@')[0]; + } + } + if(!this.formData.lastName) { + if(this.formData.firstName) {// If a user provided a firstName but no lastName, we'll set the lastName to '?' instead of a fragment of the users email address. + signupArgins.lastName = '?'; + } + signupArgins.lastName = argins.emailAddress.split('@')[1]; + } + signupArgins.signupReason = 'Try Fleet Sandbox'; + return await Cloud.signup.with(signupArgins); }, // After the form is submitted, we'll redirect the user to their Fleet sandbox instance. diff --git a/website/assets/styles/pages/try-fleet/register.less b/website/assets/styles/pages/try-fleet/register.less index 090de4c67c..aec02340da 100644 --- a/website/assets/styles/pages/try-fleet/register.less +++ b/website/assets/styles/pages/try-fleet/register.less @@ -21,6 +21,22 @@ border: 1px solid @core-vibrant-blue; outline: none; } + [purpose='email-input']:focus-visible { + border: 1px solid @core-vibrant-blue; + outline: none; + } + [purpose='email-input'] { + position: relative; + span { + position: absolute; + right: 12px; + top: 18px; + font-size: 10px; + font-weight: 700; + color: @core-fleet-black-50; + line-height: 18px; + } + } input::placeholder { color: #8B8FA2; } diff --git a/website/views/pages/try-fleet/register.ejs b/website/views/pages/try-fleet/register.ejs index 8a95f632fe..da6e0d4136 100644 --- a/website/views/pages/try-fleet/register.ejs +++ b/website/views/pages/try-fleet/register.ejs @@ -11,7 +11,17 @@
+
+ + +
+
+
+ +
+
+ REQUIRED
This doesn’t appear to be a valid email address