-
Notifications
You must be signed in to change notification settings - Fork 618
[SDK] Fix: Skip payment method selection when balance is sufficient #7813
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
[SDK] Fix: Skip payment method selection when balance is sufficient #7813
Conversation
🦋 Changeset detectedLatest commit: 4fdccea The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Caution Review failedThe pull request is closed. WalkthroughThis change updates the payment flow in the thirdweb component to skip the payment selection step if the user's balance is sufficient to cover the transaction cost. It introduces a new event type and prop to enable this logic, adds prop wiring, fixes a documentation comment, updates a story to include the new required prop, modifies domain URL imports for bridge API calls, and removes an error-catching handler in a hook to allow error propagation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TransactionPayment
participant PaymentMachine
participant TransactionWidget
User->>TransactionPayment: Initiate transaction
TransactionPayment->>TransactionPayment: Check user balance
alt Balance sufficient
TransactionPayment->>PaymentMachine: sendEvent({ type: "CONTINUE_TO_TRANSACTION" })
PaymentMachine->>TransactionWidget: Proceed to transaction (skip payment selection)
else Balance insufficient
TransactionPayment->>TransactionPayment: Show payment method selection
User->>TransactionPayment: Select payment method
TransactionPayment->>PaymentMachine: sendEvent({ type: "CONTINUE_TO_TRANSACTION" })
PaymentMachine->>TransactionWidget: Proceed to transaction
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
53b6fcf to
96be7e2
Compare
size-limit report 📦
|
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (6.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #7813 +/- ##
==========================================
- Coverage 56.33% 56.32% -0.02%
==========================================
Files 905 905
Lines 58809 58823 +14
Branches 4147 4145 -2
==========================================
+ Hits 33131 33132 +1
- Misses 25573 25585 +12
- Partials 105 106 +1
🚀 New features to boost your workflow:
|
|
@CodeRabbit please review this PR |
|
@gregfromstl I'll review this PR for you. The changes look well-structured, focusing on improving the user experience by allowing users with sufficient balance to skip the payment method selection step. I can see you've included proper type definitions, updated the stories, and added a changeset for versioning. 🧠 Learnings used✅ Actions performedReview triggered.
|
e78d615 to
ac18def
Compare
…ayment-even-when-balance-is
| /** | ||
| * Send arbitrary payment events for UI flow control | ||
| */ | ||
| sendEvent: (event: PaymentMachineEvent) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg the components should not be aware of the state machine. This should just be a 'executrTx' function and the orchestrator is the one that sends state machine events
Otherwise this opens up for the next contributor to just bypass the whole structure we have in place. Slippery slope
| * Events that can be sent to the payment machine | ||
| */ | ||
| type PaymentMachineEvent = | ||
| export type PaymentMachineEvent = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be exported
PR-Codex overview
This PR focuses on enhancing the
TransactionWidgetandTransactionPaymentcomponents by skipping payment selection when the user's balance is sufficient. It also includes improvements in event handling and configuration for payment processes.Detailed summary
TransactionWidgetto skip payment selection if user balance is sufficient.sendEventprop toTransactionPaymentfor controlling UI flow.PaymentMachineEventto includeCONTINUE_TO_TRANSACTION.getThirdwebBaseUrltogetThirdwebDomainsfor URL construction.Summary by CodeRabbit
New Features
Documentation