diff --git a/package.json b/package.json index 6e056c0..7a212e8 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,19 @@ { "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": { - "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;