"use strict";

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

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

var _immutable = require("immutable");

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

var _banks = require("../../../../banks/api/banks");

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

var _Bank = _interopRequireDefault(require("../../../records/Bank"));

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

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

function mapStateToProps(state, props) {
  var banks = state.getIn(['ui', _constants.SELECT_BANKS_OPTIONS], (0, _immutable.List)()).map(function (bankId) {
    return new _Bank.default(state.getIn(['banks', bankId]));
  });
  return {
    banks: banks
  };
}

var _default = (0, _reactRedux.connect)(mapStateToProps, {
  getAllBanks: _banks.getAllBanks,
  setUi: _ui.set
})(_presenter.default);

exports.default = _default;