<commit_before>import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';

import RequiredLoginView from '../../common/components/RequiredLoginView';
import RequiredTermsAcceptanceView from '../../common/components/RequiredTermsAcceptanceView';
import { closeRefillModal, closeGlossaryModal } from '../actions/modals';
import { refillPrescription } from '../actions/prescriptions';
import Breadcrumbs from '../components/Breadcrumbs';
import ConfirmRefillModal from '../components/ConfirmRefillModal';
import GlossaryModal from '../components/GlossaryModal';

// This needs to be a React component for RequiredLoginView to pass down
// the isDataAvailable prop, which is only passed on failure.
function AppContent({ children, isDataAvailable }) {
  const unregistered = isDataAvailable === false;
  let view;

  if (unregistered) {
    view = (
      <h4>
        To refill prescriptions at this time, you need to be registered as a VA patient through MyHealtheVet.
        To register, <a href="https://www.myhealth.va.gov/web/myhealthevet/user-registration">visit MyHealtheVet</a>.
        If you're registered but you don't see your prescriptions here, please call the Vets.gov Help Desk at 1-855-574-7286, Monday‒Friday, 8:00 a.m.‒8:00 p.m. (ET).
      </h4>
    );
  } else {
    view = children;
  }

  return (
    <div className="rx-app">
      <div className="row">
        <div className="columns small-12">
          {view}
        </div>
      </div>
    </div>
  );
}

class RxRefillsApp extends React.Component {
  render() {
    return (
      <RequiredLoginView
          authRequired={3}
          serviceRequired={"rx"}
          userProfile={this.props.profile}
          loginUrl={this.props.loginUrl}
          verifyUrl={this.props.verifyUrl}>
        <AppContent>
          <Breadcrumbs location={this.props.location} prescription={this.props.prescription}/>
          {this.props.children}
          <ConfirmRefillModal
              prescription={this.props.refillModal.prescription}
              isLoading={this.props.refillModal.loading}
              isVisible={this.props.refillModal.visible}
              refillPrescription={this.props.refillPrescription}
              onCloseModal={this.props.closeRefillModal}/>
          <GlossaryModal
              content={this.props.glossaryModal.content}
              isVisible={this.props.glossaryModal.visible}
              onCloseModal={this.props.closeGlossaryModal}/>
        </AppContent>

      </RequiredLoginView>
    );
  }
}

RxRefillsApp.propTypes = {
  children: PropTypes.element
};

const mapStateToProps = (state) => {
  const rxState = state.health.rx;
  const modals = rxState.modals;
  const userState = state.user;

  return {
    glossaryModal: modals.glossary,
    refillModal: modals.refill,
    prescription: rxState.prescriptions.currentItem,
    profile: userState.profile,
    loginUrl: userState.login.loginUrl,
    verifyUrl: userState.login.verifyUrl
  };
};

const mapDispatchToProps = {<commit_msg>put the terms acceptance thing back<commit_after>import PropTypes from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';

import RequiredLoginView from '../../common/components/RequiredLoginView';
import RequiredTermsAcceptanceView from '../../common/components/RequiredTermsAcceptanceView';
import { closeRefillModal, closeGlossaryModal } from '../actions/modals';
import { refillPrescription } from '../actions/prescriptions';
import Breadcrumbs from '../components/Breadcrumbs';
import ConfirmRefillModal from '../components/ConfirmRefillModal';
import GlossaryModal from '../components/GlossaryModal';

// This needs to be a React component for RequiredLoginView to pass down
// the isDataAvailable prop, which is only passed on failure.
function AppContent({ children, isDataAvailable }) {
  const unregistered = isDataAvailable === false;
  let view;

  if (unregistered) {
    view = (
      <h4>
        To refill prescriptions at this time, you need to be registered as a VA patient through MyHealtheVet.
        To register, <a href="https://www.myhealth.va.gov/web/myhealthevet/user-registration">visit MyHealtheVet</a>.
        If you're registered but you don't see your prescriptions here, please call the Vets.gov Help Desk at 1-855-574-7286, Monday‒Friday, 8:00 a.m.‒8:00 p.m. (ET).
      </h4>
    );
  } else {
    view = children;
  }

  return (
    <div className="rx-app">
      <div className="row">
        <div className="columns small-12">
          {view}
        </div>
      </div>
    </div>
  );
}

class RxRefillsApp extends React.Component {
  render() {
    return (
      <RequiredLoginView
          authRequired={3}
          serviceRequired={"rx"}
          userProfile={this.props.profile}
          loginUrl={this.props.loginUrl}
          verifyUrl={this.props.verifyUrl}>
        <RequiredTermsAcceptanceView termsName={"mhvac"}>
          <AppContent>
            <Breadcrumbs location={this.props.location} prescription={this.props.prescription}/>
            {this.props.children}
            <ConfirmRefillModal
                prescription={this.props.refillModal.prescription}
                isLoading={this.props.refillModal.loading}
                isVisible={this.props.refillModal.visible}
                refillPrescription={this.props.refillPrescription}
                onCloseModal={this.props.closeRefillModal}/>
            <GlossaryModal
                content={this.props.glossaryModal.content}
                isVisible={this.props.glossaryModal.visible}
                onCloseModal={this.props.closeGlossaryModal}/>
          </AppContent>
        </RequiredTermsAcceptanceView>
      </RequiredLoginView>
    );
  }
}

RxRefillsApp.propTypes = {
  children: PropTypes.element
};

const mapStateToProps = (state) => {
  const rxState = state.health.rx;
  const modals = rxState.modals;
  const userState = state.user;

  return {
    glossaryModal: modals.glossary,
    refillModal: modals.refill,
    prescription: rxState.prescriptions.currentItem,
    profile: userState.profile,
    loginUrl: userState.login.loginUrl,
    verifyUrl: userState.login.verifyUrl
  };
};

const mapDispatchToProps = {
{'fraction_non_alphanumeric': 0.11303234069804675, 'fraction_numerical': 0.007044508485430675, 'mean_word_length': 2.9815168897386872, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3089521', 'n_tokens_mistral': 1840, 'n_tokens_neox': 1804, 'n_words': 400}