<commit_before>// 1:1 copied from https://github.com/mozilla/payments-ui
import React, { Component, PropTypes } from 'react';

import PayMethodChoice from 'components/pay-method-choice';
import ProductDetail from 'components/product-detail';

import * as products from 'products';
import { gettext } from 'utils';
import tracking from 'tracking';


export default class ProductPayChooser extends Component {

  static propTypes = {
    payMethods: PropTypes.array.isRequired,
    payWithNewCard: PropTypes.func.isRequired,
    processPayment: PropTypes.func.isRequired,
    productId: PropTypes.string.isRequired,
    userDefinedAmount: PropTypes.string,
  }

  componentDidMount() {
    tracking.setPage('/product-pay-chooser');
  }

  handleSubmit = (payMethodUri, processingId) => {
    this.props.processPayment({productId: this.props.productId,
                               userDefinedAmount: this.props.userDefinedAmount,
                               payMethodUri: payMethodUri,
                               processingId: processingId});
  }

  render() {
    var product = products.get(this.props.productId);
    var submitPrompt;
    if (product.seller.kind === 'donations') {
      submitPrompt = gettext('Donate now');
    } else {
      // Also handle non-recurring, non-donations here.
      submitPrompt = gettext('Subscribe');
    }

    return (
      <div>
        <ProductDetail
          productId={this.props.productId}
          userDefinedAmount={this.props.userDefinedAmount}
        />
        <PayMethodChoice
          payMethods={this.props.payMethods}
          productId={this.props.productId}
          submitButtonText={submitPrompt}
          submitHandler={this.handleSubmit}
          useDropDown
        />
        <a className="add-card" href="#"<commit_msg>:mag: adapts jsx fixture to changed jsx input<commit_after>// 1:1 copied from https://github.com/mozilla/payments-ui. Removed the todos, though
import React, { Component, PropTypes } from 'react';

import PayMethodChoice from 'components/pay-method-choice';
import ProductDetail from 'components/product-detail';

import * as products from 'products';
import { gettext } from 'utils';
import tracking from 'tracking';


export default class ProductPayChooser extends Component {

  static propTypes = {
    payMethods: PropTypes.array.isRequired,
    payWithNewCard: PropTypes.func.isRequired,
    processPayment: PropTypes.func.isRequired,
    productId: PropTypes.string.isRequired,
    userDefinedAmount: PropTypes.string,
  }

  componentDidMount() {
    tracking.setPage('/product-pay-chooser');
  }

  handleSubmit = (payMethodUri, processingId) => {
    this.props.processPayment({productId: this.props.productId,
                               userDefinedAmount: this.props.userDefinedAmount,
                               payMethodUri: payMethodUri,
                               processingId: processingId});
  }

  render() {
    var product = products.get(this.props.productId);
    var submitPrompt;
    if (product.seller.kind === 'donations') {
      submitPrompt = gettext('Donate now');
    } else {
      submitPrompt = gettext('Subscribe');
    }

    return (
      <div>
        <ProductDetail
          productId={this.props.productId}
          userDefinedAmount={this.props.userDefinedAmount}
        />
        <PayMethodChoice
          payMethods={this.props.payMethods}
          productId={this.props.productId}
          submitButtonText={submitPrompt}
          submitHandler={this.handleSubmit}
          useDropDown
        />
        <a className="add-card" href="#"
{'fraction_non_alphanumeric': 0.10608164398778117, 'fraction_numerical': 0.0011108025548458762, 'mean_word_length': 2.7677824267782425, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '3732924', 'n_tokens_mistral': 993, 'n_tokens_neox': 981, 'n_words': 199}