Skip to content

Conversation

@gusveloso
Copy link
Contributor

Description

Add eligibility check to children card fields in order to throw meaningful error messages error messages when card fields aren't eligible.
Before this change, only the parent card fields component had a eligibility check, but its children are rendered nonetheless, and they were throwing a not actionable error, without giving the information that it wasn't eligible.

Why are we making these changes? Include references to any related Jira tasks or GitHub Issues

Right now this is the error message thrown by a child card field component (cvv, number, name, expiry): Uncaught Error: Expected prop "clientID" to be defined.
We want to make it clearer: Uncaught Error: card payments are not eligible

Reproduction Steps (if applicable)

  • Use a client ID where card fields aren't eligible / On Storybook, access Eligibility > Card Fields
  • Check for semantic error message Uncaught Error: card payments are not eligible for each card field

Screenshots (if applicable)

Screenshot 2025-10-24 at 10 16 28

Groups who should review (if applicable)

❤️ Thank you!

@gusveloso gusveloso requested a review from a team as a code owner October 24, 2025 13:19
@gusveloso gusveloso force-pushed the fix/card-fields-not-eligible-message branch from 4c48241 to 2ae6263 Compare October 24, 2025 13:24
eligible: ({ props }) => {
// Prevent child field from being eligible if parent is not eligible
// Parent props will be empty as eligibility is checked before props are set
if (Object.keys(props.parent.props).length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add some some optional chaining checks in props.parent.lenghts just incase something is not defined.

…meaningful error messages when card fields aren't eligible
@gusveloso gusveloso force-pushed the fix/card-fields-not-eligible-message branch from 2ae6263 to 96db6c6 Compare October 24, 2025 18:11
@gusveloso gusveloso merged commit f817382 into main Oct 28, 2025
4 checks passed
@gusveloso gusveloso deleted the fix/card-fields-not-eligible-message branch October 28, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants