diff --git a/.changeset/rich-badgers-pump.md b/.changeset/rich-badgers-pump.md new file mode 100644 index 0000000000..91a13ed520 --- /dev/null +++ b/.changeset/rich-badgers-pump.md @@ -0,0 +1,5 @@ +--- +'@clerk/elements': minor +--- + +Introduce support for `` and ``. This allows rendering of a CAPTCHA widget when a sign in attempt is transferred to a sign up attempt. diff --git a/packages/elements/examples/nextjs/app/sign-in/[[...sign-in]]/page.tsx b/packages/elements/examples/nextjs/app/sign-in/[[...sign-in]]/page.tsx index e99e7cfbc9..d428a07f6d 100644 --- a/packages/elements/examples/nextjs/app/sign-in/[[...sign-in]]/page.tsx +++ b/packages/elements/examples/nextjs/app/sign-in/[[...sign-in]]/page.tsx @@ -499,6 +499,7 @@ export default function SignInPage() { Update Password + ); diff --git a/packages/elements/src/internals/machines/third-party/third-party.actors.ts b/packages/elements/src/internals/machines/third-party/third-party.actors.ts index 592f273814..e80a48b2e9 100644 --- a/packages/elements/src/internals/machines/third-party/third-party.actors.ts +++ b/packages/elements/src/internals/machines/third-party/third-party.actors.ts @@ -78,10 +78,6 @@ export const handleRedirectCallback = fromCallback; + +type CaptchaElementProps = Omit< + React.DetailedHTMLProps, HTMLDivElement>, + 'id' | 'children' +>; + +export type SignInCaptchaProps = + | ({ + asChild: true; + /* Must only be a self-closing element/component */ + children: React.ReactElement; + } & CaptchaElementProps) + | ({ asChild?: false; children?: undefined } & CaptchaElementProps); + +/** + * The `` component is used to render the Cloudflare Turnstile widget. It must be used within the `` component. + * + * If utilizing the `asChild` prop, the component must be a self-closing element or component. Any children passed to the immediate child component of will be ignored. + * + * @param {boolean} [asChild] - If true, `` will render as its child element, passing along any necessary props. + * + * @example + * + * + * + * + * + * + * @example + * + * + * + *