@mindbill/react 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.tsx
4
4
  import "@mindbill/embed";
5
- import { createElement, useEffect as useEffect6, useRef as useRef5 } from "react";
5
+ import { createElement, useEffect as useEffect7, useRef as useRef6 } from "react";
6
6
 
7
7
  // src/appearance.ts
8
8
  var mindBillThemePresets = {
@@ -2876,19 +2876,290 @@ function BillStatusAgingMatrix({
2876
2876
  ] });
2877
2877
  }
2878
2878
 
2879
+ // src/organization-onboarding.tsx
2880
+ import { useCallback as useCallback2, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
2881
+ import {
2882
+ createOrganizationClient
2883
+ } from "@mindbill/browser";
2884
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2885
+ var STEPS = [
2886
+ { id: "practice", label: "Practice & billing" },
2887
+ { id: "locations", label: "Locations" },
2888
+ { id: "w9", label: "W-9" },
2889
+ { id: "review", label: "Review" }
2890
+ ];
2891
+ var css4 = `
2892
+ .mbob{color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbob *{box-sizing:border-box}.mbob h2,.mbob h3,.mbob p{margin:0}
2893
+ .mbob-card{border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow);padding:24px}
2894
+ .mbob-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:18px}.mbob-head h2{font-size:22px}.mbob-copy{color:var(--mb-muted);margin-top:5px!important}
2895
+ .mbob-steps{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:20px}
2896
+ .mbob-step{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--mb-border);border-radius:999px;background:var(--mb-surface);padding:7px 13px;color:var(--mb-muted);font:inherit;font-size:13px;font-weight:700;cursor:pointer}
2897
+ .mbob-step[data-active=true]{border-color:var(--mb-accent);color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 8%,var(--mb-surface))}
2898
+ .mbob-step[data-done=true] i{color:#159447;font-style:normal}
2899
+ .mbob-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px 22px}.mbob-span{grid-column:1/-1}
2900
+ .mbob-field{display:grid;gap:7px;font-size:13px;font-weight:720}
2901
+ .mbob-field input{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);padding:10px 12px;color:var(--mb-text);font:inherit;font-weight:450}
2902
+ .mbob-field input:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}
2903
+ .mbob-subhead{margin:20px 0 12px!important;padding-top:16px;border-top:1px solid var(--mb-border);font-size:15px}
2904
+ .mbob-loc{display:grid;grid-template-columns:1.2fr 1.4fr .9fr .4fr .6fr auto auto;gap:10px;align-items:end;border-top:1px solid color-mix(in srgb,var(--mb-border) 60%,transparent);padding:12px 0}
2905
+ .mbob-loc:first-of-type{border-top:0}
2906
+ .mbob-primary{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--mb-muted);white-space:nowrap;padding-bottom:12px}
2907
+ .mbob-remove{border:0;background:transparent;color:var(--mb-muted);font-size:20px;cursor:pointer;padding-bottom:8px}
2908
+ .mbob-add,.mbob-secondary{border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-surface);padding:10px 14px;color:var(--mb-text);font:inherit;font-weight:700;cursor:pointer}
2909
+ .mbob-drop{display:grid;place-content:center;gap:6px;min-height:150px;border:2px dashed color-mix(in srgb,var(--mb-muted) 55%,transparent);border-radius:var(--mb-control-radius);text-align:center;cursor:pointer;position:relative}
2910
+ .mbob-drop input{position:absolute;inset:0;opacity:0;cursor:pointer}
2911
+ .mbob-drop span{color:var(--mb-muted);font-size:13px}
2912
+ .mbob-w9-current{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid #9fd6b4;border-radius:var(--mb-control-radius);background:#f3fcf6;padding:12px 14px;margin-bottom:14px}
2913
+ .mbob-w9-current span{color:var(--mb-muted);font-size:13px}
2914
+ .mbob-check{display:grid;gap:9px}
2915
+ .mbob-check-item{display:flex;align-items:center;gap:10px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);padding:11px 14px}
2916
+ .mbob-check-item[data-complete=true]{border-color:#9fd6b4;background:#f3fcf6}
2917
+ .mbob-check-item i{font-style:normal}
2918
+ .mbob-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:20px}
2919
+ .mbob-save{min-width:170px;border:0;border-radius:var(--mb-control-radius);background:var(--mb-accent);color:var(--mb-accent-contrast);padding:12px 22px;font:inherit;font-weight:780;cursor:pointer}
2920
+ .mbob-save:disabled{opacity:.6;cursor:wait}
2921
+ .mbob-error{margin-top:14px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));padding:12px 14px;color:var(--mb-danger)}
2922
+ .mbob-status{color:var(--mb-muted)}
2923
+ .mbob-done{color:#159447;font-weight:750}
2924
+ @media(max-width:820px){.mbob-grid{grid-template-columns:1fr}.mbob-span{grid-column:auto}.mbob-loc{grid-template-columns:1fr 1fr;align-items:center}.mbob-loc>*{grid-column:auto}}
2925
+ `;
2926
+ var blankLocation = () => ({ name: "", street: "", city: "", state: "", zip: "", isPrimary: false });
2927
+ async function fileToBase64(file) {
2928
+ const buffer = new Uint8Array(await file.arrayBuffer());
2929
+ let binary = "";
2930
+ for (const byte of buffer) binary += String.fromCharCode(byte);
2931
+ return btoa(binary);
2932
+ }
2933
+ function OrganizationOnboarding({
2934
+ appearance,
2935
+ className = "",
2936
+ style,
2937
+ sessionEndpoint = "/api/mindbill/session",
2938
+ getSession,
2939
+ apiBaseUrl,
2940
+ heading = "Billing setup",
2941
+ description = "Practice identity, locations, and the W-9 \u2014 saved once, used on every bill.",
2942
+ variant = "onboarding",
2943
+ onSaved,
2944
+ onCompleted,
2945
+ onError
2946
+ }) {
2947
+ const client = useMemo5(
2948
+ () => createOrganizationClient({
2949
+ sessionEndpoint,
2950
+ ...getSession ? { getSession } : {},
2951
+ ...apiBaseUrl ? { apiBaseUrl } : {}
2952
+ }),
2953
+ [sessionEndpoint, getSession, apiBaseUrl]
2954
+ );
2955
+ const [profile, setProfile] = useState5(null);
2956
+ const [loadError, setLoadError] = useState5(null);
2957
+ const [step, setStep] = useState5("practice");
2958
+ const [identity, setIdentity] = useState5({ name: "", legalName: "", taxId: "", npi: "", phone: "", email: "" });
2959
+ const [provider, setProvider] = useState5({ name: "", taxId: "", npi: "", billType: "Professional", phone: "", billingStreet: "", billingCity: "", billingState: "", billingZip: "" });
2960
+ const [locations, setLocations] = useState5([blankLocation()]);
2961
+ const [w9File, setW9File] = useState5(null);
2962
+ const [saving, setSaving] = useState5(false);
2963
+ const [error, setError] = useState5(null);
2964
+ const [savedStep, setSavedStep] = useState5({});
2965
+ const completedFired = useRef3(false);
2966
+ const adoptProfile = useCallback2((next) => {
2967
+ setProfile(next);
2968
+ setIdentity((current) => ({
2969
+ name: next.practiceIdentity.name ?? current.name,
2970
+ legalName: next.practiceIdentity.legalName ?? current.legalName,
2971
+ taxId: next.practiceIdentity.taxId ?? current.taxId,
2972
+ npi: next.practiceIdentity.npi ?? current.npi,
2973
+ phone: next.practiceIdentity.phone ?? current.phone,
2974
+ email: next.practiceIdentity.email ?? current.email
2975
+ }));
2976
+ if (next.billingProviders[0]) setProvider({ billType: "Professional", ...next.billingProviders[0] });
2977
+ if (next.locations.length) setLocations(next.locations.map((item) => ({ ...item })));
2978
+ if (next.onboarding.complete && !completedFired.current) {
2979
+ completedFired.current = true;
2980
+ onCompleted?.(next);
2981
+ }
2982
+ }, [onCompleted]);
2983
+ useEffect4(() => {
2984
+ let alive = true;
2985
+ client.getOrganization().then((next) => {
2986
+ if (alive) {
2987
+ setLoadError(null);
2988
+ adoptProfile(next);
2989
+ }
2990
+ }).catch((caught) => {
2991
+ if (!alive) return;
2992
+ const failure = caught instanceof Error ? caught : new Error("The organization could not be loaded.");
2993
+ setLoadError(failure.message);
2994
+ onError?.(failure);
2995
+ });
2996
+ return () => {
2997
+ alive = false;
2998
+ };
2999
+ }, [client, adoptProfile, onError]);
3000
+ const run = async (work, stepId) => {
3001
+ setSaving(true);
3002
+ setError(null);
3003
+ try {
3004
+ const next = await work();
3005
+ adoptProfile(next);
3006
+ setSavedStep((current) => ({ ...current, [stepId]: true }));
3007
+ onSaved?.(next);
3008
+ if (variant === "onboarding") {
3009
+ const order = ["practice", "locations", "w9", "review"];
3010
+ const nextStep = order[order.indexOf(stepId) + 1];
3011
+ if (nextStep) setStep(nextStep);
3012
+ }
3013
+ } catch (caught) {
3014
+ const failure = caught instanceof Error ? caught : new Error("Saving failed.");
3015
+ setError(failure.message);
3016
+ onError?.(failure);
3017
+ } finally {
3018
+ setSaving(false);
3019
+ }
3020
+ };
3021
+ const savePractice = () => run(() => client.saveBillingProfile({
3022
+ practiceIdentity: identity,
3023
+ ...provider.name.trim() || provider.taxId.trim() || provider.npi.trim() ? { billingProviders: [provider] } : {}
3024
+ }), "practice");
3025
+ const saveLocations = () => run(() => client.saveLocations(locations.filter((item) => item.name.trim() || item.street.trim())), "locations");
3026
+ const saveW9 = () => run(async () => {
3027
+ if (!w9File) throw new Error("Choose the practice W-9 PDF first.");
3028
+ return client.saveW9({ filename: w9File.name, contentBase64: await fileToBase64(w9File) });
3029
+ }, "w9");
3030
+ const field = (label, value, onChange, span = false, placeholder = "") => /* @__PURE__ */ jsxs6("label", { className: `mbob-field${span ? " mbob-span" : ""}`, children: [
3031
+ label,
3032
+ /* @__PURE__ */ jsx6("input", { value, placeholder, onChange: (event) => onChange(event.target.value), disabled: saving })
3033
+ ] });
3034
+ const setLocation = (index, patch) => setLocations((current) => current.map((item, itemIndex) => {
3035
+ if (itemIndex !== index) return patch.isPrimary ? { ...item, isPrimary: false } : item;
3036
+ return { ...item, ...patch };
3037
+ }));
3038
+ const practiceSection = /* @__PURE__ */ jsxs6("div", { children: [
3039
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3040
+ field("Practice name", identity.name, (name) => setIdentity((c) => ({ ...c, name }))),
3041
+ field("Legal name", identity.legalName, (legalName) => setIdentity((c) => ({ ...c, legalName }))),
3042
+ field("Tax ID (EIN)", identity.taxId, (taxId) => setIdentity((c) => ({ ...c, taxId })), false, "94-1234567"),
3043
+ field("Group NPI", identity.npi, (npi) => setIdentity((c) => ({ ...c, npi }))),
3044
+ field("Phone", identity.phone, (phone) => setIdentity((c) => ({ ...c, phone }))),
3045
+ field("Email", identity.email, (email) => setIdentity((c) => ({ ...c, email })))
3046
+ ] }),
3047
+ /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Billing provider (pay-to)" }),
3048
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-grid", children: [
3049
+ field("Billing provider name", provider.name, (name) => setProvider((c) => ({ ...c, name }))),
3050
+ field("Billing tax ID", provider.taxId, (taxId) => setProvider((c) => ({ ...c, taxId }))),
3051
+ field("Billing NPI", provider.npi, (npi) => setProvider((c) => ({ ...c, npi }))),
3052
+ field("Billing phone", provider.phone ?? "", (phone) => setProvider((c) => ({ ...c, phone }))),
3053
+ field("Street", provider.billingStreet ?? "", (billingStreet) => setProvider((c) => ({ ...c, billingStreet })), true),
3054
+ field("City", provider.billingCity ?? "", (billingCity) => setProvider((c) => ({ ...c, billingCity }))),
3055
+ field("State", provider.billingState ?? "", (billingState) => setProvider((c) => ({ ...c, billingState: billingState.toUpperCase().slice(0, 2) }))),
3056
+ field("ZIP", provider.billingZip ?? "", (billingZip) => setProvider((c) => ({ ...c, billingZip })))
3057
+ ] }),
3058
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3059
+ /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["practice"] ? "Saved to MindBill." : "Saved once, used on every bill." }),
3060
+ /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving, onClick: savePractice, children: saving ? "Saving\u2026" : "Save practice" })
3061
+ ] })
3062
+ ] });
3063
+ const locationsSection = /* @__PURE__ */ jsxs6("div", { children: [
3064
+ locations.map((location, index) => /* @__PURE__ */ jsxs6("div", { className: "mbob-loc", children: [
3065
+ field("Name", location.name, (name) => setLocation(index, { name })),
3066
+ field("Street", location.street, (street) => setLocation(index, { street })),
3067
+ field("City", location.city, (city) => setLocation(index, { city })),
3068
+ field("State", location.state, (state) => setLocation(index, { state: state.toUpperCase().slice(0, 2) })),
3069
+ field("ZIP", location.zip, (zip) => setLocation(index, { zip })),
3070
+ /* @__PURE__ */ jsxs6("label", { className: "mbob-primary", children: [
3071
+ /* @__PURE__ */ jsx6("input", { type: "radio", name: "mbob-primary", checked: location.isPrimary === true, onChange: () => setLocation(index, { isPrimary: true }) }),
3072
+ " Primary"
3073
+ ] }),
3074
+ /* @__PURE__ */ jsx6("button", { className: "mbob-remove", type: "button", "aria-label": "Remove location", onClick: () => setLocations((current) => current.filter((_, itemIndex) => itemIndex !== index)), children: "\xD7" })
3075
+ ] }, location.id ?? index)),
3076
+ /* @__PURE__ */ jsx6("button", { className: "mbob-add", type: "button", onClick: () => setLocations((current) => [...current, blankLocation()]), children: "+ Add location" }),
3077
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3078
+ /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["locations"] ? "Saved to MindBill." : "Where evaluations happen." }),
3079
+ /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving, onClick: saveLocations, children: saving ? "Saving\u2026" : "Save locations" })
3080
+ ] })
3081
+ ] });
3082
+ const w9Section = /* @__PURE__ */ jsxs6("div", { children: [
3083
+ profile?.w9 ? /* @__PURE__ */ jsxs6("div", { className: "mbob-w9-current", children: [
3084
+ /* @__PURE__ */ jsxs6("div", { children: [
3085
+ /* @__PURE__ */ jsx6("strong", { children: profile.w9.filename }),
3086
+ /* @__PURE__ */ jsxs6("span", { children: [
3087
+ " \xB7 added ",
3088
+ profile.w9.addDate
3089
+ ] })
3090
+ ] }),
3091
+ /* @__PURE__ */ jsx6("span", { children: "Rides on every bill automatically" })
3092
+ ] }) : null,
3093
+ /* @__PURE__ */ jsxs6("label", { className: "mbob-drop", children: [
3094
+ /* @__PURE__ */ jsx6("input", { type: "file", accept: "application/pdf,.pdf", onChange: (event) => setW9File(event.target.files?.[0] ?? null) }),
3095
+ /* @__PURE__ */ jsx6("strong", { children: w9File ? w9File.name : profile?.w9 ? "Replace the W-9 PDF" : "Drop the practice W-9 PDF here, or click to choose" }),
3096
+ /* @__PURE__ */ jsx6("span", { children: "The W-9 is auto-attached to every submission." })
3097
+ ] }),
3098
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-actions", children: [
3099
+ /* @__PURE__ */ jsx6("span", { className: "mbob-status", children: savedStep["w9"] ? "Saved to MindBill." : "" }),
3100
+ /* @__PURE__ */ jsx6("button", { className: "mbob-save", type: "button", disabled: saving || !w9File, onClick: saveW9, children: saving ? "Uploading\u2026" : "Save W-9" })
3101
+ ] })
3102
+ ] });
3103
+ const reviewSection = /* @__PURE__ */ jsxs6("div", { className: "mbob-check", children: [
3104
+ (profile?.onboarding.checklist ?? []).map((item) => /* @__PURE__ */ jsxs6("div", { className: "mbob-check-item", "data-complete": item.complete, children: [
3105
+ /* @__PURE__ */ jsx6("i", { children: item.complete ? "\u2713" : "\u2022" }),
3106
+ /* @__PURE__ */ jsx6("span", { children: item.label })
3107
+ ] }, item.id)),
3108
+ profile?.onboarding.complete ? /* @__PURE__ */ jsx6("p", { className: "mbob-done", children: "Billing setup is complete \u2014 bills submitted from your product carry this profile automatically." }) : /* @__PURE__ */ jsx6("p", { className: "mbob-status", children: "Items above complete themselves as each section is saved." })
3109
+ ] });
3110
+ const sections = { practice: practiceSection, locations: locationsSection, w9: w9Section, review: reviewSection };
3111
+ return /* @__PURE__ */ jsxs6("div", { className: `mbob ${className}`.trim(), style: { ...mindBillAppearanceStyle(appearance), ...style }, children: [
3112
+ /* @__PURE__ */ jsx6("style", { children: css4 }),
3113
+ /* @__PURE__ */ jsxs6("div", { className: "mbob-card", children: [
3114
+ /* @__PURE__ */ jsx6("div", { className: "mbob-head", children: /* @__PURE__ */ jsxs6("div", { children: [
3115
+ /* @__PURE__ */ jsx6("h2", { children: heading }),
3116
+ /* @__PURE__ */ jsx6("p", { className: "mbob-copy", children: description })
3117
+ ] }) }),
3118
+ loadError ? /* @__PURE__ */ jsx6("div", { className: "mbob-error", role: "alert", children: loadError }) : null,
3119
+ variant === "onboarding" ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
3120
+ /* @__PURE__ */ jsx6("div", { className: "mbob-steps", children: STEPS.map((item) => /* @__PURE__ */ jsxs6("button", { className: "mbob-step", type: "button", "data-active": step === item.id, "data-done": Boolean(savedStep[item.id]), onClick: () => setStep(item.id), children: [
3121
+ /* @__PURE__ */ jsx6("i", { children: savedStep[item.id] ? "\u2713" : "" }),
3122
+ item.label
3123
+ ] }, item.id)) }),
3124
+ sections[step]
3125
+ ] }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
3126
+ practiceSection,
3127
+ /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Locations" }),
3128
+ locationsSection,
3129
+ /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Practice W-9" }),
3130
+ w9Section,
3131
+ /* @__PURE__ */ jsx6("h3", { className: "mbob-subhead", children: "Checklist" }),
3132
+ reviewSection
3133
+ ] }),
3134
+ error ? /* @__PURE__ */ jsx6("div", { className: "mbob-error", role: "alert", children: error }) : null
3135
+ ] })
3136
+ ] });
3137
+ }
3138
+ function BillingSettings(props) {
3139
+ return /* @__PURE__ */ jsx6(
3140
+ OrganizationOnboarding,
3141
+ {
3142
+ heading: "Billing settings",
3143
+ description: "Practice identity, locations, and the W-9 used on every bill.",
3144
+ ...props,
3145
+ variant: "settings"
3146
+ }
3147
+ );
3148
+ }
3149
+
2879
3150
  // src/connected-bill-status.tsx
