@mindbill/react 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +191 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -114,6 +114,15 @@ import { BillReadOnlyForm } from "@mindbill/react";
|
|
|
114
114
|
|
|
115
115
|
For older responses without `issues`, the component falls back to the singular `reason` and `code` fields. `appearance.dangerColor` can override the rejection color without changing the rest of the theme.
|
|
116
116
|
|
|
117
|
+
For the server-authorized **Correct and resubmit** action,
|
|
118
|
+
`ConnectedBillLifecycle` opens `BillSubmissionForm` with the complete submitted
|
|
119
|
+
snapshot and authenticated copies of its documents. API-provided rejection
|
|
120
|
+
`fieldPaths` call attention to likely problem controls, and payer contact
|
|
121
|
+
guidance remains visible while the user corrects the bill. Submitting creates
|
|
122
|
+
the next immutable attempt under the same logical `billId`; the original
|
|
123
|
+
attempt and rejection remain in history. The host application does not build a
|
|
124
|
+
second correction form or pass bill seed data back into the lifecycle.
|
|
125
|
+
|
|
117
126
|
## Lifecycle actions
|
|
118
127
|
|
|
119
128
|
MindBill returns the actions that are valid for the bill's current state. Render that server-authoritative list instead of duplicating rejection, EOR, denial, review, payment, and closure rules in your application.
|
package/dist/index.d.ts
CHANGED
|
@@ -520,6 +520,8 @@ type BillSubmissionSourceAttachment = {
|
|
|
520
520
|
autoAttached?: boolean;
|
|
521
521
|
removable?: boolean;
|
|
522
522
|
previewUrl?: string;
|
|
523
|
+
/** Authenticated source loader used when the document is not available at a public URL. */
|
|
524
|
+
loadBlob?: () => Promise<Blob>;
|
|
523
525
|
reportTypeCode?: string;
|
|
524
526
|
};
|
|
525
527
|
type BillSubmissionUpload = {
|
|
@@ -574,6 +576,9 @@ type BillSubmissionFormProps = {
|
|
|
574
576
|
submitLabel?: string;
|
|
575
577
|
heading?: ReactNode;
|
|
576
578
|
description?: ReactNode;
|
|
579
|
+
/** Rejected-field paths to visually call out while the user corrects the next submission. */
|
|
580
|
+
attentionFields?: string[];
|
|
581
|
+
attentionMessage?: ReactNode;
|
|
577
582
|
/**
|
|
578
583
|
* Optional composable layout. Use the exported section components as children;
|
|
579
584
|
* the parent form continues to own validation, directory lookups, uploads, and submission.
|
|
@@ -612,7 +617,7 @@ declare function BillSubmissionProvidersSection(): ReactElement;
|
|
|
612
617
|
declare function BillSubmissionServiceLinesSection(): ReactElement;
|
|
613
618
|
declare function BillSubmissionAttachmentsSection(): ReactElement;
|
|
614
619
|
declare function BillSubmissionActions(): ReactElement;
|
|
615
|
-
declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, taxonomyOptions, deliveryRoutePicker, attachmentReportTypeMode, attachmentReportTypes, defaultAttachmentReportType, appearance, className, style, disabled, submitLabel, heading, description, children, }: BillSubmissionFormProps): ReactElement;
|
|
620
|
+
declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, taxonomyOptions, deliveryRoutePicker, attachmentReportTypeMode, attachmentReportTypes, defaultAttachmentReportType, appearance, className, style, disabled, submitLabel, heading, description, attentionFields, attentionMessage, children, }: BillSubmissionFormProps): ReactElement;
|
|
616
621
|
|
|
617
622
|
/** First plausible email address inside a raw contact string, or null. */
|
|
618
623
|
declare function extractSendRouteEmail(raw: string | null | undefined): string | null;
|
|
@@ -1055,6 +1060,7 @@ type UseBillLifecycleResult = {
|
|
|
1055
1060
|
refresh: () => Promise<void>;
|
|
1056
1061
|
searchClaimsAdministrators: BillLifecycleClient["searchClaimsAdministrators"];
|
|
1057
1062
|
getDeliveryOptions: BillLifecycleClient["getDeliveryOptions"];
|
|
1063
|
+
getAttachment: BillLifecycleClient["getAttachment"];
|
|
1058
1064
|
openAttachment: (attachment: BillReviewAttachment) => Promise<void>;
|
|
1059
1065
|
openEor: (document: BillEorDocument) => Promise<void>;
|
|
1060
1066
|
downloadPacket: () => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -2007,13 +2007,18 @@ async function prepareBillSubmissionDocuments({
|
|
|
2007
2007
|
fetch: fetchOverride
|
|
2008
2008
|
}) {
|
|
2009
2009
|
const fetcher = fetchOverride ?? globalThis.fetch;
|
|
2010
|
-
if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
|
|
2011
2010
|
const selected = selectedIds.map((id) => attachments.find((item) => item.id === id)).filter((item) => Boolean(item));
|
|
2012
2011
|
const sourceDocuments = await Promise.all(selected.map(async (attachment) => {
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2012
|
+
let blob;
|
|
2013
|
+
if (attachment.loadBlob) blob = await attachment.loadBlob();
|
|
2014
|
+
else {
|
|
2015
|
+
if (!attachment.previewUrl) throw new Error(`${attachment.fileName} cannot be submitted because its document URL is missing.`);
|
|
2016
|
+
if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
|
|
2017
|
+
const response = await fetcher(attachment.previewUrl, { credentials: "same-origin" });
|
|
2018
|
+
if (!response.ok) throw new Error(`${attachment.fileName} could not be loaded for submission.`);
|
|
2019
|
+
blob = await response.blob();
|
|
2020
|
+
}
|
|
2021
|
+
return pdfDocument(blob, {
|
|
2017
2022
|
externalId: attachment.id,
|
|
2018
2023
|
filename: attachment.fileName,
|
|
2019
2024
|
documentType: attachment.documentType,
|
|
@@ -2170,6 +2175,7 @@ function validateBillSubmission(bill) {
|
|
|
2170
2175
|
}
|
|
2171
2176
|
var css2 = `
|
|
2172
2177
|
.mbsf{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbsf *{box-sizing:border-box}
|
|
2178
|
+
.mbsf-attention{padding:14px 16px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));color:var(--mb-text)}.mbsf [data-attention=true] .mbsf-input,.mbsf [data-attention=true] .mbsf-select,.mbsf [data-attention=true].mbsf-lines{border-color:var(--mb-danger);background:color-mix(in srgb,var(--mb-danger) 4%,var(--mb-input))}.mbsf [data-attention=true]>.mbsf-label{color:var(--mb-danger)}
|
|
2173
2179
|
.mbsf-head,.mbsf-section-head,.mbsf-attach-row,.mbsf-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.mbsf-title{margin:0;font-size:24px}.mbsf-copy,.mbsf-help{color:var(--mb-muted);margin:5px 0 0}.mbsf-required{font-size:13px;color:var(--mb-muted);white-space:nowrap}.mbsf-star,.mbsf-error{color:var(--mb-danger)}
|
|
2174
2180
|
.mbsf-card{min-width:0;margin:0;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}.mbsf-card[data-invalid=true]{border-color:var(--mb-danger)}.mbsf-legend{padding:0 10px;font-size:18px;font-weight:760}.mbsf-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.mbsf-subhead{grid-column:1/-1;margin:6px 0 -2px;padding-top:14px;border-top:1px solid var(--mb-border);font-size:15px;font-weight:780;letter-spacing:.01em}.mbsf-subhead:first-child{margin-top:0;padding-top:0;border-top:0}.mbsf-span{grid-column:1/-1}.mbsf-field{display:grid;align-content:start;gap:7px;min-width:0}.mbsf-label{font-weight:680}.mbsf-input,.mbsf-select{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbsf-input:focus,.mbsf-select:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}.mbsf-field[data-invalid=true] .mbsf-input,.mbsf-field[data-invalid=true] .mbsf-select,.mbsf-invalid-control .mbsf-input{border-color:var(--mb-danger);background:color-mix(in srgb,var(--mb-danger) 4%,var(--mb-input))}.mbsf-field[data-invalid=true] .mbsf-input:focus,.mbsf-field[data-invalid=true] .mbsf-select:focus{outline-color:color-mix(in srgb,var(--mb-danger) 24%,transparent)}
|
|
2175
2181
|
.mbsf-combo{position:relative}.mbsf-menu{position:absolute;z-index:20;top:calc(100% + 5px);left:0;right:0;max-height:min(360px,46vh);overflow:auto;overscroll-behavior:contain;padding:7px;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);box-shadow:0 14px 35px rgba(17,38,49,.16)}.mbsf-option{display:grid;width:100%;gap:2px;padding:10px;border:0;border-radius:8px;background:transparent;color:var(--mb-text);font:inherit;text-align:left;cursor:pointer}.mbsf-option:hover,.mbsf-option:focus{background:color-mix(in srgb,var(--mb-accent) 9%,var(--mb-surface))}.mbsf-option small{color:var(--mb-muted)}.mbsf-menu-status{padding:12px;text-align:center;color:var(--mb-muted);font-size:13px}
|
|
@@ -2346,6 +2352,8 @@ function BillSubmissionForm({
|
|
|
2346
2352
|
submitLabel = "Submit bill",
|
|
2347
2353
|
heading = "Bill information",
|
|
2348
2354
|
description = "Review the bill details, add attachments, and submit.",
|
|
2355
|
+
attentionFields = [],
|
|
2356
|
+
attentionMessage,
|
|
2349
2357
|
children
|
|
2350
2358
|
}) {
|
|
2351
2359
|
const [bill, setBill] = useState4(() => cloneInitialBill(initialBill));
|
|
@@ -2406,6 +2414,21 @@ function BillSubmissionForm({
|
|
|
2406
2414
|
const next = validateBillSubmission(bill).fieldErrors;
|
|
2407
2415
|
setErrors(missingAttachmentReportType ? { ...next, attachments: "Select a report type for every attachment." } : next);
|
|
2408
2416
|
}, [bill, missingAttachmentReportType, validationActive]);
|
|
2417
|
+
useEffect4(() => {
|
|
2418
|
+
const root = formRef.current;
|
|
2419
|
+
if (!root) return;
|
|
2420
|
+
const nodes = Array.from(root.querySelectorAll("[data-field-path]"));
|
|
2421
|
+
nodes.forEach((node) => node.removeAttribute("data-attention"));
|
|
2422
|
+
for (const requested of attentionFields) {
|
|
2423
|
+
const normalized = requested.replace(/\[\]/g, "");
|
|
2424
|
+
for (const node of nodes) {
|
|
2425
|
+
const actual = node.dataset.fieldPath ?? "";
|
|
2426
|
+
if (actual === requested || actual === normalized || actual.startsWith(`${normalized}.`) || normalized.startsWith(`${actual}.`)) {
|
|
2427
|
+
node.dataset.attention = "true";
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
}, [attentionFields]);
|
|
2409
2432
|
const addFiles = useCallback((fileList) => {
|
|
2410
2433
|
const files = Array.from(fileList);
|
|
2411
2434
|
if (!files.length) return;
|
|
@@ -2895,6 +2918,7 @@ function BillSubmissionForm({
|
|
|
2895
2918
|
void submit();
|
|
2896
2919
|
}, noValidate: true, children: [
|
|
2897
2920
|
/* @__PURE__ */ jsx4("style", { children: css2 }),
|
|
2921
|
+
attentionMessage ? /* @__PURE__ */ jsx4("div", { className: "mbsf-attention", role: "status", children: attentionMessage }) : null,
|
|
2898
2922
|
children ?? defaultLayout,
|
|
2899
2923
|
routeDialog ? /* @__PURE__ */ jsx4(
|
|
2900
2924
|
SendRouteDialog,
|
|
@@ -5045,6 +5069,7 @@ function useBillLifecycle({
|
|
|
5045
5069
|
refresh,
|
|
5046
5070
|
searchClaimsAdministrators: (query, claimNumber) => client.searchClaimsAdministrators(query, claimNumber),
|
|
5047
5071
|
getDeliveryOptions: () => client.getDeliveryOptions(),
|
|
5072
|
+
getAttachment: (attachmentId) => client.getAttachment(attachmentId),
|
|
5048
5073
|
openAttachment,
|
|
5049
5074
|
openEor,
|
|
5050
5075
|
downloadPacket,
|
|
@@ -5056,7 +5081,7 @@ function useBillLifecycle({
|
|
|
5056
5081
|
simulateSandbox: (input) => mutate(() => client.simulateSandbox(input))
|
|
5057
5082
|
};
|
|
5058
5083
|
}
|
|
5059
|
-
function LifecycleDialog({ children, title, onClose }) {
|
|
5084
|
+
function LifecycleDialog({ children, title, wide = false, onClose }) {
|
|
5060
5085
|
const dialog = useRef5(null);
|
|
5061
5086
|
useEffect8(() => {
|
|
5062
5087
|
const previous = document.activeElement;
|
|
@@ -5068,11 +5093,90 @@ function LifecycleDialog({ children, title, onClose }) {
|
|
|
5068
5093
|
previous?.focus();
|
|
5069
5094
|
};
|
|
5070
5095
|
}, [onClose]);
|
|
5071
|
-
return /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs13("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
|
|
5096
|
+
return /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs13("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
|
|
5072
5097
|
/* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
|
|
5073
5098
|
children
|
|
5074
5099
|
] }) });
|
|
5075
5100
|
}
|
|
5101
|
+
function correctionDocumentType(value) {
|
|
5102
|
+
return BILL_SUBMISSION_DOCUMENT_TYPES.includes(value) ? value : "other";
|
|
5103
|
+
}
|
|
5104
|
+
function correctionBill(data) {
|
|
5105
|
+
const billing = data.bill.billingSnapshot?.billingProvider;
|
|
5106
|
+
const rendering = data.bill.billingSnapshot?.renderingProvider;
|
|
5107
|
+
const location = data.bill.billingSnapshot?.placeOfService;
|
|
5108
|
+
const nameParts = data.patient.name.trim().split(/\s+/);
|
|
5109
|
+
const firstName = data.patient.firstName || nameParts[0] || "";
|
|
5110
|
+
const lastName = data.patient.lastName || nameParts.slice(1).join(" ") || "";
|
|
5111
|
+
return {
|
|
5112
|
+
billingMode: data.bill.billingMode,
|
|
5113
|
+
patient: {
|
|
5114
|
+
firstName,
|
|
5115
|
+
...data.patient.middleName ? { middleName: data.patient.middleName } : {},
|
|
5116
|
+
lastName,
|
|
5117
|
+
dateOfBirth: data.patient.dob || "",
|
|
5118
|
+
...data.patient.phone ? { phone: data.patient.phone } : {},
|
|
5119
|
+
address: {
|
|
5120
|
+
line1: data.patient.address?.line1 || "",
|
|
5121
|
+
city: data.patient.address?.city || "",
|
|
5122
|
+
state: data.patient.address?.state || "",
|
|
5123
|
+
postalCode: data.patient.address?.postalCode || ""
|
|
5124
|
+
}
|
|
5125
|
+
},
|
|
5126
|
+
claim: {
|
|
5127
|
+
claimNumber: data.injury.claimNumber || "",
|
|
5128
|
+
...data.injury.adjNumber ? { adjNumber: data.injury.adjNumber } : {},
|
|
5129
|
+
employer: data.injury.employer || "",
|
|
5130
|
+
dateOfInjury: data.injury.doi || "",
|
|
5131
|
+
...data.injury.injuryDescription ? { description: data.injury.injuryDescription } : {},
|
|
5132
|
+
...data.injury.claimsAdminId && data.injury.claimsAdminName ? {
|
|
5133
|
+
claimsAdministrator: { id: data.injury.claimsAdminId, name: data.injury.claimsAdminName }
|
|
5134
|
+
} : {}
|
|
5135
|
+
},
|
|
5136
|
+
service: {
|
|
5137
|
+
date: data.bill.dos,
|
|
5138
|
+
...data.bill.dosEnd !== void 0 ? { endDate: data.bill.dosEnd } : {},
|
|
5139
|
+
...data.bill.authorizationNumber !== void 0 ? { authorizationNumber: data.bill.authorizationNumber } : {}
|
|
5140
|
+
},
|
|
5141
|
+
...billing ? { billingProvider: {
|
|
5142
|
+
name: billing.name,
|
|
5143
|
+
taxId: billing.taxId,
|
|
5144
|
+
npi: billing.npi,
|
|
5145
|
+
...billing.phone ? { phone: billing.phone } : {},
|
|
5146
|
+
address: {
|
|
5147
|
+
line1: billing.billingStreet || "",
|
|
5148
|
+
city: billing.billingCity || "",
|
|
5149
|
+
state: billing.billingState || "",
|
|
5150
|
+
postalCode: billing.billingZip || ""
|
|
5151
|
+
}
|
|
5152
|
+
} } : {},
|
|
5153
|
+
...rendering ? { renderingProvider: {
|
|
5154
|
+
name: rendering.name,
|
|
5155
|
+
npi: rendering.npi,
|
|
5156
|
+
...rendering.taxonomy ? { taxonomy: rendering.taxonomy } : {},
|
|
5157
|
+
...rendering.specialty ? { specialty: rendering.specialty } : {},
|
|
5158
|
+
...rendering.licenseNumber ? { licenseNumber: rendering.licenseNumber } : {},
|
|
5159
|
+
...rendering.licenseState ? { licenseState: rendering.licenseState } : {},
|
|
5160
|
+
...rendering.isQME !== void 0 ? { isQme: rendering.isQME } : {},
|
|
5161
|
+
...rendering.isAME !== void 0 ? { isAme: rendering.isAME } : {}
|
|
5162
|
+
} } : {},
|
|
5163
|
+
...location ? { serviceLocation: {
|
|
5164
|
+
...location.name ? { name: location.name } : {},
|
|
5165
|
+
address: { line1: location.street, city: location.city, state: location.state, postalCode: location.zip },
|
|
5166
|
+
...location.posCode ? { placeOfServiceCode: location.posCode } : {}
|
|
5167
|
+
} } : {},
|
|
5168
|
+
diagnoses: [...data.injury.diagnosisCodes || []],
|
|
5169
|
+
serviceLines: data.bill.lineItems.map((line) => ({
|
|
5170
|
+
code: line.code,
|
|
5171
|
+
modifiers: [...line.modifiers],
|
|
5172
|
+
units: line.units,
|
|
5173
|
+
charge: line.charge,
|
|
5174
|
+
...line.serviceDate ? { serviceDate: line.serviceDate } : {},
|
|
5175
|
+
...line.serviceDateEnd !== void 0 ? { serviceDateEnd: line.serviceDateEnd } : {},
|
|
5176
|
+
...line.diagnosisPointers ? { diagnosisPointers: [...line.diagnosisPointers] } : {}
|
|
5177
|
+
}))
|
|
5178
|
+
};
|
|
5179
|
+
}
|
|
5076
5180
|
function today() {
|
|
5077
5181
|
const now = /* @__PURE__ */ new Date();
|
|
5078
5182
|
return new Date(now.getTime() - now.getTimezoneOffset() * 6e4).toISOString().slice(0, 10);
|
|
@@ -5109,6 +5213,21 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
|
|
|
5109
5213
|
const [payment, setPayment] = useState10({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
|
|
5110
5214
|
const [review, setReview] = useState10({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
|
|
5111
5215
|
const lastData = useRef5(null);
|
|
5216
|
+
const correctionInitialBill = useMemo8(() => data ? correctionBill(data) : null, [data]);
|
|
5217
|
+
const correctionAttachments = useMemo8(() => data ? data.bill.attachments.map((attachment) => {
|
|
5218
|
+
const documentType = correctionDocumentType(attachment.documentType);
|
|
5219
|
+
const isW9 = documentType === "w9";
|
|
5220
|
+
return {
|
|
5221
|
+
id: attachment.id,
|
|
5222
|
+
fileName: attachment.filename,
|
|
5223
|
+
documentType,
|
|
5224
|
+
...attachment.description ? { description: attachment.description } : {},
|
|
5225
|
+
...attachment.reportType ? { reportTypeCode: attachment.reportType } : {},
|
|
5226
|
+
loadBlob: () => lifecycle.getAttachment(attachment.id),
|
|
5227
|
+
...isW9 ? { autoAttached: true, removable: false } : { removable: true }
|
|
5228
|
+
};
|
|
5229
|
+
}) : [], [data, lifecycle]);
|
|
5230
|
+
const correctionAttentionFields = useMemo8(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
|
|
5112
5231
|
useEffect8(() => {
|
|
5113
5232
|
if (!data || data === lastData.current) return;
|
|
5114
5233
|
lastData.current = data;
|
|
@@ -5145,6 +5264,24 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
|
|
|
5145
5264
|
} catch {
|
|
5146
5265
|
}
|
|
5147
5266
|
};
|
|
5267
|
+
const submitCorrection = async (value) => {
|
|
5268
|
+
setNotice("");
|
|
5269
|
+
const documents = await prepareBillSubmissionDocuments({
|
|
5270
|
+
attachments: correctionAttachments,
|
|
5271
|
+
selectedIds: value.sourceAttachmentIds,
|
|
5272
|
+
reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
|
|
5273
|
+
uploads: value.uploads,
|
|
5274
|
+
...options.fetch ? { fetch: options.fetch } : {}
|
|
5275
|
+
});
|
|
5276
|
+
await lifecycle.resubmitBill({
|
|
5277
|
+
bill: value.bill,
|
|
5278
|
+
...documents.length ? { documents } : {},
|
|
5279
|
+
...reason.trim() ? { reason: reason.trim() } : {}
|
|
5280
|
+
});
|
|
5281
|
+
setPanel("");
|
|
5282
|
+
setReason("");
|
|
5283
|
+
setNotice("Corrected submission sent.");
|
|
5284
|
+
};
|
|
5148
5285
|
const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
|
|
5149
5286
|
const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
|
|
5150
5287
|
const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
|
|
@@ -5193,19 +5330,55 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
|
|
|
5193
5330
|
if (next) setPanel(next);
|
|
5194
5331
|
}, children: action.label }, action.id))
|
|
5195
5332
|
] }) : null,
|
|
5196
|
-
panel === "resubmit" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-
|
|
5197
|
-
/* @__PURE__ */ jsxs13("
|
|
5198
|
-
/* @__PURE__ */
|
|
5199
|
-
|
|
5333
|
+
panel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-correction", children: [
|
|
5334
|
+
/* @__PURE__ */ jsxs13("header", { children: [
|
|
5335
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
5336
|
+
/* @__PURE__ */ jsx13("h3", { children: "Correct and resubmit" }),
|
|
5337
|
+
/* @__PURE__ */ jsx13("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
|
|
5338
|
+
] }),
|
|
5339
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" })
|
|
5200
5340
|
] }),
|
|
5201
|
-
/* @__PURE__ */ jsxs13("
|
|
5341
|
+
data.rejection ? /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-correction-reason", children: [
|
|
5342
|
+
/* @__PURE__ */ jsx13("strong", { children: data.rejection.reason }),
|
|
5343
|
+
data.rejection.issues?.map((issue, index) => /* @__PURE__ */ jsxs13("span", { children: [
|
|
5344
|
+
issue.code ? `${issue.code}: ` : "",
|
|
5345
|
+
issue.description
|
|
5346
|
+
] }, `${issue.code || "issue"}-${index}`))
|
|
5347
|
+
] }) : null,
|
|
5348
|
+
data.delivery.contacts.adjusterPhone || data.delivery.contacts.claimsEmail ? /* @__PURE__ */ jsxs13("aside", { className: "mb-lifecycle-correction-contact", children: [
|
|
5349
|
+
/* @__PURE__ */ jsx13("strong", { children: "Need to verify the rejected information?" }),
|
|
5350
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
5351
|
+
"Contact ",
|
|
5352
|
+
data.delivery.payerName,
|
|
5353
|
+
data.delivery.contacts.adjusterPhone ? ` at ${data.delivery.contacts.adjusterPhone}` : "",
|
|
5354
|
+
data.delivery.contacts.claimsEmail ? ` \xB7 ${data.delivery.contacts.claimsEmail}` : "",
|
|
5355
|
+
"."
|
|
5356
|
+
] })
|
|
5357
|
+
] }) : null,
|
|
5358
|
+
/* @__PURE__ */ jsxs13("label", { className: "mb-lifecycle-correction-note", children: [
|
|
5202
5359
|
/* @__PURE__ */ jsx13("span", { children: "Correction note (optional)" }),
|
|
5203
5360
|
/* @__PURE__ */ jsx13("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
|
|
5204
5361
|
] }),
|
|
5205
|
-
/* @__PURE__ */
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5362
|
+
/* @__PURE__ */ jsx13(
|
|
5363
|
+
BillSubmissionForm,
|
|
5364
|
+
{
|
|
5365
|
+
initialBill: correctionInitialBill,
|
|
5366
|
+
attachments: correctionAttachments,
|
|
5367
|
+
onSubmit: submitCorrection,
|
|
5368
|
+
onSearchClaimsAdministrators: lifecycle.searchClaimsAdministrators,
|
|
5369
|
+
attentionFields: correctionAttentionFields,
|
|
5370
|
+
attentionMessage: correctionAttentionFields.length ? "The rejected response points to the highlighted fields. Confirm every required value before resubmitting." : "Confirm the bill information below before resubmitting.",
|
|
5371
|
+
submitLabel: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill",
|
|
5372
|
+
heading: "Corrected bill information",
|
|
5373
|
+
description: "The original submission stays unchanged. This form creates the next submission attempt.",
|
|
5374
|
+
disabled: lifecycle.isMutating,
|
|
5375
|
+
...options.getSession ? { getSession: options.getSession } : {},
|
|
5376
|
+
...options.sessionEndpoint ? { sessionEndpoint: options.sessionEndpoint } : {},
|
|
5377
|
+
...options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {},
|
|
5378
|
+
...options.fetch ? { fetch: options.fetch } : {},
|
|
5379
|
+
...appearance ? { appearance } : {}
|
|
5380
|
+
}
|
|
5381
|
+
)
|
|
5209
5382
|
] }) }) : null,
|
|
5210
5383
|
panel === "second_review" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
|
|
5211
5384
|
/* @__PURE__ */ jsxs13("div", { children: [
|
|
@@ -5319,8 +5492,9 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
|
|
|
5319
5492
|
var CONNECTED_LIFECYCLE_STYLES = `
|
|
5320
5493
|
.mb-lifecycle-simulator{display:grid;gap:14px;padding:18px;border:1px solid #b8dadd;border-radius:var(--mb-radius,14px);background:#f2fbfb}.mb-lifecycle-simulator>div:first-child>span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.09em;text-transform:uppercase}.mb-lifecycle-simulator h3{margin:3px 0 0;font-size:1.05rem}.mb-lifecycle-simulator p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-simulator-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.mb-lifecycle-simulator-actions button{min-height:76px;border:1px solid #a9cccf;border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;padding:12px 14px;text-align:left;font:inherit}.mb-lifecycle-simulator-actions button:hover{border-color:var(--mb-accent);box-shadow:0 3px 14px rgba(23,108,112,.1)}.mb-lifecycle-simulator-actions button:disabled{cursor:not-allowed;opacity:.55}.mb-lifecycle-simulator-actions button strong,.mb-lifecycle-simulator-actions button span{display:block}.mb-lifecycle-simulator-actions button span{margin-top:3px;color:var(--mb-muted);font-size:.83rem}.mb-lifecycle-simulator-idle{padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.72)}
|
|
5321
5494
|
.mb-connected-lifecycle{--mb-accent:#176c70;--mb-text:#17282d;--mb-muted:#607176;--mb-border:#d7e0df;--mb-soft:#f4f7f6;--mb-surface:#fff;display:grid;gap:18px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-title{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.mb-lifecycle-title h2{margin:0;font-size:1.7rem}.mb-lifecycle-head p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-tabs{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);padding:6px}.mb-lifecycle-tabs button{min-height:46px;border:0;border-radius:8px;background:transparent;color:var(--mb-muted);font:inherit;font-size:1rem;font-weight:750;cursor:pointer}.mb-lifecycle-tabs button[aria-selected=true]{background:var(--mb-accent);color:white}.mb-lifecycle-tabpanel{display:grid;gap:18px}.mb-lifecycle-button{min-height:40px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:9px 14px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:var(--mb-accent-contrast,#fff)}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-actions-sheet{position:sticky;bottom:12px;z-index:24;display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:9px;padding:10px;border:1px solid var(--mb-border);border-radius:12px;background:color-mix(in srgb,var(--mb-surface) 94%,transparent);box-shadow:0 10px 34px rgba(18,35,43,.16);backdrop-filter:blur(12px)}.mb-lifecycle-card,.mb-lifecycle-panel{padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-card header{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-card h3,.mb-lifecycle-panel h3{margin:0;font-size:1.08rem}.mb-lifecycle-card p,.mb-lifecycle-panel p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-card header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-documents{list-style:none;margin:14px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid;gap:3px;min-width:0}.mb-lifecycle-documents li span{color:var(--mb-muted);font-size:.85rem}.mb-lifecycle-dialog-backdrop{position:fixed;z-index:2147483000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(18,35,43,.56);backdrop-filter:blur(3px)}.mb-lifecycle-dialog{position:relative;width:min(760px,100%);max-height:calc(100vh - 40px);overflow:auto;outline:0}.mb-lifecycle-dialog-close{position:absolute;z-index:1;top:12px;right:12px;width:34px;height:34px;border:1px solid var(--mb-border);border-radius:8px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;font:22px/1 inherit}.mb-lifecycle-panel{display:grid;gap:17px;padding-top:24px;box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:13px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:.85rem;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}
|
|
5495
|
+
.mb-lifecycle-dialog.wide{width:min(1280px,100%)}.mb-lifecycle-correction{display:grid;gap:16px;padding:22px;border-radius:var(--mb-radius,14px);background:var(--mb-surface);box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-correction>header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-right:42px}.mb-lifecycle-correction h3{margin:0;font-size:1.2rem}.mb-lifecycle-correction header p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-correction-reason,.mb-lifecycle-correction-contact{display:grid;gap:4px;padding:13px 15px;border-radius:10px}.mb-lifecycle-correction-reason{border-left:4px solid #c5443f;background:#fff2f1;color:#812d29}.mb-lifecycle-correction-contact{border:1px solid color-mix(in srgb,var(--mb-accent) 35%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface))}.mb-lifecycle-correction-note{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-correction-note textarea{min-height:76px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px;resize:vertical}
|
|
5322
5496
|
.mb-payment-total{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:9px;background:var(--mb-soft)}.mb-payment-total strong{font-size:1.12rem}
|
|
5323
|
-
@media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:
|
|
5497
|
+
@media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:96vh}.mb-lifecycle-dialog .mb-lifecycle-panel,.mb-lifecycle-correction{border-radius:18px 18px 0 0}.mb-lifecycle-correction{padding:18px 12px}.mb-lifecycle-correction>header{align-items:stretch;flex-direction:column;padding-right:42px}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
|
|
5324
5498
|
`;
|
|
5325
5499
|
|
|
5326
5500
|
// src/index.tsx
|