From 09ccd937c9a37f88eb4c7acf40ad701d85390f0c Mon Sep 17 00:00:00 2001 From: mohitb35 <44917347+mohitb35@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:42:14 +0530 Subject: [PATCH] feat: prevent GiftForm display for planet-cash donations --- pages/index.tsx | 7 ++++++- src/Donations/Components/DonationsForm.tsx | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index 597d2eec..087c8ba2 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -409,7 +409,12 @@ export const getServerSideProps: GetServerSideProps = async (context) => { utmSource = context.query.utm_source; // Set gift details if there is s (support link) in the query params - if (projectDetails?.category !== "membership" && context.query.s) { + if ( + projectDetails !== null && + projectDetails?.category !== "membership" && + projectDetails.purpose !== "planet-cash" && + context.query.s + ) { try { const requestParams = { url: `/app/profiles/${context.query.s}`, diff --git a/src/Donations/Components/DonationsForm.tsx b/src/Donations/Components/DonationsForm.tsx index 63798c29..6aa5e9fe 100644 --- a/src/Donations/Components/DonationsForm.tsx +++ b/src/Donations/Components/DonationsForm.tsx @@ -130,9 +130,14 @@ function DonationsForm(): ReactElement { !(isGift && giftDetails.recipientName === "") && !(onBehalf && onBehalfDonor.firstName === ""); - const canSendDirectGift = projectDetails?.category !== "membership"; + const canSendDirectGift = + projectDetails !== null && + projectDetails.category !== "membership" && + projectDetails.purpose !== "planet-cash"; const hasDirectGift = giftDetails.type === "direct"; const canSendInvitationGift = + projectDetails !== null && + projectDetails.purpose !== "planet-cash" && !hasDirectGift && ((projectDetails?.category !== "membership" && frequency === "once") || (projectDetails?.category === "membership" && frequency !== "once"));