import { omit } from 'lodash';
import { addAction } from '@wordpress/hooks';
import { registerModule } from '@divi/module-library';
import { dynamicField } from './components/dynamic-field';
import { dynamicImage } from './components/dynamic-image';
import { dynamicRepeater } from './components/dynamic-repeater';
import { dynamicMeta } from './components/dynamic-meta';
import { dynamicLink } from './components/dynamic-link';
import { dynamicTerms } from './components/dynamic-terms';
import { listingGrid } from './components/listing-grid';
import { listingCalendar } from './components/listing-calendar';
import { mapsListing } from './components/maps-listing';
import './module-icons';

// Register modules.
addAction('divi.moduleLibrary.registerModuleLibraryStore.after', 'jetEngineDiviViewsJE', () => {
	registerModule( dynamicField.metadata, omit( dynamicField, 'metadata' ) );
	registerModule( dynamicImage.metadata, omit( dynamicImage, 'metadata' ) );
	registerModule( dynamicRepeater.metadata, omit( dynamicRepeater, 'metadata' ) );
	registerModule( dynamicMeta.metadata, omit( dynamicMeta, 'metadata' ) );
	registerModule( dynamicLink.metadata, omit( dynamicLink, 'metadata' ) );
	registerModule( dynamicTerms.metadata, omit( dynamicTerms, 'metadata' ) );
	registerModule( listingGrid.metadata, omit( listingGrid, 'metadata' ) );
	registerModule( listingCalendar.metadata, omit( listingCalendar, 'metadata' ) );
	registerModule( mapsListing.metadata, omit( mapsListing, 'metadata' ) );
});
