From 1c4632d10f56093fac3b9511f5484a1975b951d4 Mon Sep 17 00:00:00 2001 From: Evgenii Perov Date: Tue, 9 Dec 2025 13:56:16 +0100 Subject: [PATCH 1/2] fix: Add TypeScript types to package.json exports for ESM compatibility --- package.json | 6 ++++-- types/hooks/index.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 types/hooks/index.d.ts diff --git a/package.json b/package.json index 6e056c0..d6e1cc9 100644 --- a/package.json +++ b/package.json @@ -6,12 +6,14 @@ "module": "dist/esm/index.js", "exports": { ".": { + "types": "./types/index.d.ts", "import": "./dist/esm/index.js", "require": "./dist/index.js" }, "./hooks": { - "import": "./dist/esm/hooks/index.jsx", - "require": "./dist/hooks/index.jsx" + "types": "./types/hooks/index.d.ts", + "import": "./dist/esm/hooks/index.js", + "require": "./dist/hooks/index.js" } }, "files": [ diff --git a/types/hooks/index.d.ts b/types/hooks/index.d.ts new file mode 100644 index 0000000..1627ea7 --- /dev/null +++ b/types/hooks/index.d.ts @@ -0,0 +1,25 @@ +import * as React from "react"; + +export interface HCaptchaContextValue { + sitekey: string | null; + error: string | null; + token: string | null; + ready: boolean; + executeInstance: (config?: { rqdata?: string }) => Promise; + resetInstance: () => void; +} + +export interface HCaptchaProviderProps { + sitekey?: string | null; + size?: "normal" | "compact" | "invisible"; + theme?: "light" | "dark" | "contrast" | object; + rqdata?: string | null; + languageOverride?: string | null; + onVerify?: (token: string) => void; + onError?: (error: string) => void; + children?: React.ReactNode; +} + +export function useHCaptcha(): HCaptchaContextValue; + +export function HCaptchaProvider(props: HCaptchaProviderProps): React.JSX.Element; From 008323bfc27a279ae33c189763013ce24924205d Mon Sep 17 00:00:00 2001 From: Evgenii Perov Date: Tue, 9 Dec 2025 14:32:36 +0100 Subject: [PATCH 2/2] bug fix version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d6e1cc9..7a212e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "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",