@mindbill/react 0.9.4 → 0.11.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 +51 -18
- package/dist/index.d.ts +74 -30
- package/dist/index.js +135 -71
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,27 +6,43 @@ Native React billing components and connected lifecycle hooks. Install with:
|
|
|
6
6
|
npm install @mindbill/react @mindbill/node
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
## Connected
|
|
9
|
+
## Connected lifecycle
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`ConnectedBillLifecycle` is the default integration. It owns bill loading, payer lookup, editable review, attachments, submission, status refresh, EORs, payment posting, Second Bill Review, correction/resubmission, and close.
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
|
-
import {
|
|
14
|
+
import { ConnectedBillLifecycle } from "@mindbill/react";
|
|
15
15
|
|
|
16
|
-
<
|
|
16
|
+
<ConnectedBillLifecycle
|
|
17
17
|
billId={billId}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
sessionEndpoint="/api/mindbill/billing-session"
|
|
19
|
+
appearance={{ preset: "qme-companion" }}
|
|
20
|
+
onChanged={(lifecycle) => syncBillStatus(lifecycle.bill)}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Appearance
|
|
25
|
+
|
|
26
|
+
Choose a complete preset, then override only the tokens your design system owns. The preset applies to review, payer search, attachments, submission, status, EOR, payment, denial, resubmission, and close states.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
<ConnectedBillLifecycle
|
|
30
|
+
billId={billId}
|
|
31
|
+
appearance={{
|
|
32
|
+
preset: "brighterway",
|
|
33
|
+
accentColor: "#ff4f0a",
|
|
34
|
+
fontFamily: "Inter, sans-serif",
|
|
35
|
+
borderRadius: "8px",
|
|
36
|
+
}}
|
|
23
37
|
/>
|
|
24
38
|
```
|
|
25
39
|
|
|
40
|
+
Available presets are `mindbill`, `qme-companion`, and `brighterway`. Supported overrides include accent, accent text, background, surface, input background, text, muted text, border, font, panel radius, control radius, shadow, danger, success, and warning colors.
|
|
41
|
+
|
|
26
42
|
Add one authenticated route to your app. It verifies that the signed-in user may access the bill, then mints an exact-origin, bill-scoped token. The Partner API key stays on the server.
|
|
27
43
|
|
|
28
44
|
```ts
|
|
29
|
-
// app/api/mindbill/
|
|
45
|
+
// app/api/mindbill/billing-session/route.ts
|
|
30
46
|
import { mindbill } from "@/lib/mindbill";
|
|
31
47
|
|
|
32
48
|
export async function POST(request: Request) {
|
|
@@ -34,8 +50,8 @@ export async function POST(request: Request) {
|
|
|
34
50
|
const { billId } = await request.json();
|
|
35
51
|
await requireBillAccess(user, billId); // your existing authorization
|
|
36
52
|
|
|
37
|
-
const session = await mindbill.
|
|
38
|
-
component: "bill-
|
|
53
|
+
const session = await mindbill.createBrowserSession({
|
|
54
|
+
component: "bill-review",
|
|
39
55
|
billId,
|
|
40
56
|
allowedOrigin: new URL(request.url).origin,
|
|
41
57
|
expiresIn: 900,
|
|
@@ -48,22 +64,36 @@ export async function POST(request: Request) {
|
|
|
48
64
|
}
|
|
49
65
|
```
|
|
50
66
|
|
|
51
|
-
|
|
67
|
+
The component searches MindBill's claims-administrator directory with both payer text and the current claim number. It explains name and claim-pattern evidence, shows delivery availability, and only preselects a high-confidence exact name or alias match.
|
|
52
68
|
|
|
53
69
|
This is the minimum safe browser integration. A permanent Partner API key must never enter frontend code. A completely serverless partner integration requires MindBill-hosted sign-in/SSO so MindBill can authenticate the end user itself.
|
|
54
70
|
|
|
55
|
-
##
|
|
71
|
+
## Compact status
|
|
72
|
+
|
|
73
|
+
Use `ConnectedBillStatus` when the partner page only needs a small status and aging surface. Add a second session route using the same server pattern and mint `component: "bill-timeline"`.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { ConnectedBillStatus } from "@mindbill/react";
|
|
77
|
+
|
|
78
|
+
<ConnectedBillStatus
|
|
79
|
+
billId={billId}
|
|
80
|
+
sessionEndpoint="/api/mindbill/status-session"
|
|
81
|
+
appearance={{ preset: "qme-companion" }}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use `useBillStatus({ billId })` when you want to render custom status UI. It returns `data`, `error`, `isLoading`, `isRefreshing`, and `refresh`. Use `createBillStatusClient` outside React.
|
|
56
86
|
|
|
57
|
-
|
|
87
|
+
## Controlled escape hatch
|
|
58
88
|
|
|
59
|
-
|
|
89
|
+
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.
|
|
60
90
|
|
|
61
91
|
```tsx
|
|
62
92
|
import { BillReviewForm } from "@mindbill/react";
|
|
63
93
|
|
|
64
94
|
<BillReviewForm
|
|
65
95
|
data={billReview}
|
|
66
|
-
appearance={{
|
|
96
|
+
appearance={{ preset: "qme-companion" }}
|
|
67
97
|
onSave={(input) => api.patch("/billing/review", input)}
|
|
68
98
|
onSubmit={(input, route) => api.post("/billing/submit", { input, route })}
|
|
69
99
|
onAddAttachment={(file, documentType, description) =>
|
|
@@ -72,6 +102,9 @@ import { BillReviewForm } from "@mindbill/react";
|
|
|
72
102
|
onRemoveAttachment={(attachmentId) =>
|
|
73
103
|
api.delete(`/billing/attachments/${attachmentId}`)
|
|
74
104
|
}
|
|
105
|
+
onSearchClaimsAdministrators={(query, claimNumber) =>
|
|
106
|
+
api.searchPayers({ query, claimNumber })
|
|
107
|
+
}
|
|
75
108
|
/>
|
|
76
109
|
```
|
|
77
110
|
|
|
@@ -92,6 +125,6 @@ Use `BillStatusSummary` only when your application already owns status loading a
|
|
|
92
125
|
/>
|
|
93
126
|
```
|
|
94
127
|
|
|
95
|
-
`
|
|
128
|
+
`MindBillBillReview` and `MindBillBillTimeline` are available when a hosted flow is a better fit. Native and hosted UI paths use the same bill ID.
|
|
96
129
|
|
|
97
130
|
Never send a Partner API key or long-lived credential to React/browser code.
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,75 @@ import { MindBillAppearance, MindBillEventDetail, MindBillErrorDetail } from '@m
|
|
|
2
2
|
export { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from '@mindbill/embed';
|
|
3
3
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
+
type MindBillThemePreset = "mindbill" | "qme-companion" | "brighterway";
|
|
6
|
+
type MindBillReactAppearance = MindBillAppearance & {
|
|
7
|
+
/** A complete starting point. Individual tokens below always win. */
|
|
8
|
+
preset?: MindBillThemePreset;
|
|
9
|
+
accentTextColor?: string;
|
|
10
|
+
inputBackgroundColor?: string;
|
|
11
|
+
controlRadius?: string;
|
|
12
|
+
shadow?: string;
|
|
13
|
+
dangerColor?: string;
|
|
14
|
+
successColor?: string;
|
|
15
|
+
warningColor?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const mindBillThemePresets: {
|
|
18
|
+
readonly mindbill: {
|
|
19
|
+
readonly accentColor: "#238dbd";
|
|
20
|
+
readonly accentTextColor: "#ffffff";
|
|
21
|
+
readonly backgroundColor: "#f3f8fa";
|
|
22
|
+
readonly surfaceColor: "#ffffff";
|
|
23
|
+
readonly inputBackgroundColor: "#ffffff";
|
|
24
|
+
readonly textColor: "#203743";
|
|
25
|
+
readonly mutedColor: "#657982";
|
|
26
|
+
readonly borderColor: "#dbe6ea";
|
|
27
|
+
readonly borderRadius: "14px";
|
|
28
|
+
readonly controlRadius: "8px";
|
|
29
|
+
readonly shadow: "0 8px 24px rgba(28,58,72,.04)";
|
|
30
|
+
readonly dangerColor: "#b63d35";
|
|
31
|
+
readonly successColor: "#217449";
|
|
32
|
+
readonly warningColor: "#8a5c17";
|
|
33
|
+
};
|
|
34
|
+
readonly "qme-companion": {
|
|
35
|
+
readonly accentColor: "#53b5dc";
|
|
36
|
+
readonly accentTextColor: "#173542";
|
|
37
|
+
readonly backgroundColor: "#f2f8fb";
|
|
38
|
+
readonly surfaceColor: "#ffffff";
|
|
39
|
+
readonly inputBackgroundColor: "#ffffff";
|
|
40
|
+
readonly textColor: "#1d3440";
|
|
41
|
+
readonly mutedColor: "#617783";
|
|
42
|
+
readonly borderColor: "#d7e5eb";
|
|
43
|
+
readonly borderRadius: "12px";
|
|
44
|
+
readonly controlRadius: "8px";
|
|
45
|
+
readonly shadow: "0 1px 2px rgba(29,52,64,.05)";
|
|
46
|
+
readonly dangerColor: "#b83f3a";
|
|
47
|
+
readonly successColor: "#21835d";
|
|
48
|
+
readonly warningColor: "#9a6418";
|
|
49
|
+
readonly fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif";
|
|
50
|
+
};
|
|
51
|
+
readonly brighterway: {
|
|
52
|
+
readonly accentColor: "#ff4f0a";
|
|
53
|
+
readonly accentTextColor: "#ffffff";
|
|
54
|
+
readonly backgroundColor: "#fffaf6";
|
|
55
|
+
readonly surfaceColor: "#ffffff";
|
|
56
|
+
readonly inputBackgroundColor: "#ffffff";
|
|
57
|
+
readonly textColor: "#111827";
|
|
58
|
+
readonly mutedColor: "#626a73";
|
|
59
|
+
readonly borderColor: "#e5e1dc";
|
|
60
|
+
readonly borderRadius: "8px";
|
|
61
|
+
readonly controlRadius: "6px";
|
|
62
|
+
readonly shadow: "0 4px 18px rgba(17,24,39,.06)";
|
|
63
|
+
readonly dangerColor: "#b42318";
|
|
64
|
+
readonly successColor: "#16794f";
|
|
65
|
+
readonly warningColor: "#9a5b13";
|
|
66
|
+
readonly fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
declare function resolveMindBillAppearance(appearance: MindBillReactAppearance | undefined): MindBillReactAppearance;
|
|
70
|
+
declare function mindBillAppearanceStyle(appearance: MindBillReactAppearance | undefined, style?: CSSProperties): CSSProperties;
|
|
71
|
+
|
|
5
72
|
type BillReviewDocumentType = "final_report" | "letter_of_attestation" | "proof_of_service" | "form_122" | "return_to_work_voucher" | "w9" | "medical_records" | "appeal" | "other";
|
|
6
73
|
type BillReviewBillingProvider = {
|
|
7
|
-
id?: string;
|
|
8
74
|
name: string;
|
|
9
75
|
taxId: string;
|
|
10
76
|
npi: string;
|
|
@@ -16,7 +82,6 @@ type BillReviewBillingProvider = {
|
|
|
16
82
|
billingZip?: string;
|
|
17
83
|
};
|
|
18
84
|
type BillReviewClinician = {
|
|
19
|
-
id?: string;
|
|
20
85
|
name: string;
|
|
21
86
|
specialty: string;
|
|
22
87
|
npi: string;
|
|
@@ -31,8 +96,6 @@ type BillReviewClinician = {
|
|
|
31
96
|
active?: boolean;
|
|
32
97
|
};
|
|
33
98
|
type BillReviewLocation = {
|
|
34
|
-
id?: string;
|
|
35
|
-
billingProviderId?: string;
|
|
36
99
|
name: string;
|
|
37
100
|
nickname?: string;
|
|
38
101
|
street: string;
|
|
@@ -95,10 +158,7 @@ type BillReviewData = {
|
|
|
95
158
|
transmissionState?: string;
|
|
96
159
|
dos: string;
|
|
97
160
|
dosEnd?: string | null;
|
|
98
|
-
placeOfServiceId?: string;
|
|
99
161
|
authorizationNumber?: string | null;
|
|
100
|
-
billingProviderId?: string;
|
|
101
|
-
renderingProviderId?: string;
|
|
102
162
|
billingSnapshot?: {
|
|
103
163
|
billingProvider?: BillReviewBillingProvider;
|
|
104
164
|
renderingProvider?: BillReviewClinician;
|
|
@@ -128,11 +188,6 @@ type BillReviewData = {
|
|
|
128
188
|
claimsAdminName?: string;
|
|
129
189
|
claimPatternStatus?: BillReviewClaimPatternStatus;
|
|
130
190
|
};
|
|
131
|
-
options?: {
|
|
132
|
-
billingProviders?: BillReviewBillingProvider[];
|
|
133
|
-
renderingProviders?: BillReviewClinician[];
|
|
134
|
-
locations?: BillReviewLocation[];
|
|
135
|
-
};
|
|
136
191
|
};
|
|
137
192
|
type BillReviewSaveInput = {
|
|
138
193
|
claimsAdminId: string;
|
|
@@ -153,12 +208,9 @@ type BillReviewSaveInput = {
|
|
|
153
208
|
dos: string;
|
|
154
209
|
dosEnd?: string | null;
|
|
155
210
|
authorizationNumber?: string | null;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
renderingProvider?: Omit<BillReviewClinician, "id">;
|
|
160
|
-
placeOfServiceId?: string;
|
|
161
|
-
placeOfService?: Omit<BillReviewLocation, "id">;
|
|
211
|
+
billingProvider?: BillReviewBillingProvider;
|
|
212
|
+
renderingProvider?: BillReviewClinician;
|
|
213
|
+
placeOfService?: BillReviewLocation;
|
|
162
214
|
lineItems: Array<{
|
|
163
215
|
id?: string;
|
|
164
216
|
code: string;
|
|
@@ -177,7 +229,7 @@ type BillReviewFormProps = {
|
|
|
177
229
|
onSearchClaimsAdministrators?: (query: string, claimNumber?: string) => Promise<BillReviewPayer[]>;
|
|
178
230
|
className?: string;
|
|
179
231
|
style?: CSSProperties;
|
|
180
|
-
appearance?:
|
|
232
|
+
appearance?: MindBillReactAppearance;
|
|
181
233
|
features?: BillReviewFeatures;
|
|
182
234
|
disabled?: boolean;
|
|
183
235
|
};
|
|
@@ -215,7 +267,7 @@ type BillStatusSummaryProps = {
|
|
|
215
267
|
actions?: BillStatusAction[];
|
|
216
268
|
className?: string;
|
|
217
269
|
style?: CSSProperties;
|
|
218
|
-
appearance?:
|
|
270
|
+
appearance?: MindBillReactAppearance;
|
|
219
271
|
};
|
|
220
272
|
type BillStatusAction = {
|
|
221
273
|
id: string;
|
|
@@ -404,7 +456,7 @@ type UseBillLifecycleResult = {
|
|
|
404
456
|
declare function createBillLifecycleClient({ billId, sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, }: BillLifecycleClientOptions): BillLifecycleClient;
|
|
405
457
|
declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, initialData, onBillIdChange, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
|
|
406
458
|
type ConnectedBillLifecycleProps = UseBillLifecycleOptions & {
|
|
407
|
-
appearance?:
|
|
459
|
+
appearance?: MindBillReactAppearance;
|
|
408
460
|
features?: BillReviewFeatures;
|
|
409
461
|
className?: string;
|
|
410
462
|
style?: CSSProperties;
|
|
@@ -425,13 +477,5 @@ type MindBillWidgetProps = {
|
|
|
425
477
|
};
|
|
426
478
|
declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
|
|
427
479
|
declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
|
|
428
|
-
declare function MindBillBillFromReport(props: MindBillWidgetProps): ReactElement;
|
|
429
|
-
declare function MindBillCollections(props: MindBillWidgetProps): ReactElement;
|
|
430
|
-
declare function MindBillOnboarding(props: MindBillWidgetProps): ReactElement;
|
|
431
|
-
declare const HostedBillTimeline: typeof MindBillBillTimeline;
|
|
432
|
-
declare const HostedBillReview: typeof MindBillBillReview;
|
|
433
|
-
declare const HostedBillFromReport: typeof MindBillBillFromReport;
|
|
434
|
-
declare const HostedCollections: typeof MindBillCollections;
|
|
435
|
-
declare const HostedOnboarding: typeof MindBillOnboarding;
|
|
436
480
|
|
|
437
|
-
export { type BillEorDocument, type BillLifecycleAction, type BillLifecycleActionId, type BillLifecycleClient, type BillLifecycleClientOptions, type BillLifecycleData, type BillLifecycleSession, type BillLifecycleSessionProvider, type BillLifecycleSessionRequest, 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, type CloseBillInput, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps,
|
|
481
|
+
export { type BillEorDocument, type BillLifecycleAction, type BillLifecycleActionId, type BillLifecycleClient, type BillLifecycleClientOptions, type BillLifecycleData, type BillLifecycleSession, type BillLifecycleSessionProvider, type BillLifecycleSessionRequest, 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, type CloseBillInput, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type PostBillPaymentInput, type SubmitSecondReviewInput, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, buildBillReviewSaveInput, createBillLifecycleClient, createBillStatusClient, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus };
|