The CardScanDropZone component provides an alternative to camera-based scanning by offering a drag-and-drop file upload interface for insurance card processing. This component is perfect for desktop workflows where users have digital images of their insurance cards ready to upload.
importReactfrom"react";import{render}from"react-dom";import{CardScanDropZone}from"@cardscan.ai/insurance-cardscan-react";functiononSuccess(card){console.log("Card processed successfully:",card);}functiononError(error){console.error('Error occurred:',error);}// See Authentication on where to get this sessionTokenconstsessionToken='JWT_TOKEN'functionApp(){return (<divclassName="App"><divclassName="DropZoneContainer"><CardScanDropZonelive={false}sessionToken={sessionToken}onSuccess={onSuccess}onError={onError}enableBackside={true}layout="side-by-side"/></div></div> );}constrootElement=document.getElementById('root');render(<App/>,rootElement);
Compatibility
Node Versions: 14, 16, 18
React Versions: >=17.0.2, 18.2.0+
Webpack Versions: 4.x, 5.x
Babel Versions: 6.x, 7.x
Peer Dependencies
React: >=17.0.2
React-DOM: >=17.0.2
react-dropzone: ^14.0.0
Configuration
Available Props
Main Props
Prop
Required
Type
Description
live
true
Boolean
Toggle production or sandbox version. Default: false
<CardScanDropZone
layout="side-by-side"
enableBackside={true}
// ... other props
/>
<CardScanDropZone
layout="sequential"
enableBackside={true}
// ... other props
/>
const customMessages = {
frontDropTitle: "Upload Front of Insurance Card",
frontDropSubtitle: "Drag and drop or click to select",
backDropTitle: "Upload Back of Insurance Card",
backDropSubtitle: "Drag and drop or click to select",
frontProcessingTitle: "Processing Front Card...",
backProcessingTitle: "Processing Back Card...",
uploadingTitle: "Uploading...",
successTitle: "Upload Complete!",
errorTitle: "Upload Failed",
fileTooLargeError: "File size must be under 5MB",
invalidFileTypeError: "Please upload a JPEG or PNG file"
};
<CardScanDropZone
messages={customMessages}
// ... other props
/>
<CardScanDropZone
widgetBackgroundColor="#ffffff"
primaryColor="#007bff"
progressBarColor="#28a745"
// ... other props
/>
const handleSuccess = (cardData) => {
console.log('Processed card data:', cardData);
// cardData contains extracted information from both front and back
};
<CardScanDropZone
onSuccess={handleSuccess}
// ... other props
/>