@dyedurham/search-and-file-widget 2.0.99 → 2.1.1

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 +31 -11
  2. package/package.json +11 -11
@@ -85111,7 +85111,8 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85111
85111
  const pick = BritishColumbiaFormationFormHelper.pickAddress;
85112
85112
  const registeredOffice = BritishColumbiaFormationFormHelper.findSharedAddressAffiliation(affiliations, AddressTitle2.REGISTERED_OFFICE);
85113
85113
  const recordsOffice = BritishColumbiaFormationFormHelper.findSharedAddressAffiliation(affiliations, AddressTitle2.RECORDS_OFFICE);
85114
- const seed = delta?.registeredOffice ? delta : this.seedFromIncomingAffiliations(task);
85114
+ const incoming = this.incomingOfficeAddresses(task);
85115
+ const seed = delta?.registeredOffice ? this.fillEmptyAddresses(delta, incoming) : this.seedFromIncomingAffiliations(task);
85115
85116
  const config2 = {};
85116
85117
  config2[BCChangeOfOfficeAddressesFormGroups.ReferenceNumbers] = this.generateReferenceNumbersFormGroup(delta?.referenceNumbers, task.entity._profile.client_matter_number);
85117
85118
  config2[BCChangeOfOfficeAddressesFormGroups.CorporationDetails] = new FormGroup({
@@ -85122,7 +85123,6 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85122
85123
  config2[BCChangeOfOfficeAddressesFormGroups.AnnualReportReminder] = new FormGroup({
85123
85124
  [Controls2.AnnualReportReminder]: new FormControl(delta?.annualReportReminder ?? BCAnnualReportReminder.Yes, Validators.required)
85124
85125
  });
85125
- const incoming = this.incomingOfficeAddresses(task);
85126
85126
  const regDeliverySame = seed.registeredOffice?.deliverySameAsMailing ?? true;
85127
85127
  config2[BCChangeOfOfficeAddressesFormGroups.RegisteredOfficeAddress] = new FormGroup({
85128
85128
  [Controls2.CurrentMailingAddress]: this.readOnly(format(pick(registeredOffice?.addresses, "Mailing"))),
@@ -85184,14 +85184,29 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85184
85184
  }
85185
85185
  };
85186
85186
  }
85187
+ /** Keeps the saved flags and addresses, but fills an address the draft left empty from `incoming`. */
85188
+ static fillEmptyAddresses(saved, incoming) {
85189
+ const hasValues = (address) => EDITABLE_ADDRESS_CONTROLS.some((name) => Boolean(address?.[name]));
85190
+ const pick = (savedAddress, incomingAddress) => hasValues(savedAddress) ? savedAddress : incomingAddress ?? savedAddress;
85191
+ return {
85192
+ registeredOffice: __spreadProps(__spreadValues({}, saved.registeredOffice), {
85193
+ mailingAddress: pick(saved.registeredOffice?.mailingAddress, incoming.regMailing),
85194
+ deliveryAddress: pick(saved.registeredOffice?.deliveryAddress, incoming.regDelivery)
85195
+ }),
85196
+ recordsOffice: __spreadProps(__spreadValues({}, saved.recordsOffice), {
85197
+ mailingAddress: pick(saved.recordsOffice?.mailingAddress, incoming.recMailing),
85198
+ deliveryAddress: pick(saved.recordsOffice?.deliveryAddress, incoming.recDelivery)
85199
+ })
85200
+ };
85201
+ }
85187
85202
  /** The four office addresses of the task's incoming Shared Address, as form values. */
85188
85203
  static incomingOfficeAddresses(task) {
85189
85204
  const incoming = task.incomingAffiliations ?? [];
85190
85205
  const pickBy = (title, locationType) => {
85191
- const affiliation = BritishColumbiaFormationFormHelper.findSharedAddressAffiliation(incoming, title);
85192
- const pool = affiliation?.addresses?.length ? affiliation.addresses : affiliation?.parent_affiliation?.addresses;
85193
- const address = pool?.find((a) => (a.computed_location_type ?? a.location_type)?.toLowerCase() === locationType.toLowerCase());
85194
- return address ? this.toOfficeAddressDelta(address) : void 0;
85206
+ const pool = incoming.filter((a) => a.role?.role_name === AddressRole2.SHARED_ADDRESS && a.role?.static_title === title).flatMap((a) => a.addresses?.length ? a.addresses : a.parent_affiliation?.addresses ?? []);
85207
+ const wanted = locationType.toLowerCase();
85208
+ const address = pool.find((a) => (a.computed_location_type ?? "").toLowerCase() === wanted || (a.location_type ?? "").toLowerCase() === wanted);
85209
+ return address && this.isBritishColumbia(address) ? this.toOfficeAddressDelta(address) : void 0;
85195
85210
  };
85196
85211
  return {
85197
85212
  regMailing: pickBy(AddressTitle2.REGISTERED_OFFICE, "Mailing"),
@@ -85202,16 +85217,21 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
85202
85217
  }
85203
85218
  /** Street = street number + street name; the suite goes to Address Line 2. */
85204
85219
  static toOfficeAddressDelta(address) {
85205
- const street = [getAddressComponent(address, "Street Number Only"), getAddressComponent(address, "Street Only")].filter(Boolean).join(" ") || address.street || "";
85220
+ const street = [getAddressComponent(address, "Street Number Only"), getAddressComponent(address, "Street Only")].filter(Boolean).join(" ") || getAddressComponent(address, "Street Address") || address.street || "";
85206
85221
  return {
85207
85222
  addressLine1: street,
85208
- addressLine2: getAddressComponent(address, "Suite/Apartment"),
85223
+ addressLine2: getAddressComponent(address, "Suite/Apartment") || address.address2 || "",
85209
85224
  city: address.city ?? "",
85210
85225
  postalCode: address.postal_zip ?? "",
85211
85226
  province: BC_DEFAULT_PROVINCE_STATE,
85212
85227
  country: BC_DEFAULT_COUNTRY
85213
85228
  };
85214
85229
  }
85230
+ /** An address with no province is accepted; the form only ever deals in British Columbia. */
85231
+ static isBritishColumbia(address) {
85232
+ const province = (address.province_state ?? "").trim().toLowerCase();
85233
+ return !province || ["bc", "b.c.", "british columbia"].includes(province);
85234
+ }
85215
85235
  static isSameOfficeAddress(a, b) {
85216
85236
  const key = (x) => [x?.addressLine1, x?.addressLine2, x?.city, x?.postalCode].map((v) => (v ?? "").trim().toLowerCase().replace(/\s+/g, " ")).join("|");
85217
85237
  return key(a) === key(b);
@@ -88174,7 +88194,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
88174
88194
  FormGroupDirective,
88175
88195
  FormControlName,
88176
88196
  TranslatePipe
88177
- ], styles: ["\n\n[_nghost-%COMP%] {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-content[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex: 1;\n overflow-y: auto;\n min-height: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\n color: #6b7280;\n font-size: 14px;\n line-height: 1.5;\n margin: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] mat-radio-group[_ngcontent-%COMP%] {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] .mat-mdc-radio-button .mdc-label {\n color: #4b5563;\n font-size: 14px;\n line-height: 1.45;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] .mat-mdc-radio-button {\n --mdc-radio-state-layer-size: 40px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-item[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-item-title[_ngcontent-%COMP%] {\n color: var(--filing-modal-color-dark-blue);\n}\n/*# sourceMappingURL=change-of-office-addresses-form.component.css.map */"], changeDetection: 0 });
88197
+ ], styles: ["\n\n[_nghost-%COMP%] {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-content[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex: 1;\n overflow-y: auto;\n min-height: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] p[_ngcontent-%COMP%] {\n color: #6b7280;\n font-size: 14px;\n line-height: 1.5;\n margin: 0;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] mat-radio-group[_ngcontent-%COMP%] {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] .mat-mdc-radio-button .mdc-label {\n color: #4b5563 !important;\n font-size: 14px !important;\n line-height: 1.45;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form[_ngcontent-%COMP%] .annual-reminder[_ngcontent-%COMP%] .mat-mdc-radio-button {\n --mdc-radio-state-layer-size: 40px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-item[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n[_nghost-%COMP%] .change-of-office-addresses-form-item-title[_ngcontent-%COMP%] {\n color: var(--filing-modal-color-dark-blue);\n}\n/*# sourceMappingURL=change-of-office-addresses-form.component.css.map */"], changeDetection: 0 });
88178
88198
  };
