ngx-recaptcha-v3 1.0.4 → 1.0.5
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.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.5] - 2026-06-05
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Fixed npm package issue where only README.md and CHANGELOG.md were published by removing restrictive `files` field from `package.json`.
|
|
9
|
+
- Added null/undefined token check in RecaptchaV3Service to properly handle cases where Google returns no token.
|
|
10
|
+
- Added debug console logs to RecaptchaV3Service for better troubleshooting.
|
|
11
|
+
|
|
5
12
|
## [1.0.1] - 2026-06-05
|
|
6
13
|
|
|
7
14
|
### Added
|
|
@@ -42,6 +42,10 @@ class RecaptchaV3Service {
|
|
|
42
42
|
grecaptchaObj.execute(siteKey, { action })
|
|
43
43
|
.then((token) => {
|
|
44
44
|
this.ngZone.run(() => {
|
|
45
|
+
if (!token) {
|
|
46
|
+
subscriber.error(new Error('Google reCAPTCHA returned null/undefined token.'));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
45
49
|
subscriber.next(token);
|
|
46
50
|
subscriber.complete();
|
|
47
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-recaptcha-v3-v3.mjs","sources":["../../../projects/ngx-recaptcha-v3/v3/src/recaptcha-v3.service.ts","../../../projects/ngx-recaptcha-v3/v3/src/public-api.ts","../../../projects/ngx-recaptcha-v3/v3/src/ngx-recaptcha-v3-v3.ts"],"sourcesContent":["import { Injectable, NgZone, Inject, PLATFORM_ID, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Observable, firstValueFrom } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { RecaptchaLoaderService, RECAPTCHA_CONFIG, RecaptchaConfig } from 'ngx-recaptcha-v3/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RecaptchaV3Service {\n private loader = inject(RecaptchaLoaderService);\n private ngZone = inject(NgZone);\n private platformId = inject(PLATFORM_ID);\n private config = inject(RECAPTCHA_CONFIG, { optional: true });\n\n private isBrowser = isPlatformBrowser(this.platformId);\n\n /**\n * Executes a specific action on the V3 siteKey and yields the resolution token as an Observable.\n */\n public execute(action: string): Observable<string> {\n if (!this.isBrowser) {\n return new Observable<string>((subscriber) => {\n subscriber.next('');\n subscriber.complete();\n });\n }\n\n const siteKey = this.config?.v3SiteKey;\n if (!siteKey) {\n return new Observable<string>((subscriber) => {\n subscriber.error(new Error('reCAPTCHA v3 siteKey is not provided in RECAPTCHA_CONFIG.'));\n });\n }\n\n return this.loader.loadScript().pipe(\n switchMap(() => {\n return new Observable<string>((subscriber) => {\n this.ngZone.runOutsideAngular(() => {\n const windowRef = window as any;\n const grecaptchaObj = windowRef.grecaptcha?.enterprise || windowRef.grecaptcha;\n\n if (!grecaptchaObj) {\n this.ngZone.run(() => {\n subscriber.error(new Error('Google reCAPTCHA script is not loaded or missing.'));\n });\n return;\n }\n\n grecaptchaObj.ready(() => {\n grecaptchaObj.execute(siteKey, { action })\n .then((token: string) => {\n this.ngZone.run(() => {\n subscriber.next(token);\n subscriber.complete();\n });\n })\n .catch((err: any) => {\n this.ngZone.run(() => {\n subscriber.error(err);\n });\n });\n });\n });\n });\n })\n );\n }\n\n /**\n * Executes a specific action on the V3 siteKey and yields the resolution token as a Promise.\n * Ideal for modern async/await execution pipelines.\n */\n public executeAsync(action: string): Promise<string> {\n return firstValueFrom(this.execute(action));\n }\n}\n","/*\n * Public API Surface of ngx-recaptcha-v3/v3\n */\n\nexport * from './recaptcha-v3.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,kBAAkB,CAAA;AACrB,IAAA,MAAM,GAAG,MAAM,CAAC,sBAAsB,CAAC;AACvC,IAAA,MA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AC;wBACF;oBACF;AAEA,oBAAA,aAAa,CAAC,KAAK,CAAC,MAAK;wBACvB,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE;AACtC,6BAAA,IAAI,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ngx-recaptcha-v3-v3.mjs","sources":["../../../projects/ngx-recaptcha-v3/v3/src/recaptcha-v3.service.ts","../../../projects/ngx-recaptcha-v3/v3/src/public-api.ts","../../../projects/ngx-recaptcha-v3/v3/src/ngx-recaptcha-v3-v3.ts"],"sourcesContent":["import { Injectable, NgZone, Inject, PLATFORM_ID, inject } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Observable, firstValueFrom } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { RecaptchaLoaderService, RECAPTCHA_CONFIG, RecaptchaConfig } from 'ngx-recaptcha-v3/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class RecaptchaV3Service {\n private loader = inject(RecaptchaLoaderService);\n private ngZone = inject(NgZone);\n private platformId = inject(PLATFORM_ID);\n private config = inject(RECAPTCHA_CONFIG, { optional: true });\n\n private isBrowser = isPlatformBrowser(this.platformId);\n\n /**\n * Executes a specific action on the V3 siteKey and yields the resolution token as an Observable.\n */\n public execute(action: string): Observable<string> {\n if (!this.isBrowser) {\n return new Observable<string>((subscriber) => {\n subscriber.next('');\n subscriber.complete();\n });\n }\n\n const siteKey = this.config?.v3SiteKey;\n if (!siteKey) {\n return new Observable<string>((subscriber) => {\n subscriber.error(new Error('reCAPTCHA v3 siteKey is not provided in RECAPTCHA_CONFIG.'));\n });\n }\n\n return this.loader.loadScript().pipe(\n switchMap(() => {\n return new Observable<string>((subscriber) => {\n this.ngZone.runOutsideAngular(() => {\n const windowRef = window as any;\n const grecaptchaObj = windowRef.grecaptcha?.enterprise || windowRef.grecaptcha;\n\n if (!grecaptchaObj) {\n this.ngZone.run(() => {\n subscriber.error(new Error('Google reCAPTCHA script is not loaded or missing.'));\n });\n return;\n }\n\n grecaptchaObj.ready(() => {\n grecaptchaObj.execute(siteKey, { action })\n .then((token: string | null | undefined) => {\n this.ngZone.run(() => {\n if (!token) {\n subscriber.error(new Error('Google reCAPTCHA returned null/undefined token.'));\n return;\n }\n subscriber.next(token);\n subscriber.complete();\n });\n })\n .catch((err: any) => {\n this.ngZone.run(() => {\n subscriber.error(err);\n });\n });\n });\n });\n });\n })\n );\n }\n\n /**\n * Executes a specific action on the V3 siteKey and yields the resolution token as a Promise.\n * Ideal for modern async/await execution pipelines.\n */\n public executeAsync(action: string): Promise<string> {\n return firstValueFrom(this.execute(action));\n }\n}\n","/*\n * Public API Surface of ngx-recaptcha-v3/v3\n */\n\nexport * from './recaptcha-v3.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MASa,kBAAkB,CAAA;AACrB,IAAA,MAAM,GAAG,MAAM,CAAC,sBAAsB,CAAC;AACvC,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;IAChC,MAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAErD,IAAA,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC;AAEtD;;AAEG;AACI,IAAA,OAAO,CAAC,MAAc,EAAA;AAC3B,QAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,OAAO,IAAI,UAAU,CAAS,CAAC,UAAU,KAAI;AAC3C,gBAAA,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,UAAU,CAAC,QAAQ,EAAE;AACvB,YAAA,CAAC,CAAC;QACJ;AAEA,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS;QACtC,IAAI,CAAC,OAAO,EAAE;AACZ,YAAA,OAAO,IAAI,UAAU,CAAS,CA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CAAC,CAAC;AACJ,wBAAA,CAAC,CAAC;AACN,oBAAA,CAAC,CAAC;AACJ,gBAAA,CAAC,CAAC;AACJ,YAAA,CAAC,CAAC;QACJ,CAAC,CAAC,CACH;IACH;AAEA;;;AAGG;AACI,IAAA,YAAY,CAAC,MAAc,EAAA;QAChC,OAAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C;uGAtEW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cAFjB,MAAM,EAAA,CAAA;;2FAEP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACRD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-recaptcha-v3",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A modern, standalone Google reCAPTCHA library for Angular supporting v2, v3, enterprise, reactive forms, and signals. Fully compatible with Angular versions 12–22",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|