<?xml version="1.0"?>
<!--
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2022-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
    <!-- Make Hyvä modals globally available on all checkout steps -->
    <update handle="hyva_modal"/>
    <!-- Make Hyvä advanced form validation available on all checkout steps -->
    <update handle="hyva_form_validation"/>

    <body>
        <!-- Use the same spinner as the Theme -->
   	    <referenceBlock
			name="magewire.loader.notifications.messenger.spinner"
			template="Hyva_Checkout::html/loader/spinner.phtml"
		/>
		<referenceBlock
            name="magewire.loader.overlay-spinner"
            template="Hyva_Checkout::html/loader/spinner.phtml"
		/>
		<referenceBlock
			name="magewire.loader.component-overlay-spinner"
			template="Hyva_Checkout::html/loader/spinner.phtml"
		/>

        <referenceContainer name="after.body.start">
            <block name="magewire-form-validation"
                   after="advanced-form-validation"
                   template="Hyva_Checkout::page/js/checkout-form-validation.phtml"
            />

            <block name="magewire-form-telephone-validation"
                   after="advanced-form-validation"
                   template="Hyva_Checkout::page/js/checkout-form-telephone-validation.phtml"
            />

            <block name="additional.input.validation"
                   template="Hyva_Theme::form/js/input-additional-validation.phtml"
                   after="-"/>

            <block name="magewire-form-recaptcha-validation"
                   after="advanced-form-validation"
                   template="Hyva_Checkout::page/js/checkout-form-recaptcha-validation.phtml"
            />

            <block name="magewire-form-postcode-validation"
                   after="advanced-form-validation"
                   ifconfig="hyva_themes_checkout/address_form/postcode/enable_format_validation"
                   template="Hyva_Checkout::page/js/checkout-form-postcode-validation.phtml"
            />
        </referenceContainer>

        <referenceContainer name="magewire.plugin.scripts">
            <block name="hyva-checkout.page.js.magewire.plugin.error"
                   after="magewire.plugin.error"
                   template="Hyva_Checkout::page/js/magewire/plugin/error.phtml"
            />
        </referenceContainer>
    </body>
</page>
