<commit_before>/** @jsx React.DOM */

Flynn.Views.SponsorForm = React.createClass({
	displayName: "Flynn.Views.SponsorForm",

	getInitialState: function () {
		return {
			stripeToken: null,
			contributionType: null,
			submitting: false,
			values: {},
			firstStep: true,
			alert: null
		};
	},

	getDefaultProps: function () {
		return {
			suggestedMonthlyAmounts: [
				10000,
				50000,
				100000
			],
			selectedMonthlyAmount: 500000
		};
	},

	handleValuesUpdated: function (values) {
		this.setState({
			values: Marbles.Utils.extend({}, this.state.values, values)
		});
	},

	focusSubmitBtn: function () {
		this.refs.submit.getDOMNode().focus();
	},

	handleSubmit: function (e) {
		e.preventDefault();

		if (this.state.firstStep) {
			this.setState({
				firstStep: false
			});
		} else {
			this.setState({ submitting: true });

			Flynn.withStripe(function (Stripe) {
				Stripe.card.createToken({
					number: this.state.values.ccNumber,
					exp_month: this.state.values.ccMonth,
					exp_year: this.state.values.ccYear,
					cvc: this.state.values.ccCVC,
					name: this.state.values.name
				}, function (status, res) {
					if (res.error) {
						this.setState({
							submitting: false,
							alert: {
								type: 'error',
								text: res.error.message
							}
						});
					} else {
						this.refs.token.getDOMNode().value = res.id;<commit_msg>website: Focus email input (sponsor form)<commit_after>/** @jsx React.DOM */

Flynn.Views.SponsorForm = React.createClass({
	displayName: "Flynn.Views.SponsorForm",

	getInitialState: function () {
		return {
			stripeToken: null,
			contributionType: null,
			submitting: false,
			values: {},
			firstStep: true,
			alert: null
		};
	},

	getDefaultProps: function () {
		return {
			suggestedMonthlyAmounts: [
				10000,
				50000,
				100000
			],
			selectedMonthlyAmount: 500000
		};
	},

	componentDidUpdate: function () {
		if ( !this.state.firstStep ) {
			this.focusEmailInput();
		}
	},

	handleValuesUpdated: function (values) {
		this.setState({
			values: Marbles.Utils.extend({}, this.state.values, values)
		});
	},

	focusSubmitBtn: function () {
		this.refs.submit.getDOMNode().focus();
	},

	focusEmailInput: function () {
		this.refs.email.getDOMNode().focus();
	},

	handleSubmit: function (e) {
		e.preventDefault();

		if (this.state.firstStep) {
			this.setState({
				firstStep: false
			});
		} else {
			this.setState({ submitting: true });

			Flynn.withStripe(function (Stripe) {
				Stripe.card.createToken({
					number: this.state.values.ccNumber,
					exp_month: this.state.values.ccMonth,
					exp_year: this.state.values.ccYear,
					cvc: this.state.values.ccCVC,
					name: this.state.values.name
				}, function (status, res) {
					if (res.error) {
						this.setState({
							submitting: false,
							alert: {
								type: 'error',
								text: res.error.message
							}
						});
					} else {
						this.refs.token.getDOMNode().value = res.id;
{'fraction_non_alphanumeric': 0.1458403502862917, 'fraction_numerical': 0.01481980464802964, 'mean_word_length': 2.857142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '7477428', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1013, 'n_words': 178}