@hcaptcha/react-hcaptcha
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -333,2 +333,27 @@ "use strict"; | ||
}, { | ||
key: "setData", | ||
value: function setData(data) { | ||
var captchaId = this.state.captchaId; | ||
if (!this.isReady()) { | ||
return; | ||
} | ||
if (data && (0, _typeof2["default"])(data) !== "object") { | ||
data = null; | ||
} | ||
hcaptcha.setData(captchaId, data); | ||
} | ||
}, { | ||
key: "getResponse", | ||
value: function getResponse() { | ||
return hcaptcha.getResponse(this.state.captchaId); | ||
} | ||
}, { | ||
key: "getRespKey", | ||
value: function getRespKey() { | ||
return hcaptcha.getRespKey(this.state.captchaId); | ||
} | ||
}, { | ||
key: "render", | ||
@@ -335,0 +360,0 @@ value: function render() { |
{ | ||
"name": "@hcaptcha/react-hcaptcha", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"types": "types/index.d.ts", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -152,3 +152,6 @@ # React hCaptcha Component Library | ||
|`execute()`|Programmatically trigger a challenge request. Additionally, this method can be run asynchronously and returns a promise with the `token` and `eKey` when the challenge is completed.| | ||
|`getRespKey()`|Get the current challenge reference ID| | ||
|`getResponse()`|Get the current challenge response token from completed challenge| | ||
|`resetCaptcha()`|Reset the current challenge| | ||
|`setData()`|See enterprise docs.| | ||
@@ -155,0 +158,0 @@ |
@@ -268,2 +268,24 @@ const React = require('react'); | ||
setData (data) { | ||
const { captchaId } = this.state; | ||
if (!this.isReady()) { | ||
return; | ||
} | ||
if (data && typeof data !== "object") { | ||
data = null; | ||
} | ||
hcaptcha.setData(captchaId, data); | ||
} | ||
getResponse() { | ||
return hcaptcha.getResponse(this.state.captchaId); | ||
} | ||
getRespKey() { | ||
return hcaptcha.getRespKey(this.state.captchaId) | ||
} | ||
render () { | ||
@@ -270,0 +292,0 @@ const { elementId } = this.state; |
@@ -42,2 +42,5 @@ // Type definitions for @hcaptcha/react-hcaptcha 0.1 | ||
removeCaptcha(): void; | ||
getRespKey(): string; | ||
getResponse(): string; | ||
setData(data: object): void; | ||
execute(opts: { async: true }): Promise<ExecuteResponse>; | ||
@@ -44,0 +47,0 @@ execute(opts?: { async: false }): void; |
33246
615
196