Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Hyperswitch React SDK CardWidget Event Handlers Not Working as Documented #6797

Open
2 tasks done
erickirt opened this issue Dec 10, 2024 · 0 comments
Open
2 tasks done
Labels
C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet

Comments

@erickirt
Copy link

Bug Description

Bug Description:
The CardWidget component's event handlers in the React SDK are not functioning as described in the documentation. While implementing the CardWidget with event handlers according to the documentation, we found that most events are not being emitted or are using mock implementations.

Expected Behavior

Expected Behavior:
According to the documentation, the CardWidget should emit events with specific data structures:

{
elementType: 'payment', // The type of element that emitted this event
complete: false, // If all required fields are complete
empty: false, // if the value is empty
value: { type: "card" }, // current selected payment method
}
These events should be handled through props like onChange, onReady, onFocus, onBlur, etc.

Actual Behavior

Actual Behavior:

Only onReady, onFocus, and onBlur events are working
The onChange event, which is crucial for form validation and completion status, is not emitting events as documented
The event system appears to be using mock implementations (visible in the SDK source code)
Unable to properly track card completion status due to non-functioning change events
Steps To Reproduce:

Steps To Reproduce

Install the Hyperswitch React SDK
Implement the CardWidget component with event handlers:
<CardWidget
options={options}
onReady={(e) => console.log("ready:", e)}
onFocus={(e) => console.log("focus:", e)}
onBlur={(e) => console.log("blur:", e)}
onChange={(e) => console.log("change:", e)}
/>
Fill out the card form
Check console logs - only ready, focus, and blur events will be logged
Context For The Bug:
We are implementing a payment form that needs to track the card input completion status to enable/disable the submit button. Without proper change events, we cannot reliably determine when the card details are complete and valid.

Context For The Bug

No response

Environment

Environment:

Using Hyperswitch hosted version: Yes
React version: 18.3.1
@juspay-tech/react-hyper-js: latest version
Browser: Chrome latest version
Nextjs but this is client side stuff

Have you spent some time checking if this bug has been raised before?

  • I checked and didn't find a similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

None

@erickirt erickirt added C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Bug S-awaiting-triage Status: New issues that have not been assessed yet
Projects
None yet
Development

No branches or pull requests

1 participant