/* Essentials YOOtheme Pro 2.3.4 build 0217.0955; ZOOlanders https://www.zoolanders.com; Copyright (C) Joolanders, SL; http://www.gnu.org/licenses/gpl.html GNU/GPL */

import Vue from 'vue';
import hooks from '@yootheme/hooks';
import BaseFields from '@yootheme/fields';
import essentials from 'yooessentials';
import SourceExtended from './SourceExtended';
import { DynamicModel } from './models';
import { GlobalQueriesSection } from './components';
import * as fields from './fields';

import './hooks';
import './composed/hooks';
import './extend';

Vue.component('yooessentials-global-queries', GlobalQueriesSection);

Object.assign(BaseFields.components, fields);

hooks.after('app.init', () => {
    // override the source query args field (until fixed in core)
    BaseFields.components.FieldSourceQueryArgs = fields.FieldYooessentialsSourceQueryArgs(
        BaseFields.components.FieldSourceQueryArgs
    );
});

hooks.before('app.init', () => {
    essentials.helpers.Source = new SourceExtended();
    essentials.helpers.Dynamic = new Vue(DynamicModel);
});
