Skip to content

Connect modal require approval#8683

Merged
joaquim-verges merged 1 commit intomainfrom
cursor/connect-modal-require-approval-3b77
Feb 24, 2026
Merged

Connect modal require approval#8683
joaquim-verges merged 1 commit intomainfrom
cursor/connect-modal-require-approval-3b77

Conversation

@Yash094
Copy link
Member

@Yash094 Yash094 commented Feb 23, 2026


Slack Thread

Open in Web Open in Cursor 


PR-Codex overview

This PR introduces a new optional property requireApproval to the useConnectModal hook, which allows requiring users to accept terms of service and privacy policy before connecting their wallets.

Detailed summary

  • Added requireApproval to the modal options in useConnectModal.
  • Updated the Modal component to include props.requireApproval.
  • Added documentation for requireApproval with an example usage.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Connect Wallet modal now supports optional approval requirement enforcement during the wallet connection process. This enhancement provides greater control over connection security and authentication workflows. The feature remains fully backward compatible when not enabled.

- 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>
@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-v2 Ready Ready Preview, Comment Feb 23, 2026 7:42am
nebula Ready Ready Preview, Comment Feb 23, 2026 7:42am
thirdweb_playground Ready Ready Preview, Comment Feb 23, 2026 7:42am
thirdweb-www Ready Ready Preview, Comment Feb 23, 2026 7:42am
wallet-ui Ready Ready Preview, Comment Feb 23, 2026 7:42am

@cursor
Copy link

cursor bot commented Feb 23, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Feb 23, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

⚠️ No Changeset found

Latest commit: e600a35

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

Walkthrough

Added an optional requireApproval boolean property to the UseConnectModalOptions type, which is propagated through the modal's meta object to influence modal behavior without changing default behavior when undefined.

Changes

Cohort / File(s) Summary
Modal options type extension
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx
Added optional requireApproval boolean prop to UseConnectModalOptions type and threaded it through to the modal's meta object for use in the connect flow.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Connect modal require approval' directly describes the main change—adding a requireApproval option to the connect modal—and aligns with the PR's primary objective.
Description check ✅ Passed The description includes all required sections: feature summary, notes for reviewer, and comprehensive testing instructions with code examples. While the template format differs slightly, all essential information is present and well-documented.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/connect-modal-require-approval-3b77

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/ConnectWallet/useConnectModal.tsx (1)

455-469: Consider enforcing URLs when requireApproval is 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.

📥 Commits

Reviewing files that changed from the base of the PR and between ecd5ae1 and e600a35.

📒 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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 105.66 KB (0%)
@thirdweb-dev/nexus (cjs) 319.47 KB (0%)

@joaquim-verges joaquim-verges merged commit decbbb8 into main Feb 24, 2026
23 of 24 checks passed
@joaquim-verges joaquim-verges deleted the cursor/connect-modal-require-approval-3b77 branch February 24, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants