@mindbill/react 0.9.4 → 0.10.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 +31 -16
- package/dist/index.d.ts +4 -27
- package/dist/index.js +14 -44
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,27 +6,25 @@ 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
|
+
sessionEndpoint="/api/mindbill/billing-session"
|
|
18
19
|
appearance={{ accentColor: "#32a9d6", textColor: "#203743" }}
|
|
19
|
-
|
|
20
|
-
{ id: "eor", label: "View EOR", onClick: openEor },
|
|
21
|
-
{ id: "payment", label: "Post payment", onClick: postPayment, primary: true },
|
|
22
|
-
]}
|
|
20
|
+
onChanged={(lifecycle) => syncBillStatus(lifecycle.bill)}
|
|
23
21
|
/>
|
|
24
22
|
```
|
|
25
23
|
|
|
26
24
|
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
25
|
|
|
28
26
|
```ts
|
|
29
|
-
// app/api/mindbill/
|
|
27
|
+
// app/api/mindbill/billing-session/route.ts
|
|
30
28
|
import { mindbill } from "@/lib/mindbill";
|
|
31
29
|
|
|
32
30
|
export async function POST(request: Request) {
|
|
@@ -34,8 +32,8 @@ export async function POST(request: Request) {
|
|
|
34
32
|
const { billId } = await request.json();
|
|
35
33
|
await requireBillAccess(user, billId); // your existing authorization
|
|
36
34
|
|
|
37
|
-
const session = await mindbill.
|
|
38
|
-
component: "bill-
|
|
35
|
+
const session = await mindbill.createBrowserSession({
|
|
36
|
+
component: "bill-review",
|
|
39
37
|
billId,
|
|
40
38
|
allowedOrigin: new URL(request.url).origin,
|
|
41
39
|
expiresIn: 900,
|
|
@@ -48,15 +46,29 @@ export async function POST(request: Request) {
|
|
|
48
46
|
}
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
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
50
|
|
|
53
51
|
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
52
|
|
|
55
|
-
##
|
|
53
|
+
## Compact status
|
|
56
54
|
|
|
57
|
-
`
|
|
55
|
+
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"`.
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
```tsx
|
|
58
|
+
import { ConnectedBillStatus } from "@mindbill/react";
|
|
59
|
+
|
|
60
|
+
<ConnectedBillStatus
|
|
61
|
+
billId={billId}
|
|
62
|
+
sessionEndpoint="/api/mindbill/status-session"
|
|
63
|
+
appearance={{ accentColor: "#32a9d6", textColor: "#203743" }}
|
|
64
|
+
/>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Use `useBillStatus({ billId })` when you want to render custom status UI. It returns `data`, `error`, `isLoading`, `isRefreshing`, and `refresh`. Use `createBillStatusClient` outside React.
|
|
68
|
+
|
|
69
|
+
## Controlled escape hatch
|
|
70
|
+
|
|
71
|
+
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
72
|
|
|
61
73
|
```tsx
|
|
62
74
|
import { BillReviewForm } from "@mindbill/react";
|
|
@@ -72,6 +84,9 @@ import { BillReviewForm } from "@mindbill/react";
|
|
|
72
84
|
onRemoveAttachment={(attachmentId) =>
|
|
73
85
|
api.delete(`/billing/attachments/${attachmentId}`)
|
|
74
86
|
}
|
|
87
|
+
onSearchClaimsAdministrators={(query, claimNumber) =>
|
|
88
|
+
api.searchPayers({ query, claimNumber })
|
|
89
|
+
}
|
|
75
90
|
/>
|
|
76
91
|
```
|
|
77
92
|
|
|
@@ -92,6 +107,6 @@ Use `BillStatusSummary` only when your application already owns status loading a
|
|
|
92
107
|
/>
|
|
93
108
|
```
|
|
94
109
|
|
|
95
|
-
`
|
|
110
|
+
`MindBillBillReview` and `MindBillBillTimeline` are available when a hosted flow is a better fit. Native and hosted UI paths use the same bill ID.
|
|
96
111
|
|
|
97
112
|
Never send a Partner API key or long-lived credential to React/browser code.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
|
4
4
|
|
|
5
5
|
type BillReviewDocumentType = "final_report" | "letter_of_attestation" | "proof_of_service" | "form_122" | "return_to_work_voucher" | "w9" | "medical_records" | "appeal" | "other";
|
|
6
6
|
type BillReviewBillingProvider = {
|
|
7
|
-
id?: string;
|
|
8
7
|
name: string;
|
|
9
8
|
taxId: string;
|
|
10
9
|
npi: string;
|
|
@@ -16,7 +15,6 @@ type BillReviewBillingProvider = {
|
|
|
16
15
|
billingZip?: string;
|
|
17
16
|
};
|
|
18
17
|
type BillReviewClinician = {
|
|
19
|
-
id?: string;
|
|
20
18
|
name: string;
|
|
21
19
|
specialty: string;
|
|
22
20
|
npi: string;
|
|
@@ -31,8 +29,6 @@ type BillReviewClinician = {
|
|
|
31
29
|
active?: boolean;
|
|
32
30
|
};
|
|
33
31
|
type BillReviewLocation = {
|
|
34
|
-
id?: string;
|
|
35
|
-
billingProviderId?: string;
|
|
36
32
|
name: string;
|
|
37
33
|
nickname?: string;
|
|
38
34
|
street: string;
|
|
@@ -95,10 +91,7 @@ type BillReviewData = {
|
|
|
95
91
|
transmissionState?: string;
|
|
96
92
|
dos: string;
|
|
97
93
|
dosEnd?: string | null;
|
|
98
|
-
placeOfServiceId?: string;
|
|
99
94
|
authorizationNumber?: string | null;
|
|
100
|
-
billingProviderId?: string;
|
|
101
|
-
renderingProviderId?: string;
|
|
102
95
|
billingSnapshot?: {
|
|
103
96
|
billingProvider?: BillReviewBillingProvider;
|
|
104
97
|
renderingProvider?: BillReviewClinician;
|
|
@@ -128,11 +121,6 @@ type BillReviewData = {
|
|
|
128
121
|
claimsAdminName?: string;
|
|
129
122
|
claimPatternStatus?: BillReviewClaimPatternStatus;
|
|
130
123
|
};
|
|
131
|
-
options?: {
|
|
132
|
-
billingProviders?: BillReviewBillingProvider[];
|
|
133
|
-
renderingProviders?: BillReviewClinician[];
|
|
134
|
-
locations?: BillReviewLocation[];
|
|
135
|
-
};
|
|
136
124
|
};
|
|
137
125
|
type BillReviewSaveInput = {
|
|
138
126
|
claimsAdminId: string;
|
|
@@ -153,12 +141,9 @@ type BillReviewSaveInput = {
|
|
|
153
141
|
dos: string;
|
|
154
142
|
dosEnd?: string | null;
|
|
155
143
|
authorizationNumber?: string | null;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
renderingProvider?: Omit<BillReviewClinician, "id">;
|
|
160
|
-
placeOfServiceId?: string;
|
|
161
|
-
placeOfService?: Omit<BillReviewLocation, "id">;
|
|
144
|
+
billingProvider?: BillReviewBillingProvider;
|
|
145
|
+
renderingProvider?: BillReviewClinician;
|
|
146
|
+
placeOfService?: BillReviewLocation;
|
|
162
147
|
lineItems: Array<{
|
|
163
148
|
id?: string;
|
|
164
149
|
code: string;
|
|
@@ -425,13 +410,5 @@ type MindBillWidgetProps = {
|
|
|
425
410
|
};
|
|
426
411
|
declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
|
|
427
412
|
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
413
|
|
|
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,
|
|
414
|
+
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 MindBillWidgetProps, type PostBillPaymentInput, type SubmitSecondReviewInput, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, buildBillReviewSaveInput, createBillLifecycleClient, createBillStatusClient, useBillLifecycle, useBillStatus };
|
package/dist/index.js
CHANGED
|
@@ -66,11 +66,6 @@ var MODIFIER_CODES = {
|
|
|
66
66
|
"97": ["ML201", "ML202", "ML203"],
|
|
67
67
|
"98": ["ML201", "ML202", "ML203"]
|
|
68
68
|
};
|
|
69
|
-
function withoutId(value) {
|
|
70
|
-
const result = { ...value };
|
|
71
|
-
delete result.id;
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
69
|
function toDraft(data) {
|
|
75
70
|
const snapshot = data.bill.billingSnapshot;
|
|
76
71
|
const nameParts = data.patient.name.trim().split(/\s+/);
|
|
@@ -119,12 +114,9 @@ function buildBillReviewSaveInput(draft) {
|
|
|
119
114
|
dos: draft.dos,
|
|
120
115
|
dosEnd: draft.dosEnd || null,
|
|
121
116
|
authorizationNumber: draft.authorizationNumber.trim() || null,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
renderingProvider: withoutId(draft.clinician),
|
|
126
|
-
...draft.location.id ? { placeOfServiceId: draft.location.id } : {},
|
|
127
|
-
placeOfService: withoutId(draft.location),
|
|
117
|
+
billingProvider: { ...draft.billingProvider },
|
|
118
|
+
renderingProvider: { ...draft.clinician },
|
|
119
|
+
placeOfService: { ...draft.location },
|
|
128
120
|
lineItems: draft.lineItems.filter((line) => line.code.trim()).map(({ id, code, modifiers, units }) => ({
|
|
129
121
|
...id ? { id } : {},
|
|
130
122
|
code: code.trim().toUpperCase(),
|
|
@@ -929,7 +921,7 @@ function createBillStatusClient({
|
|
|
929
921
|
};
|
|
930
922
|
const requestStatus = async (browserSession, signal) => {
|
|
931
923
|
const baseUrl = (browserSession.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
|
|
932
|
-
return fetcher(`${baseUrl}/
|
|
924
|
+
return fetcher(`${baseUrl}/partner/v2/browser/status`, {
|
|
933
925
|
headers: { authorization: `Bearer ${browserSession.token}` },
|
|
934
926
|
signal
|
|
935
927
|
});
|
|
@@ -1201,7 +1193,7 @@ function createBillLifecycleClient({
|
|
|
1201
1193
|
return response;
|
|
1202
1194
|
};
|
|
1203
1195
|
const loadLifecycle = async (signal) => {
|
|
1204
|
-
const response = await request("/
|
|
1196
|
+
const response = await request("/partner/v2/browser/bill", {}, signal);
|
|
1205
1197
|
if (!response.ok) {
|
|
1206
1198
|
throw await responseError2(response, "Bill lifecycle could not be loaded.");
|
|
1207
1199
|
}
|
|
@@ -1213,7 +1205,7 @@ function createBillLifecycleClient({
|
|
|
1213
1205
|
if (query.trim()) params.set("q", query.trim());
|
|
1214
1206
|
if (claimNumber?.trim()) params.set("claimNumber", claimNumber.trim());
|
|
1215
1207
|
const response = await request(
|
|
1216
|
-
`/
|
|
1208
|
+
`/partner/v2/browser/claims-administrators?${params.toString()}`
|
|
1217
1209
|
);
|
|
1218
1210
|
if (!response.ok) {
|
|
1219
1211
|
throw await responseError2(
|
|
@@ -1264,7 +1256,7 @@ function createBillLifecycleClient({
|
|
|
1264
1256
|
};
|
|
1265
1257
|
const action = async (input, fallback) => {
|
|
1266
1258
|
const response = await mutation(
|
|
1267
|
-
"/
|
|
1259
|
+
"/partner/v2/browser/actions",
|
|
1268
1260
|
{
|
|
1269
1261
|
method: "POST",
|
|
1270
1262
|
headers: { "content-type": "application/json" },
|
|
@@ -1277,7 +1269,7 @@ function createBillLifecycleClient({
|
|
|
1277
1269
|
};
|
|
1278
1270
|
const saveReview = async (input) => {
|
|
1279
1271
|
await mutation(
|
|
1280
|
-
"/
|
|
1272
|
+
"/partner/v2/browser/bill",
|
|
1281
1273
|
{
|
|
1282
1274
|
method: "PATCH",
|
|
1283
1275
|
headers: { "content-type": "application/json" },
|
|
@@ -1298,7 +1290,7 @@ function createBillLifecycleClient({
|
|
|
1298
1290
|
async submitBill(input, route) {
|
|
1299
1291
|
await saveReview(input);
|
|
1300
1292
|
await mutation(
|
|
1301
|
-
"/
|
|
1293
|
+
"/partner/v2/browser/submissions",
|
|
1302
1294
|
{
|
|
1303
1295
|
method: "POST",
|
|
1304
1296
|
headers: { "content-type": "application/json" },
|
|
@@ -1314,7 +1306,7 @@ function createBillLifecycleClient({
|
|
|
1314
1306
|
body.set("documentType", documentType);
|
|
1315
1307
|
if (description) body.set("description", description);
|
|
1316
1308
|
await mutation(
|
|
1317
|
-
"/
|
|
1309
|
+
"/partner/v2/browser/documents",
|
|
1318
1310
|
{ method: "POST", body },
|
|
1319
1311
|
"Document could not be attached."
|
|
1320
1312
|
);
|
|
@@ -1322,7 +1314,7 @@ function createBillLifecycleClient({
|
|
|
1322
1314
|
},
|
|
1323
1315
|
async removeAttachment(attachmentId) {
|
|
1324
1316
|
await mutation(
|
|
1325
|
-
`/
|
|
1317
|
+
`/partner/v2/browser/documents/${encodeURIComponent(attachmentId)}`,
|
|
1326
1318
|
{ method: "DELETE" },
|
|
1327
1319
|
"Document could not be removed."
|
|
1328
1320
|
);
|
|
@@ -1330,7 +1322,7 @@ function createBillLifecycleClient({
|
|
|
1330
1322
|
},
|
|
1331
1323
|
async getAttachment(attachmentId) {
|
|
1332
1324
|
const response = await request(
|
|
1333
|
-
`/
|
|
1325
|
+
`/partner/v2/browser/documents/${encodeURIComponent(attachmentId)}`
|
|
1334
1326
|
);
|
|
1335
1327
|
if (!response.ok) {
|
|
1336
1328
|
throw await responseError2(response, "Document could not be opened.");
|
|
@@ -1339,7 +1331,7 @@ function createBillLifecycleClient({
|
|
|
1339
1331
|
},
|
|
1340
1332
|
async getEor(documentId) {
|
|
1341
1333
|
const response = await request(
|
|
1342
|
-
`/
|
|
1334
|
+
`/partner/v2/browser/eors/${encodeURIComponent(documentId)}`
|
|
1343
1335
|
);
|
|
1344
1336
|
if (!response.ok) throw await responseError2(response, "EOR could not be opened.");
|
|
1345
1337
|
return response.blob();
|
|
@@ -1361,7 +1353,7 @@ function createBillLifecycleClient({
|
|
|
1361
1353
|
},
|
|
1362
1354
|
async startCorrection() {
|
|
1363
1355
|
const response = await mutation(
|
|
1364
|
-
"/
|
|
1356
|
+
"/partner/v2/browser/actions",
|
|
1365
1357
|
{
|
|
1366
1358
|
method: "POST",
|
|
1367
1359
|
headers: { "content-type": "application/json" },
|
|
@@ -1912,35 +1904,13 @@ function MindBillBillTimeline(props) {
|
|
|
1912
1904
|
function MindBillBillReview(props) {
|
|
1913
1905
|
return widget("mindbill-bill-review", props);
|
|
1914
1906
|
}
|
|
1915
|
-
function MindBillBillFromReport(props) {
|
|
1916
|
-
return widget("mindbill-bill-from-report", props);
|
|
1917
|
-
}
|
|
1918
|
-
function MindBillCollections(props) {
|
|
1919
|
-
return widget("mindbill-collections", props);
|
|
1920
|
-
}
|
|
1921
|
-
function MindBillOnboarding(props) {
|
|
1922
|
-
return widget("mindbill-onboarding", props);
|
|
1923
|
-
}
|
|
1924
|
-
var HostedBillTimeline = MindBillBillTimeline;
|
|
1925
|
-
var HostedBillReview = MindBillBillReview;
|
|
1926
|
-
var HostedBillFromReport = MindBillBillFromReport;
|
|
1927
|
-
var HostedCollections = MindBillCollections;
|
|
1928
|
-
var HostedOnboarding = MindBillOnboarding;
|
|
1929
1907
|
export {
|
|
1930
1908
|
BillReviewForm,
|
|
1931
1909
|
BillStatusSummary,
|
|
1932
1910
|
ConnectedBillLifecycle,
|
|
1933
1911
|
ConnectedBillStatus,
|
|
1934
|
-
HostedBillFromReport,
|
|
1935
|
-
HostedBillReview,
|
|
1936
|
-
HostedBillTimeline,
|
|
1937
|
-
HostedCollections,
|
|
1938
|
-
HostedOnboarding,
|
|
1939
|
-
MindBillBillFromReport,
|
|
1940
1912
|
MindBillBillReview,
|
|
1941
1913
|
MindBillBillTimeline,
|
|
1942
|
-
MindBillCollections,
|
|
1943
|
-
MindBillOnboarding,
|
|
1944
1914
|
buildBillReviewSaveInput,
|
|
1945
1915
|
createBillLifecycleClient,
|
|
1946
1916
|
createBillStatusClient,
|