vue3-smart-captcha
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -12,10 +12,6 @@ { | ||
"license": "MIT", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/SmartCaptcha.d.ts", | ||
@@ -22,0 +18,0 @@ "files": [ |
@@ -5,10 +5,15 @@ # Yandex SmartCaptcha for Vue3 projects | ||
[Create](https://cloud.yandex.ru/docs/smartcaptcha/operations/create-captcha) Captcha and [get](https://cloud.yandex.ru/docs/smartcaptcha/operations/get-keys) keys. You need client site key to activate captcha | ||
You need to [create](https://cloud.yandex.ru/docs/smartcaptcha/operations/create-captcha) Captcha and [get](https://cloud.yandex.ru/docs/smartcaptcha/operations/get-keys) keys. You need client site key in order to activate captcha component and it is the only required property | ||
> NOTE: this package does NOT provides verification | ||
> NOTE: this package does NOT provides verification of response - you still need to [implement](https://cloud.yandex.ru/docs/smartcaptcha/concepts/validation) it | ||
## Installation | ||
Install it using npm | ||
```sh | ||
npm install vue3-smart-captcha | ||
# Or using pnpm | ||
pnpm add vue3-smart-captcha | ||
``` | ||
@@ -18,2 +23,4 @@ | ||
No need to add widget script in the head section of your site | ||
### As plugin | ||
@@ -26,3 +33,4 @@ | ||
const app = createApp(App) | ||
const app = createApp({}) | ||
app.use(SmartCaptchaPlugin) | ||
@@ -45,6 +53,30 @@ ``` | ||
You may add `style="height: 100px"` in order to [prevent](https://cloud.yandex.ru/docs/smartcaptcha/operations/advanced-method) layout jump | ||
```vue | ||
<template> | ||
<SmartCaptcha style="height: 100px" :sitekey="sitekey" /> | ||
</template> | ||
``` | ||
## Options | ||
**TODO** | ||
Only `sitekey` is required | ||
| Property | Default | Type | | ||
|----------------------|-----------------------------|----------------------------------------------------------------------------------------------| | ||
| **sitekey** | - | `string` | | ||
| callback | `undefined` | `(token: string) => void` | | ||
| hl | `window.navigator.language` | `'ru' | 'en' | 'be' | 'kk' | 'tt' | 'uk' | 'uz' | 'tr'` | | ||
| test | `false` | `boolean` | | ||
| webview | `false` | `boolean` | | ||
| invisible | `false` | `boolean` | | ||
| shieldPosition | `center-right` | `'top-left' | 'center-left' | 'bottom-left' | 'top-right' | 'center-right' | 'bottom-right'` | | ||
| hideShield | `false` | `boolean` | | ||
| on-success | `undefined` | `(token: string) => void` | | ||
| on-network-error | `undefined` | `() => void` | | ||
| on-challenge-visible | `undefined` | `() => void` | | ||
| on-challenge-hidden | `undefined` | `() => void` | | ||
| on-token-expired | `undefined` | `() => void` | | ||
Basically it gets every parameter of `window.smartCaptcha` [object](https://cloud.yandex.ru/docs/smartcaptcha/concepts/widget-methods#methods) plus 5 callbacks for every [subscription](https://cloud.yandex.ru/docs/smartcaptcha/concepts/widget-methods#subscribe) events named as `on` + event name in camelCase ('success' => 'onSuccess', 'network-error' => 'onNetworkError', etc) | ||
@@ -51,0 +83,0 @@ |
13824
7
162
87
4