Zend certified PHP/Magento developer

Correct way of using ViewModel inside of pagebuilder elements?

I have a ViewModel that returns if a user is logged in or not and we need to add this functionality to vendor/magento/module-page-builder/view/frontend/templates/catalog/product/widget/content/carousel.phtml but we’re unsure on the correct way to do this.

Cheers