@hcaptcha/react-hcaptcha
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -153,3 +153,3 @@ "use strict"; | ||
if (isApiReady || isRemoved) return; | ||
if (!isApiReady || isRemoved) return; | ||
// Reset captcha state, removes stored token and unticks checkbox | ||
@@ -156,0 +156,0 @@ hcaptcha.reset(captchaId); |
{ | ||
"name": "@hcaptcha/react-hcaptcha", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "A React library for hCaptcha", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# React hCaptcha Component Library | ||
## Description | ||
hCaptcha Component Library for ReactJS. | ||
@@ -11,5 +12,7 @@ | ||
## Installation | ||
You can install this library via npm with: | ||
``` | ||
npm install react-hcaptcha --save | ||
npm install @hcaptcha/react-hcaptcha --save | ||
``` | ||
@@ -20,6 +23,9 @@ | ||
#### Basic Usage | ||
``` | ||
<your-cool-form> | ||
<hCaptcha :sitekey="**Your sitekey here**" onVerify={this.onVerifyCaptcha}></hCaptcha> | ||
</your-cool-form> | ||
import hCaptcha from '@hcaptcha/react-hcaptcha'; | ||
<FormComponent> | ||
<hCaptcha sitekey="**Your sitekey here**" onVerify={token => handleVerificationSuccess(token)}/> | ||
</FormComponent> | ||
``` | ||
@@ -31,13 +37,14 @@ | ||
Props include: | ||
- sitekey: String, **Required** | ||
- This is your sitekey. It allows you to load hCaptcha, and to configure options like difficulty on the hCaptcha dashboard. | ||
- This is your sitekey. It allows you to load hCaptcha, and to configure options like difficulty on the hCaptcha dashboard. | ||
- size: String (normal, compact, invisible) | ||
- This specifies the "size" of the component. hCaptcha allows you to decide how big the component will appear on render. Defaults to normal. | ||
Want a smaller checkbox? Use compact! Invisible does not show a hCaptcha button, and instead pops up on form submit. | ||
- This specifies the "size" of the component. hCaptcha allows you to decide how big the component will appear on render. Defaults to normal. | ||
Want a smaller checkbox? Use compact! Invisible does not show a hCaptcha button, and instead pops up on form submit. | ||
- theme: String (light, dark) | ||
- hCaptcha supports both a light and dark theme. If no theme is inherently set, the captcha will always default to light. | ||
- hCaptcha supports both a light and dark theme. If no theme is inherently set, the captcha will always default to light. | ||
- tabindex: Integer | ||
- Set the tabindex of the widget and popup. When appropriate, this can make navigation of your site more intuitive. This always defaults to 0. | ||
- Set the tabindex of the widget and popup. When appropriate, this can make navigation of your site more intuitive. This always defaults to 0. | ||
- languageOverride: String | ||
- Manually set the language used to render text in the hCaptcha API. See [language codes](https://hcaptcha.com/docs/languages). | ||
- Manually set the language used to render text in the hCaptcha API. See [language codes](https://hcaptcha.com/docs/languages). | ||
@@ -51,5 +58,7 @@ The component emits events related to verification and expiration. Simply catch these events in the parent component: `onVerify`, `onExpire`, `onError` and handle the events as you choose. The captcha will automatically reset on error, but still emits an error. | ||
## Notes to Maintainers | ||
This repository can be found on **npm** at [@hcaptcha/react-hcaptcha](https://www.npmjs.com/package/@hcaptcha/react-hcaptcha). If any updates are committed to master the **npm** registry should be updated to reflect these changes. See steps below to update the package on **npm**: | ||
This repository can be found on **npm** at [@hcaptcha/react-hcaptcha](https://www.npmjs.com/package/@hcaptcha/react-hcaptcha). If any updates are committed to master the **npm** registry should be updated to reflect these changes. See steps below to update the package on **npm**: | ||
#### Requirements | ||
- NPM Account | ||
@@ -59,3 +68,4 @@ - Set as a `Maintainer` of [@hcaptcha/react-hcaptcha](https://www.npmjs.com/package/@hcaptcha/react-hcaptcha) | ||
#### Publishing | ||
- Always update package version | ||
- Run `npm publish` from inside the current repository |
@@ -110,3 +110,3 @@ const React = require('react'); | ||
if (isApiReady || isRemoved) return | ||
if (!isApiReady || isRemoved) return | ||
// Reset captcha state, removes stored token and unticks checkbox | ||
@@ -113,0 +113,0 @@ hcaptcha.reset(captchaId) |
28859
67