@mindbill/react 0.21.2 → 0.22.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
@@ -167,6 +167,82 @@ Validation is component-owned as well. A missing routing payer is highlighted im
167
167
 
168
168
  `BillReviewForm` remains available for legacy integrations that already own a custom review model. New integrations should use `BillSubmissionForm`.
169
169
 
170
+ ### Compose individual submission sections
171
+
172
+ `BillSubmissionForm` is also the form-state provider. Put its named children in your own page shell when you want the same MindBill behavior in a partner-specific layout. The sections do not duplicate required-field, directory, fee, attachment, or submission logic.
173
+
174
+ ```tsx
175
+ import {
176
+ BillSubmissionActions,
177
+ BillSubmissionAttachmentsSection,
178
+ BillSubmissionClaimSection,
179
+ BillSubmissionForm,
180
+ BillSubmissionHeader,
181
+ BillSubmissionPatientSection,
182
+ BillSubmissionProvidersSection,
183
+ BillSubmissionServiceLinesSection,
184
+ } from "@mindbill/react";
185
+
186
+ <BillSubmissionForm {...submissionProps}>
187
+ <BillSubmissionHeader />
188
+ <BillSubmissionPatientSection />
189
+ <BillSubmissionClaimSection />
190
+ <BillSubmissionProvidersSection />
191
+ <BillSubmissionServiceLinesSection />
192
+ <BillSubmissionAttachmentsSection />
193
+ <BillSubmissionActions />
194
+ </BillSubmissionForm>
195
+ ```
196
+
197
+ Omit a section when another step in your product already supplies that information, or reorder sections to match your workflow. `BillSubmissionActions` remains the only submit control and always validates the complete immutable snapshot.
198
+
199
+ ## Billing dashboard, aging, bill list, and reports
200
+
201
+ The dashboard components accept plain bill summaries, so they work with `@mindbill/node`'s `listBills()` response, a server-rendered loader, or a partner-owned cache. They never require an API key in the browser.
202
+
203
+ ```tsx
204
+ import {
205
+ BillingDashboard,
206
+ BillingReport,
207
+ buildBillingReportCsv,
208
+ type BillingDashboardBill,
209
+ } from "@mindbill/react";
210
+
211
+ const bills: BillingDashboardBill[] = apiBills.map((bill) => ({
212
+ id: bill.id,
213
+ billNumber: bill.billNumber,
214
+ patientName: `${bill.patient.firstName} ${bill.patient.lastName}`,
215
+ claimNumber: bill.claim.claimNumber,
216
+ payerName: bill.claim.claimsAdministrator?.name,
217
+ state: bill.state,
218
+ // Supply agingDays from your status/lifecycle response, or submittedAt when
219
+ // your server-side bill summary includes it.
220
+ agingDays: agingByBillId[bill.id] ?? 0,
221
+ totalCharge: bill.amounts.charged,
222
+ totalPaid: bill.amounts.paid,
223
+ balanceDue: bill.amounts.balance,
224
+ href: `/billing/${bill.id}`,
225
+ }));
226
+
227
+ <BillingDashboard
228
+ bills={bills}
229
+ appearance={{ preset: "orange-bright" }}
230
+ onSelectBill={(bill) => router.push(`/billing/${bill.id}`)}
231
+ />
232
+
233
+ <BillingReport bills={bills} groupBy="payer" />
234
+ ```
235
+
236
+ Use the smaller pieces independently when a page already has its own shell:
237
+
238
+ - `BillAgingSummary` — outstanding balance, open count, collected, total billed, and 0–30 / 31–60 / 61–90 / 91+ buckets;
239
+ - `BillList` — responsive desktop table and mobile cards;
240
+ - `BillingReport` — grouped totals by `status`, `payer`, or `aging`;
241
+ - `summarizeBillingDashboard` and `buildBillingReportRows` — presentation-free aggregates;
242
+ - `buildBillingReportCsv` — the same report rows as downloadable CSV text.
243
+
244
+ Pass only synthetic data to public examples and tests. In production, load organization-scoped bills on the server and authorize each bill-detail route independently.
245
+
170
246
  Use `BillStatusSummary` only when your application already owns status loading and wants a presentation-only component:
171
247
 
