@mindbill/react 0.77.58 → 0.77.60

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.d.ts CHANGED
@@ -979,6 +979,8 @@ type RfaFormDetails = {
979
979
  physician?: {
980
980
  specialty?: string | undefined;
981
981
  };
982
+ /** The claim's adjuster, when one is saved on the injury; fills a blank claims administrator Contact Name. */
983
+ adjusterName?: string | undefined;
982
984
  /** The organization's own fax line for responses; fills a blank Fax Number. */
983
985
  returnFax?: string | undefined;
984
986
  /** The organization's monitored e-mail address; fills a blank E-mail Address. */
package/dist/index.js CHANGED
@@ -10222,7 +10222,8 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
10222
10222
  void client.getCreationContext({ claimId, renderingProviderId, limit: 1 }).then((context) => {
10223
10223
  if (!active) return;
10224
10224
  const claim = context.claims.find((value) => value.claimId === claimId), provider = context.renderingProviders.find((value) => value.id === renderingProviderId);
10225
- setDetails({ ...context.returnFax ? { returnFax: context.returnFax } : {}, ...context.returnEmail ? { returnEmail: context.returnEmail } : {}, ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
10225
+ const adjusterName = claim?.adjusterName;
10226
+ setDetails({ ...adjusterName ? { adjusterName } : {}, ...context.returnFax ? { returnFax: context.returnFax } : {}, ...context.returnEmail ? { returnEmail: context.returnEmail } : {}, ...claim ? { employee: { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : {}, ...provider ? { physician: { specialty: provider.specialty } } : {} });
10226
10227
  }).catch(() => void 0);
10227
10228
  return () => {
10228
10229
  active = false;
@@ -10531,6 +10532,7 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10531
10532
  .mbtd .mbrfa-section-actions{display:flex;gap:12px;align-items:center;margin-top:14px;font-size:12px;color:var(--mb-muted)}
10532
10533
  .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10533
10534
  .mbtd .mbrfa-template-save{display:grid;grid-template-columns:minmax(0,420px);gap:10px 16px;margin-top:10px}.mbtd .mbrfa-template-save>label{display:grid;gap:4px;font-size:12px;color:var(--mb-muted)}.mbtd .mbrfa-template-save>.mbrfa-check{display:flex;flex-direction:row;align-items:center;gap:8px;cursor:pointer}.mbtd .mbrfa-template-save>.mbrfa-check>input{width:16px;height:16px;min-height:16px;margin:0;padding:0;flex:0 0 16px;accent-color:var(--mb-accent)}.mbtd .mbrfa-template-save>:is(.mbrfa-check,.mbrfa-section-actions){grid-column:1/-1;margin-top:0;padding-top:0;border-top:0}
10535
+ .mbtd .mbrfa-dx-suggest{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 8px;font-size:12px;color:var(--mb-muted)}.mbtd .mbrfa-dx-suggest button{min-height:28px;padding:2px 10px;border:1px dashed var(--mb-border);border-radius:999px;background:var(--mb-surface);font:inherit;font-size:12px;font-weight:600;color:var(--mb-accent);cursor:pointer}
10534
10536
  .mbtd .mbrfa-reading{margin:0 0 10px;padding:8px 12px;border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface));color:var(--mb-text);font-size:13px}.mbtd .mbrfa-reading[data-flag=true]{background:#fff4e5;color:#7a4a00}.mbtd fieldset[data-flag=true]{border-color:#f0a23b;box-shadow:inset 3px 0 0 #f0a23b}
10535
10537
  .mbtd .mbrfa-template-save>.mbrfa-section-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.mbtd .mbrfa-template-save>.mbrfa-section-actions>button{flex:0 0 auto;white-space:nowrap}.mbtd .mbrfa-template-save>.mbrfa-section-actions>span{flex:1 0 100%;font-size:12px;color:var(--mb-muted)}
10536
10538
  @media(max-width:760px){.mbtd .mbrfa-template-save{grid-template-columns:minmax(0,1fr)}}
@@ -11407,6 +11409,21 @@ function rfaOutcome(item) {
11407
11409
  if (item.outcome === "denied") return { label: "Denied", tone: "bad" };
11408
11410
  return { label: sentence(item.outcome || "pending"), tone: "muted" };
11409
11411
  }
11412
+ function rfaDecisionSummary(rfa) {
11413
+ const items = rfa.items.filter((item) => !item.decisionClosure?.closed);
11414
+ const decided = items.filter((item) => item.outcome !== "pending");
11415
+ if (!decided.length) return null;
11416
+ if (decided.length < items.length) return { label: "Partially decided", tone: "warn" };
11417
+ if (decided.every((item) => item.outcome === "approved")) return { label: "Approved", tone: "ok" };
11418
+ if (decided.every((item) => item.outcome === "denied")) return { label: "Denied", tone: "bad" };
11419
+ if (decided.every((item) => item.outcome === "modified")) return { label: "Modified", tone: "warn" };
11420
+ return { label: "Partially approved", tone: "warn" };
11421
+ }
11422
+ var FAX_FAILURES = { busy: "The line was busy", no_answer: "No answer", not_a_fax_machine: "The number did not answer as a fax machine", invalid_number: "The number is not in service", rejected: "The call was rejected", carrier_error: "The fax carrier could not complete the call" };
11423
+ function rfaFailureReason(transmission) {
11424
+ const reason = transmission.metadata?.failureReason;
11425
+ return transmission.status === "failed" && typeof reason === "string" ? FAX_FAILURES[reason] ?? "" : "";
11426
+ }
11410
11427
  function RfaPill({ tone = "muted", children }) {
11411
11428
  return /* @__PURE__ */ jsx30("span", { className: "mbrfa-pill", "data-tone": tone, children });
11412
11429
  }
@@ -11424,11 +11441,12 @@ function RfaStatusCard({ rfa }) {
11424
11441
  const stages = ["Draft", "Sent", "Received", "Decided"];
11425
11442
  const current = rfa.submittedAt && decided ? 3 : rfa.receivedAt ? 2 : rfa.submittedAt ? 1 : 0;
11426
11443
  const stopped = status === "canceled" || status === "failed";
11427
- const detail = status === "canceled" ? "This request was canceled" : status === "failed" ? "Delivery needs attention" : rfa.submittedAt ? `Sent ${rfaShortDate(rfa.submittedAt)}` : "Not sent yet";
11444
+ const failure = status === "failed" ? rfa.transmissions.map(rfaFailureReason).filter(Boolean).at(-1) : "";
11445
+ const detail = status === "canceled" ? "This request was canceled" : status === "failed" ? `Delivery needs attention${failure ? `: ${failure.charAt(0).toLowerCase()}${failure.slice(1)}` : ""}` : rfa.submittedAt ? `Sent ${rfaShortDate(rfa.submittedAt)}` : "Not sent yet";
11428
11446
  return /* @__PURE__ */ jsxs28("section", { className: "mbrfa-status", "aria-label": "Request status", "data-stopped": stopped || void 0, children: [
11429
11447
  /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-heading", children: [
11430
11448
  /* @__PURE__ */ jsxs28("div", { children: [
11431
- /* @__PURE__ */ jsx30("h3", { children: !rfa.submittedAt && !stopped ? "Draft" : RFA_LIFECYCLE_LABELS2[status] }),
11449
+ /* @__PURE__ */ jsx30("h3", { children: !rfa.submittedAt && !stopped ? "Draft" : !stopped && rfaDecisionSummary(rfa) ? rfaDecisionSummary(rfa).label : RFA_LIFECYCLE_LABELS2[status] }),
11432
11450
  /* @__PURE__ */ jsx30("p", { children: detail })
11433
11451
  ] }),
11434
11452
  rfa.submittedAt && !stopped ? /* @__PURE__ */ jsxs28("div", { className: "mbrfa-status-due", children: [
@@ -11739,7 +11757,8 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11739
11757
  ] }) }),
11740
11758
  /* @__PURE__ */ jsx31("tbody", { children: rfa.items.map((item, index) => {
11741
11759
  const appointment = scheduling.find((value) => value.itemId === item.id);
11742
- const outcome = rfaOutcome(item);
11760
+ const awaiting = item.outcome === "pending" && !item.decisionClosure?.closed && rfa.items.some((other) => other.outcome !== "pending");
11761
+ const outcome = awaiting ? { label: "Awaiting decision", tone: "warn" } : rfaOutcome(item);
11743
11762
  const showAppointment = !!appointment && (appointment.eligible || appointment.version > 0);
11744
11763
  const closable = canClose && item.outcome === "pending" && !item.decidedAt;
11745
11764
  const correctable = canCorrect && !!item.currentDecisionEventId && item.outcome !== "pending";
@@ -11851,7 +11870,8 @@ function RfaTrackingContent({ rfa: provided, options, permissions = [], onUpdate
11851
11870
  transmission.providerMessageId ? /* @__PURE__ */ jsxs29("small", { children: [
11852
11871
  "Reference ",
11853
11872
  transmission.providerMessageId
11854
- ] }) : null
11873
+ ] }) : null,
11874
+ rfaFailureReason(transmission) ? /* @__PURE__ */ jsx31("small", { children: rfaFailureReason(transmission) }) : null
11855
11875
  ] }),
11856
11876
  /* @__PURE__ */ jsx31("td", { children: rfaShortDate(transmission.receivedAt) }),
11857
11877
  /* @__PURE__ */ jsx31("td", { className: "mbrfa-row-actions", children: evidence(transmission.proofDocumentId, "Receipt") })
@@ -13025,6 +13045,13 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
13025
13045
  } }),
13026
13046
  /* @__PURE__ */ jsx39("button", { type: "button", "aria-label": `Remove ${item}`, onClick: () => emit(codes2.filter((_, position) => position !== index), descriptions2.filter((_, position) => position !== index)), children: "\xD7" })
13027
13047
  ] }, item)) }) : null,
