idmission-web-sdk 2.1.7 → 2.1.8
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/lib/utils/cropping.d.ts +1 -1
- package/dist/sdk2.cjs.development.js +74 -96
- 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 +75 -97
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +76 -98
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Frame } from './getFrameDimensions';
|
|
2
2
|
import { DetectedObjectBox } from '../models/DocumentDetection';
|
|
3
3
|
import { Face } from '../models/FaceDetection';
|
|
4
|
-
export declare function cropToShoulders(rawCanvas: HTMLCanvasElement | null, cropCanvas: HTMLCanvasElement | null, frame: ImageData, face: Face): string;
|
|
4
|
+
export declare function cropToShoulders(rawCanvas: HTMLCanvasElement | null, cropCanvas: HTMLCanvasElement | null, resizeCanvas: HTMLCanvasElement | null, frame: ImageData, face: Face, quality?: number, maxHeight?: number): string;
|
|
5
5
|
export declare function cropToDetectedObjectBox(frame: Frame, box: DetectedObjectBox, canvas?: HTMLCanvasElement): HTMLCanvasElement;
|
|
@@ -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 = '2.1.
|
|
52
|
+
var webSdkVersion = '2.1.8';
|
|
53
53
|
|
|
54
54
|
function getPlatform() {
|
|
55
55
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2278,39 +2278,15 @@ function preloadVisionRuntime() {
|
|
|
2278
2278
|
});
|
|
2279
2279
|
}
|
|
2280
2280
|
|
|
2281
|
-
function
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
function isMobile(nav) {
|
|
2285
|
-
if (nav || _isNavigatorDefined()) {
|
|
2286
|
-
if (!nav) {
|
|
2287
|
-
nav = navigator;
|
|
2288
|
-
}
|
|
2289
|
-
if (nav.product === 'ReactNative') {
|
|
2290
|
-
return true;
|
|
2291
|
-
}
|
|
2292
|
-
var a = nav.userAgent || nav.vendor || (
|
|
2293
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2294
|
-
// @ts-ignore
|
|
2295
|
-
typeof window !== 'undefined' ? window.opera : '');
|
|
2296
|
-
if (!a) {
|
|
2297
|
-
var navAny = nav;
|
|
2298
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2299
|
-
// @ts-ignore
|
|
2300
|
-
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
2301
|
-
}
|
|
2302
|
-
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
|
|
2303
|
-
// tslint:disable-next-line:max-line-length
|
|
2304
|
-
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
2281
|
+
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
2282
|
+
if (quality === void 0) {
|
|
2283
|
+
quality = 0.92;
|
|
2305
2284
|
}
|
|
2306
|
-
return
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
|
|
2310
|
-
if (!rawCanvas || !cropCanvas) return '';
|
|
2285
|
+
if (!rawCanvas || !cropCanvas || !resizeCanvas) return '';
|
|
2311
2286
|
var rawCtx = rawCanvas.getContext('2d');
|
|
2312
2287
|
var cropCtx = cropCanvas.getContext('2d');
|
|
2313
|
-
|
|
2288
|
+
var resizeCtx = resizeCanvas.getContext('2d');
|
|
2289
|
+
if (!rawCtx || !cropCtx || !resizeCtx) throw new Error('could not get 2d context');
|
|
2314
2290
|
rawCanvas.width = frame.width;
|
|
2315
2291
|
rawCanvas.height = frame.height;
|
|
2316
2292
|
rawCtx.putImageData(frame, 0, 0);
|
|
@@ -2320,7 +2296,7 @@ function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
|
|
|
2320
2296
|
var frameHeight = frame.height;
|
|
2321
2297
|
var xPadding = frameHeight * 0.6 - width;
|
|
2322
2298
|
var xPos = Math.max(0, xMin - xPadding / 2);
|
|
2323
|
-
if (
|
|
2299
|
+
if (frame.height > frame.width) {
|
|
2324
2300
|
cropCanvas.width = frame.width;
|
|
2325
2301
|
cropCanvas.height = frame.height;
|
|
2326
2302
|
cropCtx.drawImage(rawCanvas, 0, 0, cropCanvas.width, cropCanvas.height);
|
|
@@ -2329,9 +2305,14 @@ function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
|
|
|
2329
2305
|
cropCanvas.height = frame.height;
|
|
2330
2306
|
cropCtx.drawImage(rawCanvas, xPos, 0, cropCanvas.width, cropCanvas.height, 0, 0, cropCanvas.width, cropCanvas.height);
|
|
2331
2307
|
}
|
|
2332
|
-
|
|
2308
|
+
resizeCanvas.height = maxHeight !== null && maxHeight !== void 0 ? maxHeight : cropCanvas.height;
|
|
2309
|
+
resizeCanvas.width = cropCanvas.width * (resizeCanvas.height / cropCanvas.height);
|
|
2310
|
+
resizeCtx === null || resizeCtx === void 0 ? void 0 : resizeCtx.drawImage(cropCanvas, 0, 0, resizeCanvas.width, resizeCanvas.height);
|
|
2311
|
+
var dataURL = resizeCanvas.toDataURL('image/jpeg', quality);
|
|
2312
|
+
log('cropToShoulders size', new TextEncoder().encode(dataURL).length);
|
|
2333
2313
|
clearCanvas(rawCanvas);
|
|
2334
2314
|
clearCanvas(cropCanvas);
|
|
2315
|
+
clearCanvas(resizeCanvas);
|
|
2335
2316
|
return dataURL;
|
|
2336
2317
|
}
|
|
2337
2318
|
function cropToDetectedObjectBox(frame, box, canvas) {
|
|
@@ -3664,6 +3645,34 @@ function FocusModelProvider(_a) {
|
|
|
3664
3645
|
}), children);
|
|
3665
3646
|
}
|
|
3666
3647
|
|
|
3648
|
+
function _isNavigatorDefined() {
|
|
3649
|
+
return typeof navigator !== 'undefined' && navigator != null;
|
|
3650
|
+
}
|
|
3651
|
+
function isMobile(nav) {
|
|
3652
|
+
if (nav || _isNavigatorDefined()) {
|
|
3653
|
+
if (!nav) {
|
|
3654
|
+
nav = navigator;
|
|
3655
|
+
}
|
|
3656
|
+
if (nav.product === 'ReactNative') {
|
|
3657
|
+
return true;
|
|
3658
|
+
}
|
|
3659
|
+
var a = nav.userAgent || nav.vendor || (
|
|
3660
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3661
|
+
// @ts-ignore
|
|
3662
|
+
typeof window !== 'undefined' ? window.opera : '');
|
|
3663
|
+
if (!a) {
|
|
3664
|
+
var navAny = nav;
|
|
3665
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3666
|
+
// @ts-ignore
|
|
3667
|
+
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
3668
|
+
}
|
|
3669
|
+
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
|
|
3670
|
+
// tslint:disable-next-line:max-line-length
|
|
3671
|
+
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
3672
|
+
}
|
|
3673
|
+
return false;
|
|
3674
|
+
}
|
|
3675
|
+
|
|
3667
3676
|
var onMobile = isMobile();
|
|
3668
3677
|
var defaultIdCaptureThresholds = {
|
|
3669
3678
|
detection: defaultDocumentDetectionThresholds,
|
|
@@ -7943,9 +7952,6 @@ var templateObject_1$j, templateObject_2$d, templateObject_3$c, templateObject_4
|
|
|
7943
7952
|
var initialState$3 = {
|
|
7944
7953
|
videoWidth: 0,
|
|
7945
7954
|
videoHeight: 0,
|
|
7946
|
-
capturing: false,
|
|
7947
|
-
captured: false,
|
|
7948
|
-
captureFailed: false,
|
|
7949
7955
|
frame: null,
|
|
7950
7956
|
faces: [],
|
|
7951
7957
|
faceNotCentered: false,
|
|
@@ -7953,36 +7959,12 @@ var initialState$3 = {
|
|
|
7953
7959
|
faceTooClose: false,
|
|
7954
7960
|
faceTooFar: false,
|
|
7955
7961
|
faceReady: false,
|
|
7956
|
-
faceReadyAt: null
|
|
7957
|
-
goodFramesCount: 0,
|
|
7958
|
-
goodFramesThreshold: 1,
|
|
7959
|
-
goodFramesThresholdMet: false
|
|
7962
|
+
faceReadyAt: null
|
|
7960
7963
|
};
|
|
7961
7964
|
var reducer$3 = function reducer(state, action) {
|
|
7962
7965
|
switch (action.type) {
|
|
7963
7966
|
case 'configure':
|
|
7964
|
-
return tslib.__assign(tslib.__assign({}, state),
|
|
7965
|
-
videoWidth: action.payload.videoWidth,
|
|
7966
|
-
videoHeight: action.payload.videoHeight
|
|
7967
|
-
});
|
|
7968
|
-
case 'capturing':
|
|
7969
|
-
return tslib.__assign(tslib.__assign({}, state), {
|
|
7970
|
-
capturing: true,
|
|
7971
|
-
captured: false,
|
|
7972
|
-
captureFailed: false
|
|
7973
|
-
});
|
|
7974
|
-
case 'captured':
|
|
7975
|
-
return tslib.__assign(tslib.__assign({}, state), {
|
|
7976
|
-
capturing: false,
|
|
7977
|
-
captured: true,
|
|
7978
|
-
captureFailed: false
|
|
7979
|
-
});
|
|
7980
|
-
case 'captureFailed':
|
|
7981
|
-
return tslib.__assign(tslib.__assign({}, state), {
|
|
7982
|
-
capturing: false,
|
|
7983
|
-
captured: false,
|
|
7984
|
-
captureFailed: true
|
|
7985
|
-
});
|
|
7967
|
+
return tslib.__assign(tslib.__assign({}, state), action.payload);
|
|
7986
7968
|
case 'facesDetected':
|
|
7987
7969
|
{
|
|
7988
7970
|
var faces = action.payload.faces;
|
|
@@ -7991,8 +7973,7 @@ var reducer$3 = function reducer(state, action) {
|
|
|
7991
7973
|
faceLookingAway = false,
|
|
7992
7974
|
faceTooClose = false,
|
|
7993
7975
|
faceTooFar = false,
|
|
7994
|
-
faceReadyAt = state.faceReadyAt
|
|
7995
|
-
goodFramesCount = state.goodFramesCount;
|
|
7976
|
+
faceReadyAt = state.faceReadyAt;
|
|
7996
7977
|
if (face) {
|
|
7997
7978
|
// calculate centroids
|
|
7998
7979
|
var vCX = state.videoWidth / 2;
|
|
@@ -8018,7 +7999,6 @@ var reducer$3 = function reducer(state, action) {
|
|
|
8018
7999
|
var faceReady = !faceNotCentered && !faceLookingAway && !faceTooClose && !faceTooFar;
|
|
8019
8000
|
if (!faceReady) {
|
|
8020
8001
|
faceReadyAt = null;
|
|
8021
|
-
goodFramesCount = 0;
|
|
8022
8002
|
} else if (!state.faceReady) {
|
|
8023
8003
|
faceReadyAt = new Date();
|
|
8024
8004
|
}
|
|
@@ -8029,8 +8009,7 @@ var reducer$3 = function reducer(state, action) {
|
|
|
8029
8009
|
faceTooClose: faceTooClose,
|
|
8030
8010
|
faceTooFar: faceTooFar,
|
|
8031
8011
|
faceReady: faceReady,
|
|
8032
|
-
faceReadyAt: faceReadyAt
|
|
8033
|
-
goodFramesCount: goodFramesCount
|
|
8012
|
+
faceReadyAt: faceReadyAt
|
|
8034
8013
|
});
|
|
8035
8014
|
}
|
|
8036
8015
|
}
|
|
@@ -8082,16 +8061,14 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
8082
8061
|
});
|
|
8083
8062
|
}
|
|
8084
8063
|
}, [cameraReady, videoRef]);
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
}
|
|
8092
|
-
});
|
|
8064
|
+
onPredictionMade(useDebounce.useThrottledCallback(function (prediction) {
|
|
8065
|
+
dispatch({
|
|
8066
|
+
type: 'facesDetected',
|
|
8067
|
+
payload: {
|
|
8068
|
+
faces: prediction
|
|
8069
|
+
}
|
|
8093
8070
|
});
|
|
8094
|
-
},
|
|
8071
|
+
}, 16));
|
|
8095
8072
|
var _p = React.useState(false),
|
|
8096
8073
|
captureReady = _p[0],
|
|
8097
8074
|
setCaptureReady = _p[1];
|
|
@@ -8110,22 +8087,14 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
8110
8087
|
};
|
|
8111
8088
|
}, [onGuidanceNotSatisfied, onGuidanceSatisfied, state.faceReady]);
|
|
8112
8089
|
React.useEffect(function () {
|
|
8113
|
-
(
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
imageData = ctx.getImageData(0, 0, videoRef.current.videoWidth, videoRef.current.videoHeight);
|
|
8122
|
-
onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData, state.faces[0]);
|
|
8123
|
-
clearCanvas(lastPredictionCanvas.current);
|
|
8124
|
-
}
|
|
8125
|
-
return [2 /*return*/];
|
|
8126
|
-
});
|
|
8127
|
-
});
|
|
8128
|
-
})();
|
|
8090
|
+
if (captureReady && videoRef.current && lastPredictionCanvas.current && state.faces.length > 0) {
|
|
8091
|
+
drawToCanvas(lastPredictionCanvas.current, videoRef.current);
|
|
8092
|
+
var ctx = lastPredictionCanvas.current.getContext('2d');
|
|
8093
|
+
if (!ctx) return;
|
|
8094
|
+
var imageData = ctx.getImageData(0, 0, videoRef.current.videoWidth, videoRef.current.videoHeight);
|
|
8095
|
+
onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData, state.faces[0]);
|
|
8096
|
+
clearCanvas(lastPredictionCanvas.current);
|
|
8097
|
+
}
|
|
8129
8098
|
}, [captureReady, onSelfieCaptured, state.faces, videoRef]);
|
|
8130
8099
|
var _q = useTimeout(timeoutDurationMs, onTimeout),
|
|
8131
8100
|
timedOut = _q.timedOut,
|
|
@@ -8174,7 +8143,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
8174
8143
|
scaling: debugScalingDetails,
|
|
8175
8144
|
color: satisfied ? 'green' : 'red'
|
|
8176
8145
|
});
|
|
8177
|
-
}))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceNotCentered ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceTooClose && !state.faceTooFar ? '✅' : '❌', " Face", ' ', state.faceTooClose ? 'Too Close' : state.faceTooFar ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceLookingAway ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__default['default'].createElement("br", null),
|
|
8146
|
+
}))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceNotCentered ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceTooClose && !state.faceTooFar ? '✅' : '❌', " Face", ' ', state.faceTooClose ? 'Too Close' : state.faceTooFar ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__default['default'].createElement("br", null), !state.faceLookingAway ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__default['default'].createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
|
|
8178
8147
|
onClick: onExit,
|
|
8179
8148
|
className: classNames.exitCaptureBtn
|
|
8180
8149
|
}));
|
|
@@ -8294,6 +8263,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
8294
8263
|
setImageUrl = _m[1];
|
|
8295
8264
|
var rawCanvas = React.useRef(null);
|
|
8296
8265
|
var cropCanvas = React.useRef(null);
|
|
8266
|
+
var resizeCanvas = React.useRef(null);
|
|
8297
8267
|
var theme = styled.useTheme();
|
|
8298
8268
|
var onSelfieCaptured = React.useCallback(function (frame, face) {
|
|
8299
8269
|
onCapture === null || onCapture === void 0 ? void 0 : onCapture();
|
|
@@ -8322,7 +8292,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
8322
8292
|
switch (_b.label) {
|
|
8323
8293
|
case 0:
|
|
8324
8294
|
_b.trys.push([0, 3,, 4]);
|
|
8325
|
-
imageUrl_1 = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
|
|
8295
|
+
imageUrl_1 = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face, 0.92, 500);
|
|
8326
8296
|
setImageUrl(imageUrl_1);
|
|
8327
8297
|
_a = checkLiveness;
|
|
8328
8298
|
return [4 /*yield*/, dataUrlToBase64(imageUrl_1)];
|
|
@@ -8435,6 +8405,8 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
|
|
|
8435
8405
|
ref: rawCanvas
|
|
8436
8406
|
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
8437
8407
|
ref: cropCanvas
|
|
8408
|
+
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
8409
|
+
ref: resizeCanvas
|
|
8438
8410
|
}), /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
|
|
8439
8411
|
onSelfieCaptured: onSelfieCaptured,
|
|
8440
8412
|
onExit: onExit,
|
|
@@ -12529,6 +12501,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12529
12501
|
setImageUrl = _k[1];
|
|
12530
12502
|
var rawCanvas = React.useRef(null);
|
|
12531
12503
|
var cropCanvas = React.useRef(null);
|
|
12504
|
+
var resizeCanvas = React.useRef(null);
|
|
12532
12505
|
var onSelfieCaptured = React.useCallback(function (frame, face) {
|
|
12533
12506
|
dispatch({
|
|
12534
12507
|
type: 'verificationReady',
|
|
@@ -12541,7 +12514,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12541
12514
|
var isReady = state.requestState === 'CAPTURED';
|
|
12542
12515
|
React.useEffect(function () {
|
|
12543
12516
|
if (!frame || !face || submissionError) return;
|
|
12544
|
-
var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
|
|
12517
|
+
var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face);
|
|
12545
12518
|
setImageUrl(imageUrl);
|
|
12546
12519
|
dataUrlToBase64(imageUrl).then(function (img) {
|
|
12547
12520
|
setSelfieImage(img);
|
|
@@ -12604,6 +12577,8 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
|
|
|
12604
12577
|
ref: rawCanvas
|
|
12605
12578
|
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
12606
12579
|
ref: cropCanvas
|
|
12580
|
+
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
12581
|
+
ref: resizeCanvas
|
|
12607
12582
|
}), /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
|
|
12608
12583
|
onSelfieCaptured: onSelfieCaptured,
|
|
12609
12584
|
onExit: onExit,
|
|
@@ -13082,6 +13057,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13082
13057
|
setImageUrl = _k[1];
|
|
13083
13058
|
var rawCanvas = React.useRef(null);
|
|
13084
13059
|
var cropCanvas = React.useRef(null);
|
|
13060
|
+
var resizeCanvas = React.useRef(null);
|
|
13085
13061
|
var onSelfieCaptured = React.useCallback(function (frame, face) {
|
|
13086
13062
|
dispatch({
|
|
13087
13063
|
type: 'identificationReady',
|
|
@@ -13096,7 +13072,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13096
13072
|
var isReady = state.requestState === 'CAPTURED';
|
|
13097
13073
|
React.useEffect(function () {
|
|
13098
13074
|
if (!frame || !face || submissionError) return;
|
|
13099
|
-
var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
|
|
13075
|
+
var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face);
|
|
13100
13076
|
setImageUrl(imageUrl);
|
|
13101
13077
|
dataUrlToBase64(imageUrl).then(function (img) {
|
|
13102
13078
|
setSelfieImage(img);
|
|
@@ -13159,6 +13135,8 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
|
|
|
13159
13135
|
ref: rawCanvas
|
|
13160
13136
|
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
13161
13137
|
ref: cropCanvas
|
|
13138
|
+
}), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
|
|
13139
|
+
ref: resizeCanvas
|
|
13162
13140
|
}), /*#__PURE__*/React__default['default'].createElement(SelfieCapture, {
|
|
13163
13141
|
onSelfieCaptured: onSelfieCaptured,
|
|
13164
13142
|
onExit: onExit,
|