@mindbill/react 0.49.0 → 0.51.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
@@ -348,7 +348,7 @@ function organizationProfileOptions(profile) {
348
348
 
349
349
  // src/index.tsx
350
350
  import "@mindbill/embed";
351
- import { createElement, useEffect as useEffect14, useRef as useRef10 } from "react";
351
+ import { createElement, useEffect as useEffect16, useRef as useRef11 } from "react";
352
352
 
353
353
  // src/native-bill-review.tsx
354
354
  import { sanitizeBillReviewSaveInput } from "@mindbill/browser";
@@ -4677,7 +4677,7 @@ function ReportBillStatusDialog({
4677
4677
  }
4678
4678
 
4679
4679
  // src/organization-onboarding.tsx
4680
- import { useCallback as useCallback2, useEffect as useEffect8, useId as useId2, useMemo as useMemo6, useRef as useRef4, useState as useState9 } from "react";
4680
+ import { useCallback as useCallback2, useEffect as useEffect8, useId as useId2, useMemo as useMemo6, useRef as useRef4, useState as useState10 } from "react";
4681
4681
  import {
4682
4682
  createOrganizationClient
4683
4683
  } from "@mindbill/browser";
@@ -4711,8 +4711,103 @@ function TaxIdInput({ label, value, onChange, disabled }) {
4711
4711
  ] });
4712
4712
  }
4713
4713
 
4714
+ // src/w9-upload.tsx
4715
+ import { useState as useState9 } from "react";
4716
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4717
+ function validateW9File(file, maxSizeBytes = 20 * 1024 * 1024) {
4718
+ if (!file.name.toLowerCase().endsWith(".pdf") || file.type && file.type !== "application/pdf") return "Choose a PDF file for the W-9.";
4719
+ if (file.size === 0) return "The selected PDF is empty.";
4720
+ if (file.size > maxSizeBytes) return `Choose a PDF smaller than ${Math.round(maxSizeBytes / 1024 / 1024)} MB.`;
4721
+ return null;
4722
+ }
4723
+ var extractionLabels = {
4724
+ idle: "",
4725
+ queued: "W-9 saved. Tax ID and address extraction is queued.",
4726
+ processing: "Reading the tax ID and remittance address\u2026",
4727
+ complete: "Extraction complete. Review the tax ID and remittance address before saving your billing settings.",
4728
+ not_found: "The tax ID or address could not be read. Enter the missing billing details manually.",
4729
+ failed: "Extraction failed. Your W-9 is still saved; enter the billing details manually or retry."
4730
+ };
4731
+ function W9Upload({ document: document2, extractionStatus = "idle", onUpload, onView, onRetryExtraction, maxSizeBytes = 20 * 1024 * 1024, disabled = false, appearance, className = "", style }) {
4732
+ const [file, setFile] = useState9(null);
4733
+ const [busy, setBusy] = useState9(false);
4734
+ const [error, setError] = useState9(null);
4735
+ const [saved, setSaved] = useState9(false);
4736
+ const choose = (next) => {
4737
+ if (busy || disabled) return;
4738
+ const failure = next ? validateW9File(next, maxSizeBytes) : null;
4739
+ setError(failure);
4740
+ setSaved(false);
4741
+ setFile(failure ? null : next);
4742
+ };
4743
+ const upload = async () => {
4744
+ if (!file || busy || disabled) return;
4745
+ setBusy(true);
4746
+ setError(null);
4747
+ setSaved(false);
4748
+ try {
4749
+ await onUpload(file);
4750
+ setFile(null);
4751
+ setSaved(true);
4752
+ } catch {
4753
+ setError("The W-9 could not be uploaded. Please try again.");
4754
+ } finally {
4755
+ setBusy(false);
4756
+ }
4757
+ };
4758
+ const retry = async () => {
4759
+ setBusy(true);
4760
+ setError(null);
4761
+ try {
4762
+ await onRetryExtraction?.();
4763
+ } catch {
4764
+ setError("Extraction could not be restarted. Please try again.");
4765
+ } finally {
4766
+ setBusy(false);
4767
+ }
4768
+ };
4769
+ return /* @__PURE__ */ jsxs13("section", { className: `mbw9 ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-label": "Practice W-9", children: [
4770
+ /* @__PURE__ */ jsx13("style", { children: `.mbw9{font:inherit;color:var(--mb-text)}.mbw9 *{box-sizing:border-box}.mbw9 p{margin:0;color:var(--mb-muted);font-size:13px;line-height:1.6}.mbw9-current,.mbw9-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.mbw9-current{padding:12px 14px;background:var(--mb-soft);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);margin-bottom:12px}.mbw9-current strong{overflow-wrap:anywhere}.mbw9 button{font:inherit;color:var(--mb-text);background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:9px 14px;cursor:pointer}.mbw9 button:disabled{opacity:.55;cursor:default}.mbw9-drop{display:grid;gap:8px;padding:20px;border:1px dashed var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface)}.mbw9-drop input{font:inherit;max-width:100%;color:var(--mb-muted)}.mbw9-actions{margin-top:12px}.mbw9 button.mbw9-primary{background:var(--mb-accent);color:var(--mb-accent-contrast);border-color:var(--mb-accent)}.mbw9 [role=alert]{color:var(--mb-danger);margin-top:12px}.mbw9 button:focus-visible,.mbw9 input:focus-visible{outline:2px solid var(--mb-accent);outline-offset:3px}.mbw9{min-width:0}.mbw9-drop{grid-template-columns:minmax(0,1fr);min-width:0;white-space:normal}.mbw9-drop>*{min-width:0;overflow-wrap:anywhere}.mbw9-drop input{width:100%}.mbw9-current>div{min-width:0;max-width:100%}` }),
4771
+ document2 ? /* @__PURE__ */ jsxs13("div", { className: "mbw9-current", children: [
4772
+ /* @__PURE__ */ jsxs13("div", { children: [
4773
+ /* @__PURE__ */ jsx13("strong", { children: document2.filename }),
4774
+ document2.addedAt ? /* @__PURE__ */ jsxs13("p", { children: [
4775
+ "Added ",
4776
+ document2.addedAt
4777
+ ] }) : null
4778
+ ] }),
4779
+ onView ? /* @__PURE__ */ jsx13("button", { type: "button", disabled: busy || disabled, onClick: onView, children: "View W-9" }) : null
4780
+ ] }) : null,
4781
+ /* @__PURE__ */ jsxs13("label", { className: "mbw9-drop", onDragOver: (event) => event.preventDefault(), onDrop: (event) => {
4782
+ event.preventDefault();
4783
+ choose(event.dataTransfer.files[0] ?? null);
4784
+ }, children: [
4785
+ /* @__PURE__ */ jsx13("strong", { children: document2 ? "Replace practice W-9" : "Upload practice W-9" }),
4786
+ /* @__PURE__ */ jsxs13("p", { children: [
4787
+ "Choose or drop a PDF, up to ",
4788
+ Math.round(maxSizeBytes / 1024 / 1024),
4789
+ " MB. Your server securely stores the document for billing."
4790
+ ] }),
4791
+ /* @__PURE__ */ jsx13("input", { "aria-label": "W-9 PDF", type: "file", accept: "application/pdf,.pdf", disabled: busy || disabled, onChange: (event) => {
4792
+ choose(event.target.files?.[0] ?? null);
4793
+ event.target.value = "";
4794
+ } }),
4795
+ file ? /* @__PURE__ */ jsx13("p", { children: file.name }) : null
4796
+ ] }),
4797
+ /* @__PURE__ */ jsxs13("div", { className: "mbw9-actions", children: [
4798
+ /* @__PURE__ */ jsx13("p", { role: "status", children: busy ? "Working\u2026" : extractionLabels[extractionStatus] || (saved ? "W-9 saved." : "") }),
4799
+ /* @__PURE__ */ jsxs13("div", { children: [
4800
+ onRetryExtraction && (extractionStatus === "failed" || extractionStatus === "not_found") ? /* @__PURE__ */ jsx13("button", { type: "button", disabled: busy || disabled, onClick: () => void retry(), children: "Retry extraction" }) : null,
4801
+ " ",
4802
+ /* @__PURE__ */ jsx13("button", { className: "mbw9-primary", type: "button", disabled: !file || busy || disabled, onClick: () => void upload(), children: busy ? "Please wait\u2026" : "Upload W-9" })
4803
+ ] })
4804
+ ] }),
4805
+ error ? /* @__PURE__ */ jsx13("p", { role: "alert", children: error }) : null
4806
+ ] });
4807
+ }
4808
+
4714
4809
  // src/organization-onboarding.tsx
4715
- import { Fragment as Fragment10, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4810
+ import { Fragment as Fragment10, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
4716
4811
  var STEPS = [
4717
4812
  { id: "practice", label: "Practice & billing" },
4718
4813
  { id: "rendering", label: "Rendering providers" },
@@ -4786,18 +4881,17 @@ function OrganizationOnboarding({
4786
4881
  }),
4787
4882
  [sessionEndpoint, getSession, apiBaseUrl]
4788
4883
  );
4789
- const [profile, setProfile] = useState9(null);
4790
- const [loadError, setLoadError] = useState9(null);
4791
- const [step, setStep] = useState9("practice");
4792
- const [identity, setIdentity] = useState9({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
4793
- const [provider, setProvider] = useState9({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
4794
- const [locations, setLocations] = useState9([blankLocation()]);
4795
- const [rendering, setRendering] = useState9(blankRendering);
4884
+ const [profile, setProfile] = useState10(null);
4885
+ const [loadError, setLoadError] = useState10(null);
4886
+ const [step, setStep] = useState10("practice");
4887
+ const [identity, setIdentity] = useState10({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
4888
+ const [provider, setProvider] = useState10({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
4889
+ const [locations, setLocations] = useState10([blankLocation()]);
4890
+ const [rendering, setRendering] = useState10(blankRendering);
4796
4891
  const primaryGroup = useId2();
4797
- const [w9File, setW9File] = useState9(null);
4798
- const [saving, setSaving] = useState9(false);
4799
- const [error, setError] = useState9(null);
4800
- const [savedStep, setSavedStep] = useState9({});
4892
+ const [saving, setSaving] = useState10(false);
4893
+ const [error, setError] = useState10(null);
4894
+ const [savedStep, setSavedStep] = useState10({});
4801
4895
  const completedFired = useRef4(false);
4802
4896
  const adoptProfile = useCallback2((next) => {
4803
4897
  setProfile(next);
@@ -4865,39 +4959,50 @@ function OrganizationOnboarding({
4865
4959
  });
4866
4960
  }, "practice");
4867
4961
  const saveLocations = () => run(() => client.saveLocations(locations.filter((item) => item.name.trim() || item.street.trim())), "locations");
4868
- const saveW9 = () => run(async () => {
4869
- if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
4870
- return client.saveW9({ filename: w9File.name, contentBase64: await fileToBase64(w9File) });
4871
- }, "w9");
4872
- const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs13("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
4962
+ const saveW9 = async (file) => {
4963
+ setSaving(true);
4964
+ try {
4965
+ const next = await client.saveW9({ filename: file.name, contentBase64: await fileToBase64(file) });
4966
+ adoptProfile(next);
4967
+ setSavedStep((current) => ({ ...current, w9: true }));
4968
+ onSaved?.(next);
4969
+ if (variant === "onboarding") setStep("review");
4970
+ } catch (error2) {
4971
+ onError?.(error2 instanceof Error ? error2 : new Error("The W-9 could not be saved."));
4972
+ throw error2;
4973
+ } finally {
4974
+ setSaving(false);
4975
+ }
4976
+ };
4977
+ const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs14("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
4873
4978
  label,
4874
- /* @__PURE__ */ jsx13("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
4979
+ /* @__PURE__ */ jsx14("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
4875
4980
  ] });
4876
4981
  const setLocation = (index, patch) => setLocations((current) => current.map((item, itemIndex) => {
4877
4982
  if (itemIndex !== index) return patch.isPrimary ? { ...item, isPrimary: false } : item;
4878
4983
  return { ...item, ...patch };
4879
4984
  }));
4880
- const practiceSection = /* @__PURE__ */ jsxs13("div", { children: [
4881
- /* @__PURE__ */ jsx13("p", { className: "mbob-status", children: "Choose EIN for a business or SSN for an individual. Saved SSNs are encrypted and shown only by their last four digits." }),
4882
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", children: [
4985
+ const practiceSection = /* @__PURE__ */ jsxs14("div", { children: [
4986
+ /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "Choose EIN for a business or SSN for an individual. Saved SSNs are encrypted and shown only by their last four digits." }),
4987
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", children: [
4883
4988
  field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
4884
4989
  field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
4885
- /* @__PURE__ */ jsx13(TaxIdInput, { label: "Practice tax ID", value: identity, disabled: saving, onChange: (patch) => setIdentity((c) => ({ ...c, ...patch })) }),
4990
+ /* @__PURE__ */ jsx14(TaxIdInput, { label: "Practice tax ID", value: identity, disabled: saving, onChange: (patch) => setIdentity((c) => ({ ...c, ...patch })) }),
4886
4991
  field("Group NPI", identity.npi, (npi) => setIdentity((c) => ({ ...c, npi }))),
4887
4992
  field("Phone", identity.phone, (phone) => setIdentity((c) => ({ ...c, phone }))),
4888
4993
  field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
4889
4994
  ] }),
4890
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
4891
- /* @__PURE__ */ jsxs13("label", { className: "mbob-field", children: [
4995
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
4996
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-field", children: [
4892
4997
  "Saved billing provider",
4893
- /* @__PURE__ */ jsxs13("select", { disabled: saving, value: provider.id ?? "", onChange: (event) => setProvider({ ...profile?.billingProviders.find((item) => item.id === event.target.value) ?? { name: "", taxId: "", npi: "" } }), children: [
4894
- /* @__PURE__ */ jsx13("option", { value: "", children: "Add a billing provider" }),
4895
- profile?.billingProviders.map((item) => /* @__PURE__ */ jsx13("option", { value: item.id, children: item.name }, item.id))
4998
+ /* @__PURE__ */ jsxs14("select", { disabled: saving, value: provider.id ?? "", onChange: (event) => setProvider({ ...profile?.billingProviders.find((item) => item.id === event.target.value) ?? { name: "", taxId: "", npi: "" } }), children: [
4999
+ /* @__PURE__ */ jsx14("option", { value: "", children: "Add a billing provider" }),
5000
+ profile?.billingProviders.map((item) => /* @__PURE__ */ jsx14("option", { value: item.id, children: item.name }, item.id))
4896
5001
  ] })
4897
5002
  ] }),
4898
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", children: [
5003
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", children: [
4899
5004
  field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
4900
- /* @__PURE__ */ jsx13(TaxIdInput, { label: "Billing tax ID", value: provider, disabled: saving, onChange: (patch) => setProvider((c) => ({ ...c, ...patch })) }),
5005
+ /* @__PURE__ */ jsx14(TaxIdInput, { label: "Billing tax ID", value: provider, disabled: saving, onChange: (patch) => setProvider((c) => ({ ...c, ...patch })) }),
4901
5006
  field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
4902
5007
  field("Billing phone", provider.phone ?? "", (phone) => setProvider((c) => ({ ...c, phone }))),
4903
5008
  field("Street", provider.billingStreet ?? "", (billingStreet) => setProvider((c) => ({ ...c, billingStreet })), true),
@@ -4905,119 +5010,102 @@ function OrganizationOnboarding({
4905
5010
  field("State", provider.billingState ?? "", (billingState) => setProvider((c) => ({ ...c, billingState: billingState.toUpperCase().slice(0, 2) }))),
4906
5011
  field("ZIP", provider.billingZip ?? "", (billingZip) => setProvider((c) => ({ ...c, billingZip })))
4907
5012
  ] }),
4908
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4909
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
4910
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
5013
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5014
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
5015
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
4911
5016
  ] })
4912
5017
  ] });
4913
- const renderingSection = /* @__PURE__ */ jsxs13("div", { children: [
4914
- /* @__PURE__ */ jsxs13("label", { className: "mbob-field", children: [
5018
+ const renderingSection = /* @__PURE__ */ jsxs14("div", { children: [
5019
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-field", children: [
4915
5020
  "Saved rendering provider",
4916
- /* @__PURE__ */ jsxs13("select", { disabled: saving, value: rendering.id ?? "", onChange: (event) => setRendering({ ...profile?.renderingProviders?.find((item) => item.id === event.target.value) ?? blankRendering() }), children: [
4917
- /* @__PURE__ */ jsx13("option", { value: "", children: "Add a rendering provider" }),
4918
- profile?.renderingProviders?.map((item) => /* @__PURE__ */ jsxs13("option", { value: item.id, children: [
5021
+ /* @__PURE__ */ jsxs14("select", { disabled: saving, value: rendering.id ?? "", onChange: (event) => setRendering({ ...profile?.renderingProviders?.find((item) => item.id === event.target.value) ?? blankRendering() }), children: [
5022
+ /* @__PURE__ */ jsx14("option", { value: "", children: "Add a rendering provider" }),
5023
+ profile?.renderingProviders?.map((item) => /* @__PURE__ */ jsxs14("option", { value: item.id, children: [
4919
5024
  item.name,
4920
5025
  item.active === false ? " (inactive)" : ""
4921
5026
  ] }, item.id))
4922
5027
  ] })
4923
5028
  ] }),
4924
- /* @__PURE__ */ jsxs13("div", { className: "mbob-grid", style: { marginTop: 16 }, children: [
5029
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-grid", style: { marginTop: 16 }, children: [
4925
5030
  field("Rendering provider name", rendering.name, (name) => setRendering((c) => ({ ...c, name }))),
4926
5031
  field("Rendering NPI", rendering.npi, (npi) => setRendering((c) => ({ ...c, npi }))),
4927
5032
  field("Taxonomy", rendering.taxonomy ?? "", (taxonomy) => setRendering((c) => ({ ...c, taxonomy }))),
4928
5033
  field("Specialty", rendering.specialty ?? "", (specialty) => setRendering((c) => ({ ...c, specialty }))),
4929
5034
  field("License number", rendering.licenseNumber ?? "", (licenseNumber) => setRendering((c) => ({ ...c, licenseNumber }))),
4930
5035
  field("License state", rendering.licenseState ?? "", (licenseState) => setRendering((c) => ({ ...c, licenseState: licenseState.toUpperCase().slice(0, 2) }))),
4931
- /* @__PURE__ */ jsxs13("label", { children: [
4932
- /* @__PURE__ */ jsx13("input", { disabled: saving, type: "checkbox", checked: rendering.active !== false, onChange: (event) => setRendering((c) => ({ ...c, active: event.target.checked })) }),
5036
+ /* @__PURE__ */ jsxs14("label", { children: [
5037
+ /* @__PURE__ */ jsx14("input", { disabled: saving, type: "checkbox", checked: rendering.active !== false, onChange: (event) => setRendering((c) => ({ ...c, active: event.target.checked })) }),
4933
5038
  " Available for new bills"
4934
5039
  ] })
4935
5040
  ] }),
4936
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4937
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["rendering"] ? "Saved to MindBill." : "Saved profiles do not change previously submitted bills." }),
4938
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving || !rendering.name.trim(), onClick: () => run(() => client.saveBillingProfile({ renderingProviders: [rendering] }), "rendering"), children: saving ? "Saving\u2026" : "Save rendering provider" })
5041
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5042
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["rendering"] ? "Saved to MindBill." : "Saved profiles do not change previously submitted bills." }),
5043
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving || !rendering.name.trim(), onClick: () => run(() => client.saveBillingProfile({ renderingProviders: [rendering] }), "rendering"), children: saving ? "Saving\u2026" : "Save rendering provider" })
4939
5044
  ] })
4940
5045
  ] });
4941
- const locationsSection = /* @__PURE__ */ jsxs13("div", { children: [
4942
- locations.map((location, index) => /* @__PURE__ */ jsxs13("div", { className: "mbob-loc", children: [
5046
+ const locationsSection = /* @__PURE__ */ jsxs14("div", { children: [
5047
+ locations.map((location, index) => /* @__PURE__ */ jsxs14("div", { className: "mbob-loc", children: [
4943
5048
  field("Name", location.name ?? "", (name) => setLocation(index, { name })),
4944
5049
  field("Street", location.street, (street) => setLocation(index, { street })),
4945
5050
  field("City", location.city, (city) => setLocation(index, { city })),
4946
5051
  field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
4947
5052
  field("ZIP", location.zip, (zip) => setLocation(index, { zip })),
4948
5053
  field("Place of service code", location.posCode ?? "", (posCode) => setLocation(index, { posCode }), false, "11"),
4949
- /* @__PURE__ */ jsxs13("label", { className: "mbob-primary", children: [
4950
- /* @__PURE__ */ jsx13("input", { disabled: saving || location.active === false, type: "radio", name: primaryGroup, checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
5054
+ /* @__PURE__ */ jsxs14("label", { className: "mbob-primary", children: [
5055
+ /* @__PURE__ */ jsx14("input", { disabled: saving || location.active === false, type: "radio", name: primaryGroup, checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
4951
5056
  " Primary"
4952
5057
  ] }),
4953
- location.id ? /* @__PURE__ */ jsx13("button", { className: "mbob-secondary", disabled: saving, type: "button", onClick: () => setLocation(index, { active: location.active === false, ...location.active !== false ? { isPrimary: false } : {} }), children: location.active === false ? "Restore" : "Archive" }) : /* @__PURE__ */ jsx13("button", { className: "mbob-remove", disabled: saving, type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
5058
+ location.id ? /* @__PURE__ */ jsx14("button", { className: "mbob-secondary", disabled: saving, type: "button", onClick: () => setLocation(index, { active: location.active === false, ...location.active !== false ? { isPrimary: false } : {} }), children: location.active === false ? "Restore" : "Archive" }) : /* @__PURE__ */ jsx14("button", { className: "mbob-remove", disabled: saving, type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
4954
5059
  ] }, location.id ?? index)),
4955
- /* @__PURE__ */ jsx13("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
4956
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4957
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
4958
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
5060
+ /* @__PURE__ */ jsx14("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
5061
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-actions", children: [
5062
+ /* @__PURE__ */ jsx14("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
5063
+ /* @__PURE__ */ jsx14("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
4959
5064
  ] })
4960
5065
  ] });
4961
- const w9Section = /* @__PURE__ */ jsxs13("div", { children: [
4962
- profile?.w9 ? /* @__PURE__ */ jsxs13("div", { className: "mbob-w9-current", children: [
4963
- /* @__PURE__ */ jsxs13("div", { children: [
4964
- /* @__PURE__ */ jsx13("strong", { children: profile.w9.filename }),
4965
- /* @__PURE__ */ jsxs13("span", { children: [
4966
- " \xB7 added ",
4967
- profile.w9.addDate
4968
- ] })
4969
- ] }),
4970
- /* @__PURE__ */ jsx13("span", { children: "Rides on every bill automatically" })
4971
- ] }) : null,
4972
- /* @__PURE__ */ jsxs13("label", { className: "mbob-drop", children: [
4973
- /* @__PURE__ */ jsx13("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
4974
- /* @__PURE__ */ jsx13("strong", { children: w9File ? w9File.name : profile?.w9 ? "Replace the W-9 PDF" : "Drop the practice W-9 PDF here, or click to choose" }),
4975
- /* @__PURE__ */ jsx13("span", { children: "The W-9 is auto-attached to every submission." })
4976
- ] }),
4977
- /* @__PURE__ */ jsxs13("div", { className: "mbob-actions", children: [
4978
- /* @__PURE__ */ jsx13("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
4979
- /* @__PURE__ */ jsx13("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
4980
- ] })
5066
+ const w9Section = /* @__PURE__ */ jsxs14("div", { children: [
5067
+ /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "The saved W-9 is auto-attached to every submission." }),
5068
+ /* @__PURE__ */ jsx14(W9Upload, { ...appearance ? { appearance } : {}, ...profile?.w9 ? { document: { filename: profile.w9.filename, addedAt: profile.w9.addDate } } : {}, onUpload: saveW9, disabled: saving })
4981
5069
  ] });
4982
- const reviewSection = /* @__PURE__ */ jsxs13("div", { className: "mbob-check", children: [
4983
- (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs13("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
4984
- /* @__PURE__ */ jsx13("i", { children: item.complete ? "\u2713" : "\u2022" }),
4985
- /* @__PURE__ */ jsx13("span", { children: item.label })
5070
+ const reviewSection = /* @__PURE__ */ jsxs14("div", { className: "mbob-check", children: [
5071
+ (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs14("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
5072
+ /* @__PURE__ */ jsx14("i", { children: item.complete ? "\u2713" : "\u2022" }),
5073
+ /* @__PURE__ */ jsx14("span", { children: item.label })
4986
5074
  ] }, item.id)),
4987
- profile?.onboarding.complete ? /* @__PURE__ */ jsx13("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx13("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
5075
+ profile?.onboarding.complete ? /* @__PURE__ */ jsx14("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx14("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
4988
5076
  ] });
4989
5077
  const sections = { practice: practiceSection, rendering: renderingSection, locations: locationsSection, w9: w9Section, review: reviewSection };
4990
- return /* @__PURE__ */ jsxs13("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
4991
- /* @__PURE__ */ jsx13("style", { children: css9 }),
4992
- /* @__PURE__ */ jsxs13("div", { className: "mbob-card", children: [
4993
- /* @__PURE__ */ jsx13("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs13("div", { children: [
4994
- /* @__PURE__ */ jsx13("h2", { children: heading }),
4995
- /* @__PURE__ */ jsx13("p", { className: "mbob-copy", children: description })
5078
+ return /* @__PURE__ */ jsxs14("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
5079
+ /* @__PURE__ */ jsx14("style", { children: css9 }),
5080
+ /* @__PURE__ */ jsxs14("div", { className: "mbob-card", children: [
5081
+ /* @__PURE__ */ jsx14("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs14("div", { children: [
5082
+ /* @__PURE__ */ jsx14("h2", { children: heading }),
5083
+ /* @__PURE__ */ jsx14("p", { className: "mbob-copy", children: description })
4996
5084
  ] }) }),
4997
- loadError ? /* @__PURE__ */ jsx13("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
4998
- variant === "onboarding" ? /* @__PURE__ */ jsxs13(Fragment10, { children: [
4999
- /* @__PURE__ */ jsx13("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs13("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
5000
- /* @__PURE__ */ jsx13("i", { children: savedStep[item.id] ? "\u2713" : "" }),
5085
+ loadError ? /* @__PURE__ */ jsx14("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
5086
+ variant === "onboarding" ? /* @__PURE__ */ jsxs14(Fragment10, { children: [
5087
+ /* @__PURE__ */ jsx14("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs14("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
5088
+ /* @__PURE__ */ jsx14("i", { children: savedStep[item.id] ? "\u2713" : "" }),
5001
5089
  item.label
5002
5090
  ] }, item.id)) }),
5003
5091
  sections[step]
5004
- ] }) : /* @__PURE__ */ jsxs13(Fragment10, { children: [
5092
+ ] }) : /* @__PURE__ */ jsxs14(Fragment10, { children: [
5005
5093
  practiceSection,
5006
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Rendering providers" }),
5094
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Rendering providers" }),
5007
5095
  renderingSection,
5008
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Locations" }),
5096
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Locations" }),
5009
5097
  locationsSection,
5010
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Practice W-9" }),
5098
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Practice W-9" }),
5011
5099
  w9Section,
5012
- /* @__PURE__ */ jsx13("h3", { className: "mbob-subhead", children: "Checklist" }),
5100
+ /* @__PURE__ */ jsx14("h3", { className: "mbob-subhead", children: "Checklist" }),
5013
5101
  reviewSection
5014
5102
  ] }),
5015
- error ? /* @__PURE__ */ jsx13("div", { className: "mbob-error", role: "alert", children: error }) : null
5103
+ error ? /* @__PURE__ */ jsx14("div", { className: "mbob-error", role: "alert", children: error }) : null
5016
5104
  ] })
5017
5105
  ] });
5018
5106
  }
5019
5107
  function BillingSettings(props) {
5020
- return /* @__PURE__ */ jsx13(
5108
+ return /* @__PURE__ */ jsx14(
5021
5109
  OrganizationOnboarding,
5022
5110
  {
5023
5111
  heading: "Billing settings",
@@ -5028,9 +5116,311 @@ function BillingSettings(props) {
5028
5116
  );
5029
5117
  }
5030
5118
 
5119
+ // src/payment-review.tsx
5120
+ import { useEffect as useEffect9, useMemo as useMemo7, useState as useState11 } from "react";
5121
+
5122
+ // src/billing-operations-client.ts
5123
+ import {
5124
+ DEFAULT_API_BASE_URL,
5125
+ DEFAULT_SESSION_ENDPOINT
5126
+ } from "@mindbill/browser";
5127
+ async function responseError(response, fallback) {
5128
+ const body = await response.json().catch(() => null);
5129
+ const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
5130
+ return new Error(typeof detail === "string" ? detail : fallback);
5131
+ }
5132
+ function normalizeSession(value) {
5133
+ if (!value || typeof value !== "object") throw new Error("The MindBill session endpoint returned an invalid response.");
5134
+ const candidate = value;
5135
+ const nested = candidate.session ?? candidate.data;
5136
+ const session = nested && typeof nested === "object" ? nested : candidate;
5137
+ if (typeof session.token !== "string" || session.token.length < 8) {
5138
+ throw new Error("The MindBill session endpoint did not return a browser session token.");
5139
+ }
5140
+ return {
5141
+ token: session.token,
5142
+ ...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
5143
+ ...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
5144
+ };
5145
+ }
5146
+ function isFresh(session) {
5147
+ if (!session) return false;
5148
+ if (!session.expiresAt) return true;
5149
+ const expiresAt = Date.parse(session.expiresAt);
5150
+ return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
5151
+ }
5152
+ function queryString(values) {
5153
+ const params = new URLSearchParams();
5154
+ for (const [key, value] of Object.entries(values)) {
5155
+ if (value !== void 0 && value !== "") params.set(key, String(value));
5156
+ }
5157
+ const text = params.toString();
5158
+ return text ? `?${text}` : "";
5159
+ }
5160
+ function createBillingOperationsClient({
5161
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5162
+ getSession,
5163
+ apiBaseUrl = DEFAULT_API_BASE_URL,
5164
+ fetch: fetchOverride
5165
+ } = {}) {
5166
+ const fetcher = fetchOverride ?? globalThis.fetch;
5167
+ if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
5168
+ let session = null;
5169
+ let pendingSession = null;
5170
+ let pendingSessionSignal = null;
5171
+ const mintSession = async (signal, force = false) => {
5172
+ if (!force && isFresh(session)) return session;
5173
+ if (!force && pendingSession && !pendingSessionSignal?.aborted) return pendingSession;
5174
+ const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
5175
+ method: "POST",
5176
+ credentials: "same-origin",
5177
+ headers: { "content-type": "application/json" },
5178
+ body: JSON.stringify({}),
5179
+ signal
5180
+ }).then(async (response) => {
5181
+ if (!response.ok) throw await responseError(response, "MindBill browser session could not be created.");
5182
+ return response.json();
5183
+ });
5184
+ const request = Promise.resolve(pending).then(normalizeSession).then((next) => {
5185
+ session = next;
5186
+ return next;
5187
+ }).finally(() => {
5188
+ if (pendingSession === request) {
5189
+ pendingSession = null;
5190
+ pendingSessionSignal = null;
5191
+ }
5192
+ });
5193
+ pendingSession = request;
5194
+ pendingSessionSignal = signal;
5195
+ return request;
5196
+ };
5197
+ const get = async (path, signal) => {
5198
+ const controller = signal ? null : new AbortController();
5199
+ const requestSignal = signal ?? controller?.signal;
5200
+ if (!requestSignal) throw new Error("An AbortSignal could not be created.");
5201
+ let browserSession = await mintSession(requestSignal);
5202
+ const request = (active) => {
5203
+ const base = (active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
5204
+ return fetcher(`${base}${path}`, {
5205
+ headers: { authorization: `Bearer ${active.token}` },
5206
+ signal: requestSignal
5207
+ });
5208
+ };
5209
+ let response = await request(browserSession);
5210
+ if (response.status === 401) {
5211
+ session = null;
5212
+ browserSession = await mintSession(requestSignal, true);
5213
+ response = await request(browserSession);
5214
+ }
5215
+ if (!response.ok) throw await responseError(response, "MindBill data could not be loaded.");
5216
+ const body = await response.json();
5217
+ return body.data ?? body;
5218
+ };
5219
+ return {
5220
+ clearSession() {
5221
+ session = null;
5222
+ pendingSession = null;
5223
+ pendingSessionSignal = null;
5224
+ },
5225
+ getBills(query = {}, signal) {
5226
+ const { claimsAdministrator, taskType, taskSection: _taskSection, sort, status, ...filters } = query;
5227
+ void _taskSection;
5228
+ const sortKey = sort?.startsWith("balance_") ? "balanceDue" : sort?.startsWith("patient_") ? "patient" : sort ? "submitted" : void 0;
5229
+ return get(`/partner/v2/bill-dashboard${queryString({
5230
+ ...filters,
5231
+ status: status === "submitted" ? "sent" : status,
5232
+ claimsAdminId: claimsAdministrator,
5233
+ taskKind: taskType,
5234
+ sort: sortKey,
5235
+ dir: sort ? sort.endsWith("_asc") ? "asc" : "desc" : void 0
5236
+ })}`, signal);
5237
+ },
5238
+ getBillTasks(claimsAdministrator, signal, renderingProviderId) {
5239
+ return get(
5240
+ `/partner/v2/bill-tasks${queryString({ claimsAdminId: claimsAdministrator, renderingProviderId })}`,
5241
+ signal
5242
+ );
5243
+ },
5244
+ getServiceLineItems(range, signal) {
5245
+ return get(
5246
+ `/partner/v2/reports/service-line-items${queryString(range)}`,
5247
+ signal
5248
+ );
5249
+ },
5250
+ getPaymentReview(query = {}, signal) {
5251
+ return get(`/partner/v2/reports/payments${queryString(query)}`, signal);
5252
+ },
5253
+ getProductivity(range, signal) {
5254
+ return get(`/partner/v2/reports/productivity${queryString(range)}`, signal);
5255
+ }
5256
+ };
5257
+ }
5258
+
5259
+ // src/payment-review.tsx
5260
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5261
+ var localDate = (date2) => `${date2.getFullYear()}-${String(date2.getMonth() + 1).padStart(2, "0")}-${String(date2.getDate()).padStart(2, "0")}`;
5262
+ function paymentReviewDateRange(range, now = /* @__PURE__ */ new Date()) {
5263
+ if (range === "all") return {};
5264
+ const start = new Date(now.getFullYear(), now.getMonth(), now.getDate());
5265
+ if (range === "week") start.setDate(start.getDate() - (start.getDay() + 6) % 7);
5266
+ if (range === "month") start.setDate(1);
5267
+ if (range === "year") {
5268
+ start.setMonth(0);
5269
+ start.setDate(1);
5270
+ }
5271
+ return { receivedFrom: localDate(start), receivedTo: localDate(now) };
5272
+ }
5273
+ var money5 = (value) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
5274
+ var dateLabel = (value) => value ? value.slice(0, 10) : "\u2014";
5275
+ var paymentReviewRowKey = (item) => JSON.stringify([item.billId, item.id]);
5276
+ function paymentReviewCsv(items) {
5277
+ const escape = (value) => {
5278
+ let text = value == null ? "" : String(value);
5279
+ if (/^[\s]*[=+@-]/.test(text) || /^[\t\r\n]/.test(text)) text = `'${text}`;
5280
+ return `"${text.replaceAll('"', '""')}"`;
5281
+ };
5282
+ return [["Patient", "Bill", "Claim", "Date of service", "Received", "Posted", "Status", "Method", "Source", "Check / trace", "Amount"], ...items.map((item) => [item.patientName, item.billNumber, item.claimNumber, item.dateOfService, item.receivedDate, item.postedDate, "Received", item.method, item.source, item.checkNumber, item.amount])].map((row) => row.map(escape).join(",")).join("\r\n");
5283
+ }
5284
+ var css10 = `.mbpr{font:14px/1.5 var(--mb-font);color:var(--mb-text);min-width:0}.mbpr *{box-sizing:border-box}.mbpr h2,.mbpr p{margin:0}.mbpr h2{font-size:21px}.mbpr-head,.mbpr-actions,.mbpr-toolbar,.mbpr-pager{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.mbpr-head,.mbpr-pager{justify-content:space-between}.mbpr small,.mbpr-sub{color:var(--mb-muted)}.mbpr small{display:block;font-size:12px}.mbpr-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px 0}.mbpr-metric,.mbpr-card{background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius)}.mbpr-metric{padding:16px}.mbpr-metric strong{display:block;font-size:24px;line-height:1.4;font-variant-numeric:tabular-nums}.mbpr-card{overflow:hidden}.mbpr-controls{padding:14px;display:grid;gap:12px}.mbpr label{display:grid;gap:4px;font-size:12px}.mbpr input,.mbpr button{font:inherit;color:var(--mb-text);background:var(--mb-input);border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:8px 10px;min-height:38px}.mbpr button{cursor:pointer;white-space:nowrap}.mbpr button:disabled{opacity:.55;cursor:default}.mbpr button.active,.mbpr button.primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbpr button:focus-visible,.mbpr input:focus-visible{outline:2px solid var(--mb-accent);outline-offset:2px}.mbpr-search{flex:1;min-width:210px}.mbpr-scroll{overflow:auto}.mbpr table{width:100%;min-width:900px;border-collapse:collapse}.mbpr th,.mbpr td{padding:11px 13px;text-align:left;border-top:1px solid var(--mb-border)}.mbpr th{background:var(--mb-soft);color:var(--mb-muted);font-size:12px;font-weight:600}.mbpr .mbpr-money{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.mbpr .mbpr-link{color:var(--mb-accent);border:0;background:none;padding:0;min-height:30px}.mbpr-status{display:inline-block;background:color-mix(in srgb,var(--mb-success) 10%,var(--mb-surface));color:var(--mb-success);border-radius:var(--mb-control-radius);padding:2px 7px;font-size:12px}.mbpr-state{padding:30px;text-align:center;color:var(--mb-muted)}.mbpr-error{color:var(--mb-danger)}.mbpr-pager{padding:12px;border-top:1px solid var(--mb-border);color:var(--mb-muted);font-size:12px}@media(max-width:640px){.mbpr-metrics{gap:8px}.mbpr-metric{padding:10px}.mbpr-metric strong{font-size:20px}.mbpr-head{align-items:flex-start}.mbpr-toolbar label{flex:1}.mbpr-search{min-width:100%}.mbpr input{width:100%;min-width:0}}`;
5285
+ function ConnectedPaymentReview({ initialQuery, onSelectBill, onPostPayment, appearance, className = "", style, ...options }) {
5286
+ const client = useMemo7(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
5287
+ const [query, setQuery] = useState11(() => ({ ...paymentReviewDateRange("month"), page: 1, pageSize: 25, ...initialQuery }));
5288
+ const [range, setRange] = useState11(initialQuery?.receivedFrom || initialQuery?.receivedTo ? null : "month");
5289
+ const [search, setSearch] = useState11(initialQuery?.q ?? "");
5290
+ const [result, setResult] = useState11(null);
5291
+ const [loading, setLoading] = useState11(true);
5292
+ const [error, setError] = useState11(false);
5293
+ const [retry, setRetry] = useState11(0);
5294
+ const invalidRange = Boolean(query.receivedFrom && query.receivedTo && query.receivedFrom > query.receivedTo);
5295
+ useEffect9(() => {
5296
+ const controller = new AbortController();
5297
+ setResult(null);
5298
+ setError(false);
5299
+ if (invalidRange) {
5300
+ setLoading(false);
5301
+ return () => controller.abort();
5302
+ }
5303
+ setLoading(true);
5304
+ client.getPaymentReview(query, controller.signal).then((next) => {
5305
+ if (!controller.signal.aborted) setResult(next);
5306
+ }).catch(() => {
5307
+ if (!controller.signal.aborted) setError(true);
5308
+ }).finally(() => {
5309
+ if (!controller.signal.aborted) setLoading(false);
5310
+ });
5311
+ return () => controller.abort();
5312
+ }, [client, query, retry, invalidRange]);
5313
+ const update = (patch) => setQuery((current) => ({ ...current, ...patch, page: 1 }));
5314
+ const exportPage = () => {
5315
+ if (!result?.items.length || loading) return;
5316
+ const url = URL.createObjectURL(new Blob([paymentReviewCsv(result.items)], { type: "text/csv;charset=utf-8" }));
5317
+ const anchor = document.createElement("a");
5318
+ anchor.href = url;
5319
+ anchor.download = "payment-review-page.csv";
5320
+ anchor.click();
5321
+ URL.revokeObjectURL(url);
5322
+ };
5323
+ return /* @__PURE__ */ jsxs15("section", { className: `mbpr ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-label": "Payment review", children: [
5324
+ /* @__PURE__ */ jsx15("style", { children: css10 + `.mbpr{font-family:var(--mb-font,ui-sans-serif,system-ui,sans-serif)}@media(max-width:640px){.mbpr-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.mbpr-metric:first-child{grid-column:1/-1}.mbpr-metric strong{overflow-wrap:anywhere}}` }),
5325
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-head", children: [
5326
+ /* @__PURE__ */ jsxs15("div", { children: [
5327
+ /* @__PURE__ */ jsx15("h2", { children: "Payment review" }),
5328
+ /* @__PURE__ */ jsx15("p", { className: "mbpr-sub", children: "Review confirmed payments, check details, and cash totals." })
5329
+ ] }),
5330
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-actions", children: [
5331
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: !result?.items.length || loading, onClick: exportPage, children: "Export page" }),
5332
+ onPostPayment ? /* @__PURE__ */ jsx15("button", { className: "primary", type: "button", onClick: onPostPayment, children: "+ Post payment" }) : null
5333
+ ] })
5334
+ ] }),
5335
+ /* @__PURE__ */ jsx15("small", { children: "Pending EOR and 835 amounts are excluded until funds are confirmed. Historical legacy payments are also excluded." }),
5336
+ /* @__PURE__ */ jsx15("div", { className: "mbpr-metrics", children: [["Posted total", result ? money5(result.summary.postedTotal) : "\u2014"], ["Payment entries", result?.summary.entryCount ?? "\u2014"], ["Unique patients", result?.summary.uniquePatients ?? "\u2014"]].map(([label, value]) => /* @__PURE__ */ jsxs15("div", { className: "mbpr-metric", children: [
5337
+ /* @__PURE__ */ jsx15("small", { children: label }),
5338
+ /* @__PURE__ */ jsx15("strong", { children: value })
5339
+ ] }, label)) }),
5340
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-card", children: [
5341
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-controls", children: [
5342
+ /* @__PURE__ */ jsx15("div", { className: "mbpr-toolbar", "aria-label": "Quick range", children: [["today", "Today"], ["week", "This week"], ["month", "This month"], ["year", "This year"], ["all", "All dates"]].map(([id, label]) => /* @__PURE__ */ jsx15("button", { type: "button", className: range === id ? "active" : "", "aria-pressed": range === id, onClick: () => {
5343
+ setRange(id);
5344
+ setQuery((current) => {
5345
+ const next = { ...current };
5346
+ delete next.receivedFrom;
5347
+ delete next.receivedTo;
5348
+ return { ...next, ...paymentReviewDateRange(id), page: 1 };
5349
+ });
5350
+ }, children: label }, id)) }),
5351
+ /* @__PURE__ */ jsxs15("form", { className: "mbpr-toolbar", onSubmit: (event) => {
5352
+ event.preventDefault();
5353
+ update({ q: search });
5354
+ }, children: [
5355
+ /* @__PURE__ */ jsxs15("label", { className: "mbpr-search", children: [
5356
+ "Search",
5357
+ /* @__PURE__ */ jsx15("input", { type: "search", placeholder: "Patient, bill, claim, payer, or check\u2026", value: search, onChange: (event) => setSearch(event.target.value) })
5358
+ ] }),
5359
+ /* @__PURE__ */ jsx15("button", { type: "submit", children: "Search" }),
5360
+ /* @__PURE__ */ jsxs15("label", { children: [
5361
+ "Received from",
5362
+ /* @__PURE__ */ jsx15("input", { type: "date", value: query.receivedFrom ?? "", onChange: (event) => {
5363
+ setRange(null);
5364
+ update({ receivedFrom: event.target.value });
5365
+ } })
5366
+ ] }),
5367
+ /* @__PURE__ */ jsxs15("label", { children: [
5368
+ "Received through",
5369
+ /* @__PURE__ */ jsx15("input", { type: "date", value: query.receivedTo ?? "", onChange: (event) => {
5370
+ setRange(null);
5371
+ update({ receivedTo: event.target.value });
5372
+ } })
5373
+ ] })
5374
+ ] })
5375
+ ] }),
5376
+ invalidRange ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state mbpr-error", role: "alert", children: "The received-through date must be on or after the received-from date." }) : loading ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state", role: "status", children: "Loading payments\u2026" }) : error ? /* @__PURE__ */ jsxs15("div", { className: "mbpr-state mbpr-error", role: "alert", children: [
5377
+ "Payments could not be loaded. ",
5378
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => setRetry((value) => value + 1), children: "Retry" })
5379
+ ] }) : !result?.items.length ? /* @__PURE__ */ jsx15("p", { className: "mbpr-state", children: "No confirmed payments match these filters." }) : /* @__PURE__ */ jsx15("div", { className: "mbpr-scroll", tabIndex: 0, role: "region", "aria-label": "Payment entries", children: /* @__PURE__ */ jsxs15("table", { children: [
5380
+ /* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { children: ["Patient", "Bill / DOS", "Received", "Posted", "Status", "Method / source", "Check / trace", "Amount"].map((label) => /* @__PURE__ */ jsx15("th", { scope: "col", className: label === "Amount" ? "mbpr-money" : "", children: label }, label)) }) }),
5381
+ /* @__PURE__ */ jsx15("tbody", { children: result.items.map((item) => /* @__PURE__ */ jsxs15("tr", { children: [
5382
+ /* @__PURE__ */ jsxs15("td", { children: [
5383
+ item.patientName,
5384
+ /* @__PURE__ */ jsx15("small", { children: item.claimNumber })
5385
+ ] }),
5386
+ /* @__PURE__ */ jsxs15("td", { children: [
5387
+ onSelectBill ? /* @__PURE__ */ jsx15("button", { type: "button", className: "mbpr-link", onClick: () => onSelectBill(item.billId), children: item.billNumber == null ? "View bill" : `Bill #${item.billNumber}` }) : item.billNumber == null ? "\u2014" : `Bill #${item.billNumber}`,
5388
+ /* @__PURE__ */ jsxs15("small", { children: [
5389
+ "DOS ",
5390
+ dateLabel(item.dateOfService)
5391
+ ] })
5392
+ ] }),
5393
+ /* @__PURE__ */ jsx15("td", { children: dateLabel(item.receivedDate) }),
5394
+ /* @__PURE__ */ jsx15("td", { children: dateLabel(item.postedDate) }),
5395
+ /* @__PURE__ */ jsx15("td", { children: /* @__PURE__ */ jsx15("span", { className: "mbpr-status", children: "Received" }) }),
5396
+ /* @__PURE__ */ jsxs15("td", { children: [
5397
+ item.method || "\u2014",
5398
+ /* @__PURE__ */ jsx15("small", { children: item.source })
5399
+ ] }),
5400
+ /* @__PURE__ */ jsx15("td", { children: item.checkNumber || "\u2014" }),
5401
+ /* @__PURE__ */ jsx15("td", { className: "mbpr-money", children: money5(item.amount) })
5402
+ ] }, paymentReviewRowKey(item))) })
5403
+ ] }) }),
5404
+ result ? /* @__PURE__ */ jsxs15("div", { className: "mbpr-pager", children: [
5405
+ /* @__PURE__ */ jsxs15("span", { children: [
5406
+ result.total,
5407
+ " entries \xB7 Page ",
5408
+ result.page,
5409
+ " of ",
5410
+ Math.max(1, Math.ceil(result.total / result.pageSize))
5411
+ ] }),
5412
+ /* @__PURE__ */ jsxs15("div", { className: "mbpr-actions", children: [
5413
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: result.page <= 1, onClick: () => setQuery((current) => ({ ...current, page: Math.max(1, result.page - 1) })), children: "Previous" }),
5414
+ /* @__PURE__ */ jsx15("button", { type: "button", disabled: result.page * result.pageSize >= result.total, onClick: () => setQuery((current) => ({ ...current, page: result.page + 1 })), children: "Next" })
5415
+ ] })
5416
+ ] }) : null
5417
+ ] })
5418
+ ] });
5419
+ }
5420
+
5031
5421
  // src/notification-settings.tsx
