@mindbill/react 0.23.2 → 0.25.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 CHANGED
@@ -152,15 +152,17 @@ The component includes the interaction model, not just the markup:
152
152
  - paste-friendly `MM/DD/YYYY` date fields and required-field asterisks;
153
153
  - ZIP-to-city/state completion through MindBill's authenticated postal directory;
154
154
  - complete, server-backed ICD-10 search with an alphabetized 100-code first page, automatic 100-code scroll paging, common-injury quick picks, and removable chips;
155
- - canonical claims-administrator search through the authenticated MindBill payer directory;
155
+ - canonical claims-administrator matching through the authenticated MindBill payer directory: exact aliases select automatically, while fuzzy matches show up to five explicit suggestions with claim-number pattern evidence;
156
156
  - QME, AME, and Psych QME evaluation modes with medical-legal modifier defaults; Psych QME also seeds `Z04.6` when no more specific diagnosis was supplied, and exposes it as a Psych quick pick;
157
157
  - searchable workers-comp procedure/modifier controls, medical-legal fee-schedule amounts, totals, valid manual CPT/HCPCS entry, and an automatically maintained empty line;
158
- - removable source documents with new-tab previews, a locked auto-attached practice W-9, and a full-width click, panel-drop, or whole-page PDF upload area. Every visible source document is included until removed; uploaded PDFs do not require document-type tagging.
158
+ - removable source documents with new-tab previews, a locked auto-attached practice W-9, and a full-width click, panel-drop, or whole-page PDF upload area. Med-legal mode assigns every document to `J4 - Med-Legal Report` without showing another control; professional mode shows the complete searchable PWK01 report-type directory. Override that presentation with `attachmentReportTypeMode`, `attachmentReportTypes`, and `defaultAttachmentReportType`.
159
159
 
160
160
  Partners supply tenant-specific bootstrap data, one short-lived browser session callback, and optionally an `onSubmitted` callback to persist the returned `billId`. Required fields, validation, ZIP lookup, ICD-10 and payer directories, service-line behavior, PDF encoding, wire-format serialization, atomic submission, attachments, and submission UX stay inside `@mindbill/react`, so every integration receives the same billing workflow. Optional `diagnosisOptions`, `procedureOptions`, `modifierOptions`, and lookup callbacks extend or replace defaults when a partner has licensed or organization-specific data.
161
161
 
162
162
  Validation is component-owned as well. A missing routing payer is highlighted immediately; Submit highlights every invalid control with a specific message, focuses and scrolls to the first problem, and continues validating as the user corrects the form.
163
163
 
164
+ The complete immutable snapshot requires patient identity and address; employer, injury date, service date, and a canonical claims-administrator directory selection; at least one ICD-10 diagnosis and procedure line; billing provider name, Tax ID, NPI, phone, and address; rendering provider name, NPI, and taxonomy; and service-facility address plus place-of-service code. Address line 2 and physician license metadata remain optional. For California workers-comp CMS-1500 output, `renderingProvider.taxonomy` is the 10-character provider taxonomy placed in shaded Box 24J with qualifier `ZZ`; it is not replaced by the physician license number.
165
+
164
166
  `BILL_SUBMISSION_REQUIRED_FIELDS` and `validateBillSubmission` expose the same contract for tests and non-visual integrations. The component never creates a draft; `onSubmitted` fires only after MindBill accepts a locally valid immutable snapshot. The legacy `onSubmit` escape hatch remains optional for unusual deployments, but connected integrations should omit it so the library owns the complete contract.
165
167
 
166
168
  `BillReviewForm` remains available for legacy integrations that already own a custom review model. New integrations should use `BillSubmissionForm`.
