2023-10-20 18:59:18 +00:00
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
friendlyName: 'View fleetctl preview',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
description: 'Display "fleetctl preview" page.',
|
|
|
|
|
|
2024-04-08 10:39:19 +00:00
|
|
|
inputs: {
|
|
|
|
|
start: {
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
description: 'A boolean flag that will hide the "next steps" buttons on the page if set to true',
|
|
|
|
|
defaultsTo: false,
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-10-20 18:59:18 +00:00
|
|
|
|
|
|
|
|
exits: {
|
|
|
|
|
|
|
|
|
|
success: {
|
|
|
|
|
viewTemplatePath: 'pages/fleetctl-preview'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
redirect: {
|
|
|
|
|
description: 'The requesting user is not logged in.',
|
|
|
|
|
responseType: 'redirect'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
2024-04-08 10:39:19 +00:00
|
|
|
fn: async function ({start}) {
|
2023-10-20 18:59:18 +00:00
|
|
|
|
2025-04-21 23:22:49 +00:00
|
|
|
if(!this.req.me) {
|
|
|
|
|
throw {redirect: '/register#tryfleet'};
|
|
|
|
|
}
|
2024-09-12 22:37:48 +00:00
|
|
|
let trialLicenseKey;
|
|
|
|
|
// Check to see if this user has a Fleet premium trial license key.
|
|
|
|
|
let userHasTrialLicense = this.req.me.fleetPremiumTrialLicenseKey;
|
|
|
|
|
let userHasExpiredTrialLicense = false;
|
|
|
|
|
if(userHasTrialLicense) {
|
|
|
|
|
if(this.req.me.fleetPremiumTrialLicenseKeyExpiresAt < Date.now()) {
|
|
|
|
|
userHasExpiredTrialLicense = true;
|
|
|
|
|
}
|
|
|
|
|
trialLicenseKey = this.req.me.fleetPremiumTrialLicenseKey;
|
|
|
|
|
} else {
|
|
|
|
|
trialLicenseKey = '';
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-20 18:59:18 +00:00
|
|
|
// Respond with view.
|
2024-09-12 22:37:48 +00:00
|
|
|
return {
|
|
|
|
|
hideNextStepsButtons: start,
|
|
|
|
|
trialLicenseKey,
|
|
|
|
|
userHasExpiredTrialLicense,
|
|
|
|
|
};
|
2023-10-20 18:59:18 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|