fleet/website/api/controllers/articles/view-basic-webinar.js
Eric be14f7c10d
Website: Add webinar article template page. (#43627)
Changes:
- Added support for a new article category: `webinar`.
- Added a template page for webinar articles.
- Added an additional route for webinar articles that users are taken to
to watch the webinar recording.
- Added `deliver-webinar-access-request`, an action that updates CRM
records when users fill out the form on the webinar template page.
- Updated the accepted `intentSignal` values in the
create-historical-event helper.
- Added an article for the "Beyond the hype, practical AI for device
management" webinar.

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

* **New Features**
* Public webinar pages (/webinars/:slug and /watch) with optional
embedded video and a new page template, script, and styles.
* Sidebar signup form (first name, last name, work email) with prefill
for signed-in users and improved scroll behavior.
* POST API to request webinar access: validates email domain, records a
webinar-request event, triggers background CRM sync, and returns a watch
view on success.
* Static-site build now recognizes webinar articles and enforces
embedded-video URL validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot <[email protected]>
2026-04-16 09:14:28 -05:00

66 lines
1.3 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'View basic webinar',
description: 'Display "Basic webinar" page.',
inputs: {
slug: {
type: 'string',
description: 'The slug of the webinar that will be displayed to the user',
required: true,
}
},
exits: {
success: {
viewTemplatePath: 'pages/articles/basic-webinar'
},
badConfig: {
responseType: 'badConfig'
},
notFound: {
responseType: 'notFound'
},
},
fn: async function ({slug}) {
if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.markdownPages) || !sails.config.builtStaticContent.markdownPages) {
throw {badConfig: 'builtStaticContent.markdownPages'};
}
let thisPage = _.find(sails.config.builtStaticContent.markdownPages, { url: '/webinars/'+encodeURIComponent(slug) });
if (!thisPage) {
throw 'notFound';
}
let pageTitleForMeta;
let pageDescriptionForMeta;
if(thisPage.meta.articleTitle) {
pageTitleForMeta = thisPage.meta.articleTitle;
}
if(thisPage.meta.description) {
pageDescriptionForMeta = thisPage.meta.description;
}
// Respond with view.
return {
pageTitleForMeta,
pageDescriptionForMeta,
path: require('path'),
thisPage: thisPage,
};
}
};