@hmcts/rpx-xui-common-lib 1.9.0-address-non-postcode → 1.9.0-address-non-postcode-3

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.
@@ -4850,6 +4850,7 @@
4850
4850
 
4851
4851
  var WriteAddressFieldComponent = /** @class */ (function () {
4852
4852
  function WriteAddressFieldComponent(addressesService) {
4853
+ this.addressesService = addressesService;
4853
4854
  this.internationalMode = false;
4854
4855
  this.submissionAttempted = false;
4855
4856
  this.postcodeOptionSelected = new i0.EventEmitter();
@@ -4868,7 +4869,6 @@
4868
4869
  this.addressChosen = false;
4869
4870
  this.missingPostcode = false;
4870
4871
  this.optionErrorMessage = exports.AddressMessageEnum.NO_OPTION_SELECTED;
4871
- this.addressesService = addressesService;
4872
4872
  }
4873
4873
  WriteAddressFieldComponent.prototype.ngOnInit = function () {
4874
4874
  if (!this.formGroup.get('address')) {
@@ -4903,7 +4903,6 @@
4903
4903
  _this.addressOptions.unshift(new AddressOption(undefined, _this.defaultLabel(_this.addressOptions.length)));
4904
4904
  });
4905
4905
  this.addressFormGroup.get('addressList').setValue(undefined);
4906
- // this.refocusElement();
4907
4906
  }
4908
4907
  };
4909
4908
  WriteAddressFieldComponent.prototype.blankAddress = function () {
@@ -4935,9 +4934,13 @@
4935
4934
  };
4936
4935
  WriteAddressFieldComponent.prototype.ngOnChanges = function (changes) {
4937
4936
  var addressChange = changes['addressField'];
4937
+ var internationalChange = changes['isInternational'];
4938
4938
  if (addressChange) {
4939
4939
  this.setFormValue();
4940
4940
  }
4941
+ if (internationalChange && this.addressFormGroup && this.addressFormGroup.get('ukAddress')) {
4942
+ this.addressFormGroup.get('ukAddress').patchValue(this.isInternational ? 'no' : 'yes');
4943
+ }
4941
4944
  this.checkIfErrorsNeeded();
4942
4945
  };
4943
4946
  WriteAddressFieldComponent.prototype.checkIfErrorsNeeded = function () {
@@ -5000,12 +5003,7 @@
5000
5003
  WriteAddressInputsComponent.prototype.ngOnChanges = function () {
5001
5004
  var addressGroup = this.formGroup.get('address');
5002
5005
  // if there is an issue with the formgroup, ensure error styling is displayed
5003
- if (addressGroup.valid) {
5004
- this.errorsPresent = false;
5005
- }
5006
- else {
5007
- this.errorsPresent = true;
5008
- }
5006
+ this.errorsPresent = !addressGroup.valid;
5009
5007
  };
5010
5008
  return WriteAddressInputsComponent;
5011
5009
  }());