@mindbill/react 0.16.0 → 0.17.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/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { MindBillAppearance, MindBillEventDetail, MindBillErrorDetail } from '@mindbill/embed';
2
2
  export { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from '@mindbill/embed';
3
3
  import { CSSProperties, ReactElement, ReactNode } from 'react';
4
- import { BillLifecycleAction, BillLifecycleClientOptions, BrowserBillCreateInput, BillLifecycleData, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
- export { BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BrowserBillAddress, BrowserBillCreateInput, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
4
+ import { BillLifecycleAction, BillLifecycleDelivery, BillPaymentRecord, BillRemittanceSummary, BillLifecycleData, BillLifecycleClientOptions, BrowserBillCreateInput, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
+ export { BillActivityRecord, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRemittanceSummary, BrowserBillAddress, BrowserBillCreateInput, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
6
6
 
7
7
  type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue";
8
8
  type MindBillReactAppearance = MindBillAppearance & {
@@ -406,15 +406,17 @@ type ConnectedBillStatusProps = UseBillStatusOptions & {
406
406
  };
407
407
  declare function ConnectedBillStatus({ actions, appearance, className, style, loadingFallback, errorFallback, ...options }: ConnectedBillStatusProps): ReactElement | null;
408
408
 
409
- type BillLifecycleActionsProps = {
409
+ type SurfaceProps = {
410
+ appearance?: MindBillReactAppearance;
411
+ className?: string;
412
+ style?: CSSProperties;
413
+ };
414
+ type BillLifecycleActionsProps = SurfaceProps & {
410
415
  actions: readonly BillLifecycleAction[];
411
416
  onAction: (action: BillLifecycleAction) => void;
412
417
  /** Show disabled actions and the server-provided reason. Defaults to false. */
413
418
  showUnavailable?: boolean;
414
419
  disabled?: boolean;
415
- appearance?: MindBillReactAppearance;
416
- className?: string;
417
- style?: CSSProperties;
418
420
  };
419
421
  /** Returns the server-authoritative actions that should be rendered. */
420
422
  declare function visibleBillLifecycleActions(actions: readonly BillLifecycleAction[], showUnavailable?: boolean): BillLifecycleAction[];
@@ -425,19 +427,40 @@ type BillActivityEvent = {
425
427
  createdAt: string;
426
428
  title?: string;
427
429
  description?: string;
428
- actor?: string;
430
+ actor?: string | null;
429
431
  };
430
- type BillActivityTimelineProps = {
432
+ type BillActivityTimelineProps = SurfaceProps & {
431
433
  events: readonly BillActivityEvent[];
432
434
  emptyLabel?: string;
433
- appearance?: MindBillReactAppearance;
434
- className?: string;
435
- style?: CSSProperties;
436
435
  formatDate?: (createdAt: string) => string;
437
436
  };
438
437
  /** Human-readable fallback for a signed partner event type. */
439
438
  declare function billActivityEventLabel(type: string): string;
440
- declare function BillActivityTimeline({ events, emptyLabel, appearance, className, style, formatDate, }: BillActivityTimelineProps): ReactElement;
439
+ declare function BillActivityTimeline({ events, emptyLabel, appearance, className, style, formatDate }: BillActivityTimelineProps): ReactElement;
440
+ type BillLifecycleStage = "created" | "submitted" | "accepted" | "response" | "follow_up" | "closed";
441
+ /** Maps MindBill's detailed lifecycle state into a compact progress stage. */
442
+ declare function billLifecycleStage(state: string): BillLifecycleStage;
443
+ type BillLifecycleProgressProps = SurfaceProps & {
444
+ state: string;
445
+ nativeStatus?: string;
446
+ submittedAt?: string | null;
447
+ agingDays?: number | null;
448
+ };
449
+ declare function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }: BillLifecycleProgressProps): ReactElement;
450
+ type BillSnapshotSummaryProps = SurfaceProps & Pick<BillLifecycleData, "bill" | "patient" | "injury" | "delivery">;
451
+ declare function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, className, style }: BillSnapshotSummaryProps): ReactElement;
452
+ type BillRemittanceCardProps = SurfaceProps & {
453
+ remittance: BillRemittanceSummary;
454
+ };
455
+ declare function BillRemittanceCard({ remittance, appearance, className, style }: BillRemittanceCardProps): ReactElement;
456
+ type BillPayerContactCardProps = SurfaceProps & {
457
+ delivery: BillLifecycleDelivery;
458
+ };
459
+ declare function BillPayerContactCard({ delivery, appearance, className, style }: BillPayerContactCardProps): ReactElement | null;
460
+ type BillPaymentLedgerProps = SurfaceProps & {
461
+ payments: readonly BillPaymentRecord[];
462
+ };
463
+ declare function BillPaymentLedger({ payments, appearance, className, style }: BillPaymentLedgerProps): ReactElement;
441
464
 
442
465
  type UseBillLifecycleOptions = BillLifecycleClientOptions & {
443
466
  /** Initial bill snapshot used when no existing `billId` is supplied. */
@@ -493,4 +516,4 @@ type MindBillWidgetProps = {
493
516
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
494
517
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
495
518
 
496
- export { type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, BillLifecycleActions, type BillLifecycleActionsProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionRoute, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, billActivityEventLabel, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingProcedureLine, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus, visibleBillLifecycleActions };
519
+ export { type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillRemittanceCard, type BillRemittanceCardProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionRoute, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, billActivityEventLabel, billLifecycleStage, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingProcedureLine, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus, visibleBillLifecycleActions };
package/dist/index.js CHANGED
@@ -1312,30 +1312,13 @@ function BillLifecycleActions({
1312
1312
  }) {
1313
1313
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
1314
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
- );
1315
+ return /* @__PURE__ */ jsxs3("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
1316
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1317
+ visible.map((action) => /* @__PURE__ */ jsxs3("div", { className: "mb-lifecycle-action", children: [
1318
+ /* @__PURE__ */ jsx3("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
1319
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx3("span", { className: "mb-action-reason", children: action.reason }) : null
1320
+ ] }, action.id))
1321
+ ] });
1339
1322
  }
1340
1323
  var activityLabels = {
1341
1324
  "bill.created": "Bill created",
@@ -1362,63 +1345,189 @@ function billActivityEventLabel(type) {
1362
1345
  function defaultFormatDate(createdAt) {
1363
1346
  const parsed = new Date(createdAt);
1364
1347
  if (Number.isNaN(parsed.getTime())) return createdAt;
1365
- return new Intl.DateTimeFormat(void 0, {
1366
- dateStyle: "medium",
1367
- timeStyle: "short"
1368
- }).format(parsed);
1348
+ return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
1369
1349
  }
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
- );
1350
+ function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
1351
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
1352
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1353
+ /* @__PURE__ */ jsxs3("header", { className: "mb-surface-heading", children: [
1354
+ /* @__PURE__ */ jsxs3("div", { children: [
1355
+ /* @__PURE__ */ jsx3("strong", { children: "Bill history" }),
1356
+ /* @__PURE__ */ jsx3("span", { children: "Submission, payer responses, follow-up, and payments." })
1357
+ ] }),
1358
+ /* @__PURE__ */ jsx3("span", { children: events.length })
1359
+ ] }),
1360
+ !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: [
1361
+ /* @__PURE__ */ jsx3("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
1362
+ /* @__PURE__ */ jsxs3("div", { className: "mb-activity-content", children: [
1363
+ /* @__PURE__ */ jsx3("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
1364
+ event.description ? /* @__PURE__ */ jsx3("p", { children: event.description }) : null,
1365
+ /* @__PURE__ */ jsxs3("span", { children: [
1366
+ formatDate(event.createdAt),
1367
+ event.actor ? ` \xB7 ${event.actor}` : ""
1368
+ ] })
1369
+ ] })
1370
+ ] }, event.id)) })
1371
+ ] });
1372
+ }
1373
+ var lifecycleStages = [
1374
+ { id: "created", label: "Created" },
1375
+ { id: "submitted", label: "Submitted" },
1376
+ { id: "accepted", label: "Accepted" },
1377
+ { id: "response", label: "Payer response" },
1378
+ { id: "follow_up", label: "Follow-up" },
1379
+ { id: "closed", label: "Closed" }
1380
+ ];
1381
+ function billLifecycleStage(state) {
1382
+ const value = state.toLowerCase();
1383
+ if (value.includes("closed") || value.includes("written_off")) return "closed";
1384
+ if (value.includes("second_review") || value.includes("ibr") || value.includes("lien") || value.includes("appeal")) return "follow_up";
1385
+ if (value.includes("processed") || value.includes("paid") || value.includes("denied") || value.includes("rejected") || value.includes("response")) return "response";
1386
+ if (value.includes("accepted")) return "accepted";
1387
+ if (value.includes("submitted") || value.includes("queued") || value.includes("sent")) return "submitted";
1388
+ return "created";
1389
+ }
1390
+ function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
1391
+ const current = billLifecycleStage(state);
1392
+ const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
1393
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
1394
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1395
+ /* @__PURE__ */ jsx3("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs3("div", { children: [
1396
+ /* @__PURE__ */ jsx3("strong", { children: humanize(nativeStatus || state) }),
1397
+ /* @__PURE__ */ jsxs3("span", { children: [
1398
+ submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Not submitted",
1399
+ typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""
1400
+ ] })
1401
+ ] }) }),
1402
+ /* @__PURE__ */ jsx3("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
1403
+ const status = index < currentIndex ? "complete" : index === currentIndex ? "current" : "upcoming";
1404
+ return /* @__PURE__ */ jsxs3("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
1405
+ /* @__PURE__ */ jsx3("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
1406
+ /* @__PURE__ */ jsx3("b", { children: stage.label })
1407
+ ] }, stage.id);
1408
+ }) })
1409
+ ] });
1410
+ }
1411
+ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, className, style }) {
1412
+ const values = [
1413
+ ["Patient", patient.name || [patient.firstName, patient.lastName].filter(Boolean).join(" ")],
1414
+ ["Claim", injury.claimNumber || "\u2014"],
1415
+ ["Payer", delivery.payerName || injury.claimsAdminName || "\u2014"],
1416
+ ["Date of service", bill.dos || "\u2014"],
1417
+ ["Charged", currency(bill.totalCharge)],
1418
+ ["Balance", currency(bill.balanceDue)]
1419
+ ];
1420
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
1421
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1422
+ /* @__PURE__ */ jsx3("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs3("div", { children: [
1423
+ /* @__PURE__ */ jsx3("strong", { children: "Bill snapshot" }),
1424
+ /* @__PURE__ */ jsxs3("span", { children: [
1425
+ "Bill #",
1426
+ bill.billNumber
1427
+ ] })
1428
+ ] }) }),
1429
+ /* @__PURE__ */ jsx3("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs3("div", { children: [
1430
+ /* @__PURE__ */ jsx3("dt", { children: label }),
1431
+ /* @__PURE__ */ jsx3("dd", { children: value })
1432
+ ] }, label)) })
1433
+ ] });
1434
+ }
1435
+ function BillRemittanceCard({ remittance, appearance, className, style }) {
1436
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
1437
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1438
+ /* @__PURE__ */ jsx3("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs3("div", { children: [
1439
+ /* @__PURE__ */ jsx3("strong", { children: "Remittance" }),
1440
+ /* @__PURE__ */ jsx3("span", { children: "Amounts reported by the payer and posted to the bill." })
1441
+ ] }) }),
1442
+ /* @__PURE__ */ jsxs3("dl", { children: [
1443
+ /* @__PURE__ */ jsxs3("div", { children: [
1444
+ /* @__PURE__ */ jsx3("dt", { children: "Payer reported" }),
1445
+ /* @__PURE__ */ jsx3("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
1446
+ ] }),
1447
+ /* @__PURE__ */ jsxs3("div", { children: [
1448
+ /* @__PURE__ */ jsx3("dt", { children: "Posted" }),
1449
+ /* @__PURE__ */ jsx3("dd", { children: currency(remittance.totalPaid) })
1450
+ ] }),
1451
+ /* @__PURE__ */ jsxs3("div", { children: [
1452
+ /* @__PURE__ */ jsx3("dt", { children: "Balance" }),
1453
+ /* @__PURE__ */ jsx3("dd", { children: currency(remittance.balanceDue) })
1454
+ ] })
1455
+ ] }),
1456
+ remittance.denialReason ? /* @__PURE__ */ jsxs3("div", { className: "mb-denial", children: [
1457
+ /* @__PURE__ */ jsx3("strong", { children: "Denial reason" }),
1458
+ /* @__PURE__ */ jsx3("p", { children: remittance.denialReason })
1459
+ ] }) : null
1460
+ ] });
1461
+ }
1462
+ function BillPayerContactCard({ delivery, appearance, className, style }) {
1463
+ const contacts = [
1464
+ delivery.contacts.adjusterName ? ["Adjuster", delivery.contacts.adjusterName, null] : null,
1465
+ delivery.contacts.adjusterPhone ? ["Adjuster phone", delivery.contacts.adjusterPhone, `tel:${delivery.contacts.adjusterPhone}`] : null,
1466
+ delivery.contacts.adjusterEmail ? ["Adjuster email", delivery.contacts.adjusterEmail, `mailto:${delivery.contacts.adjusterEmail}`] : null,
1467
+ delivery.contacts.faxNumber ? ["Fax", delivery.contacts.faxNumber, `tel:${delivery.contacts.faxNumber}`] : null,
1468
+ delivery.contacts.claimsEmail ? ["Email", delivery.contacts.claimsEmail, `mailto:${delivery.contacts.claimsEmail}`] : null,
1469
+ delivery.contacts.mailingAddress ? ["Mail", delivery.contacts.mailingAddress, null] : null,
1470
+ delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
1471
+ ].filter(Boolean);
1472
+ if (!delivery.payerName && !contacts.length) return null;
1473
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
1474
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1475
+ /* @__PURE__ */ jsx3("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs3("div", { children: [
1476
+ /* @__PURE__ */ jsx3("strong", { children: delivery.payerName || "Claims administrator" }),
1477
+ /* @__PURE__ */ jsx3("span", { children: "Billing and follow-up contacts." })
1478
+ ] }) }),
1479
+ !contacts.length ? /* @__PURE__ */ jsx3("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx3("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs3("div", { children: [
1480
+ /* @__PURE__ */ jsx3("dt", { children: label }),
1481
+ /* @__PURE__ */ jsx3("dd", { children: href ? /* @__PURE__ */ jsx3("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
1482
+ ] }, label)) })
1483
+ ] });
1484
+ }
1485
+ function BillPaymentLedger({ payments, appearance, className, style }) {
1486
+ return /* @__PURE__ */ jsxs3("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
1487
+ /* @__PURE__ */ jsx3("style", { children: lifecycleSurfaceStyles }),
1488
+ /* @__PURE__ */ jsxs3("header", { className: "mb-surface-heading", children: [
1489
+ /* @__PURE__ */ jsxs3("div", { children: [
1490
+ /* @__PURE__ */ jsx3("strong", { children: "Payments" }),
1491
+ /* @__PURE__ */ jsx3("span", { children: "Payments posted to this bill." })
1492
+ ] }),
1493
+ /* @__PURE__ */ jsx3("span", { children: payments.length })
1494
+ ] }),
1495
+ !payments.length ? /* @__PURE__ */ jsx3("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx3("div", { className: "mb-payment-list", children: payments.map((payment) => /* @__PURE__ */ jsxs3("article", { children: [
1496
+ /* @__PURE__ */ jsxs3("div", { children: [
1497
+ /* @__PURE__ */ jsx3("strong", { children: currency(payment.amount) }),
1498
+ /* @__PURE__ */ jsxs3("span", { children: [
1499
+ humanize(payment.status || "posted"),
1500
+ " \xB7 ",
1501
+ payment.method.toUpperCase()
1502
+ ] })
1503
+ ] }),
1504
+ /* @__PURE__ */ jsxs3("div", { children: [
1505
+ /* @__PURE__ */ jsx3("span", { children: payment.checkNumber ? `#${payment.checkNumber}` : payment.source.toUpperCase() }),
1506
+ /* @__PURE__ */ jsx3("span", { children: payment.depositDate || defaultFormatDate(payment.postedAt) })
1507
+ ] }),
1508
+ payment.note ? /* @__PURE__ */ jsx3("p", { children: payment.note }) : null
1509
+ ] }, payment.id)) })
1510
+ ] });
1511
+ }
1512
+ function classes(base, className) {
1513
+ return [base, className].filter(Boolean).join(" ");
1514
+ }
1515
+ function humanize(value) {
1516
+ return value.replace(/[._-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
1517
+ }
1518
+ function currency(value) {
1519
+ return new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(value);
1400
1520
  }
1401
1521
  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}
1522
+ .mb-lifecycle-actions,.mb-surface{box-sizing:border-box;color:var(--mb-text);font-family:var(--mb-font,ui-sans-serif,system-ui,sans-serif)}
1523
+ .mb-surface *{box-sizing:border-box}.mb-surface{background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius,12px);box-shadow:var(--mb-shadow);padding:20px}
1524
+ .mb-surface-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}.mb-surface-heading>div{display:grid;gap:2px}.mb-surface-heading strong{font-size:16px}.mb-surface-heading span,.mb-empty{color:var(--mb-muted);font-size:13px}.mb-surface-heading>span{border-radius:999px;background:var(--mb-soft);font-weight:750;padding:4px 8px}
1525
+ .mb-lifecycle-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-start}.mb-lifecycle-action{display:grid;gap:5px;max-width:260px}.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}.mb-action-button:hover:not(:disabled){border-color:var(--mb-accent);color:var(--mb-accent)}.mb-action-button:focus-visible{outline:3px solid color-mix(in srgb,var(--mb-accent) 28%,transparent);outline-offset:2px}.mb-action-button.is-primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mb-action-button:disabled{cursor:not-allowed;opacity:.55}.mb-action-reason{color:var(--mb-muted);font-size:12px;line-height:1.35}
1526
+ .mb-activity-list{list-style:none;margin:0;padding:0}.mb-activity-item{display:grid;grid-template-columns:18px minmax(0,1fr);gap:12px;position:relative;padding:0 0 22px}.mb-activity-item:last-child{padding-bottom:0}.mb-activity-item:not(:last-child)::before{background:var(--mb-border);content:"";left:8px;position:absolute;top:10px;bottom:0;width:1px}.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}.mb-activity-content{display:grid;gap:4px;min-width:0}.mb-activity-content strong{font-size:15px;line-height:1.35}.mb-activity-content p{color:var(--mb-text);font-size:14px;line-height:1.5;margin:0}.mb-activity-content span,.mb-activity-empty{color:var(--mb-muted);font-size:13px;line-height:1.45}.mb-activity-empty,.mb-empty{margin:0}
1527
+ .mb-progress-list{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));list-style:none;margin:0;padding:0}.mb-progress-list li{display:grid;gap:7px;position:relative;text-align:center;color:var(--mb-muted);font-size:12px}.mb-progress-list li:not(:last-child)::after{content:"";position:absolute;left:calc(50% + 14px);right:calc(-50% + 14px);top:13px;height:2px;background:var(--mb-border)}.mb-progress-list li.is-complete:not(:last-child)::after{background:var(--mb-accent)}.mb-progress-list li>span{display:grid;place-items:center;justify-self:center;position:relative;z-index:1;width:28px;height:28px;border:2px solid var(--mb-border);border-radius:50%;background:var(--mb-surface);font-weight:800}.mb-progress-list li.is-complete>span,.mb-progress-list li.is-current>span{border-color:var(--mb-accent);background:var(--mb-accent);color:var(--mb-accent-contrast)}.mb-progress-list li.is-current{color:var(--mb-text)}
1528
+ .mb-snapshot dl,.mb-remittance dl,.mb-contacts dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;margin:0}.mb-snapshot dl>div,.mb-remittance dl>div,.mb-contacts dl>div{display:grid;gap:3px;padding:10px 14px;border-left:1px solid var(--mb-border)}.mb-snapshot dl>div:nth-child(3n+1),.mb-remittance dl>div:first-child,.mb-contacts dl>div:first-child{border-left:0}.mb-snapshot dt,.mb-remittance dt,.mb-contacts dt{color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.mb-snapshot dd,.mb-remittance dd,.mb-contacts dd{font-size:14px;font-weight:750;margin:0;overflow-wrap:anywhere}.mb-contacts a{color:var(--mb-accent)}.mb-denial{margin-top:16px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));padding:12px 14px}.mb-denial p{margin:4px 0 0}
1529
+ .mb-payment-list{display:grid}.mb-payment-list article{display:grid;grid-template-columns:1fr auto;gap:5px 18px;padding:12px 0;border-top:1px solid var(--mb-border)}.mb-payment-list article:first-child{border-top:0}.mb-payment-list article>div{display:grid;gap:2px}.mb-payment-list article>div:nth-child(2){text-align:right}.mb-payment-list article span{color:var(--mb-muted);font-size:12px}.mb-payment-list article p{grid-column:1/-1;margin:0;color:var(--mb-muted);font-size:13px}
1530
+ @media(max-width:700px){.mb-progress-list{grid-template-columns:1fr;text-align:left}.mb-progress-list li{grid-template-columns:28px 1fr;align-items:center;text-align:left}.mb-progress-list li:not(:last-child)::after{left:13px;right:auto;top:28px;bottom:-7px;width:2px;height:auto}.mb-progress-list li>span{grid-row:1}.mb-snapshot dl,.mb-remittance dl,.mb-contacts dl{grid-template-columns:1fr 1fr}.mb-snapshot dl>div,.mb-remittance dl>div,.mb-contacts dl>div{border:0;border-top:1px solid var(--mb-border);padding:10px 0}.mb-snapshot dl>div:nth-child(-n+2),.mb-remittance dl>div:nth-child(-n+2),.mb-contacts dl>div:nth-child(-n+2){border-top:0}.mb-payment-list article{grid-template-columns:1fr}.mb-payment-list article>div:nth-child(2){text-align:left}}
1422
1531
  `;
1423
1532
 
1424
1533
  // src/connected-bill-lifecycle.tsx
@@ -1587,7 +1696,7 @@ function useBillLifecycle({
1587
1696
  setData(result.data);
1588
1697
  return result.data;
1589
1698
  } catch (cause) {
1590
- const nextError = cause instanceof Error ? cause : new Error("Correction draft could not be created.");
1699
+ const nextError = cause instanceof Error ? cause : new Error("The correction could not be created.");
1591
1700
  setError(nextError);
1592
1701
  throw nextError;
1593
1702
  } finally {
@@ -1622,6 +1731,31 @@ function useBillLifecycle({
1622
1731
  startCorrection
1623
1732
  };
1624
1733
  }
1734
+ function LifecycleDialog({
1735
+ children,
1736
+ title,
1737
+ onClose
1738
+ }) {
1739
+ const dialog = useRef3(null);
1740
+ useEffect3(() => {
1741
+ const previous = document.activeElement;
1742
+ dialog.current?.focus();
1743
+ const onKeyDown = (event) => {
1744
+ if (event.key === "Escape") onClose();
1745
+ };
1746
+ document.addEventListener("keydown", onKeyDown);
1747
+ return () => {
1748
+ document.removeEventListener("keydown", onKeyDown);
1749
+ previous?.focus();
1750
+ };
1751
+ }, [onClose]);
1752
+ return /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => {
1753
+ if (event.currentTarget === event.target) onClose();
1754
+ }, children: /* @__PURE__ */ jsxs4("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
1755
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
1756
+ children
1757
+ ] }) });
1758
+ }
1625
1759
  function dateInputValue() {
1626
1760
  const now = /* @__PURE__ */ new Date();
1627
1761
  const offset = now.getTimezoneOffset() * 6e4;
@@ -1682,6 +1816,7 @@ function ConnectedBillLifecycle({
1682
1816
  route: "ebill"
1683
1817
  });
1684
1818
  const lastData = useRef3(null);
1819
+ const closePanel = useCallback2(() => setPanel(""), []);
1685
1820
  useEffect3(() => {
1686
1821
  if (!data || data === lastData.current) return;
1687
1822
  lastData.current = data;
@@ -1737,6 +1872,26 @@ function ConnectedBillLifecycle({
1737
1872
  return /* @__PURE__ */ jsxs4("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
1738
1873
  /* @__PURE__ */ jsx4("style", { children: CONNECTED_LIFECYCLE_STYLES }),
1739
1874
  /* @__PURE__ */ jsx4("style", { children: CONNECTED_THEME_OVERRIDE_STYLES }),
1875
+ /* @__PURE__ */ jsx4(
1876
+ BillLifecycleProgress,
1877
+ {
1878
+ state: data.lifecycle.state,
1879
+ nativeStatus: data.lifecycle.nativeStatus,
1880
+ submittedAt: data.lifecycle.submittedAt ?? null,
1881
+ agingDays: data.lifecycle.agingDays ?? null,
1882
+ ...appearance ? { appearance } : {}
1883
+ }
1884
+ ),
1885
+ /* @__PURE__ */ jsx4(
1886
+ BillSnapshotSummary,
1887
+ {
1888
+ bill: data.bill,
1889
+ patient: data.patient,
1890
+ injury: data.injury,
1891
+ delivery: data.delivery,
1892
+ ...appearance ? { appearance } : {}
1893
+ }
1894
+ ),
1740
1895
  canEditAndSubmit ? /* @__PURE__ */ jsx4(
1741
1896
  BillReviewForm,
1742
1897
  {
@@ -1805,21 +1960,27 @@ function ConnectedBillLifecycle({
1805
1960
  /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(eor).catch(() => void 0), children: "View PDF" })
1806
1961
  ] }, eor.id)) })
1807
1962
  ] }) : null,
1963
+ /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-detail-grid", children: [
1964
+ /* @__PURE__ */ jsx4(BillRemittanceCard, { remittance: data.remittance, ...appearance ? { appearance } : {} }),
1965
+ /* @__PURE__ */ jsx4(BillPayerContactCard, { delivery: data.delivery, ...appearance ? { appearance } : {} }),
1966
+ /* @__PURE__ */ jsx4(BillPaymentLedger, { payments: data.payments, ...appearance ? { appearance } : {} })
1967
+ ] }),
1968
+ /* @__PURE__ */ jsx4(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }),
1808
1969
  has("independent_bill_review") ? /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-info", children: [
1809
1970
  /* @__PURE__ */ jsx4("strong", { children: has("independent_bill_review")?.label }),
1810
1971
  /* @__PURE__ */ jsx4("span", { children: has("independent_bill_review")?.reason })
1811
1972
  ] }) : null,
1812
- panel === "correction" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
1973
+ panel === "correction" ? /* @__PURE__ */ jsx4(LifecycleDialog, { title: "Correct and resubmit", onClose: closePanel, children: /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
1813
1974
  /* @__PURE__ */ jsxs4("div", { children: [
1814
1975
  /* @__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." })
1976
+ /* @__PURE__ */ jsx4("p", { children: "The rejected bill stays in history. A copied correction opens here so you can fix the rejected values and resubmit." })
1816
1977
  ] }),
1817
1978
  /* @__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" })
1979
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: closePanel, children: "Cancel" }),
1980
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Correction created.", lifecycle.startCorrection), children: lifecycle.isMutating ? "Creating\u2026" : "Create correction" })
1820
1981
  ] })
1821
- ] }) : null,
1822
- panel === "second_review" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel wide", children: [
1982
+ ] }) }) : null,
1983
+ panel === "second_review" ? /* @__PURE__ */ jsx4(LifecycleDialog, { title: "Submit Second Review", onClose: closePanel, children: /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel wide", children: [
1823
1984
  /* @__PURE__ */ jsxs4("div", { children: [
1824
1985
  /* @__PURE__ */ jsx4("h3", { children: "Submit Second Review" }),
1825
1986
  /* @__PURE__ */ jsx4("p", { children: "State why payment is disputed, confirm the payer control number, and choose the supporting documents to send." })
@@ -1872,11 +2033,11 @@ function ConnectedBillLifecycle({
1872
2033
  }));
1873
2034
  } }),
1874
2035
  /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
1875
- /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2036
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: closePanel, children: "Cancel" }),
1876
2037
  /* @__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" })
1877
2038
  ] })
1878
- ] }) : null,
1879
- panel === "payment" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
2039
+ ] }) }) : null,
2040
+ panel === "payment" ? /* @__PURE__ */ jsx4(LifecycleDialog, { title: "Post payment", onClose: closePanel, children: /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel", children: [
1880
2041
  /* @__PURE__ */ jsxs4("div", { children: [
1881
2042
  /* @__PURE__ */ jsx4("h3", { children: "Post payment" }),
1882
2043
  /* @__PURE__ */ jsx4("p", { children: "Record funds shown on the EOR. The balance updates and the bill closes automatically when configured." })
@@ -1910,11 +2071,11 @@ function ConnectedBillLifecycle({
1910
2071
  ] })
1911
2072
  ] }),
1912
2073
  /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
1913
- /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2074
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: closePanel, children: "Cancel" }),
1914
2075
  /* @__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" })
1915
2076
  ] })
1916
- ] }) : null,
1917
- panel === "close" ? /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel danger", children: [
2077
+ ] }) }) : null,
2078
+ panel === "close" ? /* @__PURE__ */ jsx4(LifecycleDialog, { title: "Close bill", onClose: closePanel, children: /* @__PURE__ */ jsxs4("section", { className: "mb-lifecycle-panel danger", children: [
1918
2079
  /* @__PURE__ */ jsxs4("div", { children: [
1919
2080
  /* @__PURE__ */ jsx4("h3", { children: "Close bill" }),
1920
2081
  /* @__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." })
@@ -1924,16 +2085,16 @@ function ConnectedBillLifecycle({
1924
2085
  /* @__PURE__ */ jsx4("textarea", { required: true, value: closeReason, onChange: (event) => setCloseReason(event.target.value) })
1925
2086
  ] }),
1926
2087
  /* @__PURE__ */ jsxs4("div", { className: "mb-lifecycle-panel-actions", children: [
1927
- /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
2088
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: closePanel, children: "Cancel" }),
1928
2089
  /* @__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" })
1929
2090
  ] })
1930
- ] }) : null,
2091
+ ] }) }) : null,
1931
2092
  notice ? /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
1932
2093
  lifecycle.error ? /* @__PURE__ */ jsx4("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
1933
2094
  ] });
1934
2095
  }
1935
2096
  var CONNECTED_LIFECYCLE_STYLES = `
