diff --git a/pages/index.tsx b/pages/index.tsx index 1824b14b..90bbed4d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -455,8 +455,13 @@ export const getServerSideProps: GetServerSideProps = async (context) => { } } - // Set gift details if gift = true in the query params (only for tree projects) - if (context.query.gift === "true" && projectDetails?.purpose === "trees") { + // Set gift details if gift = true in the query params + if ( + giftDetails?.type !== "direct" && + context.query.gift === "true" && + projectDetails !== null && + !NON_GIFTABLE_PROJECT_PURPOSES.includes(projectDetails.purpose) + ) { isGift = true; giftDetails = { type: "invitation", diff --git a/src/Common/Types/index.tsx b/src/Common/Types/index.tsx index 18a9ce45..49789d3b 100644 --- a/src/Common/Types/index.tsx +++ b/src/Common/Types/index.tsx @@ -14,11 +14,11 @@ import { } from "@planet-sdk/common"; /** planet-donations only allows direct or invitation gifts */ -export type DirectGiftDetails = SentDirectGift & { +export interface DirectGiftDetails extends SentDirectGift { recipientName?: string; recipientProfile?: string; -}; -export type InvitationGiftDetails = SentInvitationGift; +} +export interface InvitationGiftDetails extends SentInvitationGift {} export type SentGift = SentDirectGift | SentInvitationGift;