import { initInstafeed } from '@assets/js/wpj.instafeed-init.js';
initInstafeed('wpjcz', 4);

if ($('#cart-products').length) {
   import('@assets/js/wpj.carousel.js').then(wpjCarousel => {
      $('#cart-products').wpjCarousel({
         itemsOnPage: 1.2,
         gutter: 10,
         controlsText: ['<i class="fc icons_arrow-left"></i>', '<i class="fc icons_arrow-right"></i>'],
         responsive: {
            420: {
               itemsOnPage: 1.8,
               gutter: 10
            },
            544: {
               itemsOnPage: 2.2,
               gutter: 10
            },
            768: {
               itemsOnPage: 2.6,
               gutter: 10
            },
            992: {
               itemsOnPage: 3,
               gutter: 10
            },
            1260: {
               itemsOnPage: 4,
               gutter: 10
            },
            1420: {
               itemsOnPage: 5,
               gutter: 10
            }
         }
      });
   });
}

const $body = $('body');
$body.on('click', '[data-resp-summary-toggle]', function(e) {
   e.preventDefault();
   $(this).toggleClass('active');
   $('[data-resp-summary-toggle-content]').toggleClass('active');
});

// added-to-cart v košíku u souvisejích
$body.on('added-to-cart-success', function(e) {
   $('#cart').data("wpjCart").reloadCart();
});
