Skip to content
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

feat(clerk-js): Fallback to invisible CAPTCHA if the element is not found #3191

Conversation

anagstef
Copy link
Member

@anagstef anagstef commented Apr 15, 2024

Description

This PR:

  • Expects a captcha_public_key_invisible CAPTCHA key alongside with the main key, so it can fallback to invisible CAPTCHA if the clerk-captcha element is not found in the DOM.
  • Utilizes the unsupported-callback prop of the CF Turnstile, to show error when the browser is not supported.
  • Sends a captcha_widget_type prop in the /sign_ups POST request to FAPI to let it know what widget type was used.
  • Removes the support to always_visible widget type option.

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented Apr 15, 2024

🦋 Changeset detected

Latest commit: 0b7d139

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@clerk/clerk-js Patch
@clerk/types Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
@clerk/express Patch
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/themes Patch

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

Copy link
Contributor

@dimkl dimkl left a comment

Choose a reason for hiding this comment

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

❓ How did the captchaPublicKeyInvisible was populated up until now? Wasn;t the invisible mode the default up until now?
I am mostly asking because it seems that this is a fix, not a feat :/

packages/types/src/displayConfig.ts Show resolved Hide resolved
@anagstef
Copy link
Member Author

❓ How did the captchaPublicKeyInvisible was populated up until now? Wasn;t the invisible mode the default up until now?

@dimkl you are right, the default one until now was Invisible. This captchaPublicKeyInvisible new property is actually a fallback that will be used if the main captcha strategy cannot be used. I'll add a comment to explain this.

@panteliselef
Copy link
Member

panteliselef commented Apr 15, 2024

I'm confused as to why we need 2 site keys at the same time. Don't we already know how to use a sitekey of type invisible ?

@anagstef
Copy link
Member Author

@panteliselef The captchaPublicKeyInvisible is a fallback to invisible, if the clerk-captcha element is not found in the DOM.

@anagstef anagstef enabled auto-merge (squash) April 17, 2024 08:16
@anagstef anagstef disabled auto-merge April 17, 2024 08:17
@anagstef anagstef enabled auto-merge (squash) April 17, 2024 08:56
@anagstef anagstef merged commit d9f265f into main Apr 17, 2024
10 checks passed
@anagstef anagstef deleted the stefanos/core-2071-implement-fallback-to-invisible-turnstile-clerkjs branch April 17, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants