<?php
/**
 * BSS Commerce Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://bsscommerce.com/Bss-Commerce-License.txt
 *
 * @category  BSS
 * @package   Bss_AjaxCart
 * @author    Extension Team
 * @copyright Copyright (c) 2022 BSS Commerce Co. ( http://bsscommerce.com )
 * @license   http://bsscommerce.com/Bss-Commerce-License.txt
 */

declare(strict_types=1);

use Magento\Catalog\Block\Product\View\Type\Simple;
use Magento\Framework\Escaper;

/** @var Simple $block */
/** @var Escaper $escaper */

$product = $block->getProduct();
?>
<script>
    function initAjaxGoto() {
        return {
            url: "<?= $escaper->escapeJs($product->getUrlModel()->getUrl($product))?>",
            getUrlGoto() {
                window.top.location.href = this.url;
            }
        }
    }
</script>
<div id="ajax-goto" x-data="initAjaxGoto()">
    <a class="text-[#1857f7] hover:underline"
       @click="getUrlGoto()"
       :href="url">
        <span>
            <?php echo $block->escapeHtml(__('Go to Product')); ?>
        </span>
    </a>
</div>
