fix: lock the demo widget to the scanned domain and surface the cloudflare one-click path - #131
Merged
Merged
Conversation
…flare one-click path
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two things the product owner hit while running the live demo against a real domain. Both are contained to the demo consumer app — the published
@domainproof/react/@domainproof/uipackages and the API are untouched.Lock the widget to the scanned domain: removed the "Verify a different domain instead" / "Back to {domain}" toggle from the embedded widget, since letting a demo visitor claim an arbitrary domain through the embedded widget was never the point — the demo is about the domain you just scanned.
Kept the sessionToken-only fallback branch: traced
frontendToken/sessionTokenback throughclaim/route.tsandstatus/route.ts— a claim itself always succeeds by the time the response is built (any real claim failure returns an error before either token is minted), butfrontendTokenextraction fromverificationUrlis defensive and documented as returningnullif that URL is ever shaped unexpectedly, whilesessionTokenis minted independently in parallel. So the sessionToken-only render state is real, just reachable through that edge case rather than "claim creation failed" outright — kept it working as a fallback, only removing its now-orphaned toggle button. Nothing downstream became dead code:componentSessions.create(server) and the widget'ssessionTokenprop (client) both stay in active use.Surface the Cloudflare one-click path from the demo: the hosted verification page can add the DNS record automatically for Cloudflare-managed domains; the embedded widget deliberately doesn't carry that flow. Added a small hint line under the widget — shown only once the bound claim's provider reads back as
cloudflareand only before it verifies — linking out to the hosted page (target="_blank") to finish there. The provider read is a single client-side GET to the frontend plane (same endpoint the hosted page's own poll uses, samefrontendApiBaseUrl()used everywhere else in this file), fired once whenfrontendTokenbinds — no additional polling. Hiding it once verified reuses the widget's existingonVerifiedcallback rather than adding new state or a second poll.Tests: added a colocated
verify-gate.test.tsxcovering both changes — no switch-domain affordance in either widget branch, the Cloudflare hint appearing only forprovider: 'cloudflare', staying hidden for other providers, and disappearing once the widget reports verified.