From 64efa96d302eaf6217f056ecaffd8b116454655c Mon Sep 17 00:00:00 2001 From: Ahmad Abdolsaheb Date: Tue, 22 Feb 2022 15:38:35 +0300 Subject: [PATCH] feat(client): add badge benefit to progress modal copy (#45142) * feat: add badge benefit to progress modal copy * Update client/src/redux/index.js --- client/i18n/locales/english/translations.json | 1 + .../components/Donation/donation-modal.tsx | 20 ++++++++++++++----- client/src/redux/index.js | 12 ++--------- config/donation-settings.js | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index bb5b519227..c036304f9a 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -331,6 +331,7 @@ "duration-2": "Become a monthly supporter of our nonprofit.", "duration-3": "Become an annual supporter of our nonprofit", "duration-4": "Become a supporter of our nonprofit", + "duration-5": "Support our nonprofit and earn a supporter profile badge.", "nicely-done": "Nicely done. You just completed {{block}}.", "credit-card": "Credit Card", "credit-card-2": "Or donate with a credit card:", diff --git a/client/src/components/Donation/donation-modal.tsx b/client/src/components/Donation/donation-modal.tsx index 1829e7f435..27ffa552c7 100644 --- a/client/src/components/Donation/donation-modal.tsx +++ b/client/src/components/Donation/donation-modal.tsx @@ -14,7 +14,8 @@ import { closeDonationModal, isDonationModalOpenSelector, recentlyClaimedBlockSelector, - executeGA + executeGA, + isAVariantSelector } from '../../redux'; import { isLocationSuperBlock } from '../../utils/path-parsers'; import { playTone } from '../../utils/tone'; @@ -24,9 +25,11 @@ import DonateForm from './donate-form'; const mapStateToProps = createSelector( isDonationModalOpenSelector, recentlyClaimedBlockSelector, - (show: boolean, recentlyClaimedBlock: string) => ({ + isAVariantSelector, + (show: boolean, recentlyClaimedBlock: string, isAVariant: boolean) => ({ show, - recentlyClaimedBlock + recentlyClaimedBlock, + isAVariant }) ); @@ -46,6 +49,7 @@ type DonateModalProps = { location: WindowLocation | undefined; recentlyClaimedBlock: string; show: boolean; + isAVariant: boolean; }; function DonateModal({ @@ -53,7 +57,8 @@ function DonateModal({ closeDonationModal, executeGA, location, - recentlyClaimedBlock + recentlyClaimedBlock, + isAVariant }: DonateModalProps): JSX.Element { const [closeLabel, setCloseLabel] = React.useState(false); const { t } = useTranslation(); @@ -129,6 +134,11 @@ function DonateModal({ ); + const renderABtestProgressText = () => { + if (isAVariant) return getDonationText(); + else {t('donate.duration-5')}; + }; + const progressDonationText = (
@@ -137,7 +147,7 @@ function DonateModal({ {!closeLabel && ( - {getDonationText()} + {renderABtestProgressText()} )} diff --git a/client/src/redux/index.js b/client/src/redux/index.js index 16fbb5e8dd..9c1475decb 100644 --- a/client/src/redux/index.js +++ b/client/src/redux/index.js @@ -221,7 +221,6 @@ export const shouldRequestDonationSelector = state => { const canRequestProgressDonation = state[MainApp].canRequestProgressDonation; const isDonating = isDonatingSelector(state); const recentlyClaimedBlock = recentlyClaimedBlockSelector(state); - const isAVariant = isAVariantSelector(state); // don't request donation if already donating if (isDonating) return false; @@ -234,15 +233,8 @@ export const shouldRequestDonationSelector = state => { // donations only appear after the user has completed ten challenges (i.e. // not before the 11th challenge has mounted) - // the follwoing is an AB test for increasing the completed challenge requirement to 20 - if (isAVariant) { - if (completedChallenges.length < 10) { - return false; - } - } else { - if (completedChallenges.length < 20) { - return false; - } + if (completedChallenges.length < 10) { + return false; } // this will mean we have completed 3 or more challenges this browser session diff --git a/config/donation-settings.js b/config/donation-settings.js index c7d468a710..0f1a60b26c 100644 --- a/config/donation-settings.js +++ b/config/donation-settings.js @@ -94,7 +94,7 @@ const patreonDefaultPledgeAmount = 500; const aBTestConfig = { isTesting: true, - type: 'increaceChallengesCompleted' + type: 'badgeProgressModalCopy' }; module.exports = {