@mindbill/react 0.14.2 → 0.16.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 +45 -12
- package/dist/index.d.ts +43 -8
- package/dist/index.js +278 -135
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1043,9 +1043,11 @@ import {
|
|
|
1043
1043
|
useRef as useRef2,
|
|
1044
1044
|
useState as useState2
|
|
1045
1045
|
} from "react";
|
|
1046
|
+
import {
|
|
1047
|
+
DEFAULT_API_BASE_URL,
|
|
1048
|
+
DEFAULT_SESSION_ENDPOINT
|
|
1049
|
+
} from "@mindbill/browser";
|
|
1046
1050
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1047
|
-
var DEFAULT_API_BASE_URL = "https://app.mindbill.org";
|
|
1048
|
-
var DEFAULT_SESSION_ENDPOINT = "/api/mindbill/status-session";
|
|
1049
1051
|
var DEFAULT_REFRESH_INTERVAL = 6e4;
|
|
1050
1052
|
async function responseError(response, fallback) {
|
|
1051
1053
|
const body = await response.json().catch(() => null);
|
|
@@ -1113,11 +1115,11 @@ function createBillStatusClient({
|
|
|
1113
1115
|
const mintSession = async (signal, force = false) => {
|
|
1114
1116
|
if (!force && isSessionFresh(session)) return session;
|
|
1115
1117
|
if (!force && sessionRequest) return sessionRequest;
|
|
1116
|
-
const pending = getSession ? getSession({
|
|
1118
|
+
const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
|
|
1117
1119
|
method: "POST",
|
|
1118
1120
|
credentials: "same-origin",
|
|
1119
1121
|
headers: { "content-type": "application/json" },
|
|
1120
|
-
body: JSON.stringify({
|
|
1122
|
+
body: JSON.stringify({}),
|
|
1121
1123
|
signal
|
|
1122
1124
|
}).then(async (response) => {
|
|
1123
1125
|
if (!response.ok) {
|
|
@@ -1139,7 +1141,7 @@ function createBillStatusClient({
|
|
|
1139
1141
|
};
|
|
1140
1142
|
const requestStatus = async (browserSession, signal) => {
|
|
1141
1143
|
const baseUrl = (browserSession.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
|
|
1142
|
-
return fetcher(`${baseUrl}/partner/v2/browser/status`, {
|
|
1144
|
+
return fetcher(`${baseUrl}/partner/v2/browser/bills/${encodeURIComponent(billId)}/status`, {
|
|
1143
1145
|
headers: { authorization: `Bearer ${browserSession.token}` },
|
|
1144
1146
|
signal
|
|
1145
1147
|
});
|
|
@@ -1294,6 +1296,131 @@ function ConnectedBillStatus({
|
|
|
1294
1296
|
);
|
|
1295
1297
|
}
|
|
1296
1298
|
|
|
1299
|
+
// src/bill-lifecycle-surfaces.tsx
|
|
1300
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1301
|
+
function visibleBillLifecycleActions(actions, showUnavailable = false) {
|
|
1302
|
+
return actions.filter((action) => action.enabled || showUnavailable);
|
|
1303
|
+
}
|
|
1304
|
+
function BillLifecycleActions({
|
|
1305
|
+
actions,
|
|
1306
|
+
onAction,
|
|
1307
|
+
showUnavailable = false,
|
|
1308
|
+
disabled = false,
|
|
1309
|
+
appearance,
|
|
1310
|
+
className,
|
|
1311
|
+
style
|
|
1312
|
+
}) {
|
|
1313
|
+
const visible = visibleBillLifecycleActions(actions, showUnavailable);
|
|
1314
|
+
if (!visible.length) return null;
|
|
1315
|
+
return /* @__PURE__ */ jsxs3(
|
|
1316
|
+
"div",
|
|
1317
|
+
{
|
|
1318
|
+
className: ["mb-lifecycle-actions", className].filter(Boolean).join(" "),
|
|
1319
|
+
style: mindBillAppearanceStyle(appearance, style),
|
|
1320
|
+
"aria-label": "Bill actions",
|
|
1321
|
+
children: [
|
|
1322
|
+
/* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
|
|
1323
|
+
visible.map((action) => /* @__PURE__ */ jsxs3("div", { className: "mb-lifecycle-action", children: [
|
|
1324
|
+
/* @__PURE__ */ jsx3(
|
|
1325
|
+
"button",
|
|
1326
|
+
{
|
|
1327
|
+
type: "button",
|
|
1328
|
+
className: action.primary ? "mb-action-button is-primary" : "mb-action-button",
|
|
1329
|
+
disabled: disabled || !action.enabled,
|
|
1330
|
+
onClick: () => onAction(action),
|
|
1331
|
+
children: action.label
|
|
1332
|
+
}
|
|
1333
|
+
),
|
|
1334
|
+
!action.enabled && action.reason ? /* @__PURE__ */ jsx3("span", { className: "mb-action-reason", children: action.reason }) : null
|
|
1335
|
+
] }, action.id))
|
|
1336
|
+
]
|
|
1337
|
+
}
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
var activityLabels = {
|
|
1341
|
+
"bill.created": "Bill created",
|
|
1342
|
+
"bill.draft": "Bill saved",
|
|
1343
|
+
"bill.scrub_failed": "Submission needs attention",
|
|
1344
|
+
"bill.submitted": "Bill submitted",
|
|
1345
|
+
"bill.accepted": "Bill accepted",
|
|
1346
|
+
"bill.rejected": "Bill rejected",
|
|
1347
|
+
"bill.denied": "Bill denied",
|
|
1348
|
+
"bill.partially_paid": "Partial payment received",
|
|
1349
|
+
"bill.paid": "Bill paid",
|
|
1350
|
+
"bill.second_review": "Second Bill Review submitted",
|
|
1351
|
+
"bill.lien": "Bill moved to lien",
|
|
1352
|
+
"bill.ibr": "Independent Bill Review submitted",
|
|
1353
|
+
"bill.closed": "Bill closed",
|
|
1354
|
+
"bill.written_off": "Balance written off",
|
|
1355
|
+
"payment.posted": "Payment posted",
|
|
1356
|
+
"eor.received": "EOR received",
|
|
1357
|
+
"bill.autofill_completed": "Bill data extracted"
|
|
1358
|
+
};
|
|
1359
|
+
function billActivityEventLabel(type) {
|
|
1360
|
+
return activityLabels[type] ?? type.replace(/[._-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
1361
|
+
}
|
|
1362
|
+
function defaultFormatDate(createdAt) {
|
|
1363
|
+
const parsed = new Date(createdAt);
|
|
1364
|
+
if (Number.isNaN(parsed.getTime())) return createdAt;
|
|
1365
|
+
return new Intl.DateTimeFormat(void 0, {
|
|
1366
|
+
dateStyle: "medium",
|
|
1367
|
+
timeStyle: "short"
|
|
1368
|
+
}).format(parsed);
|
|
1369
|
+
}
|
|
1370
|
+
function BillActivityTimeline({
|
|
1371
|
+
events,
|
|
1372
|
+
emptyLabel = "No bill activity yet.",
|
|
1373
|
+
appearance,
|
|
1374
|
+
className,
|
|
1375
|
+
style,
|
|
1376
|
+
formatDate = defaultFormatDate
|
|
1377
|
+
}) {
|
|
1378
|
+
return /* @__PURE__ */ jsxs3(
|
|
1379
|
+
"section",
|
|
1380
|
+
{
|
|
1381
|
+
className: ["mb-activity", className].filter(Boolean).join(" "),
|
|
1382
|
+
style: mindBillAppearanceStyle(appearance, style),
|
|
1383
|
+
"aria-label": "Bill activity",
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
|
|
1386
|
+
!events.length ? /* @__PURE__ */ jsx3("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx3("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs3("li", { className: "mb-activity-item", children: [
|
|
1387
|
+
/* @__PURE__ */ jsx3("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
|
|
1388
|
+
/* @__PURE__ */ jsxs3("div", { className: "mb-activity-content", children: [
|
|
1389
|
+
/* @__PURE__ */ jsx3("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
|
|
1390
|
+
event.description ? /* @__PURE__ */ jsx3("p", { children: event.description }) : null,
|
|
1391
|
+
/* @__PURE__ */ jsxs3("span", { children: [
|
|
1392
|
+
formatDate(event.createdAt),
|
|
1393
|
+
event.actor ? ` \xB7 ${event.actor}` : ""
|
|
1394
|
+
] })
|
|
1395
|
+
] })
|
|
1396
|
+
] }, event.id)) })
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
var lifecycleSurfaceStyles = `
|
|
1402
|
+
.mb-lifecycle-actions,.mb-activity{box-sizing:border-box;color:var(--mb-text);font-family:var(--mb-font,ui-sans-serif,system-ui,sans-serif)}
|
|
1403
|
+
.mb-lifecycle-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-start}
|
|
1404
|
+
.mb-lifecycle-action{display:grid;gap:5px;max-width:260px}
|
|
1405
|
+
.mb-action-button{appearance:none;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-surface);color:var(--mb-text);font:inherit;font-weight:700;line-height:1.2;padding:11px 15px;cursor:pointer}
|
|
1406
|
+
.mb-action-button:hover:not(:disabled){border-color:var(--mb-accent);color:var(--mb-accent)}
|
|
1407
|
+
.mb-action-button:focus-visible{outline:3px solid color-mix(in srgb,var(--mb-accent) 28%,transparent);outline-offset:2px}
|
|
1408
|
+
.mb-action-button.is-primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}
|
|
1409
|
+
.mb-action-button:disabled{cursor:not-allowed;opacity:.55}
|
|
1410
|
+
.mb-action-reason{color:var(--mb-muted);font-size:12px;line-height:1.35}
|
|
1411
|
+
.mb-activity{background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius,12px);box-shadow:var(--mb-shadow);padding:20px}
|
|
1412
|
+
.mb-activity-list{list-style:none;margin:0;padding:0}
|
|
1413
|
+
.mb-activity-item{display:grid;grid-template-columns:18px minmax(0,1fr);gap:12px;position:relative;padding:0 0 22px}
|
|
1414
|
+
.mb-activity-item:last-child{padding-bottom:0}
|
|
1415
|
+
.mb-activity-item:not(:last-child)::before{background:var(--mb-border);content:"";left:8px;position:absolute;top:10px;bottom:0;width:1px}
|
|
1416
|
+
.mb-activity-marker{background:var(--mb-surface);border:3px solid var(--mb-accent);border-radius:999px;height:11px;margin-top:4px;position:relative;width:11px;z-index:1}
|
|
1417
|
+
.mb-activity-content{display:grid;gap:4px;min-width:0}
|
|
1418
|
+
.mb-activity-content strong{font-size:15px;line-height:1.35}
|
|
1419
|
+
.mb-activity-content p{color:var(--mb-text);font-size:14px;line-height:1.5;margin:0}
|
|
1420
|
+
.mb-activity-content span,.mb-activity-empty{color:var(--mb-muted);font-size:13px;line-height:1.45}
|
|
1421
|
+
.mb-activity-empty{margin:0}
|
|
1422
|
+
`;
|
|
1423
|
+
|
|
1297
1424
|
// src/connected-bill-lifecycle.tsx
|
|
1298
1425
|
import {
|
|
1299
1426
|
useCallback as useCallback2,
|
|
@@ -1308,7 +1435,7 @@ import {
|
|
|
1308
1435
|
createBillLifecycleClient
|
|
1309
1436
|
} from "@mindbill/browser";
|
|
1310
1437
|
import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
|
|
1311
|
-
import { Fragment as Fragment3, jsx as
|
|
1438
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1312
1439
|
var DEFAULT_REFRESH_INTERVAL2 = 6e4;
|
|
1313
1440
|
function openPdf(blob, filename) {
|
|
1314
1441
|
const url = URL.createObjectURL(blob);
|
|
@@ -1322,16 +1449,18 @@ function openPdf(blob, filename) {
|
|
|
1322
1449
|
}
|
|
1323
1450
|
function useBillLifecycle({
|
|
1324
1451
|
billId: providedBillId,
|
|
1452
|
+
create,
|
|
1325
1453
|
sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
|
|
1326
1454
|
getSession,
|
|
1327
1455
|
apiBaseUrl = DEFAULT_API_BASE_URL2,
|
|
1328
1456
|
refreshInterval = DEFAULT_REFRESH_INTERVAL2,
|
|
1329
1457
|
enabled = true,
|
|
1330
1458
|
initialData = null,
|
|
1459
|
+
onBillCreated,
|
|
1331
1460
|
onBillIdChange,
|
|
1332
1461
|
fetch: fetchOverride
|
|
1333
1462
|
}) {
|
|
1334
|
-
const [billId, setBillId] = useState3(providedBillId);
|
|
1463
|
+
const [billId, setBillId] = useState3(providedBillId ?? null);
|
|
1335
1464
|
const [data, setData] = useState3(initialData);
|
|
1336
1465
|
const [error, setError] = useState3(null);
|
|
1337
1466
|
const [isLoading, setIsLoading] = useState3(enabled && !initialData);
|
|
@@ -1339,17 +1468,17 @@ function useBillLifecycle({
|
|
|
1339
1468
|
const [isMutating, setIsMutating] = useState3(false);
|
|
1340
1469
|
const mounted = useRef3(true);
|
|
1341
1470
|
useEffect3(() => {
|
|
1342
|
-
setBillId(providedBillId);
|
|
1471
|
+
setBillId(providedBillId ?? null);
|
|
1343
1472
|
setData(initialData);
|
|
1344
1473
|
setError(null);
|
|
1345
1474
|
}, [initialData, providedBillId]);
|
|
1346
1475
|
const client = useMemo3(() => createBillLifecycleClient({
|
|
1347
|
-
billId,
|
|
1476
|
+
...providedBillId ? { billId: providedBillId } : {},
|
|
1348
1477
|
sessionEndpoint,
|
|
1349
1478
|
getSession,
|
|
1350
1479
|
apiBaseUrl,
|
|
1351
1480
|
fetch: fetchOverride
|
|
1352
|
-
}), [apiBaseUrl,
|
|
1481
|
+
}), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
|
|
1353
1482
|
useEffect3(() => {
|
|
1354
1483
|
mounted.current = true;
|
|
1355
1484
|
return () => {
|
|
@@ -1361,7 +1490,17 @@ function useBillLifecycle({
|
|
|
1361
1490
|
if (!enabled) return;
|
|
1362
1491
|
setIsRefreshing(true);
|
|
1363
1492
|
try {
|
|
1364
|
-
|
|
1493
|
+
let next;
|
|
1494
|
+
if (!client.getBillId()) {
|
|
1495
|
+
if (!create) throw new Error("Pass billId to open a bill or create to start a new one.");
|
|
1496
|
+
const created = await client.createBill(create);
|
|
1497
|
+
await onBillCreated?.(created.billId, created.data);
|
|
1498
|
+
await onBillIdChange?.(created.billId, null);
|
|
1499
|
+
if (mounted.current) setBillId(created.billId);
|
|
1500
|
+
next = created.data;
|
|
1501
|
+
} else {
|
|
1502
|
+
next = await client.getLifecycle();
|
|
1503
|
+
}
|
|
1365
1504
|
if (!mounted.current) return;
|
|
1366
1505
|
setData(next);
|
|
1367
1506
|
setError(null);
|
|
@@ -1374,7 +1513,7 @@ function useBillLifecycle({
|
|
|
1374
1513
|
setIsRefreshing(false);
|
|
1375
1514
|
}
|
|
1376
1515
|
}
|
|
1377
|
-
}, [client, enabled]);
|
|
1516
|
+
}, [client, create, enabled, onBillCreated, onBillIdChange]);
|
|
1378
1517
|
useEffect3(() => {
|
|
1379
1518
|
if (!enabled) return;
|
|
1380
1519
|
void refresh();
|
|
@@ -1495,18 +1634,18 @@ function SupportingDocumentControl({
|
|
|
1495
1634
|
const [file, setFile] = useState3(null);
|
|
1496
1635
|
const [type, setType] = useState3("appeal");
|
|
1497
1636
|
const [busy, setBusy] = useState3(false);
|
|
1498
|
-
return /* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1637
|
+
return /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-upload", children: [
|
|
1638
|
+
/* @__PURE__ */ jsxs4("select", { "aria-label": "Supporting document type", value: type, disabled: disabled || busy, onChange: (event) => setType(event.target.value), children: [
|
|
1639
|
+
/* @__PURE__ */ jsx4("option", { value: "appeal", children: "Second Review support" }),
|
|
1640
|
+
/* @__PURE__ */ jsx4("option", { value: "final_report", children: "Final report" }),
|
|
1641
|
+
/* @__PURE__ */ jsx4("option", { value: "proof_of_service", children: "Proof of service" }),
|
|
1642
|
+
/* @__PURE__ */ jsx4("option", { value: "letter_of_attestation", children: "Letter of attestation" }),
|
|
1643
|
+
/* @__PURE__ */ jsx4("option", { value: "form_122", children: "DWC Form 122" }),
|
|
1644
|
+
/* @__PURE__ */ jsx4("option", { value: "w9", children: "W-9" }),
|
|
1645
|
+
/* @__PURE__ */ jsx4("option", { value: "other", children: "Other supporting document" })
|
|
1507
1646
|
] }),
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ jsx4("input", { "aria-label": "Choose supporting PDF", type: "file", accept: "application/pdf,.pdf", disabled: disabled || busy, onChange: (event) => setFile(event.target.files?.[0] ?? null) }),
|
|
1648
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: disabled || busy || !file, onClick: () => {
|
|
1510
1649
|
if (!file) return;
|
|
1511
1650
|
setBusy(true);
|
|
1512
1651
|
void onAdd(file, type).then(() => setFile(null)).catch(() => void 0).finally(() => setBusy(false));
|
|
@@ -1558,14 +1697,14 @@ function ConnectedBillLifecycle({
|
|
|
1558
1697
|
}));
|
|
1559
1698
|
}, [data, onChanged]);
|
|
1560
1699
|
if (lifecycle.isLoading && !data) {
|
|
1561
|
-
return /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: loadingFallback ?? /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-loading", children: "Loading billing\u2026" }) });
|
|
1562
1701
|
}
|
|
1563
1702
|
if (!data) {
|
|
1564
1703
|
const error = lifecycle.error ?? new Error("Bill could not be loaded.");
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx4(Fragment3, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-error", role: "alert", children: [
|
|
1705
|
+
/* @__PURE__ */ jsx4("strong", { children: "Billing is unavailable." }),
|
|
1706
|
+
/* @__PURE__ */ jsx4("span", { children: error.message }),
|
|
1707
|
+
/* @__PURE__ */ jsx4("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
|
|
1569
1708
|
] }) });
|
|
1570
1709
|
}
|
|
1571
1710
|
const actionMap = new Map(data.lifecycle.actions.map((action) => [action.id, action]));
|
|
@@ -1595,10 +1734,10 @@ function ConnectedBillLifecycle({
|
|
|
1595
1734
|
disabled: !action.enabled || lifecycle.isMutating
|
|
1596
1735
|
}));
|
|
1597
1736
|
const canEditAndSubmit = Boolean(has("edit_and_submit"));
|
|
1598
|
-
return /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
canEditAndSubmit ? /* @__PURE__ */
|
|
1737
|
+
return /* @__PURE__ */ jsxs4("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
|
|
1738
|
+
/* @__PURE__ */ jsx4("style", { children: CONNECTED_LIFECYCLE_STYLES }),
|
|
1739
|
+
/* @__PURE__ */ jsx4("style", { children: CONNECTED_THEME_OVERRIDE_STYLES }),
|
|
1740
|
+
canEditAndSubmit ? /* @__PURE__ */ jsx4(
|
|
1602
1741
|
BillReviewForm,
|
|
1603
1742
|
{
|
|
1604
1743
|
data,
|
|
@@ -1619,7 +1758,7 @@ function ConnectedBillLifecycle({
|
|
|
1619
1758
|
},
|
|
1620
1759
|
onOpenAttachment: (attachment) => void lifecycle.openAttachment(attachment).catch(() => void 0)
|
|
1621
1760
|
}
|
|
1622
|
-
) : /* @__PURE__ */
|
|
1761
|
+
) : /* @__PURE__ */ jsx4(
|
|
1623
1762
|
BillStatusSummary,
|
|
1624
1763
|
{
|
|
1625
1764
|
status: data.lifecycle.state,
|
|
@@ -1633,96 +1772,96 @@ function ConnectedBillLifecycle({
|
|
|
1633
1772
|
...appearance ? { appearance } : {}
|
|
1634
1773
|
}
|
|
1635
1774
|
),
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1775
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-toolbar", children: [
|
|
1776
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1777
|
+
/* @__PURE__ */ jsxs4("strong", { children: [
|
|
1639
1778
|
"Bill #",
|
|
1640
1779
|
data.bill.billNumber
|
|
1641
1780
|
] }),
|
|
1642
|
-
/* @__PURE__ */
|
|
1781
|
+
/* @__PURE__ */ jsx4("span", { children: lifecycle.isRefreshing ? "Refreshing\u2026" : "Status and actions update automatically." })
|
|
1643
1782
|
] }),
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
has("view_eor") ? /* @__PURE__ */
|
|
1646
|
-
canEditAndSubmit && has("close") ? /* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-toolbar-actions", children: [
|
|
1784
|
+
has("view_eor") ? /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => document.getElementById(`mb-eors-${data.bill.id}`)?.scrollIntoView({ behavior: "smooth", block: "center" }), children: "View EOR" }) : null,
|
|
1785
|
+
canEditAndSubmit && has("close") ? /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button quiet", onClick: () => selectPanel("close"), children: "Close bill" }) : null
|
|
1647
1786
|
] })
|
|
1648
1787
|
] }),
|
|
1649
|
-
data.eors.length ? /* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1651
|
-
/* @__PURE__ */
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1788
|
+
data.eors.length ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-card", id: `mb-eors-${data.bill.id}`, children: [
|
|
1789
|
+
/* @__PURE__ */ jsxs4("header", { children: [
|
|
1790
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1791
|
+
/* @__PURE__ */ jsx4("h3", { children: "Explanation of Review" }),
|
|
1792
|
+
/* @__PURE__ */ jsx4("p", { children: "Review the payer response and original PDF before posting payment." })
|
|
1654
1793
|
] }),
|
|
1655
|
-
/* @__PURE__ */
|
|
1794
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1656
1795
|
data.eors.length,
|
|
1657
1796
|
" PDF",
|
|
1658
1797
|
data.eors.length === 1 ? "" : "s"
|
|
1659
1798
|
] })
|
|
1660
1799
|
] }),
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
1800
|
+
/* @__PURE__ */ jsx4("ul", { className: "mb-lifecycle-documents", children: data.eors.map((eor) => /* @__PURE__ */ jsxs4("li", { children: [
|
|
1801
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1802
|
+
/* @__PURE__ */ jsx4("strong", { children: eor.filename }),
|
|
1803
|
+
/* @__PURE__ */ jsx4("span", { children: eor.description || `Added ${new Date(eor.addedAt).toLocaleDateString()}` })
|
|
1665
1804
|
] }),
|
|
1666
|
-
/* @__PURE__ */
|
|
1805
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View PDF" })
|
|
1667
1806
|
] }, eor.id)) })
|
|
1668
1807
|
] }) : null,
|
|
1669
|
-
has("independent_bill_review") ? /* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1808
|
+
has("independent_bill_review") ? /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-info", children: [
|
|
1809
|
+
/* @__PURE__ */ jsx4("strong", { children: has("independent_bill_review")?.label }),
|
|
1810
|
+
/* @__PURE__ */ jsx4("span", { children: has("independent_bill_review")?.reason })
|
|
1672
1811
|
] }) : null,
|
|
1673
|
-
panel === "correction" ? /* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1812
|
+
panel === "correction" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
|
|
1813
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1814
|
+
/* @__PURE__ */ jsx4("h3", { children: "Correct and resubmit" }),
|
|
1815
|
+
/* @__PURE__ */ jsx4("p", { children: "A new correction draft will preserve this rejected bill in history. Review the copied values before submitting." })
|
|
1677
1816
|
] }),
|
|
1678
|
-
/* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1680
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
1818
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
1819
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Correction draft created.", lifecycle.startCorrection), children: lifecycle.isMutating ? "Creating\u2026" : "Create correction draft" })
|
|
1681
1820
|
] })
|
|
1682
1821
|
] }) : null,
|
|
1683
|
-
panel === "second_review" ? /* @__PURE__ */
|
|
1684
|
-
/* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1822
|
+
panel === "second_review" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel wide", children: [
|
|
1823
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1824
|
+
/* @__PURE__ */ jsx4("h3", { children: "Submit Second Review" }),
|
|
1825
|
+
/* @__PURE__ */ jsx4("p", { children: "State why payment is disputed, confirm the payer control number, and choose the supporting documents to send." })
|
|
1687
1826
|
] }),
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
/* @__PURE__ */
|
|
1827
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-fields two", children: [
|
|
1828
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1829
|
+
/* @__PURE__ */ jsx4("span", { children: "Reason for Second Review" }),
|
|
1830
|
+
/* @__PURE__ */ jsx4("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
|
|
1692
1831
|
] }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1832
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-fields", children: [
|
|
1833
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1834
|
+
/* @__PURE__ */ jsx4("span", { children: "Payer claim control number" }),
|
|
1835
|
+
/* @__PURE__ */ jsx4("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
|
|
1697
1836
|
] }),
|
|
1698
|
-
/* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1838
|
+
/* @__PURE__ */ jsx4("span", { children: "Disputed amount" }),
|
|
1839
|
+
/* @__PURE__ */ jsx4("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 })) })
|
|
1701
1840
|
] }),
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
/* @__PURE__ */
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
/* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1841
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1842
|
+
/* @__PURE__ */ jsx4("span", { children: "Send via" }),
|
|
1843
|
+
/* @__PURE__ */ jsxs4("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
|
|
1844
|
+
/* @__PURE__ */ jsx4("option", { value: "ebill", children: "E-bill" }),
|
|
1845
|
+
/* @__PURE__ */ jsx4("option", { value: "fax", children: "Fax" }),
|
|
1846
|
+
/* @__PURE__ */ jsx4("option", { value: "mail", children: "Mail" }),
|
|
1847
|
+
/* @__PURE__ */ jsx4("option", { value: "email", children: "Email" })
|
|
1709
1848
|
] })
|
|
1710
1849
|
] })
|
|
1711
1850
|
] })
|
|
1712
1851
|
] }),
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
data.bill.attachments.map((attachment) => /* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1852
|
+
/* @__PURE__ */ jsxs4("fieldset", { className: "mb-lifecycle-packet", children: [
|
|
1853
|
+
/* @__PURE__ */ jsx4("legend", { children: "Supporting packet" }),
|
|
1854
|
+
data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs4("label", { children: [
|
|
1855
|
+
/* @__PURE__ */ jsx4("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) })) }),
|
|
1856
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1857
|
+
/* @__PURE__ */ jsx4("strong", { children: attachment.filename }),
|
|
1858
|
+
/* @__PURE__ */ jsx4("small", { children: attachment.description || attachment.documentType })
|
|
1720
1859
|
] }),
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1860
|
+
/* @__PURE__ */ jsx4("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" }),
|
|
1861
|
+
/* @__PURE__ */ jsx4("button", { type: "button", "aria-label": `Remove ${attachment.filename}`, onClick: () => void lifecycle.removeAttachment(attachment.id).catch(() => void 0), children: "\xD7" })
|
|
1723
1862
|
] }, attachment.id))
|
|
1724
1863
|
] }),
|
|
1725
|
-
/* @__PURE__ */
|
|
1864
|
+
/* @__PURE__ */ jsx4(SupportingDocumentControl, { disabled: lifecycle.isMutating, onAdd: async (file, type, description) => {
|
|
1726
1865
|
const next = await lifecycle.addAttachment(file, type, description);
|
|
1727
1866
|
setReview((current) => ({
|
|
1728
1867
|
...current,
|
|
@@ -1732,65 +1871,65 @@ function ConnectedBillLifecycle({
|
|
|
1732
1871
|
]))
|
|
1733
1872
|
}));
|
|
1734
1873
|
} }),
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1737
|
-
/* @__PURE__ */
|
|
1874
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
1875
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
1876
|
+
/* @__PURE__ */ jsx4("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" })
|
|
1738
1877
|
] })
|
|
1739
1878
|
] }) : null,
|
|
1740
|
-
panel === "payment" ? /* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1879
|
+
panel === "payment" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
|
|
1880
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1881
|
+
/* @__PURE__ */ jsx4("h3", { children: "Post payment" }),
|
|
1882
|
+
/* @__PURE__ */ jsx4("p", { children: "Record funds shown on the EOR. The balance updates and the bill closes automatically when configured." })
|
|
1744
1883
|
] }),
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1884
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-fields two", children: [
|
|
1885
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1886
|
+
/* @__PURE__ */ jsx4("span", { children: "Amount" }),
|
|
1887
|
+
/* @__PURE__ */ jsx4("input", { type: "number", min: "0.01", max: data.bill.balanceDue, step: "0.01", required: true, value: payment.amount || "", onChange: (event) => setPayment((current) => ({ ...current, amount: Number(event.target.value) })) })
|
|
1749
1888
|
] }),
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
/* @__PURE__ */
|
|
1754
|
-
/* @__PURE__ */
|
|
1889
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1890
|
+
/* @__PURE__ */ jsx4("span", { children: "Method" }),
|
|
1891
|
+
/* @__PURE__ */ jsxs4("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
|
|
1892
|
+
/* @__PURE__ */ jsx4("option", { value: "check", children: "Check" }),
|
|
1893
|
+
/* @__PURE__ */ jsx4("option", { value: "eft", children: "EFT" })
|
|
1755
1894
|
] })
|
|
1756
1895
|
] }),
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1897
|
+
/* @__PURE__ */ jsx4("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
|
|
1898
|
+
/* @__PURE__ */ jsx4("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
|
|
1760
1899
|
] }),
|
|
1761
|
-
/* @__PURE__ */
|
|
1762
|
-
/* @__PURE__ */
|
|
1763
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1901
|
+
/* @__PURE__ */ jsx4("span", { children: "Deposit date" }),
|
|
1902
|
+
/* @__PURE__ */ jsx4("input", { type: "date", required: true, value: payment.depositDate, onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
|
|
1764
1903
|
] }),
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ jsxs4("label", { className: "full", children: [
|
|
1905
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1767
1906
|
"Note ",
|
|
1768
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ jsx4("small", { children: "Optional" })
|
|
1769
1908
|
] }),
|
|
1770
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ jsx4("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
|
|
1771
1910
|
] })
|
|
1772
1911
|
] }),
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */
|
|
1912
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
1913
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
1914
|
+
/* @__PURE__ */ jsx4("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" })
|
|
1776
1915
|
] })
|
|
1777
1916
|
] }) : null,
|
|
1778
|
-
panel === "close" ? /* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1917
|
+
panel === "close" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel danger", children: [
|
|
1918
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
1919
|
+
/* @__PURE__ */ jsx4("h3", { children: "Close bill" }),
|
|
1920
|
+
/* @__PURE__ */ jsx4("p", { children: "Closing removes this bill from active A/R. Any remaining balance will be written off and the original lifecycle is preserved." })
|
|
1782
1921
|
] }),
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
-
/* @__PURE__ */
|
|
1785
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1923
|
+
/* @__PURE__ */ jsx4("span", { children: "Reason for closing" }),
|
|
1924
|
+
/* @__PURE__ */ jsx4("textarea", { required: true, value: closeReason, onChange: (event) => setCloseReason(event.target.value) })
|
|
1786
1925
|
] }),
|
|
1787
|
-
/* @__PURE__ */
|
|
1788
|
-
/* @__PURE__ */
|
|
1789
|
-
/* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
|
|
1927
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
|
|
1928
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button danger", disabled: lifecycle.isMutating || !closeReason.trim(), onClick: () => void complete("Bill closed.", () => lifecycle.closeBill({ reason: closeReason })), children: lifecycle.isMutating ? "Closing\u2026" : "Close bill" })
|
|
1790
1929
|
] })
|
|
1791
1930
|
] }) : null,
|
|
1792
|
-
notice ? /* @__PURE__ */
|
|
1793
|
-
lifecycle.error ? /* @__PURE__ */
|
|
1931
|
+
notice ? /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
|
|
1932
|
+
lifecycle.error ? /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
|
|
1794
1933
|
] });
|
|
1795
1934
|
}
|
|
1796
1935
|
var CONNECTED_LIFECYCLE_STYLES = `
|
|
@@ -1854,12 +1993,15 @@ function MindBillBillReview(props) {
|
|
|
1854
1993
|
return widget("mindbill-bill-review", props);
|
|
1855
1994
|
}
|
|
1856
1995
|
export {
|
|
1996
|
+
BillActivityTimeline,
|
|
1997
|
+
BillLifecycleActions,
|
|
1857
1998
|
BillReviewForm,
|
|
1858
1999
|
BillStatusSummary,
|
|
1859
2000
|
ConnectedBillLifecycle,
|
|
1860
2001
|
ConnectedBillStatus,
|
|
1861
2002
|
MindBillBillReview,
|
|
1862
2003
|
MindBillBillTimeline,
|
|
2004
|
+
billActivityEventLabel,
|
|
1863
2005
|
buildBillReviewSaveInput,
|
|
1864
2006
|
createBillLifecycleClient2 as createBillLifecycleClient,
|
|
1865
2007
|
createBillStatusClient,
|
|
@@ -1868,6 +2010,7 @@ export {
|
|
|
1868
2010
|
mindBillThemePresets,
|
|
1869
2011
|
resolveMindBillAppearance,
|
|
1870
2012
|
useBillLifecycle,
|
|
1871
|
-
useBillStatus
|
|
2013
|
+
useBillStatus,
|
|
2014
|
+
visibleBillLifecycleActions
|
|
1872
2015
|
};
|
|
1873
2016
|
//# sourceMappingURL=index.js.map
|