@mindbill/browser 0.43.6 → 0.45.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/README.md CHANGED
@@ -177,14 +177,45 @@ See the [RFA directory guide](https://github.com/incidentfox/mindbill-widgets/bl
177
177
 
178
178
  ## RFA creation choices
179
179
 
180
- Browser 0.43.0 adds `createRfaClient(options).getCreationContext(query?)` for
180
+ Use `createRfaClient(options).getCreationContext(query?)` for
181
181
  building a draft from saved claims and rendering providers. It requires a trusted
182
182
  server session with `rfas:create` and returns `{claims, renderingProviders,
183
183
  nextCursor, renderingProvidersNextCursor}`. Search claims with `search` and physicians
184
184
  with `providerSearch`; pass `cursor` and `providerCursor` for their independent next
185
185
  pages. Reset each cursor when its search changes. Optional `claimId` and
186
186
  `renderingProviderId` restrict choices; `limit` defaults to 50 and is capped at 100.
187
- The lookup is read-only. Creating, signing, and sending remain separate actions.
187
+ Claims include saved injury diagnosis codes when available. The lookup is read-only.
188
+ Creating, signing, and sending remain separate actions. An RFA belongs to a patient
189
+ and injury/claim; it does not require an existing bill.
190
+
191
+ `createRfaClient` also exposes `provisionClaim(input, {idempotencyKey})` to create or reuse
192
+ patients and injuries by stable external IDs without creating a bill, and
193
+ `searchClaimsAdministrators(query, claimNumber?)` for directory choices. Provisioning
194
+ requires `bills:create`; directory search requires `payers:read`.
195
+
196
+ `saveProviderSignature(providerId, {contentBase64, physicianAuthorized: true,
197
+ actorReference}, {idempotencyKey})` saves an authorized PNG for an active organization
198
+ physician. It requires both `rfas:sign` and `organization:manage` in an organization-wide
199
+ session. It does not sign or send an RFA. Draft creation and updates support independent
200
+ `writtenConfirmation`, per-item `diagnosisDescription`, and `requestingPractice` /
201
+ `authorizationContact` snapshots. Explicit `null` clears a snapshot.
202
+
203
+ ## Reviewed RFA delivery
204
+
205
+ After signing and uploading supporting PDFs, call `prepareDelivery(id, {documentIds,
206
+ channel, to, message})`, where `channel` is `fax`, `email`, or `download` and `to` is
207
+ omitted for download. The response contains `packetId`, `sha256`, and `contentRevision`.
208
+ Read the retained PDF with `getPacket(id, packetId)` and obtain explicit packet-review
209
+ and recipient confirmations before calling `submit(id, {packetId, sha256, channel,
210
+ to, message}, idempotencyKey)`. Submission uses the retained packet bytes; changing
211
+ recipient, message, documents, channel, or request revision requires a fresh preview.
212
+ Download packets are not submitted by this flow.
213
+
214
+ Packet preparation and submission require `rfas:act`; reading retained packets requires
215
+ `rfas:read`. Signing previews and document reads additionally require `documents:read`.
216
+ Sandbox sessions cannot send external fax or email. Existing `previewPacket`, `sendFax`,
217
+ and `refreshFaxes` remain available; use the retained-packet methods for the same review
218
+ guarantee as the dashboard.
188
219
 
189
220
  See the [RFA dashboard guide](../../docs/rfa-dashboard.md#custom-browser-ui) for the
190
221
  response fields and React's built-in saved-choice flow.
package/dist/index.d.ts CHANGED
@@ -265,6 +265,26 @@ type ReportAutofillClient = {
265
265
  /** Available only by written agreement, with an organization-wide autofill:run session. Does not save a document or submit a bill. */
266
266
  declare function createReportAutofillClient({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride }?: OrganizationClientOptions): ReportAutofillClient;
267
267
 
268
+ /** Paper claim family; clearinghouse transport is selected by the server. */
269
+ type ClaimForm = "cms1500" | "ub04" | "ada" | "ncpdp";
270
+ /** JSON fields validated by the server's form-specific contract. */
271
+ type BillFormValue = string | number | boolean | null | BillFormValue[] | {
272
+ [key: string]: BillFormValue;
273
+ };
274
+ type BillFormData = {
275
+ institutional?: {
276
+ [key: string]: BillFormValue;
277
+ };
278
+ dental?: {
279
+ [key: string]: BillFormValue;
280
+ };
281
+ pharmacy?: {
282
+ [key: string]: BillFormValue;
283
+ };
284
+ };
285
+ /** Service-line metadata, including revenue, tooth, and prescription details. */
286
+ type BillLineFormData = BillFormData;
287
+
268
288
  declare const DEFAULT_API_BASE_URL = "https://app.mindbill.org";
269
289
  declare const DEFAULT_SESSION_ENDPOINT = "/api/mindbill/session";
270
290
 
@@ -276,7 +296,7 @@ type BillReviewBillingProvider = {
276
296
  taxIdConfigured?: boolean;
277
297
  taxIdLast4?: string;
278
298
  npi: string;
279
- billType: "Professional" | "Institutional";
299
+ billType: "Professional" | "Institutional" | "Dental" | "Pharmacy";
280
300
  phone?: string;
281
301
  billingStreet?: string;
282
302
  billingCity?: string;
@@ -326,6 +346,8 @@ type BillLineFeeBreakdown = {
326
346
  notes: string[];
327
347
  };
328
348
  type BillReviewLineItem = {
349
+ formData?: BillLineFormData;
350
+ drug?: BilledDrug;
329
351
  id?: string;
330
352
  code: string;
331
353
  modifiers: string[];
@@ -436,6 +458,8 @@ type BillReviewClaimPatternStatus = {
436
458
  type BillReviewData = {
437
459
  options?: Pick<OrganizationProfileData, "billingProviders" | "renderingProviders" | "locations">;
438
460
  bill: {
461
+ claimForm?: ClaimForm;
462
+ formData?: BillFormData;
439
463
  id: string;
440
464
  billNumber: string | number;
441
465
  status: string;
@@ -489,6 +513,7 @@ type BillReviewData = {
489
513
  };
490
514
  };
491
515
  type BillReviewSaveInput = {
516
+ formData?: BillFormData;
492
517
  claimsAdminId: string;
493
518
  /** The chosen payer (subpayor) when the claims administrator requires payer selection. */
494
519
  payerId?: string;
@@ -513,6 +538,8 @@ type BillReviewSaveInput = {
513
538
  renderingProvider?: BillReviewClinician;
514
539
  placeOfService?: BillReviewLocation;
515
540
  lineItems: Array<{
541
+ formData?: BillLineFormData;
542
+ drug?: BilledDrug;
516
543
  id?: string;
517
544
  code: string;
518
545
  modifiers: string[];
@@ -1041,6 +1068,8 @@ type BrowserBillAddress = {
1041
1068
  };
1042
1069
  /** Complete bill snapshot accepted by the browser create endpoint. */
1043
1070
  type BrowserBillCreateInput = {
1071
+ claimForm?: ClaimForm;
1072
+ formData?: BillFormData;
1044
1073
  externalId?: string;
1045
1074
  billingMode?: "med_legal" | "professional";
1046
1075
  patient: {
@@ -1106,6 +1135,7 @@ type BrowserBillCreateInput = {
1106
1135
  };
1107
1136
  diagnoses: string[];
1108
1137
  serviceLines: Array<{
1138
+ formData?: BillLineFormData;
1109
1139
  code: string;
1110
1140
  modifiers?: string[];
1111
1141
  units?: number;
@@ -1759,6 +1789,35 @@ declare function billTasksAgingBucketIndex(ageDays: number, buckets?: BillTasksA
1759
1789
  * first-seen item order within their section.
1760
1790
  */
1761
1791
  declare function buildBillTasksDashboard(items: BillTasksDashboardItem[], sections: BillTasksDashboardSectionInput[], buckets?: BillTasksAgingBucket[]): BillTasksDashboardData;
1792
+ /** Contacts snapshotted on a request and included in the reviewed form. */
1793
+ type RfaContact = {
1794
+ name?: string;
1795
+ contactName?: string;
1796
+ address?: string;
1797
+ city?: string;
1798
+ state?: string;
1799
+ zip?: string;
1800
+ phone?: string;
1801
+ fax?: string;
1802
+ email?: string;
1803
+ };
1804
+ type RfaDeliveryPreviewInput = {
1805
+ documentIds: string[];
1806
+ channel: "fax" | "email" | "download";
1807
+ to?: string;
1808
+ message?: string;
1809
+ };
1810
+ type RfaDeliveryPreview = {
1811
+ packetId: string;
1812
+ sha256: string;
1813
+ contentRevision: number;
1814
+ };
1815
+ type RfaSubmitInput = Omit<RfaDeliveryPreview, "contentRevision"> & {
1816
+ channel: "fax" | "email";
1817
+ to: string;
1818
+ message?: string;
1819
+ nonBusinessDates?: string[];
1820
+ };
1762
1821
  /** An unsigned RFA preparation draft. Signing and sending are separate operations. */
1763
1822
  type RfaCreateDraftInput = {
1764
1823
  claimId: string;
@@ -1768,6 +1827,9 @@ type RfaCreateDraftInput = {
1768
1827
  providerName: string;
1769
1828
  externalId?: string;
1770
1829
  claimsAdminId?: string;
1830
+ writtenConfirmation?: boolean;
1831
+ requestingPractice?: RfaContact | null;
1832
+ authorizationContact?: RfaContact | null;
1771
1833
  requestType?: "new" | "resubmission_material_change" | "oral_authorization_confirmation";
1772
1834
  reviewType?: "prospective" | "concurrent" | "retrospective";
1773
1835
  expedited?: boolean;
@@ -1782,6 +1844,7 @@ type RfaCreateDraftInput = {
1782
1844
  items: Array<{
1783
1845
  externalId?: string;
1784
1846
  diagnosisCode: string;
1847
+ diagnosisDescription?: string;
1785
1848
  serviceDescription: string;
1786
1849
  procedureCode?: string;
1787
1850
  quantity?: number;
@@ -1813,6 +1876,9 @@ type RfaRecord = {
1813
1876
  claimNumber: string | null;
1814
1877
  status: string;
1815
1878
  requestType?: RfaCreateDraftInput["requestType"];
1879
+ writtenConfirmation?: boolean;
1880
+ requestingPractice?: RfaContact | null;
1881
+ authorizationContact?: RfaContact | null;
1816
1882
  placeOfServiceCode?: string | null;
1817
1883
  providerNpi?: string | null;
1818
1884
  providerPhone?: string | null;
@@ -1840,6 +1906,7 @@ type RfaRecord = {
1840
1906
  items: Array<{
1841
1907
  id: string;
1842
1908
  diagnosisCode: string;
1909
+ diagnosisDescription?: string;
1843
1910
  serviceDescription: string;
1844
1911
  procedureCode: string | null;
1845
1912
  frequency?: string | null;
@@ -1939,6 +2006,7 @@ type RfaCreationClaim = {
1939
2006
  claimNumber?: string;
1940
2007
  dateOfInjury?: string;
1941
2008
  claimsAdminId?: string;
2009
+ diagnosisCodes?: string[];
1942
2010
  };
1943
2011
  type RfaCreationProvider = {
1944
2012
  id: string;
@@ -1960,7 +2028,39 @@ type RfaCreationContextQuery = {
1960
2028
  claimId?: string;
1961
2029
  renderingProviderId?: string;
1962
2030
  };
2031
+ type RfaProvisionClaimInput = {
2032
+ patient: Omit<BrowserBillCreateInput["patient"], "id" | "externalId"> & {
2033
+ externalId: string;
2034
+ };
2035
+ claim: Omit<BrowserBillCreateInput["claim"], "id" | "externalId"> & {
2036
+ externalId: string;
2037
+ };
2038
+ };
2039
+ type RfaProvisionClaimResult = {
2040
+ patientId: string;
2041
+ claimId: string;
2042
+ patientExternalId: string;
2043
+ claimExternalId: string;
2044
+ created: {
2045
+ patient: boolean;
2046
+ claim: boolean;
2047
+ };
2048
+ };
1963
2049
  type RfaClient = {
2050
+ provisionClaim?: (input: RfaProvisionClaimInput, options?: {
2051
+ idempotencyKey?: string;
2052
+ }) => Promise<RfaProvisionClaimResult>;
2053
+ searchClaimsAdministrators?: (query: string, claimNumber?: string) => Promise<BillReviewPayer[]>;
2054
+ saveProviderSignature?: (providerId: string, input: {
2055
+ contentBase64: string;
2056
+ physicianAuthorized: true;
2057
+ actorReference: string;
2058
+ }, options?: {
2059
+ idempotencyKey?: string;
2060
+ }) => Promise<{
2061
+ providerId: string;
2062
+ signatureConfigured: true;
2063
+ }>;
1964
2064
  getCreationContext: (query?: RfaCreationContextQuery) => Promise<RfaCreationContext>;
1965
2065
  list: (query?: RfaListQuery) => Promise<RfaListResult>;
1966
2066
  get: (rfaId: string) => Promise<RfaRecord>;
@@ -1970,6 +2070,9 @@ type RfaClient = {
1970
2070
  uploadDocument: (rfaId: string, input: RfaUploadDocumentInput, idempotencyKey: string) => Promise<RfaRecord>;
1971
2071
  prepareSigning: (rfaId: string, input: RfaSigningPreviewInput, idempotencyKey: string) => Promise<RfaSigningPreview>;
1972
2072
  sign: (rfaId: string, input: RfaSignInput, idempotencyKey: string) => Promise<RfaRecord>;
2073
+ prepareDelivery: (rfaId: string, input: RfaDeliveryPreviewInput, key?: string) => Promise<RfaDeliveryPreview>;
2074
+ getPacket: (rfaId: string, packetId: string) => Promise<Blob>;
2075
+ submit: (rfaId: string, input: RfaSubmitInput, idempotencyKey: string) => Promise<RfaRecord>;
1973
2076
  previewPacket: (rfaId: string, documentIds: string[]) => Promise<Blob>;
1974
2077
  sendFax: (rfaId: string, input: RfaFaxInput, idempotencyKey: string) => Promise<RfaRecord>;
1975
2078
  refreshFaxes: (rfaId: string, idempotencyKey: string) => Promise<RfaRecord>;
@@ -1977,4 +2080,4 @@ type RfaClient = {
1977
2080
  /** Uses short-lived browser credentials. Never pass a partner API key. */
1978
2081
  declare function createRfaClient({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride }?: OrganizationClientOptions): RfaClient;
1979
2082
 
1980
- 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 BillHistoryEntry, type BillLifecycleAction, type BillLifecycleActionId, type BillLifecycleClient, type BillLifecycleClientOptions, type BillLifecycleData, type BillLifecycleDelivery, type BillLifecycleSession, type BillLifecycleSessionProvider, type BillLifecycleSessionRequest, type BillLineFeeBreakdown, 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 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 RfaCreateDraftInput, type RfaCreationClaim, type RfaCreationContext, type RfaCreationContextQuery, type RfaCreationProvider, type RfaDecisionsInput, type RfaFaxInput, type RfaFollowUp, type RfaFollowUpList, type RfaFollowUpUpdate, type RfaInformationRequestInput, type RfaInformationResponseInput, type RfaLifecycleClient, type RfaListQuery, type RfaListResult, type RfaReceiptInput, type RfaRecord, type RfaSignInput, type RfaSigningPreview, type RfaSigningPreviewInput, 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, createRfaLifecycleClient, defaultBillReviewPayerOption, normalizeRfaFax, organizationTaxIdWrite, parseSecondReviewCorrection, reportBillStatusContacts, rfaAuthorizationDestinations, rfaAuthorizationGuidance, sanitizeBillReviewSaveInput, secondReviewDeadline };
2083
+ 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 RfaDecisionsInput, type RfaDeliveryPreview, type RfaDeliveryPreviewInput, type RfaFaxInput, type RfaFollowUp, type RfaFollowUpList, type RfaFollowUpUpdate, type RfaInformationRequestInput, type RfaInformationResponseInput, type RfaLifecycleClient, type RfaListQuery, type RfaListResult, type RfaProvisionClaimInput, type RfaProvisionClaimResult, type RfaReceiptInput, type RfaRecord, 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, createRfaLifecycleClient, defaultBillReviewPayerOption, normalizeRfaFax, organizationTaxIdWrite, parseSecondReviewCorrection, reportBillStatusContacts, rfaAuthorizationDestinations, rfaAuthorizationGuidance, sanitizeBillReviewSaveInput, secondReviewDeadline };
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ function rfaAuthorizationGuidance(directory) {
62
62
  case "central_fax":
63
63
  return "Select the central authorization fax after confirming it applies to this claim.";
64
64
  case "central_email":
65
- return "Authorization is routed by email. Download the signed packet and record delivery after sending it through your email service.";
65
+ return "Authorization is routed by email. Confirm the recipient for this claim before sending the reviewed packet.";
66
66
  case "claim_handling_location_routes":
67
67
  return "Choose the office handling this claim. Authorization destinations vary by office.";
68
68
  case "adjuster_specific_required":
@@ -72,7 +72,7 @@ function rfaAuthorizationGuidance(directory) {
72
72
  case "profile_not_published":
73
73
  return "No authorization destination is currently published. Confirm a current destination with the handling adjuster.";
74
74
  default:
75
- return "Select an authorization contact or enter a fax confirmed with the handling adjuster.";
75
+ return "Select an authorization contact or enter a destination confirmed with the handling adjuster.";
76
76
  }
77
77
  }
78
78
 
@@ -232,6 +232,7 @@ function pickDefined(source, keys) {
232
232
  function sanitizeBillReviewSaveInput(input) {
233
233
  return {
234
234
  claimsAdminId: input.claimsAdminId,
235
+ ...input.formData !== void 0 ? { formData: input.formData } : {},
235
236
  ...input.payerId !== void 0 ? { payerId: input.payerId } : {},
236
237
  ...input.patientOverrides ? {
237
238
  patientOverrides: pickDefined(input.patientOverrides, [
@@ -308,7 +309,9 @@ function sanitizeBillReviewSaveInput(input) {
308
309
  "charge",
309
310
  "serviceDate",
310
311
  "serviceDateEnd",
311
- "diagnosisPointers"
312
+ "diagnosisPointers",
313
+ "formData",
314
+ "drug"
312
315
  ]))
313
316
  };
314
317
  }
@@ -1056,12 +1059,12 @@ function createRfaClient({ sessionEndpoint = DEFAULT_SESSION_ENDPOINT, getSessio
1056
1059
  });
1057
1060
  return pending;
1058
1061
  };
1059
- const request = async (path2, init = {}, browser = false) => {
1062
+ const request = async (path2, init = {}, browser = false, resource = "rfas") => {
1060
1063
  const perform = (active) => {
1061
1064
  const headers = new Headers(init.headers);
1062
1065
  headers.set("authorization", `Bearer ${active.token}`);
1063
1066
  if (init.body && !(init.body instanceof FormData)) headers.set("content-type", "application/json");
1064
- return fetcher(`${(active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "")}/partner/v2/${browser ? "browser/" : ""}rfas${path2}`, { ...init, headers });
1067
+ return fetcher(`${(active.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "")}/partner/v2/${browser ? "browser/" : ""}${resource}${path2}`, { ...init, headers });
1065
1068
  };
1066
1069
  let response = await perform(await mint());
1067
1070
  if (response.status === 401) response = await perform(await mint(true));
@@ -1079,6 +1082,19 @@ function createRfaClient({ sessionEndpoint = DEFAULT_SESSION_ENDPOINT, getSessio
1079
1082
  };
1080
1083
  const path = (id, suffix) => `/${encodeURIComponent(id)}/${suffix}`;
1081
1084
  return {
1085
+ provisionClaim: async (input, options) => {
1086
+ const response = await request("", mutation(input, options?.idempotencyKey ?? globalThis.crypto.randomUUID()), false, "claims");
1087
+ const body = await response.json();
1088
+ if (!body.patientId || !body.claimId) throw new Error("The saved patient and injury response was invalid.");
1089
+ return body;
1090
+ },
1091
+ searchClaimsAdministrators: (query, claimNumber) => createBillReferenceClient({ sessionEndpoint, ...getSession ? { getSession } : {}, apiBaseUrl, ...fetchOverride ? { fetch: fetchOverride } : {} }).searchClaimsAdministrators(query, claimNumber),
1092
+ saveProviderSignature: async (providerId, input, options) => {
1093
+ const response = await request(`/providers/${encodeURIComponent(providerId)}/signature`, mutation(input, options?.idempotencyKey ?? globalThis.crypto.randomUUID()), true);
1094
+ const body = await response.json();
1095
+ if (body.data?.signatureConfigured !== true) throw new Error("The physician signature could not be confirmed.");
1096
+ return body.data;
1097
+ },
1082
1098
  getCreationContext: async (query = {}) => {
1083
1099
  const params = new URLSearchParams();
1084
1100
  for (const [name, value] of Object.entries(query)) if (value !== void 0 && value !== "") params.set(name, String(value));
@@ -1134,6 +1150,17 @@ function createRfaClient({ sessionEndpoint = DEFAULT_SESSION_ENDPOINT, getSessio
1134
1150
  if (input.physicianAuthorized !== true || !input.actorReference.trim()) return Promise.reject(new Error("Physician authorization and signer identity are required."));
1135
1151
  return record2(path(id, "sign"), mutation(input, key));
1136
1152
  },
1153
+ prepareDelivery: async (id, input, key) => {
1154
+ const body = await (await request(path(id, "delivery-preview"), mutation(input, key ?? idempotencyKey()))).json();
1155
+ if (!body.data?.packetId || !body.data.sha256 || !body.data.contentRevision) throw new Error("The delivery preview was invalid.");
1156
+ return body.data;
1157
+ },
1158
+ getPacket: async (id, packetId) => (await request(path(id, `packets/${encodeURIComponent(packetId)}`))).blob(),
1159
+ submit: async (id, input, key) => {
1160
+ const body = await (await request(path(id, "submit"), mutation(input, key))).json();
1161
+ if (!body.data?.transmissionId || !body.data.packetId) throw new Error("The submission response was invalid. Refresh before trying again.");
1162
+ return record2(`/${encodeURIComponent(id)}`);
1163
+ },
1137
1164
  previewPacket: async (id, documentIds) => (await request(path(id, "packet"), { method: "POST", body: JSON.stringify({ documentIds }) })).blob(),
1138
1165
  sendFax: (id, input, key) => record2(path(id, "fax"), mutation(input, key)),
1139
1166
  refreshFaxes: (id, key) => record2(path(id, "fax/refresh"), mutation({}, key)),