@mindbill/react 0.77.57 → 0.77.58

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
@@ -10598,22 +10598,29 @@ var taskViewDescriptions = {
10598
10598
  Scheduled: "Open tasks with a future follow-up date. This does not mean a treatment appointment is scheduled.",
10599
10599
  Completed: "Tasks that have been resolved. Completing a task does not necessarily close its RFA."
10600
10600
  };
10601
- var names = { send_rfa: "Send RFA", no_response: "Decision overdue", transmission_failed: "Submission failed", information_requested: "Respond to information request", clock_review: "Deadline needs review", schedule_treatment: "Schedule treatment", post_ur_decision: "Post UR", document_required: "Add supporting documents" };
10601
+ var names = { send_rfa: "Send RFA", no_response: "Decision overdue", transmission_failed: "Submission failed", information_requested: "Respond to information request", clock_review: "Deadline needs review", schedule_treatment: "Schedule treatment", post_ur_decision: "Post UR", post_ur_approved: "Approved \u2014 confirm and bill", post_ur_denied: "Denied or modified \u2014 review", document_required: "Add supporting documents" };
10602
10602
  var descriptions = {
10603
10603
  transmission_failed: "Delivery failed. Correct the issue before sending again.",
10604
10604
  no_response: "The decision deadline passed without a recorded decision.",
10605
10605
  clock_review: "The deadline cannot yet be calculated confidently. Review receipt and timing details.",
10606
- post_ur_decision: "Record the treatment decisions in a received utilization review response.",
10606
+ post_ur_decision: "A response arrived and its decisions are not recorded yet. Check what was read from it and save.",
10607
+ post_ur_approved: "Every treatment in this response was approved. Confirm the review, then bill the authorized care.",
10608
+ post_ur_denied: "This response denied or modified treatment. Confirm the review and decide on an appeal or independent medical review.",
10607
10609
  information_requested: "Provide the additional information requested by the reviewer.",
10608
10610
  schedule_treatment: "Arrange treatment after approval."
10609
10611
  };
10612
+ function rfaTaskByResponseOutcome(task) {
10613
+ const outcome = task.responseOutcome;
10614
+ if (task.kind !== "post_ur_decision" || !outcome) return task;
10615
+ return { ...task, kind: outcome === "approved" ? "post_ur_approved" : "post_ur_denied" };
10616
+ }
10610
10617
  var rfaTaskLabel = (kind) => names[kind] ?? kind.replaceAll("_", " ");
10611
10618
  var taskAgeColumns = [{ key: "0-5", label: "0\u20135 days" }, { key: "6-14", label: "6\u201314 days" }, { key: "15-30", label: "15\u201330 days" }, { key: "31+", label: "31+ days" }];
10612
10619
  var taskGroups = [
10613
10620
  { title: "Incomplete RFAs", kinds: ["document_required", "send_rfa"] },
10614
10621
  { title: "Delivery issues", kinds: ["transmission_failed"] },
10615
10622
  { title: "Decision deadlines", kinds: ["no_response", "clock_review"] },
10616
- { title: "Responses to process", kinds: ["post_ur_decision", "information_requested"] },
10623
+ { title: "Responses to process", kinds: ["post_ur_decision", "post_ur_approved", "post_ur_denied", "information_requested"] },
10617
10624
  { title: "Treatment scheduling", kinds: ["schedule_treatment"] }
10618
10625
  ];
