@dsivd/prestations-ng 19.0.2-beta.5 → 19.0.2-beta.6

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,14 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## [19.0.2]
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
+
16
+
9
17
  ## [19.0.0] - should be aligned with prestations-be 19.0.x
10
18
 
11
19
  ### Added
@@ -42,6 +50,13 @@
42
50
  - [foehn-list-summary.component.ts](projects/prestations-ng/src/foehn-menu-prestation/foehn-list-summary/foehn-list-summary.component.ts)
43
51
  - `[list]` attribut has been removed. Use `[model]` instead.
44
52
 
53
+ ## [18.3.13]
54
+
55
+ ### Fixed
56
+
57
+ - [recaptcha.service.ts](projects/prestations-ng/src/sdk-recaptcha/recaptcha.service.ts)
58
+ - fixed recaptcha called infinitely when backend says that it must be revalidated
59
+
45
60
  ## [18.3.12]
46
61
 
47
62
  ### Updated
@@ -4418,13 +4418,22 @@ class FoehnInputStringComponent extends FoehnInputComponent {
4418
4418
  super.onBlur(e);
4419
4419
  }
4420
4420
  onModelChange(value) {
4421
- if (value === undefined || value === null || !!value) {
4421
+ if (value === undefined ||
4422
+ value === null ||
4423
+ !!value ||
4424
+ this.isZeroAsNumber(value)) {
4422
4425
  this.updateNgModel(value);
4423
4426
  }
4424
4427
  else {
4425
4428
  this.updateNgModel(null);
4426
4429
  }
4427
4430
  }
4431
+ isZeroAsNumber(value) {
4432
+ if (typeof value === 'number') {
4433
+ return value === 0;
4434
+ }
4435
+ return false;
4436
+ }
4428
4437
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: FoehnInputStringComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
4429
4438
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.19", type: FoehnInputStringComponent, isStandalone: true, inputs: { trimOnBlur: { classPropertyName: "trimOnBlur", publicName: "trimOnBlur", isSignal: true, isRequired: false, transformFunction: null }, sanitizeOnBlur: { classPropertyName: "sanitizeOnBlur", publicName: "sanitizeOnBlur", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 }); }
4430
4439
  }
@@ -4604,6 +4613,7 @@ class RecaptchaService {
4604
4613
  this.applicationInfoService = inject(ApplicationInfoService);
4605
4614
  this.sdkLogsService = inject(SdkLogsService);
4606
4615
  this.errorsSubject = new BehaviorSubject([]);
4616
+ this.gesdemFormErrors = [];
4607
4617
  this.errors = this.initErrorObservable(); // has to be first since it is used in initShouldDisplayObservable !
4608
4618
  this.shouldDisplay = this.initShouldDisplayObservable();
4609
4619
  this.publicKey = this.initPublicKeyObservable();
@@ -4646,6 +4656,9 @@ class RecaptchaService {
4646
4656
  this.errorsSubject.next([newError, ...existingErrors]);
4647
4657
  }
4648
4658
  clearErrors() {
4659
+ // Remove recaptcha errors so it won't reset infinitely
4660
+ this.validationHandlerService.updateErrors(this.gesdemFormErrors.filter(error => error.code !== CAPTCHA_ERROR_NAME &&
4661
+ error.name !== CAPTCHA_ERROR_NAME));
4649
4662
  this.errorsSubject.next([]);
4650
4663
  }
4651
4664
  getErrors() {
@@ -4669,8 +4682,13 @@ class RecaptchaService {
4669
4682
  of([]),
4670
4683
  // Read from the gesdem service all errors.
4671
4684
  this.validationHandlerService.validationErrorsSubject).pipe(
4685
+ // Store all validation errors before filtering
4686
+ tap(errors => {
4687
+ this.gesdemFormErrors = errors;
4688
+ }),
4672
4689
  // Errors from GesDem, or nothing
4673
- map((errors) => errors.filter((ex) => CAPTCHA_ERROR_NAME === ex.code)));
4690
+ map((errors) => errors.filter((ex) => CAPTCHA_ERROR_NAME === ex.code ||
4691
+ CAPTCHA_ERROR_NAME === ex.name)));
4674
4692
  // Bind errors to the component, either from the backend of from this component
4675
4693
  return combineLatest([
4676
4694
  // Errors from gesdem matching the name of the captcha.