@mindbill/react 0.12.0 → 0.13.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 +1 -1
- package/dist/index.d.ts +21 -89
- package/dist/index.js +24 -287
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Choose a complete preset, then override only the tokens your design system owns.
|
|
|
37
37
|
/>
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Available presets are `mindbill`, `qme-companion`, and `
|
|
40
|
+
Available presets are `mindbill`, `qme-companion`, `orange-bright`, and `clinical-blue`. Preset names describe visual styles rather than customer or partner brands. 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
41
|
|
|
42
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.
|
|
43
43
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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, BillLifecycleData, BillLifecycleClient, BillEorDocument } from '@mindbill/browser';
|
|
5
|
+
export { BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, CloseBillInput, PostBillPaymentInput, SubmitSecondReviewInput, createBillLifecycleClient } from '@mindbill/browser';
|
|
4
6
|
|
|
5
|
-
type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright";
|
|
7
|
+
type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue";
|
|
6
8
|
type MindBillReactAppearance = MindBillAppearance & {
|
|
7
9
|
/** A complete starting point. Individual tokens below always win. */
|
|
8
10
|
preset?: MindBillThemePreset;
|
|
@@ -65,6 +67,23 @@ declare const mindBillThemePresets: {
|
|
|
65
67
|
readonly warningColor: "#9a5b13";
|
|
66
68
|
readonly fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif";
|
|
67
69
|
};
|
|
70
|
+
readonly "clinical-blue": {
|
|
71
|
+
readonly accentColor: "#1677ff";
|
|
72
|
+
readonly accentTextColor: "#ffffff";
|
|
73
|
+
readonly backgroundColor: "#f5f7fa";
|
|
74
|
+
readonly surfaceColor: "#ffffff";
|
|
75
|
+
readonly inputBackgroundColor: "#ffffff";
|
|
76
|
+
readonly textColor: "#1f2d3d";
|
|
77
|
+
readonly mutedColor: "#66788a";
|
|
78
|
+
readonly borderColor: "#d9e2ec";
|
|
79
|
+
readonly borderRadius: "8px";
|
|
80
|
+
readonly controlRadius: "6px";
|
|
81
|
+
readonly shadow: "0 2px 8px rgba(31,45,61,.06)";
|
|
82
|
+
readonly dangerColor: "#d4380d";
|
|
83
|
+
readonly successColor: "#389e0d";
|
|
84
|
+
readonly warningColor: "#d48806";
|
|
85
|
+
readonly fontFamily: "Inter, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif";
|
|
86
|
+
};
|
|
68
87
|
};
|
|
69
88
|
declare function resolveMindBillAppearance(appearance: MindBillReactAppearance | undefined): MindBillReactAppearance;
|
|
70
89
|
declare function mindBillAppearanceStyle(appearance: MindBillReactAppearance | undefined, style?: CSSProperties): CSSProperties;
|
|
@@ -341,87 +360,6 @@ type ConnectedBillStatusProps = UseBillStatusOptions & {
|
|
|
341
360
|
};
|
|
342
361
|
declare function ConnectedBillStatus({ actions, appearance, className, style, loadingFallback, errorFallback, ...options }: ConnectedBillStatusProps): ReactElement | null;
|
|
343
362
|
|
|
344
|
-
type BillLifecycleActionId = "edit_and_submit" | "correct_and_resubmit" | "second_review" | "independent_bill_review" | "view_eor" | "post_payment" | "close";
|
|
345
|
-
type BillLifecycleAction = {
|
|
346
|
-
id: BillLifecycleActionId;
|
|
347
|
-
label: string;
|
|
348
|
-
enabled: boolean;
|
|
349
|
-
primary?: boolean;
|
|
350
|
-
reason?: string;
|
|
351
|
-
};
|
|
352
|
-
type BillEorDocument = {
|
|
353
|
-
id: string;
|
|
354
|
-
filename: string;
|
|
355
|
-
description: string | null;
|
|
356
|
-
addedAt: string;
|
|
357
|
-
contentUrl: string;
|
|
358
|
-
};
|
|
359
|
-
type BillLifecycleData = BillReviewData & {
|
|
360
|
-
lifecycle: {
|
|
361
|
-
state: string;
|
|
362
|
-
nativeStatus: string;
|
|
363
|
-
submittedAt?: string | null;
|
|
364
|
-
agingDays?: number | null;
|
|
365
|
-
updatedAt?: string | null;
|
|
366
|
-
actions: BillLifecycleAction[];
|
|
367
|
-
};
|
|
368
|
-
eors: BillEorDocument[];
|
|
369
|
-
};
|
|
370
|
-
type BillLifecycleSession = {
|
|
371
|
-
token: string;
|
|
372
|
-
expiresAt?: string;
|
|
373
|
-
apiBaseUrl?: string;
|
|
374
|
-
};
|
|
375
|
-
type BillLifecycleSessionRequest = {
|
|
376
|
-
billId: string;
|
|
377
|
-
component: "bill-review";
|
|
378
|
-
signal: AbortSignal;
|
|
379
|
-
};
|
|
380
|
-
type BillLifecycleSessionProvider = (request: BillLifecycleSessionRequest) => Promise<BillLifecycleSession>;
|
|
381
|
-
type CloseBillInput = {
|
|
382
|
-
reason: string;
|
|
383
|
-
};
|
|
384
|
-
type PostBillPaymentInput = {
|
|
385
|
-
amount: number;
|
|
386
|
-
method: "check" | "eft";
|
|
387
|
-
checkNumber?: string;
|
|
388
|
-
depositDate: string;
|
|
389
|
-
note?: string;
|
|
390
|
-
};
|
|
391
|
-
type SubmitSecondReviewInput = {
|
|
392
|
-
reason: string;
|
|
393
|
-
payerClaimControlNumber: string;
|
|
394
|
-
disputedAmount: number | undefined;
|
|
395
|
-
attachmentIds: string[];
|
|
396
|
-
route: BillSubmissionRoute;
|
|
397
|
-
};
|
|
398
|
-
type BillLifecycleClientOptions = {
|
|
399
|
-
billId: string;
|
|
400
|
-
/** Same-origin server route that mints a short-lived, bill-scoped session. */
|
|
401
|
-
sessionEndpoint?: string | undefined;
|
|
402
|
-
/** Advanced escape hatch for a custom session exchange. */
|
|
403
|
-
getSession?: BillLifecycleSessionProvider | undefined;
|
|
404
|
-
apiBaseUrl?: string | undefined;
|
|
405
|
-
fetch?: typeof globalThis.fetch | undefined;
|
|
406
|
-
};
|
|
407
|
-
type BillLifecycleClient = {
|
|
408
|
-
getLifecycle: (signal?: AbortSignal) => Promise<BillLifecycleData>;
|
|
409
|
-
searchClaimsAdministrators: (query: string, claimNumber?: string) => Promise<BillReviewPayer[]>;
|
|
410
|
-
saveReview: (input: BillReviewSaveInput) => Promise<BillLifecycleData>;
|
|
411
|
-
submitBill: (input: BillReviewSaveInput, route: BillSubmissionRoute) => Promise<BillLifecycleData>;
|
|
412
|
-
addAttachment: (file: File, documentType: BillReviewDocumentType, description?: string) => Promise<BillLifecycleData>;
|
|
413
|
-
removeAttachment: (attachmentId: string) => Promise<BillLifecycleData>;
|
|
414
|
-
getAttachment: (attachmentId: string) => Promise<Blob>;
|
|
415
|
-
getEor: (documentId: string) => Promise<Blob>;
|
|
416
|
-
closeBill: (input: CloseBillInput) => Promise<BillLifecycleData>;
|
|
417
|
-
postPayment: (input: PostBillPaymentInput) => Promise<BillLifecycleData>;
|
|
418
|
-
submitSecondReview: (input: SubmitSecondReviewInput) => Promise<BillLifecycleData>;
|
|
419
|
-
startCorrection: () => Promise<{
|
|
420
|
-
replacementBillId: string;
|
|
421
|
-
data: BillLifecycleData;
|
|
422
|
-
}>;
|
|
423
|
-
clearSession: () => void;
|
|
424
|
-
};
|
|
425
363
|
type UseBillLifecycleOptions = BillLifecycleClientOptions & {
|
|
426
364
|
refreshInterval?: number;
|
|
427
365
|
enabled?: boolean;
|
|
@@ -448,12 +386,6 @@ type UseBillLifecycleResult = {
|
|
|
448
386
|
submitSecondReview: BillLifecycleClient["submitSecondReview"];
|
|
449
387
|
startCorrection: () => Promise<BillLifecycleData>;
|
|
450
388
|
};
|
|
451
|
-
/**
|
|
452
|
-
* Browser-safe client for the complete bill lifecycle. The only long-lived
|
|
453
|
-
* secret remains on the partner server; this client uses a short-lived,
|
|
454
|
-
* origin-bound session scoped to one bill.
|
|
455
|
-
*/
|
|
456
|
-
declare function createBillLifecycleClient({ billId, sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, }: BillLifecycleClientOptions): BillLifecycleClient;
|
|
457
389
|
declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, initialData, onBillIdChange, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
|
|
458
390
|
type ConnectedBillLifecycleProps = UseBillLifecycleOptions & {
|
|
459
391
|
appearance?: MindBillReactAppearance;
|
|
@@ -478,4 +410,4 @@ type MindBillWidgetProps = {
|
|
|
478
410
|
declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
|
|
479
411
|
declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
|
|
480
412
|
|
|
481
|
-
export { type
|
|
413
|
+
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, mindBillAppearanceStyle, mindBillThemePresets, resolveMindBillAppearance, useBillLifecycle, useBillStatus };
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,23 @@ var mindBillThemePresets = {
|
|
|
55
55
|
successColor: "#16794f",
|
|
56
56
|
warningColor: "#9a5b13",
|
|
57
57
|
fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif"
|
|
58
|
+
},
|
|
59
|
+
"clinical-blue": {
|
|
60
|
+
accentColor: "#1677ff",
|
|
61
|
+
accentTextColor: "#ffffff",
|
|
62
|
+
backgroundColor: "#f5f7fa",
|
|
63
|
+
surfaceColor: "#ffffff",
|
|
64
|
+
inputBackgroundColor: "#ffffff",
|
|
65
|
+
textColor: "#1f2d3d",
|
|
66
|
+
mutedColor: "#66788a",
|
|
67
|
+
borderColor: "#d9e2ec",
|
|
68
|
+
borderRadius: "8px",
|
|
69
|
+
controlRadius: "6px",
|
|
70
|
+
shadow: "0 2px 8px rgba(31,45,61,.06)",
|
|
71
|
+
dangerColor: "#d4380d",
|
|
72
|
+
successColor: "#389e0d",
|
|
73
|
+
warningColor: "#d48806",
|
|
74
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
|
|
58
75
|
}
|
|
59
76
|
};
|
|
60
77
|
function resolveMindBillAppearance(appearance) {
|
|
@@ -1170,294 +1187,14 @@ import {
|
|
|
1170
1187
|
useRef as useRef3,
|
|
1171
1188
|
useState as useState3
|
|
1172
1189
|
} from "react";
|
|
1190
|
+
import {
|
|
1191
|
+
DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
|
|
1192
|
+
DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
|
|
1193
|
+
createBillLifecycleClient
|
|
1194
|
+
} from "@mindbill/browser";
|
|
1195
|
+
import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
|
|
1173
1196
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1174
|
-
var DEFAULT_API_BASE_URL2 = "https://app.mindbill.org";
|
|
1175
|
-
var DEFAULT_SESSION_ENDPOINT2 = "/api/mindbill/bill-session";
|
|
1176
1197
|
var DEFAULT_REFRESH_INTERVAL2 = 6e4;
|
|
1177
|
-
async function responseError2(response, fallback) {
|
|
1178
|
-
const body = await response.json().catch(() => null);
|
|
1179
|
-
const detail = body && typeof body === "object" ? body.detail ?? body.message ?? body.error : null;
|
|
1180
|
-
return new Error(typeof detail === "string" ? detail : fallback);
|
|
1181
|
-
}
|
|
1182
|
-
function isSessionFresh2(session) {
|
|
1183
|
-
if (!session) return false;
|
|
1184
|
-
if (!session.expiresAt) return true;
|
|
1185
|
-
const expiresAt = new Date(session.expiresAt).getTime();
|
|
1186
|
-
return Number.isFinite(expiresAt) && expiresAt > Date.now() + 3e4;
|
|
1187
|
-
}
|
|
1188
|
-
function normalizeSession2(value) {
|
|
1189
|
-
if (!value || typeof value !== "object") {
|
|
1190
|
-
throw new Error("The billing session endpoint returned an invalid response.");
|
|
1191
|
-
}
|
|
1192
|
-
const candidate = value;
|
|
1193
|
-
const nested = candidate.session ?? candidate.data;
|
|
1194
|
-
const session = nested && typeof nested === "object" ? nested : candidate;
|
|
1195
|
-
if (typeof session.token !== "string" || session.token.length < 8) {
|
|
1196
|
-
throw new Error(
|
|
1197
|
-
"The billing session endpoint did not return a browser session token."
|
|
1198
|
-
);
|
|
1199
|
-
}
|
|
1200
|
-
return {
|
|
1201
|
-
token: session.token,
|
|
1202
|
-
...typeof session.expiresAt === "string" ? { expiresAt: session.expiresAt } : {},
|
|
1203
|
-
...typeof session.apiBaseUrl === "string" ? { apiBaseUrl: session.apiBaseUrl } : {}
|
|
1204
|
-
};
|
|
1205
|
-
}
|
|
1206
|
-
function normalizeLifecycle(value) {
|
|
1207
|
-
if (!value || typeof value !== "object") {
|
|
1208
|
-
throw new Error("The billing service returned an invalid bill lifecycle.");
|
|
1209
|
-
}
|
|
1210
|
-
const data = value;
|
|
1211
|
-
if (!data.bill || !data.patient || !data.injury || !data.lifecycle || !Array.isArray(data.lifecycle.actions) || !Array.isArray(data.eors)) {
|
|
1212
|
-
throw new Error("The billing service returned an invalid bill lifecycle.");
|
|
1213
|
-
}
|
|
1214
|
-
return data;
|
|
1215
|
-
}
|
|
1216
|
-
function idempotencyKey() {
|
|
1217
|
-
if (typeof globalThis.crypto?.randomUUID === "function") {
|
|
1218
|
-
return globalThis.crypto.randomUUID();
|
|
1219
|
-
}
|
|
1220
|
-
return `mb-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1221
|
-
}
|
|
1222
|
-
function createBillLifecycleClient({
|
|
1223
|
-
billId,
|
|
1224
|
-
sessionEndpoint = DEFAULT_SESSION_ENDPOINT2,
|
|
1225
|
-
getSession,
|
|
1226
|
-
apiBaseUrl = DEFAULT_API_BASE_URL2,
|
|
1227
|
-
fetch: fetchOverride
|
|
1228
|
-
}) {
|
|
1229
|
-
const fetcher = fetchOverride ?? globalThis.fetch;
|
|
1230
|
-
if (typeof fetcher !== "function") {
|
|
1231
|
-
throw new Error("A Fetch API implementation is required.");
|
|
1232
|
-
}
|
|
1233
|
-
let session = null;
|
|
1234
|
-
let sessionRequest = null;
|
|
1235
|
-
const mintSession = async (signal, force = false) => {
|
|
1236
|
-
if (!force && isSessionFresh2(session)) return session;
|
|
1237
|
-
if (!force && sessionRequest) return sessionRequest;
|
|
1238
|
-
const pending = getSession ? getSession({ billId, component: "bill-review", signal }) : fetcher(sessionEndpoint, {
|
|
1239
|
-
method: "POST",
|
|
1240
|
-
credentials: "same-origin",
|
|
1241
|
-
headers: { "content-type": "application/json" },
|
|
1242
|
-
body: JSON.stringify({ billId, component: "bill-review" }),
|
|
1243
|
-
signal
|
|
1244
|
-
}).then(async (response) => {
|
|
1245
|
-
if (!response.ok) {
|
|
1246
|
-
throw await responseError2(
|
|
1247
|
-
response,
|
|
1248
|
-
"The billing session could not be created."
|
|
1249
|
-
);
|
|
1250
|
-
}
|
|
1251
|
-
return response.json();
|
|
1252
|
-
});
|
|
1253
|
-
const request2 = Promise.resolve(pending).then(normalizeSession2).then((nextSession) => {
|
|
1254
|
-
session = nextSession;
|
|
1255
|
-
return nextSession;
|
|
1256
|
-
}).finally(() => {
|
|
1257
|
-
if (sessionRequest === request2) sessionRequest = null;
|
|
1258
|
-
});
|
|
1259
|
-
sessionRequest = request2;
|
|
1260
|
-
return request2;
|
|
1261
|
-
};
|
|
1262
|
-
const request = async (path, init = {}, providedSignal) => {
|
|
1263
|
-
const controller = providedSignal ? null : new AbortController();
|
|
1264
|
-
const signal = providedSignal ?? controller?.signal;
|
|
1265
|
-
if (!signal) throw new Error("An AbortSignal could not be created.");
|
|
1266
|
-
let browserSession = await mintSession(signal);
|
|
1267
|
-
const perform = (current) => {
|
|
1268
|
-
const base = (current.apiBaseUrl ?? apiBaseUrl).replace(/\/$/, "");
|
|
1269
|
-
const headers = new Headers(init.headers);
|
|
1270
|
-
headers.set("authorization", `Bearer ${current.token}`);
|
|
1271
|
-
return fetcher(`${base}${path}`, { ...init, headers, signal });
|
|
1272
|
-
};
|
|
1273
|
-
let response = await perform(browserSession);
|
|
1274
|
-
if (response.status === 401) {
|
|
1275
|
-
session = null;
|
|
1276
|
-
browserSession = await mintSession(signal, true);
|
|
1277
|
-
response = await perform(browserSession);
|
|
1278
|
-
}
|
|
1279
|
-
return response;
|
|
1280
|
-
};
|
|
1281
|
-
const loadLifecycle = async (signal) => {
|
|
1282
|
-
const response = await request("/partner/v2/browser/bill", {}, signal);
|
|
1283
|
-
if (!response.ok) {
|
|
1284
|
-
throw await responseError2(response, "Bill lifecycle could not be loaded.");
|
|
1285
|
-
}
|
|
1286
|
-
const body = await response.json();
|
|
1287
|
-
return normalizeLifecycle(body.data);
|
|
1288
|
-
};
|
|
1289
|
-
const searchClaimsAdministrators = async (query, claimNumber) => {
|
|
1290
|
-
const params = new URLSearchParams();
|
|
1291
|
-
if (query.trim()) params.set("q", query.trim());
|
|
1292
|
-
if (claimNumber?.trim()) params.set("claimNumber", claimNumber.trim());
|
|
1293
|
-
const response = await request(
|
|
1294
|
-
`/partner/v2/browser/claims-administrators?${params.toString()}`
|
|
1295
|
-
);
|
|
1296
|
-
if (!response.ok) {
|
|
1297
|
-
throw await responseError2(
|
|
1298
|
-
response,
|
|
1299
|
-
"Claims administrator search is unavailable."
|
|
1300
|
-
);
|
|
1301
|
-
}
|
|
1302
|
-
const body = await response.json();
|
|
1303
|
-
if (!Array.isArray(body.results)) {
|
|
1304
|
-
throw new Error("Claims administrator search returned an invalid response.");
|
|
1305
|
-
}
|
|
1306
|
-
return body.results.flatMap((value) => {
|
|
1307
|
-
if (!value || typeof value !== "object") return [];
|
|
1308
|
-
const payer = value;
|
|
1309
|
-
if (typeof payer.id !== "string" || typeof payer.name !== "string") {
|
|
1310
|
-
return [];
|
|
1311
|
-
}
|
|
1312
|
-
return [{
|
|
1313
|
-
id: payer.id,
|
|
1314
|
-
name: payer.name,
|
|
1315
|
-
...typeof payer.hasElectronic === "boolean" ? { hasElectronic: payer.hasElectronic } : {},
|
|
1316
|
-
...Array.isArray(payer.states) ? { states: payer.states.filter((state) => typeof state === "string") } : {},
|
|
1317
|
-
...["high", "medium", "directory"].includes(payer.confidence ?? "") ? {
|
|
1318
|
-
confidence: payer.confidence
|
|
1319
|
-
} : {},
|
|
1320
|
-
...typeof payer.recommended === "boolean" ? { recommended: payer.recommended } : {},
|
|
1321
|
-
...Array.isArray(payer.signals) ? {
|
|
1322
|
-
signals: payer.signals.flatMap((signal) => {
|
|
1323
|
-
if (!signal || typeof signal !== "object") return [];
|
|
1324
|
-
const candidate = signal;
|
|
1325
|
-
if (!["name", "claim_number"].includes(String(candidate.kind)) || !["match", "warning"].includes(String(candidate.state)) || typeof candidate.label !== "string") return [];
|
|
1326
|
-
return [{
|
|
1327
|
-
kind: candidate.kind,
|
|
1328
|
-
state: candidate.state,
|
|
1329
|
-
label: candidate.label
|
|
1330
|
-
}];
|
|
1331
|
-
})
|
|
1332
|
-
} : {}
|
|
1333
|
-
}];
|
|
1334
|
-
});
|
|
1335
|
-
};
|
|
1336
|
-
const mutation = async (path, init, fallback) => {
|
|
1337
|
-
const headers = new Headers(init.headers);
|
|
1338
|
-
headers.set("idempotency-key", idempotencyKey());
|
|
1339
|
-
const response = await request(path, { ...init, headers });
|
|
1340
|
-
if (!response.ok) throw await responseError2(response, fallback);
|
|
1341
|
-
return response;
|
|
1342
|
-
};
|
|
1343
|
-
const action = async (input, fallback) => {
|
|
1344
|
-
const response = await mutation(
|
|
1345
|
-
"/partner/v2/browser/actions",
|
|
1346
|
-
{
|
|
1347
|
-
method: "POST",
|
|
1348
|
-
headers: { "content-type": "application/json" },
|
|
1349
|
-
body: JSON.stringify(input)
|
|
1350
|
-
},
|
|
1351
|
-
fallback
|
|
1352
|
-
);
|
|
1353
|
-
const body = await response.json();
|
|
1354
|
-
return normalizeLifecycle(body.data);
|
|
1355
|
-
};
|
|
1356
|
-
const saveReview = async (input) => {
|
|
1357
|
-
await mutation(
|
|
1358
|
-
"/partner/v2/browser/bill",
|
|
1359
|
-
{
|
|
1360
|
-
method: "PATCH",
|
|
1361
|
-
headers: { "content-type": "application/json" },
|
|
1362
|
-
body: JSON.stringify(input)
|
|
1363
|
-
},
|
|
1364
|
-
"Bill changes could not be saved."
|
|
1365
|
-
);
|
|
1366
|
-
return loadLifecycle();
|
|
1367
|
-
};
|
|
1368
|
-
return {
|
|
1369
|
-
clearSession() {
|
|
1370
|
-
session = null;
|
|
1371
|
-
sessionRequest = null;
|
|
1372
|
-
},
|
|
1373
|
-
getLifecycle: loadLifecycle,
|
|
1374
|
-
searchClaimsAdministrators,
|
|
1375
|
-
saveReview,
|
|
1376
|
-
async submitBill(input, route) {
|
|
1377
|
-
await saveReview(input);
|
|
1378
|
-
await mutation(
|
|
1379
|
-
"/partner/v2/browser/submissions",
|
|
1380
|
-
{
|
|
1381
|
-
method: "POST",
|
|
1382
|
-
headers: { "content-type": "application/json" },
|
|
1383
|
-
body: JSON.stringify({ route })
|
|
1384
|
-
},
|
|
1385
|
-
"Bill could not be submitted."
|
|
1386
|
-
);
|
|
1387
|
-
return loadLifecycle();
|
|
1388
|
-
},
|
|
1389
|
-
async addAttachment(file, documentType, description) {
|
|
1390
|
-
const body = new FormData();
|
|
1391
|
-
body.set("file", file);
|
|
1392
|
-
body.set("documentType", documentType);
|
|
1393
|
-
if (description) body.set("description", description);
|
|
1394
|
-
await mutation(
|
|
1395
|
-
"/partner/v2/browser/documents",
|
|
1396
|
-
{ method: "POST", body },
|
|
1397
|
-
"Document could not be attached."
|
|
1398
|
-
);
|
|
1399
|
-
return loadLifecycle();
|
|
1400
|
-
},
|
|
1401
|
-
async removeAttachment(attachmentId) {
|
|
1402
|
-
await mutation(
|
|
1403
|
-
`/partner/v2/browser/documents/${encodeURIComponent(attachmentId)}`,
|
|
1404
|
-
{ method: "DELETE" },
|
|
1405
|
-
"Document could not be removed."
|
|
1406
|
-
);
|
|
1407
|
-
return loadLifecycle();
|
|
1408
|
-
},
|
|
1409
|
-
async getAttachment(attachmentId) {
|
|
1410
|
-
const response = await request(
|
|
1411
|
-
`/partner/v2/browser/documents/${encodeURIComponent(attachmentId)}`
|
|
1412
|
-
);
|
|
1413
|
-
if (!response.ok) {
|
|
1414
|
-
throw await responseError2(response, "Document could not be opened.");
|
|
1415
|
-
}
|
|
1416
|
-
return response.blob();
|
|
1417
|
-
},
|
|
1418
|
-
async getEor(documentId) {
|
|
1419
|
-
const response = await request(
|
|
1420
|
-
`/partner/v2/browser/eors/${encodeURIComponent(documentId)}`
|
|
1421
|
-
);
|
|
1422
|
-
if (!response.ok) throw await responseError2(response, "EOR could not be opened.");
|
|
1423
|
-
return response.blob();
|
|
1424
|
-
},
|
|
1425
|
-
closeBill(input) {
|
|
1426
|
-
return action({ action: "close", ...input }, "Bill could not be closed.");
|
|
1427
|
-
},
|
|
1428
|
-
postPayment(input) {
|
|
1429
|
-
return action(
|
|
1430
|
-
{ action: "post_payment", ...input, checkNumber: input.checkNumber ?? "" },
|
|
1431
|
-
"Payment could not be posted."
|
|
1432
|
-
);
|
|
1433
|
-
},
|
|
1434
|
-
submitSecondReview(input) {
|
|
1435
|
-
return action(
|
|
1436
|
-
{ action: "second_review", ...input },
|
|
1437
|
-
"Second Review could not be submitted."
|
|
1438
|
-
);
|
|
1439
|
-
},
|
|
1440
|
-
async startCorrection() {
|
|
1441
|
-
const response = await mutation(
|
|
1442
|
-
"/partner/v2/browser/actions",
|
|
1443
|
-
{
|
|
1444
|
-
method: "POST",
|
|
1445
|
-
headers: { "content-type": "application/json" },
|
|
1446
|
-
body: JSON.stringify({ action: "start_correction" })
|
|
1447
|
-
},
|
|
1448
|
-
"Correction draft could not be created."
|
|
1449
|
-
);
|
|
1450
|
-
const body = await response.json();
|
|
1451
|
-
if (typeof body.replacementBillId !== "string") {
|
|
1452
|
-
throw new Error("The billing service did not return the correction bill ID.");
|
|
1453
|
-
}
|
|
1454
|
-
return {
|
|
1455
|
-
replacementBillId: body.replacementBillId,
|
|
1456
|
-
data: normalizeLifecycle(body.data)
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
};
|
|
1460
|
-
}
|
|
1461
1198
|
function openPdf(blob, filename) {
|
|
1462
1199
|
const url = URL.createObjectURL(blob);
|
|
1463
1200
|
const link = document.createElement("a");
|
|
@@ -2003,7 +1740,7 @@ export {
|
|
|
2003
1740
|
MindBillBillReview,
|
|
2004
1741
|
MindBillBillTimeline,
|
|
2005
1742
|
buildBillReviewSaveInput,
|
|
2006
|
-
createBillLifecycleClient,
|
|
1743
|
+
createBillLifecycleClient2 as createBillLifecycleClient,
|
|
2007
1744
|
createBillStatusClient,
|
|
2008
1745
|
mindBillAppearanceStyle,
|
|
2009
1746
|
mindBillThemePresets,
|