From 9fdb2d0511901a4908d08ddefcdb66883fb24f8a Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 17 Feb 2025 13:35:53 -0600 Subject: [PATCH] Website: update contact form for Fleet premium subscribers (#26361) Changes: - Updated the contact page to only display the "Send a message" form for users who have a Fleet premium subscription - Updated the deliver-contact-form-message action to include details about a user's subscription if the user has purchased a Fleet premium license, and to also send an email to our support email address (in addition to sending a message to our Slack) --- .../deliver-contact-form-message.js | 40 +++++++++++++++++++ website/api/controllers/view-contact.js | 12 ++++++ .../assets/js/pages/entrance/login.page.js | 6 +++ website/assets/styles/pages/contact.less | 28 +++++++++++++ website/assets/styles/pages/support.less | 4 +- website/views/pages/contact.ejs | 22 +++++++++- website/views/pages/support.ejs | 9 ----- 7 files changed, 108 insertions(+), 13 deletions(-) diff --git a/website/api/controllers/deliver-contact-form-message.js b/website/api/controllers/deliver-contact-form-message.js index bd5b602f17..bbad0ad580 100644 --- a/website/api/controllers/deliver-contact-form-message.js +++ b/website/api/controllers/deliver-contact-form-message.js @@ -50,18 +50,58 @@ module.exports = { fn: async function({emailAddress, firstName, lastName, message}) { + + let userHasPremiumSubscription = false; + let thisSubscription; + if(this.req.me){ + thisSubscription = await Subscription.findOne({user: this.req.me.id}); + if(thisSubscription) { + userHasPremiumSubscription = true; + } + } + if (!sails.config.custom.slackWebhookUrlForContactForm) { throw new Error( 'Message not delivered: slackWebhookUrlForContactForm needs to be configured in sails.config.custom. Here\'s the undelivered message: ' + `Name: ${firstName + ' ' + lastName}, Email: ${emailAddress}, Message: ${message ? message : 'No message.'}` ); } + if(userHasPremiumSubscription){ + // If the user has a Fleet Premium subscription, prepend the message with details about their subscription. + let subscriptionDetails =` +Fleet Premium subscription details: +- Fleet Premium subscriber since: ${new Date(thisSubscription.createdAt).toISOString().split('T')[0]} +- Next billing date: ${new Date(thisSubscription.nextBillingAt).toISOString().split('T')[0]} +- Host count: ${thisSubscription.numberOfHosts} +- Organization: ${this.req.me.organization} +----- + + `; + message = subscriptionDetails + message; + await sails.helpers.sendTemplateEmail.with({ + to: sails.config.custom.fromEmailAddress, + replyTo: { + name: firstName + ' '+ lastName, + emailAddress: emailAddress, + }, + subject: 'New contact form message', + layout: false, + template: 'email-contact-form', + templateData: { + emailAddress, + firstName, + lastName, + message, + }, + }); + } await sails.helpers.http.post(sails.config.custom.slackWebhookUrlForContactForm, { text: `New contact form message: (cc: <@U0801Q57JDU>, <@U05CS07KASK>) (Remember: we have to email back; can't just reply to this thread.)`+ `Name: ${firstName + ' ' + lastName}, Email: ${emailAddress}, Message: ${message ? message : 'No message.'}` }); + sails.helpers.salesforce.updateOrCreateContactAndAccount.with({ emailAddress: emailAddress, firstName: firstName, diff --git a/website/api/controllers/view-contact.js b/website/api/controllers/view-contact.js index 3b644211ee..b61de65e69 100644 --- a/website/api/controllers/view-contact.js +++ b/website/api/controllers/view-contact.js @@ -27,12 +27,24 @@ module.exports = { let formToShow = 'talk-to-us'; + let userIsLoggedIn = !! this.req.me; + let userHasPremiumSubscription = false; + if(userIsLoggedIn) { + let thisSubscription = await Subscription.findOne({user: this.req.me.id}); + if(thisSubscription){ + formToShow = 'contact'; + userHasPremiumSubscription = true; + } + } + if(sendMessage) { formToShow = 'contact'; } // Respond with view. return { formToShow, + userIsLoggedIn, + userHasPremiumSubscription }; } diff --git a/website/assets/js/pages/entrance/login.page.js b/website/assets/js/pages/entrance/login.page.js index a18738b75d..4d04ad0dce 100644 --- a/website/assets/js/pages/entrance/login.page.js +++ b/website/assets/js/pages/entrance/login.page.js @@ -44,6 +44,12 @@ parasails.registerPage('login', { this.pageToRedirectToAfterLogin = '/new-license#login'; window.location.hash = ''; } + // If we're redirecting this user to the contact form after they log in, modify the link to the /register page and the pageToRedirectToAfterLogin. + if(window.location.hash && window.location.hash === '#contact'){ + this.registerSlug = '/register'; + this.pageToRedirectToAfterLogin = '/contact?sendMessage'; + window.location.hash = ''; + } }, mounted: async function() { //… diff --git a/website/assets/styles/pages/contact.less b/website/assets/styles/pages/contact.less index 487c58d3a3..21033b70cf 100644 --- a/website/assets/styles/pages/contact.less +++ b/website/assets/styles/pages/contact.less @@ -27,6 +27,34 @@ color: #515774; font-size: 14px; } + [purpose='note'] { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + border-radius: 8px; + border: 1px solid #B4B2FE; + background: #F7F7FC; + text-decoration: none; + padding: 16px 24px; + margin-bottom: 40px; + img { + height: 16px; + margin-right: 8px; + } + p { + a { + color: #515774; + } + color: #515774; + font-family: Inter; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 21px; + margin-bottom: 0px; + } + } [purpose='form-option'] { user-select: none; cursor: pointer; diff --git a/website/assets/styles/pages/support.less b/website/assets/styles/pages/support.less index a60481dcc4..7a2d183dea 100644 --- a/website/assets/styles/pages/support.less +++ b/website/assets/styles/pages/support.less @@ -92,7 +92,7 @@ width: 100%; } a { - width: 50%; + width: 33%; } @@ -116,7 +116,7 @@ [purpose='support-row'] { [purpose='support-card'] { - width: 274px; + width: 341px; height: 221px; } } diff --git a/website/views/pages/contact.ejs b/website/views/pages/contact.ejs index 8c4ac9994e..2fdf4e7b0a 100644 --- a/website/views/pages/contact.ejs +++ b/website/views/pages/contact.ejs @@ -3,15 +3,33 @@

Get in touch

-

Let us help you deploy and evaluate Fleet quickly for yourself. We’d love to save you some time.

+

Dedicated professional support from the Fleet team.

+

Let us help you deploy and evaluate Fleet quickly for yourself. We’d love to save you some time.

Schedule a personalized demo for your team and get support or training.

Schedule a personalized demo, or ask us anything. We’d love to chat.

-
+
Talk to an engineer
Send a message
+ + +
+
+ An icon indicating that this section has important information +
+

Already a Fleet customer? Sign in for Premium support

+
+ +
+
+ An icon indicating that this section has important information +
+

Already a Premium customer? Reach out to us directly or use the form below.

+
+ +
diff --git a/website/views/pages/support.ejs b/website/views/pages/support.ejs index e471f2bb66..9a940a517e 100644 --- a/website/views/pages/support.ejs +++ b/website/views/pages/support.ejs @@ -37,13 +37,6 @@