idmission-web-sdk 1.0.377 → 1.0.379
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/dist/components/common/debug.d.ts +6 -3
- package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +2 -2
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts +2 -2
- package/dist/components/customer_flows/IdValidation.d.ts +2 -0
- package/dist/components/id_capture/CapturedDocuments.d.ts +5 -3
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +49 -0
- package/dist/components/id_capture/FocusModelProvider.d.ts +23 -0
- package/dist/components/id_capture/IdCapture.d.ts +6 -6
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +20 -34
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +7 -3
- package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -2
- package/dist/components/selfie_capture/SelfieCapture.d.ts +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +21 -3
- package/dist/contexts/SubmissionContext.d.ts +2 -1
- package/dist/lib/barcode/Scan.d.ts +2 -1
- package/dist/lib/models/CapabilityProbing.d.ts +14 -0
- package/dist/lib/models/DocumentDetection.d.ts +26 -25
- package/dist/lib/models/FaceDetection.d.ts +20 -5
- package/dist/lib/models/Focus.d.ts +19 -9
- package/dist/lib/models/VisionRuntime.d.ts +2 -0
- package/dist/lib/models/preloadModels.d.ts +9 -2
- package/dist/lib/utils/cropping.d.ts +3 -2
- package/dist/lib/utils/isMobile.d.ts +1 -0
- package/dist/lib/utils/logger.d.ts +2 -0
- package/dist/sdk2.cjs.development.js +2175 -8472
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +2176 -8472
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +2182 -8480
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/stories/CustomerFlows/IdAndFaceValidation.stories.d.ts +1 -0
- package/dist/stories/CustomerFlows/IdValidation.stories.d.ts +6 -0
- package/dist/stories/{models/DocumentDetection.stories.d.ts → Experiments/SpeedTest.stories.d.ts} +2 -2
- package/dist/stories/Experiments/VideoCapture.stories.d.ts +1 -1
- package/dist/stories/models/FocusModel.stories.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/id_capture/HighPerformanceObjectDetectionModelsProvider.d.ts +0 -36
- package/dist/components/selfie_capture/HighPerformanceSelfieGuidanceModelsProvider.d.ts +0 -42
- package/dist/contexts/SelfieGuidanceModelsContext.d.ts +0 -15
- package/dist/stories/Components/HighPerformanceFaceDetection/Original.stories.d.ts +0 -8
- package/dist/stories/Experiments/BarcodeReader.stories.d.ts +0 -7
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { DetectedObject } from '../../lib/models/DocumentDetection';
|
|
3
|
-
import { Face, FaceKeypoint } from '
|
|
4
|
-
export declare
|
|
3
|
+
import { Face, FaceKeypoint } from '../../lib/models/FaceDetection';
|
|
4
|
+
export declare function DebugStatsPane({ children }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export declare const DebugStatsPaneDiv: import("styled-components").IStyledComponent<"web", {
|
|
5
8
|
ref?: React.LegacyRef<HTMLSpanElement> | undefined;
|
|
6
9
|
key?: React.Key | null | undefined;
|
|
7
10
|
defaultChecked?: boolean | undefined;
|
|
@@ -313,7 +316,7 @@ export type DetectedObjectDebugBoxProps = {
|
|
|
313
316
|
flipX?: boolean;
|
|
314
317
|
color?: string;
|
|
315
318
|
};
|
|
316
|
-
export declare function IdCaptureDetectedObjectDebugBox({ obj, flipX, color, }: DetectedObjectDebugBoxProps): ReactElement;
|
|
319
|
+
export declare function IdCaptureDetectedObjectDebugBox({ obj, flipX, color, scaling, }: DetectedObjectDebugBoxProps): ReactElement;
|
|
317
320
|
export type SelfieCaptureFaceDebugBoxProps = {
|
|
318
321
|
face: Face;
|
|
319
322
|
scaling: DebugScalingDetails;
|
|
@@ -88,10 +88,10 @@ export interface CustomerEnrollmentProps extends PropsWithChildren {
|
|
|
88
88
|
idAutoCaptureEnabled?: boolean;
|
|
89
89
|
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for ID cards. Defaults to 0.8. */
|
|
90
90
|
idCardAutoCaptureScoreThreshold?: number;
|
|
91
|
-
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for Machine Readable Zones. Defaults to 0.5. */
|
|
92
|
-
mrzDetectionScoreThreshold?: number;
|
|
93
91
|
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for passports. Defaults to 0.75. */
|
|
94
92
|
passportAutoCaptureScoreThreshold?: number;
|
|
93
|
+
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for Machine Readable Zones. Defaults to 0.5. */
|
|
94
|
+
mrzDetectionScoreThreshold?: number;
|
|
95
95
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for ID cards. */
|
|
96
96
|
idCardFocusScoreThreshold?: number;
|
|
97
97
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for passports. */
|
|
@@ -85,10 +85,10 @@ export interface IdAndFaceValidationProps extends PropsWithChildren {
|
|
|
85
85
|
idAutoCaptureEnabled?: boolean;
|
|
86
86
|
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for ID cards. Defaults to 0.8. */
|
|
87
87
|
idCardAutoCaptureScoreThreshold?: number;
|
|
88
|
-
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for Machine Readable Zones. Defaults to 0.5. */
|
|
89
|
-
mrzDetectionScoreThreshold?: number;
|
|
90
88
|
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for passports. Defaults to 0.75. */
|
|
91
89
|
passportAutoCaptureScoreThreshold?: number;
|
|
90
|
+
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for Machine Readable Zones. Defaults to 0.5. */
|
|
91
|
+
mrzDetectionScoreThreshold?: number;
|
|
92
92
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for ID cards. */
|
|
93
93
|
idCardFocusScoreThreshold?: number;
|
|
94
94
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for passports. */
|
|
@@ -72,6 +72,8 @@ export interface IdValidationProps extends PropsWithChildren {
|
|
|
72
72
|
idCardAutoCaptureScoreThreshold?: number;
|
|
73
73
|
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for passports. Defaults to 0.75. */
|
|
74
74
|
passportAutoCaptureScoreThreshold?: number;
|
|
75
|
+
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for Machine Readable Zones. Defaults to 0.5. */
|
|
76
|
+
mrzDetectionScoreThreshold?: number;
|
|
75
77
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for ID cards. */
|
|
76
78
|
idCardFocusScoreThreshold?: number;
|
|
77
79
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for passports. */
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { DetectedObjectBox } from '../../lib/models/DocumentDetection';
|
|
2
|
+
export declare const CapturedDocumentTypeValues: readonly ["idCardFront", "idCardBack", "passport", "selfie"];
|
|
3
|
+
export type CapturedDocumentType = (typeof CapturedDocumentTypeValues)[number];
|
|
1
4
|
export type CapturedDocument = {
|
|
2
5
|
imageData: string;
|
|
3
6
|
width: number;
|
|
4
7
|
height: number;
|
|
5
|
-
boundingBox?:
|
|
8
|
+
boundingBox?: DetectedObjectBox;
|
|
9
|
+
documentType: CapturedDocumentType;
|
|
6
10
|
};
|
|
7
|
-
export declare const CapturedDocumentTypeValues: readonly ["idCardFront", "idCardBack", "passport", "selfie"];
|
|
8
|
-
export type CapturedDocumentType = (typeof CapturedDocumentTypeValues)[number];
|
|
9
11
|
export type CapturedDocuments = {
|
|
10
12
|
[k in CapturedDocumentType]?: CapturedDocument;
|
|
11
13
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { DetectedObject, DocumentDetectionThresholds, DocumentType } from '../../lib/models/DocumentDetection';
|
|
4
|
+
type PredictionHandler = (prediction: DocumentDetectionPrediction) => Promise<void>;
|
|
5
|
+
type DocumentDetectionModelState = {
|
|
6
|
+
documentDetectionModelReady: boolean;
|
|
7
|
+
startDocumentDetection: () => void;
|
|
8
|
+
stopDocumentDetection: () => void;
|
|
9
|
+
onDocumentDetected: (handler: PredictionHandler) => void;
|
|
10
|
+
detectionTime: number;
|
|
11
|
+
documentDetectionThresholds: DocumentDetectionThresholds;
|
|
12
|
+
setDocumentDetectionThresholds: (value: DocumentDetectionThresholds) => void;
|
|
13
|
+
documentDetectionLastPredictionCanvas: MutableRefObject<HTMLCanvasElement | null>;
|
|
14
|
+
documentDetectionModelDownloadProgress: number;
|
|
15
|
+
documentDetectionModelError: Error | null;
|
|
16
|
+
};
|
|
17
|
+
export declare const DocumentDetectionModelContext: React.Context<DocumentDetectionModelState>;
|
|
18
|
+
export type DocumentDetectionModelProviderProps = {
|
|
19
|
+
autoStart?: boolean;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
throttleMs?: number;
|
|
22
|
+
documentDetectionModelPath?: string;
|
|
23
|
+
documentDetectionModelDelegate?: 'CPU' | 'GPU';
|
|
24
|
+
documentDetectionModelScoreThreshold?: number;
|
|
25
|
+
documentDetectionModelLoadTimeoutMs?: number;
|
|
26
|
+
};
|
|
27
|
+
export declare function DocumentDetectionModelProvider({ autoStart, children, throttleMs, documentDetectionModelPath, documentDetectionModelDelegate, documentDetectionModelScoreThreshold, documentDetectionModelLoadTimeoutMs, }: DocumentDetectionModelProviderProps): ReactElement;
|
|
28
|
+
export type DocumentDetectionPrediction = {
|
|
29
|
+
detectedObjects: DetectedObject[];
|
|
30
|
+
detectionTime: number;
|
|
31
|
+
detectionScore: number;
|
|
32
|
+
detectionThresholdMet: boolean;
|
|
33
|
+
detectedDocumentType: DocumentType;
|
|
34
|
+
passportDetectionScore: number;
|
|
35
|
+
passportDetectionThresholdMet: boolean;
|
|
36
|
+
mrzDetectionScore: number;
|
|
37
|
+
mrzDetectionThresholdMet: boolean;
|
|
38
|
+
pdf417DetectionScore: number;
|
|
39
|
+
pdf417DetectionThresholdMet: boolean;
|
|
40
|
+
bestDocument: DetectedObject | undefined;
|
|
41
|
+
bestMrz: DetectedObject | undefined;
|
|
42
|
+
bestPdf417: DetectedObject | undefined;
|
|
43
|
+
documentInBounds: boolean;
|
|
44
|
+
documentTooClose: boolean;
|
|
45
|
+
frameWidth: number;
|
|
46
|
+
frameHeight: number;
|
|
47
|
+
allZero: boolean;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Frame } from '../../lib/utils/getFrameDimensions';
|
|
3
|
+
import { FocusPrediction, FocusThresholds } from '../../lib/models/Focus';
|
|
4
|
+
import { DetectedObjectBox } from '../../lib/models/DocumentDetection';
|
|
5
|
+
type FocusModelState = {
|
|
6
|
+
focusModelReady: boolean;
|
|
7
|
+
focusModelDownloadProgress: number;
|
|
8
|
+
focusModelError: Error | null;
|
|
9
|
+
focusThresholds: FocusThresholds;
|
|
10
|
+
setFocusThresholds: (value: FocusThresholds) => void;
|
|
11
|
+
makeFocusPrediction: (image: Frame, box?: DetectedObjectBox) => Promise<FocusPrediction | null>;
|
|
12
|
+
focusPredictionTime: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const FocusModelContext: React.Context<FocusModelState>;
|
|
15
|
+
export type FocusModelProviderProps = {
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
focusModelPath?: string;
|
|
18
|
+
focusModelLoadTimeoutMs?: number;
|
|
19
|
+
focusModelDelegate?: 'CPU' | 'GPU';
|
|
20
|
+
onFocusModelError?: (error: Error) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function FocusModelProvider({ children, focusModelPath, focusModelLoadTimeoutMs, focusModelDelegate, onFocusModelError, }: FocusModelProviderProps): React.JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -40,24 +40,24 @@ export type IdCaptureVerbiage = {
|
|
|
40
40
|
export type IdCaptureProps = {
|
|
41
41
|
requiredDocumentType?: CapturedDocumentType;
|
|
42
42
|
autoCaptureEnabled?: boolean;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
idCardDetectionThreshold?: number;
|
|
44
|
+
passportDetectionThreshold?: number;
|
|
45
45
|
autoCaptureBarcodeRequired?: boolean | 'mobile';
|
|
46
46
|
mrzDetectionScoreThreshold?: number;
|
|
47
|
-
passportPageDetectionThreshold?: number;
|
|
48
47
|
pdf417DetectionThreshold?: number;
|
|
49
48
|
barcodeScanningEnabled?: boolean;
|
|
50
49
|
maxBarcodeScanAttempts?: number;
|
|
51
|
-
|
|
50
|
+
idCardFocusScoreThreshold?: number;
|
|
51
|
+
passportFocusScoreThreshold?: number;
|
|
52
52
|
guidanceMessage?: string;
|
|
53
53
|
guidanceSatisfied?: boolean;
|
|
54
54
|
onPrediction?: (prediction: IdCapturePrediction) => void;
|
|
55
55
|
onBarcodeScanned?: (result: PDF417DetectionResult) => void;
|
|
56
|
-
onCapture?: (frame: string, width: number, height: number, metadata: CaptureAttemptMetadata) => void;
|
|
56
|
+
onCapture?: (frame: string, width: number, height: number, documentType: CapturedDocumentType, metadata: CaptureAttemptMetadata) => void;
|
|
57
57
|
assets?: IdCaptureAssets;
|
|
58
58
|
classNames?: IdCaptureClassNames;
|
|
59
59
|
colors?: IdCaptureColors;
|
|
60
60
|
verbiage?: IdCaptureVerbiage;
|
|
61
61
|
debugMode?: boolean;
|
|
62
62
|
};
|
|
63
|
-
export declare const IdCapture: ({ requiredDocumentType, autoCaptureEnabled,
|
|
63
|
+
export declare const IdCapture: ({ requiredDocumentType, autoCaptureEnabled, autoCaptureBarcodeRequired, idCardDetectionThreshold, passportDetectionThreshold, mrzDetectionScoreThreshold, pdf417DetectionThreshold, idCardFocusScoreThreshold, passportFocusScoreThreshold, barcodeScanningEnabled, maxBarcodeScanAttempts, guidanceMessage, guidanceSatisfied, onPrediction, onCapture, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdCaptureProps) => React.ReactElement;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { DetectedObject, DocumentType } from '../../lib/models/DocumentDetection';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DetectedObject, DetectedObjectBox, DocumentDetectionThresholds, DocumentType } from '../../lib/models/DocumentDetection';
|
|
3
|
+
import { DocumentDetectionModelProviderProps } from './DocumentDetectionModelProvider';
|
|
4
|
+
import { FocusModelProviderProps } from './FocusModelProvider';
|
|
5
|
+
import { FocusThresholds } from '../../lib/models/Focus';
|
|
5
6
|
export type IdCapturePrediction = {
|
|
6
7
|
detectedObjects: DetectedObject[];
|
|
7
8
|
detectionTime: number;
|
|
@@ -14,7 +15,7 @@ export type IdCapturePrediction = {
|
|
|
14
15
|
mrzDetectionThresholdMet: boolean;
|
|
15
16
|
pdf417DetectionScore: number;
|
|
16
17
|
pdf417DetectionThresholdMet: boolean;
|
|
17
|
-
|
|
18
|
+
bestDocument: DetectedObject | undefined;
|
|
18
19
|
bestMrz: DetectedObject | undefined;
|
|
19
20
|
bestPdf417: DetectedObject | undefined;
|
|
20
21
|
documentInBounds: boolean;
|
|
@@ -26,55 +27,40 @@ export type IdCapturePrediction = {
|
|
|
26
27
|
frameHeight: number;
|
|
27
28
|
allZero: boolean;
|
|
28
29
|
};
|
|
29
|
-
export type IdCaptureThresholds = {
|
|
30
|
-
|
|
31
|
-
passport?: number;
|
|
32
|
-
mrz?: number;
|
|
33
|
-
pdf417?: number;
|
|
34
|
-
focus?: {
|
|
35
|
-
desktop?: number;
|
|
36
|
-
mobile?: number;
|
|
37
|
-
};
|
|
30
|
+
export type IdCaptureThresholds = DocumentDetectionThresholds & {
|
|
31
|
+
focus?: FocusThresholds;
|
|
38
32
|
};
|
|
39
|
-
export type
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
export type BestFrameDetails = {
|
|
34
|
+
boundingBox?: DetectedObjectBox;
|
|
35
|
+
documentType: DocumentType;
|
|
42
36
|
detectionScore: number;
|
|
43
37
|
focusScore: number;
|
|
44
38
|
};
|
|
39
|
+
export type BestFrame = BestFrameDetails & {
|
|
40
|
+
canvas: HTMLCanvasElement;
|
|
41
|
+
};
|
|
45
42
|
export type IdCaptureModelsState = {
|
|
46
43
|
ready: boolean;
|
|
44
|
+
start: () => void;
|
|
45
|
+
stop: () => void;
|
|
47
46
|
modelDownloadProgress: number;
|
|
48
|
-
working: MutableRefObject<boolean>;
|
|
49
47
|
idModelError: Error | null;
|
|
50
48
|
thresholds: IdCaptureThresholds;
|
|
51
49
|
setThresholds: (value: IdCaptureThresholds) => void;
|
|
52
|
-
makePrediction: (frame: Frame) => void;
|
|
53
50
|
onPredictionMade: (handler: (prediction: IdCapturePrediction) => void) => void;
|
|
54
51
|
detectionTime: number;
|
|
55
52
|
focusPredictionTime: number;
|
|
56
|
-
|
|
53
|
+
bestFrameDetails: BestFrameDetails | null;
|
|
54
|
+
getBestFrame: () => BestFrame | null;
|
|
57
55
|
resetBestFrame: () => void;
|
|
58
|
-
bestFrameDetectionScore: number;
|
|
59
|
-
bestFrameFocusScore: number;
|
|
60
56
|
};
|
|
61
57
|
export declare const IdCaptureModelsContext: React.Context<IdCaptureModelsState>;
|
|
62
58
|
export type IdCaptureModelsProviderProps = {
|
|
63
59
|
children: ReactNode;
|
|
64
60
|
documentDetectionModelUrl?: string | undefined;
|
|
65
61
|
focusModelUrl?: string | undefined;
|
|
66
|
-
logPredictions?: boolean;
|
|
67
62
|
onModelError?: (error: Error) => void;
|
|
68
63
|
modelLoadTimeoutMs?: number;
|
|
69
64
|
};
|
|
70
|
-
export declare
|
|
71
|
-
export declare
|
|
72
|
-
export declare const defaultIdCaptureModelLoadTimeoutMs = 45000;
|
|
73
|
-
export declare const IdCaptureModelsProvider: ({ children, documentDetectionModelUrl, focusModelUrl, logPredictions, onModelError, modelLoadTimeoutMs, }: IdCaptureModelsProviderProps) => ReactElement;
|
|
74
|
-
type Canvases = {
|
|
75
|
-
lastPredictionCanvas: HTMLCanvasElement;
|
|
76
|
-
cropCanvas: HTMLCanvasElement;
|
|
77
|
-
rotateCanvas: HTMLCanvasElement;
|
|
78
|
-
};
|
|
79
|
-
export declare function makeFocusPrediction(imageData: Frame, canvases: Canvases, bbox?: number[], logPredictions?: boolean): Promise<[FocusPrediction, number]>;
|
|
80
|
-
export {};
|
|
65
|
+
export declare function IdCaptureModelsProviderInner({ children, onModelError, }: IdCaptureModelsProviderProps): ReactElement;
|
|
66
|
+
export declare function IdCaptureModelsProvider({ children, ...props }: IdCaptureModelsProviderProps & DocumentDetectionModelProviderProps & FocusModelProviderProps): React.JSX.Element;
|
|
@@ -51,7 +51,6 @@ export type IdCaptureState = {
|
|
|
51
51
|
lastFrameCapturedAt: Date | null;
|
|
52
52
|
frameCaptureRate: number;
|
|
53
53
|
capturing: boolean;
|
|
54
|
-
captured: boolean;
|
|
55
54
|
captureFailed: boolean;
|
|
56
55
|
imageUrl: string | null;
|
|
57
56
|
captureState: CaptureState;
|
|
@@ -60,6 +59,8 @@ export type IdCaptureState = {
|
|
|
60
59
|
requestedDocumentType: CapturedDocumentType;
|
|
61
60
|
detectedDocumentType: DocumentType;
|
|
62
61
|
differentDocumentTypeDetections: number;
|
|
62
|
+
operationStartedAt: Date | null;
|
|
63
|
+
captureStartedAt: Date | null;
|
|
63
64
|
};
|
|
64
65
|
export type IdCaptureAction = {
|
|
65
66
|
type: 'configureWizard';
|
|
@@ -70,12 +71,13 @@ export type IdCaptureAction = {
|
|
|
70
71
|
} | {
|
|
71
72
|
type: 'configureCapture';
|
|
72
73
|
payload: {
|
|
73
|
-
requiredDocumentType?: CapturedDocumentType;
|
|
74
|
-
goodFramesThreshold: number;
|
|
75
74
|
autoCaptureBarcodeRequired: boolean | 'mobile';
|
|
76
75
|
barcodeScanningEnabled: boolean;
|
|
77
76
|
maxBarcodeScanAttempts: number;
|
|
78
77
|
};
|
|
78
|
+
} | {
|
|
79
|
+
type: 'setRequiredDocumentType';
|
|
80
|
+
payload: CapturedDocumentType;
|
|
79
81
|
} | {
|
|
80
82
|
type: 'redrawRequested';
|
|
81
83
|
} | {
|
|
@@ -101,6 +103,8 @@ export type IdCaptureAction = {
|
|
|
101
103
|
width: number;
|
|
102
104
|
height: number;
|
|
103
105
|
};
|
|
106
|
+
} | {
|
|
107
|
+
type: 'captureStarted';
|
|
104
108
|
} | {
|
|
105
109
|
type: 'capturing';
|
|
106
110
|
} | {
|
|
@@ -54,7 +54,6 @@ export type IdCaptureWizardProps = {
|
|
|
54
54
|
precapturedDocuments?: CapturedDocuments;
|
|
55
55
|
captureRequirement?: IdCaptureRequirementOption;
|
|
56
56
|
autoCaptureEnabled?: boolean;
|
|
57
|
-
autoCaptureGoodFramesRequired?: number;
|
|
58
57
|
autoCaptureBarcodeRequired?: 'mobile' | boolean;
|
|
59
58
|
barcodeScanningEnabled?: boolean;
|
|
60
59
|
idCardAutoCaptureScoreThreshold?: number;
|
|
@@ -75,4 +74,4 @@ export type IdCaptureWizardProps = {
|
|
|
75
74
|
verbiage?: IdCaptureWizardVerbiage;
|
|
76
75
|
debugMode?: boolean;
|
|
77
76
|
};
|
|
78
|
-
export declare const IdCaptureWizard: ({ onSuccess, onExitCapture, onUserCancel, loadingOverlayMode, precapturedDocuments, captureRequirement, autoCaptureEnabled,
|
|
77
|
+
export declare const IdCaptureWizard: ({ onSuccess, onExitCapture, onUserCancel, loadingOverlayMode, precapturedDocuments, captureRequirement, autoCaptureEnabled, autoCaptureBarcodeRequired, barcodeScanningEnabled, idCardAutoCaptureScoreThreshold, passportAutoCaptureScoreThreshold, mrzDetectionScoreThreshold, idCardFocusScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, instructions, releaseCameraAccessOnExit, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, silentFallback, assets, classNames, colors, verbiage, debugMode, }: IdCaptureWizardProps) => ReactElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { FaceCaptureGuideOverlayClassNames } from '../face_liveness/FaceCaptureGuideOverlay';
|
|
3
|
-
import { Face } from './HighPerformanceSelfieGuidanceModelsProvider';
|
|
4
3
|
import { CustomerSuppliedVerbiage } from '../../lib/locales';
|
|
5
4
|
import { SelfieCaptureFallbackClassNames } from '../fallback_flows/SelfieCapture';
|
|
5
|
+
import { Face } from '../../lib/models/FaceDetection';
|
|
6
6
|
export type SelfieCaptureClassNames = {
|
|
7
7
|
container?: string;
|
|
8
8
|
cameraFeed?: string;
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { Face } from '../../lib/models/FaceDetection';
|
|
4
|
+
type PredictionHandler = (prediction: Face[]) => void;
|
|
5
|
+
type SelfieGuidanceModelsState = {
|
|
6
|
+
start: () => void;
|
|
7
|
+
stop: () => void;
|
|
8
|
+
onPredictionMade: (handler: PredictionHandler) => void;
|
|
9
|
+
canvasRef: MutableRefObject<HTMLCanvasElement | null>;
|
|
10
|
+
ready: boolean;
|
|
11
|
+
error: Error | null;
|
|
12
|
+
modelDownloadProgress: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const SelfieGuidanceModelsContext: React.Context<SelfieGuidanceModelsState>;
|
|
2
15
|
export type SelfieGuidanceModelsProviderProps = {
|
|
3
|
-
|
|
16
|
+
autoStart?: boolean;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
throttleMs?: number;
|
|
19
|
+
onModelError?: (error: Error) => void;
|
|
20
|
+
modelLoadTimeoutMs?: number;
|
|
4
21
|
};
|
|
5
|
-
export declare
|
|
22
|
+
export declare function SelfieGuidanceModelsProvider({ autoStart, children, throttleMs, onModelError, modelLoadTimeoutMs, }: SelfieGuidanceModelsProviderProps): ReactElement;
|
|
23
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UploadedDocument } from '../components/additional_document_capture/AdditionalDocumentCapture';
|
|
2
|
+
import { DetectedObjectBox } from '../lib/models/DocumentDetection';
|
|
2
3
|
export declare enum SubmissionAction {
|
|
3
4
|
NONE = "NONE",
|
|
4
5
|
ENROLL = "ENROLL",
|
|
@@ -80,7 +81,7 @@ export type CaptureAttemptMetadata = {
|
|
|
80
81
|
operationTime?: number;
|
|
81
82
|
bestDetectionScore?: number;
|
|
82
83
|
bestFocusScore?: number;
|
|
83
|
-
boundingBox?:
|
|
84
|
+
boundingBox?: DetectedObjectBox;
|
|
84
85
|
};
|
|
85
86
|
export type PersonalData = {
|
|
86
87
|
uniqueNumber?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { PDF417DetectionResult } from './Native';
|
|
2
|
+
import { DetectedObjectBox } from '../models/DocumentDetection';
|
|
2
3
|
export declare function supportsNativeBarcodeScanning(): boolean;
|
|
3
|
-
export declare function scanBarcode(blob: Blob,
|
|
4
|
+
export declare function scanBarcode(blob: Blob, box?: DetectedObjectBox): Promise<PDF417DetectionResult | null>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ProbeState = 'notProbed' | 'probing' | 'probed';
|
|
2
|
+
export type NetworkTier = 'untested' | 'unusable' | 'slow' | 'medium' | 'fast';
|
|
3
|
+
type ModelCapabilities = {
|
|
4
|
+
probeState: ProbeState;
|
|
5
|
+
delegate: 'GPU' | 'CPU' | 'NONE';
|
|
6
|
+
networkTier: NetworkTier;
|
|
7
|
+
networkSpeed: number;
|
|
8
|
+
networkTestTime: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const defaultImageSegmenterModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/selfiesegmenter20240524/selfie_segmenter.tflite";
|
|
11
|
+
export declare let modelCapabilities: ModelCapabilities;
|
|
12
|
+
export declare function probeModelCapabilities(): Promise<void>;
|
|
13
|
+
export declare function resetModelCapabilityProbe(): void;
|
|
14
|
+
export {};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ObjectDetector } from '@mediapipe/tasks-vision';
|
|
2
|
+
export declare const defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240605/model_fp16.tflite";
|
|
3
|
+
export declare const defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
2
4
|
export type DocumentType = 'none' | 'idCard' | 'passport';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare function loadDocumentDetectionModel(url: string): Promise<DocumentDetectionModel>;
|
|
12
|
-
export declare function unloadDocumentDetectionModel(): void;
|
|
13
|
-
export type RawEdgeDetectionResult = tf.Tensor<tf.Rank>[];
|
|
14
|
-
export declare function makeDocumentDetectionPredictions(model: tf.GraphModel, image: ImageBitmap | ImageData | HTMLImageElement): Promise<[RawEdgeDetectionResult, () => void]>;
|
|
15
|
-
export type DocumentDetectionResults = {
|
|
16
|
-
boxes: number[][];
|
|
17
|
-
scores: number[];
|
|
18
|
-
labels: number[];
|
|
5
|
+
export type Label = 'Document' | 'MRZ' | 'PDF417' | 'Primary face' | 'Secondary face' | 'Glare' | 'Punch Hole' | 'Passport page';
|
|
6
|
+
export type DetectedObjectBox = {
|
|
7
|
+
xMin: number;
|
|
8
|
+
xMax: number;
|
|
9
|
+
yMin: number;
|
|
10
|
+
yMax: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
19
13
|
};
|
|
20
|
-
export declare const labelMap: {
|
|
21
|
-
[id: number]: Label;
|
|
22
|
-
};
|
|
23
|
-
export type Label = 'Document' | 'MRZ' | 'PDF417' | 'Primary face' | 'Secondary face' | 'Glare' | 'Punch Hole' | 'Passport Page';
|
|
24
|
-
export declare function runDocumentDetection(model: tf.GraphModel, image: ImageBitmap | ImageData | HTMLImageElement): Promise<DocumentDetectionResults>;
|
|
25
14
|
export type DetectedObject = {
|
|
26
|
-
|
|
27
|
-
bbox: number[];
|
|
15
|
+
box: DetectedObjectBox;
|
|
28
16
|
label: Label;
|
|
17
|
+
score: number;
|
|
18
|
+
};
|
|
19
|
+
export type DocumentDetectionThresholds = {
|
|
20
|
+
idCard?: number;
|
|
21
|
+
passport?: number;
|
|
22
|
+
mrz?: number;
|
|
23
|
+
pdf417?: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const defaultDocumentDetectionThresholds: {
|
|
26
|
+
idCard: number;
|
|
27
|
+
passport: number;
|
|
28
|
+
mrz: number;
|
|
29
|
+
pdf417: number;
|
|
29
30
|
};
|
|
30
|
-
export declare function
|
|
31
|
+
export declare function loadDocumentDetector(modelAssetPath: string, scoreThreshold?: number): Promise<ObjectDetector>;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import * as faceDetection from '@tensorflow-models/face-detection';
|
|
2
1
|
import '@mediapipe/face_detection';
|
|
3
|
-
import {
|
|
4
|
-
export
|
|
5
|
-
export declare
|
|
6
|
-
export
|
|
2
|
+
import { FaceDetector } from '@mediapipe/tasks-vision';
|
|
3
|
+
export declare const defaultFaceDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite";
|
|
4
|
+
export declare const defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
5
|
+
export type FaceKeypoint = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
export type Face = {
|
|
11
|
+
keypoints: FaceKeypoint[];
|
|
12
|
+
box: {
|
|
13
|
+
xMin: number;
|
|
14
|
+
xMax: number;
|
|
15
|
+
yMin: number;
|
|
16
|
+
yMax: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare function loadFaceDetector(): Promise<FaceDetector>;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
1
|
+
import { ImageClassifier } from '@mediapipe/tasks-vision';
|
|
2
|
+
export declare const defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240523/model_float16.tflite";
|
|
3
|
+
export declare const defaultFocusModelLoadTimeoutMs = 45000;
|
|
4
|
+
export type FocusPrediction = {
|
|
5
|
+
score: number;
|
|
6
|
+
predictionTime: number;
|
|
7
|
+
};
|
|
8
|
+
export type FocusThresholds = {
|
|
9
|
+
idCard?: {
|
|
10
|
+
desktop?: number;
|
|
11
|
+
mobile?: number;
|
|
12
|
+
};
|
|
13
|
+
passport?: {
|
|
14
|
+
desktop?: number;
|
|
15
|
+
mobile?: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const defaultFocusThresholds: FocusThresholds;
|
|
19
|
+
export declare function loadFocusModel(modelAssetPath: string, delegate?: 'CPU' | 'GPU'): Promise<ImageClassifier>;
|
|
@@ -7,8 +7,15 @@ export type PreloadProgress = {
|
|
|
7
7
|
loaded: number;
|
|
8
8
|
total: number;
|
|
9
9
|
};
|
|
10
|
+
export declare const progressByUseCase: {
|
|
11
|
+
visionRuntime: PreloadProgress;
|
|
12
|
+
documentDetection: PreloadProgress;
|
|
13
|
+
focus: PreloadProgress;
|
|
14
|
+
faceDetection: PreloadProgress;
|
|
15
|
+
};
|
|
10
16
|
export declare function preloadDependency(url: string): Promise<unknown>;
|
|
11
|
-
export declare function
|
|
17
|
+
export declare function preloadDocumentDetectorDependencies(): Promise<void>;
|
|
18
|
+
export declare function preloadFocusModelDependencies(): Promise<void>;
|
|
12
19
|
export declare function preloadFaceDetectorDependencies(): Promise<void>;
|
|
13
|
-
export declare function getTfjsModelDependencies(url: string): Promise<string[]>;
|
|
14
20
|
export declare function progressToPercentage(progress: PreloadProgress): number;
|
|
21
|
+
export declare function sumUpProgressForDependencies(dependencies: string[]): PreloadProgress;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Face } from '@tensorflow-models/face-detection';
|
|
2
1
|
import { Frame } from './getFrameDimensions';
|
|
2
|
+
import { DetectedObjectBox } from '../models/DocumentDetection';
|
|
3
|
+
import { Face } from '../models/FaceDetection';
|
|
3
4
|
export declare function cropToShoulders(rawCanvas: HTMLCanvasElement | null, cropCanvas: HTMLCanvasElement | null, frame: ImageData, face: Face): string;
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function cropToDetectedObjectBox(frame: Frame, box: DetectedObjectBox, canvas?: HTMLCanvasElement): HTMLCanvasElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isMobile(nav?: Navigator): any;
|
|
@@ -11,4 +11,6 @@ export declare function debug(...parts: unknown[]): void;
|
|
|
11
11
|
export declare function log(...parts: unknown[]): void;
|
|
12
12
|
export declare function warn(...parts: unknown[]): void;
|
|
13
13
|
export declare function error(...parts: unknown[]): void;
|
|
14
|
+
export declare function time(label?: string): void;
|
|
15
|
+
export declare function timeEnd(label?: string): void;
|
|
14
16
|
export default log;
|