@bpost/bp-address-auto-complete-by-component 1.1.14 → 1.1.16

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.
@@ -240,7 +240,7 @@ class HttpService {
240
240
  let headers = new HttpHeaders();
241
241
  // Attention !
242
242
  // Need to reassign as the 'set' is returning a clone of the headera object !!!
243
- headers = headers.set('x-api-key', /*'bBkvimXYnAaEEKMyGqoWO2XiaZCQyqUi7VReYzPJ'*/ this.apiKey);
243
+ headers = headers.set('x-api-key', this.apiKey);
244
244
  return headers;
245
245
  }
246
246
  get(url, options) {
@@ -3769,6 +3769,9 @@ class BoxNumberComponent {
3769
3769
  if (!this.validatedByBackend) {
3770
3770
  return (this.isValid(this.postalCode) || this.isValid(this.locality)) && this.isValid(this.streetName) && this.isValid(this.streetNumber);
3771
3771
  }
3772
+ else if (this.suggestionLevel === SuggestionLevelType.None && this.prefillData) {
3773
+ return this.isValid(this.postalCode) && this.isValid(this.locality) && this.isValid(this.streetName) && this.isValid(this.streetNumber) && this.prefillData.parameters.boxNumber !== '';
3774
+ }
3772
3775
  else {
3773
3776
  return this.isValid(this.postalCode) && this.isValid(this.locality) && this.isValid(this.streetName) && this.isValid(this.streetNumber);
3774
3777
  }
@@ -4480,7 +4483,7 @@ class LibAddressAutocompleteByComponentComponent {
4480
4483
  this.httpService = httpService;
4481
4484
  this.selectedLanguage = null;
4482
4485
  this.baseUrl = "https://api.mailops.bpost.cloud/roa-info/externalMailingAddressProofingRest/autocomplete/";
4483
- this.defaultApiKey = 'cyRkKOD73O1DOdgcDLLnsaOiDh6OyOkt3BBT5JU1';
4486
+ this.defaultApiKey = '';
4484
4487
  this.usedLocalityUrl = this.baseUrl + 'locality';
4485
4488
  this.usedStreetUrl = this.baseUrl + 'street';
4486
4489
  this.usedStreetNumberUrl = this.baseUrl + 'streetNumber';
@@ -5339,6 +5342,7 @@ class LibAddressAutocompleteByComponentComponent {
5339
5342
  }
5340
5343
  this.streetNumberAddress = this.streetAddress;
5341
5344
  this.selectedAddress = this.streetAddress;
5345
+ this.selectedAddress.houseNumber = streetNumber;
5342
5346
  this.selectedAddress.streetNumber = streetNumber;
5343
5347
  /*
5344
5348
  this.streetNumber = streetNumber;
@@ -5702,6 +5706,26 @@ class LibAddressAutocompleteByComponentComponent {
5702
5706
  this.setAddress(address, ADDRESSLEVEL.STREET_NUMBER);
5703
5707
  // this.quitPrefillMode();
5704
5708
  }
5709
+ else {
5710
+ this.updatePostalCodeLocality(address);
5711
+ this.updateStreetName(address);
5712
+ this.updateStreetNumber(address);
5713
+ this.streetAddress = address;
5714
+ this.streetNumberAddress = address;
5715
+ if (address.hasOwnProperty('isComplete') && address.isComplete === true) {
5716
+ this.autocompleteStreetNb.addressIsComplete = true;
5717
+ if (addressIsNotInList) {
5718
+ this.autocompleteBoxNb.streetNumber = address.houseNumber;
5719
+ }
5720
+ else {
5721
+ this.autocompleteBoxNb.streetNumber = '';
5722
+ }
5723
+ }
5724
+ else {
5725
+ this.autocompleteBoxNb.streetNumber = address.houseNumber;
5726
+ }
5727
+ this.autocompleteBoxNb.searchText = '';
5728
+ }
5705
5729
  /*
5706
5730
  const boxNumber = this.prefillData.parameters.boxNumber;
5707
5731
  if ( ! addressIsNotInList && (boxNumber === null || boxNumber === undefined || boxNumber === '') )