@mindbill/react 0.21.2 → 0.22.0
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/README.md +76 -0
- package/dist/index.d.ts +109 -12
- package/dist/index.js +775 -397
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -40,20 +40,20 @@ var mindBillThemePresets = {
|
|
|
40
40
|
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
41
41
|
},
|
|
42
42
|
"orange-bright": {
|
|
43
|
-
accentColor: "#
|
|
43
|
+
accentColor: "#f4510b",
|
|
44
44
|
accentTextColor: "#ffffff",
|
|
45
45
|
backgroundColor: "#fffaf6",
|
|
46
|
-
surfaceColor: "#
|
|
46
|
+
surfaceColor: "#fffefd",
|
|
47
47
|
inputBackgroundColor: "#ffffff",
|
|
48
|
-
textColor: "#
|
|
48
|
+
textColor: "#090f1f",
|
|
49
49
|
mutedColor: "#626a73",
|
|
50
|
-
borderColor: "#
|
|
51
|
-
borderRadius: "
|
|
52
|
-
controlRadius: "
|
|
53
|
-
shadow: "0
|
|
54
|
-
dangerColor: "#
|
|
55
|
-
successColor: "#
|
|
56
|
-
warningColor: "#
|
|
50
|
+
borderColor: "#e7e1da",
|
|
51
|
+
borderRadius: "16px",
|
|
52
|
+
controlRadius: "10px",
|
|
53
|
+
shadow: "0 12px 36px rgba(244,81,11,.08), 0 1px 2px rgba(9,15,31,.05)",
|
|
54
|
+
dangerColor: "#c4322b",
|
|
55
|
+
successColor: "#16835b",
|
|
56
|
+
warningColor: "#a65f00",
|
|
57
57
|
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
58
58
|
},
|
|
59
59
|
"clinical-blue": {
|
|
@@ -1155,7 +1155,7 @@ var READ_ONLY_STYLES = `
|
|
|
1155
1155
|
`;
|
|
1156
1156
|
|
|
1157
1157
|
// src/bill-submission-form.tsx
|
|
1158
|
-
import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
1158
|
+
import { createContext, useCallback, useContext, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
1159
1159
|
import {
|
|
1160
1160
|
createBillReferenceClient
|
|
1161
1161
|
} from "@mindbill/browser";
|
|
@@ -1528,6 +1528,33 @@ function mergeOptions(defaults, supplied) {
|
|
|
1528
1528
|
function mergeDiagnosisOptions(options) {
|
|
1529
1529
|
return [...new Map(options.map((item) => [item.code.toUpperCase(), item])).values()].sort((left, right) => left.code.localeCompare(right.code, void 0, { numeric: true }));
|
|
1530
1530
|
}
|
|
1531
|
+
var BillSubmissionSectionsContext = createContext(null);
|
|
1532
|
+
function BillSubmissionSection({ id }) {
|
|
1533
|
+
const sections = useContext(BillSubmissionSectionsContext);
|
|
1534
|
+
if (!sections) throw new Error("Bill submission sections must be rendered inside BillSubmissionForm.");
|
|
1535
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: sections[id] });
|
|
1536
|
+
}
|
|
1537
|
+
function BillSubmissionHeader() {
|
|
1538
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "header" });
|
|
1539
|
+
}
|
|
1540
|
+
function BillSubmissionPatientSection() {
|
|
1541
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "patient" });
|
|
1542
|
+
}
|
|
1543
|
+
function BillSubmissionClaimSection() {
|
|
1544
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "claim" });
|
|
1545
|
+
}
|
|
1546
|
+
function BillSubmissionProvidersSection() {
|
|
1547
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "providers" });
|
|
1548
|
+
}
|
|
1549
|
+
function BillSubmissionServiceLinesSection() {
|
|
1550
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "serviceLines" });
|
|
1551
|
+
}
|
|
1552
|
+
function BillSubmissionAttachmentsSection() {
|
|
1553
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "attachments" });
|
|
1554
|
+
}
|
|
1555
|
+
function BillSubmissionActions() {
|
|
1556
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "actions" });
|
|
1557
|
+
}
|
|
1531
1558
|
function BillSubmissionForm({
|
|
1532
1559
|
initialBill,
|
|
1533
1560
|
attachments = EMPTY_ATTACHMENTS,
|
|
@@ -1548,7 +1575,8 @@ function BillSubmissionForm({
|
|
|
1548
1575
|
disabled = false,
|
|
1549
1576
|
submitLabel = "Submit bill",
|
|
1550
1577
|
heading = "Bill information",
|
|
1551
|
-
description = "Review the bill details, add attachments, and submit."
|
|
1578
|
+
description = "Review the bill details, add attachments, and submit.",
|
|
1579
|
+
children
|
|
1552
1580
|
}) {
|
|
1553
1581
|
const [bill, setBill] = useState2(() => cloneBill(initialBill));
|
|
1554
1582
|
const [selectedIds, setSelectedIds] = useState2(() => attachments.map((item) => item.id));
|
|
@@ -1740,197 +1768,481 @@ function BillSubmissionForm({
|
|
|
1740
1768
|
}
|
|
1741
1769
|
}
|
|
1742
1770
|
const claimsAdministratorError = errors["claim.claimsAdministrator"] ?? (!bill.claim.claimsAdministrator?.id ? "Required for routing \u2014 search and select a claims administrator." : void 0);
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
/* @__PURE__ */ jsxs3("
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
|
|
1751
|
-
|
|
1771
|
+
const headerSection = /* @__PURE__ */ jsxs3("div", { className: "mbsf-head", children: [
|
|
1772
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1773
|
+
/* @__PURE__ */ jsx3("h3", { className: "mbsf-title", children: heading }),
|
|
1774
|
+
/* @__PURE__ */ jsx3("p", { className: "mbsf-copy", children: description })
|
|
1775
|
+
] }),
|
|
1776
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
|
|
1777
|
+
/* @__PURE__ */ jsx3(RequiredMark, {}),
|
|
1778
|
+
" Required"
|
|
1779
|
+
] })
|
|
1780
|
+
] });
|
|
1781
|
+
const patientSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1782
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Patient" }),
|
|
1783
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1784
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.firstName", label: "First name", required: true, error: errors["patient.firstName"], children: text(bill.patient.firstName, (firstName) => setBill((c) => ({ ...c, patient: { ...c.patient, firstName } }))) }),
|
|
1785
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.lastName", label: "Last name", required: true, error: errors["patient.lastName"], children: text(bill.patient.lastName, (lastName) => setBill((c) => ({ ...c, patient: { ...c.patient, lastName } }))) }),
|
|
1786
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
|
|
1787
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
|
|
1788
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.dateOfBirth", label: "Date of birth", required: true, error: errors["patient.dateOfBirth"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of birth", value: bill.patient.dateOfBirth, disabled: locked, required: true, onChange: (dateOfBirth) => setBill((c) => ({ ...c, patient: { ...c.patient, dateOfBirth } })) }) }),
|
|
1789
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.address.line1", label: "Address", required: true, span: true, error: errors["patient.address.line1"], children: text(bill.patient.address.line1, (line1) => setAddress({ line1 }), { placeholder: "Street address" }) }),
|
|
1790
|
+
/* @__PURE__ */ jsxs3(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
|
|
1791
|
+
text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
|
|
1792
|
+
postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
|
|
1752
1793
|
] }),
|
|
1753
|
-
/* @__PURE__ */
|
|
1754
|
-
|
|
1755
|
-
|
|
1794
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.address.city", label: "City", required: true, error: errors["patient.address.city"], children: text(bill.patient.address.city, (city) => setAddress({ city })) }),
|
|
1795
|
+
/* @__PURE__ */ jsx3(Field2, { path: "patient.address.state", label: "State", required: true, error: errors["patient.address.state"], children: text(bill.patient.address.state, (state) => setAddress({ state: state.toUpperCase() }), { maxLength: 2 }) })
|
|
1796
|
+
] })
|
|
1797
|
+
] });
|
|
1798
|
+
const claimSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1799
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Injury & claim" }),
|
|
1800
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1801
|
+
/* @__PURE__ */ jsx3(Field2, { path: "service.date", label: "Date of service", required: true, error: errors["service.date"], children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of service", value: bill.service.date, disabled: locked, required: true, onChange: (date2) => setBill((c) => ({ ...c, service: { ...c.service, date: date2 } })) }) }),
|
|
1802
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Date of injury", children: /* @__PURE__ */ jsx3(TextDateInput, { ariaLabel: "Date of injury", value: bill.claim.dateOfInjury, disabled: locked, onChange: (dateOfInjury) => setBill((c) => ({ ...c, claim: { ...c.claim, dateOfInjury } })) }) }),
|
|
1803
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Employer (optional)", children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
|
|
1804
|
+
/* @__PURE__ */ jsx3(Field2, { path: "claim.claimNumber", label: "Claim number", required: true, error: errors["claim.claimNumber"], children: text(bill.claim.claimNumber, (claimNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, claimNumber } }))) }),
|
|
1805
|
+
/* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
|
|
1806
|
+
/* @__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 } } })) }) }),
|
|
1807
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
|
|
1808
|
+
/* @__PURE__ */ jsxs3(Field2, { label: "Diagnosis codes (ICD-10)", span: true, children: [
|
|
1809
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
|
|
1810
|
+
const selected = (bill.diagnoses ?? []).includes(option.code);
|
|
1811
|
+
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: [
|
|
1812
|
+
selected ? "\u2713" : "+",
|
|
1813
|
+
" ",
|
|
1814
|
+
option.label
|
|
1815
|
+
] }, option.code);
|
|
1816
|
+
}) }),
|
|
1817
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
|
|
1818
|
+
const option = [...BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, ...diagnosisChoices].find((item) => item.code === code);
|
|
1819
|
+
return /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
|
|
1820
|
+
/* @__PURE__ */ jsx3("strong", { children: code }),
|
|
1821
|
+
option?.description ? ` ${option.description}` : "",
|
|
1822
|
+
/* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
|
|
1823
|
+
] }, code);
|
|
1824
|
+
}) }),
|
|
1825
|
+
/* @__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: () => {
|
|
1826
|
+
if (diagnosisQuery !== "") loadDiagnoses("");
|
|
1827
|
+
}, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
|
|
1756
1828
|
] })
|
|
1757
|
-
] })
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1829
|
+
] })
|
|
1830
|
+
] });
|
|
1831
|
+
const providersSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1832
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
|
|
1833
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1834
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing provider", children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
|
|
1835
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing tax ID", children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } }))) }),
|
|
1836
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing NPI", children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } }))) }),
|
|
1837
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing phone", children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
|
|
1838
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Rendering provider", children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
|
|
1839
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Specialty", children: text(bill.renderingProvider?.specialty, (specialty) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, specialty } }))) }),
|
|
1840
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Rendering NPI", children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } }))) }),
|
|
1841
|
+
/* @__PURE__ */ jsx3(Field2, { label: "License number", children: text(bill.renderingProvider?.licenseNumber, (licenseNumber) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseNumber } }))) }),
|
|
1842
|
+
/* @__PURE__ */ jsx3(Field2, { label: "License state", children: text(bill.renderingProvider?.licenseState, (licenseState) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseState: licenseState.toUpperCase() } })), { maxLength: 2 }) }),
|
|
1843
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Service location", children: text(bill.serviceLocation?.name, (name) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, name } }))) }),
|
|
1844
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Place of service", children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { maxLength: 2 }) })
|
|
1845
|
+
] })
|
|
1846
|
+
] });
|
|
1847
|
+
const serviceLinesSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1848
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
|
|
1849
|
+
/* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
|
|
1850
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-segments", role: "group", "aria-label": "Evaluation type", children: [["qme", "QME (default)"], ["ame", "AME"], ["psych_qme", "Psych QME"]].map(([type, label]) => /* @__PURE__ */ jsx3("button", { className: "mbsf-segment", type: "button", "aria-pressed": evaluationType === type, onClick: () => changeEvaluation(type), children: label }, type)) }),
|
|
1851
|
+
/* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: evaluationType === "ame" ? "Agreed Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -94." : evaluationType === "psych_qme" ? "Psychiatric QME \u2014 eligible ML evaluation codes default to modifier -96 (-95 for ML200)." : "Qualified Medical Evaluator \u2014 eligible ML evaluation codes default to modifier -95." }),
|
|
1852
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
|
|
1853
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-line-head", children: [
|
|
1854
|
+
/* @__PURE__ */ jsx3("span", { children: "Procedure code" }),
|
|
1855
|
+
/* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
|
|
1856
|
+
/* @__PURE__ */ jsx3("span", { children: "Units" }),
|
|
1857
|
+
/* @__PURE__ */ jsx3("span", { children: "Allowed" }),
|
|
1858
|
+
/* @__PURE__ */ jsx3("span", {}),
|
|
1859
|
+
" "
|
|
1860
|
+
] }),
|
|
1861
|
+
bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-line", children: [
|
|
1862
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
|
|
1863
|
+
/* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Procedure code ${index + 1}`, invalid: Boolean(errors[`serviceLines.${index}.code`]), disabled: locked, value: line.code, placeholder: "Search or enter code\u2026", options: procedures.map((item) => ({ id: item.code, label: item.code, detail: item.description })), createOption: customProcedureOption, onSelect: (option) => {
|
|
1864
|
+
const auto = evaluationModifier(evaluationType, option.id);
|
|
1865
|
+
setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
|
|
1866
|
+
} }),
|
|
1867
|
+
line.code ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: procedures.find((item) => item.code === line.code)?.description ?? "Custom CPT, HCPCS, or medical-legal code" }) : null,
|
|
1868
|
+
errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
|
|
1869
|
+
] }),
|
|
1870
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Modifiers", children: [
|
|
1871
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
|
|
1872
|
+
"\u2212",
|
|
1873
|
+
modifier.replace(/^-/, ""),
|
|
1874
|
+
/* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
|
|
1875
|
+
] }, modifier)) }),
|
|
1876
|
+
/* @__PURE__ */ jsx3(ComboBox, { ariaLabel: `Modifiers ${index + 1}`, disabled: locked, value: "", placeholder: line.modifiers?.length ?? 0 ? `${line.modifiers.length} modifier${line.modifiers.length === 1 ? "" : "s"}` : "Add modifiers\u2026", options: modifiers.filter((item) => !(line.modifiers ?? []).includes(item.code)).map((item) => ({ id: item.code, label: `\u2212${item.code}`, detail: item.description })), onSelect: (option) => setLine(index, { modifiers: [.../* @__PURE__ */ new Set([...line.modifiers ?? [], option.id])] }) })
|
|
1770
1877
|
] }),
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
|
|
1878
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
|
|
1879
|
+
/* @__PURE__ */ jsx3("input", { className: "mbsf-input", "aria-label": `Units ${index + 1}`, "aria-invalid": Boolean(errors[`serviceLines.${index}.units`]), type: "number", min: 1, value: line.units ?? 1, onChange: (event) => setLine(index, { units: Number(event.target.value) }) }),
|
|
1880
|
+
errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
|
|
1881
|
+
] }),
|
|
1882
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
|
|
1883
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove service line ${index + 1}`, disabled: locked || !lineHasContent(line) && index === bill.serviceLines.length - 1, onClick: () => setBill((c) => ({ ...c, serviceLines: ensureTrailingBillSubmissionLine(c.serviceLines.filter((_, itemIndex) => itemIndex !== index)) })), children: "\xD7" })
|
|
1884
|
+
] }, index)),
|
|
1885
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
|
|
1886
|
+
/* @__PURE__ */ jsx3("span", { children: "Total" }),
|
|
1887
|
+
/* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
|
|
1773
1888
|
] })
|
|
1774
1889
|
] }),
|
|
1775
|
-
/* @__PURE__ */
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1890
|
+
errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
|
|
1891
|
+
] });
|
|
1892
|
+
const attachmentsSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1893
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
|
|
1894
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
|
|
1895
|
+
attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
|
|
1896
|
+
const auto = attachment.autoAttached || attachment.documentType === "w9";
|
|
1897
|
+
const removable = !auto && attachment.removable !== false;
|
|
1898
|
+
return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
|
|
1899
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
|
|
1900
|
+
auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
|
|
1901
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1902
|
+
/* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
|
|
1903
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
|
|
1904
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
|
|
1905
|
+
] })
|
|
1906
|
+
] }),
|
|
1907
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1908
|
+
attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
|
|
1909
|
+
removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
|
|
1910
|
+
setSelectedIds((current) => current.filter((id) => id !== attachment.id));
|
|
1911
|
+
setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
|
|
1912
|
+
}, children: "\xD7" }) : null
|
|
1913
|
+
] })
|
|
1914
|
+
] }, attachment.id);
|
|
1915
|
+
}),
|
|
1916
|
+
uploads.map((upload, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
|
|
1917
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1918
|
+
/* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
|
|
1919
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
|
|
1920
|
+
(upload.file.size / 1024 / 1024).toFixed(1),
|
|
1921
|
+
" MB"
|
|
1922
|
+
] })
|
|
1923
|
+
] }) }),
|
|
1924
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1925
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
|
|
1926
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
|
|
1805
1927
|
] })
|
|
1806
|
-
] })
|
|
1928
|
+
] }, `${upload.file.name}-${index}`))
|
|
1807
1929
|
] }),
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1930
|
+
/* @__PURE__ */ jsx3("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
|
|
1931
|
+
if (event.target.files) addFiles(event.target.files);
|
|
1932
|
+
event.target.value = "";
|
|
1933
|
+
} }),
|
|
1934
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs3("span", { children: [
|
|
1935
|
+
/* @__PURE__ */ jsx3("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
|
|
1936
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
|
|
1937
|
+
] }) })
|
|
1938
|
+
] });
|
|
1939
|
+
const actionsSection = /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1940
|
+
formError ? /* @__PURE__ */ jsx3("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
|
|
1941
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx3("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
|
|
1942
|
+
] });
|
|
1943
|
+
const sections = {
|
|
1944
|
+
header: headerSection,
|
|
1945
|
+
patient: patientSection,
|
|
1946
|
+
claim: claimSection,
|
|
1947
|
+
providers: providersSection,
|
|
1948
|
+
serviceLines: serviceLinesSection,
|
|
1949
|
+
attachments: attachmentsSection,
|
|
1950
|
+
actions: actionsSection
|
|
1951
|
+
};
|
|
1952
|
+
const defaultLayout = /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1953
|
+
/* @__PURE__ */ jsx3(BillSubmissionHeader, {}),
|
|
1954
|
+
/* @__PURE__ */ jsx3(BillSubmissionPatientSection, {}),
|
|
1955
|
+
/* @__PURE__ */ jsx3(BillSubmissionClaimSection, {}),
|
|
1956
|
+
/* @__PURE__ */ jsx3(BillSubmissionProvidersSection, {}),
|
|
1957
|
+
/* @__PURE__ */ jsx3(BillSubmissionServiceLinesSection, {}),
|
|
1958
|
+
/* @__PURE__ */ jsx3(BillSubmissionAttachmentsSection, {}),
|
|
1959
|
+
/* @__PURE__ */ jsx3(BillSubmissionActions, {})
|
|
1960
|
+
] });
|
|
1961
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
|
|
1962
|
+
event.preventDefault();
|
|
1963
|
+
void submit();
|
|
1964
|
+
}, noValidate: true, children: [
|
|
1965
|
+
/* @__PURE__ */ jsx3("style", { children: css }),
|
|
1966
|
+
children ?? defaultLayout
|
|
1967
|
+
] }) });
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
// src/billing-dashboard.tsx
|
|
1971
|
+
import { useMemo as useMemo3, useState as useState3 } from "react";
|
|
1972
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1973
|
+
var css2 = `
|
|
1974
|
+
.mbdash{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbdash *{box-sizing:border-box}.mbdash h2,.mbdash h3,.mbdash p{margin:0}.mbdash-copy{color:var(--mb-muted);margin-top:5px!important}.mbdash-card{min-width:0;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}
|
|
1975
|
+
.mbdash-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px}.mbdash-head h2{font-size:24px}.mbdash-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-stat{display:grid;gap:7px;padding:20px 22px;border-right:1px solid var(--mb-border)}.mbdash-stat:last-child{border:0}.mbdash-label{color:var(--mb-muted);font-size:12px;font-weight:760;letter-spacing:.06em;text-transform:uppercase}.mbdash-value{font-size:24px;font-weight:780;font-variant-numeric:tabular-nums}.mbdash-aging{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden}.mbdash-aging-item{display:grid;gap:5px;padding:16px 20px;border-right:1px solid var(--mb-border)}.mbdash-aging-item:last-child{border:0}.mbdash-aging-item strong{font-size:18px;font-variant-numeric:tabular-nums}.mbdash-aging-item span:last-child{color:var(--mb-muted);font-size:13px}
|
|
1976
|
+
.mbdash-filters{display:grid;grid-template-columns:minmax(240px,1fr) minmax(180px,260px);gap:12px}.mbdash-control{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbdash-control:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
|
|
1977
|
+
.mbdash-table-wrap{overflow:auto}.mbdash-table{width:100%;border-collapse:collapse}.mbdash-table th{padding:13px 16px;border-bottom:1px solid var(--mb-border);color:var(--mb-muted);font-size:12px;letter-spacing:.04em;text-align:left;text-transform:uppercase;white-space:nowrap}.mbdash-table td{padding:16px;border-bottom:1px solid var(--mb-border);vertical-align:top}.mbdash-table tr:last-child td{border-bottom:0}.mbdash-table tbody tr[data-clickable=true]{cursor:pointer}.mbdash-table tbody tr[data-clickable=true]:hover{background:color-mix(in srgb,var(--mb-accent) 5%,var(--mb-surface))}.mbdash-primary{display:block;color:var(--mb-text);font-weight:720;text-decoration:none}.mbdash-secondary{display:block;margin-top:4px;color:var(--mb-muted);font-size:13px}.mbdash-state{display:inline-flex;padding:4px 9px;border-radius:999px;background:color-mix(in srgb,var(--mb-accent) 10%,var(--mb-surface));color:var(--mb-text);font-size:12px;font-weight:720}.mbdash-money{text-align:right!important;font-variant-numeric:tabular-nums;white-space:nowrap}.mbdash-empty{padding:46px 22px;color:var(--mb-muted);text-align:center}.mbdash-mobile-list{display:none}.mbdash-mobile-card{display:grid;gap:14px;padding:18px;border-bottom:1px solid var(--mb-border)}.mbdash-mobile-card:last-child{border:0}.mbdash-mobile-top,.mbdash-mobile-money{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.mbdash-mobile-money>span{display:grid;gap:3px}.mbdash-mobile-money small{color:var(--mb-muted)}
|
|
1978
|
+
.mbdash-report-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 22px;border-bottom:1px solid var(--mb-border)}.mbdash-report-total td{font-weight:780;background:var(--mb-soft)}
|
|
1979
|
+
@media(max-width:900px){.mbdash-summary{grid-template-columns:repeat(2,1fr)}.mbdash-stat:nth-child(2){border-right:0}.mbdash-stat:nth-child(-n+2){border-bottom:1px solid var(--mb-border)}.mbdash-aging{grid-template-columns:repeat(2,1fr)}.mbdash-aging-item:nth-child(2){border-right:0}.mbdash-aging-item:nth-child(-n+2){border-bottom:1px solid var(--mb-border)}}
|
|
1980
|
+
@media(max-width:700px){.mbdash{gap:16px}.mbdash-head{align-items:flex-start;flex-direction:column}.mbdash-filters{grid-template-columns:1fr}.mbdash-table-wrap{display:none}.mbdash-mobile-list{display:block}.mbdash-value{font-size:20px}.mbdash-stat,.mbdash-aging-item{padding:16px}.mbdash-report .mbdash-table-wrap{display:block}.mbdash-report .mbdash-table th:nth-child(2),.mbdash-report .mbdash-table td:nth-child(2),.mbdash-report .mbdash-table th:nth-child(3),.mbdash-report .mbdash-table td:nth-child(3){display:none}}
|
|
1981
|
+
`;
|
|
1982
|
+
var terminalStates = /* @__PURE__ */ new Set(["closed", "voided", "cancelled"]);
|
|
1983
|
+
var money3 = (value) => Number(value || 0).toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
1984
|
+
var stateLabel = (state) => state.replaceAll("_", " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
1985
|
+
function billAgingDays(bill, now = /* @__PURE__ */ new Date()) {
|
|
1986
|
+
if (Number.isFinite(bill.agingDays)) return Math.max(0, Math.floor(bill.agingDays));
|
|
1987
|
+
if (!bill.submittedAt) return 0;
|
|
1988
|
+
const submitted = new Date(bill.submittedAt);
|
|
1989
|
+
if (Number.isNaN(submitted.valueOf())) return 0;
|
|
1990
|
+
return Math.max(0, Math.floor((now.valueOf() - submitted.valueOf()) / 864e5));
|
|
1991
|
+
}
|
|
1992
|
+
function billAgingBucket(bill, now = /* @__PURE__ */ new Date()) {
|
|
1993
|
+
const days = billAgingDays(bill, now);
|
|
1994
|
+
if (days <= 30) return "current";
|
|
1995
|
+
if (days <= 60) return "31-60";
|
|
1996
|
+
if (days <= 90) return "61-90";
|
|
1997
|
+
return "91+";
|
|
1998
|
+
}
|
|
1999
|
+
function summarizeBillingDashboard(bills, now = /* @__PURE__ */ new Date()) {
|
|
2000
|
+
const aging = [
|
|
2001
|
+
{ id: "current", label: "0\u201330 days", count: 0, balance: 0 },
|
|
2002
|
+
{ id: "31-60", label: "31\u201360 days", count: 0, balance: 0 },
|
|
2003
|
+
{ id: "61-90", label: "61\u201390 days", count: 0, balance: 0 },
|
|
2004
|
+
{ id: "91+", label: "91+ days", count: 0, balance: 0 }
|
|
2005
|
+
];
|
|
2006
|
+
let totalBilled = 0;
|
|
2007
|
+
let totalPaid = 0;
|
|
2008
|
+
let outstanding = 0;
|
|
2009
|
+
let openCount = 0;
|
|
2010
|
+
for (const bill of bills) {
|
|
2011
|
+
totalBilled += Number(bill.totalCharge || 0);
|
|
2012
|
+
totalPaid += Number(bill.totalPaid || 0);
|
|
2013
|
+
outstanding += Number(bill.balanceDue || 0);
|
|
2014
|
+
if (!terminalStates.has(bill.state.toLowerCase()) && bill.balanceDue > 0) {
|
|
2015
|
+
openCount += 1;
|
|
2016
|
+
const bucket = aging.find((item) => item.id === billAgingBucket(bill, now));
|
|
2017
|
+
bucket.count += 1;
|
|
2018
|
+
bucket.balance += Number(bill.balanceDue || 0);
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
return { totalBilled, totalPaid, outstanding, openCount, bills: bills.length, aging };
|
|
2022
|
+
}
|
|
2023
|
+
function Shell({ appearance, className = "", style, children }) {
|
|
2024
|
+
return /* @__PURE__ */ jsxs4("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
|
|
2025
|
+
/* @__PURE__ */ jsx4("style", { children: css2 }),
|
|
2026
|
+
children
|
|
2027
|
+
] });
|
|
2028
|
+
}
|
|
2029
|
+
function BillIdentity({ bill }) {
|
|
2030
|
+
const label = bill.billNumber == null ? bill.externalId ?? "Bill" : `Bill #${bill.billNumber}`;
|
|
2031
|
+
const content = /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2032
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-primary", children: label }),
|
|
2033
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
|
|
2034
|
+
] });
|
|
2035
|
+
return bill.href ? /* @__PURE__ */ jsx4("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx4(Fragment3, { children: content });
|
|
2036
|
+
}
|
|
2037
|
+
function BillListContent({ bills, onSelectBill, emptyState = "No bills match these filters." }) {
|
|
2038
|
+
if (!bills.length) return /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-empty", children: emptyState });
|
|
2039
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
|
|
2040
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
|
|
2041
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2042
|
+
/* @__PURE__ */ jsx4("th", { children: "Bill" }),
|
|
2043
|
+
/* @__PURE__ */ jsx4("th", { children: "Payer" }),
|
|
2044
|
+
/* @__PURE__ */ jsx4("th", { children: "Status" }),
|
|
2045
|
+
/* @__PURE__ */ jsx4("th", { children: "Age" }),
|
|
2046
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
|
|
2047
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
|
|
2048
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
|
|
2049
|
+
] }) }),
|
|
2050
|
+
/* @__PURE__ */ jsx4("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs4("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
|
|
2051
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
|
|
2052
|
+
/* @__PURE__ */ jsx4("td", { children: bill.payerName || "\u2014" }),
|
|
2053
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
|
|
2054
|
+
/* @__PURE__ */ jsxs4("td", { children: [
|
|
2055
|
+
billAgingDays(bill),
|
|
2056
|
+
" days"
|
|
1837
2057
|
] }),
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
/* @__PURE__ */
|
|
1860
|
-
/* @__PURE__ */
|
|
1861
|
-
] }, index)),
|
|
1862
|
-
/* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
|
|
1863
|
-
/* @__PURE__ */ jsx3("span", { children: "Total" }),
|
|
1864
|
-
/* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
|
|
2058
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
|
|
2059
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
|
|
2060
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) }) })
|
|
2061
|
+
] }, bill.id)) })
|
|
2062
|
+
] }) }),
|
|
2063
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs4("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
|
|
2064
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-top", children: [
|
|
2065
|
+
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
|
|
2066
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) })
|
|
2067
|
+
] }),
|
|
2068
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-money", children: [
|
|
2069
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2070
|
+
/* @__PURE__ */ jsx4("small", { children: "Age" }),
|
|
2071
|
+
billAgingDays(bill),
|
|
2072
|
+
" days"
|
|
2073
|
+
] }),
|
|
2074
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2075
|
+
/* @__PURE__ */ jsx4("small", { children: "Paid" }),
|
|
2076
|
+
money3(bill.totalPaid)
|
|
2077
|
+
] }),
|
|
2078
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2079
|
+
/* @__PURE__ */ jsx4("small", { children: "Balance" }),
|
|
2080
|
+
/* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) })
|
|
1865
2081
|
] })
|
|
2082
|
+
] })
|
|
2083
|
+
] }, bill.id)) })
|
|
2084
|
+
] });
|
|
2085
|
+
}
|
|
2086
|
+
function BillList(props) {
|
|
2087
|
+
const shellProps = {
|
|
2088
|
+
...props.appearance === void 0 ? {} : { appearance: props.appearance },
|
|
2089
|
+
...props.className === void 0 ? {} : { className: props.className },
|
|
2090
|
+
...props.style === void 0 ? {} : { style: props.style }
|
|
2091
|
+
};
|
|
2092
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(BillListContent, { ...props }) });
|
|
2093
|
+
}
|
|
2094
|
+
function AgingContent({ bills, heading = "Accounts receivable" }) {
|
|
2095
|
+
const summary = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
|
|
2096
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2097
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
|
|
2098
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2099
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
|
|
2100
|
+
] }) }),
|
|
2101
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-card mbdash-summary", children: [
|
|
2102
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2103
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Outstanding" }),
|
|
2104
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.outstanding) })
|
|
1866
2105
|
] }),
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
|
|
1871
|
-
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
|
|
1872
|
-
attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
|
|
1873
|
-
const auto = attachment.autoAttached || attachment.documentType === "w9";
|
|
1874
|
-
const removable = !auto && attachment.removable !== false;
|
|
1875
|
-
return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
|
|
1876
|
-
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
|
|
1877
|
-
auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
|
|
1878
|
-
/* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1879
|
-
/* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
|
|
1880
|
-
/* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
|
|
1881
|
-
/* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
|
|
1882
|
-
] })
|
|
1883
|
-
] }),
|
|
1884
|
-
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1885
|
-
attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
|
|
1886
|
-
removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
|
|
1887
|
-
setSelectedIds((current) => current.filter((id) => id !== attachment.id));
|
|
1888
|
-
setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
|
|
1889
|
-
}, children: "\xD7" }) : null
|
|
1890
|
-
] })
|
|
1891
|
-
] }, attachment.id);
|
|
1892
|
-
}),
|
|
1893
|
-
uploads.map((upload, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
|
|
1894
|
-
/* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1895
|
-
/* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
|
|
1896
|
-
/* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
|
|
1897
|
-
(upload.file.size / 1024 / 1024).toFixed(1),
|
|
1898
|
-
" MB"
|
|
1899
|
-
] })
|
|
1900
|
-
] }) }),
|
|
1901
|
-
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1902
|
-
/* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
|
|
1903
|
-
/* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${upload.file.name}`, onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
|
|
1904
|
-
] })
|
|
1905
|
-
] }, `${upload.file.name}-${index}`))
|
|
2106
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2107
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Open bills" }),
|
|
2108
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: summary.openCount })
|
|
1906
2109
|
] }),
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
/* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
] })
|
|
2110
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2111
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Collected" }),
|
|
2112
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
|
|
2113
|
+
] }),
|
|
2114
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2115
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Total billed" }),
|
|
2116
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
|
|
2117
|
+
] })
|
|
1915
2118
|
] }),
|
|
1916
|
-
|
|
1917
|
-
|
|
2119
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs4("div", { className: "mbdash-aging-item", children: [
|
|
2120
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: bucket.label }),
|
|
2121
|
+
/* @__PURE__ */ jsx4("strong", { children: money3(bucket.balance) }),
|
|
2122
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2123
|
+
bucket.count,
|
|
2124
|
+
" bill",
|
|
2125
|
+
bucket.count === 1 ? "" : "s"
|
|
2126
|
+
] })
|
|
2127
|
+
] }, bucket.id)) })
|
|
2128
|
+
] });
|
|
2129
|
+
}
|
|
2130
|
+
function BillAgingSummary(props) {
|
|
2131
|
+
const shellProps = {
|
|
2132
|
+
...props.appearance === void 0 ? {} : { appearance: props.appearance },
|
|
2133
|
+
...props.className === void 0 ? {} : { className: props.className },
|
|
2134
|
+
...props.style === void 0 ? {} : { style: props.style }
|
|
2135
|
+
};
|
|
2136
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
|
|
2137
|
+
}
|
|
2138
|
+
function BillingDashboard({ bills, heading = "Billing", description = "Track submitted bills, payments, and outstanding balances.", onSelectBill, initialSearch = "", initialState = "all", hideFilters = false, appearance, className, style }) {
|
|
2139
|
+
const [search, setSearch] = useState3(initialSearch);
|
|
2140
|
+
const [state, setState] = useState3(initialState);
|
|
2141
|
+
const states = useMemo3(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
|
|
2142
|
+
const filtered = useMemo3(() => {
|
|
2143
|
+
const query = search.trim().toLowerCase();
|
|
2144
|
+
return bills.filter((bill) => (state === "all" || bill.state === state) && (!query || [bill.billNumber, bill.externalId, bill.patientName, bill.claimNumber, bill.payerName, bill.workItemLabel].some((value) => String(value ?? "").toLowerCase().includes(query))));
|
|
2145
|
+
}, [bills, search, state]);
|
|
2146
|
+
const shellProps = {
|
|
2147
|
+
...appearance === void 0 ? {} : { appearance },
|
|
2148
|
+
...className === void 0 ? {} : { className },
|
|
2149
|
+
...style === void 0 ? {} : { style }
|
|
2150
|
+
};
|
|
2151
|
+
const listProps = { bills: filtered, ...onSelectBill === void 0 ? {} : { onSelectBill } };
|
|
2152
|
+
return /* @__PURE__ */ jsxs4(Shell, { ...shellProps, children: [
|
|
2153
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
|
|
2154
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2155
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
|
|
2156
|
+
] }) }),
|
|
2157
|
+
/* @__PURE__ */ jsx4(AgingContent, { bills: filtered, heading: "Receivables" }),
|
|
2158
|
+
hideFilters ? null : /* @__PURE__ */ jsxs4("div", { className: "mbdash-filters", children: [
|
|
2159
|
+
/* @__PURE__ */ jsx4("input", { className: "mbdash-control", type: "search", value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search patient, claim, payer, or bill\u2026", "aria-label": "Search bills" }),
|
|
2160
|
+
/* @__PURE__ */ jsxs4("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
|
|
2161
|
+
/* @__PURE__ */ jsx4("option", { value: "all", children: "All statuses" }),
|
|
2162
|
+
states.map((item) => /* @__PURE__ */ jsx4("option", { value: item, children: stateLabel(item) }, item))
|
|
2163
|
+
] })
|
|
2164
|
+
] }),
|
|
2165
|
+
/* @__PURE__ */ jsx4(BillListContent, { ...listProps })
|
|
1918
2166
|
] });
|
|
1919
2167
|
}
|
|
2168
|
+
function buildBillingReportRows(bills, groupBy = "status") {
|
|
2169
|
+
const rows = /* @__PURE__ */ new Map();
|
|
2170
|
+
for (const bill of bills) {
|
|
2171
|
+
const key = groupBy === "payer" ? bill.payerName || "Unassigned payer" : groupBy === "aging" ? billAgingBucket(bill) : bill.state;
|
|
2172
|
+
const label = groupBy === "status" ? stateLabel(key) : groupBy === "aging" ? { current: "0\u201330 days", "31-60": "31\u201360 days", "61-90": "61\u201390 days", "91+": "91+ days" }[key] ?? key : key;
|
|
2173
|
+
const row = rows.get(key) ?? { key, label, billCount: 0, totalBilled: 0, totalPaid: 0, balanceDue: 0 };
|
|
2174
|
+
row.billCount += 1;
|
|
2175
|
+
row.totalBilled += Number(bill.totalCharge || 0);
|
|
2176
|
+
row.totalPaid += Number(bill.totalPaid || 0);
|
|
2177
|
+
row.balanceDue += Number(bill.balanceDue || 0);
|
|
2178
|
+
rows.set(key, row);
|
|
2179
|
+
}
|
|
2180
|
+
return [...rows.values()].sort((a, b) => a.label.localeCompare(b.label, void 0, { numeric: true }));
|
|
2181
|
+
}
|
|
2182
|
+
function buildBillingReportCsv(bills, groupBy = "status") {
|
|
2183
|
+
const escape = (value) => `"${String(value).replaceAll('"', '""')}"`;
|
|
2184
|
+
return [["Group", "Bills", "Total billed", "Total paid", "Balance due"].map(escape).join(","), ...buildBillingReportRows(bills, groupBy).map((row) => [row.label, row.billCount, row.totalBilled.toFixed(2), row.totalPaid.toFixed(2), row.balanceDue.toFixed(2)].map(escape).join(","))].join("\n");
|
|
2185
|
+
}
|
|
2186
|
+
function BillingReport({ bills, groupBy = "status", heading = "Billing report", description = "Billed, paid, and outstanding totals.", appearance, className, style }) {
|
|
2187
|
+
const rows = useMemo3(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
|
|
2188
|
+
const total = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
|
|
2189
|
+
const shellProps = {
|
|
2190
|
+
...appearance === void 0 ? {} : { appearance },
|
|
2191
|
+
className: `mbdash-report ${className ?? ""}`.trim(),
|
|
2192
|
+
...style === void 0 ? {} : { style }
|
|
2193
|
+
};
|
|
2194
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
|
|
2195
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-report-head", children: [
|
|
2196
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2197
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2198
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
|
|
2199
|
+
] }),
|
|
2200
|
+
/* @__PURE__ */ jsxs4("span", { className: "mbdash-state", children: [
|
|
2201
|
+
"By ",
|
|
2202
|
+
groupBy
|
|
2203
|
+
] })
|
|
2204
|
+
] }),
|
|
2205
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
|
|
2206
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2207
|
+
/* @__PURE__ */ jsx4("th", { children: "Group" }),
|
|
2208
|
+
/* @__PURE__ */ jsx4("th", { children: "Bills" }),
|
|
2209
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
|
|
2210
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
|
|
2211
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
|
|
2212
|
+
] }) }),
|
|
2213
|
+
/* @__PURE__ */ jsxs4("tbody", { children: [
|
|
2214
|
+
rows.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2215
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("strong", { children: row.label }) }),
|
|
2216
|
+
/* @__PURE__ */ jsx4("td", { children: row.billCount }),
|
|
2217
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
|
|
2218
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
|
|
2219
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.balanceDue) })
|
|
2220
|
+
] }, row.key)),
|
|
2221
|
+
/* @__PURE__ */ jsxs4("tr", { className: "mbdash-report-total", children: [
|
|
2222
|
+
/* @__PURE__ */ jsx4("td", { children: "Total" }),
|
|
2223
|
+
/* @__PURE__ */ jsx4("td", { children: total.bills }),
|
|
2224
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
|
|
2225
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
|
|
2226
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.outstanding) })
|
|
2227
|
+
] })
|
|
2228
|
+
] })
|
|
2229
|
+
] }) })
|
|
2230
|
+
] }) });
|
|
2231
|
+
}
|
|
1920
2232
|
|
|
1921
2233
|
// src/connected-bill-status.tsx
|
|
1922
2234
|
import {
|
|
1923
2235
|
useCallback as useCallback2,
|
|
1924
2236
|
useEffect as useEffect3,
|
|
1925
|
-
useMemo as
|
|
2237
|
+
useMemo as useMemo4,
|
|
1926
2238
|
useRef as useRef3,
|
|
1927
|
-
useState as
|
|
2239
|
+
useState as useState4
|
|
1928
2240
|
} from "react";
|
|
1929
2241
|
import {
|
|
1930
2242
|
DEFAULT_API_BASE_URL,
|
|
1931
2243
|
DEFAULT_SESSION_ENDPOINT
|
|
1932
2244
|
} from "@mindbill/browser";
|
|
1933
|
-
import { Fragment as
|
|
2245
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1934
2246
|
var DEFAULT_REFRESH_INTERVAL = 6e4;
|
|
1935
2247
|
async function responseError(response, fallback) {
|
|
1936
2248
|
const body = await response.json().catch(() => null);
|
|
@@ -2063,17 +2375,17 @@ function useBillStatus({
|
|
|
2063
2375
|
initialData = null,
|
|
2064
2376
|
fetch: fetchOverride
|
|
2065
2377
|
}) {
|
|
2066
|
-
const client =
|
|
2378
|
+
const client = useMemo4(() => createBillStatusClient({
|
|
2067
2379
|
billId,
|
|
2068
2380
|
sessionEndpoint,
|
|
2069
2381
|
...getSession ? { getSession } : {},
|
|
2070
2382
|
apiBaseUrl,
|
|
2071
2383
|
...fetchOverride ? { fetch: fetchOverride } : {}
|
|
2072
2384
|
}), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
|
|
2073
|
-
const [data, setData] =
|
|
2074
|
-
const [error, setError] =
|
|
2075
|
-
const [isLoading, setIsLoading] =
|
|
2076
|
-
const [isRefreshing, setIsRefreshing] =
|
|
2385
|
+
const [data, setData] = useState4(initialData);
|
|
2386
|
+
const [error, setError] = useState4(null);
|
|
2387
|
+
const [isLoading, setIsLoading] = useState4(enabled && !initialData);
|
|
2388
|
+
const [isRefreshing, setIsRefreshing] = useState4(false);
|
|
2077
2389
|
const dataRef = useRef3(initialData);
|
|
2078
2390
|
const initialDataRef = useRef3(initialData);
|
|
2079
2391
|
initialDataRef.current = initialData;
|
|
@@ -2151,17 +2463,17 @@ function ConnectedBillStatus({
|
|
|
2151
2463
|
}) {
|
|
2152
2464
|
const status = useBillStatus(options);
|
|
2153
2465
|
if (status.isLoading && !status.data) {
|
|
2154
|
-
return /* @__PURE__ */
|
|
2466
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children: loadingFallback ?? /* @__PURE__ */ jsx5("div", { role: "status", children: "Loading bill status\u2026" }) });
|
|
2155
2467
|
}
|
|
2156
2468
|
if (status.error && !status.data) {
|
|
2157
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs5("div", { role: "alert", children: [
|
|
2158
2470
|
status.error.message,
|
|
2159
2471
|
" ",
|
|
2160
|
-
/* @__PURE__ */
|
|
2472
|
+
/* @__PURE__ */ jsx5("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
|
|
2161
2473
|
] }) });
|
|
2162
2474
|
}
|
|
2163
2475
|
if (!status.data) return null;
|
|
2164
|
-
return /* @__PURE__ */
|
|
2476
|
+
return /* @__PURE__ */ jsx5(
|
|
2165
2477
|
BillStatusSummary,
|
|
2166
2478
|
{
|
|
2167
2479
|
status: status.data.state,
|
|
@@ -2180,7 +2492,7 @@ function ConnectedBillStatus({
|
|
|
2180
2492
|
}
|
|
2181
2493
|
|
|
2182
2494
|
// src/bill-lifecycle-surfaces.tsx
|
|
2183
|
-
import { jsx as
|
|
2495
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2184
2496
|
function visibleBillLifecycleActions(actions, showUnavailable = false) {
|
|
2185
2497
|
return actions.filter((action) => action.enabled || showUnavailable);
|
|
2186
2498
|
}
|
|
@@ -2195,11 +2507,11 @@ function BillLifecycleActions({
|
|
|
2195
2507
|
}) {
|
|
2196
2508
|
const visible = visibleBillLifecycleActions(actions, showUnavailable);
|
|
2197
2509
|
if (!visible.length) return null;
|
|
2198
|
-
return /* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
visible.map((action) => /* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
!action.enabled && action.reason ? /* @__PURE__ */
|
|
2510
|
+
return /* @__PURE__ */ jsxs6("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
|
|
2511
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2512
|
+
visible.map((action) => /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-action", children: [
|
|
2513
|
+
/* @__PURE__ */ jsx6("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
|
|
2514
|
+
!action.enabled && action.reason ? /* @__PURE__ */ jsx6("span", { className: "mb-action-reason", children: action.reason }) : null
|
|
2203
2515
|
] }, action.id))
|
|
2204
2516
|
] });
|
|
2205
2517
|
}
|
|
@@ -2229,21 +2541,21 @@ function defaultFormatDate(createdAt) {
|
|
|
2229
2541
|
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
|
|
2230
2542
|
}
|
|
2231
2543
|
function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
|
|
2232
|
-
return /* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2544
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
|
|
2545
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2546
|
+
/* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
|
|
2547
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2548
|
+
/* @__PURE__ */ jsx6("strong", { children: "Bill history" }),
|
|
2549
|
+
/* @__PURE__ */ jsx6("span", { children: "Submission, payer responses, follow-up, and payments." })
|
|
2238
2550
|
] }),
|
|
2239
|
-
/* @__PURE__ */
|
|
2551
|
+
/* @__PURE__ */ jsx6("span", { children: events.length })
|
|
2240
2552
|
] }),
|
|
2241
|
-
!events.length ? /* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
event.description ? /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2553
|
+
!events.length ? /* @__PURE__ */ jsx6("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx6("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs6("li", { className: "mb-activity-item", children: [
|
|
2554
|
+
/* @__PURE__ */ jsx6("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
|
|
2555
|
+
/* @__PURE__ */ jsxs6("div", { className: "mb-activity-content", children: [
|
|
2556
|
+
/* @__PURE__ */ jsx6("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
|
|
2557
|
+
event.description ? /* @__PURE__ */ jsx6("p", { children: event.description }) : null,
|
|
2558
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2247
2559
|
formatDate(event.createdAt),
|
|
2248
2560
|
event.actor ? ` \xB7 ${event.actor}` : ""
|
|
2249
2561
|
] })
|
|
@@ -2252,7 +2564,7 @@ function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", ap
|
|
|
2252
2564
|
] });
|
|
2253
2565
|
}
|
|
2254
2566
|
var lifecycleStages = [
|
|
2255
|
-
{ id: "submitted", label: "
|
|
2567
|
+
{ id: "submitted", label: "Sent" },
|
|
2256
2568
|
{ id: "accepted", label: "Accepted" },
|
|
2257
2569
|
{ id: "processed", label: "Processed" },
|
|
2258
2570
|
{ id: "closed", label: "Closed" }
|
|
@@ -2260,27 +2572,38 @@ var lifecycleStages = [
|
|
|
2260
2572
|
function billLifecycleStage(state) {
|
|
2261
2573
|
const value = state.toLowerCase();
|
|
2262
2574
|
if (value.includes("closed") || value.includes("written_off")) return "closed";
|
|
2263
|
-
if (value.includes("
|
|
2575
|
+
if (value.includes("second_review") || value.includes("appeal") || value.includes("reject")) return "submitted";
|
|
2576
|
+
if (value.includes("processed") || value.includes("paid") || value.includes("denied") || value.includes("partial") || value.includes("response") || value.includes("ibr") || value.includes("lien")) return "processed";
|
|
2264
2577
|
if (value.includes("accepted")) return "accepted";
|
|
2265
2578
|
return "submitted";
|
|
2266
2579
|
}
|
|
2580
|
+
function billLifecycleDisplayLabel(state, nativeStatus) {
|
|
2581
|
+
const value = state.toLowerCase();
|
|
2582
|
+
if (value === "submitted") return "Sent";
|
|
2583
|
+
if (value === "second_review") return "Second Review sent";
|
|
2584
|
+
if (value === "rejected") return "Rejected";
|
|
2585
|
+
if (value === "denied") return "Denied";
|
|
2586
|
+
if (value === "partially_paid") return "Partially paid";
|
|
2587
|
+
if (value === "written_off") return "Written off";
|
|
2588
|
+
return humanize(state || nativeStatus || "submitted");
|
|
2589
|
+
}
|
|
2267
2590
|
function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
|
|
2268
2591
|
const current = billLifecycleStage(state);
|
|
2269
2592
|
const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
|
|
2270
|
-
return /* @__PURE__ */
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
/* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2274
|
-
/* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
|
|
2594
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2595
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2596
|
+
/* @__PURE__ */ jsx6("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
|
|
2597
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2275
2598
|
submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted",
|
|
2276
2599
|
typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""
|
|
2277
2600
|
] })
|
|
2278
2601
|
] }) }),
|
|
2279
|
-
/* @__PURE__ */
|
|
2602
|
+
/* @__PURE__ */ jsx6("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
|
|
2280
2603
|
const status = index < currentIndex ? "complete" : index === currentIndex ? "current" : "upcoming";
|
|
2281
|
-
return /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2604
|
+
return /* @__PURE__ */ jsxs6("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
|
|
2605
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
|
|
2606
|
+
/* @__PURE__ */ jsx6("b", { children: stage.label })
|
|
2284
2607
|
] }, stage.id);
|
|
2285
2608
|
}) })
|
|
2286
2609
|
] });
|
|
@@ -2294,45 +2617,45 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
|
|
|
2294
2617
|
["Charged", currency(bill.totalCharge)],
|
|
2295
2618
|
["Balance", currency(bill.balanceDue)]
|
|
2296
2619
|
];
|
|
2297
|
-
return /* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
/* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
|
|
2621
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2622
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2623
|
+
/* @__PURE__ */ jsx6("strong", { children: "Bill snapshot" }),
|
|
2624
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2302
2625
|
"Bill #",
|
|
2303
2626
|
bill.billNumber
|
|
2304
2627
|
] })
|
|
2305
2628
|
] }) }),
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2629
|
+
/* @__PURE__ */ jsx6("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs6("div", { children: [
|
|
2630
|
+
/* @__PURE__ */ jsx6("dt", { children: label }),
|
|
2631
|
+
/* @__PURE__ */ jsx6("dd", { children: value })
|
|
2309
2632
|
] }, label)) })
|
|
2310
2633
|
] });
|
|
2311
2634
|
}
|
|
2312
2635
|
function BillRemittanceCard({ remittance, appearance, className, style }) {
|
|
2313
|
-
return /* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2636
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
|
|
2637
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2638
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2639
|
+
/* @__PURE__ */ jsx6("strong", { children: "Remittance" }),
|
|
2640
|
+
/* @__PURE__ */ jsx6("span", { children: "Amounts reported by the payer and posted to the bill." })
|
|
2318
2641
|
] }) }),
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
/* @__PURE__ */
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ jsxs6("dl", { children: [
|
|
2643
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2644
|
+
/* @__PURE__ */ jsx6("dt", { children: "Payer reported" }),
|
|
2645
|
+
/* @__PURE__ */ jsx6("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
|
|
2323
2646
|
] }),
|
|
2324
|
-
/* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2648
|
+
/* @__PURE__ */ jsx6("dt", { children: "Posted" }),
|
|
2649
|
+
/* @__PURE__ */ jsx6("dd", { children: currency(remittance.totalPaid) })
|
|
2327
2650
|
] }),
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2652
|
+
/* @__PURE__ */ jsx6("dt", { children: "Balance" }),
|
|
2653
|
+
/* @__PURE__ */ jsx6("dd", { children: currency(remittance.balanceDue) })
|
|
2331
2654
|
] })
|
|
2332
2655
|
] }),
|
|
2333
|
-
remittance.denialReason ? /* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2656
|
+
remittance.denialReason ? /* @__PURE__ */ jsxs6("div", { className: "mb-denial", children: [
|
|
2657
|
+
/* @__PURE__ */ jsx6("strong", { children: "Denial reason" }),
|
|
2658
|
+
/* @__PURE__ */ jsx6("p", { children: remittance.denialReason })
|
|
2336
2659
|
] }) : null
|
|
2337
2660
|
] });
|
|
2338
2661
|
}
|
|
@@ -2347,42 +2670,42 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
|
|
|
2347
2670
|
delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
|
|
2348
2671
|
].filter(Boolean);
|
|
2349
2672
|
if (!delivery.payerName && !contacts.length) return null;
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
|
|
2674
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2675
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2676
|
+
/* @__PURE__ */ jsx6("strong", { children: delivery.payerName || "Claims administrator" }),
|
|
2677
|
+
/* @__PURE__ */ jsx6("span", { children: "Billing and follow-up contacts." })
|
|
2355
2678
|
] }) }),
|
|
2356
|
-
!contacts.length ? /* @__PURE__ */
|
|
2357
|
-
/* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
2679
|
+
!contacts.length ? /* @__PURE__ */ jsx6("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx6("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs6("div", { children: [
|
|
2680
|
+
/* @__PURE__ */ jsx6("dt", { children: label }),
|
|
2681
|
+
/* @__PURE__ */ jsx6("dd", { children: href ? /* @__PURE__ */ jsx6("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
|
|
2359
2682
|
] }, label)) })
|
|
2360
2683
|
] });
|
|
2361
2684
|
}
|
|
2362
2685
|
function BillPaymentLedger({ payments, appearance, className, style }) {
|
|
2363
|
-
return /* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2686
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
|
|
2687
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2688
|
+
/* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
|
|
2689
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2690
|
+
/* @__PURE__ */ jsx6("strong", { children: "Payments" }),
|
|
2691
|
+
/* @__PURE__ */ jsx6("span", { children: "Payments posted to this bill." })
|
|
2369
2692
|
] }),
|
|
2370
|
-
/* @__PURE__ */
|
|
2693
|
+
/* @__PURE__ */ jsx6("span", { children: payments.length })
|
|
2371
2694
|
] }),
|
|
2372
|
-
!payments.length ? /* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
2695
|
+
!payments.length ? /* @__PURE__ */ jsx6("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx6("div", { className: "mb-payment-list", children: payments.map((payment) => /* @__PURE__ */ jsxs6("article", { children: [
|
|
2696
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2697
|
+
/* @__PURE__ */ jsx6("strong", { children: currency(payment.amount) }),
|
|
2698
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2376
2699
|
humanize(payment.status || "posted"),
|
|
2377
2700
|
" \xB7 ",
|
|
2378
2701
|
payment.method.toUpperCase()
|
|
2379
2702
|
] })
|
|
2380
2703
|
] }),
|
|
2381
|
-
/* @__PURE__ */
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2705
|
+
/* @__PURE__ */ jsx6("span", { children: payment.checkNumber ? `#${payment.checkNumber}` : payment.source.toUpperCase() }),
|
|
2706
|
+
/* @__PURE__ */ jsx6("span", { children: payment.depositDate || defaultFormatDate(payment.postedAt) })
|
|
2384
2707
|
] }),
|
|
2385
|
-
payment.note ? /* @__PURE__ */
|
|
2708
|
+
payment.note ? /* @__PURE__ */ jsx6("p", { children: payment.note }) : null
|
|
2386
2709
|
] }, payment.id)) })
|
|
2387
2710
|
] });
|
|
2388
2711
|
}
|
|
@@ -2411,9 +2734,9 @@ var lifecycleSurfaceStyles = `
|
|
|
2411
2734
|
import {
|
|
2412
2735
|
useCallback as useCallback3,
|
|
2413
2736
|
useEffect as useEffect4,
|
|
2414
|
-
useMemo as
|
|
2737
|
+
useMemo as useMemo5,
|
|
2415
2738
|
useRef as useRef4,
|
|
2416
|
-
useState as
|
|
2739
|
+
useState as useState5
|
|
2417
2740
|
} from "react";
|
|
2418
2741
|
import {
|
|
2419
2742
|
DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
|
|
@@ -2421,7 +2744,7 @@ import {
|
|
|
2421
2744
|
createBillLifecycleClient
|
|
2422
2745
|
} from "@mindbill/browser";
|
|
2423
2746
|
import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
|
|
2424
|
-
import { Fragment as
|
|
2747
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2425
2748
|
var DEFAULT_REFRESH_INTERVAL2 = 6e4;
|
|
2426
2749
|
function downloadBlob(blob, filename, open = false) {
|
|
2427
2750
|
const url = URL.createObjectURL(blob);
|
|
@@ -2443,13 +2766,13 @@ function useBillLifecycle({
|
|
|
2443
2766
|
initialData = null,
|
|
2444
2767
|
fetch: fetchOverride
|
|
2445
2768
|
}) {
|
|
2446
|
-
const [data, setData] =
|
|
2447
|
-
const [error, setError] =
|
|
2448
|
-
const [isLoading, setIsLoading] =
|
|
2449
|
-
const [isRefreshing, setIsRefreshing] =
|
|
2450
|
-
const [isMutating, setIsMutating] =
|
|
2769
|
+
const [data, setData] = useState5(initialData);
|
|
2770
|
+
const [error, setError] = useState5(null);
|
|
2771
|
+
const [isLoading, setIsLoading] = useState5(enabled && !initialData);
|
|
2772
|
+
const [isRefreshing, setIsRefreshing] = useState5(false);
|
|
2773
|
+
const [isMutating, setIsMutating] = useState5(false);
|
|
2451
2774
|
const mounted = useRef4(true);
|
|
2452
|
-
const client =
|
|
2775
|
+
const client = useMemo5(() => createBillLifecycleClient({
|
|
2453
2776
|
billId: providedBillId,
|
|
2454
2777
|
sessionEndpoint,
|
|
2455
2778
|
getSession,
|
|
@@ -2536,7 +2859,9 @@ function useBillLifecycle({
|
|
|
2536
2859
|
closeBill: (input) => mutate(() => client.closeBill(input)),
|
|
2537
2860
|
reopenBill: (input) => mutate(() => client.reopenBill(input)),
|
|
2538
2861
|
postPayment: (input) => mutate(() => client.postPayment(input)),
|
|
2539
|
-
submitSecondReview: (input) => mutate(() => client.submitSecondReview(input))
|
|
2862
|
+
submitSecondReview: (input) => mutate(() => client.submitSecondReview(input)),
|
|
2863
|
+
resubmitBill: (input) => mutate(() => client.resubmitBill(input)),
|
|
2864
|
+
simulateSandbox: (input) => mutate(() => client.simulateSandbox(input))
|
|
2540
2865
|
};
|
|
2541
2866
|
}
|
|
2542
2867
|
function LifecycleDialog({ children, title, onClose }) {
|
|
@@ -2551,8 +2876,8 @@ function LifecycleDialog({ children, title, onClose }) {
|
|
|
2551
2876
|
previous?.focus();
|
|
2552
2877
|
};
|
|
2553
2878
|
}, [onClose]);
|
|
2554
|
-
return /* @__PURE__ */
|
|
2555
|
-
/* @__PURE__ */
|
|
2879
|
+
return /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs7("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
|
|
2880
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
|
|
2556
2881
|
children
|
|
2557
2882
|
] }) });
|
|
2558
2883
|
}
|
|
@@ -2560,25 +2885,34 @@ function today() {
|
|
|
2560
2885
|
const now = /* @__PURE__ */ new Date();
|
|
2561
2886
|
return new Date(now.getTime() - now.getTimezoneOffset() * 6e4).toISOString().slice(0, 10);
|
|
2562
2887
|
}
|
|
2563
|
-
function stateLabel(state) {
|
|
2564
|
-
return state.replace(/[._-]+/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
2565
|
-
}
|
|
2566
2888
|
function actionPanel(action) {
|
|
2889
|
+
if (action.id === "resubmit") return "resubmit";
|
|
2567
2890
|
if (action.id === "second_review") return "second_review";
|
|
2568
2891
|
if (action.id === "post_payment") return "payment";
|
|
2569
2892
|
if (action.id === "close") return "close";
|
|
2570
2893
|
if (action.id === "reopen") return "reopen";
|
|
2571
2894
|
return "";
|
|
2572
2895
|
}
|
|
2896
|
+
function sandboxScenarios(state) {
|
|
2897
|
+
if (state === "submitted") return [
|
|
2898
|
+
{ id: "accepted", label: "Accept submission", detail: "Add clearinghouse and payer acknowledgements." },
|
|
2899
|
+
{ id: "rejected", label: "Reject submission", detail: "Return a correctable routing rejection." }
|
|
2900
|
+
];
|
|
2901
|
+
if (state === "accepted" || state === "second_review") return [
|
|
2902
|
+
{ id: "processed", label: "Process with EOR", detail: "Attach a synthetic payer EOR and enable payment posting." },
|
|
2903
|
+
{ id: "denied", label: "Deny payment", detail: "Attach a realistic denial EOR and enable Second Review." }
|
|
2904
|
+
];
|
|
2905
|
+
return [];
|
|
2906
|
+
}
|
|
2573
2907
|
function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
|
|
2574
2908
|
const lifecycle = useBillLifecycle(options);
|
|
2575
2909
|
const { data } = lifecycle;
|
|
2576
|
-
const [tab, setTab] =
|
|
2577
|
-
const [panel, setPanel] =
|
|
2578
|
-
const [notice, setNotice] =
|
|
2579
|
-
const [reason, setReason] =
|
|
2580
|
-
const [payment, setPayment] =
|
|
2581
|
-
const [review, setReview] =
|
|
2910
|
+
const [tab, setTab] = useState5("details");
|
|
2911
|
+
const [panel, setPanel] = useState5("");
|
|
2912
|
+
const [notice, setNotice] = useState5("");
|
|
2913
|
+
const [reason, setReason] = useState5("");
|
|
2914
|
+
const [payment, setPayment] = useState5({ amount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
|
|
2915
|
+
const [review, setReview] = useState5({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
|
|
2582
2916
|
const lastData = useRef4(null);
|
|
2583
2917
|
useEffect4(() => {
|
|
2584
2918
|
if (!data || data === lastData.current) return;
|
|
@@ -2591,13 +2925,13 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
|
|
|
2591
2925
|
attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
|
|
2592
2926
|
}));
|
|
2593
2927
|
}, [data, onChanged]);
|
|
2594
|
-
if (lifecycle.isLoading && !data) return /* @__PURE__ */
|
|
2928
|
+
if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
|
|
2595
2929
|
if (!data) {
|
|
2596
2930
|
const error = lifecycle.error ?? new Error("Bill could not be loaded.");
|
|
2597
|
-
return /* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-error", role: "alert", children: [
|
|
2932
|
+
/* @__PURE__ */ jsx7("strong", { children: "Billing is unavailable." }),
|
|
2933
|
+
/* @__PURE__ */ jsx7("span", { children: error.message }),
|
|
2934
|
+
/* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
|
|
2601
2935
|
] }) });
|
|
2602
2936
|
}
|
|
2603
2937
|
const complete = async (message, task) => {
|
|
@@ -2611,165 +2945,192 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
|
|
|
2611
2945
|
}
|
|
2612
2946
|
};
|
|
2613
2947
|
const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
|
|
2614
|
-
const supportedActions = /* @__PURE__ */ new Set(["second_review", "post_payment", "close", "reopen"]);
|
|
2948
|
+
const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
|
|
2615
2949
|
const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2950
|
+
const simulations = data.environment === "sandbox" ? sandboxScenarios(data.lifecycle.state) : [];
|
|
2951
|
+
return /* @__PURE__ */ jsxs7("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
|
|
2952
|
+
/* @__PURE__ */ jsx7("style", { children: CONNECTED_LIFECYCLE_STYLES }),
|
|
2953
|
+
/* @__PURE__ */ jsx7(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
|
|
2954
|
+
/* @__PURE__ */ jsxs7("header", { className: "mb-lifecycle-head", children: [
|
|
2955
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2956
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-title", children: [
|
|
2957
|
+
/* @__PURE__ */ jsxs7("h2", { children: [
|
|
2623
2958
|
"Bill #",
|
|
2624
2959
|
data.bill.billNumber
|
|
2625
2960
|
] }),
|
|
2626
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ jsx7("span", { children: billLifecycleDisplayLabel(data.lifecycle.state, data.lifecycle.nativeStatus) })
|
|
2627
2962
|
] }),
|
|
2628
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ jsxs7("p", { children: [
|
|
2629
2964
|
"Claim ",
|
|
2630
2965
|
data.injury.claimNumber || "\u2014",
|
|
2631
2966
|
lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
|
|
2632
2967
|
] })
|
|
2633
2968
|
] }),
|
|
2634
|
-
/* @__PURE__ */
|
|
2969
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
|
|
2635
2970
|
] }),
|
|
2636
|
-
/* @__PURE__ */
|
|
2637
|
-
/* @__PURE__ */
|
|
2638
|
-
/* @__PURE__ */
|
|
2971
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
|
|
2972
|
+
/* @__PURE__ */ jsx7("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
|
|
2973
|
+
/* @__PURE__ */ jsxs7("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: [
|
|
2639
2974
|
"Bill history ",
|
|
2640
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ jsx7("span", { children: data.activity.length })
|
|
2641
2976
|
] })
|
|
2642
2977
|
] }),
|
|
2643
|
-
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2978
|
+
data.environment === "sandbox" ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
|
|
2979
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2980
|
+
/* @__PURE__ */ jsx7("span", { children: "Sandbox demo controls" }),
|
|
2981
|
+
/* @__PURE__ */ jsx7("h3", { children: "Simulate the next payer response" }),
|
|
2982
|
+
/* @__PURE__ */ jsx7("p", { children: "This changes sandbox data only. QME Companion receives the result through the same lifecycle API and components partners use." })
|
|
2983
|
+
] }),
|
|
2984
|
+
simulations.length ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs7("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
|
|
2985
|
+
/* @__PURE__ */ jsx7("strong", { children: scenario.label }),
|
|
2986
|
+
/* @__PURE__ */ jsx7("span", { children: scenario.detail })
|
|
2987
|
+
] }, scenario.id)) }) : /* @__PURE__ */ jsx7("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
|
|
2988
|
+
] }) : null,
|
|
2989
|
+
tab === "details" ? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
|
|
2990
|
+
/* @__PURE__ */ jsx7(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} }),
|
|
2991
|
+
data.eors.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-card", id: `mb-eors-${data.bill.id}`, children: [
|
|
2992
|
+
/* @__PURE__ */ jsxs7("header", { children: [
|
|
2993
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2994
|
+
/* @__PURE__ */ jsx7("h3", { children: "Explanation of Review" }),
|
|
2995
|
+
/* @__PURE__ */ jsx7("p", { children: "The payer response associated with this immutable submission." })
|
|
2650
2996
|
] }),
|
|
2651
|
-
/* @__PURE__ */
|
|
2997
|
+
/* @__PURE__ */ jsx7("span", { children: data.eors.length })
|
|
2652
2998
|
] }),
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2999
|
+
/* @__PURE__ */ jsx7("ul", { className: "mb-lifecycle-documents", children: data.eors.map((eor) => /* @__PURE__ */ jsxs7("li", { children: [
|
|
3000
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3001
|
+
/* @__PURE__ */ jsx7("strong", { children: eor.filename }),
|
|
3002
|
+
/* @__PURE__ */ jsx7("span", { children: eor.description || `Received ${new Date(eor.addedAt).toLocaleDateString()}` })
|
|
2657
3003
|
] }),
|
|
2658
|
-
/* @__PURE__ */
|
|
3004
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View EOR" })
|
|
2659
3005
|
] }, eor.id)) })
|
|
2660
3006
|
] }) : null,
|
|
2661
|
-
viewEor || actions.length ? /* @__PURE__ */
|
|
2662
|
-
/* @__PURE__ */
|
|
2663
|
-
/* @__PURE__ */
|
|
2664
|
-
/* @__PURE__ */
|
|
3007
|
+
viewEor || actions.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-actions-sheet", children: [
|
|
3008
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3009
|
+
/* @__PURE__ */ jsx7("h3", { children: data.lifecycle.state.includes("closed") ? "This bill is closed" : data.lifecycle.state.includes("denied") || data.lifecycle.state.includes("rejected") ? "This bill needs attention" : "Available actions" }),
|
|
3010
|
+
/* @__PURE__ */ jsx7("p", { children: "Actions are determined by the current bill status." })
|
|
2665
3011
|
] }),
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
viewEor ? /* @__PURE__ */
|
|
2668
|
-
actions.map((action) => /* @__PURE__ */
|
|
3012
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3013
|
+
viewEor ? /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => document.getElementById(`mb-eors-${data.bill.id}`)?.scrollIntoView({ behavior: "smooth" }), children: viewEor.label }) : null,
|
|
3014
|
+
actions.map((action) => /* @__PURE__ */ jsx7("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
|
|
2669
3015
|
const next = actionPanel(action);
|
|
2670
3016
|
if (next) setPanel(next);
|
|
2671
3017
|
}, children: action.label }, action.id))
|
|
2672
3018
|
] })
|
|
2673
3019
|
] }) : null
|
|
2674
|
-
] }) : /* @__PURE__ */
|
|
2675
|
-
panel === "
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
3020
|
+
] }) : /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx7(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
|
|
3021
|
+
panel === "resubmit" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3022
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3023
|
+
/* @__PURE__ */ jsx7("h3", { children: "Correct and resubmit" }),
|
|
3024
|
+
/* @__PURE__ */ jsx7("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
|
|
3025
|
+
] }),
|
|
3026
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3027
|
+
/* @__PURE__ */ jsx7("span", { children: "Correction note (optional)" }),
|
|
3028
|
+
/* @__PURE__ */ jsx7("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
|
|
3029
|
+
] }),
|
|
3030
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3031
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3032
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
|
|
3033
|
+
] })
|
|
3034
|
+
] }) }) : null,
|
|
3035
|
+
panel === "second_review" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3036
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3037
|
+
/* @__PURE__ */ jsx7("h3", { children: "Submit Second Review" }),
|
|
3038
|
+
/* @__PURE__ */ jsx7("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
|
|
2679
3039
|
] }),
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
|
|
3041
|
+
/* @__PURE__ */ jsxs7("label", { className: "full", children: [
|
|
3042
|
+
/* @__PURE__ */ jsx7("span", { children: "Reason" }),
|
|
3043
|
+
/* @__PURE__ */ jsx7("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
|
|
2684
3044
|
] }),
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
3045
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3046
|
+
/* @__PURE__ */ jsx7("span", { children: "Payer claim control number" }),
|
|
3047
|
+
/* @__PURE__ */ jsx7("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
|
|
2688
3048
|
] }),
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
3049
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3050
|
+
/* @__PURE__ */ jsx7("span", { children: "Disputed amount" }),
|
|
3051
|
+
/* @__PURE__ */ jsx7("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
|
|
2692
3052
|
] }),
|
|
2693
|
-
/* @__PURE__ */
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
/* @__PURE__ */
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
3053
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3054
|
+
/* @__PURE__ */ jsx7("span", { children: "Send via" }),
|
|
3055
|
+
/* @__PURE__ */ jsxs7("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
|
|
3056
|
+
/* @__PURE__ */ jsx7("option", { value: "ebill", children: "E-bill" }),
|
|
3057
|
+
/* @__PURE__ */ jsx7("option", { value: "fax", children: "Fax" }),
|
|
3058
|
+
/* @__PURE__ */ jsx7("option", { value: "mail", children: "Mail" }),
|
|
3059
|
+
/* @__PURE__ */ jsx7("option", { value: "email", children: "Email" })
|
|
2700
3060
|
] })
|
|
2701
3061
|
] })
|
|
2702
3062
|
] }),
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
data.bill.attachments.map((attachment) => /* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
3063
|
+
/* @__PURE__ */ jsxs7("fieldset", { className: "mb-lifecycle-packet", children: [
|
|
3064
|
+
/* @__PURE__ */ jsx7("legend", { children: "Supporting packet" }),
|
|
3065
|
+
data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs7("label", { children: [
|
|
3066
|
+
/* @__PURE__ */ jsx7("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
|
|
3067
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
3068
|
+
/* @__PURE__ */ jsx7("strong", { children: attachment.filename }),
|
|
3069
|
+
/* @__PURE__ */ jsx7("small", { children: attachment.description || attachment.documentType })
|
|
2710
3070
|
] }),
|
|
2711
|
-
/* @__PURE__ */
|
|
3071
|
+
/* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
|
|
2712
3072
|
] }, attachment.id))
|
|
2713
3073
|
] }),
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
3074
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3075
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3076
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
|
|
2717
3077
|
] })
|
|
2718
3078
|
] }) }) : null,
|
|
2719
|
-
panel === "payment" ? /* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
3079
|
+
panel === "payment" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3080
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3081
|
+
/* @__PURE__ */ jsx7("h3", { children: "Post payment" }),
|
|
3082
|
+
/* @__PURE__ */ jsx7("p", { children: "Record funds shown on the payer response." })
|
|
2723
3083
|
] }),
|
|
2724
|
-
/* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2727
|
-
/* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
|
|
3085
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3086
|
+
/* @__PURE__ */ jsx7("span", { children: "Amount" }),
|
|
3087
|
+
/* @__PURE__ */ jsx7("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
|
|
2728
3088
|
] }),
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
3089
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3090
|
+
/* @__PURE__ */ jsx7("span", { children: "Method" }),
|
|
3091
|
+
/* @__PURE__ */ jsxs7("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
|
|
3092
|
+
/* @__PURE__ */ jsx7("option", { value: "check", children: "Check" }),
|
|
3093
|
+
/* @__PURE__ */ jsx7("option", { value: "eft", children: "EFT" })
|
|
2734
3094
|
] })
|
|
2735
3095
|
] }),
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
3096
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3097
|
+
/* @__PURE__ */ jsx7("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
|
|
3098
|
+
/* @__PURE__ */ jsx7("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
|
|
2739
3099
|
] }),
|
|
2740
|
-
/* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
3100
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3101
|
+
/* @__PURE__ */ jsx7("span", { children: "Deposit date" }),
|
|
3102
|
+
/* @__PURE__ */ jsx7("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
|
|
2743
3103
|
] }),
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsxs7("label", { className: "full", children: [
|
|
3105
|
+
/* @__PURE__ */ jsx7("span", { children: "Note (optional)" }),
|
|
3106
|
+
/* @__PURE__ */ jsx7("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
|
|
2747
3107
|
] })
|
|
2748
3108
|
] }),
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
3109
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3110
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3111
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment(payment)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
|
|
2752
3112
|
] })
|
|
2753
3113
|
] }) }) : null,
|
|
2754
|
-
panel === "close" || panel === "reopen" ? /* @__PURE__ */
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
3114
|
+
panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3115
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3116
|
+
/* @__PURE__ */ jsx7("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
|
|
3117
|
+
/* @__PURE__ */ jsx7("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
|
|
2758
3118
|
] }),
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
2761
|
-
/* @__PURE__ */
|
|
3119
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3120
|
+
/* @__PURE__ */ jsx7("span", { children: "Reason" }),
|
|
3121
|
+
/* @__PURE__ */ jsx7("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
|
|
2762
3122
|
] }),
|
|
2763
|
-
/* @__PURE__ */
|
|
2764
|
-
/* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3124
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3125
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
|
|
2766
3126
|
] })
|
|
2767
3127
|
] }) }) : null,
|
|
2768
|
-
notice ? /* @__PURE__ */
|
|
2769
|
-
lifecycle.error ? /* @__PURE__ */
|
|
3128
|
+
notice ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
|
|
3129
|
+
lifecycle.error ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
|
|
2770
3130
|
] });
|
|
2771
3131
|
}
|
|
2772
3132
|
var CONNECTED_LIFECYCLE_STYLES = `
|
|
3133
|
+
.mb-lifecycle-simulator{display:grid;gap:14px;padding:18px;border:1px solid #b8dadd;border-radius:var(--mb-radius,14px);background:#f2fbfb}.mb-lifecycle-simulator>div:first-child>span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.09em;text-transform:uppercase}.mb-lifecycle-simulator h3{margin:3px 0 0;font-size:1.05rem}.mb-lifecycle-simulator p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-simulator-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.mb-lifecycle-simulator-actions button{min-height:76px;border:1px solid #a9cccf;border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;padding:12px 14px;text-align:left;font:inherit}.mb-lifecycle-simulator-actions button:hover{border-color:var(--mb-accent);box-shadow:0 3px 14px rgba(23,108,112,.1)}.mb-lifecycle-simulator-actions button:disabled{cursor:not-allowed;opacity:.55}.mb-lifecycle-simulator-actions button strong,.mb-lifecycle-simulator-actions button span{display:block}.mb-lifecycle-simulator-actions button span{margin-top:3px;color:var(--mb-muted);font-size:.83rem}.mb-lifecycle-simulator-idle{padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.72)}
|
|
2773
3134
|
.mb-connected-lifecycle{--mb-accent:#176c70;--mb-text:#17282d;--mb-muted:#607176;--mb-border:#d7e0df;--mb-soft:#f4f7f6;--mb-surface:#fff;display:grid;gap:18px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-title{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.mb-lifecycle-title h2{margin:0;font-size:1.7rem}.mb-lifecycle-title span{border-radius:999px;background:var(--mb-soft);padding:5px 10px;font-weight:750}.mb-lifecycle-head p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-tabs{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);padding:6px}.mb-lifecycle-tabs button{min-height:46px;border:0;border-radius:8px;background:transparent;color:var(--mb-muted);font:inherit;font-size:1rem;font-weight:750;cursor:pointer}.mb-lifecycle-tabs button[aria-selected=true]{background:var(--mb-accent);color:white}.mb-lifecycle-tabs span{display:inline-grid;place-items:center;min-width:24px;height:24px;margin-left:6px;border-radius:999px;background:rgba(127,127,127,.14);font-size:.8rem}.mb-lifecycle-tabpanel{display:grid;gap:18px}.mb-lifecycle-button{min-height:40px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:9px 14px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:var(--mb-accent-contrast,#fff)}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-card,.mb-lifecycle-actions-sheet,.mb-lifecycle-panel{padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-card header,.mb-lifecycle-actions-sheet{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-card h3,.mb-lifecycle-actions-sheet h3,.mb-lifecycle-panel h3{margin:0;font-size:1.08rem}.mb-lifecycle-card p,.mb-lifecycle-actions-sheet p,.mb-lifecycle-panel p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-card header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-actions-sheet>div:last-child{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.mb-lifecycle-documents{list-style:none;margin:14px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid;gap:3px;min-width:0}.mb-lifecycle-documents li span{color:var(--mb-muted);font-size:.85rem}.mb-lifecycle-dialog-backdrop{position:fixed;z-index:2147483000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(18,35,43,.56);backdrop-filter:blur(3px)}.mb-lifecycle-dialog{position:relative;width:min(760px,100%);max-height:calc(100vh - 40px);overflow:auto;outline:0}.mb-lifecycle-dialog-close{position:absolute;z-index:1;top:12px;right:12px;width:34px;height:34px;border:1px solid var(--mb-border);border-radius:8px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;font:22px/1 inherit}.mb-lifecycle-panel{display:grid;gap:17px;padding-top:24px;box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:13px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:.85rem;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}
|
|
2774
3135
|
@media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-actions-sheet,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet>div:last-child{justify-content:stretch}.mb-lifecycle-actions-sheet .mb-lifecycle-button{width:100%}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:92vh}.mb-lifecycle-dialog .mb-lifecycle-panel{border-radius:18px 18px 0 0}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
|
|
2775
3136
|
`;
|
|
@@ -2819,8 +3180,10 @@ export {
|
|
|
2819
3180
|
BILL_SUBMISSION_DOCUMENT_TYPES,
|
|
2820
3181
|
BILL_SUBMISSION_REQUIRED_FIELDS,
|
|
2821
3182
|
BillActivityTimeline,
|
|
3183
|
+
BillAgingSummary,
|
|
2822
3184
|
BillLifecycleActions,
|
|
2823
3185
|
BillLifecycleProgress,
|
|
3186
|
+
BillList,
|
|
2824
3187
|
BillPayerContactCard,
|
|
2825
3188
|
BillPaymentLedger,
|
|
2826
3189
|
BillReadOnlyForm,
|
|
@@ -2828,7 +3191,16 @@ export {
|
|
|
2828
3191
|
BillReviewForm,
|
|
2829
3192
|
BillSnapshotSummary,
|
|
2830
3193
|
BillStatusSummary,
|
|
3194
|
+
BillSubmissionActions,
|
|
3195
|
+
BillSubmissionAttachmentsSection,
|
|
3196
|
+
BillSubmissionClaimSection,
|
|
2831
3197
|
BillSubmissionForm,
|
|
3198
|
+
BillSubmissionHeader,
|
|
3199
|
+
BillSubmissionPatientSection,
|
|
3200
|
+
BillSubmissionProvidersSection,
|
|
3201
|
+
BillSubmissionServiceLinesSection,
|
|
3202
|
+
BillingDashboard,
|
|
3203
|
+
BillingReport,
|
|
2832
3204
|
ConnectedBillLifecycle,
|
|
2833
3205
|
ConnectedBillStatus,
|
|
2834
3206
|
DEFAULT_BILL_SUBMISSION_MODIFIERS,
|
|
@@ -2837,8 +3209,13 @@ export {
|
|
|
2837
3209
|
MindBillBillTimeline,
|
|
2838
3210
|
applyBillSubmissionEvaluationModifiers,
|
|
2839
3211
|
billActivityEventLabel,
|
|
3212
|
+
billAgingBucket,
|
|
3213
|
+
billAgingDays,
|
|
3214
|
+
billLifecycleDisplayLabel,
|
|
2840
3215
|
billLifecycleStage,
|
|
2841
3216
|
buildBillReviewSaveInput,
|
|
3217
|
+
buildBillingReportCsv,
|
|
3218
|
+
buildBillingReportRows,
|
|
2842
3219
|
calculateBillSubmissionAllowedAmount,
|
|
2843
3220
|
createBillLifecycleClient2 as createBillLifecycleClient,
|
|
2844
3221
|
createBillStatusClient,
|
|
@@ -2849,6 +3226,7 @@ export {
|
|
|
2849
3226
|
mindBillThemePresets,
|
|
2850
3227
|
parseBillSubmissionDate,
|
|
2851
3228
|
resolveMindBillAppearance,
|
|
3229
|
+
summarizeBillingDashboard,
|
|
2852
3230
|
useBillLifecycle,
|
|
2853
3231
|
useBillStatus,
|
|
2854
3232
|
validateBillSubmission,
|