@dsivd/prestations-ng 18.3.12 → 18.3.13

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
@@ -6,6 +6,13 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## [18.3.13]
10
+
11
+ ### Fixed
12
+
13
+ - [recaptcha.service.ts](projects/prestations-ng/src/sdk-recaptcha/recaptcha.service.ts)
14
+ - fixed recaptcha called infinitely when backend says that it must be revalidated
15
+
9
16
  ## [18.3.12]
10
17
 
11
18
  ### Updated
Binary file
@@ -4367,6 +4367,7 @@ class RecaptchaService {
4367
4367
  this.applicationInfoService = applicationInfoService;
4368
4368
  this.sdkLogsService = sdkLogsService;
4369
4369
  this.errorsSubject = new BehaviorSubject([]);
4370
+ this.gesdemFormErrors = [];
4370
4371
  this.errors = this.initErrorObservable(); // has to be first since it is used in initShouldDisplayObservable !
4371
4372
  this.shouldDisplay = this.initShouldDisplayObservable();
4372
4373
  this.publicKey = this.initPublicKeyObservable();
@@ -4409,6 +4410,9 @@ class RecaptchaService {
4409
4410
  this.errorsSubject.next([newError, ...existingErrors]);
4410
4411
  }
4411
4412
  clearErrors() {
4413
+ // Remove recaptcha errors so it won't reset infinitely
4414
+ this.validationHandlerService.updateErrors(this.gesdemFormErrors.filter(error => error.code !== CAPTCHA_ERROR_NAME &&
4415
+ error.name !== CAPTCHA_ERROR_NAME));
4412
4416
  this.errorsSubject.next([]);
4413
4417
  }
4414
4418
  getErrors() {
@@ -4432,8 +4436,13 @@ class RecaptchaService {
4432
4436
  of([]),
4433
4437
  // Read from the gesdem service all errors.
4434
4438
  this.validationHandlerService.validationErrorsSubject).pipe(
4439
+ // Store all validation errors before filtering
4440
+ tap(errors => {
4441
+ this.gesdemFormErrors = errors;
4442
+ }),
4435
4443
  // Errors from GesDem, or nothing
4436
- map(errors => errors.filter(ex => CAPTCHA_ERROR_NAME === ex.code)));
4444
+ map(errors => errors.filter(ex => CAPTCHA_ERROR_NAME === ex.code ||
4445
+ CAPTCHA_ERROR_NAME === ex.name)));
4437
4446
  // Bind errors to the component, either from the backend of from this component
4438
4447
  return combineLatest([
4439
4448
  // Errors from gesdem matching the name of the captcha.