'use strict';

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

var _redux = require('redux');

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

var _presenter2 = _interopRequireDefault(_presenter);

var _taking = require('../../../../../taking/api/taking');

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

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

var _calculator = require('../../../../../common/selectors/calculator');

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

var _stateHelper = require('../../../../util/stateHelper');

var _stateHelper2 = _interopRequireDefault(_stateHelper);

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

var mapStateToProps = function mapStateToProps(state) {
  return {
    activeCalculatorId: (0, _ui.getActiveCalculatorId)(state),
    calculatorType: (0, _calculator.hasVisibleQuestionCalculator)(state) ? 'none' : _stateHelper2.default.calculatorType(),
    quizSessionId: _stateHelper2.default.activeQuizSessionId()
  };
};

var mapDispatchToProps = exports.mapDispatchToProps = function mapDispatchToProps(dispatch) {
  return {
    authenticateLearnosity: _taking.authenticateLearnosity,
    setActiveCalculatorId: (0, _redux.bindActionCreators)(_ui2.setActiveCalculatorId, dispatch)
  };
};

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