2023-02-13 23:06:02 +00:00
module . exports = {
2023-12-14 23:06:31 +00:00
friendlyName : 'View endpoint ops' ,
2023-02-13 23:06:02 +00:00
2023-12-14 23:06:31 +00:00
description : 'Display "Endpoint ops" page.' ,
2023-02-13 23:06:02 +00:00
exits : {
success : {
2023-12-14 23:06:31 +00:00
viewTemplatePath : 'pages/endpoint-ops'
2023-12-18 21:09:58 +00:00
} ,
badConfig : { responseType : 'badConfig' } ,
2023-02-13 23:06:02 +00:00
} ,
fn : async function ( ) {
2023-12-18 21:09:58 +00:00
if ( ! _ . isObject ( sails . config . builtStaticContent ) || ! _ . isArray ( sails . config . builtStaticContent . testimonials ) || ! sails . config . builtStaticContent . compiledPagePartialsAppPath ) {
throw { badConfig : 'builtStaticContent.testimonials' } ;
}
// Get testimonials for the <scrolalble-tweets> component.
2024-01-13 01:22:36 +00:00
let testimonialsForScrollableTweets = _ . clone ( sails . config . builtStaticContent . testimonials ) ;
2024-08-30 18:18:47 +00:00
// Default the pagePersonalization to the user's primaryBuyingSituation.
let pagePersonalization = this . req . session . primaryBuyingSituation ;
2024-09-10 19:36:01 +00:00
// If a purpose query parameter is set, update the pagePersonalization value.
2024-08-30 18:18:47 +00:00
// Note: This is the only page we're using this method instead of using the primaryBuyingSiutation value set in the users session.
// This lets us link to the security and IT versions of the endpoint ops page from the unpersonalized homepage without changing the users primaryBuyingSituation.
2024-09-10 19:36:01 +00:00
if ( this . req . param ( 'purpose' ) === 'it' ) {
2024-08-30 18:18:47 +00:00
pagePersonalization = 'eo-it' ;
2024-09-10 19:36:01 +00:00
} else if ( this . req . param ( 'purpose' ) === 'security' ) {
2024-08-30 18:18:47 +00:00
pagePersonalization = 'eo-security' ;
}
2024-01-13 01:22:36 +00:00
2024-04-24 22:47:35 +00:00
// Specify an order for the testimonials on this page using the last names of quote authors
2024-08-30 21:54:08 +00:00
let testimonialOrderForThisPage = [ 'Charles Zaffery' , 'Dan Grzelak' , 'Nico Waisman' , 'Tom Larkin' , 'Austin Anderson' , 'Erik Gomez' , 'Nick Fohs' , 'Brendan Shaklovitz' , 'Mike Arpaia' , 'Andre Shields' , 'Dhruv Majumdar' , 'Ahmed Elshaer' , 'Abubakar Yousafzai' , 'Wes Whetstone' , 'Kenny Botelho' , 'Chandra Majumdar' , 'Eric Tan' , 'Alvaro Gutierrez' , 'Joe Pistone' ] ;
2024-08-30 18:18:47 +00:00
if ( [ 'eo-it' , 'mdm' ] . includes ( pagePersonalization ) ) {
2024-08-30 21:54:08 +00:00
testimonialOrderForThisPage = [ 'Eric Tan' , 'Erik Gomez' , 'Tom Larkin' , 'Nick Fohs' , 'Wes Whetstone' , 'Mike Arpaia' , 'Kenny Botelho' , 'Alvaro Gutierrez' ] ;
2024-08-30 18:18:47 +00:00
} else if ( [ 'eo-security' , 'vm' ] . includes ( pagePersonalization ) ) {
2024-07-18 19:41:54 +00:00
testimonialOrderForThisPage = [ 'Nico Waisman' , 'Charles Zaffery' , 'Abubakar Yousafzai' , 'Eric Tan' , 'Mike Arpaia' , 'Chandra Majumdar' , 'Ahmed Elshaer' , 'Brendan Shaklovitz' , 'Austin Anderson' , 'Dan Grzelak' , 'Dhruv Majumdar' , 'Alvaro Gutierrez' , 'Joe Pistone' ] ;
2024-04-24 22:47:35 +00:00
}
// Filter the testimonials by product category and the filtered list we built above.
2024-01-13 01:22:36 +00:00
testimonialsForScrollableTweets = _ . filter ( testimonialsForScrollableTweets , ( testimonial ) => {
2024-04-24 22:47:35 +00:00
return _ . contains ( testimonial . productCategories , 'Endpoint operations' ) && _ . contains ( testimonialOrderForThisPage , testimonial . quoteAuthorName ) ;
2024-01-13 01:22:36 +00:00
} ) ;
testimonialsForScrollableTweets . sort ( ( a , b ) => {
2024-02-12 22:40:56 +00:00
if ( testimonialOrderForThisPage . indexOf ( a . quoteAuthorName ) === - 1 ) {
2024-01-13 01:22:36 +00:00
return 1 ;
2024-02-12 22:40:56 +00:00
} else if ( testimonialOrderForThisPage . indexOf ( b . quoteAuthorName ) === - 1 ) {
2024-01-13 01:22:36 +00:00
return - 1 ;
}
2024-02-12 22:40:56 +00:00
return testimonialOrderForThisPage . indexOf ( a . quoteAuthorName ) - testimonialOrderForThisPage . indexOf ( b . quoteAuthorName ) ;
2024-01-13 01:22:36 +00:00
} ) ;
2023-02-13 23:06:02 +00:00
// Respond with view.
2023-12-18 21:09:58 +00:00
return {
testimonialsForScrollableTweets ,
2024-08-30 18:18:47 +00:00
pagePersonalization ,
2023-12-18 21:09:58 +00:00
} ;
2023-02-13 23:06:02 +00:00
}
} ;