@mindbill/react 0.21.3 → 0.23.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 +81 -7
- package/dist/index.d.ts +111 -6
- package/dist/index.js +789 -402
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1155,9 +1155,10 @@ 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
|
-
createBillReferenceClient
|
|
1160
|
+
createBillReferenceClient,
|
|
1161
|
+
createBillSubmissionClient
|
|
1161
1162
|
} from "@mindbill/browser";
|
|
1162
1163
|
|
|
1163
1164
|
// src/billing-catalog.ts
|
|
@@ -1322,6 +1323,48 @@ var MAX_UPLOAD_BYTES = 100 * 1024 * 1024;
|
|
|
1322
1323
|
var MAX_DOCUMENTS = 25;
|
|
1323
1324
|
var DIAGNOSIS_PAGE_SIZE = 100;
|
|
1324
1325
|
var EMPTY_ATTACHMENTS = [];
|
|
1326
|
+
function bytesToBase64(bytes) {
|
|
1327
|
+
let binary = "";
|
|
1328
|
+
for (let offset = 0; offset < bytes.length; offset += 32768) {
|
|
1329
|
+
binary += String.fromCharCode(...bytes.subarray(offset, offset + 32768));
|
|
1330
|
+
}
|
|
1331
|
+
return globalThis.btoa(binary);
|
|
1332
|
+
}
|
|
1333
|
+
async function pdfDocument(blob, input) {
|
|
1334
|
+
if (blob.size > MAX_PDF_BYTES) throw new Error(`${input.filename} is larger than 25 MB.`);
|
|
1335
|
+
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
1336
|
+
if (bytes.length < 5 || bytes[0] !== 37 || bytes[1] !== 80 || bytes[2] !== 68 || bytes[3] !== 70 || bytes[4] !== 45) {
|
|
1337
|
+
throw new Error(`${input.filename} is not a valid PDF.`);
|
|
1338
|
+
}
|
|
1339
|
+
return { ...input, contentBase64: bytesToBase64(bytes) };
|
|
1340
|
+
}
|
|
1341
|
+
async function prepareBillSubmissionDocuments({
|
|
1342
|
+
attachments,
|
|
1343
|
+
selectedIds,
|
|
1344
|
+
uploads,
|
|
1345
|
+
fetch: fetchOverride
|
|
1346
|
+
}) {
|
|
1347
|
+
const fetcher = fetchOverride ?? globalThis.fetch;
|
|
1348
|
+
if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
|
|
1349
|
+
const selected = selectedIds.map((id) => attachments.find((item) => item.id === id)).filter((item) => Boolean(item));
|
|
1350
|
+
const sourceDocuments = await Promise.all(selected.map(async (attachment) => {
|
|
1351
|
+
if (!attachment.previewUrl) throw new Error(`${attachment.fileName} cannot be submitted because its document URL is missing.`);
|
|
1352
|
+
const response = await fetcher(attachment.previewUrl, { credentials: "same-origin" });
|
|
1353
|
+
if (!response.ok) throw new Error(`${attachment.fileName} could not be loaded for submission.`);
|
|
1354
|
+
return pdfDocument(await response.blob(), {
|
|
1355
|
+
externalId: attachment.id,
|
|
1356
|
+
filename: attachment.fileName,
|
|
1357
|
+
documentType: attachment.documentType,
|
|
1358
|
+
...attachment.description ? { description: attachment.description } : {}
|
|
1359
|
+
});
|
|
1360
|
+
}));
|
|
1361
|
+
const uploadedDocuments = await Promise.all(uploads.map(({ file, documentType, description }) => pdfDocument(file, {
|
|
1362
|
+
filename: file.name,
|
|
1363
|
+
documentType,
|
|
1364
|
+
...description ? { description } : {}
|
|
1365
|
+
})));
|
|
1366
|
+
return [...sourceDocuments, ...uploadedDocuments];
|
|
1367
|
+
}
|
|
1325
1368
|
function previewUploadedPdf(file) {
|
|
1326
1369
|
const url = URL.createObjectURL(file);
|
|
1327
1370
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
@@ -1528,10 +1571,38 @@ function mergeOptions(defaults, supplied) {
|
|
|
1528
1571
|
function mergeDiagnosisOptions(options) {
|
|
1529
1572
|
return [...new Map(options.map((item) => [item.code.toUpperCase(), item])).values()].sort((left, right) => left.code.localeCompare(right.code, void 0, { numeric: true }));
|
|
1530
1573
|
}
|
|
1574
|
+
var BillSubmissionSectionsContext = createContext(null);
|
|
1575
|
+
function BillSubmissionSection({ id }) {
|
|
1576
|
+
const sections = useContext(BillSubmissionSectionsContext);
|
|
1577
|
+
if (!sections) throw new Error("Bill submission sections must be rendered inside BillSubmissionForm.");
|
|
1578
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: sections[id] });
|
|
1579
|
+
}
|
|
1580
|
+
function BillSubmissionHeader() {
|
|
1581
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "header" });
|
|
1582
|
+
}
|
|
1583
|
+
function BillSubmissionPatientSection() {
|
|
1584
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "patient" });
|
|
1585
|
+
}
|
|
1586
|
+
function BillSubmissionClaimSection() {
|
|
1587
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "claim" });
|
|
1588
|
+
}
|
|
1589
|
+
function BillSubmissionProvidersSection() {
|
|
1590
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "providers" });
|
|
1591
|
+
}
|
|
1592
|
+
function BillSubmissionServiceLinesSection() {
|
|
1593
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "serviceLines" });
|
|
1594
|
+
}
|
|
1595
|
+
function BillSubmissionAttachmentsSection() {
|
|
1596
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "attachments" });
|
|
1597
|
+
}
|
|
1598
|
+
function BillSubmissionActions() {
|
|
1599
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSection, { id: "actions" });
|
|
1600
|
+
}
|
|
1531
1601
|
function BillSubmissionForm({
|
|
1532
1602
|
initialBill,
|
|
1533
1603
|
attachments = EMPTY_ATTACHMENTS,
|
|
1534
1604
|
onSubmit,
|
|
1605
|
+
onSubmitted,
|
|
1535
1606
|
getSession,
|
|
1536
1607
|
sessionEndpoint,
|
|
1537
1608
|
apiBaseUrl,
|
|
@@ -1548,7 +1619,8 @@ function BillSubmissionForm({
|
|
|
1548
1619
|
disabled = false,
|
|
1549
1620
|
submitLabel = "Submit bill",
|
|
1550
1621
|
heading = "Bill information",
|
|
1551
|
-
description = "Review the bill details, add attachments, and submit."
|
|
1622
|
+
description = "Review the bill details, add attachments, and submit.",
|
|
1623
|
+
children
|
|
1552
1624
|
}) {
|
|
1553
1625
|
const [bill, setBill] = useState2(() => cloneBill(initialBill));
|
|
1554
1626
|
const [selectedIds, setSelectedIds] = useState2(() => attachments.map((item) => item.id));
|
|
@@ -1574,7 +1646,9 @@ function BillSubmissionForm({
|
|
|
1574
1646
|
const procedures = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_PROCEDURES, procedureOptions), [procedureOptions]);
|
|
1575
1647
|
const modifiers = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_MODIFIERS, modifierOptions), [modifierOptions]);
|
|
1576
1648
|
const [evaluationType, setEvaluationType] = useState2(() => initialBill.renderingProvider?.isAme ? "ame" : initialBill.renderingProvider?.specialty?.toLowerCase().includes("psych") ? "psych_qme" : "qme");
|
|
1577
|
-
const
|
|
1649
|
+
const connected = !onSubmit;
|
|
1650
|
+
const referenceClient = useMemo2(() => getSession || sessionEndpoint || connected ? createBillReferenceClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
|
|
1651
|
+
const submissionClient = useMemo2(() => connected ? createBillSubmissionClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
|
|
1578
1652
|
const locked = disabled || submitting;
|
|
1579
1653
|
useEffect2(() => {
|
|
1580
1654
|
setBill(cloneBill(initialBill));
|
|
@@ -1732,7 +1806,19 @@ function BillSubmissionForm({
|
|
|
1732
1806
|
if (selectedIds.length + uploads.length > MAX_DOCUMENTS) return setFormError(`A bill can include at most ${MAX_DOCUMENTS} attachments.`);
|
|
1733
1807
|
setSubmitting(true);
|
|
1734
1808
|
try {
|
|
1735
|
-
|
|
1809
|
+
if (onSubmit) {
|
|
1810
|
+
await onSubmit({ bill: clean, sourceAttachmentIds: selectedIds, uploads });
|
|
1811
|
+
} else {
|
|
1812
|
+
if (!submissionClient) throw new Error("The connected billing client is unavailable.");
|
|
1813
|
+
const documents = await prepareBillSubmissionDocuments({
|
|
1814
|
+
attachments,
|
|
1815
|
+
selectedIds,
|
|
1816
|
+
uploads,
|
|
1817
|
+
...fetchOverride ? { fetch: fetchOverride } : {}
|
|
1818
|
+
});
|
|
1819
|
+
const result = await submissionClient.submitBill({ bill: clean, documents });
|
|
1820
|
+
await onSubmitted?.(result);
|
|
1821
|
+
}
|
|
1736
1822
|
} catch (caught) {
|
|
1737
1823
|
setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
|
|
1738
1824
|
} finally {
|
|
@@ -1740,197 +1826,481 @@ function BillSubmissionForm({
|
|
|
1740
1826
|
}
|
|
1741
1827
|
}
|
|
1742
1828
|
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
|
-
|
|
1829
|
+
const headerSection = /* @__PURE__ */ jsxs3("div", { className: "mbsf-head", children: [
|
|
1830
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1831
|
+
/* @__PURE__ */ jsx3("h3", { className: "mbsf-title", children: heading }),
|
|
1832
|
+
/* @__PURE__ */ jsx3("p", { className: "mbsf-copy", children: description })
|
|
1833
|
+
] }),
|
|
1834
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-required", children: [
|
|
1835
|
+
/* @__PURE__ */ jsx3(RequiredMark, {}),
|
|
1836
|
+
" Required"
|
|
1837
|
+
] })
|
|
1838
|
+
] });
|
|
1839
|
+
const patientSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1840
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Patient" }),
|
|
1841
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1842
|
+
/* @__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 } }))) }),
|
|
1843
|
+
/* @__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 } }))) }),
|
|
1844
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Middle name", children: text(bill.patient.middleName, (middleName) => setBill((c) => ({ ...c, patient: { ...c.patient, middleName } }))) }),
|
|
1845
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Phone (optional)", children: text(bill.patient.phone, (phone) => setBill((c) => ({ ...c, patient: { ...c.patient, phone } })), { type: "tel" }) }),
|
|
1846
|
+
/* @__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 } })) }) }),
|
|
1847
|
+
/* @__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" }) }),
|
|
1848
|
+
/* @__PURE__ */ jsxs3(Field2, { path: "patient.address.postalCode", label: "ZIP", required: true, error: errors["patient.address.postalCode"], children: [
|
|
1849
|
+
text(bill.patient.address.postalCode, updatePostalCode, { maxLength: 10 }),
|
|
1850
|
+
postalStatus ? /* @__PURE__ */ jsx3("small", { className: "mbsf-help", children: postalStatus }) : null
|
|
1752
1851
|
] }),
|
|
1753
|
-
/* @__PURE__ */
|
|
1754
|
-
|
|
1755
|
-
|
|
1852
|
+
/* @__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 })) }),
|
|
1853
|
+
/* @__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 }) })
|
|
1854
|
+
] })
|
|
1855
|
+
] });
|
|
1856
|
+
const claimSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1857
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Injury & claim" }),
|
|
1858
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1859
|
+
/* @__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 } })) }) }),
|
|
1860
|
+
/* @__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 } })) }) }),
|
|
1861
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Employer (optional)", children: text(bill.claim.employer, (employer) => setBill((c) => ({ ...c, claim: { ...c.claim, employer } }))) }),
|
|
1862
|
+
/* @__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 } }))) }),
|
|
1863
|
+
/* @__PURE__ */ jsx3(Field2, { label: "WCAB / ADJ number (optional)", children: text(bill.claim.adjNumber, (adjNumber) => setBill((c) => ({ ...c, claim: { ...c.claim, adjNumber } }))) }),
|
|
1864
|
+
/* @__PURE__ */ jsx3(Field2, { path: "claim.claimsAdministrator", label: "Claims administrator", required: true, span: true, error: claimsAdministratorError, children: /* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Claims administrator", invalid: Boolean(claimsAdministratorError), disabled: locked, loading: payerLoading, value: bill.claim.claimsAdministrator?.name ?? "", placeholder: "Search the payer directory\u2026", options: payerResults.map((payer) => ({ id: payer.id, label: payer.name, detail: [payer.hasElectronic ? "Electronic" : "Work comp", ...payer.states ?? []].join(" \xB7 ") })), onQuery: searchPayers, onSelect: (option) => setBill((c) => ({ ...c, claim: { ...c.claim, claimsAdministrator: { id: option.id, name: option.label } } })) }) }),
|
|
1865
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Injury description (optional)", span: true, children: text(bill.claim.description, (description2) => setBill((c) => ({ ...c, claim: { ...c.claim, description: description2 } }))) }),
|
|
1866
|
+
/* @__PURE__ */ jsxs3(Field2, { label: "Diagnosis codes (ICD-10)", span: true, children: [
|
|
1867
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-quick-picks", "aria-label": "Common diagnosis codes", children: BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS.map((option) => {
|
|
1868
|
+
const selected = (bill.diagnoses ?? []).includes(option.code);
|
|
1869
|
+
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: [
|
|
1870
|
+
selected ? "\u2713" : "+",
|
|
1871
|
+
" ",
|
|
1872
|
+
option.label
|
|
1873
|
+
] }, option.code);
|
|
1874
|
+
}) }),
|
|
1875
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (bill.diagnoses ?? []).map((code) => {
|
|
1876
|
+
const option = [...BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, ...diagnosisChoices].find((item) => item.code === code);
|
|
1877
|
+
return /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
|
|
1878
|
+
/* @__PURE__ */ jsx3("strong", { children: code }),
|
|
1879
|
+
option?.description ? ` ${option.description}` : "",
|
|
1880
|
+
/* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove ${code}`, onClick: () => setBill((c) => ({ ...c, diagnoses: (c.diagnoses ?? []).filter((item) => item !== code) })), children: "\xD7" })
|
|
1881
|
+
] }, code);
|
|
1882
|
+
}) }),
|
|
1883
|
+
/* @__PURE__ */ jsx3(ComboBox, { ariaLabel: "Add diagnosis code", disabled: locked, loading: diagnosisLoading, loadingMore: diagnosisLoadingMore, value: "", placeholder: bill.diagnoses?.length ?? 0 ? `${bill.diagnoses.length} selected \u2014 add more\u2026` : "Search ICD-10 codes\u2026", options: diagnosisChoices.filter((item) => !(bill.diagnoses ?? []).includes(item.code)).map((item) => ({ id: item.code, label: item.code, detail: item.description })), onOpen: () => {
|
|
1884
|
+
if (diagnosisQuery !== "") loadDiagnoses("");
|
|
1885
|
+
}, onQuery: searchDiagnoses, onEndReached: () => loadDiagnoses(diagnosisQuery ?? "", true), onSelect: (option) => setBill((c) => ({ ...c, diagnoses: [.../* @__PURE__ */ new Set([...c.diagnoses ?? [], option.id])] })) })
|
|
1756
1886
|
] })
|
|
1757
|
-
] })
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1887
|
+
] })
|
|
1888
|
+
] });
|
|
1889
|
+
const providersSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1890
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Providers & place of service" }),
|
|
1891
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-grid", children: [
|
|
1892
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing provider", children: text(bill.billingProvider?.name, (name) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, name } }))) }),
|
|
1893
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing tax ID", children: text(bill.billingProvider?.taxId, (taxId) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, taxId } }))) }),
|
|
1894
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing NPI", children: text(bill.billingProvider?.npi, (npi) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, npi } }))) }),
|
|
1895
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Billing phone", children: text(bill.billingProvider?.phone, (phone) => setBill((c) => ({ ...c, billingProvider: { ...c.billingProvider, phone } })), { type: "tel" }) }),
|
|
1896
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Rendering provider", children: text(bill.renderingProvider?.name, (name) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, name } }))) }),
|
|
1897
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Specialty", children: text(bill.renderingProvider?.specialty, (specialty) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, specialty } }))) }),
|
|
1898
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Rendering NPI", children: text(bill.renderingProvider?.npi, (npi) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, npi } }))) }),
|
|
1899
|
+
/* @__PURE__ */ jsx3(Field2, { label: "License number", children: text(bill.renderingProvider?.licenseNumber, (licenseNumber) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseNumber } }))) }),
|
|
1900
|
+
/* @__PURE__ */ jsx3(Field2, { label: "License state", children: text(bill.renderingProvider?.licenseState, (licenseState) => setBill((c) => ({ ...c, renderingProvider: { ...c.renderingProvider, licenseState: licenseState.toUpperCase() } })), { maxLength: 2 }) }),
|
|
1901
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Service location", children: text(bill.serviceLocation?.name, (name) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, name } }))) }),
|
|
1902
|
+
/* @__PURE__ */ jsx3(Field2, { label: "Place of service", children: text(bill.serviceLocation?.placeOfServiceCode, (placeOfServiceCode) => setBill((c) => ({ ...c, serviceLocation: { ...c.serviceLocation, placeOfServiceCode } })), { maxLength: 2 }) })
|
|
1903
|
+
] })
|
|
1904
|
+
] });
|
|
1905
|
+
const serviceLinesSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1906
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Evaluation & service lines" }),
|
|
1907
|
+
/* @__PURE__ */ jsx3("p", { className: "mbsf-help", children: "Sets the evaluator/specialty modifier on medical-legal evaluation lines." }),
|
|
1908
|
+
/* @__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)) }),
|
|
1909
|
+
/* @__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." }),
|
|
1910
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-lines", "data-field-path": "serviceLines", "data-invalid": Boolean(errors.serviceLines), children: [
|
|
1911
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-line-head", children: [
|
|
1912
|
+
/* @__PURE__ */ jsx3("span", { children: "Procedure code" }),
|
|
1913
|
+
/* @__PURE__ */ jsx3("span", { children: "Modifiers" }),
|
|
1914
|
+
/* @__PURE__ */ jsx3("span", { children: "Units" }),
|
|
1915
|
+
/* @__PURE__ */ jsx3("span", { children: "Allowed" }),
|
|
1916
|
+
/* @__PURE__ */ jsx3("span", {}),
|
|
1917
|
+
" "
|
|
1918
|
+
] }),
|
|
1919
|
+
bill.serviceLines.map((line, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-line", children: [
|
|
1920
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Procedure code", "data-field-path": `serviceLines.${index}.code`, "data-invalid": Boolean(errors[`serviceLines.${index}.code`]), children: [
|
|
1921
|
+
/* @__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) => {
|
|
1922
|
+
const auto = evaluationModifier(evaluationType, option.id);
|
|
1923
|
+
setLine(index, { code: option.id, ...auto ? { modifiers: [auto, ...(line.modifiers ?? []).filter((item) => !["94", "95", "96"].includes(item.replace(/^-/, "")))] } : line.modifiers ? { modifiers: line.modifiers } : {} });
|
|
1924
|
+
} }),
|
|
1925
|
+
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,
|
|
1926
|
+
errors[`serviceLines.${index}.code`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.code`] }) : null
|
|
1770
1927
|
] }),
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
|
|
1928
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Modifiers", children: [
|
|
1929
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-chips", children: (line.modifiers ?? []).map((modifier) => /* @__PURE__ */ jsxs3("span", { className: "mbsf-chip", children: [
|
|
1930
|
+
"\u2212",
|
|
1931
|
+
modifier.replace(/^-/, ""),
|
|
1932
|
+
/* @__PURE__ */ jsx3("button", { type: "button", "aria-label": `Remove modifier ${modifier}`, onClick: () => setLine(index, { modifiers: (line.modifiers ?? []).filter((item) => item !== modifier) }), children: "\xD7" })
|
|
1933
|
+
] }, modifier)) }),
|
|
1934
|
+
/* @__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])] }) })
|
|
1935
|
+
] }),
|
|
1936
|
+
/* @__PURE__ */ jsxs3("div", { "data-label": "Units", "data-field-path": `serviceLines.${index}.units`, "data-invalid": Boolean(errors[`serviceLines.${index}.units`]), children: [
|
|
1937
|
+
/* @__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) }) }),
|
|
1938
|
+
errors[`serviceLines.${index}.units`] ? /* @__PURE__ */ jsx3("small", { className: "mbsf-error", role: "alert", children: errors[`serviceLines.${index}.units`] }) : null
|
|
1939
|
+
] }),
|
|
1940
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-money", "data-label": "Allowed", children: lineCharge(line) == null ? "\u2014" : lineCharge(line).toLocaleString(void 0, { style: "currency", currency: "USD" }) }),
|
|
1941
|
+
/* @__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" })
|
|
1942
|
+
] }, index)),
|
|
1943
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-total", children: [
|
|
1944
|
+
/* @__PURE__ */ jsx3("span", { children: "Total" }),
|
|
1945
|
+
/* @__PURE__ */ jsx3("span", { children: total.toLocaleString(void 0, { style: "currency", currency: "USD" }) })
|
|
1773
1946
|
] })
|
|
1774
1947
|
] }),
|
|
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
|
-
|
|
1948
|
+
errors.serviceLines ? /* @__PURE__ */ jsx3("p", { className: "mbsf-error", role: "alert", children: errors.serviceLines }) : null
|
|
1949
|
+
] });
|
|
1950
|
+
const attachmentsSection = /* @__PURE__ */ jsxs3("fieldset", { className: "mbsf-card", disabled: locked, children: [
|
|
1951
|
+
/* @__PURE__ */ jsx3("legend", { className: "mbsf-legend", children: "Attachments" }),
|
|
1952
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-list", children: [
|
|
1953
|
+
attachments.filter((attachment) => !removedSourceIds.includes(attachment.id)).map((attachment) => {
|
|
1954
|
+
const auto = attachment.autoAttached || attachment.documentType === "w9";
|
|
1955
|
+
const removable = !auto && attachment.removable !== false;
|
|
1956
|
+
return /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", "data-auto": auto, children: [
|
|
1957
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-main", children: [
|
|
1958
|
+
auto ? /* @__PURE__ */ jsx3("span", { "aria-label": "Always attached", role: "img", children: "\u2713" }) : null,
|
|
1959
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1960
|
+
/* @__PURE__ */ jsx3("strong", { children: attachment.fileName }),
|
|
1961
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-badge", children: auto ? "Auto-attached" : documentLabels[attachment.documentType] }),
|
|
1962
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block" }, children: attachment.description || (auto ? "Included automatically with every bill." : documentLabels[attachment.documentType]) })
|
|
1963
|
+
] })
|
|
1964
|
+
] }),
|
|
1965
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1966
|
+
attachment.previewUrl ? /* @__PURE__ */ jsx3("a", { className: "mbsf-secondary", href: attachment.previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview" }) : null,
|
|
1967
|
+
removable ? /* @__PURE__ */ jsx3("button", { className: "mbsf-icon-btn", type: "button", "aria-label": `Remove ${attachment.fileName}`, disabled: locked, onClick: () => {
|
|
1968
|
+
setSelectedIds((current) => current.filter((id) => id !== attachment.id));
|
|
1969
|
+
setRemovedSourceIds((current) => [.../* @__PURE__ */ new Set([...current, attachment.id])]);
|
|
1970
|
+
}, children: "\xD7" }) : null
|
|
1971
|
+
] })
|
|
1972
|
+
] }, attachment.id);
|
|
1973
|
+
}),
|
|
1974
|
+
uploads.map((upload, index) => /* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-row", children: [
|
|
1975
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-attach-main", children: /* @__PURE__ */ jsxs3("span", { className: "mbsf-file", children: [
|
|
1976
|
+
/* @__PURE__ */ jsx3("strong", { children: upload.file.name }),
|
|
1977
|
+
/* @__PURE__ */ jsxs3("span", { className: "mbsf-help", style: { display: "block" }, children: [
|
|
1978
|
+
(upload.file.size / 1024 / 1024).toFixed(1),
|
|
1979
|
+
" MB"
|
|
1980
|
+
] })
|
|
1981
|
+
] }) }),
|
|
1982
|
+
/* @__PURE__ */ jsxs3("div", { className: "mbsf-attach-actions", children: [
|
|
1983
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-secondary", type: "button", onClick: () => previewUploadedPdf(upload.file), children: "Preview" }),
|
|
1984
|
+
/* @__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
1985
|
] })
|
|
1806
|
-
] })
|
|
1986
|
+
] }, `${upload.file.name}-${index}`))
|
|
1807
1987
|
] }),
|
|
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
|
-
|
|
1988
|
+
/* @__PURE__ */ jsx3("input", { ref: fileInput, hidden: true, type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: (event) => {
|
|
1989
|
+
if (event.target.files) addFiles(event.target.files);
|
|
1990
|
+
event.target.value = "";
|
|
1991
|
+
} }),
|
|
1992
|
+
/* @__PURE__ */ jsx3("button", { className: "mbsf-drop", "data-active": dragActive, type: "button", onClick: () => fileInput.current?.click(), children: /* @__PURE__ */ jsxs3("span", { children: [
|
|
1993
|
+
/* @__PURE__ */ jsx3("strong", { style: { fontSize: 18 }, children: "Drop additional PDF files here, or click to choose" }),
|
|
1994
|
+
/* @__PURE__ */ jsx3("span", { className: "mbsf-help", style: { display: "block", marginTop: 8 }, children: "Add supporting documents anywhere on this screen." })
|
|
1995
|
+
] }) })
|
|
1996
|
+
] });
|
|
1997
|
+
const actionsSection = /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1998
|
+
formError ? /* @__PURE__ */ jsx3("div", { className: "mbsf-alert", role: "alert", children: formError }) : null,
|
|
1999
|
+
/* @__PURE__ */ jsx3("div", { className: "mbsf-actions", children: /* @__PURE__ */ jsx3("button", { className: "mbsf-submit", type: "submit", disabled: locked, children: submitting ? "Submitting\u2026" : submitLabel }) })
|
|
2000
|
+
] });
|
|
2001
|
+
const sections = {
|
|
2002
|
+
header: headerSection,
|
|
2003
|
+
patient: patientSection,
|
|
2004
|
+
claim: claimSection,
|
|
2005
|
+
providers: providersSection,
|
|
2006
|
+
serviceLines: serviceLinesSection,
|
|
2007
|
+
attachments: attachmentsSection,
|
|
2008
|
+
actions: actionsSection
|
|
2009
|
+
};
|
|
2010
|
+
const defaultLayout = /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
2011
|
+
/* @__PURE__ */ jsx3(BillSubmissionHeader, {}),
|
|
2012
|
+
/* @__PURE__ */ jsx3(BillSubmissionPatientSection, {}),
|
|
2013
|
+
/* @__PURE__ */ jsx3(BillSubmissionClaimSection, {}),
|
|
2014
|
+
/* @__PURE__ */ jsx3(BillSubmissionProvidersSection, {}),
|
|
2015
|
+
/* @__PURE__ */ jsx3(BillSubmissionServiceLinesSection, {}),
|
|
2016
|
+
/* @__PURE__ */ jsx3(BillSubmissionAttachmentsSection, {}),
|
|
2017
|
+
/* @__PURE__ */ jsx3(BillSubmissionActions, {})
|
|
2018
|
+
] });
|
|
2019
|
+
return /* @__PURE__ */ jsx3(BillSubmissionSectionsContext.Provider, { value: sections, children: /* @__PURE__ */ jsxs3("form", { ref: formRef, className: `${className} mbsf`, style: { ...mindBillAppearanceStyle(appearance), ...style }, onSubmit: (event) => {
|
|
2020
|
+
event.preventDefault();
|
|
2021
|
+
void submit();
|
|
2022
|
+
}, noValidate: true, children: [
|
|
2023
|
+
/* @__PURE__ */ jsx3("style", { children: css }),
|
|
2024
|
+
children ?? defaultLayout
|
|
2025
|
+
] }) });
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// src/billing-dashboard.tsx
|
|
2029
|
+
import { useMemo as useMemo3, useState as useState3 } from "react";
|
|
2030
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2031
|
+
var css2 = `
|
|
2032
|
+
.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)}
|
|
2033
|
+
.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}
|
|
2034
|
+
.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)}
|
|
2035
|
+
.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)}
|
|
2036
|
+
.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)}
|
|
2037
|
+
@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)}}
|
|
2038
|
+
@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}}
|
|
2039
|
+
`;
|
|
2040
|
+
var terminalStates = /* @__PURE__ */ new Set(["closed", "voided", "cancelled"]);
|
|
2041
|
+
var money3 = (value) => Number(value || 0).toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
2042
|
+
var stateLabel = (state) => state.replaceAll("_", " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
2043
|
+
function billAgingDays(bill, now = /* @__PURE__ */ new Date()) {
|
|
2044
|
+
if (Number.isFinite(bill.agingDays)) return Math.max(0, Math.floor(bill.agingDays));
|
|
2045
|
+
if (!bill.submittedAt) return 0;
|
|
2046
|
+
const submitted = new Date(bill.submittedAt);
|
|
2047
|
+
if (Number.isNaN(submitted.valueOf())) return 0;
|
|
2048
|
+
return Math.max(0, Math.floor((now.valueOf() - submitted.valueOf()) / 864e5));
|
|
2049
|
+
}
|
|
2050
|
+
function billAgingBucket(bill, now = /* @__PURE__ */ new Date()) {
|
|
2051
|
+
const days = billAgingDays(bill, now);
|
|
2052
|
+
if (days <= 30) return "current";
|
|
2053
|
+
if (days <= 60) return "31-60";
|
|
2054
|
+
if (days <= 90) return "61-90";
|
|
2055
|
+
return "91+";
|
|
2056
|
+
}
|
|
2057
|
+
function summarizeBillingDashboard(bills, now = /* @__PURE__ */ new Date()) {
|
|
2058
|
+
const aging = [
|
|
2059
|
+
{ id: "current", label: "0\u201330 days", count: 0, balance: 0 },
|
|
2060
|
+
{ id: "31-60", label: "31\u201360 days", count: 0, balance: 0 },
|
|
2061
|
+
{ id: "61-90", label: "61\u201390 days", count: 0, balance: 0 },
|
|
2062
|
+
{ id: "91+", label: "91+ days", count: 0, balance: 0 }
|
|
2063
|
+
];
|
|
2064
|
+
let totalBilled = 0;
|
|
2065
|
+
let totalPaid = 0;
|
|
2066
|
+
let outstanding = 0;
|
|
2067
|
+
let openCount = 0;
|
|
2068
|
+
for (const bill of bills) {
|
|
2069
|
+
totalBilled += Number(bill.totalCharge || 0);
|
|
2070
|
+
totalPaid += Number(bill.totalPaid || 0);
|
|
2071
|
+
outstanding += Number(bill.balanceDue || 0);
|
|
2072
|
+
if (!terminalStates.has(bill.state.toLowerCase()) && bill.balanceDue > 0) {
|
|
2073
|
+
openCount += 1;
|
|
2074
|
+
const bucket = aging.find((item) => item.id === billAgingBucket(bill, now));
|
|
2075
|
+
bucket.count += 1;
|
|
2076
|
+
bucket.balance += Number(bill.balanceDue || 0);
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
return { totalBilled, totalPaid, outstanding, openCount, bills: bills.length, aging };
|
|
2080
|
+
}
|
|
2081
|
+
function Shell({ appearance, className = "", style, children }) {
|
|
2082
|
+
return /* @__PURE__ */ jsxs4("div", { className: `mbdash ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
|
|
2083
|
+
/* @__PURE__ */ jsx4("style", { children: css2 }),
|
|
2084
|
+
children
|
|
2085
|
+
] });
|
|
2086
|
+
}
|
|
2087
|
+
function BillIdentity({ bill }) {
|
|
2088
|
+
const label = bill.billNumber == null ? bill.externalId ?? "Bill" : `Bill #${bill.billNumber}`;
|
|
2089
|
+
const content = /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2090
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-primary", children: label }),
|
|
2091
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-secondary", children: [bill.patientName, bill.claimNumber ? `Claim ${bill.claimNumber}` : null].filter(Boolean).join(" \xB7 ") })
|
|
2092
|
+
] });
|
|
2093
|
+
return bill.href ? /* @__PURE__ */ jsx4("a", { href: bill.href, className: "mbdash-primary", children: content }) : /* @__PURE__ */ jsx4(Fragment3, { children: content });
|
|
2094
|
+
}
|
|
2095
|
+
function BillListContent({ bills, onSelectBill, emptyState = "No bills match these filters." }) {
|
|
2096
|
+
if (!bills.length) return /* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-empty", children: emptyState });
|
|
2097
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
|
|
2099
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2100
|
+
/* @__PURE__ */ jsx4("th", { children: "Bill" }),
|
|
2101
|
+
/* @__PURE__ */ jsx4("th", { children: "Payer" }),
|
|
2102
|
+
/* @__PURE__ */ jsx4("th", { children: "Status" }),
|
|
2103
|
+
/* @__PURE__ */ jsx4("th", { children: "Age" }),
|
|
2104
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
|
|
2105
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
|
|
2106
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
|
|
2107
|
+
] }) }),
|
|
2108
|
+
/* @__PURE__ */ jsx4("tbody", { children: bills.map((bill) => /* @__PURE__ */ jsxs4("tr", { "data-clickable": Boolean(onSelectBill), onClick: () => onSelectBill?.(bill), children: [
|
|
2109
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
|
|
2110
|
+
/* @__PURE__ */ jsx4("td", { children: bill.payerName || "\u2014" }),
|
|
2111
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) }) }),
|
|
2112
|
+
/* @__PURE__ */ jsxs4("td", { children: [
|
|
2113
|
+
billAgingDays(bill),
|
|
2114
|
+
" days"
|
|
1837
2115
|
] }),
|
|
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" }) })
|
|
2116
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalCharge) }),
|
|
2117
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(bill.totalPaid) }),
|
|
2118
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: /* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) }) })
|
|
2119
|
+
] }, bill.id)) })
|
|
2120
|
+
] }) }),
|
|
2121
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-mobile-list", children: bills.map((bill) => /* @__PURE__ */ jsxs4("article", { className: "mbdash-mobile-card", onClick: () => onSelectBill?.(bill), children: [
|
|
2122
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-top", children: [
|
|
2123
|
+
/* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(BillIdentity, { bill }) }),
|
|
2124
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-state", children: stateLabel(bill.state) })
|
|
2125
|
+
] }),
|
|
2126
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-mobile-money", children: [
|
|
2127
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2128
|
+
/* @__PURE__ */ jsx4("small", { children: "Age" }),
|
|
2129
|
+
billAgingDays(bill),
|
|
2130
|
+
" days"
|
|
2131
|
+
] }),
|
|
2132
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2133
|
+
/* @__PURE__ */ jsx4("small", { children: "Paid" }),
|
|
2134
|
+
money3(bill.totalPaid)
|
|
2135
|
+
] }),
|
|
2136
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2137
|
+
/* @__PURE__ */ jsx4("small", { children: "Balance" }),
|
|
2138
|
+
/* @__PURE__ */ jsx4("strong", { children: money3(bill.balanceDue) })
|
|
1865
2139
|
] })
|
|
2140
|
+
] })
|
|
2141
|
+
] }, bill.id)) })
|
|
2142
|
+
] });
|
|
2143
|
+
}
|
|
2144
|
+
function BillList(props) {
|
|
2145
|
+
const shellProps = {
|
|
2146
|
+
...props.appearance === void 0 ? {} : { appearance: props.appearance },
|
|
2147
|
+
...props.className === void 0 ? {} : { className: props.className },
|
|
2148
|
+
...props.style === void 0 ? {} : { style: props.style }
|
|
2149
|
+
};
|
|
2150
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(BillListContent, { ...props }) });
|
|
2151
|
+
}
|
|
2152
|
+
function AgingContent({ bills, heading = "Accounts receivable" }) {
|
|
2153
|
+
const summary = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
|
|
2154
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
2155
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
|
|
2156
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2157
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: "Current balances and aging at a glance." })
|
|
2158
|
+
] }) }),
|
|
2159
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-card mbdash-summary", children: [
|
|
2160
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2161
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Outstanding" }),
|
|
2162
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.outstanding) })
|
|
1866
2163
|
] }),
|
|
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}`))
|
|
2164
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2165
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Open bills" }),
|
|
2166
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: summary.openCount })
|
|
1906
2167
|
] }),
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
/* @__PURE__ */
|
|
1912
|
-
/* @__PURE__ */
|
|
1913
|
-
/* @__PURE__ */
|
|
1914
|
-
] })
|
|
2168
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2169
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Collected" }),
|
|
2170
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalPaid) })
|
|
2171
|
+
] }),
|
|
2172
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-stat", children: [
|
|
2173
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: "Total billed" }),
|
|
2174
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-value", children: money3(summary.totalBilled) })
|
|
2175
|
+
] })
|
|
1915
2176
|
] }),
|
|
1916
|
-
|
|
1917
|
-
|
|
2177
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-card mbdash-aging", children: summary.aging.map((bucket) => /* @__PURE__ */ jsxs4("div", { className: "mbdash-aging-item", children: [
|
|
2178
|
+
/* @__PURE__ */ jsx4("span", { className: "mbdash-label", children: bucket.label }),
|
|
2179
|
+
/* @__PURE__ */ jsx4("strong", { children: money3(bucket.balance) }),
|
|
2180
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
2181
|
+
bucket.count,
|
|
2182
|
+
" bill",
|
|
2183
|
+
bucket.count === 1 ? "" : "s"
|
|
2184
|
+
] })
|
|
2185
|
+
] }, bucket.id)) })
|
|
1918
2186
|
] });
|
|
1919
2187
|
}
|
|
2188
|
+
function BillAgingSummary(props) {
|
|
2189
|
+
const shellProps = {
|
|
2190
|
+
...props.appearance === void 0 ? {} : { appearance: props.appearance },
|
|
2191
|
+
...props.className === void 0 ? {} : { className: props.className },
|
|
2192
|
+
...props.style === void 0 ? {} : { style: props.style }
|
|
2193
|
+
};
|
|
2194
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsx4(AgingContent, { bills: props.bills, ...props.heading === void 0 ? {} : { heading: props.heading } }) });
|
|
2195
|
+
}
|
|
2196
|
+
function BillingDashboard({ bills, heading = "Billing", description = "Track submitted bills, payments, and outstanding balances.", onSelectBill, initialSearch = "", initialState = "all", hideFilters = false, appearance, className, style }) {
|
|
2197
|
+
const [search, setSearch] = useState3(initialSearch);
|
|
2198
|
+
const [state, setState] = useState3(initialState);
|
|
2199
|
+
const states = useMemo3(() => [...new Set(bills.map((bill) => bill.state))].sort((a, b) => a.localeCompare(b)), [bills]);
|
|
2200
|
+
const filtered = useMemo3(() => {
|
|
2201
|
+
const query = search.trim().toLowerCase();
|
|
2202
|
+
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))));
|
|
2203
|
+
}, [bills, search, state]);
|
|
2204
|
+
const shellProps = {
|
|
2205
|
+
...appearance === void 0 ? {} : { appearance },
|
|
2206
|
+
...className === void 0 ? {} : { className },
|
|
2207
|
+
...style === void 0 ? {} : { style }
|
|
2208
|
+
};
|
|
2209
|
+
const listProps = { bills: filtered, ...onSelectBill === void 0 ? {} : { onSelectBill } };
|
|
2210
|
+
return /* @__PURE__ */ jsxs4(Shell, { ...shellProps, children: [
|
|
2211
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-head", children: /* @__PURE__ */ jsxs4("div", { children: [
|
|
2212
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2213
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
|
|
2214
|
+
] }) }),
|
|
2215
|
+
/* @__PURE__ */ jsx4(AgingContent, { bills: filtered, heading: "Receivables" }),
|
|
2216
|
+
hideFilters ? null : /* @__PURE__ */ jsxs4("div", { className: "mbdash-filters", children: [
|
|
2217
|
+
/* @__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" }),
|
|
2218
|
+
/* @__PURE__ */ jsxs4("select", { className: "mbdash-control", value: state, onChange: (event) => setState(event.target.value), "aria-label": "Filter bills by status", children: [
|
|
2219
|
+
/* @__PURE__ */ jsx4("option", { value: "all", children: "All statuses" }),
|
|
2220
|
+
states.map((item) => /* @__PURE__ */ jsx4("option", { value: item, children: stateLabel(item) }, item))
|
|
2221
|
+
] })
|
|
2222
|
+
] }),
|
|
2223
|
+
/* @__PURE__ */ jsx4(BillListContent, { ...listProps })
|
|
2224
|
+
] });
|
|
2225
|
+
}
|
|
2226
|
+
function buildBillingReportRows(bills, groupBy = "status") {
|
|
2227
|
+
const rows = /* @__PURE__ */ new Map();
|
|
2228
|
+
for (const bill of bills) {
|
|
2229
|
+
const key = groupBy === "payer" ? bill.payerName || "Unassigned payer" : groupBy === "aging" ? billAgingBucket(bill) : bill.state;
|
|
2230
|
+
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;
|
|
2231
|
+
const row = rows.get(key) ?? { key, label, billCount: 0, totalBilled: 0, totalPaid: 0, balanceDue: 0 };
|
|
2232
|
+
row.billCount += 1;
|
|
2233
|
+
row.totalBilled += Number(bill.totalCharge || 0);
|
|
2234
|
+
row.totalPaid += Number(bill.totalPaid || 0);
|
|
2235
|
+
row.balanceDue += Number(bill.balanceDue || 0);
|
|
2236
|
+
rows.set(key, row);
|
|
2237
|
+
}
|
|
2238
|
+
return [...rows.values()].sort((a, b) => a.label.localeCompare(b.label, void 0, { numeric: true }));
|
|
2239
|
+
}
|
|
2240
|
+
function buildBillingReportCsv(bills, groupBy = "status") {
|
|
2241
|
+
const escape = (value) => `"${String(value).replaceAll('"', '""')}"`;
|
|
2242
|
+
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");
|
|
2243
|
+
}
|
|
2244
|
+
function BillingReport({ bills, groupBy = "status", heading = "Billing report", description = "Billed, paid, and outstanding totals.", appearance, className, style }) {
|
|
2245
|
+
const rows = useMemo3(() => buildBillingReportRows(bills, groupBy), [bills, groupBy]);
|
|
2246
|
+
const total = useMemo3(() => summarizeBillingDashboard(bills), [bills]);
|
|
2247
|
+
const shellProps = {
|
|
2248
|
+
...appearance === void 0 ? {} : { appearance },
|
|
2249
|
+
className: `mbdash-report ${className ?? ""}`.trim(),
|
|
2250
|
+
...style === void 0 ? {} : { style }
|
|
2251
|
+
};
|
|
2252
|
+
return /* @__PURE__ */ jsx4(Shell, { ...shellProps, children: /* @__PURE__ */ jsxs4("div", { className: "mbdash-card", children: [
|
|
2253
|
+
/* @__PURE__ */ jsxs4("div", { className: "mbdash-report-head", children: [
|
|
2254
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
2255
|
+
/* @__PURE__ */ jsx4("h2", { children: heading }),
|
|
2256
|
+
/* @__PURE__ */ jsx4("p", { className: "mbdash-copy", children: description })
|
|
2257
|
+
] }),
|
|
2258
|
+
/* @__PURE__ */ jsxs4("span", { className: "mbdash-state", children: [
|
|
2259
|
+
"By ",
|
|
2260
|
+
groupBy
|
|
2261
|
+
] })
|
|
2262
|
+
] }),
|
|
2263
|
+
/* @__PURE__ */ jsx4("div", { className: "mbdash-table-wrap", children: /* @__PURE__ */ jsxs4("table", { className: "mbdash-table", children: [
|
|
2264
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2265
|
+
/* @__PURE__ */ jsx4("th", { children: "Group" }),
|
|
2266
|
+
/* @__PURE__ */ jsx4("th", { children: "Bills" }),
|
|
2267
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Billed" }),
|
|
2268
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Paid" }),
|
|
2269
|
+
/* @__PURE__ */ jsx4("th", { className: "mbdash-money", children: "Balance" })
|
|
2270
|
+
] }) }),
|
|
2271
|
+
/* @__PURE__ */ jsxs4("tbody", { children: [
|
|
2272
|
+
rows.map((row) => /* @__PURE__ */ jsxs4("tr", { children: [
|
|
2273
|
+
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4("strong", { children: row.label }) }),
|
|
2274
|
+
/* @__PURE__ */ jsx4("td", { children: row.billCount }),
|
|
2275
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalBilled) }),
|
|
2276
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.totalPaid) }),
|
|
2277
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(row.balanceDue) })
|
|
2278
|
+
] }, row.key)),
|
|
2279
|
+
/* @__PURE__ */ jsxs4("tr", { className: "mbdash-report-total", children: [
|
|
2280
|
+
/* @__PURE__ */ jsx4("td", { children: "Total" }),
|
|
2281
|
+
/* @__PURE__ */ jsx4("td", { children: total.bills }),
|
|
2282
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalBilled) }),
|
|
2283
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.totalPaid) }),
|
|
2284
|
+
/* @__PURE__ */ jsx4("td", { className: "mbdash-money", children: money3(total.outstanding) })
|
|
2285
|
+
] })
|
|
2286
|
+
] })
|
|
2287
|
+
] }) })
|
|
2288
|
+
] }) });
|
|
2289
|
+
}
|
|
1920
2290
|
|
|
1921
2291
|
// src/connected-bill-status.tsx
|
|
1922
2292
|
import {
|
|
1923
2293
|
useCallback as useCallback2,
|
|
1924
2294
|
useEffect as useEffect3,
|
|
1925
|
-
useMemo as
|
|
2295
|
+
useMemo as useMemo4,
|
|
1926
2296
|
useRef as useRef3,
|
|
1927
|
-
useState as
|
|
2297
|
+
useState as useState4
|
|
1928
2298
|
} from "react";
|
|
1929
2299
|
import {
|
|
1930
2300
|
DEFAULT_API_BASE_URL,
|
|
1931
2301
|
DEFAULT_SESSION_ENDPOINT
|
|
1932
2302
|
} from "@mindbill/browser";
|
|
1933
|
-
import { Fragment as
|
|
2303
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1934
2304
|
var DEFAULT_REFRESH_INTERVAL = 6e4;
|
|
1935
2305
|
async function responseError(response, fallback) {
|
|
1936
2306
|
const body = await response.json().catch(() => null);
|
|
@@ -2063,17 +2433,17 @@ function useBillStatus({
|
|
|
2063
2433
|
initialData = null,
|
|
2064
2434
|
fetch: fetchOverride
|
|
2065
2435
|
}) {
|
|
2066
|
-
const client =
|
|
2436
|
+
const client = useMemo4(() => createBillStatusClient({
|
|
2067
2437
|
billId,
|
|
2068
2438
|
sessionEndpoint,
|
|
2069
2439
|
...getSession ? { getSession } : {},
|
|
2070
2440
|
apiBaseUrl,
|
|
2071
2441
|
...fetchOverride ? { fetch: fetchOverride } : {}
|
|
2072
2442
|
}), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
|
|
2073
|
-
const [data, setData] =
|
|
2074
|
-
const [error, setError] =
|
|
2075
|
-
const [isLoading, setIsLoading] =
|
|
2076
|
-
const [isRefreshing, setIsRefreshing] =
|
|
2443
|
+
const [data, setData] = useState4(initialData);
|
|
2444
|
+
const [error, setError] = useState4(null);
|
|
2445
|
+
const [isLoading, setIsLoading] = useState4(enabled && !initialData);
|
|
2446
|
+
const [isRefreshing, setIsRefreshing] = useState4(false);
|
|
2077
2447
|
const dataRef = useRef3(initialData);
|
|
2078
2448
|
const initialDataRef = useRef3(initialData);
|
|
2079
2449
|
initialDataRef.current = initialData;
|
|
@@ -2151,17 +2521,17 @@ function ConnectedBillStatus({
|
|
|
2151
2521
|
}) {
|
|
2152
2522
|
const status = useBillStatus(options);
|
|
2153
2523
|
if (status.isLoading && !status.data) {
|
|
2154
|
-
return /* @__PURE__ */
|
|
2524
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children: loadingFallback ?? /* @__PURE__ */ jsx5("div", { role: "status", children: "Loading bill status\u2026" }) });
|
|
2155
2525
|
}
|
|
2156
2526
|
if (status.error && !status.data) {
|
|
2157
|
-
return /* @__PURE__ */
|
|
2527
|
+
return /* @__PURE__ */ jsx5(Fragment4, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs5("div", { role: "alert", children: [
|
|
2158
2528
|
status.error.message,
|
|
2159
2529
|
" ",
|
|
2160
|
-
/* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ jsx5("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
|
|
2161
2531
|
] }) });
|
|
2162
2532
|
}
|
|
2163
2533
|
if (!status.data) return null;
|
|
2164
|
-
return /* @__PURE__ */
|
|
2534
|
+
return /* @__PURE__ */ jsx5(
|
|
2165
2535
|
BillStatusSummary,
|
|
2166
2536
|
{
|
|
2167
2537
|
status: status.data.state,
|
|
@@ -2180,7 +2550,7 @@ function ConnectedBillStatus({
|
|
|
2180
2550
|
}
|
|
2181
2551
|
|
|
2182
2552
|
// src/bill-lifecycle-surfaces.tsx
|
|
2183
|
-
import { jsx as
|
|
2553
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2184
2554
|
function visibleBillLifecycleActions(actions, showUnavailable = false) {
|
|
2185
2555
|
return actions.filter((action) => action.enabled || showUnavailable);
|
|
2186
2556
|
}
|
|
@@ -2195,11 +2565,11 @@ function BillLifecycleActions({
|
|
|
2195
2565
|
}) {
|
|
2196
2566
|
const visible = visibleBillLifecycleActions(actions, showUnavailable);
|
|
2197
2567
|
if (!visible.length) return null;
|
|
2198
|
-
return /* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
visible.map((action) => /* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
!action.enabled && action.reason ? /* @__PURE__ */
|
|
2568
|
+
return /* @__PURE__ */ jsxs6("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
|
|
2569
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2570
|
+
visible.map((action) => /* @__PURE__ */ jsxs6("div", { className: "mb-lifecycle-action", children: [
|
|
2571
|
+
/* @__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 }),
|
|
2572
|
+
!action.enabled && action.reason ? /* @__PURE__ */ jsx6("span", { className: "mb-action-reason", children: action.reason }) : null
|
|
2203
2573
|
] }, action.id))
|
|
2204
2574
|
] });
|
|
2205
2575
|
}
|
|
@@ -2229,21 +2599,21 @@ function defaultFormatDate(createdAt) {
|
|
|
2229
2599
|
return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
|
|
2230
2600
|
}
|
|
2231
2601
|
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__ */
|
|
2602
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
|
|
2603
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2604
|
+
/* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
|
|
2605
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2606
|
+
/* @__PURE__ */ jsx6("strong", { children: "Bill history" }),
|
|
2607
|
+
/* @__PURE__ */ jsx6("span", { children: "Submission, payer responses, follow-up, and payments." })
|
|
2238
2608
|
] }),
|
|
2239
|
-
/* @__PURE__ */
|
|
2609
|
+
/* @__PURE__ */ jsx6("span", { children: events.length })
|
|
2240
2610
|
] }),
|
|
2241
|
-
!events.length ? /* @__PURE__ */
|
|
2242
|
-
/* @__PURE__ */
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
event.description ? /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2611
|
+
!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: [
|
|
2612
|
+
/* @__PURE__ */ jsx6("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
|
|
2613
|
+
/* @__PURE__ */ jsxs6("div", { className: "mb-activity-content", children: [
|
|
2614
|
+
/* @__PURE__ */ jsx6("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
|
|
2615
|
+
event.description ? /* @__PURE__ */ jsx6("p", { children: event.description }) : null,
|
|
2616
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2247
2617
|
formatDate(event.createdAt),
|
|
2248
2618
|
event.actor ? ` \xB7 ${event.actor}` : ""
|
|
2249
2619
|
] })
|
|
@@ -2278,20 +2648,20 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
|
|
|
2278
2648
|
function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
|
|
2279
2649
|
const current = billLifecycleStage(state);
|
|
2280
2650
|
const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
|
|
2281
|
-
return /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
/* @__PURE__ */
|
|
2651
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
|
|
2652
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2653
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2654
|
+
/* @__PURE__ */ jsx6("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
|
|
2655
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2286
2656
|
submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted",
|
|
2287
2657
|
typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""
|
|
2288
2658
|
] })
|
|
2289
2659
|
] }) }),
|
|
2290
|
-
/* @__PURE__ */
|
|
2660
|
+
/* @__PURE__ */ jsx6("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
|
|
2291
2661
|
const status = index < currentIndex ? "complete" : index === currentIndex ? "current" : "upcoming";
|
|
2292
|
-
return /* @__PURE__ */
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2662
|
+
return /* @__PURE__ */ jsxs6("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
|
|
2663
|
+
/* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
|
|
2664
|
+
/* @__PURE__ */ jsx6("b", { children: stage.label })
|
|
2295
2665
|
] }, stage.id);
|
|
2296
2666
|
}) })
|
|
2297
2667
|
] });
|
|
@@ -2305,45 +2675,45 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
|
|
|
2305
2675
|
["Charged", currency(bill.totalCharge)],
|
|
2306
2676
|
["Balance", currency(bill.balanceDue)]
|
|
2307
2677
|
];
|
|
2308
|
-
return /* @__PURE__ */
|
|
2309
|
-
/* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2678
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
|
|
2679
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2680
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2681
|
+
/* @__PURE__ */ jsx6("strong", { children: "Bill snapshot" }),
|
|
2682
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2313
2683
|
"Bill #",
|
|
2314
2684
|
bill.billNumber
|
|
2315
2685
|
] })
|
|
2316
2686
|
] }) }),
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2319
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ jsx6("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs6("div", { children: [
|
|
2688
|
+
/* @__PURE__ */ jsx6("dt", { children: label }),
|
|
2689
|
+
/* @__PURE__ */ jsx6("dd", { children: value })
|
|
2320
2690
|
] }, label)) })
|
|
2321
2691
|
] });
|
|
2322
2692
|
}
|
|
2323
2693
|
function BillRemittanceCard({ remittance, appearance, className, style }) {
|
|
2324
|
-
return /* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
2327
|
-
/* @__PURE__ */
|
|
2328
|
-
/* @__PURE__ */
|
|
2694
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
|
|
2695
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2696
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2697
|
+
/* @__PURE__ */ jsx6("strong", { children: "Remittance" }),
|
|
2698
|
+
/* @__PURE__ */ jsx6("span", { children: "Amounts reported by the payer and posted to the bill." })
|
|
2329
2699
|
] }) }),
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */
|
|
2700
|
+
/* @__PURE__ */ jsxs6("dl", { children: [
|
|
2701
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2702
|
+
/* @__PURE__ */ jsx6("dt", { children: "Payer reported" }),
|
|
2703
|
+
/* @__PURE__ */ jsx6("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
|
|
2334
2704
|
] }),
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2337
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2706
|
+
/* @__PURE__ */ jsx6("dt", { children: "Posted" }),
|
|
2707
|
+
/* @__PURE__ */ jsx6("dd", { children: currency(remittance.totalPaid) })
|
|
2338
2708
|
] }),
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2341
|
-
/* @__PURE__ */
|
|
2709
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2710
|
+
/* @__PURE__ */ jsx6("dt", { children: "Balance" }),
|
|
2711
|
+
/* @__PURE__ */ jsx6("dd", { children: currency(remittance.balanceDue) })
|
|
2342
2712
|
] })
|
|
2343
2713
|
] }),
|
|
2344
|
-
remittance.denialReason ? /* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2714
|
+
remittance.denialReason ? /* @__PURE__ */ jsxs6("div", { className: "mb-denial", children: [
|
|
2715
|
+
/* @__PURE__ */ jsx6("strong", { children: "Denial reason" }),
|
|
2716
|
+
/* @__PURE__ */ jsx6("p", { children: remittance.denialReason })
|
|
2347
2717
|
] }) : null
|
|
2348
2718
|
] });
|
|
2349
2719
|
}
|
|
@@ -2358,42 +2728,42 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
|
|
|
2358
2728
|
delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
|
|
2359
2729
|
].filter(Boolean);
|
|
2360
2730
|
if (!delivery.payerName && !contacts.length) return null;
|
|
2361
|
-
return /* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2365
|
-
/* @__PURE__ */
|
|
2731
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
|
|
2732
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2733
|
+
/* @__PURE__ */ jsx6("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs6("div", { children: [
|
|
2734
|
+
/* @__PURE__ */ jsx6("strong", { children: delivery.payerName || "Claims administrator" }),
|
|
2735
|
+
/* @__PURE__ */ jsx6("span", { children: "Billing and follow-up contacts." })
|
|
2366
2736
|
] }) }),
|
|
2367
|
-
!contacts.length ? /* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2737
|
+
!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: [
|
|
2738
|
+
/* @__PURE__ */ jsx6("dt", { children: label }),
|
|
2739
|
+
/* @__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 })
|
|
2370
2740
|
] }, label)) })
|
|
2371
2741
|
] });
|
|
2372
2742
|
}
|
|
2373
2743
|
function BillPaymentLedger({ payments, appearance, className, style }) {
|
|
2374
|
-
return /* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2744
|
+
return /* @__PURE__ */ jsxs6("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
|
|
2745
|
+
/* @__PURE__ */ jsx6("style", { children: lifecycleSurfaceStyles }),
|
|
2746
|
+
/* @__PURE__ */ jsxs6("header", { className: "mb-surface-heading", children: [
|
|
2747
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2748
|
+
/* @__PURE__ */ jsx6("strong", { children: "Payments" }),
|
|
2749
|
+
/* @__PURE__ */ jsx6("span", { children: "Payments posted to this bill." })
|
|
2380
2750
|
] }),
|
|
2381
|
-
/* @__PURE__ */
|
|
2751
|
+
/* @__PURE__ */ jsx6("span", { children: payments.length })
|
|
2382
2752
|
] }),
|
|
2383
|
-
!payments.length ? /* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2753
|
+
!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: [
|
|
2754
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2755
|
+
/* @__PURE__ */ jsx6("strong", { children: currency(payment.amount) }),
|
|
2756
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2387
2757
|
humanize(payment.status || "posted"),
|
|
2388
2758
|
" \xB7 ",
|
|
2389
2759
|
payment.method.toUpperCase()
|
|
2390
2760
|
] })
|
|
2391
2761
|
] }),
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
2394
|
-
/* @__PURE__ */
|
|
2762
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
2763
|
+
/* @__PURE__ */ jsx6("span", { children: payment.checkNumber ? `#${payment.checkNumber}` : payment.source.toUpperCase() }),
|
|
2764
|
+
/* @__PURE__ */ jsx6("span", { children: payment.depositDate || defaultFormatDate(payment.postedAt) })
|
|
2395
2765
|
] }),
|
|
2396
|
-
payment.note ? /* @__PURE__ */
|
|
2766
|
+
payment.note ? /* @__PURE__ */ jsx6("p", { children: payment.note }) : null
|
|
2397
2767
|
] }, payment.id)) })
|
|
2398
2768
|
] });
|
|
2399
2769
|
}
|
|
@@ -2422,9 +2792,9 @@ var lifecycleSurfaceStyles = `
|
|
|
2422
2792
|
import {
|
|
2423
2793
|
useCallback as useCallback3,
|
|
2424
2794
|
useEffect as useEffect4,
|
|
2425
|
-
useMemo as
|
|
2795
|
+
useMemo as useMemo5,
|
|
2426
2796
|
useRef as useRef4,
|
|
2427
|
-
useState as
|
|
2797
|
+
useState as useState5
|
|
2428
2798
|
} from "react";
|
|
2429
2799
|
import {
|
|
2430
2800
|
DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
|
|
@@ -2432,7 +2802,7 @@ import {
|
|
|
2432
2802
|
createBillLifecycleClient
|
|
2433
2803
|
} from "@mindbill/browser";
|
|
2434
2804
|
import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
|
|
2435
|
-
import { Fragment as
|
|
2805
|
+
import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2436
2806
|
var DEFAULT_REFRESH_INTERVAL2 = 6e4;
|
|
2437
2807
|
function downloadBlob(blob, filename, open = false) {
|
|
2438
2808
|
const url = URL.createObjectURL(blob);
|
|
@@ -2454,13 +2824,13 @@ function useBillLifecycle({
|
|
|
2454
2824
|
initialData = null,
|
|
2455
2825
|
fetch: fetchOverride
|
|
2456
2826
|
}) {
|
|
2457
|
-
const [data, setData] =
|
|
2458
|
-
const [error, setError] =
|
|
2459
|
-
const [isLoading, setIsLoading] =
|
|
2460
|
-
const [isRefreshing, setIsRefreshing] =
|
|
2461
|
-
const [isMutating, setIsMutating] =
|
|
2827
|
+
const [data, setData] = useState5(initialData);
|
|
2828
|
+
const [error, setError] = useState5(null);
|
|
2829
|
+
const [isLoading, setIsLoading] = useState5(enabled && !initialData);
|
|
2830
|
+
const [isRefreshing, setIsRefreshing] = useState5(false);
|
|
2831
|
+
const [isMutating, setIsMutating] = useState5(false);
|
|
2462
2832
|
const mounted = useRef4(true);
|
|
2463
|
-
const client =
|
|
2833
|
+
const client = useMemo5(() => createBillLifecycleClient({
|
|
2464
2834
|
billId: providedBillId,
|
|
2465
2835
|
sessionEndpoint,
|
|
2466
2836
|
getSession,
|
|
@@ -2564,8 +2934,8 @@ function LifecycleDialog({ children, title, onClose }) {
|
|
|
2564
2934
|
previous?.focus();
|
|
2565
2935
|
};
|
|
2566
2936
|
}, [onClose]);
|
|
2567
|
-
return /* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2937
|
+
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: [
|
|
2938
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
|
|
2569
2939
|
children
|
|
2570
2940
|
] }) });
|
|
2571
2941
|
}
|
|
@@ -2595,12 +2965,12 @@ function sandboxScenarios(state) {
|
|
|
2595
2965
|
function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
|
|
2596
2966
|
const lifecycle = useBillLifecycle(options);
|
|
2597
2967
|
const { data } = lifecycle;
|
|
2598
|
-
const [tab, setTab] =
|
|
2599
|
-
const [panel, setPanel] =
|
|
2600
|
-
const [notice, setNotice] =
|
|
2601
|
-
const [reason, setReason] =
|
|
2602
|
-
const [payment, setPayment] =
|
|
2603
|
-
const [review, setReview] =
|
|
2968
|
+
const [tab, setTab] = useState5("details");
|
|
2969
|
+
const [panel, setPanel] = useState5("");
|
|
2970
|
+
const [notice, setNotice] = useState5("");
|
|
2971
|
+
const [reason, setReason] = useState5("");
|
|
2972
|
+
const [payment, setPayment] = useState5({ amount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
|
|
2973
|
+
const [review, setReview] = useState5({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
|
|
2604
2974
|
const lastData = useRef4(null);
|
|
2605
2975
|
useEffect4(() => {
|
|
2606
2976
|
if (!data || data === lastData.current) return;
|
|
@@ -2613,13 +2983,13 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
|
|
|
2613
2983
|
attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
|
|
2614
2984
|
}));
|
|
2615
2985
|
}, [data, onChanged]);
|
|
2616
|
-
if (lifecycle.isLoading && !data) return /* @__PURE__ */
|
|
2986
|
+
if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
|
|
2617
2987
|
if (!data) {
|
|
2618
2988
|
const error = lifecycle.error ?? new Error("Bill could not be loaded.");
|
|
2619
|
-
return /* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
2621
|
-
/* @__PURE__ */
|
|
2622
|
-
/* @__PURE__ */
|
|
2989
|
+
return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-error", role: "alert", children: [
|
|
2990
|
+
/* @__PURE__ */ jsx7("strong", { children: "Billing is unavailable." }),
|
|
2991
|
+
/* @__PURE__ */ jsx7("span", { children: error.message }),
|
|
2992
|
+
/* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
|
|
2623
2993
|
] }) });
|
|
2624
2994
|
}
|
|
2625
2995
|
const complete = async (message, task) => {
|
|
@@ -2636,185 +3006,185 @@ function ConnectedBillLifecycle({ appearance, className, style, loadingFallback,
|
|
|
2636
3006
|
const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
|
|
2637
3007
|
const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
|
|
2638
3008
|
const simulations = data.environment === "sandbox" ? sandboxScenarios(data.lifecycle.state) : [];
|
|
2639
|
-
return /* @__PURE__ */
|
|
2640
|
-
/* @__PURE__ */
|
|
2641
|
-
/* @__PURE__ */
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
3009
|
+
return /* @__PURE__ */ jsxs7("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
|
|
3010
|
+
/* @__PURE__ */ jsx7("style", { children: CONNECTED_LIFECYCLE_STYLES }),
|
|
3011
|
+
/* @__PURE__ */ jsx7(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
|
|
3012
|
+
/* @__PURE__ */ jsxs7("header", { className: "mb-lifecycle-head", children: [
|
|
3013
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3014
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-title", children: [
|
|
3015
|
+
/* @__PURE__ */ jsxs7("h2", { children: [
|
|
2646
3016
|
"Bill #",
|
|
2647
3017
|
data.bill.billNumber
|
|
2648
3018
|
] }),
|
|
2649
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx7("span", { children: billLifecycleDisplayLabel(data.lifecycle.state, data.lifecycle.nativeStatus) })
|
|
2650
3020
|
] }),
|
|
2651
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsxs7("p", { children: [
|
|
2652
3022
|
"Claim ",
|
|
2653
3023
|
data.injury.claimNumber || "\u2014",
|
|
2654
3024
|
lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
|
|
2655
3025
|
] })
|
|
2656
3026
|
] }),
|
|
2657
|
-
/* @__PURE__ */
|
|
3027
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
|
|
2658
3028
|
] }),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
|
|
3030
|
+
/* @__PURE__ */ jsx7("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
|
|
3031
|
+
/* @__PURE__ */ jsxs7("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: [
|
|
2662
3032
|
"Bill history ",
|
|
2663
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__PURE__ */ jsx7("span", { children: data.activity.length })
|
|
2664
3034
|
] })
|
|
2665
3035
|
] }),
|
|
2666
|
-
data.environment === "sandbox" ? /* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
3036
|
+
data.environment === "sandbox" ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
|
|
3037
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3038
|
+
/* @__PURE__ */ jsx7("span", { children: "Sandbox demo controls" }),
|
|
3039
|
+
/* @__PURE__ */ jsx7("h3", { children: "Simulate the next payer response" }),
|
|
3040
|
+
/* @__PURE__ */ jsx7("p", { children: "This changes sandbox data only. QME Companion receives the result through the same lifecycle API and components partners use." })
|
|
2671
3041
|
] }),
|
|
2672
|
-
simulations.length ? /* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
/* @__PURE__ */
|
|
2675
|
-
] }, scenario.id)) }) : /* @__PURE__ */
|
|
3042
|
+
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: [
|
|
3043
|
+
/* @__PURE__ */ jsx7("strong", { children: scenario.label }),
|
|
3044
|
+
/* @__PURE__ */ jsx7("span", { children: scenario.detail })
|
|
3045
|
+
] }, 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." })
|
|
2676
3046
|
] }) : null,
|
|
2677
|
-
tab === "details" ? /* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2679
|
-
data.eors.length ? /* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
3047
|
+
tab === "details" ? /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
|
|
3048
|
+
/* @__PURE__ */ jsx7(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} }),
|
|
3049
|
+
data.eors.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-card", id: `mb-eors-${data.bill.id}`, children: [
|
|
3050
|
+
/* @__PURE__ */ jsxs7("header", { children: [
|
|
3051
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3052
|
+
/* @__PURE__ */ jsx7("h3", { children: "Explanation of Review" }),
|
|
3053
|
+
/* @__PURE__ */ jsx7("p", { children: "The payer response associated with this immutable submission." })
|
|
2684
3054
|
] }),
|
|
2685
|
-
/* @__PURE__ */
|
|
3055
|
+
/* @__PURE__ */ jsx7("span", { children: data.eors.length })
|
|
2686
3056
|
] }),
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
3057
|
+
/* @__PURE__ */ jsx7("ul", { className: "mb-lifecycle-documents", children: data.eors.map((eor) => /* @__PURE__ */ jsxs7("li", { children: [
|
|
3058
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3059
|
+
/* @__PURE__ */ jsx7("strong", { children: eor.filename }),
|
|
3060
|
+
/* @__PURE__ */ jsx7("span", { children: eor.description || `Received ${new Date(eor.addedAt).toLocaleDateString()}` })
|
|
2691
3061
|
] }),
|
|
2692
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View EOR" })
|
|
2693
3063
|
] }, eor.id)) })
|
|
2694
3064
|
] }) : null,
|
|
2695
|
-
viewEor || actions.length ? /* @__PURE__ */
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
3065
|
+
viewEor || actions.length ? /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-actions-sheet", children: [
|
|
3066
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3067
|
+
/* @__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" }),
|
|
3068
|
+
/* @__PURE__ */ jsx7("p", { children: "Actions are determined by the current bill status." })
|
|
2699
3069
|
] }),
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
viewEor ? /* @__PURE__ */
|
|
2702
|
-
actions.map((action) => /* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3071
|
+
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,
|
|
3072
|
+
actions.map((action) => /* @__PURE__ */ jsx7("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
|
|
2703
3073
|
const next = actionPanel(action);
|
|
2704
3074
|
if (next) setPanel(next);
|
|
2705
3075
|
}, children: action.label }, action.id))
|
|
2706
3076
|
] })
|
|
2707
3077
|
] }) : null
|
|
2708
|
-
] }) : /* @__PURE__ */
|
|
2709
|
-
panel === "resubmit" ? /* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
3078
|
+
] }) : /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx7(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
|
|
3079
|
+
panel === "resubmit" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3080
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3081
|
+
/* @__PURE__ */ jsx7("h3", { children: "Correct and resubmit" }),
|
|
3082
|
+
/* @__PURE__ */ jsx7("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
|
|
2713
3083
|
] }),
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3085
|
+
/* @__PURE__ */ jsx7("span", { children: "Correction note (optional)" }),
|
|
3086
|
+
/* @__PURE__ */ jsx7("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
|
|
2717
3087
|
] }),
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
3088
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3089
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3090
|
+
/* @__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" })
|
|
2721
3091
|
] })
|
|
2722
3092
|
] }) }) : null,
|
|
2723
|
-
panel === "second_review" ? /* @__PURE__ */
|
|
2724
|
-
/* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
3093
|
+
panel === "second_review" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3094
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3095
|
+
/* @__PURE__ */ jsx7("h3", { children: "Submit Second Review" }),
|
|
3096
|
+
/* @__PURE__ */ jsx7("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
|
|
2727
3097
|
] }),
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
3098
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
|
|
3099
|
+
/* @__PURE__ */ jsxs7("label", { className: "full", children: [
|
|
3100
|
+
/* @__PURE__ */ jsx7("span", { children: "Reason" }),
|
|
3101
|
+
/* @__PURE__ */ jsx7("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
|
|
2732
3102
|
] }),
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
/* @__PURE__ */
|
|
3103
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3104
|
+
/* @__PURE__ */ jsx7("span", { children: "Payer claim control number" }),
|
|
3105
|
+
/* @__PURE__ */ jsx7("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
|
|
2736
3106
|
] }),
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2739
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3108
|
+
/* @__PURE__ */ jsx7("span", { children: "Disputed amount" }),
|
|
3109
|
+
/* @__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 })) })
|
|
2740
3110
|
] }),
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3112
|
+
/* @__PURE__ */ jsx7("span", { children: "Send via" }),
|
|
3113
|
+
/* @__PURE__ */ jsxs7("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
|
|
3114
|
+
/* @__PURE__ */ jsx7("option", { value: "ebill", children: "E-bill" }),
|
|
3115
|
+
/* @__PURE__ */ jsx7("option", { value: "fax", children: "Fax" }),
|
|
3116
|
+
/* @__PURE__ */ jsx7("option", { value: "mail", children: "Mail" }),
|
|
3117
|
+
/* @__PURE__ */ jsx7("option", { value: "email", children: "Email" })
|
|
2748
3118
|
] })
|
|
2749
3119
|
] })
|
|
2750
3120
|
] }),
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2753
|
-
data.bill.attachments.map((attachment) => /* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
3121
|
+
/* @__PURE__ */ jsxs7("fieldset", { className: "mb-lifecycle-packet", children: [
|
|
3122
|
+
/* @__PURE__ */ jsx7("legend", { children: "Supporting packet" }),
|
|
3123
|
+
data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs7("label", { children: [
|
|
3124
|
+
/* @__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) })) }),
|
|
3125
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
3126
|
+
/* @__PURE__ */ jsx7("strong", { children: attachment.filename }),
|
|
3127
|
+
/* @__PURE__ */ jsx7("small", { children: attachment.description || attachment.documentType })
|
|
2758
3128
|
] }),
|
|
2759
|
-
/* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
|
|
2760
3130
|
] }, attachment.id))
|
|
2761
3131
|
] }),
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
/* @__PURE__ */
|
|
2764
|
-
/* @__PURE__ */
|
|
3132
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3133
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3134
|
+
/* @__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" })
|
|
2765
3135
|
] })
|
|
2766
3136
|
] }) }) : null,
|
|
2767
|
-
panel === "payment" ? /* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
/* @__PURE__ */
|
|
3137
|
+
panel === "payment" ? /* @__PURE__ */ jsx7(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs7("section", { className: "mb-lifecycle-panel", children: [
|
|
3138
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3139
|
+
/* @__PURE__ */ jsx7("h3", { children: "Post payment" }),
|
|
3140
|
+
/* @__PURE__ */ jsx7("p", { children: "Record funds shown on the payer response." })
|
|
2771
3141
|
] }),
|
|
2772
|
-
/* @__PURE__ */
|
|
2773
|
-
/* @__PURE__ */
|
|
2774
|
-
/* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
3142
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-fields two", children: [
|
|
3143
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3144
|
+
/* @__PURE__ */ jsx7("span", { children: "Amount" }),
|
|
3145
|
+
/* @__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) })) })
|
|
2776
3146
|
] }),
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3148
|
+
/* @__PURE__ */ jsx7("span", { children: "Method" }),
|
|
3149
|
+
/* @__PURE__ */ jsxs7("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
|
|
3150
|
+
/* @__PURE__ */ jsx7("option", { value: "check", children: "Check" }),
|
|
3151
|
+
/* @__PURE__ */ jsx7("option", { value: "eft", children: "EFT" })
|
|
2782
3152
|
] })
|
|
2783
3153
|
] }),
|
|
2784
|
-
/* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3155
|
+
/* @__PURE__ */ jsx7("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
|
|
3156
|
+
/* @__PURE__ */ jsx7("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
|
|
2787
3157
|
] }),
|
|
2788
|
-
/* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
3158
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3159
|
+
/* @__PURE__ */ jsx7("span", { children: "Deposit date" }),
|
|
3160
|
+
/* @__PURE__ */ jsx7("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
|
|
2791
3161
|
] }),
|
|
2792
|
-
/* @__PURE__ */
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
3162
|
+
/* @__PURE__ */ jsxs7("label", { className: "full", children: [
|
|
3163
|
+
/* @__PURE__ */ jsx7("span", { children: "Note (optional)" }),
|
|
3164
|
+
/* @__PURE__ */ jsx7("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
|
|
2795
3165
|
] })
|
|
2796
3166
|
] }),
|
|
2797
|
-
/* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
3167
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3168
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3169
|
+
/* @__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" })
|
|
2800
3170
|
] })
|
|
2801
3171
|
] }) }) : null,
|
|
2802
|
-
panel === "close" || panel === "reopen" ? /* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
3172
|
+
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: [
|
|
3173
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
3174
|
+
/* @__PURE__ */ jsx7("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
|
|
3175
|
+
/* @__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." })
|
|
2806
3176
|
] }),
|
|
2807
|
-
/* @__PURE__ */
|
|
2808
|
-
/* @__PURE__ */
|
|
2809
|
-
/* @__PURE__ */
|
|
3177
|
+
/* @__PURE__ */ jsxs7("label", { children: [
|
|
3178
|
+
/* @__PURE__ */ jsx7("span", { children: "Reason" }),
|
|
3179
|
+
/* @__PURE__ */ jsx7("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
|
|
2810
3180
|
] }),
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
3181
|
+
/* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
3182
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
3183
|
+
/* @__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" })
|
|
2814
3184
|
] })
|
|
2815
3185
|
] }) }) : null,
|
|
2816
|
-
notice ? /* @__PURE__ */
|
|
2817
|
-
lifecycle.error ? /* @__PURE__ */
|
|
3186
|
+
notice ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
|
|
3187
|
+
lifecycle.error ? /* @__PURE__ */ jsx7("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
|
|
2818
3188
|
] });
|
|
2819
3189
|
}
|
|
2820
3190
|
var CONNECTED_LIFECYCLE_STYLES = `
|
|
@@ -2868,8 +3238,10 @@ export {
|
|
|
2868
3238
|
BILL_SUBMISSION_DOCUMENT_TYPES,
|
|
2869
3239
|
BILL_SUBMISSION_REQUIRED_FIELDS,
|
|
2870
3240
|
BillActivityTimeline,
|
|
3241
|
+
BillAgingSummary,
|
|
2871
3242
|
BillLifecycleActions,
|
|
2872
3243
|
BillLifecycleProgress,
|
|
3244
|
+
BillList,
|
|
2873
3245
|
BillPayerContactCard,
|
|
2874
3246
|
BillPaymentLedger,
|
|
2875
3247
|
BillReadOnlyForm,
|
|
@@ -2877,7 +3249,16 @@ export {
|
|
|
2877
3249
|
BillReviewForm,
|
|
2878
3250
|
BillSnapshotSummary,
|
|
2879
3251
|
BillStatusSummary,
|
|
3252
|
+
BillSubmissionActions,
|
|
3253
|
+
BillSubmissionAttachmentsSection,
|
|
3254
|
+
BillSubmissionClaimSection,
|
|
2880
3255
|
BillSubmissionForm,
|
|
3256
|
+
BillSubmissionHeader,
|
|
3257
|
+
BillSubmissionPatientSection,
|
|
3258
|
+
BillSubmissionProvidersSection,
|
|
3259
|
+
BillSubmissionServiceLinesSection,
|
|
3260
|
+
BillingDashboard,
|
|
3261
|
+
BillingReport,
|
|
2881
3262
|
ConnectedBillLifecycle,
|
|
2882
3263
|
ConnectedBillStatus,
|
|
2883
3264
|
DEFAULT_BILL_SUBMISSION_MODIFIERS,
|
|
@@ -2886,9 +3267,13 @@ export {
|
|
|
2886
3267
|
MindBillBillTimeline,
|
|
2887
3268
|
applyBillSubmissionEvaluationModifiers,
|
|
2888
3269
|
billActivityEventLabel,
|
|
3270
|
+
billAgingBucket,
|
|
3271
|
+
billAgingDays,
|
|
2889
3272
|
billLifecycleDisplayLabel,
|
|
2890
3273
|
billLifecycleStage,
|
|
2891
3274
|
buildBillReviewSaveInput,
|
|
3275
|
+
buildBillingReportCsv,
|
|
3276
|
+
buildBillingReportRows,
|
|
2892
3277
|
calculateBillSubmissionAllowedAmount,
|
|
2893
3278
|
createBillLifecycleClient2 as createBillLifecycleClient,
|
|
2894
3279
|
createBillStatusClient,
|
|
@@ -2898,7 +3283,9 @@ export {
|
|
|
2898
3283
|
mindBillAppearanceStyle,
|
|
2899
3284
|
mindBillThemePresets,
|
|
2900
3285
|
parseBillSubmissionDate,
|
|
3286
|
+
prepareBillSubmissionDocuments,
|
|
2901
3287
|
resolveMindBillAppearance,
|
|
3288
|
+
summarizeBillingDashboard,
|
|
2902
3289
|
useBillLifecycle,
|
|
2903
3290
|
useBillStatus,
|
|
2904
3291
|
validateBillSubmission,
|