"use strict";

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

var immutable = _interopRequireWildcard(require("immutable"));

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

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

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

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

var _bankEntries = require("../../../banks/api/bankEntries");

var _quizEntries = require("../../../building/api/quizEntries");

var _modal = require("../../../common/actions/modal");

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

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

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

var _featureCheck = require("../../../common/util/featureCheck");

function mapStateToProps(state, props) {
  var bank = new _Bank.default(state.getIn(['banks', props.bankId]));
  var search = state.get('bankSearch', immutable.Map());
  return {
    bank: bank,
    search: search,
    useBankSearch: (0, _featureCheck.featureOn)('item_bank_search'),
    position: state.getIn(['ui', _constants.BUILD_TRAY_POSITION]),
    stimulusId: state.getIn(['ui', _constants.BUILD_TRAY_STIMULUS_ID]),
    activeQuizId: state.getIn(['quizzes', 'activeQuizId'])
  };
}

var mapDispatchToProps = {
  addEntryToQuiz: _quizEntries.createQuizEntry,
  getBank: _banks.getBank,
  getBankEntries: _bankEntries.getBankEntries,
  openModal: _modal.openModal,
  resetSearch: _bankSearch.reset,
  screenreaderNotification: _alerts.screenreaderNotification
};

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

exports.default = _default;