Conversation
- Added requireApproval property to UseConnectModalOptions type - Pass requireApproval through to ConnectModal meta object - Matches functionality available in ConnectButton and ConnectEmbed Co-authored-by: Yash <Yash094@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Cursor Agent can help with this pull request. Just |
|
WalkthroughAdded an optional Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (1)
455-469: Consider enforcing URLs whenrequireApprovalis true.
A discriminated union can prevent misconfiguration at compile time.♻️ Proposed typing guard
+type RequireApprovalOptions = + | { + requireApproval?: false; + termsOfServiceUrl?: string; + privacyPolicyUrl?: string; + } + | { + requireApproval: true; + termsOfServiceUrl: string; + privacyPolicyUrl: string; + }; + -export type UseConnectModalOptions = { +export type UseConnectModalOptions = RequireApprovalOptions & { ... - termsOfServiceUrl?: string; - privacyPolicyUrl?: string; - requireApproval?: boolean; + // termsOfServiceUrl/privacyPolicyUrl/requireApproval moved to RequireApprovalOptions };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx` around lines 455 - 469, The current typing for requireApproval allows runtime misconfiguration; change the connect modal options to a discriminated union so that when requireApproval: true the type requires explicit URL fields (e.g., termsOfServiceUrl and privacyPolicyUrl as strings) and when requireApproval is false/undefined those URL fields are optional or absent. Locate the type used by useConnectModal/connect options (the interface containing requireApproval) and replace it with two variants: { requireApproval: true; termsOfServiceUrl: string; privacyPolicyUrl: string; ... } | { requireApproval?: false; ... } and update any call sites to satisfy the new required properties when passing requireApproval: true.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx`:
- Around line 455-469: The current typing for requireApproval allows runtime
misconfiguration; change the connect modal options to a discriminated union so
that when requireApproval: true the type requires explicit URL fields (e.g.,
termsOfServiceUrl and privacyPolicyUrl as strings) and when requireApproval is
false/undefined those URL fields are optional or absent. Locate the type used by
useConnectModal/connect options (the interface containing requireApproval) and
replace it with two variants: { requireApproval: true; termsOfServiceUrl:
string; privacyPolicyUrl: string; ... } | { requireApproval?: false; ... } and
update any call sites to satisfy the new required properties when passing
requireApproval: true.
size-limit report 📦
|
Slack Thread
PR-Codex overview
This PR introduces a new optional property
requireApprovalto theuseConnectModalhook, which allows requiring users to accept terms of service and privacy policy before connecting their wallets.Detailed summary
requireApprovalto the modal options inuseConnectModal.Modalcomponent to includeprops.requireApproval.requireApprovalwith an example usage.Summary by CodeRabbit