10619
10626
  function rfaTaskAgeBucket(createdAt, now = Date.now()) {
@@ -10675,7 +10682,7 @@ function TaskBoardContent({ options, patientId, claimId, renderingProviderId, pe
10675
10682
  let cursor;
10676
10683
  do {
10677
10684
  const result = await client.listFollowUps({ ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, includeResolved: true, limit: 200, ...cursor ? { cursor } : {} });
10678
- found.push(...result.data);
10685
+ found.push(...result.data.map(rfaTaskByResponseOutcome));
10679
10686
  cursor = result.nextCursor ?? void 0;
10680
10687
  if (cursor && seen.has(cursor)) throw new Error("Task pagination could not be completed. Retrying automatically.");
10681
10688
  if (cursor) seen.add(cursor);
@@ -14154,7 +14161,7 @@ var rfaSendDialogCss = `.mbrfa-send-backdrop{position:fixed;z-index:1000;inset:0
14154
14161
  .mbrfa-send [role=alert]{color:var(--mb-danger,#b42318);font-size:13px}
14155
14162
  @media(max-width:640px){.mbrfa-send-backdrop{place-items:end stretch;padding:0}.mbrfa-send{width:100%;max-height:92vh;border-radius:var(--mb-radius) var(--mb-radius) 0 0}.mbrfa-send>footer{flex-direction:column}.mbrfa-send>footer>a{margin:0;align-self:center}}`;
14156
14163
  var treatmentDetail = (item) => [item.procedureCode ? `CPT/HCPCS ${item.procedureCode}` : "", item.quantity ? `Qty ${item.quantity}` : "", item.frequency ?? "", item.duration ?? "", `Dx ${item.diagnosisCode}`].filter(Boolean).join(" \xB7 ");
14157
- function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, directory, directoryLoading, directoryError, environment, canSend, canSign, actorReference, previewUrl, signatureSetup, signatureMissing, onUpdated, onSent, onClose }) {
14164
+ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, directory, directoryLoading, directoryError, environment, canSend, canSign, actorReference, previewUrl, signatureSetup, signatureMissing, resend, onUpdated, onSent, onClose }) {
14158
14165
  const [method, setMethod] = useState30(() => !rfa.authorizationContact?.fax?.trim() && rfa.authorizationContact?.email?.trim() ? "email" : "fax");
14159
14166
  const [destination, setDestination] = useState30(null);
14160
14167
  const [message, setMessage] = useState30("");
@@ -14266,6 +14273,7 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14266
14273
  supporting.length ? /* @__PURE__ */ jsx45("ul", { children: supporting.map((document2) => /* @__PURE__ */ jsx45("li", { children: document2.filename }, document2.id)) }) : /* @__PURE__ */ jsx45("p", { children: "None attached yet." })
14267
14274
  ] })
14268
14275
  ] }),
