@mindbill/react 0.18.0 → 0.20.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
@@ -8,7 +8,7 @@ npm install @mindbill/react @mindbill/node
8
8
 
9
9
  ## Connected lifecycle
10
10
 
11
- `ConnectedBillLifecycle` starts after your server atomically creates and submits an immutable bill. It owns bill loading, status refresh, EORs, payment posting, Second Bill Review, and close.
11
+ `ConnectedBillLifecycle` starts after your server atomically creates and submits an immutable bill. It owns the submitted-to-closed progress rail, a read-only rendering of the exact submitted snapshot, server-owned human-readable history, packet download, EORs, payment posting, Second Bill Review, close, and reopen. The only persistent header action is **Download packet**; status-dependent actions appear in the details view when MindBill makes them available.
12
12
 
13
13
  ```tsx
14
14
  import { ConnectedBillLifecycle } from "@mindbill/react";
@@ -79,6 +79,20 @@ import { ConnectedBillStatus } from "@mindbill/react";
79
79
 
80
80
  Use `useBillStatus({ billId })` when you want to render custom status UI. It returns `data`, `error`, `isLoading`, `isRefreshing`, and `refresh`. Use `createBillStatusClient` outside React.
81
81
 
82
+ The public lifecycle is `Submitted → Accepted → Processed → Closed`. Rejections and denials remain detailed states inside the Processed stage so the progress rail stays stable while the action sheet explains what the user can do next. Partner APIs and components do not expose draft or queued states.
83
+
84
+ ## Read-only bill details
85
+
86
+ Use `BillReadOnlyForm` when you already loaded `BillLifecycleData` and only need the immutable detail surface. It uses the same section order and responsive layout as `BillSubmissionForm`, but renders values, calculated fees, and attachments without form controls.
87
+
88
+ ```tsx
89
+ import { BillReadOnlyForm } from "@mindbill/react";
90
+
91
+ <BillReadOnlyForm data={billLifecycleData} onOpenAttachment={openAttachment} />
92
+ ```
93
+
94
+ `ConnectedBillLifecycle` composes this component with the Details / Bill history switch, so most partners should not assemble these pieces themselves.
95
+
82
96
  ## Lifecycle actions
83
97
 
84
98
  MindBill returns the actions that are valid for the bill's current state. Render that server-authoritative list instead of duplicating rejection, EOR, denial, review, payment, and closure rules in your application.
@@ -94,6 +108,7 @@ import { BillLifecycleActions } from "@mindbill/react";
94
108
  case "post_payment": return setPaymentOpen(true);
95
109
  case "second_review": return setSecondReviewOpen(true);
96
110
  case "close": return bill.closeBill({ reason: "Resolved" });
111
+ case "reopen": return bill.reopenBill({ reason: "Follow-up is continuing" });
97
112
  }
98
113
  }}
99
114
  />
@@ -103,15 +118,15 @@ Disabled actions are hidden by default. Set `showUnavailable` to show them with
103
118
 
104
119
  ## Activity timeline
105
120
 
106
- `BillActivityTimeline` renders ordered lifecycle events. Feed it events stored from MindBill's signed webhooks so a reload does not depend on browser callback history.
121
+ `BillActivityTimeline` renders the ordered, human-readable lifecycle events returned by MindBill. Partners do not need to store or reconstruct bill history.
107
122
 
108
123
  ```tsx
109
124
  import { BillActivityTimeline } from "@mindbill/react";
110
125
 
111
- <BillActivityTimeline events={billEvents} />
126
+ <BillActivityTimeline events={bill.data.activity} />
112
127
  ```
113
128
 
114
- Browser callbacks such as `onChanged` are for immediate UI, navigation, optimistic state, and analytics. Signed webhooks are the authoritative integration for durable server state.
129
+ Browser callbacks such as `onChanged` are for immediate UI, navigation, optimistic state, and analytics. MindBill remains authoritative for durable history; signed webhooks are available when your backend also needs event-driven synchronization.
115
130
 
116
131
  ## Bill submission form
117
132
 
@@ -125,6 +140,10 @@ import { BillSubmissionForm } from "@mindbill/react";
125
140
  <BillSubmissionForm
126
141
  initialBill={bootstrap.bill}
127
142
  attachments={bootstrap.attachments}
143
+ getSession={() => fetch("/api/mindbill/session", { method: "POST" }).then(r => r.json())}
144
+ diagnosisOptions={bootstrap.diagnoses}
145
+ procedureOptions={bootstrap.procedures}
146
+ onLookupPostalCode={lookupPostalCode}
128
147
  appearance={{ preset: "qme-companion" }}
129
148
  onSubmit={({ bill, sourceAttachmentIds, uploads }) =>
130
149
  submitBill({ bill, sourceAttachmentIds, uploads })
@@ -132,6 +151,19 @@ import { BillSubmissionForm } from "@mindbill/react";
132
151
  />
133
152
  ```
134
153
 
