fleet/website/assets/js/pages/articles/basic-webinar.page.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

76 lines
3 KiB
JavaScript
Vendored

parasails.registerPage('basic-webinar', {
// ╦╔╗╔╦╔╦╗╦╔═╗╦ ╔═╗╔╦╗╔═╗╔╦╗╔═╗
// ║║║║║ ║ ║╠═╣║ ╚═╗ ║ ╠═╣ ║ ║╣
// ╩╝╚╝╩ ╩ ╩╩ ╩╩═╝ ╚═╝ ╩ ╩ ╩ ╩ ╚═╝
data: {
formData: {
emailAddress: undefined,
firstName: undefined,
lastName: undefined,
},
formRules: {
emailAddress: {isEmail: true, required: true},
firstName: {required: true},
lastName: {required: true},
},
formDataToPrefillForLoggedInUsers: {},
formErrors: {},
syncing: false,
cloudError: '',
cloudSuccess: '',
scrollDistance: undefined,
},
// ╦ ╦╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╔═╗
// ║ ║╠╣ ║╣ ║ ╚╦╝║ ║ ║╣
// ╩═╝╩╚ ╚═╝╚═╝ ╩ ╚═╝╩═╝╚═╝
beforeMount: function() {
if(this.me){// prefill from database
this.formDataToPrefillForLoggedInUsers.emailAddress = this.me.emailAddress;
this.formDataToPrefillForLoggedInUsers.firstName = this.me.firstName;
this.formDataToPrefillForLoggedInUsers.lastName = this.me.lastName;
this.formData = _.clone(this.formDataToPrefillForLoggedInUsers);
}
},
mounted: async function() {
this.formData.webinarName = this.thisPage.meta.articleTitle;
// Add an event listener to add a class to the right sidebar when the header is hidden.
window.addEventListener('scroll', this.handleScrollingInArticle);
},
// ╦╔╗╔╔╦╗╔═╗╦═╗╔═╗╔═╗╔╦╗╦╔═╗╔╗╔╔═╗
// ║║║║ ║ ║╣ ╠╦╝╠═╣║ ║ ║║ ║║║║╚═╗
// ╩╝╚╝ ╩ ╚═╝╩╚═╩ ╩╚═╝ ╩ ╩╚═╝╝╚╝╚═╝
methods: {
submittedDownloadForm: async function () {
if(typeof qualified !== 'undefined') {
qualified('saveFormData',
{
email: this.formData.emailAddress,
name: this.formData.firstName+' '+this.formData.lastName,
});
qualified('showFormExperience', 'experience-1772126772950');
}
this.syncing = true;
this.goto(this.thisPage.url+'/watch');
},
handleScrollingInArticle: function () {
let rightNavBar = document.querySelector('div[purpose="right-sidebar"]');
let scrollTop = window.pageYOffset;
let windowHeight = window.innerHeight;
// Add/remove the 'header-hidden' class to the right sidebar to scroll it upwards with the website's header.
if (rightNavBar) {
if (scrollTop > this.scrollDistance && scrollTop > windowHeight * 1.5) {
rightNavBar.classList.add('header-hidden');
this.lastScrollTop = scrollTop;
} else if(scrollTop < this.lastScrollTop - 60) {
rightNavBar.classList.remove('header-hidden');
this.lastScrollTop = scrollTop;
}
}
this.scrollDistance = scrollTop;
},
}
});