13048
+ codes2.length < 12 && savedCodes.some((saved) => saved && !chosen(saved)) ? /* @__PURE__ */ jsxs37("div", { className: "mbrfa-dx-suggest", role: "group", "aria-label": "Diagnoses saved on this injury", children: [
13049
+ /* @__PURE__ */ jsx39("span", { children: "On this injury:" }),
13050
+ savedCodes.filter((saved) => saved && !chosen(saved)).map((saved) => /* @__PURE__ */ jsxs37("button", { type: "button", "aria-label": `Add ${saved}`, onClick: () => add(`saved:${saved}`), children: [
13051
+ "+ ",
13052
+ saved
13053
+ ] }, saved))
13054
+ ] }) : null,
13028
13055
  codes2.length < 12 ? /* @__PURE__ */ jsx39(RfaIdentitySelect, { label: "ICD-10 Code", placeholder: codes2.length ? "Add another ICD-10 code" : "Enter code", searchPlaceholder: "Search by code or diagnosis", query, onSearch: setQuery, searchable: true, loading: searching && !options.length, error, value: "", options, onSelect: add }) : null
13029
13056
  ] }) });
13030
13057
  }
@@ -13436,6 +13463,10 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13436
13463
  useEffect23(() => {
13437
13464
  if (officialForm && returnFax) setDraft((current) => current.requestingPractice?.fax?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, fax: returnFax } });
