"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.CarouselItems = void 0;

var _react = _interopRequireDefault(require("react"));

var _lib = require("@sentecacommerce-theme/lib");

var _Common = require("../../Common");

var _2 = require("../../");

var placeholderItems = Array(10).fill(null).map(function (_, i) {
  return {
    id: i,
    isPlaceholder: true
  };
});

var CarouselItems = function CarouselItems(props) {
  var header = props.header,
      withArrows = props.withArrows,
      small = props.small,
      skus = props.skus,
      withScrollBar = props.withScrollBar;

  var _useCatalogFilter = (0, _lib.useCatalogFilter)({
    filter: "sku;in;\"" + (skus == null ? void 0 : skus.join('","')) + "\""
  }),
      catalogData = _useCatalogFilter.data;

  return /*#__PURE__*/_react["default"].createElement(_Common.CarouselComponent, {
    slides: (catalogData == null ? void 0 : catalogData.results) || placeholderItems,
    header: header,
    withArrows: withArrows,
    withScrollBar: withScrollBar,
    small: small,
    renderSlide: function renderSlide(item) {
      return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, item.isPlaceholder ? /*#__PURE__*/_react["default"].createElement(_2.LineItemPlaceholder, null) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_2.LineItem, {
        data: item,
        hideVariants: true,
        carousel: true
      })));
    }
  });
};

exports.CarouselItems = CarouselItems;
//# sourceMappingURL=index.js.map