@mindbill/react 0.8.0 → 0.9.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/dist/index.d.ts CHANGED
@@ -227,6 +227,125 @@ type ConnectedBillStatusProps = UseBillStatusOptions & {
227
227
  };
228
228
  declare function ConnectedBillStatus({ actions, appearance, className, style, loadingFallback, errorFallback, ...options }: ConnectedBillStatusProps): ReactElement | null;
229
229
 
230
+ type BillLifecycleActionId = "edit_and_submit" | "correct_and_resubmit" | "second_review" | "independent_bill_review" | "view_eor" | "post_payment" | "close";
231
+ type BillLifecycleAction = {
232
+ id: BillLifecycleActionId;
233
+ label: string;
234
+ enabled: boolean;
235
+ primary?: boolean;
236
+ reason?: string;
237
+ };
238
+ type BillEorDocument = {
239
+ id: string;
240
+ filename: string;
241
+ description: string | null;
242
+ addedAt: string;
243
+ contentUrl: string;
244
+ };
245
+ type BillLifecycleData = BillReviewData & {
246
+ lifecycle: {
247
+ state: string;
248
+ nativeStatus: string;
249
+ actions: BillLifecycleAction[];
250
+ };
251
+ eors: BillEorDocument[];
252
+ };
253
+ type BillLifecycleSession = {
254
+ token: string;
255
+ expiresAt?: string;
256
+ apiBaseUrl?: string;
257
+ };
258
+ type BillLifecycleSessionRequest = {
259
+ billId: string;
260
+ component: "bill-review";
261
+ signal: AbortSignal;
262
+ };
263
+ type BillLifecycleSessionProvider = (request: BillLifecycleSessionRequest) => Promise<BillLifecycleSession>;
264
+ type CloseBillInput = {
265
+ reason: string;
266
+ };
267
+ type PostBillPaymentInput = {
268
+ amount: number;
269
+ method: "check" | "eft";
270
+ checkNumber?: string;
271
+ depositDate: string;
272
+ note?: string;
273
+ };
274
+ type SubmitSecondReviewInput = {
275
+ reason: string;
276
+ payerClaimControlNumber: string;
277
+ disputedAmount: number | undefined;
278
+ attachmentIds: string[];
279
+ route: BillSubmissionRoute;
280
+ };
281
+ type BillLifecycleClientOptions = {
282
+ billId: string;
283
+ /** Same-origin server route that mints a short-lived, bill-scoped session. */
284
+ sessionEndpoint?: string | undefined;
285
+ /** Advanced escape hatch for a custom session exchange. */
286
+ getSession?: BillLifecycleSessionProvider | undefined;
287
+ apiBaseUrl?: string | undefined;
288
+ fetch?: typeof globalThis.fetch | undefined;
289
+ };
290
+ type BillLifecycleClient = {
291
+ getLifecycle: (signal?: AbortSignal) => Promise<BillLifecycleData>;
292
+ saveReview: (input: BillReviewSaveInput) => Promise<BillLifecycleData>;
293
+ submitBill: (input: BillReviewSaveInput, route: BillSubmissionRoute) => Promise<BillLifecycleData>;
294
+ addAttachment: (file: File, documentType: BillReviewDocumentType, description?: string) => Promise<BillLifecycleData>;
295
+ removeAttachment: (attachmentId: string) => Promise<BillLifecycleData>;
296
+ getAttachment: (attachmentId: string) => Promise<Blob>;
297
+ getEor: (documentId: string) => Promise<Blob>;
298
+ closeBill: (input: CloseBillInput) => Promise<BillLifecycleData>;
299
+ postPayment: (input: PostBillPaymentInput) => Promise<BillLifecycleData>;
300
+ submitSecondReview: (input: SubmitSecondReviewInput) => Promise<BillLifecycleData>;
301
+ startCorrection: () => Promise<{
302
+ replacementBillId: string;
303
+ data: BillLifecycleData;
304
+ }>;
305
+ clearSession: () => void;
306
+ };
307
+ type UseBillLifecycleOptions = BillLifecycleClientOptions & {
308
+ refreshInterval?: number;
309
+ enabled?: boolean;
310
+ initialData?: BillLifecycleData | null;
311
+ onBillIdChange?: (billId: string, previousBillId: string) => void | Promise<void>;
312
+ };
313
+ type UseBillLifecycleResult = {
314
+ billId: string;
315
+ data: BillLifecycleData | null;
316
+ error: Error | null;
317
+ isLoading: boolean;
318
+ isRefreshing: boolean;
319
+ isMutating: boolean;
320
+ refresh: () => Promise<void>;
321
+ saveReview: BillLifecycleClient["saveReview"];
322
+ submitBill: BillLifecycleClient["submitBill"];
323
+ addAttachment: BillLifecycleClient["addAttachment"];
324
+ removeAttachment: BillLifecycleClient["removeAttachment"];
325
+ openAttachment: (attachment: BillReviewAttachment) => Promise<void>;
326
+ openEor: (document: BillEorDocument) => Promise<void>;
327
+ closeBill: BillLifecycleClient["closeBill"];
328
+ postPayment: BillLifecycleClient["postPayment"];
329
+ submitSecondReview: BillLifecycleClient["submitSecondReview"];
330
+ startCorrection: () => Promise<BillLifecycleData>;
331
+ };
332
+ /**
333
+ * Browser-safe client for the complete bill lifecycle. The only long-lived
334
+ * secret remains on the partner server; this client uses a short-lived,
335
+ * origin-bound session scoped to one bill.
336
+ */
337
+ declare function createBillLifecycleClient({ billId, sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOverride, }: BillLifecycleClientOptions): BillLifecycleClient;
338
+ declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, initialData, onBillIdChange, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
339
+ type ConnectedBillLifecycleProps = UseBillLifecycleOptions & {
340
+ appearance?: MindBillAppearance;
341
+ className?: string;
342
+ style?: CSSProperties;
343
+ loadingFallback?: ReactNode;
344
+ errorFallback?: (error: Error, retry: () => Promise<void>) => ReactNode;
345
+ onChanged?: (data: BillLifecycleData) => void;
346
+ };
347
+ declare function ConnectedBillLifecycle({ appearance, className, style, loadingFallback, errorFallback, onChanged, ...options }: ConnectedBillLifecycleProps): ReactElement;
348
+
230
349
  type MindBillWidgetProps = {
231
350
  sessionToken: string;
232
351
  embedUrl: string;
@@ -247,4 +366,4 @@ declare const HostedBillFromReport: typeof MindBillBillFromReport;
247
366
  declare const HostedCollections: typeof MindBillCollections;
248
367
  declare const HostedOnboarding: typeof MindBillOnboarding;
249
368
 
250
- export { type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewSaveInput, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, type BillSubmissionRoute, ConnectedBillStatus, type ConnectedBillStatusProps, HostedBillFromReport, HostedBillReview, HostedBillTimeline, HostedCollections, HostedOnboarding, MindBillBillFromReport, MindBillBillReview, MindBillBillTimeline, MindBillCollections, MindBillOnboarding, type MindBillWidgetProps, type UseBillStatusOptions, type UseBillStatusResult, buildBillReviewSaveInput, createBillStatusClient, useBillStatus };
369
+ 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, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, 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, HostedBillFromReport, HostedBillReview, HostedBillTimeline, HostedCollections, HostedOnboarding, MindBillBillFromReport, MindBillBillReview, MindBillBillTimeline, MindBillCollections, MindBillOnboarding, type MindBillWidgetProps, type PostBillPaymentInput, type SubmitSecondReviewInput, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, buildBillReviewSaveInput, createBillLifecycleClient, createBillStatusClient, useBillLifecycle, useBillStatus };