<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2022 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

?>
<div id="iframe-warning" class="warning-message">
    <?= $this->__('Please do not refresh the page until you complete payment.') ?>
</div>
<iframe id="hss-iframe" style="display:none;" scrolling="no" frameborder="0" border="0" src="<?= $this->getFrameActionUrl() ?>" height="610" width="100%"></iframe>
<script type="text/javascript">
    const headers = document.querySelectorAll('#' + checkout.accordion.container.getAttribute('id') + ' .section');
    headers.forEach(header => {
        header.classList.remove('allow');
    });

    document.getElementById('hss-iframe').addEventListener('load', function() {
        document.getElementById('hss-iframe').style.display = 'block';
        document.getElementById('iframe-warning').style.display = 'block';
        checkout.loadWaiting = 'review';
        checkout.setLoadWaiting(false);
        if (checkout.accordion.currentSection == 'opc-review') {
            document.getElementById('checkout-review-submit').style.display = 'none';
        }
    });
</script>
