@mindbill/react 0.15.0 → 0.16.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 +35 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.js +253 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,7 +1,7 @@
|
|
|
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';
|
|
4
|
+
import { BillLifecycleAction, BillLifecycleClientOptions, BrowserBillCreateInput, BillLifecycleData, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
|
|
5
5
|
export { BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BrowserBillAddress, BrowserBillCreateInput, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
|
|
6
6
|
|
|
7
7
|
type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue";
|
|
@@ -406,6 +406,39 @@ type ConnectedBillStatusProps = UseBillStatusOptions & {
|
|
|
406
406
|
};
|
|
407
407
|
declare function ConnectedBillStatus({ actions, appearance, className, style, loadingFallback, errorFallback, ...options }: ConnectedBillStatusProps): ReactElement | null;
|
|
408
408
|
|
|
409
|
+
type BillLifecycleActionsProps = {
|
|
410
|
+
actions: readonly BillLifecycleAction[];
|
|
411
|
+
onAction: (action: BillLifecycleAction) => void;
|
|
412
|
+
/** Show disabled actions and the server-provided reason. Defaults to false. */
|
|
413
|
+
showUnavailable?: boolean;
|
|
414
|
+
disabled?: boolean;
|
|
415
|
+
appearance?: MindBillReactAppearance;
|
|
416
|
+
className?: string;
|
|
417
|
+
style?: CSSProperties;
|
|
418
|
+
};
|
|
419
|
+
/** Returns the server-authoritative actions that should be rendered. */
|
|
420
|
+
declare function visibleBillLifecycleActions(actions: readonly BillLifecycleAction[], showUnavailable?: boolean): BillLifecycleAction[];
|
|
421
|
+
declare function BillLifecycleActions({ actions, onAction, showUnavailable, disabled, appearance, className, style, }: BillLifecycleActionsProps): ReactElement | null;
|
|
422
|
+
type BillActivityEvent = {
|
|
423
|
+
id: string;
|
|
424
|
+
type: string;
|
|
425
|
+
createdAt: string;
|
|
426
|
+
title?: string;
|
|
427
|
+
description?: string;
|
|
428
|
+
actor?: string;
|
|
429
|
+
};
|
|
430
|
+
type BillActivityTimelineProps = {
|
|
431
|
+
events: readonly BillActivityEvent[];
|
|
432
|
+
emptyLabel?: string;
|
|
433
|
+
appearance?: MindBillReactAppearance;
|
|
434
|
+
className?: string;
|
|
435
|
+
style?: CSSProperties;
|
|
436
|
+
formatDate?: (createdAt: string) => string;
|
|
437
|
+
};
|
|
438
|
+
/** Human-readable fallback for a signed partner event type. */
|
|
439
|
+
declare function billActivityEventLabel(type: string): string;
|
|
440
|
+
declare function BillActivityTimeline({ events, emptyLabel, appearance, className, style, formatDate, }: BillActivityTimelineProps): ReactElement;
|
|
441
|
+
|
|
409
442
|
type UseBillLifecycleOptions = BillLifecycleClientOptions & {
|
|
410
443
|
/** Initial bill snapshot used when no existing `billId` is supplied. */
|
|
411
444
|
create?: BrowserBillCreateInput;
|
|
@@ -460,4 +493,4 @@ type MindBillWidgetProps = {
|
|
|
460
493
|
declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
|
|
461
494
|
declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
|
|
462
495
|
|
|
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 };
|
|
496
|
+
export { type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, BillLifecycleActions, type BillLifecycleActionsProps, 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, billActivityEventLabel, buildBillReviewSaveInput, createBillStatusClient, ensureTrailingProcedureLine, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus, visibleBillLifecycleActions };
|