@@ -207,7 +206,6 @@ class DonateForm extends Component {
diff --git a/client/src/components/Donation/components/DonateFormChildViewForHOC.js b/client/src/components/Donation/components/DonateFormChildViewForHOC.js
index 9be72873f8..ff59231162 100644
--- a/client/src/components/Donation/components/DonateFormChildViewForHOC.js
+++ b/client/src/components/Donation/components/DonateFormChildViewForHOC.js
@@ -21,7 +21,6 @@ const propTypes = {
donationAmount: PropTypes.number.isRequired,
donationDuration: PropTypes.string.isRequired,
email: PropTypes.string,
- enableDonationSettingsPage: PropTypes.func.isRequired,
getDonationButtonLabel: PropTypes.func.isRequired,
hideAmountOptionsCB: PropTypes.func.isRequired,
isSignedIn: PropTypes.bool,
@@ -120,7 +119,6 @@ class DonateFormChildViewForHOC extends Component {
}
postDonation(token) {
- const { enableDonationSettingsPage } = this.props;
const { donationAmount: amount, donationDuration: duration } = this.state;
this.setState(state => ({
...state,
@@ -150,7 +148,6 @@ class DonateFormChildViewForHOC extends Component {
error: data.error ? data.error : null
}
}));
- enableDonationSettingsPage();
})
.catch(error => {
const data =
diff --git a/client/src/components/Donation/components/DonateServicebotEmbed.js b/client/src/components/Donation/components/DonateServicebotEmbed.js
deleted file mode 100644
index dc9de11835..0000000000
--- a/client/src/components/Donation/components/DonateServicebotEmbed.js
+++ /dev/null
@@ -1,71 +0,0 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-
-import { servicebotId } from '../../../../config/env.json';
-import { servicebotScriptLoader } from '../../../utils/scriptLoaders';
-
-import '../Donation.css';
-
-const propTypes = {
- email: PropTypes.string.isRequired,
- hash: PropTypes.string.isRequired
-};
-
-export class DonationServicebotEmbed extends Component {
- constructor(...props) {
- super(...props);
-
- this.state = {
- email: this.props.email,
- hash: this.props.hash
- };
-
- this.setServiceBotConfig = this.setServiceBotConfig.bind(this);
- }
-
- setServiceBotConfig() {
- const { email, hash } = this.state;
- /* eslint-disable camelcase */
- window.servicebotSettings = {
- type: 'portal',
- servicebot_id: servicebotId,
- service: 'freeCodeCamp.org',
- email,
- hash,
- options: {
- cancel_now: true,
- disableCoupon: true,
- forceCard: true,
- hideTiers: [
- 'Monthly $3 Donation - Unavailable',
- 'Monthly $10 Donation - Unavailable'
- ],
- card: {
- hideName: true,
- hideAddress: true,
- hideCountryPostal: true
- },
- messageOnCancel: `Thanks again for supporting our tiny nonprofit. We are helping millions of people around the world learn to code for free. Please confirm: are you certain you want to stop your donation?`
- }
- };
- /* eslint-enable camelcase */
- }
-
- componentDidMount() {
- servicebotScriptLoader();
- }
-
- render() {
- this.setServiceBotConfig();
- return (
-
- );
- }
-}
-
-DonationServicebotEmbed.displayName = 'DonationServicebotEmbed';
-DonationServicebotEmbed.propTypes = propTypes;
-
-export default DonationServicebotEmbed;
diff --git a/client/src/pages/donate.js b/client/src/pages/donate.js
index 109e25451c..6992d5180e 100644
--- a/client/src/pages/donate.js
+++ b/client/src/pages/donate.js
@@ -6,7 +6,7 @@ import { createSelector } from 'reselect';
import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
import { stripePublicKey } from '../../config/env.json';
-import { Spacer, Loader, FullWidthRow, Link } from '../components/helpers';
+import { Spacer, Loader, FullWidthRow } from '../components/helpers';
import DonateForm from '../components/Donation/components/DonateForm';
import DonateText from '../components/Donation/components/DonateText';
import { signInLoadingSelector, userSelector } from '../redux';
@@ -30,13 +30,9 @@ export class DonatePage extends Component {
constructor(...props) {
super(...props);
this.state = {
- stripe: null,
- enableSettings: false
+ stripe: null
};
- this.enableDonationSettingsPage = this.enableDonationSettingsPage.bind(
- this
- );
this.handleStripeLoad = this.handleStripeLoad.bind(this);
}
@@ -69,14 +65,9 @@ export class DonatePage extends Component {
}
}
- enableDonationSettingsPage(enableSettings = true) {
- this.setState({ enableSettings });
- }
-
render() {
const { stripe } = this.state;
- const { showLoading, isDonating } = this.props;
- const { enableSettings } = this.state;
+ const { showLoading } = this.props;
if (showLoading) {
return
;
@@ -94,33 +85,7 @@ export class DonatePage extends Component {
-
-
-
-
-
- Manage your existing donation
-
-
- {[
- `Update your existing donation`,
- `Download donation receipts`
- ].map(donationSettingOps => (
-
- {donationSettingOps}
-
- ))}
-
-
-
+
diff --git a/client/src/pages/donation/settings.js b/client/src/pages/donation/settings.js
deleted file mode 100644
index 8324b8ea1c..0000000000
--- a/client/src/pages/donation/settings.js
+++ /dev/null
@@ -1,229 +0,0 @@
-import React, { Component, Fragment } from 'react';
-import Helmet from 'react-helmet';
-import PropTypes from 'prop-types';
-import { connect } from 'react-redux';
-import { createSelector } from 'reselect';
-import { Grid, Button, Panel } from '@freecodecamp/react-bootstrap';
-import { uniq } from 'lodash';
-
-import { apiLocation } from '../../../config/env.json';
-import { postCreateHmacHash } from '../../utils/ajax';
-import {
- signInLoadingSelector,
- userSelector,
- hardGoTo as navigate,
- isSignedInSelector
-} from '../../redux';
-// eslint-disable-next-line max-len
-import DonateServicebotEmbed from '../../components/Donation/components/DonateServicebotEmbed';
-import { Loader, Spacer, Link, FullWidthRow } from '../../components/helpers';
-import SectionHeader from '../../components/settings/SectionHeader.js';
-
-const propTypes = {
- donationEmails: PropTypes.array,
- email: PropTypes.string,
- isDonating: PropTypes.bool,
- isSignedIn: PropTypes.bool,
- navigate: PropTypes.func.isRequired,
- showLoading: PropTypes.bool.isRequired
-};
-
-const mapStateToProps = createSelector(
- isSignedInSelector,
- userSelector,
- signInLoadingSelector,
- (isSignedIn, { email, isDonating, donationEmails }, showLoading) => ({
- isSignedIn,
- email,
- isDonating,
- donationEmails,
- showLoading
- })
-);
-
-const mapDispatchToProps = {
- navigate
-};
-
-export class DonationSettingsPage extends Component {
- constructor(...props) {
- super(...props);
-
- this.state = {
- hash: null,
- currentSettingsEmail: null
- };
-
- this.getEmailHmacHash = this.getEmailHmacHash.bind(this);
- this.handleSelectDonationEmail = this.handleSelectDonationEmail.bind(this);
- }
-
- getEmailHmacHash(currentSettingsEmail) {
- return postCreateHmacHash({
- email: currentSettingsEmail
- })
- .then(response => {
- const data = response && response.data;
- this.setState({ hash: '' + data.hash, currentSettingsEmail });
- })
- .catch(error => {
- const data =
- error.response && error.response.data
- ? error.response.data
- : {
- error:
- 'Something is not right. Please contact team@freecodecamp.org'
- };
- console.error(data.error);
- });
- }
-
- handleSelectDonationEmail(e) {
- e.preventDefault();
- this.setState({ hash: null, currentSettingsEmail: null });
- this.getEmailHmacHash(e.currentTarget.value);
- }
-
- renderServicebotEmbed() {
- const { donationEmails } = this.props;
- if (!donationEmails || donationEmails.length === 0) {
- return null;
- }
- const { currentSettingsEmail, hash } = this.state;
- return (
-
- {!hash || !currentSettingsEmail ? (
-
-
-
- Select the email associated with your donations above.
-
-
- ) : (
-
-
-
-
-
- )}
-
- );
- }
-
- renderDonationEmailsList() {
- const { donationEmails } = this.props;
- if (!donationEmails || donationEmails.length === 0) {
- return (
-
- Some of the data associated with your donation is unavailable. Please
- contact team@freeCodeCamp.org to get your donation updated manually.
-
- );
- }
- return uniq(donationEmails).map(email => (
-
- {`Show donations for your ${email} email address`}
-
- ));
- }
-
- render() {
- const { showLoading, isSignedIn, isDonating, navigate } = this.props;
-
- if (showLoading) {
- return ;
- }
-
- if (!isSignedIn) {
- navigate(`${apiLocation}/signin?returnTo=donation/settings`);
- return ;
- }
-
- if (!isDonating) {
- navigate(`/donate`);
- return ;
- }
-
- return (
-
-
-
-
-
-
-
-
- Go to donate page
-
-
- Update my account settings
-
-
-
-
-
- Manage your donations
-
-
-
-
- Donations made using a credit or debit card
-
-
- {this.renderDonationEmailsList()}
-
-
- {this.renderServicebotEmbed()}
-
-
- Donations made using PayPal
-
-
- You can update your PayPal donation{' '}
-
- directly on PayPal
-
- .
-
-
-
-
- Still need help?
-
-
- If you can't see your donation here, forward a donation receipt
- you have recieved in your email to team@freeCodeCamp.org and
- tell us how we can help you with it.
-
-
-
-
-
-
-
- );
- }
-}
-
-DonationSettingsPage.displayName = 'DonationSettingsPage';
-DonationSettingsPage.propTypes = propTypes;
-
-export default connect(
- mapStateToProps,
- mapDispatchToProps
-)(DonationSettingsPage);