React ⚛
Last updated
Last updated
Our CardScanView
react component makes it easy to add insurance card scanning and eligibility verification to any web application in 5 minutes or less.
Import the library widget and model into your project files:
You can optionally add the API client for more custom applications.
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
React: >=17.0.2
React-DOM: >=17.0.2
The react widget is designed to be highly customizable. Please see the #customization section of UI Components to adjust these elements to match your application's branding and theme:
Note: All UI/UX Props are optional
Note: Additional UI elements can be modified using CSS
The onSuccess
prop allows you to execute a custom function when the card scanning process is completed successfully. This function receives the scanned card data as an argument.
To use the onSuccess
prop, pass a function that receives the scanned card data:
In this example, the handleCardScanSuccess
function logs the scanned card data to the console when the scanning process is completed successfully.
The onError
prop allows you to execute a custom function when there's a failure during the card scanning process. This function receives an error object as an argument.
To use the onError
prop, pass a function that receives the error object:
In this example, the handleCardScanError
function logs the error object to the console when a scanning failure occurs.
By using the onSuccess
and onError
props, you can handle successful and failed scanning events, allowing you to implement custom actions or display appropriate messages to the user.
You can find examples of theError Screens at the bottom of this document
Possible errors returned to the onError
callback.
The onCancel
prop enables you to execute a custom function when the user cancels the card scanning process. This can be useful for tracking user behavior, navigating to a different part of the application, or displaying an appropriate message.
To use the onCancel
prop, pass a function that will be executed when the user cancels the scanning process:
In this example, we initialize the showCardScanView
state variable to true
. Then, we conditionally render the CardScanView
component based on the value of showCardScanView
. We then use the onCancel
prop to set the showCardScanView
state variable to false
when the user cancels the scanning process.
The onRetry
prop allows you to execute a custom function when a retry is triggered due to a scanning failure.
To use the onRetry
prop, pass a function that receives the retry event as an argument:
In this example, the handleRetry
function logs the retry event to the console when a retry is triggered.
The onProgress
prop allows you to execute a custom function to report progress during the scanning process.
In this example, the handleProgress
function logs the progress during a live scanning operation. When backsideSupport
is enabled the scan counter will reset to zero when the card is flipped to scan the back side.
For the majority of live scanning scenarios, the scanning will be completed within 2-3 scans. In situations with low light or occluded card elements, the scan count can go as high as 12.
Eligibility Verification is crucial in healthcare for confirming a patient's insurance coverage and benefits before services are provided, streamlining billing and enhancing patient care.
By providing subscriber and provider details through our React component, users can initiate the verification process effortlessly. The widget offers real-time feedback with success and error callbacks, simplifying integration into your application's UI.
See Eligibility Verification 🩻 for more details.
The fullScreen
prop controls the sizing behavior of the widget. When set to true
, the widget expands to fill the entire viewport, providing a full-screen experience. Setting it to false
keeps the widget within the width of its parent container, maintaining a 16:9 aspect ratio. This property ensures that the widget can be embedded in various layouts while preserving its visual integrity.
Example:
Camera Configuration allow developers to preset the camera's view orientation for specific installation scenarios, such as mirrored cameras or kiosks. These settings ensure the camera view is correctly aligned and oriented during the initial setup of the application:
flipHorizontal
: Enables horizontal flipping of camera view, reversing the left to right sides of the image (aka mirrored)
flipVertical
: Enabled vertical flipping of camera view, swapping the top and bottom of the image when the camera or document is upside down.
The camera permission modal is designed to handle all possible scenarios where users may refuse permission for their camera device. It serves to guide users through the steps needed to resolve a rejected permission request, whether the user manually declined access or if the device automatically blocked the permission. This ensures that users are informed and can take the necessary actions to enable camera access.
For further details, please visit the dedicated page:
The CardScanModel
class is designed to load and "warm" the TensorFlowJS model used during live scanning to detect insurance cards. Properly warming the model ensures it is ready for immediate use in the scanning process.
To utilize the CardScanModel
in your project, import it as follows:
While importing the class and warming the model are optional, doing so will result in faster widget initialization and happier users. To warm the model, call the warm
method once during the component mount. This initializes the model loading and warming process, making it ready for scanning.
Custom Model Path
Optionally, you can provide a custom model path to a local version of the model file or to a CDN that you control. Ensure the model files are included in your build folder. If the model cannot be loaded from the provided path, it will default to fetching the model from the CDN.
To include the model assets in your build system, configure your bundler (such as Webpack, Rollup, or a similar tool) to import all files from the assets/model-tfjs
folder in the npm package. The exact configuration will depend on your specific build setup and requirements.
Please reach out to support if you need help configuring your build system.
This screen will be shown on setup connection failure (websocket or initial REST API call), network error, auth failure (invalid or expired token), and camera error (without webToMobileHandOff or enableCameraPermissionModal enabled).
This screen will be shown on direct upload of an invalid image (i.e. a photo of a cat) or when all 12+ scan attempts have been exhausted because of poor input quality or complete backend failure.
Are we missing something? Please let us know and we would be happy to add it. Contact support.
Prop | Required | Type | Description |
---|---|---|---|
Prop | Type | Description |
---|---|---|
Error Type | Error Code | Error Message |
---|---|---|