@mindbill/react 0.77.54 → 0.77.55

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
@@ -1179,6 +1179,15 @@ type RfaDashboardProps = OrganizationClientOptions & TreatmentDraftAppearance &
1179
1179
  /** Host-owned saved provider selection and provider creation. Newly selected providers are resolved through creation context. */
1180
1180
  renderProviderSelector?: (props: RfaProviderSelectorProps) => ReactNode;
1181
1181
  canManageProviderSignatures?: boolean;
1182
+ /** Host-owned physician signature setup inside the send dialog (for example draw or upload buttons). `missing` holds the send until
1183
+ * the host reports a saved signature; leave it undefined when the host cannot tell. Replaces the built-in PNG upload there. */
1184
+ renderSendSignatureSetup?: (props: {
1185
+ renderingProviderId: string;
1186
+ providerName: string;
1187
+ }) => {
1188
+ missing?: boolean;
1189
+ setup: ReactNode;
1190
+ };
1182
1191
  /** Optional separate admin session for saving physician signatures. */
1183
1192
  signatureSession?: OrganizationClientOptions;
1184
1193
  patientId?: string;
package/dist/index.js CHANGED
@@ -14146,17 +14146,21 @@ var rfaSendDialogCss = `.mbrfa-send-backdrop{position:fixed;z-index:1000;inset:0
14146
14146
  .mbrfa-send-body{display:grid;gap:14px;padding:18px 20px;overflow:auto}.mbrfa-send-body p{margin:0}.mbrfa-send-body label{display:grid;gap:5px;font-size:13px}
14147
14147
  .mbrfa-send-methods{display:flex;flex-wrap:wrap;align-items:center;gap:6px 18px}.mbrfa-send-methods>span{font-size:13px;font-weight:600}.mbrfa-send .mb-rfa-destination{margin:0;padding:0;border:0}.mbrfa-send-to{display:grid;gap:5px;min-width:0}.mbrfa-send-to>span{font-size:13px;font-weight:600}.mbrfa-send-to[data-method=email] .mbrfa-guidance{display:none}.mbrfa-send .mb-rfa-destination label{display:grid;gap:5px}.mbrfa-send-methods label{display:flex;align-items:center;gap:8px;min-height:36px;cursor:pointer}.mbrfa-send-methods input{width:16px;height:16px;min-height:16px;margin:0;padding:0;accent-color:var(--mb-accent)}
14148
14148
  .mbrfa-send-summary{display:grid;gap:4px;padding:12px 14px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-accent) 4%,var(--mb-surface));font-size:13px}.mbrfa-send-summary span{color:var(--mb-muted)}
14149
+ .mbrfa-send-contents{display:grid;gap:10px}.mbrfa-send-contents h4{margin:0 0 4px;font-size:13px;font-weight:600}.mbrfa-send-contents ul{display:grid;gap:4px;margin:0;padding:0;list-style:none;font-size:13px}.mbrfa-send-contents li{min-width:0;overflow-wrap:anywhere}.mbrfa-send-contents li span,.mbrfa-send-contents p{color:var(--mb-muted);font-size:13px}
14150
+ .mbrfa-send-signature{display:grid;gap:8px;padding:12px 14px;border:1px solid color-mix(in srgb,var(--mb-danger,#b42318) 35%,var(--mb-border));border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger,#b42318) 5%,var(--mb-surface));font-size:13px}
14149
14151
  .mbrfa-send-confirm{display:flex!important;align-items:flex-start;gap:10px;padding-top:4px;cursor:pointer}.mbrfa-send-confirm input{width:16px;height:16px;min-height:16px;margin:3px 0 0;padding:0;flex:none;accent-color:var(--mb-accent)}
14150
14152
  .mbrfa-send>footer{display:flex;flex-direction:row-reverse;gap:10px;padding:14px 20px;border-top:1px solid var(--mb-border)}.mbrfa-send>footer>a{margin-right:auto;align-self:center;font-size:13px}
14151
14153
  .mbrfa-send [role=alert]{color:var(--mb-danger,#b42318);font-size:13px}
14152
14154
  @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}}`;
