"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _immutable = require("immutable");

var _presenter = _interopRequireDefault(require("./presenter"));

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

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

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

var _constants = require("@instructure/quiz-common/lib/constants");

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 = {
  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);
  },
  setFilter: _bankSearch.setFilter,
  update: _bankSearch.update
};

var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_presenter.default);

exports.default = _default;