@mindbill/react 0.77.50 → 0.77.52
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 +5 -1
- package/dist/index.js +54 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1028,6 +1028,8 @@ type RfaDraftFormProps = TreatmentDraftAppearance & RfaContactDirectoryProps & {
|
|
|
1028
1028
|
onReview?: (draft: RfaDraftInput) => Promise<void>;
|
|
1029
1029
|
/** Save unsigned content before opening the host's actual PDF packet preview. */
|
|
1030
1030
|
onPreview?: (draft: RfaDraftInput) => Promise<void>;
|
|
1031
|
+
/** Shows the form as filled in so far, without saving it or requiring any field. Replaces `onPreview`. */
|
|
1032
|
+
onPreviewDraft?: (draft: RfaDraftInput) => Promise<void>;
|
|
1031
1033
|
/** Suppress the repeated title when composing a single creation page. */
|
|
1032
1034
|
embedded?: boolean;
|
|
1033
1035
|
/** Live identity selection on the same creation page; clinical fields remain local. */
|
|
@@ -1059,7 +1061,7 @@ type RfaDraftFormProps = TreatmentDraftAppearance & RfaContactDirectoryProps & {
|
|
|
1059
1061
|
/** Remove blank optional item fields, retaining an explicitly cleared return fax. */
|
|
1060
1062
|
declare function normalizeRfaDraft(draft: RfaDraftInput): RfaDraftInput;
|
|
1061
1063
|
declare function validateRfaDraft(draft: RfaDraftInput): string | null;
|
|
1062
|
-
declare function RfaDraftForm({ initialDraft, identity, officialForm, formDetails, selectors, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, managePracticeHref, manageLocationsHref, onRefreshProfile, profilePending, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded, onSave, onBack, mode, searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes, supportingDocuments, disabled, ...appearance }: RfaDraftFormProps): ReactElement;
|
|
1064
|
+
declare function RfaDraftForm({ initialDraft, identity, officialForm, formDetails, selectors, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, managePracticeHref, manageLocationsHref, onRefreshProfile, profilePending, onReview, onPreview, onPreviewDraft, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded, onSave, onBack, mode, searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes, supportingDocuments, disabled, ...appearance }: RfaDraftFormProps): ReactElement;
|
|
1063
1065
|
|
|
1064
1066
|
/** A saved set of requested treatments. Diagnoses stay with the claim, so templates do not carry them. */
|
|
1065
1067
|
type RfaTreatmentTemplate = {
|
|
@@ -1152,6 +1154,8 @@ type RfaDashboardProps = OrganizationClientOptions & TreatmentDraftAppearance &
|
|
|
1152
1154
|
manageLocationsHref?: string;
|
|
1153
1155
|
/** Opens the actual saved packet. Creation first saves and attaches files, then selects its detail view. */
|
|
1154
1156
|
onPreviewRequest?: (id: string) => Promise<void>;
|
|
1157
|
+
/** Shows an unsaved request form as filled in so far; the Preview button then needs no saved draft. */
|
|
1158
|
+
onPreviewDraft?: (draft: RfaDraftInput) => Promise<void>;
|
|
1155
1159
|
hideBackButton?: boolean;
|
|
1156
1160
|
hideHeading?: boolean;
|
|
1157
1161
|
/** Opt in to a list-first workspace with focused Request, Responses, Documents and History tabs. */
|
package/dist/index.js
CHANGED
|
@@ -12808,8 +12808,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
|
|
|
12808
12808
|
setPracticeQuery("");
|
|
12809
12809
|
onChosen?.();
|
|
12810
12810
|
const matching = (profile?.locations ?? []).filter((item) => item.active !== false && (item.billingProviderId === id || !item.billingProviderId && practices.length === 1));
|
|
12811
|
-
const
|
|
12812
|
-
const chosen = matching.length === 1 ? matching[0] : primary.length === 1 ? primary[0] : void 0;
|
|
12811
|
+
const chosen = matching.length === 1 ? matching[0] : void 0;
|
|
12813
12812
|
setLocation(chosen?.id ?? "");
|
|
12814
12813
|
onChange({ ...value, name: provider.name, address: provider.billingStreet ?? "", city: provider.billingCity ?? "", state: provider.billingState ?? "", zip: provider.billingZip ?? "", ...contactFields(provider), ...chosen ? located(chosen, provider) : {} });
|
|
12815
12814
|
};
|
|
@@ -12941,29 +12940,42 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
|
|
|
12941
12940
|
diagnosisDescription: nextDescriptions.some(Boolean) ? nextDescriptions.map((text3) => text3.replace(/;/g, ",").trim()).join("; ") : ""
|
|
12942
12941
|
});
|
|
12943
12942
|
const resolved = useRef19(/* @__PURE__ */ new Set());
|
|
12944
|
-
const
|
|
12945
|
-
const
|
|
12943
|
+
const started = useRef19(/* @__PURE__ */ new Set());
|
|
12944
|
+
const [, lookedUp] = useState24(0);
|
|
12945
|
+
for (const known of [...started.current]) if (!codes2.includes(known)) {
|
|
12946
|
+
started.current.delete(known);
|
|
12947
|
+
resolved.current.delete(known);
|
|
12948
|
+
}
|
|
12949
|
+
const missing = officialForm && search ? codes2.filter((item, index) => !descriptions2[index] && !started.current.has(item)) : [];
|
|
12946
12950
|
const latest = useRef19({ codes: codes2, descriptions: descriptions2, emit });
|
|
12947
12951
|
latest.current = { codes: codes2, descriptions: descriptions2, emit };
|
|
12952
|
+
const mounted = useRef19(true);
|
|
12948
12953
|
useEffect21(() => {
|
|
12949
|
-
|
|
12950
|
-
resolved.current.add(pending);
|
|
12951
|
-
let active = true;
|
|
12952
|
-
setResolving(pending);
|
|
12953
|
-
const same = (left, right) => left.replace(".", "").toUpperCase() === right.replace(".", "").toUpperCase();
|
|
12954
|
-
void search(pending).then((items) => {
|
|
12955
|
-
const match = items.find((item) => same(item.code, pending));
|
|
12956
|
-
if (!active || !match) return;
|
|
12957
|
-
const now = latest.current, at = now.codes.indexOf(pending);
|
|
12958
|
-
if (at < 0) return;
|
|
12959
|
-
now.emit(now.codes.map((item, index) => index === at ? match.code : item), now.descriptions.map((text3, index) => index === at ? match.description : text3));
|
|
12960
|
-
}).catch(() => void 0).finally(() => {
|
|
12961
|
-
if (active) setResolving("");
|
|
12962
|
-
});
|
|
12954
|
+
mounted.current = true;
|
|
12963
12955
|
return () => {
|
|
12964
|
-
|
|
12956
|
+
mounted.current = false;
|
|
12965
12957
|
};
|
|
12966
|
-
}, [
|
|
12958
|
+
}, []);
|
|
12959
|
+
const missingKey = missing.join("|");
|
|
12960
|
+
useEffect21(() => {
|
|
12961
|
+
if (!missing.length || !search) return;
|
|
12962
|
+
const same = (left, right) => left.replace(".", "").toUpperCase() === right.replace(".", "").toUpperCase();
|
|
12963
|
+
for (const wanted of missing) {
|
|
12964
|
+
started.current.add(wanted);
|
|
12965
|
+
void search(wanted).then((items) => {
|
|
12966
|
+
const match = items.find((item) => same(item.code, wanted));
|
|
12967
|
+
if (!mounted.current || !match) return;
|
|
12968
|
+
const now = latest.current, at = now.codes.indexOf(wanted);
|
|
12969
|
+
if (at < 0 || now.descriptions[at]) return;
|
|
12970
|
+
const descriptions3 = now.descriptions.map((text3, index) => index === at ? match.description : text3);
|
|
12971
|
+
latest.current = { ...now, descriptions: descriptions3 };
|
|
12972
|
+
now.emit(now.codes, descriptions3);
|
|
12973
|
+
}).catch(() => void 0).finally(() => {
|
|
12974
|
+
resolved.current.add(wanted);
|
|
12975
|
+
if (mounted.current) lookedUp((count) => count + 1);
|
|
12976
|
+
});
|
|
12977
|
+
}
|
|
12978
|
+
}, [missingKey, search]);
|
|
12967
12979
|
if (officialForm && search) {
|
|
12968
12980
|
const typed = query.trim().toUpperCase(), known = results.some((item) => item.code.toUpperCase() === typed);
|
|
12969
12981
|
const chosen = (value) => codes2.includes(value);
|
|
@@ -12976,6 +12988,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
|
|
|
12976
12988
|
const item = results.find((item2) => item2.code === value);
|
|
12977
12989
|
if (item) emit([...codes2, item.code], [...descriptions2, item.description]);
|
|
12978
12990
|
else if (value.startsWith("entered:")) {
|
|
12991
|
+
started.current.add(value.slice(8));
|
|
12979
12992
|
resolved.current.add(value.slice(8));
|
|
12980
12993
|
emit([...codes2, value.slice(8)], [...descriptions2, ""]);
|
|
12981
12994
|
} else if (value.startsWith("saved:")) emit([...codes2, value.slice(6)], [...descriptions2, ""]);
|
|
@@ -12984,7 +12997,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
|
|
|
12984
12997
|
return /* @__PURE__ */ jsx39("div", { className: "mbrfa-s6", children: /* @__PURE__ */ jsxs37(RfaPicker, { required: true, label: "ICD-10 Code", children: [
|
|
12985
12998
|
codes2.length ? /* @__PURE__ */ jsx39("ul", { className: "mbrfa-dx-list", "aria-label": "Selected ICD-10 codes", children: codes2.map((item, index) => /* @__PURE__ */ jsxs37("li", { children: [
|
|
12986
12999
|
/* @__PURE__ */ jsx39("strong", { children: item }),
|
|
12987
|
-
descriptions2[index] ||
|
|
13000
|
+
descriptions2[index] || !resolved.current.has(item) ? /* @__PURE__ */ jsx39("span", { children: descriptions2[index] || "Looking up\u2026" }) : /* @__PURE__ */ jsx39("input", { required: true, "aria-label": `Diagnosis for ${item}`, maxLength: 400, placeholder: "Type the diagnosis for this code", defaultValue: "", onBlur: (event) => {
|
|
12988
13001
|
if (event.target.value.trim()) emit(codes2, descriptions2.map((text3, position) => position === index ? event.target.value : text3));
|
|
12989
13002
|
} }),
|
|
12990
13003
|
/* @__PURE__ */ jsx39("button", { type: "button", "aria-label": `Remove ${item}`, onClick: () => emit(codes2.filter((_, position) => position !== index), descriptions2.filter((_, position) => position !== index)), children: "\xD7" })
|
|
@@ -13384,7 +13397,7 @@ function validateRfaDraft(draft2) {
|
|
|
13384
13397
|
}
|
|
13385
13398
|
return null;
|
|
13386
13399
|
}
|
|
13387
|
-
function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, managePracticeHref, manageLocationsHref, onRefreshProfile, profilePending = false, onReview, onPreview, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
|
|
13400
|
+
function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetails, selectors, onEditPractice, onAddPractice, onEditLocation, treatmentTemplates, onSaveTreatmentTemplate, onManageTreatmentTemplates, managePracticeHref, manageLocationsHref, onRefreshProfile, profilePending = false, onReview, onPreview, onPreviewDraft, searchClaimsAdministrators, getClaimsAdministratorDirectory, embedded = false, onSave, onBack, mode = "create", searchDiagnosisCodes, organizationProfile, savedDiagnosisCodes = [], supportingDocuments, disabled = false, ...appearance }) {
|
|
13388
13401
|
const [savedDraft, setDraft] = useState28(() => normalizeRfaDraft(initialDraft));
|
|
13389
13402
|
useEffect23(() => {
|
|
13390
13403
|
if (identity) setDraft((current) => {
|
|
@@ -13461,6 +13474,20 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
|
|
|
13461
13474
|
const action = useDraftSave(async (value) => {
|
|
13462
13475
|
await (intentRef.current === "preview" && onPreview ? onPreview : intentRef.current === "review" && onReview ? onReview : onSave)(value);
|
|
13463
13476
|
}), locked = disabled || action.busy;
|
|
13477
|
+
const [previewing, setPreviewing] = useState28(false);
|
|
13478
|
+
const [previewError, setPreviewError] = useState28("");
|
|
13479
|
+
const previewDraft = async () => {
|
|
13480
|
+
if (!onPreviewDraft || previewing) return;
|
|
13481
|
+
setPreviewing(true);
|
|
13482
|
+
setPreviewError("");
|
|
13483
|
+
try {
|
|
13484
|
+
await onPreviewDraft(normalizeRfaDraft(draft2));
|
|
13485
|
+
} catch {
|
|
13486
|
+
setPreviewError("The preview could not be opened. Try again.");
|
|
13487
|
+
} finally {
|
|
13488
|
+
setPreviewing(false);
|
|
13489
|
+
}
|
|
13490
|
+
};
|
|
13464
13491
|
const billingProviders = Array.isArray(organizationProfile?.billingProviders) ? organizationProfile.billingProviders : [];
|
|
13465
13492
|
const locations = Array.isArray(organizationProfile?.locations) ? organizationProfile.locations : [];
|
|
13466
13493
|
const update = (patch) => {
|
|
@@ -13640,9 +13667,10 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
|
|
|
13640
13667
|
saveError,
|
|
13641
13668
|
/* @__PURE__ */ jsxs41("div", { className: "mbtd-actions", children: [
|
|
13642
13669
|
onReview ? /* @__PURE__ */ jsx43("button", { type: "submit", className: "mbtd-primary", disabled: locked, onClick: () => chooseIntent("review"), children: action.busy && intent === "review" ? "Saving\u2026" : officialForm ? "Send" : "Review & submit" }) : null,
|
|
13643
|
-
onPreview ? /* @__PURE__ */ jsx43("button", { type: "submit", disabled: locked, onClick: () => chooseIntent("preview"), children: action.busy && intent === "preview" ? "Preparing preview\u2026" : "Preview" }) : null,
|
|
13670
|
+
onPreviewDraft ? /* @__PURE__ */ jsx43("button", { type: "button", disabled: locked || previewing, onClick: () => void previewDraft(), children: previewing ? "Preparing preview\u2026" : "Preview" }) : onPreview ? /* @__PURE__ */ jsx43("button", { type: "submit", disabled: locked, onClick: () => chooseIntent("preview"), children: action.busy && intent === "preview" ? "Preparing preview\u2026" : "Preview" }) : null,
|
|
13644
13671
|
/* @__PURE__ */ jsx43("button", { type: "submit", className: onReview ? void 0 : "mbtd-primary", disabled: locked, onClick: () => chooseIntent("save"), children: action.busy && intent === "save" ? "Saving\u2026" : mode === "edit" ? "Save draft changes" : "Save draft" }),
|
|
13645
|
-
/* @__PURE__ */ jsx43("p", { role: "status", children: action.message })
|
|
13672
|
+
/* @__PURE__ */ jsx43("p", { role: "status", children: action.message }),
|
|
13673
|
+
previewError ? /* @__PURE__ */ jsx43("p", { role: "alert", children: previewError }) : null
|
|
13646
13674
|
] })
|
|
13647
13675
|
] })
|
|
13648
13676
|
] });
|
|
@@ -14889,7 +14917,7 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
|
|
|
14889
14917
|
const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
|
|
14890
14918
|
return /* @__PURE__ */ jsx48(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
|
|
14891
14919
|
}
|
|
14892
|
-
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, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
|
|
14920
|
+
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 }) {
|
|
14893
14921
|
const active = useRef25(true);
|
|
14894
14922
|
useEffect27(() => {
|
|
14895
14923
|
active.current = true;
|
|
@@ -14905,7 +14933,7 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
|
|
|
14905
14933
|
const merge = (current, saved) => saved?.length ? [...current.map((item) => saved.find((next) => next.id === item.id) ?? item), ...saved.filter((next) => !current.some((item) => item.id === next.id))] : current;
|
|
14906
14934
|
setProfile((current) => current ? { ...current, billingProviders: merge(current.billingProviders, savedProfileChanges.billingProviders), locations: merge(current.locations, savedProfileChanges.locations) } : current);
|
|
14907
14935
|
}, [savedProfileChanges]);
|
|
14908
|
-
const draftFormProps = { officialForm, profilePending: !profile && !profileSettled, ...officialForm && (treatmentTemplates || onSaveTreatmentTemplate) ? { treatmentTemplates: treatmentTemplates ?? [], onSaveTreatmentTemplate, onManageTreatmentTemplates } : {}, ...onEditPractice ? { onEditPractice } : {}, ...onAddPractice ? { onAddPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
|
|
14936
|
+
const draftFormProps = { officialForm, profilePending: !profile && !profileSettled, ...onPreviewDraft ? { onPreviewDraft } : {}, ...officialForm && (treatmentTemplates || onSaveTreatmentTemplate) ? { treatmentTemplates: treatmentTemplates ?? [], onSaveTreatmentTemplate, onManageTreatmentTemplates } : {}, ...onEditPractice ? { onEditPractice } : {}, ...onAddPractice ? { onAddPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
|
|
14909
14937
|
const next = await createOrganizationClient4(options).getBillingProfile();
|
|
14910
14938
|
if (active.current) setProfile(next);
|
|
14911
14939
|
}, ...client.searchClaimsAdministrators ? { searchClaimsAdministrators: client.searchClaimsAdministrators } : {}, ...client.getClaimsAdministratorDirectory ? { getClaimsAdministratorDirectory: client.getClaimsAdministratorDirectory } : {}, searchDiagnosisCodes: references.searchDiagnosisCodes, ...profile ? { organizationProfile: profile } : {} };
|