14276
+ resend ? /* @__PURE__ */ jsx45("p", { className: "mbrfa-send-signature", role: "status", children: "The last attempt did not go through. Check the destination with the claims administrator, or choose another way to send, then send again." }) : null,
14269
14277
  /* @__PURE__ */ jsxs43("div", { className: "mbrfa-send-methods", role: "radiogroup", "aria-label": "Send by", children: [
14270
14278
  /* @__PURE__ */ jsx45("span", { children: "Send by" }),
14271
14279
  /* @__PURE__ */ jsxs43("label", { children: [
@@ -15164,6 +15172,10 @@ var sentence2 = (value) => {
15164
15172
  var documentTypeLabel = (type) => ({ rfa_form: "DWC Form RFA", clinical_report: "Clinical report", supporting_record: "Supporting record", ur_response: "Utilization review response", imr_form: "Independent medical review form", fax_cover: "Fax cover sheet" })[type] ?? sentence2(type);
15165
15173
  var date7 = (value) => value ? new Date(value).toLocaleString() : "Not recorded";
15166
15174
  var key = () => `rfa-widget-${globalThis.crypto.randomUUID()}`;
15175
+ function rfaCanResend(rfa) {
15176
+ const attempts = rfa.transmissions.filter((sent) => sent.direction === "outbound" && (sent.purpose ?? "submission") === "submission");
15177
+ return rfa.status === "submitted" && !rfa.receivedAt && attempts.length > 0 && attempts.every((sent) => sent.status === "failed");
15178
+ }
15167
15179
  function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, patientId, claimId, renderingProviderId, signatureSession, ...props }) {
15168
15180
  const options = useMemo13(() => ({ ...sessionEndpoint ? { sessionEndpoint } : {}, ...getSession ? { getSession } : {}, ...apiBaseUrl ? { apiBaseUrl } : {}, ...fetchOverride ? { fetch: fetchOverride } : {} }), [sessionEndpoint, getSession, apiBaseUrl, fetchOverride]);
15169
15181
  const client = useMemo13(() => createRfaClient4(options), [options]);
@@ -15622,6 +15634,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15622
15634
  const locked = busy || disabled;
15623
15635
  const canSign = permissions.includes("sign") && !!actorReference?.trim();
15624
15636
  const unsent = rfa && !rfa.submittedAt && ["draft", "ready", "incomplete", "deferred"].includes(rfa.status);
15637
+ const resendable = !!rfa && rfaCanResend(rfa);
15625
15638
  const reviewable = !!rfa && (!!rfa.submittedAt || ["submitted", "received", "under_review", "information_requested", "approved", "modified", "denied", "mixed", "incomplete", "deferred"].includes(rfa.status));
15626
15639
  const openDocument = (documentId, title) => run(async () => {
15627
15640
  const blob = await client.getDocument(id, documentId);
@@ -15946,8 +15959,8 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15946
15959
  /* @__PURE__ */ jsx49("summary", { children: "More" }),
15947
15960
  /* @__PURE__ */ jsx49("div", { children: /* @__PURE__ */ jsx49(RfaDraftActions, { deleteWording: true, ...options, rfa, disabled: !!locked, permissions: permissions.filter((permission) => permission === "create" || permission === "edit"), onCopied, onCanceled: adopt }) })
15948
15961
  ] }) : /* @__PURE__ */ jsx49(RfaDraftActions, { ...options, rfa, disabled: !!locked, permissions: permissions.filter((permission) => permission === "create" || permission === "edit"), onCopied, onCanceled: adopt }),
15949
- simple && !unsent && !!rfa.submittedAt && rfa.status !== "canceled" && permissions.includes("act") ? /* @__PURE__ */ jsx49("button", { type: "button", disabled: locked, onClick: () => setDuplicating(true), children: "Send duplicate" }) : null,
15950
- simple && unsent ? /* @__PURE__ */ jsx49("button", { type: "button", className: "mbtd-primary", disabled: locked, onClick: () => setSending(true), children: "Send" }) : simple && reviewable && detailTab === "details" ? /* @__PURE__ */ jsx49("button", { type: "button", disabled: locked, onClick: () => reveal("review"), children: "Record response" }) : null
15962
+ simple && !unsent && !resendable && !!rfa.submittedAt && rfa.status !== "canceled" && permissions.includes("act") ? /* @__PURE__ */ jsx49("button", { type: "button", disabled: locked, onClick: () => setDuplicating(true), children: "Send duplicate" }) : null,
15963
+ simple && (unsent || resendable) ? /* @__PURE__ */ jsx49("button", { type: "button", className: "mbtd-primary", disabled: locked, onClick: () => setSending(true), children: resendable ? "Send again" : "Send" }) : simple && reviewable && detailTab === "details" ? /* @__PURE__ */ jsx49("button", { type: "button", disabled: locked, onClick: () => reveal("review"), children: "Record response" }) : null
15951
15964
  ] })
15952
15965
  ] }) : null,
15953
15966
  simple && duplicating && !unsent ? /* @__PURE__ */ jsx49(
@@ -15966,11 +15979,12 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15966
15979
  onClose: () => setDuplicating(false)
15967
15980
  }
15968
15981
  ) : null,
15969
- simple && sending && unsent ? (() => {
15982
+ simple && sending && (unsent || resendable) ? (() => {
15970
15983
  const hostSignature = renderSendSignatureSetup?.({ renderingProviderId: rfa.renderingProviderId, providerName: rfa.providerName });
15971
15984
  return /* @__PURE__ */ jsx49(
15972
15985
  RfaSendDialog,
15973
15986
  {
15987
+ resend: resendable,
15974
15988
  rfa,
15975
15989
  client,
15976
15990
  documentIds,