@dyedurham/search-and-file-widget 2.0.62 → 2.0.63

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.
@@ -92514,11 +92514,34 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92514
92514
  });
92515
92515
 
92516
92516
  // src/app/services/british-columbia/british-columbia-formation.service.ts
92517
- function toValidateErrors(errors) {
92518
- if (!errors?.length) {
92519
- return void 0;
92517
+ function toValidateErrors(payload) {
92518
+ const out = [];
92519
+ const errors = payload?.errors;
92520
+ if (Array.isArray(errors)) {
92521
+ for (const e of errors) {
92522
+ if (typeof e === "string") {
92523
+ out.push({ Message: e });
92524
+ } else if (e?.message) {
92525
+ out.push({ Code: e.code, Message: e.message });
92526
+ }
92527
+ }
92528
+ } else if (errors && typeof errors === "object") {
92529
+ for (const [field, messages] of Object.entries(errors)) {
92530
+ for (const message of Array.isArray(messages) ? messages : [messages]) {
92531
+ out.push({ Code: field, Message: `${field}: ${String(message)}` });
92532
+ }
92533
+ }
92520
92534
  }
92521
- return errors.map((e) => ({ Code: e.code, Message: e.message }));
92535
+ for (const message of payload?.additionalInformation ?? []) {
92536
+ out.push({ Message: message });
92537
+ }
92538
+ if (!out.length) {
92539
+ const fallback = payload?.detail ?? payload?.message ?? payload?.title;
92540
+ if (fallback) {
92541
+ out.push({ Message: fallback });
92542
+ }
92543
+ }
92544
+ return out.length ? out : void 0;
92522
92545
  }
92523
92546
  var INCORPORATION_PATH, TEMP_UAT_BC_FILING_URL, BritishColumbiaFormationService;
92524
92547
  var init_british_columbia_formation_service = __esm({
@@ -92553,7 +92576,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92553
92576
  Status: payload?.status,
92554
92577
  ServiceOrderId: payload?.serviceOrderId,
92555
92578
  Draft: payload?.draft,
92556
- Errors: toValidateErrors(payload?.errors)
92579
+ Errors: toValidateErrors(payload)
92557
92580
  };
92558
92581
  const statusFailed = Boolean(result.Status) && result.Status !== "success";
92559
92582
  if (resp.ok && !statusFailed && result.ServiceOrderId && !result.Errors?.length) {
@@ -92596,9 +92619,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92596
92619
  const result = {
92597
92620
  Status: payload?.status,
92598
92621
  ServiceOrderId: serviceOrderId,
92599
- Errors: failed ? toValidateErrors(payload?.errors) ?? (payload?.additionalInformation ?? [payload?.status ?? "failed"]).map((message) => ({
92600
- Message: message
92601
- })) : void 0
92622
+ Errors: failed ? toValidateErrors(payload) ?? [{ Message: payload?.status ?? "failed" }] : void 0
92602
92623
  };
92603
92624
  if (failed) {
92604
92625
  const err = buildGenericError(resp.status, "eCore submit failed", result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyedurham/search-and-file-widget",
3
- "version": "2.0.62",
3
+ "version": "2.0.63",
4
4
  "description": "",
5
5
  "main": "dnd-filing-shell.js",
6
6
  "scripts": {