"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _ComponentContainer = _interopRequireDefault(require("../../../../../Framework/ComponentContainer"));
var _Actions = require("../../../../Reducers/UI/Actions");
var configuratorActions = _interopRequireWildcard(require("../../../../Reducers/Configurator/Actions"));
var _ConfigurationvariantSelection = _interopRequireDefault(require("../../Components/ConfigurationvariantSelection"));
var _ConfigurationvariantItem = _interopRequireDefault(require("../../Components/ConfigurationvariantItem"));
var _Carousel = _interopRequireDefault(require("../../../../../Framework/Components/Carousel"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var mapStateToProps = function mapStateToProps(_ref) {
  var ui = _ref.ui,
    configurator = _ref.configurator,
    device = _ref.device;
  return {
    Component: _ConfigurationvariantSelection["default"],
    ItemComponent: _ConfigurationvariantItem["default"],
    Carousel: _Carousel["default"],
    show: !!ui.visibilityMap.configurationVariantSelection,
    configurationvariants: configurator.configurationvariants,
    selectedItem: configurator.configuration.item.identifier,
    screen: device.screen,
    // should re-render when the screen size changes

    showConfigurationVariantSelection: ui.visibilityMap.configurationvariantSelection
  };
};
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    onClose: function onClose() {
      return dispatch((0, _Actions.setVisible)('configurationVariantSelection', false));
    },
    onProceed: function onProceed(itemIdentifier, show) {
      dispatch((0, _Actions.setVisible)('optionlist', false));
      dispatch((0, _Actions.setVisible)('configurationVariantSelection', !show));
      dispatch(configuratorActions.fetchConfiguration(itemIdentifier));
    }
  };
};
var _default = exports["default"] = (0, _ComponentContainer["default"])(mapStateToProps, mapDispatchToProps);