13438
13465
  }, [officialForm, returnFax, savedDraft.requestingPractice?.fax]);
13466
+ const adjusterName = formDetails?.adjusterName;
13467
+ useEffect23(() => {
13468
+ if (officialForm && adjusterName) setDraft((current) => !current.authorizationContact || current.authorizationContact.contactName?.trim() ? current : { ...current, authorizationContact: { ...current.authorizationContact, contactName: adjusterName } });
13469
+ }, [officialForm, adjusterName, savedDraft.authorizationContact?.name, savedDraft.authorizationContact?.contactName]);
13439
13470
  const returnEmail = formDetails?.returnEmail;
13440
13471
  useEffect23(() => {
13441
13472
  if (officialForm && returnEmail && !physicianEmail) setDraft((current) => current.requestingPractice?.email?.trim() ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: returnEmail } });
@@ -13472,7 +13503,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13472
13503
  useEffect23(() => {
13473
13504
  if (previousClaim.current !== identityKey) {
13474
13505
  setAdministratorOverride(null);
13475
- setDraft((current) => ({ ...current, authorizationContact: null, ...officialForm ? { items: [{ diagnosisCode: savedDiagnosisCodes.slice(0, 12).join(", "), serviceDescription: "" }] } : {} }));
13506
+ setDraft((current) => ({ ...current, authorizationContact: null, ...officialForm ? { items: [{ diagnosisCode: "", serviceDescription: "" }] } : {} }));
13476
13507
  previousClaim.current = identityKey;
13477
13508
  }
13478
13509
  }, [identityKey]);
