import React$1 from 'react'; /** * CMS-1500 Form Data Types * * Maps to the 33 numbered boxes on the standard CMS-1500 (02/12) claim form. * All fields are optional to support partial rendering. */ /** Insurance type checkboxes (Box 1) */ type InsuranceType = 'medicare' | 'medicaid' | 'tricare' | 'champva' | 'group_health' | 'feca_blk_lung' | 'other'; /** Sex field */ type Sex = 'M' | 'F'; /** Patient relationship to insured (Box 6) */ type PatientRelationship = 'Self' | 'Spouse' | 'Child' | 'Other'; /** Employment/accident status (Boxes 10a-c) */ interface ConditionRelatedTo { employment?: boolean; autoAccident?: boolean; autoAccidentState?: string; otherAccident?: boolean; } /** Address structure */ interface CMS1500Address { line1?: string; line2?: string; city?: string; state?: string; zipcode?: string; } /** Diagnosis code entry (Box 21, A-L) */ interface DiagnosisCode { code: string; } /** Procedure code entry for service lines (Box 24) */ interface ProcedureCodeEntry { /** CPT/HCPCS code — can be object { key: "code-desc" } or string */ procedureCode?: Record | string; /** Modifiers — can be object { key: "mod-desc" } or string[] */ modifiers?: Record | string[]; /** Diagnosis pointers (A-L letters referencing Box 21) */ diagnosisFirstPointers?: string; diagnosisSecondPointers?: string; diagnosisThirdPointers?: string; diagnosisFourthPointers?: string; /** Charges */ charges?: number | string; /** Units/quantity */ quantity?: number | string; /** EPSDT/Family Plan */ epsdt?: string; /** Type of service */ typeOfService?: string; } /** Insurance details */ interface InsuranceInfo { planName?: string; policyNumber?: string; address?: CMS1500Address; phoneNumber?: string; dob?: string; sex?: Sex; } /** Complete CMS-1500 form data */ interface CMS1500Data { /** Insurance plan details */ patientInsurance?: InsuranceInfo; /** Box 1: Insurance type */ insuranceType?: InsuranceType; /** Box 1a: Insured's ID number */ insuranceId?: string; /** Box 2: Patient's full name */ patientName?: string; /** Box 3: Patient's DOB (YYYY-MM-DD format) */ patientDOB?: string; /** Box 3: Patient's sex */ patientSex?: Sex; /** Box 5: Patient address */ patientAddress?: CMS1500Address; /** Box 5: Patient phone (e.g. "(555) 123-4567") */ patientPhone?: string; /** Box 4: Insured's name (defaults to patientName if self) */ insuredName?: string; /** Box 6: Patient relationship to insured */ patientRelationship?: PatientRelationship; otherInsuredName?: string; otherInsuredPolicy?: string; otherInsuredPlanName?: string; conditionRelatedTo?: ConditionRelatedTo; patientSignature?: string; patientSignatureDate?: string; insuredSignature?: string; /** Box 14: Date of current illness (YYYY-MM-DD) */ dateOfCurrentIllness?: string; /** Box 15: Similar illness date (YYYY-MM-DD) */ dateOfSimilarIllness?: string; /** Box 16: Unable to work — from (YYYY-MM-DD) */ unableToWorkFrom?: string; /** Box 16: Unable to work — to (YYYY-MM-DD) */ unableToWorkTo?: string; /** Box 18: Hospitalization — from (YYYY-MM-DD) */ hospitalizationFrom?: string; /** Box 18: Hospitalization — to (YYYY-MM-DD) */ hospitalizationTo?: string; /** Box 17: Referring provider (can be object or string) */ referringProvider?: Record | string; /** Box 17a: Referring provider other ID */ referringProviderOtherId?: string; /** Box 17b: Referring provider NPI */ referringProviderNPI?: string; /** Box 19: Additional claim info */ additionalClaimInfo?: string; /** Box 20: Outside lab charges */ outsideLab?: boolean; outsideLabCharges?: number | string; /** NUCC Use field */ nuccUse?: string; /** Box 21: Diagnosis codes (A-L, up to 12) */ diagnisisCodeData?: DiagnosisCode[]; resubmissionCode?: string; originalRefNumber?: string; priorAuthorization?: string; /** Date of service for all lines (YYYY-MM-DD) */ dateOfService?: string; /** Place of service code for all lines */ posCode?: string; /** Rendering provider NPI for all lines */ renderingProviderNPI?: string; /** Box 24: Procedure codes/service lines (up to 6) */ patientProcedureCodes?: ProcedureCodeEntry[]; /** Box 25: Federal Tax ID */ federalTaxId?: string; /** Box 25: SSN or EIN */ federalTaxIdType?: 'SSN' | 'EIN'; /** Box 26: Patient account number */ patientAccountNumber?: string; /** Box 27: Accept assignment */ acceptAssignment?: boolean; /** Box 28: Total charge */ total?: number; /** Box 29: Amount paid */ amountPaid?: number | string; /** Box 31: Physician signature */ physicianSignature?: string; physicianSignatureDate?: string; /** Box 32: Service facility */ serviceLocation?: Record | string; serviceFacilityName?: string; serviceFacilityAddress?: string; /** Box 33: Billing provider */ billingProvider?: Record | string; billingProviderName?: string; billingProviderAddress?: string; billingProviderPhone?: string; /** Box 33a/b: NPI and group */ billingProviderNPI?: string; billingProviderGroupNPI?: string; } /** Props for the CMS1500 PDF viewer component */ interface CMS1500FormProps { /** Form data to render */ data: CMS1500Data; /** URL or path to the CMS-1500 PDF template */ pdfTemplateUrl?: string; /** Callback when PDF is generated successfully */ onPdfReady?: (pdfUrl: string) => void; /** Callback on error */ onError?: (error: Error) => void; /** Width of the viewer (default: "100%") */ width?: string | number; /** Height of the viewer (default: "calc(100vh - 120px)") */ height?: string | number; /** Whether to auto-generate PDF on mount (default: true) */ autoGenerate?: boolean; /** Custom CSS class */ className?: string; /** Inline styles */ style?: React.CSSProperties; } /** Options for the PDF generation hook */ interface UseCMS1500Options { /** URL or path to the CMS-1500 PDF template */ pdfTemplateUrl?: string; /** Auto-generate on data change (default: false) */ autoGenerate?: boolean; } /** * CMS-1500 Form Component * * Fills a CMS-1500 PDF template with claim data and renders it in an iframe. * Uses pdf-lib to write directly into the PDF form fields for pixel-perfect output. * * HIPAA Note: This component does not store, log, or transmit any data. * All PHI is passed via props, rendered client-side, and held only in memory. */ declare const CMS1500Form: React$1.FC; interface UseCMS1500Return { /** Generated PDF blob URL (null until generated) */ pdfUrl: string | null; /** Whether PDF is currently being generated */ loading: boolean; /** Error from last generation attempt */ error: Error | null; /** Generate/regenerate the PDF */ generatePdf: (data: CMS1500Data) => Promise; /** Print the generated PDF */ handlePrint: () => void; /** Download the generated PDF */ handleDownload: (filename?: string) => void; /** Ref for the iframe viewer element */ iframeRef: React.RefObject; /** Cleanup blob URL (call on unmount if needed) */ cleanup: () => void; } /** * Hook for generating, viewing, printing, and downloading CMS-1500 PDFs. * * The PDF template is bundled with the package — no file copy or URL needed. * If pdfTemplateUrl is provided, it will fetch from that URL instead. * * No PHI is logged, stored, or transmitted. */ declare function useCMS1500(options?: UseCMS1500Options): UseCMS1500Return; /** * Parse a date string (YYYY-MM-DD or ISO) into MM, DD, YY components. */ declare function parseDateParts(dateStr?: string): { MM: string; DD: string; YY: string; }; interface FillCMS1500Options { /** Whether to flatten the form after filling (prevents further editing) */ flatten?: boolean; } /** * Fill a CMS-1500 PDF template with claim data. * * @param pdfBytes - The PDF template as ArrayBuffer or Uint8Array * @param data - CMS-1500 form data * @param options - Optional settings * @returns Filled PDF as Uint8Array */ declare function fillCMS1500Pdf(pdfBytes: ArrayBuffer | Uint8Array, data: CMS1500Data, options?: FillCMS1500Options): Promise; /** * Minimal FHIR R4 types for CMS-1500 mapping. * * These are intentionally simplified subsets of the full FHIR R4 spec, * covering only the fields needed for CMS-1500 form population. */ interface FHIRHumanName { family?: string; given?: string[]; prefix?: string[]; suffix?: string[]; } interface FHIRAddress { line?: string[]; city?: string; state?: string; postalCode?: string; country?: string; } interface FHIRContactPoint { system?: 'phone' | 'fax' | 'email'; value?: string; use?: 'home' | 'work' | 'mobile'; } interface FHIRIdentifier { system?: string; value?: string; type?: { coding?: Array<{ system?: string; code?: string; }>; }; } interface FHIRCoding { system?: string; code?: string; display?: string; } interface FHIRCodeableConcept { coding?: FHIRCoding[]; text?: string; } interface FHIRReference { reference?: string; display?: string; } interface FHIRPeriod { start?: string; end?: string; } /** Minimal FHIR R4 Patient */ interface FHIRPatient { resourceType: 'Patient'; id?: string; identifier?: FHIRIdentifier[]; name?: FHIRHumanName[]; birthDate?: string; gender?: 'male' | 'female' | 'other' | 'unknown'; address?: FHIRAddress[]; telecom?: FHIRContactPoint[]; } /** Minimal FHIR R4 Practitioner */ interface FHIRPractitioner { resourceType: 'Practitioner'; id?: string; identifier?: FHIRIdentifier[]; name?: FHIRHumanName[]; address?: FHIRAddress[]; telecom?: FHIRContactPoint[]; } /** Minimal FHIR R4 Organization */ interface FHIROrganization { resourceType: 'Organization'; id?: string; identifier?: FHIRIdentifier[]; name?: string; address?: FHIRAddress[]; telecom?: FHIRContactPoint[]; } /** FHIR Claim diagnosis component */ interface FHIRClaimDiagnosis { sequence: number; diagnosisCodeableConcept?: FHIRCodeableConcept; } /** FHIR Claim item (service line) */ interface FHIRClaimItem { sequence: number; productOrService: FHIRCodeableConcept; modifier?: FHIRCodeableConcept[]; servicedDate?: string; servicedPeriod?: FHIRPeriod; locationCodeableConcept?: FHIRCodeableConcept; quantity?: { value?: number; }; unitPrice?: { value?: number; currency?: string; }; net?: { value?: number; currency?: string; }; diagnosisSequence?: number[]; } /** Minimal FHIR R4 Claim */ interface FHIRClaim { resourceType: 'Claim'; id?: string; identifier?: FHIRIdentifier[]; status?: string; type?: FHIRCodeableConcept; patient?: FHIRReference; provider?: FHIRReference; diagnosis?: FHIRClaimDiagnosis[]; item?: FHIRClaimItem[]; total?: { value?: number; currency?: string; }; } /** Bundle for mapping — patient + claim + optional provider/org */ interface FHIRClaimBundle { patient: FHIRPatient; claim: FHIRClaim; provider?: FHIRPractitioner; billingOrganization?: FHIROrganization; serviceFacility?: FHIROrganization; referringProvider?: FHIRPractitioner; } /** * Maps a FHIR R4 claim bundle to CMS-1500 form data. * * This is an optional utility — you can also populate CMS1500Data directly. * The mapper handles common FHIR patterns but may need customization for * specific payer requirements. */ declare function mapFHIRToCMS1500(bundle: FHIRClaimBundle): CMS1500Data; /** * Returns the path to the bundled CMS-1500 PDF template relative to node_modules. * * Usage with common bundlers: * * **Next.js / CRA / Vite:** * Copy the file to your public directory, then use the default (no URL needed). * * **With copy-webpack-plugin or vite static assets:** * ```js * import { TEMPLATE_ASSET_PATH } from 'cms1500-react'; * // TEMPLATE_ASSET_PATH = 'cms1500-react/assets/cms-1500-template.pdf' * ``` */ declare const TEMPLATE_ASSET_PATH = "cms1500-react/assets/cms-1500-template.pdf"; /** * Returns the resolved path to the bundled template within node_modules. * Useful for build tools to know where to copy from. */ declare const TEMPLATE_FILENAME = "cms-1500-template.pdf"; /** * Decodes the embedded CMS-1500 PDF template to a Uint8Array. * This is the actual PDF template bundled with the package — no fetch or file copy needed. */ declare function getEmbeddedTemplate(): Uint8Array; /** Box 21: Diagnosis codes (A-L → diagnosis1-12) */ declare const DIAGNOSIS_FIELDS: readonly ["diagnosis1", "diagnosis2", "diagnosis3", "diagnosis4", "diagnosis5", "diagnosis6", "diagnosis7", "diagnosis8", "diagnosis9", "diagnosis10", "diagnosis11", "diagnosis12"]; /** Box 23: Prior authorization */ declare const PRIOR_AUTH_FIELD = "prior_auth"; /** * Box 24: Service line fields for rows 1-6. * Each row has: date from/to (mm/dd/yy), place, EMG, CPT, modifiers (a-c), * diagnosis pointer, charges, days, EPSDT, type, rendering NPI. */ interface ServiceLineFieldSet { svFromMm: string; svFromDd: string; svFromYy: string; svEndMm: string; svEndDd: string; svEndYy: string; place: string; emg: string; cpt: string; mod: string; modA: string; modB: string; modC: string; diag: string; charge: string; days: string; epsdt: string; type: string; localNpi: string; localOther: string; plan: string; } declare const SERVICE_LINE_FIELDS: ServiceLineFieldSet[]; /** Box 31: Physician signature */ declare const PHYSICIAN_FIELDS: { readonly signature: "physician_signature"; readonly date: "physician_date"; }; /** Box 32: Service facility */ declare const FACILITY_FIELDS: { readonly name: "fac_name"; readonly street: "fac_street"; readonly location: "fac_location"; readonly npi: "pin1"; readonly groupNpi: "grp1"; }; /** Box 33: Billing provider */ declare const BILLING_PROVIDER_FIELDS: { readonly name: "doc_name"; readonly street: "doc_street"; readonly location: "doc_location"; readonly phoneArea: "doc_phone area"; readonly phone: "doc_phone"; readonly npi: "pin"; readonly groupNpi: "grp"; }; export { BILLING_PROVIDER_FIELDS, type CMS1500Address, type CMS1500Data, CMS1500Form, type CMS1500FormProps, type ConditionRelatedTo, DIAGNOSIS_FIELDS, type DiagnosisCode, FACILITY_FIELDS, type FHIRClaim, type FHIRClaimBundle, type FHIRClaimDiagnosis, type FHIRClaimItem, type FHIROrganization, type FHIRPatient, type FHIRPractitioner, type FillCMS1500Options, type InsuranceInfo, type InsuranceType, PHYSICIAN_FIELDS, PRIOR_AUTH_FIELD, type PatientRelationship, type ProcedureCodeEntry, SERVICE_LINE_FIELDS, type ServiceLineFieldSet, type Sex, TEMPLATE_ASSET_PATH, TEMPLATE_FILENAME, type UseCMS1500Options, type UseCMS1500Return, fillCMS1500Pdf, getEmbeddedTemplate, mapFHIRToCMS1500, parseDateParts, useCMS1500 };