From f854790c7b97708c6947722c35e3f780d7856b86 Mon Sep 17 00:00:00 2001 From: joao-imi Date: Tue, 9 Dec 2025 10:03:06 -0300 Subject: [PATCH 1/2] fix: types --- package.json | 4 +++- types/hooks/index.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 types/hooks/index.d.ts diff --git a/package.json b/package.json index 6e056c0..18f03d9 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,17 @@ { "name": "@hcaptcha/react-hcaptcha", - "version": "1.17.0", + "version": "1.17.1", "types": "types/index.d.ts", "main": "dist/index.js", "module": "dist/esm/index.js", "exports": { ".": { + "types": "./types/index.d.ts", "import": "./dist/esm/index.js", "require": "./dist/index.js" }, "./hooks": { + "types": "./types/hooks/index.d.ts", "import": "./dist/esm/hooks/index.jsx", "require": "./dist/hooks/index.jsx" } diff --git a/types/hooks/index.d.ts b/types/hooks/index.d.ts new file mode 100644 index 0000000..f2ecd57 --- /dev/null +++ b/types/hooks/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for @hcaptcha/react-hcaptcha/hooks +// Project: https://github.com/hCaptcha/react-hcaptcha + +import * as React from "react"; + +export interface HCaptchaContextValue { + sitekey: string | null; + token: string | null; + error: string | Error | null; + ready: boolean; + executeInstance: (config?: { rqdata?: string }) => Promise; + resetInstance: () => void; +} + +export interface HCaptchaProviderProps { + sitekey: string; + size?: "normal" | "compact" | "invisible"; + theme?: "light" | "dark" | "contrast" | object; + rqdata?: string | null; + languageOverride?: string | null; + onVerify?: (token: string) => void; + onError?: (error: string | Error) => void; + children: React.ReactNode; +} + +export const HCaptchaContext: React.Context; + +export const HCaptchaProvider: React.FC; + +export function useHCaptcha(): HCaptchaContextValue; From 07ffd078d8392dcf95e6068b42bd313710d18c67 Mon Sep 17 00:00:00 2001 From: joao-imi Date: Tue, 9 Dec 2025 10:11:56 -0300 Subject: [PATCH 2/2] fix: babel exports --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 18f03d9..7a212e8 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ }, "./hooks": { "types": "./types/hooks/index.d.ts", - "import": "./dist/esm/hooks/index.jsx", - "require": "./dist/hooks/index.jsx" + "import": "./dist/esm/hooks/index.js", + "require": "./dist/hooks/index.js" } }, "files": [