@mindbill/react 0.23.0 → 0.23.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.
package/dist/index.d.ts CHANGED
@@ -504,7 +504,7 @@ type BillSubmissionFormProps = {
504
504
  */
505
505
  children?: ReactNode;
506
506
  };
507
- declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.dateOfBirth", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "claim.claimsAdministrator", "service.date", "serviceLines[].code", "serviceLines[].units"];
507
+ declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.dateOfBirth", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "claim.claimsAdministrator", "service.date", "diagnoses[]", "serviceLines[].code", "serviceLines[].units"];
508
508
  type BillSubmissionValidation = {
509
509
  valid: boolean;
510
510
  fieldErrors: Record<string, string>;
package/dist/index.js CHANGED
@@ -1304,6 +1304,7 @@ var BILL_SUBMISSION_REQUIRED_FIELDS = [
1304
1304
  "claim.claimNumber",
1305
1305
  "claim.claimsAdministrator",
1306
1306
  "service.date",
1307
+ "diagnoses[]",
1307
1308
  "serviceLines[].code",
1308
1309
  "serviceLines[].units"
1309
1310
  ];
@@ -1446,6 +1447,9 @@ function validateBillSubmission(bill) {
1446
1447
  required("claim.claimNumber", bill.claim.claimNumber, "Enter the claim number.");
1447
1448
  required("claim.claimsAdministrator", bill.claim.claimsAdministrator?.name, "Select a claims administrator so MindBill can route this bill.");
1448
1449
  required("service.date", bill.service.date, "Enter the date of service.");
1450
+ if (!(bill.diagnoses ?? []).some((code) => code.trim())) {
1451
+ errors.diagnoses = "Select at least one ICD-10 diagnosis code.";
1452
+ }
1449
1453
  if (bill.claim.claimsAdministrator?.name && !bill.claim.claimsAdministrator.id) {
1450
1454
  errors["claim.claimsAdministrator"] = "Select a claims administrator from the payer directory.";
1451
1455
  }
@@ -1863,7 +1867,7 @@ function BillSubmissionForm({
1863
1867
  /* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
1864
1868
  /* @__PURE__ */ jsx3(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => setBill((c) => ({ ...c, claim: { ...c.claim, claimsAdministrator: { id: option.id, name: option.label } } })) }) }),
1865
1869
  /* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
1866
- /* @__PURE__ */ jsxs3(Field2, { label: "Diagnosis codes (ICD-10)", span: true, children: [
1870
+ /* @__PURE__ */ jsxs3(Field2, { path: "diagnoses", label: "Diagnosis codes (ICD-10)", required: true, span: true, error: errors.diagnoses, children: [
1867
1871
  /* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
1868
1872
  const selected = (bill.diagnoses ?? []).includes(option.code);
1869
1873
  return /* @__PURE__ */ jsxs3("button", { className: "mbsf-quick-pick", "data-selected": selected, type: "button", "aria-pressed": selected, title: `${option.code} \u2014 ${option.description}`, onClick: () => setBill((current) => ({ ...current, diagnoses: selected ? (current.diagnoses ?? []).filter((code) => code !== option.code) : [.../* @__PURE__ */ new Set([...current.diagnoses ?? [], option.code])] })), children: [
@@ -1880,7 +1884,7 @@ function BillSubmissionForm({
1880
1884
  /* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
1881
1885
  ] }, code);
1882
1886
  }) }),
1883
- /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
1887
+ /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", invalid: Boolean(errors.diagnoses), disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
1884
1888
  if (diagnosisQuery !== "") loadDiagnoses("");
1885
1889
  }, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
1886
1890
  ] })