"use strict";

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

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

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

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

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

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

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

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

var _react = _interopRequireWildcard(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _OutcomesPerStudentReport = _interopRequireDefault(require("outcomes-react/lib/containers/OutcomesPerStudentReport"));

var _CustomPropTypes = _interopRequireDefault(require("../../../../common/util/CustomPropTypes"));

var _ElementsForSelectors = _interopRequireDefault(require("../../../../common/util/ElementsForSelectors"));

/**
---
category: components
name: OutcomeAnalysis
---
  SDK Outcome Analysis Report component

  A component to show outcomes results

  ```jsx_example
  function Example () {
    return (
      <SDKApp
        apiEndpoint={`http://${config.API_HOST}`}
        appContainer="#app"
        userToken={config.TOKEN_QUIZ_BUILD}
        outcomesEndpoint={`http://${config.OUTCOMES_HOST}`}
        outcomesToken={config.TOKEN_OUTCOMES_REPORT}
      >
        <OutcomeAnalysis quizId='1' />
      </SDKApp>
    )
  }

  <LocaleSwitcher locales={LOCALES}>
    <Example />
  </LocaleSwitcher>
  ```
*/
var OutcomeAnalysis =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(OutcomeAnalysis, _Component);

  function OutcomeAnalysis() {
    var _getPrototypeOf2;

    var _this;

    (0, _classCallCheck2.default)(this, OutcomeAnalysis);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(OutcomeAnalysis)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.applicationElement = function () {
      return (0, _ElementsForSelectors.default)(_this.props.appContainer);
    };

    return _this;
  }

  (0, _createClass2.default)(OutcomeAnalysis, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          quizId = _this$props.quizId,
          contextUuid = _this$props.contextUuid,
          outcomesHost = _this$props.outcomesHost,
          outcomesToken = _this$props.outcomesToken,
          loadUsersOverride = _this$props.loadUsersOverride,
          showRollups = _this$props.showRollups;
      return _react.default.createElement(_OutcomesPerStudentReport.default, {
        applicationElement: this.applicationElement,
        artifactType: "quizzes.quiz",
        artifactId: quizId,
        contextUuid: contextUuid,
        host: outcomesHost,
        jwt: outcomesToken,
        loadUsersOverride: loadUsersOverride,
        showRollups: showRollups
      });
    }
  }]);
  OutcomeAnalysis.displayName = "OutcomeAnalysis";
  return OutcomeAnalysis;
}(_react.Component);

exports.default = OutcomeAnalysis;
OutcomeAnalysis.propTypes = {
  appContainer: _CustomPropTypes.default.selectors.isRequired,
  quizId: _propTypes.default.string.isRequired,
  contextUuid: _propTypes.default.string.isRequired,
  outcomesHost: _propTypes.default.string.isRequired,
  outcomesToken: _propTypes.default.string.isRequired,
  loadUsersOverride: _propTypes.default.func,
  showRollups: _propTypes.default.bool
};
OutcomeAnalysis.defaultProps = {
  loadUsersOverride: void 0,
  showRollups: true
};