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

/* @block Codazon\ShoppingCartPro\Block\MiniCart */
?>
<?php
$helper = $this->getHelper();
?>
<?php if ($helper->enableCustomCart()) : ?>
<?php
$style = $helper->getMiniCartStyle();
?>

<?php if ($style === '1') : /* popup */ ?>
    <?php echo $this->setTemplate('cart/popup.phtml')->toHtml(); ?>
<?php elseif ($style === '2') : /* footer cart */ ?>
    <?php echo $this->setTemplate('cart/footer-panel.phtml')->toHtml(); ?>
<?php elseif ($style === '3') : /* footer cart */ ?>
    <?php echo $this->setTemplate('cart/sidebar.phtml')->toHtml(); ?>
<?php elseif ($style === '4') : /* message bubble */ ?>
<script>
require(['jquery', 'Magento_Customer/js/customer-data'], function($, customerData) {
    customerData.get('messages').subscribe(function(msg) {
        var dataPost = $(document).data('mageDataPost');
        if (dataPost) dataPost.updateMessages(msg.messages);
    }, this);
});
</script>
<?php endif ?>
<?php endif ?>