@dsivd/prestations-ng 19.0.2-beta.4 → 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
@@ -5,8 +5,9 @@ Back offices that are behind IAM ACV should migrate to OIDC, IAM headers are now
5
5
  ## ADMIN
6
6
 
7
7
  - You have to request a new VIP for your application (<env>-<deployunit>.etat-de-vaud.ch)
8
- - i.e. for eldoradobo (R260219_00034) : https://int-eldoradobo.etat-de-vaud.ch/
8
+ - i.e. for sesamebo (R260429_00018) : https://int-sesame.etat-de-vaud.ch/
9
9
  - On IAM side, you have to request a client id / secret on every environment to be used in your configuration
10
+ - i.e. for sesamebo (S260429_00110)
10
11
 
11
12
  ## FRONTEND
12
13
 
@@ -1667,8 +1667,6 @@ class ComponentError {
1667
1667
 
1668
1668
  class FoehnFormComponent {
1669
1669
  constructor() {
1670
- // Class of this input is manually instantiated. This is discouraged and prevents
1671
- // migration.
1672
1670
  this.shouldDisplayAlertSummary = input(true, ...(ngDevMode ? [{ debugName: "shouldDisplayAlertSummary" }] : /* istanbul ignore next */ []));
1673
1671
  this.ngFormComponent = viewChild(NgForm, ...(ngDevMode ? [{ debugName: "ngFormComponent" }] : /* istanbul ignore next */ []));
1674
1672
  this.childrenInputComponents = contentChildren(FoehnInputComponent, { ...(ngDevMode ? { debugName: "childrenInputComponents" } : /* istanbul ignore next */ {}), descendants: true });
@@ -4420,13 +4418,22 @@ class FoehnInputStringComponent extends FoehnInputComponent {
4420
4418
  super.onBlur(e);
4421
4419
  }
4422
4420
  onModelChange(value) {
4423
- if (value === undefined || value === null || !!value) {
4421
+ if (value === undefined ||
4422
+ value === null ||
4423
+ !!value ||
4424
+ this.isZeroAsNumber(value)) {
4424
4425
  this.updateNgModel(value);
4425
4426
  }
4426
4427
  else {
4427
4428
  this.updateNgModel(null);
4428
4429
  }
4429
4430
  }
4431
+ isZeroAsNumber(value) {
4432
+ if (typeof value === 'number') {
4433
+ return value === 0;
4434
+ }
4435
+ return false;
4436
+ }
4430
4437
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: FoehnInputStringComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
4431
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 }); }
4432
4439
  }
@@ -4606,6 +4613,7 @@ class RecaptchaService {
4606
4613
  this.applicationInfoService = inject(ApplicationInfoService);
4607
4614
  this.sdkLogsService = inject(SdkLogsService);
4608
4615
  this.errorsSubject = new BehaviorSubject([]);
4616
+ this.gesdemFormErrors = [];
4609
4617
  this.errors = this.initErrorObservable(); // has to be first since it is used in initShouldDisplayObservable !
4610
4618
  this.shouldDisplay = this.initShouldDisplayObservable();
4611
4619
  this.publicKey = this.initPublicKeyObservable();
@@ -4648,6 +4656,9 @@ class RecaptchaService {
4648
4656
  this.errorsSubject.next([newError, ...existingErrors]);
4649
4657
  }
4650
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));
4651
4662
  this.errorsSubject.next([]);
4652
4663
  }
4653
4664
  getErrors() {
@@ -4671,8 +4682,13 @@ class RecaptchaService {
4671
4682
  of([]),
4672
4683
  // Read from the gesdem service all errors.
4673
4684
  this.validationHandlerService.validationErrorsSubject).pipe(
4685
+ // Store all validation errors before filtering
4686
+ tap(errors => {
4687
+ this.gesdemFormErrors = errors;
4688
+ }),
4674
4689
  // Errors from GesDem, or nothing
4675
- 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)));
4676
4692
  // Bind errors to the component, either from the backend of from this component
4677
4693
  return combineLatest([
4678
4694
  // Errors from gesdem matching the name of the captcha.
@@ -8641,7 +8657,7 @@ class FoehnInputAddressComponent extends FoehnInputComponent {
8641
8657
  if (value) {
8642
8658
  // Need to manually load localities because country "modelChange" event does not fire anymore because a signal
8643
8659
  // only fires when value has changed
8644
- if (!this.isOnlySwiss() && this.country?.iso2Id === SWISS_ISO_ID) {
8660
+ if (!this.isOnlySwiss() && value.country?.iso2Id === SWISS_ISO_ID) {
8645
8661
  this.iso2IdSubject.next(SWISS_ISO_ID);
8646
8662
  }
8647
8663
  this.country = value.country;