14153
- function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, directory, directoryLoading, directoryError, environment, canSend, canSign, actorReference, previewUrl, signatureSetup, onUpdated, onSent, onClose }) {
14155
+ 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 ");
14156
+ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, directory, directoryLoading, directoryError, environment, canSend, canSign, actorReference, previewUrl, signatureSetup, signatureMissing, onUpdated, onSent, onClose }) {
14154
14157
  const [method, setMethod] = useState30(() => !rfa.authorizationContact?.fax?.trim() && rfa.authorizationContact?.email?.trim() ? "email" : "fax");
14155
14158
  const [destination, setDestination] = useState30(null);
14156
14159
  const [message, setMessage] = useState30("");
14157
14160
  const [confirmed, setConfirmed] = useState30(false);
14158
14161
  const [busy, setBusy] = useState30("");
14159
14162
  const [error, setError] = useState30("");
14163
+ const [signatureRefused, setSignatureRefused] = useState30(false);
14160
14164
  const keys = useRef22(/* @__PURE__ */ new Map());
14161
14165
  const alive = useRef22(true);
14162
14166
  const latest = useRef22(rfa);
@@ -14169,7 +14173,7 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14169
14173
  }, []);
14170
14174
  useEffect25(() => {
14171
14175
  const close = (event) => {
14172
- if (event.key === "Escape" && !busy) onClose();
14176
+ if (event.key === "Escape" && !busy && !event.defaultPrevented) onClose();
14173
14177
  };
14174
14178
  window.addEventListener("keydown", close);
14175
14179
  return () => window.removeEventListener("keydown", close);
@@ -14186,9 +14190,13 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14186
14190
  const supporting = rfa.documents.filter((document2) => ["clinical_report", "supporting_record"].includes(document2.documentType) && documentIds.includes(document2.id));
14187
14191
  const missingDiagnosis = rfa.items.find((item) => !(diagnosisDescriptions[item.id] ?? item.diagnosisDescription ?? "").trim());
14188
14192
  const live = environment === "live";
14193
+ const needsSignature = !rfa.signedAt && (signatureMissing ?? signatureRefused);
14194
+ useEffect25(() => {
14195
+ if (signatureMissing === false) setSignatureRefused(false);
14196
+ }, [signatureMissing]);
14189
14197
  const blocked = !supporting.length ? "Add the report that supports this request (PR-2, Doctor's First Report or narrative) before sending." : missingDiagnosis ? `Add the diagnosis for ${missingDiagnosis.diagnosisCode} (Edit request) before sending.` : !rfa.signedAt && !canSign ? "Sending applies the physician's saved signature, and your account is not set up to do that." : !live ? "This is a sandbox: nothing is faxed or e-mailed." : !canSend ? "Sending requires permission from your organization." : "";
14190
14198
  const go = async () => {
14191
- if (busy || blocked || !confirmed || !destination) return;
14199
+ if (busy || blocked || needsSignature || !confirmed || !destination) return;
14192
14200
  setError("");
14193
14201
  try {
14194
14202
  let current = latest.current, ids = documentIds;
@@ -14209,7 +14217,9 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14209
14217
  onSent(await client.submit(current.id, body, stable("submit", body)));
14210
14218
  } catch (caught) {
14211
14219
  const reason = caught instanceof Error ? caught.message : "";
14212
- if (alive.current) setError(/saved.signature/i.test(reason) ? `${rfa.providerName} has no saved signature yet. Add it on the physician\u2019s page, then send again. Nothing was sent.` : reason || "The request could not be sent. Nothing was sent; try again.");
14220
+ if (!alive.current) return;
14221
+ if (/saved.signature/i.test(reason)) setSignatureRefused(true);
14222
+ else setError(reason || "The request could not be sent. Nothing was sent; try again.");
14213
14223
  } finally {
14214
14224
  if (alive.current) setBusy("");
14215
14225
  }
@@ -14231,16 +14241,28 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14231
14241
  rfa.employeeName,
14232
14242
  rfa.claimNumber ? ` \xB7 Claim ${rfa.claimNumber}` : ""
14233
14243
  ] }),
