<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var \Magento\Paypal\Block\Express\InContext\SmartButton $block
 */
$widget = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonDecode($block->getJsInitParams());
$widgetConfig = $this->helper(\Magento\Framework\Json\Helper\Data::class)->jsonEncode(
  $widget['Magento_Paypal/js/in-context/product-express-checkout']
);
?>
<div data-mage-init='{"Magento_Paypal/js/in-context/product-express-checkout":<?= /* @noEscape */ $widgetConfig ?>}'></div>

<script>
    require([
        'jquery'
    ], function ($) {
        $(function () {
            $('body.catalog-product-view').addClass('paypal-enabled');
        });
    });
</script>
