@mindbill/react 0.15.0 → 0.17.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
@@ -84,6 +84,41 @@ import { ConnectedBillStatus } from "@mindbill/react";
84
84
 
85
85
  Use `useBillStatus({ billId })` when you want to render custom status UI. It returns `data`, `error`, `isLoading`, `isRefreshing`, and `refresh`. Use `createBillStatusClient` outside React.
86
86
 
87
+ ## Lifecycle actions
88
+
89
+ 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.
90
+
91
+ ```tsx
92
+ import { BillLifecycleActions } from "@mindbill/react";
93
+
94
+ <BillLifecycleActions
95
+ actions={bill.data.lifecycle.actions}
96
+ onAction={(action) => {
97
+ switch (action.id) {
98
+ case "view_eor": return bill.openEor();
99
+ case "post_payment": return setPaymentOpen(true);
100
+ case "second_review": return setSecondReviewOpen(true);
101
+ case "correct_and_resubmit": return bill.startCorrection();
102
+ case "close": return bill.closeBill({ reason: "Resolved" });
103
+ }
104
+ }}
105
+ />
106
+ ```
107
+
108
+ Disabled actions are hidden by default. Set `showUnavailable` to show them with the reason returned by the API.
109
+
110
+ ## Activity timeline
111
+
112
+ `BillActivityTimeline` renders ordered lifecycle events. Feed it events stored from MindBill's signed webhooks so a reload does not depend on browser callback history.
113
+
114
+ ```tsx
115
+ import { BillActivityTimeline } from "@mindbill/react";
116
+
117
+ <BillActivityTimeline events={billEvents} />
118
+ ```
119
+
120
+ Browser callbacks such as `onBillCreated`, `onBillIdChange`, and `onChanged` are for immediate UI, navigation, optimistic state, and analytics. Signed webhooks are the authoritative integration for durable server state.
121
+
87
122
  ## Controlled escape hatch
88
123
 
89
124
  Use `BillReviewForm` only when your application intentionally owns the API calls and local review state. Known bill values and payer documents remain explicit and editable.
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 { BillLifecycleClientOptions, BrowserBillCreateInput, BillLifecycleData, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
- export { BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BrowserBillAddress, BrowserBillCreateInput, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
4
+ import { BillLifecycleAction, BillLifecycleDelivery, BillPaymentRecord, BillRemittanceSummary, BillLifecycleData, BillLifecycleClientOptions, BrowserBillCreateInput, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
5
+ export { BillActivityRecord, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRemittanceSummary, BrowserBillAddress, BrowserBillCreateInput, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
6
6
 
7
7
  type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue";
8
8
  type MindBillReactAppearance = MindBillAppearance & {
@@ -406,6 +406,62 @@ type ConnectedBillStatusProps = UseBillStatusOptions & {
406
406
  };
407
407
  declare function ConnectedBillStatus({ actions, appearance, className, style, loadingFallback, errorFallback, ...options }: ConnectedBillStatusProps): ReactElement | null;
408
408
 
409
+ type SurfaceProps = {
410
+ appearance?: MindBillReactAppearance;
411
+ className?: string;
412
+ style?: CSSProperties;
413
+ };
414
+ type BillLifecycleActionsProps = SurfaceProps & {
415
+ actions: readonly BillLifecycleAction[];
416
+ onAction: (action: BillLifecycleAction) => void;
417
+ /** Show disabled actions and the server-provided reason. Defaults to false. */
418
+ showUnavailable?: boolean;
419
+ disabled?: boolean;
420
+ };
421
+ /** Returns the server-authoritative actions that should be rendered. */
422
+ declare function visibleBillLifecycleActions(actions: readonly BillLifecycleAction[], showUnavailable?: boolean): BillLifecycleAction[];
423
+ declare function BillLifecycleActions({ actions, onAction, showUnavailable, disabled, appearance, className, style, }: BillLifecycleActionsProps): ReactElement | null;
424
+ type BillActivityEvent = {
425
+ id: string;
426
+ type: string;
427
+ createdAt: string;
428
+ title?: string;
429
+ description?: string;
430
+ actor?: string | null;
431
+ };
432
+ type BillActivityTimelineProps = SurfaceProps & {
433
+ events: readonly BillActivityEvent[];
434
+ emptyLabel?: string;
435
+ formatDate?: (createdAt: string) => string;
436
+ };
437
+ /** Human-readable fallback for a signed partner event type. */
438
+ declare function billActivityEventLabel(type: string): string;
439
+ declare function BillActivityTimeline({ events, emptyLabel, appearance, className, style, formatDate }: BillActivityTimelineProps): ReactElement;
440
+ type BillLifecycleStage = "created" | "submitted" | "accepted" | "response" | "follow_up" | "closed";
441
+ /** Maps MindBill's detailed lifecycle state into a compact progress stage. */
442
+ declare function billLifecycleStage(state: string): BillLifecycleStage;
443
+ type BillLifecycleProgressProps = SurfaceProps & {
444
+ state: string;
445
+ nativeStatus?: string;
446
+ submittedAt?: string | null;
447
+ agingDays?: number | null;
448
+ };
449
+ declare function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }: BillLifecycleProgressProps): ReactElement;
450
+ type BillSnapshotSummaryProps = SurfaceProps & Pick<BillLifecycleData, "bill" | "patient" | "injury" | "delivery">;
451
+ declare function BillSnapshotSummary({ bill, patient, injury, delivery, appearance, className, style }: BillSnapshotSummaryProps): ReactElement;
452
+ type BillRemittanceCardProps = SurfaceProps & {
453
+ remittance: BillRemittanceSummary;
454
+ };
455
+ declare function BillRemittanceCard({ remittance, appearance, className, style }: BillRemittanceCardProps): ReactElement;
456
+ type BillPayerContactCardProps = SurfaceProps & {
457
+ delivery: BillLifecycleDelivery;
458
+ };
459
+ declare function BillPayerContactCard({ delivery, appearance, className, style }: BillPayerContactCardProps): ReactElement | null;
460
+ type BillPaymentLedgerProps = SurfaceProps & {
461
+ payments: readonly BillPaymentRecord[];
462
+ };
463
+ declare function BillPaymentLedger({ payments, appearance, className, style }: BillPaymentLedgerProps): ReactElement;
464
+
409
465
  type UseBillLifecycleOptions = BillLifecycleClientOptions & {
410
466
  /** Initial bill snapshot used when no existing `billId` is supplied. */
411
467
  create?: BrowserBillCreateInput;
@@ -460,4 +516,4 @@ type MindBillWidgetProps = {
460
516
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
461
517
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
462
518
 
463
- export { 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, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionRoute, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingProcedureLine, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus };
519
+ export { 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 BillSubmissionRoute, 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, visibleBillLifecycleActions };