idmission-web-sdk 2.2.35 → 2.2.37
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/CompositeWizard.d.ts +1 -2
- package/dist/components/CompositeWizard.d.ts.map +1 -1
- package/dist/components/camera/CameraAccessDeniedOverlay.d.ts.map +1 -1
- package/dist/components/camera/CameraVideoTag.d.ts +2 -4
- package/dist/components/camera/CameraVideoTag.d.ts.map +1 -1
- package/dist/components/camera/MicrophoneAccessDeniedOverlay.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerIdentification.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerVerification.d.ts.map +1 -1
- package/dist/components/customer_flows/DocumentCapture.d.ts.map +1 -1
- package/dist/components/customer_flows/FaceValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
- package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts +1 -1
- package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts.map +1 -1
- package/dist/components/customer_verification/CustomerVerificationWizard.d.ts.map +1 -1
- package/dist/components/document_capture/DocumentCaptureScreen.d.ts.map +1 -1
- package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessWizard.d.ts.map +1 -1
- package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
- package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureGuides.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureLoadingOverlayLegacy.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieCaptureLoadingOverlayDefault.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieCaptureLoadingOverlayLegacy.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureFlipIdPrompt.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureGuides.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/lib/camera/Camera.d.ts +4 -0
- package/dist/lib/camera/Camera.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts +52 -0
- package/dist/lib/camera/cameraStore.d.ts.map +1 -0
- package/dist/lib/camera/videoRefStack.d.ts +6 -0
- package/dist/lib/camera/videoRefStack.d.ts.map +1 -0
- package/dist/lib/models/DocumentDetection.d.ts +3 -1
- package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
- package/dist/lib/models/FaceDetection.d.ts +3 -1
- package/dist/lib/models/FaceDetection.d.ts.map +1 -1
- package/dist/lib/models/Focus.d.ts +3 -1
- package/dist/lib/models/Focus.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +1001 -1083
- 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 +1001 -1083
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +1121 -1086
- 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 +5 -4
- package/dist/components/camera/CameraProvider.d.ts +0 -17
- package/dist/components/camera/CameraProvider.d.ts.map +0 -1
|
@@ -9,10 +9,12 @@ var tusJsClient = require('tus-js-client');
|
|
|
9
9
|
var SparkMD5 = require('spark-md5');
|
|
10
10
|
var useResizeObserver = require('use-resize-observer');
|
|
11
11
|
var tasksVision = require('@mediapipe/tasks-vision');
|
|
12
|
+
var zustand = require('zustand');
|
|
12
13
|
var useDebounce = require('use-debounce');
|
|
13
14
|
var reactDom = require('react-dom');
|
|
14
15
|
var LanguageDetector = require('i18next-browser-languagedetector');
|
|
15
16
|
var i18n = require('i18next');
|
|
17
|
+
var shallow = require('zustand/react/shallow');
|
|
16
18
|
var SignatureCanvas = require('react-signature-canvas');
|
|
17
19
|
|
|
18
20
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -232,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
232
234
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
233
235
|
};
|
|
234
236
|
|
|
235
|
-
var webSdkVersion = '2.2.
|
|
237
|
+
var webSdkVersion = '2.2.37';
|
|
236
238
|
|
|
237
239
|
function getPlatform() {
|
|
238
240
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -801,11 +803,11 @@ function setDefaultAuthUrl(url) {
|
|
|
801
803
|
if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
|
|
802
804
|
exports.defaultAuthUrl = url;
|
|
803
805
|
}
|
|
804
|
-
var initialState$
|
|
806
|
+
var initialState$6 = {
|
|
805
807
|
authUrl: exports.defaultAuthUrl,
|
|
806
808
|
sessionCheckState: 'READY'
|
|
807
809
|
};
|
|
808
|
-
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$
|
|
810
|
+
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$6);
|
|
809
811
|
var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
810
812
|
var reducer$4 = function reducer(state, action) {
|
|
811
813
|
switch (action.type) {
|
|
@@ -837,7 +839,7 @@ function useAuthReducer(authUrl, sessionId) {
|
|
|
837
839
|
if (authUrl === void 0) {
|
|
838
840
|
authUrl = exports.defaultAuthUrl;
|
|
839
841
|
}
|
|
840
|
-
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$
|
|
842
|
+
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$6), {
|
|
841
843
|
authUrl: authUrl
|
|
842
844
|
})),
|
|
843
845
|
state = _a[0],
|
|
@@ -1917,608 +1919,6 @@ function calculateMd5(blob) {
|
|
|
1917
1919
|
});
|
|
1918
1920
|
}
|
|
1919
1921
|
|
|
1920
|
-
function getFrameDimensions(frame) {
|
|
1921
|
-
var frameWidth = frame.width,
|
|
1922
|
-
frameHeight = frame.height;
|
|
1923
|
-
if (frame instanceof HTMLImageElement) {
|
|
1924
|
-
frameWidth = frame.naturalWidth;
|
|
1925
|
-
frameHeight = frame.naturalHeight;
|
|
1926
|
-
}
|
|
1927
|
-
if (frame instanceof HTMLVideoElement) {
|
|
1928
|
-
frameWidth = frame.videoWidth;
|
|
1929
|
-
frameHeight = frame.videoHeight;
|
|
1930
|
-
}
|
|
1931
|
-
return [frameWidth, frameHeight];
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
1935
|
-
function drawToCanvas(canvas, frame, width, height) {
|
|
1936
|
-
if (!canvas) return;
|
|
1937
|
-
var ctx = canvas.getContext('2d');
|
|
1938
|
-
if (!ctx) return;
|
|
1939
|
-
if (!width || !height) {
|
|
1940
|
-
var _a = getFrameDimensions(frame),
|
|
1941
|
-
frameWidth = _a[0],
|
|
1942
|
-
frameHeight = _a[1];
|
|
1943
|
-
width || (width = frameWidth);
|
|
1944
|
-
height || (height = frameHeight);
|
|
1945
|
-
}
|
|
1946
|
-
canvas.width = width;
|
|
1947
|
-
canvas.height = height;
|
|
1948
|
-
ctx.drawImage(frame, 0, 0, width, height);
|
|
1949
|
-
}
|
|
1950
|
-
function clearCanvas(canvas) {
|
|
1951
|
-
var _a;
|
|
1952
|
-
(_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
|
|
1953
|
-
}
|
|
1954
|
-
var templateObject_1$G;
|
|
1955
|
-
|
|
1956
|
-
function listAvailableCameras(facingMode_1) {
|
|
1957
|
-
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
1958
|
-
var cameraEnumerationStream, videoDevices;
|
|
1959
|
-
if (requestMicAccess === void 0) {
|
|
1960
|
-
requestMicAccess = false;
|
|
1961
|
-
}
|
|
1962
|
-
return __generator(this, function (_a) {
|
|
1963
|
-
switch (_a.label) {
|
|
1964
|
-
case 0:
|
|
1965
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
1966
|
-
video: {
|
|
1967
|
-
facingMode: {
|
|
1968
|
-
exact: facingMode
|
|
1969
|
-
}
|
|
1970
|
-
},
|
|
1971
|
-
audio: requestMicAccess
|
|
1972
|
-
})
|
|
1973
|
-
// This lists all available cameras attached to the user's device.
|
|
1974
|
-
];
|
|
1975
|
-
case 1:
|
|
1976
|
-
cameraEnumerationStream = _a.sent();
|
|
1977
|
-
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
1978
|
-
case 2:
|
|
1979
|
-
videoDevices = _a.sent().filter(function (_a) {
|
|
1980
|
-
var kind = _a.kind;
|
|
1981
|
-
return kind === 'videoinput';
|
|
1982
|
-
});
|
|
1983
|
-
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
1984
|
-
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
1985
|
-
track.enabled = false;
|
|
1986
|
-
track.stop();
|
|
1987
|
-
});
|
|
1988
|
-
cameraEnumerationStream = null;
|
|
1989
|
-
return [2 /*return*/, videoDevices];
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
var frontLabels = ['front', 'avant', 'anteriore', 'cameraaanvoorzijde', 'kamerapåframsidan', 'forsidekamera', 'kamerapåforsiden', 'aparatprzedni', 'etukamera', 'kameradepan', 'ÖnKamera', 'cameramặttrước', 'camerăfață', 'prednákamera', 'prednjakamera', 'előlapikamera', 'přednífotoaparát', 'μπροστινήκάμερα', 'переднякамера', 'передняякамера', 'преднакамера', 'алдыңғыкамера', 'מצלמה קדמית', 'الكاميرا الأمامية', 'फ़्रंटकैमरा', '前置相机', '前置鏡頭', '前面カメラ', '전면카메라', 'กล้องด้านหน้า'].map(function (s) {
|
|
1995
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
1996
|
-
});
|
|
1997
|
-
var rearLabels = ['back', 'rear', 'posterior', 'trasera', 'traseira', 'arrière', 'rückkamera', 'fotocamera(posteriore)', 'cameraaanachterzijde', 'kamerapåbaksidan', 'kamerapåbaksiden', 'bagsidekamera', 'aparattylny', 'takakamera', 'arkakamera', 'kamerabelakang', 'cameramặtsau', 'camerăspate', 'stražnjakamera', 'zadnákamera', 'hátoldalikamera', 'zadnífotoaparát', 'πίσωκάμερα', 'заднякамера', 'Задняякамера', 'заднакамера', 'артқыкамера', 'מצלמה אחורית', 'الكاميرا الخلفية', 'बैककैमरा', '后置相机', '後置鏡頭', '背面カメラ', '후면카메라', 'กล้องด้านหลัง'].map(function (s) {
|
|
1998
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
1999
|
-
});
|
|
2000
|
-
var backUltraWideLabels = ['backdualwidecamera', 'backultrawidecamera', 'ultraampliaposterior', 'ultra-angulartraseira', 'ultragrandeangulartraseira', 'ultragrandangle', 'ultragranangular', 'ultra-weitwinkelkamera', 'ultra-grandangolo', 'ultrabredecameraaanachterzijde', 'ultravidvinkelkamerapåbaksidan', 'ultravidvinkelkameraetpåbagsiden', 'ultravidvinkelkamerabak', 'ultragenişkameraarkayüzü', 'ultralaajakulmainentakakamera', 'tylnyaparatultraszerokokątny', 'cameracựcrộngmặtsau', 'camerăcuobiectivultra‑superangularspate', 'ultraszéleslátószögűkamera', 'kameraultralebarbelakang', 'stražnjaultraširokakamera', 'zadníultraširokoúhlýfotoaparát', 'ultraširokouhlá', 'πίσωυπερευρείακάμερα', 'заднянадширококутнакамера', 'Задняясверхширокоугольнаякамера', 'Задна свръх широкоъгълна камера', 'артқыультракеңбұрыштыкамера', 'מצלמה אולטרה רחבה אחורית', 'كاميرا خلفية عريضة جدًا', 'बैकअल्ट्रावाइडकैमरा', '后置超广角相机', '後置超廣角鏡頭相機', '背面超広角カメラ', '후면울트라와이드카메라', 'กล้องด้านหลังอัลตร้าไวด์'].map(function (s) {
|
|
2001
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
2002
|
-
});
|
|
2003
|
-
var labelMatches = function labelMatches(labelOrDevice, labelSetOrLabel) {
|
|
2004
|
-
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
2005
|
-
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
2006
|
-
return labelSet.some(function (l) {
|
|
2007
|
-
return label.includes(l);
|
|
2008
|
-
});
|
|
2009
|
-
};
|
|
2010
|
-
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
2011
|
-
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
2012
|
-
};
|
|
2013
|
-
var currentCamera;
|
|
2014
|
-
var currentAudioStream;
|
|
2015
|
-
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
2016
|
-
releaseCameraAccess();
|
|
2017
|
-
log('obtaining camera access...');
|
|
2018
|
-
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
2019
|
-
width = _a.width,
|
|
2020
|
-
height = _a.height;
|
|
2021
|
-
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
2022
|
-
var isRearFacing = labelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearLabels, true), backUltraWideLabels, true), ['iphone'], false));
|
|
2023
|
-
var release = function release() {
|
|
2024
|
-
stream.getTracks().forEach(function (track) {
|
|
2025
|
-
track.enabled = false;
|
|
2026
|
-
track.stop();
|
|
2027
|
-
});
|
|
2028
|
-
if (video) {
|
|
2029
|
-
video.pause();
|
|
2030
|
-
video.srcObject = null;
|
|
2031
|
-
video.src = '';
|
|
2032
|
-
}
|
|
2033
|
-
};
|
|
2034
|
-
width || (width = 0);
|
|
2035
|
-
height || (height = 0);
|
|
2036
|
-
currentCamera = {
|
|
2037
|
-
label: deviceLabel,
|
|
2038
|
-
stream: stream,
|
|
2039
|
-
width: width,
|
|
2040
|
-
height: height,
|
|
2041
|
-
isRearFacing: isRearFacing,
|
|
2042
|
-
release: release
|
|
2043
|
-
};
|
|
2044
|
-
if (video) video.srcObject = stream;
|
|
2045
|
-
return currentCamera;
|
|
2046
|
-
}
|
|
2047
|
-
function releaseCameraAccess() {
|
|
2048
|
-
if (!currentCamera) return;
|
|
2049
|
-
log('releasing camera access...');
|
|
2050
|
-
currentCamera.release();
|
|
2051
|
-
currentCamera = undefined;
|
|
2052
|
-
}
|
|
2053
|
-
function releaseMicrophoneAccess() {
|
|
2054
|
-
var _a;
|
|
2055
|
-
if (!currentAudioStream) return;
|
|
2056
|
-
log('releasing microphone access...');
|
|
2057
|
-
(_a = currentAudioStream.stop) === null || _a === void 0 ? void 0 : _a.call(currentAudioStream);
|
|
2058
|
-
currentAudioStream.getAudioTracks().forEach(function (t) {
|
|
2059
|
-
var _a;
|
|
2060
|
-
(_a = t.stop) === null || _a === void 0 ? void 0 : _a.call(t);
|
|
2061
|
-
});
|
|
2062
|
-
currentAudioStream = undefined;
|
|
2063
|
-
}
|
|
2064
|
-
function usePreferredCaptureDevice(_a) {
|
|
2065
|
-
var _b = _a === void 0 ? {} : _a,
|
|
2066
|
-
_c = _b.requestAccessAutomatically,
|
|
2067
|
-
requestAccessAutomatically = _c === void 0 ? true : _c,
|
|
2068
|
-
_d = _b.preferFrontFacingCamera,
|
|
2069
|
-
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
2070
|
-
_e = _b.preferContinuityCamera,
|
|
2071
|
-
preferContinuityCamera = _e === void 0 ? true : _e,
|
|
2072
|
-
_f = _b.requireMicrophoneAccess,
|
|
2073
|
-
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
2074
|
-
_g = _b.maxVideoWidth,
|
|
2075
|
-
maxVideoWidth = _g === void 0 ? 1920 : _g,
|
|
2076
|
-
maxFps = _b.maxFps,
|
|
2077
|
-
_h = _b.debugMode,
|
|
2078
|
-
debugMode = _h === void 0 ? false : _h;
|
|
2079
|
-
var videoRef = React.useRef(null);
|
|
2080
|
-
var videoRefStack = React.useRef([]);
|
|
2081
|
-
var cameraRef = React.useRef(null);
|
|
2082
|
-
var _j = React.useState(false),
|
|
2083
|
-
cameraReady = _j[0],
|
|
2084
|
-
setCameraReady = _j[1];
|
|
2085
|
-
var _k = React.useState(false),
|
|
2086
|
-
microphoneReady = _k[0],
|
|
2087
|
-
setMicrophoneReady = _k[1];
|
|
2088
|
-
var _l = React.useState(null),
|
|
2089
|
-
videoDevice = _l[0],
|
|
2090
|
-
setVideoDevice = _l[1];
|
|
2091
|
-
var _m = React.useState(null),
|
|
2092
|
-
audioStream = _m[0],
|
|
2093
|
-
setAudioStream = _m[1];
|
|
2094
|
-
var _o = React.useState(false),
|
|
2095
|
-
videoLoaded = _o[0],
|
|
2096
|
-
setVideoLoaded = _o[1];
|
|
2097
|
-
var _p = React.useState(false),
|
|
2098
|
-
iphoneContinuityCameraAvailable = _p[0],
|
|
2099
|
-
setIphoneContinuityCameraAvailable = _p[1];
|
|
2100
|
-
var _q = React.useState(preferContinuityCamera),
|
|
2101
|
-
iphoneContinuityCameraAllowed = _q[0],
|
|
2102
|
-
setIphoneContinuityCameraAllowed = _q[1];
|
|
2103
|
-
var _r = React.useState(false),
|
|
2104
|
-
iphoneContinuityCameraDenied = _r[0],
|
|
2105
|
-
setIphoneContinuityCameraDenied = _r[1];
|
|
2106
|
-
var _s = React.useState(false),
|
|
2107
|
-
cameraAccessDenied = _s[0],
|
|
2108
|
-
setCameraAccessDenied = _s[1];
|
|
2109
|
-
var _t = React.useState(false),
|
|
2110
|
-
microphoneAccessDenied = _t[0],
|
|
2111
|
-
setMicrophoneAccessDenied = _t[1];
|
|
2112
|
-
var videoRefElement = videoRef.current;
|
|
2113
|
-
React.useEffect(function pushVideoRefToStackWhenChanged() {
|
|
2114
|
-
// proceed if the video element being mounted is not already at the top of the videoRefStack.
|
|
2115
|
-
var topOfStack = videoRefStack.current.slice(-1)[0];
|
|
2116
|
-
if (videoRefElement && videoRefElement !== topOfStack) {
|
|
2117
|
-
log('adding video to stack', videoRefElement);
|
|
2118
|
-
videoRefStack.current.push(videoRefElement);
|
|
2119
|
-
}
|
|
2120
|
-
}, [videoRefElement]);
|
|
2121
|
-
var onVideoUnmounted = React.useCallback(function (videoElement) {
|
|
2122
|
-
log('removing video from stack', videoElement);
|
|
2123
|
-
videoRefStack.current = videoRefStack.current.filter(function (v) {
|
|
2124
|
-
return v !== videoElement;
|
|
2125
|
-
});
|
|
2126
|
-
videoRef.current = videoRefStack.current.slice(-1)[0]; // top of stack.
|
|
2127
|
-
log('new videoRef is', videoRef.current);
|
|
2128
|
-
}, []);
|
|
2129
|
-
React.useEffect(function resetCameraOnContinuityPreferenceChanged() {
|
|
2130
|
-
if (debugMode) {
|
|
2131
|
-
log('iphone continuity camera allowed changed', iphoneContinuityCameraAllowed);
|
|
2132
|
-
}
|
|
2133
|
-
releaseCameraAccess();
|
|
2134
|
-
cameraRef.current = null;
|
|
2135
|
-
setVideoLoaded(false);
|
|
2136
|
-
}, [debugMode, iphoneContinuityCameraAllowed]);
|
|
2137
|
-
// NOTE: the bound callback function here is called requestCameraAccess, because
|
|
2138
|
-
// it initiates the useEffect chain that results in camera access being requested
|
|
2139
|
-
// (requestCameraAccessAutomatically -> chooseFromAvailableCameras -> accessChosenCamera).
|
|
2140
|
-
//
|
|
2141
|
-
// We chose to title the inner function "chooseFromAvailableCameras" because
|
|
2142
|
-
// that's all it literally does -- the available cameras are enumerated, and then
|
|
2143
|
-
// the result is parsed to decide which one we like best, which is then passed to
|
|
2144
|
-
// setVideoDevice, which causes accessChosenCamera to trigger.
|
|
2145
|
-
//
|
|
2146
|
-
// I am not a huge fan of getUserMedia's design -- you need to call it twice in order
|
|
2147
|
-
// to select the "best" camera for your application's purposes.
|
|
2148
|
-
var requestCameraAccess = React.useCallback(function chooseFromAvailableCameras() {
|
|
2149
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2150
|
-
var availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, e_1;
|
|
2151
|
-
var _a, _b;
|
|
2152
|
-
return __generator(this, function (_c) {
|
|
2153
|
-
switch (_c.label) {
|
|
2154
|
-
case 0:
|
|
2155
|
-
setCameraReady(false);
|
|
2156
|
-
setCameraAccessDenied(false);
|
|
2157
|
-
_c.label = 1;
|
|
2158
|
-
case 1:
|
|
2159
|
-
_c.trys.push([1, 3,, 4]);
|
|
2160
|
-
return [4 /*yield*/, listAvailableCameras()];
|
|
2161
|
-
case 2:
|
|
2162
|
-
availableCameras = _c.sent();
|
|
2163
|
-
selectedCamera = void 0;
|
|
2164
|
-
if (debugMode) {
|
|
2165
|
-
log('availableCameras', availableCameras);
|
|
2166
|
-
}
|
|
2167
|
-
platform_1 = getPlatform();
|
|
2168
|
-
if (debugMode) {
|
|
2169
|
-
log('platformDetails', platform_1);
|
|
2170
|
-
}
|
|
2171
|
-
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
2172
|
-
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
2173
|
-
return labelMatches(deviceInfo, 'iphone');
|
|
2174
|
-
});
|
|
2175
|
-
setIphoneContinuityCameraAvailable(!!iphoneContinuityCamera);
|
|
2176
|
-
if (iphoneContinuityCamera && iphoneContinuityCameraAllowed) {
|
|
2177
|
-
selectedCamera = iphoneContinuityCamera;
|
|
2178
|
-
}
|
|
2179
|
-
} else if (((_a = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _a === void 0 ? void 0 : _a.family) === 'Android' || availableCameras.every(function (c) {
|
|
2180
|
-
return c.label.startsWith('camera2 ');
|
|
2181
|
-
})) {
|
|
2182
|
-
availableCameras = availableCameras.sort(function (a, b) {
|
|
2183
|
-
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
2184
|
-
});
|
|
2185
|
-
if (debugMode) {
|
|
2186
|
-
log('cameras have been sorted', availableCameras);
|
|
2187
|
-
}
|
|
2188
|
-
}
|
|
2189
|
-
if (preferFrontFacingCamera) {
|
|
2190
|
-
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2191
|
-
return labelMatches(deviceInfo, frontLabels);
|
|
2192
|
-
});
|
|
2193
|
-
}
|
|
2194
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2195
|
-
return labelMatches(deviceInfo, 'backtriplecamera');
|
|
2196
|
-
}));
|
|
2197
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2198
|
-
return labelMatches(deviceInfo, 'backdualcamera');
|
|
2199
|
-
}));
|
|
2200
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2201
|
-
return labelMatches(deviceInfo, rearLabels) && !labelMatches(deviceInfo, backUltraWideLabels);
|
|
2202
|
-
}));
|
|
2203
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2204
|
-
return labelMatches(deviceInfo, rearLabels);
|
|
2205
|
-
}));
|
|
2206
|
-
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
2207
|
-
if (!preferFrontFacingCamera && ((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'iOS' && availableCameras.length > 0) {
|
|
2208
|
-
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
2209
|
-
}
|
|
2210
|
-
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
2211
|
-
if (debugMode) log('selectedCamera', selectedCamera);
|
|
2212
|
-
setVideoDevice(selectedCamera);
|
|
2213
|
-
return [3 /*break*/, 4];
|
|
2214
|
-
case 3:
|
|
2215
|
-
e_1 = _c.sent();
|
|
2216
|
-
if (e_1.name === 'NotAllowedError') {
|
|
2217
|
-
error('camera access has been blocked by the user', e_1);
|
|
2218
|
-
setCameraAccessDenied(true);
|
|
2219
|
-
} else {
|
|
2220
|
-
error('camera access encountered some other error', e_1);
|
|
2221
|
-
throw e_1;
|
|
2222
|
-
}
|
|
2223
|
-
return [3 /*break*/, 4];
|
|
2224
|
-
case 4:
|
|
2225
|
-
return [2 /*return*/];
|
|
2226
|
-
}
|
|
2227
|
-
});
|
|
2228
|
-
});
|
|
2229
|
-
}, [debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
|
|
2230
|
-
React.useEffect(function requestCameraAccessAutomatically() {
|
|
2231
|
-
if (requestAccessAutomatically && !cameraAccessDenied) {
|
|
2232
|
-
requestCameraAccess()["catch"](error);
|
|
2233
|
-
}
|
|
2234
|
-
}, [cameraAccessDenied, requestAccessAutomatically, requestCameraAccess]);
|
|
2235
|
-
React.useEffect(function accessChosenCamera() {
|
|
2236
|
-
var _this = this;
|
|
2237
|
-
var _a;
|
|
2238
|
-
if (!videoDevice) return;
|
|
2239
|
-
var cleanup = function cleanup() {
|
|
2240
|
-
releaseCameraAccess();
|
|
2241
|
-
cameraRef.current = null;
|
|
2242
|
-
setVideoLoaded(false);
|
|
2243
|
-
};
|
|
2244
|
-
if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
|
|
2245
|
-
(function () {
|
|
2246
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
2247
|
-
var constraints, stream, e_2, handleStreamEnded;
|
|
2248
|
-
var _a;
|
|
2249
|
-
return __generator(this, function (_b) {
|
|
2250
|
-
switch (_b.label) {
|
|
2251
|
-
case 0:
|
|
2252
|
-
constraints = {
|
|
2253
|
-
audio: false,
|
|
2254
|
-
video: {
|
|
2255
|
-
deviceId: {
|
|
2256
|
-
exact: videoDevice.deviceId
|
|
2257
|
-
},
|
|
2258
|
-
width: {
|
|
2259
|
-
ideal: maxVideoWidth
|
|
2260
|
-
},
|
|
2261
|
-
aspectRatio: 1.777777778,
|
|
2262
|
-
frameRate: {}
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
if (maxFps) {
|
|
2266
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2267
|
-
// @ts-ignore
|
|
2268
|
-
constraints.video.frameRate = {
|
|
2269
|
-
max: maxFps
|
|
2270
|
-
};
|
|
2271
|
-
}
|
|
2272
|
-
stream = null;
|
|
2273
|
-
_b.label = 1;
|
|
2274
|
-
case 1:
|
|
2275
|
-
_b.trys.push([1, 3,, 4]);
|
|
2276
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
2277
|
-
case 2:
|
|
2278
|
-
stream = _b.sent();
|
|
2279
|
-
return [3 /*break*/, 4];
|
|
2280
|
-
case 3:
|
|
2281
|
-
e_2 = _b.sent();
|
|
2282
|
-
if (e_2.name === 'NotAllowedError') {
|
|
2283
|
-
if (iphoneContinuityCameraAllowed) {
|
|
2284
|
-
setIphoneContinuityCameraAvailable(false);
|
|
2285
|
-
setIphoneContinuityCameraDenied(true);
|
|
2286
|
-
} else {
|
|
2287
|
-
setCameraAccessDenied(true);
|
|
2288
|
-
}
|
|
2289
|
-
return [2 /*return*/];
|
|
2290
|
-
}
|
|
2291
|
-
return [3 /*break*/, 4];
|
|
2292
|
-
case 4:
|
|
2293
|
-
if (!!stream) return [3 /*break*/, 8];
|
|
2294
|
-
_b.label = 5;
|
|
2295
|
-
case 5:
|
|
2296
|
-
_b.trys.push([5, 7,, 8]);
|
|
2297
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
2298
|
-
audio: false,
|
|
2299
|
-
video: true
|
|
2300
|
-
})];
|
|
2301
|
-
case 6:
|
|
2302
|
-
stream = _b.sent();
|
|
2303
|
-
log('opened stream with no width and height constraints');
|
|
2304
|
-
return [3 /*break*/, 8];
|
|
2305
|
-
case 7:
|
|
2306
|
-
_b.sent();
|
|
2307
|
-
log('cannot open stream at all');
|
|
2308
|
-
return [3 /*break*/, 8];
|
|
2309
|
-
case 8:
|
|
2310
|
-
if (!stream) {
|
|
2311
|
-
throw new Error('failed to open camera');
|
|
2312
|
-
}
|
|
2313
|
-
handleStreamEnded = function handleStreamEnded() {
|
|
2314
|
-
if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
|
|
2315
|
-
log('someone unplugged the continuity camera');
|
|
2316
|
-
releaseCameraAccess();
|
|
2317
|
-
cameraRef.current = null;
|
|
2318
|
-
setIphoneContinuityCameraAvailable(false);
|
|
2319
|
-
setIphoneContinuityCameraDenied(true);
|
|
2320
|
-
setVideoDevice(null);
|
|
2321
|
-
} else {
|
|
2322
|
-
log('someone unplugged the webcam');
|
|
2323
|
-
releaseCameraAccess();
|
|
2324
|
-
cameraRef.current = null;
|
|
2325
|
-
setVideoLoaded(false);
|
|
2326
|
-
setCameraAccessDenied(true);
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
|
|
2330
|
-
stream.getVideoTracks().forEach(function (track) {
|
|
2331
|
-
track.onended = handleStreamEnded;
|
|
2332
|
-
});
|
|
2333
|
-
cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
|
|
2334
|
-
return [2 /*return*/];
|
|
2335
|
-
}
|
|
2336
|
-
});
|
|
2337
|
-
});
|
|
2338
|
-
})();
|
|
2339
|
-
return cleanup;
|
|
2340
|
-
}, [iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, maxFps, maxVideoWidth, videoDevice]);
|
|
2341
|
-
React.useEffect(function triggerCameraReady() {
|
|
2342
|
-
// TODO: in the future let's evaluate whether we can simplify this to just
|
|
2343
|
-
// setCameraReady(!!videoDevice && videoLoaded) -- we are wondering whether
|
|
2344
|
-
// we somehow depend on this being set twice.
|
|
2345
|
-
setCameraReady(false);
|
|
2346
|
-
if (videoDevice && videoLoaded) {
|
|
2347
|
-
setCameraReady(videoDevice && videoLoaded);
|
|
2348
|
-
}
|
|
2349
|
-
}, [videoLoaded, videoDevice]);
|
|
2350
|
-
var requestMicrophoneAccess = React.useCallback(function _requestMicrophoneAccess() {
|
|
2351
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2352
|
-
var stream;
|
|
2353
|
-
return __generator(this, function (_a) {
|
|
2354
|
-
switch (_a.label) {
|
|
2355
|
-
case 0:
|
|
2356
|
-
setMicrophoneReady(false);
|
|
2357
|
-
setMicrophoneAccessDenied(false);
|
|
2358
|
-
_a.label = 1;
|
|
2359
|
-
case 1:
|
|
2360
|
-
_a.trys.push([1, 3,, 4]);
|
|
2361
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
2362
|
-
audio: true,
|
|
2363
|
-
video: false
|
|
2364
|
-
})];
|
|
2365
|
-
case 2:
|
|
2366
|
-
stream = _a.sent();
|
|
2367
|
-
currentAudioStream = stream;
|
|
2368
|
-
setAudioStream(stream);
|
|
2369
|
-
setMicrophoneReady(true);
|
|
2370
|
-
stream.getAudioTracks().forEach(function (track) {
|
|
2371
|
-
track.onended = function () {
|
|
2372
|
-
setMicrophoneAccessDenied(true);
|
|
2373
|
-
};
|
|
2374
|
-
});
|
|
2375
|
-
return [3 /*break*/, 4];
|
|
2376
|
-
case 3:
|
|
2377
|
-
_a.sent();
|
|
2378
|
-
setMicrophoneAccessDenied(true);
|
|
2379
|
-
return [3 /*break*/, 4];
|
|
2380
|
-
case 4:
|
|
2381
|
-
return [2 /*return*/];
|
|
2382
|
-
}
|
|
2383
|
-
});
|
|
2384
|
-
});
|
|
2385
|
-
}, []);
|
|
2386
|
-
React.useEffect(function requestMicrophoneAccessIfNeeded() {
|
|
2387
|
-
if (!requireMicrophoneAccess || microphoneAccessDenied) return;
|
|
2388
|
-
requestMicrophoneAccess()["catch"](error);
|
|
2389
|
-
return function () {
|
|
2390
|
-
releaseMicrophoneAccess();
|
|
2391
|
-
setAudioStream(null);
|
|
2392
|
-
setMicrophoneReady(false);
|
|
2393
|
-
};
|
|
2394
|
-
}, [microphoneAccessDenied, requestMicrophoneAccess, requireMicrophoneAccess]);
|
|
2395
|
-
var takePhoto = React.useCallback(function _takePhoto() {
|
|
2396
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2397
|
-
var canvas;
|
|
2398
|
-
return __generator(this, function (_a) {
|
|
2399
|
-
switch (_a.label) {
|
|
2400
|
-
case 0:
|
|
2401
|
-
if (!cameraRef.current) return [2 /*return*/, null];
|
|
2402
|
-
if (!(typeof ImageCapture !== 'undefined')) return [3 /*break*/, 2];
|
|
2403
|
-
return [4 /*yield*/, new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto()];
|
|
2404
|
-
case 1:
|
|
2405
|
-
return [2 /*return*/, _a.sent()];
|
|
2406
|
-
case 2:
|
|
2407
|
-
if (!videoRef.current) return [2 /*return*/, null];
|
|
2408
|
-
canvas = document.createElement('canvas');
|
|
2409
|
-
drawToCanvas(canvas, videoRef.current);
|
|
2410
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
2411
|
-
return canvas.toBlob(resolve);
|
|
2412
|
-
})];
|
|
2413
|
-
}
|
|
2414
|
-
});
|
|
2415
|
-
});
|
|
2416
|
-
}, []);
|
|
2417
|
-
return React.useMemo(function () {
|
|
2418
|
-
return {
|
|
2419
|
-
videoRef: videoRef,
|
|
2420
|
-
videoDevice: videoDevice,
|
|
2421
|
-
videoLoaded: videoLoaded,
|
|
2422
|
-
setVideoLoaded: setVideoLoaded,
|
|
2423
|
-
onVideoUnmounted: onVideoUnmounted,
|
|
2424
|
-
cameraRef: cameraRef,
|
|
2425
|
-
cameraReady: cameraReady,
|
|
2426
|
-
cameraAccessDenied: cameraAccessDenied,
|
|
2427
|
-
requestCameraAccess: requestCameraAccess,
|
|
2428
|
-
releaseCameraAccess: releaseCameraAccess,
|
|
2429
|
-
iphoneContinuityCameraAvailable: iphoneContinuityCameraAvailable,
|
|
2430
|
-
iphoneContinuityCameraAllowed: iphoneContinuityCameraAllowed,
|
|
2431
|
-
setIphoneContinuityCameraAllowed: setIphoneContinuityCameraAllowed,
|
|
2432
|
-
takePhoto: takePhoto,
|
|
2433
|
-
audioStream: audioStream,
|
|
2434
|
-
microphoneReady: microphoneReady,
|
|
2435
|
-
microphoneAccessDenied: microphoneAccessDenied,
|
|
2436
|
-
requestMicrophoneAccess: requestMicrophoneAccess
|
|
2437
|
-
};
|
|
2438
|
-
}, [audioStream, cameraAccessDenied, cameraReady, iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, microphoneAccessDenied, microphoneReady, onVideoUnmounted, requestCameraAccess, requestMicrophoneAccess, takePhoto, videoDevice, videoLoaded]);
|
|
2439
|
-
}
|
|
2440
|
-
|
|
2441
|
-
var CameraStateContext = /*#__PURE__*/React.createContext({
|
|
2442
|
-
videoRef: {
|
|
2443
|
-
current: null
|
|
2444
|
-
},
|
|
2445
|
-
videoDevice: null,
|
|
2446
|
-
videoLoaded: false,
|
|
2447
|
-
cameraRef: {
|
|
2448
|
-
current: null
|
|
2449
|
-
},
|
|
2450
|
-
cameraReady: false,
|
|
2451
|
-
cameraAccessDenied: false,
|
|
2452
|
-
requestCameraAccess: function requestCameraAccess() {
|
|
2453
|
-
return null;
|
|
2454
|
-
},
|
|
2455
|
-
releaseCameraAccess: function releaseCameraAccess() {
|
|
2456
|
-
return null;
|
|
2457
|
-
},
|
|
2458
|
-
iphoneContinuityCameraAvailable: false,
|
|
2459
|
-
iphoneContinuityCameraAllowed: true,
|
|
2460
|
-
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed() {
|
|
2461
|
-
return null;
|
|
2462
|
-
},
|
|
2463
|
-
takePhoto: function takePhoto() {
|
|
2464
|
-
return Promise.resolve(null);
|
|
2465
|
-
},
|
|
2466
|
-
setVideoLoaded: function setVideoLoaded() {
|
|
2467
|
-
return null;
|
|
2468
|
-
},
|
|
2469
|
-
onVideoUnmounted: function onVideoUnmounted() {
|
|
2470
|
-
return null;
|
|
2471
|
-
},
|
|
2472
|
-
audioStream: null,
|
|
2473
|
-
microphoneReady: false,
|
|
2474
|
-
microphoneAccessDenied: false,
|
|
2475
|
-
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
2476
|
-
return null;
|
|
2477
|
-
}
|
|
2478
|
-
});
|
|
2479
|
-
var CameraProvider = function CameraProvider(_a) {
|
|
2480
|
-
var children = _a.children,
|
|
2481
|
-
_b = _a.requestAccessAutomatically,
|
|
2482
|
-
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
2483
|
-
_c = _a.preferFrontFacingCamera,
|
|
2484
|
-
preferFrontFacingCamera = _c === void 0 ? false : _c,
|
|
2485
|
-
_d = _a.preferContinuityCamera,
|
|
2486
|
-
preferContinuityCamera = _d === void 0 ? true : _d,
|
|
2487
|
-
_e = _a.requireMicrophoneAccess,
|
|
2488
|
-
requireMicrophoneAccess = _e === void 0 ? false : _e,
|
|
2489
|
-
_f = _a.maxVideoWidth,
|
|
2490
|
-
maxVideoWidth = _f === void 0 ? 1920 : _f,
|
|
2491
|
-
maxFps = _a.maxFps,
|
|
2492
|
-
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
2493
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
2494
|
-
_g = _a.debugMode,
|
|
2495
|
-
debugMode = _g === void 0 ? false : _g;
|
|
2496
|
-
var captureDevice = usePreferredCaptureDevice({
|
|
2497
|
-
requestAccessAutomatically: requestAccessAutomatically,
|
|
2498
|
-
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
2499
|
-
preferContinuityCamera: preferContinuityCamera,
|
|
2500
|
-
requireMicrophoneAccess: requireMicrophoneAccess,
|
|
2501
|
-
maxVideoWidth: maxVideoWidth,
|
|
2502
|
-
maxFps: maxFps,
|
|
2503
|
-
debugMode: debugMode
|
|
2504
|
-
});
|
|
2505
|
-
React.useEffect(function () {
|
|
2506
|
-
if (captureDevice.cameraAccessDenied) onCameraAccessDenied === null || onCameraAccessDenied === void 0 ? void 0 : onCameraAccessDenied();
|
|
2507
|
-
}, [captureDevice.cameraAccessDenied, onCameraAccessDenied]);
|
|
2508
|
-
React.useEffect(function () {
|
|
2509
|
-
if (captureDevice.microphoneAccessDenied) onMicrophoneAccessDenied === null || onMicrophoneAccessDenied === void 0 ? void 0 : onMicrophoneAccessDenied();
|
|
2510
|
-
}, [captureDevice.microphoneAccessDenied, onMicrophoneAccessDenied]);
|
|
2511
|
-
var releaseCameraAccess = captureDevice.releaseCameraAccess;
|
|
2512
|
-
React.useEffect(function () {
|
|
2513
|
-
return function () {
|
|
2514
|
-
releaseCameraAccess();
|
|
2515
|
-
};
|
|
2516
|
-
}, [releaseCameraAccess]);
|
|
2517
|
-
return /*#__PURE__*/React__namespace.default.createElement(CameraStateContext.Provider, {
|
|
2518
|
-
value: captureDevice
|
|
2519
|
-
}, children);
|
|
2520
|
-
};
|
|
2521
|
-
|
|
2522
1922
|
var visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
|
|
2523
1923
|
var visionRuntimePreloading = false;
|
|
2524
1924
|
function preloadVisionRuntime() {
|
|
@@ -2561,6 +1961,42 @@ function preloadVisionRuntime() {
|
|
|
2561
1961
|
});
|
|
2562
1962
|
}
|
|
2563
1963
|
|
|
1964
|
+
function getFrameDimensions(frame) {
|
|
1965
|
+
var frameWidth = frame.width,
|
|
1966
|
+
frameHeight = frame.height;
|
|
1967
|
+
if (frame instanceof HTMLImageElement) {
|
|
1968
|
+
frameWidth = frame.naturalWidth;
|
|
1969
|
+
frameHeight = frame.naturalHeight;
|
|
1970
|
+
}
|
|
1971
|
+
if (frame instanceof HTMLVideoElement) {
|
|
1972
|
+
frameWidth = frame.videoWidth;
|
|
1973
|
+
frameHeight = frame.videoHeight;
|
|
1974
|
+
}
|
|
1975
|
+
return [frameWidth, frameHeight];
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
1979
|
+
function drawToCanvas(canvas, frame, width, height) {
|
|
1980
|
+
if (!canvas) return;
|
|
1981
|
+
var ctx = canvas.getContext('2d');
|
|
1982
|
+
if (!ctx) return;
|
|
1983
|
+
if (!width || !height) {
|
|
1984
|
+
var _a = getFrameDimensions(frame),
|
|
1985
|
+
frameWidth = _a[0],
|
|
1986
|
+
frameHeight = _a[1];
|
|
1987
|
+
width || (width = frameWidth);
|
|
1988
|
+
height || (height = frameHeight);
|
|
1989
|
+
}
|
|
1990
|
+
canvas.width = width;
|
|
1991
|
+
canvas.height = height;
|
|
1992
|
+
ctx.drawImage(frame, 0, 0, width, height);
|
|
1993
|
+
}
|
|
1994
|
+
function clearCanvas(canvas) {
|
|
1995
|
+
var _a;
|
|
1996
|
+
(_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
|
|
1997
|
+
}
|
|
1998
|
+
var templateObject_1$G;
|
|
1999
|
+
|
|
2564
2000
|
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
2565
2001
|
if (quality === void 0) {
|
|
2566
2002
|
quality = 0.92;
|
|
@@ -2864,7 +2300,8 @@ function useLoadFocusModel(_a) {
|
|
|
2864
2300
|
modelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
2865
2301
|
_c = _a.modelLoadTimeoutMs,
|
|
2866
2302
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
2867
|
-
onModelError = _a.onModelError
|
|
2303
|
+
onModelError = _a.onModelError,
|
|
2304
|
+
videoRef = _a.videoRef;
|
|
2868
2305
|
var _d = React.useState(false),
|
|
2869
2306
|
ready = _d[0],
|
|
2870
2307
|
setReady = _d[1];
|
|
@@ -2874,7 +2311,6 @@ function useLoadFocusModel(_a) {
|
|
|
2874
2311
|
var _f = React.useState(null),
|
|
2875
2312
|
modelError = _f[0],
|
|
2876
2313
|
setModelError = _f[1];
|
|
2877
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
2878
2314
|
React.useEffect(function loadModel() {
|
|
2879
2315
|
var _this = this;
|
|
2880
2316
|
setReady(false);
|
|
@@ -3012,7 +2448,8 @@ function closeFaceDetector() {
|
|
|
3012
2448
|
function useLoadFaceDetector(_a) {
|
|
3013
2449
|
var onModelError = _a.onModelError,
|
|
3014
2450
|
_b = _a.modelLoadTimeoutMs,
|
|
3015
|
-
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b
|
|
2451
|
+
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
|
|
2452
|
+
videoRef = _a.videoRef;
|
|
3016
2453
|
var _c = React.useState(false),
|
|
3017
2454
|
ready = _c[0],
|
|
3018
2455
|
setReady = _c[1];
|
|
@@ -3022,7 +2459,6 @@ function useLoadFaceDetector(_a) {
|
|
|
3022
2459
|
var _e = React.useState(null),
|
|
3023
2460
|
modelError = _e[0],
|
|
3024
2461
|
setModelError = _e[1];
|
|
3025
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
3026
2462
|
React.useEffect(function loadModel() {
|
|
3027
2463
|
var _this = this;
|
|
3028
2464
|
setReady(false);
|
|
@@ -3503,7 +2939,8 @@ function useLoadDocumentDetector(_a) {
|
|
|
3503
2939
|
modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
|
|
3504
2940
|
_d = _a.scoreThreshold,
|
|
3505
2941
|
scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
|
|
3506
|
-
onModelError = _a.onModelError
|
|
2942
|
+
onModelError = _a.onModelError,
|
|
2943
|
+
videoRef = _a.videoRef;
|
|
3507
2944
|
var _e = React.useState(false),
|
|
3508
2945
|
ready = _e[0],
|
|
3509
2946
|
setReady = _e[1];
|
|
@@ -3513,7 +2950,6 @@ function useLoadDocumentDetector(_a) {
|
|
|
3513
2950
|
var _g = React.useState(null),
|
|
3514
2951
|
modelError = _g[0],
|
|
3515
2952
|
setModelError = _g[1];
|
|
3516
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
3517
2953
|
React.useEffect(function loadModel() {
|
|
3518
2954
|
var _this = this;
|
|
3519
2955
|
setReady(false);
|
|
@@ -3749,77 +3185,541 @@ function applyNonMaxSuppression(detectedObjects, isGoodBox) {
|
|
|
3749
3185
|
if (obj.score > maxes[obj.label][0] && (isGoodBox === null || isGoodBox === void 0 ? void 0 : isGoodBox(obj))) maxes[obj.label] = [obj.score, i];
|
|
3750
3186
|
}
|
|
3751
3187
|
});
|
|
3752
|
-
return Object.keys(maxes).map(function (label) {
|
|
3753
|
-
return detectedObjects[maxes[label][1]];
|
|
3754
|
-
}).filter(function (obj) {
|
|
3755
|
-
return !!obj;
|
|
3188
|
+
return Object.keys(maxes).map(function (label) {
|
|
3189
|
+
return detectedObjects[maxes[label][1]];
|
|
3190
|
+
}).filter(function (obj) {
|
|
3191
|
+
return !!obj;
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
|
|
3195
|
+
function useFrameLoop(fn, _a) {
|
|
3196
|
+
var _b = _a.throttleMs,
|
|
3197
|
+
throttleMs = _b === void 0 ? 0 : _b,
|
|
3198
|
+
_c = _a.autoStart,
|
|
3199
|
+
autoStart = _c === void 0 ? false : _c;
|
|
3200
|
+
var _d = React.useState(false),
|
|
3201
|
+
running = _d[0],
|
|
3202
|
+
setRunning = _d[1];
|
|
3203
|
+
var startedAtRef = React.useRef(null);
|
|
3204
|
+
var loopId = React.useRef(0);
|
|
3205
|
+
var frameId = React.useRef(0);
|
|
3206
|
+
React.useEffect(function runFrameLoop() {
|
|
3207
|
+
if (!running) return;
|
|
3208
|
+
var timer;
|
|
3209
|
+
var currentLoopId = loopId.current;
|
|
3210
|
+
function renderPrediction() {
|
|
3211
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3212
|
+
var start, timeRunning, took, amountToThrottle;
|
|
3213
|
+
var _a, _b;
|
|
3214
|
+
return __generator(this, function (_c) {
|
|
3215
|
+
switch (_c.label) {
|
|
3216
|
+
case 0:
|
|
3217
|
+
if (currentLoopId !== loopId.current) return [2 /*return*/];
|
|
3218
|
+
start = new Date().getTime();
|
|
3219
|
+
timeRunning = start - ((_b = (_a = startedAtRef.current) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0);
|
|
3220
|
+
return [4 /*yield*/, fn(frameId.current, timeRunning)];
|
|
3221
|
+
case 1:
|
|
3222
|
+
_c.sent();
|
|
3223
|
+
took = new Date().getTime() - start;
|
|
3224
|
+
amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
|
|
3225
|
+
timer = setTimeout(function () {
|
|
3226
|
+
frameId.current = requestAnimationFrame(renderPrediction);
|
|
3227
|
+
}, amountToThrottle);
|
|
3228
|
+
return [2 /*return*/];
|
|
3229
|
+
}
|
|
3230
|
+
});
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
renderPrediction().then();
|
|
3234
|
+
return function () {
|
|
3235
|
+
loopId.current += 1;
|
|
3236
|
+
frameId.current && cancelAnimationFrame(frameId.current);
|
|
3237
|
+
timer && clearTimeout(timer);
|
|
3238
|
+
};
|
|
3239
|
+
}, [fn, running, throttleMs]);
|
|
3240
|
+
var start = React.useCallback(function () {
|
|
3241
|
+
startedAtRef.current = new Date();
|
|
3242
|
+
setRunning(true);
|
|
3243
|
+
}, []);
|
|
3244
|
+
var stop = React.useCallback(function () {
|
|
3245
|
+
loopId.current += 1; // force the loop to stop immediately.
|
|
3246
|
+
setRunning(false);
|
|
3247
|
+
startedAtRef.current = null;
|
|
3248
|
+
}, []);
|
|
3249
|
+
React.useEffect(function startAutomatically() {
|
|
3250
|
+
if (autoStart) start();
|
|
3251
|
+
return function () {
|
|
3252
|
+
stop();
|
|
3253
|
+
};
|
|
3254
|
+
}, [autoStart, start, stop]);
|
|
3255
|
+
return {
|
|
3256
|
+
start: start,
|
|
3257
|
+
stop: stop
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
function listAvailableCameras(facingMode_1) {
|
|
3262
|
+
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
3263
|
+
var cameraEnumerationStream, videoDevices;
|
|
3264
|
+
if (requestMicAccess === void 0) {
|
|
3265
|
+
requestMicAccess = false;
|
|
3266
|
+
}
|
|
3267
|
+
return __generator(this, function (_a) {
|
|
3268
|
+
switch (_a.label) {
|
|
3269
|
+
case 0:
|
|
3270
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3271
|
+
video: {
|
|
3272
|
+
facingMode: {
|
|
3273
|
+
exact: facingMode
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3276
|
+
audio: requestMicAccess
|
|
3277
|
+
})
|
|
3278
|
+
// This lists all available cameras attached to the user's device.
|
|
3279
|
+
];
|
|
3280
|
+
case 1:
|
|
3281
|
+
cameraEnumerationStream = _a.sent();
|
|
3282
|
+
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
3283
|
+
case 2:
|
|
3284
|
+
videoDevices = _a.sent().filter(function (_a) {
|
|
3285
|
+
var kind = _a.kind;
|
|
3286
|
+
return kind === 'videoinput';
|
|
3287
|
+
});
|
|
3288
|
+
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
3289
|
+
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
3290
|
+
track.enabled = false;
|
|
3291
|
+
track.stop();
|
|
3292
|
+
});
|
|
3293
|
+
cameraEnumerationStream = null;
|
|
3294
|
+
return [2 /*return*/, videoDevices];
|
|
3295
|
+
}
|
|
3296
|
+
});
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
var frontCameraLabels = ['front', 'avant', 'anteriore', 'cameraaanvoorzijde', 'kamerapåframsidan', 'forsidekamera', 'kamerapåforsiden', 'aparatprzedni', 'etukamera', 'kameradepan', 'ÖnKamera', 'cameramặttrước', 'camerăfață', 'prednákamera', 'prednjakamera', 'előlapikamera', 'přednífotoaparát', 'μπροστινήκάμερα', 'переднякамера', 'передняякамера', 'преднакамера', 'алдыңғыкамера', 'מצלמה קדמית', 'الكاميرا الأمامية', 'फ़्रंटकैमरा', '前置相机', '前置鏡頭', '前面カメラ', '전면카메라', 'กล้องด้านหน้า'].map(function (s) {
|
|
3300
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3301
|
+
});
|
|
3302
|
+
var rearCameraLabels = ['back', 'rear', 'posterior', 'trasera', 'traseira', 'arrière', 'rückkamera', 'fotocamera(posteriore)', 'cameraaanachterzijde', 'kamerapåbaksidan', 'kamerapåbaksiden', 'bagsidekamera', 'aparattylny', 'takakamera', 'arkakamera', 'kamerabelakang', 'cameramặtsau', 'camerăspate', 'stražnjakamera', 'zadnákamera', 'hátoldalikamera', 'zadnífotoaparát', 'πίσωκάμερα', 'заднякамера', 'Задняякамера', 'заднакамера', 'артқыкамера', 'מצלמה אחורית', 'الكاميرا الخلفية', 'बैककैमरा', '后置相机', '後置鏡頭', '背面カメラ', '후면카메라', 'กล้องด้านหลัง'].map(function (s) {
|
|
3303
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3304
|
+
});
|
|
3305
|
+
var backUltraWideCameraLabels = ['backdualwidecamera', 'backultrawidecamera', 'ultraampliaposterior', 'ultra-angulartraseira', 'ultragrandeangulartraseira', 'ultragrandangle', 'ultragranangular', 'ultra-weitwinkelkamera', 'ultra-grandangolo', 'ultrabredecameraaanachterzijde', 'ultravidvinkelkamerapåbaksidan', 'ultravidvinkelkameraetpåbagsiden', 'ultravidvinkelkamerabak', 'ultragenişkameraarkayüzü', 'ultralaajakulmainentakakamera', 'tylnyaparatultraszerokokątny', 'cameracựcrộngmặtsau', 'camerăcuobiectivultra‑superangularspate', 'ultraszéleslátószögűkamera', 'kameraultralebarbelakang', 'stražnjaultraširokakamera', 'zadníultraširokoúhlýfotoaparát', 'ultraširokouhlá', 'πίσωυπερευρείακάμερα', 'заднянадширококутнакамера', 'Задняясверхширокоугольнаякамера', 'Задна свръх широкоъгълна камера', 'артқыультракеңбұрыштыкамера', 'מצלמה אולטרה רחבה אחורית', 'كاميرا خلفية عريضة جدًا', 'बैकअल्ट्रावाइडकैमरा', '后置超广角相机', '後置超廣角鏡頭相機', '背面超広角カメラ', '후면울트라와이드카메라', 'กล้องด้านหลังอัลตร้าไวด์'].map(function (s) {
|
|
3306
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3307
|
+
});
|
|
3308
|
+
var cameraLabelMatches = function cameraLabelMatches(labelOrDevice, labelSetOrLabel) {
|
|
3309
|
+
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
3310
|
+
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
3311
|
+
return labelSet.some(function (l) {
|
|
3312
|
+
return label.includes(l);
|
|
3313
|
+
});
|
|
3314
|
+
};
|
|
3315
|
+
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
3316
|
+
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
3317
|
+
};
|
|
3318
|
+
var currentCamera;
|
|
3319
|
+
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
3320
|
+
releaseCameraAccess();
|
|
3321
|
+
log('obtaining camera access...');
|
|
3322
|
+
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
3323
|
+
width = _a.width,
|
|
3324
|
+
height = _a.height;
|
|
3325
|
+
log('camera dimensions', width, height);
|
|
3326
|
+
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
3327
|
+
log('camera label', label);
|
|
3328
|
+
var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
|
|
3329
|
+
log('is rear facing?', isRearFacing);
|
|
3330
|
+
var release = function release() {
|
|
3331
|
+
stream.getTracks().forEach(function (track) {
|
|
3332
|
+
track.enabled = false;
|
|
3333
|
+
track.stop();
|
|
3334
|
+
});
|
|
3335
|
+
if (video) {
|
|
3336
|
+
video.pause();
|
|
3337
|
+
video.srcObject = null;
|
|
3338
|
+
video.src = '';
|
|
3339
|
+
}
|
|
3340
|
+
};
|
|
3341
|
+
width || (width = 0);
|
|
3342
|
+
height || (height = 0);
|
|
3343
|
+
currentCamera = {
|
|
3344
|
+
label: deviceLabel,
|
|
3345
|
+
stream: stream,
|
|
3346
|
+
width: width,
|
|
3347
|
+
height: height,
|
|
3348
|
+
isRearFacing: isRearFacing,
|
|
3349
|
+
release: release
|
|
3350
|
+
};
|
|
3351
|
+
log('camera access granted');
|
|
3352
|
+
if (video) video.srcObject = stream;
|
|
3353
|
+
log('video source initialized');
|
|
3354
|
+
return currentCamera;
|
|
3355
|
+
}
|
|
3356
|
+
function releaseCameraAccess() {
|
|
3357
|
+
if (!currentCamera) return;
|
|
3358
|
+
log('releasing camera access...');
|
|
3359
|
+
currentCamera.release();
|
|
3360
|
+
currentCamera = undefined;
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
var initialState$5 = {
|
|
3364
|
+
videoRef: {
|
|
3365
|
+
current: null
|
|
3366
|
+
},
|
|
3367
|
+
videoLoaded: false,
|
|
3368
|
+
videoStream: null,
|
|
3369
|
+
videoDevice: null,
|
|
3370
|
+
isRearFacing: false,
|
|
3371
|
+
camera: null,
|
|
3372
|
+
cameraReady: false,
|
|
3373
|
+
cameraAccessDenied: false,
|
|
3374
|
+
iphoneContinuityCameraAvailable: false,
|
|
3375
|
+
iphoneContinuityCameraDenied: false,
|
|
3376
|
+
preferIphoneContinuityCamera: true,
|
|
3377
|
+
audioStream: null,
|
|
3378
|
+
microphoneReady: false,
|
|
3379
|
+
microphoneAccessDenied: false
|
|
3380
|
+
};
|
|
3381
|
+
var createCameraStore = function createCameraStore(config) {
|
|
3382
|
+
var store = zustand.createStore(function (set, get) {
|
|
3383
|
+
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
3384
|
+
reset: function reset() {
|
|
3385
|
+
return set(_assign(_assign({}, initialState$5), config));
|
|
3386
|
+
},
|
|
3387
|
+
setConfig: function setConfig(config) {
|
|
3388
|
+
return set(config);
|
|
3389
|
+
},
|
|
3390
|
+
onVideoMounted: function onVideoMounted() {
|
|
3391
|
+
return set({
|
|
3392
|
+
videoLoaded: true
|
|
3393
|
+
});
|
|
3394
|
+
},
|
|
3395
|
+
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
3396
|
+
return set({
|
|
3397
|
+
preferIphoneContinuityCamera: value
|
|
3398
|
+
});
|
|
3399
|
+
},
|
|
3400
|
+
requestCameraAccess: function requestCameraAccess() {
|
|
3401
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3402
|
+
var _a, releaseCameraAccess, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded_1, camera, e_3;
|
|
3403
|
+
var _b, _c, _d;
|
|
3404
|
+
return __generator(this, function (_e) {
|
|
3405
|
+
switch (_e.label) {
|
|
3406
|
+
case 0:
|
|
3407
|
+
_a = get(), releaseCameraAccess = _a.releaseCameraAccess, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
3408
|
+
releaseCameraAccess();
|
|
3409
|
+
_e.label = 1;
|
|
3410
|
+
case 1:
|
|
3411
|
+
_e.trys.push([1, 11,, 12]);
|
|
3412
|
+
return [4 /*yield*/, listAvailableCameras()];
|
|
3413
|
+
case 2:
|
|
3414
|
+
availableCameras = _e.sent();
|
|
3415
|
+
selectedCamera = void 0;
|
|
3416
|
+
debug('availableCameras', availableCameras);
|
|
3417
|
+
platform_1 = getPlatform();
|
|
3418
|
+
debug('platformDetails', platform_1);
|
|
3419
|
+
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
3420
|
+
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
3421
|
+
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
3422
|
+
});
|
|
3423
|
+
set({
|
|
3424
|
+
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
3425
|
+
});
|
|
3426
|
+
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
3427
|
+
selectedCamera = iphoneContinuityCamera;
|
|
3428
|
+
}
|
|
3429
|
+
} else if (((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'Android' || availableCameras.every(function (c) {
|
|
3430
|
+
return c.label.startsWith('camera2 ');
|
|
3431
|
+
})) {
|
|
3432
|
+
availableCameras = availableCameras.sort(function (a, b) {
|
|
3433
|
+
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
3434
|
+
});
|
|
3435
|
+
debug('cameras have been sorted', availableCameras);
|
|
3436
|
+
}
|
|
3437
|
+
if (config.preferFrontFacingCamera) {
|
|
3438
|
+
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3439
|
+
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
3440
|
+
});
|
|
3441
|
+
}
|
|
3442
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3443
|
+
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
3444
|
+
}));
|
|
3445
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3446
|
+
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
3447
|
+
}));
|
|
3448
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3449
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
3450
|
+
}));
|
|
3451
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3452
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
3453
|
+
}));
|
|
3454
|
+
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
3455
|
+
if (!config.preferFrontFacingCamera && ((_c = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _c === void 0 ? void 0 : _c.family) === 'iOS' && availableCameras.length > 0) {
|
|
3456
|
+
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
3457
|
+
}
|
|
3458
|
+
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
3459
|
+
debug('selectedCamera', selectedCamera);
|
|
3460
|
+
set({
|
|
3461
|
+
videoDevice: selectedCamera
|
|
3462
|
+
});
|
|
3463
|
+
constraints = {
|
|
3464
|
+
audio: false,
|
|
3465
|
+
video: {
|
|
3466
|
+
deviceId: {
|
|
3467
|
+
exact: selectedCamera.deviceId
|
|
3468
|
+
},
|
|
3469
|
+
width: {
|
|
3470
|
+
ideal: config.maxVideoWidth
|
|
3471
|
+
},
|
|
3472
|
+
aspectRatio: 1.777777778,
|
|
3473
|
+
frameRate: {}
|
|
3474
|
+
}
|
|
3475
|
+
};
|
|
3476
|
+
if (config.maxFps) {
|
|
3477
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3478
|
+
// @ts-ignore
|
|
3479
|
+
constraints.video.frameRate = {
|
|
3480
|
+
max: config.maxFps
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
stream = null;
|
|
3484
|
+
_e.label = 3;
|
|
3485
|
+
case 3:
|
|
3486
|
+
_e.trys.push([3, 5,, 6]);
|
|
3487
|
+
debug('obtaining camera access with constraints', constraints);
|
|
3488
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
3489
|
+
case 4:
|
|
3490
|
+
stream = _e.sent();
|
|
3491
|
+
return [3 /*break*/, 6];
|
|
3492
|
+
case 5:
|
|
3493
|
+
e_1 = _e.sent();
|
|
3494
|
+
if (e_1.name === 'NotAllowedError') {
|
|
3495
|
+
if (preferIphoneContinuityCamera) {
|
|
3496
|
+
set({
|
|
3497
|
+
iphoneContinuityCameraAvailable: false,
|
|
3498
|
+
iphoneContinuityCameraDenied: true
|
|
3499
|
+
});
|
|
3500
|
+
} else {
|
|
3501
|
+
set({
|
|
3502
|
+
cameraAccessDenied: true
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
return [2 /*return*/];
|
|
3506
|
+
}
|
|
3507
|
+
return [3 /*break*/, 6];
|
|
3508
|
+
case 6:
|
|
3509
|
+
if (!!stream) return [3 /*break*/, 10];
|
|
3510
|
+
_e.label = 7;
|
|
3511
|
+
case 7:
|
|
3512
|
+
_e.trys.push([7, 9,, 10]);
|
|
3513
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3514
|
+
audio: false,
|
|
3515
|
+
video: true
|
|
3516
|
+
})];
|
|
3517
|
+
case 8:
|
|
3518
|
+
stream = _e.sent();
|
|
3519
|
+
debug('opened stream with no width and height constraints');
|
|
3520
|
+
return [3 /*break*/, 10];
|
|
3521
|
+
case 9:
|
|
3522
|
+
_e.sent();
|
|
3523
|
+
debug('cannot open stream at all');
|
|
3524
|
+
return [3 /*break*/, 10];
|
|
3525
|
+
case 10:
|
|
3526
|
+
if (!stream) {
|
|
3527
|
+
error('failed to open camera');
|
|
3528
|
+
throw new Error('failed to open camera');
|
|
3529
|
+
}
|
|
3530
|
+
debug('camera access granted with constraints', constraints);
|
|
3531
|
+
iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
|
|
3532
|
+
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
3533
|
+
if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
|
|
3534
|
+
debug('someone unplugged the continuity camera');
|
|
3535
|
+
releaseCameraAccess();
|
|
3536
|
+
set({
|
|
3537
|
+
videoStream: null,
|
|
3538
|
+
videoDevice: null,
|
|
3539
|
+
iphoneContinuityCameraAvailable: false,
|
|
3540
|
+
iphoneContinuityCameraDenied: true
|
|
3541
|
+
});
|
|
3542
|
+
} else {
|
|
3543
|
+
debug('someone unplugged the webcam');
|
|
3544
|
+
releaseCameraAccess();
|
|
3545
|
+
set({
|
|
3546
|
+
videoStream: null,
|
|
3547
|
+
videoDevice: null,
|
|
3548
|
+
videoLoaded: false,
|
|
3549
|
+
cameraAccessDenied: true
|
|
3550
|
+
});
|
|
3551
|
+
}
|
|
3552
|
+
};
|
|
3553
|
+
(_d = config.videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
3554
|
+
stream.getVideoTracks().forEach(function (track) {
|
|
3555
|
+
track.onended = handleStreamEnded_1;
|
|
3556
|
+
});
|
|
3557
|
+
camera = obtainCameraAccess(stream, selectedCamera.label, config.videoRef.current);
|
|
3558
|
+
set({
|
|
3559
|
+
camera: camera,
|
|
3560
|
+
cameraReady: true,
|
|
3561
|
+
isRearFacing: camera.isRearFacing,
|
|
3562
|
+
videoStream: stream
|
|
3563
|
+
});
|
|
3564
|
+
return [3 /*break*/, 12];
|
|
3565
|
+
case 11:
|
|
3566
|
+
e_3 = _e.sent();
|
|
3567
|
+
if (e_3.name === 'NotAllowedError') {
|
|
3568
|
+
error('camera access has been blocked by the user', e_3);
|
|
3569
|
+
set({
|
|
3570
|
+
cameraAccessDenied: true
|
|
3571
|
+
});
|
|
3572
|
+
} else {
|
|
3573
|
+
error('camera access encountered some other error', e_3);
|
|
3574
|
+
throw e_3;
|
|
3575
|
+
}
|
|
3576
|
+
return [3 /*break*/, 12];
|
|
3577
|
+
case 12:
|
|
3578
|
+
return [2 /*return*/];
|
|
3579
|
+
}
|
|
3580
|
+
});
|
|
3581
|
+
});
|
|
3582
|
+
},
|
|
3583
|
+
releaseCameraAccess: function releaseCameraAccess() {
|
|
3584
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3585
|
+
var camera;
|
|
3586
|
+
return __generator(this, function (_a) {
|
|
3587
|
+
camera = get().camera;
|
|
3588
|
+
if (!camera) return [2 /*return*/];
|
|
3589
|
+
camera.release();
|
|
3590
|
+
set({
|
|
3591
|
+
camera: null,
|
|
3592
|
+
cameraReady: false,
|
|
3593
|
+
cameraAccessDenied: false
|
|
3594
|
+
});
|
|
3595
|
+
return [2 /*return*/];
|
|
3596
|
+
});
|
|
3597
|
+
});
|
|
3598
|
+
},
|
|
3599
|
+
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
3600
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3601
|
+
var stream;
|
|
3602
|
+
return __generator(this, function (_a) {
|
|
3603
|
+
switch (_a.label) {
|
|
3604
|
+
case 0:
|
|
3605
|
+
get().releaseMicrophoneAccess();
|
|
3606
|
+
_a.label = 1;
|
|
3607
|
+
case 1:
|
|
3608
|
+
_a.trys.push([1, 3,, 4]);
|
|
3609
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3610
|
+
audio: true,
|
|
3611
|
+
video: false
|
|
3612
|
+
})];
|
|
3613
|
+
case 2:
|
|
3614
|
+
stream = _a.sent();
|
|
3615
|
+
set({
|
|
3616
|
+
audioStream: stream,
|
|
3617
|
+
microphoneReady: true
|
|
3618
|
+
});
|
|
3619
|
+
stream.getAudioTracks().forEach(function (track) {
|
|
3620
|
+
track.onended = function () {
|
|
3621
|
+
set({
|
|
3622
|
+
microphoneAccessDenied: true
|
|
3623
|
+
});
|
|
3624
|
+
};
|
|
3625
|
+
});
|
|
3626
|
+
return [3 /*break*/, 4];
|
|
3627
|
+
case 3:
|
|
3628
|
+
_a.sent();
|
|
3629
|
+
set({
|
|
3630
|
+
microphoneAccessDenied: true
|
|
3631
|
+
});
|
|
3632
|
+
return [3 /*break*/, 4];
|
|
3633
|
+
case 4:
|
|
3634
|
+
return [2 /*return*/];
|
|
3635
|
+
}
|
|
3636
|
+
});
|
|
3637
|
+
});
|
|
3638
|
+
},
|
|
3639
|
+
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
3640
|
+
var _a;
|
|
3641
|
+
var audioStream = get().audioStream;
|
|
3642
|
+
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
3643
|
+
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
3644
|
+
var _a;
|
|
3645
|
+
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
3646
|
+
});
|
|
3647
|
+
set({
|
|
3648
|
+
audioStream: null,
|
|
3649
|
+
microphoneReady: false,
|
|
3650
|
+
microphoneAccessDenied: false
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3654
|
+
});
|
|
3655
|
+
if (config.requestAccessAutomatically) {
|
|
3656
|
+
store.getState().requestCameraAccess();
|
|
3657
|
+
}
|
|
3658
|
+
if (config.requireMicrophoneAccess) {
|
|
3659
|
+
store.getState().requestMicrophoneAccess();
|
|
3660
|
+
}
|
|
3661
|
+
return _assign(_assign({}, store), {
|
|
3662
|
+
destroy: function destroy() {
|
|
3663
|
+
store.getState().releaseCameraAccess();
|
|
3664
|
+
store.getState().releaseMicrophoneAccess();
|
|
3665
|
+
}
|
|
3756
3666
|
});
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
|
-
function
|
|
3760
|
-
var
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3667
|
+
};
|
|
3668
|
+
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
3669
|
+
function CameraStoreProvider(_a) {
|
|
3670
|
+
var children = _a.children,
|
|
3671
|
+
_b = _a.requestAccessAutomatically,
|
|
3672
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
3673
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
3674
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
3675
|
+
_d = _a.preferFrontFacingCamera,
|
|
3676
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
3677
|
+
_e = _a.maxVideoWidth,
|
|
3678
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
3679
|
+
maxFps = _a.maxFps,
|
|
3680
|
+
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
3681
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
3682
|
+
_f = _a.requireMicrophoneAccess,
|
|
3683
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f;
|
|
3684
|
+
var videoRef = React.useRef(null);
|
|
3685
|
+
var store = React.useRef();
|
|
3686
|
+
store.current || (store.current = createCameraStore({
|
|
3687
|
+
videoRef: videoRef,
|
|
3688
|
+
requestAccessAutomatically: requestAccessAutomatically,
|
|
3689
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3690
|
+
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
3691
|
+
maxVideoWidth: maxVideoWidth,
|
|
3692
|
+
maxFps: maxFps,
|
|
3693
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
3694
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
3695
|
+
requireMicrophoneAccess: requireMicrophoneAccess
|
|
3696
|
+
}));
|
|
3697
|
+
React.useEffect(function () {
|
|
3698
|
+
var _a, _b, _c;
|
|
3699
|
+
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
3700
|
+
if (!state) return;
|
|
3701
|
+
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
3702
|
+
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
3703
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3704
|
+
preferFrontFacingCamera: preferFrontFacingCamera
|
|
3795
3705
|
});
|
|
3706
|
+
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
3796
3707
|
}
|
|
3797
|
-
|
|
3708
|
+
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
3709
|
+
React.useEffect(function () {
|
|
3798
3710
|
return function () {
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
timer && clearTimeout(timer);
|
|
3711
|
+
var _a;
|
|
3712
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3802
3713
|
};
|
|
3803
|
-
}, [fn, running, throttleMs]);
|
|
3804
|
-
var start = React.useCallback(function () {
|
|
3805
|
-
startedAtRef.current = new Date();
|
|
3806
|
-
setRunning(true);
|
|
3807
|
-
}, []);
|
|
3808
|
-
var stop = React.useCallback(function () {
|
|
3809
|
-
loopId.current += 1; // force the loop to stop immediately.
|
|
3810
|
-
setRunning(false);
|
|
3811
|
-
startedAtRef.current = null;
|
|
3812
3714
|
}, []);
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
stop: stop
|
|
3822
|
-
};
|
|
3715
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
|
|
3716
|
+
value: store.current
|
|
3717
|
+
}, children);
|
|
3718
|
+
}
|
|
3719
|
+
function useCameraStore(selector) {
|
|
3720
|
+
var store = React.useContext(CameraStoreContext);
|
|
3721
|
+
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
3722
|
+
return zustand.useStore(store, selector);
|
|
3823
3723
|
}
|
|
3824
3724
|
|
|
3825
3725
|
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
@@ -3867,7 +3767,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3867
3767
|
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
3868
3768
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3869
3769
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
|
|
3870
|
-
var _h =
|
|
3770
|
+
var _h = useCameraStore(),
|
|
3871
3771
|
videoRef = _h.videoRef,
|
|
3872
3772
|
videoLoaded = _h.videoLoaded,
|
|
3873
3773
|
cameraReady = _h.cameraReady;
|
|
@@ -3890,7 +3790,8 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3890
3790
|
modelPath: documentDetectionModelPath,
|
|
3891
3791
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
3892
3792
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
3893
|
-
onModelError: onDocumentDetectionModelError
|
|
3793
|
+
onModelError: onDocumentDetectionModelError,
|
|
3794
|
+
videoRef: videoRef
|
|
3894
3795
|
}),
|
|
3895
3796
|
ready = _o.ready,
|
|
3896
3797
|
modelDownloadProgress = _o.modelDownloadProgress,
|
|
@@ -4007,10 +3908,12 @@ function FocusModelProvider(_a) {
|
|
|
4007
3908
|
var _e = React.useState({}),
|
|
4008
3909
|
focusThresholds = _e[0],
|
|
4009
3910
|
setFocusThresholds = _e[1];
|
|
3911
|
+
var videoRef = useCameraStore().videoRef;
|
|
4010
3912
|
var _f = useLoadFocusModel({
|
|
4011
3913
|
modelPath: focusModelPath,
|
|
4012
3914
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4013
|
-
onModelError: onFocusModelError
|
|
3915
|
+
onModelError: onFocusModelError,
|
|
3916
|
+
videoRef: videoRef
|
|
4014
3917
|
}),
|
|
4015
3918
|
ready = _f.ready,
|
|
4016
3919
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -5132,31 +5035,33 @@ var Button = styled__default.default(LoaderButton)(templateObject_5$b || (templa
|
|
|
5132
5035
|
var templateObject_1$D, templateObject_2$w, templateObject_3$o, templateObject_4$i, templateObject_5$b;
|
|
5133
5036
|
|
|
5134
5037
|
var IdCapture = function IdCapture(_a) {
|
|
5135
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
5038
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
5136
5039
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
5137
|
-
|
|
5138
|
-
thresholds =
|
|
5040
|
+
_j = _a.thresholds,
|
|
5041
|
+
thresholds = _j === void 0 ? defaultIdCaptureThresholds : _j,
|
|
5139
5042
|
guidanceMessage = _a.guidanceMessage,
|
|
5140
5043
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
5141
5044
|
onCapture = _a.onCapture,
|
|
5142
|
-
|
|
5143
|
-
classNames =
|
|
5144
|
-
|
|
5145
|
-
colors =
|
|
5146
|
-
|
|
5147
|
-
rawVerbiage =
|
|
5148
|
-
|
|
5149
|
-
debugMode =
|
|
5150
|
-
var
|
|
5151
|
-
ref =
|
|
5152
|
-
|
|
5153
|
-
width =
|
|
5154
|
-
|
|
5155
|
-
height =
|
|
5156
|
-
var
|
|
5157
|
-
state =
|
|
5158
|
-
dispatch =
|
|
5159
|
-
var
|
|
5045
|
+
_k = _a.classNames,
|
|
5046
|
+
classNames = _k === void 0 ? {} : _k,
|
|
5047
|
+
_l = _a.colors,
|
|
5048
|
+
colors = _l === void 0 ? {} : _l,
|
|
5049
|
+
_m = _a.verbiage,
|
|
5050
|
+
rawVerbiage = _m === void 0 ? {} : _m,
|
|
5051
|
+
_o = _a.debugMode,
|
|
5052
|
+
debugMode = _o === void 0 ? false : _o;
|
|
5053
|
+
var _p = useResizeObserver__default.default(),
|
|
5054
|
+
ref = _p.ref,
|
|
5055
|
+
_q = _p.width,
|
|
5056
|
+
width = _q === void 0 ? 1 : _q,
|
|
5057
|
+
_r = _p.height,
|
|
5058
|
+
height = _r === void 0 ? 1 : _r;
|
|
5059
|
+
var _s = useIdCaptureState(),
|
|
5060
|
+
state = _s[0],
|
|
5061
|
+
dispatch = _s[1];
|
|
5062
|
+
var _t = useCameraStore(),
|
|
5063
|
+
camera = _t.camera,
|
|
5064
|
+
isRearFacing = _t.isRearFacing;
|
|
5160
5065
|
var _u = React.useContext(IdCaptureModelsContext),
|
|
5161
5066
|
modelsReady = _u.ready,
|
|
5162
5067
|
setThresholds = _u.setThresholds,
|
|
@@ -5268,17 +5173,16 @@ var IdCapture = function IdCapture(_a) {
|
|
|
5268
5173
|
classNames: classNames.overrideWrongDocumentTypeGuidanceDialog,
|
|
5269
5174
|
verbiage: rawVerbiage.overrideWrongDocumentTypeGuidanceDialog
|
|
5270
5175
|
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugBoundingBoxOverlay, {
|
|
5271
|
-
"$flipX": !
|
|
5176
|
+
"$flipX": !isRearFacing,
|
|
5272
5177
|
scaling: debugScalingDetails
|
|
5273
5178
|
}, state.detectedObjects.map(function (obj, i) {
|
|
5274
|
-
var _a;
|
|
5275
5179
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
5276
5180
|
key: i,
|
|
5277
5181
|
obj: obj,
|
|
5278
5182
|
scaling: debugScalingDetails,
|
|
5279
|
-
flipX: !
|
|
5183
|
+
flipX: !isRearFacing
|
|
5280
5184
|
});
|
|
5281
|
-
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null,
|
|
5185
|
+
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
|
|
5282
5186
|
};
|
|
5283
5187
|
var timeSince = function timeSince(t) {
|
|
5284
5188
|
if (!t) return 0;
|
|
@@ -5295,7 +5199,9 @@ var CameraAccessDeniedOverlay = function CameraAccessDeniedOverlay(_a) {
|
|
|
5295
5199
|
colors = _e === void 0 ? {} : _e,
|
|
5296
5200
|
_f = _a.verbiage,
|
|
5297
5201
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
5298
|
-
var requestCameraAccess =
|
|
5202
|
+
var requestCameraAccess = useCameraStore(function (state) {
|
|
5203
|
+
return state.requestCameraAccess;
|
|
5204
|
+
});
|
|
5299
5205
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/camera-disable-icon.png');
|
|
5300
5206
|
var verbiage = useTranslations(rawVerbiage, {
|
|
5301
5207
|
headingText: 'Your camera permission is disabled',
|
|
@@ -5943,7 +5849,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
|
|
|
5943
5849
|
var _o = React.useContext(IdCaptureModelsContext),
|
|
5944
5850
|
modelsReady = _o.ready,
|
|
5945
5851
|
modelDownloadProgress = _o.modelDownloadProgress;
|
|
5946
|
-
var _p =
|
|
5852
|
+
var _p = useCameraStore(),
|
|
5947
5853
|
cameraReady = _p.cameraReady,
|
|
5948
5854
|
cameraAccessDenied = _p.cameraAccessDenied,
|
|
5949
5855
|
iphoneContinuityCameraAvailable = _p.iphoneContinuityCameraAvailable,
|
|
@@ -6141,7 +6047,14 @@ var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
|
|
|
6141
6047
|
var _l = React.useContext(IdCaptureModelsContext),
|
|
6142
6048
|
modelsReady = _l.ready,
|
|
6143
6049
|
modelDownloadProgress = _l.modelDownloadProgress;
|
|
6144
|
-
var _m =
|
|
6050
|
+
var _m = useCameraStore(shallow.useShallow(function (state) {
|
|
6051
|
+
return {
|
|
6052
|
+
cameraReady: state.cameraReady,
|
|
6053
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
6054
|
+
iphoneContinuityCameraAvailable: state.iphoneContinuityCameraAvailable,
|
|
6055
|
+
setIphoneContinuityCameraAllowed: state.setIphoneContinuityCameraAllowed
|
|
6056
|
+
};
|
|
6057
|
+
})),
|
|
6145
6058
|
cameraReady = _m.cameraReady,
|
|
6146
6059
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
6147
6060
|
iphoneContinuityCameraAvailable = _m.iphoneContinuityCameraAvailable,
|
|
@@ -6687,23 +6600,24 @@ function getOrientation(allowPortraitOnMobile) {
|
|
|
6687
6600
|
}
|
|
6688
6601
|
|
|
6689
6602
|
var IdVideoCaptureFlipIdPrompt = function IdVideoCaptureFlipIdPrompt(_a) {
|
|
6690
|
-
var _b
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
classNames = _d === void 0 ? {} : _d,
|
|
6603
|
+
var _b = _a.idCaptureGuideImages,
|
|
6604
|
+
idCaptureGuideImages = _b === void 0 ? defaultIdCaptureGuideImages : _b,
|
|
6605
|
+
_c = _a.classNames,
|
|
6606
|
+
classNames = _c === void 0 ? {} : _c,
|
|
6695
6607
|
borderWidth = _a.borderWidth,
|
|
6696
6608
|
borderColor = _a.borderColor,
|
|
6697
6609
|
borderRadius = _a.borderRadius,
|
|
6698
6610
|
imageStyle = _a.imageStyle;
|
|
6699
|
-
var
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6611
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
6612
|
+
return state.isRearFacing;
|
|
6613
|
+
});
|
|
6614
|
+
var isMirrored = !isRearFacing;
|
|
6615
|
+
var _d = React.useState(1),
|
|
6616
|
+
transitionTime = _d[0],
|
|
6617
|
+
setTransitionTime = _d[1];
|
|
6618
|
+
var _e = React.useState(0),
|
|
6619
|
+
rotationAngle = _e[0],
|
|
6620
|
+
setRotationAngle = _e[1];
|
|
6707
6621
|
var frontTransforms = ["rotateY(".concat(rotationAngle, "deg)")];
|
|
6708
6622
|
if (isMirrored) frontTransforms.push('scaleX(-1)');
|
|
6709
6623
|
var backTransforms = ["rotateY(".concat(180 - rotationAngle, "deg)")];
|
|
@@ -7227,29 +7141,30 @@ var Canvas$1 = styled__default.default.canvas(templateObject_2$n || (templateObj
|
|
|
7227
7141
|
var templateObject_1$r, templateObject_2$n;
|
|
7228
7142
|
|
|
7229
7143
|
function IdCaptureGuides(_a) {
|
|
7230
|
-
var _b,
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
rawVerbiage = _o === void 0 ? {} : _o;
|
|
7144
|
+
var _b = _a.guideType,
|
|
7145
|
+
guideType = _b === void 0 ? 'fit' : _b,
|
|
7146
|
+
_c = _a.status,
|
|
7147
|
+
status = _c === void 0 ? 'ready' : _c,
|
|
7148
|
+
_d = _a.progress,
|
|
7149
|
+
progress = _d === void 0 ? 0 : _d,
|
|
7150
|
+
_e = _a.portraitGuidesOnMobile,
|
|
7151
|
+
portraitGuidesOnMobile = _e === void 0 ? true : _e,
|
|
7152
|
+
_f = _a.requestedAction,
|
|
7153
|
+
requestedAction = _f === void 0 ? 'SHOW_ID_FRONT' : _f,
|
|
7154
|
+
_g = _a.isBackToFront,
|
|
7155
|
+
isBackToFront = _g === void 0 ? false : _g,
|
|
7156
|
+
_h = _a.images,
|
|
7157
|
+
images = _h === void 0 ? defaultIdCaptureGuideImages : _h,
|
|
7158
|
+
_j = _a.classNames,
|
|
7159
|
+
classNames = _j === void 0 ? {} : _j,
|
|
7160
|
+
_k = _a.colors,
|
|
7161
|
+
colors = _k === void 0 ? {} : _k,
|
|
7162
|
+
_l = _a.verbiage,
|
|
7163
|
+
rawVerbiage = _l === void 0 ? {} : _l;
|
|
7251
7164
|
var state = useIdCaptureState()[0];
|
|
7252
|
-
var
|
|
7165
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
7166
|
+
return state.isRearFacing;
|
|
7167
|
+
});
|
|
7253
7168
|
var verbiage = useTranslations(rawVerbiage, {
|
|
7254
7169
|
instructionText: 'Scan the front of ID',
|
|
7255
7170
|
capturingText: 'Capturing...',
|
|
@@ -7261,7 +7176,7 @@ function IdCaptureGuides(_a) {
|
|
|
7261
7176
|
status: status,
|
|
7262
7177
|
progress: progress,
|
|
7263
7178
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
7264
|
-
isMirrored: !
|
|
7179
|
+
isMirrored: !isRearFacing,
|
|
7265
7180
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
7266
7181
|
imageVisible: requestedAction === 'FLIP_ID' || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
|
|
7267
7182
|
})), guideType === 'fit' && ( /*#__PURE__*/React__namespace.default.createElement(IdCaptureFitGuide, {
|
|
@@ -7271,7 +7186,7 @@ function IdCaptureGuides(_a) {
|
|
|
7271
7186
|
status: status,
|
|
7272
7187
|
progress: progress,
|
|
7273
7188
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
7274
|
-
isMirrored: !
|
|
7189
|
+
isMirrored: !isRearFacing,
|
|
7275
7190
|
isBackToFront: isBackToFront,
|
|
7276
7191
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
7277
7192
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
@@ -7370,48 +7285,6 @@ var ImagePreviewText = styled__default.default.div(templateObject_3$h || (templa
|
|
|
7370
7285
|
var ImagePreviewImageWrapper = styled__default.default.div(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"], ["\n position: relative;\n height: calc(100% - 8px);\n padding: 4px;\n border-radius: 4px;\n background: white;\n\n & > img {\n border-radius: 4px;\n width: auto;\n max-height: 100%;\n }\n"])));
|
|
7371
7286
|
var templateObject_1$q, templateObject_2$m, templateObject_3$h, templateObject_4$b;
|
|
7372
7287
|
|
|
7373
|
-
var CameraVideoTag = function CameraVideoTag(_a) {
|
|
7374
|
-
var _b;
|
|
7375
|
-
var className = _a.className;
|
|
7376
|
-
var _c = React.useContext(CameraStateContext),
|
|
7377
|
-
videoRef = _c.videoRef,
|
|
7378
|
-
setVideoLoaded = _c.setVideoLoaded,
|
|
7379
|
-
onVideoUnmounted = _c.onVideoUnmounted,
|
|
7380
|
-
cameraRef = _c.cameraRef;
|
|
7381
|
-
React.useEffect(function notifyCameraProviderOfUnmount() {
|
|
7382
|
-
var videoElement = videoRef.current;
|
|
7383
|
-
if (!videoElement) return;
|
|
7384
|
-
return function () {
|
|
7385
|
-
onVideoUnmounted(videoElement);
|
|
7386
|
-
};
|
|
7387
|
-
}, [onVideoUnmounted, videoRef]);
|
|
7388
|
-
React.useEffect(function setVideoLoadedToFalseOnMount() {
|
|
7389
|
-
setVideoLoaded(false);
|
|
7390
|
-
}, [setVideoLoaded]);
|
|
7391
|
-
React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
7392
|
-
var _a;
|
|
7393
|
-
if (videoRef.current && ((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.stream)) {
|
|
7394
|
-
videoRef.current.srcObject = cameraRef.current.stream;
|
|
7395
|
-
}
|
|
7396
|
-
}, [cameraRef, videoRef]);
|
|
7397
|
-
var onLoadedData = React.useCallback(function () {
|
|
7398
|
-
setVideoLoaded(true);
|
|
7399
|
-
}, [setVideoLoaded]);
|
|
7400
|
-
return /*#__PURE__*/React__namespace.default.createElement(FullscreenVideoTag, {
|
|
7401
|
-
className: className,
|
|
7402
|
-
autoPlay: true,
|
|
7403
|
-
playsInline: true,
|
|
7404
|
-
muted: true,
|
|
7405
|
-
ref: videoRef,
|
|
7406
|
-
onLoadedData: onLoadedData,
|
|
7407
|
-
"$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
|
|
7408
|
-
});
|
|
7409
|
-
};
|
|
7410
|
-
var FullscreenVideoTag = styled__default.default.video(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
|
|
7411
|
-
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
7412
|
-
});
|
|
7413
|
-
var templateObject_1$p;
|
|
7414
|
-
|
|
7415
7288
|
var documentCaptureInitialState = {
|
|
7416
7289
|
documents: [],
|
|
7417
7290
|
currentDocumentIndex: 0,
|
|
@@ -7530,8 +7403,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7530
7403
|
var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
|
|
7531
7404
|
state = _c[0],
|
|
7532
7405
|
dispatch = _c[1];
|
|
7533
|
-
var _d =
|
|
7534
|
-
|
|
7406
|
+
var _d = useCameraStore(),
|
|
7407
|
+
videoStream = _d.videoStream,
|
|
7535
7408
|
videoRef = _d.videoRef;
|
|
7536
7409
|
var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
|
|
7537
7410
|
var uploadCapturedDocument = React.useCallback(function (content, filetype) {
|
|
@@ -7622,8 +7495,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7622
7495
|
}, [onResize]);
|
|
7623
7496
|
var videoTag = videoRef.current;
|
|
7624
7497
|
React.useEffect(function () {
|
|
7625
|
-
if (!state.capturing) return;
|
|
7626
|
-
if (!cameraRef.current) return;
|
|
7498
|
+
if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
|
|
7627
7499
|
function onComplete(content) {
|
|
7628
7500
|
if (!content) return;
|
|
7629
7501
|
var contentUrl = URL.createObjectURL(content);
|
|
@@ -7636,7 +7508,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7636
7508
|
});
|
|
7637
7509
|
}
|
|
7638
7510
|
if (typeof ImageCapture !== 'undefined') {
|
|
7639
|
-
var tracks =
|
|
7511
|
+
var tracks = videoStream.getTracks();
|
|
7640
7512
|
var videoCameraTrack = tracks.find(function (track) {
|
|
7641
7513
|
return track.kind === 'video';
|
|
7642
7514
|
});
|
|
@@ -7651,7 +7523,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7651
7523
|
drawToCanvas(canvas, videoTag);
|
|
7652
7524
|
canvas.toBlob(onComplete);
|
|
7653
7525
|
}
|
|
7654
|
-
}, [
|
|
7526
|
+
}, [state.capturing, videoStream, videoTag]);
|
|
7655
7527
|
var stateWithActions = React.useMemo(function () {
|
|
7656
7528
|
return _assign(_assign({}, state), {
|
|
7657
7529
|
uploadCapturedDocument: uploadCapturedDocument
|
|
@@ -7766,52 +7638,85 @@ var DocumentCaptureGuideOverlay = function DocumentCaptureGuideOverlay(_a) {
|
|
|
7766
7638
|
ref: canvasRef
|
|
7767
7639
|
}));
|
|
7768
7640
|
};
|
|
7769
|
-
var CanvasWrapper = styled__default.default.div(templateObject_1$
|
|
7641
|
+
var CanvasWrapper = styled__default.default.div(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"], ["\n flex-grow: 1;\n background-clip: padding-box;\n box-shadow: inset 0 0 0 2px ", ";\n"])), function (props) {
|
|
7770
7642
|
return props.$maskColor;
|
|
7771
7643
|
});
|
|
7772
7644
|
var Canvas = styled__default.default.canvas(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
|
|
7773
|
-
var templateObject_1$
|
|
7645
|
+
var templateObject_1$p, templateObject_2$l;
|
|
7774
7646
|
|
|
7775
|
-
var CameraFeedWrapper = styled__default.default.div(templateObject_1$
|
|
7647
|
+
var CameraFeedWrapper = styled__default.default.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
7776
7648
|
return props.$mode === 'snapToGuides' ? "display: flex;\n position: absolute;\n left: ".concat(props.$x, "px;\n top: ").concat(props.$y, "px;\n width: ").concat(props.$w, "px;\n height: ").concat(props.$h, "px;") : "";
|
|
7777
7649
|
});
|
|
7650
|
+
var templateObject_1$o;
|
|
7651
|
+
|
|
7652
|
+
var CameraVideoTag = function CameraVideoTag(props) {
|
|
7653
|
+
var _a = useCameraStore(shallow.useShallow(function (store) {
|
|
7654
|
+
return {
|
|
7655
|
+
videoRef: store.videoRef,
|
|
7656
|
+
videoStream: store.videoStream,
|
|
7657
|
+
onVideoMounted: store.onVideoMounted,
|
|
7658
|
+
isRearFacing: store.isRearFacing
|
|
7659
|
+
};
|
|
7660
|
+
})),
|
|
7661
|
+
videoRef = _a.videoRef,
|
|
7662
|
+
videoStream = _a.videoStream,
|
|
7663
|
+
onVideoMounted = _a.onVideoMounted,
|
|
7664
|
+
isRearFacing = _a.isRearFacing;
|
|
7665
|
+
React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
7666
|
+
if (videoRef.current && videoStream) {
|
|
7667
|
+
debug('attaching camera stream to video tag');
|
|
7668
|
+
videoRef.current.srcObject = videoStream;
|
|
7669
|
+
}
|
|
7670
|
+
}, [videoStream, videoRef]);
|
|
7671
|
+
return /*#__PURE__*/React__namespace.default.createElement(FullscreenVideoTag, _assign({
|
|
7672
|
+
autoPlay: true,
|
|
7673
|
+
playsInline: true,
|
|
7674
|
+
muted: true,
|
|
7675
|
+
ref: videoRef,
|
|
7676
|
+
onLoadedData: onVideoMounted,
|
|
7677
|
+
"$isRearFacing": isRearFacing
|
|
7678
|
+
}, props));
|
|
7679
|
+
};
|
|
7680
|
+
var FullscreenVideoTag = styled__default.default.video(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"], ["\n transform: ", ";\n transform-style: preserve-3d;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n object-fit: cover;\n background: black;\n z-index: -2;\n"])), function (props) {
|
|
7681
|
+
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
7682
|
+
});
|
|
7778
7683
|
var templateObject_1$n;
|
|
7779
7684
|
|
|
7780
7685
|
var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
7781
|
-
var _b, _c, _d, _e, _f
|
|
7686
|
+
var _b, _c, _d, _e, _f;
|
|
7782
7687
|
var onCaptureClicked = _a.onCaptureClicked,
|
|
7783
|
-
|
|
7784
|
-
classNames =
|
|
7785
|
-
|
|
7786
|
-
rawVerbiage =
|
|
7787
|
-
var
|
|
7788
|
-
|
|
7789
|
-
documents =
|
|
7790
|
-
currentDocumentIndex =
|
|
7791
|
-
rectX =
|
|
7792
|
-
rectY =
|
|
7793
|
-
rectWidth =
|
|
7794
|
-
rectHeight =
|
|
7795
|
-
rectOffsetTop =
|
|
7796
|
-
capturing =
|
|
7797
|
-
uploadCapturedDocument =
|
|
7798
|
-
dispatch =
|
|
7799
|
-
var
|
|
7800
|
-
title =
|
|
7801
|
-
aspectRatio =
|
|
7802
|
-
cameraFeedMode =
|
|
7803
|
-
instructions =
|
|
7804
|
-
contentUrl =
|
|
7805
|
-
content =
|
|
7806
|
-
uploadState =
|
|
7807
|
-
var
|
|
7808
|
-
|
|
7809
|
-
cameraReady =
|
|
7810
|
-
cameraAccessDenied =
|
|
7811
|
-
requestCameraAccess =
|
|
7812
|
-
var
|
|
7813
|
-
cameraAccessRequested =
|
|
7814
|
-
setCameraAccessRequested =
|
|
7688
|
+
_g = _a.classNames,
|
|
7689
|
+
classNames = _g === void 0 ? {} : _g,
|
|
7690
|
+
_h = _a.verbiage,
|
|
7691
|
+
rawVerbiage = _h === void 0 ? {} : _h;
|
|
7692
|
+
var _j = useDocumentCaptureState(),
|
|
7693
|
+
_k = _j[0],
|
|
7694
|
+
documents = _k.documents,
|
|
7695
|
+
currentDocumentIndex = _k.currentDocumentIndex,
|
|
7696
|
+
rectX = _k.rectX,
|
|
7697
|
+
rectY = _k.rectY,
|
|
7698
|
+
rectWidth = _k.rectWidth,
|
|
7699
|
+
rectHeight = _k.rectHeight,
|
|
7700
|
+
rectOffsetTop = _k.rectOffsetTop,
|
|
7701
|
+
capturing = _k.capturing,
|
|
7702
|
+
uploadCapturedDocument = _k.uploadCapturedDocument,
|
|
7703
|
+
dispatch = _j[1];
|
|
7704
|
+
var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
|
|
7705
|
+
title = _l.title,
|
|
7706
|
+
aspectRatio = _l.aspectRatio,
|
|
7707
|
+
cameraFeedMode = _l.cameraFeedMode,
|
|
7708
|
+
instructions = _l.instructions,
|
|
7709
|
+
contentUrl = _l.contentUrl,
|
|
7710
|
+
content = _l.content,
|
|
7711
|
+
uploadState = _l.uploadState;
|
|
7712
|
+
var _m = useCameraStore(),
|
|
7713
|
+
videoStream = _m.videoStream,
|
|
7714
|
+
cameraReady = _m.cameraReady,
|
|
7715
|
+
cameraAccessDenied = _m.cameraAccessDenied,
|
|
7716
|
+
requestCameraAccess = _m.requestCameraAccess;
|
|
7717
|
+
var _o = React.useState(false),
|
|
7718
|
+
cameraAccessRequested = _o[0],
|
|
7719
|
+
setCameraAccessRequested = _o[1];
|
|
7815
7720
|
var cameraAccessNeeded =
|
|
7816
7721
|
// we should force the browser to ask for camera access if...
|
|
7817
7722
|
uploadState === 'not_started' &&
|
|
@@ -7820,14 +7725,14 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
7820
7725
|
// and the user hasn't passed a media blob for the current document...
|
|
7821
7726
|
!cameraAccessRequested &&
|
|
7822
7727
|
// and we haven't already tried to force a camera request...
|
|
7823
|
-
!(
|
|
7728
|
+
!(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active); // and we don't already have camera access.
|
|
7824
7729
|
React.useEffect(function requestCameraAccessIfNeeded() {
|
|
7825
7730
|
if (!cameraAccessNeeded) return;
|
|
7826
7731
|
setCameraAccessRequested(true);
|
|
7827
7732
|
requestCameraAccess();
|
|
7828
7733
|
}, [cameraAccessNeeded, requestCameraAccess]);
|
|
7829
7734
|
var theme = styled.useTheme();
|
|
7830
|
-
var maskColor = (
|
|
7735
|
+
var maskColor = (_e = (_d = (_c = theme.documentCapture) === null || _c === void 0 ? void 0 : _c.guideBox) === null || _d === void 0 ? void 0 : _d.maskColor) !== null && _e !== void 0 ? _e : cameraFeedMode === 'snapToGuides' ? '#708090' : "rgba(0, 0, 0, 0.5)";
|
|
7831
7736
|
var verbiage = useTranslations(rawVerbiage, {
|
|
7832
7737
|
headingText: title,
|
|
7833
7738
|
loadingBtnText: 'Camera initializing...',
|
|
@@ -7860,7 +7765,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
7860
7765
|
});
|
|
7861
7766
|
}
|
|
7862
7767
|
return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
|
|
7863
|
-
className: "flex ".concat((
|
|
7768
|
+
className: "flex ".concat((_f = classNames.container) !== null && _f !== void 0 ? _f : '')
|
|
7864
7769
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraFeedWrapper, {
|
|
7865
7770
|
className: classNames.cameraFeedWrapper,
|
|
7866
7771
|
"$mode": cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
|
|
@@ -8285,7 +8190,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8285
8190
|
var _3 = useIdCaptureState(),
|
|
8286
8191
|
state = _3[0],
|
|
8287
8192
|
dispatch = _3[1];
|
|
8288
|
-
var _4 =
|
|
8193
|
+
var _4 = useCameraStore(),
|
|
8289
8194
|
cameraAccessDenied = _4.cameraAccessDenied,
|
|
8290
8195
|
requestCameraAccess = _4.requestCameraAccess,
|
|
8291
8196
|
releaseCameraAccess = _4.releaseCameraAccess;
|
|
@@ -9233,7 +9138,13 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9233
9138
|
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
9234
9139
|
_d = _a.requireVerticalFaceCentering,
|
|
9235
9140
|
requireVerticalFaceCentering = _d === void 0 ? true : _d;
|
|
9236
|
-
var _e =
|
|
9141
|
+
var _e = useCameraStore(shallow.useShallow(function (state) {
|
|
9142
|
+
return {
|
|
9143
|
+
videoRef: state.videoRef,
|
|
9144
|
+
videoLoaded: state.videoLoaded,
|
|
9145
|
+
cameraReady: state.cameraReady
|
|
9146
|
+
};
|
|
9147
|
+
})),
|
|
9237
9148
|
videoRef = _e.videoRef,
|
|
9238
9149
|
videoLoaded = _e.videoLoaded,
|
|
9239
9150
|
cameraReady = _e.cameraReady;
|
|
@@ -9241,7 +9152,8 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9241
9152
|
var onPredictionHandler = React.useRef();
|
|
9242
9153
|
var _f = useLoadFaceDetector({
|
|
9243
9154
|
onModelError: onModelError,
|
|
9244
|
-
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
9155
|
+
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
9156
|
+
videoRef: videoRef
|
|
9245
9157
|
}),
|
|
9246
9158
|
ready = _f.ready,
|
|
9247
9159
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -9574,8 +9486,14 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
9574
9486
|
prediction = _t.prediction,
|
|
9575
9487
|
dispatch = _s[1];
|
|
9576
9488
|
var lastPredictionCanvas = React.useRef(null);
|
|
9577
|
-
var _u =
|
|
9578
|
-
|
|
9489
|
+
var _u = useCameraStore(shallow.useShallow(function (state) {
|
|
9490
|
+
return {
|
|
9491
|
+
camera: state.camera,
|
|
9492
|
+
cameraReady: state.cameraReady,
|
|
9493
|
+
videoRef: state.videoRef
|
|
9494
|
+
};
|
|
9495
|
+
})),
|
|
9496
|
+
camera = _u.camera,
|
|
9579
9497
|
videoRef = _u.videoRef;
|
|
9580
9498
|
var _v = React.useContext(SelfieGuidanceModelsContext),
|
|
9581
9499
|
onPredictionMade = _v.onPredictionMade,
|
|
@@ -9665,7 +9583,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
9665
9583
|
face: prediction.face,
|
|
9666
9584
|
scaling: debugScalingDetails,
|
|
9667
9585
|
color: satisfied ? 'green' : 'red'
|
|
9668
|
-
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null,
|
|
9586
|
+
}))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) && !(prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? '✅' : '❌', ' ', "Face", ' ', (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? 'Too Close' : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__namespace.default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React__namespace.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__namespace.default.createElement(ExitCaptureButton, {
|
|
9669
9587
|
onClick: onExit,
|
|
9670
9588
|
className: classNames.exitCaptureBtn
|
|
9671
9589
|
}));
|
|
@@ -10121,7 +10039,9 @@ var MicrophoneAccessDeniedOverlay = function MicrophoneAccessDeniedOverlay(_a) {
|
|
|
10121
10039
|
colors = _e === void 0 ? {} : _e,
|
|
10122
10040
|
_f = _a.verbiage,
|
|
10123
10041
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10124
|
-
var requestMicrophoneAccess =
|
|
10042
|
+
var requestMicrophoneAccess = useCameraStore(function (state) {
|
|
10043
|
+
return state.requestMicrophoneAccess;
|
|
10044
|
+
});
|
|
10125
10045
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/microphone-disable-icon.svg');
|
|
10126
10046
|
var verbiage = useTranslations(rawVerbiage, {
|
|
10127
10047
|
headingText: 'Your microphone permission is disabled',
|
|
@@ -10169,7 +10089,13 @@ var SelfieCaptureLoadingOverlayLegacy = function SelfieCaptureLoadingOverlayLega
|
|
|
10169
10089
|
colors = _e === void 0 ? {} : _e,
|
|
10170
10090
|
_f = _a.verbiage,
|
|
10171
10091
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10172
|
-
var _g =
|
|
10092
|
+
var _g = useCameraStore(shallow.useShallow(function (state) {
|
|
10093
|
+
return {
|
|
10094
|
+
cameraReady: state.cameraReady,
|
|
10095
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10096
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
10097
|
+
};
|
|
10098
|
+
})),
|
|
10173
10099
|
cameraReady = _g.cameraReady,
|
|
10174
10100
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
10175
10101
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -10256,7 +10182,13 @@ var SelfieCaptureLoadingOverlayDefault = function SelfieCaptureLoadingOverlayDef
|
|
|
10256
10182
|
colors = _e === void 0 ? {} : _e,
|
|
10257
10183
|
_f = _a.verbiage,
|
|
10258
10184
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10259
|
-
var _g =
|
|
10185
|
+
var _g = useCameraStore(shallow.useShallow(function (state) {
|
|
10186
|
+
return {
|
|
10187
|
+
cameraReady: state.cameraReady,
|
|
10188
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10189
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
10190
|
+
};
|
|
10191
|
+
})),
|
|
10260
10192
|
cameraReady = _g.cameraReady,
|
|
10261
10193
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
10262
10194
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -10473,7 +10405,13 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
10473
10405
|
livenessCheckRequest = _t.livenessCheckRequest,
|
|
10474
10406
|
setSelfieImage = _t.setSelfieImage,
|
|
10475
10407
|
logSelfieCaptureAttempt = _t.logSelfieCaptureAttempt;
|
|
10476
|
-
var _u =
|
|
10408
|
+
var _u = useCameraStore(shallow.useShallow(function (state) {
|
|
10409
|
+
return {
|
|
10410
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10411
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
10412
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
10413
|
+
};
|
|
10414
|
+
})),
|
|
10477
10415
|
cameraAccessDenied = _u.cameraAccessDenied,
|
|
10478
10416
|
requestCameraAccess = _u.requestCameraAccess,
|
|
10479
10417
|
releaseCameraAccess = _u.releaseCameraAccess;
|
|
@@ -11194,10 +11132,10 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11194
11132
|
setSignatureVideoUrl = _e[1];
|
|
11195
11133
|
var signatureRecorder = React.useRef(null);
|
|
11196
11134
|
var recordedChunks = React.useRef([]);
|
|
11197
|
-
var _f =
|
|
11198
|
-
|
|
11135
|
+
var _f = useCameraStore(),
|
|
11136
|
+
camera = _f.camera,
|
|
11199
11137
|
videoRef = _f.videoRef;
|
|
11200
|
-
var _g = useVideoRecorder(
|
|
11138
|
+
var _g = useVideoRecorder(camera),
|
|
11201
11139
|
isRecordingVideo = _g.isRecordingVideo,
|
|
11202
11140
|
startRecordingVideo = _g.startRecordingVideo,
|
|
11203
11141
|
stopRecordingVideo = _g.stopRecordingVideo,
|
|
@@ -11265,8 +11203,8 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11265
11203
|
var animationFrame = React.useRef(0);
|
|
11266
11204
|
React.useEffect(function () {
|
|
11267
11205
|
var _a;
|
|
11268
|
-
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !
|
|
11269
|
-
var _b = [
|
|
11206
|
+
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
|
|
11207
|
+
var _b = [camera.width, camera.height],
|
|
11270
11208
|
w = _b[0],
|
|
11271
11209
|
h = _b[1];
|
|
11272
11210
|
var isPortrait = typeof window !== 'undefined' && window.innerWidth < window.innerHeight;
|
|
@@ -11299,7 +11237,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11299
11237
|
return function () {
|
|
11300
11238
|
cancelAnimationFrame(animationFrame.current);
|
|
11301
11239
|
};
|
|
11302
|
-
}, [
|
|
11240
|
+
}, [camera, isRecording, isRecordingVideo, videoRef]);
|
|
11303
11241
|
var onAcceptClicked = React.useCallback(function () {
|
|
11304
11242
|
return __awaiter(_this, void 0, void 0, function () {
|
|
11305
11243
|
var imageUrl;
|
|
@@ -11428,27 +11366,29 @@ var AcceptBtn = styled__default.default(LoaderButton)(templateObject_7$1 || (tem
|
|
|
11428
11366
|
var templateObject_1$9, templateObject_2$8, templateObject_3$8, templateObject_4$3, templateObject_5$2, templateObject_6$2, templateObject_7$1;
|
|
11429
11367
|
|
|
11430
11368
|
var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
11431
|
-
var _b
|
|
11369
|
+
var _b;
|
|
11432
11370
|
var onVideoCaptured = _a.onVideoCaptured,
|
|
11433
11371
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
11434
11372
|
onExit = _a.onExit,
|
|
11435
11373
|
guidesComponent = _a.guidesComponent,
|
|
11436
|
-
|
|
11437
|
-
classNames =
|
|
11438
|
-
|
|
11439
|
-
colors =
|
|
11440
|
-
|
|
11441
|
-
rawVerbiage =
|
|
11442
|
-
|
|
11443
|
-
debugMode =
|
|
11444
|
-
var
|
|
11374
|
+
_c = _a.classNames,
|
|
11375
|
+
classNames = _c === void 0 ? {} : _c,
|
|
11376
|
+
_d = _a.colors,
|
|
11377
|
+
colors = _d === void 0 ? {} : _d,
|
|
11378
|
+
_e = _a.verbiage,
|
|
11379
|
+
rawVerbiage = _e === void 0 ? {} : _e,
|
|
11380
|
+
_f = _a.debugMode,
|
|
11381
|
+
debugMode = _f === void 0 ? false : _f;
|
|
11382
|
+
var camera = useCameraStore(function (state) {
|
|
11383
|
+
return state.camera;
|
|
11384
|
+
});
|
|
11445
11385
|
var onPredictionMade = React.useContext(SelfieGuidanceModelsContext).onPredictionMade;
|
|
11446
|
-
var
|
|
11447
|
-
signatureData =
|
|
11448
|
-
signatureDataUrl =
|
|
11449
|
-
signatureVideoData =
|
|
11450
|
-
startRecording =
|
|
11451
|
-
stopRecording =
|
|
11386
|
+
var _g = useVideoSignatureContext(),
|
|
11387
|
+
signatureData = _g.signatureData,
|
|
11388
|
+
signatureDataUrl = _g.signatureDataUrl,
|
|
11389
|
+
signatureVideoData = _g.signatureVideoData,
|
|
11390
|
+
startRecording = _g.startRecording,
|
|
11391
|
+
stopRecording = _g.stopRecording;
|
|
11452
11392
|
React.useEffect(function () {
|
|
11453
11393
|
startRecording();
|
|
11454
11394
|
return function () {
|
|
@@ -11465,9 +11405,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11465
11405
|
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
|
|
11466
11406
|
}
|
|
11467
11407
|
}, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
|
|
11468
|
-
var
|
|
11469
|
-
numFramesWithoutFaces =
|
|
11470
|
-
setNumFramesWithoutFaces =
|
|
11408
|
+
var _h = React.useState(0),
|
|
11409
|
+
numFramesWithoutFaces = _h[0],
|
|
11410
|
+
setNumFramesWithoutFaces = _h[1];
|
|
11471
11411
|
React.useEffect(function () {
|
|
11472
11412
|
onPredictionMade(function (_a) {
|
|
11473
11413
|
var face = _a.face;
|
|
@@ -11494,7 +11434,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11494
11434
|
}, verbiage.guidanceMessageText))), /*#__PURE__*/React__namespace.default.createElement(GuidesComponent, {
|
|
11495
11435
|
classNames: classNames.videoSignatureGuidesClassNames,
|
|
11496
11436
|
status: "success"
|
|
11497
|
-
}), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ",
|
|
11437
|
+
}), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", camera === null || camera === void 0 ? void 0 : camera.width, "x", camera === null || camera === void 0 ? void 0 : camera.height)), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
11498
11438
|
onClick: onExit,
|
|
11499
11439
|
className: classNames.exitCaptureBtn
|
|
11500
11440
|
}));
|
|
@@ -11588,7 +11528,13 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
11588
11528
|
setSignatureData = _l.setSignatureData,
|
|
11589
11529
|
setSignatureVideoUrl = _l.setSignatureVideoUrl,
|
|
11590
11530
|
logSelfieCaptureAttempt = _l.logSelfieCaptureAttempt;
|
|
11591
|
-
var _m =
|
|
11531
|
+
var _m = useCameraStore(shallow.useShallow(function (state) {
|
|
11532
|
+
return {
|
|
11533
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
11534
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
11535
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
11536
|
+
};
|
|
11537
|
+
})),
|
|
11592
11538
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
11593
11539
|
requestCameraAccess = _m.requestCameraAccess,
|
|
11594
11540
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
@@ -11748,27 +11694,29 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
11748
11694
|
};
|
|
11749
11695
|
|
|
11750
11696
|
var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
11751
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
11752
|
-
var
|
|
11753
|
-
requestedAction =
|
|
11754
|
-
|
|
11755
|
-
satisfied =
|
|
11756
|
-
|
|
11757
|
-
faceGuideStatus =
|
|
11697
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
11698
|
+
var _z = _a.requestedAction,
|
|
11699
|
+
requestedAction = _z === void 0 ? 'SHOW_ID_FRONT' : _z,
|
|
11700
|
+
_0 = _a.satisfied,
|
|
11701
|
+
satisfied = _0 === void 0 ? false : _0,
|
|
11702
|
+
_1 = _a.faceGuideStatus,
|
|
11703
|
+
faceGuideStatus = _1 === void 0 ? 'success' : _1,
|
|
11758
11704
|
faceGuideBorderWidth = _a.faceGuideBorderWidth,
|
|
11759
11705
|
faceGuideBorderColor = _a.faceGuideBorderColor,
|
|
11760
|
-
|
|
11761
|
-
idCardGuideStatus =
|
|
11706
|
+
_2 = _a.idCardGuideStatus,
|
|
11707
|
+
idCardGuideStatus = _2 === void 0 ? 'ready' : _2,
|
|
11762
11708
|
idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
|
|
11763
11709
|
idCardGuideBorderColor = _a.idCardGuideBorderColor,
|
|
11764
11710
|
idCardCaptureProgress = _a.idCardCaptureProgress,
|
|
11765
|
-
|
|
11766
|
-
userSuppliedImages =
|
|
11767
|
-
|
|
11768
|
-
classNames =
|
|
11769
|
-
|
|
11770
|
-
rawVerbiage =
|
|
11771
|
-
var
|
|
11711
|
+
_3 = _a.idCardCaptureGuideImages,
|
|
11712
|
+
userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
|
|
11713
|
+
_4 = _a.classNames,
|
|
11714
|
+
classNames = _4 === void 0 ? {} : _4,
|
|
11715
|
+
_5 = _a.verbiage,
|
|
11716
|
+
rawVerbiage = _5 === void 0 ? {} : _5;
|
|
11717
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
11718
|
+
return state.isRearFacing;
|
|
11719
|
+
});
|
|
11772
11720
|
var verbiage = useTranslations(rawVerbiage, {
|
|
11773
11721
|
idFrontInstructionText: 'Display the front of your ID card...',
|
|
11774
11722
|
idBackInstructionText: 'Display the back of your ID card...',
|
|
@@ -11781,17 +11729,17 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11781
11729
|
if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : '#D6DCE7';
|
|
11782
11730
|
if (idCardGuideBorderWidth === undefined) idCardGuideBorderWidth = (_m = (_l = (_k = theme.idVideoCapture) === null || _k === void 0 ? void 0 : _k.idCardGuides) === null || _l === void 0 ? void 0 : _l.borderWidth) !== null && _m !== void 0 ? _m : 20;
|
|
11783
11731
|
if (idCardGuideBorderColor === undefined) idCardGuideBorderColor = (_s = satisfied ? (_p = (_o = theme.idVideoCapture) === null || _o === void 0 ? void 0 : _o.idCardGuides) === null || _p === void 0 ? void 0 : _p.satisfiedColor : (_r = (_q = theme.idVideoCapture) === null || _q === void 0 ? void 0 : _q.idCardGuides) === null || _r === void 0 ? void 0 : _r.unsatisfiedColor) !== null && _s !== void 0 ? _s : '#D6DCE7';
|
|
11784
|
-
var
|
|
11785
|
-
idCardGuideRef =
|
|
11786
|
-
|
|
11787
|
-
idCardGuideWidth =
|
|
11788
|
-
|
|
11789
|
-
idCardGuideHeight =
|
|
11732
|
+
var _6 = useResizeObserver__default.default(),
|
|
11733
|
+
idCardGuideRef = _6.ref,
|
|
11734
|
+
_7 = _6.width,
|
|
11735
|
+
idCardGuideWidth = _7 === void 0 ? 0 : _7,
|
|
11736
|
+
_8 = _6.height,
|
|
11737
|
+
idCardGuideHeight = _8 === void 0 ? 0 : _8;
|
|
11790
11738
|
var idCaptureGuideImages = useGuideImages(userSuppliedImages);
|
|
11791
11739
|
var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
|
|
11792
|
-
var
|
|
11793
|
-
aspectRatio =
|
|
11794
|
-
setAspectRatio =
|
|
11740
|
+
var _9 = React.useState(undefined),
|
|
11741
|
+
aspectRatio = _9[0],
|
|
11742
|
+
setAspectRatio = _9[1];
|
|
11795
11743
|
var onImageLoaded = React.useCallback(function (e) {
|
|
11796
11744
|
var _a, _b, _c, _d;
|
|
11797
11745
|
var img = e.currentTarget;
|
|
@@ -11838,7 +11786,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11838
11786
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCardGuideImage, {
|
|
11839
11787
|
alt: "",
|
|
11840
11788
|
className: classNames.idCardGuideImage,
|
|
11841
|
-
"$isMirrored": !
|
|
11789
|
+
"$isMirrored": !isRearFacing,
|
|
11842
11790
|
style: idCardImageStyle,
|
|
11843
11791
|
src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
|
|
11844
11792
|
onLoad: onImageLoaded
|
|
@@ -11852,8 +11800,8 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11852
11800
|
className: classNames.idCardGuideInstructionsContainer
|
|
11853
11801
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCardGuideInstructions, {
|
|
11854
11802
|
className: classNames.idCardGuideInstructions,
|
|
11855
|
-
"$textColor": (
|
|
11856
|
-
"$background": (
|
|
11803
|
+
"$textColor": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsTextColor,
|
|
11804
|
+
"$background": (_y = (_x = theme.idVideoCapture) === null || _x === void 0 ? void 0 : _x.idCardGuides) === null || _y === void 0 ? void 0 : _y.instructionsBackgroundColor
|
|
11857
11805
|
}, instructionText))))));
|
|
11858
11806
|
};
|
|
11859
11807
|
var Container = styled__default.default.div(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"], ["\n display: flex;\n max-height: 100%;\n position: absolute;\n z-index: 1000;\n width: 100dvw;\n height: 100dvh;\n font-family: ", ";\n box-sizing: border-box;\n overflow: hidden;\n padding: 40px;\n"])), function (props) {
|
|
@@ -11998,99 +11946,100 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
11998
11946
|
flipShortcutThreshold: 0.7
|
|
11999
11947
|
};
|
|
12000
11948
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
12001
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v
|
|
11949
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
12002
11950
|
var onComplete = _a.onComplete,
|
|
12003
11951
|
onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
|
|
12004
11952
|
onIdBackImageCaptured = _a.onIdBackImageCaptured,
|
|
12005
11953
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
12006
11954
|
onRecordingFailed = _a.onRecordingFailed,
|
|
12007
11955
|
onExitCapture = _a.onExitCapture,
|
|
12008
|
-
|
|
12009
|
-
idCaptureModelsEnabled =
|
|
12010
|
-
|
|
12011
|
-
idCardCaptureGuideImages =
|
|
12012
|
-
|
|
12013
|
-
idCardFrontDelay =
|
|
12014
|
-
|
|
12015
|
-
videoIdCaptureThresholds =
|
|
12016
|
-
|
|
12017
|
-
skipShowIdCardBack =
|
|
12018
|
-
|
|
12019
|
-
captureCountdownSeconds =
|
|
11956
|
+
_w = _a.idCaptureModelsEnabled,
|
|
11957
|
+
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
11958
|
+
_x = _a.idCardCaptureGuideImages,
|
|
11959
|
+
idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
|
|
11960
|
+
_y = _a.idCardFrontDelay,
|
|
11961
|
+
idCardFrontDelay = _y === void 0 ? 1000 : _y,
|
|
11962
|
+
_z = _a.videoIdCaptureThresholds,
|
|
11963
|
+
videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
|
|
11964
|
+
_0 = _a.skipShowIdCardBack,
|
|
11965
|
+
skipShowIdCardBack = _0 === void 0 ? false : _0,
|
|
11966
|
+
_1 = _a.captureCountdownSeconds,
|
|
11967
|
+
captureCountdownSeconds = _1 === void 0 ? 3 : _1,
|
|
12020
11968
|
readTextPrompt = _a.readTextPrompt,
|
|
12021
|
-
|
|
12022
|
-
readTextTimeoutDurationMs =
|
|
12023
|
-
|
|
12024
|
-
readTextMinReadingMs =
|
|
12025
|
-
|
|
12026
|
-
disableFaceDetectionWhileAudioCapture =
|
|
12027
|
-
|
|
12028
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
12029
|
-
|
|
12030
|
-
mergeAVStreams =
|
|
12031
|
-
|
|
12032
|
-
classNames =
|
|
12033
|
-
|
|
12034
|
-
colors =
|
|
12035
|
-
|
|
12036
|
-
rawVerbiage =
|
|
12037
|
-
|
|
12038
|
-
debugMode =
|
|
12039
|
-
var
|
|
12040
|
-
ref =
|
|
12041
|
-
|
|
12042
|
-
width =
|
|
12043
|
-
|
|
12044
|
-
height =
|
|
12045
|
-
var
|
|
12046
|
-
|
|
12047
|
-
videoRef =
|
|
12048
|
-
videoLoaded =
|
|
12049
|
-
cameraReady =
|
|
12050
|
-
microphoneReady =
|
|
12051
|
-
audioStream =
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
11969
|
+
_2 = _a.readTextTimeoutDurationMs,
|
|
11970
|
+
readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
|
|
11971
|
+
_3 = _a.readTextMinReadingMs,
|
|
11972
|
+
readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
|
|
11973
|
+
_4 = _a.disableFaceDetectionWhileAudioCapture,
|
|
11974
|
+
disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
|
|
11975
|
+
_5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
11976
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
|
|
11977
|
+
_6 = _a.mergeAVStreams,
|
|
11978
|
+
mergeAVStreams = _6 === void 0 ? false : _6,
|
|
11979
|
+
_7 = _a.classNames,
|
|
11980
|
+
classNames = _7 === void 0 ? {} : _7,
|
|
11981
|
+
_8 = _a.colors,
|
|
11982
|
+
colors = _8 === void 0 ? {} : _8,
|
|
11983
|
+
_9 = _a.verbiage,
|
|
11984
|
+
rawVerbiage = _9 === void 0 ? {} : _9,
|
|
11985
|
+
_10 = _a.debugMode,
|
|
11986
|
+
debugMode = _10 === void 0 ? false : _10;
|
|
11987
|
+
var _11 = useResizeObserver__default.default(),
|
|
11988
|
+
ref = _11.ref,
|
|
11989
|
+
_12 = _11.width,
|
|
11990
|
+
width = _12 === void 0 ? 1 : _12,
|
|
11991
|
+
_13 = _11.height,
|
|
11992
|
+
height = _13 === void 0 ? 1 : _13;
|
|
11993
|
+
var _14 = useCameraStore(),
|
|
11994
|
+
camera = _14.camera,
|
|
11995
|
+
videoRef = _14.videoRef,
|
|
11996
|
+
videoLoaded = _14.videoLoaded,
|
|
11997
|
+
cameraReady = _14.cameraReady,
|
|
11998
|
+
microphoneReady = _14.microphoneReady,
|
|
11999
|
+
audioStream = _14.audioStream,
|
|
12000
|
+
isRearFacing = _14.isRearFacing,
|
|
12001
|
+
releaseCameraAccess = _14.releaseCameraAccess;
|
|
12002
|
+
var _15 = React.useState([]),
|
|
12003
|
+
detectedObjects = _15[0],
|
|
12004
|
+
setDetectedObjects = _15[1];
|
|
12005
|
+
var _16 = React.useState(null),
|
|
12006
|
+
face = _16[0],
|
|
12007
|
+
setFace = _16[1];
|
|
12008
|
+
var _17 = React.useContext(IdCaptureModelsContext),
|
|
12009
|
+
idModelsReady = _17.ready,
|
|
12010
|
+
startIdModels = _17.start,
|
|
12011
|
+
stopIdModels = _17.stop,
|
|
12012
|
+
onIdPredictionMade = _17.onPredictionMade,
|
|
12013
|
+
setThresholds = _17.setThresholds,
|
|
12014
|
+
setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
|
|
12015
|
+
bestFrameDetails = _17.bestFrameDetails,
|
|
12016
|
+
resetBestFrame = _17.resetBestFrame,
|
|
12017
|
+
idModelError = _17.modelError;
|
|
12018
|
+
var _18 = React.useState(null),
|
|
12019
|
+
videoStartsAt = _18[0],
|
|
12020
|
+
setVideoStartsAt = _18[1];
|
|
12021
|
+
var _19 = React.useContext(SubmissionContext),
|
|
12022
|
+
setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
|
|
12023
|
+
setExpectedAudioText = _19.setExpectedAudioText;
|
|
12024
|
+
var _20 = React.useContext(SelfieGuidanceModelsContext),
|
|
12025
|
+
startSelfieGuidance = _20.start,
|
|
12026
|
+
stopSelfieGuidance = _20.stop,
|
|
12027
|
+
onSelfiePredictionMade = _20.onPredictionMade,
|
|
12028
|
+
selfieModelError = _20.error;
|
|
12029
|
+
var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
|
|
12030
|
+
isRecordingVideo = _21.isRecordingVideo,
|
|
12031
|
+
startRecordingVideo = _21.startRecordingVideo,
|
|
12032
|
+
startRecordingAudio = _21.startRecordingAudio,
|
|
12033
|
+
stopRecordingVideo = _21.stopRecordingVideo,
|
|
12034
|
+
stopRecordingAudio = _21.stopRecordingAudio,
|
|
12035
|
+
videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
|
|
12036
|
+
audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
|
|
12037
|
+
videoUrl = _21.videoUrl,
|
|
12038
|
+
audioUrl = _21.audioUrl;
|
|
12090
12039
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
12091
|
-
var
|
|
12092
|
-
countdownRemaining =
|
|
12093
|
-
setCountdownRemaining =
|
|
12040
|
+
var _22 = React.useState(-1),
|
|
12041
|
+
countdownRemaining = _22[0],
|
|
12042
|
+
setCountdownRemaining = _22[1];
|
|
12094
12043
|
React.useEffect(function () {
|
|
12095
12044
|
if (!isRecordingVideo && !videoUrl) {
|
|
12096
12045
|
startRecordingVideo();
|
|
@@ -12101,18 +12050,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12101
12050
|
var needsAudio = !!readTextPrompt && !mergeAVStreams;
|
|
12102
12051
|
var audioReady = !needsAudio || audioUrl;
|
|
12103
12052
|
if (videoUrl && audioReady) {
|
|
12104
|
-
|
|
12053
|
+
releaseCameraAccess();
|
|
12105
12054
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
|
|
12106
12055
|
}
|
|
12107
|
-
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt,
|
|
12056
|
+
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
|
|
12108
12057
|
React.useEffect(function () {
|
|
12109
12058
|
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
|
|
12110
12059
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
12111
12060
|
}
|
|
12112
12061
|
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
12113
|
-
var
|
|
12114
|
-
requestedAction =
|
|
12115
|
-
setRequestedAction =
|
|
12062
|
+
var _23 = React.useState('SHOW_ID_FRONT'),
|
|
12063
|
+
requestedAction = _23[0],
|
|
12064
|
+
setRequestedAction = _23[1];
|
|
12116
12065
|
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
12117
12066
|
React.useEffect(function startModelsWhenCapturing() {
|
|
12118
12067
|
if (!shouldRunIdModels) return;
|
|
@@ -12132,18 +12081,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12132
12081
|
bottom: 1
|
|
12133
12082
|
});
|
|
12134
12083
|
}, [setDocumentDetectionBoundaries]);
|
|
12135
|
-
var
|
|
12136
|
-
currentDetectionScore =
|
|
12137
|
-
setCurrentDetectionScore =
|
|
12138
|
-
var
|
|
12139
|
-
currentDetectedDocumentType =
|
|
12140
|
-
setCurrentDetectedDocumentType =
|
|
12084
|
+
var _24 = React.useState(0),
|
|
12085
|
+
currentDetectionScore = _24[0],
|
|
12086
|
+
setCurrentDetectionScore = _24[1];
|
|
12087
|
+
var _25 = React.useState('none'),
|
|
12088
|
+
currentDetectedDocumentType = _25[0],
|
|
12089
|
+
setCurrentDetectedDocumentType = _25[1];
|
|
12090
|
+
var _26 = React.useState(0),
|
|
12091
|
+
currentFocusScore = _26[0],
|
|
12092
|
+
setCurrentFocusScore = _26[1];
|
|
12141
12093
|
var _27 = React.useState(0),
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
var _28 = React.useState(0),
|
|
12145
|
-
goodFramesCount = _28[0],
|
|
12146
|
-
setGoodFramesCount = _28[1];
|
|
12094
|
+
goodFramesCount = _27[0],
|
|
12095
|
+
setGoodFramesCount = _27[1];
|
|
12147
12096
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
12148
12097
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
12149
12098
|
React.useEffect(function () {
|
|
@@ -12164,9 +12113,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12164
12113
|
} : 0);
|
|
12165
12114
|
});
|
|
12166
12115
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
|
|
12167
|
-
var
|
|
12168
|
-
idFrontCaptureStartedAt =
|
|
12169
|
-
setFirstGoodFrameTime =
|
|
12116
|
+
var _28 = React.useState(null),
|
|
12117
|
+
idFrontCaptureStartedAt = _28[0],
|
|
12118
|
+
setFirstGoodFrameTime = _28[1];
|
|
12170
12119
|
React.useEffect(function () {
|
|
12171
12120
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
12172
12121
|
}, [goodFramesCount]);
|
|
@@ -12187,9 +12136,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12187
12136
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
12188
12137
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
12189
12138
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
12190
|
-
var
|
|
12191
|
-
countdownStartedAt =
|
|
12192
|
-
setCountdownStartedAt =
|
|
12139
|
+
var _29 = React.useState(),
|
|
12140
|
+
countdownStartedAt = _29[0],
|
|
12141
|
+
setCountdownStartedAt = _29[1];
|
|
12193
12142
|
var photoCanvas = React.useRef(null);
|
|
12194
12143
|
var frameLock = React.useRef(false);
|
|
12195
12144
|
var captureFrame = React.useCallback(function () {
|
|
@@ -12312,9 +12261,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12312
12261
|
stopSelfieGuidance();
|
|
12313
12262
|
};
|
|
12314
12263
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
12315
|
-
var
|
|
12316
|
-
numFramesWithoutFaces =
|
|
12317
|
-
setNumFramesWithoutFaces =
|
|
12264
|
+
var _30 = React.useState(0),
|
|
12265
|
+
numFramesWithoutFaces = _30[0],
|
|
12266
|
+
setNumFramesWithoutFaces = _30[1];
|
|
12318
12267
|
onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
12319
12268
|
var face = _a.face;
|
|
12320
12269
|
if (selfieModelError) return;
|
|
@@ -12330,12 +12279,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12330
12279
|
}
|
|
12331
12280
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
12332
12281
|
var theme = styled.useTheme();
|
|
12333
|
-
var
|
|
12282
|
+
var _31 = useTranslations(rawVerbiage, {
|
|
12334
12283
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
12335
12284
|
captureBtnText: 'Capture'
|
|
12336
12285
|
}),
|
|
12337
|
-
captureBtnText =
|
|
12338
|
-
faceNotCenteredText =
|
|
12286
|
+
captureBtnText = _31.captureBtnText,
|
|
12287
|
+
faceNotCenteredText = _31.faceNotCenteredText;
|
|
12339
12288
|
var debugScalingDetails = useDebugScalingDetails({
|
|
12340
12289
|
enabled: debugMode,
|
|
12341
12290
|
pageWidth: width,
|
|
@@ -12371,15 +12320,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12371
12320
|
faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
|
|
12372
12321
|
idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
|
|
12373
12322
|
}), debugMode && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
12374
|
-
"$flipX": !
|
|
12323
|
+
"$flipX": !isRearFacing
|
|
12375
12324
|
}, detectedObjects.map(function (obj, i) {
|
|
12376
|
-
var _a;
|
|
12377
12325
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
12378
12326
|
key: i,
|
|
12379
12327
|
obj: obj,
|
|
12380
12328
|
scaling: debugScalingDetails,
|
|
12381
12329
|
color: "blue",
|
|
12382
|
-
flipX: !
|
|
12330
|
+
flipX: !isRearFacing
|
|
12383
12331
|
});
|
|
12384
12332
|
})), /*#__PURE__*/React__namespace.default.createElement(DebugBoundingBoxOverlay, null, face && ( /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceDebugBox, {
|
|
12385
12333
|
face: face,
|
|
@@ -12388,9 +12336,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12388
12336
|
className: classNames.guidanceMessageContainer
|
|
12389
12337
|
}, /*#__PURE__*/React__namespace.default.createElement(GuidanceMessage, {
|
|
12390
12338
|
className: classNames.guidanceMessage,
|
|
12391
|
-
"$background": (
|
|
12392
|
-
"$textColor": (
|
|
12393
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null,
|
|
12339
|
+
"$background": (_o = (_m = (_l = theme.guidanceMessages) === null || _l === void 0 ? void 0 : _l.negative) === null || _m === void 0 ? void 0 : _m.backgroundColor) !== null && _o !== void 0 ? _o : 'red',
|
|
12340
|
+
"$textColor": (_r = (_q = (_p = theme.guidanceMessages) === null || _p === void 0 ? void 0 : _p.negative) === null || _q === void 0 ? void 0 : _q.textColor) !== null && _r !== void 0 ? _r : 'white'
|
|
12341
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__namespace.default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__namespace.default.createElement("br", null), "Document Type: ", currentDetectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__namespace.default.createElement("br", null), "Best Frame Detection Score:", ' ', (_t = (_s = bestFrameDetails.current) === null || _s === void 0 ? void 0 : _s.detectionScore) !== null && _t !== void 0 ? _t : 0, /*#__PURE__*/React__namespace.default.createElement("br", null), "Best Frame Focus Score: ", (_v = (_u = bestFrameDetails.current) === null || _u === void 0 ? void 0 : _u.focusScore) !== null && _v !== void 0 ? _v : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(CountdownContainer, {
|
|
12394
12342
|
className: classNames.countdownContainer
|
|
12395
12343
|
}, /*#__PURE__*/React__namespace.default.createElement(Countdown, {
|
|
12396
12344
|
className: classNames.countdown
|
|
@@ -12653,7 +12601,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12653
12601
|
});
|
|
12654
12602
|
setCaptureState('CAPTURING_ID');
|
|
12655
12603
|
}, []);
|
|
12656
|
-
var isCapturingId = ['LOADING', 'CAPTURING_ID'].includes(captureState);
|
|
12604
|
+
var isCapturingId = !skipIdCapture && ['LOADING', 'CAPTURING_ID'].includes(captureState);
|
|
12657
12605
|
React.useEffect(function () {
|
|
12658
12606
|
if (submissionStatus === SubmissionStatus.SUBMITTING) releaseCameraAccess();
|
|
12659
12607
|
}, [submissionStatus]);
|
|
@@ -12687,16 +12635,14 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12687
12635
|
className: "flex"
|
|
12688
12636
|
}, /*#__PURE__*/React__namespace.default.createElement(Spinner, null));
|
|
12689
12637
|
}
|
|
12690
|
-
return /*#__PURE__*/React__namespace.default.createElement(
|
|
12691
|
-
|
|
12692
|
-
preferContinuityCamera: isCapturingId,
|
|
12638
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
12639
|
+
preferIphoneContinuityCamera: isCapturingId,
|
|
12693
12640
|
preferFrontFacingCamera: !isCapturingId,
|
|
12694
12641
|
requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
|
|
12695
12642
|
maxVideoWidth: isCapturingId ? 1920 : 1280,
|
|
12696
12643
|
maxFps: isCapturingId ? 60 : 30,
|
|
12697
12644
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12698
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12699
|
-
debugMode: debugMode
|
|
12645
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12700
12646
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
12701
12647
|
autoStart: false,
|
|
12702
12648
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
@@ -12822,17 +12768,15 @@ function CompositeWizard(_a) {
|
|
|
12822
12768
|
_o = _a.captureSignatureVideo,
|
|
12823
12769
|
captureSignatureVideo = _o === void 0 ? false : _o,
|
|
12824
12770
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
12825
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
checkIndex = _r[0],
|
|
12835
|
-
setCheckIndex = _r[1];
|
|
12771
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied;
|
|
12772
|
+
var _p = React.useContext(SubmissionContext),
|
|
12773
|
+
submit = _p.submit,
|
|
12774
|
+
submissionStatus = _p.submissionStatus,
|
|
12775
|
+
setSignatureData = _p.setSignatureData,
|
|
12776
|
+
setAdditionalDocuments = _p.setAdditionalDocuments;
|
|
12777
|
+
var _q = React.useState(0),
|
|
12778
|
+
checkIndex = _q[0],
|
|
12779
|
+
setCheckIndex = _q[1];
|
|
12836
12780
|
var checks = React.useMemo(function () {
|
|
12837
12781
|
var _a, _b;
|
|
12838
12782
|
var checks = __spreadArray([], userChecks, true);
|
|
@@ -12910,16 +12854,6 @@ function CompositeWizard(_a) {
|
|
|
12910
12854
|
return i + 1;
|
|
12911
12855
|
});
|
|
12912
12856
|
}, [onVideoSignatureCompleteProp]);
|
|
12913
|
-
var _s = React.useState(0),
|
|
12914
|
-
videoSignatureAttempts = _s[0],
|
|
12915
|
-
setVideoSignatureAttempts = _s[1];
|
|
12916
|
-
var onVideoSignatureRetryProp = videoSignatureCaptureProps.onRetryClicked;
|
|
12917
|
-
var onVideoSignatureRetry = React.useCallback(function () {
|
|
12918
|
-
onVideoSignatureRetryProp === null || onVideoSignatureRetryProp === void 0 ? void 0 : onVideoSignatureRetryProp();
|
|
12919
|
-
setVideoSignatureAttempts(function (n) {
|
|
12920
|
-
return n + 1;
|
|
12921
|
-
});
|
|
12922
|
-
}, [onVideoSignatureRetryProp]);
|
|
12923
12857
|
var onAdditionalDocumentCaptureCompleteProp = additionalDocumentCaptureProps === null || additionalDocumentCaptureProps === void 0 ? void 0 : additionalDocumentCaptureProps.onComplete;
|
|
12924
12858
|
var onAdditionalDocumentCaptureComplete = React.useCallback(function (uploadedDocuments) {
|
|
12925
12859
|
setAdditionalDocuments(uploadedDocuments);
|
|
@@ -12948,11 +12882,9 @@ function CompositeWizard(_a) {
|
|
|
12948
12882
|
}
|
|
12949
12883
|
switch (checks[checkIndex]) {
|
|
12950
12884
|
case 'IdCapture':
|
|
12951
|
-
return /*#__PURE__*/React__namespace.default.createElement(
|
|
12952
|
-
key: "IdCaptureCamera",
|
|
12885
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
12953
12886
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12954
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12955
|
-
debugMode: debugMode
|
|
12887
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12956
12888
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
12957
12889
|
autoStart: false,
|
|
12958
12890
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
@@ -12969,13 +12901,11 @@ function CompositeWizard(_a) {
|
|
|
12969
12901
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12970
12902
|
}));
|
|
12971
12903
|
case 'FaceLiveness':
|
|
12972
|
-
return /*#__PURE__*/React__namespace.default.createElement(
|
|
12973
|
-
key: "FaceLivenessCamera",
|
|
12904
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
12974
12905
|
preferFrontFacingCamera: true,
|
|
12975
|
-
|
|
12906
|
+
preferIphoneContinuityCamera: false,
|
|
12976
12907
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12977
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12978
|
-
debugMode: debugMode
|
|
12908
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12979
12909
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
12980
12910
|
autoStart: false,
|
|
12981
12911
|
onModelError: faceLivenessProps.onModelError,
|
|
@@ -12988,15 +12918,13 @@ function CompositeWizard(_a) {
|
|
|
12988
12918
|
onAccept: onSignatureCaptureSuccess
|
|
12989
12919
|
}));
|
|
12990
12920
|
case 'VideoSignatureCapture':
|
|
12991
|
-
return /*#__PURE__*/React__namespace.default.createElement(
|
|
12992
|
-
|
|
12993
|
-
preferContinuityCamera: false,
|
|
12921
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
12922
|
+
preferIphoneContinuityCamera: false,
|
|
12994
12923
|
preferFrontFacingCamera: true,
|
|
12995
12924
|
maxVideoWidth: 1280,
|
|
12996
12925
|
maxFps: 30,
|
|
12997
12926
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12998
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12999
|
-
debugMode: debugMode
|
|
12927
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
13000
12928
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
13001
12929
|
autoStart: false,
|
|
13002
12930
|
throttleMs: 250,
|
|
@@ -13004,8 +12932,7 @@ function CompositeWizard(_a) {
|
|
|
13004
12932
|
modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
|
|
13005
12933
|
requireVerticalFaceCentering: false
|
|
13006
12934
|
}, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
|
|
13007
|
-
onComplete: onVideoSignatureComplete
|
|
13008
|
-
onRetryClicked: onVideoSignatureRetry
|
|
12935
|
+
onComplete: onVideoSignatureComplete
|
|
13009
12936
|
}))));
|
|
13010
12937
|
case 'AdditionalDocumentCapture':
|
|
13011
12938
|
return /*#__PURE__*/React__namespace.default.createElement(AdditionalDocumentCaptureWizard, _assign({}, additionalDocumentCaptureProps, {
|
|
@@ -13456,8 +13383,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13456
13383
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
13457
13384
|
captureSignature: captureSignature,
|
|
13458
13385
|
captureSignatureVideo: captureSignatureVideo,
|
|
13459
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13460
|
-
debugMode: debugMode
|
|
13386
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13461
13387
|
}))));
|
|
13462
13388
|
};
|
|
13463
13389
|
|
|
@@ -13563,8 +13489,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
13563
13489
|
return ['FaceLiveness'];
|
|
13564
13490
|
}, []),
|
|
13565
13491
|
faceLivenessProps: faceLivenessProps,
|
|
13566
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13567
|
-
debugMode: debugMode
|
|
13492
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13568
13493
|
}))));
|
|
13569
13494
|
};
|
|
13570
13495
|
|
|
@@ -13797,8 +13722,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
13797
13722
|
additionalDocumentCaptureProps: additionalDocumentCaptureProps,
|
|
13798
13723
|
captureSignature: captureSignature,
|
|
13799
13724
|
captureSignatureVideo: captureSignatureVideo,
|
|
13800
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13801
|
-
debugMode: debugMode
|
|
13725
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13802
13726
|
}))));
|
|
13803
13727
|
};
|
|
13804
13728
|
|
|
@@ -14053,8 +13977,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
14053
13977
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
14054
13978
|
captureSignature: captureSignature,
|
|
14055
13979
|
captureSignatureVideo: captureSignatureVideo,
|
|
14056
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
14057
|
-
debugMode: debugMode
|
|
13980
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
14058
13981
|
}))));
|
|
14059
13982
|
};
|
|
14060
13983
|
|
|
@@ -14386,7 +14309,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
14386
14309
|
var _l = React.useState('LOADING'),
|
|
14387
14310
|
captureState = _l[0],
|
|
14388
14311
|
setCaptureState = _l[1];
|
|
14389
|
-
var _m =
|
|
14312
|
+
var _m = useCameraStore(),
|
|
14390
14313
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
14391
14314
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
14392
14315
|
var _o = React.useContext(SelfieGuidanceModelsContext),
|
|
@@ -14592,10 +14515,9 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
14592
14515
|
onSubmit: onSubmit,
|
|
14593
14516
|
geolocationEnabled: geolocationEnabled,
|
|
14594
14517
|
geolocationRequired: geolocationRequired
|
|
14595
|
-
}, /*#__PURE__*/React__namespace.default.createElement(
|
|
14518
|
+
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
14596
14519
|
preferFrontFacingCamera: true,
|
|
14597
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
14598
|
-
debugMode: debugMode
|
|
14520
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
14599
14521
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
14600
14522
|
autoStart: false,
|
|
14601
14523
|
onModelError: onModelError,
|
|
@@ -14944,7 +14866,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
14944
14866
|
var _l = React.useState('LOADING'),
|
|
14945
14867
|
captureState = _l[0],
|
|
14946
14868
|
setCaptureState = _l[1];
|
|
14947
|
-
var _m =
|
|
14869
|
+
var _m = useCameraStore(),
|
|
14948
14870
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
14949
14871
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
14950
14872
|
var _o = React.useContext(SelfieGuidanceModelsContext),
|
|
@@ -15148,10 +15070,9 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
15148
15070
|
onSubmit: onSubmit,
|
|
15149
15071
|
geolocationEnabled: geolocationEnabled,
|
|
15150
15072
|
geolocationRequired: geolocationRequired
|
|
15151
|
-
}, /*#__PURE__*/React__namespace.default.createElement(
|
|
15073
|
+
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
15152
15074
|
preferFrontFacingCamera: true,
|
|
15153
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15154
|
-
debugMode: debugMode
|
|
15075
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15155
15076
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
15156
15077
|
autoStart: false,
|
|
15157
15078
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -15478,8 +15399,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
15478
15399
|
captureSignature: captureSignature,
|
|
15479
15400
|
captureSignatureVideo: captureSignatureVideo,
|
|
15480
15401
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15481
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15482
|
-
debugMode: debugMode
|
|
15402
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15483
15403
|
}))));
|
|
15484
15404
|
};
|
|
15485
15405
|
|
|
@@ -15636,8 +15556,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
15636
15556
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
15637
15557
|
captureSignature: captureSignature,
|
|
15638
15558
|
captureSignatureVideo: captureSignatureVideo,
|
|
15639
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15640
|
-
debugMode: debugMode
|
|
15559
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15641
15560
|
}))));
|
|
15642
15561
|
};
|
|
15643
15562
|
|
|
@@ -15695,11 +15614,10 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
15695
15614
|
onDocumentUploadFailed: onDocumentUploadFailed,
|
|
15696
15615
|
geolocationEnabled: geolocationEnabled,
|
|
15697
15616
|
geolocationRequired: geolocationRequired
|
|
15698
|
-
}, /*#__PURE__*/React__namespace.default.createElement(
|
|
15617
|
+
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
15699
15618
|
requestAccessAutomatically: false,
|
|
15700
|
-
|
|
15701
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15702
|
-
debugMode: debugMode
|
|
15619
|
+
preferIphoneContinuityCamera: true,
|
|
15620
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15703
15621
|
}, /*#__PURE__*/React__namespace.default.createElement(DocumentCaptureWizard, {
|
|
15704
15622
|
onSuccess: onComplete,
|
|
15705
15623
|
onExitCapture: onExitCapture,
|