Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-tracker/etc/di.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0"?>
<!--
/**
 * Smile_ElasticsuiteCore dependency injection configuration.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteTracker
 * @author    Aurelien FOUCRET <aurelien.foucret@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
 -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <preference for="Smile\ElasticsuiteTracker\Api\EventQueueInterface" type="Smile\ElasticsuiteTracker\Model\EventQueue" />
    <preference for="Smile\ElasticsuiteTracker\Api\EventIndexInterface" type="Smile\ElasticsuiteTracker\Model\EventIndex" />
    <preference for="Smile\ElasticsuiteTracker\Api\SessionIndexInterface" type="Smile\ElasticsuiteTracker\Model\SessionIndex" />
    <preference for="Smile\ElasticsuiteTracker\Api\CustomerTrackingServiceInterface" type="Smile\ElasticsuiteTracker\Model\Customer\TrackingService" />

    <type name="Smile\ElasticsuiteTracker\Model\EventQueue">
        <arguments>
            <argument name="eventProcessors" xsi:type="array">
                <item name="orderItems" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Processor\OrderItems</item>
                <item name="productListFilters" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Processor\ProductListFilters</item>
                <item name="searches" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Processor\Search</item>
                <item name="mapPageIdentifier" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Processor\MapPageIdentifier</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Quote\Model\Quote">
      <plugin name="trackAddedProduct" type="Smile\ElasticsuiteTracker\Plugin\QuotePlugin" sortOrder="1" />
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\Event\Mapping\TypeEnforcerCollector">
        <arguments>
            <argument name="factories" xsi:type="array">
                <item name="integer" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Mapping\TypeEnforcer\IntegerFactory</item>
                <item name="double" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Mapping\TypeEnforcer\DoubleFactory</item>
                <item name="boolean" xsi:type="object">Smile\ElasticsuiteTracker\Model\Event\Mapping\TypeEnforcer\BooleanFactory</item>
            </argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\EventIndex">
        <arguments>
            <argument name="indexOperation" xsi:type="object">Smile\ElasticsuiteCore\Api\Index\AsyncIndexOperationInterface</argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\SessionIndex">
        <arguments>
            <argument name="indexOperation" xsi:type="object">Smile\ElasticsuiteCore\Api\Index\AsyncIndexOperationInterface</argument>
        </arguments>
    </type>
    <!-- Session proxies -->
    <type name="Smile\ElasticsuiteTracker\Model\CustomerDataTrackingManager">
        <arguments>
            <argument name="customerSession" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument>
        </arguments>
    </type>
    <type name="Smile\ElasticsuiteTracker\Model\Customer\TrackingService">
        <arguments>
            <argument name="customerSession" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument>
        </arguments>
    </type>
    <type name="Smile\ElasticsuiteTracker\Block\Variables\Page\Order">
        <arguments>
            <argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument>
        </arguments>
    </type>

    <type name="Magento\Framework\Console\CommandList">
        <arguments>
            <argument name="commands" xsi:type="array">
                <item name="elasticsuiteTrackerCheckIndexedData" xsi:type="object">Smile\ElasticsuiteTracker\Console\CheckData</item>
                <item name="elasticsuiteTrackerFixIndexedData" xsi:type="object">Smile\ElasticsuiteTracker\Console\FixData</item>
            </argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Console\CheckData">
        <arguments>
            <argument name="checker" xsi:type="object">Smile\ElasticsuiteTracker\Model\Data\Checker\Proxy</argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Console\FixData">
        <arguments>
            <argument name="checker" xsi:type="object">Smile\ElasticsuiteTracker\Model\Data\Checker\Proxy</argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\Data\Checker">
        <arguments>
            <argument name="checkers" xsi:type="array">
                <item name="undefinedSessionIdInEvents" xsi:type="object">Smile\ElasticsuiteTracker\Model\Data\Checker\Event\UndefinedSessionId</item>
                <item name="undefinedSessionIdInSessions" xsi:type="object">Smile\ElasticsuiteTracker\Model\Data\Checker\Session\UndefinedSessionId</item>
            </argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\Data\Checker\Event\UndefinedSessionId">
        <arguments>
            <argument name="dataFixer" xsi:type="object">\Smile\ElasticsuiteTracker\Model\Data\Fixer\Event\DeleteUndefinedSessionId</argument>
        </arguments>
    </type>

    <type name="Smile\ElasticsuiteTracker\Model\Data\Checker\Session\UndefinedSessionId">
        <arguments>
            <argument name="dataFixer" xsi:type="object">Smile\ElasticsuiteTracker\Model\Data\Fixer\Session\DeleteUndefinedSessionId</argument>
        </arguments>
    </type>

    <!-- Prevent session start for tracking urls -->
    <type name="Magento\Framework\Session\SessionStartChecker">
        <plugin name="elasticsuite_tracker_disable_session" type="Smile\ElasticsuiteTracker\Plugin\SessionStartCheckerPlugin"/>
    </type>

</config>