"use strict";

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

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

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

var _redux = require("redux");

var _partial = _interopRequireDefault(require("lodash/partial"));

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

var _stateHelper = _interopRequireDefault(require("../../../../../common/util/stateHelper"));

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

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

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

var _ImportModal = require("../../../../../common/components/ImportModal");

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

function mapStateToProps(state, props) {
  return {
    canImport: _stateHelper.default.activeQuiz().canImport()
  };
}

var mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    openBanksTray: (0, _redux.bindActionCreators)(_ui.set.bind(void 0, _constants.BUILD_TRAY_OPEN, true), dispatch),
    setBanksTrayButtonRef: (0, _redux.bindActionCreators)((0, _partial.default)(_ui.set, _constants.BUILD_TRAY_BUTTON_REF), dispatch),
    openModal: (0, _redux.bindActionCreators)(modalActions.openModal.bind(modalActions, (0, _ImportModal.generateImportModalId)('qtiImport')), dispatch)
  };
};

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

exports.default = _default;