88179
88199
  (() => {
88180
88200
  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BritishColumbiaChangeOfOfficeAddressesFormComponent, [{
@@ -88377,7 +88397,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
88377
88397
  }\r
88378
88398
  </div>\r
88379
88399
  </div>\r
88380
- `, styles: ["/* src/app/components/british-columbia/change-of-office-addresses/change-of-office-addresses-form/change-of-office-addresses-form.component.scss */\n:host {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n:host .change-of-office-addresses-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n:host .change-of-office-addresses-form-content {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex: 1;\n overflow-y: auto;\n min-height: 0;\n}\n:host .change-of-office-addresses-form .annual-reminder {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .change-of-office-addresses-form .annual-reminder p {\n color: #6b7280;\n font-size: 14px;\n line-height: 1.5;\n margin: 0;\n}\n:host .change-of-office-addresses-form .annual-reminder mat-radio-group {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n:host .change-of-office-addresses-form .annual-reminder ::ng-deep .mat-mdc-radio-button .mdc-label {\n color: #4b5563;\n font-size: 14px;\n line-height: 1.45;\n}\n:host .change-of-office-addresses-form .annual-reminder ::ng-deep .mat-mdc-radio-button {\n --mdc-radio-state-layer-size: 40px;\n}\n:host .change-of-office-addresses-form-item {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .change-of-office-addresses-form-item-title {\n color: var(--filing-modal-color-dark-blue);\n}\n/*# sourceMappingURL=change-of-office-addresses-form.component.css.map */\n"] }]
88400
+ `, styles: ["/* src/app/components/british-columbia/change-of-office-addresses/change-of-office-addresses-form/change-of-office-addresses-form.component.scss */\n:host {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0;\n}\n:host .change-of-office-addresses-form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n height: 100%;\n}\n:host .change-of-office-addresses-form-content {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex: 1;\n overflow-y: auto;\n min-height: 0;\n}\n:host .change-of-office-addresses-form .annual-reminder {\n display: flex;\n flex-direction: column;\n gap: 24px;\n}\n:host .change-of-office-addresses-form .annual-reminder p {\n color: #6b7280;\n font-size: 14px;\n line-height: 1.5;\n margin: 0;\n}\n:host .change-of-office-addresses-form .annual-reminder mat-radio-group {\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n:host .change-of-office-addresses-form .annual-reminder ::ng-deep .mat-mdc-radio-button .mdc-label {\n color: #4b5563 !important;\n font-size: 14px !important;\n line-height: 1.45;\n}\n:host .change-of-office-addresses-form .annual-reminder ::ng-deep .mat-mdc-radio-button {\n --mdc-radio-state-layer-size: 40px;\n}\n:host .change-of-office-addresses-form-item {\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n:host .change-of-office-addresses-form-item-title {\n color: var(--filing-modal-color-dark-blue);\n}\n/*# sourceMappingURL=change-of-office-addresses-form.component.css.map */\n"] }]
88381
88401
  }], null, null);