14234
- /* @__PURE__ */ jsxs43("span", { children: [
14235
- rfa.providerName,
14236
- " \xB7 ",
14237
- rfa.items.length,
14238
- " requested treatment",
14239
- rfa.items.length === 1 ? "" : "s",
14240
- " \xB7 ",
14241
- supporting.length,
14242
- " supporting document",
14243
- supporting.length === 1 ? "" : "s"
14244
+ /* @__PURE__ */ jsx45("span", { children: rfa.providerName })
14245
+ ] }),
14246
+ /* @__PURE__ */ jsxs43("div", { className: "mbrfa-send-contents", children: [
14247
+ /* @__PURE__ */ jsxs43("div", { children: [
14248
+ /* @__PURE__ */ jsxs43("h4", { children: [
14249
+ "Requested treatment",
14250
+ rfa.items.length === 1 ? "" : "s"
14251
+ ] }),
14252
+ /* @__PURE__ */ jsx45("ul", { children: rfa.items.map((item) => {
14253
+ const detail = treatmentDetail(item);
14254
+ return /* @__PURE__ */ jsxs43("li", { children: [
14255
+ item.serviceDescription,
14256
+ detail ? /* @__PURE__ */ jsxs43("span", { children: [
14257
+ " \xB7 ",
14258
+ detail
14259
+ ] }) : null
14260
+ ] }, item.id);
14261
+ }) })
14262
+ ] }),
14263
+ /* @__PURE__ */ jsxs43("div", { children: [
14264
+ /* @__PURE__ */ jsx45("h4", { children: "Supporting documents" }),
14265
+ supporting.length ? /* @__PURE__ */ jsx45("ul", { children: supporting.map((document2) => /* @__PURE__ */ jsx45("li", { children: document2.filename }, document2.id)) }) : /* @__PURE__ */ jsx45("p", { children: "None attached yet." })
14244
14266
  ] })
14245
14267
  ] }),
14246
14268
  /* @__PURE__ */ jsxs43("div", { className: "mbrfa-send-methods", role: "radiogroup", "aria-label": "Send by", children: [
@@ -14272,7 +14294,15 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14272
14294
  " (optional)",
14273
14295
  /* @__PURE__ */ jsx45("textarea", { disabled: !!busy, maxLength: 1e3, rows: 2, value: message, onChange: (event) => setMessage(event.target.value) })
14274
14296
  ] }),
