<?xml version="1.0"?>
<!--
    Módulo compat Hyvä de Magezon_PopupBuilder: en temas Hyvä, las plantillas de
    view/frontend/templates de este módulo sustituyen a las de Magezon_PopupBuilder
    (Magezon_PopupBuilder::popup.phtml → este módulo, mismo path). En Luma no se aplica.
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Hyva\CompatModuleFallback\Model\CompatModuleRegistry">
        <arguments>
            <argument name="compatModules" xsi:type="array">
                <item name="yeboyebo-magezon-popupbuilder-hyva" xsi:type="array">
                    <item name="original_module" xsi:type="string">Magezon_PopupBuilder</item>
                    <item name="compat_module" xsi:type="string">Yeboyebo_MagezonPopupBuilderHyva</item>
                </item>
            </argument>
        </arguments>
    </type>
    <type name="Magezon\PopupBuilder\Controller\Popup\Report">
        <plugin name="yeboyebo_popupbuilder_report_type_filter"
                type="Yeboyebo\MagezonPopupBuilderHyva\Plugin\ReportTypeFilter"/>
    </type>

    <!-- Login de los popups y de las páginas cliente-vip: el tipo del widget de la PWA (la clase
         ya no existe) pinta el formulario de Hyvä; también hay que declararlo en etc/widget.xml. -->
    <preference for="Yeboyebo\ScandiPWA\Block\Widget\LogIn"
                type="Yeboyebo\MagezonPopupBuilderHyva\Block\Widget\LoginForm"/>
    <type name="Magento\Customer\Controller\Ajax\Login">
        <plugin name="yeboyebo_popupbuilder_ajax_login_regenerate_session"
                type="Yeboyebo\MagezonPopupBuilderHyva\Plugin\AjaxLoginRegenerateSession"/>
    </type>
</config>
