Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // TODO: remove override — testing consent flow | ||
| (this.options.uiConfig as Record<string, unknown>).consentRequired = true; | ||
| if (!this.options.uiConfig.privacyPolicy) this.options.uiConfig.privacyPolicy = "https://example.com/privacy"; | ||
| if (!this.options.uiConfig.tncLink) this.options.uiConfig.tncLink = "https://example.com/terms"; |
There was a problem hiding this comment.
Accidentally committed test code forces consent for all users
High Severity
Debug override left in the init() method unconditionally forces consentRequired to true and sets dummy privacyPolicy and tncLink URLs pointing to example.com for every user. The TODO: remove override comment confirms this is test scaffolding. Every user initializing the modal SDK will be blocked by a consent screen with fake links, breaking the normal login flow entirely.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.


Motivation and Context
Introduces a consent gate that requires users to accept Terms and Conditions / Privacy Policy before completing the login flow. When
consentRequiredis enabled inuiConfig(along withtncLinkandprivacyPolicyURLs), the SDK pauses after wallet connection and prompts the user to accept or decline before proceeding.Jira Link:
https://consensyssoftware.atlassian.net/browse/EMBED-80
Description
New Connector Status:
CONSENT_REQUIREDCONSENT_REQUIREDtoCONNECTOR_STATUSandCONNECTOR_EVENTSconstants.CAN_LOGOUT_STATUSESto allow logout from the consent-required state.ConnectorEventsandWeb3AuthNoModalEventstypings with the new event.Core SDK (
no-modal)Web3AuthNoModal: AddedconsentRequiredflag,pendingConnectedData, andpendingAuthorizedDatafields to buffer connection/authorization data while awaiting user consent.connectToConnector: When consent is required, theconnectedevent handler now emitsCONSENT_REQUIREDinstead ofCONNECTED, and buffers theAUTHORIZEDevent data.acceptConsent(): New public method that resumes the login flow — transitions status fromCONSENT_REQUIREDtoCONNECTED/AUTHORIZED, connects plugins, and emits buffered events.logout(): Updated to allow logout fromCONSENT_REQUIREDstate, clearing any pending data.consentRequiredwhen restoring status fromidToken.Modal Manager (
modal)consentRequired,privacyPolicy, andtncLinkfromuiConfigin the constructor.onAcceptConsentandonDeclineConsentcallbacks toLoginModal.onAcceptConsentcallsacceptConsent();onDeclineConsentcallslogout()and closes the modal.UI Components (
modalUI layer)LoginModal: Listens for theCONSENT_REQUIREDconnector event and transitions modal to consent status. ExposesconsentRequiredflag. Forwards accept/decline handlers.WidgetContext: AddedhandleAcceptConsentandhandleDeclineConsentto the widget context.Root: Passes consent handlers and TnC/privacy links to theLoader. Hides footer links when consent screen is active.Loader: NewConsentRequiredStatussub-component renders the consent UI with accept/decline buttons, TnC link, and privacy policy link. Shown whenmodalStatus === CONSENT_REQUIRED.How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note
Medium Risk
Introduces a new
CONSENT_REQUIREDstate that buffers connection/authorization events until user action, changing the core login state machine and event ordering. Risk is mainly around regressions in connect/authorize/logout flows (including SSR rehydration) and modal UX transitions.Overview
Adds an optional consent-gated login flow: when
uiConfig.consentRequiredis enabled (withprivacyPolicyandtncLink), the SDK pauses after a wallet connects and emits a newCONSENT_REQUIREDstatus/event instead of completing login.In
no-modal, this introducesCONNECTOR_STATUS.CONSENT_REQUIRED, allowslogout()from that state, buffersCONNECTED/AUTHORIZEDpayloads, and addsacceptConsent()to resume by emitting the buffered events and connecting plugins (with special handling for SSR rehydration and suppressingAUTHORIZING/AUTHORIZEDemissions while pending consent).In
modal, the manager wires accept/decline callbacks (acceptConsent()vslogout()+close), the UI adds a consent screen inLoaderand routes handlers via context/root, and the footer links are hidden while the consent screen is active. (Note:modalManager.initcurrently force-enables consent and injects example policy URLs behind a TODO test override.)Written by Cursor Bugbot for commit 95d0da7. This will update automatically on new commits. Configure here.