"use strict";

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

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

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

var _reactBootstrap = require("react-bootstrap");

var _constants = require("../../util/constants");

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

/**
 * User terms of use pane.
 */
const TermsOfUsePane = ({
  disableCheckTerms,
  handleBlur,
  handleChange,
  termsOfStorageSet,
  values: userData
}) => {
  const {
    hasConsentedToTerms,
    storeTripHistory
  } = userData;
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.ControlLabel, null, "You must agree to the terms of service to continue."), /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormGroup, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Checkbox, {
    checked: hasConsentedToTerms,
    disabled: disableCheckTerms,
    name: "hasConsentedToTerms",
    onBlur: disableCheckTerms ? null : handleBlur,
    onChange: disableCheckTerms ? null : handleChange
  }, "I confirm that I am at least 18 years old, and I have read and", ' ', "consent to the", ' ', /*#__PURE__*/_react.default.createElement("a", {
    href: `/#${_constants.TERMS_OF_SERVICE_PATH}`,
    target: "_blank"
  }, "Terms of Service"), " for using the Trip Planner.")), /*#__PURE__*/_react.default.createElement(_reactBootstrap.FormGroup, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Checkbox, {
    checked: storeTripHistory,
    name: "storeTripHistory",
    onBlur: handleBlur,
    onChange: handleChange
  }, "Optional: I consent to the Trip Planner storing my historical planned trips in order to improve transit services in my area. ", termsOfStorageSet && /*#__PURE__*/_react.default.createElement("a", {
    href: `/#${_constants.TERMS_OF_STORAGE_PATH}`,
    target: "_blank"
  }, "More info..."))));
};

const mapStateToProps = state => {
  var _state$otp$config$per;

  return {
    termsOfStorageSet: (_state$otp$config$per = state.otp.config.persistence) === null || _state$otp$config$per === void 0 ? void 0 : _state$otp$config$per.terms_of_storage
  };
};

var _default = (0, _reactRedux.connect)(mapStateToProps)(TermsOfUsePane);

exports.default = _default;
module.exports = exports.default;

//# sourceMappingURL=terms-of-use-pane.js