@@ -14091,6 +14122,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
14091
14122
  const formDetails = {
14092
14123
  ...claim ? { employee: selectedDetails?.employee ?? { formName: claim.employeeFormName, dateOfBirth: claim.dateOfBirth, employer: claim.employer } } : employeePreview ? { employee: employeePreview } : {},
14093
14124
  ...provider ? { physician: { specialty: provider.specialty } } : {},
14125
+ ...selectedDetails?.adjusterName ?? claim?.adjusterName ? { adjusterName: selectedDetails?.adjusterName ?? claim.adjusterName } : {},
14094
14126
  ...context?.returnFax ? { returnFax: context.returnFax } : {},
14095
14127
  ...context?.returnEmail ? { returnEmail: context.returnEmail } : {}
14096
14128
  };
@@ -14132,7 +14164,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
14132
14164
  ...appearance,
14133
14165
  ...draftFormProps,
14134
14166
  disabled: official ? disabled || addingClaim : disabled || loading || addingClaim || !claim || !provider || !!error,
14135
- initialDraft: { claimId: "", patientId: "", renderingProviderId: "", employeeName: "", providerName: "", requestType: "new", reviewType: "prospective", items: [{ diagnosisCode: (draftFormProps?.officialForm ? claim?.diagnosisCodes?.slice(0, 12).join(", ") : claim?.diagnosisCodes?.[0]) ?? "", serviceDescription: "" }] },
14167
+ initialDraft: { claimId: "", patientId: "", renderingProviderId: "", employeeName: "", providerName: "", requestType: "new", reviewType: "prospective", items: [{ diagnosisCode: (draftFormProps?.officialForm ? "" : claim?.diagnosisCodes?.[0]) ?? "", serviceDescription: "" }] },
14136
14168
  ...official ? { formDetails, selectors: { claim: /* @__PURE__ */ jsx44("fieldset", { className: "mbrfa-plain", disabled, children: renderClaimSelector ? claimFields : /* @__PURE__ */ jsx44(RfaPicker, { label: "Patient and claim", children: claimFields }) }), physician: /* @__PURE__ */ jsx44("fieldset", { className: "mbrfa-plain", disabled, children: providerFields }) } } : {},
14137
14169
  identity,
14138
14170
  supportingDocuments,
@@ -14198,6 +14230,7 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14198
14230
  const supporting = rfa.documents.filter((document2) => ["clinical_report", "supporting_record"].includes(document2.documentType) && documentIds.includes(document2.id));
14199
14231
  const missingDiagnosis = rfa.items.find((item) => !(diagnosisDescriptions[item.id] ?? item.diagnosisDescription ?? "").trim());
14200
14232
  const live = environment === "live";
14233
+ const lastFailure = rfa.transmissions.map(rfaFailureReason).filter(Boolean).at(-1) ?? "";
14201
14234
  const needsSignature = !rfa.signedAt && (signatureMissing ?? signatureRefused);
14202
14235
  useEffect25(() => {
14203
14236
  if (signatureMissing === false) setSignatureRefused(false);
@@ -14273,7 +14306,11 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14273
14306
  supporting.length ? /* @__PURE__ */ jsx45("ul", { children: supporting.map((document2) => /* @__PURE__ */ jsx45("li", { children: document2.filename }, document2.id)) }) : /* @__PURE__ */ jsx45("p", { children: "None attached yet." })
14274
14307
  ] })