1936
- .mb-connected-lifecycle{--mb-accent:#238dbd;--mb-text:#203743;--mb-muted:#657982;--mb-border:#dbe6ea;--mb-soft:#f3f8fa;--mb-surface:#fff;display:grid;gap:14px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;border:1px solid var(--mb-border);border-radius:10px;background:var(--mb-surface)}.mb-lifecycle-toolbar>div:first-child{display:grid;gap:2px}.mb-lifecycle-toolbar span,.mb-lifecycle-card p,.mb-lifecycle-panel p,.mb-lifecycle-info span{color:var(--mb-muted)}.mb-lifecycle-toolbar-actions,.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-button{min-height:38px;border:1px solid var(--mb-border);border-radius:8px;background:#fff;color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:8px 13px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:#fff}.mb-lifecycle-button.quiet{border-color:transparent;background:transparent;color:var(--mb-muted)}.mb-lifecycle-button.danger{border-color:#b63d35;background:#b63d35;color:#fff}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-card,.mb-lifecycle-panel{padding:18px;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface)}.mb-lifecycle-card header{display:flex;align-items:start;justify-content:space-between;gap:16px}.mb-lifecycle-card h3,.mb-lifecycle-panel h3{margin:0;font-size:18px}.mb-lifecycle-card p,.mb-lifecycle-panel p{margin:3px 0 0}.mb-lifecycle-card header>span{padding:5px 8px;border-radius:999px;background:var(--mb-soft);color:var(--mb-muted);font-size:11px;font-weight:800;text-transform:uppercase}.mb-lifecycle-documents{list-style:none;margin:12px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid}.mb-lifecycle-documents span{color:var(--mb-muted);font-size:12px}.mb-lifecycle-info{display:grid;gap:3px;padding:13px 15px;border:1px solid #cddfe5;border-radius:10px;background:var(--mb-soft)}.mb-lifecycle-panel{display:grid;gap:16px;box-shadow:0 14px 38px rgba(30,56,68,.08)}.mb-lifecycle-panel.danger{border-color:#ecc5c2}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:12px;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-size:inherit;font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea,.mb-lifecycle-upload input,.mb-lifecycle-upload select{width:100%;min-height:42px;border:1px solid var(--mb-border);border-radius:8px;background:#fff;color:var(--mb-text);font:inherit;padding:9px 11px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:12px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:12px;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-upload{display:grid;grid-template-columns:220px 1fr auto;align-items:end;gap:10px;padding:12px;border-radius:9px;background:var(--mb-soft)}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}@media(max-width:760px){.mb-lifecycle-toolbar,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-toolbar-actions,.mb-lifecycle-panel-actions{justify-content:start}.mb-lifecycle-fields.two,.mb-lifecycle-upload{grid-template-columns:1fr}.mb-lifecycle-documents li{align-items:start}.mb-lifecycle-packet>label{grid-template-columns:auto 1fr auto}}
2097
+ .mb-connected-lifecycle{--mb-accent:#238dbd;--mb-text:#203743;--mb-muted:#657982;--mb-border:#dbe6ea;--mb-soft:#f3f8fa;--mb-surface:#fff;display:grid;gap:14px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.mb-lifecycle-detail-grid>*:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;border:1px solid var(--mb-border);border-radius:10px;background:var(--mb-surface)}.mb-lifecycle-toolbar>div:first-child{display:grid;gap:2px}.mb-lifecycle-toolbar span,.mb-lifecycle-card p,.mb-lifecycle-panel p,.mb-lifecycle-info span{color:var(--mb-muted)}.mb-lifecycle-toolbar-actions,.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-button{min-height:38px;border:1px solid var(--mb-border);border-radius:8px;background:#fff;color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:8px 13px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:#fff}.mb-lifecycle-button.quiet{border-color:transparent;background:transparent;color:var(--mb-muted)}.mb-lifecycle-button.danger{border-color:#b63d35;background:#b63d35;color:#fff}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-card,.mb-lifecycle-panel{padding:18px;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface)}.mb-lifecycle-card header{display:flex;align-items:start;justify-content:space-between;gap:16px}.mb-lifecycle-card h3,.mb-lifecycle-panel h3{margin:0;font-size:18px}.mb-lifecycle-card p,.mb-lifecycle-panel p{margin:3px 0 0}.mb-lifecycle-card header>span{padding:5px 8px;border-radius:999px;background:var(--mb-soft);color:var(--mb-muted);font-size:11px;font-weight:800;text-transform:uppercase}.mb-lifecycle-documents{list-style:none;margin:12px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:11px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid}.mb-lifecycle-documents span{color:var(--mb-muted);font-size:12px}.mb-lifecycle-info{display:grid;gap:3px;padding:13px 15px;border:1px solid #cddfe5;border-radius:10px;background:var(--mb-soft)}.mb-lifecycle-dialog-backdrop{position:fixed;z-index:2147483000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(18,35,43,.56);backdrop-filter:blur(3px)}.mb-lifecycle-dialog{position:relative;width:min(760px,100%);max-height:calc(100vh - 40px);overflow:auto;outline:0}.mb-lifecycle-dialog-close{position:absolute;z-index:1;top:12px;right:12px;width:34px;height:34px;border:1px solid var(--mb-border);border-radius:8px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;font:22px/1 inherit}.mb-lifecycle-panel{display:grid;gap:16px;padding-top:24px;box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-panel.danger{border-color:#ecc5c2}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:12px;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-size:inherit;font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea,.mb-lifecycle-upload input,.mb-lifecycle-upload select{width:100%;min-height:42px;border:1px solid var(--mb-border);border-radius:8px;background:#fff;color:var(--mb-text);font:inherit;padding:9px 11px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:12px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:12px;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-upload{display:grid;grid-template-columns:220px 1fr auto;align-items:end;gap:10px;padding:12px;border-radius:9px;background:var(--mb-soft)}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}@media(max-width:760px){.mb-lifecycle-detail-grid{grid-template-columns:1fr}.mb-lifecycle-detail-grid>*:last-child:nth-child(odd){grid-column:auto}.mb-lifecycle-toolbar,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-toolbar-actions,.mb-lifecycle-panel-actions{justify-content:start}.mb-lifecycle-fields.two,.mb-lifecycle-upload{grid-template-columns:1fr}.mb-lifecycle-documents li{align-items:start}.mb-lifecycle-packet>label{grid-template-columns:auto 1fr auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:92vh}.mb-lifecycle-dialog .mb-lifecycle-panel{border-radius:18px 18px 0 0}.mb-lifecycle-packet>label>button:last-child{grid-column:3}}
1937
2098
  `;
1938
2099
  var CONNECTED_THEME_OVERRIDE_STYLES = `
1939
2100
  .mb-connected-lifecycle{color:var(--mb-text);font-family:var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}
@@ -1995,13 +2156,19 @@ function MindBillBillReview(props) {
1995
2156
  export {
1996
2157
  BillActivityTimeline,
1997
2158
  BillLifecycleActions,
2159
+ BillLifecycleProgress,
2160
+ BillPayerContactCard,
2161
+ BillPaymentLedger,
2162
+ BillRemittanceCard,
1998
2163
  BillReviewForm,
2164
+ BillSnapshotSummary,
1999
2165
  BillStatusSummary,
2000
2166
  ConnectedBillLifecycle,
2001
2167
  ConnectedBillStatus,
2002
2168
  MindBillBillReview,
2003
2169
  MindBillBillTimeline,
2004
2170
  billActivityEventLabel,
2171
+ billLifecycleStage,
2005
2172
  buildBillReviewSaveInput,
2006
2173
  createBillLifecycleClient2 as createBillLifecycleClient,
2007
2174
  createBillStatusClient,