Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a type definition to match the actual API response format for disabled payment methods. The API returns disabled payment methods as an array with a single comma-separated string (e.g., ["card,paypal"]) rather than just a comma-separated string.
- Updated the
disabledPaymentFlowOptionstype fromstringtostring[] - Modified the payment method filter logic to handle the array-of-length-1 format
- Updated comments to accurately describe the API behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/donate-button-v4/src/components/widget/types/Nonprofit.ts | Changed disabledPaymentFlowOptions type from string to string[] and updated comment |
| packages/donate-button-v4/src/components/widget/components/PaymentProcess/PaymentMethodSelect/index.tsx | Added array length check and array index access to properly handle the new type |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| nonprofit?.metadata?.disabledPaymentFlowOptions?.length === 1 && | ||
| nonprofit?.metadata?.disabledPaymentFlowOptions[0]?.includes(method) |
There was a problem hiding this comment.
The logic assumes the array always has exactly length 1, but only checks for length === 1 without handling cases where the array might be empty or have multiple elements. Consider using nonprofit?.metadata?.disabledPaymentFlowOptions?.[0]?.includes(method) instead, which safely handles all array lengths without the explicit length check.
| nonprofit?.metadata?.disabledPaymentFlowOptions?.length === 1 && | |
| nonprofit?.metadata?.disabledPaymentFlowOptions[0]?.includes(method) | |
| nonprofit?.metadata?.disabledPaymentFlowOptions?.[0]?.includes(method) |
No description provided.