import { omit } from 'lodash';
import { addAction } from '@wordpress/hooks';
import { registerModule } from '@divi/module-library';
import './module-icons';
import { selectFilter } from './components/select-filter';
import { checkboxesFilter } from './components/checkboxes-filter';
import { rangeFilter } from './components/range-filter';
import { checkRangeFilter } from './components/check-range-filter';
import { radioFilter } from './components/radio-filter';
import { dateRangeFilter } from './components/date-range-filter';
import { datePeriodFilter } from "./components/date-period-filter";
import { ratingFilter } from "./components/rating-filter";
import { activeFilters } from "./components/active-filters";
import { activeTags } from "./components/active-tags";
import { alphabet } from "./components/alphabet";
import { applyButton } from "./components/apply-button";
import { colorImage } from "./components/color-image";
import { pagination } from "./components/pagination";
import { removeFilters } from "./components/remove-filters";
import { search } from "./components/search";
import { sorting } from "./components/sorting";
import { hidden } from "./components/hidden";

// Register modules.
addAction('divi.moduleLibrary.registerModuleLibraryStore.after', 'jetEngineDiviViewsJSF', () => {
	registerModule(selectFilter.metadata, omit(selectFilter, 'metadata'));
	registerModule(checkboxesFilter.metadata, omit(checkboxesFilter, 'metadata'));
	registerModule(rangeFilter.metadata, omit(rangeFilter, 'metadata'));
	registerModule(checkRangeFilter.metadata, omit(checkRangeFilter, 'metadata'));
	registerModule(radioFilter.metadata, omit(radioFilter, 'metadata'));
	registerModule(dateRangeFilter.metadata, omit(dateRangeFilter, 'metadata'));
	registerModule(datePeriodFilter.metadata, omit(datePeriodFilter, 'metadata'));
	registerModule(ratingFilter.metadata, omit(ratingFilter, 'metadata'));
	registerModule(activeFilters.metadata, omit(activeFilters, 'metadata'));
	registerModule(activeTags.metadata, omit(activeTags, 'metadata'));
	registerModule(alphabet.metadata, omit(alphabet, 'metadata'));
	registerModule(applyButton.metadata, omit(applyButton, 'metadata'));
	registerModule(colorImage.metadata, omit(colorImage, 'metadata'));
	registerModule(pagination.metadata, omit(pagination, 'metadata'));
	registerModule(removeFilters.metadata, omit(removeFilters, 'metadata'));
	registerModule(search.metadata, omit(search, 'metadata'));
	registerModule(sorting.metadata, omit(sorting, 'metadata'));
	registerModule(hidden.metadata, omit(hidden, 'metadata'));
});
