idmission-web-sdk 1.0.225 → 1.0.227
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/video_id/IdVideoCapture.d.ts +2 -1
- package/dist/sdk2.cjs.development.js +84 -73
- 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 +84 -73
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +84 -73
- 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/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@ export type IdVideoCaptureProps = {
|
|
|
27
27
|
onIdFrontImageCaptured?: (imageUrl: string) => void;
|
|
28
28
|
onIdBackImageCaptured?: (imageUrl: string) => void;
|
|
29
29
|
onFaceNotDetected?: () => void;
|
|
30
|
+
idCardFrontDelay?: number;
|
|
30
31
|
idCardFrontDetectionThreshold?: number;
|
|
31
32
|
idCardBackDetectionThreshold?: number;
|
|
32
33
|
idCardFrontFocusThreshold?: number;
|
|
@@ -42,4 +43,4 @@ export type IdVideoCaptureProps = {
|
|
|
42
43
|
verbiage?: IdVideoCaptureVerbiage;
|
|
43
44
|
debugMode?: boolean;
|
|
44
45
|
};
|
|
45
|
-
export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, readTextPrompt, readTextTimeoutDurationMs, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
|
|
46
|
+
export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, idCardFrontDelay, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, readTextPrompt, readTextTimeoutDurationMs, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
|
|
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
|
|
|
49
49
|
var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
|
|
50
50
|
var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
|
|
51
51
|
|
|
52
|
-
var webSdkVersion = '1.0.
|
|
52
|
+
var webSdkVersion = '1.0.227';
|
|
53
53
|
|
|
54
54
|
function getPlatform() {
|
|
55
55
|
if (typeof window === 'undefined') return;
|
|
@@ -14153,65 +14153,67 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14153
14153
|
onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
|
|
14154
14154
|
onIdBackImageCaptured = _a.onIdBackImageCaptured,
|
|
14155
14155
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
14156
|
-
_v = _a.
|
|
14157
|
-
|
|
14158
|
-
_w = _a.
|
|
14159
|
-
|
|
14160
|
-
_x = _a.
|
|
14161
|
-
|
|
14162
|
-
_y = _a.
|
|
14163
|
-
|
|
14164
|
-
_z = _a.
|
|
14165
|
-
|
|
14166
|
-
_0 = _a.
|
|
14167
|
-
|
|
14168
|
-
_1 = _a.
|
|
14169
|
-
|
|
14156
|
+
_v = _a.idCardFrontDelay,
|
|
14157
|
+
idCardFrontDelay = _v === void 0 ? 1000 : _v,
|
|
14158
|
+
_w = _a.idCardFrontDetectionThreshold,
|
|
14159
|
+
idCardFrontDetectionThreshold = _w === void 0 ? 0.6 : _w,
|
|
14160
|
+
_x = _a.idCardFrontFocusThreshold,
|
|
14161
|
+
idCardFrontFocusThreshold = _x === void 0 ? 0 : _x,
|
|
14162
|
+
_y = _a.goodIdCardFrontFramesThreshold,
|
|
14163
|
+
goodIdCardFrontFramesThreshold = _y === void 0 ? 3 : _y,
|
|
14164
|
+
_z = _a.idCardBackDetectionThreshold,
|
|
14165
|
+
idCardBackDetectionThreshold = _z === void 0 ? 0.6 : _z,
|
|
14166
|
+
_0 = _a.idCardBackFocusThreshold,
|
|
14167
|
+
idCardBackFocusThreshold = _0 === void 0 ? 0 : _0,
|
|
14168
|
+
_1 = _a.goodIdCardBackFramesThreshold,
|
|
14169
|
+
goodIdCardBackFramesThreshold = _1 === void 0 ? 3 : _1,
|
|
14170
|
+
_2 = _a.skipShowIdCardBack,
|
|
14171
|
+
skipShowIdCardBack = _2 === void 0 ? false : _2,
|
|
14170
14172
|
readTextPrompt = _a.readTextPrompt,
|
|
14171
|
-
|
|
14172
|
-
readTextTimeoutDurationMs =
|
|
14173
|
-
|
|
14174
|
-
assets =
|
|
14175
|
-
|
|
14176
|
-
classNames =
|
|
14177
|
-
|
|
14178
|
-
colors =
|
|
14179
|
-
|
|
14180
|
-
rawVerbiage =
|
|
14181
|
-
|
|
14182
|
-
debugMode =
|
|
14183
|
-
var
|
|
14184
|
-
ref =
|
|
14185
|
-
|
|
14186
|
-
width =
|
|
14187
|
-
|
|
14188
|
-
height =
|
|
14189
|
-
var
|
|
14190
|
-
cameraRef =
|
|
14191
|
-
videoRef =
|
|
14192
|
-
videoLoaded =
|
|
14193
|
-
cameraReady =
|
|
14194
|
-
var _12 = React.useState([]),
|
|
14195
|
-
detectedObjects = _12[0],
|
|
14196
|
-
setDetectedObjects = _12[1];
|
|
14173
|
+
_3 = _a.readTextTimeoutDurationMs,
|
|
14174
|
+
readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
|
|
14175
|
+
_4 = _a.assets,
|
|
14176
|
+
assets = _4 === void 0 ? {} : _4,
|
|
14177
|
+
_5 = _a.classNames,
|
|
14178
|
+
classNames = _5 === void 0 ? {} : _5,
|
|
14179
|
+
_6 = _a.colors,
|
|
14180
|
+
colors = _6 === void 0 ? {} : _6,
|
|
14181
|
+
_7 = _a.verbiage,
|
|
14182
|
+
rawVerbiage = _7 === void 0 ? {} : _7,
|
|
14183
|
+
_8 = _a.debugMode,
|
|
14184
|
+
debugMode = _8 === void 0 ? false : _8;
|
|
14185
|
+
var _9 = useResizeObserver__default['default'](),
|
|
14186
|
+
ref = _9.ref,
|
|
14187
|
+
_10 = _9.width,
|
|
14188
|
+
width = _10 === void 0 ? 1 : _10,
|
|
14189
|
+
_11 = _9.height,
|
|
14190
|
+
height = _11 === void 0 ? 1 : _11;
|
|
14191
|
+
var _12 = React.useContext(CameraStateContext),
|
|
14192
|
+
cameraRef = _12.cameraRef,
|
|
14193
|
+
videoRef = _12.videoRef,
|
|
14194
|
+
videoLoaded = _12.videoLoaded,
|
|
14195
|
+
cameraReady = _12.cameraReady;
|
|
14197
14196
|
var _13 = React.useState([]),
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
var _14 = React.
|
|
14201
|
-
|
|
14202
|
-
|
|
14203
|
-
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14197
|
+
detectedObjects = _13[0],
|
|
14198
|
+
setDetectedObjects = _13[1];
|
|
14199
|
+
var _14 = React.useState([]),
|
|
14200
|
+
faces = _14[0],
|
|
14201
|
+
setFaces = _14[1];
|
|
14202
|
+
var _15 = React.useContext(IdCaptureModelsContext),
|
|
14203
|
+
idModelsReady = _15.ready,
|
|
14204
|
+
idModelsWorking = _15.working,
|
|
14205
|
+
makeIdPrediction = _15.makePrediction,
|
|
14206
|
+
onIdPredictionMade = _15.onPredictionMade,
|
|
14207
|
+
setThresholds = _15.setThresholds,
|
|
14208
|
+
bestFrameDetectionScore = _15.bestFrameDetectionScore,
|
|
14209
|
+
bestFrameFocusScore = _15.bestFrameFocusScore,
|
|
14210
|
+
resetBestFrame = _15.resetBestFrame;
|
|
14209
14211
|
var onSelfiePredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
|
|
14210
|
-
var
|
|
14211
|
-
isRecording =
|
|
14212
|
-
startRecording =
|
|
14213
|
-
stopRecording =
|
|
14214
|
-
videoUrl =
|
|
14212
|
+
var _16 = useVideoRecorder(cameraRef.current),
|
|
14213
|
+
isRecording = _16.isRecording,
|
|
14214
|
+
startRecording = _16.startRecording,
|
|
14215
|
+
stopRecording = _16.stopRecording,
|
|
14216
|
+
videoUrl = _16.videoUrl;
|
|
14215
14217
|
React.useEffect(function () {
|
|
14216
14218
|
if (!isRecording && !videoUrl) startRecording();
|
|
14217
14219
|
if (videoUrl) onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl);
|
|
@@ -14221,9 +14223,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14221
14223
|
React.useEffect(function () {
|
|
14222
14224
|
shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady;
|
|
14223
14225
|
}, [cameraReady, idModelsReady, videoLoaded]);
|
|
14224
|
-
var
|
|
14225
|
-
requestedAction =
|
|
14226
|
-
setRequestedAction =
|
|
14226
|
+
var _17 = React.useState('SHOW_ID_FRONT'),
|
|
14227
|
+
requestedAction = _17[0],
|
|
14228
|
+
setRequestedAction = _17[1];
|
|
14227
14229
|
React.useEffect(function () {
|
|
14228
14230
|
if (requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
|
|
14229
14231
|
if (!idModelsReady || !cameraReady || !videoLoaded) return;
|
|
@@ -14251,15 +14253,23 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14251
14253
|
}
|
|
14252
14254
|
});
|
|
14253
14255
|
}, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
|
|
14254
|
-
var
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14256
|
+
var _18 = React.useState(null),
|
|
14257
|
+
idFrontCaptureStartedAt = _18[0],
|
|
14258
|
+
setIdFrontCaptureStartedAt = _18[1];
|
|
14259
|
+
React.useEffect(function () {
|
|
14260
|
+
if (requestedAction === 'SHOW_ID_FRONT') {
|
|
14261
|
+
setIdFrontCaptureStartedAt(new Date().getTime());
|
|
14262
|
+
}
|
|
14263
|
+
}, [requestedAction]);
|
|
14260
14264
|
var _19 = React.useState(0),
|
|
14261
|
-
|
|
14262
|
-
|
|
14265
|
+
currentDetectionScore = _19[0],
|
|
14266
|
+
setCurrentDetectionScore = _19[1];
|
|
14267
|
+
var _20 = React.useState(0),
|
|
14268
|
+
currentFocusScore = _20[0],
|
|
14269
|
+
setCurrentFocusScore = _20[1];
|
|
14270
|
+
var _21 = React.useState(0),
|
|
14271
|
+
goodFramesCount = _21[0],
|
|
14272
|
+
setGoodFramesCount = _21[1];
|
|
14263
14273
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
|
|
14264
14274
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
14265
14275
|
React.useEffect(function () {
|
|
@@ -14267,7 +14277,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14267
14277
|
setDetectedObjects(prediction.detectedObjects);
|
|
14268
14278
|
setCurrentDetectionScore(prediction.detectionScore);
|
|
14269
14279
|
setCurrentFocusScore(prediction.focusScore);
|
|
14270
|
-
|
|
14280
|
+
var delaySatisfied = idFrontCaptureStartedAt && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
|
|
14281
|
+
if (delaySatisfied && prediction.detectionThresholdMet && prediction.focusThresholdMet) {
|
|
14271
14282
|
setGoodFramesCount(function (n) {
|
|
14272
14283
|
return n + 1;
|
|
14273
14284
|
});
|
|
@@ -14275,7 +14286,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14275
14286
|
setGoodFramesCount(0);
|
|
14276
14287
|
}
|
|
14277
14288
|
});
|
|
14278
|
-
}, [idCardFrontDetectionThreshold, onIdPredictionMade]);
|
|
14289
|
+
}, [idCardFrontDelay, idCardFrontDetectionThreshold, idFrontCaptureStartedAt, onIdPredictionMade]);
|
|
14279
14290
|
var captureCanvas = React.useRef(null);
|
|
14280
14291
|
var captureFrame = React.useCallback(function () {
|
|
14281
14292
|
if (!captureCanvas.current || !videoRef.current) return;
|
|
@@ -14350,9 +14361,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
14350
14361
|
stopRecording();
|
|
14351
14362
|
}, [stopRecording]);
|
|
14352
14363
|
var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, onReadTextTimeout, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
|
|
14353
|
-
var
|
|
14354
|
-
numFramesWithoutFaces =
|
|
14355
|
-
setNumFramesWithoutFaces =
|
|
14364
|
+
var _22 = React.useState(0),
|
|
14365
|
+
numFramesWithoutFaces = _22[0],
|
|
14366
|
+
setNumFramesWithoutFaces = _22[1];
|
|
14356
14367
|
React.useEffect(function () {
|
|
14357
14368
|
onSelfiePredictionMade(function (faces) {
|
|
14358
14369
|
setFaces(faces);
|