const path = require("path");
const { AssetsHelper } = require("./../webpack/webpack-helpers.js");
const theme = new AssetsHelper(path.resolve(__dirname, "./../"));

const components = [
  ...theme.component("img-with-text", "allowed_blocks"), //
  ...theme.component("popular-categories", "allowed_blocks"),
  ...theme.component("featured-product", "allowed_blocks"),
  ...theme.component("slider-gallery", "allowed_blocks"),
  ...theme.component("grid-gallery", "allowed_blocks"),
  ...theme.component("product-slider", "allowed_blocks"),
  ...theme.component("hero", "allowed_blocks"),
  ...theme.component("icon-boxes", "allowed_blocks"),
  ...theme.component("cta-grid", "allowed_blocks"),
  ...theme.component("block-filter", "allowed_blocks"),
  ...theme.component("navigation", "allowed_blocks"),
  ...theme.component("contact-section", "allowed_blocks"),
  ...theme.component("contact-boxes", "allowed_blocks"),
  ...theme.component("posts-selection", "allowed_blocks"),
  ...theme.component("spacer", "allowed_blocks"),
  ...theme.component("video-section", "allowed_blocks"),
  ...theme.component("video-slider", "allowed_blocks"),
  ...theme.component("buttons", "allowed_blocks"),
  ...theme.component("testimonials", "allowed_blocks"),
  ...theme.component("notice", "allowed_blocks"),
  ...theme.component("partners", "allowed_blocks"),
  ...theme.component("video", "allowed_blocks"),
  ...theme.component("tabs", "allowed_blocks"),
  ...theme.component("cta-box", "allowed_blocks"),
  ...theme.component("downloads", "allowed_blocks"),
  ...theme.component("quotes", "allowed_blocks"),
  ...theme.component("side-graphics", "allowed_blocks"),
  ...theme.component("newsletter", "allowed_blocks"),
  ...theme.component("hero-slider", "allowed_blocks"),
  ...theme.component("references", "allowed_blocks"),
  ...theme.component("statistics", "allowed_blocks"),
  ...theme.component("faq", "allowed_blocks"),
  ...theme.component("pricelist", "allowed_blocks"),
  ...theme.component("timeline", "allowed_blocks"),
  ...theme.component("carousel-boxes", "allowed_blocks"),
  ...theme.component("numeric-list", "allowed_blocks"),
  ...theme.component("separator-text", "allowed_blocks"),
  ...theme.component("counter", "allowed_blocks"),
  ...theme.component("posts-slider", (cfg) => {
    // post-slider sa generuje pre kazdy post type
    // preto je potrebne ci je povoleny nejaky post-slider manualne
    return (
      cfg.allowed_blocks == null ||
      cfg.allowed_blocks.some((b) =>
        b.startsWith("meta-box/inoby-posts-slider-")
      )
    );
  }),
  ...theme.component("contact-form-select", "allowed_blocks"),
  ...theme.component("calendar", "allowed_blocks"),
];

module.exports = components;