14275
- signatureSetup,
14297
+ needsSignature ? /* @__PURE__ */ jsxs43("div", { className: "mbrfa-send-signature", children: [
14298
+ /* @__PURE__ */ jsxs43("p", { role: "alert", children: [
14299
+ rfa.providerName,
14300
+ " has no saved signature yet. Sending puts the physician\u2019s signature on the form, so add it first.",
14301
+ signatureSetup ? "" : " Add it on the physician\u2019s page, then send again.",
14302
+ signatureRefused ? " Nothing was sent." : ""
14303
+ ] }),
14304
+ signatureSetup
14305
+ ] }) : signatureSetup,
14276
14306
  blocked ? /* @__PURE__ */ jsx45("p", { role: "alert", children: blocked }) : /* @__PURE__ */ jsxs43("label", { className: "mbrfa-send-confirm", children: [
14277
14307
  /* @__PURE__ */ jsx45("input", { type: "checkbox", checked: confirmed, disabled: !!busy || !destination, onChange: (event) => setConfirmed(event.target.checked) }),
14278
14308
  /* @__PURE__ */ jsxs43("span", { children: [
@@ -14291,7 +14321,7 @@ function RfaSendDialog({ rfa, client, documentIds, diagnosisDescriptions, direct
14291
14321
  error ? /* @__PURE__ */ jsx45("p", { role: "alert", children: error }) : null
14292
14322
  ] }),
14293
14323
  /* @__PURE__ */ jsxs43("footer", { children: [
14294
- /* @__PURE__ */ jsx45("button", { type: "button", className: "mbtd-primary", disabled: !!busy || !!blocked || !confirmed || !destination, onClick: () => void go(), children: busy || (method === "email" ? "Send e-mail" : "Send fax") }),
14324
+ /* @__PURE__ */ jsx45("button", { type: "button", className: "mbtd-primary", disabled: !!busy || !!blocked || needsSignature || !confirmed || !destination, onClick: () => void go(), children: busy || (method === "email" ? "Send e-mail" : "Send fax") }),
14295
14325
  /* @__PURE__ */ jsx45("button", { type: "button", disabled: !!busy, onClick: onClose, children: "Cancel" }),
14296
14326
  previewUrl ? /* @__PURE__ */ jsx45("a", { href: previewUrl, target: "_blank", rel: "noopener noreferrer", children: "Preview packet" }) : null
14297
14327
  ] })
@@ -14931,7 +14961,7 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14931
14961
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14932
14962
  return /* @__PURE__ */ jsx48(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14933
14963
  }
14934
- function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialDetailAction, initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, savedProfileChanges, manageLocationsHref, onPreviewRequest, onPreviewDraft, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14964
+ function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialDetailAction, initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, savedProfileChanges, manageLocationsHref, onPreviewRequest, onPreviewDraft, canManageProviderSignatures = false, renderSendSignatureSetup, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14935
14965
  const active = useRef25(true);
14936
14966
  useEffect27(() => {
14937
14967
  active.current = true;
@@ -15117,7 +15147,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
15117
15147
  } }) : selected ? /* @__PURE__ */ jsx48(RfaDetail, { layout, ...initialDetailAction ? { initialAction: initialDetailAction } : {}, ...relatedLinks, ...formPreviewUrl ? { formPreviewUrl } : {}, id: selected, selectedItem, ...selectedResponseDocumentId ? { selectedResponseDocumentId } : {}, client, signatureClient, options, onCopied: (draft2) => {
15118
15148
  selectRfa(draft2.id);
15119
15149
  onCreated?.(draft2);
15120
- }, draftFormProps, canManageProviderSignatures, permissions, environment, ...actorReference ? { actorReference } : {}, ...onContinue ? { onContinue } : {}, ...appearance.disabled !== void 0 ? { disabled: appearance.disabled } : {} }, selected) : /* @__PURE__ */ jsxs46(Fragment27, { children: [
15150
+ }, draftFormProps, canManageProviderSignatures, ...renderSendSignatureSetup ? { renderSendSignatureSetup } : {}, permissions, environment, ...actorReference ? { actorReference } : {}, ...onContinue ? { onContinue } : {}, ...appearance.disabled !== void 0 ? { disabled: appearance.disabled } : {} }, selected) : /* @__PURE__ */ jsxs46(Fragment27, { children: [
15121
15151
  view === "overview" ? /* @__PURE__ */ jsx48(RfaTaskBoard, { ...taskPresentation ? { presentation: taskPresentation } : {}, ...taskQuery2 ? { query: taskQuery2 } : {}, ...renderTaskIdentity ? { renderTaskIdentity } : {}, ...navigation?.getTaskHref ? { getTaskHref: navigation.getTaskHref } : {}, ...navigation?.onNavigate ? { onNavigate: navigation.onNavigate } : {}, embedded: true, ...appearance, ...options, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, permissions: permissions.filter((value) => value === "act"), onSelect: (id, documentId) => selectRfa(id, documentId ? { responseDocumentId: documentId } : void 0) }) : /* @__PURE__ */ jsxs46("div", { className: "mbrfa-filters", children: [
15122
15152
  /* @__PURE__ */ jsxs46("label", { className: "mbrfa-search", children: [
15123
15153
  "Search requests",
@@ -15199,7 +15229,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
15199
15229
  ] })
15200
15230
  ] });
15201
15231
  }
15202
- function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, client, signatureClient, options, permissions, environment, actorReference, onContinue, disabled, draftFormProps, canManageProviderSignatures, onCopied, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, initialAction }) {
15232
+ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, client, signatureClient, options, permissions, environment, actorReference, onContinue, disabled, draftFormProps, canManageProviderSignatures, renderSendSignatureSetup, onCopied, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, initialAction }) {
15203
15233
  const [rfa, setRfa] = useState33(null);
15204
15234
  const [error, setError] = useState33("");
15205
15235
  const [busy, setBusy] = useState33(false);
@@ -15708,30 +15738,34 @@ function RfaDetail({ layout, id, selectedItem, selectedResponseDocumentId, clien
15708
15738
  simple && unsent ? /* @__PURE__ */ jsx48("button", { type: "button", className: "mbtd-primary", disabled: locked, onClick: () => setSending(true), children: "Send" }) : simple && reviewable && detailTab === "details" ? /* @__PURE__ */ jsx48("button", { type: "button", disabled: locked, onClick: () => reveal("review"), children: "Record response" }) : null
15709
15739
  ] })
15710
15740
  ] }) : null,
