From 99284006af1a3aa9926ba2caeb32891440f7bcbc Mon Sep 17 00:00:00 2001 From: OlegKrav64 <90597537+OlegKrav64@users.noreply.github.com> Date: Mon, 16 Oct 2023 19:26:20 +0300 Subject: [PATCH] Add support for metadata.prefixWithThe (#371) * add_support_prefix_with_the * requested_changes --- .../src/components/widget/components/Faq/helpers.tsx | 6 ++++++ .../src/components/widget/components/Faq/index.tsx | 9 ++++++--- .../src/components/widget/components/Footer/helpers.tsx | 9 +++++++-- .../src/components/widget/types/Nonprofit.ts | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/donate-button-v4/src/components/widget/components/Faq/helpers.tsx b/packages/donate-button-v4/src/components/widget/components/Faq/helpers.tsx index e123c297..82146b73 100644 --- a/packages/donate-button-v4/src/components/widget/components/Faq/helpers.tsx +++ b/packages/donate-button-v4/src/components/widget/components/Faq/helpers.tsx @@ -3,6 +3,12 @@ import {faqLinkCss} from 'src/components/widget/components/Faq/styles'; import {Nonprofit} from 'src/components/widget/types/Nonprofit'; import {PaymentMethod} from 'src/components/widget/types/PaymentMethod'; +export function getNonprofitName(nonprofit: Nonprofit) { + return nonprofit.metadata?.prefixWithThe + ? `the ${nonprofit.name}` + : nonprofit.name; +} + export function getDisbursementDescription(nonprofit: Nonprofit) { if (nonprofit.directDisbursement) { return ( diff --git a/packages/donate-button-v4/src/components/widget/components/Faq/index.tsx b/packages/donate-button-v4/src/components/widget/components/Faq/index.tsx index c9f019e4..82a29403 100644 --- a/packages/donate-button-v4/src/components/widget/components/Faq/index.tsx +++ b/packages/donate-button-v4/src/components/widget/components/Faq/index.tsx @@ -1,7 +1,10 @@ import {FunctionalComponent, VNode} from 'preact'; import {useState} from 'preact/hooks'; import {Fragment} from 'preact/jsx-runtime'; -import {getFeeDescription} from 'src/components/widget/components/Faq/helpers'; +import { + getFeeDescription, + getNonprofitName +} from 'src/components/widget/components/Faq/helpers'; import { faqItemConateinerCss, faqItemButtonCss, @@ -69,12 +72,12 @@ export const Faq = () => {

Your donation is made to Every.org, a US 501(c)(3) public charity. Every.org will immediately send you a receipt by email. On a weekly - basis, Every.org sends funds to {nonprofit.name}. + basis, Every.org sends funds to {getNonprofitName(nonprofit)}.

This process ensures your eligibility for a tax-deduction, enables you to consolidate your gift records, and reduces the burden on{' '} - {nonprofit.name}. + {getNonprofitName(nonprofit)}.

) diff --git a/packages/donate-button-v4/src/components/widget/components/Footer/helpers.tsx b/packages/donate-button-v4/src/components/widget/components/Footer/helpers.tsx index 3668a9cc..0219853c 100644 --- a/packages/donate-button-v4/src/components/widget/components/Footer/helpers.tsx +++ b/packages/donate-button-v4/src/components/widget/components/Footer/helpers.tsx @@ -1,3 +1,4 @@ +import {getNonprofitName} from 'src/components/widget/components/Faq/helpers'; import {Fundraiser} from 'src/components/widget/types/Fundraiser'; import {Nonprofit} from 'src/components/widget/types/Nonprofit'; @@ -11,8 +12,12 @@ export const getTaxDeductibleStatement = ( ) => { const base = `100% of your donation is tax-deductible to the extent allowed by US law. Your donation is made to Every.org, a tax-exempt US 501(c)(3) charity that - grants unrestricted funds to ${nonprofit.name} on your behalf. - As a legal matter, Every.org must provide any donations to ${nonprofit.name} on an + grants unrestricted funds to ${getNonprofitName( + nonprofit + )} on your behalf. + As a legal matter, Every.org must provide any donations to ${getNonprofitName( + nonprofit + )} on an unrestricted basis, regardless of any designations or restrictions made by you.`; diff --git a/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts b/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts index b47fb255..5472a990 100644 --- a/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts +++ b/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts @@ -18,6 +18,7 @@ export interface Nonprofit { nteeCode: string | null; metadata?: { disablePrivateNotes?: boolean; + prefixWithThe?: boolean; }; }