idmission-web-sdk 1.0.394 → 1.0.396
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 +3 -6
- 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 +0 -2
- package/dist/components/id_capture/CapturedDocuments.d.ts +3 -5
- package/dist/components/id_capture/HighPerformanceObjectDetectionModelsProvider.d.ts +36 -0
- package/dist/components/id_capture/IdCapture.d.ts +6 -6
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +35 -21
- package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +3 -7
- package/dist/components/id_capture/IdCaptureWizard.d.ts +2 -1
- package/dist/components/selfie_capture/HighPerformanceSelfieGuidanceModelsProvider.d.ts +42 -0
- package/dist/components/selfie_capture/SelfieCapture.d.ts +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +3 -21
- package/dist/contexts/SelfieGuidanceModelsContext.d.ts +15 -0
- package/dist/contexts/SubmissionContext.d.ts +1 -2
- package/dist/lib/barcode/Scan.d.ts +1 -2
- package/dist/lib/models/DocumentDetection.d.ts +25 -69
- package/dist/lib/models/FaceDetection.d.ts +4 -33
- package/dist/lib/models/Focus.d.ts +9 -33
- package/dist/lib/models/preloadModels.d.ts +2 -9
- package/dist/lib/utils/cropping.d.ts +2 -3
- package/dist/lib/utils/logger.d.ts +0 -2
- package/dist/sdk2.cjs.development.js +8360 -2073
- 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 +8360 -2074
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +8358 -2070
- 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/Components/HighPerformanceFaceDetection/Minimal.stories.d.ts +12 -12
- package/dist/stories/Components/HighPerformanceFaceDetection/Original.stories.d.ts +8 -0
- package/dist/stories/CustomerFlows/CustomerBiometricsEnrollment.stories.d.ts +4 -4
- package/dist/stories/CustomerFlows/CustomerIdAndBiometricsEnrollment.stories.d.ts +5 -5
- package/dist/stories/CustomerFlows/CustomerIdentification.stories.d.ts +2 -2
- package/dist/stories/CustomerFlows/CustomerVerification.stories.d.ts +2 -2
- package/dist/stories/CustomerFlows/DocumentCapture.stories.d.ts +1 -1
- package/dist/stories/CustomerFlows/FaceValidation.stories.d.ts +2 -2
- package/dist/stories/CustomerFlows/IdAndFaceValidation.stories.d.ts +5 -6
- package/dist/stories/CustomerFlows/IdValidation.stories.d.ts +6 -11
- package/dist/stories/CustomerFlows/SignatureKYC.stories.d.ts +2 -2
- package/dist/stories/CustomerFlows/VideoIdValidation.stories.d.ts +5 -5
- package/dist/stories/Experiments/BarcodeReader.stories.d.ts +7 -0
- package/dist/stories/Experiments/VideoCapture.stories.d.ts +1 -1
- package/dist/stories/{Experiments/SpeedTest.stories.d.ts → models/DocumentDetection.stories.d.ts} +2 -2
- package/dist/stories/models/FocusModel.stories.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +10 -9
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +0 -29
- package/dist/components/id_capture/FocusModelProvider.d.ts +0 -22
- package/dist/lib/models/CapabilityProbing.d.ts +0 -14
- package/dist/lib/models/FrameLoop.d.ts +0 -7
- package/dist/lib/models/VisionRuntime.d.ts +0 -2
- package/dist/lib/models/helpers.d.ts +0 -9
- package/dist/lib/utils/isMobile.d.ts +0 -1
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { DetectedObject } from '../../lib/models/DocumentDetection';
|
|
3
|
-
import { Face, FaceKeypoint } from '
|
|
4
|
-
export declare
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
export declare const DebugStatsPaneDiv: import("styled-components").IStyledComponent<"web", {
|
|
3
|
+
import { Face, FaceKeypoint } from '../selfie_capture/HighPerformanceSelfieGuidanceModelsProvider';
|
|
4
|
+
export declare const DebugStatsPane: import("styled-components").IStyledComponent<"web", {
|
|
8
5
|
ref?: React.LegacyRef<HTMLSpanElement> | undefined;
|
|
9
6
|
key?: React.Key | null | undefined;
|
|
10
7
|
defaultChecked?: boolean | undefined;
|
|
@@ -316,7 +313,7 @@ export type DetectedObjectDebugBoxProps = {
|
|
|
316
313
|
flipX?: boolean;
|
|
317
314
|
color?: string;
|
|
318
315
|
};
|
|
319
|
-
export declare function IdCaptureDetectedObjectDebugBox({ obj, flipX, color,
|
|
316
|
+
export declare function IdCaptureDetectedObjectDebugBox({ obj, flipX, color, }: DetectedObjectDebugBoxProps): ReactElement;
|
|
320
317
|
export type SelfieCaptureFaceDebugBoxProps = {
|
|
321
318
|
face: Face;
|
|
322
319
|
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 passports. Defaults to 0.75. */
|
|
92
|
-
passportAutoCaptureScoreThreshold?: number;
|
|
93
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. */
|
|
94
92
|
mrzDetectionScoreThreshold?: number;
|
|
93
|
+
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for passports. Defaults to 0.75. */
|
|
94
|
+
passportAutoCaptureScoreThreshold?: 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 passports. Defaults to 0.75. */
|
|
89
|
-
passportAutoCaptureScoreThreshold?: number;
|
|
90
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. */
|
|
91
89
|
mrzDetectionScoreThreshold?: number;
|
|
90
|
+
/** Number between 0 and 1 at which document detection guidance score condition is considered to be met for passports. Defaults to 0.75. */
|
|
91
|
+
passportAutoCaptureScoreThreshold?: 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,8 +72,6 @@ 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;
|
|
77
75
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for ID cards. */
|
|
78
76
|
idCardFocusScoreThreshold?: number;
|
|
79
77
|
/** Number between 0 and 1 at which focus guidance score condition is considered to be met for passports. */
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { DetectedObjectBox } from '../../lib/models/DocumentDetection';
|
|
2
|
-
export declare const CapturedDocumentTypeValues: readonly ["idCardFront", "idCardBack", "passport", "selfie"];
|
|
3
|
-
export type CapturedDocumentType = (typeof CapturedDocumentTypeValues)[number];
|
|
4
1
|
export type CapturedDocument = {
|
|
5
2
|
imageData: string;
|
|
6
3
|
width: number;
|
|
7
4
|
height: number;
|
|
8
|
-
boundingBox?:
|
|
9
|
-
documentType: CapturedDocumentType;
|
|
5
|
+
boundingBox?: number[];
|
|
10
6
|
};
|
|
7
|
+
export declare const CapturedDocumentTypeValues: readonly ["idCardFront", "idCardBack", "passport", "selfie"];
|
|
8
|
+
export type CapturedDocumentType = (typeof CapturedDocumentTypeValues)[number];
|
|
11
9
|
export type CapturedDocuments = {
|
|
12
10
|
[k in CapturedDocumentType]?: CapturedDocument;
|
|
13
11
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { ObjectDetector } from '@mediapipe/tasks-vision';
|
|
4
|
+
export declare const visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm";
|
|
5
|
+
export declare const objectDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240517/model_fp16.tflite";
|
|
6
|
+
export type DetectedObject = {
|
|
7
|
+
box: {
|
|
8
|
+
xMin: number;
|
|
9
|
+
xMax: number;
|
|
10
|
+
yMin: number;
|
|
11
|
+
yMax: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function loadHighPerformanceObjectDetector(modelAssetPath: string, delegate?: 'CPU' | 'GPU', scoreThreshold?: number): Promise<ObjectDetector>;
|
|
17
|
+
type PredictionHandler = (prediction: DetectedObject[]) => void;
|
|
18
|
+
type HighPerformanceSelfieGuidanceModelsState = {
|
|
19
|
+
start: () => void;
|
|
20
|
+
stop: () => void;
|
|
21
|
+
onPredictionMade: (handler: PredictionHandler) => void;
|
|
22
|
+
canvasRef: MutableRefObject<HTMLCanvasElement | null>;
|
|
23
|
+
ready: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
modelDownloadProgress: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const HighPerformanceObjectDetectionModelsContext: React.Context<HighPerformanceSelfieGuidanceModelsState>;
|
|
28
|
+
export declare const HighPerformanceObjectDetectionModelsProvider: ({ autoStart, children, throttleMs, modelAssetPath, delegate, scoreThreshold, }: {
|
|
29
|
+
autoStart?: boolean | undefined;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
throttleMs?: number | undefined;
|
|
32
|
+
modelAssetPath?: string | undefined;
|
|
33
|
+
delegate?: "CPU" | "GPU" | undefined;
|
|
34
|
+
scoreThreshold?: number | undefined;
|
|
35
|
+
}) => ReactElement;
|
|
36
|
+
export {};
|
|
@@ -40,24 +40,24 @@ export type IdCaptureVerbiage = {
|
|
|
40
40
|
export type IdCaptureProps = {
|
|
41
41
|
requiredDocumentType?: CapturedDocumentType;
|
|
42
42
|
autoCaptureEnabled?: boolean;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
autoCaptureScoreThreshold?: number;
|
|
44
|
+
autoCaptureGoodFramesRequired?: number;
|
|
45
45
|
autoCaptureBarcodeRequired?: boolean | 'mobile';
|
|
46
46
|
mrzDetectionScoreThreshold?: number;
|
|
47
|
+
passportPageDetectionThreshold?: number;
|
|
47
48
|
pdf417DetectionThreshold?: number;
|
|
48
49
|
barcodeScanningEnabled?: boolean;
|
|
49
50
|
maxBarcodeScanAttempts?: number;
|
|
50
|
-
|
|
51
|
-
passportFocusScoreThreshold?: number;
|
|
51
|
+
focusScoreThreshold?: 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,
|
|
56
|
+
onCapture?: (frame: string, width: number, height: number, 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, autoCaptureScoreThreshold, autoCaptureGoodFramesRequired, autoCaptureBarcodeRequired, mrzDetectionScoreThreshold, passportPageDetectionThreshold, pdf417DetectionThreshold, focusScoreThreshold, barcodeScanningEnabled, maxBarcodeScanAttempts, guidanceMessage, guidanceSatisfied, onPrediction, onBarcodeScanned, onCapture, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdCaptureProps) => React.ReactElement;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { DetectedObject,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { FocusThresholds } from '../../lib/models/Focus';
|
|
1
|
+
import React, { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { DetectedObject, DocumentType } from '../../lib/models/DocumentDetection';
|
|
3
|
+
import { FocusPrediction } from '../../lib/models/Focus';
|
|
4
|
+
import { Frame } from '../../lib/utils/getFrameDimensions';
|
|
6
5
|
export type IdCapturePrediction = {
|
|
7
6
|
detectedObjects: DetectedObject[];
|
|
8
7
|
detectionTime: number;
|
|
@@ -15,7 +14,7 @@ export type IdCapturePrediction = {
|
|
|
15
14
|
mrzDetectionThresholdMet: boolean;
|
|
16
15
|
pdf417DetectionScore: number;
|
|
17
16
|
pdf417DetectionThresholdMet: boolean;
|
|
18
|
-
|
|
17
|
+
bestDocumentOrPassport: DetectedObject | undefined;
|
|
19
18
|
bestMrz: DetectedObject | undefined;
|
|
20
19
|
bestPdf417: DetectedObject | undefined;
|
|
21
20
|
documentInBounds: boolean;
|
|
@@ -27,40 +26,55 @@ export type IdCapturePrediction = {
|
|
|
27
26
|
frameHeight: number;
|
|
28
27
|
allZero: boolean;
|
|
29
28
|
};
|
|
30
|
-
export type IdCaptureThresholds =
|
|
31
|
-
|
|
29
|
+
export type IdCaptureThresholds = {
|
|
30
|
+
document?: number;
|
|
31
|
+
passport?: number;
|
|
32
|
+
mrz?: number;
|
|
33
|
+
pdf417?: number;
|
|
34
|
+
focus?: {
|
|
35
|
+
desktop?: number;
|
|
36
|
+
mobile?: number;
|
|
37
|
+
};
|
|
32
38
|
};
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
export type BestFrame = {
|
|
40
|
+
canvas: HTMLCanvasElement;
|
|
41
|
+
boundingBox?: number[];
|
|
36
42
|
detectionScore: number;
|
|
37
43
|
focusScore: number;
|
|
38
44
|
};
|
|
39
|
-
export type BestFrame = BestFrameDetails & {
|
|
40
|
-
canvas: HTMLCanvasElement;
|
|
41
|
-
};
|
|
42
45
|
export type IdCaptureModelsState = {
|
|
43
46
|
ready: boolean;
|
|
44
|
-
start: () => void;
|
|
45
|
-
stop: () => void;
|
|
46
47
|
modelDownloadProgress: number;
|
|
47
|
-
|
|
48
|
+
working: MutableRefObject<boolean>;
|
|
49
|
+
idModelError: Error | null;
|
|
48
50
|
thresholds: IdCaptureThresholds;
|
|
49
51
|
setThresholds: (value: IdCaptureThresholds) => void;
|
|
52
|
+
makePrediction: (frame: Frame) => void;
|
|
50
53
|
onPredictionMade: (handler: (prediction: IdCapturePrediction) => void) => void;
|
|
51
54
|
detectionTime: number;
|
|
52
55
|
focusPredictionTime: number;
|
|
53
|
-
|
|
54
|
-
getBestFrame: () => BestFrame | null;
|
|
56
|
+
getBestFrame: () => Promise<BestFrame | null>;
|
|
55
57
|
resetBestFrame: () => void;
|
|
58
|
+
bestFrameDetectionScore: number;
|
|
59
|
+
bestFrameFocusScore: number;
|
|
56
60
|
};
|
|
57
61
|
export declare const IdCaptureModelsContext: React.Context<IdCaptureModelsState>;
|
|
58
62
|
export type IdCaptureModelsProviderProps = {
|
|
59
63
|
children: ReactNode;
|
|
60
64
|
documentDetectionModelUrl?: string | undefined;
|
|
61
65
|
focusModelUrl?: string | undefined;
|
|
66
|
+
logPredictions?: boolean;
|
|
62
67
|
onModelError?: (error: Error) => void;
|
|
63
68
|
modelLoadTimeoutMs?: number;
|
|
64
69
|
};
|
|
65
|
-
export declare
|
|
66
|
-
export declare
|
|
70
|
+
export declare const defaultDocumentDetectionModelUrl: string;
|
|
71
|
+
export declare const defaultFocusModelUrl: string;
|
|
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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CapturedDocumentType } from './CapturedDocuments';
|
|
2
|
-
export type IdCaptureRequirementOption = '
|
|
2
|
+
export type IdCaptureRequirementOption = 'idCardFront' | 'idCardBack' | 'passport' | 'idCard' | 'idCardOrPassport' | 'idCardAndPassport';
|
|
3
3
|
export declare const requiredDocumentsForOption: {
|
|
4
4
|
[key in IdCaptureRequirementOption]: Array<CapturedDocumentType>;
|
|
5
5
|
};
|
|
@@ -51,6 +51,7 @@ export type IdCaptureState = {
|
|
|
51
51
|
lastFrameCapturedAt: Date | null;
|
|
52
52
|
frameCaptureRate: number;
|
|
53
53
|
capturing: boolean;
|
|
54
|
+
captured: boolean;
|
|
54
55
|
captureFailed: boolean;
|
|
55
56
|
imageUrl: string | null;
|
|
56
57
|
captureState: CaptureState;
|
|
@@ -59,8 +60,6 @@ export type IdCaptureState = {
|
|
|
59
60
|
requestedDocumentType: CapturedDocumentType;
|
|
60
61
|
detectedDocumentType: DocumentType;
|
|
61
62
|
differentDocumentTypeDetections: number;
|
|
62
|
-
operationStartedAt: Date | null;
|
|
63
|
-
captureStartedAt: Date | null;
|
|
64
63
|
};
|
|
65
64
|
export type IdCaptureAction = {
|
|
66
65
|
type: 'configureWizard';
|
|
@@ -71,13 +70,12 @@ export type IdCaptureAction = {
|
|
|
71
70
|
} | {
|
|
72
71
|
type: 'configureCapture';
|
|
73
72
|
payload: {
|
|
73
|
+
requiredDocumentType?: CapturedDocumentType;
|
|
74
|
+
goodFramesThreshold: number;
|
|
74
75
|
autoCaptureBarcodeRequired: boolean | 'mobile';
|
|
75
76
|
barcodeScanningEnabled: boolean;
|
|
76
77
|
maxBarcodeScanAttempts: number;
|
|
77
78
|
};
|
|
78
|
-
} | {
|
|
79
|
-
type: 'setRequiredDocumentType';
|
|
80
|
-
payload: CapturedDocumentType;
|
|
81
79
|
} | {
|
|
82
80
|
type: 'redrawRequested';
|
|
83
81
|
} | {
|
|
@@ -103,8 +101,6 @@ export type IdCaptureAction = {
|
|
|
103
101
|
width: number;
|
|
104
102
|
height: number;
|
|
105
103
|
};
|
|
106
|
-
} | {
|
|
107
|
-
type: 'captureStarted';
|
|
108
104
|
} | {
|
|
109
105
|
type: 'capturing';
|
|
110
106
|
} | {
|
|
@@ -54,6 +54,7 @@ export type IdCaptureWizardProps = {
|
|
|
54
54
|
precapturedDocuments?: CapturedDocuments;
|
|
55
55
|
captureRequirement?: IdCaptureRequirementOption;
|
|
56
56
|
autoCaptureEnabled?: boolean;
|
|
57
|
+
autoCaptureGoodFramesRequired?: number;
|
|
57
58
|
autoCaptureBarcodeRequired?: 'mobile' | boolean;
|
|
58
59
|
barcodeScanningEnabled?: boolean;
|
|
59
60
|
idCardAutoCaptureScoreThreshold?: number;
|
|
@@ -74,4 +75,4 @@ export type IdCaptureWizardProps = {
|
|
|
74
75
|
verbiage?: IdCaptureWizardVerbiage;
|
|
75
76
|
debugMode?: boolean;
|
|
76
77
|
};
|
|
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;
|
|
78
|
+
export declare const IdCaptureWizard: ({ onSuccess, onExitCapture, onUserCancel, loadingOverlayMode, precapturedDocuments, captureRequirement, autoCaptureEnabled, autoCaptureGoodFramesRequired, autoCaptureBarcodeRequired, barcodeScanningEnabled, idCardAutoCaptureScoreThreshold, passportAutoCaptureScoreThreshold, mrzDetectionScoreThreshold, idCardFocusScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, instructions, releaseCameraAccessOnExit, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, silentFallback, assets, classNames, colors, verbiage, debugMode, }: IdCaptureWizardProps) => ReactElement;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { FaceDetector } from '@mediapipe/tasks-vision';
|
|
4
|
+
export declare const visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
|
|
5
|
+
export declare const faceDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite";
|
|
6
|
+
export declare const defaultSelfieCaptureModelLoadTimeoutMs = 45000;
|
|
7
|
+
export type FaceKeypoint = {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
export type Face = {
|
|
13
|
+
keypoints: FaceKeypoint[];
|
|
14
|
+
box: {
|
|
15
|
+
xMin: number;
|
|
16
|
+
xMax: number;
|
|
17
|
+
yMin: number;
|
|
18
|
+
yMax: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare function loadHighPerformanceFaceDetector(): Promise<FaceDetector>;
|
|
24
|
+
type PredictionHandler = (prediction: Face[]) => void;
|
|
25
|
+
type HighPerformanceSelfieGuidanceModelsState = {
|
|
26
|
+
start: () => void;
|
|
27
|
+
stop: () => void;
|
|
28
|
+
onPredictionMade: (handler: PredictionHandler) => void;
|
|
29
|
+
canvasRef: MutableRefObject<HTMLCanvasElement | null>;
|
|
30
|
+
ready: boolean;
|
|
31
|
+
error: Error | null;
|
|
32
|
+
modelDownloadProgress: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const HighPerformanceSelfieGuidanceModelsContext: React.Context<HighPerformanceSelfieGuidanceModelsState>;
|
|
35
|
+
export declare const HighPerformanceSelfieGuidanceModelsProvider: ({ autoStart, children, throttleMs, onModelError, modelLoadTimeoutMs, }: {
|
|
36
|
+
autoStart?: boolean | undefined;
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
throttleMs?: number | undefined;
|
|
39
|
+
onModelError?: ((error: Error) => void) | undefined;
|
|
40
|
+
modelLoadTimeoutMs?: number | undefined;
|
|
41
|
+
}) => ReactElement;
|
|
42
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { FaceCaptureGuideOverlayClassNames } from '../face_liveness/FaceCaptureGuideOverlay';
|
|
3
|
+
import { Face } from './HighPerformanceSelfieGuidanceModelsProvider';
|
|
3
4
|
import { CustomerSuppliedVerbiage } from '../../lib/locales';
|
|
4
5
|
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,23 +1,5 @@
|
|
|
1
|
-
import
|
|
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>;
|
|
1
|
+
import { ReactElement } from 'react';
|
|
15
2
|
export type SelfieGuidanceModelsProviderProps = {
|
|
16
|
-
|
|
17
|
-
children: ReactNode;
|
|
18
|
-
throttleMs?: number;
|
|
19
|
-
onModelError?: (error: Error) => void;
|
|
20
|
-
modelLoadTimeoutMs?: number;
|
|
3
|
+
children: ReactElement;
|
|
21
4
|
};
|
|
22
|
-
export declare
|
|
23
|
-
export {};
|
|
5
|
+
export declare const SelfieGuidanceModelsProvider: ({ children, }: SelfieGuidanceModelsProviderProps) => ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { Face } from '@tensorflow-models/face-detection';
|
|
3
|
+
import { Frame } from '../lib/utils/getFrameDimensions';
|
|
4
|
+
export type FacesPrediction = {
|
|
5
|
+
image: ImageBitmap;
|
|
6
|
+
faces: Face[];
|
|
7
|
+
};
|
|
8
|
+
export type SelfieGuidanceModelsState = {
|
|
9
|
+
ready: boolean;
|
|
10
|
+
working: MutableRefObject<boolean>;
|
|
11
|
+
makePrediction: (frame: Frame) => void;
|
|
12
|
+
onPredictionMade: (handler: (prediction: FacesPrediction) => void) => void;
|
|
13
|
+
faceDetectionTime: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const SelfieGuidanceModelsContext: import("react").Context<SelfieGuidanceModelsState>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UploadedDocument } from '../components/additional_document_capture/AdditionalDocumentCapture';
|
|
2
|
-
import { DetectedObjectBox } from '../lib/models/DocumentDetection';
|
|
3
2
|
export declare enum SubmissionAction {
|
|
4
3
|
NONE = "NONE",
|
|
5
4
|
ENROLL = "ENROLL",
|
|
@@ -81,7 +80,7 @@ export type CaptureAttemptMetadata = {
|
|
|
81
80
|
operationTime?: number;
|
|
82
81
|
bestDetectionScore?: number;
|
|
83
82
|
bestFocusScore?: number;
|
|
84
|
-
boundingBox?:
|
|
83
|
+
boundingBox?: number[];
|
|
85
84
|
};
|
|
86
85
|
export type PersonalData = {
|
|
87
86
|
uniqueNumber?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PDF417DetectionResult } from './Native';
|
|
2
|
-
import { DetectedObjectBox } from '../models/DocumentDetection';
|
|
3
2
|
export declare function supportsNativeBarcodeScanning(): boolean;
|
|
4
|
-
export declare function scanBarcode(blob: Blob,
|
|
3
|
+
export declare function scanBarcode(blob: Blob, bbox?: number[]): Promise<PDF417DetectionResult | null>;
|
|
@@ -1,74 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import { ObjectDetector, ObjectDetectorResult } from '@mediapipe/tasks-vision';
|
|
3
|
-
export declare const defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240611/model_fp16.tflite";
|
|
4
|
-
export declare const defaultDocumentDetectionScoreThreshold = 0.1;
|
|
5
|
-
export declare const defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
1
|
+
import * as tf from '@tensorflow/tfjs';
|
|
6
2
|
export type DocumentType = 'none' | 'idCard' | 'passport';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
export interface DocumentDetectionModel extends tf.GraphModel {
|
|
4
|
+
outputPositions: {
|
|
5
|
+
boxes: number;
|
|
6
|
+
scores: number;
|
|
7
|
+
labels: number;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export declare let documentDetectionModel: DocumentDetectionModel | null;
|
|
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[];
|
|
15
19
|
};
|
|
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>;
|
|
16
25
|
export type DetectedObject = {
|
|
17
|
-
box: DetectedObjectBox;
|
|
18
|
-
label: Label;
|
|
19
26
|
score: number;
|
|
27
|
+
bbox: number[];
|
|
28
|
+
label: Label;
|
|
20
29
|
};
|
|
21
|
-
export
|
|
22
|
-
idCard?: number;
|
|
23
|
-
passport?: number;
|
|
24
|
-
mrz?: number;
|
|
25
|
-
pdf417?: number;
|
|
26
|
-
};
|
|
27
|
-
export declare const defaultDocumentDetectionThresholds: {
|
|
28
|
-
idCard: number;
|
|
29
|
-
passport: number;
|
|
30
|
-
mrz: number;
|
|
31
|
-
pdf417: number;
|
|
32
|
-
};
|
|
33
|
-
export declare function loadDocumentDetector(modelAssetPath?: string, scoreThreshold?: number): Promise<ObjectDetector>;
|
|
34
|
-
export declare function useLoadDocumentDetector({ modelPath, modelLoadTimeoutMs, scoreThreshold, onModelError, }: {
|
|
35
|
-
modelPath?: string;
|
|
36
|
-
modelLoadTimeoutMs?: number;
|
|
37
|
-
scoreThreshold?: number;
|
|
38
|
-
onModelError?: (error: Error) => void;
|
|
39
|
-
}): {
|
|
40
|
-
detector: import("react").MutableRefObject<ObjectDetector | null>;
|
|
41
|
-
ready: boolean;
|
|
42
|
-
modelDownloadProgress: number;
|
|
43
|
-
modelError: Error | null;
|
|
44
|
-
setModelError: import("react").Dispatch<import("react").SetStateAction<Error | null>>;
|
|
45
|
-
};
|
|
46
|
-
export type DocumentDetectionPrediction = {
|
|
47
|
-
detectedObjects: DetectedObject[];
|
|
48
|
-
detectionTime: number;
|
|
49
|
-
detectionScore: number;
|
|
50
|
-
detectionThresholdMet: boolean;
|
|
51
|
-
detectedDocumentType: DocumentType;
|
|
52
|
-
passportDetectionScore: number;
|
|
53
|
-
passportDetectionThresholdMet: boolean;
|
|
54
|
-
mrzDetectionScore: number;
|
|
55
|
-
mrzDetectionThresholdMet: boolean;
|
|
56
|
-
pdf417DetectionScore: number;
|
|
57
|
-
pdf417DetectionThresholdMet: boolean;
|
|
58
|
-
bestDocument: DetectedObject | undefined;
|
|
59
|
-
bestMrz: DetectedObject | undefined;
|
|
60
|
-
bestPdf417: DetectedObject | undefined;
|
|
61
|
-
documentInBounds: boolean;
|
|
62
|
-
documentTooClose: boolean;
|
|
63
|
-
frameWidth: number;
|
|
64
|
-
frameHeight: number;
|
|
65
|
-
allZero: boolean;
|
|
66
|
-
frameId?: number;
|
|
67
|
-
};
|
|
68
|
-
export type ObjectDetectorPrediction = ObjectDetectorResult & {
|
|
69
|
-
time: number;
|
|
70
|
-
frameWidth: number;
|
|
71
|
-
frameHeight: number;
|
|
72
|
-
};
|
|
73
|
-
export declare function makeDocumentDetectorPrediction(detector: ObjectDetector, frame: HTMLCanvasElement): Promise<ObjectDetectorPrediction | null>;
|
|
74
|
-
export declare function processDocumentDetectorPrediction(prediction: ObjectDetectorPrediction, thresholds: DocumentDetectionThresholds): DocumentDetectionPrediction;
|
|
30
|
+
export declare function bboxToDetectedObjectUnscaled(box: number[], score: number, label: number): DetectedObject;
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as faceDetection from '@tensorflow-models/face-detection';
|
|
2
2
|
import '@mediapipe/face_detection';
|
|
3
|
-
import { FaceDetector, FaceDetectorResult } from '@mediapipe/tasks-vision';
|
|
4
3
|
import { Frame } from '../utils/getFrameDimensions';
|
|
5
|
-
export
|
|
6
|
-
export declare
|
|
7
|
-
export
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
name: string;
|
|
11
|
-
};
|
|
12
|
-
export type Face = {
|
|
13
|
-
keypoints: FaceKeypoint[];
|
|
14
|
-
box: {
|
|
15
|
-
xMin: number;
|
|
16
|
-
xMax: number;
|
|
17
|
-
yMin: number;
|
|
18
|
-
yMax: number;
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare function loadFaceDetector(): Promise<FaceDetector>;
|
|
24
|
-
export declare function useLoadFaceDetector({ onModelError, modelLoadTimeoutMs, }: {
|
|
25
|
-
onModelError?: (error: Error) => void;
|
|
26
|
-
modelLoadTimeoutMs?: number;
|
|
27
|
-
}): {
|
|
28
|
-
detector: import("react").MutableRefObject<FaceDetector | null>;
|
|
29
|
-
ready: boolean;
|
|
30
|
-
modelDownloadProgress: number;
|
|
31
|
-
modelError: Error | null;
|
|
32
|
-
};
|
|
33
|
-
export declare function makeFaceDetectorPrediction(model: FaceDetector, imageData: Frame): FaceDetectorResult & {
|
|
34
|
-
faces: Face[];
|
|
35
|
-
};
|
|
4
|
+
export type FaceDetectionModel = faceDetection.FaceDetector;
|
|
5
|
+
export declare function loadFaceDetectionModel(): Promise<FaceDetectionModel>;
|
|
6
|
+
export declare function makeFaceDetectionPrediction(model: FaceDetectionModel, imageData: Frame): Promise<[faceDetection.Face[], number]>;
|
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type FocusPrediction =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export type FocusThresholds = {
|
|
12
|
-
idCard?: {
|
|
13
|
-
desktop?: number;
|
|
14
|
-
mobile?: number;
|
|
15
|
-
};
|
|
16
|
-
passport?: {
|
|
17
|
-
desktop?: number;
|
|
18
|
-
mobile?: number;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export declare const defaultFocusThresholds: FocusThresholds;
|
|
22
|
-
export declare function loadFocusModel(modelAssetPath: string): Promise<ImageClassifier>;
|
|
23
|
-
export declare function useLoadFocusModel({ modelPath, modelLoadTimeoutMs, onModelError, }: {
|
|
24
|
-
modelPath?: string;
|
|
25
|
-
modelLoadTimeoutMs?: number;
|
|
26
|
-
onModelError?: (error: Error) => void;
|
|
27
|
-
}): {
|
|
28
|
-
model: import("react").MutableRefObject<ImageClassifier | null>;
|
|
29
|
-
ready: boolean;
|
|
30
|
-
modelDownloadProgress: number;
|
|
31
|
-
modelError: Error | null;
|
|
32
|
-
};
|
|
33
|
-
export declare function makeFocusModelPrediction(model: ImageClassifier, imageData: Frame, cropCanvas: HTMLCanvasElement, rotateCanvas: HTMLCanvasElement, box?: DetectedObjectBox): FocusPrediction;
|
|
1
|
+
import * as tf from '@tensorflow/tfjs';
|
|
2
|
+
export declare let focusModel: tf.LayersModel | null;
|
|
3
|
+
export declare function loadFocusModel(url: string): Promise<tf.LayersModel>;
|
|
4
|
+
export declare function unloadFocusModel(): void;
|
|
5
|
+
type BlurScore = number;
|
|
6
|
+
type FocusScore = number;
|
|
7
|
+
export type FocusPrediction = [BlurScore, FocusScore];
|
|
8
|
+
export declare function makeFocusPrediction(model: tf.LayersModel, imageData: ImageBitmap | ImageData): Promise<[FocusPrediction, () => void]>;
|
|
9
|
+
export {};
|
|
@@ -7,15 +7,8 @@ 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
|
-
};
|
|
16
10
|
export declare function preloadDependency(url: string): Promise<unknown>;
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function preloadFocusModelDependencies(): Promise<void>;
|
|
11
|
+
export declare function preloadIdCaptureDependencies(): Promise<void>;
|
|
19
12
|
export declare function preloadFaceDetectorDependencies(): Promise<void>;
|
|
13
|
+
export declare function getTfjsModelDependencies(url: string): Promise<string[]>;
|
|
20
14
|
export declare function progressToPercentage(progress: PreloadProgress): number;
|
|
21
|
-
export declare function sumUpProgressForDependencies(dependencies: string[]): PreloadProgress;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
+
import { Face } from '@tensorflow-models/face-detection';
|
|
1
2
|
import { Frame } from './getFrameDimensions';
|
|
2
|
-
import { DetectedObjectBox } from '../models/DocumentDetection';
|
|
3
|
-
import { Face } from '../models/FaceDetection';
|
|
4
3
|
export declare function cropToShoulders(rawCanvas: HTMLCanvasElement | null, cropCanvas: HTMLCanvasElement | null, frame: ImageData, face: Face): string;
|
|
5
|
-
export declare function
|
|
4
|
+
export declare function cropToBoundingBox(frame: Frame, bbox: number[], canvas?: HTMLCanvasElement): HTMLCanvasElement;
|