15711
- simple && sending && unsent ? /* @__PURE__ */ jsx48(
15712
- RfaSendDialog,
15713
- {
15714
- rfa,
15715
- client,
15716
- documentIds,
15717
- diagnosisDescriptions: descriptions2,
15718
- directory,
15719
- directoryLoading,
15720
- directoryError,
15721
- environment,
15722
- canSend: permissions.includes("send"),
15723
- canSign,
15724
- actorReference,
15725
- previewUrl: formPreviewUrl,
15726
- signatureSetup: canManageProviderSignatures && canSign ? settingSignature ? /* @__PURE__ */ jsx48(RfaProviderSignatureSetup, { client: signatureClient, renderingProviderId: rfa.renderingProviderId, providerName: rfa.providerName, disabled: !!locked, onSaved: () => setSettingSignature(false), onCancel: () => setSettingSignature(false) }) : /* @__PURE__ */ jsx48("p", { children: /* @__PURE__ */ jsx48("button", { type: "button", className: "mbrfa-text-link", onClick: () => setSettingSignature(true), children: "Set up or replace the physician's saved signature" }) }) : null,
15727
- onUpdated: adopt,
15728
- onSent: (value) => {
15729
- adopt(value);
15730
- setSending(false);
15731
- },
15732
- onClose: () => setSending(false)
15733
- }
15734
- ) : null
15741
+ simple && sending && unsent ? (() => {
15742
+ const hostSignature = renderSendSignatureSetup?.({ renderingProviderId: rfa.renderingProviderId, providerName: rfa.providerName });
15743
+ return /* @__PURE__ */ jsx48(
15744
+ RfaSendDialog,
15745
+ {
15746
+ rfa,
15747
+ client,
15748
+ documentIds,
15749
+ diagnosisDescriptions: descriptions2,
15750
+ directory,
15751
+ directoryLoading,
15752
+ directoryError,
15753
+ environment,
15754
+ canSend: permissions.includes("send"),
15755
+ canSign,
15756
+ actorReference,
15757
+ previewUrl: formPreviewUrl,
15758
+ signatureMissing: hostSignature?.missing,
15759
+ signatureSetup: hostSignature ? hostSignature.setup : canManageProviderSignatures && canSign ? settingSignature ? /* @__PURE__ */ jsx48(RfaProviderSignatureSetup, { client: signatureClient, renderingProviderId: rfa.renderingProviderId, providerName: rfa.providerName, disabled: !!locked, onSaved: () => setSettingSignature(false), onCancel: () => setSettingSignature(false) }) : /* @__PURE__ */ jsx48("p", { children: /* @__PURE__ */ jsx48("button", { type: "button", className: "mbrfa-text-link", onClick: () => setSettingSignature(true), children: "Set up or replace the physician's saved signature" }) }) : null,
15760
+ onUpdated: adopt,
15761
+ onSent: (value) => {
15762
+ adopt(value);
15763
+ setSending(false);
15764
+ },
15765
+ onClose: () => setSending(false)
15766
+ }
15767
+ );
15768
+ })() : null
15735
15769
  ] })
15736
15770
  ] });
15737
15771
  }