172
248
  ```tsx
package/dist/index.d.ts CHANGED
@@ -51,20 +51,20 @@ declare const mindBillThemePresets: {
51
51
  readonly fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif";
52
52
  };
53
53
  readonly "orange-bright": {
54
- readonly accentColor: "#ff4f0a";
54
+ readonly accentColor: "#f4510b";
55
55
  readonly accentTextColor: "#ffffff";
56
56
  readonly backgroundColor: "#fffaf6";
57
- readonly surfaceColor: "#ffffff";
57
+ readonly surfaceColor: "#fffefd";
58
58
  readonly inputBackgroundColor: "#ffffff";
59
- readonly textColor: "#111827";
59
+ readonly textColor: "#090f1f";
60
60
  readonly mutedColor: "#626a73";
61
- readonly borderColor: "#e5e1dc";
62
- readonly borderRadius: "8px";
63
- readonly controlRadius: "6px";
64
- readonly shadow: "0 4px 18px rgba(17,24,39,.06)";
65
- readonly dangerColor: "#b42318";
66
- readonly successColor: "#16794f";
67
- readonly warningColor: "#9a5b13";
61
+ readonly borderColor: "#e7e1da";
62
+ readonly borderRadius: "16px";
63
+ readonly controlRadius: "10px";
64
+ readonly shadow: "0 12px 36px rgba(244,81,11,.08), 0 1px 2px rgba(9,15,31,.05)";
65
+ readonly dangerColor: "#c4322b";
66
+ readonly successColor: "#16835b";
67
+ readonly warningColor: "#a65f00";
68
68
  readonly fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif";
69
69
  };
70
70
  readonly "clinical-blue": {
@@ -492,6 +492,11 @@ type BillSubmissionFormProps = {
492
492
  submitLabel?: string;
493
493
  heading?: ReactNode;
494
494
  description?: ReactNode;
495
+ /**
496
+ * Optional composable layout. Use the exported section components as children;
497
+ * the parent form continues to own validation, directory lookups, uploads, and submission.
498
+ */
499
+ children?: ReactNode;
495
500
  };
496
501
  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"];
497
502
  type BillSubmissionValidation = {
@@ -503,7 +508,15 @@ declare function parseBillSubmissionDate(value: string): string | undefined;
503
508
  declare function formatBillSubmissionDate(value: string | null | undefined): string;
504
509
  declare function applyBillSubmissionEvaluationModifiers(lines: BillSubmissionInput["serviceLines"], type: BillSubmissionEvaluationType): BillSubmissionInput["serviceLines"];
505
510
  declare function validateBillSubmission(bill: BillSubmissionInput): BillSubmissionValidation;
506
- 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;
511
+ type BillSubmissionSectionId = "header" | "patient" | "claim" | "providers" | "serviceLines" | "attachments" | "actions";
512
+ declare function BillSubmissionHeader(): ReactElement;
513
+ declare function BillSubmissionPatientSection(): ReactElement;
514
+ declare function BillSubmissionClaimSection(): ReactElement;
515
+ declare function BillSubmissionProvidersSection(): ReactElement;
516
+ declare function BillSubmissionServiceLinesSection(): ReactElement;
517
+ declare function BillSubmissionAttachmentsSection(): ReactElement;
518
+ declare function BillSubmissionActions(): ReactElement;
519
+ declare function BillSubmissionForm({ initialBill, attachments, onSubmit, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, appearance, className, style, disabled, submitLabel, heading, description, children, }: BillSubmissionFormProps): ReactElement;
507
520
 
508
521
  /** Public-domain and MindBill-owned metadata. CPT descriptions are intentionally limited to the curated catalog. */
509
522
  declare const DEFAULT_BILL_SUBMISSION_PROCEDURES: BillSubmissionProcedureOption[];
@@ -517,6 +530,86 @@ declare function calculateBillSubmissionAllowedAmount(line: {
517
530
  units?: number;
518
531
  }, procedures?: BillSubmissionProcedureOption[]): number | undefined;
519
532
 
533
+ type BillingDashboardBill = {
534
+ id: string;
535
+ billNumber?: string | number;
536
+ externalId?: string;
537
+ patientName: string;
538
+ claimNumber?: string;
539
+ payerName?: string;
540
+ state: string;
541
+ submittedAt?: string;
542
+ updatedAt?: string;
543
+ agingDays?: number;
544
+ totalCharge: number;
545
+ totalPaid: number;
546
+ balanceDue: number;
547
+ href?: string;
548
+ workItemLabel?: string;
549
+ };
550
+ type BillAgingBucketId = "current" | "31-60" | "61-90" | "91+";
551
+ type BillAgingBucket = {
552
+ id: BillAgingBucketId;
553
+ label: string;
554
+ count: number;
555
+ balance: number;
556
+ };
557
+ type BillingDashboardSummary = {
558
+ totalBilled: number;
559
+ totalPaid: number;
560
+ outstanding: number;
561
+ openCount: number;
562
+ bills: number;
563
+ aging: BillAgingBucket[];
564
+ };
565
+ type BillingComponentProps = {
566
+ appearance?: MindBillReactAppearance;
567
+ className?: string;
568
+ style?: CSSProperties;
569
+ };
570
+ type BillListProps = BillingComponentProps & {
571
+ bills: BillingDashboardBill[];
572
+ onSelectBill?: (bill: BillingDashboardBill) => void;
573
+ emptyState?: ReactNode;
574
+ };
575
+ type BillAgingSummaryProps = BillingComponentProps & {
576
+ bills: BillingDashboardBill[];
577
+ heading?: ReactNode;
578
+ };
579
+ type BillingDashboardProps = BillingComponentProps & {
580
+ bills: BillingDashboardBill[];
581
+ heading?: ReactNode;
582
+ description?: ReactNode;
583
+ onSelectBill?: (bill: BillingDashboardBill) => void;
584
+ initialSearch?: string;
585
+ initialState?: string;
586
+ hideFilters?: boolean;
587
+ };
588
+ type BillingReportDimension = "status" | "payer" | "aging";
589
+ type BillingReportRow = {
590
+ key: string;
591
+ label: string;
592
+ billCount: number;
593
+ totalBilled: number;
594
+ totalPaid: number;
595
+ balanceDue: number;
596
+ };
597
+ type BillingReportProps = BillingComponentProps & {
598
+ bills: BillingDashboardBill[];
599
+ groupBy?: BillingReportDimension;
600
+ heading?: ReactNode;
601
+ description?: ReactNode;
602
+ };
603
+ declare function billAgingDays(bill: BillingDashboardBill, now?: Date): number;
604
+ declare function billAgingBucket(bill: BillingDashboardBill, now?: Date): BillAgingBucketId;
605
+ declare function summarizeBillingDashboard(bills: BillingDashboardBill[], now?: Date): BillingDashboardSummary;
606
+ declare function BillList(props: BillListProps): ReactElement;
607
+ declare function BillAgingSummary(props: BillAgingSummaryProps): ReactElement;
608
+ declare function BillingDashboard({ bills, heading, description, onSelectBill, initialSearch, initialState, hideFilters, appearance, className, style }: BillingDashboardProps): ReactElement;
609
+ declare function buildBillingReportRows(bills: BillingDashboardBill[], groupBy?: BillingReportDimension): BillingReportRow[];
610
+ declare function buildBillingReportCsv(bills: BillingDashboardBill[], groupBy?: BillingReportDimension): string;
611
+ declare function BillingReport({ bills, groupBy, heading, description, appearance, className, style }: BillingReportProps): ReactElement;
612
+
520
613
  type BillStatusData = {
521
614
  billId: string;
522
615
  state: string;
@@ -613,6 +706,8 @@ declare function BillActivityTimeline({ events, emptyLabel, appearance, classNam
613
706
  type BillLifecycleStage = "submitted" | "accepted" | "processed" | "closed";
614
707
  /** Maps MindBill's detailed lifecycle state into a compact progress stage. */
615
708
  declare function billLifecycleStage(state: string): BillLifecycleStage;
709
+ /** Returns the end-user label for a canonical lifecycle state. */
710
+ declare function billLifecycleDisplayLabel(state: string, nativeStatus?: string): string;
616
711
  type BillLifecycleProgressProps = SurfaceProps & {
617
712
  state: string;
618
713
  nativeStatus?: string;
@@ -657,6 +752,8 @@ type UseBillLifecycleResult = {
657
752
  reopenBill: BillLifecycleClient["reopenBill"];
658
753
  postPayment: BillLifecycleClient["postPayment"];
659
754
  submitSecondReview: BillLifecycleClient["submitSecondReview"];
755
+ resubmitBill: BillLifecycleClient["resubmitBill"];
756
+ simulateSandbox: BillLifecycleClient["simulateSandbox"];
660
757
  };
661
758
  declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, initialData, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
662
759
  type ConnectedBillLifecycleProps = UseBillLifecycleOptions & {
@@ -681,4 +778,4 @@ type MindBillWidgetProps = {
681
778
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
682
779
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
683
780
 
684
- export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, 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, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billLifecycleStage, buildBillReviewSaveInput, calculateBillSubmissionAllowedAmount, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, resolveMindBillAppearance, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
781
+ export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, 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, BillSubmissionActions, type BillSubmissionAddress, BillSubmissionAttachmentsSection, BillSubmissionClaimSection, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, BillSubmissionHeader, type BillSubmissionInput, type BillSubmissionModifierOption, BillSubmissionPatientSection, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, BillSubmissionProvidersSection, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, buildBillReviewSaveInput, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };