fleet/website/api/controllers/view-start.js
Eric a0d1172f89
Website Update /start signup flow. (#18027)
Closes: #17958

Changes:
- Updated the primary and secondary CTAs site-wide
- Updated the /start page to have a multi-stage form that users can fill
out to personalize their onboarding experience
- Updated the signup action to not set a `primaryBuyingSituation` on new
user records (This will now be set when users progress through the
/start form)
- Added two new attributes to the `User` model:
`currentGetStartedQuestionnarieStep` and
`getStartedQuestionnarieAnswers` that save user's progress in the /start
form.


Before this PR can be merged we will need to:
- [x] Update the Zapier webhook that runs when new users sign up to no
longer expect a `primaryBuyingSituation` value
- [ ] Update the User table in the website's database
- [ ] Migrate the existing user records
2024-04-04 11:13:53 -05:00

33 lines
638 B
JavaScript
Vendored

module.exports = {
friendlyName: 'View start',
description: 'Display "Start" page.',
exits: {
success: {
viewTemplatePath: 'pages/start'
}
},
fn: async function () {
if(this.req.me.lastSubmittedGetStartedQuestionnaireStep && !_.isEmpty(this.req.me.getStartedQuestionnaireAnswers)){
let currentStep = this.req.me.lastSubmittedGetStartedQuestionnaireStep;
let previouslyAnsweredQuestions = this.req.me.getStartedQuestionnaireAnswers;
// Respond with view.
return {currentStep, previouslyAnsweredQuestions};
} else {
// Respond with view.
return;
}
}
};