@dyedurham/search-and-file-widget 2.0.61 → 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.
Files changed (2) hide show
  1. package/dnd-filing-shell.js +35 -13
  2. package/package.json +1 -1
@@ -92514,19 +92514,43 @@ 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
- var INCORPORATION_PATH, BritishColumbiaFormationService;
92546
+ var INCORPORATION_PATH, TEMP_UAT_BC_FILING_URL, BritishColumbiaFormationService;
92524
92547
  var init_british_columbia_formation_service = __esm({
92525
92548
  "src/app/services/british-columbia/british-columbia-formation.service.ts"() {
92526
92549
  init_core();
92527
92550
  init_common_utils();
92528
92551
  init_core();
92529
92552
  INCORPORATION_PATH = "filings/ca/bc/incorporation";
92553
+ TEMP_UAT_BC_FILING_URL = "https://uat3-onbis.oncorp.com/eCoreBcApi/";
92530
92554
  BritishColumbiaFormationService = class _BritishColumbiaFormationService {
92531
92555
  config;
92532
92556
  setConfig(config2) {
@@ -92538,7 +92562,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92538
92562
  ensureAuthInputs(signature);
92539
92563
  const fetchFn = opts.fetchImpl ?? fetch;
92540
92564
  const resp = yield fetchWithJwtRetry(signature, () => postJson(fetchFn, signature.proxyApiUrl, signature.jwtToken, requestBody, {
92541
- "x-target-url": this.targetUrl(INCORPORATION_PATH)
92565
+ "x-target-url": this.targetUrl(signature.env, INCORPORATION_PATH)
92542
92566
  }));
92543
92567
  const raw = yield resp.text();
92544
92568
  const parsed = tryParseJson(raw);
@@ -92552,7 +92576,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92552
92576
  Status: payload?.status,
92553
92577
  ServiceOrderId: payload?.serviceOrderId,
92554
92578
  Draft: payload?.draft,
92555
- Errors: toValidateErrors(payload?.errors)
92579
+ Errors: toValidateErrors(payload)
92556
92580
  };
92557
92581
  const statusFailed = Boolean(result.Status) && result.Status !== "success";
92558
92582
  if (resp.ok && !statusFailed && result.ServiceOrderId && !result.Errors?.length) {
@@ -92576,7 +92600,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92576
92600
  method: "POST",
92577
92601
  headers: {
92578
92602
  Authorization: `Bearer ${signature.jwtToken}`,
92579
- "x-target-url": this.targetUrl(`${INCORPORATION_PATH}/${encodeURIComponent(serviceOrderId)}/submit`)
92603
+ "x-target-url": this.targetUrl(signature.env, `${INCORPORATION_PATH}/${encodeURIComponent(serviceOrderId)}/submit`)
92580
92604
  }
92581
92605
  }));
92582
92606
  const raw = yield resp.text();
@@ -92595,9 +92619,7 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92595
92619
  const result = {
92596
92620
  Status: payload?.status,
92597
92621
  ServiceOrderId: serviceOrderId,
92598
- Errors: failed ? toValidateErrors(payload?.errors) ?? (payload?.additionalInformation ?? [payload?.status ?? "failed"]).map((message) => ({
92599
- Message: message
92600
- })) : void 0
92622
+ Errors: failed ? toValidateErrors(payload) ?? [{ Message: payload?.status ?? "failed" }] : void 0
92601
92623
  };
92602
92624
  if (failed) {
92603
92625
  const err = buildGenericError(resp.status, "eCore submit failed", result);
@@ -92615,8 +92637,8 @@ Note: Recommended intrinsic image size is calculated assuming a maximum DPR of $
92615
92637
  serviceOrderId
92616
92638
  });
92617
92639
  }
92618
- targetUrl(path) {
92619
- const base = this.config?.BCFiling;
92640
+ targetUrl(env, path) {
92641
+ const base = this.config?.BCFiling || (env === "TEST" ? TEMP_UAT_BC_FILING_URL : void 0);
92620
92642
  if (!base) {
92621
92643
  throw new Error("Missing config.BCFiling (British Columbia filing service URL).");
92622
92644
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyedurham/search-and-file-widget",
3
- "version": "2.0.61",
3
+ "version": "2.0.63",
4
4
  "description": "",
5
5
  "main": "dnd-filing-shell.js",
6
6
  "scripts": {