From 963b77043a4a77c140e87ed1a9f5021b4535435d Mon Sep 17 00:00:00 2001 From: Mark Ulrich <6357579+markulrich@users.noreply.github.com> Date: Fri, 17 Oct 2025 02:29:21 +0900 Subject: [PATCH] Fix type --- .../components/PaymentProcess/PaymentMethodSelect/index.tsx | 5 ++++- .../src/components/widget/types/Nonprofit.ts | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/donate-button-v4/src/components/widget/components/PaymentProcess/PaymentMethodSelect/index.tsx b/packages/donate-button-v4/src/components/widget/components/PaymentProcess/PaymentMethodSelect/index.tsx index 85fe205d..794ddefc 100644 --- a/packages/donate-button-v4/src/components/widget/components/PaymentProcess/PaymentMethodSelect/index.tsx +++ b/packages/donate-button-v4/src/components/widget/components/PaymentProcess/PaymentMethodSelect/index.tsx @@ -45,8 +45,11 @@ const usePaymentMethods = () => { () => methods .filter((method) => { + // There is a bug where instead of being a proper array of disabled methods, + // it comes as an array of length 1 with a comma-separated string inside if ( - nonprofit?.metadata?.disabledPaymentFlowOptions?.includes(method) + nonprofit?.metadata?.disabledPaymentFlowOptions?.length === 1 && + nonprofit?.metadata?.disabledPaymentFlowOptions[0]?.includes(method) ) { return false; } 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 0fdef3b5..27332294 100644 --- a/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts +++ b/packages/donate-button-v4/src/components/widget/types/Nonprofit.ts @@ -18,9 +18,9 @@ export interface Nonprofit { nteeCode: string | null; metadata?: { customTaxDeductible?: string; - // Note that multiple payment methods can be disabled, but it still arrives as a single - // comma-separated string from the API eg "card,paypal" so we type it as such here - disabledPaymentFlowOptions?: string; + // Note that multiple payment methods can be disabled, but for some reason it arrives + // as an array of length 1 eg ["card,paypal"] from the API, so we type it as such here + disabledPaymentFlowOptions?: string[]; disablePrivateNotes?: boolean; granteeName?: string; prefixWithThe?: boolean;