154
+ The component includes the interaction model, not just the markup:
155
+
156
+ - a responsive two-column review form (one column on narrow screens);
157
+ - paste-friendly `MM/DD/YYYY` date fields and required-field asterisks;
158
+ - ZIP-to-city/state completion through `onLookupPostalCode`;
159
+ - searchable ICD-10 multi-select with removable chips;
160
+ - canonical claims-administrator search through the authenticated MindBill payer directory;
161
+ - QME, AME, and Psych QME evaluation modes with medical-legal modifier defaults;
162
+ - searchable procedure/modifier controls, fee-schedule amounts, totals, and an automatically maintained empty line;
163
+ - auto-attached source documents, practice W-9 treatment, and click, panel-drop, or whole-page PDF upload.
164
+
165
+ Partners supply tenant-specific bootstrap data and server callbacks. Required fields, validation, payer selection, service-line behavior, attachments, and submission UX stay inside `@mindbill/react`, so every integration receives the same billing workflow.
166
+
135
167
  `BILL_SUBMISSION_REQUIRED_FIELDS` and `validateBillSubmission` expose the same contract for tests and non-visual integrations. The component never creates a draft; its callback fires only when the user submits a locally valid snapshot.
136
168
 
137
169
  `BillReviewForm` remains available for legacy integrations that already own a custom review model. New integrations should use `BillSubmissionForm`.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { MindBillAppearance, MindBillEventDetail, MindBillErrorDetail } from '@mindbill/embed';
