@semantic-components/re-captcha
Version:
**@semantic-components/re-captcha** is an Angular library designed to simplify the integration of Google reCAPTCHA into your Angular applications. It supports reCAPTCHA v2 and v3, providing an easy-to-use API and seamless setup for enhancing your app's se
46 lines (45 loc) • 1.37 kB
TypeScript
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
declare global {
interface Window {
onRecaptchaError?: () => void;
onRecaptchaSuccess?: (token: string) => void;
onRecaptchaExpired?: () => void;
onRecaptchaLoaded?: () => void;
grecaptcha?: any;
}
}
export declare class ScReCaptchaService {
private readonly zone;
private readonly v3SiteKey;
private readonly languageCode;
private readonly scriptId;
private readonly apiUrl;
private readonly scriptStatus$;
private scriptLoading;
constructor();
/**
* Check if the script already exists in the document
*/
private checkScriptExists;
/**
* Load the reCAPTCHA script dynamically
* @param onload Optional callback function name for script load
* @returns Observable that emits true when script is loaded
*/
loadScript(onload?: string): Observable<boolean>;
/**
* Remove the reCAPTCHA script from the DOM
*/
removeScript(): void;
/**
* Check if the script is loaded
*/
isLoaded(): Observable<boolean | null>;
/**
* Reset all reCAPTCHA instances on the page
*/
resetAll(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ScReCaptchaService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ScReCaptchaService>;
}