@dyedurham/search-and-file-widget 2.0.70 → 2.0.72

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.
Files changed (2) hide show
  1. package/dnd-filing-shell.js +28 -10
  2. package/package.json +1 -1
@@ -84177,7 +84177,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84177
84177
  });
84178
84178
 
84179
84179
  // src/app/constants/BritishColumbiaConstants.ts
84180
- var BCNameType, BCNameTypeLabel, BC_NUMBERED_NAME_PREVIEW, BC_DEFAULT_COUNTRY, BC_FUTURE_EFFECTIVE_DATE_FEE, BC_PASSWORD_MIN_LENGTH, BC_PASSWORD_MAX_LENGTH, BC_PASSWORD_PATTERN, BC_COMPANY_EMAIL_MAX_LENGTH, BC_NAME_RESERVATION_MAX_LENGTH, BC_NAME_RESERVATION_PATTERN, BC_COMPLETING_PARTY_COUNTRY_OPTIONS;
84180
+ var BCNameType, BCNameTypeLabel, BC_NUMBERED_NAME_PREVIEW, BC_DEFAULT_COUNTRY, BC_FUTURE_EFFECTIVE_DATE_FEE, BC_PASSWORD_MIN_LENGTH, BC_PASSWORD_MAX_LENGTH, BC_PASSWORD_PATTERN, BC_COMPANY_EMAIL_MAX_LENGTH, BC_CANADIAN_POSTAL_PATTERN, BC_NAME_RESERVATION_MAX_LENGTH, BC_NAME_RESERVATION_PATTERN, BC_COMPLETING_PARTY_COUNTRY_OPTIONS;
84181
84181
  var init_BritishColumbiaConstants = __esm({
84182
84182
  "src/app/constants/BritishColumbiaConstants.ts"() {
84183
84183
  init_common_constants();
@@ -84196,6 +84196,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84196
84196
  BC_PASSWORD_MAX_LENGTH = 15;
84197
84197
  BC_PASSWORD_PATTERN = /^[A-Za-z0-9]+$/;
84198
84198
  BC_COMPANY_EMAIL_MAX_LENGTH = 150;
84199
+ BC_CANADIAN_POSTAL_PATTERN = /^[A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d$/;
84199
84200
  BC_NAME_RESERVATION_MAX_LENGTH = 9;
84200
84201
  BC_NAME_RESERVATION_PATTERN = /^(NR)?\d{1,7}$/i;
84201
84202
  BC_COMPLETING_PARTY_COUNTRY_OPTIONS = [
@@ -84344,7 +84345,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84344
84345
  additionalStreetAddress: address?.addressLine2?.trim() || void 0,
84345
84346
  city: address?.city?.trim() ?? "",
84346
84347
  provinceOrState: toProvinceOrStateCode(address?.provinceState, country),
84347
- postalOrZipCode: address?.postalZip?.trim() ?? "",
84348
+ postalOrZipCode: normalizePostalCode(address?.postalZip, country),
84348
84349
  country
84349
84350
  }
84350
84351
  };
@@ -84371,15 +84372,24 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84371
84372
  const streetNumber = getAddressComponent(address, "Street Number Only");
84372
84373
  const streetName = getAddressComponent(address, "Street Only");
84373
84374
  const suite = getAddressComponent(address, "Suite/Apartment");
84375
+ const singleLineStreet = getAddressComponent(address, "Street Address");
84374
84376
  return {
84375
- streetAddress: [streetNumber, streetName].filter(Boolean).join(" ") || address?.street || "",
84377
+ streetAddress: [streetNumber, streetName].filter(Boolean).join(" ") || singleLineStreet || address?.street || "",
84376
84378
  additionalStreetAddress: padShortAddressLine(suite || address?.address2),
84377
84379
  city: address?.city ?? "",
84378
84380
  provinceOrState: toProvinceOrStateCode(address?.province_state, country),
84379
- postalOrZipCode: address?.postal_zip ?? "",
84381
+ postalOrZipCode: normalizePostalCode(address?.postal_zip, country),
84380
84382
  country
84381
84383
  };
84382
84384
  }
84385
+ function normalizePostalCode(value, countryCode) {
84386
+ const trimmed = (value ?? "").trim();
84387
+ if (countryCode !== "CA") {
84388
+ return trimmed;
84389
+ }
84390
+ const compact = trimmed.replace(/[\s-]+/g, "").toUpperCase();
84391
+ return /^[A-Z]\d[A-Z]\d[A-Z]\d$/.test(compact) ? `${compact.slice(0, 3)} ${compact.slice(3)}` : trimmed;
84392
+ }
84383
84393
  function toProvinceOrStateCode(value, countryCode) {
84384
84394
  const trimmed = (value ?? "").trim();
84385
84395
  if (!trimmed || trimmed.length === 2) {
@@ -84471,7 +84481,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84471
84481
  });
84472
84482
 
84473
84483
  // src/app/helpers/british-columbia/formation/british-columbia-formation-form.helper.ts
84474
- var ifNamed, BritishColumbiaFormationFormHelper;
84484
+ var ifNamed, ifCanada, BritishColumbiaFormationFormHelper;
84475
84485
  var init_british_columbia_formation_form_helper = __esm({
84476
84486
  "src/app/helpers/british-columbia/formation/british-columbia-formation-form.helper.ts"() {
84477
84487
  init_forms();
@@ -84482,6 +84492,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84482
84492
  init_custom_validators();
84483
84493
  init_BritishColumbiaConstants();
84484
84494
  ifNamed = (validator) => (control) => control.parent?.get(BCFormationFormControls.CorporationNameType)?.value === BCNameType.Named ? validator(control) : null;
84495
+ ifCanada = (validator) => (control) => control.parent?.get(BCFormationFormControls.Country)?.value === "Canada" ? validator(control) : null;
84485
84496
  BritishColumbiaFormationFormHelper = class {
84486
84497
  static generateConfig(task, translateFn, currentUser) {
84487
84498
  const t = translateFn ?? ((key) => key);
@@ -84595,7 +84606,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84595
84606
  const streetNumber = getAddressComponent(address, "Street Number Only");
84596
84607
  const streetName = getAddressComponent(address, "Street Only");
84597
84608
  const suite = getAddressComponent(address, "Suite/Apartment");
84598
- const street = [streetNumber, streetName].filter(Boolean).join(" ") || address.street || "";
84609
+ const street = [streetNumber, streetName].filter(Boolean).join(" ") || getAddressComponent(address, "Street Address") || address.street || "";
84599
84610
  return [
84600
84611
  suite ? `Unit ${suite}` : "",
84601
84612
  street,
@@ -84676,8 +84687,9 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84676
84687
  [BCFormationFormControls.AddressLine1]: new FormControl(mailAddress?.addressLine1 ?? prefill.mailingAddress.addressLine1, [Validators.required, Validators.minLength(3), Validators.maxLength(40)]),
84677
84688
  [BCFormationFormControls.AddressLine2]: new FormControl(mailAddress?.addressLine2 ?? prefill.mailingAddress.addressLine2, Validators.maxLength(40)),
84678
84689
  [BCFormationFormControls.City]: new FormControl(mailAddress?.city ?? prefill.mailingAddress.city, [Validators.required, Validators.maxLength(40)]),
84679
- [BCFormationFormControls.ProvinceState]: new FormControl(mailAddress?.provinceState ?? prefill.mailingAddress.provinceState),
84680
- [BCFormationFormControls.PostalZip]: new FormControl(mailAddress?.postalZip ?? prefill.mailingAddress.postalZip, [Validators.required, Validators.maxLength(10)]),
84690
+ // The API requires a province / state when the country is Canada or the United States.
84691
+ [BCFormationFormControls.ProvinceState]: new FormControl(mailAddress?.provinceState ?? prefill.mailingAddress.provinceState, requiredIfValueIn(BCFormationFormControls.Country, ["Canada", "United States"])),
84692
+ [BCFormationFormControls.PostalZip]: new FormControl(mailAddress?.postalZip ?? prefill.mailingAddress.postalZip, [Validators.required, Validators.maxLength(10), ifCanada(Validators.pattern(BC_CANADIAN_POSTAL_PATTERN))]),
84681
84693
  [BCFormationFormControls.Country]: new FormControl(mailAddress?.country ?? (prefill.mailingAddress.country || BC_DEFAULT_COUNTRY), Validators.required),
84682
84694
  [BCFormationFormControls.HasConfirmedCompletion]: new FormControl(deltaData?.hasConfirmedCompletion ?? false, Validators.requiredTrue),
84683
84695
  [BCFormationFormControls.HasRequiredDocuments]: new FormControl(deltaData?.hasRequiredDocuments ?? false, Validators.requiredTrue)
@@ -84713,7 +84725,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
84713
84725
  lastName: isPerson ? certified?.lastName ?? "" : "",
84714
84726
  email: certified?.email ?? "",
84715
84727
  mailingAddress: {
84716
- addressLine1: [streetNumber, streetName].filter(Boolean).join(" ") || address?.street || "",
84728
+ addressLine1: [streetNumber, streetName].filter(Boolean).join(" ") || getAddressComponent(address, "Street Address") || address?.street || "",
84717
84729
  addressLine2: getAddressComponent(address, "Suite/Apartment") || address?.address2 || "",
84718
84730
  city: address?.city ?? "",
84719
84731
  provinceState: address?.province_state ?? "",
@@ -85003,6 +85015,8 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85003
85015
  label: "Postal / Zip Code",
85004
85016
  formControlName: BCFormationFormControls.PostalZip,
85005
85017
  required: true,
85018
+ errorMessage: "Enter a valid Canadian postal code (for example V8W 1X4)",
85019
+ showRequiredMessage: true,
85006
85020
  class: "column-2"
85007
85021
  },
85008
85022
  {
@@ -85011,7 +85025,11 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85011
85025
  formControlName: BCFormationFormControls.Country,
85012
85026
  required: true,
85013
85027
  options: BC_COMPLETING_PARTY_COUNTRY_OPTIONS,
85014
- class: "span-4"
85028
+ class: "span-4",
85029
+ // Province / State is required for Canada and the US, and the postal code format is Canada-only.
85030
+ onChange: (form) => {
85031
+ [BCFormationFormControls.ProvinceState, BCFormationFormControls.PostalZip].forEach((control) => form.get(control)?.updateValueAndValidity({ emitEvent: false }));
85032
+ }
85015
85033
  },
85016
85034
  {
85017
85035
  type: FormType.Checkbox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyedurham/search-and-file-widget",
3
- "version": "2.0.70",
3
+ "version": "2.0.72",
4
4
  "description": "",
5
5
  "main": "dnd-filing-shell.js",
6
6
  "scripts": {