svelte-turnstile
Advanced tools
Comparing version 0.2.1 to 0.3.0
{ | ||
"name": "svelte-turnstile", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"devDependencies": { | ||
@@ -5,0 +5,0 @@ "@sveltejs/adapter-auto": "next", |
@@ -29,12 +29,14 @@ # Svelte Turnstile | ||
| Prop | Type | Description | Required | | ||
|--------------|----------------------------------------|----------------------------------------------------------------------------------------------|----------------------------------------------| | ||
| `siteKey` | `string` | sitekey for your website | ✅ | | ||
| `theme` | `'light' \| 'dark' \| 'auto'` | colour theme of the widget (defaults to `auto`) | ❌ | | ||
| `size` | `'normal' \| 'compact'` | size of the widget (defaults to `normal`) | ❌ | | ||
| `action` | `string` | A string that can be used to differentiate widgets, returned on validation | ❌ | | ||
| `cData` | `string` | A string that can attach customer data to a challange, returned on validation | ❌ | | ||
| `tabIndex` | `number` | Used for accessibility (defaults to `0`) | ❌ | | ||
| `forms` | `boolean` | if true the response token will be a property on the form data (default `true`) | ❌ | | ||
| `formsField` | `string` | the `name` of the input which will appear on the form data (default `cf-turnstile-response`) | ❌ | | ||
| Prop | Type | Description | Required | | ||
|-----------------|----------------------------------------|------------------------------------------------------------------------------------------------|----------| | ||
| `siteKey` | `string` | sitekey for your website | ✅ | | ||
| `theme` | `'light' \| 'dark' \| 'auto'` | colour theme of the widget (defaults to `auto`) | ❌ | | ||
| `size` | `'normal' \| 'compact'` | size of the widget (defaults to `normal`) | ❌ | | ||
| `action` | `string` | A string that can be used to differentiate widgets, returned on validation | ❌ | | ||
| `cData` | `string` | A string that can attach customer data to a challange, returned on validation | ❌ | | ||
| `tabIndex` | `number` | Used for accessibility (defaults to `0`) | ❌ | | ||
| `forms` | `boolean` | if true the response token will be a property on the form data (default `true`) | ❌ | | ||
| `formsField` | `string` | the `name` of the input which will appear on the form data (default `cf-turnstile-response`) | ❌ | | ||
| `retry` | `'auto' \| 'never'` | should the widget automatically retry to obtain a token if it did not succeed (default `auto`) | ❌ | | ||
| `retryInterval` | `number` | if `retry` is true, this controls the time between attempts in milliseconds (default `8000`) | ❌ | | ||
@@ -45,7 +47,8 @@ For more information about some of the props [checkout the Cloudflare Documentation](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations). | ||
| Event | Data | Description | | ||
|----------------------|---------------------|------------------------------------------------------------------------------| | ||
| `turnstile-error` | `{}` | Emitted when a user fails verification | | ||
| `turnstile-expired` | `{}` | Emitted when a challenge expires, this library will auto-renew the challenge | | ||
| `turnstile-callback` | `{ token: string }` | Emitted when a user passes a challenge | | ||
| Event | Data | Description | | ||
|----------------------|---------------------|----------------------------------------------------------------| | ||
| `turnstile-error` | `{}` | Emitted when a user fails verification | | ||
| `turnstile-expired` | `{}` | Emitted when a challenge expires and does not reset the widget | | ||
| `turnstile-timeout` | `{}` | Emitted when a challenge expires and does reset the widget | | ||
| `turnstile-callback` | `{ token: string }` | Emitted when a user passes a challenge | | ||
@@ -52,0 +55,0 @@ # Validate CAPTCHA |
@@ -19,2 +19,3 @@ import { SvelteComponentTyped } from "svelte"; | ||
'expired-callback'?: () => void; | ||
'timeout-callback'?: () => void; | ||
theme?: TurnstileTheme; | ||
@@ -25,3 +26,6 @@ tabindex?: number; | ||
'response-field-name'?: string; | ||
'retry-interval'?: number; | ||
retry?: TurnstileRetry; | ||
} | ||
export declare type TurnstileRetry = 'auto' | 'never'; | ||
export declare type TurnstileSize = 'normal' | 'compact'; | ||
@@ -36,2 +40,4 @@ export declare type TurnstileTheme = 'light' | 'dark' | 'auto'; | ||
cData?: string | undefined; | ||
retryInterval?: number | undefined; | ||
retry?: TurnstileRetry | undefined; | ||
theme?: TurnstileTheme | undefined; | ||
@@ -43,3 +49,2 @@ size?: TurnstileSize | undefined; | ||
events: { | ||
'turnstile-expired': CustomEvent<{}>; | ||
'turnstile-callback': CustomEvent<{ | ||
@@ -49,2 +54,4 @@ token: string; | ||
'turnstile-error': CustomEvent<{}>; | ||
'turnstile-expired': CustomEvent<{}>; | ||
'turnstile-timeout': CustomEvent<{}>; | ||
} & { | ||
@@ -51,0 +58,0 @@ [evt: string]: CustomEvent<any>; |
Sorry, the diff of this file is not supported yet
12305
65
143