Files
Eric ce47cb924a Website: Update contact form for users who visit the page from "Get a demo" buttons (#49929)
Closes:  https://github.com/fleetdm/fleet/issues/47653

Changes:
- Updated the contact page to only display the "Talk to us" form if a
user visits it with a `?talkToUs` query string.
- Updated all "Get a demo" buttons to go to `/contact?talkToUs`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added a dedicated “Talk to us” contact experience.
* Updated “Get a demo,” “Talk to sales,” and “Talk to an engineer” links
across the site to open the appropriate contact form directly.
* **Bug Fixes**
* Improved contact form selection so the requested form displays
consistently across supported pages.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-24 18:27:11 -05:00

79 lines
1.7 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View contact',
description: 'Display "Contact" page.',
inputs: {
sendMessage: {
type: 'boolean',
description: 'A boolean that determines whether or not to display the talk to us form when the contact page loads.',
defaultsTo: false,
},
talkToUs: {
type: 'boolean',
description: 'A boolean that determines whether or not to *only* display the talk to us form when the contact page loads.',
defaultsTo: false,
},
},
exits: {
success: {
viewTemplatePath: 'pages/contact'
},
badConfig: {
responseType: 'badConfig'
},
},
fn: async function ({sendMessage, talkToUs}) {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.openPositions)) {
throw {badConfig: 'builtStaticContent.openPositions'};
}
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;
}
}
let onlyShowTalkToUsForm = false;
if(talkToUs){
onlyShowTalkToUsForm = true;
}
if(sendMessage) {
formToShow = 'contact';
}
let currentOpenPositionsForApplicationDropdown = _.pluck(sails.config.builtStaticContent.openPositions, 'jobTitle');
// Respond with view.
return {
formToShow,
userIsLoggedIn,
userHasPremiumSubscription,
currentOpenPositionsForApplicationDropdown,
onlyShowTalkToUsForm,
};
}
};