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): Add experimental support for hCaptcha #3422

Merged
merged 10 commits into from
May 27, 2024

Conversation

anagstef
Copy link
Member

@anagstef anagstef commented May 22, 2024

Description

This PR adds experimental support for hCaptcha alongside with Cloudflare Turnstile, for testing purposes.

The mechanism and logic used is exactly the same with Turnstile. There are duplicated fragments of code, but this is temporary thing.

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:

@anagstef anagstef self-assigned this May 22, 2024
Copy link

changeset-bot bot commented May 22, 2024

🦋 Changeset detected

Latest commit: 0dd731a

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

This PR includes changesets to release 14 packages
Name Type
@clerk/clerk-js Patch
@clerk/types Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/testing 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

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/backend 1.2.1-snapshot.v038cdae
@clerk/chrome-extension 1.0.14-snapshot.v038cdae
@clerk/clerk-js 5.6.0-snapshot.v038cdae
@clerk/elements 0.4.7-snapshot.v038cdae
@clerk/clerk-expo 1.1.6-snapshot.v038cdae
@clerk/express 0.0.10-snapshot.v038cdae
@clerk/fastify 1.0.11-snapshot.v038cdae
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/nextjs 5.1.1-snapshot.v038cdae
@clerk/clerk-react 5.2.1-snapshot.v038cdae
@clerk/remix 4.0.12-snapshot.v038cdae
@clerk/clerk-sdk-node 5.0.9-snapshot.v038cdae
@clerk/shared 2.2.1-snapshot.v038cdae
@clerk/testing 1.1.4-snapshot.v038cdae
@clerk/themes 2.1.8-snapshot.v038cdae
@clerk/types 4.6.0-snapshot.v038cdae

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend

npm i @clerk/backend@1.2.1-snapshot.v038cdae --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.0.14-snapshot.v038cdae --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.6.0-snapshot.v038cdae --save-exact

@clerk/elements

npm i @clerk/elements@0.4.7-snapshot.v038cdae --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@1.1.6-snapshot.v038cdae --save-exact

@clerk/express

npm i @clerk/express@0.0.10-snapshot.v038cdae --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.11-snapshot.v038cdae --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.1.1-snapshot.v038cdae --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.2.1-snapshot.v038cdae --save-exact

@clerk/remix

npm i @clerk/remix@4.0.12-snapshot.v038cdae --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.9-snapshot.v038cdae --save-exact

@clerk/shared

npm i @clerk/shared@2.2.1-snapshot.v038cdae --save-exact

@clerk/testing

npm i @clerk/testing@1.1.4-snapshot.v038cdae --save-exact

@clerk/themes

npm i @clerk/themes@2.1.8-snapshot.v038cdae --save-exact

@clerk/types

npm i @clerk/types@4.6.0-snapshot.v038cdae --save-exact

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/backend 1.2.1-snapshot.v25f7fe2
@clerk/chrome-extension 1.0.14-snapshot.v25f7fe2
@clerk/clerk-js 5.6.0-snapshot.v25f7fe2
@clerk/elements 0.4.7-snapshot.v25f7fe2
@clerk/clerk-expo 1.1.6-snapshot.v25f7fe2
@clerk/express 0.0.10-snapshot.v25f7fe2
@clerk/fastify 1.0.11-snapshot.v25f7fe2
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/nextjs 5.1.1-snapshot.v25f7fe2
@clerk/clerk-react 5.2.1-snapshot.v25f7fe2
@clerk/remix 4.0.12-snapshot.v25f7fe2
@clerk/clerk-sdk-node 5.0.9-snapshot.v25f7fe2
@clerk/shared 2.2.1-snapshot.v25f7fe2
@clerk/testing 1.1.4-snapshot.v25f7fe2
@clerk/themes 2.1.8-snapshot.v25f7fe2
@clerk/types 4.6.0-snapshot.v25f7fe2

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/backend

npm i @clerk/backend@1.2.1-snapshot.v25f7fe2 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@1.0.14-snapshot.v25f7fe2 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.6.0-snapshot.v25f7fe2 --save-exact

@clerk/elements

npm i @clerk/elements@0.4.7-snapshot.v25f7fe2 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@1.1.6-snapshot.v25f7fe2 --save-exact

@clerk/express

npm i @clerk/express@0.0.10-snapshot.v25f7fe2 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.11-snapshot.v25f7fe2 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.1.1-snapshot.v25f7fe2 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.2.1-snapshot.v25f7fe2 --save-exact

@clerk/remix

npm i @clerk/remix@4.0.12-snapshot.v25f7fe2 --save-exact

@clerk/clerk-sdk-node

npm i @clerk/clerk-sdk-node@5.0.9-snapshot.v25f7fe2 --save-exact

@clerk/shared

npm i @clerk/shared@2.2.1-snapshot.v25f7fe2 --save-exact

@clerk/testing

npm i @clerk/testing@1.1.4-snapshot.v25f7fe2 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.8-snapshot.v25f7fe2 --save-exact

