@cardscan.ai/insurance-cardscan-react
Version:
A library that makes it easy to add health insurance card scanning to any web application
70 lines (69 loc) • 2.85 kB
TypeScript
import { AxiosInstance } from "axios";
import Card, { CardDetailsResponse } from "./cardApiModel";
import { EligibilityInfo } from "./eligibilityApiModel";
interface ListParameters {
cursor?: string;
limit?: number;
}
declare global {
interface Window {
Cypress?: any;
}
}
interface PerformanceDataI {
laplaceMax: number;
laplaceVariance: number;
modelClass: string;
modelProbability: number;
modelScore: number;
}
export default class CardScanApi {
protected readonly instance: AxiosInstance;
private sessionToken;
private intervalId;
private webviewVersion;
private mobileSdkVersion;
socket: WebSocket;
constructor(params: {
sessionToken: string;
live: boolean;
apiEndpoint?: string;
wsEndpoint?: string;
webviewVersion?: string;
mobileSdkVersion?: string;
});
private initializeRequestInterceptor;
private handleRequest;
private generateUploadUrl;
generateMagicLink: () => Promise<import("axios").AxiosResponse<any, any>>;
uploadCardImage: (file: File) => Promise<any>;
uploadScanImage: (scanCount: number, file: File, cardId: string, captureType: CaptureType, orientation: "front" | "back", metadata?: {
[key: string]: any;
} | undefined) => Promise<{
scanId: any;
cardId: any;
}>;
uploadScan: (cardId: string, file: File, orientation: "front" | "back", captureType: CaptureType, scanCount: number) => Promise<import("axios").AxiosResponse<any, any>>;
setScanMetadata: (scanId: string, metadata: {
[key: string]: any;
}) => Promise<import("axios").AxiosResponse<any, any>>;
listCards: (params?: ListParameters) => Promise<import("axios").AxiosResponse<{
cards: CardDetailsResponse[];
response_metadata: {
limit: number;
next_cursor: string;
total: number;
};
}, any>>;
getCard: (cardId: string) => Promise<import("axios").AxiosResponse<CardDetailsResponse, any>>;
createEligibility: (eligibility: EligibilityInfo, card_id: string) => Promise<import("axios").AxiosResponse<any, any>>;
getEligibility: (eligibilityId: string) => Promise<import("axios").AxiosResponse<any, any>>;
getCardImage: (cardId: string) => Promise<import("axios").AxiosResponse<any, any>>;
createCard: (backsideSupport?: boolean, enableLivescan?: boolean, metadata?: {
[key: string]: any;
} | undefined) => Promise<import("axios").AxiosResponse<CardDetailsResponse, any>>;
performanceData: (cardId: string, data: PerformanceDataI) => Promise<import("axios").AxiosResponse<any, any>>;
subscribe: (cardId: string, callback: (x: Card) => void) => void;
cancelSubscription: () => void;
}
export {};