"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _ComponentContainer = require("../../../../../Framework/ComponentContainer");
var _Actions = require("../../../../Reducers/Configurator/Actions");
var _Actions2 = require("../../../../Reducers/UI/Actions");
var _OptionsList = _interopRequireDefault(require("../../Components/OptionsList"));
var _configuration = require("../../../../configuration");
var _ServiceLocator = require("../../../../ServiceLocator");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var mapStateToProps = function mapStateToProps(_ref) {
  var ui = _ref.ui,
    configurator = _ref.configurator,
    api = _ref.api;
  var showDialog = !!ui.visibilityMap.incompatibility || !!ui.visibilityMap.optionDetails;
  return {
    Component: _OptionsList["default"],
    isLoading: api.isFetching && !showDialog,
    optionclassification: ui.visibilityMap.optionlist ? configurator.selectedoptionclassification : {},
    options: configurator.options,
    show: !!ui.visibilityMap.optionlist,
    isAdminMode: !!(0, _configuration.getConf)('adminMode')
  };
};
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    viewStockInformation: function viewStockInformation(option) {
      dispatch((0, _Actions.setStockInformationOption)(option));
      dispatch((0, _Actions2.setVisible)('stockInformation', true));
    },
    onClose: function onClose() {
      return dispatch((0, _Actions2.setVisible)('optionlist', false));
    },
    setOptionInputText: function setOptionInputText(identifier, value) {
      return _ServiceLocator.Services.configurator.setOptionInputText(identifier, value);
    }
  };
};
var _default = exports["default"] = (0, _ComponentContainer.containerConnect)(mapStateToProps, mapDispatchToProps);