88382
88402
  })();
88383
88403
  (() => {
@@ -95791,7 +95811,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
95791
95811
  const { ecoreClientId, ecoreUserId } = this.config ?? {};
95792
95812
  const headers = __spreadValues(__spreadValues(__spreadValues({
95793
95813
  "x-target-url": targetUrl
95794
- }, ecoreClientId ? { "x-ecore-client-id": String(ecoreClientId) } : {}), ecoreUserId ? { "x-ecore-user-id": String(ecoreUserId) } : {}), opts.headers ?? {});
95814
+ }, ecoreClientId ? { ClientId: String(ecoreClientId) } : {}), ecoreUserId ? { UserId: String(ecoreUserId) } : {}), opts.headers ?? {});
95795
95815
  const resp = yield fetchWithJwtRetry(signature, () => method === "POST" && payload !== void 0 ? postJson(fetchFn, signature.proxyApiUrl, signature.jwtToken, payload, headers) : fetchFn(signature.proxyApiUrl, {
95796
95816
  method,
95797
95817
  headers: __spreadValues({ Authorization: `Bearer ${signature.jwtToken}` }, headers)
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
- {
2
- "name": "@dyedurham/search-and-file-widget",
3
- "version": "2.0.99",
4
- "description": "",
5
- "main": "dnd-filing-shell.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "author": "",
10
- "license": "ISC"
11
- }
1
+ {
2
+ "name": "@dyedurham/search-and-file-widget",
3
+ "version": "2.1.1",
4
+ "description": "",
5
+ "main": "dnd-filing-shell.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC"
11
+ }