'use strict';

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

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

var _RelatedRecordBrowser = require('../../components/record/RelatedRecordBrowser');

var _RelatedRecordBrowser2 = _interopRequireDefault(_RelatedRecordBrowser);

var _recordBrowser = require('../../actions/recordBrowser');

var _search = require('../../actions/search');

var _reducers = require('../../reducers');

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

const mapStateToProps = (state, ownProps) => {
  const relatedRecordType = ownProps.relatedRecordType;


  return {
    perms: (0, _reducers.getUserPerms)(state),
    preferredRelatedCsid: (0, _reducers.getRelatedRecordBrowserRelatedCsid)(state, relatedRecordType)
  };
};

const mapDispatchToProps = {
  deselectItem: _search.deselectResultItem,
  setPreferredRelatedCsid: _recordBrowser.setRelatedRecordBrowserRelatedCsid
};

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