@dyedurham/search-and-file-widget 2.0.42 → 2.0.43

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.
@@ -84426,7 +84426,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84426
84426
  const citizenships = isc.participant?._profile?.["citizenships"];
84427
84427
  const countriesOfCitizenship = citizenships?.map((c) => normalizeCountryCode(c)).join(", ") ?? "";
84428
84428
  const countriesOfResidence = normalizeCountryCode(isc.participant?._profile?.tax_residency?.country ?? "");
84429
- const address = isc.addresses?.[0] || isc.parent_affiliation?.addresses?.[0];
84429
+ const address = this.getAffiliationAddress(isc);
84430
84430
  return new FormGroup(__spreadValues({
84431
84431
  [FormationFormControls.AffiliationName]: new FormControl({ value: name, disabled: true }),
84432
84432
  [FormationFormControls.Id]: new FormControl({ value: id, disabled: true }),
@@ -84440,6 +84440,12 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84440
84440
  [FederalFormationFormControl.ISCPercentageInterest]: new FormControl(deltaData?.percentageInterest ?? null, requiredIfNotValue(FederalFormationFormControl.ISCTypeOfInterest, ISCTypeOfInterest.ControlWithoutShares))
84441
84441
  }, this.generateAddressFormGroup(address)));
84442
84442
  }
84443
+ static getAffiliationAddress(affiliation) {
84444
+ const addresses = affiliation?.addresses?.filter((address) => this.hasAddressValue(address)) ?? [];
84445
+ const parentAddresses = affiliation?.parent_affiliation?.addresses?.filter((address) => this.hasAddressValue(address)) ?? [];
84446
+ const addressReferences = affiliation?._addresses?.filter((address) => this.hasAddressValue(address)) ?? [];
84447
+ return addresses[0] || parentAddresses[0] || addressReferences[0];
84448
+ }
84443
84449
  static generateAddressFormGroup(address) {
84444
84450
  const config2 = {};
84445
84451
  if (address) {
@@ -84504,6 +84510,9 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84504
84510
  const match = /^(\d[\w-]*)\s+(.+)$/.exec(line);
84505
84511
  return match ? { number: match[1], name: match[2] } : { number: "", name: line };
84506
84512
  }
84513
+ static hasAddressValue(address) {
84514
+ return Boolean(address?.components?.some((component) => component.value?.trim()) || address?.street?.trim() || address?.display?.line1?.trim() || address?.display?.line2?.trim() || address?.city?.trim() || address?.province_state?.trim() || address?.country?.trim() || address?.postal_zip?.trim());
84515
+ }
84507
84516
  };
84508
84517
  }
84509
84518
  });
@@ -85021,10 +85030,15 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85021
85030
  const map2 = /* @__PURE__ */ new Map();
85022
85031
  const individualsWithSignificantControl = this.getSelectableIndividualsWithSignificantControl(affiliations);
85023
85032
  for (const individual of individualsWithSignificantControl) {
85024
- const addressOptions = individual.addresses.map((address) => ({
85033
+ const addresses = [
85034
+ ...individual.addresses ?? [],
85035
+ ...individual.parent_affiliation?.addresses ?? []
85036
+ ];
85037
+ const resolvedAddress = FederalFormHelper.getAffiliationAddress(individual);
85038
+ const addressOptions = (addresses.length ? addresses : resolvedAddress ? [resolvedAddress] : []).map((address) => ({
85025
85039
  label: this.formatAddressLabel(address),
85026
85040
  value: address.uid
85027
- }));
85041
+ })).filter((option) => option.label && option.value);
85028
85042
  map2.set(individual._id, addressOptions);
85029
85043
  }
85030
85044
  return map2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyedurham/search-and-file-widget",
3
- "version": "2.0.42",
3
+ "version": "2.0.43",
4
4
  "description": "",
5
5
  "main": "dnd-filing-shell.js",
6
6
  "scripts": {