14275
14308
  ] }),
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,
14309
+ resend ? /* @__PURE__ */ jsxs43("p", { className: "mbrfa-send-signature", role: "status", children: [
14310
+ "The last attempt did not go through",
14311
+ lastFailure ? `: ${lastFailure.charAt(0).toLowerCase()}${lastFailure.slice(1)}` : "",
14312
+ ". Check the destination with the claims administrator, or choose another way to send, then send again."
14313
+ ] }) : null,
14277
14314
  /* @__PURE__ */ jsxs43("div", { className: "mbrfa-send-methods", role: "radiogroup", "aria-label": "Send by", children: [
14278
14315
  /* @__PURE__ */ jsx45("span", { children: "Send by" }),
14279
14316
  /* @__PURE__ */ jsxs43("label", { children: [
@@ -15635,6 +15672,8 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15635
15672
  const canSign = permissions.includes("sign") && !!actorReference?.trim();
15636
15673
  const unsent = rfa && !rfa.submittedAt && ["draft", "ready", "incomplete", "deferred"].includes(rfa.status);
15637
15674
  const resendable = !!rfa && rfaCanResend(rfa);
15675
+ const decision = rfa && !unsent && !["failed", "canceled"].includes(getRfaLifecycleStatus4(rfa)) ? rfaDecisionSummary(rfa) : null;
15676
+ const statusPill = rfa ? /* @__PURE__ */ jsx49(RfaPill, { tone: decision ? decision.tone : rfaLifecycleTone(rfa), children: unsent && getRfaLifecycleStatus4(rfa) !== "failed" ? "Draft" : decision ? decision.label : RFA_LIFECYCLE_LABELS5[getRfaLifecycleStatus4(rfa)] }) : null;
15638
15677
  const reviewable = !!rfa && (!!rfa.submittedAt || ["submitted", "received", "under_review", "information_requested", "approved", "modified", "denied", "mixed", "incomplete", "deferred"].includes(rfa.status));
15639
15678
  const openDocument = (documentId, title) => run(async () => {
15640
15679
  const blob = await client.getDocument(id, documentId);
@@ -15652,7 +15691,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15652
15691
  /* @__PURE__ */ jsxs47("div", { className: "mbrfa-detail-toolbar", children: [
15653
15692
  /* @__PURE__ */ jsx49("div", { children: simple ? /* @__PURE__ */ jsxs47(Fragment28, { children: [
15654
15693
  /* @__PURE__ */ jsx49("h2", { children: rfa.displayReference || "Request for Authorization" }),
15655
- /* @__PURE__ */ jsx49(RfaPill, { tone: rfaLifecycleTone(rfa), children: unsent ? "Draft" : RFA_LIFECYCLE_LABELS5[getRfaLifecycleStatus4(rfa)] }),
15694
+ statusPill,
15656
15695
  /* @__PURE__ */ jsx49(RfaPill, { children: rfa.expedited ? "Expedited" : sentence2(rfa.reviewType) }),
15657
15696
  rfa.claimNumber ? /* @__PURE__ */ jsxs47(RfaPill, { tone: "mono", children: [
15658
15697
  "Claim ",
@@ -15948,7 +15987,7 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15948
15987
  ] })
15949
15988
  ] }),
15950
15989
  !editing || !simple ? /* @__PURE__ */ jsxs47("div", { className: "mbrfa-bottom-actions", children: [
15951
- simple ? /* @__PURE__ */ jsx49(RfaPill, { tone: rfaLifecycleTone(rfa), children: unsent ? "Draft" : RFA_LIFECYCLE_LABELS5[getRfaLifecycleStatus4(rfa)] }) : /* @__PURE__ */ jsx49("span", { className: "mbrfa-badge", children: RFA_LIFECYCLE_LABELS5[getRfaLifecycleStatus4(rfa)] }),
15990
+ simple ? statusPill : /* @__PURE__ */ jsx49("span", { className: "mbrfa-badge", children: RFA_LIFECYCLE_LABELS5[getRfaLifecycleStatus4(rfa)] }),
15952
15991
  /* @__PURE__ */ jsxs47("div", { className: "mbtd-actions", children: [
15953
15992
  !simple && permissions.includes("edit") && canEditRfaDraft(rfa) && !editing ? /* @__PURE__ */ jsx49("button", { type: "button", className: "mbtd-primary", disabled: locked, onClick: () => {
15954
15993
  setDetailTab("details");