2021-04-01 00:24:42 +00:00
module . exports = {
friendlyName : 'View pricing' ,
description : 'Display "Pricing" page.' ,
exits : {
success : {
viewTemplatePath : 'pages/pricing'
2022-12-05 20:11:46 +00:00
} ,
badConfig : {
responseType : 'badConfig'
} ,
2021-04-01 00:24:42 +00:00
} ,
fn : async function ( ) {
2022-12-05 20:11:46 +00:00
if ( ! _ . isObject ( sails . config . builtStaticContent ) || ! _ . isArray ( sails . config . builtStaticContent . pricingTable ) ) {
throw { badConfig : 'builtStaticContent.pricingTable' } ;
}
let pricingTable = sails . config . builtStaticContent . pricingTable ;
2023-06-09 21:52:39 +00:00
// Create a filtered version of the pricing table array that does not have the "Device management" category that will be used for the security-focused pricing table.
let pricingTableForSecurity = pricingTable . filter ( ( category ) => {
return category . categoryName !== 'Device management' ;
} ) ;
// Create an array used to sort the pricing table for secuirty focused buyers
// To change the order of the pricing table for the security focused buyers, rearrange the values in the array below.
// Note: The category names must match existing categories in the pricing-features-table.yml file.
let categoryOrderForSecurityPricingTable = [
'Security and compliance' ,
'Monitoring' ,
'Inventory management' ,
'Collaboration' ,
'Support' ,
'Data outputs' ,
'Deployment'
] ;
// Sort the security-focused pricing table from the order of the elements in the categoryOrderForSecurityPricingTable array.
pricingTableForSecurity . sort ( ( a , b ) => {
// If there is a category that is not in the list above, sort it to the end of the list.
if ( categoryOrderForSecurityPricingTable . indexOf ( a . categoryName ) === - 1 ) {
return 1 ;
} else if ( categoryOrderForSecurityPricingTable . indexOf ( b . categoryName ) === - 1 ) {
return - 1 ;
}
return categoryOrderForSecurityPricingTable . indexOf ( a . categoryName ) - categoryOrderForSecurityPricingTable . indexOf ( b . categoryName ) ;
} ) ;
2021-04-01 00:24:42 +00:00
// Respond with view.
2023-06-09 21:52:39 +00:00
return {
pricingTable ,
pricingTableForSecurity ,
} ;
2021-04-01 00:24:42 +00:00
}
} ;