@clerk/types

npm i @clerk/types@4.6.0-snapshot.v25f7fe2 --save-exact

@anagstef anagstef marked this pull request as ready for review May 24, 2024 09:58
@anagstef anagstef changed the title feat(clerk-js): Add support for hCaptcha feat(clerk-js): Add experimental support for hCaptcha May 24, 2024
let retries = 0;
const errorCodes: (string | number)[] = [];

const handleCaptchaTokenGeneration = (): Promise<[string, string]> => {
Copy link
Member

Choose a reason for hiding this comment

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

❓ Can we extract parts from handleCaptchaTokenGeneration to avoid duplicate code?

Copy link
Member Author

Choose a reason for hiding this comment

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

These duplicated code fragments are temprary until we decide on the provider and will be removed soon. If we decide to provide multiple captcha providers, I will refactor the code, as you suggested!

Copy link
Member

@octoper octoper left a comment

Choose a reason for hiding this comment

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

💯

@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/chrome-extension 1.0.15-snapshot.v84cdc13
@clerk/clerk-js 5.5.2-snapshot.v84cdc13
@clerk/elements 0.5.1-snapshot.v84cdc13
@clerk/clerk-expo 1.1.7-snapshot.v84cdc13
@clerk/fastify 1.0.12-snapshot.v84cdc13
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/nextjs 5.1.3-snapshot.v84cdc13
@clerk/clerk-react 5.2.2-snapshot.v84cdc13
@clerk/remix 4.0.13-snapshot.v84cdc13
@clerk/testing 1.1.5-snapshot.v84cdc13
@clerk/themes 2.1.8-snapshot.v84cdc13
@clerk/types 4.5.1-snapshot.v84cdc13

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension

npm i @clerk/chrome-extension@1.0.15-snapshot.v84cdc13 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.5.2-snapshot.v84cdc13 --save-exact

@clerk/elements

npm i @clerk/elements@0.5.1-snapshot.v84cdc13 --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@1.1.7-snapshot.v84cdc13 --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.12-snapshot.v84cdc13 --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.1.3-snapshot.v84cdc13 --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.2.2-snapshot.v84cdc13 --save-exact

@clerk/remix

npm i @clerk/remix@4.0.13-snapshot.v84cdc13 --save-exact

@clerk/testing

npm i @clerk/testing@1.1.5-snapshot.v84cdc13 --save-exact

@clerk/themes

npm i @clerk/themes@2.1.8-snapshot.v84cdc13 --save-exact

@clerk/types

npm i @clerk/types@4.5.1-snapshot.v84cdc13 --save-exact

@anagstef
Copy link
Member Author

!snapshot

1 similar comment
@anagstef
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @anagstef - the snapshot version command generated the following package versions:

Package Version
@clerk/chrome-extension 1.0.16-snapshot.vf344f0c
@clerk/clerk-js 5.5.3-snapshot.vf344f0c
@clerk/elements 0.5.2-snapshot.vf344f0c
@clerk/clerk-expo 1.1.8-snapshot.vf344f0c
@clerk/fastify 1.0.12-snapshot.vf344f0c
gatsby-plugin-clerk 5.0.0-beta.45
@clerk/nextjs 5.1.3-snapshot.vf344f0c
@clerk/clerk-react 5.2.2-snapshot.vf344f0c
@clerk/remix 4.0.13-snapshot.vf344f0c
@clerk/testing 1.1.5-snapshot.vf344f0c
@clerk/themes 2.1.8-snapshot.vf344f0c
@clerk/types 4.5.1-snapshot.vf344f0c

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension

npm i @clerk/chrome-extension@1.0.16-snapshot.vf344f0c --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@5.5.3-snapshot.vf344f0c --save-exact

@clerk/elements

npm i @clerk/elements@0.5.2-snapshot.vf344f0c --save-exact

@clerk/clerk-expo

npm i @clerk/clerk-expo@1.1.8-snapshot.vf344f0c --save-exact

@clerk/fastify

npm i @clerk/fastify@1.0.12-snapshot.vf344f0c --save-exact

gatsby-plugin-clerk

npm i gatsby-plugin-clerk@5.0.0-beta.45 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@5.1.3-snapshot.vf344f0c --save-exact

@clerk/clerk-react

npm i @clerk/clerk-react@5.2.2-snapshot.vf344f0c --save-exact

@clerk/remix

npm i @clerk/remix@4.0.13-snapshot.vf344f0c --save-exact

@clerk/testing

npm i @clerk/testing@1.1.5-snapshot.vf344f0c --save-exact

@clerk/themes

npm i @clerk/themes@2.1.8-snapshot.vf344f0c --save-exact

@clerk/types

npm i @clerk/types@4.5.1-snapshot.vf344f0c --save-exact

@anagstef anagstef merged commit 4beb006 into main May 27, 2024
11 checks passed
@anagstef anagstef deleted the stefanos/core-2319-create-a-poc-for-hcaptcha branch May 27, 2024 11:32
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.

None yet

5 participants