'use strict';

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

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

var _qs = require('qs');

var _qs2 = _interopRequireDefault(_qs);

var _ReportViewerPage = require('../../components/pages/ReportViewerPage');

var _ReportViewerPage2 = _interopRequireDefault(_ReportViewerPage);

var _withConfig = require('../../enhancers/withConfig');

var _withConfig2 = _interopRequireDefault(_withConfig);

var _report = require('../../actions/report');

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

const mapDispatchToProps = (dispatch, ownProps) => ({
  readContent: (location, match) => {
    const invocationContext = _qs2.default.parse(location.search, { ignoreQueryPrefix: true });

    return dispatch((0, _report.invoke)(ownProps.config, match.params.reportCsid, invocationContext));
  }
});

const ConnectedReportViewerPage = exports.ConnectedReportViewerPage = (0, _reactRedux.connect)(undefined, mapDispatchToProps)(_ReportViewerPage2.default);

exports.default = (0, _withConfig2.default)(ConnectedReportViewerPage);