Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add parameters retry and size #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ The component supports these options as input:
- `cData`
- `theme`
- `tabIndex`
- `retry`
- `size`

These options are well documented in the [Cloudflare Docs](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/#configurations). The letter cases are adapted to camelCase to facilitate easy migration from `ng-recaptcha`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { NgxTurnstileModule, NgxTurnstileFormsModule } from 'ngx-turnstile';
><ngx-turnstile
[siteKey]="siteKey"
theme="light"
retry="never"
size="normal"
Comment on lines +12 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the new inputs here.

Suggested change
retry="never"
size="normal"

And then add a new route to our demo app which shows the different sizes.

In this folder:
https://github.com/verto-health/ngx-turnstile/tree/main/projects/ngx-turnstile-demo/src/app/examples

[(ngModel)]="token"
></ngx-turnstile>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface TurnstileOptions {
language?: string;
tabindex?: number;
appearance?: 'always' | 'execute' | 'interaction-only';
retry?: 'never' | 'auto';
size?: 'normal' | 'flexible' | 'compact';
}
4 changes: 4 additions & 0 deletions projects/ngx-turnstile/src/lib/ngx-turnstile.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export class NgxTurnstileComponent implements OnDestroy {
@Input() version: SupportedVersion = '0';
@Input() tabIndex?: number;
@Input() appearance?: 'always' | 'execute' | 'interaction-only' = 'always';
@Input() retry?: 'never' | 'auto' = 'auto';
@Input() size?: 'normal' | 'flexible' | 'compact' = 'normal';

@Output() resolved = new EventEmitter<string | null>();
@Output() errored = new EventEmitter<string | null>();
Expand Down Expand Up @@ -79,6 +81,8 @@ export class NgxTurnstileComponent implements OnDestroy {
action: this.action,
cData: this.cData,
appearance: this.appearance,
retry: this.retry,
size: this.size,
callback: (token: string) => {
this.zone.run(() => this.resolved.emit(token));
},
Expand Down
Loading