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
package/dist/sdk2.esm.js
CHANGED
|
@@ -8,10 +8,12 @@ import { Upload } from 'tus-js-client';
|
|
|
8
8
|
import SparkMD5 from 'spark-md5';
|
|
9
9
|
import useResizeObserver from 'use-resize-observer';
|
|
10
10
|
import { ImageSegmenter, FilesetResolver, ImageClassifier, FaceDetector, ObjectDetector } from '@mediapipe/tasks-vision';
|
|
11
|
+
import { createStore, useStore } from 'zustand';
|
|
11
12
|
import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
|
|
12
13
|
import { createPortal } from 'react-dom';
|
|
13
14
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
14
15
|
import i18n from 'i18next';
|
|
16
|
+
import { useShallow } from 'zustand/react/shallow';
|
|
15
17
|
import SignatureCanvas from 'react-signature-canvas';
|
|
16
18
|
|
|
17
19
|
/******************************************************************************
|
|
@@ -201,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
201
203
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
202
204
|
};
|
|
203
205
|
|
|
204
|
-
var webSdkVersion = '2.2.
|
|
206
|
+
var webSdkVersion = '2.2.37';
|
|
205
207
|
|
|
206
208
|
function getPlatform() {
|
|
207
209
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -770,11 +772,11 @@ function setDefaultAuthUrl(url) {
|
|
|
770
772
|
if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
|
|
771
773
|
defaultAuthUrl = url;
|
|
772
774
|
}
|
|
773
|
-
var initialState$
|
|
775
|
+
var initialState$6 = {
|
|
774
776
|
authUrl: defaultAuthUrl,
|
|
775
777
|
sessionCheckState: 'READY'
|
|
776
778
|
};
|
|
777
|
-
var AuthStateContext = /*#__PURE__*/createContext(initialState$
|
|
779
|
+
var AuthStateContext = /*#__PURE__*/createContext(initialState$6);
|
|
778
780
|
var AuthDispatchContext = /*#__PURE__*/createContext(function () {});
|
|
779
781
|
var reducer$4 = function reducer(state, action) {
|
|
780
782
|
switch (action.type) {
|
|
@@ -806,7 +808,7 @@ function useAuthReducer(authUrl, sessionId) {
|
|
|
806
808
|
if (authUrl === void 0) {
|
|
807
809
|
authUrl = defaultAuthUrl;
|
|
808
810
|
}
|
|
809
|
-
var _a = useReducer(reducer$4, _assign(_assign({}, initialState$
|
|
811
|
+
var _a = useReducer(reducer$4, _assign(_assign({}, initialState$6), {
|
|
810
812
|
authUrl: authUrl
|
|
811
813
|
})),
|
|
812
814
|
state = _a[0],
|
|
@@ -1886,608 +1888,6 @@ function calculateMd5(blob) {
|
|
|
1886
1888
|
});
|
|
1887
1889
|
}
|
|
1888
1890
|
|
|
1889
|
-
function getFrameDimensions(frame) {
|
|
1890
|
-
var frameWidth = frame.width,
|
|
1891
|
-
frameHeight = frame.height;
|
|
1892
|
-
if (frame instanceof HTMLImageElement) {
|
|
1893
|
-
frameWidth = frame.naturalWidth;
|
|
1894
|
-
frameHeight = frame.naturalHeight;
|
|
1895
|
-
}
|
|
1896
|
-
if (frame instanceof HTMLVideoElement) {
|
|
1897
|
-
frameWidth = frame.videoWidth;
|
|
1898
|
-
frameHeight = frame.videoHeight;
|
|
1899
|
-
}
|
|
1900
|
-
return [frameWidth, frameHeight];
|
|
1901
|
-
}
|
|
1902
|
-
|
|
1903
|
-
var InvisibleCanvas = styled.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
1904
|
-
function drawToCanvas(canvas, frame, width, height) {
|
|
1905
|
-
if (!canvas) return;
|
|
1906
|
-
var ctx = canvas.getContext('2d');
|
|
1907
|
-
if (!ctx) return;
|
|
1908
|
-
if (!width || !height) {
|
|
1909
|
-
var _a = getFrameDimensions(frame),
|
|
1910
|
-
frameWidth = _a[0],
|
|
1911
|
-
frameHeight = _a[1];
|
|
1912
|
-
width || (width = frameWidth);
|
|
1913
|
-
height || (height = frameHeight);
|
|
1914
|
-
}
|
|
1915
|
-
canvas.width = width;
|
|
1916
|
-
canvas.height = height;
|
|
1917
|
-
ctx.drawImage(frame, 0, 0, width, height);
|
|
1918
|
-
}
|
|
1919
|
-
function clearCanvas(canvas) {
|
|
1920
|
-
var _a;
|
|
1921
|
-
(_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);
|
|
1922
|
-
}
|
|
1923
|
-
var templateObject_1$G;
|
|
1924
|
-
|
|
1925
|
-
function listAvailableCameras(facingMode_1) {
|
|
1926
|
-
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
1927
|
-
var cameraEnumerationStream, videoDevices;
|
|
1928
|
-
if (requestMicAccess === void 0) {
|
|
1929
|
-
requestMicAccess = false;
|
|
1930
|
-
}
|
|
1931
|
-
return __generator(this, function (_a) {
|
|
1932
|
-
switch (_a.label) {
|
|
1933
|
-
case 0:
|
|
1934
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
1935
|
-
video: {
|
|
1936
|
-
facingMode: {
|
|
1937
|
-
exact: facingMode
|
|
1938
|
-
}
|
|
1939
|
-
},
|
|
1940
|
-
audio: requestMicAccess
|
|
1941
|
-
})
|
|
1942
|
-
// This lists all available cameras attached to the user's device.
|
|
1943
|
-
];
|
|
1944
|
-
case 1:
|
|
1945
|
-
cameraEnumerationStream = _a.sent();
|
|
1946
|
-
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
1947
|
-
case 2:
|
|
1948
|
-
videoDevices = _a.sent().filter(function (_a) {
|
|
1949
|
-
var kind = _a.kind;
|
|
1950
|
-
return kind === 'videoinput';
|
|
1951
|
-
});
|
|
1952
|
-
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
1953
|
-
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
1954
|
-
track.enabled = false;
|
|
1955
|
-
track.stop();
|
|
1956
|
-
});
|
|
1957
|
-
cameraEnumerationStream = null;
|
|
1958
|
-
return [2 /*return*/, videoDevices];
|
|
1959
|
-
}
|
|
1960
|
-
});
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
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) {
|
|
1964
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
1965
|
-
});
|
|
1966
|
-
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) {
|
|
1967
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
1968
|
-
});
|
|
1969
|
-
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) {
|
|
1970
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
1971
|
-
});
|
|
1972
|
-
var labelMatches = function labelMatches(labelOrDevice, labelSetOrLabel) {
|
|
1973
|
-
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
1974
|
-
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
1975
|
-
return labelSet.some(function (l) {
|
|
1976
|
-
return label.includes(l);
|
|
1977
|
-
});
|
|
1978
|
-
};
|
|
1979
|
-
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
1980
|
-
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
1981
|
-
};
|
|
1982
|
-
var currentCamera;
|
|
1983
|
-
var currentAudioStream;
|
|
1984
|
-
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
1985
|
-
releaseCameraAccess();
|
|
1986
|
-
log('obtaining camera access...');
|
|
1987
|
-
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
1988
|
-
width = _a.width,
|
|
1989
|
-
height = _a.height;
|
|
1990
|
-
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
1991
|
-
var isRearFacing = labelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearLabels, true), backUltraWideLabels, true), ['iphone'], false));
|
|
1992
|
-
var release = function release() {
|
|
1993
|
-
stream.getTracks().forEach(function (track) {
|
|
1994
|
-
track.enabled = false;
|
|
1995
|
-
track.stop();
|
|
1996
|
-
});
|
|
1997
|
-
if (video) {
|
|
1998
|
-
video.pause();
|
|
1999
|
-
video.srcObject = null;
|
|
2000
|
-
video.src = '';
|
|
2001
|
-
}
|
|
2002
|
-
};
|
|
2003
|
-
width || (width = 0);
|
|
2004
|
-
height || (height = 0);
|
|
2005
|
-
currentCamera = {
|
|
2006
|
-
label: deviceLabel,
|
|
2007
|
-
stream: stream,
|
|
2008
|
-
width: width,
|
|
2009
|
-
height: height,
|
|
2010
|
-
isRearFacing: isRearFacing,
|
|
2011
|
-
release: release
|
|
2012
|
-
};
|
|
2013
|
-
if (video) video.srcObject = stream;
|
|
2014
|
-
return currentCamera;
|
|
2015
|
-
}
|
|
2016
|
-
function releaseCameraAccess() {
|
|
2017
|
-
if (!currentCamera) return;
|
|
2018
|
-
log('releasing camera access...');
|
|
2019
|
-
currentCamera.release();
|
|
2020
|
-
currentCamera = undefined;
|
|
2021
|
-
}
|
|
2022
|
-
function releaseMicrophoneAccess() {
|
|
2023
|
-
var _a;
|
|
2024
|
-
if (!currentAudioStream) return;
|
|
2025
|
-
log('releasing microphone access...');
|
|
2026
|
-
(_a = currentAudioStream.stop) === null || _a === void 0 ? void 0 : _a.call(currentAudioStream);
|
|
2027
|
-
currentAudioStream.getAudioTracks().forEach(function (t) {
|
|
2028
|
-
var _a;
|
|
2029
|
-
(_a = t.stop) === null || _a === void 0 ? void 0 : _a.call(t);
|
|
2030
|
-
});
|
|
2031
|
-
currentAudioStream = undefined;
|
|
2032
|
-
}
|
|
2033
|
-
function usePreferredCaptureDevice(_a) {
|
|
2034
|
-
var _b = _a === void 0 ? {} : _a,
|
|
2035
|
-
_c = _b.requestAccessAutomatically,
|
|
2036
|
-
requestAccessAutomatically = _c === void 0 ? true : _c,
|
|
2037
|
-
_d = _b.preferFrontFacingCamera,
|
|
2038
|
-
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
2039
|
-
_e = _b.preferContinuityCamera,
|
|
2040
|
-
preferContinuityCamera = _e === void 0 ? true : _e,
|
|
2041
|
-
_f = _b.requireMicrophoneAccess,
|
|
2042
|
-
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
2043
|
-
_g = _b.maxVideoWidth,
|
|
2044
|
-
maxVideoWidth = _g === void 0 ? 1920 : _g,
|
|
2045
|
-
maxFps = _b.maxFps,
|
|
2046
|
-
_h = _b.debugMode,
|
|
2047
|
-
debugMode = _h === void 0 ? false : _h;
|
|
2048
|
-
var videoRef = useRef(null);
|
|
2049
|
-
var videoRefStack = useRef([]);
|
|
2050
|
-
var cameraRef = useRef(null);
|
|
2051
|
-
var _j = useState(false),
|
|
2052
|
-
cameraReady = _j[0],
|
|
2053
|
-
setCameraReady = _j[1];
|
|
2054
|
-
var _k = useState(false),
|
|
2055
|
-
microphoneReady = _k[0],
|
|
2056
|
-
setMicrophoneReady = _k[1];
|
|
2057
|
-
var _l = useState(null),
|
|
2058
|
-
videoDevice = _l[0],
|
|
2059
|
-
setVideoDevice = _l[1];
|
|
2060
|
-
var _m = useState(null),
|
|
2061
|
-
audioStream = _m[0],
|
|
2062
|
-
setAudioStream = _m[1];
|
|
2063
|
-
var _o = useState(false),
|
|
2064
|
-
videoLoaded = _o[0],
|
|
2065
|
-
setVideoLoaded = _o[1];
|
|
2066
|
-
var _p = useState(false),
|
|
2067
|
-
iphoneContinuityCameraAvailable = _p[0],
|
|
2068
|
-
setIphoneContinuityCameraAvailable = _p[1];
|
|
2069
|
-
var _q = useState(preferContinuityCamera),
|
|
2070
|
-
iphoneContinuityCameraAllowed = _q[0],
|
|
2071
|
-
setIphoneContinuityCameraAllowed = _q[1];
|
|
2072
|
-
var _r = useState(false),
|
|
2073
|
-
iphoneContinuityCameraDenied = _r[0],
|
|
2074
|
-
setIphoneContinuityCameraDenied = _r[1];
|
|
2075
|
-
var _s = useState(false),
|
|
2076
|
-
cameraAccessDenied = _s[0],
|
|
2077
|
-
setCameraAccessDenied = _s[1];
|
|
2078
|
-
var _t = useState(false),
|
|
2079
|
-
microphoneAccessDenied = _t[0],
|
|
2080
|
-
setMicrophoneAccessDenied = _t[1];
|
|
2081
|
-
var videoRefElement = videoRef.current;
|
|
2082
|
-
useEffect(function pushVideoRefToStackWhenChanged() {
|
|
2083
|
-
// proceed if the video element being mounted is not already at the top of the videoRefStack.
|
|
2084
|
-
var topOfStack = videoRefStack.current.slice(-1)[0];
|
|
2085
|
-
if (videoRefElement && videoRefElement !== topOfStack) {
|
|
2086
|
-
log('adding video to stack', videoRefElement);
|
|
2087
|
-
videoRefStack.current.push(videoRefElement);
|
|
2088
|
-
}
|
|
2089
|
-
}, [videoRefElement]);
|
|
2090
|
-
var onVideoUnmounted = useCallback(function (videoElement) {
|
|
2091
|
-
log('removing video from stack', videoElement);
|
|
2092
|
-
videoRefStack.current = videoRefStack.current.filter(function (v) {
|
|
2093
|
-
return v !== videoElement;
|
|
2094
|
-
});
|
|
2095
|
-
videoRef.current = videoRefStack.current.slice(-1)[0]; // top of stack.
|
|
2096
|
-
log('new videoRef is', videoRef.current);
|
|
2097
|
-
}, []);
|
|
2098
|
-
useEffect(function resetCameraOnContinuityPreferenceChanged() {
|
|
2099
|
-
if (debugMode) {
|
|
2100
|
-
log('iphone continuity camera allowed changed', iphoneContinuityCameraAllowed);
|
|
2101
|
-
}
|
|
2102
|
-
releaseCameraAccess();
|
|
2103
|
-
cameraRef.current = null;
|
|
2104
|
-
setVideoLoaded(false);
|
|
2105
|
-
}, [debugMode, iphoneContinuityCameraAllowed]);
|
|
2106
|
-
// NOTE: the bound callback function here is called requestCameraAccess, because
|
|
2107
|
-
// it initiates the useEffect chain that results in camera access being requested
|
|
2108
|
-
// (requestCameraAccessAutomatically -> chooseFromAvailableCameras -> accessChosenCamera).
|
|
2109
|
-
//
|
|
2110
|
-
// We chose to title the inner function "chooseFromAvailableCameras" because
|
|
2111
|
-
// that's all it literally does -- the available cameras are enumerated, and then
|
|
2112
|
-
// the result is parsed to decide which one we like best, which is then passed to
|
|
2113
|
-
// setVideoDevice, which causes accessChosenCamera to trigger.
|
|
2114
|
-
//
|
|
2115
|
-
// I am not a huge fan of getUserMedia's design -- you need to call it twice in order
|
|
2116
|
-
// to select the "best" camera for your application's purposes.
|
|
2117
|
-
var requestCameraAccess = useCallback(function chooseFromAvailableCameras() {
|
|
2118
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2119
|
-
var availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, e_1;
|
|
2120
|
-
var _a, _b;
|
|
2121
|
-
return __generator(this, function (_c) {
|
|
2122
|
-
switch (_c.label) {
|
|
2123
|
-
case 0:
|
|
2124
|
-
setCameraReady(false);
|
|
2125
|
-
setCameraAccessDenied(false);
|
|
2126
|
-
_c.label = 1;
|
|
2127
|
-
case 1:
|
|
2128
|
-
_c.trys.push([1, 3,, 4]);
|
|
2129
|
-
return [4 /*yield*/, listAvailableCameras()];
|
|
2130
|
-
case 2:
|
|
2131
|
-
availableCameras = _c.sent();
|
|
2132
|
-
selectedCamera = void 0;
|
|
2133
|
-
if (debugMode) {
|
|
2134
|
-
log('availableCameras', availableCameras);
|
|
2135
|
-
}
|
|
2136
|
-
platform_1 = getPlatform();
|
|
2137
|
-
if (debugMode) {
|
|
2138
|
-
log('platformDetails', platform_1);
|
|
2139
|
-
}
|
|
2140
|
-
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
2141
|
-
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
2142
|
-
return labelMatches(deviceInfo, 'iphone');
|
|
2143
|
-
});
|
|
2144
|
-
setIphoneContinuityCameraAvailable(!!iphoneContinuityCamera);
|
|
2145
|
-
if (iphoneContinuityCamera && iphoneContinuityCameraAllowed) {
|
|
2146
|
-
selectedCamera = iphoneContinuityCamera;
|
|
2147
|
-
}
|
|
2148
|
-
} 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) {
|
|
2149
|
-
return c.label.startsWith('camera2 ');
|
|
2150
|
-
})) {
|
|
2151
|
-
availableCameras = availableCameras.sort(function (a, b) {
|
|
2152
|
-
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
2153
|
-
});
|
|
2154
|
-
if (debugMode) {
|
|
2155
|
-
log('cameras have been sorted', availableCameras);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
if (preferFrontFacingCamera) {
|
|
2159
|
-
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2160
|
-
return labelMatches(deviceInfo, frontLabels);
|
|
2161
|
-
});
|
|
2162
|
-
}
|
|
2163
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2164
|
-
return labelMatches(deviceInfo, 'backtriplecamera');
|
|
2165
|
-
}));
|
|
2166
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2167
|
-
return labelMatches(deviceInfo, 'backdualcamera');
|
|
2168
|
-
}));
|
|
2169
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2170
|
-
return labelMatches(deviceInfo, rearLabels) && !labelMatches(deviceInfo, backUltraWideLabels);
|
|
2171
|
-
}));
|
|
2172
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
2173
|
-
return labelMatches(deviceInfo, rearLabels);
|
|
2174
|
-
}));
|
|
2175
|
-
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
2176
|
-
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) {
|
|
2177
|
-
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
2178
|
-
}
|
|
2179
|
-
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
2180
|
-
if (debugMode) log('selectedCamera', selectedCamera);
|
|
2181
|
-
setVideoDevice(selectedCamera);
|
|
2182
|
-
return [3 /*break*/, 4];
|
|
2183
|
-
case 3:
|
|
2184
|
-
e_1 = _c.sent();
|
|
2185
|
-
if (e_1.name === 'NotAllowedError') {
|
|
2186
|
-
error('camera access has been blocked by the user', e_1);
|
|
2187
|
-
setCameraAccessDenied(true);
|
|
2188
|
-
} else {
|
|
2189
|
-
error('camera access encountered some other error', e_1);
|
|
2190
|
-
throw e_1;
|
|
2191
|
-
}
|
|
2192
|
-
return [3 /*break*/, 4];
|
|
2193
|
-
case 4:
|
|
2194
|
-
return [2 /*return*/];
|
|
2195
|
-
}
|
|
2196
|
-
});
|
|
2197
|
-
});
|
|
2198
|
-
}, [debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
|
|
2199
|
-
useEffect(function requestCameraAccessAutomatically() {
|
|
2200
|
-
if (requestAccessAutomatically && !cameraAccessDenied) {
|
|
2201
|
-
requestCameraAccess()["catch"](error);
|
|
2202
|
-
}
|
|
2203
|
-
}, [cameraAccessDenied, requestAccessAutomatically, requestCameraAccess]);
|
|
2204
|
-
useEffect(function accessChosenCamera() {
|
|
2205
|
-
var _this = this;
|
|
2206
|
-
var _a;
|
|
2207
|
-
if (!videoDevice) return;
|
|
2208
|
-
var cleanup = function cleanup() {
|
|
2209
|
-
releaseCameraAccess();
|
|
2210
|
-
cameraRef.current = null;
|
|
2211
|
-
setVideoLoaded(false);
|
|
2212
|
-
};
|
|
2213
|
-
if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
|
|
2214
|
-
(function () {
|
|
2215
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
2216
|
-
var constraints, stream, e_2, handleStreamEnded;
|
|
2217
|
-
var _a;
|
|
2218
|
-
return __generator(this, function (_b) {
|
|
2219
|
-
switch (_b.label) {
|
|
2220
|
-
case 0:
|
|
2221
|
-
constraints = {
|
|
2222
|
-
audio: false,
|
|
2223
|
-
video: {
|
|
2224
|
-
deviceId: {
|
|
2225
|
-
exact: videoDevice.deviceId
|
|
2226
|
-
},
|
|
2227
|
-
width: {
|
|
2228
|
-
ideal: maxVideoWidth
|
|
2229
|
-
},
|
|
2230
|
-
aspectRatio: 1.777777778,
|
|
2231
|
-
frameRate: {}
|
|
2232
|
-
}
|
|
2233
|
-
};
|
|
2234
|
-
if (maxFps) {
|
|
2235
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2236
|
-
// @ts-ignore
|
|
2237
|
-
constraints.video.frameRate = {
|
|
2238
|
-
max: maxFps
|
|
2239
|
-
};
|
|
2240
|
-
}
|
|
2241
|
-
stream = null;
|
|
2242
|
-
_b.label = 1;
|
|
2243
|
-
case 1:
|
|
2244
|
-
_b.trys.push([1, 3,, 4]);
|
|
2245
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
2246
|
-
case 2:
|
|
2247
|
-
stream = _b.sent();
|
|
2248
|
-
return [3 /*break*/, 4];
|
|
2249
|
-
case 3:
|
|
2250
|
-
e_2 = _b.sent();
|
|
2251
|
-
if (e_2.name === 'NotAllowedError') {
|
|
2252
|
-
if (iphoneContinuityCameraAllowed) {
|
|
2253
|
-
setIphoneContinuityCameraAvailable(false);
|
|
2254
|
-
setIphoneContinuityCameraDenied(true);
|
|
2255
|
-
} else {
|
|
2256
|
-
setCameraAccessDenied(true);
|
|
2257
|
-
}
|
|
2258
|
-
return [2 /*return*/];
|
|
2259
|
-
}
|
|
2260
|
-
return [3 /*break*/, 4];
|
|
2261
|
-
case 4:
|
|
2262
|
-
if (!!stream) return [3 /*break*/, 8];
|
|
2263
|
-
_b.label = 5;
|
|
2264
|
-
case 5:
|
|
2265
|
-
_b.trys.push([5, 7,, 8]);
|
|
2266
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
2267
|
-
audio: false,
|
|
2268
|
-
video: true
|
|
2269
|
-
})];
|
|
2270
|
-
case 6:
|
|
2271
|
-
stream = _b.sent();
|
|
2272
|
-
log('opened stream with no width and height constraints');
|
|
2273
|
-
return [3 /*break*/, 8];
|
|
2274
|
-
case 7:
|
|
2275
|
-
_b.sent();
|
|
2276
|
-
log('cannot open stream at all');
|
|
2277
|
-
return [3 /*break*/, 8];
|
|
2278
|
-
case 8:
|
|
2279
|
-
if (!stream) {
|
|
2280
|
-
throw new Error('failed to open camera');
|
|
2281
|
-
}
|
|
2282
|
-
handleStreamEnded = function handleStreamEnded() {
|
|
2283
|
-
if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
|
|
2284
|
-
log('someone unplugged the continuity camera');
|
|
2285
|
-
releaseCameraAccess();
|
|
2286
|
-
cameraRef.current = null;
|
|
2287
|
-
setIphoneContinuityCameraAvailable(false);
|
|
2288
|
-
setIphoneContinuityCameraDenied(true);
|
|
2289
|
-
setVideoDevice(null);
|
|
2290
|
-
} else {
|
|
2291
|
-
log('someone unplugged the webcam');
|
|
2292
|
-
releaseCameraAccess();
|
|
2293
|
-
cameraRef.current = null;
|
|
2294
|
-
setVideoLoaded(false);
|
|
2295
|
-
setCameraAccessDenied(true);
|
|
2296
|
-
}
|
|
2297
|
-
};
|
|
2298
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
|
|
2299
|
-
stream.getVideoTracks().forEach(function (track) {
|
|
2300
|
-
track.onended = handleStreamEnded;
|
|
2301
|
-
});
|
|
2302
|
-
cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
|
|
2303
|
-
return [2 /*return*/];
|
|
2304
|
-
}
|
|
2305
|
-
});
|
|
2306
|
-
});
|
|
2307
|
-
})();
|
|
2308
|
-
return cleanup;
|
|
2309
|
-
}, [iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, maxFps, maxVideoWidth, videoDevice]);
|
|
2310
|
-
useEffect(function triggerCameraReady() {
|
|
2311
|
-
// TODO: in the future let's evaluate whether we can simplify this to just
|
|
2312
|
-
// setCameraReady(!!videoDevice && videoLoaded) -- we are wondering whether
|
|
2313
|
-
// we somehow depend on this being set twice.
|
|
2314
|
-
setCameraReady(false);
|
|
2315
|
-
if (videoDevice && videoLoaded) {
|
|
2316
|
-
setCameraReady(videoDevice && videoLoaded);
|
|
2317
|
-
}
|
|
2318
|
-
}, [videoLoaded, videoDevice]);
|
|
2319
|
-
var requestMicrophoneAccess = useCallback(function _requestMicrophoneAccess() {
|
|
2320
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2321
|
-
var stream;
|
|
2322
|
-
return __generator(this, function (_a) {
|
|
2323
|
-
switch (_a.label) {
|
|
2324
|
-
case 0:
|
|
2325
|
-
setMicrophoneReady(false);
|
|
2326
|
-
setMicrophoneAccessDenied(false);
|
|
2327
|
-
_a.label = 1;
|
|
2328
|
-
case 1:
|
|
2329
|
-
_a.trys.push([1, 3,, 4]);
|
|
2330
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
2331
|
-
audio: true,
|
|
2332
|
-
video: false
|
|
2333
|
-
})];
|
|
2334
|
-
case 2:
|
|
2335
|
-
stream = _a.sent();
|
|
2336
|
-
currentAudioStream = stream;
|
|
2337
|
-
setAudioStream(stream);
|
|
2338
|
-
setMicrophoneReady(true);
|
|
2339
|
-
stream.getAudioTracks().forEach(function (track) {
|
|
2340
|
-
track.onended = function () {
|
|
2341
|
-
setMicrophoneAccessDenied(true);
|
|
2342
|
-
};
|
|
2343
|
-
});
|
|
2344
|
-
return [3 /*break*/, 4];
|
|
2345
|
-
case 3:
|
|
2346
|
-
_a.sent();
|
|
2347
|
-
setMicrophoneAccessDenied(true);
|
|
2348
|
-
return [3 /*break*/, 4];
|
|
2349
|
-
case 4:
|
|
2350
|
-
return [2 /*return*/];
|
|
2351
|
-
}
|
|
2352
|
-
});
|
|
2353
|
-
});
|
|
2354
|
-
}, []);
|
|
2355
|
-
useEffect(function requestMicrophoneAccessIfNeeded() {
|
|
2356
|
-
if (!requireMicrophoneAccess || microphoneAccessDenied) return;
|
|
2357
|
-
requestMicrophoneAccess()["catch"](error);
|
|
2358
|
-
return function () {
|
|
2359
|
-
releaseMicrophoneAccess();
|
|
2360
|
-
setAudioStream(null);
|
|
2361
|
-
setMicrophoneReady(false);
|
|
2362
|
-
};
|
|
2363
|
-
}, [microphoneAccessDenied, requestMicrophoneAccess, requireMicrophoneAccess]);
|
|
2364
|
-
var takePhoto = useCallback(function _takePhoto() {
|
|
2365
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2366
|
-
var canvas;
|
|
2367
|
-
return __generator(this, function (_a) {
|
|
2368
|
-
switch (_a.label) {
|
|
2369
|
-
case 0:
|
|
2370
|
-
if (!cameraRef.current) return [2 /*return*/, null];
|
|
2371
|
-
if (!(typeof ImageCapture !== 'undefined')) return [3 /*break*/, 2];
|
|
2372
|
-
return [4 /*yield*/, new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto()];
|
|
2373
|
-
case 1:
|
|
2374
|
-
return [2 /*return*/, _a.sent()];
|
|
2375
|
-
case 2:
|
|
2376
|
-
if (!videoRef.current) return [2 /*return*/, null];
|
|
2377
|
-
canvas = document.createElement('canvas');
|
|
2378
|
-
drawToCanvas(canvas, videoRef.current);
|
|
2379
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
2380
|
-
return canvas.toBlob(resolve);
|
|
2381
|
-
})];
|
|
2382
|
-
}
|
|
2383
|
-
});
|
|
2384
|
-
});
|
|
2385
|
-
}, []);
|
|
2386
|
-
return useMemo(function () {
|
|
2387
|
-
return {
|
|
2388
|
-
videoRef: videoRef,
|
|
2389
|
-
videoDevice: videoDevice,
|
|
2390
|
-
videoLoaded: videoLoaded,
|
|
2391
|
-
setVideoLoaded: setVideoLoaded,
|
|
2392
|
-
onVideoUnmounted: onVideoUnmounted,
|
|
2393
|
-
cameraRef: cameraRef,
|
|
2394
|
-
cameraReady: cameraReady,
|
|
2395
|
-
cameraAccessDenied: cameraAccessDenied,
|
|
2396
|
-
requestCameraAccess: requestCameraAccess,
|
|
2397
|
-
releaseCameraAccess: releaseCameraAccess,
|
|
2398
|
-
iphoneContinuityCameraAvailable: iphoneContinuityCameraAvailable,
|
|
2399
|
-
iphoneContinuityCameraAllowed: iphoneContinuityCameraAllowed,
|
|
2400
|
-
setIphoneContinuityCameraAllowed: setIphoneContinuityCameraAllowed,
|
|
2401
|
-
takePhoto: takePhoto,
|
|
2402
|
-
audioStream: audioStream,
|
|
2403
|
-
microphoneReady: microphoneReady,
|
|
2404
|
-
microphoneAccessDenied: microphoneAccessDenied,
|
|
2405
|
-
requestMicrophoneAccess: requestMicrophoneAccess
|
|
2406
|
-
};
|
|
2407
|
-
}, [audioStream, cameraAccessDenied, cameraReady, iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, microphoneAccessDenied, microphoneReady, onVideoUnmounted, requestCameraAccess, requestMicrophoneAccess, takePhoto, videoDevice, videoLoaded]);
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
var CameraStateContext = /*#__PURE__*/createContext({
|
|
2411
|
-
videoRef: {
|
|
2412
|
-
current: null
|
|
2413
|
-
},
|
|
2414
|
-
videoDevice: null,
|
|
2415
|
-
videoLoaded: false,
|
|
2416
|
-
cameraRef: {
|
|
2417
|
-
current: null
|
|
2418
|
-
},
|
|
2419
|
-
cameraReady: false,
|
|
2420
|
-
cameraAccessDenied: false,
|
|
2421
|
-
requestCameraAccess: function requestCameraAccess() {
|
|
2422
|
-
return null;
|
|
2423
|
-
},
|
|
2424
|
-
releaseCameraAccess: function releaseCameraAccess() {
|
|
2425
|
-
return null;
|
|
2426
|
-
},
|
|
2427
|
-
iphoneContinuityCameraAvailable: false,
|
|
2428
|
-
iphoneContinuityCameraAllowed: true,
|
|
2429
|
-
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed() {
|
|
2430
|
-
return null;
|
|
2431
|
-
},
|
|
2432
|
-
takePhoto: function takePhoto() {
|
|
2433
|
-
return Promise.resolve(null);
|
|
2434
|
-
},
|
|
2435
|
-
setVideoLoaded: function setVideoLoaded() {
|
|
2436
|
-
return null;
|
|
2437
|
-
},
|
|
2438
|
-
onVideoUnmounted: function onVideoUnmounted() {
|
|
2439
|
-
return null;
|
|
2440
|
-
},
|
|
2441
|
-
audioStream: null,
|
|
2442
|
-
microphoneReady: false,
|
|
2443
|
-
microphoneAccessDenied: false,
|
|
2444
|
-
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
2445
|
-
return null;
|
|
2446
|
-
}
|
|
2447
|
-
});
|
|
2448
|
-
var CameraProvider = function CameraProvider(_a) {
|
|
2449
|
-
var children = _a.children,
|
|
2450
|
-
_b = _a.requestAccessAutomatically,
|
|
2451
|
-
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
2452
|
-
_c = _a.preferFrontFacingCamera,
|
|
2453
|
-
preferFrontFacingCamera = _c === void 0 ? false : _c,
|
|
2454
|
-
_d = _a.preferContinuityCamera,
|
|
2455
|
-
preferContinuityCamera = _d === void 0 ? true : _d,
|
|
2456
|
-
_e = _a.requireMicrophoneAccess,
|
|
2457
|
-
requireMicrophoneAccess = _e === void 0 ? false : _e,
|
|
2458
|
-
_f = _a.maxVideoWidth,
|
|
2459
|
-
maxVideoWidth = _f === void 0 ? 1920 : _f,
|
|
2460
|
-
maxFps = _a.maxFps,
|
|
2461
|
-
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
2462
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
2463
|
-
_g = _a.debugMode,
|
|
2464
|
-
debugMode = _g === void 0 ? false : _g;
|
|
2465
|
-
var captureDevice = usePreferredCaptureDevice({
|
|
2466
|
-
requestAccessAutomatically: requestAccessAutomatically,
|
|
2467
|
-
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
2468
|
-
preferContinuityCamera: preferContinuityCamera,
|
|
2469
|
-
requireMicrophoneAccess: requireMicrophoneAccess,
|
|
2470
|
-
maxVideoWidth: maxVideoWidth,
|
|
2471
|
-
maxFps: maxFps,
|
|
2472
|
-
debugMode: debugMode
|
|
2473
|
-
});
|
|
2474
|
-
useEffect(function () {
|
|
2475
|
-
if (captureDevice.cameraAccessDenied) onCameraAccessDenied === null || onCameraAccessDenied === void 0 ? void 0 : onCameraAccessDenied();
|
|
2476
|
-
}, [captureDevice.cameraAccessDenied, onCameraAccessDenied]);
|
|
2477
|
-
useEffect(function () {
|
|
2478
|
-
if (captureDevice.microphoneAccessDenied) onMicrophoneAccessDenied === null || onMicrophoneAccessDenied === void 0 ? void 0 : onMicrophoneAccessDenied();
|
|
2479
|
-
}, [captureDevice.microphoneAccessDenied, onMicrophoneAccessDenied]);
|
|
2480
|
-
var releaseCameraAccess = captureDevice.releaseCameraAccess;
|
|
2481
|
-
useEffect(function () {
|
|
2482
|
-
return function () {
|
|
2483
|
-
releaseCameraAccess();
|
|
2484
|
-
};
|
|
2485
|
-
}, [releaseCameraAccess]);
|
|
2486
|
-
return /*#__PURE__*/React__default.createElement(CameraStateContext.Provider, {
|
|
2487
|
-
value: captureDevice
|
|
2488
|
-
}, children);
|
|
2489
|
-
};
|
|
2490
|
-
|
|
2491
1891
|
var visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
|
|
2492
1892
|
var visionRuntimePreloading = false;
|
|
2493
1893
|
function preloadVisionRuntime() {
|
|
@@ -2530,6 +1930,42 @@ function preloadVisionRuntime() {
|
|
|
2530
1930
|
});
|
|
2531
1931
|
}
|
|
2532
1932
|
|
|
1933
|
+
function getFrameDimensions(frame) {
|
|
1934
|
+
var frameWidth = frame.width,
|
|
1935
|
+
frameHeight = frame.height;
|
|
1936
|
+
if (frame instanceof HTMLImageElement) {
|
|
1937
|
+
frameWidth = frame.naturalWidth;
|
|
1938
|
+
frameHeight = frame.naturalHeight;
|
|
1939
|
+
}
|
|
1940
|
+
if (frame instanceof HTMLVideoElement) {
|
|
1941
|
+
frameWidth = frame.videoWidth;
|
|
1942
|
+
frameHeight = frame.videoHeight;
|
|
1943
|
+
}
|
|
1944
|
+
return [frameWidth, frameHeight];
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
var InvisibleCanvas = styled.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
1948
|
+
function drawToCanvas(canvas, frame, width, height) {
|
|
1949
|
+
if (!canvas) return;
|
|
1950
|
+
var ctx = canvas.getContext('2d');
|
|
1951
|
+
if (!ctx) return;
|
|
1952
|
+
if (!width || !height) {
|
|
1953
|
+
var _a = getFrameDimensions(frame),
|
|
1954
|
+
frameWidth = _a[0],
|
|
1955
|
+
frameHeight = _a[1];
|
|
1956
|
+
width || (width = frameWidth);
|
|
1957
|
+
height || (height = frameHeight);
|
|
1958
|
+
}
|
|
1959
|
+
canvas.width = width;
|
|
1960
|
+
canvas.height = height;
|
|
1961
|
+
ctx.drawImage(frame, 0, 0, width, height);
|
|
1962
|
+
}
|
|
1963
|
+
function clearCanvas(canvas) {
|
|
1964
|
+
var _a;
|
|
1965
|
+
(_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);
|
|
1966
|
+
}
|
|
1967
|
+
var templateObject_1$G;
|
|
1968
|
+
|
|
2533
1969
|
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
2534
1970
|
if (quality === void 0) {
|
|
2535
1971
|
quality = 0.92;
|
|
@@ -2833,7 +2269,8 @@ function useLoadFocusModel(_a) {
|
|
|
2833
2269
|
modelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
2834
2270
|
_c = _a.modelLoadTimeoutMs,
|
|
2835
2271
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
2836
|
-
onModelError = _a.onModelError
|
|
2272
|
+
onModelError = _a.onModelError,
|
|
2273
|
+
videoRef = _a.videoRef;
|
|
2837
2274
|
var _d = useState(false),
|
|
2838
2275
|
ready = _d[0],
|
|
2839
2276
|
setReady = _d[1];
|
|
@@ -2843,7 +2280,6 @@ function useLoadFocusModel(_a) {
|
|
|
2843
2280
|
var _f = useState(null),
|
|
2844
2281
|
modelError = _f[0],
|
|
2845
2282
|
setModelError = _f[1];
|
|
2846
|
-
var videoRef = useContext(CameraStateContext).videoRef;
|
|
2847
2283
|
useEffect(function loadModel() {
|
|
2848
2284
|
var _this = this;
|
|
2849
2285
|
setReady(false);
|
|
@@ -2981,7 +2417,8 @@ function closeFaceDetector() {
|
|
|
2981
2417
|
function useLoadFaceDetector(_a) {
|
|
2982
2418
|
var onModelError = _a.onModelError,
|
|
2983
2419
|
_b = _a.modelLoadTimeoutMs,
|
|
2984
|
-
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b
|
|
2420
|
+
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
|
|
2421
|
+
videoRef = _a.videoRef;
|
|
2985
2422
|
var _c = useState(false),
|
|
2986
2423
|
ready = _c[0],
|
|
2987
2424
|
setReady = _c[1];
|
|
@@ -2991,7 +2428,6 @@ function useLoadFaceDetector(_a) {
|
|
|
2991
2428
|
var _e = useState(null),
|
|
2992
2429
|
modelError = _e[0],
|
|
2993
2430
|
setModelError = _e[1];
|
|
2994
|
-
var videoRef = useContext(CameraStateContext).videoRef;
|
|
2995
2431
|
useEffect(function loadModel() {
|
|
2996
2432
|
var _this = this;
|
|
2997
2433
|
setReady(false);
|
|
@@ -3472,7 +2908,8 @@ function useLoadDocumentDetector(_a) {
|
|
|
3472
2908
|
modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
|
|
3473
2909
|
_d = _a.scoreThreshold,
|
|
3474
2910
|
scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
|
|
3475
|
-
onModelError = _a.onModelError
|
|
2911
|
+
onModelError = _a.onModelError,
|
|
2912
|
+
videoRef = _a.videoRef;
|
|
3476
2913
|
var _e = useState(false),
|
|
3477
2914
|
ready = _e[0],
|
|
3478
2915
|
setReady = _e[1];
|
|
@@ -3482,7 +2919,6 @@ function useLoadDocumentDetector(_a) {
|
|
|
3482
2919
|
var _g = useState(null),
|
|
3483
2920
|
modelError = _g[0],
|
|
3484
2921
|
setModelError = _g[1];
|
|
3485
|
-
var videoRef = useContext(CameraStateContext).videoRef;
|
|
3486
2922
|
useEffect(function loadModel() {
|
|
3487
2923
|
var _this = this;
|
|
3488
2924
|
setReady(false);
|
|
@@ -3718,77 +3154,541 @@ function applyNonMaxSuppression(detectedObjects, isGoodBox) {
|
|
|
3718
3154
|
if (obj.score > maxes[obj.label][0] && (isGoodBox === null || isGoodBox === void 0 ? void 0 : isGoodBox(obj))) maxes[obj.label] = [obj.score, i];
|
|
3719
3155
|
}
|
|
3720
3156
|
});
|
|
3721
|
-
return Object.keys(maxes).map(function (label) {
|
|
3722
|
-
return detectedObjects[maxes[label][1]];
|
|
3723
|
-
}).filter(function (obj) {
|
|
3724
|
-
return !!obj;
|
|
3157
|
+
return Object.keys(maxes).map(function (label) {
|
|
3158
|
+
return detectedObjects[maxes[label][1]];
|
|
3159
|
+
}).filter(function (obj) {
|
|
3160
|
+
return !!obj;
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
function useFrameLoop(fn, _a) {
|
|
3165
|
+
var _b = _a.throttleMs,
|
|
3166
|
+
throttleMs = _b === void 0 ? 0 : _b,
|
|
3167
|
+
_c = _a.autoStart,
|
|
3168
|
+
autoStart = _c === void 0 ? false : _c;
|
|
3169
|
+
var _d = useState(false),
|
|
3170
|
+
running = _d[0],
|
|
3171
|
+
setRunning = _d[1];
|
|
3172
|
+
var startedAtRef = useRef(null);
|
|
3173
|
+
var loopId = useRef(0);
|
|
3174
|
+
var frameId = useRef(0);
|
|
3175
|
+
useEffect(function runFrameLoop() {
|
|
3176
|
+
if (!running) return;
|
|
3177
|
+
var timer;
|
|
3178
|
+
var currentLoopId = loopId.current;
|
|
3179
|
+
function renderPrediction() {
|
|
3180
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3181
|
+
var start, timeRunning, took, amountToThrottle;
|
|
3182
|
+
var _a, _b;
|
|
3183
|
+
return __generator(this, function (_c) {
|
|
3184
|
+
switch (_c.label) {
|
|
3185
|
+
case 0:
|
|
3186
|
+
if (currentLoopId !== loopId.current) return [2 /*return*/];
|
|
3187
|
+
start = new Date().getTime();
|
|
3188
|
+
timeRunning = start - ((_b = (_a = startedAtRef.current) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0);
|
|
3189
|
+
return [4 /*yield*/, fn(frameId.current, timeRunning)];
|
|
3190
|
+
case 1:
|
|
3191
|
+
_c.sent();
|
|
3192
|
+
took = new Date().getTime() - start;
|
|
3193
|
+
amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
|
|
3194
|
+
timer = setTimeout(function () {
|
|
3195
|
+
frameId.current = requestAnimationFrame(renderPrediction);
|
|
3196
|
+
}, amountToThrottle);
|
|
3197
|
+
return [2 /*return*/];
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
renderPrediction().then();
|
|
3203
|
+
return function () {
|
|
3204
|
+
loopId.current += 1;
|
|
3205
|
+
frameId.current && cancelAnimationFrame(frameId.current);
|
|
3206
|
+
timer && clearTimeout(timer);
|
|
3207
|
+
};
|
|
3208
|
+
}, [fn, running, throttleMs]);
|
|
3209
|
+
var start = useCallback(function () {
|
|
3210
|
+
startedAtRef.current = new Date();
|
|
3211
|
+
setRunning(true);
|
|
3212
|
+
}, []);
|
|
3213
|
+
var stop = useCallback(function () {
|
|
3214
|
+
loopId.current += 1; // force the loop to stop immediately.
|
|
3215
|
+
setRunning(false);
|
|
3216
|
+
startedAtRef.current = null;
|
|
3217
|
+
}, []);
|
|
3218
|
+
useEffect(function startAutomatically() {
|
|
3219
|
+
if (autoStart) start();
|
|
3220
|
+
return function () {
|
|
3221
|
+
stop();
|
|
3222
|
+
};
|
|
3223
|
+
}, [autoStart, start, stop]);
|
|
3224
|
+
return {
|
|
3225
|
+
start: start,
|
|
3226
|
+
stop: stop
|
|
3227
|
+
};
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
function listAvailableCameras(facingMode_1) {
|
|
3231
|
+
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
3232
|
+
var cameraEnumerationStream, videoDevices;
|
|
3233
|
+
if (requestMicAccess === void 0) {
|
|
3234
|
+
requestMicAccess = false;
|
|
3235
|
+
}
|
|
3236
|
+
return __generator(this, function (_a) {
|
|
3237
|
+
switch (_a.label) {
|
|
3238
|
+
case 0:
|
|
3239
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3240
|
+
video: {
|
|
3241
|
+
facingMode: {
|
|
3242
|
+
exact: facingMode
|
|
3243
|
+
}
|
|
3244
|
+
},
|
|
3245
|
+
audio: requestMicAccess
|
|
3246
|
+
})
|
|
3247
|
+
// This lists all available cameras attached to the user's device.
|
|
3248
|
+
];
|
|
3249
|
+
case 1:
|
|
3250
|
+
cameraEnumerationStream = _a.sent();
|
|
3251
|
+
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
3252
|
+
case 2:
|
|
3253
|
+
videoDevices = _a.sent().filter(function (_a) {
|
|
3254
|
+
var kind = _a.kind;
|
|
3255
|
+
return kind === 'videoinput';
|
|
3256
|
+
});
|
|
3257
|
+
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
3258
|
+
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
3259
|
+
track.enabled = false;
|
|
3260
|
+
track.stop();
|
|
3261
|
+
});
|
|
3262
|
+
cameraEnumerationStream = null;
|
|
3263
|
+
return [2 /*return*/, videoDevices];
|
|
3264
|
+
}
|
|
3265
|
+
});
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
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) {
|
|
3269
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3270
|
+
});
|
|
3271
|
+
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) {
|
|
3272
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3273
|
+
});
|
|
3274
|
+
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) {
|
|
3275
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
3276
|
+
});
|
|
3277
|
+
var cameraLabelMatches = function cameraLabelMatches(labelOrDevice, labelSetOrLabel) {
|
|
3278
|
+
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
3279
|
+
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
3280
|
+
return labelSet.some(function (l) {
|
|
3281
|
+
return label.includes(l);
|
|
3282
|
+
});
|
|
3283
|
+
};
|
|
3284
|
+
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
3285
|
+
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
3286
|
+
};
|
|
3287
|
+
var currentCamera;
|
|
3288
|
+
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
3289
|
+
releaseCameraAccess();
|
|
3290
|
+
log('obtaining camera access...');
|
|
3291
|
+
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
3292
|
+
width = _a.width,
|
|
3293
|
+
height = _a.height;
|
|
3294
|
+
log('camera dimensions', width, height);
|
|
3295
|
+
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
3296
|
+
log('camera label', label);
|
|
3297
|
+
var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
|
|
3298
|
+
log('is rear facing?', isRearFacing);
|
|
3299
|
+
var release = function release() {
|
|
3300
|
+
stream.getTracks().forEach(function (track) {
|
|
3301
|
+
track.enabled = false;
|
|
3302
|
+
track.stop();
|
|
3303
|
+
});
|
|
3304
|
+
if (video) {
|
|
3305
|
+
video.pause();
|
|
3306
|
+
video.srcObject = null;
|
|
3307
|
+
video.src = '';
|
|
3308
|
+
}
|
|
3309
|
+
};
|
|
3310
|
+
width || (width = 0);
|
|
3311
|
+
height || (height = 0);
|
|
3312
|
+
currentCamera = {
|
|
3313
|
+
label: deviceLabel,
|
|
3314
|
+
stream: stream,
|
|
3315
|
+
width: width,
|
|
3316
|
+
height: height,
|
|
3317
|
+
isRearFacing: isRearFacing,
|
|
3318
|
+
release: release
|
|
3319
|
+
};
|
|
3320
|
+
log('camera access granted');
|
|
3321
|
+
if (video) video.srcObject = stream;
|
|
3322
|
+
log('video source initialized');
|
|
3323
|
+
return currentCamera;
|
|
3324
|
+
}
|
|
3325
|
+
function releaseCameraAccess() {
|
|
3326
|
+
if (!currentCamera) return;
|
|
3327
|
+
log('releasing camera access...');
|
|
3328
|
+
currentCamera.release();
|
|
3329
|
+
currentCamera = undefined;
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
var initialState$5 = {
|
|
3333
|
+
videoRef: {
|
|
3334
|
+
current: null
|
|
3335
|
+
},
|
|
3336
|
+
videoLoaded: false,
|
|
3337
|
+
videoStream: null,
|
|
3338
|
+
videoDevice: null,
|
|
3339
|
+
isRearFacing: false,
|
|
3340
|
+
camera: null,
|
|
3341
|
+
cameraReady: false,
|
|
3342
|
+
cameraAccessDenied: false,
|
|
3343
|
+
iphoneContinuityCameraAvailable: false,
|
|
3344
|
+
iphoneContinuityCameraDenied: false,
|
|
3345
|
+
preferIphoneContinuityCamera: true,
|
|
3346
|
+
audioStream: null,
|
|
3347
|
+
microphoneReady: false,
|
|
3348
|
+
microphoneAccessDenied: false
|
|
3349
|
+
};
|
|
3350
|
+
var createCameraStore = function createCameraStore(config) {
|
|
3351
|
+
var store = createStore(function (set, get) {
|
|
3352
|
+
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
3353
|
+
reset: function reset() {
|
|
3354
|
+
return set(_assign(_assign({}, initialState$5), config));
|
|
3355
|
+
},
|
|
3356
|
+
setConfig: function setConfig(config) {
|
|
3357
|
+
return set(config);
|
|
3358
|
+
},
|
|
3359
|
+
onVideoMounted: function onVideoMounted() {
|
|
3360
|
+
return set({
|
|
3361
|
+
videoLoaded: true
|
|
3362
|
+
});
|
|
3363
|
+
},
|
|
3364
|
+
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
3365
|
+
return set({
|
|
3366
|
+
preferIphoneContinuityCamera: value
|
|
3367
|
+
});
|
|
3368
|
+
},
|
|
3369
|
+
requestCameraAccess: function requestCameraAccess() {
|
|
3370
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3371
|
+
var _a, releaseCameraAccess, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded_1, camera, e_3;
|
|
3372
|
+
var _b, _c, _d;
|
|
3373
|
+
return __generator(this, function (_e) {
|
|
3374
|
+
switch (_e.label) {
|
|
3375
|
+
case 0:
|
|
3376
|
+
_a = get(), releaseCameraAccess = _a.releaseCameraAccess, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
3377
|
+
releaseCameraAccess();
|
|
3378
|
+
_e.label = 1;
|
|
3379
|
+
case 1:
|
|
3380
|
+
_e.trys.push([1, 11,, 12]);
|
|
3381
|
+
return [4 /*yield*/, listAvailableCameras()];
|
|
3382
|
+
case 2:
|
|
3383
|
+
availableCameras = _e.sent();
|
|
3384
|
+
selectedCamera = void 0;
|
|
3385
|
+
debug('availableCameras', availableCameras);
|
|
3386
|
+
platform_1 = getPlatform();
|
|
3387
|
+
debug('platformDetails', platform_1);
|
|
3388
|
+
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
3389
|
+
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
3390
|
+
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
3391
|
+
});
|
|
3392
|
+
set({
|
|
3393
|
+
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
3394
|
+
});
|
|
3395
|
+
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
3396
|
+
selectedCamera = iphoneContinuityCamera;
|
|
3397
|
+
}
|
|
3398
|
+
} 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) {
|
|
3399
|
+
return c.label.startsWith('camera2 ');
|
|
3400
|
+
})) {
|
|
3401
|
+
availableCameras = availableCameras.sort(function (a, b) {
|
|
3402
|
+
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
3403
|
+
});
|
|
3404
|
+
debug('cameras have been sorted', availableCameras);
|
|
3405
|
+
}
|
|
3406
|
+
if (config.preferFrontFacingCamera) {
|
|
3407
|
+
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3408
|
+
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
3409
|
+
});
|
|
3410
|
+
}
|
|
3411
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3412
|
+
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
3413
|
+
}));
|
|
3414
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3415
|
+
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
3416
|
+
}));
|
|
3417
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3418
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
3419
|
+
}));
|
|
3420
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3421
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
3422
|
+
}));
|
|
3423
|
+
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
3424
|
+
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) {
|
|
3425
|
+
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
3426
|
+
}
|
|
3427
|
+
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
3428
|
+
debug('selectedCamera', selectedCamera);
|
|
3429
|
+
set({
|
|
3430
|
+
videoDevice: selectedCamera
|
|
3431
|
+
});
|
|
3432
|
+
constraints = {
|
|
3433
|
+
audio: false,
|
|
3434
|
+
video: {
|
|
3435
|
+
deviceId: {
|
|
3436
|
+
exact: selectedCamera.deviceId
|
|
3437
|
+
},
|
|
3438
|
+
width: {
|
|
3439
|
+
ideal: config.maxVideoWidth
|
|
3440
|
+
},
|
|
3441
|
+
aspectRatio: 1.777777778,
|
|
3442
|
+
frameRate: {}
|
|
3443
|
+
}
|
|
3444
|
+
};
|
|
3445
|
+
if (config.maxFps) {
|
|
3446
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3447
|
+
// @ts-ignore
|
|
3448
|
+
constraints.video.frameRate = {
|
|
3449
|
+
max: config.maxFps
|
|
3450
|
+
};
|
|
3451
|
+
}
|
|
3452
|
+
stream = null;
|
|
3453
|
+
_e.label = 3;
|
|
3454
|
+
case 3:
|
|
3455
|
+
_e.trys.push([3, 5,, 6]);
|
|
3456
|
+
debug('obtaining camera access with constraints', constraints);
|
|
3457
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
3458
|
+
case 4:
|
|
3459
|
+
stream = _e.sent();
|
|
3460
|
+
return [3 /*break*/, 6];
|
|
3461
|
+
case 5:
|
|
3462
|
+
e_1 = _e.sent();
|
|
3463
|
+
if (e_1.name === 'NotAllowedError') {
|
|
3464
|
+
if (preferIphoneContinuityCamera) {
|
|
3465
|
+
set({
|
|
3466
|
+
iphoneContinuityCameraAvailable: false,
|
|
3467
|
+
iphoneContinuityCameraDenied: true
|
|
3468
|
+
});
|
|
3469
|
+
} else {
|
|
3470
|
+
set({
|
|
3471
|
+
cameraAccessDenied: true
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3474
|
+
return [2 /*return*/];
|
|
3475
|
+
}
|
|
3476
|
+
return [3 /*break*/, 6];
|
|
3477
|
+
case 6:
|
|
3478
|
+
if (!!stream) return [3 /*break*/, 10];
|
|
3479
|
+
_e.label = 7;
|
|
3480
|
+
case 7:
|
|
3481
|
+
_e.trys.push([7, 9,, 10]);
|
|
3482
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3483
|
+
audio: false,
|
|
3484
|
+
video: true
|
|
3485
|
+
})];
|
|
3486
|
+
case 8:
|
|
3487
|
+
stream = _e.sent();
|
|
3488
|
+
debug('opened stream with no width and height constraints');
|
|
3489
|
+
return [3 /*break*/, 10];
|
|
3490
|
+
case 9:
|
|
3491
|
+
_e.sent();
|
|
3492
|
+
debug('cannot open stream at all');
|
|
3493
|
+
return [3 /*break*/, 10];
|
|
3494
|
+
case 10:
|
|
3495
|
+
if (!stream) {
|
|
3496
|
+
error('failed to open camera');
|
|
3497
|
+
throw new Error('failed to open camera');
|
|
3498
|
+
}
|
|
3499
|
+
debug('camera access granted with constraints', constraints);
|
|
3500
|
+
iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
|
|
3501
|
+
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
3502
|
+
if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
|
|
3503
|
+
debug('someone unplugged the continuity camera');
|
|
3504
|
+
releaseCameraAccess();
|
|
3505
|
+
set({
|
|
3506
|
+
videoStream: null,
|
|
3507
|
+
videoDevice: null,
|
|
3508
|
+
iphoneContinuityCameraAvailable: false,
|
|
3509
|
+
iphoneContinuityCameraDenied: true
|
|
3510
|
+
});
|
|
3511
|
+
} else {
|
|
3512
|
+
debug('someone unplugged the webcam');
|
|
3513
|
+
releaseCameraAccess();
|
|
3514
|
+
set({
|
|
3515
|
+
videoStream: null,
|
|
3516
|
+
videoDevice: null,
|
|
3517
|
+
videoLoaded: false,
|
|
3518
|
+
cameraAccessDenied: true
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
};
|
|
3522
|
+
(_d = config.videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
3523
|
+
stream.getVideoTracks().forEach(function (track) {
|
|
3524
|
+
track.onended = handleStreamEnded_1;
|
|
3525
|
+
});
|
|
3526
|
+
camera = obtainCameraAccess(stream, selectedCamera.label, config.videoRef.current);
|
|
3527
|
+
set({
|
|
3528
|
+
camera: camera,
|
|
3529
|
+
cameraReady: true,
|
|
3530
|
+
isRearFacing: camera.isRearFacing,
|
|
3531
|
+
videoStream: stream
|
|
3532
|
+
});
|
|
3533
|
+
return [3 /*break*/, 12];
|
|
3534
|
+
case 11:
|
|
3535
|
+
e_3 = _e.sent();
|
|
3536
|
+
if (e_3.name === 'NotAllowedError') {
|
|
3537
|
+
error('camera access has been blocked by the user', e_3);
|
|
3538
|
+
set({
|
|
3539
|
+
cameraAccessDenied: true
|
|
3540
|
+
});
|
|
3541
|
+
} else {
|
|
3542
|
+
error('camera access encountered some other error', e_3);
|
|
3543
|
+
throw e_3;
|
|
3544
|
+
}
|
|
3545
|
+
return [3 /*break*/, 12];
|
|
3546
|
+
case 12:
|
|
3547
|
+
return [2 /*return*/];
|
|
3548
|
+
}
|
|
3549
|
+
});
|
|
3550
|
+
});
|
|
3551
|
+
},
|
|
3552
|
+
releaseCameraAccess: function releaseCameraAccess() {
|
|
3553
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3554
|
+
var camera;
|
|
3555
|
+
return __generator(this, function (_a) {
|
|
3556
|
+
camera = get().camera;
|
|
3557
|
+
if (!camera) return [2 /*return*/];
|
|
3558
|
+
camera.release();
|
|
3559
|
+
set({
|
|
3560
|
+
camera: null,
|
|
3561
|
+
cameraReady: false,
|
|
3562
|
+
cameraAccessDenied: false
|
|
3563
|
+
});
|
|
3564
|
+
return [2 /*return*/];
|
|
3565
|
+
});
|
|
3566
|
+
});
|
|
3567
|
+
},
|
|
3568
|
+
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
3569
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3570
|
+
var stream;
|
|
3571
|
+
return __generator(this, function (_a) {
|
|
3572
|
+
switch (_a.label) {
|
|
3573
|
+
case 0:
|
|
3574
|
+
get().releaseMicrophoneAccess();
|
|
3575
|
+
_a.label = 1;
|
|
3576
|
+
case 1:
|
|
3577
|
+
_a.trys.push([1, 3,, 4]);
|
|
3578
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3579
|
+
audio: true,
|
|
3580
|
+
video: false
|
|
3581
|
+
})];
|
|
3582
|
+
case 2:
|
|
3583
|
+
stream = _a.sent();
|
|
3584
|
+
set({
|
|
3585
|
+
audioStream: stream,
|
|
3586
|
+
microphoneReady: true
|
|
3587
|
+
});
|
|
3588
|
+
stream.getAudioTracks().forEach(function (track) {
|
|
3589
|
+
track.onended = function () {
|
|
3590
|
+
set({
|
|
3591
|
+
microphoneAccessDenied: true
|
|
3592
|
+
});
|
|
3593
|
+
};
|
|
3594
|
+
});
|
|
3595
|
+
return [3 /*break*/, 4];
|
|
3596
|
+
case 3:
|
|
3597
|
+
_a.sent();
|
|
3598
|
+
set({
|
|
3599
|
+
microphoneAccessDenied: true
|
|
3600
|
+
});
|
|
3601
|
+
return [3 /*break*/, 4];
|
|
3602
|
+
case 4:
|
|
3603
|
+
return [2 /*return*/];
|
|
3604
|
+
}
|
|
3605
|
+
});
|
|
3606
|
+
});
|
|
3607
|
+
},
|
|
3608
|
+
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
3609
|
+
var _a;
|
|
3610
|
+
var audioStream = get().audioStream;
|
|
3611
|
+
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
3612
|
+
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
3613
|
+
var _a;
|
|
3614
|
+
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
3615
|
+
});
|
|
3616
|
+
set({
|
|
3617
|
+
audioStream: null,
|
|
3618
|
+
microphoneReady: false,
|
|
3619
|
+
microphoneAccessDenied: false
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
});
|
|
3623
|
+
});
|
|
3624
|
+
if (config.requestAccessAutomatically) {
|
|
3625
|
+
store.getState().requestCameraAccess();
|
|
3626
|
+
}
|
|
3627
|
+
if (config.requireMicrophoneAccess) {
|
|
3628
|
+
store.getState().requestMicrophoneAccess();
|
|
3629
|
+
}
|
|
3630
|
+
return _assign(_assign({}, store), {
|
|
3631
|
+
destroy: function destroy() {
|
|
3632
|
+
store.getState().releaseCameraAccess();
|
|
3633
|
+
store.getState().releaseMicrophoneAccess();
|
|
3634
|
+
}
|
|
3725
3635
|
});
|
|
3726
|
-
}
|
|
3727
|
-
|
|
3728
|
-
function
|
|
3729
|
-
var
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3636
|
+
};
|
|
3637
|
+
var CameraStoreContext = /*#__PURE__*/createContext(undefined);
|
|
3638
|
+
function CameraStoreProvider(_a) {
|
|
3639
|
+
var children = _a.children,
|
|
3640
|
+
_b = _a.requestAccessAutomatically,
|
|
3641
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
3642
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
3643
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
3644
|
+
_d = _a.preferFrontFacingCamera,
|
|
3645
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
3646
|
+
_e = _a.maxVideoWidth,
|
|
3647
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
3648
|
+
maxFps = _a.maxFps,
|
|
3649
|
+
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
3650
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
3651
|
+
_f = _a.requireMicrophoneAccess,
|
|
3652
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f;
|
|
3653
|
+
var videoRef = useRef(null);
|
|
3654
|
+
var store = useRef();
|
|
3655
|
+
store.current || (store.current = createCameraStore({
|
|
3656
|
+
videoRef: videoRef,
|
|
3657
|
+
requestAccessAutomatically: requestAccessAutomatically,
|
|
3658
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3659
|
+
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
3660
|
+
maxVideoWidth: maxVideoWidth,
|
|
3661
|
+
maxFps: maxFps,
|
|
3662
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
3663
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
3664
|
+
requireMicrophoneAccess: requireMicrophoneAccess
|
|
3665
|
+
}));
|
|
3666
|
+
useEffect(function () {
|
|
3667
|
+
var _a, _b, _c;
|
|
3668
|
+
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
3669
|
+
if (!state) return;
|
|
3670
|
+
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
3671
|
+
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
3672
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3673
|
+
preferFrontFacingCamera: preferFrontFacingCamera
|
|
3764
3674
|
});
|
|
3675
|
+
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
3765
3676
|
}
|
|
3766
|
-
|
|
3677
|
+
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
3678
|
+
useEffect(function () {
|
|
3767
3679
|
return function () {
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
timer && clearTimeout(timer);
|
|
3680
|
+
var _a;
|
|
3681
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3771
3682
|
};
|
|
3772
|
-
}, [fn, running, throttleMs]);
|
|
3773
|
-
var start = useCallback(function () {
|
|
3774
|
-
startedAtRef.current = new Date();
|
|
3775
|
-
setRunning(true);
|
|
3776
|
-
}, []);
|
|
3777
|
-
var stop = useCallback(function () {
|
|
3778
|
-
loopId.current += 1; // force the loop to stop immediately.
|
|
3779
|
-
setRunning(false);
|
|
3780
|
-
startedAtRef.current = null;
|
|
3781
3683
|
}, []);
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
stop: stop
|
|
3791
|
-
};
|
|
3684
|
+
return /*#__PURE__*/React__default.createElement(CameraStoreContext.Provider, {
|
|
3685
|
+
value: store.current
|
|
3686
|
+
}, children);
|
|
3687
|
+
}
|
|
3688
|
+
function useCameraStore(selector) {
|
|
3689
|
+
var store = useContext(CameraStoreContext);
|
|
3690
|
+
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
3691
|
+
return useStore(store, selector);
|
|
3792
3692
|
}
|
|
3793
3693
|
|
|
3794
3694
|
var DocumentDetectionModelContext = /*#__PURE__*/createContext({
|
|
@@ -3836,7 +3736,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3836
3736
|
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
3837
3737
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3838
3738
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
|
|
3839
|
-
var _h =
|
|
3739
|
+
var _h = useCameraStore(),
|
|
3840
3740
|
videoRef = _h.videoRef,
|
|
3841
3741
|
videoLoaded = _h.videoLoaded,
|
|
3842
3742
|
cameraReady = _h.cameraReady;
|
|
@@ -3859,7 +3759,8 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
3859
3759
|
modelPath: documentDetectionModelPath,
|
|
3860
3760
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
3861
3761
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
3862
|
-
onModelError: onDocumentDetectionModelError
|
|
3762
|
+
onModelError: onDocumentDetectionModelError,
|
|
3763
|
+
videoRef: videoRef
|
|
3863
3764
|
}),
|
|
3864
3765
|
ready = _o.ready,
|
|
3865
3766
|
modelDownloadProgress = _o.modelDownloadProgress,
|
|
@@ -3976,10 +3877,12 @@ function FocusModelProvider(_a) {
|
|
|
3976
3877
|
var _e = useState({}),
|
|
3977
3878
|
focusThresholds = _e[0],
|
|
3978
3879
|
setFocusThresholds = _e[1];
|
|
3880
|
+
var videoRef = useCameraStore().videoRef;
|
|
3979
3881
|
var _f = useLoadFocusModel({
|
|
3980
3882
|
modelPath: focusModelPath,
|
|
3981
3883
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
3982
|
-
onModelError: onFocusModelError
|
|
3884
|
+
onModelError: onFocusModelError,
|
|
3885
|
+
videoRef: videoRef
|
|
3983
3886
|
}),
|
|
3984
3887
|
ready = _f.ready,
|
|
3985
3888
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -5101,31 +5004,33 @@ var Button = styled(LoaderButton)(templateObject_5$b || (templateObject_5$b = __
|
|
|
5101
5004
|
var templateObject_1$D, templateObject_2$w, templateObject_3$o, templateObject_4$i, templateObject_5$b;
|
|
5102
5005
|
|
|
5103
5006
|
var IdCapture = function IdCapture(_a) {
|
|
5104
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
5007
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
5105
5008
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
5106
|
-
|
|
5107
|
-
thresholds =
|
|
5009
|
+
_j = _a.thresholds,
|
|
5010
|
+
thresholds = _j === void 0 ? defaultIdCaptureThresholds : _j,
|
|
5108
5011
|
guidanceMessage = _a.guidanceMessage,
|
|
5109
5012
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
5110
5013
|
onCapture = _a.onCapture,
|
|
5111
|
-
|
|
5112
|
-
classNames =
|
|
5113
|
-
|
|
5114
|
-
colors =
|
|
5115
|
-
|
|
5116
|
-
rawVerbiage =
|
|
5117
|
-
|
|
5118
|
-
debugMode =
|
|
5119
|
-
var
|
|
5120
|
-
ref =
|
|
5121
|
-
|
|
5122
|
-
width =
|
|
5123
|
-
|
|
5124
|
-
height =
|
|
5125
|
-
var
|
|
5126
|
-
state =
|
|
5127
|
-
dispatch =
|
|
5128
|
-
var
|
|
5014
|
+
_k = _a.classNames,
|
|
5015
|
+
classNames = _k === void 0 ? {} : _k,
|
|
5016
|
+
_l = _a.colors,
|
|
5017
|
+
colors = _l === void 0 ? {} : _l,
|
|
5018
|
+
_m = _a.verbiage,
|
|
5019
|
+
rawVerbiage = _m === void 0 ? {} : _m,
|
|
5020
|
+
_o = _a.debugMode,
|
|
5021
|
+
debugMode = _o === void 0 ? false : _o;
|
|
5022
|
+
var _p = useResizeObserver(),
|
|
5023
|
+
ref = _p.ref,
|
|
5024
|
+
_q = _p.width,
|
|
5025
|
+
width = _q === void 0 ? 1 : _q,
|
|
5026
|
+
_r = _p.height,
|
|
5027
|
+
height = _r === void 0 ? 1 : _r;
|
|
5028
|
+
var _s = useIdCaptureState(),
|
|
5029
|
+
state = _s[0],
|
|
5030
|
+
dispatch = _s[1];
|
|
5031
|
+
var _t = useCameraStore(),
|
|
5032
|
+
camera = _t.camera,
|
|
5033
|
+
isRearFacing = _t.isRearFacing;
|
|
5129
5034
|
var _u = useContext(IdCaptureModelsContext),
|
|
5130
5035
|
modelsReady = _u.ready,
|
|
5131
5036
|
setThresholds = _u.setThresholds,
|
|
@@ -5237,17 +5142,16 @@ var IdCapture = function IdCapture(_a) {
|
|
|
5237
5142
|
classNames: classNames.overrideWrongDocumentTypeGuidanceDialog,
|
|
5238
5143
|
verbiage: rawVerbiage.overrideWrongDocumentTypeGuidanceDialog
|
|
5239
5144
|
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugBoundingBoxOverlay, {
|
|
5240
|
-
"$flipX": !
|
|
5145
|
+
"$flipX": !isRearFacing,
|
|
5241
5146
|
scaling: debugScalingDetails
|
|
5242
5147
|
}, state.detectedObjects.map(function (obj, i) {
|
|
5243
|
-
var _a;
|
|
5244
5148
|
return /*#__PURE__*/React__default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
5245
5149
|
key: i,
|
|
5246
5150
|
obj: obj,
|
|
5247
5151
|
scaling: debugScalingDetails,
|
|
5248
|
-
flipX: !
|
|
5152
|
+
flipX: !isRearFacing
|
|
5249
5153
|
});
|
|
5250
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null,
|
|
5154
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__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__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
5251
5155
|
};
|
|
5252
5156
|
var timeSince = function timeSince(t) {
|
|
5253
5157
|
if (!t) return 0;
|
|
@@ -5264,7 +5168,9 @@ var CameraAccessDeniedOverlay = function CameraAccessDeniedOverlay(_a) {
|
|
|
5264
5168
|
colors = _e === void 0 ? {} : _e,
|
|
5265
5169
|
_f = _a.verbiage,
|
|
5266
5170
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
5267
|
-
var requestCameraAccess =
|
|
5171
|
+
var requestCameraAccess = useCameraStore(function (state) {
|
|
5172
|
+
return state.requestCameraAccess;
|
|
5173
|
+
});
|
|
5268
5174
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/camera-disable-icon.png');
|
|
5269
5175
|
var verbiage = useTranslations(rawVerbiage, {
|
|
5270
5176
|
headingText: 'Your camera permission is disabled',
|
|
@@ -5912,7 +5818,7 @@ var IdCaptureLoadingOverlayDefault = function IdCaptureLoadingOverlayDefault(_a)
|
|
|
5912
5818
|
var _o = useContext(IdCaptureModelsContext),
|
|
5913
5819
|
modelsReady = _o.ready,
|
|
5914
5820
|
modelDownloadProgress = _o.modelDownloadProgress;
|
|
5915
|
-
var _p =
|
|
5821
|
+
var _p = useCameraStore(),
|
|
5916
5822
|
cameraReady = _p.cameraReady,
|
|
5917
5823
|
cameraAccessDenied = _p.cameraAccessDenied,
|
|
5918
5824
|
iphoneContinuityCameraAvailable = _p.iphoneContinuityCameraAvailable,
|
|
@@ -6110,7 +6016,14 @@ var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
|
|
|
6110
6016
|
var _l = useContext(IdCaptureModelsContext),
|
|
6111
6017
|
modelsReady = _l.ready,
|
|
6112
6018
|
modelDownloadProgress = _l.modelDownloadProgress;
|
|
6113
|
-
var _m =
|
|
6019
|
+
var _m = useCameraStore(useShallow(function (state) {
|
|
6020
|
+
return {
|
|
6021
|
+
cameraReady: state.cameraReady,
|
|
6022
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
6023
|
+
iphoneContinuityCameraAvailable: state.iphoneContinuityCameraAvailable,
|
|
6024
|
+
setIphoneContinuityCameraAllowed: state.setIphoneContinuityCameraAllowed
|
|
6025
|
+
};
|
|
6026
|
+
})),
|
|
6114
6027
|
cameraReady = _m.cameraReady,
|
|
6115
6028
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
6116
6029
|
iphoneContinuityCameraAvailable = _m.iphoneContinuityCameraAvailable,
|
|
@@ -6656,23 +6569,24 @@ function getOrientation(allowPortraitOnMobile) {
|
|
|
6656
6569
|
}
|
|
6657
6570
|
|
|
6658
6571
|
var IdVideoCaptureFlipIdPrompt = function IdVideoCaptureFlipIdPrompt(_a) {
|
|
6659
|
-
var _b
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
classNames = _d === void 0 ? {} : _d,
|
|
6572
|
+
var _b = _a.idCaptureGuideImages,
|
|
6573
|
+
idCaptureGuideImages = _b === void 0 ? defaultIdCaptureGuideImages : _b,
|
|
6574
|
+
_c = _a.classNames,
|
|
6575
|
+
classNames = _c === void 0 ? {} : _c,
|
|
6664
6576
|
borderWidth = _a.borderWidth,
|
|
6665
6577
|
borderColor = _a.borderColor,
|
|
6666
6578
|
borderRadius = _a.borderRadius,
|
|
6667
6579
|
imageStyle = _a.imageStyle;
|
|
6668
|
-
var
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6580
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
6581
|
+
return state.isRearFacing;
|
|
6582
|
+
});
|
|
6583
|
+
var isMirrored = !isRearFacing;
|
|
6584
|
+
var _d = useState(1),
|
|
6585
|
+
transitionTime = _d[0],
|
|
6586
|
+
setTransitionTime = _d[1];
|
|
6587
|
+
var _e = useState(0),
|
|
6588
|
+
rotationAngle = _e[0],
|
|
6589
|
+
setRotationAngle = _e[1];
|
|
6676
6590
|
var frontTransforms = ["rotateY(".concat(rotationAngle, "deg)")];
|
|
6677
6591
|
if (isMirrored) frontTransforms.push('scaleX(-1)');
|
|
6678
6592
|
var backTransforms = ["rotateY(".concat(180 - rotationAngle, "deg)")];
|
|
@@ -7196,29 +7110,30 @@ var Canvas$1 = styled.canvas(templateObject_2$n || (templateObject_2$n = __makeT
|
|
|
7196
7110
|
var templateObject_1$r, templateObject_2$n;
|
|
7197
7111
|
|
|
7198
7112
|
function IdCaptureGuides(_a) {
|
|
7199
|
-
var _b,
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
rawVerbiage = _o === void 0 ? {} : _o;
|
|
7113
|
+
var _b = _a.guideType,
|
|
7114
|
+
guideType = _b === void 0 ? 'fit' : _b,
|
|
7115
|
+
_c = _a.status,
|
|
7116
|
+
status = _c === void 0 ? 'ready' : _c,
|
|
7117
|
+
_d = _a.progress,
|
|
7118
|
+
progress = _d === void 0 ? 0 : _d,
|
|
7119
|
+
_e = _a.portraitGuidesOnMobile,
|
|
7120
|
+
portraitGuidesOnMobile = _e === void 0 ? true : _e,
|
|
7121
|
+
_f = _a.requestedAction,
|
|
7122
|
+
requestedAction = _f === void 0 ? 'SHOW_ID_FRONT' : _f,
|
|
7123
|
+
_g = _a.isBackToFront,
|
|
7124
|
+
isBackToFront = _g === void 0 ? false : _g,
|
|
7125
|
+
_h = _a.images,
|
|
7126
|
+
images = _h === void 0 ? defaultIdCaptureGuideImages : _h,
|
|
7127
|
+
_j = _a.classNames,
|
|
7128
|
+
classNames = _j === void 0 ? {} : _j,
|
|
7129
|
+
_k = _a.colors,
|
|
7130
|
+
colors = _k === void 0 ? {} : _k,
|
|
7131
|
+
_l = _a.verbiage,
|
|
7132
|
+
rawVerbiage = _l === void 0 ? {} : _l;
|
|
7220
7133
|
var state = useIdCaptureState()[0];
|
|
7221
|
-
var
|
|
7134
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
7135
|
+
return state.isRearFacing;
|
|
7136
|
+
});
|
|
7222
7137
|
var verbiage = useTranslations(rawVerbiage, {
|
|
7223
7138
|
instructionText: 'Scan the front of ID',
|
|
7224
7139
|
capturingText: 'Capturing...',
|
|
@@ -7230,7 +7145,7 @@ function IdCaptureGuides(_a) {
|
|
|
7230
7145
|
status: status,
|
|
7231
7146
|
progress: progress,
|
|
7232
7147
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
7233
|
-
isMirrored: !
|
|
7148
|
+
isMirrored: !isRearFacing,
|
|
7234
7149
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
7235
7150
|
imageVisible: requestedAction === 'FLIP_ID' || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
|
|
7236
7151
|
})), guideType === 'fit' && ( /*#__PURE__*/React__default.createElement(IdCaptureFitGuide, {
|
|
@@ -7240,7 +7155,7 @@ function IdCaptureGuides(_a) {
|
|
|
7240
7155
|
status: status,
|
|
7241
7156
|
progress: progress,
|
|
7242
7157
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
7243
|
-
isMirrored: !
|
|
7158
|
+
isMirrored: !isRearFacing,
|
|
7244
7159
|
isBackToFront: isBackToFront,
|
|
7245
7160
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
7246
7161
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
@@ -7339,48 +7254,6 @@ var ImagePreviewText = styled.div(templateObject_3$h || (templateObject_3$h = __
|
|
|
7339
7254
|
var ImagePreviewImageWrapper = styled.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"])));
|
|
7340
7255
|
var templateObject_1$q, templateObject_2$m, templateObject_3$h, templateObject_4$b;
|
|
7341
7256
|
|
|
7342
|
-
var CameraVideoTag = function CameraVideoTag(_a) {
|
|
7343
|
-
var _b;
|
|
7344
|
-
var className = _a.className;
|
|
7345
|
-
var _c = useContext(CameraStateContext),
|
|
7346
|
-
videoRef = _c.videoRef,
|
|
7347
|
-
setVideoLoaded = _c.setVideoLoaded,
|
|
7348
|
-
onVideoUnmounted = _c.onVideoUnmounted,
|
|
7349
|
-
cameraRef = _c.cameraRef;
|
|
7350
|
-
useEffect(function notifyCameraProviderOfUnmount() {
|
|
7351
|
-
var videoElement = videoRef.current;
|
|
7352
|
-
if (!videoElement) return;
|
|
7353
|
-
return function () {
|
|
7354
|
-
onVideoUnmounted(videoElement);
|
|
7355
|
-
};
|
|
7356
|
-
}, [onVideoUnmounted, videoRef]);
|
|
7357
|
-
useEffect(function setVideoLoadedToFalseOnMount() {
|
|
7358
|
-
setVideoLoaded(false);
|
|
7359
|
-
}, [setVideoLoaded]);
|
|
7360
|
-
useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
7361
|
-
var _a;
|
|
7362
|
-
if (videoRef.current && ((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.stream)) {
|
|
7363
|
-
videoRef.current.srcObject = cameraRef.current.stream;
|
|
7364
|
-
}
|
|
7365
|
-
}, [cameraRef, videoRef]);
|
|
7366
|
-
var onLoadedData = useCallback(function () {
|
|
7367
|
-
setVideoLoaded(true);
|
|
7368
|
-
}, [setVideoLoaded]);
|
|
7369
|
-
return /*#__PURE__*/React__default.createElement(FullscreenVideoTag, {
|
|
7370
|
-
className: className,
|
|
7371
|
-
autoPlay: true,
|
|
7372
|
-
playsInline: true,
|
|
7373
|
-
muted: true,
|
|
7374
|
-
ref: videoRef,
|
|
7375
|
-
onLoadedData: onLoadedData,
|
|
7376
|
-
"$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
|
|
7377
|
-
});
|
|
7378
|
-
};
|
|
7379
|
-
var FullscreenVideoTag = styled.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) {
|
|
7380
|
-
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
7381
|
-
});
|
|
7382
|
-
var templateObject_1$p;
|
|
7383
|
-
|
|
7384
7257
|
var documentCaptureInitialState = {
|
|
7385
7258
|
documents: [],
|
|
7386
7259
|
currentDocumentIndex: 0,
|
|
@@ -7499,8 +7372,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7499
7372
|
var _c = useReducer(documentCaptureStateReducer, documentCaptureInitialState),
|
|
7500
7373
|
state = _c[0],
|
|
7501
7374
|
dispatch = _c[1];
|
|
7502
|
-
var _d =
|
|
7503
|
-
|
|
7375
|
+
var _d = useCameraStore(),
|
|
7376
|
+
videoStream = _d.videoStream,
|
|
7504
7377
|
videoRef = _d.videoRef;
|
|
7505
7378
|
var uploadDocument = useContext(SubmissionContext).uploadDocument;
|
|
7506
7379
|
var uploadCapturedDocument = useCallback(function (content, filetype) {
|
|
@@ -7591,8 +7464,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7591
7464
|
}, [onResize]);
|
|
7592
7465
|
var videoTag = videoRef.current;
|
|
7593
7466
|
useEffect(function () {
|
|
7594
|
-
if (!state.capturing) return;
|
|
7595
|
-
if (!cameraRef.current) return;
|
|
7467
|
+
if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
|
|
7596
7468
|
function onComplete(content) {
|
|
7597
7469
|
if (!content) return;
|
|
7598
7470
|
var contentUrl = URL.createObjectURL(content);
|
|
@@ -7605,7 +7477,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7605
7477
|
});
|
|
7606
7478
|
}
|
|
7607
7479
|
if (typeof ImageCapture !== 'undefined') {
|
|
7608
|
-
var tracks =
|
|
7480
|
+
var tracks = videoStream.getTracks();
|
|
7609
7481
|
var videoCameraTrack = tracks.find(function (track) {
|
|
7610
7482
|
return track.kind === 'video';
|
|
7611
7483
|
});
|
|
@@ -7620,7 +7492,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
|
|
|
7620
7492
|
drawToCanvas(canvas, videoTag);
|
|
7621
7493
|
canvas.toBlob(onComplete);
|
|
7622
7494
|
}
|
|
7623
|
-
}, [
|
|
7495
|
+
}, [state.capturing, videoStream, videoTag]);
|
|
7624
7496
|
var stateWithActions = useMemo(function () {
|
|
7625
7497
|
return _assign(_assign({}, state), {
|
|
7626
7498
|
uploadCapturedDocument: uploadCapturedDocument
|
|
@@ -7735,52 +7607,85 @@ var DocumentCaptureGuideOverlay = function DocumentCaptureGuideOverlay(_a) {
|
|
|
7735
7607
|
ref: canvasRef
|
|
7736
7608
|
}));
|
|
7737
7609
|
};
|
|
7738
|
-
var CanvasWrapper = styled.div(templateObject_1$
|
|
7610
|
+
var CanvasWrapper = styled.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) {
|
|
7739
7611
|
return props.$maskColor;
|
|
7740
7612
|
});
|
|
7741
7613
|
var Canvas = styled.canvas(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
|
|
7742
|
-
var templateObject_1$
|
|
7614
|
+
var templateObject_1$p, templateObject_2$l;
|
|
7743
7615
|
|
|
7744
|
-
var CameraFeedWrapper = styled.div(templateObject_1$
|
|
7616
|
+
var CameraFeedWrapper = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
7745
7617
|
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;") : "";
|
|
7746
7618
|
});
|
|
7619
|
+
var templateObject_1$o;
|
|
7620
|
+
|
|
7621
|
+
var CameraVideoTag = function CameraVideoTag(props) {
|
|
7622
|
+
var _a = useCameraStore(useShallow(function (store) {
|
|
7623
|
+
return {
|
|
7624
|
+
videoRef: store.videoRef,
|
|
7625
|
+
videoStream: store.videoStream,
|
|
7626
|
+
onVideoMounted: store.onVideoMounted,
|
|
7627
|
+
isRearFacing: store.isRearFacing
|
|
7628
|
+
};
|
|
7629
|
+
})),
|
|
7630
|
+
videoRef = _a.videoRef,
|
|
7631
|
+
videoStream = _a.videoStream,
|
|
7632
|
+
onVideoMounted = _a.onVideoMounted,
|
|
7633
|
+
isRearFacing = _a.isRearFacing;
|
|
7634
|
+
useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
7635
|
+
if (videoRef.current && videoStream) {
|
|
7636
|
+
debug('attaching camera stream to video tag');
|
|
7637
|
+
videoRef.current.srcObject = videoStream;
|
|
7638
|
+
}
|
|
7639
|
+
}, [videoStream, videoRef]);
|
|
7640
|
+
return /*#__PURE__*/React__default.createElement(FullscreenVideoTag, _assign({
|
|
7641
|
+
autoPlay: true,
|
|
7642
|
+
playsInline: true,
|
|
7643
|
+
muted: true,
|
|
7644
|
+
ref: videoRef,
|
|
7645
|
+
onLoadedData: onVideoMounted,
|
|
7646
|
+
"$isRearFacing": isRearFacing
|
|
7647
|
+
}, props));
|
|
7648
|
+
};
|
|
7649
|
+
var FullscreenVideoTag = styled.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) {
|
|
7650
|
+
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
7651
|
+
});
|
|
7747
7652
|
var templateObject_1$n;
|
|
7748
7653
|
|
|
7749
7654
|
var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
7750
|
-
var _b, _c, _d, _e, _f
|
|
7655
|
+
var _b, _c, _d, _e, _f;
|
|
7751
7656
|
var onCaptureClicked = _a.onCaptureClicked,
|
|
7752
|
-
|
|
7753
|
-
classNames =
|
|
7754
|
-
|
|
7755
|
-
rawVerbiage =
|
|
7756
|
-
var
|
|
7757
|
-
|
|
7758
|
-
documents =
|
|
7759
|
-
currentDocumentIndex =
|
|
7760
|
-
rectX =
|
|
7761
|
-
rectY =
|
|
7762
|
-
rectWidth =
|
|
7763
|
-
rectHeight =
|
|
7764
|
-
rectOffsetTop =
|
|
7765
|
-
capturing =
|
|
7766
|
-
uploadCapturedDocument =
|
|
7767
|
-
dispatch =
|
|
7768
|
-
var
|
|
7769
|
-
title =
|
|
7770
|
-
aspectRatio =
|
|
7771
|
-
cameraFeedMode =
|
|
7772
|
-
instructions =
|
|
7773
|
-
contentUrl =
|
|
7774
|
-
content =
|
|
7775
|
-
uploadState =
|
|
7776
|
-
var
|
|
7777
|
-
|
|
7778
|
-
cameraReady =
|
|
7779
|
-
cameraAccessDenied =
|
|
7780
|
-
requestCameraAccess =
|
|
7781
|
-
var
|
|
7782
|
-
cameraAccessRequested =
|
|
7783
|
-
setCameraAccessRequested =
|
|
7657
|
+
_g = _a.classNames,
|
|
7658
|
+
classNames = _g === void 0 ? {} : _g,
|
|
7659
|
+
_h = _a.verbiage,
|
|
7660
|
+
rawVerbiage = _h === void 0 ? {} : _h;
|
|
7661
|
+
var _j = useDocumentCaptureState(),
|
|
7662
|
+
_k = _j[0],
|
|
7663
|
+
documents = _k.documents,
|
|
7664
|
+
currentDocumentIndex = _k.currentDocumentIndex,
|
|
7665
|
+
rectX = _k.rectX,
|
|
7666
|
+
rectY = _k.rectY,
|
|
7667
|
+
rectWidth = _k.rectWidth,
|
|
7668
|
+
rectHeight = _k.rectHeight,
|
|
7669
|
+
rectOffsetTop = _k.rectOffsetTop,
|
|
7670
|
+
capturing = _k.capturing,
|
|
7671
|
+
uploadCapturedDocument = _k.uploadCapturedDocument,
|
|
7672
|
+
dispatch = _j[1];
|
|
7673
|
+
var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
|
|
7674
|
+
title = _l.title,
|
|
7675
|
+
aspectRatio = _l.aspectRatio,
|
|
7676
|
+
cameraFeedMode = _l.cameraFeedMode,
|
|
7677
|
+
instructions = _l.instructions,
|
|
7678
|
+
contentUrl = _l.contentUrl,
|
|
7679
|
+
content = _l.content,
|
|
7680
|
+
uploadState = _l.uploadState;
|
|
7681
|
+
var _m = useCameraStore(),
|
|
7682
|
+
videoStream = _m.videoStream,
|
|
7683
|
+
cameraReady = _m.cameraReady,
|
|
7684
|
+
cameraAccessDenied = _m.cameraAccessDenied,
|
|
7685
|
+
requestCameraAccess = _m.requestCameraAccess;
|
|
7686
|
+
var _o = useState(false),
|
|
7687
|
+
cameraAccessRequested = _o[0],
|
|
7688
|
+
setCameraAccessRequested = _o[1];
|
|
7784
7689
|
var cameraAccessNeeded =
|
|
7785
7690
|
// we should force the browser to ask for camera access if...
|
|
7786
7691
|
uploadState === 'not_started' &&
|
|
@@ -7789,14 +7694,14 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
7789
7694
|
// and the user hasn't passed a media blob for the current document...
|
|
7790
7695
|
!cameraAccessRequested &&
|
|
7791
7696
|
// and we haven't already tried to force a camera request...
|
|
7792
|
-
!(
|
|
7697
|
+
!(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active); // and we don't already have camera access.
|
|
7793
7698
|
useEffect(function requestCameraAccessIfNeeded() {
|
|
7794
7699
|
if (!cameraAccessNeeded) return;
|
|
7795
7700
|
setCameraAccessRequested(true);
|
|
7796
7701
|
requestCameraAccess();
|
|
7797
7702
|
}, [cameraAccessNeeded, requestCameraAccess]);
|
|
7798
7703
|
var theme = useTheme();
|
|
7799
|
-
var maskColor = (
|
|
7704
|
+
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)";
|
|
7800
7705
|
var verbiage = useTranslations(rawVerbiage, {
|
|
7801
7706
|
headingText: title,
|
|
7802
7707
|
loadingBtnText: 'Camera initializing...',
|
|
@@ -7829,7 +7734,7 @@ var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
|
7829
7734
|
});
|
|
7830
7735
|
}
|
|
7831
7736
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
7832
|
-
className: "flex ".concat((
|
|
7737
|
+
className: "flex ".concat((_f = classNames.container) !== null && _f !== void 0 ? _f : '')
|
|
7833
7738
|
}, /*#__PURE__*/React__default.createElement(CameraFeedWrapper, {
|
|
7834
7739
|
className: classNames.cameraFeedWrapper,
|
|
7835
7740
|
"$mode": cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
|
|
@@ -8254,7 +8159,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
8254
8159
|
var _3 = useIdCaptureState(),
|
|
8255
8160
|
state = _3[0],
|
|
8256
8161
|
dispatch = _3[1];
|
|
8257
|
-
var _4 =
|
|
8162
|
+
var _4 = useCameraStore(),
|
|
8258
8163
|
cameraAccessDenied = _4.cameraAccessDenied,
|
|
8259
8164
|
requestCameraAccess = _4.requestCameraAccess,
|
|
8260
8165
|
releaseCameraAccess = _4.releaseCameraAccess;
|
|
@@ -9202,7 +9107,13 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9202
9107
|
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
9203
9108
|
_d = _a.requireVerticalFaceCentering,
|
|
9204
9109
|
requireVerticalFaceCentering = _d === void 0 ? true : _d;
|
|
9205
|
-
var _e =
|
|
9110
|
+
var _e = useCameraStore(useShallow(function (state) {
|
|
9111
|
+
return {
|
|
9112
|
+
videoRef: state.videoRef,
|
|
9113
|
+
videoLoaded: state.videoLoaded,
|
|
9114
|
+
cameraReady: state.cameraReady
|
|
9115
|
+
};
|
|
9116
|
+
})),
|
|
9206
9117
|
videoRef = _e.videoRef,
|
|
9207
9118
|
videoLoaded = _e.videoLoaded,
|
|
9208
9119
|
cameraReady = _e.cameraReady;
|
|
@@ -9210,7 +9121,8 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
9210
9121
|
var onPredictionHandler = useRef();
|
|
9211
9122
|
var _f = useLoadFaceDetector({
|
|
9212
9123
|
onModelError: onModelError,
|
|
9213
|
-
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
9124
|
+
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
9125
|
+
videoRef: videoRef
|
|
9214
9126
|
}),
|
|
9215
9127
|
ready = _f.ready,
|
|
9216
9128
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -9543,8 +9455,14 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
9543
9455
|
prediction = _t.prediction,
|
|
9544
9456
|
dispatch = _s[1];
|
|
9545
9457
|
var lastPredictionCanvas = useRef(null);
|
|
9546
|
-
var _u =
|
|
9547
|
-
|
|
9458
|
+
var _u = useCameraStore(useShallow(function (state) {
|
|
9459
|
+
return {
|
|
9460
|
+
camera: state.camera,
|
|
9461
|
+
cameraReady: state.cameraReady,
|
|
9462
|
+
videoRef: state.videoRef
|
|
9463
|
+
};
|
|
9464
|
+
})),
|
|
9465
|
+
camera = _u.camera,
|
|
9548
9466
|
videoRef = _u.videoRef;
|
|
9549
9467
|
var _v = useContext(SelfieGuidanceModelsContext),
|
|
9550
9468
|
onPredictionMade = _v.onPredictionMade,
|
|
@@ -9634,7 +9552,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
9634
9552
|
face: prediction.face,
|
|
9635
9553
|
scaling: debugScalingDetails,
|
|
9636
9554
|
color: satisfied ? 'green' : 'red'
|
|
9637
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null,
|
|
9555
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__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__default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__default.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React__default.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
9638
9556
|
onClick: onExit,
|
|
9639
9557
|
className: classNames.exitCaptureBtn
|
|
9640
9558
|
}));
|
|
@@ -10090,7 +10008,9 @@ var MicrophoneAccessDeniedOverlay = function MicrophoneAccessDeniedOverlay(_a) {
|
|
|
10090
10008
|
colors = _e === void 0 ? {} : _e,
|
|
10091
10009
|
_f = _a.verbiage,
|
|
10092
10010
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10093
|
-
var requestMicrophoneAccess =
|
|
10011
|
+
var requestMicrophoneAccess = useCameraStore(function (state) {
|
|
10012
|
+
return state.requestMicrophoneAccess;
|
|
10013
|
+
});
|
|
10094
10014
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/microphone-disable-icon.svg');
|
|
10095
10015
|
var verbiage = useTranslations(rawVerbiage, {
|
|
10096
10016
|
headingText: 'Your microphone permission is disabled',
|
|
@@ -10138,7 +10058,13 @@ var SelfieCaptureLoadingOverlayLegacy = function SelfieCaptureLoadingOverlayLega
|
|
|
10138
10058
|
colors = _e === void 0 ? {} : _e,
|
|
10139
10059
|
_f = _a.verbiage,
|
|
10140
10060
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10141
|
-
var _g =
|
|
10061
|
+
var _g = useCameraStore(useShallow(function (state) {
|
|
10062
|
+
return {
|
|
10063
|
+
cameraReady: state.cameraReady,
|
|
10064
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10065
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
10066
|
+
};
|
|
10067
|
+
})),
|
|
10142
10068
|
cameraReady = _g.cameraReady,
|
|
10143
10069
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
10144
10070
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -10225,7 +10151,13 @@ var SelfieCaptureLoadingOverlayDefault = function SelfieCaptureLoadingOverlayDef
|
|
|
10225
10151
|
colors = _e === void 0 ? {} : _e,
|
|
10226
10152
|
_f = _a.verbiage,
|
|
10227
10153
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
10228
|
-
var _g =
|
|
10154
|
+
var _g = useCameraStore(useShallow(function (state) {
|
|
10155
|
+
return {
|
|
10156
|
+
cameraReady: state.cameraReady,
|
|
10157
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10158
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
10159
|
+
};
|
|
10160
|
+
})),
|
|
10229
10161
|
cameraReady = _g.cameraReady,
|
|
10230
10162
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
10231
10163
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -10442,7 +10374,13 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
|
|
|
10442
10374
|
livenessCheckRequest = _t.livenessCheckRequest,
|
|
10443
10375
|
setSelfieImage = _t.setSelfieImage,
|
|
10444
10376
|
logSelfieCaptureAttempt = _t.logSelfieCaptureAttempt;
|
|
10445
|
-
var _u =
|
|
10377
|
+
var _u = useCameraStore(useShallow(function (state) {
|
|
10378
|
+
return {
|
|
10379
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
10380
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
10381
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
10382
|
+
};
|
|
10383
|
+
})),
|
|
10446
10384
|
cameraAccessDenied = _u.cameraAccessDenied,
|
|
10447
10385
|
requestCameraAccess = _u.requestCameraAccess,
|
|
10448
10386
|
releaseCameraAccess = _u.releaseCameraAccess;
|
|
@@ -11163,10 +11101,10 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11163
11101
|
setSignatureVideoUrl = _e[1];
|
|
11164
11102
|
var signatureRecorder = useRef(null);
|
|
11165
11103
|
var recordedChunks = useRef([]);
|
|
11166
|
-
var _f =
|
|
11167
|
-
|
|
11104
|
+
var _f = useCameraStore(),
|
|
11105
|
+
camera = _f.camera,
|
|
11168
11106
|
videoRef = _f.videoRef;
|
|
11169
|
-
var _g = useVideoRecorder(
|
|
11107
|
+
var _g = useVideoRecorder(camera),
|
|
11170
11108
|
isRecordingVideo = _g.isRecordingVideo,
|
|
11171
11109
|
startRecordingVideo = _g.startRecordingVideo,
|
|
11172
11110
|
stopRecordingVideo = _g.stopRecordingVideo,
|
|
@@ -11234,8 +11172,8 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11234
11172
|
var animationFrame = useRef(0);
|
|
11235
11173
|
useEffect(function () {
|
|
11236
11174
|
var _a;
|
|
11237
|
-
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !
|
|
11238
|
-
var _b = [
|
|
11175
|
+
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
|
|
11176
|
+
var _b = [camera.width, camera.height],
|
|
11239
11177
|
w = _b[0],
|
|
11240
11178
|
h = _b[1];
|
|
11241
11179
|
var isPortrait = typeof window !== 'undefined' && window.innerWidth < window.innerHeight;
|
|
@@ -11268,7 +11206,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
11268
11206
|
return function () {
|
|
11269
11207
|
cancelAnimationFrame(animationFrame.current);
|
|
11270
11208
|
};
|
|
11271
|
-
}, [
|
|
11209
|
+
}, [camera, isRecording, isRecordingVideo, videoRef]);
|
|
11272
11210
|
var onAcceptClicked = useCallback(function () {
|
|
11273
11211
|
return __awaiter(_this, void 0, void 0, function () {
|
|
11274
11212
|
var imageUrl;
|
|
@@ -11397,27 +11335,29 @@ var AcceptBtn = styled(LoaderButton)(templateObject_7$1 || (templateObject_7$1 =
|
|
|
11397
11335
|
var templateObject_1$9, templateObject_2$8, templateObject_3$8, templateObject_4$3, templateObject_5$2, templateObject_6$2, templateObject_7$1;
|
|
11398
11336
|
|
|
11399
11337
|
var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
11400
|
-
var _b
|
|
11338
|
+
var _b;
|
|
11401
11339
|
var onVideoCaptured = _a.onVideoCaptured,
|
|
11402
11340
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
11403
11341
|
onExit = _a.onExit,
|
|
11404
11342
|
guidesComponent = _a.guidesComponent,
|
|
11405
|
-
|
|
11406
|
-
classNames =
|
|
11407
|
-
|
|
11408
|
-
colors =
|
|
11409
|
-
|
|
11410
|
-
rawVerbiage =
|
|
11411
|
-
|
|
11412
|
-
debugMode =
|
|
11413
|
-
var
|
|
11343
|
+
_c = _a.classNames,
|
|
11344
|
+
classNames = _c === void 0 ? {} : _c,
|
|
11345
|
+
_d = _a.colors,
|
|
11346
|
+
colors = _d === void 0 ? {} : _d,
|
|
11347
|
+
_e = _a.verbiage,
|
|
11348
|
+
rawVerbiage = _e === void 0 ? {} : _e,
|
|
11349
|
+
_f = _a.debugMode,
|
|
11350
|
+
debugMode = _f === void 0 ? false : _f;
|
|
11351
|
+
var camera = useCameraStore(function (state) {
|
|
11352
|
+
return state.camera;
|
|
11353
|
+
});
|
|
11414
11354
|
var onPredictionMade = useContext(SelfieGuidanceModelsContext).onPredictionMade;
|
|
11415
|
-
var
|
|
11416
|
-
signatureData =
|
|
11417
|
-
signatureDataUrl =
|
|
11418
|
-
signatureVideoData =
|
|
11419
|
-
startRecording =
|
|
11420
|
-
stopRecording =
|
|
11355
|
+
var _g = useVideoSignatureContext(),
|
|
11356
|
+
signatureData = _g.signatureData,
|
|
11357
|
+
signatureDataUrl = _g.signatureDataUrl,
|
|
11358
|
+
signatureVideoData = _g.signatureVideoData,
|
|
11359
|
+
startRecording = _g.startRecording,
|
|
11360
|
+
stopRecording = _g.stopRecording;
|
|
11421
11361
|
useEffect(function () {
|
|
11422
11362
|
startRecording();
|
|
11423
11363
|
return function () {
|
|
@@ -11434,9 +11374,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11434
11374
|
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
|
|
11435
11375
|
}
|
|
11436
11376
|
}, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
|
|
11437
|
-
var
|
|
11438
|
-
numFramesWithoutFaces =
|
|
11439
|
-
setNumFramesWithoutFaces =
|
|
11377
|
+
var _h = useState(0),
|
|
11378
|
+
numFramesWithoutFaces = _h[0],
|
|
11379
|
+
setNumFramesWithoutFaces = _h[1];
|
|
11440
11380
|
useEffect(function () {
|
|
11441
11381
|
onPredictionMade(function (_a) {
|
|
11442
11382
|
var face = _a.face;
|
|
@@ -11463,7 +11403,7 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
11463
11403
|
}, verbiage.guidanceMessageText))), /*#__PURE__*/React__default.createElement(GuidesComponent, {
|
|
11464
11404
|
classNames: classNames.videoSignatureGuidesClassNames,
|
|
11465
11405
|
status: "success"
|
|
11466
|
-
}), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ",
|
|
11406
|
+
}), debugMode && ( /*#__PURE__*/React__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__default.createElement(ExitCaptureButton, {
|
|
11467
11407
|
onClick: onExit,
|
|
11468
11408
|
className: classNames.exitCaptureBtn
|
|
11469
11409
|
}));
|
|
@@ -11557,7 +11497,13 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
11557
11497
|
setSignatureData = _l.setSignatureData,
|
|
11558
11498
|
setSignatureVideoUrl = _l.setSignatureVideoUrl,
|
|
11559
11499
|
logSelfieCaptureAttempt = _l.logSelfieCaptureAttempt;
|
|
11560
|
-
var _m =
|
|
11500
|
+
var _m = useCameraStore(useShallow(function (state) {
|
|
11501
|
+
return {
|
|
11502
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
11503
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
11504
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
11505
|
+
};
|
|
11506
|
+
})),
|
|
11561
11507
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
11562
11508
|
requestCameraAccess = _m.requestCameraAccess,
|
|
11563
11509
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
@@ -11717,27 +11663,29 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
11717
11663
|
};
|
|
11718
11664
|
|
|
11719
11665
|
var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
11720
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
11721
|
-
var
|
|
11722
|
-
requestedAction =
|
|
11723
|
-
|
|
11724
|
-
satisfied =
|
|
11725
|
-
|
|
11726
|
-
faceGuideStatus =
|
|
11666
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
11667
|
+
var _z = _a.requestedAction,
|
|
11668
|
+
requestedAction = _z === void 0 ? 'SHOW_ID_FRONT' : _z,
|
|
11669
|
+
_0 = _a.satisfied,
|
|
11670
|
+
satisfied = _0 === void 0 ? false : _0,
|
|
11671
|
+
_1 = _a.faceGuideStatus,
|
|
11672
|
+
faceGuideStatus = _1 === void 0 ? 'success' : _1,
|
|
11727
11673
|
faceGuideBorderWidth = _a.faceGuideBorderWidth,
|
|
11728
11674
|
faceGuideBorderColor = _a.faceGuideBorderColor,
|
|
11729
|
-
|
|
11730
|
-
idCardGuideStatus =
|
|
11675
|
+
_2 = _a.idCardGuideStatus,
|
|
11676
|
+
idCardGuideStatus = _2 === void 0 ? 'ready' : _2,
|
|
11731
11677
|
idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
|
|
11732
11678
|
idCardGuideBorderColor = _a.idCardGuideBorderColor,
|
|
11733
11679
|
idCardCaptureProgress = _a.idCardCaptureProgress,
|
|
11734
|
-
|
|
11735
|
-
userSuppliedImages =
|
|
11736
|
-
|
|
11737
|
-
classNames =
|
|
11738
|
-
|
|
11739
|
-
rawVerbiage =
|
|
11740
|
-
var
|
|
11680
|
+
_3 = _a.idCardCaptureGuideImages,
|
|
11681
|
+
userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
|
|
11682
|
+
_4 = _a.classNames,
|
|
11683
|
+
classNames = _4 === void 0 ? {} : _4,
|
|
11684
|
+
_5 = _a.verbiage,
|
|
11685
|
+
rawVerbiage = _5 === void 0 ? {} : _5;
|
|
11686
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
11687
|
+
return state.isRearFacing;
|
|
11688
|
+
});
|
|
11741
11689
|
var verbiage = useTranslations(rawVerbiage, {
|
|
11742
11690
|
idFrontInstructionText: 'Display the front of your ID card...',
|
|
11743
11691
|
idBackInstructionText: 'Display the back of your ID card...',
|
|
@@ -11750,17 +11698,17 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11750
11698
|
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';
|
|
11751
11699
|
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;
|
|
11752
11700
|
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';
|
|
11753
|
-
var
|
|
11754
|
-
idCardGuideRef =
|
|
11755
|
-
|
|
11756
|
-
idCardGuideWidth =
|
|
11757
|
-
|
|
11758
|
-
idCardGuideHeight =
|
|
11701
|
+
var _6 = useResizeObserver(),
|
|
11702
|
+
idCardGuideRef = _6.ref,
|
|
11703
|
+
_7 = _6.width,
|
|
11704
|
+
idCardGuideWidth = _7 === void 0 ? 0 : _7,
|
|
11705
|
+
_8 = _6.height,
|
|
11706
|
+
idCardGuideHeight = _8 === void 0 ? 0 : _8;
|
|
11759
11707
|
var idCaptureGuideImages = useGuideImages(userSuppliedImages);
|
|
11760
11708
|
var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
|
|
11761
|
-
var
|
|
11762
|
-
aspectRatio =
|
|
11763
|
-
setAspectRatio =
|
|
11709
|
+
var _9 = useState(undefined),
|
|
11710
|
+
aspectRatio = _9[0],
|
|
11711
|
+
setAspectRatio = _9[1];
|
|
11764
11712
|
var onImageLoaded = useCallback(function (e) {
|
|
11765
11713
|
var _a, _b, _c, _d;
|
|
11766
11714
|
var img = e.currentTarget;
|
|
@@ -11807,7 +11755,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11807
11755
|
}, /*#__PURE__*/React__default.createElement(IdCardGuideImage, {
|
|
11808
11756
|
alt: "",
|
|
11809
11757
|
className: classNames.idCardGuideImage,
|
|
11810
|
-
"$isMirrored": !
|
|
11758
|
+
"$isMirrored": !isRearFacing,
|
|
11811
11759
|
style: idCardImageStyle,
|
|
11812
11760
|
src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
|
|
11813
11761
|
onLoad: onImageLoaded
|
|
@@ -11821,8 +11769,8 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
|
11821
11769
|
className: classNames.idCardGuideInstructionsContainer
|
|
11822
11770
|
}, /*#__PURE__*/React__default.createElement(IdCardGuideInstructions, {
|
|
11823
11771
|
className: classNames.idCardGuideInstructions,
|
|
11824
|
-
"$textColor": (
|
|
11825
|
-
"$background": (
|
|
11772
|
+
"$textColor": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsTextColor,
|
|
11773
|
+
"$background": (_y = (_x = theme.idVideoCapture) === null || _x === void 0 ? void 0 : _x.idCardGuides) === null || _y === void 0 ? void 0 : _y.instructionsBackgroundColor
|
|
11826
11774
|
}, instructionText))))));
|
|
11827
11775
|
};
|
|
11828
11776
|
var Container = styled.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) {
|
|
@@ -11967,99 +11915,100 @@ var defaultVideoIdCaptureThresholds = {
|
|
|
11967
11915
|
flipShortcutThreshold: 0.7
|
|
11968
11916
|
};
|
|
11969
11917
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
11970
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v
|
|
11918
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
11971
11919
|
var onComplete = _a.onComplete,
|
|
11972
11920
|
onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
|
|
11973
11921
|
onIdBackImageCaptured = _a.onIdBackImageCaptured,
|
|
11974
11922
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
11975
11923
|
onRecordingFailed = _a.onRecordingFailed,
|
|
11976
11924
|
onExitCapture = _a.onExitCapture,
|
|
11977
|
-
|
|
11978
|
-
idCaptureModelsEnabled =
|
|
11979
|
-
|
|
11980
|
-
idCardCaptureGuideImages =
|
|
11981
|
-
|
|
11982
|
-
idCardFrontDelay =
|
|
11983
|
-
|
|
11984
|
-
videoIdCaptureThresholds =
|
|
11985
|
-
|
|
11986
|
-
skipShowIdCardBack =
|
|
11987
|
-
|
|
11988
|
-
captureCountdownSeconds =
|
|
11925
|
+
_w = _a.idCaptureModelsEnabled,
|
|
11926
|
+
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
11927
|
+
_x = _a.idCardCaptureGuideImages,
|
|
11928
|
+
idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
|
|
11929
|
+
_y = _a.idCardFrontDelay,
|
|
11930
|
+
idCardFrontDelay = _y === void 0 ? 1000 : _y,
|
|
11931
|
+
_z = _a.videoIdCaptureThresholds,
|
|
11932
|
+
videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
|
|
11933
|
+
_0 = _a.skipShowIdCardBack,
|
|
11934
|
+
skipShowIdCardBack = _0 === void 0 ? false : _0,
|
|
11935
|
+
_1 = _a.captureCountdownSeconds,
|
|
11936
|
+
captureCountdownSeconds = _1 === void 0 ? 3 : _1,
|
|
11989
11937
|
readTextPrompt = _a.readTextPrompt,
|
|
11990
|
-
|
|
11991
|
-
readTextTimeoutDurationMs =
|
|
11992
|
-
|
|
11993
|
-
readTextMinReadingMs =
|
|
11994
|
-
|
|
11995
|
-
disableFaceDetectionWhileAudioCapture =
|
|
11996
|
-
|
|
11997
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
11998
|
-
|
|
11999
|
-
mergeAVStreams =
|
|
12000
|
-
|
|
12001
|
-
classNames =
|
|
12002
|
-
|
|
12003
|
-
colors =
|
|
12004
|
-
|
|
12005
|
-
rawVerbiage =
|
|
12006
|
-
|
|
12007
|
-
debugMode =
|
|
12008
|
-
var
|
|
12009
|
-
ref =
|
|
12010
|
-
|
|
12011
|
-
width =
|
|
12012
|
-
|
|
12013
|
-
height =
|
|
12014
|
-
var
|
|
12015
|
-
|
|
12016
|
-
videoRef =
|
|
12017
|
-
videoLoaded =
|
|
12018
|
-
cameraReady =
|
|
12019
|
-
microphoneReady =
|
|
12020
|
-
audioStream =
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
11938
|
+
_2 = _a.readTextTimeoutDurationMs,
|
|
11939
|
+
readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
|
|
11940
|
+
_3 = _a.readTextMinReadingMs,
|
|
11941
|
+
readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
|
|
11942
|
+
_4 = _a.disableFaceDetectionWhileAudioCapture,
|
|
11943
|
+
disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
|
|
11944
|
+
_5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
11945
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
|
|
11946
|
+
_6 = _a.mergeAVStreams,
|
|
11947
|
+
mergeAVStreams = _6 === void 0 ? false : _6,
|
|
11948
|
+
_7 = _a.classNames,
|
|
11949
|
+
classNames = _7 === void 0 ? {} : _7,
|
|
11950
|
+
_8 = _a.colors,
|
|
11951
|
+
colors = _8 === void 0 ? {} : _8,
|
|
11952
|
+
_9 = _a.verbiage,
|
|
11953
|
+
rawVerbiage = _9 === void 0 ? {} : _9,
|
|
11954
|
+
_10 = _a.debugMode,
|
|
11955
|
+
debugMode = _10 === void 0 ? false : _10;
|
|
11956
|
+
var _11 = useResizeObserver(),
|
|
11957
|
+
ref = _11.ref,
|
|
11958
|
+
_12 = _11.width,
|
|
11959
|
+
width = _12 === void 0 ? 1 : _12,
|
|
11960
|
+
_13 = _11.height,
|
|
11961
|
+
height = _13 === void 0 ? 1 : _13;
|
|
11962
|
+
var _14 = useCameraStore(),
|
|
11963
|
+
camera = _14.camera,
|
|
11964
|
+
videoRef = _14.videoRef,
|
|
11965
|
+
videoLoaded = _14.videoLoaded,
|
|
11966
|
+
cameraReady = _14.cameraReady,
|
|
11967
|
+
microphoneReady = _14.microphoneReady,
|
|
11968
|
+
audioStream = _14.audioStream,
|
|
11969
|
+
isRearFacing = _14.isRearFacing,
|
|
11970
|
+
releaseCameraAccess = _14.releaseCameraAccess;
|
|
11971
|
+
var _15 = useState([]),
|
|
11972
|
+
detectedObjects = _15[0],
|
|
11973
|
+
setDetectedObjects = _15[1];
|
|
11974
|
+
var _16 = useState(null),
|
|
11975
|
+
face = _16[0],
|
|
11976
|
+
setFace = _16[1];
|
|
11977
|
+
var _17 = useContext(IdCaptureModelsContext),
|
|
11978
|
+
idModelsReady = _17.ready,
|
|
11979
|
+
startIdModels = _17.start,
|
|
11980
|
+
stopIdModels = _17.stop,
|
|
11981
|
+
onIdPredictionMade = _17.onPredictionMade,
|
|
11982
|
+
setThresholds = _17.setThresholds,
|
|
11983
|
+
setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
|
|
11984
|
+
bestFrameDetails = _17.bestFrameDetails,
|
|
11985
|
+
resetBestFrame = _17.resetBestFrame,
|
|
11986
|
+
idModelError = _17.modelError;
|
|
11987
|
+
var _18 = useState(null),
|
|
11988
|
+
videoStartsAt = _18[0],
|
|
11989
|
+
setVideoStartsAt = _18[1];
|
|
11990
|
+
var _19 = useContext(SubmissionContext),
|
|
11991
|
+
setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
|
|
11992
|
+
setExpectedAudioText = _19.setExpectedAudioText;
|
|
11993
|
+
var _20 = useContext(SelfieGuidanceModelsContext),
|
|
11994
|
+
startSelfieGuidance = _20.start,
|
|
11995
|
+
stopSelfieGuidance = _20.stop,
|
|
11996
|
+
onSelfiePredictionMade = _20.onPredictionMade,
|
|
11997
|
+
selfieModelError = _20.error;
|
|
11998
|
+
var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
|
|
11999
|
+
isRecordingVideo = _21.isRecordingVideo,
|
|
12000
|
+
startRecordingVideo = _21.startRecordingVideo,
|
|
12001
|
+
startRecordingAudio = _21.startRecordingAudio,
|
|
12002
|
+
stopRecordingVideo = _21.stopRecordingVideo,
|
|
12003
|
+
stopRecordingAudio = _21.stopRecordingAudio,
|
|
12004
|
+
videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
|
|
12005
|
+
audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
|
|
12006
|
+
videoUrl = _21.videoUrl,
|
|
12007
|
+
audioUrl = _21.audioUrl;
|
|
12059
12008
|
var countdownTimeoutRef = useRef(undefined);
|
|
12060
|
-
var
|
|
12061
|
-
countdownRemaining =
|
|
12062
|
-
setCountdownRemaining =
|
|
12009
|
+
var _22 = useState(-1),
|
|
12010
|
+
countdownRemaining = _22[0],
|
|
12011
|
+
setCountdownRemaining = _22[1];
|
|
12063
12012
|
useEffect(function () {
|
|
12064
12013
|
if (!isRecordingVideo && !videoUrl) {
|
|
12065
12014
|
startRecordingVideo();
|
|
@@ -12070,18 +12019,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12070
12019
|
var needsAudio = !!readTextPrompt && !mergeAVStreams;
|
|
12071
12020
|
var audioReady = !needsAudio || audioUrl;
|
|
12072
12021
|
if (videoUrl && audioReady) {
|
|
12073
|
-
|
|
12022
|
+
releaseCameraAccess();
|
|
12074
12023
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
|
|
12075
12024
|
}
|
|
12076
|
-
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt,
|
|
12025
|
+
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
|
|
12077
12026
|
useEffect(function () {
|
|
12078
12027
|
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
|
|
12079
12028
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
12080
12029
|
}
|
|
12081
12030
|
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
12082
|
-
var
|
|
12083
|
-
requestedAction =
|
|
12084
|
-
setRequestedAction =
|
|
12031
|
+
var _23 = useState('SHOW_ID_FRONT'),
|
|
12032
|
+
requestedAction = _23[0],
|
|
12033
|
+
setRequestedAction = _23[1];
|
|
12085
12034
|
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
12086
12035
|
useEffect(function startModelsWhenCapturing() {
|
|
12087
12036
|
if (!shouldRunIdModels) return;
|
|
@@ -12101,18 +12050,18 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12101
12050
|
bottom: 1
|
|
12102
12051
|
});
|
|
12103
12052
|
}, [setDocumentDetectionBoundaries]);
|
|
12104
|
-
var
|
|
12105
|
-
currentDetectionScore =
|
|
12106
|
-
setCurrentDetectionScore =
|
|
12107
|
-
var
|
|
12108
|
-
currentDetectedDocumentType =
|
|
12109
|
-
setCurrentDetectedDocumentType =
|
|
12053
|
+
var _24 = useState(0),
|
|
12054
|
+
currentDetectionScore = _24[0],
|
|
12055
|
+
setCurrentDetectionScore = _24[1];
|
|
12056
|
+
var _25 = useState('none'),
|
|
12057
|
+
currentDetectedDocumentType = _25[0],
|
|
12058
|
+
setCurrentDetectedDocumentType = _25[1];
|
|
12059
|
+
var _26 = useState(0),
|
|
12060
|
+
currentFocusScore = _26[0],
|
|
12061
|
+
setCurrentFocusScore = _26[1];
|
|
12110
12062
|
var _27 = useState(0),
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
var _28 = useState(0),
|
|
12114
|
-
goodFramesCount = _28[0],
|
|
12115
|
-
setGoodFramesCount = _28[1];
|
|
12063
|
+
goodFramesCount = _27[0],
|
|
12064
|
+
setGoodFramesCount = _27[1];
|
|
12116
12065
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
12117
12066
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
12118
12067
|
useEffect(function () {
|
|
@@ -12133,9 +12082,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12133
12082
|
} : 0);
|
|
12134
12083
|
});
|
|
12135
12084
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
|
|
12136
|
-
var
|
|
12137
|
-
idFrontCaptureStartedAt =
|
|
12138
|
-
setFirstGoodFrameTime =
|
|
12085
|
+
var _28 = useState(null),
|
|
12086
|
+
idFrontCaptureStartedAt = _28[0],
|
|
12087
|
+
setFirstGoodFrameTime = _28[1];
|
|
12139
12088
|
useEffect(function () {
|
|
12140
12089
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
12141
12090
|
}, [goodFramesCount]);
|
|
@@ -12156,9 +12105,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12156
12105
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
12157
12106
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
12158
12107
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
12159
|
-
var
|
|
12160
|
-
countdownStartedAt =
|
|
12161
|
-
setCountdownStartedAt =
|
|
12108
|
+
var _29 = useState(),
|
|
12109
|
+
countdownStartedAt = _29[0],
|
|
12110
|
+
setCountdownStartedAt = _29[1];
|
|
12162
12111
|
var photoCanvas = useRef(null);
|
|
12163
12112
|
var frameLock = useRef(false);
|
|
12164
12113
|
var captureFrame = useCallback(function () {
|
|
@@ -12281,9 +12230,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12281
12230
|
stopSelfieGuidance();
|
|
12282
12231
|
};
|
|
12283
12232
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
12284
|
-
var
|
|
12285
|
-
numFramesWithoutFaces =
|
|
12286
|
-
setNumFramesWithoutFaces =
|
|
12233
|
+
var _30 = useState(0),
|
|
12234
|
+
numFramesWithoutFaces = _30[0],
|
|
12235
|
+
setNumFramesWithoutFaces = _30[1];
|
|
12287
12236
|
onSelfiePredictionMade(useThrottledCallback(useCallback(function (_a) {
|
|
12288
12237
|
var face = _a.face;
|
|
12289
12238
|
if (selfieModelError) return;
|
|
@@ -12299,12 +12248,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12299
12248
|
}
|
|
12300
12249
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
12301
12250
|
var theme = useTheme();
|
|
12302
|
-
var
|
|
12251
|
+
var _31 = useTranslations(rawVerbiage, {
|
|
12303
12252
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
12304
12253
|
captureBtnText: 'Capture'
|
|
12305
12254
|
}),
|
|
12306
|
-
captureBtnText =
|
|
12307
|
-
faceNotCenteredText =
|
|
12255
|
+
captureBtnText = _31.captureBtnText,
|
|
12256
|
+
faceNotCenteredText = _31.faceNotCenteredText;
|
|
12308
12257
|
var debugScalingDetails = useDebugScalingDetails({
|
|
12309
12258
|
enabled: debugMode,
|
|
12310
12259
|
pageWidth: width,
|
|
@@ -12340,15 +12289,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12340
12289
|
faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
|
|
12341
12290
|
idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
|
|
12342
12291
|
}), debugMode && capturingId && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
12343
|
-
"$flipX": !
|
|
12292
|
+
"$flipX": !isRearFacing
|
|
12344
12293
|
}, detectedObjects.map(function (obj, i) {
|
|
12345
|
-
var _a;
|
|
12346
12294
|
return /*#__PURE__*/React__default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
12347
12295
|
key: i,
|
|
12348
12296
|
obj: obj,
|
|
12349
12297
|
scaling: debugScalingDetails,
|
|
12350
12298
|
color: "blue",
|
|
12351
|
-
flipX: !
|
|
12299
|
+
flipX: !isRearFacing
|
|
12352
12300
|
});
|
|
12353
12301
|
})), /*#__PURE__*/React__default.createElement(DebugBoundingBoxOverlay, null, face && ( /*#__PURE__*/React__default.createElement(SelfieCaptureFaceDebugBox, {
|
|
12354
12302
|
face: face,
|
|
@@ -12357,9 +12305,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
|
|
|
12357
12305
|
className: classNames.guidanceMessageContainer
|
|
12358
12306
|
}, /*#__PURE__*/React__default.createElement(GuidanceMessage, {
|
|
12359
12307
|
className: classNames.guidanceMessage,
|
|
12360
|
-
"$background": (
|
|
12361
|
-
"$textColor": (
|
|
12362
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null,
|
|
12308
|
+
"$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',
|
|
12309
|
+
"$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'
|
|
12310
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default.createElement("br", null), "Document Type: ", currentDetectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__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__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__default.createElement(CountdownContainer, {
|
|
12363
12311
|
className: classNames.countdownContainer
|
|
12364
12312
|
}, /*#__PURE__*/React__default.createElement(Countdown, {
|
|
12365
12313
|
className: classNames.countdown
|
|
@@ -12622,7 +12570,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12622
12570
|
});
|
|
12623
12571
|
setCaptureState('CAPTURING_ID');
|
|
12624
12572
|
}, []);
|
|
12625
|
-
var isCapturingId = ['LOADING', 'CAPTURING_ID'].includes(captureState);
|
|
12573
|
+
var isCapturingId = !skipIdCapture && ['LOADING', 'CAPTURING_ID'].includes(captureState);
|
|
12626
12574
|
useEffect(function () {
|
|
12627
12575
|
if (submissionStatus === SubmissionStatus.SUBMITTING) releaseCameraAccess();
|
|
12628
12576
|
}, [submissionStatus]);
|
|
@@ -12656,16 +12604,14 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
12656
12604
|
className: "flex"
|
|
12657
12605
|
}, /*#__PURE__*/React__default.createElement(Spinner, null));
|
|
12658
12606
|
}
|
|
12659
|
-
return /*#__PURE__*/React__default.createElement(
|
|
12660
|
-
|
|
12661
|
-
preferContinuityCamera: isCapturingId,
|
|
12607
|
+
return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
12608
|
+
preferIphoneContinuityCamera: isCapturingId,
|
|
12662
12609
|
preferFrontFacingCamera: !isCapturingId,
|
|
12663
12610
|
requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
|
|
12664
12611
|
maxVideoWidth: isCapturingId ? 1920 : 1280,
|
|
12665
12612
|
maxFps: isCapturingId ? 60 : 30,
|
|
12666
12613
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12667
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12668
|
-
debugMode: debugMode
|
|
12614
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12669
12615
|
}, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
|
|
12670
12616
|
autoStart: false,
|
|
12671
12617
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
@@ -12791,17 +12737,15 @@ function CompositeWizard(_a) {
|
|
|
12791
12737
|
_o = _a.captureSignatureVideo,
|
|
12792
12738
|
captureSignatureVideo = _o === void 0 ? false : _o,
|
|
12793
12739
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
12794
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
|
|
12802
|
-
|
|
12803
|
-
checkIndex = _r[0],
|
|
12804
|
-
setCheckIndex = _r[1];
|
|
12740
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied;
|
|
12741
|
+
var _p = useContext(SubmissionContext),
|
|
12742
|
+
submit = _p.submit,
|
|
12743
|
+
submissionStatus = _p.submissionStatus,
|
|
12744
|
+
setSignatureData = _p.setSignatureData,
|
|
12745
|
+
setAdditionalDocuments = _p.setAdditionalDocuments;
|
|
12746
|
+
var _q = useState(0),
|
|
12747
|
+
checkIndex = _q[0],
|
|
12748
|
+
setCheckIndex = _q[1];
|
|
12805
12749
|
var checks = useMemo(function () {
|
|
12806
12750
|
var _a, _b;
|
|
12807
12751
|
var checks = __spreadArray([], userChecks, true);
|
|
@@ -12879,16 +12823,6 @@ function CompositeWizard(_a) {
|
|
|
12879
12823
|
return i + 1;
|
|
12880
12824
|
});
|
|
12881
12825
|
}, [onVideoSignatureCompleteProp]);
|
|
12882
|
-
var _s = useState(0),
|
|
12883
|
-
videoSignatureAttempts = _s[0],
|
|
12884
|
-
setVideoSignatureAttempts = _s[1];
|
|
12885
|
-
var onVideoSignatureRetryProp = videoSignatureCaptureProps.onRetryClicked;
|
|
12886
|
-
var onVideoSignatureRetry = useCallback(function () {
|
|
12887
|
-
onVideoSignatureRetryProp === null || onVideoSignatureRetryProp === void 0 ? void 0 : onVideoSignatureRetryProp();
|
|
12888
|
-
setVideoSignatureAttempts(function (n) {
|
|
12889
|
-
return n + 1;
|
|
12890
|
-
});
|
|
12891
|
-
}, [onVideoSignatureRetryProp]);
|
|
12892
12826
|
var onAdditionalDocumentCaptureCompleteProp = additionalDocumentCaptureProps === null || additionalDocumentCaptureProps === void 0 ? void 0 : additionalDocumentCaptureProps.onComplete;
|
|
12893
12827
|
var onAdditionalDocumentCaptureComplete = useCallback(function (uploadedDocuments) {
|
|
12894
12828
|
setAdditionalDocuments(uploadedDocuments);
|
|
@@ -12917,11 +12851,9 @@ function CompositeWizard(_a) {
|
|
|
12917
12851
|
}
|
|
12918
12852
|
switch (checks[checkIndex]) {
|
|
12919
12853
|
case 'IdCapture':
|
|
12920
|
-
return /*#__PURE__*/React__default.createElement(
|
|
12921
|
-
key: "IdCaptureCamera",
|
|
12854
|
+
return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
12922
12855
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12923
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12924
|
-
debugMode: debugMode
|
|
12856
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12925
12857
|
}, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
|
|
12926
12858
|
autoStart: false,
|
|
12927
12859
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
@@ -12938,13 +12870,11 @@ function CompositeWizard(_a) {
|
|
|
12938
12870
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12939
12871
|
}));
|
|
12940
12872
|
case 'FaceLiveness':
|
|
12941
|
-
return /*#__PURE__*/React__default.createElement(
|
|
12942
|
-
key: "FaceLivenessCamera",
|
|
12873
|
+
return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
12943
12874
|
preferFrontFacingCamera: true,
|
|
12944
|
-
|
|
12875
|
+
preferIphoneContinuityCamera: false,
|
|
12945
12876
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12946
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12947
|
-
debugMode: debugMode
|
|
12877
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12948
12878
|
}, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
|
|
12949
12879
|
autoStart: false,
|
|
12950
12880
|
onModelError: faceLivenessProps.onModelError,
|
|
@@ -12957,15 +12887,13 @@ function CompositeWizard(_a) {
|
|
|
12957
12887
|
onAccept: onSignatureCaptureSuccess
|
|
12958
12888
|
}));
|
|
12959
12889
|
case 'VideoSignatureCapture':
|
|
12960
|
-
return /*#__PURE__*/React__default.createElement(
|
|
12961
|
-
|
|
12962
|
-
preferContinuityCamera: false,
|
|
12890
|
+
return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
12891
|
+
preferIphoneContinuityCamera: false,
|
|
12963
12892
|
preferFrontFacingCamera: true,
|
|
12964
12893
|
maxVideoWidth: 1280,
|
|
12965
12894
|
maxFps: 30,
|
|
12966
12895
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
12967
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12968
|
-
debugMode: debugMode
|
|
12896
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
12969
12897
|
}, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
|
|
12970
12898
|
autoStart: false,
|
|
12971
12899
|
throttleMs: 250,
|
|
@@ -12973,8 +12901,7 @@ function CompositeWizard(_a) {
|
|
|
12973
12901
|
modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
|
|
12974
12902
|
requireVerticalFaceCentering: false
|
|
12975
12903
|
}, /*#__PURE__*/React__default.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
|
|
12976
|
-
onComplete: onVideoSignatureComplete
|
|
12977
|
-
onRetryClicked: onVideoSignatureRetry
|
|
12904
|
+
onComplete: onVideoSignatureComplete
|
|
12978
12905
|
}))));
|
|
12979
12906
|
case 'AdditionalDocumentCapture':
|
|
12980
12907
|
return /*#__PURE__*/React__default.createElement(AdditionalDocumentCaptureWizard, _assign({}, additionalDocumentCaptureProps, {
|
|
@@ -13425,8 +13352,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
13425
13352
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
13426
13353
|
captureSignature: captureSignature,
|
|
13427
13354
|
captureSignatureVideo: captureSignatureVideo,
|
|
13428
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13429
|
-
debugMode: debugMode
|
|
13355
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13430
13356
|
}))));
|
|
13431
13357
|
};
|
|
13432
13358
|
|
|
@@ -13532,8 +13458,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
13532
13458
|
return ['FaceLiveness'];
|
|
13533
13459
|
}, []),
|
|
13534
13460
|
faceLivenessProps: faceLivenessProps,
|
|
13535
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13536
|
-
debugMode: debugMode
|
|
13461
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13537
13462
|
}))));
|
|
13538
13463
|
};
|
|
13539
13464
|
|
|
@@ -13766,8 +13691,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
13766
13691
|
additionalDocumentCaptureProps: additionalDocumentCaptureProps,
|
|
13767
13692
|
captureSignature: captureSignature,
|
|
13768
13693
|
captureSignatureVideo: captureSignatureVideo,
|
|
13769
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
13770
|
-
debugMode: debugMode
|
|
13694
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
13771
13695
|
}))));
|
|
13772
13696
|
};
|
|
13773
13697
|
|
|
@@ -14022,8 +13946,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
14022
13946
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
14023
13947
|
captureSignature: captureSignature,
|
|
14024
13948
|
captureSignatureVideo: captureSignatureVideo,
|
|
14025
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
14026
|
-
debugMode: debugMode
|
|
13949
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
14027
13950
|
}))));
|
|
14028
13951
|
};
|
|
14029
13952
|
|
|
@@ -14355,7 +14278,7 @@ var CustomerVerificationWizard = function CustomerVerificationWizard(_a) {
|
|
|
14355
14278
|
var _l = useState('LOADING'),
|
|
14356
14279
|
captureState = _l[0],
|
|
14357
14280
|
setCaptureState = _l[1];
|
|
14358
|
-
var _m =
|
|
14281
|
+
var _m = useCameraStore(),
|
|
14359
14282
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
14360
14283
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
14361
14284
|
var _o = useContext(SelfieGuidanceModelsContext),
|
|
@@ -14561,10 +14484,9 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
14561
14484
|
onSubmit: onSubmit,
|
|
14562
14485
|
geolocationEnabled: geolocationEnabled,
|
|
14563
14486
|
geolocationRequired: geolocationRequired
|
|
14564
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
14487
|
+
}, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
14565
14488
|
preferFrontFacingCamera: true,
|
|
14566
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
14567
|
-
debugMode: debugMode
|
|
14489
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
14568
14490
|
}, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
|
|
14569
14491
|
autoStart: false,
|
|
14570
14492
|
onModelError: onModelError,
|
|
@@ -14913,7 +14835,7 @@ var CustomerIdentificationWizard = function CustomerIdentificationWizard(_a) {
|
|
|
14913
14835
|
var _l = useState('LOADING'),
|
|
14914
14836
|
captureState = _l[0],
|
|
14915
14837
|
setCaptureState = _l[1];
|
|
14916
|
-
var _m =
|
|
14838
|
+
var _m = useCameraStore(),
|
|
14917
14839
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
14918
14840
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
14919
14841
|
var _o = useContext(SelfieGuidanceModelsContext),
|
|
@@ -15117,10 +15039,9 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
15117
15039
|
onSubmit: onSubmit,
|
|
15118
15040
|
geolocationEnabled: geolocationEnabled,
|
|
15119
15041
|
geolocationRequired: geolocationRequired
|
|
15120
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
15042
|
+
}, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
15121
15043
|
preferFrontFacingCamera: true,
|
|
15122
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15123
|
-
debugMode: debugMode
|
|
15044
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15124
15045
|
}, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
|
|
15125
15046
|
autoStart: false,
|
|
15126
15047
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -15447,8 +15368,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
15447
15368
|
captureSignature: captureSignature,
|
|
15448
15369
|
captureSignatureVideo: captureSignatureVideo,
|
|
15449
15370
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15450
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15451
|
-
debugMode: debugMode
|
|
15371
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15452
15372
|
}))));
|
|
15453
15373
|
};
|
|
15454
15374
|
|
|
@@ -15605,8 +15525,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
15605
15525
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
15606
15526
|
captureSignature: captureSignature,
|
|
15607
15527
|
captureSignatureVideo: captureSignatureVideo,
|
|
15608
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15609
|
-
debugMode: debugMode
|
|
15528
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15610
15529
|
}))));
|
|
15611
15530
|
};
|
|
15612
15531
|
|
|
@@ -15664,11 +15583,10 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
15664
15583
|
onDocumentUploadFailed: onDocumentUploadFailed,
|
|
15665
15584
|
geolocationEnabled: geolocationEnabled,
|
|
15666
15585
|
geolocationRequired: geolocationRequired
|
|
15667
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
15586
|
+
}, /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
|
|
15668
15587
|
requestAccessAutomatically: false,
|
|
15669
|
-
|
|
15670
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
15671
|
-
debugMode: debugMode
|
|
15588
|
+
preferIphoneContinuityCamera: true,
|
|
15589
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
15672
15590
|
}, /*#__PURE__*/React__default.createElement(DocumentCaptureWizard, {
|
|
15673
15591
|
onSuccess: onComplete,
|
|
15674
15592
|
onExitCapture: onExitCapture,
|