2
2
  export { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from '@mindbill/embed';
3
3
  import { CSSProperties, ReactElement, ReactNode } from 'react';
4
- import { BillLifecycleAction, BillLifecycleDelivery, BillPaymentRecord, BillRemittanceSummary, BillLifecycleData, BillLifecycleClientOptions, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
- export { BillActivityRecord, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRemittanceSummary, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
4
+ import { BillReviewData as BillReviewData$1, BillReviewAttachment as BillReviewAttachment$1, BillLifecycleSessionProvider, BillReviewPayer as BillReviewPayer$1, BillLifecycleAction, BillLifecycleDelivery, BillPaymentRecord, BillRemittanceSummary, BillLifecycleData, BillLifecycleClientOptions, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
+ export { BillActivityRecord, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRemittanceSummary, CloseBillInput, PostBillPaymentInput, ReopenBillInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
6
6
 
7
7
  type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue";
8
8
  type MindBillReactAppearance = MindBillAppearance & {
@@ -346,14 +346,41 @@ type BillStatusAction = {
346
346
  };
347
347
  declare function BillStatusSummary({ status, submittedAt, agingDays, updatedAt, totalCharge, totalPaid, balanceDue, actions, className, style, appearance }: BillStatusSummaryProps): ReactElement;
348
348
 
349
+ type BillReadOnlyFormProps = {
350
+ data: BillReviewData$1;
351
+ appearance?: MindBillReactAppearance;
352
+ className?: string;
353
+ style?: CSSProperties;
354
+ onOpenAttachment?: (attachment: BillReviewAttachment$1) => void | Promise<void>;
355
+ };
356
+ declare function BillReadOnlyForm({ data, appearance, className, style, onOpenAttachment }: BillReadOnlyFormProps): ReactElement;
357
+
349
358
  declare const BILL_SUBMISSION_DOCUMENT_TYPES: readonly ["final_report", "proof_of_service", "letter_of_attestation", "form_122", "return_to_work_voucher", "w9", "medical_records", "appeal", "other"];
350
359
  type BillSubmissionDocumentType = (typeof BILL_SUBMISSION_DOCUMENT_TYPES)[number];
360
+ type BillSubmissionEvaluationType = "qme" | "ame" | "psych_qme";
351
361
  type BillSubmissionAddress = {
352
362
  line1: string;
353
363
  city: string;
354
364
  state: string;
355
365
  postalCode: string;
356
366
  };
367
+ type BillSubmissionDiagnosisOption = {
368
+ code: string;
369
+ description: string;
370
+ };
371
+ type BillSubmissionProcedureOption = {
372
+ code: string;
373
+ description: string;
374
+ allowedAmount?: number;
375
+ };
376
+ type BillSubmissionModifierOption = {
377
+ code: string;
378
+ description: string;
379
+ };
380
+ type BillSubmissionPostalPlace = {
381
+ city: string;
382
+ state: string;
383
+ };
357
384
  type BillSubmissionInput = {
358
385
  externalId?: string;
359
386
  billingMode?: "med_legal" | "professional";
@@ -363,7 +390,7 @@ type BillSubmissionInput = {
363
390
  firstName: string;
364
391
  middleName?: string;
365
392
  lastName: string;
366
- dateOfBirth?: string;
393
+ dateOfBirth: string;
367
394
  ssn?: string;
368
395
  gender?: "M" | "F" | "X";
369
396
  phone?: string;
@@ -427,6 +454,10 @@ type BillSubmissionSourceAttachment = {
427
454
  documentType: BillSubmissionDocumentType;
428
455
  description?: string;
429
456
  selected?: boolean;
457
+ /** Auto-attached documents such as a practice W-9 cannot be deselected. */
458
+ autoAttached?: boolean;
459
+ removable?: boolean;
460
+ previewUrl?: string;
430
461
  };
431
462
  type BillSubmissionUpload = {
432
463
  file: File;
@@ -442,6 +473,17 @@ type BillSubmissionFormProps = {
442
473
  initialBill: BillSubmissionInput;
443
474
  attachments?: BillSubmissionSourceAttachment[];
444
475
  onSubmit: (value: BillSubmissionFormValue) => void | Promise<void>;
476
+ /** Short-lived partner browser session. Enables the built-in canonical payer directory. */
477
+ getSession?: BillLifecycleSessionProvider;
478
+ sessionEndpoint?: string;
479
+ apiBaseUrl?: string;
480
+ fetch?: typeof globalThis.fetch;
481
+ onSearchClaimsAdministrators?: (query: string, claimNumber?: string) => Promise<BillReviewPayer$1[]>;
482
+ diagnosisOptions?: BillSubmissionDiagnosisOption[];
483
+ onSearchDiagnoses?: (query: string) => Promise<BillSubmissionDiagnosisOption[]>;
484
+ onLookupPostalCode?: (postalCode: string) => Promise<BillSubmissionPostalPlace | null>;
485
+ procedureOptions?: BillSubmissionProcedureOption[];
486
+ modifierOptions?: BillSubmissionModifierOption[];
445
487
  appearance?: MindBillReactAppearance;
446
488
  className?: string;
447
489
  style?: CSSProperties;
@@ -450,13 +492,17 @@ type BillSubmissionFormProps = {
450
492
  heading?: ReactNode;
451
493
  description?: ReactNode;
452
494
  };
453
- declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "service.date", "serviceLines[].code", "serviceLines[].units"];
495
+ declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.dateOfBirth", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "claim.claimsAdministrator", "service.date", "serviceLines[].code", "serviceLines[].units"];
454
496
  type BillSubmissionValidation = {
455
497
  valid: boolean;
456
498
  fieldErrors: Record<string, string>;
457
499
  };
500
+ declare function ensureTrailingBillSubmissionLine(lines: BillSubmissionInput["serviceLines"]): BillSubmissionInput["serviceLines"];
501
+ declare function parseBillSubmissionDate(value: string): string | undefined;
502
+ declare function formatBillSubmissionDate(value: string | null | undefined): string;
503
+ declare function applyBillSubmissionEvaluationModifiers(lines: BillSubmissionInput["serviceLines"], type: BillSubmissionEvaluationType): BillSubmissionInput["serviceLines"];
458
504
  declare function validateBillSubmission(bill: BillSubmissionInput): BillSubmissionValidation;
459
- declare function BillSubmissionForm({ initialBill, attachments, onSubmit, appearance, className, style, disabled, submitLabel, heading, description, }: BillSubmissionFormProps): ReactElement;
505
+ declare function BillSubmissionForm({ initialBill, attachments, onSubmit, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, appearance, className, style, disabled, submitLabel, heading, description, }: BillSubmissionFormProps): ReactElement;
460
506
 
461
507
  type BillStatusData = {
462
508
  billId: string;
@@ -551,7 +597,7 @@ type BillActivityTimelineProps = SurfaceProps & {
551
597
  /** Human-readable fallback for a signed partner event type. */
552
598
  declare function billActivityEventLabel(type: string): string;
553
599
  declare function BillActivityTimeline({ events, emptyLabel, appearance, className, style, formatDate }: BillActivityTimelineProps): ReactElement;
554
- type BillLifecycleStage = "created" | "submitted" | "accepted" | "response" | "follow_up" | "closed";
600
+ type BillLifecycleStage = "submitted" | "accepted" | "processed" | "closed";
555
601
  /** Maps MindBill's detailed lifecycle state into a compact progress stage. */
556
602
  declare function billLifecycleStage(state: string): BillLifecycleStage;
557
603
  type BillLifecycleProgressProps = SurfaceProps & {
@@ -593,7 +639,9 @@ type UseBillLifecycleResult = {
593
639
  getDeliveryOptions: BillLifecycleClient["getDeliveryOptions"];
594
640
  openAttachment: (attachment: BillReviewAttachment) => Promise<void>;
595
641
  openEor: (document: BillEorDocument) => Promise<void>;
642
+ downloadPacket: () => Promise<void>;
596
643
  closeBill: BillLifecycleClient["closeBill"];
644
+ reopenBill: BillLifecycleClient["reopenBill"];
597
645
  postPayment: BillLifecycleClient["postPayment"];
598
646
  submitSecondReview: BillLifecycleClient["submitSecondReview"];
599
647
  };
@@ -620,4 +668,4 @@ type MindBillWidgetProps = {
620
668
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
621
669
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
622
670
 
623
- export { BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillRemittanceCard, type BillRemittanceCardProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionAddress, type BillSubmissionDocumentType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, type BillSubmissionInput, type BillSubmissionRoute, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, billActivityEventLabel, billLifecycleStage, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingProcedureLine, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
671
+ export { BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRemittanceCard, type BillRemittanceCardProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionAddress, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, type BillSubmissionInput, type BillSubmissionModifierOption, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, type BillSubmissionRoute, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billLifecycleStage, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, resolveMindBillAppearance, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };