@mindbill/react 0.43.0 → 0.44.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.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.tsx
4
4
  import "@mindbill/embed";
5
- import { createElement, useEffect as useEffect11, useRef as useRef7 } from "react";
5
+ import { createElement, useEffect as useEffect12, useRef as useRef7 } from "react";
6
6
 
7
7
  // src/appearance.ts
8
8
  var mindBillThemePresets = {
@@ -39,6 +39,23 @@ var mindBillThemePresets = {
39
39
  warningColor: "#9a6418",
40
40
  fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
41
41
  },
42
+ "calm-clinical": {
43
+ accentColor: "#52b4d7",
44
+ accentTextColor: "#173542",
45
+ backgroundColor: "#f2f8fb",
46
+ surfaceColor: "#ffffff",
47
+ inputBackgroundColor: "#ffffff",
48
+ textColor: "#20323c",
49
+ mutedColor: "#687b84",
50
+ borderColor: "#d8e4e9",
51
+ borderRadius: "12px",
52
+ controlRadius: "8px",
53
+ shadow: "0 1px 2px rgba(32,50,60,.05)",
54
+ dangerColor: "#b83f3a",
55
+ successColor: "#21835d",
56
+ warningColor: "#9a6418",
57
+ fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
58
+ },
42
59
  "orange-bright": {
43
60
  accentColor: "#f4510b",
44
61
  accentTextColor: "#ffffff",
@@ -4033,7 +4050,7 @@ import {
4033
4050
  REPORT_BILL_STATUS_OPTIONS
4034
4051
  } from "@mindbill/browser";
4035
4052
  import { REPORT_BILL_STATUS_OPTIONS as REPORT_BILL_STATUS_OPTIONS2 } from "@mindbill/browser";
4036
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
4053
+ import { Fragment as Fragment8, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
4037
4054
  var css8 = `
4038
4055
  .mbbs-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,30,40,.45)}
4039
4056
  .mbbs{display:grid;gap:18px;width:min(860px,100%);max-height:min(90vh,960px);overflow:auto;overscroll-behavior:contain;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);color:var(--mb-text);font-family:var(--mb-font);font-size:14px;box-shadow:0 24px 60px rgba(17,38,49,.28)}
@@ -4050,6 +4067,20 @@ var css8 = `
4050
4067
  .mbbs-contact dl>div{display:grid;grid-template-columns:130px minmax(0,1fr);gap:10px}
4051
4068
  .mbbs-contact dt{color:var(--mb-muted);font-size:12.5px}
4052
4069
  .mbbs-contact dd{margin:0;font-weight:700;overflow-wrap:anywhere}
4070
+ .mbbs-contact a,.mbbs-directory a{color:var(--mb-accent);text-decoration-thickness:1px;text-underline-offset:2px}
4071
+ .mbbs-directory{display:grid;gap:10px}
4072
+ .mbbs-directory-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
4073
+ .mbbs-directory-card{min-width:0;padding:12px 14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 3%,var(--mb-surface))}
4074
+ .mbbs-directory-card.wide{grid-column:1/-1}
4075
+ .mbbs-directory-card h5{margin:0 0 8px;color:var(--mb-muted);font-size:11px;font-weight:800;letter-spacing:.07em;text-transform:uppercase}
4076
+ .mbbs-directory-card dl{display:grid;gap:7px;margin:0}
4077
+ .mbbs-directory-card dl>div{display:grid;grid-template-columns:120px minmax(0,1fr);gap:10px}
4078
+ .mbbs-directory-card dt{color:var(--mb-muted);font-size:12px}
4079
+ .mbbs-directory-card dd{min-width:0;margin:0;font-weight:650;overflow-wrap:anywhere}
4080
+ .mbbs-directory-list{display:grid;gap:8px;margin:0;padding:0;list-style:none}
4081
+ .mbbs-directory-list li{display:grid;gap:2px;padding-top:8px;border-top:1px solid var(--mb-border)}
4082
+ .mbbs-directory-list li:first-child{padding-top:0;border-top:0}
4083
+ .mbbs-directory-list small{color:var(--mb-muted);line-height:1.4}
4053
4084
  .mbbs-receipt{border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:10px}
4054
4085
  .mbbs-report{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:18px}
4055
4086
  .mbbs-options{display:grid;gap:8px;align-content:start}
@@ -4069,12 +4100,156 @@ var css8 = `
4069
4100
  .mbbs-cancel{min-height:42px;padding:9px 16px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:var(--mb-text);font:inherit;font-weight:680;cursor:pointer}
4070
4101
  .mbbs-save{min-height:42px;min-width:130px;padding:9px 18px;border:0;border-radius:var(--mb-control-radius);background:var(--mb-accent);color:var(--mb-accent-contrast);font:inherit;font-weight:760;cursor:pointer}
4071
4102
  .mbbs-save:disabled,.mbbs-cancel:disabled{opacity:.6;cursor:not-allowed}
4072
- @media(max-width:700px){.mbbs-contacts,.mbbs-report{grid-template-columns:1fr}}
4103
+ @media(max-width:700px){.mbbs-contacts,.mbbs-directory-grid,.mbbs-report{grid-template-columns:1fr}.mbbs-directory-card.wide{grid-column:auto}.mbbs-directory-card dl>div{grid-template-columns:1fr;gap:2px}}
4073
4104
  `;
4105
+ function externalHref(value) {
4106
+ return /^https?:\/\//i.test(value) ? value : `https://${value}`;
4107
+ }
4108
+ function contactLine(contact, key) {
4109
+ return /* @__PURE__ */ jsxs10("li", { children: [
4110
+ /* @__PURE__ */ jsx10("strong", { children: contact.name || "Contact" }),
4111
+ /* @__PURE__ */ jsxs10("span", { children: [
4112
+ contact.phone ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4113
+ /* @__PURE__ */ jsx10("a", { href: `tel:${contact.phone}`, children: contact.phone }),
4114
+ " "
4115
+ ] }) : null,
4116
+ contact.email ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4117
+ /* @__PURE__ */ jsx10("a", { href: `mailto:${contact.email}`, children: contact.email }),
4118
+ " "
4119
+ ] }) : null,
4120
+ contact.portalUrl ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4121
+ /* @__PURE__ */ jsx10("a", { href: externalHref(contact.portalUrl), target: "_blank", rel: "noreferrer", children: "Open portal" }),
4122
+ " "
4123
+ ] }) : null,
4124
+ contact.fax ? /* @__PURE__ */ jsxs10(Fragment8, { children: [
4125
+ "Fax ",
4126
+ contact.fax,
4127
+ " "
4128
+ ] }) : null,
4129
+ contact.address || null
4130
+ ] }),
4131
+ contact.note ? /* @__PURE__ */ jsx10("small", { children: contact.note }) : null
4132
+ ] }, key);
4133
+ }
4134
+ function DirectoryDetails({ directory }) {
4135
+ const aliases = directory.aliases?.filter(Boolean).join(", ");
4136
+ const affiliates = directory.affiliatedEntities?.filter(Boolean).join(", ");
4137
+ return /* @__PURE__ */ jsxs10("div", { className: "mbbs-directory-grid", children: [
4138
+ /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card wide", children: [
4139
+ /* @__PURE__ */ jsx10("h5", { children: "Claims administrator" }),
4140
+ /* @__PURE__ */ jsxs10("dl", { children: [
4141
+ directory.name ? /* @__PURE__ */ jsxs10("div", { children: [
4142
+ /* @__PURE__ */ jsx10("dt", { children: "Name" }),
4143
+ /* @__PURE__ */ jsx10("dd", { children: directory.name })
4144
+ ] }) : null,
4145
+ directory.type ? /* @__PURE__ */ jsxs10("div", { children: [
4146
+ /* @__PURE__ */ jsx10("dt", { children: "Type" }),
4147
+ /* @__PURE__ */ jsx10("dd", { children: directory.type })
4148
+ ] }) : null,
4149
+ directory.description ? /* @__PURE__ */ jsxs10("div", { children: [
4150
+ /* @__PURE__ */ jsx10("dt", { children: "Description" }),
4151
+ /* @__PURE__ */ jsx10("dd", { children: directory.description })
4152
+ ] }) : null,
4153
+ directory.website ? /* @__PURE__ */ jsxs10("div", { children: [
4154
+ /* @__PURE__ */ jsx10("dt", { children: "Website" }),
4155
+ /* @__PURE__ */ jsx10("dd", { children: /* @__PURE__ */ jsx10("a", { href: externalHref(directory.website), target: "_blank", rel: "noreferrer", children: directory.website }) })
4156
+ ] }) : null,
4157
+ directory.hours ? /* @__PURE__ */ jsxs10("div", { children: [
4158
+ /* @__PURE__ */ jsx10("dt", { children: "Hours" }),
4159
+ /* @__PURE__ */ jsx10("dd", { children: directory.hours })
4160
+ ] }) : null,
4161
+ directory.telephoneNumbers?.length ? /* @__PURE__ */ jsxs10("div", { children: [
4162
+ /* @__PURE__ */ jsx10("dt", { children: "Phone" }),
4163
+ /* @__PURE__ */ jsx10("dd", { children: directory.telephoneNumbers.map((value, index) => /* @__PURE__ */ jsxs10("span", { children: [
4164
+ index ? ", " : "",
4165
+ /* @__PURE__ */ jsx10("a", { href: `tel:${value}`, children: value })
4166
+ ] }, value)) })
4167
+ ] }) : null,
4168
+ directory.emailAddresses?.length ? /* @__PURE__ */ jsxs10("div", { children: [
4169
+ /* @__PURE__ */ jsx10("dt", { children: "Email" }),
4170
+ /* @__PURE__ */ jsx10("dd", { children: directory.emailAddresses.map((value, index) => /* @__PURE__ */ jsxs10("span", { children: [
4171
+ index ? ", " : "",
4172
+ /* @__PURE__ */ jsx10("a", { href: `mailto:${value}`, children: value })
4173
+ ] }, value)) })
4174
+ ] }) : null,
4175
+ directory.webPortals?.length ? /* @__PURE__ */ jsxs10("div", { children: [
4176
+ /* @__PURE__ */ jsx10("dt", { children: "Portals" }),
4177
+ /* @__PURE__ */ jsx10("dd", { children: directory.webPortals.map((value, index) => /* @__PURE__ */ jsxs10("span", { children: [
4178
+ index ? ", " : "",
4179
+ /* @__PURE__ */ jsxs10("a", { href: externalHref(value), target: "_blank", rel: "noreferrer", children: [
4180
+ "Open portal ",
4181
+ index + 1
4182
+ ] })
4183
+ ] }, value)) })
4184
+ ] }) : null,
4185
+ aliases ? /* @__PURE__ */ jsxs10("div", { children: [
4186
+ /* @__PURE__ */ jsx10("dt", { children: "Also known as" }),
4187
+ /* @__PURE__ */ jsx10("dd", { children: aliases })
4188
+ ] }) : null,
4189
+ affiliates ? /* @__PURE__ */ jsxs10("div", { children: [
4190
+ /* @__PURE__ */ jsx10("dt", { children: "Affiliates" }),
4191
+ /* @__PURE__ */ jsx10("dd", { children: affiliates })
4192
+ ] }) : null,
4193
+ directory.claimNumberHint ? /* @__PURE__ */ jsxs10("div", { children: [
4194
+ /* @__PURE__ */ jsx10("dt", { children: "Claim number" }),
4195
+ /* @__PURE__ */ jsx10("dd", { children: directory.claimNumberHint })
4196
+ ] }) : null,
4197
+ directory.billProcessingWorkflow ? /* @__PURE__ */ jsxs10("div", { children: [
4198
+ /* @__PURE__ */ jsx10("dt", { children: "Workflow" }),
4199
+ /* @__PURE__ */ jsx10("dd", { children: directory.billProcessingWorkflow })
4200
+ ] }) : null,
4201
+ directory.billProcessingWorkflowNotes ? /* @__PURE__ */ jsxs10("div", { children: [
4202
+ /* @__PURE__ */ jsx10("dt", { children: "Workflow notes" }),
4203
+ /* @__PURE__ */ jsx10("dd", { children: directory.billProcessingWorkflowNotes })
4204
+ ] }) : null
4205
+ ] })
4206
+ ] }),
4207
+ directory.billReview?.length ? /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card", children: [
4208
+ /* @__PURE__ */ jsx10("h5", { children: "Bill review" }),
4209
+ /* @__PURE__ */ jsx10("ul", { className: "mbbs-directory-list", children: directory.billReview.map(contactLine) })
4210
+ ] }) : null,
4211
+ directory.authorization?.length || directory.authorizationNotice ? /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card", children: [
4212
+ /* @__PURE__ */ jsx10("h5", { children: "Authorization" }),
4213
+ directory.authorizationNotice ? /* @__PURE__ */ jsx10("p", { className: "mbbs-copy", children: directory.authorizationNotice }) : null,
4214
+ /* @__PURE__ */ jsx10("ul", { className: "mbbs-directory-list", children: (directory.authorization ?? []).map(contactLine) })
4215
+ ] }) : null,
4216
+ directory.mailingAddresses?.length ? /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card", children: [
4217
+ /* @__PURE__ */ jsx10("h5", { children: "Mailing addresses" }),
4218
+ /* @__PURE__ */ jsx10("ul", { className: "mbbs-directory-list", children: directory.mailingAddresses.map((entry, index) => /* @__PURE__ */ jsxs10("li", { children: [
4219
+ /* @__PURE__ */ jsx10("strong", { children: entry.company || "Mailing address" }),
4220
+ /* @__PURE__ */ jsx10("span", { children: entry.address }),
4221
+ entry.notes ? /* @__PURE__ */ jsx10("small", { children: entry.notes }) : null,
4222
+ entry.submissionTypes?.length ? /* @__PURE__ */ jsxs10("small", { children: [
4223
+ "Submission types: ",
4224
+ entry.submissionTypes.join(", ")
4225
+ ] }) : null
4226
+ ] }, index)) })
4227
+ ] }) : null,
4228
+ directory.claimNumberPatterns?.length ? /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card", children: [
4229
+ /* @__PURE__ */ jsx10("h5", { children: "Claim number patterns" }),
4230
+ /* @__PURE__ */ jsx10("ul", { className: "mbbs-directory-list", children: directory.claimNumberPatterns.map((entry, index) => /* @__PURE__ */ jsxs10("li", { children: [
4231
+ /* @__PURE__ */ jsx10("strong", { children: entry.pattern }),
4232
+ /* @__PURE__ */ jsxs10("span", { children: [
4233
+ entry.length ? `Length ${entry.length}` : "",
4234
+ entry.example ? `${entry.length ? " \xB7 " : ""}Example ${entry.example}` : ""
4235
+ ] })
4236
+ ] }, index)) })
4237
+ ] }) : null,
4238
+ directory.payers?.length ? /* @__PURE__ */ jsxs10("section", { className: "mbbs-directory-card wide", children: [
4239
+ /* @__PURE__ */ jsx10("h5", { children: "Electronic billing routes" }),
4240
+ /* @__PURE__ */ jsx10("ul", { className: "mbbs-directory-list", children: directory.payers.map((payer, index) => /* @__PURE__ */ jsxs10("li", { children: [
4241
+ /* @__PURE__ */ jsx10("strong", { children: payer.name }),
4242
+ /* @__PURE__ */ jsx10("span", { children: [payer.deliveryType || payer.route, payer.clearinghouse, payer.payerId ? `Payer ID ${payer.payerId}` : null].filter(Boolean).join(" \xB7 ") }),
4243
+ payer.hint ? /* @__PURE__ */ jsx10("small", { children: payer.hint }) : null
4244
+ ] }, `${payer.name}-${payer.payerId ?? index}`)) })
4245
+ ] }) : null
4246
+ ] });
4247
+ }
4074
4248
  function ReportBillStatusDialog({
4075
4249
  title = "Report Bill Status",
4076
4250
  claimsAdmin,
4077
4251
  billReview,
4252
+ directory,
4078
4253
  receipt,
4079
4254
  submitting = false,
4080
4255
  error = null,
@@ -4137,10 +4312,10 @@ function ReportBillStatusDialog({
4137
4312
  /* @__PURE__ */ jsx10("h3", { className: "mbbs-title", children: title }),
4138
4313
  /* @__PURE__ */ jsx10("button", { className: "mbbs-close", type: "button", "aria-label": "Close", disabled: submitting, onClick: onCancel, children: "\xD7" })
4139
4314
  ] }),
4140
- claimsAdmin || billReview ? /* @__PURE__ */ jsxs10("div", { className: "mbbs-section", children: [
4315
+ directory || claimsAdmin || billReview ? /* @__PURE__ */ jsxs10("div", { className: "mbbs-section", children: [
4141
4316
  /* @__PURE__ */ jsx10("h4", { children: "1. Call Claims Administrator or Bill Review" }),
4142
4317
  /* @__PURE__ */ jsx10("p", { className: "mbbs-copy", children: "Contact the payer to request the payment status of this bill." }),
4143
- /* @__PURE__ */ jsxs10("div", { className: "mbbs-contacts", children: [
4318
+ directory ? /* @__PURE__ */ jsx10(DirectoryDetails, { directory }) : /* @__PURE__ */ jsxs10("div", { className: "mbbs-contacts", children: [
4144
4319
  claimsAdmin ? /* @__PURE__ */ jsxs10("div", { className: "mbbs-contact", children: [
4145
4320
  /* @__PURE__ */ jsx10("h5", { children: "Claims Admin" }),
4146
4321
  /* @__PURE__ */ jsxs10("dl", { children: [
@@ -4230,7 +4405,7 @@ import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMem
4230
4405
  import {
4231
4406
  createOrganizationClient
4232
4407
  } from "@mindbill/browser";
4233
- import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4408
+ import { Fragment as Fragment9, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4234
4409
  var STEPS = [
4235
4410
  { id: "practice", label: "Practice & billing" },
4236
4411
  { id: "locations", label: "Locations" },
@@ -4465,13 +4640,13 @@ function OrganizationOnboarding({
4465
4640
  /* @__PURE__ */ jsx11("p", { className: "mbob-copy", children: description })
4466
4641
  ] }) }),
4467
4642
  loadError ? /* @__PURE__ */ jsx11("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
4468
- variant === "onboarding" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
4643
+ variant === "onboarding" ? /* @__PURE__ */ jsxs11(Fragment9, { children: [
4469
4644
  /* @__PURE__ */ jsx11("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs11("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
4470
4645
  /* @__PURE__ */ jsx11("i", { children: savedStep[item.id] ? "\u2713" : "" }),
4471
4646
  item.label
4472
4647
  ] }, item.id)) }),
4473
4648
  sections[step]
4474
- ] }) : /* @__PURE__ */ jsxs11(Fragment8, { children: [
4649
+ ] }) : /* @__PURE__ */ jsxs11(Fragment9, { children: [
4475
4650
  practiceSection,
4476
4651
  /* @__PURE__ */ jsx11("h3", { className: "mbob-subhead", children: "Locations" }),
4477
4652
  locationsSection,
@@ -4508,7 +4683,7 @@ import {
4508
4683
  DEFAULT_API_BASE_URL,
4509
4684
  DEFAULT_SESSION_ENDPOINT
4510
4685
  } from "@mindbill/browser";
4511
- import { Fragment as Fragment9, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
4686
+ import { Fragment as Fragment10, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
4512
4687
  var DEFAULT_REFRESH_INTERVAL = 6e4;
4513
4688
  async function responseError(response, fallback) {
4514
4689
  const body = await response.json().catch(() => null);
@@ -4729,10 +4904,10 @@ function ConnectedBillStatus({
4729
4904
  }) {
4730
4905
  const status = useBillStatus(options);
4731
4906
  if (status.isLoading && !status.data) {
4732
- return /* @__PURE__ */ jsx12(Fragment9, { children: loadingFallback ?? /* @__PURE__ */ jsx12("div", { role: "status", children: "Loading bill status\u2026" }) });
4907
+ return /* @__PURE__ */ jsx12(Fragment10, { children: loadingFallback ?? /* @__PURE__ */ jsx12("div", { role: "status", children: "Loading bill status\u2026" }) });
4733
4908
  }
4734
4909
  if (status.error && !status.data) {
4735
- return /* @__PURE__ */ jsx12(Fragment9, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs12("div", { role: "alert", children: [
4910
+ return /* @__PURE__ */ jsx12(Fragment10, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs12("div", { role: "alert", children: [
4736
4911
  status.error.message,
4737
4912
  " ",
4738
4913
  /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
@@ -4759,7 +4934,7 @@ function ConnectedBillStatus({
4759
4934
 
4760
4935
  // src/bill-lifecycle-surfaces.tsx
4761
4936
  import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
4762
- import { Fragment as Fragment10, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4937
+ import { Fragment as Fragment11, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4763
4938
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
4764
4939
  return actions.filter((action) => action.enabled || showUnavailable);
4765
4940
  }
@@ -4859,7 +5034,7 @@ function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill hist
4859
5034
  const expandable = Boolean(entry.details);
4860
5035
  const isOpen = expandable && Boolean(expanded[entry.id]);
4861
5036
  const details = entry.details;
4862
- const lineContents = /* @__PURE__ */ jsxs13(Fragment10, { children: [
5037
+ const lineContents = /* @__PURE__ */ jsxs13(Fragment11, { children: [
4863
5038
  /* @__PURE__ */ jsx13("span", { className: "mb-history-date", children: formatDate(entry.date) }),
4864
5039
  /* @__PURE__ */ jsx13("span", { className: "mb-history-action", children: entry.action }),
4865
5040
  /* @__PURE__ */ jsx13("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
@@ -5343,26 +5518,273 @@ var lifecycleSurfaceStyles = `
5343
5518
  import {
5344
5519
  useCallback as useCallback4,
5345
5520
  useEffect as useEffect10,
5346
- useMemo as useMemo8,
5521
+ useMemo as useMemo9,
5347
5522
  useRef as useRef6,
5348
- useState as useState11
5523
+ useState as useState12
5349
5524
  } from "react";
5350
5525
  import {
5351
5526
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
5352
5527
  DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
5353
- SECOND_REVIEW_REASON_TEMPLATE,
5354
5528
  createBillLifecycleClient,
5355
5529
  reportBillStatusContacts,
5356
5530
  secondReviewDeadline
5357
5531
  } from "@mindbill/browser";
5532
+
5533
+ // src/second-review-form.tsx
5534
+ import { useMemo as useMemo8, useState as useState11 } from "react";
5535
+ import { Fragment as Fragment12, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5536
+ var SECOND_REVIEW_REASON_TEMPLATES = [
5537
+ {
5538
+ label: "Med-legal report denied",
5539
+ value: "The attached medical-legal report satisfies the applicable requirements for a compensable medical-legal evaluation. Please reprocess this service and issue payment under the Medical-Legal Fee Schedule."
5540
+ },
5541
+ {
5542
+ label: "Supporting documentation was provided",
5543
+ value: "The EOR incorrectly states that supporting documentation was not received. The original electronic submission included the required documentation and was acknowledged as accepted. Please reprocess this service."
5544
+ },
5545
+ {
5546
+ label: "Payment missing or not received",
5547
+ value: "The EOR reports payment, but the funds have not been received or deposited by the provider. Please issue or reissue payment and pay the remaining fee-schedule balance, including applicable penalty and interest."
5548
+ },
5549
+ {
5550
+ label: "PPO or network reduction unsupported",
5551
+ value: "The EOR applies a PPO or network discount, but the provider has no agreement authorizing this reduction. Please demonstrate entitlement to the contracted rate or reprocess this service under the applicable fee schedule."
5552
+ },
5553
+ {
5554
+ label: "Service was authorized",
5555
+ value: "The billed service was authorized. Please reprocess this service and issue payment; the supporting authorization is included with this request."
5556
+ },
5557
+ {
5558
+ label: "Correct units or modifiers",
5559
+ value: "The units or modifiers on this service have been corrected on the accompanying modified bill. Please reprocess the service using the corrected billing information."
5560
+ },
5561
+ {
5562
+ label: "Fee schedule incorrectly applied",
5563
+ value: "The applicable fee schedule was incorrectly applied to this service. Please recalculate the allowed amount under the governing fee schedule and issue the additional payment due."
5564
+ },
5565
+ {
5566
+ label: "Treatment before liability decision",
5567
+ value: "This service was provided before the claims administrator accepted or denied liability and was authorized under California Labor Code section 5402(c). Please reprocess this service and issue payment."
5568
+ }
5569
+ ];
5570
+ var css10 = `
5571
+ .mbsr{display:grid;gap:18px;color:var(--mb-text);font-family:var(--mb-font)}
5572
+ .mbsr *{box-sizing:border-box}.mbsr h3{margin:0;font-size:22px}.mbsr p{margin:4px 0 0;color:var(--mb-muted)}
5573
+ .mbsr-deadline{padding:12px 14px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-warning) 10%,var(--mb-surface));color:var(--mb-text)!important}
5574
+ .mbsr-template,.mbsr-field{display:grid;gap:6px}.mbsr-label{font-size:13px;font-weight:720}.mbsr-select,.mbsr-textarea{width:100%;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}.mbsr-textarea{min-height:86px;resize:vertical}.mbsr-select:focus,.mbsr-textarea:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 20%,transparent);border-color:var(--mb-accent)}
5575
+ .mbsr-lines{display:grid;gap:10px}.mbsr-line{display:grid;gap:12px;padding:14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface)}.mbsr-line[data-selected=true]{border-color:color-mix(in srgb,var(--mb-accent) 65%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 4%,var(--mb-surface))}.mbsr-line-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.mbsr-check{display:flex;align-items:center;gap:9px;font-weight:750}.mbsr-check input{width:18px;height:18px;accent-color:var(--mb-accent)}.mbsr-metrics{display:flex;gap:14px;color:var(--mb-muted);font-size:12px}.mbsr-auth{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:13px}.mbsr-auth strong{margin-right:4px}.mbsr-auth label{display:flex;align-items:center;gap:5px}.mbsr-auth input{accent-color:var(--mb-accent)}
5576
+ .mbsr-packet{display:grid;gap:10px;padding:0;border:0}.mbsr-packet legend{margin-bottom:8px;font-weight:750}.mbsr-document{display:flex;align-items:center;gap:10px;padding:10px 0;border-top:1px solid var(--mb-border)}.mbsr-document input{width:18px;height:18px;accent-color:var(--mb-accent)}.mbsr-document span{display:grid;min-width:0;flex:1}.mbsr-document small{color:var(--mb-muted)}.mbsr-link{border:0;background:transparent;color:var(--mb-accent);font:inherit;font-weight:700;cursor:pointer}
5577
+ .mbsr-upload{display:grid;place-items:center;min-height:82px;padding:16px;border:1px dashed color-mix(in srgb,var(--mb-accent) 55%,var(--mb-border));border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 3%,var(--mb-surface));cursor:pointer}.mbsr-upload input{position:absolute;width:1px;height:1px;opacity:0}.mbsr-upload strong{color:var(--mb-accent)}
5578
+ .mbsr-uploaded{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius)}
5579
+ .mbsr-error{padding:10px 12px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 10%,transparent);color:var(--mb-danger);font-size:13px}.mbsr-actions{display:flex;justify-content:flex-end;gap:10px}.mbsr-button{min-height:42px;padding:9px 16px;border-radius:var(--mb-control-radius);font:inherit;font-weight:740;cursor:pointer}.mbsr-button.secondary{border:1px solid var(--mb-border);background:var(--mb-surface);color:var(--mb-text)}.mbsr-button.primary{border:0;background:var(--mb-accent);color:var(--mb-accent-contrast)}.mbsr-button:disabled{opacity:.55;cursor:not-allowed}
5580
+ @media(max-width:680px){.mbsr-line-head{align-items:flex-start;flex-direction:column}.mbsr-metrics{flex-wrap:wrap}}
5581
+ `;
5582
+ function money5(value) {
5583
+ return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
5584
+ }
5585
+ function initialLineDrafts(data) {
5586
+ return Object.fromEntries(data.bill.lineItems.flatMap((line) => line.id ? [[line.id, {
5587
+ selected: true,
5588
+ reason: "",
5589
+ serviceAuthorized: ""
5590
+ }]] : []));
5591
+ }
5592
+ function SecondReviewForm({
5593
+ data,
5594
+ submitting = false,
5595
+ error,
5596
+ fetch: fetchOverride,
5597
+ getDeliveryOptions,
5598
+ openAttachment,
5599
+ onCancel,
5600
+ onSubmit
5601
+ }) {
5602
+ const [lines, setLines] = useState11(() => initialLineDrafts(data));
5603
+ const [attachmentIds, setAttachmentIds] = useState11(() => data.bill.attachments.map((attachment) => attachment.id));
5604
+ const [uploads, setUploads] = useState11([]);
5605
+ const [formError, setFormError] = useState11("");
5606
+ const [preparing, setPreparing] = useState11(false);
5607
+ const [delivery, setDelivery] = useState11(null);
5608
+ const selectableLines = useMemo8(() => data.bill.lineItems.filter((line) => Boolean(line.id)), [data.bill.lineItems]);
5609
+ const selected = selectableLines.filter((line) => lines[line.id]?.selected);
5610
+ const invalidReason = selected.some((line) => !lines[line.id]?.reason.trim());
5611
+ const disputedAmount = selected.reduce((sum, line) => sum + Math.max(0, line.charge), 0);
5612
+ const patchLine = (id, patch) => setLines((current) => {
5613
+ const line = current[id];
5614
+ if (!line) return current;
5615
+ return { ...current, [id]: { ...line, ...patch } };
5616
+ });
5617
+ const applyTemplate = (value) => {
5618
+ if (!value) return;
5619
+ setLines((current) => Object.fromEntries(Object.entries(current).map(([id, line]) => [
5620
+ id,
5621
+ line.selected ? { ...line, reason: value } : line
5622
+ ])));
5623
+ };
5624
+ const addUploads = (event) => {
5625
+ const files = Array.from(event.target.files || []);
5626
+ event.target.value = "";
5627
+ if (!files.length) return;
5628
+ const invalid = files.find((file) => file.type !== "application/pdf" && !file.name.toLowerCase().endsWith(".pdf"));
5629
+ if (invalid) {
5630
+ setFormError(`${invalid.name} is not a PDF.`);
5631
+ return;
5632
+ }
5633
+ const oversized = files.find((file) => file.size > 25 * 1024 * 1024);
5634
+ if (oversized) {
5635
+ setFormError(`${oversized.name} is larger than 25 MB.`);
5636
+ return;
5637
+ }
5638
+ setFormError("");
5639
+ setUploads((current) => [...current, ...files.map((file) => ({ file, documentType: "appeal" }))]);
5640
+ };
5641
+ const continueToDelivery = async () => {
5642
+ if (!selected.length) {
5643
+ setFormError("Select at least one service line.");
5644
+ return;
5645
+ }
5646
+ if (invalidReason) {
5647
+ setFormError("Enter a dispute reason for every selected service line.");
5648
+ return;
5649
+ }
5650
+ setPreparing(true);
5651
+ setFormError("");
5652
+ try {
5653
+ setDelivery(await getDeliveryOptions());
5654
+ } catch (cause) {
5655
+ setFormError(cause instanceof Error ? cause.message : "Delivery methods could not be loaded.");
5656
+ } finally {
5657
+ setPreparing(false);
5658
+ }
5659
+ };
5660
+ const submit = async (route) => {
5661
+ setPreparing(true);
5662
+ setFormError("");
5663
+ try {
5664
+ const documents = await prepareBillSubmissionDocuments({
5665
+ attachments: [],
5666
+ selectedIds: [],
5667
+ uploads,
5668
+ ...fetchOverride ? { fetch: fetchOverride } : {}
5669
+ });
5670
+ const lineItems = selected.map((line) => {
5671
+ const draft = lines[line.id];
5672
+ return {
5673
+ lineItemId: line.id,
5674
+ reason: draft.reason.trim(),
5675
+ ...draft.serviceAuthorized === "" ? {} : { serviceAuthorized: draft.serviceAuthorized === "yes" }
5676
+ };
5677
+ });
5678
+ await onSubmit({
5679
+ attachmentIds,
5680
+ documents,
5681
+ disputedAmount,
5682
+ lineItems,
5683
+ ...lineItems[0] ? { reason: lineItems[0].reason } : {},
5684
+ ...route
5685
+ });
5686
+ } catch (cause) {
5687
+ setFormError(cause instanceof Error ? cause.message : "The Second Review could not be submitted.");
5688
+ } finally {
5689
+ setPreparing(false);
5690
+ }
5691
+ };
5692
+ return /* @__PURE__ */ jsxs14(Fragment12, { children: [
5693
+ /* @__PURE__ */ jsx14("style", { children: css10 }),
5694
+ /* @__PURE__ */ jsxs14("section", { className: "mbsr", children: [
5695
+ /* @__PURE__ */ jsxs14("div", { children: [
5696
+ /* @__PURE__ */ jsx14("h3", { children: "Submit Second Review" }),
5697
+ /* @__PURE__ */ jsx14("p", { children: "Select each disputed service and explain why it should be reconsidered." })
5698
+ ] }),
5699
+ /* @__PURE__ */ jsxs14("label", { className: "mbsr-template", children: [
5700
+ /* @__PURE__ */ jsx14("span", { className: "mbsr-label", children: "Apply a saved reason to selected lines" }),
5701
+ /* @__PURE__ */ jsxs14("select", { className: "mbsr-select", defaultValue: "", onChange: (event) => {
5702
+ applyTemplate(event.target.value);
5703
+ event.target.value = "";
5704
+ }, children: [
5705
+ /* @__PURE__ */ jsx14("option", { value: "", children: "Choose a reason template (optional)" }),
5706
+ SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx14("option", { value: template.value, children: template.label }, template.label))
5707
+ ] })
5708
+ ] }),
5709
+ /* @__PURE__ */ jsxs14("section", { className: "mbsr-lines", "aria-label": "Service lines in dispute", children: [
5710
+ selectableLines.map((line) => {
5711
+ const draft = lines[line.id];
5712
+ return /* @__PURE__ */ jsxs14("article", { className: "mbsr-line", "data-selected": draft?.selected, children: [
5713
+ /* @__PURE__ */ jsxs14("div", { className: "mbsr-line-head", children: [
5714
+ /* @__PURE__ */ jsxs14("label", { className: "mbsr-check", children: [
5715
+ /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
5716
+ /* @__PURE__ */ jsxs14("span", { children: [
5717
+ line.code,
5718
+ line.modifiers.length ? `-${line.modifiers.join("-")}` : ""
5719
+ ] })
5720
+ ] }),
5721
+ /* @__PURE__ */ jsxs14("span", { className: "mbsr-metrics", children: [
5722
+ /* @__PURE__ */ jsxs14("span", { children: [
5723
+ line.units,
5724
+ " unit",
5725
+ line.units === 1 ? "" : "s"
5726
+ ] }),
5727
+ /* @__PURE__ */ jsx14("span", { children: money5(line.charge) })
5728
+ ] })
5729
+ ] }),
5730
+ draft?.selected ? /* @__PURE__ */ jsxs14(Fragment12, { children: [
5731
+ /* @__PURE__ */ jsxs14("label", { className: "mbsr-field", children: [
5732
+ /* @__PURE__ */ jsx14("span", { className: "mbsr-label", children: "Reason for requesting Second Review" }),
5733
+ /* @__PURE__ */ jsx14("textarea", { className: "mbsr-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
5734
+ ] }),
5735
+ /* @__PURE__ */ jsxs14("div", { className: "mbsr-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
5736
+ /* @__PURE__ */ jsx14("strong", { children: "Service/Good Authorized?" }),
5737
+ [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs14("label", { children: [
5738
+ /* @__PURE__ */ jsx14("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
5739
+ label
5740
+ ] }, label))
5741
+ ] })
5742
+ ] }) : null
5743
+ ] }, line.id);
5744
+ }),
5745
+ !selectableLines.length ? /* @__PURE__ */ jsx14("div", { className: "mbsr-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
5746
+ ] }),
5747
+ /* @__PURE__ */ jsxs14("fieldset", { className: "mbsr-packet", children: [
5748
+ /* @__PURE__ */ jsx14("legend", { children: "Supporting packet" }),
5749
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs14("label", { className: "mbsr-document", children: [
5750
+ /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
5751
+ /* @__PURE__ */ jsxs14("span", { children: [
5752
+ /* @__PURE__ */ jsx14("strong", { children: attachment.filename }),
5753
+ /* @__PURE__ */ jsx14("small", { children: attachment.description || attachment.documentType })
5754
+ ] }),
5755
+ /* @__PURE__ */ jsx14("button", { className: "mbsr-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
5756
+ ] }, attachment.id)),
5757
+ /* @__PURE__ */ jsxs14("label", { className: "mbsr-upload", children: [
5758
+ /* @__PURE__ */ jsx14("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
5759
+ /* @__PURE__ */ jsxs14("span", { children: [
5760
+ /* @__PURE__ */ jsx14("strong", { children: "Choose one or more PDF files" }),
5761
+ " to attach"
5762
+ ] })
5763
+ ] }),
5764
+ uploads.map((upload, index) => /* @__PURE__ */ jsxs14("div", { className: "mbsr-uploaded", children: [
5765
+ /* @__PURE__ */ jsx14("span", { children: upload.file.name }),
5766
+ /* @__PURE__ */ jsx14("button", { className: "mbsr-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
5767
+ ] }, `${upload.file.name}-${index}`))
5768
+ ] }),
5769
+ formError || error?.message ? /* @__PURE__ */ jsx14("div", { className: "mbsr-error", role: "alert", children: formError || error?.message }) : null,
5770
+ /* @__PURE__ */ jsxs14("div", { className: "mbsr-actions", children: [
5771
+ /* @__PURE__ */ jsx14("button", { className: "mbsr-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
5772
+ /* @__PURE__ */ jsx14("button", { className: "mbsr-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
5773
+ ] })
5774
+ ] }),
5775
+ delivery ? /* @__PURE__ */ jsx14(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
5776
+ ] });
5777
+ }
5778
+
5779
+ // src/connected-bill-lifecycle.tsx
5358
5780
  import {
5359
- SECOND_REVIEW_REASON_TEMPLATE as SECOND_REVIEW_REASON_TEMPLATE2,
5781
+ SECOND_REVIEW_REASON_TEMPLATE,
5360
5782
  SECOND_REVIEW_WINDOW_DAYS,
5361
5783
  createBillLifecycleClient as createBillLifecycleClient2,
5362
5784
  reportBillStatusContacts as reportBillStatusContacts2,
5363
5785
  secondReviewDeadline as secondReviewDeadline2
5364
5786
  } from "@mindbill/browser";
5365
- import { Fragment as Fragment11, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5787
+ import { Fragment as Fragment13, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5366
5788
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
5367
5789
  function reservePreviewWindow() {
5368
5790
  const preview = window.open("about:blank", "_blank");
@@ -5404,13 +5826,13 @@ function useBillLifecycle({
5404
5826
  enabled = true,
5405
5827
  fetch: fetchOverride
5406
5828
  }) {
5407
- const [data, setData] = useState11(null);
5408
- const [error, setError] = useState11(null);
5409
- const [isLoading, setIsLoading] = useState11(enabled);
5410
- const [isRefreshing, setIsRefreshing] = useState11(false);
5411
- const [isMutating, setIsMutating] = useState11(false);
5829
+ const [data, setData] = useState12(null);
5830
+ const [error, setError] = useState12(null);
5831
+ const [isLoading, setIsLoading] = useState12(enabled);
5832
+ const [isRefreshing, setIsRefreshing] = useState12(false);
5833
+ const [isMutating, setIsMutating] = useState12(false);
5412
5834
  const mounted = useRef6(true);
5413
- const client = useMemo8(() => createBillLifecycleClient({
5835
+ const client = useMemo9(() => createBillLifecycleClient({
5414
5836
  billId: providedBillId,
5415
5837
  sessionEndpoint,
5416
5838
  getSession,
@@ -5528,8 +5950,8 @@ function LifecycleDialog({ children, title, wide = false, onClose }) {
5528
5950
  previous?.focus();
5529
5951
  };
5530
5952
  }, []);
5531
- return /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs14("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
5532
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
5953
+ return /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs15("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
5954
+ /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
5533
5955
  children
5534
5956
  ] }) });
5535
5957
  }
@@ -5568,22 +5990,22 @@ function correctionRejectionSummary(rejection) {
5568
5990
  function CorrectionRejectionReason({ rejection }) {
5569
5991
  const summary = correctionRejectionSummary(rejection);
5570
5992
  const details = rejection.issues?.filter((issue) => issue.description.trim() !== summary.description || Boolean(issue.code?.trim() && issue.code.trim() !== summary.code)) ?? [];
5571
- return /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
5572
- summary.code ? /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-correction-reason-code", children: [
5573
- /* @__PURE__ */ jsx14("span", { children: "Rejection code" }),
5574
- /* @__PURE__ */ jsx14("code", { children: summary.code }),
5575
- summary.clearinghouseDetail ? /* @__PURE__ */ jsxs14("small", { children: [
5576
- /* @__PURE__ */ jsx14("span", { children: "Clearinghouse detail" }),
5993
+ return /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
5994
+ summary.code ? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-correction-reason-code", children: [
5995
+ /* @__PURE__ */ jsx15("span", { children: "Rejection code" }),
5996
+ /* @__PURE__ */ jsx15("code", { children: summary.code }),
5997
+ summary.clearinghouseDetail ? /* @__PURE__ */ jsxs15("small", { children: [
5998
+ /* @__PURE__ */ jsx15("span", { children: "Clearinghouse detail" }),
5577
5999
  summary.clearinghouseDetail
5578
6000
  ] }) : null
5579
6001
  ] }) : null,
5580
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-correction-reason-description", children: [
5581
- /* @__PURE__ */ jsx14("span", { children: "Reason" }),
5582
- /* @__PURE__ */ jsx14("strong", { children: summary.description })
6002
+ /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-correction-reason-description", children: [
6003
+ /* @__PURE__ */ jsx15("span", { children: "Reason" }),
6004
+ /* @__PURE__ */ jsx15("strong", { children: summary.description })
5583
6005
  ] }),
5584
- details.length ? /* @__PURE__ */ jsx14("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs14("li", { children: [
5585
- issue.code ? /* @__PURE__ */ jsx14("code", { children: issue.code }) : null,
5586
- /* @__PURE__ */ jsx14("span", { children: issue.description })
6006
+ details.length ? /* @__PURE__ */ jsx15("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs15("li", { children: [
6007
+ issue.code ? /* @__PURE__ */ jsx15("code", { children: issue.code }) : null,
6008
+ /* @__PURE__ */ jsx15("span", { children: issue.description })
5587
6009
  ] }, `${issue.code || "issue"}-${index}`)) }) : null
5588
6010
  ] });
5589
6011
  }
@@ -5624,16 +6046,16 @@ function CorrectionVerificationContact({ delivery }) {
5624
6046
  { label: "Mail", values: mailingAddresses }
5625
6047
  ].filter((method) => method.values.length);
5626
6048
  if (!methods.length) return null;
5627
- return /* @__PURE__ */ jsxs14("aside", { className: "mb-lifecycle-correction-contact", children: [
5628
- /* @__PURE__ */ jsx14("strong", { children: "Need to verify the rejected information?" }),
5629
- /* @__PURE__ */ jsxs14("span", { children: [
6049
+ return /* @__PURE__ */ jsxs15("aside", { className: "mb-lifecycle-correction-contact", children: [
6050
+ /* @__PURE__ */ jsx15("strong", { children: "Need to verify the rejected information?" }),
6051
+ /* @__PURE__ */ jsxs15("span", { children: [
5630
6052
  "Contact ",
5631
6053
  delivery.payerName,
5632
6054
  " using any available method:"
5633
6055
  ] }),
5634
- /* @__PURE__ */ jsx14("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs14("div", { children: [
5635
- /* @__PURE__ */ jsx14("dt", { children: method.label }),
5636
- /* @__PURE__ */ jsx14("dd", { children: /* @__PURE__ */ jsx14("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx14("li", { children: method.href ? /* @__PURE__ */ jsx14("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
6056
+ /* @__PURE__ */ jsx15("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs15("div", { children: [
6057
+ /* @__PURE__ */ jsx15("dt", { children: method.label }),
6058
+ /* @__PURE__ */ jsx15("dd", { children: /* @__PURE__ */ jsx15("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx15("li", { children: method.href ? /* @__PURE__ */ jsx15("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
5637
6059
  ] }, method.label)) })
5638
6060
  ] });
5639
6061
  }
@@ -5749,21 +6171,19 @@ function shouldShowSandboxControls(environment, enabled = false) {
5749
6171
  function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint, claimsAdministratorSources, sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
5750
6172
  const lifecycle = useBillLifecycle(options);
5751
6173
  const { data } = lifecycle;
5752
- const [tab, setTab] = useState11("details");
5753
- const [selectedSubmissionId, setSelectedSubmissionId] = useState11();
5754
- const [panel, setPanel] = useState11("");
5755
- const [notice, setNotice] = useState11("");
5756
- const [reason, setReason] = useState11("");
5757
- const [correctionError, setCorrectionError] = useState11("");
5758
- const [newBillError, setNewBillError] = useState11("");
5759
- const [payment, setPayment] = useState11({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
5760
- const [review, setReview] = useState11({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
5761
- const [duplicateDelivery, setDuplicateDelivery] = useState11(null);
5762
- const [duplicateDeliveryError, setDuplicateDeliveryError] = useState11("");
6174
+ const [tab, setTab] = useState12("details");
6175
+ const [selectedSubmissionId, setSelectedSubmissionId] = useState12();
6176
+ const [panel, setPanel] = useState12("");
6177
+ const [notice, setNotice] = useState12("");
6178
+ const [reason, setReason] = useState12("");
6179
+ const [correctionError, setCorrectionError] = useState12("");
6180
+ const [newBillError, setNewBillError] = useState12("");
6181
+ const [payment, setPayment] = useState12({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
6182
+ const [duplicateError, setDuplicateError] = useState12("");
5763
6183
  const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
5764
6184
  const lastData = useRef6(null);
5765
- const correctionInitialBill = useMemo8(() => data ? correctionBill(data) : null, [data]);
5766
- const correctionAttachments = useMemo8(() => data ? data.bill.attachments.map((attachment) => {
6185
+ const correctionInitialBill = useMemo9(() => data ? correctionBill(data) : null, [data]);
6186
+ const correctionAttachments = useMemo9(() => data ? data.bill.attachments.map((attachment) => {
5767
6187
  const documentType = correctionDocumentType(attachment.documentType);
5768
6188
  const isW9 = documentType === "w9";
5769
6189
  return {
@@ -5776,7 +6196,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
5776
6196
  ...isW9 ? { autoAttached: true, removable: false } : { removable: true }
5777
6197
  };
5778
6198
  }) : [], [data, lifecycle]);
5779
- const correctionAttentionFields = useMemo8(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
6199
+ const correctionAttentionFields = useMemo9(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
5780
6200
  useEffect10(() => {
5781
6201
  if (!data || data === lastData.current) return;
5782
6202
  lastData.current = data;
@@ -5788,19 +6208,14 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
5788
6208
  penaltyAmount: 0,
5789
6209
  interestAmount: 0
5790
6210
  }));
5791
- setReview((current) => ({
5792
- ...current,
5793
- disputedAmount: current.disputedAmount ?? data.bill.balanceDue,
5794
- attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
5795
- }));
5796
6211
  }, [data, onChanged]);
5797
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx14(Fragment11, { children: loadingFallback ?? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
6212
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx15(Fragment13, { children: loadingFallback ?? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
5798
6213
  if (!data) {
5799
6214
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
5800
- return /* @__PURE__ */ jsx14(Fragment11, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-error", role: "alert", children: [
5801
- /* @__PURE__ */ jsx14("strong", { children: "Billing is unavailable." }),
5802
- /* @__PURE__ */ jsx14("span", { children: error.message }),
5803
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
6215
+ return /* @__PURE__ */ jsx15(Fragment13, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-error", role: "alert", children: [
6216
+ /* @__PURE__ */ jsx15("strong", { children: "Billing is unavailable." }),
6217
+ /* @__PURE__ */ jsx15("span", { children: error.message }),
6218
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
5804
6219
  ] }) });
5805
6220
  }
5806
6221
  const complete = async (message, task) => {
@@ -5869,10 +6284,31 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
5869
6284
  setReason("");
5870
6285
  setNotice("New bill submitted.");
5871
6286
  };
5872
- const loadDuplicateDelivery = () => {
5873
- setDuplicateDeliveryError("");
5874
- if (duplicateDelivery) return;
5875
- lifecycle.getDeliveryOptions().then((options2) => setDuplicateDelivery(options2)).catch((cause) => setDuplicateDeliveryError(cause instanceof Error ? cause.message : "Delivery options could not be loaded."));
6287
+ const submitDuplicateFromForm = async (value) => {
6288
+ setNotice("");
6289
+ setDuplicateError("");
6290
+ try {
6291
+ const documents = await prepareBillSubmissionDocuments({
6292
+ attachments: correctionAttachments,
6293
+ selectedIds: value.sourceAttachmentIds,
6294
+ reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
6295
+ uploads: value.uploads,
6296
+ ...options.fetch ? { fetch: options.fetch } : {}
6297
+ });
6298
+ await lifecycle.sendDuplicateBill({
6299
+ bill: value.bill,
6300
+ ...value.submission ? { submission: value.submission } : {},
6301
+ ...documents.length ? { documents } : {},
6302
+ ...actor
6303
+ });
6304
+ } catch (cause) {
6305
+ setDuplicateError(
6306
+ cause instanceof Error && cause.message ? cause.message : "The duplicate bill could not be submitted."
6307
+ );
6308
+ throw cause;
6309
+ }
6310
+ setPanel("");
6311
+ setNotice("Duplicate bill sent.");
5876
6312
  };
5877
6313
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
5878
6314
  const supportedActions = /* @__PURE__ */ new Set(["resubmit", "submit_new_bill", "second_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
@@ -5886,74 +6322,73 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
5886
6322
  const statusContacts = reportBillStatusContacts(data.delivery);
5887
6323
  const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
5888
6324
  const reviewDeadline = secondReviewDeadline(data.eors);
5889
- return /* @__PURE__ */ jsxs14("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
5890
- /* @__PURE__ */ jsx14("style", { children: CONNECTED_LIFECYCLE_STYLES }),
5891
- ribbonItems.length >= 2 ? /* @__PURE__ */ jsx14(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
6325
+ return /* @__PURE__ */ jsxs15("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
6326
+ /* @__PURE__ */ jsx15("style", { children: CONNECTED_LIFECYCLE_STYLES }),
6327
+ ribbonItems.length >= 2 ? /* @__PURE__ */ jsx15(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
5892
6328
  setSelectedSubmissionId(item.id);
5893
6329
  setTab("history");
5894
6330
  }, ...appearance ? { appearance } : {} }) : null,
5895
- data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx14(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx14(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
5896
- /* @__PURE__ */ jsxs14("header", { className: "mb-lifecycle-head", children: [
5897
- /* @__PURE__ */ jsxs14("div", { children: [
5898
- /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs14("h2", { children: [
6331
+ data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx15(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx15(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
6332
+ /* @__PURE__ */ jsxs15("header", { className: "mb-lifecycle-head", children: [
6333
+ /* @__PURE__ */ jsxs15("div", { children: [
6334
+ /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs15("h2", { children: [
5899
6335
  "Bill #",
5900
6336
  data.bill.billNumber
5901
6337
  ] }) }),
5902
- /* @__PURE__ */ jsxs14("p", { children: [
6338
+ /* @__PURE__ */ jsxs15("p", { children: [
5903
6339
  "Claim ",
5904
6340
  data.injury.claimNumber || "\u2014",
5905
6341
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
5906
6342
  ] })
5907
6343
  ] }),
5908
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
6344
+ /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
5909
6345
  ] }),
5910
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
5911
- /* @__PURE__ */ jsx14("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
5912
- /* @__PURE__ */ jsx14("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
6346
+ /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
6347
+ /* @__PURE__ */ jsx15("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
6348
+ /* @__PURE__ */ jsx15("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
5913
6349
  ] }),
5914
- tab === "details" ? /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
5915
- data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx14(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
5916
- showSandboxControls ? /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
5917
- /* @__PURE__ */ jsxs14("div", { children: [
5918
- /* @__PURE__ */ jsx14("span", { children: "Sandbox demo controls" }),
5919
- /* @__PURE__ */ jsx14("h3", { children: "Simulate the next payer response" }),
5920
- /* @__PURE__ */ jsx14("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
6350
+ tab === "details" ? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
6351
+ data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx15(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
6352
+ showSandboxControls ? /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
6353
+ /* @__PURE__ */ jsxs15("div", { children: [
6354
+ /* @__PURE__ */ jsx15("span", { children: "Sandbox demo controls" }),
6355
+ /* @__PURE__ */ jsx15("h3", { children: "Simulate the next payer response" }),
6356
+ /* @__PURE__ */ jsx15("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
5921
6357
  ] }),
5922
- simulations.length ? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs14("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
5923
- /* @__PURE__ */ jsx14("strong", { children: scenario.label }),
5924
- /* @__PURE__ */ jsx14("span", { children: scenario.detail })
5925
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx14("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
6358
+ simulations.length ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs15("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
6359
+ /* @__PURE__ */ jsx15("strong", { children: scenario.label }),
6360
+ /* @__PURE__ */ jsx15("span", { children: scenario.detail })
6361
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx15("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
5926
6362
  ] }) : null,
5927
- /* @__PURE__ */ jsx14(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
5928
- ] }) : /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx14(BillHistoryTable, { entries: data.history, ...selectedHistoryEntryId ? { selectedEntryId: selectedHistoryEntryId } : {}, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx14(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
5929
- viewEor || actions.length ? /* @__PURE__ */ jsxs14("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
5930
- viewEor && data.eors[0] ? /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
5931
- actions.map((action) => /* @__PURE__ */ jsx14("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
6363
+ /* @__PURE__ */ jsx15(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
6364
+ ] }) : /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx15(BillHistoryTable, { entries: data.history, ...selectedHistoryEntryId ? { selectedEntryId: selectedHistoryEntryId } : {}, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx15(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
6365
+ viewEor || actions.length ? /* @__PURE__ */ jsxs15("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
6366
+ viewEor && data.eors[0] ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
6367
+ actions.map((action) => /* @__PURE__ */ jsx15("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
5932
6368
  const next = actionPanel(action);
5933
6369
  if (!next) return;
5934
6370
  if (next === "resubmit") setCorrectionError("");
5935
6371
  if (next === "submit_new_bill") setNewBillError("");
5936
- if (next === "send_duplicate") loadDuplicateDelivery();
5937
- if (next === "second_review") setReview((current) => current.reason.trim() ? current : { ...current, reason: SECOND_REVIEW_REASON_TEMPLATE });
6372
+ if (next === "send_duplicate") setDuplicateError("");
5938
6373
  setPanel(next);
5939
6374
  }, children: action.label }, action.id))
5940
6375
  ] }) : null,
5941
- panel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx14(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-correction", children: [
5942
- /* @__PURE__ */ jsx14("header", { children: /* @__PURE__ */ jsxs14("div", { children: [
5943
- /* @__PURE__ */ jsx14("h3", { children: "Correct and resubmit" }),
5944
- /* @__PURE__ */ jsx14("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
6376
+ panel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx15(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-correction", children: [
6377
+ /* @__PURE__ */ jsx15("header", { children: /* @__PURE__ */ jsxs15("div", { children: [
6378
+ /* @__PURE__ */ jsx15("h3", { children: "Correct and resubmit" }),
6379
+ /* @__PURE__ */ jsx15("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
5945
6380
  ] }) }),
5946
- data.environment === "live" ? /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-live-warning", children: [
5947
- /* @__PURE__ */ jsx14("strong", { children: "Live clearinghouse submission" }),
5948
- /* @__PURE__ */ jsx14("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
6381
+ data.environment === "live" ? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-live-warning", children: [
6382
+ /* @__PURE__ */ jsx15("strong", { children: "Live clearinghouse submission" }),
6383
+ /* @__PURE__ */ jsx15("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
5949
6384
  ] }) : null,
5950
- data.rejection ? /* @__PURE__ */ jsx14(CorrectionRejectionReason, { rejection: data.rejection }) : null,
5951
- /* @__PURE__ */ jsx14(CorrectionVerificationContact, { delivery: data.delivery }),
5952
- /* @__PURE__ */ jsxs14("label", { className: "mb-lifecycle-correction-note", children: [
5953
- /* @__PURE__ */ jsx14("span", { children: "Correction note (optional)" }),
5954
- /* @__PURE__ */ jsx14("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
6385
+ data.rejection ? /* @__PURE__ */ jsx15(CorrectionRejectionReason, { rejection: data.rejection }) : null,
6386
+ /* @__PURE__ */ jsx15(CorrectionVerificationContact, { delivery: data.delivery }),
6387
+ /* @__PURE__ */ jsxs15("label", { className: "mb-lifecycle-correction-note", children: [
6388
+ /* @__PURE__ */ jsx15("span", { children: "Correction note (optional)" }),
6389
+ /* @__PURE__ */ jsx15("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
5955
6390
  ] }),
5956
- /* @__PURE__ */ jsx14(
6391
+ /* @__PURE__ */ jsx15(
5957
6392
  BillSubmissionForm,
5958
6393
  {
5959
6394
  className: "mbsf-lifecycle-correction",
@@ -5979,18 +6414,18 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
5979
6414
  ...appearance ? { appearance } : {}
5980
6415
  }
5981
6416
  ),
5982
- correctionError ? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
6417
+ correctionError ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
5983
6418
  ] }) }) : null,
5984
- panel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx14(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-correction", children: [
5985
- /* @__PURE__ */ jsx14("header", { children: /* @__PURE__ */ jsxs14("div", { children: [
5986
- /* @__PURE__ */ jsx14("h3", { children: "Submit New Bill" }),
5987
- /* @__PURE__ */ jsx14("p", { children: "This closed bill stays closed and keeps its record. Review the carried-over snapshot below and submit a fresh bill \u2014 both bills stay linked in the submissions timeline." })
6419
+ panel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx15(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-correction", children: [
6420
+ /* @__PURE__ */ jsx15("header", { children: /* @__PURE__ */ jsxs15("div", { children: [
6421
+ /* @__PURE__ */ jsx15("h3", { children: "Submit New Bill" }),
6422
+ /* @__PURE__ */ jsx15("p", { children: "This closed bill stays closed and keeps its record. Review the carried-over snapshot below and submit a fresh bill \u2014 both bills stay linked in the submissions timeline." })
5988
6423
  ] }) }),
5989
- /* @__PURE__ */ jsxs14("label", { className: "mb-lifecycle-correction-note", children: [
5990
- /* @__PURE__ */ jsx14("span", { children: "Submission note (optional)" }),
5991
- /* @__PURE__ */ jsx14("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
6424
+ /* @__PURE__ */ jsxs15("label", { className: "mb-lifecycle-correction-note", children: [
6425
+ /* @__PURE__ */ jsx15("span", { children: "Submission note (optional)" }),
6426
+ /* @__PURE__ */ jsx15("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
5992
6427
  ] }),
5993
- /* @__PURE__ */ jsx14(
6428
+ /* @__PURE__ */ jsx15(
5994
6429
  BillSubmissionForm,
5995
6430
  {
5996
6431
  className: "mbsf-lifecycle-correction",
@@ -6015,146 +6450,135 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6015
6450
  ...appearance ? { appearance } : {}
6016
6451
  }
6017
6452
  ),
6018
- newBillError ? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
6453
+ newBillError ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
6019
6454
  ] }) }) : null,
6020
- panel === "second_review" ? /* @__PURE__ */ jsx14(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-panel", children: [
6021
- /* @__PURE__ */ jsxs14("div", { children: [
6022
- /* @__PURE__ */ jsx14("h3", { children: "Submit Second Review" }),
6023
- /* @__PURE__ */ jsx14("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
6024
- ] }),
6025
- reviewDeadline ? /* @__PURE__ */ jsxs14("p", { className: "mb-lifecycle-deadline-hint", children: [
6455
+ panel === "second_review" ? /* @__PURE__ */ jsxs15(LifecycleDialog, { title: "Submit Second Review", wide: true, onClose: () => setPanel(""), children: [
6456
+ /* @__PURE__ */ jsx15(
6457
+ SecondReviewForm,
6458
+ {
6459
+ data,
6460
+ submitting: lifecycle.isMutating,
6461
+ error: lifecycle.error,
6462
+ ...options.fetch ? { fetch: options.fetch } : {},
6463
+ getDeliveryOptions: lifecycle.getDeliveryOptions,
6464
+ openAttachment: lifecycle.openAttachment,
6465
+ onCancel: () => setPanel(""),
6466
+ onSubmit: (input) => complete("Second Review submitted.", () => lifecycle.submitSecondReview({ ...input, ...actor }))
6467
+ }
6468
+ ),
6469
+ reviewDeadline ? /* @__PURE__ */ jsxs15("p", { className: "mb-lifecycle-deadline-hint", children: [
6026
6470
  "Second Review must be requested within 90 days of the denial EOR (dated ",
6027
6471
  usDate(reviewDeadline.eorDate),
6028
6472
  ") \u2014 file by ",
6029
- /* @__PURE__ */ jsx14("strong", { children: usDate(reviewDeadline.deadline) }),
6473
+ /* @__PURE__ */ jsx15("strong", { children: usDate(reviewDeadline.deadline) }),
6030
6474
  "."
6031
- ] }) : null,
6032
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-fields two", children: [
6033
- /* @__PURE__ */ jsxs14("label", { className: "full", children: [
6034
- /* @__PURE__ */ jsx14("span", { children: "Reason" }),
6035
- /* @__PURE__ */ jsx14("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
6036
- ] }),
6037
- /* @__PURE__ */ jsxs14("label", { children: [
6038
- /* @__PURE__ */ jsx14("span", { children: "Payer claim control number" }),
6039
- /* @__PURE__ */ jsx14("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
6040
- ] }),
6041
- /* @__PURE__ */ jsxs14("label", { children: [
6042
- /* @__PURE__ */ jsx14("span", { children: "Disputed amount" }),
6043
- /* @__PURE__ */ jsx14("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 })) })
6044
- ] }),
6045
- /* @__PURE__ */ jsxs14("label", { children: [
6046
- /* @__PURE__ */ jsx14("span", { children: "Send via" }),
6047
- /* @__PURE__ */ jsxs14("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
6048
- /* @__PURE__ */ jsx14("option", { value: "ebill", children: "E-bill" }),
6049
- /* @__PURE__ */ jsx14("option", { value: "fax", children: "Fax" }),
6050
- /* @__PURE__ */ jsx14("option", { value: "mail", children: "Mail" }),
6051
- /* @__PURE__ */ jsx14("option", { value: "email", children: "Email" })
6052
- ] })
6053
- ] })
6054
- ] }),
6055
- /* @__PURE__ */ jsxs14("fieldset", { className: "mb-lifecycle-packet", children: [
6056
- /* @__PURE__ */ jsx14("legend", { children: "Supporting packet" }),
6057
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs14("label", { children: [
6058
- /* @__PURE__ */ jsx14("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) })) }),
6059
- /* @__PURE__ */ jsxs14("span", { children: [
6060
- /* @__PURE__ */ jsx14("strong", { children: attachment.filename }),
6061
- /* @__PURE__ */ jsx14("small", { children: attachment.description || attachment.documentType })
6062
- ] }),
6063
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
6064
- ] }, attachment.id))
6065
- ] }),
6066
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-panel-actions", children: [
6067
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6068
- /* @__PURE__ */ jsx14("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, ...actor })), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
6069
- ] })
6070
- ] }) }) : null,
6071
- panel === "payment" ? /* @__PURE__ */ jsx14(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-panel", children: [
6072
- /* @__PURE__ */ jsxs14("div", { children: [
6073
- /* @__PURE__ */ jsx14("h3", { children: "Post payment" }),
6074
- /* @__PURE__ */ jsx14("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
6475
+ ] }) : null
6476
+ ] }) : null,
6477
+ panel === "payment" ? /* @__PURE__ */ jsx15(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-panel", children: [
6478
+ /* @__PURE__ */ jsxs15("div", { children: [
6479
+ /* @__PURE__ */ jsx15("h3", { children: "Post payment" }),
6480
+ /* @__PURE__ */ jsx15("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
6075
6481
  ] }),
6076
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-fields two", children: [
6077
- /* @__PURE__ */ jsxs14("label", { children: [
6078
- /* @__PURE__ */ jsx14("span", { children: "Amount applied to bill" }),
6079
- /* @__PURE__ */ jsx14("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) })) })
6482
+ /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-fields two", children: [
6483
+ /* @__PURE__ */ jsxs15("label", { children: [
6484
+ /* @__PURE__ */ jsx15("span", { children: "Amount applied to bill" }),
6485
+ /* @__PURE__ */ jsx15("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) })) })
6080
6486
  ] }),
6081
- /* @__PURE__ */ jsxs14("label", { children: [
6082
- /* @__PURE__ */ jsx14("span", { children: "Penalty" }),
6083
- /* @__PURE__ */ jsx14("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
6487
+ /* @__PURE__ */ jsxs15("label", { children: [
6488
+ /* @__PURE__ */ jsx15("span", { children: "Penalty" }),
6489
+ /* @__PURE__ */ jsx15("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
6084
6490
  ] }),
6085
- /* @__PURE__ */ jsxs14("label", { children: [
6086
- /* @__PURE__ */ jsx14("span", { children: "Interest" }),
6087
- /* @__PURE__ */ jsx14("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
6491
+ /* @__PURE__ */ jsxs15("label", { children: [
6492
+ /* @__PURE__ */ jsx15("span", { children: "Interest" }),
6493
+ /* @__PURE__ */ jsx15("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
6088
6494
  ] }),
6089
- /* @__PURE__ */ jsxs14("label", { children: [
6090
- /* @__PURE__ */ jsx14("span", { children: "Method" }),
6091
- /* @__PURE__ */ jsxs14("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
6092
- /* @__PURE__ */ jsx14("option", { value: "check", children: "Check" }),
6093
- /* @__PURE__ */ jsx14("option", { value: "eft", children: "EFT" })
6495
+ /* @__PURE__ */ jsxs15("label", { children: [
6496
+ /* @__PURE__ */ jsx15("span", { children: "Method" }),
6497
+ /* @__PURE__ */ jsxs15("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
6498
+ /* @__PURE__ */ jsx15("option", { value: "check", children: "Check" }),
6499
+ /* @__PURE__ */ jsx15("option", { value: "eft", children: "EFT" })
6094
6500
  ] })
6095
6501
  ] }),
6096
- /* @__PURE__ */ jsxs14("label", { children: [
6097
- /* @__PURE__ */ jsx14("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
6098
- /* @__PURE__ */ jsx14("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
6502
+ /* @__PURE__ */ jsxs15("label", { children: [
6503
+ /* @__PURE__ */ jsx15("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
6504
+ /* @__PURE__ */ jsx15("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
6099
6505
  ] }),
6100
- /* @__PURE__ */ jsxs14("label", { children: [
6101
- /* @__PURE__ */ jsx14("span", { children: "Deposit date" }),
6102
- /* @__PURE__ */ jsx14("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
6506
+ /* @__PURE__ */ jsxs15("label", { children: [
6507
+ /* @__PURE__ */ jsx15("span", { children: "Deposit date" }),
6508
+ /* @__PURE__ */ jsx15("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
6103
6509
  ] }),
6104
- /* @__PURE__ */ jsxs14("label", { className: "full", children: [
6105
- /* @__PURE__ */ jsx14("span", { children: "Note (optional)" }),
6106
- /* @__PURE__ */ jsx14("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
6510
+ /* @__PURE__ */ jsxs15("label", { className: "full", children: [
6511
+ /* @__PURE__ */ jsx15("span", { children: "Note (optional)" }),
6512
+ /* @__PURE__ */ jsx15("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
6107
6513
  ] })
6108
6514
  ] }),
6109
- /* @__PURE__ */ jsxs14("div", { className: "mb-payment-total", children: [
6110
- /* @__PURE__ */ jsx14("span", { children: "Total received" }),
6111
- /* @__PURE__ */ jsx14("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
6515
+ /* @__PURE__ */ jsxs15("div", { className: "mb-payment-total", children: [
6516
+ /* @__PURE__ */ jsx15("span", { children: "Total received" }),
6517
+ /* @__PURE__ */ jsx15("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
6112
6518
  ] }),
6113
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-panel-actions", children: [
6114
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6115
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || (payment.penaltyAmount ?? 0) < 0 || (payment.interestAmount ?? 0) < 0 || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment({ ...payment, ...actor })), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
6519
+ /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-panel-actions", children: [
6520
+ /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6521
+ /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || payment.amount <= 0 || payment.amount > data.bill.balanceDue || (payment.penaltyAmount ?? 0) < 0 || (payment.interestAmount ?? 0) < 0 || !payment.depositDate, onClick: () => void complete("Payment posted.", () => lifecycle.postPayment({ ...payment, ...actor })), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
6116
6522
  ] })
6117
6523
  ] }) }) : null,
6118
- panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx14(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-panel", children: [
6119
- /* @__PURE__ */ jsxs14("div", { children: [
6120
- /* @__PURE__ */ jsx14("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
6121
- /* @__PURE__ */ jsx14("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
6524
+ panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx15(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-panel", children: [
6525
+ /* @__PURE__ */ jsxs15("div", { children: [
6526
+ /* @__PURE__ */ jsx15("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
6527
+ /* @__PURE__ */ jsx15("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
6122
6528
  ] }),
6123
- /* @__PURE__ */ jsxs14("label", { children: [
6124
- /* @__PURE__ */ jsx14("span", { children: "Reason" }),
6125
- /* @__PURE__ */ jsx14("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
6529
+ /* @__PURE__ */ jsxs15("label", { children: [
6530
+ /* @__PURE__ */ jsx15("span", { children: "Reason" }),
6531
+ /* @__PURE__ */ jsx15("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
6126
6532
  ] }),
6127
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-panel-actions", children: [
6128
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6129
- /* @__PURE__ */ jsx14("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, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
6533
+ /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-panel-actions", children: [
6534
+ /* @__PURE__ */ jsx15("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6535
+ /* @__PURE__ */ jsx15("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, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
6130
6536
  ] })
6131
6537
  ] }) }) : null,
6132
- panel === "send_duplicate" ? duplicateDelivery ? /* @__PURE__ */ jsx14(
6133
- SendRouteDialog,
6134
- {
6135
- title: "Send duplicate bill",
6136
- delivery: duplicateDelivery,
6137
- submitting: lifecycle.isMutating,
6138
- error: lifecycle.error?.message ?? null,
6139
- onCancel: () => setPanel(""),
6140
- onConfirm: (submission) => void complete("Duplicate bill sent.", () => lifecycle.sendDuplicateBill({ ...submission, ...actor }))
6141
- }
6142
- ) : /* @__PURE__ */ jsx14(LifecycleDialog, { title: "Send duplicate bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs14("section", { className: "mb-lifecycle-panel", children: [
6143
- /* @__PURE__ */ jsxs14("div", { children: [
6144
- /* @__PURE__ */ jsx14("h3", { children: "Send duplicate bill" }),
6145
- /* @__PURE__ */ jsx14("p", { children: duplicateDeliveryError || "Loading delivery options\u2026" })
6146
- ] }),
6147
- /* @__PURE__ */ jsxs14("div", { className: "mb-lifecycle-panel-actions", children: [
6148
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
6149
- duplicateDeliveryError ? /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button primary", onClick: loadDuplicateDelivery, children: "Try again" }) : null
6150
- ] })
6538
+ panel === "send_duplicate" && correctionInitialBill ? /* @__PURE__ */ jsx15(LifecycleDialog, { title: "Send duplicate bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs15("section", { className: "mb-lifecycle-correction", children: [
6539
+ /* @__PURE__ */ jsx15("header", { children: /* @__PURE__ */ jsxs15("div", { children: [
6540
+ /* @__PURE__ */ jsx15("h3", { children: "Send duplicate bill" }),
6541
+ /* @__PURE__ */ jsx15("p", { children: "Review and edit any bill field before creating a duplicate submission. The original bill and its history stay unchanged." })
6542
+ ] }) }),
6543
+ data.environment === "live" ? /* @__PURE__ */ jsxs15("div", { className: "mb-lifecycle-live-warning", children: [
6544
+ /* @__PURE__ */ jsx15("strong", { children: "Live clearinghouse submission" }),
6545
+ /* @__PURE__ */ jsx15("span", { children: "The duplicate will be sent only after you confirm its delivery route in the next dialog." })
6546
+ ] }) : null,
6547
+ /* @__PURE__ */ jsx15(CorrectionVerificationContact, { delivery: data.delivery }),
6548
+ /* @__PURE__ */ jsx15(
6549
+ BillSubmissionForm,
6550
+ {
6551
+ className: "mbsf-lifecycle-correction",
6552
+ initialBill: correctionInitialBill,
6553
+ attachments: correctionAttachments,
6554
+ onSubmit: submitDuplicateFromForm,
6555
+ onSearchClaimsAdministrators: lifecycle.searchClaimsAdministrators,
6556
+ onGetClaimsAdministratorDirectory: lifecycle.getClaimsAdministratorDirectory,
6557
+ claimsAdministratorHint,
6558
+ ...claimsAdministratorSources ? { claimsAdministratorSources } : {},
6559
+ attentionMessage: "Confirm every carried-over value. You may edit any field before sending this duplicate.",
6560
+ submitLabel: lifecycle.isMutating ? "Sending\u2026" : "Send duplicate",
6561
+ deliveryRoutePicker: "required",
6562
+ deliveryRouteDialogTitle: "Confirm duplicate bill delivery",
6563
+ heading: "Duplicate bill information",
6564
+ description: "The submitted original remains immutable. This form creates and sends a linked duplicate.",
6565
+ disabled: lifecycle.isMutating,
6566
+ ...options.getSession ? { getSession: options.getSession } : {},
6567
+ ...options.sessionEndpoint ? { sessionEndpoint: options.sessionEndpoint } : {},
6568
+ ...options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {},
6569
+ ...options.fetch ? { fetch: options.fetch } : {},
6570
+ ...appearance ? { appearance } : {}
6571
+ }
6572
+ ),
6573
+ duplicateError ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-message error", role: "alert", children: duplicateError }) : null
6151
6574
  ] }) }) : null,
6152
- panel === "report_status" ? /* @__PURE__ */ jsx14(
6575
+ panel === "report_status" ? /* @__PURE__ */ jsx15(
6153
6576
  ReportBillStatusDialog,
6154
6577
  {
6578
+ ...data.delivery.directory ? { directory: data.delivery.directory } : {},
6155
6579
  ...statusContacts.claimsAdmin ? { claimsAdmin: statusContacts.claimsAdmin } : {},
6156
6580
  ...statusContacts.billReview ? { billReview: statusContacts.billReview } : {},
6157
- ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx14(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
6581
+ ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx15(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
6158
6582
  submitting: lifecycle.isMutating,
6159
6583
  error: lifecycle.error?.message ?? null,
6160
6584
  onCancel: () => setPanel(""),
@@ -6162,8 +6586,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6162
6586
  ...appearance ? { appearance } : {}
6163
6587
  }
6164
6588
  ) : null,
6165
- notice ? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
6166
- lifecycle.error ? /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
6589
+ notice ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
6590
+ lifecycle.error ? /* @__PURE__ */ jsx15("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
6167
6591
  ] });
6168
6592
  }
6169
6593
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -6175,11 +6599,520 @@ var CONNECTED_LIFECYCLE_STYLES = `
6175
6599
  @media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:calc(100dvh - 12px)}.mb-lifecycle-dialog .mb-lifecycle-panel,.mb-lifecycle-correction{border-radius:18px 18px 0 0}.mb-lifecycle-correction{padding:18px 12px calc(18px + env(safe-area-inset-bottom))}.mb-lifecycle-correction>header{align-items:stretch;flex-direction:column;padding-right:56px}.mb-lifecycle-correction-reason{grid-template-columns:1fr}.mb-lifecycle-correction-reason>ul{grid-column:auto}.mb-lifecycle-correction-contact dl>div{grid-template-columns:1fr;gap:2px}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
6176
6600
  `;
6177
6601
 
6602
+ // src/connected-billing-workspace.tsx
6603
+ import {
6604
+ useCallback as useCallback5,
6605
+ useEffect as useEffect11,
6606
+ useMemo as useMemo10,
6607
+ useState as useState13
6608
+ } from "react";
6609
+
6610
+ // src/billing-operations-client.ts
6611
+ import {
6612
+ DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL3,
6613
+ DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT3
6614
+ } from "@mindbill/browser";
6615
+ async function responseError2(response, fallback) {
6616
+ const body = await response.json().catch(() => null);
6617
+ const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
6618
+ return new Error(typeof detail === "string" ? detail : fallback);
6619
+ }
6620
+ function normalizeSession2(value) {
6621
+ if (!value || typeof value !== "object") throw new Error("The MindBill session endpoint returned an invalid response.");
6622
+ const candidate = value;
6623
+ const nested = candidate.session ?? candidate.data;
6624
+ const session = nested && typeof nested === "object" ? nested : candidate;
6625
+ if (typeof session.token !== "string" || session.token.length < 8) {
6626
+ throw new Error("The MindBill session endpoint did not return a browser session token.");
6627
+ }
6628
+ return {
6629
+ token: session.token,
6630
+ ...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
6631
+ ...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
6632
+ };
6633
+ }
6634
+ function isFresh(session) {
6635
+ if (!session) return false;
6636
+ if (!session.expiresAt) return true;
6637
+ const expiresAt = Date.parse(session.expiresAt);
6638
+ return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
6639
+ }
6640
+ function queryString(values) {
6641
+ const params = new URLSearchParams();
6642
+ for (const [key, value] of Object.entries(values)) {
6643
+ if (value !== void 0 && value !== "") params.set(key, String(value));
6644
+ }
6645
+ const text = params.toString();
6646
+ return text ? `?${text}` : "";
6647
+ }
6648
+ function createBillingOperationsClient({
6649
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT3,
6650
+ getSession,
6651
+ apiBaseUrl = DEFAULT_API_BASE_URL3,
6652
+ fetch: fetchOverride
6653
+ } = {}) {
6654
+ const fetcher = fetchOverride ?? globalThis.fetch;
6655
+ if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
6656
+ let session = null;
6657
+ let pendingSession = null;
6658
+ const mintSession = async (signal, force = false) => {
6659
+ if (!force && isFresh(session)) return session;
6660
+ if (!force && pendingSession) return pendingSession;
6661
+ const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
6662
+ method: "POST",
6663
+ credentials: "same-origin",
6664
+ headers: { "content-type": "application/json" },
6665
+ body: JSON.stringify({}),
6666
+ signal
6667
+ }).then(async (response) => {
6668
+ if (!response.ok) throw await responseError2(response, "MindBill browser session could not be created.");
6669
+ return response.json();
6670
+ });
6671
+ const request = Promise.resolve(pending).then(normalizeSession2).then((next) => {
6672
+ session = next;
6673
+ return next;
6674
+ }).finally(() => {
6675
+ if (pendingSession === request) pendingSession = null;
6676
+ });
6677
+ pendingSession = request;
6678
+ return request;
6679
+ };
6680
+ const get = async (path, signal) => {
6681
+ const controller = signal ? null : new AbortController();
6682
+ const requestSignal = signal ?? controller?.signal;
6683
+ if (!requestSignal) throw new Error("An AbortSignal could not be created.");
6684
+ let browserSession = await mintSession(requestSignal);
6685
+ const request = (active) => {
6686
+ const base = (active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
6687
+ return fetcher(`${base}${path}`, {
6688
+ headers: { authorization: `Bearer ${active.token}` },
6689
+ signal: requestSignal
6690
+ });
6691
+ };
6692
+ let response = await request(browserSession);
6693
+ if (response.status === 401) {
6694
+ session = null;
6695
+ browserSession = await mintSession(requestSignal, true);
6696
+ response = await request(browserSession);
6697
+ }
6698
+ if (!response.ok) throw await responseError2(response, "MindBill data could not be loaded.");
6699
+ const body = await response.json();
6700
+ return body.data ?? body;
6701
+ };
6702
+ return {
6703
+ clearSession() {
6704
+ session = null;
6705
+ pendingSession = null;
6706
+ },
6707
+ getBills(query = {}, signal) {
6708
+ return get(`/partner/v2/browser/bills${queryString(query)}`, signal);
6709
+ },
6710
+ getBillTasks(claimsAdministrator, signal) {
6711
+ return get(
6712
+ `/partner/v2/browser/bill-tasks${queryString({ claimsAdminId: claimsAdministrator })}`,
6713
+ signal
6714
+ );
6715
+ },
6716
+ getServiceLineItems(range, signal) {
6717
+ return get(
6718
+ `/partner/v2/browser/reports/service-line-items${queryString(range)}`,
6719
+ signal
6720
+ );
6721
+ },
6722
+ getProductivity(range, signal) {
6723
+ return get(`/partner/v2/browser/reports/productivity${queryString(range)}`, signal);
6724
+ }
6725
+ };
6726
+ }
6727
+
6728
+ // src/connected-billing-workspace.tsx
6729
+ import { Fragment as Fragment14, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6730
+ var css11 = `
6731
+ .mbow{color:var(--mb-text);font:14px/1.45 var(--mb-font);background:var(--mb-soft);border-radius:var(--mb-radius);padding:20px}.mbow *{box-sizing:border-box}.mbow h2,.mbow h3,.mbow p{margin:0}.mbow a{color:var(--mb-accent)}
6732
+ .mbow-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px}.mbow-head h2{font-size:24px;line-height:1.2}.mbow-sub{color:var(--mb-muted);margin-top:4px!important}.mbow-actions{display:flex;gap:8px;flex-wrap:wrap}
6733
+ .mbow-button,.mbow-input,.mbow-select{min-height:38px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbow-button{padding:7px 12px;cursor:pointer;font-weight:650}.mbow-button:hover{border-color:var(--mb-accent)}.mbow-button.primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbow-button:disabled{opacity:.55;cursor:not-allowed}.mbow-input,.mbow-select{padding:7px 10px}.mbow-input{min-width:260px;flex:1}
6734
+ .mbow-tabs{display:flex;gap:4px;border-bottom:1px solid var(--mb-border);margin-bottom:18px;overflow:auto}.mbow-tab{border:0;border-bottom:3px solid transparent;background:transparent;color:var(--mb-muted);padding:10px 13px;font:inherit;font-weight:700;white-space:nowrap;cursor:pointer}.mbow-tab.active{color:var(--mb-text);border-bottom-color:var(--mb-accent)}
6735
+ .mbow-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.mbow-card{background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow);overflow:hidden}.mbow-scroll{overflow:auto}.mbow-table{width:100%;border-collapse:collapse;min-width:820px}.mbow-table th,.mbow-table td{padding:11px 12px;border-bottom:1px solid var(--mb-border);text-align:left;vertical-align:middle}.mbow-table th{color:var(--mb-muted);font-size:11px;letter-spacing:.045em;text-transform:uppercase;font-weight:800;background:color-mix(in srgb,var(--mb-soft) 60%,var(--mb-surface))}.mbow-table tr:last-child td{border-bottom:0}.mbow-table tbody tr.clickable{cursor:pointer}.mbow-table tbody tr.clickable:hover{background:color-mix(in srgb,var(--mb-accent) 6%,var(--mb-surface))}.mbow-money{text-align:right!important;font-variant-numeric:tabular-nums}.mbow-strong{font-weight:760}.mbow-muted{color:var(--mb-muted);font-size:12px}.mbow-badge{display:inline-flex;border:1px solid var(--mb-border);border-radius:999px;padding:2px 8px;font-size:12px;background:var(--mb-soft);white-space:nowrap}.mbow-badge.success{color:var(--mb-success);border-color:color-mix(in srgb,var(--mb-success) 35%,var(--mb-border));background:color-mix(in srgb,var(--mb-success) 8%,var(--mb-surface))}.mbow-badge.danger{color:var(--mb-danger)}.mbow-badge.warning{color:var(--mb-warning)}
6736
+ .mbow-state{padding:28px;text-align:center;color:var(--mb-muted)}.mbow-error{color:var(--mb-danger)}.mbow-pager{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;color:var(--mb-muted)}
6737
+ .mbow-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:14px 0 18px}.mbow-metric{padding:16px;background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}.mbow-metric span{display:block;color:var(--mb-muted);font-size:11px;text-transform:uppercase;letter-spacing:.05em}.mbow-metric strong{display:block;font-size:24px;margin-top:5px}.mbow-section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--mb-border)}
6738
+ .mbow-back{margin-bottom:12px}.mbow-task-note{color:var(--mb-muted);font-size:13px;margin-bottom:14px!important}.mbow-bar{height:7px;min-width:70px;background:var(--mb-soft);border-radius:99px;overflow:hidden}.mbow-bar i{display:block;height:100%;background:var(--mb-accent);border-radius:inherit}
6739
+ @media(max-width:760px){.mbow{padding:14px}.mbow-head{display:block}.mbow-actions{margin-top:12px}.mbow-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.mbow-input{min-width:100%}}
6740
+ `;
6741
+ function money6(value) {
6742
+ return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
6743
+ }
6744
+ function shortDate(value) {
6745
+ if (!value) return "\u2014";
6746
+ const date2 = /* @__PURE__ */ new Date(`${value.slice(0, 10)}T12:00:00`);
6747
+ return Number.isNaN(date2.getTime()) ? value : date2.toLocaleDateString("en-US");
6748
+ }
6749
+ function defaultRange(days = 29) {
6750
+ const to = /* @__PURE__ */ new Date();
6751
+ const from = new Date(to);
6752
+ from.setDate(to.getDate() - days);
6753
+ const iso = (date2) => date2.toISOString().slice(0, 10);
6754
+ return { from: iso(from), to: iso(to) };
6755
+ }
6756
+ function Surface({ appearance, className = "", style, children }) {
6757
+ return /* @__PURE__ */ jsxs16("div", { className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
6758
+ /* @__PURE__ */ jsx16("style", { children: css11 }),
6759
+ children
6760
+ ] });
6761
+ }
6762
+ function useClient(options) {
6763
+ return useMemo10(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
6764
+ }
6765
+ function BillSearchContent({
6766
+ client,
6767
+ initialQuery,
6768
+ onSelectBill,
6769
+ heading
6770
+ }) {
6771
+ const [query, setQuery] = useState13({ status: "all", age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery });
6772
+ const [draft, setDraft] = useState13(initialQuery?.q ?? "");
6773
+ const [result, setResult] = useState13(null);
6774
+ const [error, setError] = useState13(null);
6775
+ const [loading, setLoading] = useState13(true);
6776
+ const load = useCallback5(async (signal) => {
6777
+ setLoading(true);
6778
+ setError(null);
6779
+ try {
6780
+ setResult(await client.getBills(query, signal));
6781
+ } catch (cause) {
6782
+ if (!signal?.aborted) setError(cause instanceof Error ? cause : new Error("Bills could not be loaded."));
6783
+ } finally {
6784
+ if (!signal?.aborted) setLoading(false);
6785
+ }
6786
+ }, [client, query]);
6787
+ useEffect11(() => {
6788
+ const controller = new AbortController();
6789
+ void load(controller.signal);
6790
+ return () => controller.abort();
6791
+ }, [load]);
6792
+ const update = (next) => setQuery((current) => ({ ...current, ...next, page: next.page ?? 1 }));
6793
+ const pageCount = Math.max(1, Math.ceil((result?.total ?? 0) / (result?.pageSize ?? 25)));
6794
+ return /* @__PURE__ */ jsxs16(Fragment14, { children: [
6795
+ heading ? /* @__PURE__ */ jsx16("div", { className: "mbow-head", children: /* @__PURE__ */ jsx16("div", { children: typeof heading === "string" ? /* @__PURE__ */ jsx16("h2", { children: heading }) : heading }) }) : null,
6796
+ /* @__PURE__ */ jsxs16("form", { className: "mbow-toolbar", onSubmit: (event) => {
6797
+ event.preventDefault();
6798
+ update({ q: draft.trim() });
6799
+ }, children: [
6800
+ /* @__PURE__ */ jsx16("input", { className: "mbow-input", value: draft, onChange: (event) => setDraft(event.target.value), placeholder: "Search patient, bill ID, claim, or external ID\u2026", "aria-label": "Search bills" }),
6801
+ /* @__PURE__ */ jsxs16("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
6802
+ /* @__PURE__ */ jsx16("option", { value: "all", children: "All statuses" }),
6803
+ /* @__PURE__ */ jsx16("option", { value: "incomplete", children: "Incomplete" }),
6804
+ /* @__PURE__ */ jsx16("option", { value: "submitted", children: "Submitted" }),
6805
+ /* @__PURE__ */ jsx16("option", { value: "accepted", children: "Accepted" }),
6806
+ /* @__PURE__ */ jsx16("option", { value: "rejected", children: "Rejected" }),
6807
+ /* @__PURE__ */ jsx16("option", { value: "processed", children: "Processed" }),
6808
+ /* @__PURE__ */ jsx16("option", { value: "paid", children: "Paid" }),
6809
+ /* @__PURE__ */ jsx16("option", { value: "closed", children: "Closed" })
6810
+ ] }),
6811
+ /* @__PURE__ */ jsxs16("select", { className: "mbow-select", value: query.age ?? "all", onChange: (event) => update({ age: event.target.value }), "aria-label": "A/R age", children: [
6812
+ /* @__PURE__ */ jsx16("option", { value: "all", children: "All A/R ages" }),
6813
+ /* @__PURE__ */ jsx16("option", { value: "0-30", children: "0\u201330 days" }),
6814
+ /* @__PURE__ */ jsx16("option", { value: "31-60", children: "31\u201360 days" }),
6815
+ /* @__PURE__ */ jsx16("option", { value: "61-90", children: "61\u201390 days" }),
6816
+ /* @__PURE__ */ jsx16("option", { value: "91+", children: "91+ days" }),
6817
+ /* @__PURE__ */ jsx16("option", { value: "91-180", children: "91\u2013180 days" }),
6818
+ /* @__PURE__ */ jsx16("option", { value: "181+", children: "181+ days" })
6819
+ ] }),
6820
+ /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "submit", children: "Search" })
6821
+ ] }),
6822
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-card mbow-scroll", children: [
6823
+ loading && !result ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error && !result ? /* @__PURE__ */ jsxs16("div", { className: "mbow-state mbow-error", role: "alert", children: [
6824
+ error.message,
6825
+ " ",
6826
+ /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
6827
+ ] }) : result?.items.length === 0 ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", children: "No bills match these filters." }) : /* @__PURE__ */ jsxs16("table", { className: "mbow-table", children: [
6828
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsxs16("tr", { children: [
6829
+ /* @__PURE__ */ jsx16("th", { children: "Bill" }),
6830
+ /* @__PURE__ */ jsx16("th", { children: "Patient" }),
6831
+ /* @__PURE__ */ jsx16("th", { children: "DOS" }),
6832
+ /* @__PURE__ */ jsx16("th", { children: "Codes" }),
6833
+ /* @__PURE__ */ jsx16("th", { children: "Claims administrator" }),
6834
+ /* @__PURE__ */ jsx16("th", { children: "Status" }),
6835
+ /* @__PURE__ */ jsx16("th", { children: "Submitted / A/R age" }),
6836
+ /* @__PURE__ */ jsx16("th", { className: "mbow-money", children: "Balance due" })
6837
+ ] }) }),
6838
+ /* @__PURE__ */ jsx16("tbody", { children: result?.items.map((bill) => /* @__PURE__ */ jsxs16("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(bill), children: [
6839
+ /* @__PURE__ */ jsxs16("td", { className: "mbow-strong", children: [
6840
+ "#",
6841
+ bill.billNumber
6842
+ ] }),
6843
+ /* @__PURE__ */ jsx16("td", { children: bill.patientName }),
6844
+ /* @__PURE__ */ jsx16("td", { children: shortDate(bill.dateOfService) }),
6845
+ /* @__PURE__ */ jsx16("td", { children: bill.procedureCodes.join(", ") || "\u2014" }),
6846
+ /* @__PURE__ */ jsx16("td", { children: bill.claimsAdministrator || "\u2014" }),
6847
+ /* @__PURE__ */ jsx16("td", { children: /* @__PURE__ */ jsx16("span", { className: `mbow-badge ${bill.status.tone ?? ""}`, children: bill.status.label }) }),
6848
+ /* @__PURE__ */ jsxs16("td", { children: [
6849
+ shortDate(bill.submittedAt),
6850
+ /* @__PURE__ */ jsx16("div", { className: "mbow-muted", children: bill.arAgeDays == null ? "\u2014" : `${bill.arAgeDays} days` })
6851
+ ] }),
6852
+ /* @__PURE__ */ jsx16("td", { className: "mbow-money mbow-strong", children: money6(bill.balanceDue) })
6853
+ ] }, bill.id)) })
6854
+ ] }),
6855
+ result ? /* @__PURE__ */ jsxs16("div", { className: "mbow-pager", children: [
6856
+ /* @__PURE__ */ jsxs16("span", { children: [
6857
+ "Showing ",
6858
+ result.total === 0 ? 0 : (result.page - 1) * result.pageSize + 1,
6859
+ "\u2013",
6860
+ Math.min(result.page * result.pageSize, result.total),
6861
+ " of ",
6862
+ result.total
6863
+ ] }),
6864
+ /* @__PURE__ */ jsxs16("span", { children: [
6865
+ /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "button", disabled: result.page <= 1, onClick: () => update({ page: result.page - 1 }), children: "Previous" }),
6866
+ " ",
6867
+ result.page,
6868
+ " / ",
6869
+ pageCount,
6870
+ " ",
6871
+ /* @__PURE__ */ jsx16("button", { className: "mbow-button", type: "button", disabled: result.page >= pageCount, onClick: () => update({ page: result.page + 1 }), children: "Next" })
6872
+ ] })
6873
+ ] }) : null
6874
+ ] })
6875
+ ] });
6876
+ }
6877
+ function ConnectedBillSearch({ appearance, className, style, initialQuery, onSelectBill, heading = "All bills", ...options }) {
6878
+ const client = useClient(options);
6879
+ return /* @__PURE__ */ jsx16(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx16(BillSearchContent, { client, initialQuery, onSelectBill, heading }) });
6880
+ }
6881
+ function taskQuery(cell) {
6882
+ const [taskType, taskLabel] = cell.rowId.split("::", 2);
6883
+ const age = cell.bucketId === "1-30" ? "0-30" : cell.bucketId;
6884
+ return { status: "all", taskSection: cell.sectionId, ...taskType ? { taskType } : {}, ...taskLabel ? { taskLabel } : {}, ...age ? { age } : {} };
6885
+ }
6886
+ function BillTasksContent({ client, onDrillDown, appearance }) {
6887
+ const [claimsAdminId, setClaimsAdminId] = useState13("");
6888
+ const [result, setResult] = useState13(null);
6889
+ const [error, setError] = useState13(null);
6890
+ const [loading, setLoading] = useState13(true);
6891
+ const load = useCallback5(async (signal) => {
6892
+ setLoading(true);
6893
+ setError(null);
6894
+ try {
6895
+ setResult(await client.getBillTasks(claimsAdminId || void 0, signal));
6896
+ } catch (cause) {
6897
+ if (!signal?.aborted) setError(cause instanceof Error ? cause : new Error("Bill tasks could not be loaded."));
6898
+ } finally {
6899
+ if (!signal?.aborted) setLoading(false);
6900
+ }
6901
+ }, [claimsAdminId, client]);
6902
+ useEffect11(() => {
6903
+ const controller = new AbortController();
6904
+ void load(controller.signal);
6905
+ return () => controller.abort();
6906
+ }, [load]);
6907
+ if (loading && !result) return /* @__PURE__ */ jsx16("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
6908
+ if (error && !result) return /* @__PURE__ */ jsx16("div", { className: "mbow-state mbow-error", children: error.message });
6909
+ if (!result) return /* @__PURE__ */ jsx16(Fragment14, {});
6910
+ return /* @__PURE__ */ jsxs16(Fragment14, { children: [
6911
+ /* @__PURE__ */ jsxs16("p", { className: "mbow-task-note", children: [
6912
+ "Open follow-up work only. Sent bills waiting on a payer stay available in ",
6913
+ /* @__PURE__ */ jsx16("strong", { children: "All bills" }),
6914
+ "."
6915
+ ] }),
6916
+ /* @__PURE__ */ jsx16(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs16("select", { className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
6917
+ /* @__PURE__ */ jsx16("option", { value: "", children: "All claims administrators" }),
6918
+ result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx16("option", { value: item.id, children: item.name }, item.id))
6919
+ ] }), onSelectCell: (cell) => onDrillDown?.(taskQuery(cell)) })
6920
+ ] });
6921
+ }
6922
+ function ConnectedBillTasksDashboard({ appearance, className, style, onDrillDown, ...options }) {
6923
+ const client = useClient(options);
6924
+ return /* @__PURE__ */ jsx16(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx16(BillTasksContent, { client, onDrillDown, appearance }) });
6925
+ }
6926
+ function RangeToolbar({ from, to, setFrom, setTo }) {
6927
+ return /* @__PURE__ */ jsxs16("div", { className: "mbow-toolbar", children: [
6928
+ /* @__PURE__ */ jsxs16("label", { children: [
6929
+ "From ",
6930
+ /* @__PURE__ */ jsx16("input", { className: "mbow-input", type: "date", value: from, onChange: (event) => setFrom(event.target.value) })
6931
+ ] }),
6932
+ /* @__PURE__ */ jsxs16("label", { children: [
6933
+ "To ",
6934
+ /* @__PURE__ */ jsx16("input", { className: "mbow-input", type: "date", value: to, onChange: (event) => setTo(event.target.value) })
6935
+ ] })
6936
+ ] });
6937
+ }
6938
+ function ConnectedServiceLineItemsReport({ appearance, className, style, initialFrom, initialTo, onSelectBill, ...options }) {
6939
+ const defaults = useMemo10(() => defaultRange(), []);
6940
+ const client = useClient(options);
6941
+ const [from, setFrom] = useState13(initialFrom ?? defaults.from);
6942
+ const [to, setTo] = useState13(initialTo ?? defaults.to);
6943
+ const [data, setData] = useState13(null);
6944
+ const [error, setError] = useState13(null);
6945
+ useEffect11(() => {
6946
+ const controller = new AbortController();
6947
+ setError(null);
6948
+ void client.getServiceLineItems({ from, to }, controller.signal).then(setData).catch((cause) => {
6949
+ if (!controller.signal.aborted) setError(cause instanceof Error ? cause : new Error("Report could not be loaded."));
6950
+ });
6951
+ return () => controller.abort();
6952
+ }, [client, from, to]);
6953
+ return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
6954
+ /* @__PURE__ */ jsx16("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs16("div", { children: [
6955
+ /* @__PURE__ */ jsx16("h2", { children: "Original submissions by procedure" }),
6956
+ /* @__PURE__ */ jsx16("p", { className: "mbow-sub", children: "First payer submission for each patient and date of service." })
6957
+ ] }) }),
6958
+ /* @__PURE__ */ jsx16(RangeToolbar, { from, to, setFrom, setTo }),
6959
+ error ? /* @__PURE__ */ jsx16("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs16(Fragment14, { children: [
6960
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-metrics", children: [
6961
+ /* @__PURE__ */ jsx16(Metric, { label: "Original bills", value: String(data.totalBills) }),
6962
+ /* @__PURE__ */ jsx16(Metric, { label: "Service lines", value: String(data.totalLines) }),
6963
+ /* @__PURE__ */ jsx16(Metric, { label: "Total billed", value: money6(data.totalBilled) }),
6964
+ /* @__PURE__ */ jsx16(Metric, { label: "Report window", value: data.windowLabel })
6965
+ ] }),
6966
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-card mbow-scroll", children: [
6967
+ /* @__PURE__ */ jsx16("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx16("h3", { children: "Procedure summary" }) }),
6968
+ /* @__PURE__ */ jsxs16("table", { className: "mbow-table", children: [
6969
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsxs16("tr", { children: [
6970
+ /* @__PURE__ */ jsx16("th", { children: "Procedure code" }),
6971
+ /* @__PURE__ */ jsx16("th", { children: "Bills" }),
6972
+ /* @__PURE__ */ jsx16("th", { children: "Service lines" }),
6973
+ /* @__PURE__ */ jsx16("th", { className: "mbow-money", children: "Total billed" })
6974
+ ] }) }),
6975
+ /* @__PURE__ */ jsx16("tbody", { children: data.cptRows.map((row) => /* @__PURE__ */ jsxs16("tr", { children: [
6976
+ /* @__PURE__ */ jsx16("td", { className: "mbow-strong", children: row.code }),
6977
+ /* @__PURE__ */ jsx16("td", { children: row.bills }),
6978
+ /* @__PURE__ */ jsx16("td", { children: row.lines }),
6979
+ /* @__PURE__ */ jsx16("td", { className: "mbow-money", children: money6(row.billed) })
6980
+ ] }, row.code)) })
6981
+ ] })
6982
+ ] }),
6983
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-card mbow-scroll", style: { marginTop: 16 }, children: [
6984
+ /* @__PURE__ */ jsx16("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx16("h3", { children: "All original bills" }) }),
6985
+ /* @__PURE__ */ jsxs16("table", { className: "mbow-table", children: [
6986
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsxs16("tr", { children: [
6987
+ /* @__PURE__ */ jsx16("th", { children: "Bill" }),
6988
+ /* @__PURE__ */ jsx16("th", { children: "First submitted" }),
6989
+ /* @__PURE__ */ jsx16("th", { children: "Patient \xB7 Claim" }),
6990
+ /* @__PURE__ */ jsx16("th", { children: "DOS" }),
6991
+ /* @__PURE__ */ jsx16("th", { children: "Claims administrator" }),
6992
+ /* @__PURE__ */ jsx16("th", { children: "Codes" }),
6993
+ /* @__PURE__ */ jsx16("th", { className: "mbow-money", children: "Billed" }),
6994
+ /* @__PURE__ */ jsx16("th", { children: "Status" })
6995
+ ] }) }),
6996
+ /* @__PURE__ */ jsx16("tbody", { children: data.billRows.map((row) => /* @__PURE__ */ jsxs16("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(row.billId), children: [
6997
+ /* @__PURE__ */ jsxs16("td", { className: "mbow-strong", children: [
6998
+ "#",
6999
+ row.billNumber
7000
+ ] }),
7001
+ /* @__PURE__ */ jsx16("td", { children: shortDate(row.submittedDate) }),
7002
+ /* @__PURE__ */ jsxs16("td", { children: [
7003
+ row.patient,
7004
+ /* @__PURE__ */ jsx16("div", { className: "mbow-muted", children: row.claim })
7005
+ ] }),
7006
+ /* @__PURE__ */ jsx16("td", { children: shortDate(row.dos) }),
7007
+ /* @__PURE__ */ jsx16("td", { children: row.claimsAdmin }),
7008
+ /* @__PURE__ */ jsx16("td", { children: row.codes.join(", ") }),
7009
+ /* @__PURE__ */ jsx16("td", { className: "mbow-money", children: money6(row.billed) }),
7010
+ /* @__PURE__ */ jsx16("td", { children: row.status })
7011
+ ] }, row.billId)) })
7012
+ ] })
7013
+ ] })
7014
+ ] })
7015
+ ] });
7016
+ }
7017
+ function Metric({ label, value }) {
7018
+ return /* @__PURE__ */ jsxs16("div", { className: "mbow-metric", children: [
7019
+ /* @__PURE__ */ jsx16("span", { children: label }),
7020
+ /* @__PURE__ */ jsx16("strong", { children: value })
7021
+ ] });
7022
+ }
7023
+ function ConnectedProductivityReport({ appearance, className, style, initialFrom, initialTo, ...options }) {
7024
+ const defaults = useMemo10(() => defaultRange(13), []);
7025
+ const client = useClient(options);
7026
+ const [from, setFrom] = useState13(initialFrom ?? defaults.from);
7027
+ const [to, setTo] = useState13(initialTo ?? defaults.to);
7028
+ const [data, setData] = useState13(null);
7029
+ const [error, setError] = useState13(null);
7030
+ useEffect11(() => {
7031
+ const controller = new AbortController();
7032
+ setError(null);
7033
+ void client.getProductivity({ from, to }, controller.signal).then(setData).catch((cause) => {
7034
+ if (!controller.signal.aborted) setError(cause instanceof Error ? cause : new Error("Report could not be loaded."));
7035
+ });
7036
+ return () => controller.abort();
7037
+ }, [client, from, to]);
7038
+ const maxSent = data ? Math.max(1, ...Object.values(data.sentTotal)) : 1;
7039
+ return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
7040
+ /* @__PURE__ */ jsx16("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs16("div", { children: [
7041
+ /* @__PURE__ */ jsx16("h2", { children: "Productivity" }),
7042
+ /* @__PURE__ */ jsx16("p", { className: "mbow-sub", children: "Bills created and sent per biller, plus accepted-first-try rate." })
7043
+ ] }) }),
7044
+ /* @__PURE__ */ jsx16(RangeToolbar, { from, to, setFrom, setTo }),
7045
+ error ? /* @__PURE__ */ jsx16("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx16("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs16(Fragment14, { children: [
7046
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-metrics", children: [
7047
+ /* @__PURE__ */ jsx16(Metric, { label: "Bills created", value: String(data.totalCreated) }),
7048
+ /* @__PURE__ */ jsx16(Metric, { label: "Transmissions", value: String(data.totalSent) }),
7049
+ /* @__PURE__ */ jsx16(Metric, { label: "Bills submitted", value: String(data.totalSubmitted) }),
7050
+ /* @__PURE__ */ jsx16(Metric, { label: "Accepted first try", value: data.totalSubmitted ? `${Math.round(data.totalClean / data.totalSubmitted * 100)}%` : "\u2014" })
7051
+ ] }),
7052
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-card mbow-scroll", children: [
7053
+ /* @__PURE__ */ jsx16("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx16("h3", { children: "Per-biller summary" }) }),
7054
+ /* @__PURE__ */ jsxs16("table", { className: "mbow-table", children: [
7055
+ /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsxs16("tr", { children: [
7056
+ /* @__PURE__ */ jsx16("th", { children: "Biller" }),
7057
+ /* @__PURE__ */ jsx16("th", { children: "Created" }),
7058
+ /* @__PURE__ */ jsx16("th", { children: "Transmissions" }),
7059
+ /* @__PURE__ */ jsx16("th", { children: "Submitted" }),
7060
+ /* @__PURE__ */ jsx16("th", { children: "Accepted first try" }),
7061
+ /* @__PURE__ */ jsx16("th", { children: "Volume" })
7062
+ ] }) }),
7063
+ /* @__PURE__ */ jsx16("tbody", { children: data.billers.map((biller) => {
7064
+ const sent = data.sentTotal[biller.name] ?? 0;
7065
+ const submitted = data.submittedTotal[biller.name] ?? 0;
7066
+ const clean = data.cleanTotal[biller.name] ?? 0;
7067
+ return /* @__PURE__ */ jsxs16("tr", { children: [
7068
+ /* @__PURE__ */ jsx16("td", { className: "mbow-strong", children: biller.name }),
7069
+ /* @__PURE__ */ jsx16("td", { children: data.createdTotal[biller.name] ?? 0 }),
7070
+ /* @__PURE__ */ jsx16("td", { children: sent }),
7071
+ /* @__PURE__ */ jsx16("td", { children: submitted }),
7072
+ /* @__PURE__ */ jsx16("td", { children: submitted ? `${Math.round(clean / submitted * 100)}%` : "\u2014" }),
7073
+ /* @__PURE__ */ jsx16("td", { children: /* @__PURE__ */ jsx16("div", { className: "mbow-bar", children: /* @__PURE__ */ jsx16("i", { style: { width: `${sent / maxSent * 100}%` } }) }) })
7074
+ ] }, biller.name);
7075
+ }) })
7076
+ ] })
7077
+ ] })
7078
+ ] })
7079
+ ] });
7080
+ }
7081
+ function ConnectedBillingWorkspace({ appearance, className, style, initialView = "tasks", onCreateBill, ...options }) {
7082
+ const client = useClient(options);
7083
+ const [view, setView] = useState13(initialView);
7084
+ const [billQuery, setBillQuery] = useState13({ status: "all" });
7085
+ const [selectedBillId, setSelectedBillId] = useState13(null);
7086
+ if (selectedBillId) return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
7087
+ /* @__PURE__ */ jsx16("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
7088
+ /* @__PURE__ */ jsx16(ConnectedBillLifecycle, { billId: selectedBillId, ...options, ...appearance ? { appearance } : {} })
7089
+ ] });
7090
+ const selectView = (next) => {
7091
+ setView(next);
7092
+ setSelectedBillId(null);
7093
+ };
7094
+ const appearanceProps = appearance ? { appearance } : {};
7095
+ return /* @__PURE__ */ jsxs16(Surface, { appearance, className, style, children: [
7096
+ /* @__PURE__ */ jsxs16("div", { className: "mbow-head", children: [
7097
+ /* @__PURE__ */ jsxs16("div", { children: [
7098
+ /* @__PURE__ */ jsx16("h2", { children: "Billing" }),
7099
+ /* @__PURE__ */ jsx16("p", { className: "mbow-sub", children: "Follow up on open work or find any bill and its current status." })
7100
+ ] }),
7101
+ onCreateBill ? /* @__PURE__ */ jsx16("div", { className: "mbow-actions", children: /* @__PURE__ */ jsx16("button", { className: "mbow-button primary", type: "button", onClick: onCreateBill, children: "+ Add bill" }) }) : null
7102
+ ] }),
7103
+ /* @__PURE__ */ jsx16("div", { className: "mbow-tabs", role: "tablist", children: [["tasks", "Bill tasks"], ["bills", "All bills"], ["procedures", "Procedures"], ["productivity", "Productivity"]].map(([id, label]) => /* @__PURE__ */ jsx16("button", { className: `mbow-tab ${view === id ? "active" : ""}`, type: "button", role: "tab", "aria-selected": view === id, onClick: () => selectView(id), children: label }, id)) }),
7104
+ view === "tasks" ? /* @__PURE__ */ jsx16(BillTasksContent, { client, onDrillDown: (query) => {
7105
+ setBillQuery(query);
7106
+ setView("bills");
7107
+ }, appearance }) : view === "bills" ? /* @__PURE__ */ jsx16(BillSearchContent, { client, initialQuery: billQuery, onSelectBill: (bill) => setSelectedBillId(bill.id) }) : view === "procedures" ? /* @__PURE__ */ jsx16(ConnectedServiceLineItemsReport, { ...options, ...appearanceProps, onSelectBill: setSelectedBillId }) : /* @__PURE__ */ jsx16(ConnectedProductivityReport, { ...options, ...appearanceProps })
7108
+ ] });
7109
+ }
7110
+
6178
7111
  // src/index.tsx
6179
7112
  function widget(tagName, props) {
6180
7113
  const ref = useRef7(null);
6181
7114
  const { onMindBill, onMindBillError } = props;
6182
- useEffect11(() => {
7115
+ useEffect12(() => {
6183
7116
  const element = ref.current;
6184
7117
  if (!element) return;
6185
7118
  const handleEvent = (event) => onMindBill?.(event);
@@ -6253,7 +7186,12 @@ export {
6253
7186
  BillingSettings,
6254
7187
  ClaimsAdministratorDirectoryDialog,
6255
7188
  ConnectedBillLifecycle,
7189
+ ConnectedBillSearch,
6256
7190
  ConnectedBillStatus,
7191
+ ConnectedBillTasksDashboard,
7192
+ ConnectedBillingWorkspace,
7193
+ ConnectedProductivityReport,
7194
+ ConnectedServiceLineItemsReport,
6257
7195
  DEFAULT_BILL_SUBMISSION_MODIFIERS,
6258
7196
  DEFAULT_BILL_SUBMISSION_PROCEDURES,
6259
7197
  DEFAULT_BILL_SUBMISSION_TAXONOMIES,
@@ -6264,8 +7202,10 @@ export {
6264
7202
  PSYCH_QME_DEFAULT_DIAGNOSIS,
6265
7203
  REPORT_BILL_STATUS_OPTIONS2 as REPORT_BILL_STATUS_OPTIONS,
6266
7204
  ReportBillStatusDialog,
6267
- SECOND_REVIEW_REASON_TEMPLATE2 as SECOND_REVIEW_REASON_TEMPLATE,
7205
+ SECOND_REVIEW_REASON_TEMPLATE,
7206
+ SECOND_REVIEW_REASON_TEMPLATES,
6268
7207
  SECOND_REVIEW_WINDOW_DAYS,
7208
+ SecondReviewForm,
6269
7209
  SendRouteDialog,
6270
7210
  applyBillSubmissionEvaluationDiagnoses,
6271
7211
  applyBillSubmissionEvaluationModifiers,
@@ -6288,6 +7228,7 @@ export {
6288
7228
  claimsAdministratorRecommendations,
6289
7229
  createBillLifecycleClient2 as createBillLifecycleClient,
6290
7230
  createBillStatusClient,
7231
+ createBillingOperationsClient,
6291
7232
  ensureTrailingBillSubmissionLine,
6292
7233
  ensureTrailingProcedureLine,
6293
7234
  exactClaimsAdministratorMatch,