ng-recaptcha-2 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ng-recaptcha-2.mjs","sources":["../../../projects/ng-recaptcha/src/lib/tokens.ts","../../../projects/ng-recaptcha/src/lib/load-script.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-loader.service.ts","../../../projects/ng-recaptcha/src/lib/recaptcha.component.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-common.module.ts","../../../projects/ng-recaptcha/src/lib/recaptcha.module.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-v3.service.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-v3.module.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-value-accessor.directive.ts","../../../projects/ng-recaptcha/src/lib/recaptcha-forms.module.ts","../../../projects/ng-recaptcha/src/ng-recaptcha-2.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\n\nimport { RecaptchaSettings } from \"./recaptcha-settings\";\n\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nexport const RECAPTCHA_LANGUAGE = new InjectionToken<string>(\"recaptcha-language\");\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nexport const RECAPTCHA_BASE_URL = new InjectionToken<string>(\"recaptcha-base-url\");\n/** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */\nexport const RECAPTCHA_NONCE = new InjectionToken<string>(\"recaptcha-nonce-tag\");\nexport const RECAPTCHA_SETTINGS = new InjectionToken<RecaptchaSettings>(\"recaptcha-settings\");\nexport const RECAPTCHA_V3_SITE_KEY = new InjectionToken<string>(\"recaptcha-v3-site-key\");\n\n/**\n * Specifies the options for loading the reCAPTCHA script tag.\n */\nexport type RecaptchaLoaderOptions = {\n /**\n * Invoked before the `<script>` tag is appended to the DOM.\n * Use this function as an opportunity to set `nonce`, as well as modify the URL of the tag.\n *\n * Use the `url.searchParams` to set additional query string attributes (including reCAPTCHA language),\n * or use an entirely different base URL altogether.\n *\n * The URL that you provide will then properly set the `\"render\"` and `\"onload\"` attributes which are required for proper `ng-recaptcha` wire-up.\n *\n * @param url the current URL that was composed. Either modify it in-place, or return a completely new URL.\n * @returns the final URL that is going to be used as the `src` for the `<script>` tag, along with (optionally) a nonce.\n *\n * @example\n * Provide nonce:\n * ```ts\n * {\n * provide: RECAPTCHA_LOADER_OPTIONS,\n * useValue: {\n * onBeforeLoad(url) {\n * return {\n * url,\n * nonce: \"YOUR_NONCE\"\n * };\n * }\n * }\n * }\n * ```\n *\n * Set the reCAPTCHA language:\n * ```ts\n * {\n * provide: RECAPTCHA_LOADER_OPTIONS,\n * useValue: {\n * onBeforeLoad(url) {\n * url.searchParams.set(\"hl\", \"en-GB\")\n *\n * return { url };\n * }\n * }\n * }\n * ```\n *\n * Use a different base URL for loading reCAPTCHA\n * ```ts\n * {\n * provide: RECAPTCHA_LOADER_OPTIONS,\n * useValue: {\n * onBeforeLoad(_url) {\n * const chinaCompatibleUrl = new URL(\"https://www.recaptcha.net/recaptcha/api.js\");\n * // optionally, set the locale:\n * // chinaCompatibleUrl.searchParams.set(\"hl\", \"zh-CN\");\n *\n * return {\n * url: chinaCompatibleUrl\n * };\n * }\n * }\n * }\n * ```\n */\n onBeforeLoad?(url: URL): { url: URL; nonce?: string };\n\n /**\n * Allows you to change the `grecaptcha` that the `ng-recaptcha` will be relying on.\n * This method is useful when you need to use `grecaptcha.enterprise` instead of the base `grecaptcha`\n *\n * @param recaptcha the value of `window.grecaptcha` upon script load.\n * @returns the {ReCaptchaV2.ReCaptcha} instance that the `ng-recaptcha` lib will use.\n *\n * @example\n * Using the Enterprise version of `grecaptcha`:\n *\n * ```ts\n * {\n * provide: RECAPTCHA_LOADER_OPTIONS,\n * useValue: {\n * onBeforeLoad() {\n * const recaptchaEnterpriseUrl = new URL(\"https://www.google.com/recaptcha/enterprise.js\");\n * // optionally, if you're using the reCAPTCHA session-tokens, set the `&waf=session` param,\n * // see https://cloud.google.com/recaptcha-enterprise/docs/implement-waf-ca#session-token\n * // recaptchaEnterpriseUrl.searchParams.set(\"waf\", \"session\");\n *\n * return {\n * url: recaptchaEnterpriseUrl,\n * }\n * },\n * onLoaded(recaptcha) {\n * return recaptcha.enterprise;\n * }\n * }\n * }\n * ```\n */\n onLoaded?(recaptcha: ReCaptchaV2.ReCaptcha): ReCaptchaV2.ReCaptcha;\n};\n\n/**\n * See the documentation for `RecaptchaLoaderOptions`.\n */\nexport const RECAPTCHA_LOADER_OPTIONS = new InjectionToken<RecaptchaLoaderOptions>(\"recaptcha-loader-options\");\n","import { RecaptchaLoaderOptions } from \"./tokens\";\n\ndeclare global {\n interface Window {\n ng2recaptchaloaded?(): void;\n }\n}\n\nexport type RenderMode = \"explicit\" | { key: string };\n\nfunction loadScript(\n renderMode: RenderMode,\n onBeforeLoad: (url: URL) => { url: URL; nonce?: string },\n onLoaded: (grecaptcha: ReCaptchaV2.ReCaptcha) => void,\n { url, lang, nonce }: { url?: string; lang?: string; nonce?: string } = {},\n): void {\n window.ng2recaptchaloaded = () => {\n onLoaded(grecaptcha);\n };\n const script = document.createElement(\"script\");\n script.innerHTML = \"\";\n\n const { url: baseUrl, nonce: onBeforeLoadNonce } = onBeforeLoad(\n new URL(url || \"https://www.google.com/recaptcha/api.js\"),\n );\n baseUrl.searchParams.set(\"render\", renderMode === \"explicit\" ? renderMode : renderMode.key);\n baseUrl.searchParams.set(\"onload\", \"ng2recaptchaloaded\");\n baseUrl.searchParams.set(\"trustedtypes\", \"true\");\n if (lang) {\n baseUrl.searchParams.set(\"hl\", lang);\n }\n\n script.src = baseUrl.href;\n\n const nonceValue = onBeforeLoadNonce || nonce;\n\n if (nonceValue) {\n script.setAttribute(\"nonce\", nonceValue);\n }\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n}\n\nfunction newLoadScript({\n v3SiteKey,\n onBeforeLoad,\n onLoaded,\n}: { v3SiteKey: string | undefined; onLoaded(recaptcha: ReCaptchaV2.ReCaptcha): void } & Pick<\n Required<RecaptchaLoaderOptions>,\n \"onBeforeLoad\"\n>) {\n const renderMode: RenderMode = v3SiteKey ? { key: v3SiteKey } : \"explicit\";\n\n loader.loadScript(renderMode, onBeforeLoad, onLoaded);\n}\n\nexport const loader = { loadScript, newLoadScript };\n","import { isPlatformBrowser } from \"@angular/common\";\nimport { Inject, Injectable, Optional, PLATFORM_ID } from \"@angular/core\";\nimport { BehaviorSubject, Observable, of } from \"rxjs\";\nimport { filter } from \"rxjs/operators\";\n\nimport { loader } from \"./load-script\";\nimport {\n RECAPTCHA_LOADER_OPTIONS,\n RECAPTCHA_BASE_URL,\n RECAPTCHA_LANGUAGE,\n RECAPTCHA_NONCE,\n RECAPTCHA_V3_SITE_KEY,\n RecaptchaLoaderOptions,\n} from \"./tokens\";\n\nfunction toNonNullObservable<T>(subject: BehaviorSubject<T | null>): Observable<T> {\n return subject.asObservable().pipe(filter<T>((value) => value !== null));\n}\n\n@Injectable()\nexport class RecaptchaLoaderService {\n /**\n * @internal\n * @nocollapse\n */\n private static ready: BehaviorSubject<ReCaptchaV2.ReCaptcha | null> | null = null;\n\n public ready: Observable<ReCaptchaV2.ReCaptcha>;\n\n /** @internal */\n private language?: string;\n /** @internal */\n private baseUrl?: string;\n /** @internal */\n private nonce?: string;\n /** @internal */\n private v3SiteKey?: string;\n /** @internal */\n private options?: RecaptchaLoaderOptions;\n\n constructor(\n // eslint-disable-next-line @typescript-eslint/ban-types\n @Inject(PLATFORM_ID) private readonly platformId: Object,\n // eslint-disable-next-line deprecation/deprecation\n @Optional() @Inject(RECAPTCHA_LANGUAGE) language?: string,\n // eslint-disable-next-line deprecation/deprecation\n @Optional() @Inject(RECAPTCHA_BASE_URL) baseUrl?: string,\n // eslint-disable-next-line deprecation/deprecation\n @Optional() @Inject(RECAPTCHA_NONCE) nonce?: string,\n @Optional() @Inject(RECAPTCHA_V3_SITE_KEY) v3SiteKey?: string,\n @Optional() @Inject(RECAPTCHA_LOADER_OPTIONS) options?: RecaptchaLoaderOptions,\n ) {\n this.language = language;\n this.baseUrl = baseUrl;\n this.nonce = nonce;\n this.v3SiteKey = v3SiteKey;\n this.options = options;\n const subject = this.init();\n this.ready = subject ? toNonNullObservable(subject) : of();\n }\n\n /** @internal */\n private init(): BehaviorSubject<ReCaptchaV2.ReCaptcha | null> | undefined {\n if (RecaptchaLoaderService.ready) {\n return RecaptchaLoaderService.ready;\n }\n\n if (!isPlatformBrowser(this.platformId)) {\n return undefined;\n }\n\n const subject = new BehaviorSubject<ReCaptchaV2.ReCaptcha | null>(null);\n RecaptchaLoaderService.ready = subject;\n\n loader.newLoadScript({\n v3SiteKey: this.v3SiteKey,\n onBeforeLoad: (url) => {\n if (this.options?.onBeforeLoad) {\n return this.options.onBeforeLoad(url);\n }\n\n const newUrl = new URL(this.baseUrl ?? url);\n\n if (this.language) {\n newUrl.searchParams.set(\"hl\", this.language);\n }\n\n return {\n url: newUrl,\n nonce: this.nonce,\n };\n },\n onLoaded: (recaptcha) => {\n let value = recaptcha;\n if (this.options?.onLoaded) {\n value = this.options.onLoaded(recaptcha);\n }\n\n subject.next(value);\n },\n });\n\n return subject;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n HostBinding,\n Inject,\n Input,\n NgZone,\n OnDestroy,\n Optional,\n Output,\n} from \"@angular/core\";\nimport { Subscription } from \"rxjs\";\n\nimport { RecaptchaLoaderService } from \"./recaptcha-loader.service\";\nimport { RecaptchaSettings } from \"./recaptcha-settings\";\nimport { RECAPTCHA_SETTINGS } from \"./tokens\";\n\nlet nextId = 0;\n\nexport type NeverUndefined<T> = T extends undefined ? never : T;\n\nexport type RecaptchaErrorParameters = Parameters<NeverUndefined<ReCaptchaV2.Parameters[\"error-callback\"]>>;\n\n@Component({\n exportAs: \"reCaptcha\",\n selector: \"re-captcha\",\n template: ``,\n})\nexport class RecaptchaComponent implements AfterViewInit, OnDestroy {\n @Input()\n @HostBinding(\"attr.id\")\n public id = `ngrecaptcha-${nextId++}`;\n\n @Input() public siteKey?: string;\n @Input() public theme?: ReCaptchaV2.Theme;\n @Input() public type?: ReCaptchaV2.Type;\n @Input() public size?: ReCaptchaV2.Size;\n @Input() public tabIndex?: number;\n @Input() public badge?: ReCaptchaV2.Badge;\n @Input() public errorMode: \"handled\" | \"default\" = \"default\";\n\n @Output() public resolved = new EventEmitter<string | null>();\n /**\n * @deprecated `(error) output will be removed in the next major version. Use (errored) instead\n */\n // eslint-disable-next-line @angular-eslint/no-output-native\n @Output() public error = new EventEmitter<RecaptchaErrorParameters>();\n @Output() public errored = new EventEmitter<RecaptchaErrorParameters>();\n\n /** @internal */\n private subscription: Subscription;\n /** @internal */\n private widget: number;\n /** @internal */\n private grecaptcha: ReCaptchaV2.ReCaptcha;\n /** @internal */\n private executeRequested: boolean;\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private loader: RecaptchaLoaderService,\n private zone: NgZone,\n @Optional() @Inject(RECAPTCHA_SETTINGS) settings?: RecaptchaSettings,\n ) {\n if (settings) {\n this.siteKey = settings.siteKey;\n this.theme = settings.theme;\n this.type = settings.type;\n this.size = settings.size;\n this.badge = settings.badge;\n }\n }\n\n public ngAfterViewInit(): void {\n this.subscription = this.loader.ready.subscribe((grecaptcha: ReCaptchaV2.ReCaptcha) => {\n if (grecaptcha != null && grecaptcha.render instanceof Function) {\n this.grecaptcha = grecaptcha;\n this.renderRecaptcha();\n }\n });\n }\n\n public ngOnDestroy(): void {\n // reset the captcha to ensure it does not leave anything behind\n // after the component is no longer needed\n this.grecaptchaReset();\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n\n /**\n * Executes the invisible recaptcha.\n * Does nothing if component's size is not set to \"invisible\".\n */\n public execute(): void {\n if (this.size !== \"invisible\") {\n return;\n }\n\n if (this.widget != null) {\n void this.grecaptcha.execute(this.widget);\n } else {\n // delay execution of recaptcha until it actually renders\n this.executeRequested = true;\n }\n }\n\n public reset(): void {\n if (this.widget != null) {\n if (this.grecaptcha.getResponse(this.widget)) {\n // Only emit an event in case if something would actually change.\n // That way we do not trigger \"touching\" of the control if someone does a \"reset\"\n // on a non-resolved captcha.\n this.resolved.emit(null);\n }\n\n this.grecaptchaReset();\n }\n }\n\n /**\n * ⚠️ Warning! Use this property at your own risk!\n *\n * While this member is `public`, it is not a part of the component's public API.\n * The semantic versioning guarantees _will not be honored_! Thus, you might find that this property behavior changes in incompatible ways in minor or even patch releases.\n * You are **strongly advised** against using this property.\n * Instead, use more idiomatic ways to get reCAPTCHA value, such as `resolved` EventEmitter, or form-bound methods (ngModel, formControl, and the likes).å\n */\n public get __unsafe_widgetValue(): string | null {\n return this.widget != null ? this.grecaptcha.getResponse(this.widget) : null;\n }\n\n /** @internal */\n private expired() {\n this.resolved.emit(null);\n }\n\n /** @internal */\n private onError(args: RecaptchaErrorParameters) {\n // eslint-disable-next-line deprecation/deprecation\n this.error.emit(args);\n this.errored.emit(args);\n }\n\n /** @internal */\n private captchaResponseCallback(response: string) {\n this.resolved.emit(response);\n }\n\n /** @internal */\n private grecaptchaReset() {\n if (this.widget != null) {\n this.zone.runOutsideAngular(() => this.grecaptcha.reset(this.widget));\n }\n }\n\n /** @internal */\n private renderRecaptcha() {\n // This `any` can be removed after @types/grecaptcha get updated\n const renderOptions: ReCaptchaV2.Parameters = {\n badge: this.badge,\n callback: (response: string) => {\n this.zone.run(() => this.captchaResponseCallback(response));\n },\n \"expired-callback\": () => {\n this.zone.run(() => this.expired());\n },\n sitekey: this.siteKey,\n size: this.size,\n tabindex: this.tabIndex,\n theme: this.theme,\n type: this.type,\n };\n\n if (this.errorMode === \"handled\") {\n renderOptions[\"error-callback\"] = (...args: RecaptchaErrorParameters) => {\n this.zone.run(() => this.onError(args));\n };\n }\n\n this.widget = this.grecaptcha.render(this.elementRef.nativeElement, renderOptions);\n\n if (this.executeRequested === true) {\n this.executeRequested = false;\n this.execute();\n }\n }\n}\n","import { NgModule } from \"@angular/core\";\n\nimport { RecaptchaComponent } from \"./recaptcha.component\";\n\n@NgModule({\n declarations: [RecaptchaComponent],\n exports: [RecaptchaComponent],\n})\nexport class RecaptchaCommonModule {}\n","import { NgModule } from \"@angular/core\";\n\nimport { RecaptchaCommonModule } from \"./recaptcha-common.module\";\nimport { RecaptchaLoaderService } from \"./recaptcha-loader.service\";\nimport { RecaptchaComponent } from \"./recaptcha.component\";\n\n@NgModule({\n exports: [RecaptchaComponent],\n imports: [RecaptchaCommonModule],\n providers: [RecaptchaLoaderService],\n})\nexport class RecaptchaModule {}\n","import { Inject, Injectable, NgZone } from \"@angular/core\";\nimport { Observable, Subject } from \"rxjs\";\n\nimport { RECAPTCHA_V3_SITE_KEY } from \"./tokens\";\nimport { RecaptchaLoaderService } from \"./recaptcha-loader.service\";\n\nexport interface OnExecuteData {\n /**\n * The name of the action that has been executed.\n */\n action: string;\n /**\n * The token that reCAPTCHA v3 provided when executing the action.\n */\n token: string;\n}\n\nexport interface OnExecuteErrorData {\n /**\n * The name of the action that has been executed.\n */\n action: string;\n /**\n * The error which was encountered\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: any;\n}\n\ntype ActionBacklogEntry = [string, Subject<string>];\n\n/**\n * The main service for working with reCAPTCHA v3 APIs.\n *\n * Use the `execute` method for executing a single action, and\n * `onExecute` observable for listening to all actions at once.\n */\n@Injectable()\nexport class ReCaptchaV3Service {\n /** @internal */\n private readonly siteKey: string;\n /** @internal */\n private readonly zone: NgZone;\n /** @internal */\n private actionBacklog: ActionBacklogEntry[] | undefined;\n /** @internal */\n private grecaptcha: ReCaptchaV2.ReCaptcha;\n\n /** @internal */\n private onExecuteSubject: Subject<OnExecuteData>;\n /** @internal */\n private onExecuteErrorSubject: Subject<OnExecuteErrorData>;\n /** @internal */\n private onExecuteObservable: Observable<OnExecuteData>;\n /** @internal */\n private onExecuteErrorObservable: Observable<OnExecuteErrorData>;\n\n constructor(\n zone: NgZone,\n public recaptchaLoader: RecaptchaLoaderService,\n @Inject(RECAPTCHA_V3_SITE_KEY) siteKey: string,\n ) {\n this.zone = zone;\n this.siteKey = siteKey;\n\n this.init();\n }\n\n public get onExecute(): Observable<OnExecuteData> {\n if (!this.onExecuteSubject) {\n this.onExecuteSubject = new Subject<OnExecuteData>();\n this.onExecuteObservable = this.onExecuteSubject.asObservable();\n }\n\n return this.onExecuteObservable;\n }\n\n public get onExecuteError(): Observable<OnExecuteErrorData> {\n if (!this.onExecuteErrorSubject) {\n this.onExecuteErrorSubject = new Subject<OnExecuteErrorData>();\n this.onExecuteErrorObservable = this.onExecuteErrorSubject.asObservable();\n }\n\n return this.onExecuteErrorObservable;\n }\n\n /**\n * Executes the provided `action` with reCAPTCHA v3 API.\n * Use the emitted token value for verification purposes on the backend.\n *\n * For more information about reCAPTCHA v3 actions and tokens refer to the official documentation at\n * https://developers.google.com/recaptcha/docs/v3.\n *\n * @param {string} action the action to execute\n * @returns {Observable<string>} an `Observable` that will emit the reCAPTCHA v3 string `token` value whenever ready.\n * The returned `Observable` completes immediately after emitting a value.\n */\n public execute(action: string): Observable<string> {\n const subject = new Subject<string>();\n if (!this.grecaptcha) {\n if (!this.actionBacklog) {\n this.actionBacklog = [];\n }\n\n this.actionBacklog.push([action, subject]);\n } else {\n this.executeActionWithSubject(action, subject);\n }\n\n return subject.asObservable();\n }\n\n /** @internal */\n private executeActionWithSubject(action: string, subject: Subject<string>): void {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const onError = (error: any) => {\n this.zone.run(() => {\n subject.error(error);\n if (this.onExecuteErrorSubject) {\n // We don't know any better at this point, unfortunately, so have to resort to `any`\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n this.onExecuteErrorSubject.next({ action, error });\n }\n });\n };\n\n this.zone.runOutsideAngular(() => {\n try {\n this.grecaptcha.execute(this.siteKey, { action }).then((token: string) => {\n this.zone.run(() => {\n subject.next(token);\n subject.complete();\n if (this.onExecuteSubject) {\n this.onExecuteSubject.next({ action, token });\n }\n });\n }, onError);\n } catch (e) {\n onError(e);\n }\n });\n }\n\n /** @internal */\n private init() {\n this.recaptchaLoader.ready.subscribe((value) => {\n this.grecaptcha = value;\n if (this.actionBacklog && this.actionBacklog.length > 0) {\n this.actionBacklog.forEach(([action, subject]) => this.executeActionWithSubject(action, subject));\n this.actionBacklog = undefined;\n }\n });\n }\n}\n","import { NgModule } from \"@angular/core\";\n\nimport { ReCaptchaV3Service } from \"./recaptcha-v3.service\";\nimport { RecaptchaLoaderService } from \"./recaptcha-loader.service\";\n\n@NgModule({\n providers: [ReCaptchaV3Service, RecaptchaLoaderService],\n})\nexport class RecaptchaV3Module {}\n","import { Directive, forwardRef, HostListener } from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { RecaptchaComponent } from \"./recaptcha.component\";\n\n@Directive({\n providers: [\n {\n multi: true,\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => RecaptchaValueAccessorDirective),\n },\n ],\n selector: \"re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]\",\n})\nexport class RecaptchaValueAccessorDirective implements ControlValueAccessor {\n /** @internal */\n private onChange: (value: string | null) => void;\n\n /** @internal */\n private onTouched: () => void;\n\n private requiresControllerReset = false;\n\n constructor(private host: RecaptchaComponent) {}\n\n public writeValue(value: string): void {\n if (!value) {\n this.host.reset();\n } else {\n // In this case, it is most likely that a form controller has requested to write a specific value into the component.\n // This isn't really a supported case - reCAPTCHA values are single-use, and, in a sense, readonly.\n // What this means is that the form controller has recaptcha control state of X, while reCAPTCHA itself can't \"restore\"\n // to that state. In order to make form controller aware of this discrepancy, and to fix the said misalignment,\n // we'll be telling the controller to \"reset\" the value back to null.\n if (this.host.__unsafe_widgetValue !== value && Boolean(this.host.__unsafe_widgetValue) === false) {\n this.requiresControllerReset = true;\n }\n }\n }\n\n public registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n if (this.requiresControllerReset) {\n this.requiresControllerReset = false;\n this.onChange(null);\n }\n }\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n @HostListener(\"resolved\", [\"$event\"]) public onResolve($event: string): void {\n if (this.onChange) {\n this.onChange($event);\n }\n if (this.onTouched) {\n this.onTouched();\n }\n }\n}\n","import { NgModule } from \"@angular/core\";\nimport { FormsModule } from \"@angular/forms\";\n\nimport { RecaptchaCommonModule } from \"./recaptcha-common.module\";\nimport { RecaptchaValueAccessorDirective } from \"./recaptcha-value-accessor.directive\";\n\n@NgModule({\n declarations: [RecaptchaValueAccessorDirective],\n exports: [RecaptchaValueAccessorDirective],\n imports: [FormsModule, RecaptchaCommonModule],\n})\nexport class RecaptchaFormsModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.RecaptchaComponent"],"mappings":";;;;;;;AAIA;MACa,kBAAkB,GAAG,IAAI,cAAc,CAAS,oBAAoB,EAAE;AACnF;MACa,kBAAkB,GAAG,IAAI,cAAc,CAAS,oBAAoB,EAAE;AACnF;MACa,eAAe,GAAG,IAAI,cAAc,CAAS,qBAAqB,EAAE;MACpE,kBAAkB,GAAG,IAAI,cAAc,CAAoB,oBAAoB,EAAE;MACjF,qBAAqB,GAAG,IAAI,cAAc,CAAS,uBAAuB,EAAE;AAsGzF;;AAEG;MACU,wBAAwB,GAAG,IAAI,cAAc,CAAyB,0BAA0B;;AC1G7G,SAAS,UAAU,CACjB,UAAsB,EACtB,YAAwD,EACxD,QAAqD,EACrD,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,KAAsD,EAAE,EAAA;AAE1E,IAAA,MAAM,CAAC,kBAAkB,GAAG,MAAK;QAC/B,QAAQ,CAAC,UAAU,CAAC,CAAC;AACvB,KAAC,CAAC;IACF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD,IAAA,MAAM,CAAC,S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LoaderService } from "./lib/recaptcha-loader.service";
3
+ export { RecaptchaModule } from "./lib/recaptcha.module";
4
+ export { RecaptchaSettings } from "./lib/recaptcha-settings";
5
+ export { RecaptchaV3Module } from "./lib/recaptcha-v3.module";
6
+ export { OnExecuteData, OnExecuteErrorData, ReCaptchaV3Service } from "./lib/recaptcha-v3.service";
7
+ export { RecaptchaFormsModule } from "./lib/recaptcha-forms.module";
8
+ export { RecaptchaValueAccessorDirective } from "./lib/recaptcha-value-accessor.directive";
9
+ export { RECAPTCHA_LANGUAGE, RECAPTCHA_BASE_URL, RECAPTCHA_NONCE, RECAPTCHA_SETTINGS, RECAPTCHA_V3_SITE_KEY, RECAPTCHA_LOADER_OPTIONS, RecaptchaLoaderOptions, } from "./lib/tokens";
@@ -0,0 +1,27 @@
1
+ /// <reference types="grecaptcha" />
2
+ import { RecaptchaLoaderOptions } from "./tokens";
3
+ declare global {
4
+ interface Window {
5
+ ng2recaptchaloaded?(): void;
6
+ }
7
+ }
8
+ export type RenderMode = "explicit" | {
9
+ key: string;
10
+ };
11
+ declare function loadScript(renderMode: RenderMode, onBeforeLoad: (url: URL) => {
12
+ url: URL;
13
+ nonce?: string;
14
+ }, onLoaded: (grecaptcha: ReCaptchaV2.ReCaptcha) => void, { url, lang, nonce }?: {
15
+ url?: string;
16
+ lang?: string;
17
+ nonce?: string;
18
+ }): void;
19
+ declare function newLoadScript({ v3SiteKey, onBeforeLoad, onLoaded, }: {
20
+ v3SiteKey: string | undefined;
21
+ onLoaded(recaptcha: ReCaptchaV2.ReCaptcha): void;
22
+ } & Pick<Required<RecaptchaLoaderOptions>, "onBeforeLoad">): void;
23
+ export declare const loader: {
24
+ loadScript: typeof loadScript;
25
+ newLoadScript: typeof newLoadScript;
26
+ };
27
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./recaptcha.component";
3
+ export declare class RecaptchaCommonModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaCommonModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaCommonModule, [typeof i1.RecaptchaComponent], never, [typeof i1.RecaptchaComponent]>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaCommonModule>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./recaptcha-value-accessor.directive";
3
+ import * as i2 from "@angular/forms";
4
+ import * as i3 from "./recaptcha-common.module";
5
+ export declare class RecaptchaFormsModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaFormsModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaFormsModule, [typeof i1.RecaptchaValueAccessorDirective], [typeof i2.FormsModule, typeof i3.RecaptchaCommonModule], [typeof i1.RecaptchaValueAccessorDirective]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaFormsModule>;
9
+ }
@@ -0,0 +1,28 @@
1
+ /// <reference types="grecaptcha" />
2
+ import { Observable } from "rxjs";
3
+ import { RecaptchaLoaderOptions } from "./tokens";
4
+ import * as i0 from "@angular/core";
5
+ export declare class RecaptchaLoaderService {
6
+ private readonly platformId;
7
+ /**
8
+ * @internal
9
+ * @nocollapse
10
+ */
11
+ private static ready;
12
+ ready: Observable<ReCaptchaV2.ReCaptcha>;
13
+ /** @internal */
14
+ private language?;
15
+ /** @internal */
16
+ private baseUrl?;
17
+ /** @internal */
18
+ private nonce?;
19
+ /** @internal */
20
+ private v3SiteKey?;
21
+ /** @internal */
22
+ private options?;
23
+ constructor(platformId: Object, language?: string, baseUrl?: string, nonce?: string, v3SiteKey?: string, options?: RecaptchaLoaderOptions);
24
+ /** @internal */
25
+ private init;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaLoaderService, [null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>;
27
+ static ɵprov: i0.ɵɵInjectableDeclaration<RecaptchaLoaderService>;
28
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="grecaptcha" />
2
+ export interface RecaptchaSettings {
3
+ siteKey?: string;
4
+ theme?: ReCaptchaV2.Theme;
5
+ type?: ReCaptchaV2.Type;
6
+ size?: ReCaptchaV2.Size;
7
+ badge?: ReCaptchaV2.Badge;
8
+ }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class RecaptchaV3Module {
3
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaV3Module, never>;
4
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaV3Module, never, never, never>;
5
+ static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaV3Module>;
6
+ }
@@ -0,0 +1,70 @@
1
+ import { NgZone } from "@angular/core";
2
+ import { Observable } from "rxjs";
3
+ import { RecaptchaLoaderService } from "./recaptcha-loader.service";
4
+ import * as i0 from "@angular/core";
5
+ export interface OnExecuteData {
6
+ /**
7
+ * The name of the action that has been executed.
8
+ */
9
+ action: string;
10
+ /**
11
+ * The token that reCAPTCHA v3 provided when executing the action.
12
+ */
13
+ token: string;
14
+ }
15
+ export interface OnExecuteErrorData {
16
+ /**
17
+ * The name of the action that has been executed.
18
+ */
19
+ action: string;
20
+ /**
21
+ * The error which was encountered
22
+ */
23
+ error: any;
24
+ }
25
+ /**
26
+ * The main service for working with reCAPTCHA v3 APIs.
27
+ *
28
+ * Use the `execute` method for executing a single action, and
29
+ * `onExecute` observable for listening to all actions at once.
30
+ */
31
+ export declare class ReCaptchaV3Service {
32
+ recaptchaLoader: RecaptchaLoaderService;
33
+ /** @internal */
34
+ private readonly siteKey;
35
+ /** @internal */
36
+ private readonly zone;
37
+ /** @internal */
38
+ private actionBacklog;
39
+ /** @internal */
40
+ private grecaptcha;
41
+ /** @internal */
42
+ private onExecuteSubject;
43
+ /** @internal */
44
+ private onExecuteErrorSubject;
45
+ /** @internal */
46
+ private onExecuteObservable;
47
+ /** @internal */
48
+ private onExecuteErrorObservable;
49
+ constructor(zone: NgZone, recaptchaLoader: RecaptchaLoaderService, siteKey: string);
50
+ get onExecute(): Observable<OnExecuteData>;
51
+ get onExecuteError(): Observable<OnExecuteErrorData>;
52
+ /**
53
+ * Executes the provided `action` with reCAPTCHA v3 API.
54
+ * Use the emitted token value for verification purposes on the backend.
55
+ *
56
+ * For more information about reCAPTCHA v3 actions and tokens refer to the official documentation at
57
+ * https://developers.google.com/recaptcha/docs/v3.
58
+ *
59
+ * @param {string} action the action to execute
60
+ * @returns {Observable<string>} an `Observable` that will emit the reCAPTCHA v3 string `token` value whenever ready.
61
+ * The returned `Observable` completes immediately after emitting a value.
62
+ */
63
+ execute(action: string): Observable<string>;
64
+ /** @internal */
65
+ private executeActionWithSubject;
66
+ /** @internal */
67
+ private init;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReCaptchaV3Service, never>;
69
+ static ɵprov: i0.ɵɵInjectableDeclaration<ReCaptchaV3Service>;
70
+ }
@@ -0,0 +1,18 @@
1
+ import { ControlValueAccessor } from "@angular/forms";
2
+ import { RecaptchaComponent } from "./recaptcha.component";
3
+ import * as i0 from "@angular/core";
4
+ export declare class RecaptchaValueAccessorDirective implements ControlValueAccessor {
5
+ private host;
6
+ /** @internal */
7
+ private onChange;
8
+ /** @internal */
9
+ private onTouched;
10
+ private requiresControllerReset;
11
+ constructor(host: RecaptchaComponent);
12
+ writeValue(value: string): void;
13
+ registerOnChange(fn: (value: string) => void): void;
14
+ registerOnTouched(fn: () => void): void;
15
+ onResolve($event: string): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaValueAccessorDirective, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RecaptchaValueAccessorDirective, "re-captcha[formControlName],re-captcha[formControl],re-captcha[ngModel]", never, {}, {}, never, never, false, never>;
18
+ }
@@ -0,0 +1,64 @@
1
+ /// <reference types="grecaptcha" />
2
+ import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnDestroy } from "@angular/core";
3
+ import { RecaptchaLoaderService } from "./recaptcha-loader.service";
4
+ import { RecaptchaSettings } from "./recaptcha-settings";
5
+ import * as i0 from "@angular/core";
6
+ export type NeverUndefined<T> = T extends undefined ? never : T;
7
+ export type RecaptchaErrorParameters = Parameters<NeverUndefined<ReCaptchaV2.Parameters["error-callback"]>>;
8
+ export declare class RecaptchaComponent implements AfterViewInit, OnDestroy {
9
+ private elementRef;
10
+ private loader;
11
+ private zone;
12
+ id: string;
13
+ siteKey?: string;
14
+ theme?: ReCaptchaV2.Theme;
15
+ type?: ReCaptchaV2.Type;
16
+ size?: ReCaptchaV2.Size;
17
+ tabIndex?: number;
18
+ badge?: ReCaptchaV2.Badge;
19
+ errorMode: "handled" | "default";
20
+ resolved: EventEmitter<string | null>;
21
+ /**
22
+ * @deprecated `(error) output will be removed in the next major version. Use (errored) instead
23
+ */
24
+ error: EventEmitter<[]>;
25
+ errored: EventEmitter<[]>;
26
+ /** @internal */
27
+ private subscription;
28
+ /** @internal */
29
+ private widget;
30
+ /** @internal */
31
+ private grecaptcha;
32
+ /** @internal */
33
+ private executeRequested;
34
+ constructor(elementRef: ElementRef<HTMLElement>, loader: RecaptchaLoaderService, zone: NgZone, settings?: RecaptchaSettings);
35
+ ngAfterViewInit(): void;
36
+ ngOnDestroy(): void;
37
+ /**
38
+ * Executes the invisible recaptcha.
39
+ * Does nothing if component's size is not set to "invisible".
40
+ */
41
+ execute(): void;
42
+ reset(): void;
43
+ /**
44
+ * ⚠️ Warning! Use this property at your own risk!
45
+ *
46
+ * While this member is `public`, it is not a part of the component's public API.
47
+ * The semantic versioning guarantees _will not be honored_! Thus, you might find that this property behavior changes in incompatible ways in minor or even patch releases.
48
+ * You are **strongly advised** against using this property.
49
+ * Instead, use more idiomatic ways to get reCAPTCHA value, such as `resolved` EventEmitter, or form-bound methods (ngModel, formControl, and the likes).å
50
+ */
51
+ get __unsafe_widgetValue(): string | null;
52
+ /** @internal */
53
+ private expired;
54
+ /** @internal */
55
+ private onError;
56
+ /** @internal */
57
+ private captchaResponseCallback;
58
+ /** @internal */
59
+ private grecaptchaReset;
60
+ /** @internal */
61
+ private renderRecaptcha;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaComponent, [null, null, null, { optional: true; }]>;
63
+ static ɵcmp: i0.ɵɵComponentDeclaration<RecaptchaComponent, "re-captcha", ["reCaptcha"], { "id": { "alias": "id"; "required": false; }; "siteKey": { "alias": "siteKey"; "required": false; }; "theme": { "alias": "theme"; "required": false; }; "type": { "alias": "type"; "required": false; }; "size": { "alias": "size"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "badge": { "alias": "badge"; "required": false; }; "errorMode": { "alias": "errorMode"; "required": false; }; }, { "resolved": "resolved"; "error": "error"; "errored": "errored"; }, never, never, false, never>;
64
+ }
@@ -0,0 +1,8 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./recaptcha-common.module";
3
+ import * as i2 from "./recaptcha.component";
4
+ export declare class RecaptchaModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<RecaptchaModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RecaptchaModule, never, [typeof i1.RecaptchaCommonModule], [typeof i2.RecaptchaComponent]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<RecaptchaModule>;
8
+ }
@@ -0,0 +1,116 @@
1
+ /// <reference types="grecaptcha" />
2
+ import { InjectionToken } from "@angular/core";
3
+ import { RecaptchaSettings } from "./recaptcha-settings";
4
+ /** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */
5
+ export declare const RECAPTCHA_LANGUAGE: InjectionToken<string>;
6
+ /** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */
7
+ export declare const RECAPTCHA_BASE_URL: InjectionToken<string>;
8
+ /** @deprecated Use `LOADER_OPTIONS` instead. See `RecaptchaLoaderOptions.onBeforeLoad` */
9
+ export declare const RECAPTCHA_NONCE: InjectionToken<string>;
10
+ export declare const RECAPTCHA_SETTINGS: InjectionToken<RecaptchaSettings>;
11
+ export declare const RECAPTCHA_V3_SITE_KEY: InjectionToken<string>;
12
+ /**
13
+ * Specifies the options for loading the reCAPTCHA script tag.
14
+ */
15
+ export type RecaptchaLoaderOptions = {
16
+ /**
17
+ * Invoked before the `<script>` tag is appended to the DOM.
18
+ * Use this function as an opportunity to set `nonce`, as well as modify the URL of the tag.
19
+ *
20
+ * Use the `url.searchParams` to set additional query string attributes (including reCAPTCHA language),
21
+ * or use an entirely different base URL altogether.
22
+ *
23
+ * The URL that you provide will then properly set the `"render"` and `"onload"` attributes which are required for proper `ng-recaptcha` wire-up.
24
+ *
25
+ * @param url the current URL that was composed. Either modify it in-place, or return a completely new URL.
26
+ * @returns the final URL that is going to be used as the `src` for the `<script>` tag, along with (optionally) a nonce.
27
+ *
28
+ * @example
29
+ * Provide nonce:
30
+ * ```ts
31
+ * {
32
+ * provide: RECAPTCHA_LOADER_OPTIONS,
33
+ * useValue: {
34
+ * onBeforeLoad(url) {
35
+ * return {
36
+ * url,
37
+ * nonce: "YOUR_NONCE"
38
+ * };
39
+ * }
40
+ * }
41
+ * }
42
+ * ```
43
+ *
44
+ * Set the reCAPTCHA language:
45
+ * ```ts
46
+ * {
47
+ * provide: RECAPTCHA_LOADER_OPTIONS,
48
+ * useValue: {
49
+ * onBeforeLoad(url) {
50
+ * url.searchParams.set("hl", "en-GB")
51
+ *
52
+ * return { url };
53
+ * }
54
+ * }
55
+ * }
56
+ * ```
57
+ *
58
+ * Use a different base URL for loading reCAPTCHA
59
+ * ```ts
60
+ * {
61
+ * provide: RECAPTCHA_LOADER_OPTIONS,
62
+ * useValue: {
63
+ * onBeforeLoad(_url) {
64
+ * const chinaCompatibleUrl = new URL("https://www.recaptcha.net/recaptcha/api.js");
65
+ * // optionally, set the locale:
66
+ * // chinaCompatibleUrl.searchParams.set("hl", "zh-CN");
67
+ *
68
+ * return {
69
+ * url: chinaCompatibleUrl
70
+ * };
71
+ * }
72
+ * }
73
+ * }
74
+ * ```
75
+ */
76
+ onBeforeLoad?(url: URL): {
77
+ url: URL;
78
+ nonce?: string;
79
+ };
80
+ /**
81
+ * Allows you to change the `grecaptcha` that the `ng-recaptcha` will be relying on.
82
+ * This method is useful when you need to use `grecaptcha.enterprise` instead of the base `grecaptcha`
83
+ *
84
+ * @param recaptcha the value of `window.grecaptcha` upon script load.
85
+ * @returns the {ReCaptchaV2.ReCaptcha} instance that the `ng-recaptcha` lib will use.
86
+ *
87
+ * @example
88
+ * Using the Enterprise version of `grecaptcha`:
89
+ *
90
+ * ```ts
91
+ * {
92
+ * provide: RECAPTCHA_LOADER_OPTIONS,
93
+ * useValue: {
94
+ * onBeforeLoad() {
95
+ * const recaptchaEnterpriseUrl = new URL("https://www.google.com/recaptcha/enterprise.js");
96
+ * // optionally, if you're using the reCAPTCHA session-tokens, set the `&waf=session` param,
97
+ * // see https://cloud.google.com/recaptcha-enterprise/docs/implement-waf-ca#session-token
98
+ * // recaptchaEnterpriseUrl.searchParams.set("waf", "session");
99
+ *
100
+ * return {
101
+ * url: recaptchaEnterpriseUrl,
102
+ * }
103
+ * },
104
+ * onLoaded(recaptcha) {
105
+ * return recaptcha.enterprise;
106
+ * }
107
+ * }
108
+ * }
109
+ * ```
110
+ */
111
+ onLoaded?(recaptcha: ReCaptchaV2.ReCaptcha): ReCaptchaV2.ReCaptcha;
112
+ };
113
+ /**
114
+ * See the documentation for `RecaptchaLoaderOptions`.
115
+ */
116
+ export declare const RECAPTCHA_LOADER_OPTIONS: InjectionToken<RecaptchaLoaderOptions>;
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "ng-recaptcha-2",
3
+ "description": "Angular component for Google reCAPTCHA for Angular v18 and onwards",
4
+ "version": "14.0.0",
5
+ "author": "Ruslan Arkhipau <dethariel@gmail.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/LakhveerChahal/ng-recaptcha-2"
10
+ },
11
+ "homepage": "https://github.com/LakhveerChahal/ng-recaptcha-2#readme",
12
+ "keywords": [
13
+ "angular",
14
+ "recaptcha",
15
+ "angular-recaptcha",
16
+ "ng-recaptcha",
17
+ "angular-18"
18
+ ],
19
+ "peerDependencies": {
20
+ "@angular/core": "^18.0.1"
21
+ },
22
+ "dependencies": {
23
+ "@types/grecaptcha": "^3.0.7",
24
+ "tslib": "^2.2.0"
25
+ },
26
+ "module": "fesm2022/ng-recaptcha-2.mjs",
27
+ "typings": "index.d.ts",
28
+ "exports": {
29
+ "./package.json": {
30
+ "default": "./package.json"
31
+ },
32
+ ".": {
33
+ "types": "./index.d.ts",
34
+ "esm2022": "./esm2022/ng-recaptcha-2.mjs",
35
+ "esm": "./esm2022/ng-recaptcha-2.mjs",
36
+ "default": "./fesm2022/ng-recaptcha-2.mjs"
37
+ }
38
+ },
39
+ "sideEffects": false
40
+ }