2880
3151
  import {
2881
- useCallback as useCallback2,
2882
- useEffect as useEffect4,
2883
- useMemo as useMemo5,
2884
- useRef as useRef3,
2885
- useState as useState5
3152
+ useCallback as useCallback3,
3153
+ useEffect as useEffect5,
3154
+ useMemo as useMemo6,
3155
+ useRef as useRef4,
3156
+ useState as useState6
2886
3157
  } from "react";
2887
3158
  import {
2888
3159
  DEFAULT_API_BASE_URL,
2889
3160
  DEFAULT_SESSION_ENDPOINT
2890
3161
  } from "@mindbill/browser";
2891
- import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
3162
+ import { Fragment as Fragment5, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2892
3163
  var DEFAULT_REFRESH_INTERVAL = 6e4;
2893
3164
  async function responseError(response, fallback) {
2894
3165
  const body = await response.json().catch(() => null);
@@ -3021,23 +3292,23 @@ function useBillStatus({
3021
3292
  initialData = null,
3022
3293
  fetch: fetchOverride
3023
3294
  }) {
3024
- const client = useMemo5(() => createBillStatusClient({
3295
+ const client = useMemo6(() => createBillStatusClient({
3025
3296
  billId,
3026
3297
  sessionEndpoint,
3027
3298
  ...getSession ? { getSession } : {},
3028
3299
  apiBaseUrl,
3029
3300
  ...fetchOverride ? { fetch: fetchOverride } : {}
3030
3301
  }), [apiBaseUrl, billId, fetchOverride, getSession, sessionEndpoint]);
3031
- const [data, setData] = useState5(initialData);
3032
- const [error, setError] = useState5(null);
3033
- const [isLoading, setIsLoading] = useState5(enabled && !initialData);
3034
- const [isRefreshing, setIsRefreshing] = useState5(false);
3035
- const dataRef = useRef3(initialData);
3036
- const initialDataRef = useRef3(initialData);
3302
+ const [data, setData] = useState6(initialData);
3303
+ const [error, setError] = useState6(null);
3304
+ const [isLoading, setIsLoading] = useState6(enabled && !initialData);
3305
+ const [isRefreshing, setIsRefreshing] = useState6(false);
3306
+ const dataRef = useRef4(initialData);
3307
+ const initialDataRef = useRef4(initialData);
3037
3308
  initialDataRef.current = initialData;
3038
- const activeControllerRef = useRef3(null);
3039
- const requestSequence = useRef3(0);
3040
- useEffect4(() => {
3309
+ const activeControllerRef = useRef4(null);
3310
+ const requestSequence = useRef4(0);
3311
+ useEffect5(() => {
3041
3312
  const seed = initialDataRef.current;
3042
3313
  dataRef.current = seed;
3043
3314
  setData(seed);
@@ -3046,7 +3317,7 @@ function useBillStatus({
3046
3317
  activeControllerRef.current?.abort();
3047
3318
  return () => activeControllerRef.current?.abort();
3048
3319
  }, [client, enabled]);
3049
- const load = useCallback2(async () => {
3320
+ const load = useCallback3(async () => {
3050
3321
  if (!enabled || !billId) return;
3051
3322
  const sequence = ++requestSequence.current;
3052
3323
  activeControllerRef.current?.abort();
@@ -3078,10 +3349,10 @@ function useBillStatus({
3078
3349
  }
3079
3350
  }
3080
3351
  }, [billId, client, enabled]);
3081
- useEffect4(() => {
3352
+ useEffect5(() => {
3082
3353
  if (enabled) void load();
3083
3354
  }, [enabled, load]);
3084
- useEffect4(() => {
3355
+ useEffect5(() => {
3085
3356
  if (!enabled || refreshInterval <= 0) return;
3086
3357
  const timer = window.setInterval(() => void load(), refreshInterval);
3087
3358
  const onFocus = () => void load();
@@ -3109,17 +3380,17 @@ function ConnectedBillStatus({
3109
3380
  }) {
3110
3381
  const status = useBillStatus(options);
3111
3382
  if (status.isLoading && !status.data) {
3112
- return /* @__PURE__ */ jsx6(Fragment4, { children: loadingFallback ?? /* @__PURE__ */ jsx6("div", { role: "status", children: "Loading bill status\u2026" }) });
3383
+ return /* @__PURE__ */ jsx7(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx7("div", { role: "status", children: "Loading bill status\u2026" }) });
3113
3384
  }
3114
3385
  if (status.error && !status.data) {
3115
- return /* @__PURE__ */ jsx6(Fragment4, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs6("div", { role: "alert", children: [
3386
+ return /* @__PURE__ */ jsx7(Fragment5, { children: errorFallback?.(status.error, status.refresh) ?? /* @__PURE__ */ jsxs7("div", { role: "alert", children: [
3116
3387
  status.error.message,
3117
3388
  " ",
3118
- /* @__PURE__ */ jsx6("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3389
+ /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void status.refresh(), children: "Retry" })
3119
3390
  ] }) });
3120
3391
  }
3121
3392
  if (!status.data) return null;
3122
- return /* @__PURE__ */ jsx6(
3393
+ return /* @__PURE__ */ jsx7(
3123
3394
  BillStatusSummary,
3124
3395
  {
3125
3396
  status: status.data.state,
@@ -3138,7 +3409,7 @@ function ConnectedBillStatus({
3138
3409
  }
3139
3410
 
3140
3411
  // src/bill-lifecycle-surfaces.tsx
3141
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
3412
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3142
3413
  function visibleBillLifecycleActions(actions, showUnavailable = false) {
3143
3414
  return actions.filter((action) => action.enabled || showUnavailable);
3144
3415
  }
@@ -3153,11 +3424,11 @@ function BillLifecycleActions({
3153
3424
  }) {
3154
3425
  const visible = visibleBillLifecycleActions(actions, showUnavailable);
3155
3426
  if (!visible.length) return null;
3156
- return /* @__PURE__ */ jsxs7("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3157
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3158
- visible.map((action) => /* @__PURE__ */ jsxs7("div", { className: "mb-lifecycle-action", children: [
3159
- /* @__PURE__ */ jsx7("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
3160
- !action.enabled && action.reason ? /* @__PURE__ */ jsx7("span", { className: "mb-action-reason", children: action.reason }) : null
3427
+ return /* @__PURE__ */ jsxs8("div", { className: classes("mb-lifecycle-actions", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill actions", children: [
3428
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3429
+ visible.map((action) => /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-action", children: [
3430
+ /* @__PURE__ */ jsx8("button", { type: "button", className: action.primary ? "mb-action-button is-primary" : "mb-action-button", disabled: disabled || !action.enabled, onClick: () => onAction(action), children: action.label }),
3431
+ !action.enabled && action.reason ? /* @__PURE__ */ jsx8("span", { className: "mb-action-reason", children: action.reason }) : null
3161
3432
  ] }, action.id))
3162
3433
  ] });
3163
3434
  }
@@ -3187,18 +3458,18 @@ function defaultFormatDate(createdAt) {
3187
3458
  return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(parsed);
3188
3459
  }
3189
3460
  function BillActivityTimeline({ events, emptyLabel = "No bill activity yet.", appearance, className, style, formatDate = defaultFormatDate }) {
3190
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3191
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3192
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3193
- /* @__PURE__ */ jsx7("strong", { children: "Bill history" }),
3194
- /* @__PURE__ */ jsx7("span", { children: "Submission, payer responses, follow-up, and payments." })
3461
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-activity", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill activity", children: [
3462
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3463
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3464
+ /* @__PURE__ */ jsx8("strong", { children: "Bill history" }),
3465
+ /* @__PURE__ */ jsx8("span", { children: "Submission, payer responses, follow-up, and payments." })
3195
3466
  ] }) }),
3196
- !events.length ? /* @__PURE__ */ jsx7("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx7("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs7("li", { className: "mb-activity-item", children: [
3197
- /* @__PURE__ */ jsx7("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3198
- /* @__PURE__ */ jsxs7("div", { className: "mb-activity-content", children: [
3199
- /* @__PURE__ */ jsx7("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3200
- event.description ? /* @__PURE__ */ jsx7("p", { children: event.description }) : null,
3201
- /* @__PURE__ */ jsxs7("span", { children: [
3467
+ !events.length ? /* @__PURE__ */ jsx8("p", { className: "mb-activity-empty", children: emptyLabel }) : /* @__PURE__ */ jsx8("ol", { className: "mb-activity-list", children: events.map((event) => /* @__PURE__ */ jsxs8("li", { className: "mb-activity-item", children: [
3468
+ /* @__PURE__ */ jsx8("span", { className: "mb-activity-marker", "aria-hidden": "true" }),
3469
+ /* @__PURE__ */ jsxs8("div", { className: "mb-activity-content", children: [
3470
+ /* @__PURE__ */ jsx8("strong", { children: event.title ?? billActivityEventLabel(event.type) }),
3471
+ event.description ? /* @__PURE__ */ jsx8("p", { children: event.description }) : null,
3472
+ /* @__PURE__ */ jsxs8("span", { children: [
3202
3473
  formatDate(event.createdAt),
3203
3474
  event.actor ? ` \xB7 ${event.actor}` : ""
3204
3475
  ] })
@@ -3233,20 +3504,20 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
3233
3504
  function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
3234
3505
  const current = billLifecycleStage(state);
3235
3506
  const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
3236
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
3237
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3238
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3239
- /* @__PURE__ */ jsx7("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
3240
- /* @__PURE__ */ jsxs7("span", { children: [
3507
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-progress", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
3508
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3509
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3510
+ /* @__PURE__ */ jsx8("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
3511
+ /* @__PURE__ */ jsxs8("span", { children: [
3241
3512
  submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted",
3242
3513
  typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""
3243
3514
  ] })
3244
3515
  ] }) }),
3245
- /* @__PURE__ */ jsx7("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
3516
+ /* @__PURE__ */ jsx8("ol", { className: "mb-progress-list", children: lifecycleStages.map((stage, index) => {
3246
3517
  const status = index < currentIndex ? "complete" : index === currentIndex ? "current" : "upcoming";
3247
- return /* @__PURE__ */ jsxs7("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
3248
- /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
3249
- /* @__PURE__ */ jsx7("b", { children: stage.label })
3518
+ return /* @__PURE__ */ jsxs8("li", { className: `is-${status}`, "aria-current": status === "current" ? "step" : void 0, children: [
3519
+ /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: status === "complete" ? "\u2713" : index + 1 }),
3520
+ /* @__PURE__ */ jsx8("b", { children: stage.label })
3250
3521
  ] }, stage.id);
3251
3522
  }) })
3252
3523
  ] });
@@ -3260,18 +3531,18 @@ function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, clas
3260
3531
  ["Charged", currency(bill.totalCharge)],
3261
3532
  ["Balance", currency(bill.balanceDue)]
3262
3533
  ];
3263
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
3264
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3265
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3266
- /* @__PURE__ */ jsx7("strong", { children: "Bill snapshot" }),
3267
- /* @__PURE__ */ jsxs7("span", { children: [
3534
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-snapshot", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill snapshot", children: [
3535
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3536
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3537
+ /* @__PURE__ */ jsx8("strong", { children: "Bill snapshot" }),
3538
+ /* @__PURE__ */ jsxs8("span", { children: [
3268
3539
  "Bill #",
3269
3540
  bill.billNumber
3270
3541
  ] })
3271
3542
  ] }) }),
3272
- /* @__PURE__ */ jsx7("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs7("div", { children: [
3273
- /* @__PURE__ */ jsx7("dt", { children: label }),
3274
- /* @__PURE__ */ jsx7("dd", { children: value })
3543
+ /* @__PURE__ */ jsx8("dl", { children: values.map(([label, value]) => /* @__PURE__ */ jsxs8("div", { children: [
3544
+ /* @__PURE__ */ jsx8("dt", { children: label }),
3545
+ /* @__PURE__ */ jsx8("dd", { children: value })
3275
3546
  ] }, label)) })
3276
3547
  ] });
3277
3548
  }
@@ -3286,140 +3557,140 @@ function BillExplanationOfReview({
3286
3557
  style
3287
3558
  }) {
3288
3559
  const rows = payments.length ? payments : [null];
3289
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
3290
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3291
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3292
- /* @__PURE__ */ jsx7("strong", { children: "Explanation of Review" }),
3293
- /* @__PURE__ */ jsx7("span", { children: "Payer response and payment reconciliation." })
3560
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-eor-review", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Explanation of Review and payments", children: [
3561
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3562
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3563
+ /* @__PURE__ */ jsx8("strong", { children: "Explanation of Review" }),
3564
+ /* @__PURE__ */ jsx8("span", { children: "Payer response and payment reconciliation." })
3294
3565
  ] }) }),
3295
- /* @__PURE__ */ jsxs7("dl", { className: "mb-eor-metrics", children: [
3296
- /* @__PURE__ */ jsxs7("div", { children: [
3297
- /* @__PURE__ */ jsx7("dt", { children: "Amount billed" }),
3298
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.billedAmount) })
3566
+ /* @__PURE__ */ jsxs8("dl", { className: "mb-eor-metrics", children: [
3567
+ /* @__PURE__ */ jsxs8("div", { children: [
3568
+ /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3569
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
3299
3570
  ] }),
3300
- /* @__PURE__ */ jsxs7("div", { children: [
3301
- /* @__PURE__ */ jsx7("dt", { children: "Payer allowed" }),
3302
- /* @__PURE__ */ jsx7("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3571
+ /* @__PURE__ */ jsxs8("div", { children: [
3572
+ /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3573
+ /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3303
3574
  ] }),
3304
- /* @__PURE__ */ jsxs7("div", { children: [
3305
- /* @__PURE__ */ jsx7("dt", { children: "Payer reported paid" }),
3306
- /* @__PURE__ */ jsx7("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3575
+ /* @__PURE__ */ jsxs8("div", { children: [
3576
+ /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3577
+ /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3307
3578
  ] }),
3308
- /* @__PURE__ */ jsxs7("div", { className: "is-balance", children: [
3309
- /* @__PURE__ */ jsx7("dt", { children: "Balance due" }),
3310
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.balanceDue) })
3579
+ /* @__PURE__ */ jsxs8("div", { className: "is-balance", children: [
3580
+ /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3581
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
3311
3582
  ] }),
3312
- /* @__PURE__ */ jsxs7("div", { children: [
3313
- /* @__PURE__ */ jsx7("dt", { children: "Payment posted" }),
3314
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.postedPrincipal) })
3583
+ /* @__PURE__ */ jsxs8("div", { children: [
3584
+ /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3585
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
3315
3586
  ] }),
3316
- /* @__PURE__ */ jsxs7("div", { children: [
3317
- /* @__PURE__ */ jsx7("dt", { children: "Penalty & interest" }),
3318
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.postedAdditional) })
3587
+ /* @__PURE__ */ jsxs8("div", { children: [
3588
+ /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3589
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
3319
3590
  ] }),
3320
- /* @__PURE__ */ jsxs7("div", { children: [
3321
- /* @__PURE__ */ jsx7("dt", { children: "Total received" }),
3322
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.totalPostedCash) })
3591
+ /* @__PURE__ */ jsxs8("div", { children: [
3592
+ /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3593
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
3323
3594
  ] }),
3324
- /* @__PURE__ */ jsxs7("div", { children: [
3325
- /* @__PURE__ */ jsx7("dt", { children: "Expected" }),
3326
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.expectedAmount) })
3595
+ /* @__PURE__ */ jsxs8("div", { children: [
3596
+ /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3597
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
3327
3598
  ] })
3328
3599
  ] }),
3329
- remittance.denialReason ? /* @__PURE__ */ jsxs7("div", { className: "mb-denial", children: [
3330
- /* @__PURE__ */ jsx7("strong", { children: "Denial reason" }),
3331
- /* @__PURE__ */ jsx7("p", { children: remittance.denialReason })
3600
+ remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3601
+ /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3602
+ /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
3332
3603
  ] }) : null,
3333
- /* @__PURE__ */ jsx7("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs7("table", { className: "mb-eor-table", children: [
3334
- /* @__PURE__ */ jsxs7("thead", { children: [
3335
- /* @__PURE__ */ jsxs7("tr", { className: "mb-eor-groups", children: [
3336
- /* @__PURE__ */ jsx7("th", { colSpan: 2, children: "Submission" }),
3337
- /* @__PURE__ */ jsx7("th", { colSpan: 5, children: "EOR payment information" }),
3338
- /* @__PURE__ */ jsx7("th", { colSpan: 2, children: "EOR post" }),
3339
- /* @__PURE__ */ jsx7("th", { children: "EOR" })
3604
+ /* @__PURE__ */ jsx8("div", { className: "mb-eor-table-wrap", children: /* @__PURE__ */ jsxs8("table", { className: "mb-eor-table", children: [
3605
+ /* @__PURE__ */ jsxs8("thead", { children: [
3606
+ /* @__PURE__ */ jsxs8("tr", { className: "mb-eor-groups", children: [
3607
+ /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "Submission" }),
3608
+ /* @__PURE__ */ jsx8("th", { colSpan: 5, children: "EOR payment information" }),
3609
+ /* @__PURE__ */ jsx8("th", { colSpan: 2, children: "EOR post" }),
3610
+ /* @__PURE__ */ jsx8("th", { children: "EOR" })
3340
3611
  ] }),
3341
- /* @__PURE__ */ jsxs7("tr", { children: [
3342
- /* @__PURE__ */ jsx7("th", { children: "Submission" }),
3343
- /* @__PURE__ */ jsx7("th", { children: "Submission payment" }),
3344
- /* @__PURE__ */ jsx7("th", { children: "Payment method" }),
3345
- /* @__PURE__ */ jsx7("th", { children: "Reference" }),
3346
- /* @__PURE__ */ jsx7("th", { children: "Effective date" }),
3347
- /* @__PURE__ */ jsx7("th", { children: "Payment total" }),
3348
- /* @__PURE__ */ jsx7("th", { children: "Deposit date" }),
3349
- /* @__PURE__ */ jsx7("th", { children: "Post date" }),
3350
- /* @__PURE__ */ jsx7("th", { children: "Source" }),
3351
- /* @__PURE__ */ jsx7("th", { children: "Document" })
3612
+ /* @__PURE__ */ jsxs8("tr", { children: [
3613
+ /* @__PURE__ */ jsx8("th", { children: "Submission" }),
3614
+ /* @__PURE__ */ jsx8("th", { children: "Submission payment" }),
3615
+ /* @__PURE__ */ jsx8("th", { children: "Payment method" }),
3616
+ /* @__PURE__ */ jsx8("th", { children: "Reference" }),
3617
+ /* @__PURE__ */ jsx8("th", { children: "Effective date" }),
3618
+ /* @__PURE__ */ jsx8("th", { children: "Payment total" }),
3619
+ /* @__PURE__ */ jsx8("th", { children: "Deposit date" }),
3620
+ /* @__PURE__ */ jsx8("th", { children: "Post date" }),
3621
+ /* @__PURE__ */ jsx8("th", { children: "Source" }),
3622
+ /* @__PURE__ */ jsx8("th", { children: "Document" })
3352
3623
  ] })
3353
3624
  ] }),
3354
- /* @__PURE__ */ jsx7("tbody", { children: rows.map((payment, index) => {
3625
+ /* @__PURE__ */ jsx8("tbody", { children: rows.map((payment, index) => {
3355
3626
  const eor = eors[index] ?? eors[0];
3356
- return /* @__PURE__ */ jsxs7("tr", { children: [
3357
- /* @__PURE__ */ jsxs7("td", { "data-label": "Submission", children: [
3358
- /* @__PURE__ */ jsx7("strong", { children: "Original bill" }),
3359
- submittedAt ? /* @__PURE__ */ jsxs7("span", { children: [
3627
+ return /* @__PURE__ */ jsxs8("tr", { children: [
3628
+ /* @__PURE__ */ jsxs8("td", { "data-label": "Submission", children: [
3629
+ /* @__PURE__ */ jsx8("strong", { children: "Original bill" }),
3630
+ submittedAt ? /* @__PURE__ */ jsxs8("span", { children: [
3360
3631
  "Sent ",
3361
3632
  defaultFormatDate(submittedAt)
3362
3633
  ] }) : null
3363
3634
  ] }),
3364
- /* @__PURE__ */ jsx7("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
3365
- /* @__PURE__ */ jsx7("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
3366
- /* @__PURE__ */ jsx7("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
3367
- /* @__PURE__ */ jsx7("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
3368
- /* @__PURE__ */ jsx7("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
3369
- /* @__PURE__ */ jsx7("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
3370
- /* @__PURE__ */ jsx7("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
3371
- /* @__PURE__ */ jsx7("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
3372
- /* @__PURE__ */ jsx7("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx7("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
3635
+ /* @__PURE__ */ jsx8("td", { "data-label": "Submission payment", children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) }),
3636
+ /* @__PURE__ */ jsx8("td", { "data-label": "Payment method", children: payment ? humanize(payment.method) : "\u2014" }),
3637
+ /* @__PURE__ */ jsx8("td", { "data-label": "Reference", children: payment?.checkNumber || "\u2014" }),
3638
+ /* @__PURE__ */ jsx8("td", { "data-label": "Effective date", children: payment ? payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) : "\u2014" }),
3639
+ /* @__PURE__ */ jsx8("td", { "data-label": "Payment total", children: payment ? currency(payment.amount) : currency(0) }),
3640
+ /* @__PURE__ */ jsx8("td", { "data-label": "Deposit date", children: payment?.depositDate || "Not recorded" }),
3641
+ /* @__PURE__ */ jsx8("td", { "data-label": "Post date", children: payment ? defaultFormatDate(payment.postedAt) : eor ? defaultFormatDate(eor.addedAt) : "\u2014" }),
3642
+ /* @__PURE__ */ jsx8("td", { "data-label": "Source", children: payment ? payment.source.toUpperCase() : eor ? "EOR" : "\u2014" }),
3643
+ /* @__PURE__ */ jsx8("td", { "data-label": "EOR", children: eor && onOpenEor ? /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-eor-link", onClick: () => void onOpenEor(eor), children: eor.filename }) : eor?.filename || "\u2014" })
3373
3644
  ] }, payment?.id ?? `empty-${index}`);
3374
3645
  }) })
3375
3646
  ] }) }),
3376
- eors.length > rows.length ? /* @__PURE__ */ jsx7("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
3647
+ eors.length > rows.length ? /* @__PURE__ */ jsx8("div", { className: "mb-eor-documents", children: eors.slice(rows.length).map((eor) => /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void onOpenEor?.(eor), children: eor.filename }, eor.id)) }) : null
3377
3648
  ] });
3378
3649
  }
3379
3650
  function BillRemittanceCard({ remittance, appearance, className, style }) {
3380
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
3381
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3382
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3383
- /* @__PURE__ */ jsx7("strong", { children: "Remittance" }),
3384
- /* @__PURE__ */ jsx7("span", { children: "Amounts reported by the payer and posted to the bill." })
3651
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-remittance", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Remittance summary", children: [
3652
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3653
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3654
+ /* @__PURE__ */ jsx8("strong", { children: "Remittance" }),
3655
+ /* @__PURE__ */ jsx8("span", { children: "Amounts reported by the payer and posted to the bill." })
3385
3656
  ] }) }),
3386
- /* @__PURE__ */ jsxs7("dl", { children: [
3387
- /* @__PURE__ */ jsxs7("div", { children: [
3388
- /* @__PURE__ */ jsx7("dt", { children: "Amount billed" }),
3389
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.billedAmount) })
3657
+ /* @__PURE__ */ jsxs8("dl", { children: [
3658
+ /* @__PURE__ */ jsxs8("div", { children: [
3659
+ /* @__PURE__ */ jsx8("dt", { children: "Amount billed" }),
3660
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.billedAmount) })
3390
3661
  ] }),
3391
- /* @__PURE__ */ jsxs7("div", { children: [
3392
- /* @__PURE__ */ jsx7("dt", { children: "Expected" }),
3393
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.expectedAmount) })
3662
+ /* @__PURE__ */ jsxs8("div", { children: [
3663
+ /* @__PURE__ */ jsx8("dt", { children: "Expected" }),
3664
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.expectedAmount) })
3394
3665
  ] }),
3395
- /* @__PURE__ */ jsxs7("div", { children: [
3396
- /* @__PURE__ */ jsx7("dt", { children: "Payer allowed" }),
3397
- /* @__PURE__ */ jsx7("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3666
+ /* @__PURE__ */ jsxs8("div", { children: [
3667
+ /* @__PURE__ */ jsx8("dt", { children: "Payer allowed" }),
3668
+ /* @__PURE__ */ jsx8("dd", { children: remittance.payerAllowedAmount === null ? "\u2014" : currency(remittance.payerAllowedAmount) })
3398
3669
  ] }),
3399
- /* @__PURE__ */ jsxs7("div", { children: [
3400
- /* @__PURE__ */ jsx7("dt", { children: "Payer reported paid" }),
3401
- /* @__PURE__ */ jsx7("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3670
+ /* @__PURE__ */ jsxs8("div", { children: [
3671
+ /* @__PURE__ */ jsx8("dt", { children: "Payer reported paid" }),
3672
+ /* @__PURE__ */ jsx8("dd", { children: remittance.payerReportedPaid === null ? "\u2014" : currency(remittance.payerReportedPaid) })
3402
3673
  ] }),
3403
- /* @__PURE__ */ jsxs7("div", { children: [
3404
- /* @__PURE__ */ jsx7("dt", { children: "Payment posted" }),
3405
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.postedPrincipal) })
3674
+ /* @__PURE__ */ jsxs8("div", { children: [
3675
+ /* @__PURE__ */ jsx8("dt", { children: "Payment posted" }),
3676
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedPrincipal) })
3406
3677
  ] }),
3407
- /* @__PURE__ */ jsxs7("div", { children: [
3408
- /* @__PURE__ */ jsx7("dt", { children: "Penalty & interest" }),
3409
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.postedAdditional) })
3678
+ /* @__PURE__ */ jsxs8("div", { children: [
3679
+ /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3680
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.postedAdditional) })
3410
3681
  ] }),
3411
- /* @__PURE__ */ jsxs7("div", { children: [
3412
- /* @__PURE__ */ jsx7("dt", { children: "Total received" }),
3413
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.totalPostedCash) })
3682
+ /* @__PURE__ */ jsxs8("div", { children: [
3683
+ /* @__PURE__ */ jsx8("dt", { children: "Total received" }),
3684
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.totalPostedCash) })
3414
3685
  ] }),
3415
- /* @__PURE__ */ jsxs7("div", { children: [
3416
- /* @__PURE__ */ jsx7("dt", { children: "Balance due" }),
3417
- /* @__PURE__ */ jsx7("dd", { children: currency(remittance.balanceDue) })
3686
+ /* @__PURE__ */ jsxs8("div", { children: [
3687
+ /* @__PURE__ */ jsx8("dt", { children: "Balance due" }),
3688
+ /* @__PURE__ */ jsx8("dd", { children: currency(remittance.balanceDue) })
3418
3689
  ] })
3419
3690
  ] }),
3420
- remittance.denialReason ? /* @__PURE__ */ jsxs7("div", { className: "mb-denial", children: [
3421
- /* @__PURE__ */ jsx7("strong", { children: "Denial reason" }),
3422
- /* @__PURE__ */ jsx7("p", { children: remittance.denialReason })
3691
+ remittance.denialReason ? /* @__PURE__ */ jsxs8("div", { className: "mb-denial", children: [
3692
+ /* @__PURE__ */ jsx8("strong", { children: "Denial reason" }),
3693
+ /* @__PURE__ */ jsx8("p", { children: remittance.denialReason })
3423
3694
  ] }) : null
3424
3695
  ] });
3425
3696
  }
@@ -3434,72 +3705,72 @@ function BillPayerContactCard({ delivery, appearance, className, style }) {
3434
3705
  delivery.contacts.portalUrl ? ["Portal", "Open payer portal", delivery.contacts.portalUrl] : null
3435
3706
  ].filter(Boolean);
3436
3707
  if (!delivery.payerName && !contacts.length) return null;
3437
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
3438
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3439
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3440
- /* @__PURE__ */ jsx7("strong", { children: delivery.payerName || "Claims administrator" }),
3441
- /* @__PURE__ */ jsx7("span", { children: "Billing and follow-up contacts." })
3708
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-contacts", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payer contact information", children: [
3709
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3710
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3711
+ /* @__PURE__ */ jsx8("strong", { children: delivery.payerName || "Claims administrator" }),
3712
+ /* @__PURE__ */ jsx8("span", { children: "Billing and follow-up contacts." })
3442
3713
  ] }) }),
3443
- !contacts.length ? /* @__PURE__ */ jsx7("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx7("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs7("div", { children: [
3444
- /* @__PURE__ */ jsx7("dt", { children: label }),
3445
- /* @__PURE__ */ jsx7("dd", { children: href ? /* @__PURE__ */ jsx7("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
3714
+ !contacts.length ? /* @__PURE__ */ jsx8("p", { className: "mb-empty", children: "No payer contact details are available." }) : /* @__PURE__ */ jsx8("dl", { children: contacts.map(([label, value, href]) => /* @__PURE__ */ jsxs8("div", { children: [
3715
+ /* @__PURE__ */ jsx8("dt", { children: label }),
3716
+ /* @__PURE__ */ jsx8("dd", { children: href ? /* @__PURE__ */ jsx8("a", { href, target: label === "Portal" ? "_blank" : void 0, rel: label === "Portal" ? "noreferrer noopener" : void 0, children: value }) : value })
3446
3717
  ] }, label)) })
3447
3718
  ] });
3448
3719
  }
3449
3720
  function BillPaymentLedger({ payments, appearance, className, style }) {
3450
- return /* @__PURE__ */ jsxs7("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
3451
- /* @__PURE__ */ jsx7("style", { children: lifecycleSurfaceStyles }),
3452
- /* @__PURE__ */ jsx7("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs7("div", { children: [
3453
- /* @__PURE__ */ jsx7("strong", { children: "Payments" }),
3454
- /* @__PURE__ */ jsx7("span", { children: "Funds recorded against this bill." })
3721
+ return /* @__PURE__ */ jsxs8("section", { className: classes("mb-surface mb-payments", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Payment ledger", children: [
3722
+ /* @__PURE__ */ jsx8("style", { children: lifecycleSurfaceStyles }),
3723
+ /* @__PURE__ */ jsx8("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs8("div", { children: [
3724
+ /* @__PURE__ */ jsx8("strong", { children: "Payments" }),
3725
+ /* @__PURE__ */ jsx8("span", { children: "Funds recorded against this bill." })
3455
3726
  ] }) }),
3456
- !payments.length ? /* @__PURE__ */ jsx7("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx7("div", { className: "mb-payment-list", children: payments.map((payment) => {
3727
+ !payments.length ? /* @__PURE__ */ jsx8("p", { className: "mb-empty", children: "No payments posted." }) : /* @__PURE__ */ jsx8("div", { className: "mb-payment-list", children: payments.map((payment) => {
3457
3728
  const additional = payment.feeAmount ?? 0;
3458
- return /* @__PURE__ */ jsxs7("article", { children: [
3459
- /* @__PURE__ */ jsxs7("div", { className: "mb-payment-amount", children: [
3460
- /* @__PURE__ */ jsx7("strong", { children: currency(payment.amount) }),
3461
- /* @__PURE__ */ jsx7("span", { children: "Total received" })
3729
+ return /* @__PURE__ */ jsxs8("article", { children: [
3730
+ /* @__PURE__ */ jsxs8("div", { className: "mb-payment-amount", children: [
3731
+ /* @__PURE__ */ jsx8("strong", { children: currency(payment.amount) }),
3732
+ /* @__PURE__ */ jsx8("span", { children: "Total received" })
3462
3733
  ] }),
3463
- /* @__PURE__ */ jsxs7("dl", { children: [
3464
- /* @__PURE__ */ jsxs7("div", { children: [
3465
- /* @__PURE__ */ jsx7("dt", { children: "Applied to bill" }),
3466
- /* @__PURE__ */ jsx7("dd", { children: currency(payment.principalAmount) })
3734
+ /* @__PURE__ */ jsxs8("dl", { children: [
3735
+ /* @__PURE__ */ jsxs8("div", { children: [
3736
+ /* @__PURE__ */ jsx8("dt", { children: "Applied to bill" }),
3737
+ /* @__PURE__ */ jsx8("dd", { children: currency(payment.principalAmount) })
3467
3738
  ] }),
3468
- additional > 0 ? /* @__PURE__ */ jsxs7("div", { children: [
3469
- /* @__PURE__ */ jsx7("dt", { children: "Penalty & interest" }),
3470
- /* @__PURE__ */ jsx7("dd", { children: currency(additional) })
3739
+ additional > 0 ? /* @__PURE__ */ jsxs8("div", { children: [
3740
+ /* @__PURE__ */ jsx8("dt", { children: "Penalty & interest" }),
3741
+ /* @__PURE__ */ jsx8("dd", { children: currency(additional) })
3471
3742
  ] }) : null,
3472
- /* @__PURE__ */ jsxs7("div", { children: [
3473
- /* @__PURE__ */ jsx7("dt", { children: "Method" }),
3474
- /* @__PURE__ */ jsx7("dd", { children: payment.method.toUpperCase() })
3743
+ /* @__PURE__ */ jsxs8("div", { children: [
3744
+ /* @__PURE__ */ jsx8("dt", { children: "Method" }),
3745
+ /* @__PURE__ */ jsx8("dd", { children: payment.method.toUpperCase() })
3475
3746
  ] }),
3476
- /* @__PURE__ */ jsxs7("div", { children: [
3477
- /* @__PURE__ */ jsx7("dt", { children: "Reference" }),
3478
- /* @__PURE__ */ jsx7("dd", { children: payment.checkNumber || "\u2014" })
3747
+ /* @__PURE__ */ jsxs8("div", { children: [
3748
+ /* @__PURE__ */ jsx8("dt", { children: "Reference" }),
3749
+ /* @__PURE__ */ jsx8("dd", { children: payment.checkNumber || "\u2014" })
3479
3750
  ] }),
3480
- /* @__PURE__ */ jsxs7("div", { children: [
3481
- /* @__PURE__ */ jsx7("dt", { children: "Effective date" }),
3482
- /* @__PURE__ */ jsx7("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
3751
+ /* @__PURE__ */ jsxs8("div", { children: [
3752
+ /* @__PURE__ */ jsx8("dt", { children: "Effective date" }),
3753
+ /* @__PURE__ */ jsx8("dd", { children: payment.receivedDate || payment.depositDate || defaultFormatDate(payment.postedAt) })
3483
3754
  ] }),
3484
- /* @__PURE__ */ jsxs7("div", { children: [
3485
- /* @__PURE__ */ jsx7("dt", { children: "Deposit date" }),
3486
- /* @__PURE__ */ jsx7("dd", { children: payment.depositDate || "Not recorded" })
3755
+ /* @__PURE__ */ jsxs8("div", { children: [
3756
+ /* @__PURE__ */ jsx8("dt", { children: "Deposit date" }),
3757
+ /* @__PURE__ */ jsx8("dd", { children: payment.depositDate || "Not recorded" })
3487
3758
  ] }),
3488
- /* @__PURE__ */ jsxs7("div", { children: [
3489
- /* @__PURE__ */ jsx7("dt", { children: "Posted" }),
3490
- /* @__PURE__ */ jsxs7("dd", { children: [
3759
+ /* @__PURE__ */ jsxs8("div", { children: [
3760
+ /* @__PURE__ */ jsx8("dt", { children: "Posted" }),
3761
+ /* @__PURE__ */ jsxs8("dd", { children: [
3491
3762
  defaultFormatDate(payment.postedAt),
3492
3763
  " \xB7 ",
3493
3764
  payment.source.toUpperCase()
3494
3765
  ] })
3495
3766
  ] }),
3496
- /* @__PURE__ */ jsxs7("div", { children: [
3497
- /* @__PURE__ */ jsx7("dt", { children: "Status" }),
3498
- /* @__PURE__ */ jsx7("dd", { children: humanize(payment.status || "posted") })
3767
+ /* @__PURE__ */ jsxs8("div", { children: [
3768
+ /* @__PURE__ */ jsx8("dt", { children: "Status" }),
3769
+ /* @__PURE__ */ jsx8("dd", { children: humanize(payment.status || "posted") })
3499
3770
  ] })
3500
3771
  ] }),
3501
- payment.feeReason ? /* @__PURE__ */ jsx7("p", { children: payment.feeReason }) : null,
3502
- payment.note ? /* @__PURE__ */ jsx7("p", { children: payment.note }) : null
3772
+ payment.feeReason ? /* @__PURE__ */ jsx8("p", { children: payment.feeReason }) : null,
3773
+ payment.note ? /* @__PURE__ */ jsx8("p", { children: payment.note }) : null
3503
3774
  ] }, payment.id);
3504
3775
  }) })
3505
3776
  ] });
@@ -3528,11 +3799,11 @@ var lifecycleSurfaceStyles = `
3528
3799
 
3529
3800
  // src/connected-bill-lifecycle.tsx
3530
3801
  import {
3531
- useCallback as useCallback3,
3532
- useEffect as useEffect5,
3533
- useMemo as useMemo6,
3534
- useRef as useRef4,
3535
- useState as useState6
3802
+ useCallback as useCallback4,
3803
+ useEffect as useEffect6,
3804
+ useMemo as useMemo7,
3805
+ useRef as useRef5,
3806
+ useState as useState7
3536
3807
  } from "react";
3537
3808
  import {
3538
3809
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
@@ -3540,7 +3811,7 @@ import {
3540
3811
  createBillLifecycleClient
3541
3812
  } from "@mindbill/browser";
3542
3813
  import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
3543
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3814
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3544
3815
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
3545
3816
  function reservePreviewWindow() {
3546
3817
  const preview = window.open("about:blank", "_blank");
@@ -3587,32 +3858,32 @@ function useBillLifecycle({
3587
3858
  enabled = true,
3588
3859
  fetch: fetchOverride
3589
3860
  }) {
3590
- const [data, setData] = useState6(null);
3591
- const [error, setError] = useState6(null);
3592
- const [isLoading, setIsLoading] = useState6(enabled);
3593
- const [isRefreshing, setIsRefreshing] = useState6(false);
3594
- const [isMutating, setIsMutating] = useState6(false);
3595
- const mounted = useRef4(true);
3596
- const client = useMemo6(() => createBillLifecycleClient({
3861
+ const [data, setData] = useState7(null);
3862
+ const [error, setError] = useState7(null);
3863
+ const [isLoading, setIsLoading] = useState7(enabled);
3864
+ const [isRefreshing, setIsRefreshing] = useState7(false);
3865
+ const [isMutating, setIsMutating] = useState7(false);
3866
+ const mounted = useRef5(true);
3867
+ const client = useMemo7(() => createBillLifecycleClient({
3597
3868
  billId: providedBillId,
3598
3869
  sessionEndpoint,
3599
3870
  getSession,
3600
3871
  apiBaseUrl,
3601
3872
  fetch: fetchOverride
3602
3873
  }), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
3603
- useEffect5(() => {
3874
+ useEffect6(() => {
3604
3875
  setData(null);
3605
3876
  setError(null);
3606
3877
  setIsLoading(enabled);
3607
3878
  }, [enabled, providedBillId]);
3608
- useEffect5(() => {
3879
+ useEffect6(() => {
3609
3880
  mounted.current = true;
3610
3881
  return () => {
3611
3882
  mounted.current = false;
3612
3883
  client.clearSession();
3613
3884
  };
3614
3885
  }, [client]);
3615
- const refresh = useCallback3(async () => {
3886
+ const refresh = useCallback4(async () => {
3616
3887
  if (!enabled) return;
3617
3888
  setIsRefreshing(true);
3618
3889
  try {
@@ -3629,7 +3900,7 @@ function useBillLifecycle({
3629
3900
  }
3630
3901
  }
3631
3902
  }, [client, enabled]);
3632
- useEffect5(() => {
3903
+ useEffect6(() => {
3633
3904
  if (!enabled) return;
3634
3905
  void refresh();
3635
3906
  const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
@@ -3640,7 +3911,7 @@ function useBillLifecycle({
3640
3911
  window.removeEventListener("focus", onFocus);
3641
3912
  };
3642
3913
  }, [enabled, refresh, refreshInterval]);
3643
- const mutate = useCallback3(async (task) => {
3914
+ const mutate = useCallback4(async (task) => {
3644
3915
  setIsMutating(true);
3645
3916
  setError(null);
3646
3917
  try {
@@ -3655,13 +3926,13 @@ function useBillLifecycle({
3655
3926
  if (mounted.current) setIsMutating(false);
3656
3927
  }
3657
3928
  }, []);
3658
- const openAttachment = useCallback3(async (attachment) => {
3929
+ const openAttachment = useCallback4(async (attachment) => {
3659
3930
  await openPdfFromUserGesture(() => client.getAttachment(attachment.id));
3660
3931
  }, [client]);
3661
- const openEor = useCallback3(async (document2) => {
3932
+ const openEor = useCallback4(async (document2) => {
3662
3933
  await openPdfFromUserGesture(() => client.getEor(document2.id));
3663
3934
  }, [client]);
3664
- const downloadPacket = useCallback3(async () => {
3935
+ const downloadPacket = useCallback4(async () => {
3665
3936
  setError(null);
3666
3937
  try {
3667
3938
  await openPdfFromUserGesture(() => client.getPacket());
@@ -3693,8 +3964,8 @@ function useBillLifecycle({
3693
3964
  };
3694
3965
  }
3695
3966
  function LifecycleDialog({ children, title, onClose }) {
3696
- const dialog = useRef4(null);
3697
- useEffect5(() => {
3967
+ const dialog = useRef5(null);
3968
+ useEffect6(() => {
3698
3969
  const previous = document.activeElement;
3699
3970
  dialog.current?.focus();
3700
3971
  const onKeyDown = (event) => event.key === "Escape" && onClose();
@@ -3704,8 +3975,8 @@ function LifecycleDialog({ children, title, onClose }) {
3704
3975
  previous?.focus();
3705
3976
  };
3706
3977
  }, [onClose]);
3707
- return /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs8("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
3708
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
3978
+ return /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs9("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
3979
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
3709
3980
  children
3710
3981
  ] }) });
3711
3982
  }
@@ -3738,14 +4009,14 @@ function shouldShowSandboxControls(environment, enabled = false) {
3738
4009
  function ConnectedBillLifecycle({ appearance, sandboxControls = false, className, style, loadingFallback, errorFallback, onChanged, ...options }) {
3739
4010
  const lifecycle = useBillLifecycle(options);
3740
4011
  const { data } = lifecycle;
3741
- const [tab, setTab] = useState6("details");
3742
- const [panel, setPanel] = useState6("");
3743
- const [notice, setNotice] = useState6("");
3744
- const [reason, setReason] = useState6("");
3745
- const [payment, setPayment] = useState6({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
3746
- const [review, setReview] = useState6({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
3747
- const lastData = useRef4(null);
3748
- useEffect5(() => {
4012
+ const [tab, setTab] = useState7("details");
4013
+ const [panel, setPanel] = useState7("");
4014
+ const [notice, setNotice] = useState7("");
4015
+ const [reason, setReason] = useState7("");
4016
+ const [payment, setPayment] = useState7({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
4017
+ const [review, setReview] = useState7({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
4018
+ const lastData = useRef5(null);
4019
+ useEffect6(() => {
3749
4020
  if (!data || data === lastData.current) return;
3750
4021
  lastData.current = data;
3751
4022
  onChanged?.(data);
@@ -3762,13 +4033,13 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
3762
4033
  attachmentIds: current.attachmentIds.length ? current.attachmentIds.filter((id) => data.bill.attachments.some((document2) => document2.id === id)) : data.bill.attachments.map((document2) => document2.id)
3763
4034
  }));
3764
4035
  }, [data, onChanged]);
3765
- if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx8(Fragment5, { children: loadingFallback ?? /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
4036
+ if (lifecycle.isLoading && !data) return /* @__PURE__ */ jsx9(Fragment6, { children: loadingFallback ?? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-loading", children: "Loading bill\u2026" }) });
3766
4037
  if (!data) {
3767
4038
  const error = lifecycle.error ?? new Error("Bill could not be loaded.");
3768
- return /* @__PURE__ */ jsx8(Fragment5, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-error", role: "alert", children: [
3769
- /* @__PURE__ */ jsx8("strong", { children: "Billing is unavailable." }),
3770
- /* @__PURE__ */ jsx8("span", { children: error.message }),
3771
- /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
4039
+ return /* @__PURE__ */ jsx9(Fragment6, { children: errorFallback?.(error, lifecycle.refresh) ?? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-error", role: "alert", children: [
4040
+ /* @__PURE__ */ jsx9("strong", { children: "Billing is unavailable." }),
4041
+ /* @__PURE__ */ jsx9("span", { children: error.message }),
4042
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.refresh(), children: "Try again" })
3772
4043
  ] }) });
3773
4044
  }
3774
4045
  const complete = async (message, task) => {
@@ -3786,170 +4057,170 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
3786
4057
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
3787
4058
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
3788
4059
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
3789
- return /* @__PURE__ */ jsxs8("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
3790
- /* @__PURE__ */ jsx8("style", { children: CONNECTED_LIFECYCLE_STYLES }),
3791
- /* @__PURE__ */ jsx8(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
3792
- /* @__PURE__ */ jsxs8("header", { className: "mb-lifecycle-head", children: [
3793
- /* @__PURE__ */ jsxs8("div", { children: [
3794
- /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs8("h2", { children: [
4060
+ return /* @__PURE__ */ jsxs9("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
4061
+ /* @__PURE__ */ jsx9("style", { children: CONNECTED_LIFECYCLE_STYLES }),
4062
+ /* @__PURE__ */ jsx9(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
4063
+ /* @__PURE__ */ jsxs9("header", { className: "mb-lifecycle-head", children: [
4064
+ /* @__PURE__ */ jsxs9("div", { children: [
4065
+ /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-title", children: /* @__PURE__ */ jsxs9("h2", { children: [
3795
4066
  "Bill #",
3796
4067
  data.bill.billNumber
3797
4068
  ] }) }),
3798
- /* @__PURE__ */ jsxs8("p", { children: [
4069
+ /* @__PURE__ */ jsxs9("p", { children: [
3799
4070
  "Claim ",
3800
4071
  data.injury.claimNumber || "\u2014",
3801
4072
  lifecycle.isRefreshing ? " \xB7 Refreshing\u2026" : ""
3802
4073
  ] })
3803
4074
  ] }),
3804
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
4075
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void lifecycle.downloadPacket().catch(() => void 0), children: "Download packet" })
3805
4076
  ] }),
3806
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
3807
- /* @__PURE__ */ jsx8("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
3808
- /* @__PURE__ */ jsx8("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
4077
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabs", role: "tablist", "aria-label": "Bill view", children: [
4078
+ /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "details", onClick: () => setTab("details"), children: "Bill details" }),
4079
+ /* @__PURE__ */ jsx9("button", { type: "button", role: "tab", "aria-selected": tab === "history", onClick: () => setTab("history"), children: "Bill history" })
3809
4080
  ] }),
3810
- tab === "details" ? /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
3811
- data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx8(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
3812
- showSandboxControls ? /* @__PURE__ */ jsxs8("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
3813
- /* @__PURE__ */ jsxs8("div", { children: [
3814
- /* @__PURE__ */ jsx8("span", { children: "Sandbox demo controls" }),
3815
- /* @__PURE__ */ jsx8("h3", { children: "Simulate the next payer response" }),
3816
- /* @__PURE__ */ jsx8("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
4081
+ tab === "details" ? /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: [
4082
+ data.eors.length || data.payments.length || ["processed", "denied", "partially_paid"].includes(data.lifecycle.state) ? /* @__PURE__ */ jsx9(BillExplanationOfReview, { remittance: data.remittance, eors: data.eors, payments: data.payments, submittedAt: data.lifecycle.submittedAt ?? null, onOpenEor: lifecycle.openEor, ...appearance ? { appearance } : {} }) : null,
4083
+ showSandboxControls ? /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-simulator", "aria-label": "Sandbox lifecycle simulator", children: [
4084
+ /* @__PURE__ */ jsxs9("div", { children: [
4085
+ /* @__PURE__ */ jsx9("span", { children: "Sandbox demo controls" }),
4086
+ /* @__PURE__ */ jsx9("h3", { children: "Simulate the next payer response" }),
4087
+ /* @__PURE__ */ jsx9("p", { children: "This changes sandbox data only. The host receives the result through the same lifecycle API and components partners use." })
3817
4088
  ] }),
3818
- simulations.length ? /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs8("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
3819
- /* @__PURE__ */ jsx8("strong", { children: scenario.label }),
3820
- /* @__PURE__ */ jsx8("span", { children: scenario.detail })
3821
- ] }, scenario.id)) }) : /* @__PURE__ */ jsx8("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
4089
+ simulations.length ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-simulator-actions", children: simulations.map((scenario) => /* @__PURE__ */ jsxs9("button", { type: "button", disabled: lifecycle.isMutating, onClick: () => void complete(`${scenario.label} simulated.`, () => lifecycle.simulateSandbox({ scenario: scenario.id })), children: [
4090
+ /* @__PURE__ */ jsx9("strong", { children: scenario.label }),
4091
+ /* @__PURE__ */ jsx9("span", { children: scenario.detail })
4092
+ ] }, scenario.id)) }) : /* @__PURE__ */ jsx9("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
3822
4093
  ] }) : null,
3823
- /* @__PURE__ */ jsx8(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
3824
- ] }) : /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx8(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
3825
- viewEor || actions.length ? /* @__PURE__ */ jsxs8("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
3826
- viewEor && data.eors[0] ? /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
3827
- actions.map((action) => /* @__PURE__ */ jsx8("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
4094
+ /* @__PURE__ */ jsx9(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
4095
+ ] }) : /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: /* @__PURE__ */ jsx9(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
4096
+ viewEor || actions.length ? /* @__PURE__ */ jsxs9("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
4097
+ viewEor && data.eors[0] ? /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
4098
+ actions.map((action) => /* @__PURE__ */ jsx9("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
3828
4099
  const next = actionPanel(action);
3829
4100
  if (next) setPanel(next);
3830
4101
  }, children: action.label }, action.id))
3831
4102
  ] }) : null,
3832
- panel === "resubmit" ? /* @__PURE__ */ jsx8(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs8("section", { className: "mb-lifecycle-panel", children: [
3833
- /* @__PURE__ */ jsxs8("div", { children: [
3834
- /* @__PURE__ */ jsx8("h3", { children: "Correct and resubmit" }),
3835
- /* @__PURE__ */ jsx8("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
4103
+ panel === "resubmit" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4104
+ /* @__PURE__ */ jsxs9("div", { children: [
4105
+ /* @__PURE__ */ jsx9("h3", { children: "Correct and resubmit" }),
4106
+ /* @__PURE__ */ jsx9("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
3836
4107
  ] }),
3837
- /* @__PURE__ */ jsxs8("label", { children: [
3838
- /* @__PURE__ */ jsx8("span", { children: "Correction note (optional)" }),
3839
- /* @__PURE__ */ jsx8("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
4108
+ /* @__PURE__ */ jsxs9("label", { children: [
4109
+ /* @__PURE__ */ jsx9("span", { children: "Correction note (optional)" }),
4110
+ /* @__PURE__ */ jsx9("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
3840
4111
  ] }),
3841
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-panel-actions", children: [
3842
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3843
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
4112
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4113
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4114
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
3844
4115
  ] })
3845
4116
  ] }) }) : null,
3846
- panel === "second_review" ? /* @__PURE__ */ jsx8(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs8("section", { className: "mb-lifecycle-panel", children: [
3847
- /* @__PURE__ */ jsxs8("div", { children: [
3848
- /* @__PURE__ */ jsx8("h3", { children: "Submit Second Review" }),
3849
- /* @__PURE__ */ jsx8("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
4117
+ panel === "second_review" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4118
+ /* @__PURE__ */ jsxs9("div", { children: [
4119
+ /* @__PURE__ */ jsx9("h3", { children: "Submit Second Review" }),
4120
+ /* @__PURE__ */ jsx9("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
3850
4121
  ] }),
3851
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-fields two", children: [
3852
- /* @__PURE__ */ jsxs8("label", { className: "full", children: [
3853
- /* @__PURE__ */ jsx8("span", { children: "Reason" }),
3854
- /* @__PURE__ */ jsx8("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
4122
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4123
+ /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4124
+ /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4125
+ /* @__PURE__ */ jsx9("textarea", { required: true, value: review.reason, onChange: (event) => setReview((current) => ({ ...current, reason: event.target.value })) })
3855
4126
  ] }),
3856
- /* @__PURE__ */ jsxs8("label", { children: [
3857
- /* @__PURE__ */ jsx8("span", { children: "Payer claim control number" }),
3858
- /* @__PURE__ */ jsx8("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
4127
+ /* @__PURE__ */ jsxs9("label", { children: [
4128
+ /* @__PURE__ */ jsx9("span", { children: "Payer claim control number" }),
4129
+ /* @__PURE__ */ jsx9("input", { required: true, value: review.payerClaimControlNumber, onChange: (event) => setReview((current) => ({ ...current, payerClaimControlNumber: event.target.value })) })
3859
4130
  ] }),
3860
- /* @__PURE__ */ jsxs8("label", { children: [
3861
- /* @__PURE__ */ jsx8("span", { children: "Disputed amount" }),
3862
- /* @__PURE__ */ jsx8("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
4131
+ /* @__PURE__ */ jsxs9("label", { children: [
4132
+ /* @__PURE__ */ jsx9("span", { children: "Disputed amount" }),
4133
+ /* @__PURE__ */ jsx9("input", { type: "number", min: "0.01", step: "0.01", value: review.disputedAmount ?? "", onChange: (event) => setReview((current) => ({ ...current, disputedAmount: event.target.value ? Number(event.target.value) : void 0 })) })
3863
4134
  ] }),
3864
- /* @__PURE__ */ jsxs8("label", { children: [
3865
- /* @__PURE__ */ jsx8("span", { children: "Send via" }),
3866
- /* @__PURE__ */ jsxs8("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
3867
- /* @__PURE__ */ jsx8("option", { value: "ebill", children: "E-bill" }),
3868
- /* @__PURE__ */ jsx8("option", { value: "fax", children: "Fax" }),
3869
- /* @__PURE__ */ jsx8("option", { value: "mail", children: "Mail" }),
3870
- /* @__PURE__ */ jsx8("option", { value: "email", children: "Email" })
4135
+ /* @__PURE__ */ jsxs9("label", { children: [
4136
+ /* @__PURE__ */ jsx9("span", { children: "Send via" }),
4137
+ /* @__PURE__ */ jsxs9("select", { value: review.route, onChange: (event) => setReview((current) => ({ ...current, route: event.target.value })), children: [
4138
+ /* @__PURE__ */ jsx9("option", { value: "ebill", children: "E-bill" }),
4139
+ /* @__PURE__ */ jsx9("option", { value: "fax", children: "Fax" }),
4140
+ /* @__PURE__ */ jsx9("option", { value: "mail", children: "Mail" }),
4141
+ /* @__PURE__ */ jsx9("option", { value: "email", children: "Email" })
3871
4142
  ] })
3872
4143
  ] })
3873
4144
  ] }),
3874
- /* @__PURE__ */ jsxs8("fieldset", { className: "mb-lifecycle-packet", children: [
3875
- /* @__PURE__ */ jsx8("legend", { children: "Supporting packet" }),
3876
- data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs8("label", { children: [
3877
- /* @__PURE__ */ jsx8("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
3878
- /* @__PURE__ */ jsxs8("span", { children: [
3879
- /* @__PURE__ */ jsx8("strong", { children: attachment.filename }),
3880
- /* @__PURE__ */ jsx8("small", { children: attachment.description || attachment.documentType })
4145
+ /* @__PURE__ */ jsxs9("fieldset", { className: "mb-lifecycle-packet", children: [
4146
+ /* @__PURE__ */ jsx9("legend", { children: "Supporting packet" }),
4147
+ data.bill.attachments.map((attachment) => /* @__PURE__ */ jsxs9("label", { children: [
4148
+ /* @__PURE__ */ jsx9("input", { type: "checkbox", checked: review.attachmentIds.includes(attachment.id), onChange: (event) => setReview((current) => ({ ...current, attachmentIds: event.target.checked ? [...current.attachmentIds, attachment.id] : current.attachmentIds.filter((id) => id !== attachment.id) })) }),
4149
+ /* @__PURE__ */ jsxs9("span", { children: [
4150
+ /* @__PURE__ */ jsx9("strong", { children: attachment.filename }),
4151
+ /* @__PURE__ */ jsx9("small", { children: attachment.description || attachment.documentType })
3881
4152
  ] }),
3882
- /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
4153
+ /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => void lifecycle.openAttachment(attachment).catch(() => void 0), children: "View" })
3883
4154
  ] }, attachment.id))
3884
4155
  ] }),
3885
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-panel-actions", children: [
3886
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3887
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
4156
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4157
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4158
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !review.reason.trim() || !review.payerClaimControlNumber.trim(), onClick: () => void complete("Second Review submitted.", () => lifecycle.submitSecondReview(review)), children: lifecycle.isMutating ? "Submitting\u2026" : "Submit Second Review" })
3888
4159
  ] })
3889
4160
  ] }) }) : null,
3890
- panel === "payment" ? /* @__PURE__ */ jsx8(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs8("section", { className: "mb-lifecycle-panel", children: [
3891
- /* @__PURE__ */ jsxs8("div", { children: [
3892
- /* @__PURE__ */ jsx8("h3", { children: "Post payment" }),
3893
- /* @__PURE__ */ jsx8("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
4161
+ panel === "payment" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: "Post payment", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4162
+ /* @__PURE__ */ jsxs9("div", { children: [
4163
+ /* @__PURE__ */ jsx9("h3", { children: "Post payment" }),
4164
+ /* @__PURE__ */ jsx9("p", { children: "Record a full or partial payment, plus any penalty and interest received." })
3894
4165
  ] }),
3895
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-fields two", children: [
3896
- /* @__PURE__ */ jsxs8("label", { children: [
3897
- /* @__PURE__ */ jsx8("span", { children: "Amount applied to bill" }),
3898
- /* @__PURE__ */ jsx8("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) })) })
4166
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-fields two", children: [
4167
+ /* @__PURE__ */ jsxs9("label", { children: [
4168
+ /* @__PURE__ */ jsx9("span", { children: "Amount applied to bill" }),
4169
+ /* @__PURE__ */ jsx9("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) })) })
3899
4170
  ] }),
3900
- /* @__PURE__ */ jsxs8("label", { children: [
3901
- /* @__PURE__ */ jsx8("span", { children: "Penalty" }),
3902
- /* @__PURE__ */ jsx8("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
4171
+ /* @__PURE__ */ jsxs9("label", { children: [
4172
+ /* @__PURE__ */ jsx9("span", { children: "Penalty" }),
4173
+ /* @__PURE__ */ jsx9("input", { type: "number", min: "0", step: "0.01", value: payment.penaltyAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, penaltyAmount: Number(event.target.value) })) })
3903
4174
  ] }),
3904
- /* @__PURE__ */ jsxs8("label", { children: [
3905
- /* @__PURE__ */ jsx8("span", { children: "Interest" }),
3906
- /* @__PURE__ */ jsx8("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
4175
+ /* @__PURE__ */ jsxs9("label", { children: [
4176
+ /* @__PURE__ */ jsx9("span", { children: "Interest" }),
4177
+ /* @__PURE__ */ jsx9("input", { type: "number", min: "0", step: "0.01", value: payment.interestAmount || "", placeholder: "0.00", onChange: (event) => setPayment((current) => ({ ...current, interestAmount: Number(event.target.value) })) })
3907
4178
  ] }),
3908
- /* @__PURE__ */ jsxs8("label", { children: [
3909
- /* @__PURE__ */ jsx8("span", { children: "Method" }),
3910
- /* @__PURE__ */ jsxs8("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
3911
- /* @__PURE__ */ jsx8("option", { value: "check", children: "Check" }),
3912
- /* @__PURE__ */ jsx8("option", { value: "eft", children: "EFT" })
4179
+ /* @__PURE__ */ jsxs9("label", { children: [
4180
+ /* @__PURE__ */ jsx9("span", { children: "Method" }),
4181
+ /* @__PURE__ */ jsxs9("select", { value: payment.method, onChange: (event) => setPayment((current) => ({ ...current, method: event.target.value })), children: [
4182
+ /* @__PURE__ */ jsx9("option", { value: "check", children: "Check" }),
4183
+ /* @__PURE__ */ jsx9("option", { value: "eft", children: "EFT" })
3913
4184
  ] })
3914
4185
  ] }),
3915
- /* @__PURE__ */ jsxs8("label", { children: [
3916
- /* @__PURE__ */ jsx8("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
3917
- /* @__PURE__ */ jsx8("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
4186
+ /* @__PURE__ */ jsxs9("label", { children: [
4187
+ /* @__PURE__ */ jsx9("span", { children: payment.method === "check" ? "Check number" : "EFT reference" }),
4188
+ /* @__PURE__ */ jsx9("input", { value: payment.checkNumber, onChange: (event) => setPayment((current) => ({ ...current, checkNumber: event.target.value })) })
3918
4189
  ] }),
3919
- /* @__PURE__ */ jsxs8("label", { children: [
3920
- /* @__PURE__ */ jsx8("span", { children: "Deposit date" }),
3921
- /* @__PURE__ */ jsx8("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
4190
+ /* @__PURE__ */ jsxs9("label", { children: [
4191
+ /* @__PURE__ */ jsx9("span", { children: "Deposit date" }),
4192
+ /* @__PURE__ */ jsx9("input", { required: true, value: payment.depositDate, placeholder: "MM/DD/YYYY", onChange: (event) => setPayment((current) => ({ ...current, depositDate: event.target.value })) })
3922
4193
  ] }),
3923
- /* @__PURE__ */ jsxs8("label", { className: "full", children: [
3924
- /* @__PURE__ */ jsx8("span", { children: "Note (optional)" }),
3925
- /* @__PURE__ */ jsx8("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
4194
+ /* @__PURE__ */ jsxs9("label", { className: "full", children: [
4195
+ /* @__PURE__ */ jsx9("span", { children: "Note (optional)" }),
4196
+ /* @__PURE__ */ jsx9("input", { value: payment.note, onChange: (event) => setPayment((current) => ({ ...current, note: event.target.value })) })
3926
4197
  ] })
3927
4198
  ] }),
3928
- /* @__PURE__ */ jsxs8("div", { className: "mb-payment-total", children: [
3929
- /* @__PURE__ */ jsx8("span", { children: "Total received" }),
3930
- /* @__PURE__ */ jsx8("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
4199
+ /* @__PURE__ */ jsxs9("div", { className: "mb-payment-total", children: [
4200
+ /* @__PURE__ */ jsx9("span", { children: "Total received" }),
4201
+ /* @__PURE__ */ jsx9("strong", { children: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format(payment.amount + (payment.penaltyAmount ?? 0) + (payment.interestAmount ?? 0)) })
3931
4202
  ] }),
3932
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-panel-actions", children: [
3933
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3934
- /* @__PURE__ */ jsx8("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)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
4203
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4204
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4205
+ /* @__PURE__ */ jsx9("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)), children: lifecycle.isMutating ? "Posting\u2026" : "Post payment" })
3935
4206
  ] })
3936
4207
  ] }) }) : null,
3937
- panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx8(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs8("section", { className: "mb-lifecycle-panel", children: [
3938
- /* @__PURE__ */ jsxs8("div", { children: [
3939
- /* @__PURE__ */ jsx8("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
3940
- /* @__PURE__ */ jsx8("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
4208
+ panel === "close" || panel === "reopen" ? /* @__PURE__ */ jsx9(LifecycleDialog, { title: panel === "close" ? "Close bill" : "Reopen bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs9("section", { className: "mb-lifecycle-panel", children: [
4209
+ /* @__PURE__ */ jsxs9("div", { children: [
4210
+ /* @__PURE__ */ jsx9("h3", { children: panel === "close" ? "Close bill" : "Reopen bill" }),
4211
+ /* @__PURE__ */ jsx9("p", { children: panel === "close" ? "The immutable submission and history remain available." : "Return this bill to active follow-up without changing the submitted snapshot." })
3941
4212
  ] }),
3942
- /* @__PURE__ */ jsxs8("label", { children: [
3943
- /* @__PURE__ */ jsx8("span", { children: "Reason" }),
3944
- /* @__PURE__ */ jsx8("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
4213
+ /* @__PURE__ */ jsxs9("label", { children: [
4214
+ /* @__PURE__ */ jsx9("span", { children: "Reason" }),
4215
+ /* @__PURE__ */ jsx9("textarea", { required: true, value: reason, onChange: (event) => setReason(event.target.value) })
3945
4216
  ] }),
3946
- /* @__PURE__ */ jsxs8("div", { className: "mb-lifecycle-panel-actions", children: [
3947
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
3948
- /* @__PURE__ */ jsx8("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
4217
+ /* @__PURE__ */ jsxs9("div", { className: "mb-lifecycle-panel-actions", children: [
4218
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
4219
+ /* @__PURE__ */ jsx9("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
3949
4220
  ] })
3950
4221
  ] }) }) : null,
3951
- notice ? /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
3952
- lifecycle.error ? /* @__PURE__ */ jsx8("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
4222
+ notice ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
4223
+ lifecycle.error ? /* @__PURE__ */ jsx9("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
3953
4224
  ] });
3954
4225
  }
3955
4226
  var CONNECTED_LIFECYCLE_STYLES = `
@@ -3961,9 +4232,9 @@ var CONNECTED_LIFECYCLE_STYLES = `
3961
4232
 
3962
4233
  // src/index.tsx
3963
4234
  function widget(tagName, props) {
3964
- const ref = useRef5(null);
4235
+ const ref = useRef6(null);
3965
4236
  const { onMindBill, onMindBillError } = props;
3966
- useEffect6(() => {
4237
+ useEffect7(() => {
3967
4238
  const element = ref.current;
3968
4239
  if (!element) return;
3969
4240
  const handleEvent = (event) => onMindBill?.(event);
@@ -4029,6 +4300,7 @@ export {
4029
4300
  BillSubmissionServiceLinesSection,
4030
4301
  BillingDashboard,
4031
4302
  BillingReport,
4303
+ BillingSettings,
4032
4304
  ConnectedBillLifecycle,
4033
4305
  ConnectedBillStatus,
4034
4306
  DEFAULT_BILL_SUBMISSION_MODIFIERS,
@@ -4037,6 +4309,7 @@ export {
4037
4309
  MED_LEGAL_REPORT_TYPE_CODE,
4038
4310
  MindBillBillReview,
4039
4311
  MindBillBillTimeline,
4312
+ OrganizationOnboarding,
4040
4313
  PSYCH_QME_DEFAULT_DIAGNOSIS,
4041
4314
  applyBillSubmissionEvaluationDiagnoses,
4042
4315
  applyBillSubmissionEvaluationModifiers,