package/dist/index.d.ts CHANGED
@@ -357,9 +357,17 @@ declare function BillReadOnlyForm({ data, appearance, className, style, onOpenAt
357
357
 
358
358
  declare const BILL_SUBMISSION_DOCUMENT_TYPES: readonly ["final_report", "proof_of_service", "letter_of_attestation", "form_122", "return_to_work_voucher", "w9", "medical_records", "appeal", "other"];
359
359
  type BillSubmissionDocumentType = (typeof BILL_SUBMISSION_DOCUMENT_TYPES)[number];
360
+ type BillSubmissionAttachmentReportTypeMode = "auto" | "hidden" | "visible";
361
+ type BillSubmissionReportTypeOption = {
362
+ code: string;
363
+ label: string;
364
+ };
365
+ declare const MED_LEGAL_REPORT_TYPE_CODE = "OZ:J4";
366
+ declare const BILL_SUBMISSION_REPORT_TYPES: readonly BillSubmissionReportTypeOption[];
360
367
  type BillSubmissionEvaluationType = "qme" | "ame" | "psych_qme";
361
368
  type BillSubmissionAddress = {
362
369
  line1: string;
370
+ line2?: string;
363
371
  city: string;
364
372
  state: string;
365
373
  postalCode: string;
@@ -448,6 +456,36 @@ type BillSubmissionInput = {
448
456
  diagnosisPointers?: number[];
449
457
  }>;
450
458
  };
459
+ /** A validated, submission-ready bill. The form accepts partial provider data while editing,
460
+ * but only emits this complete contract after every required field has passed validation. */
461
+ type CompleteBillSubmissionInput = Omit<BillSubmissionInput, "claim" | "billingProvider" | "renderingProvider" | "serviceLocation" | "diagnoses" | "serviceLines"> & {
462
+ claim: BillSubmissionInput["claim"] & {
463
+ employer: string;
464
+ dateOfInjury: string;
465
+ claimsAdministrator: {
466
+ id: string;
467
+ name: string;
468
+ };
469
+ };
470
+ billingProvider: {
471
+ name: string;
472
+ taxId: string;
473
+ npi: string;
474
+ phone: string;
475
+ address: BillSubmissionAddress;
476
+ };
477
+ renderingProvider: NonNullable<BillSubmissionInput["renderingProvider"]> & {
478
+ name: string;
479
+ npi: string;
480
+ taxonomy: string;
481
+ };
482
+ serviceLocation: NonNullable<BillSubmissionInput["serviceLocation"]> & {
483
+ address: BillSubmissionAddress;
484
+ placeOfServiceCode: string;
485
+ };
486
+ diagnoses: string[];
487
+ serviceLines: BillSubmissionInput["serviceLines"];
488
+ };
451
489
  type BillSubmissionSourceAttachment = {
452
490
  id: string;
453
491
  fileName: string;
@@ -459,15 +497,18 @@ type BillSubmissionSourceAttachment = {
459
497
  autoAttached?: boolean;
460
498
  removable?: boolean;
461
499
  previewUrl?: string;
500
+ reportTypeCode?: string;
462
501
  };
463
502
  type BillSubmissionUpload = {
464
503
  file: File;
465
504
  documentType: BillSubmissionDocumentType;
466
505
  description?: string;
506
+ reportTypeCode?: string;
467
507
  };
468
508
  type BillSubmissionFormValue = {
469
- bill: BillSubmissionInput;
509
+ bill: CompleteBillSubmissionInput;
470
510
  sourceAttachmentIds: string[];
511
+ sourceAttachmentReportTypes: Record<string, string>;
471
512
  uploads: BillSubmissionUpload[];
472
513
  };
473
514
  type BillSubmissionFormProps = {
@@ -491,6 +532,10 @@ type BillSubmissionFormProps = {
491
532
  onLookupPostalCode?: (postalCode: string) => Promise<BillSubmissionPostalPlace | null>;
492
533
  procedureOptions?: BillSubmissionProcedureOption[];
493
534
  modifierOptions?: BillSubmissionModifierOption[];
535
+ /** Auto hides and forces J4 for med-legal bills; treatment bills show the full report-type directory. */
536
+ attachmentReportTypeMode?: BillSubmissionAttachmentReportTypeMode;
537
+ attachmentReportTypes?: readonly BillSubmissionReportTypeOption[];
538
+ defaultAttachmentReportType?: string;
494
539
  appearance?: MindBillReactAppearance;
495
540
  className?: string;
496
541
  style?: CSSProperties;
@@ -504,15 +549,17 @@ type BillSubmissionFormProps = {
504
549
  */
505
550
  children?: ReactNode;
506
551
  };
507
- declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.dateOfBirth", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "claim.claimsAdministrator", "service.date", "diagnoses[]", "serviceLines[].code", "serviceLines[].units"];
552
+ declare const BILL_SUBMISSION_REQUIRED_FIELDS: readonly ["patient.firstName", "patient.lastName", "patient.dateOfBirth", "patient.address.line1", "patient.address.city", "patient.address.state", "patient.address.postalCode", "claim.claimNumber", "claim.employer", "claim.dateOfInjury", "claim.claimsAdministrator", "service.date", "billingProvider.name", "billingProvider.taxId", "billingProvider.npi", "billingProvider.phone", "billingProvider.address.line1", "billingProvider.address.city", "billingProvider.address.state", "billingProvider.address.postalCode", "renderingProvider.name", "renderingProvider.npi", "renderingProvider.taxonomy", "serviceLocation.placeOfServiceCode", "serviceLocation.address.line1", "serviceLocation.address.city", "serviceLocation.address.state", "serviceLocation.address.postalCode", "diagnoses[]", "serviceLines[].code", "serviceLines[].units"];
508
553
  type BillSubmissionValidation = {
509
554
  valid: boolean;
510
555
  fieldErrors: Record<string, string>;
511
556
  };
512
- declare function prepareBillSubmissionDocuments({ attachments, selectedIds, uploads, fetch: fetchOverride, }: {
557
+ declare function prepareBillSubmissionDocuments({ attachments, selectedIds, uploads, reportTypeCodeByAttachmentId, defaultReportTypeCode, fetch: fetchOverride, }: {
513
558
  attachments: BillSubmissionSourceAttachment[];
514
559
  selectedIds: string[];
515
560
  uploads: BillSubmissionUpload[];
561
+ reportTypeCodeByAttachmentId?: Record<string, string>;
562
+ defaultReportTypeCode?: string;
516
563
  fetch?: typeof globalThis.fetch;
517
564
  }): Promise<BrowserBillSubmissionDocument[]>;
518
565
  declare function ensureTrailingBillSubmissionLine(lines: BillSubmissionInput["serviceLines"]): BillSubmissionInput["serviceLines"];
@@ -523,6 +570,9 @@ declare const PSYCH_QME_DEFAULT_DIAGNOSIS = "Z04.6";
523
570
  /** Seed Psych QME's general examination code only when no diagnosis was supplied. */
524
571
  declare function applyBillSubmissionEvaluationDiagnoses(diagnoses: string[] | undefined, type: BillSubmissionEvaluationType): string[];
525
572
  declare function validateBillSubmission(bill: BillSubmissionInput): BillSubmissionValidation;
573
+ declare function normalizeClaimsAdministratorName(value: string): string;
574
+ declare function exactClaimsAdministratorMatch(results: BillReviewPayer$1[], suppliedName: string): BillReviewPayer$1 | undefined;
575
+ declare function claimsAdministratorRecommendations(results: BillReviewPayer$1[], limit?: number): BillReviewPayer$1[];
526
576
  type BillSubmissionSectionId = "header" | "patient" | "claim" | "providers" | "serviceLines" | "attachments" | "actions";
527
577
  declare function BillSubmissionHeader(): ReactElement;
528
578
  declare function BillSubmissionPatientSection(): ReactElement;
@@ -531,7 +581,7 @@ declare function BillSubmissionProvidersSection(): ReactElement;
531
581
  declare function BillSubmissionServiceLinesSection(): ReactElement;
532
582
  declare function BillSubmissionAttachmentsSection(): ReactElement;
533
583
  declare function BillSubmissionActions(): ReactElement;
534
- declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, appearance, className, style, disabled, submitLabel, heading, description, children, }: BillSubmissionFormProps): ReactElement;
584
+ declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, attachmentReportTypeMode, attachmentReportTypes, defaultAttachmentReportType, appearance, className, style, disabled, submitLabel, heading, description, children, }: BillSubmissionFormProps): ReactElement;
535
585
 
536
586
  /** Public-domain and MindBill-owned metadata. CPT descriptions are intentionally limited to the curated catalog. */
537
587
  declare const DEFAULT_BILL_SUBMISSION_PROCEDURES: BillSubmissionProcedureOption[];
@@ -793,4 +843,4 @@ type MindBillWidgetProps = {
793
843
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
794
844
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
795
845
 
796
- export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRemittanceCard, type BillRemittanceCardProps, 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, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, BillSubmissionAttachmentsSection, BillSubmissionClaimSection, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, BillSubmissionHeader, type BillSubmissionInput, type BillSubmissionModifierOption, BillSubmissionPatientSection, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, BillSubmissionProvidersSection, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, PSYCH_QME_DEFAULT_DIAGNOSIS, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationDiagnoses, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, buildBillReviewSaveInput, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
846
+ export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REPORT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRemittanceCard, type BillRemittanceCardProps, 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, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, type BillSubmissionAttachmentReportTypeMode, BillSubmissionAttachmentsSection, BillSubmissionClaimSection, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, BillSubmissionHeader, type BillSubmissionInput, type BillSubmissionModifierOption, BillSubmissionPatientSection, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, BillSubmissionProvidersSection, type BillSubmissionReportTypeOption, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MED_LEGAL_REPORT_TYPE_CODE, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, PSYCH_QME_DEFAULT_DIAGNOSIS, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationDiagnoses, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, buildBillReviewSaveInput, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, claimsAdministratorRecommendations, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, exactClaimsAdministratorMatch, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, normalizeClaimsAdministratorName, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };