@mindbill/browser 0.46.0 → 0.48.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/dist/index.d.ts +47 -2
- package/dist/index.js +47 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
type RfaLifecycleStatus = "incomplete" | "sent" | "failed" | "received" | "closed" | "canceled";
|
|
2
|
+
declare const RFA_LIFECYCLE_LABELS: Readonly<Record<RfaLifecycleStatus, string>>;
|
|
3
|
+
type LifecycleRecord = Pick<RfaRecord, "status"> & Partial<Pick<RfaRecord, "lifecycleStatus" | "submittedAt" | "receivedAt" | "transmissions">>;
|
|
4
|
+
/** Prefer the API lifecycle. Older responses are derived from the current submission's evidence. */
|
|
5
|
+
declare function getRfaLifecycleStatus(rfa: LifecycleRecord): RfaLifecycleStatus;
|
|
6
|
+
|
|
1
7
|
/** One patient's complete services for one provider/group. Dates are service dates, not publication dates. */
|
|
2
8
|
type CaClaimFeeQuoteInput = {
|
|
3
9
|
lines: Array<Omit<BillFeeQuoteInput, "billingProviderId" | "payerId" | "physicianContext"> & {
|
|
@@ -136,6 +142,8 @@ type RfaAuthorizationDestinationOption = {
|
|
|
136
142
|
destination: string;
|
|
137
143
|
label: string;
|
|
138
144
|
phone?: string;
|
|
145
|
+
/** Recipient attention line, retained on the reviewed delivery cover. */
|
|
146
|
+
recipientName?: string;
|
|
139
147
|
};
|
|
140
148
|
/** Accept fax numbers only, never telephone notes, email addresses, or extensions. */
|
|
141
149
|
declare function normalizeRfaFax(value: string): string | null;
|
|
@@ -257,11 +265,40 @@ type RfaFollowUpUpdate = {
|
|
|
257
265
|
allDecisionsRecordedConfirmed: true;
|
|
258
266
|
};
|
|
259
267
|
};
|
|
268
|
+
type RfaInboundFax = {
|
|
269
|
+
id: string;
|
|
270
|
+
receivedAt: string;
|
|
271
|
+
fromFax: string | null;
|
|
272
|
+
fromName: string | null;
|
|
273
|
+
pages: number | null;
|
|
274
|
+
ocrStatus: string | null;
|
|
275
|
+
matchedRfaId: string | null;
|
|
276
|
+
documentId: string | null;
|
|
277
|
+
previewUrl: string;
|
|
278
|
+
suggestedRfaIds: string[];
|
|
279
|
+
};
|
|
280
|
+
type RfaInboundFaxMatch = {
|
|
281
|
+
faxId: string;
|
|
282
|
+
rfaId: string;
|
|
283
|
+
documentId: string;
|
|
284
|
+
alreadyAttached: boolean;
|
|
285
|
+
};
|
|
260
286
|
type RfaFollowUpList = {
|
|
261
287
|
data: RfaFollowUp[];
|
|
262
288
|
nextCursor: string | null;
|
|
263
289
|
};
|
|
264
290
|
type RfaLifecycleClient = {
|
|
291
|
+
listInboundFaxes(query?: {
|
|
292
|
+
includeMatched?: boolean;
|
|
293
|
+
cursor?: string;
|
|
294
|
+
limit?: number;
|
|
295
|
+
}): Promise<{
|
|
296
|
+
data: RfaInboundFax[];
|
|
297
|
+
hasMore: boolean;
|
|
298
|
+
nextCursor: string | null;
|
|
299
|
+
}>;
|
|
300
|
+
getInboundFaxContent(faxId: string): Promise<Blob>;
|
|
301
|
+
matchInboundFax(faxId: string, rfaId: string, idempotencyKey: string): Promise<RfaInboundFaxMatch>;
|
|
265
302
|
listScheduling(id: string): Promise<RfaScheduling[]>;
|
|
266
303
|
updateScheduling(id: string, itemId: string, input: RfaSchedulingInput, idempotencyKey: string): Promise<RfaScheduling[]>;
|
|
267
304
|
correctDecision(id: string, input: RfaDecisionCorrectionInput, idempotencyKey: string): Promise<RfaRecord>;
|
|
@@ -272,6 +309,8 @@ type RfaLifecycleClient = {
|
|
|
272
309
|
recordInformationResponse(id: string, requestId: string, input: RfaInformationResponseInput, idempotencyKey: string): Promise<RfaRecord>;
|
|
273
310
|
recordDecisions(id: string, input: RfaDecisionsInput, idempotencyKey: string): Promise<RfaRecord>;
|
|
274
311
|
listFollowUps(query?: {
|
|
312
|
+
patientId?: string;
|
|
313
|
+
renderingProviderId?: string;
|
|
275
314
|
claimId?: string;
|
|
276
315
|
includeResolved?: boolean;
|
|
277
316
|
limit?: number;
|
|
@@ -1900,6 +1939,7 @@ type RfaDeliveryPreviewInput = {
|
|
|
1900
1939
|
documentIds: string[];
|
|
1901
1940
|
channel: "fax" | "email" | "download";
|
|
1902
1941
|
to?: string;
|
|
1942
|
+
recipientName?: string;
|
|
1903
1943
|
message?: string;
|
|
1904
1944
|
};
|
|
1905
1945
|
type RfaDeliveryPreview = {
|
|
@@ -1910,6 +1950,7 @@ type RfaDeliveryPreview = {
|
|
|
1910
1950
|
type RfaSubmitInput = Omit<RfaDeliveryPreview, "contentRevision"> & {
|
|
1911
1951
|
channel: "fax" | "email";
|
|
1912
1952
|
to: string;
|
|
1953
|
+
recipientName?: string;
|
|
1913
1954
|
message?: string;
|
|
1914
1955
|
nonBusinessDates?: string[];
|
|
1915
1956
|
};
|
|
@@ -1970,6 +2011,8 @@ type RfaRecord = {
|
|
|
1970
2011
|
providerName: string;
|
|
1971
2012
|
claimNumber: string | null;
|
|
1972
2013
|
status: string;
|
|
2014
|
+
/** Delivery/review lifecycle, separate from the clinical status and item outcomes. */
|
|
2015
|
+
lifecycleStatus?: RfaLifecycleStatus;
|
|
1973
2016
|
requestType?: RfaCreateDraftInput["requestType"];
|
|
1974
2017
|
writtenConfirmation?: boolean;
|
|
1975
2018
|
requestingPractice?: RfaContact | null;
|
|
@@ -2063,11 +2106,12 @@ type RfaRecord = {
|
|
|
2063
2106
|
type RfaListQuery = {
|
|
2064
2107
|
patientId?: string;
|
|
2065
2108
|
search?: string;
|
|
2066
|
-
sortBy?: "createdAt" | "employeeName" | "providerName" | "submittedAt" | "status";
|
|
2109
|
+
sortBy?: "createdAt" | "employeeName" | "providerName" | "submittedAt" | "status" | "lifecycleStatus";
|
|
2067
2110
|
sortDirection?: "asc" | "desc";
|
|
2068
2111
|
claimId?: string;
|
|
2069
2112
|
renderingProviderId?: string;
|
|
2070
2113
|
status?: string;
|
|
2114
|
+
lifecycleStatus?: RfaLifecycleStatus;
|
|
2071
2115
|
createdFrom?: string;
|
|
2072
2116
|
createdTo?: string;
|
|
2073
2117
|
limit?: number;
|
|
@@ -2079,6 +2123,7 @@ type RfaListResult = {
|
|
|
2079
2123
|
summary: {
|
|
2080
2124
|
total: number;
|
|
2081
2125
|
byStatus: Record<string, number>;
|
|
2126
|
+
byLifecycleStatus?: Partial<Record<RfaLifecycleStatus, number>>;
|
|
2082
2127
|
};
|
|
2083
2128
|
};
|
|
2084
2129
|
type RfaSigningPreviewInput = {
|
|
@@ -2191,4 +2236,4 @@ type RfaClient = {
|
|
|
2191
2236
|
/** Uses short-lived browser credentials. Never pass a partner API key. */
|
|
2192
2237
|
declare function createRfaClient({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride }?: OrganizationClientOptions): RfaClient;
|
|
2193
2238
|
|
|
2194
|
-
export { type AddBillNoteInput, BILL_FEE_QUOTE_BASES, BILL_TASKS_AGING_BUCKETS, type BillActivityRecord, type BillActorInput, type BillAttemptSummary, type BillClaimsAdministratorAuthorizationStatus, type BillClaimsAdministratorContact, type BillClaimsAdministratorDirectory, type BillClaimsAdministratorMailingAddress, type BillClaimsAdministratorPattern, type BillClaimsAdministratorPayer, type BillClaimsAdministratorSource, type BillCourtesyCopyInput, type BillCourtesyCopyPreview, type BillCourtesyCopyResult, type BillDeliveryOption, type BillDeliveryOptions, type BillDeliveryPreviewInput, type BillDiagnosisCode, type BillEorDocument, type BillFeeContext, type BillFeeQuote, type BillFeeQuoteBasis, type BillFeeQuoteInput, type BillFeeSource, type BillFormData, type BillFormValue, type BillHistoryEntry, type BillLifecycleAction, type BillLifecycleActionId, type BillLifecycleClient, type BillLifecycleClientOptions, type BillLifecycleData, type BillLifecycleDelivery, type BillLifecycleSession, type BillLifecycleSessionProvider, type BillLifecycleSessionRequest, type BillLineFeeBreakdown, type BillLineFormData, type BillPaymentRecord, type BillPostalPlace, type BillProcedureCodePage, type BillProcedureCodeSearchInput, type BillReferenceClient, type BillReferenceClientOptions, type BillRejection, type BillRejectionIssue, type BillRemittanceSummary, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClaimPatternStatus, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewFeatures, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewPayerListInput, type BillReviewPayerOption, type BillReviewPayerPage, type BillReviewPayerSuggestion, type BillReviewSaveInput, type BillSubmissionClient, type BillSubmissionClientOptions, type BillSubmissionDetail, type BillSubmissionRoute, type BillTasksAgingBucket, type BillTasksDashboardData, type BillTasksDashboardItem, type BillTasksDashboardRow, type BillTasksDashboardSection, type BillTasksDashboardSectionInput, type BillTasksDashboardTone, type BillTeamNote, type BilledDrug, type BrowserBillAddress, type BrowserBillCreateInput, type BrowserBillSubmissionDocument, type BrowserBillSubmissionInput, type BrowserBillSubmissionResult, type BrowserSubmittedBill, type CaAnesthesiaContext, type CaAnesthesiaEvent, type CaAnesthesiaInterval, type CaAnesthesiaOptionalParticipation, type CaAnesthesiaParticipation, type CaClaimEditFinding, type CaClaimFeeFinding, type CaClaimFeeQuoteInput, type CaClaimFeeQuoteResult, type CaClaimLineQuote, type CaFeeCalculation, type CaFeeCitation, type CaMedicalDirection, type CaMedicalDirectionCase, type CaMonitoredAnesthesiaCare, type CaPadbContext, type CaProfessionalComponentContext, type CaTechnicalComponentContext, type CaTherapyContext, type ClaimForm, type CloseBillInput, type CorrectionDraft, DEFAULT_API_BASE_URL, DEFAULT_SESSION_ENDPOINT, type HistoricalBillReviewData, type OrganizationBillingProviderInput, type OrganizationChecklistItem, type OrganizationClaimsAdministrator, type OrganizationClaimsAdministratorInput, type OrganizationClient, type OrganizationClientOptions, type OrganizationLocationInput, type OrganizationPracticeIdentity, type OrganizationProfileData, type OrganizationRenderingProviderInput, type OrganizationTeam, type OrganizationTeamMember, type OrganizationTeamRole, type PostBillPaymentInput, REPORT_BILL_STATUS_OPTIONS, type ReopenBillInput, type ReportAutofillClient, type ReportAutofillField, type ReportAutofillMatch, type ReportAutofillResult, type ReportBillStatusActionInput, type ReportBillStatusContacts, type ReportBillStatusId, type ReportBillStatusInput, type ReportBillStatusOption, type ResubmitBillInput, type RfaAuthorizationDestinationOption, type RfaClient, type RfaContact, type RfaCreateDraftInput, type RfaCreationClaim, type RfaCreationContext, type RfaCreationContextQuery, type RfaCreationProvider, type RfaDecisionCorrectionInput, type RfaDecisionsInput, type RfaDeliveryPreview, type RfaDeliveryPreviewInput, type RfaDraftActionsClient, type RfaFaxInput, type RfaFollowUp, type RfaFollowUpList, type RfaFollowUpUpdate, type RfaForwardInput, type RfaForwardResult, type RfaHistoryEvent, type RfaInformationRequestInput, type RfaInformationResponseInput, type RfaLifecycleClient, type RfaListQuery, type RfaListResult, type RfaPacketHistory, type RfaPacketTransmission, type RfaPacketsClient, type RfaProvisionClaimInput, type RfaProvisionClaimResult, type RfaReceiptInput, type RfaRecord, type RfaSavedPacket, type RfaScheduling, type RfaSchedulingInput, type RfaSignInput, type RfaSigningPreview, type RfaSigningPreviewInput, type RfaSubmitInput, type RfaTreatmentDecisionInput, type RfaUpdateDraftInput, type RfaUploadDocumentInput, SECOND_REVIEW_REASON_TEMPLATE, SECOND_REVIEW_WINDOW_DAYS, type SandboxSimulationScenario, type SecondReviewDeadline, type SecondReviewLineInput, type SendDuplicateBillInput, type SimulateSandboxBillInput, type SubmitBillInput, type SubmitNewBillInput, type SubmitSecondReviewInput, billTasksAgingBucketIndex, buildBillTasksDashboard, createBillLifecycleClient, createBillReferenceClient, createBillSubmissionClient, createOrganizationClient, createReportAutofillClient, createRfaClient, createRfaDraftActionsClient, createRfaLifecycleClient, createRfaPacketsClient, defaultBillReviewPayerOption, normalizeRfaFax, organizationTaxIdWrite, parseSecondReviewCorrection, reportBillStatusContacts, rfaAuthorizationDestinations, rfaAuthorizationGuidance, sanitizeBillReviewSaveInput, secondReviewDeadline };
|
|
2239
|
+
export { type AddBillNoteInput, BILL_FEE_QUOTE_BASES, BILL_TASKS_AGING_BUCKETS, type BillActivityRecord, type BillActorInput, type BillAttemptSummary, type BillClaimsAdministratorAuthorizationStatus, type BillClaimsAdministratorContact, type BillClaimsAdministratorDirectory, type BillClaimsAdministratorMailingAddress, type BillClaimsAdministratorPattern, type BillClaimsAdministratorPayer, type BillClaimsAdministratorSource, type BillCourtesyCopyInput, type BillCourtesyCopyPreview, type BillCourtesyCopyResult, type BillDeliveryOption, type BillDeliveryOptions, type BillDeliveryPreviewInput, type BillDiagnosisCode, type BillEorDocument, type BillFeeContext, type BillFeeQuote, type BillFeeQuoteBasis, type BillFeeQuoteInput, type BillFeeSource, type BillFormData, type BillFormValue, type BillHistoryEntry, type BillLifecycleAction, type BillLifecycleActionId, type BillLifecycleClient, type BillLifecycleClientOptions, type BillLifecycleData, type BillLifecycleDelivery, type BillLifecycleSession, type BillLifecycleSessionProvider, type BillLifecycleSessionRequest, type BillLineFeeBreakdown, type BillLineFormData, type BillPaymentRecord, type BillPostalPlace, type BillProcedureCodePage, type BillProcedureCodeSearchInput, type BillReferenceClient, type BillReferenceClientOptions, type BillRejection, type BillRejectionIssue, type BillRemittanceSummary, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClaimPatternStatus, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewFeatures, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewPayerListInput, type BillReviewPayerOption, type BillReviewPayerPage, type BillReviewPayerSuggestion, type BillReviewSaveInput, type BillSubmissionClient, type BillSubmissionClientOptions, type BillSubmissionDetail, type BillSubmissionRoute, type BillTasksAgingBucket, type BillTasksDashboardData, type BillTasksDashboardItem, type BillTasksDashboardRow, type BillTasksDashboardSection, type BillTasksDashboardSectionInput, type BillTasksDashboardTone, type BillTeamNote, type BilledDrug, type BrowserBillAddress, type BrowserBillCreateInput, type BrowserBillSubmissionDocument, type BrowserBillSubmissionInput, type BrowserBillSubmissionResult, type BrowserSubmittedBill, type CaAnesthesiaContext, type CaAnesthesiaEvent, type CaAnesthesiaInterval, type CaAnesthesiaOptionalParticipation, type CaAnesthesiaParticipation, type CaClaimEditFinding, type CaClaimFeeFinding, type CaClaimFeeQuoteInput, type CaClaimFeeQuoteResult, type CaClaimLineQuote, type CaFeeCalculation, type CaFeeCitation, type CaMedicalDirection, type CaMedicalDirectionCase, type CaMonitoredAnesthesiaCare, type CaPadbContext, type CaProfessionalComponentContext, type CaTechnicalComponentContext, type CaTherapyContext, type ClaimForm, type CloseBillInput, type CorrectionDraft, DEFAULT_API_BASE_URL, DEFAULT_SESSION_ENDPOINT, type HistoricalBillReviewData, type OrganizationBillingProviderInput, type OrganizationChecklistItem, type OrganizationClaimsAdministrator, type OrganizationClaimsAdministratorInput, type OrganizationClient, type OrganizationClientOptions, type OrganizationLocationInput, type OrganizationPracticeIdentity, type OrganizationProfileData, type OrganizationRenderingProviderInput, type OrganizationTeam, type OrganizationTeamMember, type OrganizationTeamRole, type PostBillPaymentInput, REPORT_BILL_STATUS_OPTIONS, RFA_LIFECYCLE_LABELS, type ReopenBillInput, type ReportAutofillClient, type ReportAutofillField, type ReportAutofillMatch, type ReportAutofillResult, type ReportBillStatusActionInput, type ReportBillStatusContacts, type ReportBillStatusId, type ReportBillStatusInput, type ReportBillStatusOption, type ResubmitBillInput, type RfaAuthorizationDestinationOption, type RfaClient, type RfaContact, type RfaCreateDraftInput, type RfaCreationClaim, type RfaCreationContext, type RfaCreationContextQuery, type RfaCreationProvider, type RfaDecisionCorrectionInput, type RfaDecisionsInput, type RfaDeliveryPreview, type RfaDeliveryPreviewInput, type RfaDraftActionsClient, type RfaFaxInput, type RfaFollowUp, type RfaFollowUpList, type RfaFollowUpUpdate, type RfaForwardInput, type RfaForwardResult, type RfaHistoryEvent, type RfaInboundFax, type RfaInboundFaxMatch, type RfaInformationRequestInput, type RfaInformationResponseInput, type RfaLifecycleClient, type RfaLifecycleStatus, type RfaListQuery, type RfaListResult, type RfaPacketHistory, type RfaPacketTransmission, type RfaPacketsClient, type RfaProvisionClaimInput, type RfaProvisionClaimResult, type RfaReceiptInput, type RfaRecord, type RfaSavedPacket, type RfaScheduling, type RfaSchedulingInput, type RfaSignInput, type RfaSigningPreview, type RfaSigningPreviewInput, type RfaSubmitInput, type RfaTreatmentDecisionInput, type RfaUpdateDraftInput, type RfaUploadDocumentInput, SECOND_REVIEW_REASON_TEMPLATE, SECOND_REVIEW_WINDOW_DAYS, type SandboxSimulationScenario, type SecondReviewDeadline, type SecondReviewLineInput, type SendDuplicateBillInput, type SimulateSandboxBillInput, type SubmitBillInput, type SubmitNewBillInput, type SubmitSecondReviewInput, billTasksAgingBucketIndex, buildBillTasksDashboard, createBillLifecycleClient, createBillReferenceClient, createBillSubmissionClient, createOrganizationClient, createReportAutofillClient, createRfaClient, createRfaDraftActionsClient, createRfaLifecycleClient, createRfaPacketsClient, defaultBillReviewPayerOption, getRfaLifecycleStatus, normalizeRfaFax, organizationTaxIdWrite, parseSecondReviewCorrection, reportBillStatusContacts, rfaAuthorizationDestinations, rfaAuthorizationGuidance, sanitizeBillReviewSaveInput, secondReviewDeadline };
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function normalizeRfaFax(value) {
|
|
|
49
49
|
function rfaAuthorizationDestinations(directory) {
|
|
50
50
|
if (!directory || ["adjuster_specific_required", "daisybill_unverified", "profile_not_published"].includes(directory.authorizationStatus ?? "")) return [];
|
|
51
51
|
return (directory.authorization ?? []).flatMap((contact) => {
|
|
52
|
-
const common = { label: contact.location || contact.name || "Authorization department", ...contact.phone ? { phone: contact.phone } : {} };
|
|
52
|
+
const common = { label: contact.location || contact.name || "Authorization department", ...contact.name ? { recipientName: contact.name } : {}, ...contact.phone ? { phone: contact.phone } : {} };
|
|
53
53
|
const options = [];
|
|
54
54
|
const fax = contact.fax ? normalizeRfaFax(contact.fax) : null;
|
|
55
55
|
if (fax && contact.method !== "email") options.push({ ...common, method: "fax", destination: fax });
|
|
@@ -124,7 +124,7 @@ function createRfaLifecycleClient({ sessionEndpoint = "/api/mindbill/session", g
|
|
|
124
124
|
});
|
|
125
125
|
return pending;
|
|
126
126
|
};
|
|
127
|
-
const
|
|
127
|
+
const responseFor = async (path2, init = {}) => {
|
|
128
128
|
const perform = (active) => {
|
|
129
129
|
const headers = new Headers(init.headers);
|
|
130
130
|
headers.set("authorization", `Bearer ${active.token}`);
|
|
@@ -134,8 +134,9 @@ function createRfaLifecycleClient({ sessionEndpoint = "/api/mindbill/session", g
|
|
|
134
134
|
let response = await perform(await mint());
|
|
135
135
|
if (response.status === 401) response = await perform(await mint(true));
|
|
136
136
|
if (!response.ok) throw await failure(response);
|
|
137
|
-
return response
|
|
137
|
+
return response;
|
|
138
138
|
};
|
|
139
|
+
const request = async (path2, init = {}) => (await responseFor(path2, init)).json();
|
|
139
140
|
const mutate = async (path2, input, key, method = "POST") => {
|
|
140
141
|
if (!key.trim()) throw new Error("An idempotency key is required.");
|
|
141
142
|
const result = await request(path2, { method, headers: { "idempotency-key": key }, body: JSON.stringify(input) });
|
|
@@ -149,6 +150,21 @@ function createRfaLifecycleClient({ sessionEndpoint = "/api/mindbill/session", g
|
|
|
149
150
|
return result.data;
|
|
150
151
|
};
|
|
151
152
|
return {
|
|
153
|
+
listInboundFaxes: async (query = {}) => {
|
|
154
|
+
const params = new URLSearchParams();
|
|
155
|
+
for (const [key, value] of Object.entries(query)) if (value !== void 0) params.set(key, String(value));
|
|
156
|
+
const result = await request(`rfa-inbound-faxes${params.size ? `?${params}` : ""}`);
|
|
157
|
+
if (!Array.isArray(result.data) || typeof result.hasMore !== "boolean" || result.nextCursor !== null && typeof result.nextCursor !== "string" || result.hasMore && !result.nextCursor) throw new Error("The inbound fax response was invalid.");
|
|
158
|
+
return result;
|
|
159
|
+
},
|
|
160
|
+
getInboundFaxContent: async (faxId) => (await responseFor(`rfa-inbound-faxes/${encodeURIComponent(faxId)}/content`)).blob(),
|
|
161
|
+
matchInboundFax: async (faxId, rfaId, key) => {
|
|
162
|
+
if (!key.trim()) throw new Error("An idempotency key is required.");
|
|
163
|
+
if (!rfaId.trim()) throw new Error("Choose an authorization request.");
|
|
164
|
+
const result = await request(`rfa-inbound-faxes/${encodeURIComponent(faxId)}/match`, { method: "POST", headers: { "idempotency-key": key }, body: JSON.stringify({ rfaId }) });
|
|
165
|
+
if (!result.data?.documentId || result.data.faxId !== faxId || result.data.rfaId !== rfaId) throw new Error("The fax match response was invalid.");
|
|
166
|
+
return result.data;
|
|
167
|
+
},
|
|
152
168
|
listScheduling: (id) => readArray(path(id, "scheduling")),
|
|
153
169
|
updateScheduling: (id, itemId, input, key) => {
|
|
154
170
|
if (!key.trim()) return Promise.reject(new Error("An idempotency key is required."));
|
|
@@ -353,6 +369,32 @@ function createRfaPacketsClient({ sessionEndpoint = "/api/mindbill/session", get
|
|
|
353
369
|
};
|
|
354
370
|
}
|
|
355
371
|
|
|
372
|
+
// src/rfa-status.ts
|
|
373
|
+
var RFA_LIFECYCLE_LABELS = {
|
|
374
|
+
incomplete: "Incomplete",
|
|
375
|
+
sent: "Sent",
|
|
376
|
+
failed: "Failed",
|
|
377
|
+
received: "Received",
|
|
378
|
+
closed: "Closed",
|
|
379
|
+
canceled: "Canceled"
|
|
380
|
+
};
|
|
381
|
+
var timestamp = (value) => value ? Date.parse(value) || 0 : 0;
|
|
382
|
+
function getRfaLifecycleStatus(rfa) {
|
|
383
|
+
if (rfa.lifecycleStatus && Object.hasOwn(RFA_LIFECYCLE_LABELS, rfa.lifecycleStatus)) return rfa.lifecycleStatus;
|
|
384
|
+
if (rfa.status === "canceled") return "canceled";
|
|
385
|
+
if (["closed", "approved", "modified", "denied", "mixed"].includes(rfa.status)) return "closed";
|
|
386
|
+
const submissions = (rfa.transmissions ?? []).filter((value) => !value.purpose || value.purpose === "submission");
|
|
387
|
+
const latest = submissions.filter((value) => value.direction === "outbound").sort((a, b) => timestamp(b.occurredAt) - timestamp(a.occurredAt) || b.id.localeCompare(a.id))[0];
|
|
388
|
+
if (latest) {
|
|
389
|
+
const received = latest.receivedAt || submissions.some((value) => value.direction === "inbound" && value.status === "received" && timestamp(value.receivedAt ?? value.occurredAt) >= timestamp(latest.occurredAt));
|
|
390
|
+
if (received) return "received";
|
|
391
|
+
return latest.status === "failed" ? "failed" : "sent";
|
|
392
|
+
}
|
|
393
|
+
if (rfa.receivedAt || ["received", "under_review", "information_requested"].includes(rfa.status)) return "received";
|
|
394
|
+
if (rfa.submittedAt || rfa.status === "submitted") return "sent";
|
|
395
|
+
return "incomplete";
|
|
396
|
+
}
|
|
397
|
+
|
|
356
398
|
// src/index.ts
|
|
357
399
|
var DEFAULT_API_BASE_URL = "https://app.mindbill.org";
|
|
358
400
|
var DEFAULT_SESSION_ENDPOINT = "/api/mindbill/session";
|
|
@@ -1310,6 +1352,7 @@ export {
|
|
|
1310
1352
|
DEFAULT_API_BASE_URL,
|
|
1311
1353
|
DEFAULT_SESSION_ENDPOINT,
|
|
1312
1354
|
REPORT_BILL_STATUS_OPTIONS,
|
|
1355
|
+
RFA_LIFECYCLE_LABELS,
|
|
1313
1356
|
SECOND_REVIEW_REASON_TEMPLATE,
|
|
1314
1357
|
SECOND_REVIEW_WINDOW_DAYS,
|
|
1315
1358
|
billTasksAgingBucketIndex,
|
|
@@ -1324,6 +1367,7 @@ export {
|
|
|
1324
1367
|
createRfaLifecycleClient,
|
|
1325
1368
|
createRfaPacketsClient,
|
|
1326
1369
|
defaultBillReviewPayerOption,
|
|
1370
|
+
getRfaLifecycleStatus,
|
|
1327
1371
|
normalizeRfaFax,
|
|
1328
1372
|
organizationTaxIdWrite,
|
|
1329
1373
|
parseSecondReviewCorrection,
|