'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _redux = require('redux');

var _immutable = require('immutable');

var _reactRedux = require('../../react-redux');

var _modal = require('../../actions/modal');

var _presenter = require('./presenter');

var _presenter2 = _interopRequireDefault(_presenter);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var mapStateToProps = function mapStateToProps(state) {
  var modal = state.get('modal');

  return {
    modalOpen: !!modal.get('isOpen') && modal.get('isOpen') === modal.getIn(['options', 'title']),
    modalOptions: modal.get('options') || (0, _immutable.Map)()
  };
};

var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    closeModal: (0, _redux.bindActionCreators)(_modal.closeModal, dispatch)
  };
};

exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter2.default);