5032
- import { useEffect as useEffect9, useId as useId3, useRef as useRef5, useState as useState10 } from "react";
5033
- import { Fragment as Fragment11, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5422
+ import { useEffect as useEffect10, useId as useId3, useRef as useRef5, useState as useState12 } from "react";
5423
+ import { Fragment as Fragment11, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
5034
5424
  function defaultNotificationPreferences() {
5035
5425
  return { enabled: false, statusUpdates: false, agingDays: [], quietHours: true };
5036
5426
  }
@@ -5048,7 +5438,7 @@ function notificationSettingsNeedsConsent(previous, next) {
5048
5438
  if (!previous?.enabled || previous.statusUpdates !== next.statusUpdates || previous.quietHours !== next.quietHours) return true;
5049
5439
  return JSON.stringify(notificationSettingsUpdate(previous, false).agingDays) !== JSON.stringify(notificationSettingsUpdate(next, false).agingDays);
5050
5440
  }
5051
- var css10 = `
5441
+ var css11 = `
5052
5442
  .mbns{color:var(--mb-text);font-family:var(--mb-font);font-size:14px;line-height:1.5;min-width:0}.mbns *{box-sizing:border-box}.mbns h2,.mbns p{margin:0}.mbns-card{padding:24px;background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}
5053
5443
  .mbns-header{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;margin-bottom:24px}.mbns h2{font-size:20px;line-height:1.3;font-weight:700}.mbns-muted{color:var(--mb-muted)}.mbns-header p{margin-top:6px;max-width:56ch}.mbns-badge{flex-shrink:0;background:var(--mb-soft);color:var(--mb-muted);padding:4px 9px;border-radius:var(--mb-control-radius);font-size:12px;font-weight:650}
5054
5444
  .mbns-account{padding:14px 16px;background:var(--mb-soft);border-radius:var(--mb-control-radius);margin-bottom:20px;overflow-wrap:anywhere}.mbns-account strong{display:block;font-weight:650}.mbns-account p{margin-top:3px;font-size:13px}
@@ -5056,20 +5446,20 @@ var css10 = `
5056
5446
  .mbns button{font:inherit;min-height:44px;padding:10px 16px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:var(--mb-text);font-weight:650;cursor:pointer}.mbns button.mbns-save{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbns button:disabled{opacity:.5;cursor:not-allowed}.mbns input:focus-visible,.mbns button:focus-visible{outline:2px solid var(--mb-accent);outline-offset:3px}.mbns-notice{margin-top:16px!important;color:var(--mb-muted)}.mbns-error{color:var(--mb-danger)}.mbns :disabled+span{opacity:.6}@media(max-width:540px){.mbns-card{padding:18px}.mbns-header{gap:8px}.mbns-actions button{flex:1 1 auto}.mbns-days{gap:4px 18px}}
5057
5447
  `;
5058
5448
  function NotificationSettings(props) {
5059
- return /* @__PURE__ */ jsx14(NotificationSettingsSession, { ...props }, props.identityKey);
5449
+ return /* @__PURE__ */ jsx16(NotificationSettingsSession, { ...props }, props.identityKey);
5060
5450
  }
5061
5451
  var ConnectedNotificationSettings = NotificationSettings;
5062
5452
  function NotificationSettingsSession({ adapter, appearance, className, style, onSaved }) {
5063
5453
  const titleId = useId3();
5064
- const [snapshot, setSnapshot] = useState10(null);
5065
- const [draft, setDraft] = useState10(defaultNotificationPreferences);
5066
- const [consent, setConsent] = useState10(false);
5067
- const [phase, setPhase] = useState10("loading");
5068
- const [notice, setNotice] = useState10("");
5069
- const [failed, setFailed] = useState10(false);
5070
- const [reload, setReload] = useState10(0);
5454
+ const [snapshot, setSnapshot] = useState12(null);
5455
+ const [draft, setDraft] = useState12(defaultNotificationPreferences);
5456
+ const [consent, setConsent] = useState12(false);
5457
+ const [phase, setPhase] = useState12("loading");
5458
+ const [notice, setNotice] = useState12("");
5459
+ const [failed, setFailed] = useState12(false);
5460
+ const [reload, setReload] = useState12(0);
5071
5461
  const request = useRef5(0);
5072
- useEffect9(() => {
5462
+ useEffect10(() => {
5073
5463
  const current = ++request.current;
5074
5464
  setPhase("loading");
5075
5465
  setSnapshot(null);
@@ -5127,96 +5517,275 @@ function NotificationSettingsSession({ adapter, appearance, className, style, on
5127
5517
  setNotice("We couldn't confirm your changes. Retry, or reload settings to check their current state.");
5128
5518
  }
5129
5519
  };
5130
- return /* @__PURE__ */ jsxs14("section", { className: `mbns ${className ?? ""}`, style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-labelledby": titleId, "aria-busy": phase === "loading" || phase === "saving", children: [
5131
- /* @__PURE__ */ jsx14("style", { children: css10 }),
5132
- /* @__PURE__ */ jsxs14("div", { className: "mbns-card", children: [
5133
- /* @__PURE__ */ jsxs14("header", { className: "mbns-header", children: [
5134
- /* @__PURE__ */ jsxs14("div", { children: [
5135
- /* @__PURE__ */ jsx14("h2", { id: titleId, children: "Email notifications" }),
5136
- /* @__PURE__ */ jsx14("p", { className: "mbns-muted", children: "Choose which billing updates reach your inbox. Notifications are off until you opt in." })
5520
+ return /* @__PURE__ */ jsxs16("section", { className: `mbns ${className ?? ""}`, style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-labelledby": titleId, "aria-busy": phase === "loading" || phase === "saving", children: [
5521
+ /* @__PURE__ */ jsx16("style", { children: css11 }),
5522
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-card", children: [
5523
+ /* @__PURE__ */ jsxs16("header", { className: "mbns-header", children: [
5524
+ /* @__PURE__ */ jsxs16("div", { children: [
5525
+ /* @__PURE__ */ jsx16("h2", { id: titleId, children: "Email notifications" }),
5526
+ /* @__PURE__ */ jsx16("p", { className: "mbns-muted", children: "Choose which billing updates reach your inbox. Notifications are off until you opt in." })
5137
5527
  ] }),
5138
- /* @__PURE__ */ jsx14("span", { className: "mbns-badge", children: !snapshot ? "\u2014" : snapshot.preferences?.enabled ? "On" : "Off" })
5528
+ /* @__PURE__ */ jsx16("span", { className: "mbns-badge", children: !snapshot ? "\u2014" : snapshot.preferences?.enabled ? "On" : "Off" })
5139
5529
  ] }),
5140
- phase === "loading" ? /* @__PURE__ */ jsx14("p", { role: "status", className: "mbns-muted", children: "Loading notification preferences\u2026" }) : phase === "error" ? /* @__PURE__ */ jsxs14("div", { children: [
5141
- /* @__PURE__ */ jsx14("p", { role: "alert", className: "mbns-error", children: "We couldn't load your preferences. No settings have been changed." }),
5142
- /* @__PURE__ */ jsx14("div", { className: "mbns-actions", children: /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading" }) })
5143
- ] }) : snapshot ? /* @__PURE__ */ jsxs14(Fragment11, { children: [
5144
- /* @__PURE__ */ jsxs14("div", { className: "mbns-account", children: [
5145
- /* @__PURE__ */ jsx14("strong", { children: snapshot.email || "No verified email address" }),
5146
- /* @__PURE__ */ jsxs14("p", { className: "mbns-muted", children: [
5530
+ phase === "loading" ? /* @__PURE__ */ jsx16("p", { role: "status", className: "mbns-muted", children: "Loading notification preferences\u2026" }) : phase === "error" ? /* @__PURE__ */ jsxs16("div", { children: [
5531
+ /* @__PURE__ */ jsx16("p", { role: "alert", className: "mbns-error", children: "We couldn't load your preferences. No settings have been changed." }),
5532
+ /* @__PURE__ */ jsx16("div", { className: "mbns-actions", children: /* @__PURE__ */ jsx16("button", { type: "button", onClick: () => setReload((value) => value + 1), children: "Retry loading" }) })
5533
+ ] }) : snapshot ? /* @__PURE__ */ jsxs16(Fragment11, { children: [
5534
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-account", children: [
5535
+ /* @__PURE__ */ jsx16("strong", { children: snapshot.email || "No verified email address" }),
5536
+ /* @__PURE__ */ jsxs16("p", { className: "mbns-muted", children: [
5147
5537
  snapshot.audience === "practice" ? "Updates for this practice's bills" : "Updates only for bills assigned to you",
5148
5538
  ". Your application manages this address and access."
5149
5539
  ] })
5150
5540
  ] }),
5151
- snapshot.environment === "sandbox" && /* @__PURE__ */ jsx14("p", { className: "mbns-notice", children: "Sandbox preview only. No notification emails will be sent." }),
5152
- !snapshot.canEnable && /* @__PURE__ */ jsx14("p", { className: "mbns-notice", children: "Notifications aren't available for this account yet. Ask your administrator to confirm email verification, billing access and notification availability. You can still turn existing notifications off." }),
5153
- /* @__PURE__ */ jsxs14("label", { className: "mbns-check", children: [
5154
- /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: draft.enabled, disabled: busy || !snapshot.canEnable && !draft.enabled, onChange: (event) => update({ enabled: event.target.checked }) }),
5155
- /* @__PURE__ */ jsxs14("span", { children: [
5156
- /* @__PURE__ */ jsx14("strong", { children: "Send me billing updates" }),
5157
- /* @__PURE__ */ jsx14("small", { children: "Emails contain a general alert, not patient details or attachments." })
5541
+ snapshot.environment === "sandbox" && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Sandbox preview only. No notification emails will be sent." }),
5542
+ !snapshot.canEnable && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Notifications aren't available for this account yet. Ask your administrator to confirm email verification, billing access and notification availability. You can still turn existing notifications off." }),
5543
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5544
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.enabled, disabled: busy || !snapshot.canEnable && !draft.enabled, onChange: (event) => update({ enabled: event.target.checked }) }),
5545
+ /* @__PURE__ */ jsxs16("span", { children: [
5546
+ /* @__PURE__ */ jsx16("strong", { children: "Send me billing updates" }),
5547
+ /* @__PURE__ */ jsx16("small", { children: "Emails contain a general alert, not patient details or attachments." })
5158
5548
  ] })
5159
5549
  ] }),
5160
- /* @__PURE__ */ jsxs14("fieldset", { disabled: busy || !draft.enabled || !snapshot.canEnable, children: [
5161
- /* @__PURE__ */ jsx14("legend", { children: "Updates to receive" }),
5162
- /* @__PURE__ */ jsxs14("label", { className: "mbns-check", children: [
5163
- /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: draft.statusUpdates, onChange: (event) => update({ statusUpdates: event.target.checked }) }),
5164
- /* @__PURE__ */ jsxs14("span", { children: [
5165
- /* @__PURE__ */ jsx14("strong", { children: "Bill status changes" }),
5166
- /* @__PURE__ */ jsx14("small", { children: "Follow accepted, rejected, processed and payment updates." })
5550
+ /* @__PURE__ */ jsxs16("fieldset", { disabled: busy || !draft.enabled || !snapshot.canEnable, children: [
5551
+ /* @__PURE__ */ jsx16("legend", { children: "Updates to receive" }),
5552
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5553
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.statusUpdates, onChange: (event) => update({ statusUpdates: event.target.checked }) }),
5554
+ /* @__PURE__ */ jsxs16("span", { children: [
5555
+ /* @__PURE__ */ jsx16("strong", { children: "Bill status changes" }),
5556
+ /* @__PURE__ */ jsx16("small", { children: "Follow accepted, rejected, processed and payment updates." })
5167
5557
  ] })
5168
5558
  ] }),
5169
- /* @__PURE__ */ jsx14("p", { className: "mbns-muted", children: "Remind me when a bill is still waiting for a payer:" }),
5170
- /* @__PURE__ */ jsx14("div", { className: "mbns-days", children: [30, 60, 90].map((day) => /* @__PURE__ */ jsxs14("label", { className: "mbns-check", children: [
5171
- /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: draft.agingDays.includes(day), onChange: (event) => update({ agingDays: event.target.checked ? [...draft.agingDays, day] : draft.agingDays.filter((value) => value !== day) }) }),
5172
- /* @__PURE__ */ jsxs14("span", { children: [
5559
+ /* @__PURE__ */ jsx16("p", { className: "mbns-muted", children: "Remind me when a bill is still waiting for a payer:" }),
5560
+ /* @__PURE__ */ jsx16("div", { className: "mbns-days", children: [30, 60, 90].map((day) => /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5561
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.agingDays.includes(day), onChange: (event) => update({ agingDays: event.target.checked ? [...draft.agingDays, day] : draft.agingDays.filter((value) => value !== day) }) }),
5562
+ /* @__PURE__ */ jsxs16("span", { children: [
5173
5563
  day,
5174
5564
  " days"
5175
5565
  ] })
5176
5566
  ] }, day)) }),
5177
- /* @__PURE__ */ jsxs14("label", { className: "mbns-check", children: [
5178
- /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: draft.quietHours, onChange: (event) => update({ quietHours: event.target.checked }) }),
5179
- /* @__PURE__ */ jsxs14("span", { children: [
5180
- /* @__PURE__ */ jsx14("strong", { children: "Quiet hours" }),
5181
- /* @__PURE__ */ jsx14("small", { children: "Hold emails from 7 pm to 7 am Pacific time." })
5567
+ /* @__PURE__ */ jsxs16("label", { className: "mbns-check", children: [
5568
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: draft.quietHours, onChange: (event) => update({ quietHours: event.target.checked }) }),
5569
+ /* @__PURE__ */ jsxs16("span", { children: [
5570
+ /* @__PURE__ */ jsx16("strong", { children: "Quiet hours" }),
5571
+ /* @__PURE__ */ jsx16("small", { children: "Hold emails from 7 pm to 7 am Pacific time." })
5182
5572
  ] })
5183
5573
  ] })
5184
5574
  ] }),
5185
- draft.enabled && !hasCategory && /* @__PURE__ */ jsx14("p", { className: "mbns-notice", children: "Select at least one update type to enable notifications." }),
5186
- needsConsent && /* @__PURE__ */ jsxs14("label", { className: "mbns-check mbns-consent", children: [
5187
- /* @__PURE__ */ jsx14("input", { type: "checkbox", checked: consent, disabled: busy || !snapshot.canEnable, onChange: (event) => setConsent(event.target.checked) }),
5188
- /* @__PURE__ */ jsxs14("span", { children: [
5575
+ draft.enabled && !hasCategory && /* @__PURE__ */ jsx16("p", { className: "mbns-notice", children: "Select at least one update type to enable notifications." }),
5576
+ needsConsent && /* @__PURE__ */ jsxs16("label", { className: "mbns-check mbns-consent", children: [
5577
+ /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: consent, disabled: busy || !snapshot.canEnable, onChange: (event) => setConsent(event.target.checked) }),
5578
+ /* @__PURE__ */ jsxs16("span", { children: [
5189
5579
  "I agree to receive the selected billing emails ",
5190
5580
  snapshot.audience === "practice" ? "for this practice" : "for bills assigned to me",
5191
5581
  " at the address above. I can unsubscribe at any time."
5192
5582
  ] })
5193
5583
  ] }),
5194
- /* @__PURE__ */ jsxs14("div", { className: "mbns-actions", children: [
5195
- /* @__PURE__ */ jsx14("button", { type: "button", className: "mbns-save", disabled: !canSave, onClick: () => void save(false), children: phase === "saving" ? "Saving\u2026" : "Save preferences" }),
5196
- snapshot.preferences?.enabled && /* @__PURE__ */ jsx14("button", { type: "button", disabled: busy, onClick: () => void save(true), children: "Unsubscribe from all" }),
5197
- failed && /* @__PURE__ */ jsx14("button", { type: "button", disabled: busy, onClick: () => setReload((value) => value + 1), children: "Reload settings" })
5584
+ /* @__PURE__ */ jsxs16("div", { className: "mbns-actions", children: [
5585
+ /* @__PURE__ */ jsx16("button", { type: "button", className: "mbns-save", disabled: !canSave, onClick: () => void save(false), children: phase === "saving" ? "Saving\u2026" : "Save preferences" }),
5586
+ snapshot.preferences?.enabled && /* @__PURE__ */ jsx16("button", { type: "button", disabled: busy, onClick: () => void save(true), children: "Unsubscribe from all" }),
5587
+ failed && /* @__PURE__ */ jsx16("button", { type: "button", disabled: busy, onClick: () => setReload((value) => value + 1), children: "Reload settings" })
5198
5588
  ] }),
5199
- notice && /* @__PURE__ */ jsx14("p", { className: `mbns-notice ${failed ? "mbns-error" : ""}`, role: failed ? "alert" : "status", children: notice })
5589
+ notice && /* @__PURE__ */ jsx16("p", { className: `mbns-notice ${failed ? "mbns-error" : ""}`, role: failed ? "alert" : "status", children: notice })
5200
5590
  ] }) : null
5201
5591
  ] })
5202
5592
  ] });
5203
5593
  }
5204
5594
 
5595
+ // src/notification-recipients.tsx
5596
+ import { useEffect as useEffect11, useId as useId4, useRef as useRef6, useState as useState13 } from "react";
5597
+ import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
5598
+ function notificationRecipientInvitation(input, requestId) {
5599
+ const preferences = notificationSettingsUpdate({ ...input, enabled: false }, false);
5600
+ return {
5601
+ requestId,
5602
+ email: input.email.trim().toLowerCase(),
5603
+ audience: input.audience,
5604
+ statusUpdates: preferences.statusUpdates,
5605
+ agingDays: preferences.agingDays,
5606
+ quietHours: preferences.quietHours
5607
+ };
5608
+ }
5609
+ var css12 = `
5610
+ .mbnr{font:14px/1.5 var(--mb-font);color:var(--mb-text);min-width:0}.mbnr *{box-sizing:border-box}.mbnr h2,.mbnr h3,.mbnr p{margin:0}.mbnr h2{font-size:20px}.mbnr h3{font-size:15px}.mbnr-card{border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);padding:24px}.mbnr header{display:flex;gap:16px;justify-content:space-between;align-items:start;margin-bottom:24px}.mbnr-muted{color:var(--mb-muted)}.mbnr header p{margin-top:6px;max-width:65ch}.mbnr-badge{background:var(--mb-soft);padding:4px 9px;border-radius:var(--mb-control-radius);white-space:nowrap;font-size:12px}.mbnr-form{display:grid;gap:16px;padding:20px;background:var(--mb-soft);border-radius:var(--mb-control-radius)}.mbnr-fields{display:grid;grid-template-columns:1fr 1fr;gap:16px}.mbnr label{display:block}.mbnr label>span{display:block;font-weight:600;margin-bottom:6px}.mbnr input[type=email],.mbnr select{width:100%;min-height:44px;background:var(--mb-surface);color:var(--mb-text);font:inherit;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:10px 12px}.mbnr-check{display:flex!important;gap:10px;align-items:center;min-height:36px}.mbnr input[type=checkbox]{width:17px;height:17px;accent-color:var(--mb-accent)}.mbnr fieldset{border:0;margin:0;padding:0;min-width:0}.mbnr legend{font-weight:600;margin-bottom:6px}.mbnr-days{display:flex;gap:20px;flex-wrap:wrap}.mbnr button{font:inherit;font-weight:600;min-height:44px;padding:10px 14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);color:var(--mb-text);cursor:pointer}.mbnr button:disabled{opacity:.5;cursor:not-allowed}.mbnr button.mbnr-primary{background:var(--mb-accent);border-color:var(--mb-accent);color:var(--mb-accent-contrast)}.mbnr :is(input,button,select):focus-visible{outline:2px solid var(--mb-accent);outline-offset:3px}.mbnr-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:center}.mbnr-list{margin-top:28px;display:grid;gap:12px}.mbnr-recipient{border-top:1px solid var(--mb-border);padding-top:16px;display:flex;gap:16px;justify-content:space-between;align-items:start}.mbnr-email{overflow-wrap:anywhere;font-weight:600}.mbnr-state{display:flex;gap:10px;align-items:center;flex-shrink:0}.mbnr-error{color:var(--mb-danger)}.mbnr-notice{margin-top:16px!important}.mbnr-pagination{margin-top:20px}.mbnr-empty{padding:20px 0;color:var(--mb-muted)}@media(max-width:600px){.mbnr-card{padding:18px}.mbnr-form{padding:16px}.mbnr-fields{grid-template-columns:1fr}.mbnr-recipient{flex-direction:column}.mbnr-state{width:100%;justify-content:space-between}.mbnr header{flex-wrap:wrap}}
5611
+ `;
5612
+ function NotificationRecipientsSettings(props) {
5613
+ return /* @__PURE__ */ jsx17(RecipientSettingsSession, { ...props }, props.identityKey);
5614
+ }
5615
+ var ConnectedNotificationRecipientsSettings = NotificationRecipientsSettings;
5616
+ function RecipientSettingsSession({ adapter, appearance, className, style }) {
5617
+ const titleId = useId4();
5618
+ const [snapshot, setSnapshot] = useState13(null);
5619
+ const [email, setEmail] = useState13("");
5620
+ const [audience, setAudience] = useState13("assigned_bills");
5621
+ const [preferences, setPreferences] = useState13(defaultNotificationPreferences);
5622
+ const [offset, setOffset] = useState13(0);
5623
+ const [reload, setReload] = useState13(0);
5624
+ const [busy, setBusy] = useState13(true);
5625
+ const [notice, setNotice] = useState13("");
5626
+ const [failed, setFailed] = useState13(false);
5627
+ const [hasReceipt, setHasReceipt] = useState13(false);
5628
+ const generation = useRef6(0);
5629
+ const pending = useRef6(null);
5630
+ useEffect11(() => {
5631
+ const current = ++generation.current;
5632
+ setBusy(true);
5633
+ setSnapshot(null);
5634
+ void Promise.resolve().then(() => adapter.load(offset)).then((result) => {
5635
+ if (current !== generation.current) return;
5636
+ setSnapshot(result);
5637
+ setBusy(false);
5638
+ }).catch(() => {
5639
+ if (current !== generation.current) return;
5640
+ setBusy(false);
5641
+ setFailed(true);
5642
+ setNotice("Could not load recipients. No settings have been changed.");
5643
+ });
5644
+ return () => {
5645
+ generation.current++;
5646
+ };
5647
+ }, [adapter, offset, reload]);
5648
+ async function mutate(action, invitation = false) {
5649
+ if (busy) return;
5650
+ const current = ++generation.current;
5651
+ setBusy(true);
5652
+ setNotice("");
5653
+ setFailed(false);
5654
+ try {
5655
+ const message = await action();
5656
+ if (current !== generation.current) return;
5657
+ if (invitation) setHasReceipt(true);
5658
+ setNotice(message);
5659
+ setReload((value) => value + 1);
5660
+ } catch {
5661
+ if (current !== generation.current) return;
5662
+ setBusy(false);
5663
+ setFailed(true);
5664
+ setNotice("We couldn't confirm the request. Retry unchanged to check the same invitation, or reload recipients. Do not assume an email was sent.");
5665
+ }
5666
+ }
5667
+ const canInvite = !busy && !!snapshot?.available && !!email.trim() && (preferences.statusUpdates || preferences.agingDays.length > 0);
5668
+ return /* @__PURE__ */ jsxs17("section", { className: `mbnr ${className ?? ""}`, style: { ...mindBillAppearanceStyle(appearance), ...style }, "aria-labelledby": titleId, "aria-busy": busy, children: [
5669
+ /* @__PURE__ */ jsx17("style", { children: css12 }),
5670
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-card", children: [
5671
+ /* @__PURE__ */ jsxs17("header", { children: [
5672
+ /* @__PURE__ */ jsxs17("div", { children: [
5673
+ /* @__PURE__ */ jsx17("h2", { id: titleId, children: "Notification recipients" }),
5674
+ /* @__PURE__ */ jsx17("p", { className: "mbnr-muted", children: "Add any email address for billing alerts. No MindBill console account is needed. Notifications stay off until the recipient confirms." })
5675
+ ] }),
5676
+ /* @__PURE__ */ jsx17("span", { className: "mbnr-badge", children: "Default off" })
5677
+ ] }),
5678
+ snapshot?.environment === "sandbox" && /* @__PURE__ */ jsx17("p", { className: "mbnr-notice mbnr-muted", children: "Sandbox preview. No emails are sent." }),
5679
+ snapshot && !snapshot.available && /* @__PURE__ */ jsx17("p", { className: "mbnr-notice mbnr-muted", children: "Email invitations are not available yet. Existing notifications can still be disabled." }),
5680
+ /* @__PURE__ */ jsxs17("form", { className: "mbnr-form", onSubmit: (event) => {
5681
+ event.preventDefault();
5682
+ if (!canInvite) return;
5683
+ const input = notificationRecipientInvitation({ email, audience, ...preferences }, "");
5684
+ const payload = JSON.stringify(input);
5685
+ if (pending.current?.payload !== payload) pending.current = { payload, id: crypto.randomUUID() };
5686
+ const requestId = pending.current.id;
5687
+ void mutate(async () => {
5688
+ const result = await adapter.invite({ ...input, requestId });
5689
+ return result.deliveryStatus === "sandbox_preview" ? "Sandbox invitation prepared. Notifications remain off until recipient confirmation." : result.deliveryStatus === "sent" ? "Invitation sent. Notifications remain off until the recipient confirms." : "Invitation recorded, but email delivery is not confirmed. Notifications remain off. Reload recipients before requesting a new invitation.";
5690
+ }, true);
5691
+ }, children: [
5692
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-fields", children: [
5693
+ /* @__PURE__ */ jsxs17("label", { children: [
5694
+ /* @__PURE__ */ jsx17("span", { children: "Recipient email" }),
5695
+ /* @__PURE__ */ jsx17("input", { type: "email", autoComplete: "email", required: true, maxLength: 254, value: email, disabled: busy || !snapshot?.available, placeholder: "doctor@example.com", onChange: (event) => setEmail(event.target.value) })
5696
+ ] }),
5697
+ /* @__PURE__ */ jsxs17("label", { children: [
5698
+ /* @__PURE__ */ jsx17("span", { children: "Billing access scope" }),
5699
+ /* @__PURE__ */ jsxs17("select", { value: audience, disabled: busy || !snapshot?.available, onChange: (event) => setAudience(event.target.value), children: [
5700
+ /* @__PURE__ */ jsx17("option", { value: "assigned_bills", children: "Assigned bills only" }),
5701
+ /* @__PURE__ */ jsx17("option", { value: "practice", children: "All bills in this practice" })
5702
+ ] })
5703
+ ] })
5704
+ ] }),
5705
+ /* @__PURE__ */ jsxs17("p", { className: "mbnr-muted", children: [
5706
+ audience === "assigned_bills" ? "Your application must assign bills on the server. Without assignments, this recipient receives no alerts." : "The invitation asks for alerts about all bills in this practice, including future bills.",
5707
+ " This does not grant access to the app."
5708
+ ] }),
5709
+ /* @__PURE__ */ jsxs17("fieldset", { disabled: busy || !snapshot?.available, children: [
5710
+ /* @__PURE__ */ jsx17("legend", { children: "Alerts to request" }),
5711
+ /* @__PURE__ */ jsxs17("label", { className: "mbnr-check", children: [
5712
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: preferences.statusUpdates, onChange: (event) => setPreferences((value) => ({ ...value, statusUpdates: event.target.checked })) }),
5713
+ "Bill status and payment updates"
5714
+ ] }),
5715
+ /* @__PURE__ */ jsx17("p", { className: "mbnr-muted", children: "Reminders while a bill waits for a payer:" }),
5716
+ /* @__PURE__ */ jsx17("div", { className: "mbnr-days", children: [30, 60, 90].map((day) => /* @__PURE__ */ jsxs17("label", { className: "mbnr-check", children: [
5717
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: preferences.agingDays.includes(day), onChange: (event) => setPreferences((value) => ({ ...value, agingDays: event.target.checked ? [...value.agingDays, day] : value.agingDays.filter((item) => item !== day) })) }),
5718
+ day,
5719
+ " days"
5720
+ ] }, day)) }),
5721
+ /* @__PURE__ */ jsxs17("label", { className: "mbnr-check", children: [
5722
+ /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: preferences.quietHours, onChange: (event) => setPreferences((value) => ({ ...value, quietHours: event.target.checked })) }),
5723
+ "Quiet hours \xB7 7 pm\u20137 am Pacific"
5724
+ ] })
5725
+ ] }),
5726
+ /* @__PURE__ */ jsx17("p", { className: "mbnr-muted", children: "Emails contain general alerts, not patient details, reports or attachments. The recipient reviews these choices and can unsubscribe at any time." }),
5727
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-actions", children: [
5728
+ /* @__PURE__ */ jsx17("button", { type: "submit", className: "mbnr-primary", disabled: !canInvite, children: busy ? "Please wait\u2026" : "Send confirmation invitation" }),
5729
+ hasReceipt && /* @__PURE__ */ jsx17("button", { type: "button", disabled: busy, onClick: () => {
5730
+ pending.current = null;
5731
+ setHasReceipt(false);
5732
+ setEmail("");
5733
+ setPreferences(defaultNotificationPreferences());
5734
+ setNotice("New invitation form. Reinviting the same recipient replaces their previous confirmation link and turns notifications off until they confirm again.");
5735
+ }, children: "Start another invitation" })
5736
+ ] })
5737
+ ] }),
5738
+ notice && /* @__PURE__ */ jsx17("p", { className: `mbnr-notice ${failed ? "mbnr-error" : "mbnr-muted"}`, role: failed ? "alert" : "status", children: notice }),
5739
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-list", children: [
5740
+ /* @__PURE__ */ jsx17("h3", { children: "Recipients" }),
5741
+ !snapshot && busy ? /* @__PURE__ */ jsx17("p", { role: "status", children: "Loading recipients\u2026" }) : snapshot?.recipients.length === 0 ? /* @__PURE__ */ jsx17("p", { className: "mbnr-empty", children: "No recipients yet. Nothing is sent until someone accepts an invitation." }) : snapshot?.recipients.map((recipient) => /* @__PURE__ */ jsxs17("div", { className: "mbnr-recipient", children: [
5742
+ /* @__PURE__ */ jsxs17("div", { children: [
5743
+ /* @__PURE__ */ jsx17("p", { className: "mbnr-email", children: recipient.email }),
5744
+ /* @__PURE__ */ jsxs17("p", { className: "mbnr-muted", children: [
5745
+ recipient.audience === "practice" ? "Practice-wide" : `${recipient.assignedBillCount} assigned bills`,
5746
+ " \xB7 ",
5747
+ recipient.statusUpdates ? "Status and payment updates" : "Reminders only",
5748
+ recipient.agingDays.length ? ` \xB7 ${recipient.agingDays.join(" / ")} day reminders` : ""
5749
+ ] }),
5750
+ recipient.deliveryStatus === "unknown" && /* @__PURE__ */ jsx17("p", { className: "mbnr-muted", children: "Invitation delivery unconfirmed. No automatic resend." })
5751
+ ] }),
5752
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-state", children: [
5753
+ /* @__PURE__ */ jsx17("span", { className: "mbnr-badge", children: { active: "On", pending_confirmation: "Pending confirmation \xB7 off", expired: "Invitation expired \xB7 off", off: "Off", unavailable: "Delivery unavailable" }[recipient.state] }),
5754
+ recipient.state !== "off" && /* @__PURE__ */ jsx17("button", { type: "button", disabled: busy, onClick: () => void mutate(async () => {
5755
+ await adapter.disable(recipient.externalUserId);
5756
+ return "Notifications disabled and pending invitations revoked.";
5757
+ }), children: "Disable" })
5758
+ ] })
5759
+ ] }, recipient.externalUserId))
5760
+ ] }),
5761
+ /* @__PURE__ */ jsxs17("div", { className: "mbnr-actions mbnr-pagination", children: [
5762
+ /* @__PURE__ */ jsx17("button", { type: "button", disabled: busy, onClick: () => {
5763
+ setNotice("");
5764
+ setFailed(false);
5765
+ setReload((value) => value + 1);
5766
+ }, children: "Reload recipients" }),
5767
+ offset > 0 && /* @__PURE__ */ jsx17("button", { type: "button", disabled: busy, onClick: () => setOffset((value) => Math.max(0, value - 100)), children: "Previous" }),
5768
+ snapshot?.hasMore && /* @__PURE__ */ jsx17("button", { type: "button", disabled: busy, onClick: () => setOffset((value) => value + 100), children: "Next" })
5769
+ ] })
5770
+ ] })
5771
+ ] });
5772
+ }
5773
+
5205
5774
  // src/connected-bill-status.tsx
5206
5775
  import {
5207
5776
  useCallback as useCallback3,
5208
- useEffect as useEffect10,
5209
- useMemo as useMemo7,
5210
- useRef as useRef6,
5211
- useState as useState11
5777
+ useEffect as useEffect12,
5778
+ useMemo as useMemo8,
5779
+ useRef as useRef7,
5780
+ useState as useState14
5212
5781
  } from "react";
5213
5782
  import {
5214
- DEFAULT_API_BASE_URL,
5215
- DEFAULT_SESSION_ENDPOINT
5783
+ DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
5784
+ DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2
5216
5785
  } from "@mindbill/browser";
5217
- import { Fragment as Fragment12, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5786
+ import { Fragment as Fragment12, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
5218
5787
  var DEFAULT_REFRESH_INTERVAL = 6e4;
5219
- async function responseError(response, fallback) {
5788
+ async function responseError2(response, fallback) {
5220
5789
  const body = await response.json().catch(() => null);
5221
5790
  const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
5222
5791
  return new Error(typeof detail === "string" ? detail : fallback);
@@ -5227,7 +5796,7 @@ function isSessionFresh(session) {
5227
5796
  const expiresAt = new Date(session.expiresAt).getTime();
5228
5797
  return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
5229
5798
  }
5230
- function normalizeSession(value) {
5799
+ function normalizeSession2(value) {
5231
5800
  if (!value || typeof value !== "object") {
5232
5801
  throw new Error("The MindBill session endpoint returned an invalid response.");
5233
5802
  }
@@ -5268,9 +5837,9 @@ function normalizeStatus(value, billId) {
5268
5837
  }
5269
5838
  function createBillStatusClient({
5270
5839
  billId,
5271
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5840
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
5272
5841
  getSession,
5273
- apiBaseUrl = DEFAULT_API_BASE_URL,
5842
+ apiBaseUrl = DEFAULT_API_BASE_URL2,
5274
5843
  fetch: fetchOverride
5275
5844
  }) {
5276
5845
  const fetcher = fetchOverride ?? globalThis.fetch;
@@ -5290,14 +5859,14 @@ function createBillStatusClient({
5290
5859
  signal
5291
5860
  }).then(async (response) => {
5292
5861
  if (!response.ok) {
5293
- throw await responseError(
5862
+ throw await responseError2(
5294
5863
  response,
5295
5864
  "MindBill browser session could not be created."
5296
5865
  );
5297
5866
  }
5298
5867
  return response.json();
5299
5868
  });
5300
- const request = Promise.resolve(pending).then(normalizeSession).then((nextSession) => {
5869
+ const request = Promise.resolve(pending).then(normalizeSession2).then((nextSession) => {
5301
5870
  session = nextSession;
5302
5871
  return nextSession;
5303
5872
  }).finally(() => {
@@ -5330,7 +5899,7 @@ function createBillStatusClient({
5330
5899
  response = await requestStatus(browserSession, signal);
5331
5900
  }
5332
5901
  if (!response.ok) {
5333
- throw await responseError(response, "Bill status could not be loaded.");
5902
+ throw await responseError2(response, "Bill status could not be loaded.");
5334
5903
  }
5335
5904
  const body = await response.json();
5336
5905
  return normalizeStatus(body.data, billId);
@@ -5339,31 +5908,31 @@ function createBillStatusClient({
5339
5908
  }
5340
5909
  function useBillStatus({
5341
5910
  billId,
5342
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT,
5911
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
5343
5912
  getSession,
5344
- apiBaseUrl = DEFAULT_API_BASE_URL,
5913
+ apiBaseUrl = DEFAULT_API_BASE_URL2,
5345
5914
  refreshInterval = DEFAULT_REFRESH_INTERVAL,
5346
5915
  enabled = true,
5347
5916
  initialData = null,
5348
5917
  fetch: fetchOverride
5349
5918
  }) {
5350
- const client = useMemo7(() => createBillStatusClient({
5919
+ const client = useMemo8(() => createBillStatusClient({
5351
5920
  billId,
5352
5921
  sessionEndpoint,
5353
5922
  ...getSession ? { getSession } : {},
5354
5923
  apiBaseUrl,
5355
5924
  ...fetchOverride ? { fetch: fetchOverride } : {}
5356
5925
  }), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
5357
- const [data, setData] = useState11(initialData);
5358
- const [error, setError] = useState11(null);
5359
- const [isLoading, setIsLoading] = useState11(enabled && !initialData);
5360
- const [isRefreshing, setIsRefreshing] = useState11(false);
5361
- const dataRef = useRef6(initialData);
5362
- const initialDataRef = useRef6(initialData);
5926
+ const [data, setData] = useState14(initialData);
5927
+ const [error, setError] = useState14(null);
5928
+ const [isLoading, setIsLoading] = useState14(enabled && !initialData);
5929
+ const [isRefreshing, setIsRefreshing] = useState14(false);
5930
+ const dataRef = useRef7(initialData);
5931
+ const initialDataRef = useRef7(initialData);
5363
5932
  initialDataRef.current = initialData;
5364
- const activeControllerRef = useRef6(null);
5365
- const requestSequence = useRef6(0);
5366
- useEffect10(() => {
5933
+ const activeControllerRef = useRef7(null);
5934
+ const requestSequence = useRef7(0);
5935
+ useEffect12(() => {
5367
5936
  const seed = initialDataRef.current;
5368
5937
  dataRef.current = seed;
5369
5938
  setData(seed);
@@ -5404,10 +5973,10 @@ function useBillStatus({
5404
5973
  }
5405
5974
  }
5406
5975
  }, [billId, client, enabled]);
5407
- useEffect10(() => {
5976
+ useEffect12(() => {
5408
5977
  if (enabled) void load();
5409
5978
  }, [enabled, load]);
5410
- useEffect10(() => {
5979
+ useEffect12(() => {
5411
5980
  if (!enabled || refreshInterval <= 0) return;
5412
5981
  const timer = window.setInterval(() => void load(), refreshInterval);
5413
5982
  const onFocus = () => void load();
@@ -5435,17 +6004,17 @@ function ConnectedBillStatus({
5435
6004
  }) {
5436
6005
  const status = useBillStatus(options);
5437
6006
  if (status.isLoading && !status.data) {
5438
- return /* @__PURE__ */ jsx15(Fragment12, { children: loadingFallback ?? /* @__PURE__ */ jsx15("div", { role: "status", children: "Loading bill status\u2026" }) });
6007
+ return /* @__PURE__ */ jsx18(Fragment12, { children: loadingFallback ?? /* @__PURE__ */ jsx18("div", { role: "status", children: "Loading bill status\u2026" }) });
5439
6008
  }
5440
6009
  if (status.error && !status.data) {
5441
- return /* @__PURE__ */ jsx15(Fragment12, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs15("div", { role: "alert", children: [
6010
+ return /* @__PURE__ */ jsx18(Fragment12, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs18("div", { role: "alert", children: [
5442
6011
  status.error.message,
5443
6012
  " ",
5444
- /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
6013
+ /* @__PURE__ */ jsx18("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
5445
6014
  ] }) });
5446
6015
  }
5447
6016
  if (!status.data) return null;
5448
- return /* @__PURE__ */ jsx15(
6017
+ return /* @__PURE__ */ jsx18(
5449
6018
  BillStatusSummary,
5450
6019
  {
5451
6020
  status: status.data.state,
@@ -5464,8 +6033,8 @@ function ConnectedBillStatus({
5464
6033
  }
5465
6034
 
5466
6035
  // src/bill-lifecycle-surfaces.tsx
5467
- import { useEffect as useEffect11, useRef as useRef7, useState as useState12 } from "react";
5468
- import { Fragment as Fragment13, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6036
+ import { useEffect as useEffect13, useRef as useRef8, useState as useState15 } from "react";
6037
+ import { Fragment as Fragment13, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
5469
6038
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
5470
6039
  return actions.filter((action) => action.enabled || showUnavailable);
5471
6040
  }
@@ -5480,11 +6049,11 @@ function BillLifecycleActions({
5480
6049
  }) {
5481
6050
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
5482
6051
  if (!visible.length) return null;
5483
- return /* @__PURE__ */ jsxs16("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
5484
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5485
- visible.map((action) => /* @__PURE__ */ jsxs16("div", { className: "mb-lifecycle-action", children: [
5486
- /* @__PURE__ */ jsx16("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
5487
- !action.enabled && action.reason ? /* @__PURE__ */ jsx16("span", { className: "mb-action-reason", children: action.reason }) : null
6052
+ return /* @__PURE__ */ jsxs19("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
6053
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6054
+ visible.map((action) => /* @__PURE__ */ jsxs19("div", { className: "mb-lifecycle-action", children: [
6055
+ /* @__PURE__ */ jsx19("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
6056
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx19("span", { className: "mb-action-reason", children: action.reason }) : null
5488
6057
  ] }, action.id))
5489
6058
  ] });
5490
6059
  }
@@ -5514,18 +6083,18 @@ function defaultFormatDate(createdAt) {
5514
6083
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
5515
6084
  }
5516
6085
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
5517
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
5518
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5519
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5520
- /* @__PURE__ */ jsx16("strong", { children: "Bill history" }),
5521
- /* @__PURE__ */ jsx16("span", { children: "Submission, payer responses, follow-up, and payments." })
6086
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
6087
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6088
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6089
+ /* @__PURE__ */ jsx19("strong", { children: "Bill history" }),
6090
+ /* @__PURE__ */ jsx19("span", { children: "Submission, payer responses, follow-up, and payments." })
5522
6091
  ] }) }),
5523
- !events.length ? /* @__PURE__ */ jsx16("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx16("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs16("li", { className: "mb-activity-item", children: [
5524
- /* @__PURE__ */ jsx16("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
5525
- /* @__PURE__ */ jsxs16("div", { className: "mb-activity-content", children: [
5526
- /* @__PURE__ */ jsx16("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
5527
- event.description ? /* @__PURE__ */ jsx16("p", { children: event.description }) : null,
5528
- /* @__PURE__ */ jsxs16("span", { children: [
6092
+ !events.length ? /* @__PURE__ */ jsx19("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx19("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs19("li", { className: "mb-activity-item", children: [
6093
+ /* @__PURE__ */ jsx19("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
6094
+ /* @__PURE__ */ jsxs19("div", { className: "mb-activity-content", children: [
6095
+ /* @__PURE__ */ jsx19("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
6096
+ event.description ? /* @__PURE__ */ jsx19("p", { children: event.description }) : null,
6097
+ /* @__PURE__ */ jsxs19("span", { children: [
5529
6098
  formatDate(event.createdAt),
5530
6099
  event.actor ? ` \xB7 ${event.actor}` : ""
5531
6100
  ] })
@@ -5539,49 +6108,49 @@ function historyDate(iso) {
5539
6108
  return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
5540
6109
  }
5541
6110
  function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
5542
- const [expanded, setExpanded] = useState12({});
5543
- const selectedRowRef = useRef7(null);
5544
- useEffect11(() => {
6111
+ const [expanded, setExpanded] = useState15({});
6112
+ const selectedRowRef = useRef8(null);
6113
+ useEffect13(() => {
5545
6114
  if (!selectedEntryId) return;
5546
6115
  const selected = entries.find((entry) => entry.id === selectedEntryId);
5547
6116
  if (selected?.details) setExpanded((current) => current[selectedEntryId] ? current : { ...current, [selectedEntryId]: true });
5548
6117
  selectedRowRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
5549
6118
  }, [entries, selectedEntryId]);
5550
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
5551
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5552
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5553
- /* @__PURE__ */ jsx16("strong", { children: "Bill history" }),
5554
- /* @__PURE__ */ jsx16("span", { children: "Submissions, payer responses, follow-up, and payments." })
6119
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
6120
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6121
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6122
+ /* @__PURE__ */ jsx19("strong", { children: "Bill history" }),
6123
+ /* @__PURE__ */ jsx19("span", { children: "Submissions, payer responses, follow-up, and payments." })
5555
6124
  ] }) }),
5556
- !entries.length ? /* @__PURE__ */ jsx16("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs16("div", { className: "mb-history-table", children: [
5557
- /* @__PURE__ */ jsxs16("div", { className: "mb-history-head", "aria-hidden": "true", children: [
5558
- /* @__PURE__ */ jsx16("span", { children: "Date" }),
5559
- /* @__PURE__ */ jsx16("span", { children: "Action" }),
5560
- /* @__PURE__ */ jsx16("span", { children: "User" }),
5561
- /* @__PURE__ */ jsx16("span", { children: "Details" })
6125
+ !entries.length ? /* @__PURE__ */ jsx19("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsxs19("div", { className: "mb-history-table", children: [
6126
+ /* @__PURE__ */ jsxs19("div", { className: "mb-history-head", "aria-hidden": "true", children: [
6127
+ /* @__PURE__ */ jsx19("span", { children: "Date" }),
6128
+ /* @__PURE__ */ jsx19("span", { children: "Action" }),
6129
+ /* @__PURE__ */ jsx19("span", { children: "User" }),
6130
+ /* @__PURE__ */ jsx19("span", { children: "Details" })
5562
6131
  ] }),
5563
- /* @__PURE__ */ jsx16("ul", { className: "mb-history-rows", children: entries.map((entry) => {
6132
+ /* @__PURE__ */ jsx19("ul", { className: "mb-history-rows", children: entries.map((entry) => {
5564
6133
  const isSelected = entry.id === selectedEntryId;
5565
6134
  const expandable = Boolean(entry.details);
5566
6135
  const isOpen = expandable && Boolean(expanded[entry.id]);
5567
6136
  const details = entry.details;
5568
- const lineContents = /* @__PURE__ */ jsxs16(Fragment13, { children: [
5569
- /* @__PURE__ */ jsx16("span", { className: "mb-history-date", children: formatDate(entry.date) }),
5570
- /* @__PURE__ */ jsx16("span", { className: "mb-history-action", children: entry.action }),
5571
- /* @__PURE__ */ jsx16("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
5572
- /* @__PURE__ */ jsxs16("span", { className: "mb-history-summary", children: [
5573
- expandable ? /* @__PURE__ */ jsx16("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
6137
+ const lineContents = /* @__PURE__ */ jsxs19(Fragment13, { children: [
6138
+ /* @__PURE__ */ jsx19("span", { className: "mb-history-date", children: formatDate(entry.date) }),
6139
+ /* @__PURE__ */ jsx19("span", { className: "mb-history-action", children: entry.action }),
6140
+ /* @__PURE__ */ jsx19("span", { className: "mb-history-actor", children: entry.actor ?? "\u2014" }),
6141
+ /* @__PURE__ */ jsxs19("span", { className: "mb-history-summary", children: [
6142
+ expandable ? /* @__PURE__ */ jsx19("i", { className: `mb-history-caret${isOpen ? " is-open" : ""}`, "aria-hidden": "true" }) : null,
5574
6143
  entry.summary
5575
6144
  ] })
5576
6145
  ] });
5577
- return /* @__PURE__ */ jsxs16(
6146
+ return /* @__PURE__ */ jsxs19(
5578
6147
  "li",
5579
6148
  {
5580
6149
  ref: isSelected ? selectedRowRef : void 0,
5581
6150
  className: `mb-history-row is-${entry.tone}${isSelected ? " is-selected" : ""}`,
5582
6151
  "aria-current": isSelected ? "true" : void 0,
5583
6152
  children: [
5584
- expandable ? /* @__PURE__ */ jsx16(
6153
+ expandable ? /* @__PURE__ */ jsx19(
5585
6154
  "button",
5586
6155
  {
5587
6156
  type: "button",
@@ -5590,31 +6159,31 @@ function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill hist
5590
6159
  onClick: () => setExpanded((current) => ({ ...current, [entry.id]: !current[entry.id] })),
5591
6160
  children: lineContents
5592
6161
  }
5593
- ) : /* @__PURE__ */ jsx16("div", { className: "mb-history-line", children: lineContents }),
5594
- isOpen && details ? /* @__PURE__ */ jsxs16("div", { className: "mb-history-details", children: [
5595
- details.rows?.length ? /* @__PURE__ */ jsx16("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs16("div", { children: [
5596
- /* @__PURE__ */ jsx16("dt", { children: row.label }),
5597
- /* @__PURE__ */ jsx16("dd", { children: row.value })
6162
+ ) : /* @__PURE__ */ jsx19("div", { className: "mb-history-line", children: lineContents }),
6163
+ isOpen && details ? /* @__PURE__ */ jsxs19("div", { className: "mb-history-details", children: [
6164
+ details.rows?.length ? /* @__PURE__ */ jsx19("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs19("div", { children: [
6165
+ /* @__PURE__ */ jsx19("dt", { children: row.label }),
6166
+ /* @__PURE__ */ jsx19("dd", { children: row.value })
5598
6167
  ] }, `${row.label}-${row.value}`)) }) : null,
5599
- details.documents?.length ? /* @__PURE__ */ jsx16("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs16("div", { children: [
5600
- /* @__PURE__ */ jsx16("dt", { children: "Documents" }),
5601
- /* @__PURE__ */ jsx16("dd", { children: details.documents.map((doc) => {
6168
+ details.documents?.length ? /* @__PURE__ */ jsx19("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs19("div", { children: [
6169
+ /* @__PURE__ */ jsx19("dt", { children: "Documents" }),
6170
+ /* @__PURE__ */ jsx19("dd", { children: details.documents.map((doc) => {
5602
6171
  const href = documentHref?.(doc) ?? null;
5603
- return href ? /* @__PURE__ */ jsx16("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : onOpenDocument ? /* @__PURE__ */ jsx16("button", { type: "button", className: "mb-history-doc", onClick: () => void onOpenDocument(doc), children: doc.filename }, doc.id) : /* @__PURE__ */ jsx16("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
6172
+ return href ? /* @__PURE__ */ jsx19("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : onOpenDocument ? /* @__PURE__ */ jsx19("button", { type: "button", className: "mb-history-doc", onClick: () => void onOpenDocument(doc), children: doc.filename }, doc.id) : /* @__PURE__ */ jsx19("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
5604
6173
  }) })
5605
6174
  ] }) }) : null,
5606
- details.codes?.length ? /* @__PURE__ */ jsx16("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs16("div", { children: [
5607
- /* @__PURE__ */ jsx16("dt", { children: code.code }),
5608
- /* @__PURE__ */ jsx16("dd", { children: code.text })
6175
+ details.codes?.length ? /* @__PURE__ */ jsx19("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs19("div", { children: [
6176
+ /* @__PURE__ */ jsx19("dt", { children: code.code }),
6177
+ /* @__PURE__ */ jsx19("dd", { children: code.text })
5609
6178
  ] }, code.code)) }) : null,
5610
- details.complianceDueDates?.length ? /* @__PURE__ */ jsxs16("div", { className: "mb-history-due", children: [
5611
- /* @__PURE__ */ jsx16("em", { children: "Compliance Due Dates" }),
5612
- /* @__PURE__ */ jsx16("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs16("div", { children: [
5613
- /* @__PURE__ */ jsx16("dt", { children: formatDate(due.date) }),
5614
- /* @__PURE__ */ jsx16("dd", { children: due.text })
6179
+ details.complianceDueDates?.length ? /* @__PURE__ */ jsxs19("div", { className: "mb-history-due", children: [
6180
+ /* @__PURE__ */ jsx19("em", { children: "Compliance Due Dates" }),
6181
+ /* @__PURE__ */ jsx19("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs19("div", { children: [
6182
+ /* @__PURE__ */ jsx19("dt", { children: formatDate(due.date) }),
6183
+ /* @__PURE__ */ jsx19("dd", { children: due.text })
5615
6184
  ] }, `${due.date}-${due.text}`)) })
5616
6185
  ] }) : null,
5617
- details.text ? /* @__PURE__ */ jsx16("p", { className: "mb-history-text", children: details.text }) : null
6186
+ details.text ? /* @__PURE__ */ jsx19("p", { className: "mb-history-text", children: details.text }) : null
5618
6187
  ] }) : null
5619
6188
  ]
5620
6189
  },
@@ -5675,15 +6244,15 @@ function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, dr
5675
6244
  const rejected = state.toLowerCase() === "rejected";
5676
6245
  const draft = Boolean(draftStage) && isBillLifecycleDraft(state);
5677
6246
  const steps = billLifecycleProgressSteps(state, { draftStage: Boolean(draftStage) });
5678
- return /* @__PURE__ */ jsxs16("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
5679
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5680
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5681
- /* @__PURE__ */ jsx16("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
5682
- /* @__PURE__ */ jsx16("span", { children: rejected ? "The payer rejected this submission." : draft ? "Not yet sent" : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
6247
+ return /* @__PURE__ */ jsxs19("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
6248
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6249
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6250
+ /* @__PURE__ */ jsx19("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
6251
+ /* @__PURE__ */ jsx19("span", { children: rejected ? "The payer rejected this submission." : draft ? "Not yet sent" : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
5683
6252
  ] }) }),
5684
- /* @__PURE__ */ jsx16("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs16("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
5685
- /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
5686
- /* @__PURE__ */ jsx16("b", { children: step.label })
6253
+ /* @__PURE__ */ jsx19("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs19("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
6254
+ /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
6255
+ /* @__PURE__ */ jsx19("b", { children: step.label })
5687
6256
  ] }, step.id)) })
5688
6257
  ] });
5689
6258
  }
@@ -5697,48 +6266,48 @@ function billRejectionIssueSummary(rejection, count) {
5697
6266
  function BillRejectionNotice({ rejection, title = "Rejected \u2014 action required", submittedAt, appearance, className, style, formatDate = defaultFormatDate }) {
5698
6267
  const issues = rejection.issues?.length ? rejection.issues : [{ code: rejection.code, description: rejection.reason }];
5699
6268
  const hasCodes = issues.some((issue) => Boolean(issue.code));
5700
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
5701
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5702
- /* @__PURE__ */ jsxs16("div", { className: "mb-rejection-overview", children: [
5703
- /* @__PURE__ */ jsxs16("header", { className: "mb-rejection-heading", children: [
5704
- /* @__PURE__ */ jsx16("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
5705
- /* @__PURE__ */ jsxs16("div", { children: [
5706
- /* @__PURE__ */ jsx16("strong", { children: title }),
5707
- /* @__PURE__ */ jsxs16("span", { children: [
6269
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-rejection-notice", className), style: mindBillAppearanceStyle(appearance, style), role: "alert", "aria-label": "Bill rejection reasons", children: [
6270
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6271
+ /* @__PURE__ */ jsxs19("div", { className: "mb-rejection-overview", children: [
6272
+ /* @__PURE__ */ jsxs19("header", { className: "mb-rejection-heading", children: [
6273
+ /* @__PURE__ */ jsx19("span", { className: "mb-rejection-icon", "aria-hidden": "true", children: "!" }),
6274
+ /* @__PURE__ */ jsxs19("div", { children: [
6275
+ /* @__PURE__ */ jsx19("strong", { children: title }),
6276
+ /* @__PURE__ */ jsxs19("span", { children: [
5708
6277
  "Fix the ",
5709
6278
  issues.length === 1 ? "issue" : "issues",
5710
6279
  " below, then resubmit."
5711
6280
  ] })
5712
6281
  ] })
5713
6282
  ] }),
5714
- /* @__PURE__ */ jsxs16("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
5715
- /* @__PURE__ */ jsxs16("li", { className: "is-complete", children: [
5716
- /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: "\u2713" }),
5717
- /* @__PURE__ */ jsx16("b", { children: "Sent" }),
5718
- submittedAt ? /* @__PURE__ */ jsx16("small", { children: formatDate(submittedAt) }) : null
6283
+ /* @__PURE__ */ jsxs19("ol", { className: "mb-rejection-progress", "aria-label": "Submission status", children: [
6284
+ /* @__PURE__ */ jsxs19("li", { className: "is-complete", children: [
6285
+ /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: "\u2713" }),
6286
+ /* @__PURE__ */ jsx19("b", { children: "Sent" }),
6287
+ submittedAt ? /* @__PURE__ */ jsx19("small", { children: formatDate(submittedAt) }) : null
5719
6288
  ] }),
5720
- /* @__PURE__ */ jsxs16("li", { className: "is-rejected", "aria-current": "step", children: [
5721
- /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: "!" }),
5722
- /* @__PURE__ */ jsx16("b", { children: "Rejected" }),
5723
- rejection.receivedAt ? /* @__PURE__ */ jsx16("small", { children: formatDate(rejection.receivedAt) }) : null
6289
+ /* @__PURE__ */ jsxs19("li", { className: "is-rejected", "aria-current": "step", children: [
6290
+ /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: "!" }),
6291
+ /* @__PURE__ */ jsx19("b", { children: "Rejected" }),
6292
+ rejection.receivedAt ? /* @__PURE__ */ jsx19("small", { children: formatDate(rejection.receivedAt) }) : null
5724
6293
  ] })
5725
6294
  ] })
5726
6295
  ] }),
5727
- /* @__PURE__ */ jsxs16("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
5728
- /* @__PURE__ */ jsxs16("div", { className: "mb-rejection-issues-heading", children: [
5729
- /* @__PURE__ */ jsxs16("strong", { children: [
5730
- /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: "\u25B3" }),
6296
+ /* @__PURE__ */ jsxs19("div", { className: "mb-rejection-issues", "aria-label": "Rejection reasons", children: [
6297
+ /* @__PURE__ */ jsxs19("div", { className: "mb-rejection-issues-heading", children: [
6298
+ /* @__PURE__ */ jsxs19("strong", { children: [
6299
+ /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: "\u25B3" }),
5731
6300
  " Rejection reasons"
5732
6301
  ] }),
5733
- /* @__PURE__ */ jsx16("span", { children: billRejectionIssueSummary(rejection, issues.length) })
6302
+ /* @__PURE__ */ jsx19("span", { children: billRejectionIssueSummary(rejection, issues.length) })
5734
6303
  ] }),
5735
- /* @__PURE__ */ jsx16("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs16("li", { children: [
5736
- /* @__PURE__ */ jsx16("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
5737
- /* @__PURE__ */ jsx16("p", { children: issue.description }),
5738
- issue.code ? /* @__PURE__ */ jsx16("span", { className: "mb-rejection-code", children: issue.code }) : null
6304
+ /* @__PURE__ */ jsx19("ol", { "aria-label": `${issues.length} rejection ${issues.length === 1 ? "reason" : "reasons"}`, children: issues.map((issue, index) => /* @__PURE__ */ jsxs19("li", { children: [
6305
+ /* @__PURE__ */ jsx19("span", { className: "mb-rejection-bullet", "aria-hidden": "true" }),
6306
+ /* @__PURE__ */ jsx19("p", { children: issue.description }),
6307
+ issue.code ? /* @__PURE__ */ jsx19("span", { className: "mb-rejection-code", children: issue.code }) : null
5739
6308
  ] }, `${issue.code ?? "issue"}-${index}`)) }),
5740
- hasCodes ? /* @__PURE__ */ jsxs16("p", { className: "mb-rejection-code-note", children: [
5741
- /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: "i" }),
6309
+ hasCodes ? /* @__PURE__ */ jsxs19("p", { className: "mb-rejection-code-note", children: [
6310
+ /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: "i" }),
5742
6311
  " Technical error codes are included for support and auditability."
5743
6312
  ] }) : null
5744
6313
  ] })
@@ -5753,18 +6322,18 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
5753
6322
  ["Charged", currency(bill.totalCharge)],
5754
6323
  ["Balance", currency(bill.balanceDue)]
5755
6324
  ];
5756
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
5757
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5758
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5759
- /* @__PURE__ */ jsx16("strong", { children: "Bill snapshot" }),
5760
- /* @__PURE__ */ jsxs16("span", { children: [
6325
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
6326
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6327
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6328
+ /* @__PURE__ */ jsx19("strong", { children: "Bill snapshot" }),
6329
+ /* @__PURE__ */ jsxs19("span", { children: [
5761
6330
  "Bill #",
5762
6331
  bill.billNumber
5763
6332
  ] })
5764
6333
  ] }) }),
5765
- /* @__PURE__ */ jsx16("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs16("div", { children: [
5766
- /* @__PURE__ */ jsx16("dt", { children: label }),
5767
- /* @__PURE__ */ jsx16("dd", { children: value })
6334
+ /* @__PURE__ */ jsx19("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs19("div", { children: [
6335
+ /* @__PURE__ */ jsx19("dt", { children: label }),
6336
+ /* @__PURE__ */ jsx19("dd", { children: value })
5768
6337
  ] }, label)) })
5769
6338
  ] });
5770
6339
  }
@@ -5779,140 +6348,140 @@ function BillExplanationOfReview({
5779
6348
  style
5780
6349
  }) {
5781
6350
  const rows = payments.length ? payments : [null];
5782
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
5783
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5784
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5785
- /* @__PURE__ */ jsx16("strong", { children: "Explanation of Review" }),
5786
- /* @__PURE__ */ jsx16("span", { children: "Payer response and payment reconciliation." })
6351
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
6352
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6353
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6354
+ /* @__PURE__ */ jsx19("strong", { children: "Explanation of Review" }),
6355
+ /* @__PURE__ */ jsx19("span", { children: "Payer response and payment reconciliation." })
5787
6356
  ] }) }),
5788
- /* @__PURE__ */ jsxs16("dl", { className: "mb-eor-metrics", children: [
5789
- /* @__PURE__ */ jsxs16("div", { children: [
5790
- /* @__PURE__ */ jsx16("dt", { children: "Amount billed" }),
5791
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.billedAmount) })
6357
+ /* @__PURE__ */ jsxs19("dl", { className: "mb-eor-metrics", children: [
6358
+ /* @__PURE__ */ jsxs19("div", { children: [
6359
+ /* @__PURE__ */ jsx19("dt", { children: "Amount billed" }),
6360
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.billedAmount) })
5792
6361
  ] }),
5793
- /* @__PURE__ */ jsxs16("div", { children: [
5794
- /* @__PURE__ */ jsx16("dt", { children: "Payer allowed" }),
5795
- /* @__PURE__ */ jsx16("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
6362
+ /* @__PURE__ */ jsxs19("div", { children: [
6363
+ /* @__PURE__ */ jsx19("dt", { children: "Payer allowed" }),
6364
+ /* @__PURE__ */ jsx19("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
5796
6365
  ] }),
5797
- /* @__PURE__ */ jsxs16("div", { children: [
5798
- /* @__PURE__ */ jsx16("dt", { children: "Payer reported paid" }),
5799
- /* @__PURE__ */ jsx16("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
6366
+ /* @__PURE__ */ jsxs19("div", { children: [
6367
+ /* @__PURE__ */ jsx19("dt", { children: "Payer reported paid" }),
6368
+ /* @__PURE__ */ jsx19("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
5800
6369
  ] }),
5801
- /* @__PURE__ */ jsxs16("div", { className: "is-balance", children: [
5802
- /* @__PURE__ */ jsx16("dt", { children: "Balance due" }),
5803
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.balanceDue) })
6370
+ /* @__PURE__ */ jsxs19("div", { className: "is-balance", children: [
6371
+ /* @__PURE__ */ jsx19("dt", { children: "Balance due" }),
6372
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.balanceDue) })
5804
6373
  ] }),
5805
- /* @__PURE__ */ jsxs16("div", { children: [
5806
- /* @__PURE__ */ jsx16("dt", { children: "Payment posted" }),
5807
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.postedPrincipal) })
6374
+ /* @__PURE__ */ jsxs19("div", { children: [
6375
+ /* @__PURE__ */ jsx19("dt", { children: "Payment posted" }),
6376
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.postedPrincipal) })
5808
6377
  ] }),
5809
- /* @__PURE__ */ jsxs16("div", { children: [
5810
- /* @__PURE__ */ jsx16("dt", { children: "Penalty & interest" }),
5811
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.postedAdditional) })
6378
+ /* @__PURE__ */ jsxs19("div", { children: [
6379
+ /* @__PURE__ */ jsx19("dt", { children: "Penalty & interest" }),
6380
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.postedAdditional) })
5812
6381
  ] }),
5813
- /* @__PURE__ */ jsxs16("div", { children: [
5814
- /* @__PURE__ */ jsx16("dt", { children: "Total received" }),
5815
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.totalPostedCash) })
6382
+ /* @__PURE__ */ jsxs19("div", { children: [
6383
+ /* @__PURE__ */ jsx19("dt", { children: "Total received" }),
6384
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.totalPostedCash) })
5816
6385
  ] }),
5817
- /* @__PURE__ */ jsxs16("div", { children: [
5818
- /* @__PURE__ */ jsx16("dt", { children: "Expected" }),
5819
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.expectedAmount) })
6386
+ /* @__PURE__ */ jsxs19("div", { children: [
6387
+ /* @__PURE__ */ jsx19("dt", { children: "Expected" }),
6388
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.expectedAmount) })
5820
6389
  ] })
5821
6390
  ] }),
5822
- remittance.denialReason ? /* @__PURE__ */ jsxs16("div", { className: "mb-denial", children: [
5823
- /* @__PURE__ */ jsx16("strong", { children: "Denial reason" }),
5824
- /* @__PURE__ */ jsx16("p", { children: remittance.denialReason })
6391
+ remittance.denialReason ? /* @__PURE__ */ jsxs19("div", { className: "mb-denial", children: [
6392
+ /* @__PURE__ */ jsx19("strong", { children: "Denial reason" }),
6393
+ /* @__PURE__ */ jsx19("p", { children: remittance.denialReason })
5825
6394
  ] }) : null,
5826
- /* @__PURE__ */ jsx16("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs16("table", { className: "mb-eor-table", children: [
5827
- /* @__PURE__ */ jsxs16("thead", { children: [
5828
- /* @__PURE__ */ jsxs16("tr", { className: "mb-eor-groups", children: [
5829
- /* @__PURE__ */ jsx16("th", { colSpan: 2, children: "Submission" }),
5830
- /* @__PURE__ */ jsx16("th", { colSpan: 5, children: "EOR payment information" }),
5831
- /* @__PURE__ */ jsx16("th", { colSpan: 2, children: "EOR post" }),
5832
- /* @__PURE__ */ jsx16("th", { children: "EOR" })
6395
+ /* @__PURE__ */ jsx19("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs19("table", { className: "mb-eor-table", children: [
6396
+ /* @__PURE__ */ jsxs19("thead", { children: [
6397
+ /* @__PURE__ */ jsxs19("tr", { className: "mb-eor-groups", children: [
6398
+ /* @__PURE__ */ jsx19("th", { colSpan: 2, children: "Submission" }),
6399
+ /* @__PURE__ */ jsx19("th", { colSpan: 5, children: "EOR payment information" }),
6400
+ /* @__PURE__ */ jsx19("th", { colSpan: 2, children: "EOR post" }),
6401
+ /* @__PURE__ */ jsx19("th", { children: "EOR" })
5833
6402
  ] }),
5834
- /* @__PURE__ */ jsxs16("tr", { children: [
5835
- /* @__PURE__ */ jsx16("th", { children: "Submission" }),
5836
- /* @__PURE__ */ jsx16("th", { children: "Submission payment" }),
5837
- /* @__PURE__ */ jsx16("th", { children: "Payment method" }),
5838
- /* @__PURE__ */ jsx16("th", { children: "Reference" }),
5839
- /* @__PURE__ */ jsx16("th", { children: "Effective date" }),
5840
- /* @__PURE__ */ jsx16("th", { children: "Payment total" }),
5841
- /* @__PURE__ */ jsx16("th", { children: "Deposit date" }),
5842
- /* @__PURE__ */ jsx16("th", { children: "Post date" }),
5843
- /* @__PURE__ */ jsx16("th", { children: "Source" }),
5844
- /* @__PURE__ */ jsx16("th", { children: "Document" })
6403
+ /* @__PURE__ */ jsxs19("tr", { children: [
6404
+ /* @__PURE__ */ jsx19("th", { children: "Submission" }),
6405
+ /* @__PURE__ */ jsx19("th", { children: "Submission payment" }),
6406
+ /* @__PURE__ */ jsx19("th", { children: "Payment method" }),
6407
+ /* @__PURE__ */ jsx19("th", { children: "Reference" }),
6408
+ /* @__PURE__ */ jsx19("th", { children: "Effective date" }),
6409
+ /* @__PURE__ */ jsx19("th", { children: "Payment total" }),
6410
+ /* @__PURE__ */ jsx19("th", { children: "Deposit date" }),
6411
+ /* @__PURE__ */ jsx19("th", { children: "Post date" }),
6412
+ /* @__PURE__ */ jsx19("th", { children: "Source" }),
6413
+ /* @__PURE__ */ jsx19("th", { children: "Document" })
5845
6414
  ] })
5846
6415
  ] }),
5847
- /* @__PURE__ */ jsx16("tbody", { children: rows.map((payment, index) => {
6416
+ /* @__PURE__ */ jsx19("tbody", { children: rows.map((payment, index) => {
5848
6417
  const eor = eors[index] ?? eors[0];
5849
- return /* @__PURE__ */ jsxs16("tr", { children: [
5850
- /* @__PURE__ */ jsxs16("td", { "data-label": "Submission", children: [
5851
- /* @__PURE__ */ jsx16("strong", { children: "Original bill" }),
5852
- submittedAt ? /* @__PURE__ */ jsxs16("span", { children: [
6418
+ return /* @__PURE__ */ jsxs19("tr", { children: [
6419
+ /* @__PURE__ */ jsxs19("td", { "data-label": "Submission", children: [
6420
+ /* @__PURE__ */ jsx19("strong", { children: "Original bill" }),
6421
+ submittedAt ? /* @__PURE__ */ jsxs19("span", { children: [
5853
6422
  "Sent ",
5854
6423
  defaultFormatDate(submittedAt)
5855
6424
  ] }) : null
5856
6425
  ] }),
5857
- /* @__PURE__ */ jsx16("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
5858
- /* @__PURE__ */ jsx16("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
5859
- /* @__PURE__ */ jsx16("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
5860
- /* @__PURE__ */ jsx16("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
5861
- /* @__PURE__ */ jsx16("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
5862
- /* @__PURE__ */ jsx16("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
5863
- /* @__PURE__ */ jsx16("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
5864
- /* @__PURE__ */ jsx16("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
5865
- /* @__PURE__ */ jsx16("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx16("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
6426
+ /* @__PURE__ */ jsx19("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
6427
+ /* @__PURE__ */ jsx19("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
6428
+ /* @__PURE__ */ jsx19("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
6429
+ /* @__PURE__ */ jsx19("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
6430
+ /* @__PURE__ */ jsx19("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
6431
+ /* @__PURE__ */ jsx19("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
6432
+ /* @__PURE__ */ jsx19("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
6433
+ /* @__PURE__ */ jsx19("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
6434
+ /* @__PURE__ */ jsx19("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx19("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
5866
6435
  ] }, payment?.id ?? `empty-${index}`);
5867
6436
  }) })
5868
6437
  ] }) }),
5869
- eors.length > rows.length ? /* @__PURE__ */ jsx16("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx16("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
6438
+ eors.length > rows.length ? /* @__PURE__ */ jsx19("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx19("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
5870
6439
  ] });
5871
6440
  }
5872
6441
  function BillRemittanceCard({ remittance, appearance, className, style }) {
5873
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
5874
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5875
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5876
- /* @__PURE__ */ jsx16("strong", { children: "Remittance" }),
5877
- /* @__PURE__ */ jsx16("span", { children: "Amounts reported by the payer and posted to the bill." })
6442
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
6443
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6444
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6445
+ /* @__PURE__ */ jsx19("strong", { children: "Remittance" }),
6446
+ /* @__PURE__ */ jsx19("span", { children: "Amounts reported by the payer and posted to the bill." })
5878
6447
  ] }) }),
5879
- /* @__PURE__ */ jsxs16("dl", { children: [
5880
- /* @__PURE__ */ jsxs16("div", { children: [
5881
- /* @__PURE__ */ jsx16("dt", { children: "Amount billed" }),
5882
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.billedAmount) })
6448
+ /* @__PURE__ */ jsxs19("dl", { children: [
6449
+ /* @__PURE__ */ jsxs19("div", { children: [
6450
+ /* @__PURE__ */ jsx19("dt", { children: "Amount billed" }),
6451
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.billedAmount) })
5883
6452
  ] }),
5884
- /* @__PURE__ */ jsxs16("div", { children: [
5885
- /* @__PURE__ */ jsx16("dt", { children: "Expected" }),
5886
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.expectedAmount) })
6453
+ /* @__PURE__ */ jsxs19("div", { children: [
6454
+ /* @__PURE__ */ jsx19("dt", { children: "Expected" }),
6455
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.expectedAmount) })
5887
6456
  ] }),
5888
- /* @__PURE__ */ jsxs16("div", { children: [
5889
- /* @__PURE__ */ jsx16("dt", { children: "Payer allowed" }),
5890
- /* @__PURE__ */ jsx16("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
6457
+ /* @__PURE__ */ jsxs19("div", { children: [
6458
+ /* @__PURE__ */ jsx19("dt", { children: "Payer allowed" }),
6459
+ /* @__PURE__ */ jsx19("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
5891
6460
  ] }),
5892
- /* @__PURE__ */ jsxs16("div", { children: [
5893
- /* @__PURE__ */ jsx16("dt", { children: "Payer reported paid" }),
5894
- /* @__PURE__ */ jsx16("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
6461
+ /* @__PURE__ */ jsxs19("div", { children: [
6462
+ /* @__PURE__ */ jsx19("dt", { children: "Payer reported paid" }),
6463
+ /* @__PURE__ */ jsx19("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
5895
6464
  ] }),
5896
- /* @__PURE__ */ jsxs16("div", { children: [
5897
- /* @__PURE__ */ jsx16("dt", { children: "Payment posted" }),
5898
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.postedPrincipal) })
6465
+ /* @__PURE__ */ jsxs19("div", { children: [
6466
+ /* @__PURE__ */ jsx19("dt", { children: "Payment posted" }),
6467
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.postedPrincipal) })
5899
6468
  ] }),
5900
- /* @__PURE__ */ jsxs16("div", { children: [
5901
- /* @__PURE__ */ jsx16("dt", { children: "Penalty & interest" }),
5902
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.postedAdditional) })
6469
+ /* @__PURE__ */ jsxs19("div", { children: [
6470
+ /* @__PURE__ */ jsx19("dt", { children: "Penalty & interest" }),
6471
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.postedAdditional) })
5903
6472
  ] }),
5904
- /* @__PURE__ */ jsxs16("div", { children: [
5905
- /* @__PURE__ */ jsx16("dt", { children: "Total received" }),
5906
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.totalPostedCash) })
6473
+ /* @__PURE__ */ jsxs19("div", { children: [
6474
+ /* @__PURE__ */ jsx19("dt", { children: "Total received" }),
6475
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.totalPostedCash) })
5907
6476
  ] }),
5908
- /* @__PURE__ */ jsxs16("div", { children: [
5909
- /* @__PURE__ */ jsx16("dt", { children: "Balance due" }),
5910
- /* @__PURE__ */ jsx16("dd", { children: currency(remittance.balanceDue) })
6477
+ /* @__PURE__ */ jsxs19("div", { children: [
6478
+ /* @__PURE__ */ jsx19("dt", { children: "Balance due" }),
6479
+ /* @__PURE__ */ jsx19("dd", { children: currency(remittance.balanceDue) })
5911
6480
  ] })
5912
6481
  ] }),
5913
- remittance.denialReason ? /* @__PURE__ */ jsxs16("div", { className: "mb-denial", children: [
5914
- /* @__PURE__ */ jsx16("strong", { children: "Denial reason" }),
5915
- /* @__PURE__ */ jsx16("p", { children: remittance.denialReason })
6482
+ remittance.denialReason ? /* @__PURE__ */ jsxs19("div", { className: "mb-denial", children: [
6483
+ /* @__PURE__ */ jsx19("strong", { children: "Denial reason" }),
6484
+ /* @__PURE__ */ jsx19("p", { children: remittance.denialReason })
5916
6485
  ] }) : null
5917
6486
  ] });
5918
6487
  }
@@ -5927,72 +6496,72 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
5927
6496
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
5928
6497
  ].filter(Boolean);
5929
6498
  if (!delivery.payerName && !contacts2.length) return null;
5930
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
5931
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5932
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5933
- /* @__PURE__ */ jsx16("strong", { children: delivery.payerName || "Claims administrator" }),
5934
- /* @__PURE__ */ jsx16("span", { children: "Billing and follow-up contacts." })
6499
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
6500
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6501
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6502
+ /* @__PURE__ */ jsx19("strong", { children: delivery.payerName || "Claims administrator" }),
6503
+ /* @__PURE__ */ jsx19("span", { children: "Billing and follow-up contacts." })
5935
6504
  ] }) }),
5936
- !contacts2.length ? /* @__PURE__ */ jsx16("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx16("dl", { children: contacts2.map(([label, value, href]) => /* @__PURE__ */ jsxs16("div", { children: [
5937
- /* @__PURE__ */ jsx16("dt", { children: label }),
5938
- /* @__PURE__ */ jsx16("dd", { children: href ? /* @__PURE__ */ jsx16("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
6505
+ !contacts2.length ? /* @__PURE__ */ jsx19("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx19("dl", { children: contacts2.map(([label, value, href]) => /* @__PURE__ */ jsxs19("div", { children: [
6506
+ /* @__PURE__ */ jsx19("dt", { children: label }),
6507
+ /* @__PURE__ */ jsx19("dd", { children: href ? /* @__PURE__ */ jsx19("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
5939
6508
  ] }, label)) })
5940
6509
  ] });
5941
6510
  }
5942
6511
  function BillPaymentLedger({ payments, appearance, className, style }) {
5943
- return /* @__PURE__ */ jsxs16("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
5944
- /* @__PURE__ */ jsx16("style", { children: lifecycleSurfaceStyles }),
5945
- /* @__PURE__ */ jsx16("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs16("div", { children: [
5946
- /* @__PURE__ */ jsx16("strong", { children: "Payments" }),
5947
- /* @__PURE__ */ jsx16("span", { children: "Funds recorded against this bill." })
6512
+ return /* @__PURE__ */ jsxs19("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
6513
+ /* @__PURE__ */ jsx19("style", { children: lifecycleSurfaceStyles }),
6514
+ /* @__PURE__ */ jsx19("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs19("div", { children: [
6515
+ /* @__PURE__ */ jsx19("strong", { children: "Payments" }),
6516
+ /* @__PURE__ */ jsx19("span", { children: "Funds recorded against this bill." })
5948
6517
  ] }) }),
5949
- !payments.length ? /* @__PURE__ */ jsx16("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx16("div", { className: "mb-payment-list", children: payments.map((payment) => {
6518
+ !payments.length ? /* @__PURE__ */ jsx19("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx19("div", { className: "mb-payment-list", children: payments.map((payment) => {
5950
6519
  const additional = payment.feeAmount ?? 0;
5951
- return /* @__PURE__ */ jsxs16("article", { children: [
5952
- /* @__PURE__ */ jsxs16("div", { className: "mb-payment-amount", children: [
5953
- /* @__PURE__ */ jsx16("strong", { children: currency(payment.amount) }),
5954
- /* @__PURE__ */ jsx16("span", { children: "Total received" })
6520
+ return /* @__PURE__ */ jsxs19("article", { children: [
6521
+ /* @__PURE__ */ jsxs19("div", { className: "mb-payment-amount", children: [
6522
+ /* @__PURE__ */ jsx19("strong", { children: currency(payment.amount) }),
6523
+ /* @__PURE__ */ jsx19("span", { children: "Total received" })
5955
6524
  ] }),
5956
- /* @__PURE__ */ jsxs16("dl", { children: [
5957
- /* @__PURE__ */ jsxs16("div", { children: [
5958
- /* @__PURE__ */ jsx16("dt", { children: "Applied to bill" }),
5959
- /* @__PURE__ */ jsx16("dd", { children: currency(payment.principalAmount) })
6525
+ /* @__PURE__ */ jsxs19("dl", { children: [
6526
+ /* @__PURE__ */ jsxs19("div", { children: [
6527
+ /* @__PURE__ */ jsx19("dt", { children: "Applied to bill" }),
6528
+ /* @__PURE__ */ jsx19("dd", { children: currency(payment.principalAmount) })
5960
6529
  ] }),
5961
- additional > 0 ? /* @__PURE__ */ jsxs16("div", { children: [
5962
- /* @__PURE__ */ jsx16("dt", { children: "Penalty & interest" }),
5963
- /* @__PURE__ */ jsx16("dd", { children: currency(additional) })
6530
+ additional > 0 ? /* @__PURE__ */ jsxs19("div", { children: [
6531
+ /* @__PURE__ */ jsx19("dt", { children: "Penalty & interest" }),
6532
+ /* @__PURE__ */ jsx19("dd", { children: currency(additional) })
5964
6533
  ] }) : null,
5965
- /* @__PURE__ */ jsxs16("div", { children: [
5966
- /* @__PURE__ */ jsx16("dt", { children: "Method" }),
5967
- /* @__PURE__ */ jsx16("dd", { children: payment.method.toUpperCase() })
6534
+ /* @__PURE__ */ jsxs19("div", { children: [
6535
+ /* @__PURE__ */ jsx19("dt", { children: "Method" }),
6536
+ /* @__PURE__ */ jsx19("dd", { children: payment.method.toUpperCase() })
5968
6537
  ] }),
5969
- /* @__PURE__ */ jsxs16("div", { children: [
5970
- /* @__PURE__ */ jsx16("dt", { children: "Reference" }),
5971
- /* @__PURE__ */ jsx16("dd", { children: payment.checkNumber || "\u2014" })
6538
+ /* @__PURE__ */ jsxs19("div", { children: [
6539
+ /* @__PURE__ */ jsx19("dt", { children: "Reference" }),
6540
+ /* @__PURE__ */ jsx19("dd", { children: payment.checkNumber || "\u2014" })
5972
6541
  ] }),
5973
- /* @__PURE__ */ jsxs16("div", { children: [
5974
- /* @__PURE__ */ jsx16("dt", { children: "Effective date" }),
5975
- /* @__PURE__ */ jsx16("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
6542
+ /* @__PURE__ */ jsxs19("div", { children: [
6543
+ /* @__PURE__ */ jsx19("dt", { children: "Effective date" }),
6544
+ /* @__PURE__ */ jsx19("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
5976
6545
  ] }),
5977
- /* @__PURE__ */ jsxs16("div", { children: [
5978
- /* @__PURE__ */ jsx16("dt", { children: "Deposit date" }),
5979
- /* @__PURE__ */ jsx16("dd", { children: payment.depositDate || "Not recorded" })
6546
+ /* @__PURE__ */ jsxs19("div", { children: [
6547
+ /* @__PURE__ */ jsx19("dt", { children: "Deposit date" }),
6548
+ /* @__PURE__ */ jsx19("dd", { children: payment.depositDate || "Not recorded" })
5980
6549
  ] }),
5981
- /* @__PURE__ */ jsxs16("div", { children: [
5982
- /* @__PURE__ */ jsx16("dt", { children: "Posted" }),
5983
- /* @__PURE__ */ jsxs16("dd", { children: [
6550
+ /* @__PURE__ */ jsxs19("div", { children: [
6551
+ /* @__PURE__ */ jsx19("dt", { children: "Posted" }),
6552
+ /* @__PURE__ */ jsxs19("dd", { children: [
5984
6553
  defaultFormatDate(payment.postedAt),
5985
6554
  " \xB7 ",
5986
6555
  payment.source.toUpperCase()
5987
6556
  ] })
5988
6557
  ] }),
5989
- /* @__PURE__ */ jsxs16("div", { children: [
5990
- /* @__PURE__ */ jsx16("dt", { children: "Status" }),
5991
- /* @__PURE__ */ jsx16("dd", { children: humanize(payment.status || "posted") })
6558
+ /* @__PURE__ */ jsxs19("div", { children: [
6559
+ /* @__PURE__ */ jsx19("dt", { children: "Status" }),
6560
+ /* @__PURE__ */ jsx19("dd", { children: humanize(payment.status || "posted") })
5992
6561
  ] })
5993
6562
  ] }),
5994
- payment.feeReason ? /* @__PURE__ */ jsx16("p", { children: payment.feeReason }) : null,
5995
- payment.note ? /* @__PURE__ */ jsx16("p", { children: payment.note }) : null
6563
+ payment.feeReason ? /* @__PURE__ */ jsx19("p", { children: payment.feeReason }) : null,
6564
+ payment.note ? /* @__PURE__ */ jsx19("p", { children: payment.note }) : null
5996
6565
  ] }, payment.id);
5997
6566
  }) })
5998
6567
  ] });
@@ -6049,27 +6618,27 @@ var lifecycleSurfaceStyles = `
6049
6618
  // src/connected-bill-lifecycle.tsx
6050
6619
  import {
6051
6620
  useCallback as useCallback4,
6052
- useEffect as useEffect12,
6053
- useMemo as useMemo9,
6054
- useRef as useRef8,
6055
- useState as useState14
6621
+ useEffect as useEffect14,
6622
+ useMemo as useMemo10,
6623
+ useRef as useRef9,
6624
+ useState as useState17
6056
6625
  } from "react";
6057
6626
  import {
6058
- DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
6059
- DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
6627
+ DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL3,
6628
+ DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT3,
6060
6629
  createBillLifecycleClient,
6061
6630
  reportBillStatusContacts,
6062
6631
  secondReviewDeadline
6063
6632
  } from "@mindbill/browser";
6064
6633
 
6065
6634
  // src/second-review-form.tsx
6066
- import { useMemo as useMemo8, useState as useState13 } from "react";
6635
+ import { useMemo as useMemo9, useState as useState16 } from "react";
6067
6636
 
6068
6637
  // src/second-review-corrections.ts
6069
6638
  import { parseSecondReviewCorrection } from "@mindbill/browser";
6070
6639
 
6071
6640
  // src/second-review-form.tsx
6072
- import { Fragment as Fragment14, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
6641
+ import { Fragment as Fragment14, jsx as jsx20, jsxs as jsxs20 } from "react/jsx-runtime";
6073
6642
  var SECOND_REVIEW_REASON_TEMPLATES = [
6074
6643
  {
6075
6644
  label: "Med-legal report denied",
@@ -6104,7 +6673,7 @@ var SECOND_REVIEW_REASON_TEMPLATES = [
6104
6673
  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."
6105
6674
  }
6106
6675
  ];
6107
- var css11 = `
6676
+ var css13 = `
6108
6677
  .mb-second-review{display:grid;gap:18px;padding:22px;color:var(--mb-text);font-family:var(--mb-font);background:var(--mb-surface);border:1px solid var(--mb-border);border-radius:var(--mb-radius);box-shadow:var(--mb-shadow)}
6109
6678
  .mb-second-review *{box-sizing:border-box}.mb-second-review h3{margin:0;font-size:22px}.mb-second-review p{margin:4px 0 0;color:var(--mb-muted)}
6110
6679
  .mb-second-review-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}
@@ -6117,7 +6686,7 @@ var css11 = `
6117
6686
  .mb-second-review-corrections{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.mb-second-review-correction-note{font-size:13px}
6118
6687
  @media(max-width:680px){.mb-second-review{padding:16px}.mb-second-review-line-head{align-items:flex-start;flex-direction:column}.mb-second-review-metrics{flex-wrap:wrap}.mb-second-review-corrections{grid-template-columns:1fr}}
6119
6688
  `;
6120
- function money5(value) {
6689
+ function money6(value) {
6121
6690
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
6122
6691
  }
6123
6692
  function initialLineDrafts(data) {
@@ -6142,13 +6711,13 @@ function SecondReviewForm({
6142
6711
  onCancel,
6143
6712
  onSubmit
6144
6713
  }) {
6145
- const [lines, setLines] = useState13(() => initialLineDrafts(data));
6146
- const [attachmentIds, setAttachmentIds] = useState13(() => data.bill.attachments.map((attachment) => attachment.id));
6147
- const [uploads, setUploads] = useState13([]);
6148
- const [formError, setFormError] = useState13("");
6149
- const [preparing, setPreparing] = useState13(false);
6150
- const [delivery, setDelivery] = useState13(null);
6151
- const selectableLines = useMemo8(() => data.bill.lineItems.filter((line) => Boolean(line.id)), [data.bill.lineItems]);
6714
+ const [lines, setLines] = useState16(() => initialLineDrafts(data));
6715
+ const [attachmentIds, setAttachmentIds] = useState16(() => data.bill.attachments.map((attachment) => attachment.id));
6716
+ const [uploads, setUploads] = useState16([]);
6717
+ const [formError, setFormError] = useState16("");
6718
+ const [preparing, setPreparing] = useState16(false);
6719
+ const [delivery, setDelivery] = useState16(null);
6720
+ const selectableLines = useMemo9(() => data.bill.lineItems.filter((line) => Boolean(line.id)), [data.bill.lineItems]);
6152
6721
  const selected = selectableLines.filter((line) => lines[line.id]?.selected);
6153
6722
  const invalidReason = selected.some((line) => !lines[line.id]?.reason.trim());
6154
6723
  const correctionErrors = Object.fromEntries(selected.map((line) => {
@@ -6247,118 +6816,118 @@ function SecondReviewForm({
6247
6816
  setPreparing(false);
6248
6817
  }
6249
6818
  };
6250
- return /* @__PURE__ */ jsxs17(Fragment14, { children: [
6251
- /* @__PURE__ */ jsx17("style", { children: css11 }),
6252
- /* @__PURE__ */ jsxs17("section", { className: "mb-second-review", children: [
6253
- /* @__PURE__ */ jsxs17("div", { children: [
6254
- /* @__PURE__ */ jsx17("h3", { children: "Submit Second Review" }),
6255
- /* @__PURE__ */ jsx17("p", { children: "Select each disputed service and explain why it should be reconsidered." })
6819
+ return /* @__PURE__ */ jsxs20(Fragment14, { children: [
6820
+ /* @__PURE__ */ jsx20("style", { children: css13 }),
6821
+ /* @__PURE__ */ jsxs20("section", { className: "mb-second-review", children: [
6822
+ /* @__PURE__ */ jsxs20("div", { children: [
6823
+ /* @__PURE__ */ jsx20("h3", { children: "Submit Second Review" }),
6824
+ /* @__PURE__ */ jsx20("p", { children: "Select each disputed service and explain why it should be reconsidered." })
6256
6825
  ] }),
6257
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-template", children: [
6258
- /* @__PURE__ */ jsx17("span", { className: "mb-second-review-label", children: "Apply a saved reason to selected lines" }),
6259
- /* @__PURE__ */ jsxs17("select", { className: "mb-second-review-select", defaultValue: "", onChange: (event) => {
6826
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-template", children: [
6827
+ /* @__PURE__ */ jsx20("span", { className: "mb-second-review-label", children: "Apply a saved reason to selected lines" }),
6828
+ /* @__PURE__ */ jsxs20("select", { className: "mb-second-review-select", defaultValue: "", onChange: (event) => {
6260
6829
  applyTemplate(event.target.value);
6261
6830
  event.target.value = "";
6262
6831
  }, children: [
6263
- /* @__PURE__ */ jsx17("option", { value: "", children: "Choose a reason template (optional)" }),
6264
- SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx17("option", { value: template.value, children: template.label }, template.label))
6832
+ /* @__PURE__ */ jsx20("option", { value: "", children: "Choose a reason template (optional)" }),
6833
+ SECOND_REVIEW_REASON_TEMPLATES.map((template) => /* @__PURE__ */ jsx20("option", { value: template.value, children: template.label }, template.label))
6265
6834
  ] })
6266
6835
  ] }),
6267
- /* @__PURE__ */ jsxs17("section", { className: "mb-second-review-lines", "aria-label": "Service lines in dispute", children: [
6836
+ /* @__PURE__ */ jsxs20("section", { className: "mb-second-review-lines", "aria-label": "Service lines in dispute", children: [
6268
6837
  selectableLines.map((line) => {
6269
6838
  const draft = lines[line.id];
6270
- return /* @__PURE__ */ jsxs17("article", { className: "mb-second-review-line", "data-selected": draft?.selected, children: [
6271
- /* @__PURE__ */ jsxs17("div", { className: "mb-second-review-line-head", children: [
6272
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-check", children: [
6273
- /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
6274
- /* @__PURE__ */ jsxs17("span", { children: [
6839
+ return /* @__PURE__ */ jsxs20("article", { className: "mb-second-review-line", "data-selected": draft?.selected, children: [
6840
+ /* @__PURE__ */ jsxs20("div", { className: "mb-second-review-line-head", children: [
6841
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-check", children: [
6842
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: Boolean(draft?.selected), onChange: (event) => patchLine(line.id, { selected: event.target.checked }) }),
6843
+ /* @__PURE__ */ jsxs20("span", { children: [
6275
6844
  line.code,
6276
6845
  line.modifiers.length ? `-${line.modifiers.join("-")}` : ""
6277
6846
  ] })
6278
6847
  ] }),
6279
- /* @__PURE__ */ jsxs17("span", { className: "mb-second-review-metrics", children: [
6280
- /* @__PURE__ */ jsxs17("span", { children: [
6848
+ /* @__PURE__ */ jsxs20("span", { className: "mb-second-review-metrics", children: [
6849
+ /* @__PURE__ */ jsxs20("span", { children: [
6281
6850
  line.units,
6282
6851
  " unit",
6283
6852
  line.units === 1 ? "" : "s"
6284
6853
  ] }),
6285
- /* @__PURE__ */ jsx17("span", { children: money5(line.charge) })
6854
+ /* @__PURE__ */ jsx20("span", { children: money6(line.charge) })
6286
6855
  ] })
6287
6856
  ] }),
6288
- draft?.selected ? /* @__PURE__ */ jsxs17(Fragment14, { children: [
6289
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-field", children: [
6290
- /* @__PURE__ */ jsx17("span", { className: "mb-second-review-label", children: "Reason for requesting Second Review" }),
6291
- /* @__PURE__ */ jsx17("textarea", { className: "mb-second-review-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
6857
+ draft?.selected ? /* @__PURE__ */ jsxs20(Fragment14, { children: [
6858
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-field", children: [
6859
+ /* @__PURE__ */ jsx20("span", { className: "mb-second-review-label", children: "Reason for requesting Second Review" }),
6860
+ /* @__PURE__ */ jsx20("textarea", { className: "mb-second-review-textarea", required: true, value: draft.reason, onChange: (event) => patchLine(line.id, { reason: event.target.value }) })
6292
6861
  ] }),
6293
- /* @__PURE__ */ jsxs17("div", { className: "mb-second-review-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
6294
- /* @__PURE__ */ jsx17("strong", { children: "Service/Good Authorized?" }),
6295
- [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs17("label", { children: [
6296
- /* @__PURE__ */ jsx17("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
6862
+ /* @__PURE__ */ jsxs20("div", { className: "mb-second-review-auth", role: "radiogroup", "aria-label": `Service or good ${line.code} authorized`, children: [
6863
+ /* @__PURE__ */ jsx20("strong", { children: "Service/Good Authorized?" }),
6864
+ [["yes", "Yes"], ["no", "No"], ["", "Not specified"]].map(([value, label]) => /* @__PURE__ */ jsxs20("label", { children: [
6865
+ /* @__PURE__ */ jsx20("input", { type: "radio", name: `authorized-${line.id}`, checked: draft.serviceAuthorized === value, onChange: () => patchLine(line.id, { serviceAuthorized: value }) }),
6297
6866
  label
6298
6867
  ] }, label))
6299
6868
  ] })
6300
6869
  ] }) : null,
6301
- draft?.selected ? /* @__PURE__ */ jsxs17(Fragment14, { children: [
6302
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-check", children: [
6303
- /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: draft.correctBilling, onChange: (event) => patchLine(line.id, { correctBilling: event.target.checked, chargeReviewed: false }) }),
6870
+ draft?.selected ? /* @__PURE__ */ jsxs20(Fragment14, { children: [
6871
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-check", children: [
6872
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: draft.correctBilling, onChange: (event) => patchLine(line.id, { correctBilling: event.target.checked, chargeReviewed: false }) }),
6304
6873
  "Correct units or modifiers on this submission"
6305
6874
  ] }),
6306
- draft.correctBilling ? /* @__PURE__ */ jsxs17(Fragment14, { children: [
6307
- /* @__PURE__ */ jsx17("p", { className: "mb-second-review-correction-note", children: "Earlier submissions stay unchanged. Review the charge explicitly; changing units or modifiers does not recalculate it." }),
6308
- /* @__PURE__ */ jsxs17("div", { className: "mb-second-review-corrections", children: [
6309
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-field", children: [
6310
- /* @__PURE__ */ jsx17("span", { className: "mb-second-review-label", children: "Corrected units" }),
6311
- /* @__PURE__ */ jsx17("input", { className: "mb-second-review-select", type: "number", min: "1", max: "10000", step: "1", value: draft.units, onChange: (event) => patchLine(line.id, { units: event.target.value, chargeReviewed: false }) })
6875
+ draft.correctBilling ? /* @__PURE__ */ jsxs20(Fragment14, { children: [
6876
+ /* @__PURE__ */ jsx20("p", { className: "mb-second-review-correction-note", children: "Earlier submissions stay unchanged. Review the charge explicitly; changing units or modifiers does not recalculate it." }),
6877
+ /* @__PURE__ */ jsxs20("div", { className: "mb-second-review-corrections", children: [
6878
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-field", children: [
6879
+ /* @__PURE__ */ jsx20("span", { className: "mb-second-review-label", children: "Corrected units" }),
6880
+ /* @__PURE__ */ jsx20("input", { className: "mb-second-review-select", type: "number", min: "1", max: "10000", step: "1", value: draft.units, onChange: (event) => patchLine(line.id, { units: event.target.value, chargeReviewed: false }) })
6312
6881
  ] }),
6313
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-field", children: [
6314
- /* @__PURE__ */ jsx17("span", { className: "mb-second-review-label", children: "Corrected modifiers" }),
6315
- /* @__PURE__ */ jsx17("input", { className: "mb-second-review-select", placeholder: "95, 93 \u2014 or leave blank", value: draft.modifiers, onChange: (event) => patchLine(line.id, { modifiers: event.target.value, chargeReviewed: false }) })
6882
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-field", children: [
6883
+ /* @__PURE__ */ jsx20("span", { className: "mb-second-review-label", children: "Corrected modifiers" }),
6884
+ /* @__PURE__ */ jsx20("input", { className: "mb-second-review-select", placeholder: "95, 93 \u2014 or leave blank", value: draft.modifiers, onChange: (event) => patchLine(line.id, { modifiers: event.target.value, chargeReviewed: false }) })
6316
6885
  ] }),
6317
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-field", children: [
6318
- /* @__PURE__ */ jsx17("span", { className: "mb-second-review-label", children: "Corrected charge ($)" }),
6319
- /* @__PURE__ */ jsx17("input", { className: "mb-second-review-select", type: "number", min: "0", max: "999999.99", step: "0.01", value: draft.charge, onChange: (event) => patchLine(line.id, { charge: event.target.value, chargeReviewed: false }) })
6886
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-field", children: [
6887
+ /* @__PURE__ */ jsx20("span", { className: "mb-second-review-label", children: "Corrected charge ($)" }),
6888
+ /* @__PURE__ */ jsx20("input", { className: "mb-second-review-select", type: "number", min: "0", max: "999999.99", step: "0.01", value: draft.charge, onChange: (event) => patchLine(line.id, { charge: event.target.value, chargeReviewed: false }) })
6320
6889
  ] })
6321
6890
  ] }),
6322
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-check", children: [
6323
- /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: draft.chargeReviewed, onChange: (event) => patchLine(line.id, { chargeReviewed: event.target.checked }) }),
6891
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-check", children: [
6892
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: draft.chargeReviewed, onChange: (event) => patchLine(line.id, { chargeReviewed: event.target.checked }) }),
6324
6893
  "I reviewed the corrected charge"
6325
6894
  ] }),
6326
- correctionErrors[line.id] ? /* @__PURE__ */ jsx17("p", { className: "mb-second-review-correction-note", role: "status", children: correctionErrors[line.id] }) : null
6895
+ correctionErrors[line.id] ? /* @__PURE__ */ jsx20("p", { className: "mb-second-review-correction-note", role: "status", children: correctionErrors[line.id] }) : null
6327
6896
  ] }) : null
6328
6897
  ] }) : null
6329
6898
  ] }, line.id);
6330
6899
  }),
6331
- !selectableLines.length ? /* @__PURE__ */ jsx17("div", { className: "mb-second-review-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
6900
+ !selectableLines.length ? /* @__PURE__ */ jsx20("div", { className: "mb-second-review-error", children: "This bill has no stable service-line identifiers. Refresh the bill before submitting a Second Review." }) : null
6332
6901
  ] }),
6333
- /* @__PURE__ */ jsxs17("fieldset", { className: "mb-second-review-packet", children: [
6334
- /* @__PURE__ */ jsx17("legend", { children: "Supporting packet" }),
6335
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-document", children: [
6336
- /* @__PURE__ */ jsx17("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
6337
- /* @__PURE__ */ jsxs17("span", { children: [
6338
- /* @__PURE__ */ jsx17("strong", { children: attachment.filename }),
6339
- /* @__PURE__ */ jsx17("small", { children: attachment.description || attachment.documentType })
6902
+ /* @__PURE__ */ jsxs20("fieldset", { className: "mb-second-review-packet", children: [
6903
+ /* @__PURE__ */ jsx20("legend", { children: "Supporting packet" }),
6904
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-document", children: [
6905
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: attachmentIds.includes(attachment.id), onChange: (event) => setAttachmentIds((current) => event.target.checked ? [...current, attachment.id] : current.filter((id) => id !== attachment.id)) }),
6906
+ /* @__PURE__ */ jsxs20("span", { children: [
6907
+ /* @__PURE__ */ jsx20("strong", { children: attachment.filename }),
6908
+ /* @__PURE__ */ jsx20("small", { children: attachment.description || attachment.documentType })
6340
6909
  ] }),
6341
- /* @__PURE__ */ jsx17("button", { className: "mb-second-review-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
6910
+ /* @__PURE__ */ jsx20("button", { className: "mb-second-review-link", type: "button", onClick: () => void openAttachment(attachment).catch(() => void 0), children: "View" })
6342
6911
  ] }, attachment.id)),
6343
- /* @__PURE__ */ jsxs17("label", { className: "mb-second-review-upload", children: [
6344
- /* @__PURE__ */ jsx17("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
6345
- /* @__PURE__ */ jsxs17("span", { children: [
6346
- /* @__PURE__ */ jsx17("strong", { children: "Choose one or more PDF files" }),
6912
+ /* @__PURE__ */ jsxs20("label", { className: "mb-second-review-upload", children: [
6913
+ /* @__PURE__ */ jsx20("input", { type: "file", accept: "application/pdf,.pdf", multiple: true, onChange: addUploads }),
6914
+ /* @__PURE__ */ jsxs20("span", { children: [
6915
+ /* @__PURE__ */ jsx20("strong", { children: "Choose one or more PDF files" }),
6347
6916
  " to attach"
6348
6917
  ] })
6349
6918
  ] }),
6350
- uploads.map((upload, index) => /* @__PURE__ */ jsxs17("div", { className: "mb-second-review-uploaded", children: [
6351
- /* @__PURE__ */ jsx17("span", { children: upload.file.name }),
6352
- /* @__PURE__ */ jsx17("button", { className: "mb-second-review-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
6919
+ uploads.map((upload, index) => /* @__PURE__ */ jsxs20("div", { className: "mb-second-review-uploaded", children: [
6920
+ /* @__PURE__ */ jsx20("span", { children: upload.file.name }),
6921
+ /* @__PURE__ */ jsx20("button", { className: "mb-second-review-link", type: "button", onClick: () => setUploads((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "Remove" })
6353
6922
  ] }, `${upload.file.name}-${index}`))
6354
6923
  ] }),
6355
- formError || error?.message ? /* @__PURE__ */ jsx17("div", { className: "mb-second-review-error", role: "alert", children: formError || error?.message }) : null,
6356
- /* @__PURE__ */ jsxs17("div", { className: "mb-second-review-actions", children: [
6357
- /* @__PURE__ */ jsx17("button", { className: "mb-second-review-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
6358
- /* @__PURE__ */ jsx17("button", { className: "mb-second-review-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason || invalidCorrection, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
6924
+ formError || error?.message ? /* @__PURE__ */ jsx20("div", { className: "mb-second-review-error", role: "alert", children: formError || error?.message }) : null,
6925
+ /* @__PURE__ */ jsxs20("div", { className: "mb-second-review-actions", children: [
6926
+ /* @__PURE__ */ jsx20("button", { className: "mb-second-review-button secondary", type: "button", disabled: submitting || preparing, onClick: onCancel, children: "Cancel" }),
6927
+ /* @__PURE__ */ jsx20("button", { className: "mb-second-review-button primary", type: "button", disabled: submitting || preparing || !selected.length || invalidReason || invalidCorrection, onClick: () => void continueToDelivery(), children: preparing ? "Preparing\u2026" : "Continue to delivery" })
6359
6928
  ] })
6360
6929
  ] }),
6361
- delivery ? /* @__PURE__ */ jsx17(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
6930
+ delivery ? /* @__PURE__ */ jsx20(SendRouteDialog, { title: "Confirm Second Review delivery", delivery, submitting: submitting || preparing, error: formError || error?.message || null, onCancel: () => setDelivery(null), onConfirm: (route) => void submit(route) }) : null
6362
6931
  ] });
6363
6932
  }
6364
6933
 
@@ -6370,7 +6939,7 @@ import {
6370
6939
  reportBillStatusContacts as reportBillStatusContacts2,
6371
6940
  secondReviewDeadline as secondReviewDeadline2
6372
6941
  } from "@mindbill/browser";
6373
- import { Fragment as Fragment15, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
6942
+ import { Fragment as Fragment15, jsx as jsx21, jsxs as jsxs21 } from "react/jsx-runtime";
6374
6943
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
6375
6944
  function billTeamNotes(data) {
6376
6945
  const notes = data.notes ?? [];
@@ -6411,32 +6980,32 @@ async function openPdfFromUserGesture(loadPdf) {
6411
6980
  }
6412
6981
  function useBillLifecycle({
6413
6982
  billId: providedBillId,
6414
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
6983
+ sessionEndpoint = DEFAULT_SESSION_ENDPOINT3,
6415
6984
  getSession,
6416
- apiBaseUrl = DEFAULT_API_BASE_URL2,
6985
+ apiBaseUrl = DEFAULT_API_BASE_URL3,
6417
6986
  refreshInterval = DEFAULT_REFRESH_INTERVAL2,
6418
6987
  enabled = true,
6419
6988
  fetch: fetchOverride
6420
6989
  }) {
6421
- const [data, setData] = useState14(null);
6422
- const [error, setError] = useState14(null);
6423
- const [isLoading, setIsLoading] = useState14(enabled);
6424
- const [isRefreshing, setIsRefreshing] = useState14(false);
6425
- const [isMutating, setIsMutating] = useState14(false);
6426
- const mounted = useRef8(true);
6427
- const client = useMemo9(() => createBillLifecycleClient({
6990
+ const [data, setData] = useState17(null);
6991
+ const [error, setError] = useState17(null);
6992
+ const [isLoading, setIsLoading] = useState17(enabled);
6993
+ const [isRefreshing, setIsRefreshing] = useState17(false);
6994
+ const [isMutating, setIsMutating] = useState17(false);
6995
+ const mounted = useRef9(true);
6996
+ const client = useMemo10(() => createBillLifecycleClient({
6428
6997
  billId: providedBillId,
6429
6998
  sessionEndpoint,
6430
6999
  getSession,
6431
7000
  apiBaseUrl,
6432
7001
  fetch: fetchOverride
6433
7002
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
6434
- useEffect12(() => {
7003
+ useEffect14(() => {
6435
7004
  setData(null);
6436
7005
  setError(null);
6437
7006
  setIsLoading(enabled);
6438
7007
  }, [enabled, providedBillId]);
6439
- useEffect12(() => {
7008
+ useEffect14(() => {
6440
7009
  mounted.current = true;
6441
7010
  return () => {
6442
7011
  mounted.current = false;
@@ -6460,7 +7029,7 @@ function useBillLifecycle({
6460
7029
  }
6461
7030
  }
6462
7031
  }, [client, enabled]);
6463
- useEffect12(() => {
7032
+ useEffect14(() => {
6464
7033
  if (!enabled) return;
6465
7034
  void refresh();
6466
7035
  const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -6563,10 +7132,10 @@ function useBillLifecycle({
6563
7132
  };
6564
7133
  }
6565
7134
  function LifecycleDialog({ children, title, wide = false, onClose }) {
6566
- const dialog = useRef8(null);
6567
- const onCloseRef = useRef8(onClose);
7135
+ const dialog = useRef9(null);
7136
+ const onCloseRef = useRef9(onClose);
6568
7137
  onCloseRef.current = onClose;
6569
- useEffect12(() => {
7138
+ useEffect14(() => {
6570
7139
  const previous = document.activeElement;
6571
7140
  dialog.current?.focus();
6572
7141
  const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
@@ -6576,8 +7145,8 @@ function LifecycleDialog({ children, title, wide = false, onClose }) {
6576
7145
  previous?.focus();
6577
7146
  };
6578
7147
  }, []);
6579
- return /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs18("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
6580
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
7148
+ return /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs21("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
7149
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
6581
7150
  children
6582
7151
  ] }) });
6583
7152
  }
@@ -6616,22 +7185,22 @@ function correctionRejectionSummary(rejection) {
6616
7185
  function CorrectionRejectionReason({ rejection }) {
6617
7186
  const summary = correctionRejectionSummary(rejection);
6618
7187
  const details = rejection.issues?.filter((issue) => issue.description.trim() !== summary.description || Boolean(issue.code?.trim() && issue.code.trim() !== summary.code)) ?? [];
6619
- return /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
6620
- summary.code ? /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-correction-reason-code", children: [
6621
- /* @__PURE__ */ jsx18("span", { children: "Rejection code" }),
6622
- /* @__PURE__ */ jsx18("code", { children: summary.code }),
6623
- summary.clearinghouseDetail ? /* @__PURE__ */ jsxs18("small", { children: [
6624
- /* @__PURE__ */ jsx18("span", { children: "Clearinghouse detail" }),
7188
+ return /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-correction-reason", role: "alert", children: [
7189
+ summary.code ? /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-correction-reason-code", children: [
7190
+ /* @__PURE__ */ jsx21("span", { children: "Rejection code" }),
7191
+ /* @__PURE__ */ jsx21("code", { children: summary.code }),
7192
+ summary.clearinghouseDetail ? /* @__PURE__ */ jsxs21("small", { children: [
7193
+ /* @__PURE__ */ jsx21("span", { children: "Clearinghouse detail" }),
6625
7194
  summary.clearinghouseDetail
6626
7195
  ] }) : null
6627
7196
  ] }) : null,
6628
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-correction-reason-description", children: [
6629
- /* @__PURE__ */ jsx18("span", { children: "Reason" }),
6630
- /* @__PURE__ */ jsx18("strong", { children: summary.description })
7197
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-correction-reason-description", children: [
7198
+ /* @__PURE__ */ jsx21("span", { children: "Reason" }),
7199
+ /* @__PURE__ */ jsx21("strong", { children: summary.description })
6631
7200
  ] }),
6632
- details.length ? /* @__PURE__ */ jsx18("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs18("li", { children: [
6633
- issue.code ? /* @__PURE__ */ jsx18("code", { children: issue.code }) : null,
6634
- /* @__PURE__ */ jsx18("span", { children: issue.description })
7201
+ details.length ? /* @__PURE__ */ jsx21("ul", { "aria-label": "Additional rejection details", children: details.map((issue, index) => /* @__PURE__ */ jsxs21("li", { children: [
7202
+ issue.code ? /* @__PURE__ */ jsx21("code", { children: issue.code }) : null,
7203
+ /* @__PURE__ */ jsx21("span", { children: issue.description })
6635
7204
  ] }, `${issue.code || "issue"}-${index}`)) }) : null
6636
7205
  ] });
6637
7206
  }
@@ -6672,16 +7241,16 @@ function CorrectionVerificationContact({ delivery }) {
6672
7241
  { label: "Mail", values: mailingAddresses }
6673
7242
  ].filter((method) => method.values.length);
6674
7243
  if (!methods.length) return null;
6675
- return /* @__PURE__ */ jsxs18("aside", { className: "mb-lifecycle-correction-contact", children: [
6676
- /* @__PURE__ */ jsx18("strong", { children: "Need to verify the rejected information?" }),
6677
- /* @__PURE__ */ jsxs18("span", { children: [
7244
+ return /* @__PURE__ */ jsxs21("aside", { className: "mb-lifecycle-correction-contact", children: [
7245
+ /* @__PURE__ */ jsx21("strong", { children: "Need to verify the rejected information?" }),
7246
+ /* @__PURE__ */ jsxs21("span", { children: [
6678
7247
  "Contact ",
6679
7248
  delivery.payerName,
6680
7249
  " using any available method:"
6681
7250
  ] }),
6682
- /* @__PURE__ */ jsx18("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs18("div", { children: [
6683
- /* @__PURE__ */ jsx18("dt", { children: method.label }),
6684
- /* @__PURE__ */ jsx18("dd", { children: /* @__PURE__ */ jsx18("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx18("li", { children: method.href ? /* @__PURE__ */ jsx18("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
7251
+ /* @__PURE__ */ jsx21("dl", { children: methods.map((method) => /* @__PURE__ */ jsxs21("div", { children: [
7252
+ /* @__PURE__ */ jsx21("dt", { children: method.label }),
7253
+ /* @__PURE__ */ jsx21("dd", { children: /* @__PURE__ */ jsx21("ul", { children: method.values.map((value) => /* @__PURE__ */ jsx21("li", { children: method.href ? /* @__PURE__ */ jsx21("a", { href: method.href(value), ...method.label === "Portal" ? { target: "_blank", rel: "noreferrer" } : {}, children: value }) : value }, value)) }) })
6685
7254
  ] }, method.label)) })
6686
7255
  ] });
6687
7256
  }
@@ -6800,24 +7369,24 @@ function shouldShowSandboxControls(environment, enabled = false) {
6800
7369
  function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint, claimsAdministratorSources, courtesyCopyRecipientOptions: courtesyCopyRecipientOptions2 = [], sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
6801
7370
  const lifecycle = useBillLifecycle(options);
6802
7371
  const { data } = lifecycle;
6803
- const [tab, setTab] = useState14("details");
6804
- const [selectedSubmissionId, setSelectedSubmissionId] = useState14();
6805
- const [panel, setPanel] = useState14("");
6806
- const [notice, setNotice] = useState14("");
6807
- const [note, setNote] = useState14("");
6808
- const [reason, setReason] = useState14("");
6809
- const [correctionError, setCorrectionError] = useState14("");
6810
- const [newBillError, setNewBillError] = useState14("");
6811
- const [payment, setPayment] = useState14({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
6812
- const [duplicateError, setDuplicateError] = useState14("");
7372
+ const [tab, setTab] = useState17("details");
7373
+ const [selectedSubmissionId, setSelectedSubmissionId] = useState17();
7374
+ const [panel, setPanel] = useState17("");
7375
+ const [notice, setNotice] = useState17("");
7376
+ const [note, setNote] = useState17("");
7377
+ const [reason, setReason] = useState17("");
7378
+ const [correctionError, setCorrectionError] = useState17("");
7379
+ const [newBillError, setNewBillError] = useState17("");
7380
+ const [payment, setPayment] = useState17({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
7381
+ const [duplicateError, setDuplicateError] = useState17("");
6813
7382
  const currentAttemptKey = data?.attempts?.find((attempt) => attempt.isCurrent)?.id ?? data?.history?.filter((entry) => entry.kind === "submission").at(-1)?.id ?? data?.bill.id;
6814
- useEffect12(() => {
7383
+ useEffect14(() => {
6815
7384
  setPanel("");
6816
7385
  }, [currentAttemptKey]);
6817
7386
  const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
6818
- const lastData = useRef8(null);
6819
- const correctionInitialBill = useMemo9(() => data ? correctionBill(data) : null, [data]);
6820
- const correctionAttachments = useMemo9(() => data ? data.bill.attachments.map((attachment) => {
7387
+ const lastData = useRef9(null);
7388
+ const correctionInitialBill = useMemo10(() => data ? correctionBill(data) : null, [data]);
7389
+ const correctionAttachments = useMemo10(() => data ? data.bill.attachments.map((attachment) => {
6821
7390
  const documentType = correctionDocumentType(attachment.documentType);
6822
7391
  const isW9 = documentType === "w9";
6823
7392
  return {
@@ -6830,8 +7399,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6830
7399
  ...isW9 ? { autoAttached: true, removable: false } : { removable: true }
6831
7400
  };
6832
7401
  }) : [], [data, lifecycle]);
6833
- const correctionAttentionFields = useMemo9(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
6834
- useEffect12(() => {
7402
+ const correctionAttentionFields = useMemo10(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
7403
+ useEffect14(() => {
6835
7404
  if (!data || data === lastData.current) return;
6836
7405
  lastData.current = data;
6837
7406
  onChanged?.(data);
@@ -6843,13 +7412,13 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6843
7412
  interestAmount: 0
6844
7413
  }));
6845
7414
  }, [data, onChanged]);
6846
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx18(Fragment15, { children: loadingFallback ?? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
7415
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx21(Fragment15, { children: loadingFallback ?? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
6847
7416
  if (!data) {
6848
7417
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
6849
- return /* @__PURE__ */ jsx18(Fragment15, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-error", role: "alert", children: [
6850
- /* @__PURE__ */ jsx18("strong", { children: "Billing is unavailable." }),
6851
- /* @__PURE__ */ jsx18("span", { children: error.message }),
6852
- /* @__PURE__ */ jsx18("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
7418
+ return /* @__PURE__ */ jsx21(Fragment15, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-error", role: "alert", children: [
7419
+ /* @__PURE__ */ jsx21("strong", { children: "Billing is unavailable." }),
7420
+ /* @__PURE__ */ jsx21("span", { children: error.message }),
7421
+ /* @__PURE__ */ jsx21("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
6853
7422
  ] }) });
6854
7423
  }
6855
7424
  const complete = async (message, task) => {
@@ -6972,121 +7541,121 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
6972
7541
  const statusContacts = reportBillStatusContacts(data.delivery);
6973
7542
  const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
6974
7543
  const reviewDeadline = secondReviewDeadline(data.eors);
6975
- return /* @__PURE__ */ jsxs18("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
6976
- /* @__PURE__ */ jsx18("style", { children: CONNECTED_LIFECYCLE_STYLES }),
6977
- ribbonItems.length >= 2 ? /* @__PURE__ */ jsx18(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
7544
+ return /* @__PURE__ */ jsxs21("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
7545
+ /* @__PURE__ */ jsx21("style", { children: CONNECTED_LIFECYCLE_STYLES }),
7546
+ ribbonItems.length >= 2 ? /* @__PURE__ */ jsx21(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
6978
7547
  setSelectedSubmissionId(item.id);
6979
7548
  setTab("details");
6980
7549
  setPanel("");
6981
7550
  }, ...appearance ? { appearance } : {} }) : null,
6982
- historical ? null : data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx18(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx18(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
6983
- /* @__PURE__ */ jsxs18("header", { className: "mb-lifecycle-head", children: [
6984
- /* @__PURE__ */ jsxs18("div", { children: [
6985
- /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsx18("h2", { children: historical && !selectedAttempt ? "Previous submission" : `Bill #${historical ? selectedAttempt?.billNumber : data.bill.billNumber}` }) }),
6986
- /* @__PURE__ */ jsxs18("p", { children: [
7551
+ historical ? null : data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx21(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx21(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
7552
+ /* @__PURE__ */ jsxs21("header", { className: "mb-lifecycle-head", children: [
7553
+ /* @__PURE__ */ jsxs21("div", { children: [
7554
+ /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsx21("h2", { children: historical && !selectedAttempt ? "Previous submission" : `Bill #${historical ? selectedAttempt?.billNumber : data.bill.billNumber}` }) }),
7555
+ /* @__PURE__ */ jsxs21("p", { children: [
6987
7556
  displayedData ? `Claim ${displayedData.injury.claimNumber || "\u2014"}` : "Previous submission",
6988
7557
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
6989
7558
  ] })
6990
7559
  ] }),
6991
- !historical ? /* @__PURE__ */ jsxs18(Fragment15, { children: [
6992
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" }),
6993
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel("courtesy_copy"), children: "Forward copy" })
7560
+ !historical ? /* @__PURE__ */ jsxs21(Fragment15, { children: [
7561
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" }),
7562
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel("courtesy_copy"), children: "Forward copy" })
6994
7563
  ] }) : null
6995
7564
  ] }),
6996
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
6997
- /* @__PURE__ */ jsx18("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
6998
- /* @__PURE__ */ jsx18("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
7565
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
7566
+ /* @__PURE__ */ jsx21("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
7567
+ /* @__PURE__ */ jsx21("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
6999
7568
  ] }),
7000
- tab === "details" ? /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
7001
- selectedAttempt && ribbonItems.length >= 2 ? /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-attempt-detail", "aria-label": "Selected submission detail", children: [
7002
- /* @__PURE__ */ jsxs18("header", { children: [
7003
- /* @__PURE__ */ jsxs18("div", { children: [
7004
- /* @__PURE__ */ jsx18("span", { children: "Selected submission" }),
7005
- /* @__PURE__ */ jsx18("h3", { children: selectedAttempt.label })
7569
+ tab === "details" ? /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
7570
+ selectedAttempt && ribbonItems.length >= 2 ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-attempt-detail", "aria-label": "Selected submission detail", children: [
7571
+ /* @__PURE__ */ jsxs21("header", { children: [
7572
+ /* @__PURE__ */ jsxs21("div", { children: [
7573
+ /* @__PURE__ */ jsx21("span", { children: "Selected submission" }),
7574
+ /* @__PURE__ */ jsx21("h3", { children: selectedAttempt.label })
7006
7575
  ] }),
7007
- /* @__PURE__ */ jsx18("strong", { children: selectedAttempt.isCurrent ? "Current" : "Previous" })
7576
+ /* @__PURE__ */ jsx21("strong", { children: selectedAttempt.isCurrent ? "Current" : "Previous" })
7008
7577
  ] }),
7009
- /* @__PURE__ */ jsxs18("dl", { children: [
7010
- /* @__PURE__ */ jsxs18("div", { children: [
7011
- /* @__PURE__ */ jsx18("dt", { children: "Bill" }),
7012
- /* @__PURE__ */ jsxs18("dd", { children: [
7578
+ /* @__PURE__ */ jsxs21("dl", { children: [
7579
+ /* @__PURE__ */ jsxs21("div", { children: [
7580
+ /* @__PURE__ */ jsx21("dt", { children: "Bill" }),
7581
+ /* @__PURE__ */ jsxs21("dd", { children: [
7013
7582
  "#",
7014
7583
  selectedAttempt.billNumber || data.bill.billNumber
7015
7584
  ] })
7016
7585
  ] }),
7017
- /* @__PURE__ */ jsxs18("div", { children: [
7018
- /* @__PURE__ */ jsx18("dt", { children: "Delivery" }),
7019
- /* @__PURE__ */ jsx18("dd", { children: selectedAttempt.deliveryLabel || "\u2014" })
7586
+ /* @__PURE__ */ jsxs21("div", { children: [
7587
+ /* @__PURE__ */ jsx21("dt", { children: "Delivery" }),
7588
+ /* @__PURE__ */ jsx21("dd", { children: selectedAttempt.deliveryLabel || "\u2014" })
7020
7589
  ] }),
7021
- /* @__PURE__ */ jsxs18("div", { children: [
7022
- /* @__PURE__ */ jsx18("dt", { children: "Sent" }),
7023
- /* @__PURE__ */ jsx18("dd", { children: selectedAttempt.sentAt ? new Date(selectedAttempt.sentAt).toLocaleString() : "\u2014" })
7590
+ /* @__PURE__ */ jsxs21("div", { children: [
7591
+ /* @__PURE__ */ jsx21("dt", { children: "Sent" }),
7592
+ /* @__PURE__ */ jsx21("dd", { children: selectedAttempt.sentAt ? new Date(selectedAttempt.sentAt).toLocaleString() : "\u2014" })
7024
7593
  ] }),
7025
- /* @__PURE__ */ jsxs18("div", { children: [
7026
- /* @__PURE__ */ jsx18("dt", { children: "Status" }),
7027
- /* @__PURE__ */ jsx18("dd", { children: selectedAttempt.status || selectedAttempt.ackLabel || "Submitted" })
7594
+ /* @__PURE__ */ jsxs21("div", { children: [
7595
+ /* @__PURE__ */ jsx21("dt", { children: "Status" }),
7596
+ /* @__PURE__ */ jsx21("dd", { children: selectedAttempt.status || selectedAttempt.ackLabel || "Submitted" })
7028
7597
  ] }),
7029
- selectedAttempt.complianceLabel ? /* @__PURE__ */ jsxs18("div", { children: [
7030
- /* @__PURE__ */ jsx18("dt", { children: selectedAttempt.complianceLabel }),
7031
- /* @__PURE__ */ jsx18("dd", { children: selectedAttempt.complianceAt ? new Date(selectedAttempt.complianceAt).toLocaleDateString() : "\u2014" })
7598
+ selectedAttempt.complianceLabel ? /* @__PURE__ */ jsxs21("div", { children: [
7599
+ /* @__PURE__ */ jsx21("dt", { children: selectedAttempt.complianceLabel }),
7600
+ /* @__PURE__ */ jsx21("dd", { children: selectedAttempt.complianceAt ? new Date(selectedAttempt.complianceAt).toLocaleDateString() : "\u2014" })
7032
7601
  ] }) : null
7033
7602
  ] })
7034
7603
  ] }) : null,
7035
- !historical && (data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state)) ? /* @__PURE__ */ jsx18(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
7036
- showSandboxControls ? /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
7037
- /* @__PURE__ */ jsxs18("div", { children: [
7038
- /* @__PURE__ */ jsx18("span", { children: "Sandbox demo controls" }),
7039
- /* @__PURE__ */ jsx18("h3", { children: "Simulate the next payer response" }),
7040
- /* @__PURE__ */ jsx18("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
7604
+ !historical && (data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state)) ? /* @__PURE__ */ jsx21(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
7605
+ showSandboxControls ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
7606
+ /* @__PURE__ */ jsxs21("div", { children: [
7607
+ /* @__PURE__ */ jsx21("span", { children: "Sandbox demo controls" }),
7608
+ /* @__PURE__ */ jsx21("h3", { children: "Simulate the next payer response" }),
7609
+ /* @__PURE__ */ jsx21("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
7041
7610
  ] }),
7042
- simulations.length ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs18("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
7043
- /* @__PURE__ */ jsx18("strong", { children: scenario.label }),
7044
- /* @__PURE__ */ jsx18("span", { children: scenario.detail })
7045
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx18("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
7611
+ simulations.length ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs21("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
7612
+ /* @__PURE__ */ jsx21("strong", { children: scenario.label }),
7613
+ /* @__PURE__ */ jsx21("span", { children: scenario.detail })
7614
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx21("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
7046
7615
  ] }) : null,
7047
- historical ? /* @__PURE__ */ jsx18("p", { className: "mb-lifecycle-card", children: selectedDetail?.source === "submission_snapshot" ? "Saved as submitted. This previous submission is read-only; payment balances and current actions are shown on the current bill." : displayedData ? "Historical bill record. An exact as-submitted snapshot was not recorded for this older attempt; these are the stored bill values, not a guaranteed copy of the original packet." : "Detailed values were not saved for this historical submission. Select the current submission to see the current bill. We will not substitute current data for this older attempt." }) : null,
7048
- displayedData ? /* @__PURE__ */ jsx18(BillReadOnlyForm, { data: displayedData, ...!historical ? { onOpenAttachment: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }, activeSubmissionId) : null,
7049
- historical && selectedAttempt ? /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-card", "aria-label": "Retained submission files", children: [
7050
- /* @__PURE__ */ jsx18("h3", { children: "Retained submission files" }),
7051
- /* @__PURE__ */ jsx18("p", { children: "Exact files saved for this submission. These downloads do not include a regenerated current bill or a later EOR." }),
7052
- selectedDetail?.artifacts?.length ? selectedDetail.artifacts.map((artifact) => /* @__PURE__ */ jsxs18("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.downloadSubmissionArtifact(selectedAttempt.id, artifact.id, artifact.label).catch(() => void 0), children: [
7616
+ historical ? /* @__PURE__ */ jsx21("p", { className: "mb-lifecycle-card", children: selectedDetail?.source === "submission_snapshot" ? "Saved as submitted. This previous submission is read-only; payment balances and current actions are shown on the current bill." : displayedData ? "Historical bill record. An exact as-submitted snapshot was not recorded for this older attempt; these are the stored bill values, not a guaranteed copy of the original packet." : "Detailed values were not saved for this historical submission. Select the current submission to see the current bill. We will not substitute current data for this older attempt." }) : null,
7617
+ displayedData ? /* @__PURE__ */ jsx21(BillReadOnlyForm, { data: displayedData, ...!historical ? { onOpenAttachment: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }, activeSubmissionId) : null,
7618
+ historical && selectedAttempt ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-card", "aria-label": "Retained submission files", children: [
7619
+ /* @__PURE__ */ jsx21("h3", { children: "Retained submission files" }),
7620
+ /* @__PURE__ */ jsx21("p", { children: "Exact files saved for this submission. These downloads do not include a regenerated current bill or a later EOR." }),
7621
+ selectedDetail?.artifacts?.length ? selectedDetail.artifacts.map((artifact) => /* @__PURE__ */ jsxs21("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.downloadSubmissionArtifact(selectedAttempt.id, artifact.id, artifact.label).catch(() => void 0), children: [
7053
7622
  "Download ",
7054
7623
  artifact.kind === "submitted_edi" ? "submitted EDI" : "submitted attachment",
7055
7624
  ": ",
7056
7625
  artifact.label
7057
- ] }, artifact.id)) : /* @__PURE__ */ jsx18("p", { children: "No retained files are available for this submission." })
7626
+ ] }, artifact.id)) : /* @__PURE__ */ jsx21("p", { children: "No retained files are available for this submission." })
7058
7627
  ] }) : null,
7059
- !historical ? /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-notes", "aria-label": "Bill notes", children: [
7060
- /* @__PURE__ */ jsxs18("header", { children: [
7061
- /* @__PURE__ */ jsxs18("div", { children: [
7062
- /* @__PURE__ */ jsx18("h3", { children: "Team notes" }),
7063
- /* @__PURE__ */ jsx18("p", { children: "Shared with your workspace\u2019s billing team. Never sent to the payer." })
7628
+ !historical ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-notes", "aria-label": "Bill notes", children: [
7629
+ /* @__PURE__ */ jsxs21("header", { children: [
7630
+ /* @__PURE__ */ jsxs21("div", { children: [
7631
+ /* @__PURE__ */ jsx21("h3", { children: "Team notes" }),
7632
+ /* @__PURE__ */ jsx21("p", { children: "Shared with your workspace\u2019s billing team. Never sent to the payer." })
7064
7633
  ] }),
7065
- /* @__PURE__ */ jsx18("span", { children: billNotes.length })
7634
+ /* @__PURE__ */ jsx21("span", { children: billNotes.length })
7066
7635
  ] }),
7067
- billNotes.length ? /* @__PURE__ */ jsx18("ol", { children: billNotes.map((entry) => /* @__PURE__ */ jsxs18("li", { children: [
7068
- /* @__PURE__ */ jsx18("p", { children: entry.summary }),
7069
- /* @__PURE__ */ jsxs18("small", { children: [
7636
+ billNotes.length ? /* @__PURE__ */ jsx21("ol", { children: billNotes.map((entry) => /* @__PURE__ */ jsxs21("li", { children: [
7637
+ /* @__PURE__ */ jsx21("p", { children: entry.summary }),
7638
+ /* @__PURE__ */ jsxs21("small", { children: [
7070
7639
  entry.actor || "System",
7071
7640
  " \xB7 ",
7072
7641
  usDate(entry.date)
7073
7642
  ] })
7074
- ] }, entry.id)) }) : /* @__PURE__ */ jsx18("p", { className: "mb-lifecycle-notes-empty", children: "No notes yet." }),
7075
- /* @__PURE__ */ jsxs18("form", { onSubmit: (event) => {
7643
+ ] }, entry.id)) }) : /* @__PURE__ */ jsx21("p", { className: "mb-lifecycle-notes-empty", children: "No notes yet." }),
7644
+ /* @__PURE__ */ jsxs21("form", { onSubmit: (event) => {
7076
7645
  event.preventDefault();
7077
7646
  void addNote();
7078
7647
  }, children: [
7079
- /* @__PURE__ */ jsxs18("label", { children: [
7080
- /* @__PURE__ */ jsx18("span", { children: "Add a note" }),
7081
- /* @__PURE__ */ jsx18("textarea", { value: note, maxLength: 2e3, placeholder: "Add context for the billing team\u2026", onChange: (event) => setNote(event.target.value) })
7648
+ /* @__PURE__ */ jsxs21("label", { children: [
7649
+ /* @__PURE__ */ jsx21("span", { children: "Add a note" }),
7650
+ /* @__PURE__ */ jsx21("textarea", { value: note, maxLength: 2e3, placeholder: "Add context for the billing team\u2026", onChange: (event) => setNote(event.target.value) })
7082
7651
  ] }),
7083
- /* @__PURE__ */ jsx18("button", { type: "submit", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !note.trim(), children: lifecycle.isMutating ? "Adding\u2026" : "Add note" })
7652
+ /* @__PURE__ */ jsx21("button", { type: "submit", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !note.trim(), children: lifecycle.isMutating ? "Adding\u2026" : "Add note" })
7084
7653
  ] })
7085
7654
  ] }) : null
7086
- ] }) : /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx18(BillHistoryTable, { entries: data.history, ...!historical ? { onOpenDocument: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx18(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
7087
- !historical && (viewEor || actions.length) ? /* @__PURE__ */ jsxs18("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
7088
- viewEor && data.eors[0] ? /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
7089
- actions.map((action) => /* @__PURE__ */ jsx18("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
7655
+ ] }) : /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx21(BillHistoryTable, { entries: data.history, ...!historical ? { onOpenDocument: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx21(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
7656
+ !historical && (viewEor || actions.length) ? /* @__PURE__ */ jsxs21("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
7657
+ viewEor && data.eors[0] ? /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
7658
+ actions.map((action) => /* @__PURE__ */ jsx21("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
7090
7659
  const next = actionPanel(action);
7091
7660
  if (!next) return;
7092
7661
  if (next === "resubmit") setCorrectionError("");
@@ -7095,37 +7664,37 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7095
7664
  setPanel(next);
7096
7665
  }, children: action.label }, action.id))
7097
7666
  ] }) : null,
7098
- activePanel === "courtesy_copy" ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Forward courtesy copy", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsx18(BillCourtesyCopyForm, { documents: data.bill.attachments, recipientOptions: courtesyCopyRecipientOptions2, subject: `Courtesy copy \u2014 bill #${data.bill.billNumber}`, environment: data.environment, onPreview: lifecycle.previewCourtesyCopy, onSend: lifecycle.sendCourtesyCopy, onSent: () => {
7667
+ activePanel === "courtesy_copy" ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Forward courtesy copy", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsx21(BillCourtesyCopyForm, { documents: data.bill.attachments, recipientOptions: courtesyCopyRecipientOptions2, subject: `Courtesy copy \u2014 bill #${data.bill.billNumber}`, environment: data.environment, onPreview: lifecycle.previewCourtesyCopy, onSend: lifecycle.sendCourtesyCopy, onSent: () => {
7099
7668
  void lifecycle.refresh();
7100
7669
  }, ...appearance ? { appearance } : {} }) }) : null,
7101
- activePanel === "ibr" ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Prepare Independent Bill Review packet", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-panel", children: [
7102
- /* @__PURE__ */ jsx18("header", { style: { paddingRight: 44 }, children: /* @__PURE__ */ jsx18("h3", { children: "Prepare Independent Bill Review packet" }) }),
7103
- /* @__PURE__ */ jsx18("p", { children: "Download a PDF packet for self-filing Independent Bill Review (IBR). Preparing this packet does not file the review, send it to a payer, or change the bill status." }),
7104
- lifecycle.error ? /* @__PURE__ */ jsx18("p", { role: "alert", className: "mb-lifecycle-message error", children: lifecycle.error.message }) : null,
7105
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-panel-actions", children: [
7106
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel(""), children: "Cancel" }),
7107
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadIbrPacket().then(() => {
7670
+ activePanel === "ibr" ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Prepare Independent Bill Review packet", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-panel", children: [
7671
+ /* @__PURE__ */ jsx21("header", { style: { paddingRight: 44 }, children: /* @__PURE__ */ jsx21("h3", { children: "Prepare Independent Bill Review packet" }) }),
7672
+ /* @__PURE__ */ jsx21("p", { children: "Download a PDF packet for self-filing Independent Bill Review (IBR). Preparing this packet does not file the review, send it to a payer, or change the bill status." }),
7673
+ lifecycle.error ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "mb-lifecycle-message error", children: lifecycle.error.message }) : null,
7674
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-panel-actions", children: [
7675
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button secondary", disabled: lifecycle.isMutating, onClick: () => setPanel(""), children: "Cancel" }),
7676
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadIbrPacket().then(() => {
7108
7677
  setPanel("");
7109
7678
  setNotice("IBR packet prepared for self-filing. The review has not been filed.");
7110
7679
  }).catch(() => void 0), children: lifecycle.isMutating ? "Preparing\u2026" : "Prepare IBR packet" })
7111
7680
  ] })
7112
7681
  ] }) }) : null,
7113
- activePanel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-correction", children: [
7114
- /* @__PURE__ */ jsx18("header", { children: /* @__PURE__ */ jsxs18("div", { children: [
7115
- /* @__PURE__ */ jsx18("h3", { children: "Correct and resubmit" }),
7116
- /* @__PURE__ */ jsx18("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
7682
+ activePanel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-correction", children: [
7683
+ /* @__PURE__ */ jsx21("header", { children: /* @__PURE__ */ jsxs21("div", { children: [
7684
+ /* @__PURE__ */ jsx21("h3", { children: "Correct and resubmit" }),
7685
+ /* @__PURE__ */ jsx21("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
7117
7686
  ] }) }),
7118
- data.environment === "live" ? /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-live-warning", children: [
7119
- /* @__PURE__ */ jsx18("strong", { children: "Live clearinghouse submission" }),
7120
- /* @__PURE__ */ jsx18("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
7687
+ data.environment === "live" ? /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-live-warning", children: [
7688
+ /* @__PURE__ */ jsx21("strong", { children: "Live clearinghouse submission" }),
7689
+ /* @__PURE__ */ jsx21("span", { children: "Resubmitting sends a real bill. Confirm the corrected information before continuing." })
7121
7690
  ] }) : null,
7122
- data.rejection ? /* @__PURE__ */ jsx18(CorrectionRejectionReason, { rejection: data.rejection }) : null,
7123
- /* @__PURE__ */ jsx18(CorrectionVerificationContact, { delivery: data.delivery }),
7124
- /* @__PURE__ */ jsxs18("label", { className: "mb-lifecycle-correction-note", children: [
7125
- /* @__PURE__ */ jsx18("span", { children: "Correction note (optional)" }),
7126
- /* @__PURE__ */ jsx18("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
7691
+ data.rejection ? /* @__PURE__ */ jsx21(CorrectionRejectionReason, { rejection: data.rejection }) : null,
7692
+ /* @__PURE__ */ jsx21(CorrectionVerificationContact, { delivery: data.delivery }),
7693
+ /* @__PURE__ */ jsxs21("label", { className: "mb-lifecycle-correction-note", children: [
7694
+ /* @__PURE__ */ jsx21("span", { children: "Correction note (optional)" }),
7695
+ /* @__PURE__ */ jsx21("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
7127
7696
  ] }),
7128
- /* @__PURE__ */ jsx18(
7697
+ /* @__PURE__ */ jsx21(
7129
7698
  BillSubmissionForm,
7130
7699
  {
7131
7700
  className: "mbsf-lifecycle-correction",
@@ -7151,18 +7720,18 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7151
7720
  ...appearance ? { appearance } : {}
7152
7721
  }
7153
7722
  ),
7154
- correctionError ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
7723
+ correctionError ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
7155
7724
  ] }) }) : null,
7156
- activePanel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-correction", children: [
7157
- /* @__PURE__ */ jsx18("header", { children: /* @__PURE__ */ jsxs18("div", { children: [
7158
- /* @__PURE__ */ jsx18("h3", { children: "Submit New Bill" }),
7159
- /* @__PURE__ */ jsx18("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." })
7725
+ activePanel === "submit_new_bill" && correctionInitialBill ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Submit New Bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-correction", children: [
7726
+ /* @__PURE__ */ jsx21("header", { children: /* @__PURE__ */ jsxs21("div", { children: [
7727
+ /* @__PURE__ */ jsx21("h3", { children: "Submit New Bill" }),
7728
+ /* @__PURE__ */ jsx21("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." })
7160
7729
  ] }) }),
7161
- /* @__PURE__ */ jsxs18("label", { className: "mb-lifecycle-correction-note", children: [
7162
- /* @__PURE__ */ jsx18("span", { children: "Submission note (optional)" }),
7163
- /* @__PURE__ */ jsx18("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
7730
+ /* @__PURE__ */ jsxs21("label", { className: "mb-lifecycle-correction-note", children: [
7731
+ /* @__PURE__ */ jsx21("span", { children: "Submission note (optional)" }),
7732
+ /* @__PURE__ */ jsx21("textarea", { value: reason, placeholder: "Why is a new bill being submitted?", onChange: (event) => setReason(event.target.value) })
7164
7733
  ] }),
7165
- /* @__PURE__ */ jsx18(
7734
+ /* @__PURE__ */ jsx21(
7166
7735
  BillSubmissionForm,
7167
7736
  {
7168
7737
  className: "mbsf-lifecycle-correction",
@@ -7187,10 +7756,10 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7187
7756
  ...appearance ? { appearance } : {}
7188
7757
  }
7189
7758
  ),
7190
- newBillError ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
7759
+ newBillError ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-message error", role: "alert", children: newBillError }) : null
7191
7760
  ] }) }) : null,
7192
- activePanel === "second_review" ? /* @__PURE__ */ jsxs18(LifecycleDialog, { title: "Submit Second Review", wide: true, onClose: () => setPanel(""), children: [
7193
- /* @__PURE__ */ jsx18(
7761
+ activePanel === "second_review" ? /* @__PURE__ */ jsxs21(LifecycleDialog, { title: "Submit Second Review", wide: true, onClose: () => setPanel(""), children: [
7762
+ /* @__PURE__ */ jsx21(
7194
7763
  SecondReviewForm,
7195
7764
  {
7196
7765
  data,
@@ -7203,86 +7772,86 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7203
7772
  onSubmit: (input) => complete("Second Review submitted.", () => lifecycle.submitSecondReview({ ...input, ...actor }))
7204
7773
  }
7205
7774
  ),
7206
- reviewDeadline ? /* @__PURE__ */ jsxs18("p", { className: "mb-lifecycle-deadline-hint", children: [
7775
+ reviewDeadline ? /* @__PURE__ */ jsxs21("p", { className: "mb-lifecycle-deadline-hint", children: [
7207
7776
  "Second Review must be requested within 90 days of the denial EOR (dated ",
7208
7777
  usDate(reviewDeadline.eorDate),
7209
7778
  ") \u2014 file by ",
7210
- /* @__PURE__ */ jsx18("strong", { children: usDate(reviewDeadline.deadline) }),
7779
+ /* @__PURE__ */ jsx21("strong", { children: usDate(reviewDeadline.deadline) }),
7211
7780
  "."
7212
7781
  ] }) : null
7213
7782
  ] }) : null,
7214
- activePanel === "payment" ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-panel", children: [
7215
- /* @__PURE__ */ jsxs18("div", { children: [
7216
- /* @__PURE__ */ jsx18("h3", { children: "Post payment" }),
7217
- /* @__PURE__ */ jsx18("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
7783
+ activePanel === "payment" ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-panel", children: [
7784
+ /* @__PURE__ */ jsxs21("div", { children: [
7785
+ /* @__PURE__ */ jsx21("h3", { children: "Post payment" }),
7786
+ /* @__PURE__ */ jsx21("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
7218
7787
  ] }),
7219
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-fields two", children: [
7220
- /* @__PURE__ */ jsxs18("label", { children: [
7221
- /* @__PURE__ */ jsx18("span", { children: "Amount applied to bill" }),
7222
- /* @__PURE__ */ jsx18("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) })) })
7788
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-fields two", children: [
7789
+ /* @__PURE__ */ jsxs21("label", { children: [
7790
+ /* @__PURE__ */ jsx21("span", { children: "Amount applied to bill" }),
7791
+ /* @__PURE__ */ jsx21("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) })) })
7223
7792
  ] }),
7224
- /* @__PURE__ */ jsxs18("label", { children: [
7225
- /* @__PURE__ */ jsx18("span", { children: "Penalty" }),
7226
- /* @__PURE__ */ jsx18("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
7793
+ /* @__PURE__ */ jsxs21("label", { children: [
7794
+ /* @__PURE__ */ jsx21("span", { children: "Penalty" }),
7795
+ /* @__PURE__ */ jsx21("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
7227
7796
  ] }),
7228
- /* @__PURE__ */ jsxs18("label", { children: [
7229
- /* @__PURE__ */ jsx18("span", { children: "Interest" }),
7230
- /* @__PURE__ */ jsx18("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
7797
+ /* @__PURE__ */ jsxs21("label", { children: [
7798
+ /* @__PURE__ */ jsx21("span", { children: "Interest" }),
7799
+ /* @__PURE__ */ jsx21("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
7231
7800
  ] }),
7232
- /* @__PURE__ */ jsxs18("label", { children: [
7233
- /* @__PURE__ */ jsx18("span", { children: "Method" }),
7234
- /* @__PURE__ */ jsxs18("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
7235
- /* @__PURE__ */ jsx18("option", { value: "check", children: "Check" }),
7236
- /* @__PURE__ */ jsx18("option", { value: "eft", children: "EFT" })
7801
+ /* @__PURE__ */ jsxs21("label", { children: [
7802
+ /* @__PURE__ */ jsx21("span", { children: "Method" }),
7803
+ /* @__PURE__ */ jsxs21("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
7804
+ /* @__PURE__ */ jsx21("option", { value: "check", children: "Check" }),
7805
+ /* @__PURE__ */ jsx21("option", { value: "eft", children: "EFT" })
7237
7806
  ] })
7238
7807
  ] }),
7239
- /* @__PURE__ */ jsxs18("label", { children: [
7240
- /* @__PURE__ */ jsx18("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
7241
- /* @__PURE__ */ jsx18("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
7808
+ /* @__PURE__ */ jsxs21("label", { children: [
7809
+ /* @__PURE__ */ jsx21("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
7810
+ /* @__PURE__ */ jsx21("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
7242
7811
  ] }),
7243
- /* @__PURE__ */ jsxs18("label", { children: [
7244
- /* @__PURE__ */ jsx18("span", { children: "Deposit date" }),
7245
- /* @__PURE__ */ jsx18("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
7812
+ /* @__PURE__ */ jsxs21("label", { children: [
7813
+ /* @__PURE__ */ jsx21("span", { children: "Deposit date" }),
7814
+ /* @__PURE__ */ jsx21("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
7246
7815
  ] }),
7247
- /* @__PURE__ */ jsxs18("label", { className: "full", children: [
7248
- /* @__PURE__ */ jsx18("span", { children: "Note (optional)" }),
7249
- /* @__PURE__ */ jsx18("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
7816
+ /* @__PURE__ */ jsxs21("label", { className: "full", children: [
7817
+ /* @__PURE__ */ jsx21("span", { children: "Note (optional)" }),
7818
+ /* @__PURE__ */ jsx21("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
7250
7819
  ] })
7251
7820
  ] }),
7252
- /* @__PURE__ */ jsxs18("div", { className: "mb-payment-total", children: [
7253
- /* @__PURE__ */ jsx18("span", { children: "Total received" }),
7254
- /* @__PURE__ */ jsx18("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
7821
+ /* @__PURE__ */ jsxs21("div", { className: "mb-payment-total", children: [
7822
+ /* @__PURE__ */ jsx21("span", { children: "Total received" }),
7823
+ /* @__PURE__ */ jsx21("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
7255
7824
  ] }),
7256
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-panel-actions", children: [
7257
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7258
- /* @__PURE__ */ jsx18("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" })
7825
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-panel-actions", children: [
7826
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7827
+ /* @__PURE__ */ jsx21("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" })
7259
7828
  ] })
7260
7829
  ] }) }) : null,
7261
- activePanel === "close" || activePanel === "reopen" ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: activePanel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-panel", children: [
7262
- /* @__PURE__ */ jsxs18("div", { children: [
7263
- /* @__PURE__ */ jsx18("h3", { children: activePanel === "close" ? "Close bill" : "Reopen bill" }),
7264
- /* @__PURE__ */ jsx18("p", { children: activePanel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
7830
+ activePanel === "close" || activePanel === "reopen" ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: activePanel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-panel", children: [
7831
+ /* @__PURE__ */ jsxs21("div", { children: [
7832
+ /* @__PURE__ */ jsx21("h3", { children: activePanel === "close" ? "Close bill" : "Reopen bill" }),
7833
+ /* @__PURE__ */ jsx21("p", { children: activePanel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
7265
7834
  ] }),
7266
- /* @__PURE__ */ jsxs18("label", { children: [
7267
- /* @__PURE__ */ jsx18("span", { children: "Reason" }),
7268
- /* @__PURE__ */ jsx18("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
7835
+ /* @__PURE__ */ jsxs21("label", { children: [
7836
+ /* @__PURE__ */ jsx21("span", { children: "Reason" }),
7837
+ /* @__PURE__ */ jsx21("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
7269
7838
  ] }),
7270
- /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-panel-actions", children: [
7271
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7272
- /* @__PURE__ */ jsx18("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(activePanel === "close" ? "Bill closed." : "Bill reopened.", () => activePanel === "close" ? lifecycle.closeBill({ reason, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : activePanel === "close" ? "Close bill" : "Reopen bill" })
7839
+ /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-panel-actions", children: [
7840
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
7841
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(activePanel === "close" ? "Bill closed." : "Bill reopened.", () => activePanel === "close" ? lifecycle.closeBill({ reason, ...actor }) : lifecycle.reopenBill({ reason, ...actor })), children: lifecycle.isMutating ? "Saving\u2026" : activePanel === "close" ? "Close bill" : "Reopen bill" })
7273
7842
  ] })
7274
7843
  ] }) }) : null,
7275
- activePanel === "send_duplicate" && correctionInitialBill ? /* @__PURE__ */ jsx18(LifecycleDialog, { title: "Send duplicate bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs18("section", { className: "mb-lifecycle-correction", children: [
7276
- /* @__PURE__ */ jsx18("header", { children: /* @__PURE__ */ jsxs18("div", { children: [
7277
- /* @__PURE__ */ jsx18("h3", { children: "Send duplicate bill" }),
7278
- /* @__PURE__ */ jsx18("p", { children: "Review and edit any bill field before creating a duplicate submission. The original bill and its history stay unchanged." })
7844
+ activePanel === "send_duplicate" && correctionInitialBill ? /* @__PURE__ */ jsx21(LifecycleDialog, { title: "Send duplicate bill", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-correction", children: [
7845
+ /* @__PURE__ */ jsx21("header", { children: /* @__PURE__ */ jsxs21("div", { children: [
7846
+ /* @__PURE__ */ jsx21("h3", { children: "Send duplicate bill" }),
7847
+ /* @__PURE__ */ jsx21("p", { children: "Review and edit any bill field before creating a duplicate submission. The original bill and its history stay unchanged." })
7279
7848
  ] }) }),
7280
- data.environment === "live" ? /* @__PURE__ */ jsxs18("div", { className: "mb-lifecycle-live-warning", children: [
7281
- /* @__PURE__ */ jsx18("strong", { children: "Live clearinghouse submission" }),
7282
- /* @__PURE__ */ jsx18("span", { children: "The duplicate will be sent only after you confirm its delivery route in the next dialog." })
7849
+ data.environment === "live" ? /* @__PURE__ */ jsxs21("div", { className: "mb-lifecycle-live-warning", children: [
7850
+ /* @__PURE__ */ jsx21("strong", { children: "Live clearinghouse submission" }),
7851
+ /* @__PURE__ */ jsx21("span", { children: "The duplicate will be sent only after you confirm its delivery route in the next dialog." })
7283
7852
  ] }) : null,
7284
- /* @__PURE__ */ jsx18(CorrectionVerificationContact, { delivery: data.delivery }),
7285
- /* @__PURE__ */ jsx18(
7853
+ /* @__PURE__ */ jsx21(CorrectionVerificationContact, { delivery: data.delivery }),
7854
+ /* @__PURE__ */ jsx21(
7286
7855
  BillSubmissionForm,
7287
7856
  {
7288
7857
  className: "mbsf-lifecycle-correction",
@@ -7307,15 +7876,15 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7307
7876
  ...appearance ? { appearance } : {}
7308
7877
  }
7309
7878
  ),
7310
- duplicateError ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-message error", role: "alert", children: duplicateError }) : null
7879
+ duplicateError ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-message error", role: "alert", children: duplicateError }) : null
7311
7880
  ] }) }) : null,
7312
- activePanel === "report_status" ? /* @__PURE__ */ jsx18(
7881
+ activePanel === "report_status" ? /* @__PURE__ */ jsx21(
7313
7882
  ReportBillStatusDialog,
7314
7883
  {
7315
7884
  ...data.delivery.directory ? { directory: data.delivery.directory } : {},
7316
7885
  ...statusContacts.claimsAdmin ? { claimsAdmin: statusContacts.claimsAdmin } : {},
7317
7886
  ...statusContacts.billReview ? { billReview: statusContacts.billReview } : {},
7318
- ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx18(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
7887
+ ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx21(BillHistoryTable, { entries: receiptEntries, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) } : {},
7319
7888
  submitting: lifecycle.isMutating,
7320
7889
  error: lifecycle.error?.message ?? null,
7321
7890
  onCancel: () => setPanel(""),
@@ -7323,8 +7892,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7323
7892
  ...appearance ? { appearance } : {}
7324
7893
  }
7325
7894
  ) : null,
7326
- notice ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
7327
- lifecycle.error ? /* @__PURE__ */ jsx18("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
7895
+ notice ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
7896
+ lifecycle.error ? /* @__PURE__ */ jsx21("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
7328
7897
  ] });
7329
7898
  }
7330
7899
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -7342,150 +7911,14 @@ var CONNECTED_LIFECYCLE_STYLES = `
7342
7911
  // src/connected-billing-workspace.tsx
7343
7912
  import {
7344
7913
  useCallback as useCallback5,
7345
- useEffect as useEffect13,
7914
+ useEffect as useEffect15,
7346
7915
  useLayoutEffect,
7347
- useMemo as useMemo10,
7348
- useRef as useRef9,
7349
- useState as useState15
7916
+ useMemo as useMemo11,
7917
+ useRef as useRef10,
7918
+ useState as useState18
7350
7919
  } from "react";
7351
-
7352
- // src/billing-operations-client.ts
7353
- import {
7354
- DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL3,
7355
- DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT3
7356
- } from "@mindbill/browser";
7357
- async function responseError2(response, fallback) {
7358
- const body = await response.json().catch(() => null);
7359
- const detail = body && typeof body === "object" ? body.detail ?? body.error : null;
7360
- return new Error(typeof detail === "string" ? detail : fallback);
7361
- }
7362
- function normalizeSession2(value) {
7363
- if (!value || typeof value !== "object") throw new Error("The MindBill session endpoint returned an invalid response.");
7364
- const candidate = value;
7365
- const nested = candidate.session ?? candidate.data;
7366
- const session = nested && typeof nested === "object" ? nested : candidate;
7367
- if (typeof session.token !== "string" || session.token.length < 8) {
7368
- throw new Error("The MindBill session endpoint did not return a browser session token.");
7369
- }
7370
- return {
7371
- token: session.token,
7372
- ...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
7373
- ...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
7374
- };
7375
- }
7376
- function isFresh(session) {
7377
- if (!session) return false;
7378
- if (!session.expiresAt) return true;
7379
- const expiresAt = Date.parse(session.expiresAt);
7380
- return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
7381
- }
7382
- function queryString(values) {
7383
- const params = new URLSearchParams();
7384
- for (const [key, value] of Object.entries(values)) {
7385
- if (value !== void 0 && value !== "") params.set(key, String(value));
7386
- }
7387
- const text = params.toString();
7388
- return text ? `?${text}` : "";
7389
- }
7390
- function createBillingOperationsClient({
7391
- sessionEndpoint = DEFAULT_SESSION_ENDPOINT3,
7392
- getSession,
7393
- apiBaseUrl = DEFAULT_API_BASE_URL3,
7394
- fetch: fetchOverride
7395
- } = {}) {
7396
- const fetcher = fetchOverride ?? globalThis.fetch;
7397
- if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
7398
- let session = null;
7399
- let pendingSession = null;
7400
- let pendingSessionSignal = null;
7401
- const mintSession = async (signal, force = false) => {
7402
- if (!force && isFresh(session)) return session;
7403
- if (!force && pendingSession && !pendingSessionSignal?.aborted) return pendingSession;
7404
- const pending = getSession ? getSession({ signal }) : fetcher(sessionEndpoint, {
7405
- method: "POST",
7406
- credentials: "same-origin",
7407
- headers: { "content-type": "application/json" },
7408
- body: JSON.stringify({}),
7409
- signal
7410
- }).then(async (response) => {
7411
- if (!response.ok) throw await responseError2(response, "MindBill browser session could not be created.");
7412
- return response.json();
7413
- });
7414
- const request = Promise.resolve(pending).then(normalizeSession2).then((next) => {
7415
- session = next;
7416
- return next;
7417
- }).finally(() => {
7418
- if (pendingSession === request) {
7419
- pendingSession = null;
7420
- pendingSessionSignal = null;
7421
- }
7422
- });
7423
- pendingSession = request;
7424
- pendingSessionSignal = signal;
7425
- return request;
7426
- };
7427
- const get = async (path, signal) => {
7428
- const controller = signal ? null : new AbortController();
7429
- const requestSignal = signal ?? controller?.signal;
7430
- if (!requestSignal) throw new Error("An AbortSignal could not be created.");
7431
- let browserSession = await mintSession(requestSignal);
7432
- const request = (active) => {
7433
- const base = (active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
7434
- return fetcher(`${base}${path}`, {
7435
- headers: { authorization: `Bearer ${active.token}` },
7436
- signal: requestSignal
7437
- });
7438
- };
7439
- let response = await request(browserSession);
7440
- if (response.status === 401) {
7441
- session = null;
7442
- browserSession = await mintSession(requestSignal, true);
7443
- response = await request(browserSession);
7444
- }
7445
- if (!response.ok) throw await responseError2(response, "MindBill data could not be loaded.");
7446
- const body = await response.json();
7447
- return body.data ?? body;
7448
- };
7449
- return {
7450
- clearSession() {
7451
- session = null;
7452
- pendingSession = null;
7453
- pendingSessionSignal = null;
7454
- },
7455
- getBills(query = {}, signal) {
7456
- const { claimsAdministrator, taskType, taskSection: _taskSection, sort, status, ...filters } = query;
7457
- void _taskSection;
7458
- const sortKey = sort?.startsWith("balance_") ? "balanceDue" : sort?.startsWith("patient_") ? "patient" : sort ? "submitted" : void 0;
7459
- return get(`/partner/v2/bill-dashboard${queryString({
7460
- ...filters,
7461
- status: status === "submitted" ? "sent" : status,
7462
- claimsAdminId: claimsAdministrator,
7463
- taskKind: taskType,
7464
- sort: sortKey,
7465
- dir: sort ? sort.endsWith("_asc") ? "asc" : "desc" : void 0
7466
- })}`, signal);
7467
- },
7468
- getBillTasks(claimsAdministrator, signal, renderingProviderId) {
7469
- return get(
7470
- `/partner/v2/bill-tasks${queryString({ claimsAdminId: claimsAdministrator, renderingProviderId })}`,
7471
- signal
7472
- );
7473
- },
7474
- getServiceLineItems(range, signal) {
7475
- return get(
7476
- `/partner/v2/reports/service-line-items${queryString(range)}`,
7477
- signal
7478
- );
7479
- },
7480
- getProductivity(range, signal) {
7481
- return get(`/partner/v2/reports/productivity${queryString(range)}`, signal);
7482
- }
7483
- };
7484
- }
7485
-
7486
- // src/connected-billing-workspace.tsx
7487
- import { Fragment as Fragment16, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
7488
- var css12 = `
7920
+ import { Fragment as Fragment16, jsx as jsx22, jsxs as jsxs22 } from "react/jsx-runtime";
7921
+ var css14 = `
7489
7922
  .mbow-select{max-width:100%}
7490
7923
  .mbow{color:var(--mb-text);font:14px/1.45 var(--mb-font);background:var(--mb-soft);border-radius:var(--mb-radius);padding:20px}.mbow,.mbow *{box-sizing:border-box}.mbow h2,.mbow h3,.mbow p{margin:0}.mbow a{color:var(--mb-accent)}
7491
7924
  .mbow-workspace{width:100%;height:100%;max-height:var(--mbow-available-height,100dvh);min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
@@ -7498,15 +7931,15 @@ var css12 = `
7498
7931
  .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}
7499
7932
  @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%}}
7500
7933
  `;
7501
- function money6(value) {
7934
+ function money7(value) {
7502
7935
  return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
7503
7936
  }
7504
7937
  function RenderingProviderFilter({ value, options, onChange }) {
7505
7938
  if (!options && !value) return null;
7506
- return /* @__PURE__ */ jsxs19("select", { className: "mbow-select", "aria-label": "Rendering provider filter", value, onChange: (event) => onChange(event.target.value), children: [
7507
- /* @__PURE__ */ jsx19("option", { value: "", children: "All rendering providers" }),
7508
- value && !options?.some((option) => option.id === value) ? /* @__PURE__ */ jsx19("option", { value, children: "Selected rendering provider" }) : null,
7509
- options?.map((option) => /* @__PURE__ */ jsx19("option", { value: option.id, children: option.name }, option.id))
7939
+ return /* @__PURE__ */ jsxs22("select", { className: "mbow-select", "aria-label": "Rendering provider filter", value, onChange: (event) => onChange(event.target.value), children: [
7940
+ /* @__PURE__ */ jsx22("option", { value: "", children: "All rendering providers" }),
7941
+ value && !options?.some((option) => option.id === value) ? /* @__PURE__ */ jsx22("option", { value, children: "Selected rendering provider" }) : null,
7942
+ options?.map((option) => /* @__PURE__ */ jsx22("option", { value: option.id, children: option.name }, option.id))
7510
7943
  ] });
7511
7944
  }
7512
7945
  function shortDate(value) {
@@ -7522,14 +7955,14 @@ function defaultRange(days = 29) {
7522
7955
  return { from: iso(from), to: iso(to) };
7523
7956
  }
7524
7957
  function Surface({ appearance, className = "", style, children, surfaceRef }) {
7525
- return /* @__PURE__ */ jsxs19("div", { ref: surfaceRef, className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
7526
- /* @__PURE__ */ jsx19("style", { children: css12 }),
7958
+ return /* @__PURE__ */ jsxs22("div", { ref: surfaceRef, className: `mbow ${className}`.trim(), style: mindBillAppearanceStyle(appearance, style), children: [
7959
+ /* @__PURE__ */ jsx22("style", { children: css14 }),
7527
7960
  children
7528
7961
  ] });
7529
7962
  }
7530
7963
  function useAvailableViewportHeight() {
7531
- const workspaceRef = useRef9(null);
7532
- const [availableHeight, setAvailableHeight] = useState15(null);
7964
+ const workspaceRef = useRef10(null);
7965
+ const [availableHeight, setAvailableHeight] = useState18(null);
7533
7966
  useLayoutEffect(() => {
7534
7967
  const element = workspaceRef.current;
7535
7968
  if (!element || typeof window === "undefined") return;
@@ -7556,7 +7989,7 @@ function useAvailableViewportHeight() {
7556
7989
  return { workspaceRef, availableHeight };
7557
7990
  }
7558
7991
  function useClient(options) {
7559
- return useMemo10(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
7992
+ return useMemo11(() => createBillingOperationsClient(options), [options.apiBaseUrl, options.fetch, options.getSession, options.sessionEndpoint]);
7560
7993
  }
7561
7994
  function BillSearchContent({
7562
7995
  client,
@@ -7564,11 +7997,11 @@ function BillSearchContent({
7564
7997
  onSelectBill,
7565
7998
  heading
7566
7999
  }) {
7567
- const [query, setQuery] = useState15({ age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery, status: initialQuery?.status === "submitted" ? "sent" : initialQuery?.status ?? "all" });
7568
- const [draft, setDraft] = useState15(initialQuery?.q ?? "");
7569
- const [result, setResult] = useState15(null);
7570
- const [error, setError] = useState15(null);
7571
- const [loading, setLoading] = useState15(true);
8000
+ const [query, setQuery] = useState18({ age: "all", page: 1, pageSize: 25, sort: "submitted_desc", ...initialQuery, status: initialQuery?.status === "submitted" ? "sent" : initialQuery?.status ?? "all" });
8001
+ const [draft, setDraft] = useState18(initialQuery?.q ?? "");
8002
+ const [result, setResult] = useState18(null);
8003
+ const [error, setError] = useState18(null);
8004
+ const [loading, setLoading] = useState18(true);
7572
8005
  const load = useCallback5(async (signal) => {
7573
8006
  setLoading(true);
7574
8007
  setError(null);
@@ -7580,78 +8013,78 @@ function BillSearchContent({
7580
8013
  if (!signal?.aborted) setLoading(false);
7581
8014
  }
7582
8015
  }, [client, query]);
7583
- useEffect13(() => {
8016
+ useEffect15(() => {
7584
8017
  const controller = new AbortController();
7585
8018
  void load(controller.signal);
7586
8019
  return () => controller.abort();
7587
8020
  }, [load]);
7588
8021
  const update = (next) => setQuery((current) => ({ ...current, ...next, page: next.page ?? 1 }));
7589
8022
  const pageCount = Math.max(1, Math.ceil((result?.total ?? 0) / (result?.pageSize ?? 25)));
7590
- return /* @__PURE__ */ jsxs19(Fragment16, { children: [
7591
- heading ? /* @__PURE__ */ jsx19("div", { className: "mbow-head", children: /* @__PURE__ */ jsx19("div", { children: typeof heading === "string" ? /* @__PURE__ */ jsx19("h2", { children: heading }) : heading }) }) : null,
7592
- /* @__PURE__ */ jsxs19("form", { className: "mbow-toolbar", onSubmit: (event) => {
8023
+ return /* @__PURE__ */ jsxs22(Fragment16, { children: [
8024
+ heading ? /* @__PURE__ */ jsx22("div", { className: "mbow-head", children: /* @__PURE__ */ jsx22("div", { children: typeof heading === "string" ? /* @__PURE__ */ jsx22("h2", { children: heading }) : heading }) }) : null,
8025
+ /* @__PURE__ */ jsxs22("form", { className: "mbow-toolbar", onSubmit: (event) => {
7593
8026
  event.preventDefault();
7594
8027
  update({ q: draft.trim() });
7595
8028
  }, children: [
7596
- /* @__PURE__ */ jsx19("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" }),
7597
- /* @__PURE__ */ jsxs19("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
7598
- /* @__PURE__ */ jsx19("option", { value: "all", children: "All statuses" }),
7599
- /* @__PURE__ */ jsx19("option", { value: "incomplete", children: "Incomplete" }),
7600
- /* @__PURE__ */ jsx19("option", { value: "sent", children: "Sent" }),
7601
- /* @__PURE__ */ jsx19("option", { value: "accepted", children: "Accepted" }),
7602
- /* @__PURE__ */ jsx19("option", { value: "accepted_no_response", children: "Accepted \u2014 response overdue" }),
7603
- /* @__PURE__ */ jsx19("option", { value: "rejected", children: "Rejected" }),
7604
- /* @__PURE__ */ jsx19("option", { value: "processed", children: "Processed" }),
7605
- /* @__PURE__ */ jsx19("option", { value: "paid", children: "Paid" }),
7606
- /* @__PURE__ */ jsx19("option", { value: "closed", children: "Closed" })
8029
+ /* @__PURE__ */ jsx22("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" }),
8030
+ /* @__PURE__ */ jsxs22("select", { className: "mbow-select", value: query.status ?? "all", onChange: (event) => update({ status: event.target.value }), "aria-label": "Bill status", children: [
8031
+ /* @__PURE__ */ jsx22("option", { value: "all", children: "All statuses" }),
8032
+ /* @__PURE__ */ jsx22("option", { value: "incomplete", children: "Incomplete" }),
8033
+ /* @__PURE__ */ jsx22("option", { value: "sent", children: "Sent" }),
8034
+ /* @__PURE__ */ jsx22("option", { value: "accepted", children: "Accepted" }),
8035
+ /* @__PURE__ */ jsx22("option", { value: "accepted_no_response", children: "Accepted \u2014 response overdue" }),
8036
+ /* @__PURE__ */ jsx22("option", { value: "rejected", children: "Rejected" }),
8037
+ /* @__PURE__ */ jsx22("option", { value: "processed", children: "Processed" }),
8038
+ /* @__PURE__ */ jsx22("option", { value: "paid", children: "Paid" }),
8039
+ /* @__PURE__ */ jsx22("option", { value: "closed", children: "Closed" })
7607
8040
  ] }),
7608
- /* @__PURE__ */ jsxs19("select", { className: "mbow-select", value: query.age ?? "all", onChange: (event) => update({ age: event.target.value }), "aria-label": "A/R age", children: [
7609
- /* @__PURE__ */ jsx19("option", { value: "all", children: "All A/R ages" }),
7610
- /* @__PURE__ */ jsx19("option", { value: "0-30", children: "0\u201330 days" }),
7611
- /* @__PURE__ */ jsx19("option", { value: "31-60", children: "31\u201360 days" }),
7612
- /* @__PURE__ */ jsx19("option", { value: "61-90", children: "61\u201390 days" }),
7613
- /* @__PURE__ */ jsx19("option", { value: "91+", children: "91+ days" }),
7614
- /* @__PURE__ */ jsx19("option", { value: "91-180", children: "91\u2013180 days" }),
7615
- /* @__PURE__ */ jsx19("option", { value: "181+", children: "181+ days" })
8041
+ /* @__PURE__ */ jsxs22("select", { className: "mbow-select", value: query.age ?? "all", onChange: (event) => update({ age: event.target.value }), "aria-label": "A/R age", children: [
8042
+ /* @__PURE__ */ jsx22("option", { value: "all", children: "All A/R ages" }),
8043
+ /* @__PURE__ */ jsx22("option", { value: "0-30", children: "0\u201330 days" }),
8044
+ /* @__PURE__ */ jsx22("option", { value: "31-60", children: "31\u201360 days" }),
8045
+ /* @__PURE__ */ jsx22("option", { value: "61-90", children: "61\u201390 days" }),
8046
+ /* @__PURE__ */ jsx22("option", { value: "91+", children: "91+ days" }),
8047
+ /* @__PURE__ */ jsx22("option", { value: "91-180", children: "91\u2013180 days" }),
8048
+ /* @__PURE__ */ jsx22("option", { value: "181+", children: "181+ days" })
7616
8049
  ] }),
7617
- /* @__PURE__ */ jsx19("button", { className: "mbow-button", type: "submit", children: "Search" }),
7618
- /* @__PURE__ */ jsx19(RenderingProviderFilter, { value: query.renderingProviderId ?? "", options: result?.filters?.renderingProviders, onChange: (value) => update({ renderingProviderId: value }) })
8050
+ /* @__PURE__ */ jsx22("button", { className: "mbow-button", type: "submit", children: "Search" }),
8051
+ /* @__PURE__ */ jsx22(RenderingProviderFilter, { value: query.renderingProviderId ?? "", options: result?.filters?.renderingProviders, onChange: (value) => update({ renderingProviderId: value }) })
7619
8052
  ] }),
7620
- /* @__PURE__ */ jsxs19("div", { className: "mbow-card mbow-scroll", children: [
7621
- loading ? /* @__PURE__ */ jsx19("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error ? /* @__PURE__ */ jsxs19("div", { className: "mbow-state mbow-error", role: "alert", children: [
8053
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-card mbow-scroll", children: [
8054
+ loading ? /* @__PURE__ */ jsx22("div", { className: "mbow-state", role: "status", children: "Loading bills\u2026" }) : error ? /* @__PURE__ */ jsxs22("div", { className: "mbow-state mbow-error", role: "alert", children: [
7622
8055
  error.message,
7623
8056
  " ",
7624
- /* @__PURE__ */ jsx19("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
7625
- ] }) : result?.items.length === 0 ? /* @__PURE__ */ jsx19("div", { className: "mbow-state", children: "No bills match these filters." }) : /* @__PURE__ */ jsxs19("table", { className: "mbow-table", children: [
7626
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
7627
- /* @__PURE__ */ jsx19("th", { children: "Bill" }),
7628
- /* @__PURE__ */ jsx19("th", { children: "Patient" }),
7629
- /* @__PURE__ */ jsx19("th", { children: "DOS" }),
7630
- /* @__PURE__ */ jsx19("th", { children: "Codes" }),
7631
- /* @__PURE__ */ jsx19("th", { children: "Claims administrator" }),
7632
- /* @__PURE__ */ jsx19("th", { children: "Status" }),
7633
- /* @__PURE__ */ jsx19("th", { children: "Submitted / A/R age" }),
7634
- /* @__PURE__ */ jsx19("th", { className: "mbow-money", children: "Balance due" })
8057
+ /* @__PURE__ */ jsx22("button", { className: "mbow-button", type: "button", onClick: () => void load(), children: "Retry" })
8058
+ ] }) : result?.items.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "mbow-state", children: "No bills match these filters." }) : /* @__PURE__ */ jsxs22("table", { className: "mbow-table", children: [
8059
+ /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs22("tr", { children: [
8060
+ /* @__PURE__ */ jsx22("th", { children: "Bill" }),
8061
+ /* @__PURE__ */ jsx22("th", { children: "Patient" }),
8062
+ /* @__PURE__ */ jsx22("th", { children: "DOS" }),
8063
+ /* @__PURE__ */ jsx22("th", { children: "Codes" }),
8064
+ /* @__PURE__ */ jsx22("th", { children: "Claims administrator" }),
8065
+ /* @__PURE__ */ jsx22("th", { children: "Status" }),
8066
+ /* @__PURE__ */ jsx22("th", { children: "Submitted / A/R age" }),
8067
+ /* @__PURE__ */ jsx22("th", { className: "mbow-money", children: "Balance due" })
7635
8068
  ] }) }),
7636
- /* @__PURE__ */ jsx19("tbody", { children: result?.items.map((bill) => /* @__PURE__ */ jsxs19("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(bill), children: [
7637
- /* @__PURE__ */ jsxs19("td", { className: "mbow-strong", children: [
8069
+ /* @__PURE__ */ jsx22("tbody", { children: result?.items.map((bill) => /* @__PURE__ */ jsxs22("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(bill), children: [
8070
+ /* @__PURE__ */ jsxs22("td", { className: "mbow-strong", children: [
7638
8071
  "#",
7639
8072
  bill.billNumber
7640
8073
  ] }),
7641
- /* @__PURE__ */ jsx19("td", { children: bill.patientName }),
7642
- /* @__PURE__ */ jsx19("td", { children: shortDate(bill.dateOfService) }),
7643
- /* @__PURE__ */ jsx19("td", { children: bill.procedureCodes.join(", ") || "\u2014" }),
7644
- /* @__PURE__ */ jsx19("td", { children: bill.claimsAdministrator || "\u2014" }),
7645
- /* @__PURE__ */ jsx19("td", { children: /* @__PURE__ */ jsx19("span", { className: `mbow-badge ${bill.status.tone ?? ""}`, children: bill.status.label }) }),
7646
- /* @__PURE__ */ jsxs19("td", { children: [
8074
+ /* @__PURE__ */ jsx22("td", { children: bill.patientName }),
8075
+ /* @__PURE__ */ jsx22("td", { children: shortDate(bill.dateOfService) }),
8076
+ /* @__PURE__ */ jsx22("td", { children: bill.procedureCodes.join(", ") || "\u2014" }),
8077
+ /* @__PURE__ */ jsx22("td", { children: bill.claimsAdministrator || "\u2014" }),
8078
+ /* @__PURE__ */ jsx22("td", { children: /* @__PURE__ */ jsx22("span", { className: `mbow-badge ${bill.status.tone ?? ""}`, children: bill.status.label }) }),
8079
+ /* @__PURE__ */ jsxs22("td", { children: [
7647
8080
  shortDate(bill.submittedAt),
7648
- /* @__PURE__ */ jsx19("div", { className: "mbow-muted", children: bill.arAgeDays == null ? "\u2014" : `${bill.arAgeDays} days` })
8081
+ /* @__PURE__ */ jsx22("div", { className: "mbow-muted", children: bill.arAgeDays == null ? "\u2014" : `${bill.arAgeDays} days` })
7649
8082
  ] }),
7650
- /* @__PURE__ */ jsx19("td", { className: "mbow-money mbow-strong", children: money6(bill.balanceDue) })
8083
+ /* @__PURE__ */ jsx22("td", { className: "mbow-money mbow-strong", children: money7(bill.balanceDue) })
7651
8084
  ] }, bill.id)) })
7652
8085
  ] }),
7653
- result && !loading && !error ? /* @__PURE__ */ jsxs19("div", { className: "mbow-pager", children: [
7654
- /* @__PURE__ */ jsxs19("span", { children: [
8086
+ result && !loading && !error ? /* @__PURE__ */ jsxs22("div", { className: "mbow-pager", children: [
8087
+ /* @__PURE__ */ jsxs22("span", { children: [
7655
8088
  "Showing ",
7656
8089
  result.total === 0 ? 0 : (result.page - 1) * result.pageSize + 1,
7657
8090
  "\u2013",
@@ -7659,14 +8092,14 @@ function BillSearchContent({
7659
8092
  " of ",
7660
8093
  result.total
7661
8094
  ] }),
7662
- /* @__PURE__ */ jsxs19("span", { children: [
7663
- /* @__PURE__ */ jsx19("button", { className: "mbow-button", type: "button", disabled: result.page <= 1, onClick: () => update({ page: result.page - 1 }), children: "Previous" }),
8095
+ /* @__PURE__ */ jsxs22("span", { children: [
8096
+ /* @__PURE__ */ jsx22("button", { className: "mbow-button", type: "button", disabled: result.page <= 1, onClick: () => update({ page: result.page - 1 }), children: "Previous" }),
7664
8097
  " ",
7665
8098
  result.page,
7666
8099
  " / ",
7667
8100
  pageCount,
7668
8101
  " ",
7669
- /* @__PURE__ */ jsx19("button", { className: "mbow-button", type: "button", disabled: result.page >= pageCount, onClick: () => update({ page: result.page + 1 }), children: "Next" })
8102
+ /* @__PURE__ */ jsx22("button", { className: "mbow-button", type: "button", disabled: result.page >= pageCount, onClick: () => update({ page: result.page + 1 }), children: "Next" })
7670
8103
  ] })
7671
8104
  ] }) : null
7672
8105
  ] })
@@ -7674,7 +8107,7 @@ function BillSearchContent({
7674
8107
  }
7675
8108
  function ConnectedBillSearch({ appearance, className, style, initialQuery, onSelectBill, heading = "All bills", ...options }) {
7676
8109
  const client = useClient(options);
7677
- return /* @__PURE__ */ jsx19(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx19(BillSearchContent, { client, initialQuery, onSelectBill, heading }) });
8110
+ return /* @__PURE__ */ jsx22(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx22(BillSearchContent, { client, initialQuery, onSelectBill, heading }) });
7678
8111
  }
7679
8112
  function taskQuery(cell) {
7680
8113
  const [taskType, taskLabel] = cell.rowId.split("::", 2);
@@ -7685,11 +8118,11 @@ function taskQuery(cell) {
7685
8118
  return { status: "all", taskSection: cell.sectionId, ...taskType ? { taskType } : {}, ...taskLabel ? { taskLabel } : {}, ...age ? { age } : {} };
7686
8119
  }
7687
8120
  function BillTasksContent({ client, onDrillDown, appearance }) {
7688
- const [claimsAdminId, setClaimsAdminId] = useState15("");
7689
- const [renderingProviderId, setRenderingProviderId] = useState15("");
7690
- const [result, setResult] = useState15(null);
7691
- const [error, setError] = useState15(null);
7692
- const [loading, setLoading] = useState15(true);
8121
+ const [claimsAdminId, setClaimsAdminId] = useState18("");
8122
+ const [renderingProviderId, setRenderingProviderId] = useState18("");
8123
+ const [result, setResult] = useState18(null);
8124
+ const [error, setError] = useState18(null);
8125
+ const [loading, setLoading] = useState18(true);
7693
8126
  const load = useCallback5(async (signal) => {
7694
8127
  setLoading(true);
7695
8128
  setError(null);
@@ -7701,32 +8134,32 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
7701
8134
  if (!signal?.aborted) setLoading(false);
7702
8135
  }
7703
8136
  }, [claimsAdminId, renderingProviderId, client]);
7704
- useEffect13(() => {
8137
+ useEffect15(() => {
7705
8138
  const controller = new AbortController();
7706
8139
  void load(controller.signal);
7707
8140
  return () => controller.abort();
7708
8141
  }, [load]);
7709
- if (loading && !result) return /* @__PURE__ */ jsx19("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
7710
- if (error && !result) return /* @__PURE__ */ jsx19("div", { className: "mbow-state mbow-error", children: error.message });
7711
- if (!result) return /* @__PURE__ */ jsx19(Fragment16, {});
8142
+ if (loading && !result) return /* @__PURE__ */ jsx22("div", { className: "mbow-state", children: "Loading bill tasks\u2026" });
8143
+ if (error && !result) return /* @__PURE__ */ jsx22("div", { className: "mbow-state mbow-error", children: error.message });
8144
+ if (!result) return /* @__PURE__ */ jsx22(Fragment16, {});
7712
8145
  const selectionProps = loading || error ? {} : {
7713
8146
  onSelectCell: (cell) => onDrillDown?.({ ...taskQuery(cell), ...claimsAdminId ? { claimsAdministrator: claimsAdminId } : {}, ...renderingProviderId ? { renderingProviderId } : {} })
7714
8147
  };
7715
- return /* @__PURE__ */ jsxs19(Fragment16, { children: [
7716
- /* @__PURE__ */ jsxs19("p", { className: "mbow-task-note", children: [
8148
+ return /* @__PURE__ */ jsxs22(Fragment16, { children: [
8149
+ /* @__PURE__ */ jsxs22("p", { className: "mbow-task-note", children: [
7717
8150
  "Open follow-up work grouped by task and age. ",
7718
8151
  result.waiting ? "Sent and accepted bills waiting for a payer are shown below." : "Find sent and accepted bills in All bills."
7719
8152
  ] }),
7720
- loading ? /* @__PURE__ */ jsx19("p", { role: "status", children: "Updating bill tasks\u2026" }) : null,
7721
- error ? /* @__PURE__ */ jsx19("p", { role: "alert", className: "mbow-error", children: error.message }) : null,
7722
- /* @__PURE__ */ jsx19(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs19("div", { className: "mbow-toolbar", children: [
7723
- /* @__PURE__ */ jsxs19("select", { "aria-label": "Claims administrator filter", className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
7724
- /* @__PURE__ */ jsx19("option", { value: "", children: "All claims administrators" }),
7725
- result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx19("option", { value: item.id, children: item.name }, item.id))
8153
+ loading ? /* @__PURE__ */ jsx22("p", { role: "status", children: "Updating bill tasks\u2026" }) : null,
8154
+ error ? /* @__PURE__ */ jsx22("p", { role: "alert", className: "mbow-error", children: error.message }) : null,
8155
+ /* @__PURE__ */ jsx22(BillTasksDashboard, { data: result.dashboard, appearance: appearance ?? { preset: "mindbill" }, toolbar: /* @__PURE__ */ jsxs22("div", { className: "mbow-toolbar", children: [
8156
+ /* @__PURE__ */ jsxs22("select", { "aria-label": "Claims administrator filter", className: "mbow-select", value: claimsAdminId, onChange: (event) => setClaimsAdminId(event.target.value), children: [
8157
+ /* @__PURE__ */ jsx22("option", { value: "", children: "All claims administrators" }),
8158
+ result.filters.claimsAdministrators.map((item) => /* @__PURE__ */ jsx22("option", { value: item.id, children: item.name }, item.id))
7726
8159
  ] }),
7727
- /* @__PURE__ */ jsx19(RenderingProviderFilter, { value: renderingProviderId, options: result.filters.renderingProviders, onChange: setRenderingProviderId })
8160
+ /* @__PURE__ */ jsx22(RenderingProviderFilter, { value: renderingProviderId, options: result.filters.renderingProviders, onChange: setRenderingProviderId })
7728
8161
  ] }), ...selectionProps }),
7729
- result.waiting ? /* @__PURE__ */ jsx19(
8162
+ result.waiting ? /* @__PURE__ */ jsx22(
7730
8163
  BillTasksDashboard,
7731
8164
  {
7732
8165
  data: result.waiting,
@@ -7744,28 +8177,28 @@ function BillTasksContent({ client, onDrillDown, appearance }) {
7744
8177
  }
7745
8178
  function ConnectedBillTasksDashboard({ appearance, className, style, onDrillDown, ...options }) {
7746
8179
  const client = useClient(options);
7747
- return /* @__PURE__ */ jsx19(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx19(BillTasksContent, { client, onDrillDown, appearance }) });
8180
+ return /* @__PURE__ */ jsx22(Surface, { appearance, className, style, children: /* @__PURE__ */ jsx22(BillTasksContent, { client, onDrillDown, appearance }) });
7748
8181
  }
7749
8182
  function RangeToolbar({ from, to, setFrom, setTo }) {
7750
- return /* @__PURE__ */ jsxs19("div", { className: "mbow-toolbar", children: [
7751
- /* @__PURE__ */ jsxs19("label", { children: [
8183
+ return /* @__PURE__ */ jsxs22("div", { className: "mbow-toolbar", children: [
8184
+ /* @__PURE__ */ jsxs22("label", { children: [
7752
8185
  "From ",
7753
- /* @__PURE__ */ jsx19("input", { className: "mbow-input", type: "date", value: from, onChange: (event) => setFrom(event.target.value) })
8186
+ /* @__PURE__ */ jsx22("input", { className: "mbow-input", type: "date", value: from, onChange: (event) => setFrom(event.target.value) })
7754
8187
  ] }),
7755
- /* @__PURE__ */ jsxs19("label", { children: [
8188
+ /* @__PURE__ */ jsxs22("label", { children: [
7756
8189
  "To ",
7757
- /* @__PURE__ */ jsx19("input", { className: "mbow-input", type: "date", value: to, onChange: (event) => setTo(event.target.value) })
8190
+ /* @__PURE__ */ jsx22("input", { className: "mbow-input", type: "date", value: to, onChange: (event) => setTo(event.target.value) })
7758
8191
  ] })
7759
8192
  ] });
7760
8193
  }
7761
8194
  function ConnectedServiceLineItemsReport({ appearance, className, style, initialFrom, initialTo, onSelectBill, ...options }) {
7762
- const defaults = useMemo10(() => defaultRange(), []);
8195
+ const defaults = useMemo11(() => defaultRange(), []);
7763
8196
  const client = useClient(options);
7764
- const [from, setFrom] = useState15(initialFrom ?? defaults.from);
7765
- const [to, setTo] = useState15(initialTo ?? defaults.to);
7766
- const [data, setData] = useState15(null);
7767
- const [error, setError] = useState15(null);
7768
- useEffect13(() => {
8197
+ const [from, setFrom] = useState18(initialFrom ?? defaults.from);
8198
+ const [to, setTo] = useState18(initialTo ?? defaults.to);
8199
+ const [data, setData] = useState18(null);
8200
+ const [error, setError] = useState18(null);
8201
+ useEffect15(() => {
7769
8202
  const controller = new AbortController();
7770
8203
  setError(null);
7771
8204
  void client.getServiceLineItems({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -7773,64 +8206,64 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
7773
8206
  });
7774
8207
  return () => controller.abort();
7775
8208
  }, [client, from, to]);
7776
- return /* @__PURE__ */ jsxs19(Surface, { appearance, className, style, children: [
7777
- /* @__PURE__ */ jsx19("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs19("div", { children: [
7778
- /* @__PURE__ */ jsx19("h2", { children: "Original submissions by procedure" }),
7779
- /* @__PURE__ */ jsx19("p", { className: "mbow-sub", children: "First payer submission for each patient and date of service." })
8209
+ return /* @__PURE__ */ jsxs22(Surface, { appearance, className, style, children: [
8210
+ /* @__PURE__ */ jsx22("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs22("div", { children: [
8211
+ /* @__PURE__ */ jsx22("h2", { children: "Original submissions by procedure" }),
8212
+ /* @__PURE__ */ jsx22("p", { className: "mbow-sub", children: "First payer submission for each patient and date of service." })
7780
8213
  ] }) }),
7781
- /* @__PURE__ */ jsx19(RangeToolbar, { from, to, setFrom, setTo }),
7782
- error ? /* @__PURE__ */ jsx19("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx19("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs19(Fragment16, { children: [
7783
- /* @__PURE__ */ jsxs19("div", { className: "mbow-metrics", children: [
7784
- /* @__PURE__ */ jsx19(Metric, { label: "Original bills", value: String(data.totalBills) }),
7785
- /* @__PURE__ */ jsx19(Metric, { label: "Service lines", value: String(data.totalLines) }),
7786
- /* @__PURE__ */ jsx19(Metric, { label: "Total billed", value: money6(data.totalBilled) }),
7787
- /* @__PURE__ */ jsx19(Metric, { label: "Report window", value: data.windowLabel })
8214
+ /* @__PURE__ */ jsx22(RangeToolbar, { from, to, setFrom, setTo }),
8215
+ error ? /* @__PURE__ */ jsx22("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx22("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs22(Fragment16, { children: [
8216
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-metrics", children: [
8217
+ /* @__PURE__ */ jsx22(Metric, { label: "Original bills", value: String(data.totalBills) }),
8218
+ /* @__PURE__ */ jsx22(Metric, { label: "Service lines", value: String(data.totalLines) }),
8219
+ /* @__PURE__ */ jsx22(Metric, { label: "Total billed", value: money7(data.totalBilled) }),
8220
+ /* @__PURE__ */ jsx22(Metric, { label: "Report window", value: data.windowLabel })
7788
8221
  ] }),
7789
- /* @__PURE__ */ jsxs19("div", { className: "mbow-card mbow-scroll", children: [
7790
- /* @__PURE__ */ jsx19("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx19("h3", { children: "Procedure summary" }) }),
7791
- /* @__PURE__ */ jsxs19("table", { className: "mbow-table", children: [
7792
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
7793
- /* @__PURE__ */ jsx19("th", { children: "Procedure code" }),
7794
- /* @__PURE__ */ jsx19("th", { children: "Bills" }),
7795
- /* @__PURE__ */ jsx19("th", { children: "Service lines" }),
7796
- /* @__PURE__ */ jsx19("th", { className: "mbow-money", children: "Total billed" })
8222
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-card mbow-scroll", children: [
8223
+ /* @__PURE__ */ jsx22("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx22("h3", { children: "Procedure summary" }) }),
8224
+ /* @__PURE__ */ jsxs22("table", { className: "mbow-table", children: [
8225
+ /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs22("tr", { children: [
8226
+ /* @__PURE__ */ jsx22("th", { children: "Procedure code" }),
8227
+ /* @__PURE__ */ jsx22("th", { children: "Bills" }),
8228
+ /* @__PURE__ */ jsx22("th", { children: "Service lines" }),
8229
+ /* @__PURE__ */ jsx22("th", { className: "mbow-money", children: "Total billed" })
7797
8230
  ] }) }),
7798
- /* @__PURE__ */ jsx19("tbody", { children: data.cptRows.map((row) => /* @__PURE__ */ jsxs19("tr", { children: [
7799
- /* @__PURE__ */ jsx19("td", { className: "mbow-strong", children: row.code }),
7800
- /* @__PURE__ */ jsx19("td", { children: row.bills }),
7801
- /* @__PURE__ */ jsx19("td", { children: row.lines }),
7802
- /* @__PURE__ */ jsx19("td", { className: "mbow-money", children: money6(row.billed) })
8231
+ /* @__PURE__ */ jsx22("tbody", { children: data.cptRows.map((row) => /* @__PURE__ */ jsxs22("tr", { children: [
8232
+ /* @__PURE__ */ jsx22("td", { className: "mbow-strong", children: row.code }),
8233
+ /* @__PURE__ */ jsx22("td", { children: row.bills }),
8234
+ /* @__PURE__ */ jsx22("td", { children: row.lines }),
8235
+ /* @__PURE__ */ jsx22("td", { className: "mbow-money", children: money7(row.billed) })
7803
8236
  ] }, row.code)) })
7804
8237
  ] })
7805
8238
  ] }),
7806
- /* @__PURE__ */ jsxs19("div", { className: "mbow-card mbow-scroll", style: { marginTop: 16 }, children: [
7807
- /* @__PURE__ */ jsx19("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx19("h3", { children: "All original bills" }) }),
7808
- /* @__PURE__ */ jsxs19("table", { className: "mbow-table", children: [
7809
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
7810
- /* @__PURE__ */ jsx19("th", { children: "Bill" }),
7811
- /* @__PURE__ */ jsx19("th", { children: "First submitted" }),
7812
- /* @__PURE__ */ jsx19("th", { children: "Patient \xB7 Claim" }),
7813
- /* @__PURE__ */ jsx19("th", { children: "DOS" }),
7814
- /* @__PURE__ */ jsx19("th", { children: "Claims administrator" }),
7815
- /* @__PURE__ */ jsx19("th", { children: "Codes" }),
7816
- /* @__PURE__ */ jsx19("th", { className: "mbow-money", children: "Billed" }),
7817
- /* @__PURE__ */ jsx19("th", { children: "Status" })
8239
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-card mbow-scroll", style: { marginTop: 16 }, children: [
8240
+ /* @__PURE__ */ jsx22("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx22("h3", { children: "All original bills" }) }),
8241
+ /* @__PURE__ */ jsxs22("table", { className: "mbow-table", children: [
8242
+ /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs22("tr", { children: [
8243
+ /* @__PURE__ */ jsx22("th", { children: "Bill" }),
8244
+ /* @__PURE__ */ jsx22("th", { children: "First submitted" }),
8245
+ /* @__PURE__ */ jsx22("th", { children: "Patient \xB7 Claim" }),
8246
+ /* @__PURE__ */ jsx22("th", { children: "DOS" }),
8247
+ /* @__PURE__ */ jsx22("th", { children: "Claims administrator" }),
8248
+ /* @__PURE__ */ jsx22("th", { children: "Codes" }),
8249
+ /* @__PURE__ */ jsx22("th", { className: "mbow-money", children: "Billed" }),
8250
+ /* @__PURE__ */ jsx22("th", { children: "Status" })
7818
8251
  ] }) }),
7819
- /* @__PURE__ */ jsx19("tbody", { children: data.billRows.map((row) => /* @__PURE__ */ jsxs19("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(row.billId), children: [
7820
- /* @__PURE__ */ jsxs19("td", { className: "mbow-strong", children: [
8252
+ /* @__PURE__ */ jsx22("tbody", { children: data.billRows.map((row) => /* @__PURE__ */ jsxs22("tr", { className: onSelectBill ? "clickable" : "", onClick: () => onSelectBill?.(row.billId), children: [
8253
+ /* @__PURE__ */ jsxs22("td", { className: "mbow-strong", children: [
7821
8254
  "#",
7822
8255
  row.billNumber
7823
8256
  ] }),
7824
- /* @__PURE__ */ jsx19("td", { children: shortDate(row.submittedDate) }),
7825
- /* @__PURE__ */ jsxs19("td", { children: [
8257
+ /* @__PURE__ */ jsx22("td", { children: shortDate(row.submittedDate) }),
8258
+ /* @__PURE__ */ jsxs22("td", { children: [
7826
8259
  row.patient,
7827
- /* @__PURE__ */ jsx19("div", { className: "mbow-muted", children: row.claim })
8260
+ /* @__PURE__ */ jsx22("div", { className: "mbow-muted", children: row.claim })
7828
8261
  ] }),
7829
- /* @__PURE__ */ jsx19("td", { children: shortDate(row.dos) }),
7830
- /* @__PURE__ */ jsx19("td", { children: row.claimsAdmin }),
7831
- /* @__PURE__ */ jsx19("td", { children: row.codes.join(", ") }),
7832
- /* @__PURE__ */ jsx19("td", { className: "mbow-money", children: money6(row.billed) }),
7833
- /* @__PURE__ */ jsx19("td", { children: row.status })
8262
+ /* @__PURE__ */ jsx22("td", { children: shortDate(row.dos) }),
8263
+ /* @__PURE__ */ jsx22("td", { children: row.claimsAdmin }),
8264
+ /* @__PURE__ */ jsx22("td", { children: row.codes.join(", ") }),
8265
+ /* @__PURE__ */ jsx22("td", { className: "mbow-money", children: money7(row.billed) }),
8266
+ /* @__PURE__ */ jsx22("td", { children: row.status })
7834
8267
  ] }, row.billId)) })
7835
8268
  ] })
7836
8269
  ] })
@@ -7838,19 +8271,19 @@ function ConnectedServiceLineItemsReport({ appearance, className, style, initial
7838
8271
  ] });
7839
8272
  }
7840
8273
  function Metric({ label, value }) {
7841
- return /* @__PURE__ */ jsxs19("div", { className: "mbow-metric", children: [
7842
- /* @__PURE__ */ jsx19("span", { children: label }),
7843
- /* @__PURE__ */ jsx19("strong", { children: value })
8274
+ return /* @__PURE__ */ jsxs22("div", { className: "mbow-metric", children: [
8275
+ /* @__PURE__ */ jsx22("span", { children: label }),
8276
+ /* @__PURE__ */ jsx22("strong", { children: value })
7844
8277
  ] });
7845
8278
  }
7846
8279
  function ConnectedProductivityReport({ appearance, className, style, initialFrom, initialTo, ...options }) {
7847
- const defaults = useMemo10(() => defaultRange(13), []);
8280
+ const defaults = useMemo11(() => defaultRange(13), []);
7848
8281
  const client = useClient(options);
7849
- const [from, setFrom] = useState15(initialFrom ?? defaults.from);
7850
- const [to, setTo] = useState15(initialTo ?? defaults.to);
7851
- const [data, setData] = useState15(null);
7852
- const [error, setError] = useState15(null);
7853
- useEffect13(() => {
8282
+ const [from, setFrom] = useState18(initialFrom ?? defaults.from);
8283
+ const [to, setTo] = useState18(initialTo ?? defaults.to);
8284
+ const [data, setData] = useState18(null);
8285
+ const [error, setError] = useState18(null);
8286
+ useEffect15(() => {
7854
8287
  const controller = new AbortController();
7855
8288
  setError(null);
7856
8289
  void client.getProductivity({ from, to }, controller.signal).then(setData).catch((cause) => {
@@ -7859,41 +8292,41 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
7859
8292
  return () => controller.abort();
7860
8293
  }, [client, from, to]);
7861
8294
  const maxSent = data ? Math.max(1, ...Object.values(data.sentTotal)) : 1;
7862
- return /* @__PURE__ */ jsxs19(Surface, { appearance, className, style, children: [
7863
- /* @__PURE__ */ jsx19("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs19("div", { children: [
7864
- /* @__PURE__ */ jsx19("h2", { children: "Productivity" }),
7865
- /* @__PURE__ */ jsx19("p", { className: "mbow-sub", children: "Bills created and sent per biller, plus accepted-first-try rate." })
8295
+ return /* @__PURE__ */ jsxs22(Surface, { appearance, className, style, children: [
8296
+ /* @__PURE__ */ jsx22("div", { className: "mbow-head", children: /* @__PURE__ */ jsxs22("div", { children: [
8297
+ /* @__PURE__ */ jsx22("h2", { children: "Productivity" }),
8298
+ /* @__PURE__ */ jsx22("p", { className: "mbow-sub", children: "Bills created and sent per biller, plus accepted-first-try rate." })
7866
8299
  ] }) }),
7867
- /* @__PURE__ */ jsx19(RangeToolbar, { from, to, setFrom, setTo }),
7868
- error ? /* @__PURE__ */ jsx19("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx19("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs19(Fragment16, { children: [
7869
- /* @__PURE__ */ jsxs19("div", { className: "mbow-metrics", children: [
7870
- /* @__PURE__ */ jsx19(Metric, { label: "Bills created", value: String(data.totalCreated) }),
7871
- /* @__PURE__ */ jsx19(Metric, { label: "Transmissions", value: String(data.totalSent) }),
7872
- /* @__PURE__ */ jsx19(Metric, { label: "Bills submitted", value: String(data.totalSubmitted) }),
7873
- /* @__PURE__ */ jsx19(Metric, { label: "Accepted first try", value: data.totalSubmitted ? `${Math.round(data.totalClean / data.totalSubmitted * 100)}%` : "\u2014" })
8300
+ /* @__PURE__ */ jsx22(RangeToolbar, { from, to, setFrom, setTo }),
8301
+ error ? /* @__PURE__ */ jsx22("div", { className: "mbow-state mbow-error", children: error.message }) : !data ? /* @__PURE__ */ jsx22("div", { className: "mbow-state", children: "Loading report\u2026" }) : /* @__PURE__ */ jsxs22(Fragment16, { children: [
8302
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-metrics", children: [
8303
+ /* @__PURE__ */ jsx22(Metric, { label: "Bills created", value: String(data.totalCreated) }),
8304
+ /* @__PURE__ */ jsx22(Metric, { label: "Transmissions", value: String(data.totalSent) }),
8305
+ /* @__PURE__ */ jsx22(Metric, { label: "Bills submitted", value: String(data.totalSubmitted) }),
8306
+ /* @__PURE__ */ jsx22(Metric, { label: "Accepted first try", value: data.totalSubmitted ? `${Math.round(data.totalClean / data.totalSubmitted * 100)}%` : "\u2014" })
7874
8307
  ] }),
7875
- /* @__PURE__ */ jsxs19("div", { className: "mbow-card mbow-scroll", children: [
7876
- /* @__PURE__ */ jsx19("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx19("h3", { children: "Per-biller summary" }) }),
7877
- /* @__PURE__ */ jsxs19("table", { className: "mbow-table", children: [
7878
- /* @__PURE__ */ jsx19("thead", { children: /* @__PURE__ */ jsxs19("tr", { children: [
7879
- /* @__PURE__ */ jsx19("th", { children: "Biller" }),
7880
- /* @__PURE__ */ jsx19("th", { children: "Created" }),
7881
- /* @__PURE__ */ jsx19("th", { children: "Transmissions" }),
7882
- /* @__PURE__ */ jsx19("th", { children: "Submitted" }),
7883
- /* @__PURE__ */ jsx19("th", { children: "Accepted first try" }),
7884
- /* @__PURE__ */ jsx19("th", { children: "Volume" })
8308
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-card mbow-scroll", children: [
8309
+ /* @__PURE__ */ jsx22("div", { className: "mbow-section-head", children: /* @__PURE__ */ jsx22("h3", { children: "Per-biller summary" }) }),
8310
+ /* @__PURE__ */ jsxs22("table", { className: "mbow-table", children: [
8311
+ /* @__PURE__ */ jsx22("thead", { children: /* @__PURE__ */ jsxs22("tr", { children: [
8312
+ /* @__PURE__ */ jsx22("th", { children: "Biller" }),
8313
+ /* @__PURE__ */ jsx22("th", { children: "Created" }),
8314
+ /* @__PURE__ */ jsx22("th", { children: "Transmissions" }),
8315
+ /* @__PURE__ */ jsx22("th", { children: "Submitted" }),
8316
+ /* @__PURE__ */ jsx22("th", { children: "Accepted first try" }),
8317
+ /* @__PURE__ */ jsx22("th", { children: "Volume" })
7885
8318
  ] }) }),
7886
- /* @__PURE__ */ jsx19("tbody", { children: data.billers.map((biller) => {
8319
+ /* @__PURE__ */ jsx22("tbody", { children: data.billers.map((biller) => {
7887
8320
  const sent = data.sentTotal[biller.name] ?? 0;
7888
8321
  const submitted = data.submittedTotal[biller.name] ?? 0;
7889
8322
  const clean = data.cleanTotal[biller.name] ?? 0;
7890
- return /* @__PURE__ */ jsxs19("tr", { children: [
7891
- /* @__PURE__ */ jsx19("td", { className: "mbow-strong", children: biller.name }),
7892
- /* @__PURE__ */ jsx19("td", { children: data.createdTotal[biller.name] ?? 0 }),
7893
- /* @__PURE__ */ jsx19("td", { children: sent }),
7894
- /* @__PURE__ */ jsx19("td", { children: submitted }),
7895
- /* @__PURE__ */ jsx19("td", { children: submitted ? `${Math.round(clean / submitted * 100)}%` : "\u2014" }),
7896
- /* @__PURE__ */ jsx19("td", { children: /* @__PURE__ */ jsx19("div", { className: "mbow-bar", children: /* @__PURE__ */ jsx19("i", { style: { width: `${sent / maxSent * 100}%` } }) }) })
8323
+ return /* @__PURE__ */ jsxs22("tr", { children: [
8324
+ /* @__PURE__ */ jsx22("td", { className: "mbow-strong", children: biller.name }),
8325
+ /* @__PURE__ */ jsx22("td", { children: data.createdTotal[biller.name] ?? 0 }),
8326
+ /* @__PURE__ */ jsx22("td", { children: sent }),
8327
+ /* @__PURE__ */ jsx22("td", { children: submitted }),
8328
+ /* @__PURE__ */ jsx22("td", { children: submitted ? `${Math.round(clean / submitted * 100)}%` : "\u2014" }),
8329
+ /* @__PURE__ */ jsx22("td", { children: /* @__PURE__ */ jsx22("div", { className: "mbow-bar", children: /* @__PURE__ */ jsx22("i", { style: { width: `${sent / maxSent * 100}%` } }) }) })
7897
8330
  ] }, biller.name);
7898
8331
  }) })
7899
8332
  ] })
@@ -7901,45 +8334,45 @@ function ConnectedProductivityReport({ appearance, className, style, initialFrom
7901
8334
  ] })
7902
8335
  ] });
7903
8336
  }
7904
- function ConnectedBillingWorkspace({ appearance, className, style, initialView = "tasks", onCreateBill, sandboxControls = false, getCourtesyCopyRecipientOptions, ...options }) {
8337
+ function ConnectedBillingWorkspace({ appearance, className, style, initialView = "tasks", onCreateBill, onPostPayment, sandboxControls = false, getCourtesyCopyRecipientOptions, ...options }) {
7905
8338
  const client = useClient(options);
7906
- const [view, setView] = useState15(initialView);
7907
- const [billQuery, setBillQuery] = useState15({ status: "all" });
7908
- const [selectedBillId, setSelectedBillId] = useState15(null);
8339
+ const [view, setView] = useState18(initialView);
8340
+ const [billQuery, setBillQuery] = useState18({ status: "all" });
8341
+ const [selectedBillId, setSelectedBillId] = useState18(null);
7909
8342
  const { workspaceRef, availableHeight } = useAvailableViewportHeight();
7910
8343
  const workspaceClassName = ["mbow-workspace", className].filter(Boolean).join(" ");
7911
8344
  const hasExplicitHeight = style?.height != null || style?.maxHeight != null;
7912
8345
  const workspaceStyle = availableHeight == null || hasExplicitHeight ? style : { ...style, maxHeight: availableHeight };
7913
- if (selectedBillId) return /* @__PURE__ */ jsxs19(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7914
- /* @__PURE__ */ jsx19("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
7915
- /* @__PURE__ */ jsx19(ConnectedBillLifecycle, { billId: selectedBillId, sandboxControls, courtesyCopyRecipientOptions: getCourtesyCopyRecipientOptions?.(selectedBillId) ?? [], ...options, ...appearance ? { appearance } : {} })
8346
+ if (selectedBillId) return /* @__PURE__ */ jsxs22(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
8347
+ /* @__PURE__ */ jsx22("button", { className: "mbow-button mbow-back", type: "button", onClick: () => setSelectedBillId(null), children: "\u2190 Back to bills" }),
8348
+ /* @__PURE__ */ jsx22(ConnectedBillLifecycle, { billId: selectedBillId, sandboxControls, courtesyCopyRecipientOptions: getCourtesyCopyRecipientOptions?.(selectedBillId) ?? [], ...options, ...appearance ? { appearance } : {} })
7916
8349
  ] });
7917
8350
  const selectView = (next) => {
7918
8351
  setView(next);
7919
8352
  setSelectedBillId(null);
7920
8353
  };
7921
8354
  const appearanceProps = appearance ? { appearance } : {};
7922
- return /* @__PURE__ */ jsxs19(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
7923
- /* @__PURE__ */ jsxs19("div", { className: "mbow-head", children: [
7924
- /* @__PURE__ */ jsxs19("div", { children: [
7925
- /* @__PURE__ */ jsx19("h2", { children: "Billing" }),
7926
- /* @__PURE__ */ jsx19("p", { className: "mbow-sub", children: "Follow up on open work or find any bill and its current status." })
8355
+ return /* @__PURE__ */ jsxs22(Surface, { surfaceRef: workspaceRef, appearance, className: workspaceClassName, style: workspaceStyle, children: [
8356
+ /* @__PURE__ */ jsxs22("div", { className: "mbow-head", children: [
8357
+ /* @__PURE__ */ jsxs22("div", { children: [
8358
+ /* @__PURE__ */ jsx22("h2", { children: "Billing" }),
8359
+ /* @__PURE__ */ jsx22("p", { className: "mbow-sub", children: "Follow up on open work or find any bill and its current status." })
7927
8360
  ] }),
7928
- onCreateBill ? /* @__PURE__ */ jsx19("div", { className: "mbow-actions", children: /* @__PURE__ */ jsx19("button", { className: "mbow-button primary", type: "button", onClick: onCreateBill, children: "+ Add bill" }) }) : null
8361
+ onCreateBill ? /* @__PURE__ */ jsx22("div", { className: "mbow-actions", children: /* @__PURE__ */ jsx22("button", { className: "mbow-button primary", type: "button", onClick: onCreateBill, children: "+ Add bill" }) }) : null
7929
8362
  ] }),
7930
- /* @__PURE__ */ jsx19("div", { className: "mbow-tabs", role: "tablist", children: [["tasks", "Bill tasks"], ["bills", "All bills"], ["procedures", "Procedures"], ["productivity", "Productivity"]].map(([id, label]) => /* @__PURE__ */ jsx19("button", { className: `mbow-tab ${view === id ? "active" : ""}`, type: "button", role: "tab", "aria-selected": view === id, onClick: () => selectView(id), children: label }, id)) }),
7931
- view === "tasks" ? /* @__PURE__ */ jsx19(BillTasksContent, { client, onDrillDown: (query) => {
8363
+ /* @__PURE__ */ jsx22("div", { className: "mbow-tabs", role: "tablist", children: [["tasks", "Bill tasks"], ["bills", "All bills"], ["procedures", "Procedures"], ["productivity", "Productivity"], ["payments", "Payment review"]].map(([id, label]) => /* @__PURE__ */ jsx22("button", { className: `mbow-tab ${view === id ? "active" : ""}`, type: "button", role: "tab", "aria-selected": view === id, onClick: () => selectView(id), children: label }, id)) }),
8364
+ view === "tasks" ? /* @__PURE__ */ jsx22(BillTasksContent, { client, onDrillDown: (query) => {
7932
8365
  setBillQuery(query);
7933
8366
  setView("bills");
7934
- }, appearance }) : view === "bills" ? /* @__PURE__ */ jsx19(BillSearchContent, { client, initialQuery: billQuery, onSelectBill: (bill) => setSelectedBillId(bill.id) }) : view === "procedures" ? /* @__PURE__ */ jsx19(ConnectedServiceLineItemsReport, { ...options, ...appearanceProps, onSelectBill: setSelectedBillId }) : /* @__PURE__ */ jsx19(ConnectedProductivityReport, { ...options, ...appearanceProps })
8367
+ }, appearance }) : view === "bills" ? /* @__PURE__ */ jsx22(BillSearchContent, { client, initialQuery: billQuery, onSelectBill: (bill) => setSelectedBillId(bill.id) }) : view === "procedures" ? /* @__PURE__ */ jsx22(ConnectedServiceLineItemsReport, { ...options, ...appearanceProps, onSelectBill: setSelectedBillId }) : view === "payments" ? /* @__PURE__ */ jsx22(ConnectedPaymentReview, { ...options, ...appearanceProps, ...onPostPayment ? { onPostPayment } : {}, onSelectBill: setSelectedBillId }) : /* @__PURE__ */ jsx22(ConnectedProductivityReport, { ...options, ...appearanceProps })
7935
8368
  ] });
7936
8369
  }
7937
8370
 
7938
8371
  // src/index.tsx
7939
8372
  function widget(tagName, props) {
7940
- const ref = useRef10(null);
8373
+ const ref = useRef11(null);
7941
8374
  const { onMindBill, onMindBillError } = props;
7942
- useEffect14(() => {
8375
+ useEffect16(() => {
7943
8376
  const element = ref.current;
7944
8377
  if (!element) return;
7945
8378
  const handleEvent = (event) => onMindBill?.(event);
@@ -8018,7 +8451,9 @@ export {
8018
8451
  ConnectedBillStatus,
8019
8452
  ConnectedBillTasksDashboard,
8020
8453
  ConnectedBillingWorkspace,
8454
+ ConnectedNotificationRecipientsSettings,
8021
8455
  ConnectedNotificationSettings,
8456
+ ConnectedPaymentReview,
8022
8457
  ConnectedProductivityReport,
8023
8458
  ConnectedServiceLineItemsReport,
8024
8459
  DEFAULT_BILL_SUBMISSION_MODIFIERS,
@@ -8027,6 +8462,7 @@ export {
8027
8462
  MED_LEGAL_REPORT_TYPE_CODE,
8028
8463
  MindBillBillReview,
8029
8464
  MindBillBillTimeline,
8465
+ NotificationRecipientsSettings,
8030
8466
  NotificationSettings,
8031
8467
  OrganizationOnboarding,
8032
8468
  PSYCH_QME_DEFAULT_DIAGNOSIS,
@@ -8037,6 +8473,7 @@ export {
8037
8473
  SECOND_REVIEW_WINDOW_DAYS,
8038
8474
  SecondReviewForm,
8039
8475
  SendRouteDialog,
8476
+ W9Upload,
8040
8477
  applyBillSubmissionEvaluationDiagnoses,
8041
8478
  applyBillSubmissionEvaluationModifiers,
8042
8479
  billActivityEventLabel,