vue3-smart-captcha
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -35,3 +35,3 @@ import { ComponentOptionsMixin } from 'vue'; | ||
declare type CaptchaSubscriptionEventCallback = BaseEventCallback | SuccessEventCallback | JavascriptErrorEventCallback; | ||
declare type CaptchaSubscriptionEventCallback = BaseEventCallback | SuccessEventCallback | JavascriptErrorEventCallback | ||
@@ -102,2 +102,11 @@ declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SmartCaptchaComponentProps>, { | ||
export declare class SmartCaptchaUtils { | ||
readonly SCRIPT_RENDER_ONLOAD_SRC = "https://smartcaptcha.yandexcloud.net/captcha.js?render=onload"; | ||
execute(widgetID?: WidgetId): void; | ||
reset(widgetID?: WidgetId): void; | ||
destroy(widgetID?: WidgetId): void; | ||
getResponse(widgetID?: WidgetId): Token | undefined; | ||
subscribe(widgetId: WidgetId, event: SubscribeEvent, cb: CaptchaSubscriptionEventCallback): void; | ||
} | ||
/** | ||
@@ -104,0 +113,0 @@ * @link https://cloud.yandex.ru/docs/smartcaptcha/concepts/widget-methods#subscribe |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"type": "module", | ||
@@ -15,0 +15,0 @@ "main": "./dist/index.cjs", |
@@ -115,2 +115,11 @@ # Yandex SmartCaptcha for Vue3 projects | ||
> Package checks if `window.smartCaptcha` object was defined. However when using multiple captcha instances at once all of them will have `window.smartCaptcha === undefined` on initial load. Therefore it is better either load script on your own and disable widget loading for every captcha or disable it for every captcha but first, e.g. | ||
```vue | ||
<template> | ||
<SmartCaptcha /> | ||
<SmartCaptcha :load-widget="false" /> | ||
</template> | ||
``` | ||
### Rendering timeout | ||
@@ -254,2 +263,14 @@ | ||
> Package checks if `window.smartCaptcha` object was defined. However when using multiple captcha instances at once all of them will have `window.smartCaptcha === undefined` on initial load.. Therefore it is better either load script on your own and disable widget loading for every captcha or disable it for every captcha but first, e.g. | ||
```js | ||
const firstCaptcha = useSmartCaptcha(container, { | ||
// render props | ||
}) | ||
const secondCaptcha = useSmartCaptcha(container, { | ||
// render props | ||
}, false) // disable script appending as it will be appended by first captcha | ||
``` | ||
### Rendering timeout | ||
@@ -413,2 +434,15 @@ | ||
## Utilities | ||
Package provides utility class with every method but `render` in order if you need call captcha methods "manually" outside of current captcha (since both composable and captcha do not allows you to specify "custom" widget id) | ||
```js | ||
import { SmartCaptchaUtils } from 'vue3-smart-captcha' | ||
const widgetId = 0 // example | ||
const utils = new SmartCaptchaUtils() | ||
utils.execute(widgetId) | ||
``` | ||
## License | ||
@@ -415,0 +449,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
304
1
452
25772
5
1