'use strict';

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

var _immutable = require('immutable');

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

var _presenter2 = _interopRequireDefault(_presenter);

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

var _alerts = require('../../../common/actions/alerts');

var _bankSearch = require('../../../common/actions/bankSearch');

var _ui = require('../../../common/actions/ui');

var _constants = require('../../../constants');

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

function mapStateToProps(state, props) {
  var searching = state.getIn(['ui', 'searching'], false);
  var search = state.get('bankSearch', (0, _immutable.Map)());
  var showFilters = state.getIn(['ui', _constants.BANKS_SEARCH_FILTER_KEY]);
  var allInteractions = state.getIn(['ui', _constants.BANKS_TOGGLE_INTERACTIONS_KEY]);

  return { allInteractions: allInteractions, searching: searching, search: search, showFilters: showFilters };
}

var mapDispatchToProps = {
  screenreaderNotification: _alerts.screenreaderNotification,
  toggle: _bankSearch.toggle,
  toggleFilters: function toggleFilters() {
    return (0, _ui.toggle)(_constants.BANKS_SEARCH_FILTER_KEY);
  },
  toggleAllInteractions: function toggleAllInteractions() {
    return (0, _ui.toggle)(_constants.BANKS_TOGGLE_INTERACTIONS_KEY);
  },
  update: _bankSearch.update
};

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