idmission-web-sdk 2.2.47 → 2.2.48
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 +1132 -1073
- 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 +1132 -1073
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +1150 -1091
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/camera/CameraProvider.d.ts +0 -17
- package/dist/components/camera/CameraProvider.d.ts.map +0 -1
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.2.
|
|
214
|
+
var webSdkVersion = '2.2.48';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1088,11 +1088,11 @@
|
|
|
1088
1088
|
if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
|
|
1089
1089
|
exports.defaultAuthUrl = url;
|
|
1090
1090
|
}
|
|
1091
|
-
var initialState$
|
|
1091
|
+
var initialState$6 = {
|
|
1092
1092
|
authUrl: exports.defaultAuthUrl,
|
|
1093
1093
|
sessionCheckState: 'READY'
|
|
1094
1094
|
};
|
|
1095
|
-
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$
|
|
1095
|
+
var AuthStateContext = /*#__PURE__*/React.createContext(initialState$6);
|
|
1096
1096
|
var AuthDispatchContext = /*#__PURE__*/React.createContext(function () {});
|
|
1097
1097
|
var reducer$4 = function reducer(state, action) {
|
|
1098
1098
|
switch (action.type) {
|
|
@@ -1124,7 +1124,7 @@
|
|
|
1124
1124
|
if (authUrl === void 0) {
|
|
1125
1125
|
authUrl = exports.defaultAuthUrl;
|
|
1126
1126
|
}
|
|
1127
|
-
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$
|
|
1127
|
+
var _a = React.useReducer(reducer$4, _assign(_assign({}, initialState$6), {
|
|
1128
1128
|
authUrl: authUrl
|
|
1129
1129
|
})),
|
|
1130
1130
|
state = _a[0],
|
|
@@ -3022,623 +3022,21 @@
|
|
|
3022
3022
|
}
|
|
3023
3023
|
resizeObserverRef.current.instance.observe(element, {
|
|
3024
3024
|
box: opts.box
|
|
3025
|
-
});
|
|
3026
|
-
return function () {
|
|
3027
|
-
if (resizeObserverRef.current) {
|
|
3028
|
-
resizeObserverRef.current.instance.unobserve(element);
|
|
3029
|
-
}
|
|
3030
|
-
};
|
|
3031
|
-
}, [opts.box, round]), opts.ref);
|
|
3032
|
-
return React.useMemo(function () {
|
|
3033
|
-
return {
|
|
3034
|
-
ref: refCallback,
|
|
3035
|
-
width: size.width,
|
|
3036
|
-
height: size.height
|
|
3037
|
-
};
|
|
3038
|
-
}, [refCallback, size.width, size.height]);
|
|
3039
|
-
}
|
|
3040
|
-
|
|
3041
|
-
function getFrameDimensions(frame) {
|
|
3042
|
-
var frameWidth = frame.width,
|
|
3043
|
-
frameHeight = frame.height;
|
|
3044
|
-
if (frame instanceof HTMLImageElement) {
|
|
3045
|
-
frameWidth = frame.naturalWidth;
|
|
3046
|
-
frameHeight = frame.naturalHeight;
|
|
3047
|
-
}
|
|
3048
|
-
if (frame instanceof HTMLVideoElement) {
|
|
3049
|
-
frameWidth = frame.videoWidth;
|
|
3050
|
-
frameHeight = frame.videoHeight;
|
|
3051
|
-
}
|
|
3052
|
-
return [frameWidth, frameHeight];
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
var InvisibleCanvas = styled.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
3056
|
-
function drawToCanvas(canvas, frame, width, height) {
|
|
3057
|
-
if (!canvas) return;
|
|
3058
|
-
var ctx = canvas.getContext('2d');
|
|
3059
|
-
if (!ctx) return;
|
|
3060
|
-
if (!width || !height) {
|
|
3061
|
-
var _a = getFrameDimensions(frame),
|
|
3062
|
-
frameWidth = _a[0],
|
|
3063
|
-
frameHeight = _a[1];
|
|
3064
|
-
width || (width = frameWidth);
|
|
3065
|
-
height || (height = frameHeight);
|
|
3066
|
-
}
|
|
3067
|
-
canvas.width = width;
|
|
3068
|
-
canvas.height = height;
|
|
3069
|
-
ctx.drawImage(frame, 0, 0, width, height);
|
|
3070
|
-
}
|
|
3071
|
-
function clearCanvas(canvas) {
|
|
3072
|
-
var _a;
|
|
3073
|
-
(_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);
|
|
3074
|
-
}
|
|
3075
|
-
var templateObject_1$G;
|
|
3076
|
-
|
|
3077
|
-
function listAvailableCameras(facingMode_1) {
|
|
3078
|
-
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
3079
|
-
var cameraEnumerationStream, videoDevices;
|
|
3080
|
-
if (requestMicAccess === void 0) {
|
|
3081
|
-
requestMicAccess = false;
|
|
3082
|
-
}
|
|
3083
|
-
return __generator(this, function (_a) {
|
|
3084
|
-
switch (_a.label) {
|
|
3085
|
-
case 0:
|
|
3086
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3087
|
-
video: {
|
|
3088
|
-
facingMode: {
|
|
3089
|
-
exact: facingMode
|
|
3090
|
-
}
|
|
3091
|
-
},
|
|
3092
|
-
audio: requestMicAccess
|
|
3093
|
-
})
|
|
3094
|
-
// This lists all available cameras attached to the user's device.
|
|
3095
|
-
];
|
|
3096
|
-
case 1:
|
|
3097
|
-
cameraEnumerationStream = _a.sent();
|
|
3098
|
-
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
3099
|
-
case 2:
|
|
3100
|
-
videoDevices = _a.sent().filter(function (_a) {
|
|
3101
|
-
var kind = _a.kind;
|
|
3102
|
-
return kind === 'videoinput';
|
|
3103
|
-
});
|
|
3104
|
-
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
3105
|
-
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
3106
|
-
track.enabled = false;
|
|
3107
|
-
track.stop();
|
|
3108
|
-
});
|
|
3109
|
-
cameraEnumerationStream = null;
|
|
3110
|
-
return [2 /*return*/, videoDevices];
|
|
3111
|
-
}
|
|
3112
|
-
});
|
|
3113
|
-
});
|
|
3114
|
-
}
|
|
3115
|
-
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) {
|
|
3116
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
3117
|
-
});
|
|
3118
|
-
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) {
|
|
3119
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
3120
|
-
});
|
|
3121
|
-
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) {
|
|
3122
|
-
return s.toLocaleLowerCase().split(' ').join('');
|
|
3123
|
-
});
|
|
3124
|
-
var labelMatches = function labelMatches(labelOrDevice, labelSetOrLabel) {
|
|
3125
|
-
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
3126
|
-
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
3127
|
-
return labelSet.some(function (l) {
|
|
3128
|
-
return label.includes(l);
|
|
3129
|
-
});
|
|
3130
|
-
};
|
|
3131
|
-
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
3132
|
-
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
3133
|
-
};
|
|
3134
|
-
var currentCamera;
|
|
3135
|
-
var currentAudioStream;
|
|
3136
|
-
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
3137
|
-
releaseCameraAccess();
|
|
3138
|
-
log('obtaining camera access...');
|
|
3139
|
-
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
3140
|
-
width = _a.width,
|
|
3141
|
-
height = _a.height;
|
|
3142
|
-
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
3143
|
-
var isRearFacing = labelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearLabels, true), backUltraWideLabels, true), ['iphone'], false));
|
|
3144
|
-
var release = function release() {
|
|
3145
|
-
stream.getTracks().forEach(function (track) {
|
|
3146
|
-
track.enabled = false;
|
|
3147
|
-
track.stop();
|
|
3148
|
-
});
|
|
3149
|
-
if (video) {
|
|
3150
|
-
video.pause();
|
|
3151
|
-
video.srcObject = null;
|
|
3152
|
-
video.src = '';
|
|
3153
|
-
}
|
|
3154
|
-
};
|
|
3155
|
-
width || (width = 0);
|
|
3156
|
-
height || (height = 0);
|
|
3157
|
-
currentCamera = {
|
|
3158
|
-
label: deviceLabel,
|
|
3159
|
-
stream: stream,
|
|
3160
|
-
width: width,
|
|
3161
|
-
height: height,
|
|
3162
|
-
isRearFacing: isRearFacing,
|
|
3163
|
-
release: release
|
|
3164
|
-
};
|
|
3165
|
-
if (video) video.srcObject = stream;
|
|
3166
|
-
return currentCamera;
|
|
3167
|
-
}
|
|
3168
|
-
function releaseCameraAccess() {
|
|
3169
|
-
if (!currentCamera) return;
|
|
3170
|
-
log('releasing camera access...');
|
|
3171
|
-
currentCamera.release();
|
|
3172
|
-
currentCamera = undefined;
|
|
3173
|
-
}
|
|
3174
|
-
function releaseMicrophoneAccess() {
|
|
3175
|
-
var _a;
|
|
3176
|
-
if (!currentAudioStream) return;
|
|
3177
|
-
log('releasing microphone access...');
|
|
3178
|
-
(_a = currentAudioStream.stop) === null || _a === void 0 ? void 0 : _a.call(currentAudioStream);
|
|
3179
|
-
currentAudioStream.getAudioTracks().forEach(function (t) {
|
|
3180
|
-
var _a;
|
|
3181
|
-
(_a = t.stop) === null || _a === void 0 ? void 0 : _a.call(t);
|
|
3182
|
-
});
|
|
3183
|
-
currentAudioStream = undefined;
|
|
3184
|
-
}
|
|
3185
|
-
function usePreferredCaptureDevice(_a) {
|
|
3186
|
-
var _b = _a === void 0 ? {} : _a,
|
|
3187
|
-
_c = _b.requestAccessAutomatically,
|
|
3188
|
-
requestAccessAutomatically = _c === void 0 ? true : _c,
|
|
3189
|
-
_d = _b.preferFrontFacingCamera,
|
|
3190
|
-
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
3191
|
-
_e = _b.preferContinuityCamera,
|
|
3192
|
-
preferContinuityCamera = _e === void 0 ? true : _e,
|
|
3193
|
-
_f = _b.requireMicrophoneAccess,
|
|
3194
|
-
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
3195
|
-
_g = _b.maxVideoWidth,
|
|
3196
|
-
maxVideoWidth = _g === void 0 ? 1920 : _g,
|
|
3197
|
-
maxFps = _b.maxFps,
|
|
3198
|
-
_h = _b.debugMode,
|
|
3199
|
-
debugMode = _h === void 0 ? false : _h;
|
|
3200
|
-
var videoRef = React.useRef(null);
|
|
3201
|
-
var videoRefStack = React.useRef([]);
|
|
3202
|
-
var cameraRef = React.useRef(null);
|
|
3203
|
-
var _j = React.useState(false),
|
|
3204
|
-
cameraReady = _j[0],
|
|
3205
|
-
setCameraReady = _j[1];
|
|
3206
|
-
var _k = React.useState(false),
|
|
3207
|
-
microphoneReady = _k[0],
|
|
3208
|
-
setMicrophoneReady = _k[1];
|
|
3209
|
-
var _l = React.useState(null),
|
|
3210
|
-
videoDevice = _l[0],
|
|
3211
|
-
setVideoDevice = _l[1];
|
|
3212
|
-
var _m = React.useState(null),
|
|
3213
|
-
audioStream = _m[0],
|
|
3214
|
-
setAudioStream = _m[1];
|
|
3215
|
-
var _o = React.useState(false),
|
|
3216
|
-
videoLoaded = _o[0],
|
|
3217
|
-
setVideoLoaded = _o[1];
|
|
3218
|
-
var _p = React.useState(false),
|
|
3219
|
-
iphoneContinuityCameraAvailable = _p[0],
|
|
3220
|
-
setIphoneContinuityCameraAvailable = _p[1];
|
|
3221
|
-
var _q = React.useState(preferContinuityCamera),
|
|
3222
|
-
iphoneContinuityCameraAllowed = _q[0],
|
|
3223
|
-
setIphoneContinuityCameraAllowed = _q[1];
|
|
3224
|
-
var _r = React.useState(false),
|
|
3225
|
-
iphoneContinuityCameraDenied = _r[0],
|
|
3226
|
-
setIphoneContinuityCameraDenied = _r[1];
|
|
3227
|
-
var _s = React.useState(false),
|
|
3228
|
-
cameraAccessDenied = _s[0],
|
|
3229
|
-
setCameraAccessDenied = _s[1];
|
|
3230
|
-
var _t = React.useState(false),
|
|
3231
|
-
microphoneAccessDenied = _t[0],
|
|
3232
|
-
setMicrophoneAccessDenied = _t[1];
|
|
3233
|
-
var videoRefElement = videoRef.current;
|
|
3234
|
-
React.useEffect(function pushVideoRefToStackWhenChanged() {
|
|
3235
|
-
// proceed if the video element being mounted is not already at the top of the videoRefStack.
|
|
3236
|
-
var topOfStack = videoRefStack.current.slice(-1)[0];
|
|
3237
|
-
if (videoRefElement && videoRefElement !== topOfStack) {
|
|
3238
|
-
log('adding video to stack', videoRefElement);
|
|
3239
|
-
videoRefStack.current.push(videoRefElement);
|
|
3240
|
-
}
|
|
3241
|
-
}, [videoRefElement]);
|
|
3242
|
-
var onVideoUnmounted = React.useCallback(function (videoElement) {
|
|
3243
|
-
log('removing video from stack', videoElement);
|
|
3244
|
-
videoRefStack.current = videoRefStack.current.filter(function (v) {
|
|
3245
|
-
return v !== videoElement;
|
|
3246
|
-
});
|
|
3247
|
-
videoRef.current = videoRefStack.current.slice(-1)[0]; // top of stack.
|
|
3248
|
-
log('new videoRef is', videoRef.current);
|
|
3249
|
-
}, []);
|
|
3250
|
-
React.useEffect(function resetCameraOnContinuityPreferenceChanged() {
|
|
3251
|
-
if (debugMode) {
|
|
3252
|
-
log('iphone continuity camera allowed changed', iphoneContinuityCameraAllowed);
|
|
3253
|
-
}
|
|
3254
|
-
releaseCameraAccess();
|
|
3255
|
-
cameraRef.current = null;
|
|
3256
|
-
setVideoLoaded(false);
|
|
3257
|
-
}, [debugMode, iphoneContinuityCameraAllowed]);
|
|
3258
|
-
// NOTE: the bound callback function here is called requestCameraAccess, because
|
|
3259
|
-
// it initiates the useEffect chain that results in camera access being requested
|
|
3260
|
-
// (requestCameraAccessAutomatically -> chooseFromAvailableCameras -> accessChosenCamera).
|
|
3261
|
-
//
|
|
3262
|
-
// We chose to title the inner function "chooseFromAvailableCameras" because
|
|
3263
|
-
// that's all it literally does -- the available cameras are enumerated, and then
|
|
3264
|
-
// the result is parsed to decide which one we like best, which is then passed to
|
|
3265
|
-
// setVideoDevice, which causes accessChosenCamera to trigger.
|
|
3266
|
-
//
|
|
3267
|
-
// I am not a huge fan of getUserMedia's design -- you need to call it twice in order
|
|
3268
|
-
// to select the "best" camera for your application's purposes.
|
|
3269
|
-
var requestCameraAccess = React.useCallback(function chooseFromAvailableCameras() {
|
|
3270
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3271
|
-
var availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, e_1;
|
|
3272
|
-
var _a, _b;
|
|
3273
|
-
return __generator(this, function (_c) {
|
|
3274
|
-
switch (_c.label) {
|
|
3275
|
-
case 0:
|
|
3276
|
-
setCameraReady(false);
|
|
3277
|
-
setCameraAccessDenied(false);
|
|
3278
|
-
_c.label = 1;
|
|
3279
|
-
case 1:
|
|
3280
|
-
_c.trys.push([1, 3,, 4]);
|
|
3281
|
-
return [4 /*yield*/, listAvailableCameras()];
|
|
3282
|
-
case 2:
|
|
3283
|
-
availableCameras = _c.sent();
|
|
3284
|
-
selectedCamera = void 0;
|
|
3285
|
-
if (debugMode) {
|
|
3286
|
-
log('availableCameras', availableCameras);
|
|
3287
|
-
}
|
|
3288
|
-
platform_1 = getPlatform();
|
|
3289
|
-
if (debugMode) {
|
|
3290
|
-
log('platformDetails', platform_1);
|
|
3291
|
-
}
|
|
3292
|
-
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
3293
|
-
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
3294
|
-
return labelMatches(deviceInfo, 'iphone');
|
|
3295
|
-
});
|
|
3296
|
-
setIphoneContinuityCameraAvailable(!!iphoneContinuityCamera);
|
|
3297
|
-
if (iphoneContinuityCamera && iphoneContinuityCameraAllowed) {
|
|
3298
|
-
selectedCamera = iphoneContinuityCamera;
|
|
3299
|
-
}
|
|
3300
|
-
} 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) {
|
|
3301
|
-
return c.label.startsWith('camera2 ');
|
|
3302
|
-
})) {
|
|
3303
|
-
availableCameras = availableCameras.sort(function (a, b) {
|
|
3304
|
-
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
3305
|
-
});
|
|
3306
|
-
if (debugMode) {
|
|
3307
|
-
log('cameras have been sorted', availableCameras);
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
if (preferFrontFacingCamera) {
|
|
3311
|
-
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3312
|
-
return labelMatches(deviceInfo, frontLabels);
|
|
3313
|
-
});
|
|
3314
|
-
}
|
|
3315
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3316
|
-
return labelMatches(deviceInfo, 'backtriplecamera');
|
|
3317
|
-
}));
|
|
3318
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3319
|
-
return labelMatches(deviceInfo, 'backdualcamera');
|
|
3320
|
-
}));
|
|
3321
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3322
|
-
return labelMatches(deviceInfo, rearLabels) && !labelMatches(deviceInfo, backUltraWideLabels);
|
|
3323
|
-
}));
|
|
3324
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3325
|
-
return labelMatches(deviceInfo, rearLabels);
|
|
3326
|
-
}));
|
|
3327
|
-
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
3328
|
-
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) {
|
|
3329
|
-
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
3330
|
-
}
|
|
3331
|
-
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
3332
|
-
if (debugMode) log('selectedCamera', selectedCamera);
|
|
3333
|
-
setVideoDevice(selectedCamera);
|
|
3334
|
-
return [3 /*break*/, 4];
|
|
3335
|
-
case 3:
|
|
3336
|
-
e_1 = _c.sent();
|
|
3337
|
-
if (e_1.name === 'NotAllowedError') {
|
|
3338
|
-
error('camera access has been blocked by the user', e_1);
|
|
3339
|
-
setCameraAccessDenied(true);
|
|
3340
|
-
} else {
|
|
3341
|
-
error('camera access encountered some other error', e_1);
|
|
3342
|
-
throw e_1;
|
|
3343
|
-
}
|
|
3344
|
-
return [3 /*break*/, 4];
|
|
3345
|
-
case 4:
|
|
3346
|
-
return [2 /*return*/];
|
|
3347
|
-
}
|
|
3348
|
-
});
|
|
3349
|
-
});
|
|
3350
|
-
}, [debugMode, iphoneContinuityCameraAllowed, iphoneContinuityCameraDenied, preferFrontFacingCamera]);
|
|
3351
|
-
React.useEffect(function requestCameraAccessAutomatically() {
|
|
3352
|
-
if (requestAccessAutomatically && !cameraAccessDenied) {
|
|
3353
|
-
requestCameraAccess()["catch"](error);
|
|
3354
|
-
}
|
|
3355
|
-
}, [cameraAccessDenied, requestAccessAutomatically, requestCameraAccess]);
|
|
3356
|
-
React.useEffect(function accessChosenCamera() {
|
|
3357
|
-
var _this = this;
|
|
3358
|
-
var _a;
|
|
3359
|
-
if (!videoDevice) return;
|
|
3360
|
-
var cleanup = function cleanup() {
|
|
3361
|
-
releaseCameraAccess();
|
|
3362
|
-
cameraRef.current = null;
|
|
3363
|
-
setVideoLoaded(false);
|
|
3364
|
-
};
|
|
3365
|
-
if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) return cleanup;
|
|
3366
|
-
(function () {
|
|
3367
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
3368
|
-
var constraints, stream, e_2, handleStreamEnded;
|
|
3369
|
-
var _a;
|
|
3370
|
-
return __generator(this, function (_b) {
|
|
3371
|
-
switch (_b.label) {
|
|
3372
|
-
case 0:
|
|
3373
|
-
constraints = {
|
|
3374
|
-
audio: false,
|
|
3375
|
-
video: {
|
|
3376
|
-
deviceId: {
|
|
3377
|
-
exact: videoDevice.deviceId
|
|
3378
|
-
},
|
|
3379
|
-
width: {
|
|
3380
|
-
ideal: maxVideoWidth
|
|
3381
|
-
},
|
|
3382
|
-
aspectRatio: 1.777777778,
|
|
3383
|
-
frameRate: {}
|
|
3384
|
-
}
|
|
3385
|
-
};
|
|
3386
|
-
if (maxFps) {
|
|
3387
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3388
|
-
// @ts-ignore
|
|
3389
|
-
constraints.video.frameRate = {
|
|
3390
|
-
max: maxFps
|
|
3391
|
-
};
|
|
3392
|
-
}
|
|
3393
|
-
stream = null;
|
|
3394
|
-
_b.label = 1;
|
|
3395
|
-
case 1:
|
|
3396
|
-
_b.trys.push([1, 3,, 4]);
|
|
3397
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
3398
|
-
case 2:
|
|
3399
|
-
stream = _b.sent();
|
|
3400
|
-
return [3 /*break*/, 4];
|
|
3401
|
-
case 3:
|
|
3402
|
-
e_2 = _b.sent();
|
|
3403
|
-
if (e_2.name === 'NotAllowedError') {
|
|
3404
|
-
if (iphoneContinuityCameraAllowed) {
|
|
3405
|
-
setIphoneContinuityCameraAvailable(false);
|
|
3406
|
-
setIphoneContinuityCameraDenied(true);
|
|
3407
|
-
} else {
|
|
3408
|
-
setCameraAccessDenied(true);
|
|
3409
|
-
}
|
|
3410
|
-
return [2 /*return*/];
|
|
3411
|
-
}
|
|
3412
|
-
return [3 /*break*/, 4];
|
|
3413
|
-
case 4:
|
|
3414
|
-
if (!!stream) return [3 /*break*/, 8];
|
|
3415
|
-
_b.label = 5;
|
|
3416
|
-
case 5:
|
|
3417
|
-
_b.trys.push([5, 7,, 8]);
|
|
3418
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3419
|
-
audio: false,
|
|
3420
|
-
video: true
|
|
3421
|
-
})];
|
|
3422
|
-
case 6:
|
|
3423
|
-
stream = _b.sent();
|
|
3424
|
-
log('opened stream with no width and height constraints');
|
|
3425
|
-
return [3 /*break*/, 8];
|
|
3426
|
-
case 7:
|
|
3427
|
-
_b.sent();
|
|
3428
|
-
log('cannot open stream at all');
|
|
3429
|
-
return [3 /*break*/, 8];
|
|
3430
|
-
case 8:
|
|
3431
|
-
if (!stream) {
|
|
3432
|
-
throw new Error('failed to open camera');
|
|
3433
|
-
}
|
|
3434
|
-
handleStreamEnded = function handleStreamEnded() {
|
|
3435
|
-
if (iphoneContinuityCameraAvailable && iphoneContinuityCameraAllowed) {
|
|
3436
|
-
log('someone unplugged the continuity camera');
|
|
3437
|
-
releaseCameraAccess();
|
|
3438
|
-
cameraRef.current = null;
|
|
3439
|
-
setIphoneContinuityCameraAvailable(false);
|
|
3440
|
-
setIphoneContinuityCameraDenied(true);
|
|
3441
|
-
setVideoDevice(null);
|
|
3442
|
-
} else {
|
|
3443
|
-
log('someone unplugged the webcam');
|
|
3444
|
-
releaseCameraAccess();
|
|
3445
|
-
cameraRef.current = null;
|
|
3446
|
-
setVideoLoaded(false);
|
|
3447
|
-
setCameraAccessDenied(true);
|
|
3448
|
-
}
|
|
3449
|
-
};
|
|
3450
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('ended', handleStreamEnded);
|
|
3451
|
-
stream.getVideoTracks().forEach(function (track) {
|
|
3452
|
-
track.onended = handleStreamEnded;
|
|
3453
|
-
});
|
|
3454
|
-
cameraRef.current = obtainCameraAccess(stream, videoDevice.label, videoRef.current);
|
|
3455
|
-
return [2 /*return*/];
|
|
3456
|
-
}
|
|
3457
|
-
});
|
|
3458
|
-
});
|
|
3459
|
-
})();
|
|
3460
|
-
return cleanup;
|
|
3461
|
-
}, [iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, maxFps, maxVideoWidth, videoDevice]);
|
|
3462
|
-
React.useEffect(function triggerCameraReady() {
|
|
3463
|
-
// TODO: in the future let's evaluate whether we can simplify this to just
|
|
3464
|
-
// setCameraReady(!!videoDevice && videoLoaded) -- we are wondering whether
|
|
3465
|
-
// we somehow depend on this being set twice.
|
|
3466
|
-
setCameraReady(false);
|
|
3467
|
-
if (videoDevice && videoLoaded) {
|
|
3468
|
-
setCameraReady(videoDevice && videoLoaded);
|
|
3469
|
-
}
|
|
3470
|
-
}, [videoLoaded, videoDevice]);
|
|
3471
|
-
var requestMicrophoneAccess = React.useCallback(function _requestMicrophoneAccess() {
|
|
3472
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3473
|
-
var stream;
|
|
3474
|
-
return __generator(this, function (_a) {
|
|
3475
|
-
switch (_a.label) {
|
|
3476
|
-
case 0:
|
|
3477
|
-
setMicrophoneReady(false);
|
|
3478
|
-
setMicrophoneAccessDenied(false);
|
|
3479
|
-
_a.label = 1;
|
|
3480
|
-
case 1:
|
|
3481
|
-
_a.trys.push([1, 3,, 4]);
|
|
3482
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3483
|
-
audio: true,
|
|
3484
|
-
video: false
|
|
3485
|
-
})];
|
|
3486
|
-
case 2:
|
|
3487
|
-
stream = _a.sent();
|
|
3488
|
-
currentAudioStream = stream;
|
|
3489
|
-
setAudioStream(stream);
|
|
3490
|
-
setMicrophoneReady(true);
|
|
3491
|
-
stream.getAudioTracks().forEach(function (track) {
|
|
3492
|
-
track.onended = function () {
|
|
3493
|
-
setMicrophoneAccessDenied(true);
|
|
3494
|
-
};
|
|
3495
|
-
});
|
|
3496
|
-
return [3 /*break*/, 4];
|
|
3497
|
-
case 3:
|
|
3498
|
-
_a.sent();
|
|
3499
|
-
setMicrophoneAccessDenied(true);
|
|
3500
|
-
return [3 /*break*/, 4];
|
|
3501
|
-
case 4:
|
|
3502
|
-
return [2 /*return*/];
|
|
3503
|
-
}
|
|
3504
|
-
});
|
|
3505
|
-
});
|
|
3506
|
-
}, []);
|
|
3507
|
-
React.useEffect(function requestMicrophoneAccessIfNeeded() {
|
|
3508
|
-
if (!requireMicrophoneAccess || microphoneAccessDenied) return;
|
|
3509
|
-
requestMicrophoneAccess()["catch"](error);
|
|
3510
|
-
return function () {
|
|
3511
|
-
releaseMicrophoneAccess();
|
|
3512
|
-
setAudioStream(null);
|
|
3513
|
-
setMicrophoneReady(false);
|
|
3514
|
-
};
|
|
3515
|
-
}, [microphoneAccessDenied, requestMicrophoneAccess, requireMicrophoneAccess]);
|
|
3516
|
-
var takePhoto = React.useCallback(function _takePhoto() {
|
|
3517
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3518
|
-
var canvas;
|
|
3519
|
-
return __generator(this, function (_a) {
|
|
3520
|
-
switch (_a.label) {
|
|
3521
|
-
case 0:
|
|
3522
|
-
if (!cameraRef.current) return [2 /*return*/, null];
|
|
3523
|
-
if (!(typeof ImageCapture !== 'undefined')) return [3 /*break*/, 2];
|
|
3524
|
-
return [4 /*yield*/, new ImageCapture(cameraRef.current.stream.getTracks()[0]).takePhoto()];
|
|
3525
|
-
case 1:
|
|
3526
|
-
return [2 /*return*/, _a.sent()];
|
|
3527
|
-
case 2:
|
|
3528
|
-
if (!videoRef.current) return [2 /*return*/, null];
|
|
3529
|
-
canvas = document.createElement('canvas');
|
|
3530
|
-
drawToCanvas(canvas, videoRef.current);
|
|
3531
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
3532
|
-
return canvas.toBlob(resolve);
|
|
3533
|
-
})];
|
|
3534
|
-
}
|
|
3535
|
-
});
|
|
3536
|
-
});
|
|
3537
|
-
}, []);
|
|
3538
|
-
return React.useMemo(function () {
|
|
3539
|
-
return {
|
|
3540
|
-
videoRef: videoRef,
|
|
3541
|
-
videoDevice: videoDevice,
|
|
3542
|
-
videoLoaded: videoLoaded,
|
|
3543
|
-
setVideoLoaded: setVideoLoaded,
|
|
3544
|
-
onVideoUnmounted: onVideoUnmounted,
|
|
3545
|
-
cameraRef: cameraRef,
|
|
3546
|
-
cameraReady: cameraReady,
|
|
3547
|
-
cameraAccessDenied: cameraAccessDenied,
|
|
3548
|
-
requestCameraAccess: requestCameraAccess,
|
|
3549
|
-
releaseCameraAccess: releaseCameraAccess,
|
|
3550
|
-
iphoneContinuityCameraAvailable: iphoneContinuityCameraAvailable,
|
|
3551
|
-
iphoneContinuityCameraAllowed: iphoneContinuityCameraAllowed,
|
|
3552
|
-
setIphoneContinuityCameraAllowed: setIphoneContinuityCameraAllowed,
|
|
3553
|
-
takePhoto: takePhoto,
|
|
3554
|
-
audioStream: audioStream,
|
|
3555
|
-
microphoneReady: microphoneReady,
|
|
3556
|
-
microphoneAccessDenied: microphoneAccessDenied,
|
|
3557
|
-
requestMicrophoneAccess: requestMicrophoneAccess
|
|
3558
|
-
};
|
|
3559
|
-
}, [audioStream, cameraAccessDenied, cameraReady, iphoneContinuityCameraAllowed, iphoneContinuityCameraAvailable, microphoneAccessDenied, microphoneReady, onVideoUnmounted, requestCameraAccess, requestMicrophoneAccess, takePhoto, videoDevice, videoLoaded]);
|
|
3560
|
-
}
|
|
3561
|
-
|
|
3562
|
-
var CameraStateContext = /*#__PURE__*/React.createContext({
|
|
3563
|
-
videoRef: {
|
|
3564
|
-
current: null
|
|
3565
|
-
},
|
|
3566
|
-
videoDevice: null,
|
|
3567
|
-
videoLoaded: false,
|
|
3568
|
-
cameraRef: {
|
|
3569
|
-
current: null
|
|
3570
|
-
},
|
|
3571
|
-
cameraReady: false,
|
|
3572
|
-
cameraAccessDenied: false,
|
|
3573
|
-
requestCameraAccess: function requestCameraAccess() {
|
|
3574
|
-
return null;
|
|
3575
|
-
},
|
|
3576
|
-
releaseCameraAccess: function releaseCameraAccess() {
|
|
3577
|
-
return null;
|
|
3578
|
-
},
|
|
3579
|
-
iphoneContinuityCameraAvailable: false,
|
|
3580
|
-
iphoneContinuityCameraAllowed: true,
|
|
3581
|
-
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed() {
|
|
3582
|
-
return null;
|
|
3583
|
-
},
|
|
3584
|
-
takePhoto: function takePhoto() {
|
|
3585
|
-
return Promise.resolve(null);
|
|
3586
|
-
},
|
|
3587
|
-
setVideoLoaded: function setVideoLoaded() {
|
|
3588
|
-
return null;
|
|
3589
|
-
},
|
|
3590
|
-
onVideoUnmounted: function onVideoUnmounted() {
|
|
3591
|
-
return null;
|
|
3592
|
-
},
|
|
3593
|
-
audioStream: null,
|
|
3594
|
-
microphoneReady: false,
|
|
3595
|
-
microphoneAccessDenied: false,
|
|
3596
|
-
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
3597
|
-
return null;
|
|
3598
|
-
}
|
|
3599
|
-
});
|
|
3600
|
-
var CameraProvider = function CameraProvider(_a) {
|
|
3601
|
-
var children = _a.children,
|
|
3602
|
-
_b = _a.requestAccessAutomatically,
|
|
3603
|
-
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
3604
|
-
_c = _a.preferFrontFacingCamera,
|
|
3605
|
-
preferFrontFacingCamera = _c === void 0 ? false : _c,
|
|
3606
|
-
_d = _a.preferContinuityCamera,
|
|
3607
|
-
preferContinuityCamera = _d === void 0 ? true : _d,
|
|
3608
|
-
_e = _a.requireMicrophoneAccess,
|
|
3609
|
-
requireMicrophoneAccess = _e === void 0 ? false : _e,
|
|
3610
|
-
_f = _a.maxVideoWidth,
|
|
3611
|
-
maxVideoWidth = _f === void 0 ? 1920 : _f,
|
|
3612
|
-
maxFps = _a.maxFps,
|
|
3613
|
-
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
3614
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
3615
|
-
_g = _a.debugMode,
|
|
3616
|
-
debugMode = _g === void 0 ? false : _g;
|
|
3617
|
-
var captureDevice = usePreferredCaptureDevice({
|
|
3618
|
-
requestAccessAutomatically: requestAccessAutomatically,
|
|
3619
|
-
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
3620
|
-
preferContinuityCamera: preferContinuityCamera,
|
|
3621
|
-
requireMicrophoneAccess: requireMicrophoneAccess,
|
|
3622
|
-
maxVideoWidth: maxVideoWidth,
|
|
3623
|
-
maxFps: maxFps,
|
|
3624
|
-
debugMode: debugMode
|
|
3625
|
-
});
|
|
3626
|
-
React.useEffect(function () {
|
|
3627
|
-
if (captureDevice.cameraAccessDenied) onCameraAccessDenied === null || onCameraAccessDenied === void 0 ? void 0 : onCameraAccessDenied();
|
|
3628
|
-
}, [captureDevice.cameraAccessDenied, onCameraAccessDenied]);
|
|
3629
|
-
React.useEffect(function () {
|
|
3630
|
-
if (captureDevice.microphoneAccessDenied) onMicrophoneAccessDenied === null || onMicrophoneAccessDenied === void 0 ? void 0 : onMicrophoneAccessDenied();
|
|
3631
|
-
}, [captureDevice.microphoneAccessDenied, onMicrophoneAccessDenied]);
|
|
3632
|
-
var releaseCameraAccess = captureDevice.releaseCameraAccess;
|
|
3633
|
-
React.useEffect(function () {
|
|
3025
|
+
});
|
|
3634
3026
|
return function () {
|
|
3635
|
-
|
|
3027
|
+
if (resizeObserverRef.current) {
|
|
3028
|
+
resizeObserverRef.current.instance.unobserve(element);
|
|
3029
|
+
}
|
|
3636
3030
|
};
|
|
3637
|
-
}, [
|
|
3638
|
-
return
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3031
|
+
}, [opts.box, round]), opts.ref);
|
|
3032
|
+
return React.useMemo(function () {
|
|
3033
|
+
return {
|
|
3034
|
+
ref: refCallback,
|
|
3035
|
+
width: size.width,
|
|
3036
|
+
height: size.height
|
|
3037
|
+
};
|
|
3038
|
+
}, [refCallback, size.width, size.height]);
|
|
3039
|
+
}
|
|
3642
3040
|
|
|
3643
3041
|
function _typeof$1(o) {
|
|
3644
3042
|
"@babel/helpers - typeof";
|
|
@@ -4112,9 +3510,9 @@
|
|
|
4112
3510
|
}
|
|
4113
3511
|
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
4114
3512
|
|
|
4115
|
-
function _createForOfIteratorHelperLoose$
|
|
4116
|
-
function _unsupportedIterableToArray$
|
|
4117
|
-
function _arrayLikeToArray$
|
|
3513
|
+
function _createForOfIteratorHelperLoose$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3514
|
+
function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
|
|
3515
|
+
function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4118
3516
|
var t = self;
|
|
4119
3517
|
function e() {
|
|
4120
3518
|
throw Error("Invalid UTF8");
|
|
@@ -6341,7 +5739,7 @@
|
|
|
6341
5739
|
height: (_hn4 = hn(e, 4)) != null ? _hn4 : 0,
|
|
6342
5740
|
angle: 0
|
|
6343
5741
|
}), (_en2 = en(t, ws, 4)) != null && _en2.g().length) {
|
|
6344
|
-
for (var _iterator = _createForOfIteratorHelperLoose$
|
|
5742
|
+
for (var _iterator = _createForOfIteratorHelperLoose$2(en(t, ws, 4).g()), _step; !(_step = _iterator()).done;) {
|
|
6345
5743
|
var _We, _We2, _We3, _un3;
|
|
6346
5744
|
var _e16 = _step.value;
|
|
6347
5745
|
i.keypoints.push({
|
|
@@ -6356,7 +5754,7 @@
|
|
|
6356
5754
|
}
|
|
6357
5755
|
function Qi(t) {
|
|
6358
5756
|
var e = [];
|
|
6359
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose$
|
|
5757
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step2; !(_step2 = _iterator2()).done;) {
|
|
6360
5758
|
var _fn2, _fn3, _fn4;
|
|
6361
5759
|
var _n14 = _step2.value;
|
|
6362
5760
|
e.push({
|
|
@@ -6369,7 +5767,7 @@
|
|
|
6369
5767
|
}
|
|
6370
5768
|
function to(t) {
|
|
6371
5769
|
var e = [];
|
|
6372
|
-
for (var _iterator3 = _createForOfIteratorHelperLoose$
|
|
5770
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step3; !(_step3 = _iterator3()).done;) {
|
|
6373
5771
|
var _fn5, _fn6, _fn7;
|
|
6374
5772
|
var _n15 = _step3.value;
|
|
6375
5773
|
e.push({
|
|
@@ -6517,7 +5915,7 @@
|
|
|
6517
5915
|
var r = new Uint32Array(e.length);
|
|
6518
5916
|
for (var _n16 = 0; _n16 < e.length; _n16++) r[_n16] = t.i.stringToNewUTF8(e[_n16]);
|
|
6519
5917
|
e = t.i._malloc(4 * r.length), t.i.HEAPU32.set(r, e >> 2), n(e);
|
|
6520
|
-
for (var _iterator4 = _createForOfIteratorHelperLoose$
|
|
5918
|
+
for (var _iterator4 = _createForOfIteratorHelperLoose$2(r), _step4; !(_step4 = _iterator4()).done;) {
|
|
6521
5919
|
var _e17 = _step4.value;
|
|
6522
5920
|
t.i._free(_e17);
|
|
6523
5921
|
}
|
|
@@ -6883,7 +6281,7 @@
|
|
|
6883
6281
|
}
|
|
6884
6282
|
t.push(n);
|
|
6885
6283
|
};
|
|
6886
|
-
for (var _iterator7 = _createForOfIteratorHelperLoose$
|
|
6284
|
+
for (var _iterator7 = _createForOfIteratorHelperLoose$2(this.g), _step7; !(_step7 = _iterator7()).done;) {
|
|
6887
6285
|
_loop();
|
|
6888
6286
|
}
|
|
6889
6287
|
return new _Yo(t, this.ba(), this.K(), this.canvas, this.l, this.width, this.height);
|
|
@@ -7015,7 +6413,7 @@
|
|
|
7015
6413
|
}
|
|
7016
6414
|
t.push(n);
|
|
7017
6415
|
};
|
|
7018
|
-
for (var _iterator8 = _createForOfIteratorHelperLoose$
|
|
6416
|
+
for (var _iterator8 = _createForOfIteratorHelperLoose$2(this.g), _step8; !(_step8 = _iterator8()).done;) {
|
|
7019
6417
|
_loop2();
|
|
7020
6418
|
}
|
|
7021
6419
|
return new _ia(t, this.K(), this.canvas, this.l, this.width, this.height);
|
|
@@ -7495,7 +6893,7 @@
|
|
|
7495
6893
|
yn(e, si, this.h);
|
|
7496
6894
|
var n = new qr();
|
|
7497
6895
|
Hr(n, "mediapipe.tasks.vision.face_detector.FaceDetectorGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect_in"), $r(n, "DETECTIONS:detections"), n.o(e), es(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
|
|
7498
|
-
for (var _iterator9 = _createForOfIteratorHelperLoose$
|
|
6896
|
+
for (var _iterator9 = _createForOfIteratorHelperLoose$2(t), _step9; !(_step9 = _iterator9()).done;) {
|
|
7499
6897
|
var _e23 = _step9.value;
|
|
7500
6898
|
t = Es(_e23), _this43.j.detections.push(Zi(t));
|
|
7501
6899
|
}
|
|
@@ -7589,7 +6987,7 @@
|
|
|
7589
6987
|
yn(e, di, this.h);
|
|
7590
6988
|
var n = new qr();
|
|
7591
6989
|
Hr(n, "mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:face_landmarks"), n.o(e), es(t, n), this.g.attachProtoVectorListener("face_landmarks", function (t, e) {
|
|
7592
|
-
for (var _iterator10 = _createForOfIteratorHelperLoose$
|
|
6990
|
+
for (var _iterator10 = _createForOfIteratorHelperLoose$2(t), _step10; !(_step10 = _iterator10()).done;) {
|
|
7593
6991
|
var _e24 = _step10.value;
|
|
7594
6992
|
t = Ms(_e24), _this45.j.faceLandmarks.push(Qi(t));
|
|
7595
6993
|
}
|
|
@@ -7598,7 +6996,7 @@
|
|
|
7598
6996
|
_o(_this45, t);
|
|
7599
6997
|
}), this.outputFaceBlendshapes && (rs(t, "blendshapes"), $r(n, "BLENDSHAPES:blendshapes"), this.g.attachProtoVectorListener("blendshapes", function (t, e) {
|
|
7600
6998
|
if (_this45.outputFaceBlendshapes) {
|
|
7601
|
-
for (var _iterator11 = _createForOfIteratorHelperLoose$
|
|
6999
|
+
for (var _iterator11 = _createForOfIteratorHelperLoose$2(t), _step11; !(_step11 = _iterator11()).done;) {
|
|
7602
7000
|
var _t$g;
|
|
7603
7001
|
var _e25 = _step11.value;
|
|
7604
7002
|
t = fs(_e25), _this45.j.faceBlendshapes.push(Ji((_t$g = t.g()) != null ? _t$g : []));
|
|
@@ -7609,7 +7007,7 @@
|
|
|
7609
7007
|
_o(_this45, t);
|
|
7610
7008
|
})), this.outputFacialTransformationMatrixes && (rs(t, "face_geometry"), $r(n, "FACE_GEOMETRY:face_geometry"), this.g.attachProtoVectorListener("face_geometry", function (t, e) {
|
|
7611
7009
|
if (_this45.outputFacialTransformationMatrixes) {
|
|
7612
|
-
for (var _iterator12 = _createForOfIteratorHelperLoose$
|
|
7010
|
+
for (var _iterator12 = _createForOfIteratorHelperLoose$2(t), _step12; !(_step12 = _iterator12()).done;) {
|
|
7613
7011
|
var _ln2, _ln3, _He;
|
|
7614
7012
|
var _e26 = _step12.value;
|
|
7615
7013
|
(t = en(ai(_e26), Ps, 2)) && _this45.j.facialTransformationMatrixes.push({
|
|
@@ -7740,11 +7138,11 @@
|
|
|
7740
7138
|
e = !0;
|
|
7741
7139
|
}
|
|
7742
7140
|
var n = [];
|
|
7743
|
-
for (var _iterator13 = _createForOfIteratorHelperLoose$
|
|
7141
|
+
for (var _iterator13 = _createForOfIteratorHelperLoose$2(t), _step13; !(_step13 = _iterator13()).done;) {
|
|
7744
7142
|
var _s9 = _step13.value;
|
|
7745
7143
|
var r = fs(_s9);
|
|
7746
7144
|
t = [];
|
|
7747
|
-
for (var _iterator14 = _createForOfIteratorHelperLoose$
|
|
7145
|
+
for (var _iterator14 = _createForOfIteratorHelperLoose$2(r.g()), _step14; !(_step14 = _iterator14()).done;) {
|
|
7748
7146
|
var _fn8, _ref9, _un4, _ref10, _un5;
|
|
7749
7147
|
var _n24 = _step14.value;
|
|
7750
7148
|
r = e && null != hn(_n24, 1) ? ln(hn(_n24, 1)) : -1, t.push({
|
|
@@ -7790,11 +7188,11 @@
|
|
|
7790
7188
|
yn(e, Oi, this.v);
|
|
7791
7189
|
var n = new qr();
|
|
7792
7190
|
Hr(n, "mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "HAND_GESTURES:hand_gestures"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
|
|
7793
|
-
for (var _iterator15 = _createForOfIteratorHelperLoose$
|
|
7191
|
+
for (var _iterator15 = _createForOfIteratorHelperLoose$2(t), _step15; !(_step15 = _iterator15()).done;) {
|
|
7794
7192
|
var _e28 = _step15.value;
|
|
7795
7193
|
t = Ms(_e28);
|
|
7796
7194
|
var _n25 = [];
|
|
7797
|
-
for (var _iterator16 = _createForOfIteratorHelperLoose$
|
|
7195
|
+
for (var _iterator16 = _createForOfIteratorHelperLoose$2(rn(t, Fs, 1)), _step16; !(_step16 = _iterator16()).done;) {
|
|
7798
7196
|
var _fn9, _fn10, _fn11;
|
|
7799
7197
|
var _e29 = _step16.value;
|
|
7800
7198
|
_n25.push({
|
|
@@ -7809,11 +7207,11 @@
|
|
|
7809
7207
|
}), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
|
|
7810
7208
|
_o(_this49, t);
|
|
7811
7209
|
}), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
|
|
7812
|
-
for (var _iterator17 = _createForOfIteratorHelperLoose$
|
|
7210
|
+
for (var _iterator17 = _createForOfIteratorHelperLoose$2(t), _step17; !(_step17 = _iterator17()).done;) {
|
|
7813
7211
|
var _e30 = _step17.value;
|
|
7814
7212
|
t = Ls(_e30);
|
|
7815
7213
|
var _n26 = [];
|
|
7816
|
-
for (var _iterator18 = _createForOfIteratorHelperLoose$
|
|
7214
|
+
for (var _iterator18 = _createForOfIteratorHelperLoose$2(rn(t, Ts, 1)), _step18; !(_step18 = _iterator18()).done;) {
|
|
7817
7215
|
var _fn12, _fn13, _fn14;
|
|
7818
7216
|
var _e31 = _step18.value;
|
|
7819
7217
|
_n26.push({
|
|
@@ -7898,7 +7296,7 @@
|
|
|
7898
7296
|
yn(e, Si, this.j);
|
|
7899
7297
|
var n = new qr();
|
|
7900
7298
|
Hr(n, "mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "LANDMARKS:hand_landmarks"), $r(n, "WORLD_LANDMARKS:world_hand_landmarks"), $r(n, "HANDEDNESS:handedness"), n.o(e), es(t, n), this.g.attachProtoVectorListener("hand_landmarks", function (t, e) {
|
|
7901
|
-
for (var _iterator19 = _createForOfIteratorHelperLoose$
|
|
7299
|
+
for (var _iterator19 = _createForOfIteratorHelperLoose$2(t), _step19; !(_step19 = _iterator19()).done;) {
|
|
7902
7300
|
var _e32 = _step19.value;
|
|
7903
7301
|
t = Ms(_e32), _this51.landmarks.push(Qi(t));
|
|
7904
7302
|
}
|
|
@@ -7906,7 +7304,7 @@
|
|
|
7906
7304
|
}), this.g.attachEmptyPacketListener("hand_landmarks", function (t) {
|
|
7907
7305
|
_o(_this51, t);
|
|
7908
7306
|
}), this.g.attachProtoVectorListener("world_hand_landmarks", function (t, e) {
|
|
7909
|
-
for (var _iterator20 = _createForOfIteratorHelperLoose$
|
|
7307
|
+
for (var _iterator20 = _createForOfIteratorHelperLoose$2(t), _step20; !(_step20 = _iterator20()).done;) {
|
|
7910
7308
|
var _e33 = _step20.value;
|
|
7911
7309
|
t = Ls(_e33), _this51.worldLandmarks.push(to(t));
|
|
7912
7310
|
}
|
|
@@ -7917,11 +7315,11 @@
|
|
|
7917
7315
|
var n = _this51.handedness,
|
|
7918
7316
|
r = n.push;
|
|
7919
7317
|
var s = [];
|
|
7920
|
-
for (var _iterator21 = _createForOfIteratorHelperLoose$
|
|
7318
|
+
for (var _iterator21 = _createForOfIteratorHelperLoose$2(t), _step21; !(_step21 = _iterator21()).done;) {
|
|
7921
7319
|
var _e34 = _step21.value;
|
|
7922
7320
|
t = fs(_e34);
|
|
7923
7321
|
var _n27 = [];
|
|
7924
|
-
for (var _iterator22 = _createForOfIteratorHelperLoose$
|
|
7322
|
+
for (var _iterator22 = _createForOfIteratorHelperLoose$2(t.g()), _step22; !(_step22 = _iterator22()).done;) {
|
|
7925
7323
|
var _fn15, _ln4, _ref11, _un6, _ref12, _un7;
|
|
7926
7324
|
var _e35 = _step22.value;
|
|
7927
7325
|
_n27.push({
|
|
@@ -8313,7 +7711,7 @@
|
|
|
8313
7711
|
dn(a, 3, !0), gn(a, 1, e.keypoint.x), gn(a, 2, e.keypoint.y), on(i, 5, oh, a);
|
|
8314
7712
|
} else {
|
|
8315
7713
|
if (!e.scribble) throw Error("Must provide either a keypoint or a scribble.");
|
|
8316
|
-
for (var _iterator23 = _createForOfIteratorHelperLoose$
|
|
7714
|
+
for (var _iterator23 = _createForOfIteratorHelperLoose$2((o = new sh(), e.scribble)), _step23; !(_step23 = _iterator23()).done;) {
|
|
8317
7715
|
a = _step23.value;
|
|
8318
7716
|
dn(e = new nh(), 3, !0), gn(e, 1, a.x), gn(e, 2, a.y), an(o, nh, e);
|
|
8319
7717
|
}
|
|
@@ -8414,7 +7812,7 @@
|
|
|
8414
7812
|
yn(e, Vi, this.h);
|
|
8415
7813
|
var n = new qr();
|
|
8416
7814
|
Hr(n, "mediapipe.tasks.vision.ObjectDetectorGraph"), Yr(n, "IMAGE:input_frame_gpu"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "DETECTIONS:detections"), n.o(e), es(t, n), this.g.attachProtoVectorListener("detections", function (t, e) {
|
|
8417
|
-
for (var _iterator24 = _createForOfIteratorHelperLoose$
|
|
7815
|
+
for (var _iterator24 = _createForOfIteratorHelperLoose$2(t), _step24; !(_step24 = _iterator24()).done;) {
|
|
8418
7816
|
var _e37 = _step24.value;
|
|
8419
7817
|
t = Es(_e37), _this61.j.detections.push(Zi(t));
|
|
8420
7818
|
}
|
|
@@ -8514,7 +7912,7 @@
|
|
|
8514
7912
|
var n = new qr();
|
|
8515
7913
|
Hr(n, "mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"), Yr(n, "IMAGE:image_in"), Yr(n, "NORM_RECT:norm_rect"), $r(n, "NORM_LANDMARKS:normalized_landmarks"), $r(n, "WORLD_LANDMARKS:world_landmarks"), n.o(e), es(t, n), wo(this, t), this.g.attachProtoVectorListener("normalized_landmarks", function (t, e) {
|
|
8516
7914
|
_this63.landmarks = [];
|
|
8517
|
-
for (var _iterator25 = _createForOfIteratorHelperLoose$
|
|
7915
|
+
for (var _iterator25 = _createForOfIteratorHelperLoose$2(t), _step25; !(_step25 = _iterator25()).done;) {
|
|
8518
7916
|
var _e39 = _step25.value;
|
|
8519
7917
|
t = Ms(_e39), _this63.landmarks.push(Qi(t));
|
|
8520
7918
|
}
|
|
@@ -8523,7 +7921,7 @@
|
|
|
8523
7921
|
_this63.landmarks = [], _o(_this63, t);
|
|
8524
7922
|
}), this.g.attachProtoVectorListener("world_landmarks", function (t, e) {
|
|
8525
7923
|
_this63.worldLandmarks = [];
|
|
8526
|
-
for (var _iterator26 = _createForOfIteratorHelperLoose$
|
|
7924
|
+
for (var _iterator26 = _createForOfIteratorHelperLoose$2(t), _step26; !(_step26 = _iterator26()).done;) {
|
|
8527
7925
|
var _e40 = _step26.value;
|
|
8528
7926
|
t = Ls(_e40), _this63.worldLandmarks.push(to(t));
|
|
8529
7927
|
}
|
|
@@ -8606,6 +8004,42 @@
|
|
|
8606
8004
|
});
|
|
8607
8005
|
}
|
|
8608
8006
|
|
|
8007
|
+
function getFrameDimensions(frame) {
|
|
8008
|
+
var frameWidth = frame.width,
|
|
8009
|
+
frameHeight = frame.height;
|
|
8010
|
+
if (frame instanceof HTMLImageElement) {
|
|
8011
|
+
frameWidth = frame.naturalWidth;
|
|
8012
|
+
frameHeight = frame.naturalHeight;
|
|
8013
|
+
}
|
|
8014
|
+
if (frame instanceof HTMLVideoElement) {
|
|
8015
|
+
frameWidth = frame.videoWidth;
|
|
8016
|
+
frameHeight = frame.videoHeight;
|
|
8017
|
+
}
|
|
8018
|
+
return [frameWidth, frameHeight];
|
|
8019
|
+
}
|
|
8020
|
+
|
|
8021
|
+
var InvisibleCanvas = styled.canvas(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
8022
|
+
function drawToCanvas(canvas, frame, width, height) {
|
|
8023
|
+
if (!canvas) return;
|
|
8024
|
+
var ctx = canvas.getContext('2d');
|
|
8025
|
+
if (!ctx) return;
|
|
8026
|
+
if (!width || !height) {
|
|
8027
|
+
var _a = getFrameDimensions(frame),
|
|
8028
|
+
frameWidth = _a[0],
|
|
8029
|
+
frameHeight = _a[1];
|
|
8030
|
+
width || (width = frameWidth);
|
|
8031
|
+
height || (height = frameHeight);
|
|
8032
|
+
}
|
|
8033
|
+
canvas.width = width;
|
|
8034
|
+
canvas.height = height;
|
|
8035
|
+
ctx.drawImage(frame, 0, 0, width, height);
|
|
8036
|
+
}
|
|
8037
|
+
function clearCanvas(canvas) {
|
|
8038
|
+
var _a;
|
|
8039
|
+
(_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);
|
|
8040
|
+
}
|
|
8041
|
+
var templateObject_1$G;
|
|
8042
|
+
|
|
8609
8043
|
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
8610
8044
|
if (quality === void 0) {
|
|
8611
8045
|
quality = 0.92;
|
|
@@ -8909,7 +8343,8 @@
|
|
|
8909
8343
|
modelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
8910
8344
|
_c = _a.modelLoadTimeoutMs,
|
|
8911
8345
|
modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
8912
|
-
onModelError = _a.onModelError
|
|
8346
|
+
onModelError = _a.onModelError,
|
|
8347
|
+
videoRef = _a.videoRef;
|
|
8913
8348
|
var _d = React.useState(false),
|
|
8914
8349
|
ready = _d[0],
|
|
8915
8350
|
setReady = _d[1];
|
|
@@ -8919,7 +8354,6 @@
|
|
|
8919
8354
|
var _f = React.useState(null),
|
|
8920
8355
|
modelError = _f[0],
|
|
8921
8356
|
setModelError = _f[1];
|
|
8922
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
8923
8357
|
React.useEffect(function loadModel() {
|
|
8924
8358
|
var _this = this;
|
|
8925
8359
|
setReady(false);
|
|
@@ -9057,7 +8491,8 @@
|
|
|
9057
8491
|
function useLoadFaceDetector(_a) {
|
|
9058
8492
|
var onModelError = _a.onModelError,
|
|
9059
8493
|
_b = _a.modelLoadTimeoutMs,
|
|
9060
|
-
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b
|
|
8494
|
+
modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
|
|
8495
|
+
videoRef = _a.videoRef;
|
|
9061
8496
|
var _c = React.useState(false),
|
|
9062
8497
|
ready = _c[0],
|
|
9063
8498
|
setReady = _c[1];
|
|
@@ -9067,7 +8502,6 @@
|
|
|
9067
8502
|
var _e = React.useState(null),
|
|
9068
8503
|
modelError = _e[0],
|
|
9069
8504
|
setModelError = _e[1];
|
|
9070
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
9071
8505
|
React.useEffect(function loadModel() {
|
|
9072
8506
|
var _this = this;
|
|
9073
8507
|
setReady(false);
|
|
@@ -9548,7 +8982,8 @@
|
|
|
9548
8982
|
modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
|
|
9549
8983
|
_d = _a.scoreThreshold,
|
|
9550
8984
|
scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
|
|
9551
|
-
onModelError = _a.onModelError
|
|
8985
|
+
onModelError = _a.onModelError,
|
|
8986
|
+
videoRef = _a.videoRef;
|
|
9552
8987
|
var _e = React.useState(false),
|
|
9553
8988
|
ready = _e[0],
|
|
9554
8989
|
setReady = _e[1];
|
|
@@ -9558,7 +8993,6 @@
|
|
|
9558
8993
|
var _g = React.useState(null),
|
|
9559
8994
|
modelError = _g[0],
|
|
9560
8995
|
setModelError = _g[1];
|
|
9561
|
-
var videoRef = React.useContext(CameraStateContext).videoRef;
|
|
9562
8996
|
React.useEffect(function loadModel() {
|
|
9563
8997
|
var _this = this;
|
|
9564
8998
|
setReady(false);
|
|
@@ -9839,32 +9273,576 @@
|
|
|
9839
9273
|
});
|
|
9840
9274
|
});
|
|
9841
9275
|
}
|
|
9842
|
-
renderPrediction().then();
|
|
9276
|
+
renderPrediction().then();
|
|
9277
|
+
return function () {
|
|
9278
|
+
loopId.current += 1;
|
|
9279
|
+
frameId.current && cancelAnimationFrame(frameId.current);
|
|
9280
|
+
timer && clearTimeout(timer);
|
|
9281
|
+
};
|
|
9282
|
+
}, [fn, running, throttleMs]);
|
|
9283
|
+
var start = React.useCallback(function () {
|
|
9284
|
+
startedAtRef.current = new Date();
|
|
9285
|
+
setRunning(true);
|
|
9286
|
+
}, []);
|
|
9287
|
+
var stop = React.useCallback(function () {
|
|
9288
|
+
loopId.current += 1; // force the loop to stop immediately.
|
|
9289
|
+
setRunning(false);
|
|
9290
|
+
startedAtRef.current = null;
|
|
9291
|
+
}, []);
|
|
9292
|
+
React.useEffect(function startAutomatically() {
|
|
9293
|
+
if (autoStart) start();
|
|
9294
|
+
return function () {
|
|
9295
|
+
stop();
|
|
9296
|
+
};
|
|
9297
|
+
}, [autoStart, start, stop]);
|
|
9298
|
+
return {
|
|
9299
|
+
start: start,
|
|
9300
|
+
stop: stop
|
|
9301
|
+
};
|
|
9302
|
+
}
|
|
9303
|
+
|
|
9304
|
+
var createStoreImpl = function createStoreImpl(createState) {
|
|
9305
|
+
var state;
|
|
9306
|
+
var listeners = /* @__PURE__ */new Set();
|
|
9307
|
+
var setState = function setState(partial, replace) {
|
|
9308
|
+
var nextState = typeof partial === "function" ? partial(state) : partial;
|
|
9309
|
+
if (!Object.is(nextState, state)) {
|
|
9310
|
+
var previousState = state;
|
|
9311
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
9312
|
+
listeners.forEach(function (listener) {
|
|
9313
|
+
return listener(state, previousState);
|
|
9314
|
+
});
|
|
9315
|
+
}
|
|
9316
|
+
};
|
|
9317
|
+
var getState = function getState() {
|
|
9318
|
+
return state;
|
|
9319
|
+
};
|
|
9320
|
+
var getInitialState = function getInitialState() {
|
|
9321
|
+
return initialState;
|
|
9322
|
+
};
|
|
9323
|
+
var subscribe = function subscribe(listener) {
|
|
9324
|
+
listeners.add(listener);
|
|
9325
|
+
return function () {
|
|
9326
|
+
return listeners["delete"](listener);
|
|
9327
|
+
};
|
|
9328
|
+
};
|
|
9329
|
+
var api = {
|
|
9330
|
+
setState: setState,
|
|
9331
|
+
getState: getState,
|
|
9332
|
+
getInitialState: getInitialState,
|
|
9333
|
+
subscribe: subscribe
|
|
9334
|
+
};
|
|
9335
|
+
var initialState = state = createState(setState, getState, api);
|
|
9336
|
+
return api;
|
|
9337
|
+
};
|
|
9338
|
+
var createStore = function createStore(createState) {
|
|
9339
|
+
return createState ? createStoreImpl(createState) : createStoreImpl;
|
|
9340
|
+
};
|
|
9341
|
+
|
|
9342
|
+
var identity = function identity(arg) {
|
|
9343
|
+
return arg;
|
|
9344
|
+
};
|
|
9345
|
+
function useStore(api, selector) {
|
|
9346
|
+
if (selector === void 0) {
|
|
9347
|
+
selector = identity;
|
|
9348
|
+
}
|
|
9349
|
+
var slice = React.useSyncExternalStore(api.subscribe, function () {
|
|
9350
|
+
return selector(api.getState());
|
|
9351
|
+
}, function () {
|
|
9352
|
+
return selector(api.getInitialState());
|
|
9353
|
+
});
|
|
9354
|
+
React.useDebugValue(slice);
|
|
9355
|
+
return slice;
|
|
9356
|
+
}
|
|
9357
|
+
|
|
9358
|
+
function listAvailableCameras(facingMode_1) {
|
|
9359
|
+
return __awaiter(this, arguments, void 0, function (facingMode, requestMicAccess) {
|
|
9360
|
+
var cameraEnumerationStream, videoDevices;
|
|
9361
|
+
if (requestMicAccess === void 0) {
|
|
9362
|
+
requestMicAccess = false;
|
|
9363
|
+
}
|
|
9364
|
+
return __generator(this, function (_a) {
|
|
9365
|
+
switch (_a.label) {
|
|
9366
|
+
case 0:
|
|
9367
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
9368
|
+
video: {
|
|
9369
|
+
facingMode: {
|
|
9370
|
+
exact: facingMode
|
|
9371
|
+
}
|
|
9372
|
+
},
|
|
9373
|
+
audio: requestMicAccess
|
|
9374
|
+
})
|
|
9375
|
+
// This lists all available cameras attached to the user's device.
|
|
9376
|
+
];
|
|
9377
|
+
case 1:
|
|
9378
|
+
cameraEnumerationStream = _a.sent();
|
|
9379
|
+
return [4 /*yield*/, navigator.mediaDevices.enumerateDevices()];
|
|
9380
|
+
case 2:
|
|
9381
|
+
videoDevices = _a.sent().filter(function (_a) {
|
|
9382
|
+
var kind = _a.kind;
|
|
9383
|
+
return kind === 'videoinput';
|
|
9384
|
+
});
|
|
9385
|
+
// Release the access to the user's camera that we obtained for enumeration purposes.
|
|
9386
|
+
cameraEnumerationStream.getVideoTracks().forEach(function (track) {
|
|
9387
|
+
track.enabled = false;
|
|
9388
|
+
track.stop();
|
|
9389
|
+
});
|
|
9390
|
+
cameraEnumerationStream = null;
|
|
9391
|
+
return [2 /*return*/, videoDevices];
|
|
9392
|
+
}
|
|
9393
|
+
});
|
|
9394
|
+
});
|
|
9395
|
+
}
|
|
9396
|
+
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) {
|
|
9397
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
9398
|
+
});
|
|
9399
|
+
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) {
|
|
9400
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
9401
|
+
});
|
|
9402
|
+
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) {
|
|
9403
|
+
return s.toLocaleLowerCase().split(' ').join('');
|
|
9404
|
+
});
|
|
9405
|
+
var cameraLabelMatches = function cameraLabelMatches(labelOrDevice, labelSetOrLabel) {
|
|
9406
|
+
var label = labelOrDevice instanceof MediaDeviceInfo ? getDeviceLabel(labelOrDevice) : labelOrDevice;
|
|
9407
|
+
var labelSet = typeof labelSetOrLabel === 'string' ? [labelSetOrLabel] : labelSetOrLabel;
|
|
9408
|
+
return labelSet.some(function (l) {
|
|
9409
|
+
return label.includes(l);
|
|
9410
|
+
});
|
|
9411
|
+
};
|
|
9412
|
+
var getDeviceLabel = function getDeviceLabel(deviceInfo) {
|
|
9413
|
+
return deviceInfo.label.toLocaleLowerCase().split(' ').join('');
|
|
9414
|
+
};
|
|
9415
|
+
var currentCamera;
|
|
9416
|
+
function obtainCameraAccess(stream, deviceLabel, video) {
|
|
9417
|
+
releaseCameraAccess();
|
|
9418
|
+
log('obtaining camera access...');
|
|
9419
|
+
var _a = stream.getVideoTracks()[0].getSettings(),
|
|
9420
|
+
width = _a.width,
|
|
9421
|
+
height = _a.height;
|
|
9422
|
+
log('camera dimensions', width, height);
|
|
9423
|
+
var label = deviceLabel.toLocaleLowerCase().split(' ').join('');
|
|
9424
|
+
log('camera label', label);
|
|
9425
|
+
var isRearFacing = cameraLabelMatches(label, __spreadArray(__spreadArray(__spreadArray([], rearCameraLabels, true), backUltraWideCameraLabels, true), ['iphone'], false));
|
|
9426
|
+
log('is rear facing?', isRearFacing);
|
|
9427
|
+
var release = function release() {
|
|
9428
|
+
stream.getTracks().forEach(function (track) {
|
|
9429
|
+
track.enabled = false;
|
|
9430
|
+
track.stop();
|
|
9431
|
+
});
|
|
9432
|
+
if (video) {
|
|
9433
|
+
video.pause();
|
|
9434
|
+
video.srcObject = null;
|
|
9435
|
+
video.src = '';
|
|
9436
|
+
}
|
|
9437
|
+
};
|
|
9438
|
+
width || (width = 0);
|
|
9439
|
+
height || (height = 0);
|
|
9440
|
+
currentCamera = {
|
|
9441
|
+
label: deviceLabel,
|
|
9442
|
+
stream: stream,
|
|
9443
|
+
width: width,
|
|
9444
|
+
height: height,
|
|
9445
|
+
isRearFacing: isRearFacing,
|
|
9446
|
+
release: release
|
|
9447
|
+
};
|
|
9448
|
+
log('camera access granted');
|
|
9449
|
+
if (video) video.srcObject = stream;
|
|
9450
|
+
log('video source initialized');
|
|
9451
|
+
return currentCamera;
|
|
9452
|
+
}
|
|
9453
|
+
function releaseCameraAccess() {
|
|
9454
|
+
if (!currentCamera) return;
|
|
9455
|
+
log('releasing camera access...');
|
|
9456
|
+
currentCamera.release();
|
|
9457
|
+
currentCamera = undefined;
|
|
9458
|
+
}
|
|
9459
|
+
|
|
9460
|
+
var initialState$5 = {
|
|
9461
|
+
videoRef: {
|
|
9462
|
+
current: null
|
|
9463
|
+
},
|
|
9464
|
+
videoLoaded: false,
|
|
9465
|
+
videoStream: null,
|
|
9466
|
+
videoDevice: null,
|
|
9467
|
+
isRearFacing: false,
|
|
9468
|
+
camera: null,
|
|
9469
|
+
cameraReady: false,
|
|
9470
|
+
cameraAccessDenied: false,
|
|
9471
|
+
iphoneContinuityCameraAvailable: false,
|
|
9472
|
+
iphoneContinuityCameraDenied: false,
|
|
9473
|
+
preferIphoneContinuityCamera: true,
|
|
9474
|
+
audioStream: null,
|
|
9475
|
+
microphoneReady: false,
|
|
9476
|
+
microphoneAccessDenied: false
|
|
9477
|
+
};
|
|
9478
|
+
var createCameraStore = function createCameraStore(config) {
|
|
9479
|
+
var store = createStore(function (set, get) {
|
|
9480
|
+
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
9481
|
+
reset: function reset() {
|
|
9482
|
+
return set(_assign(_assign({}, initialState$5), config));
|
|
9483
|
+
},
|
|
9484
|
+
setConfig: function setConfig(config) {
|
|
9485
|
+
return set(config);
|
|
9486
|
+
},
|
|
9487
|
+
onVideoMounted: function onVideoMounted() {
|
|
9488
|
+
return set({
|
|
9489
|
+
videoLoaded: true
|
|
9490
|
+
});
|
|
9491
|
+
},
|
|
9492
|
+
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
9493
|
+
return set({
|
|
9494
|
+
preferIphoneContinuityCamera: value
|
|
9495
|
+
});
|
|
9496
|
+
},
|
|
9497
|
+
requestCameraAccess: function requestCameraAccess() {
|
|
9498
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9499
|
+
var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
|
|
9500
|
+
var _b, _c, _d;
|
|
9501
|
+
return __generator(this, function (_e) {
|
|
9502
|
+
switch (_e.label) {
|
|
9503
|
+
case 0:
|
|
9504
|
+
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
9505
|
+
releaseCameraAccess();
|
|
9506
|
+
_e.label = 1;
|
|
9507
|
+
case 1:
|
|
9508
|
+
_e.trys.push([1, 11,, 12]);
|
|
9509
|
+
return [4 /*yield*/, listAvailableCameras()];
|
|
9510
|
+
case 2:
|
|
9511
|
+
availableCameras = _e.sent();
|
|
9512
|
+
selectedCamera = void 0;
|
|
9513
|
+
debug('availableCameras', availableCameras);
|
|
9514
|
+
platform_1 = getPlatform();
|
|
9515
|
+
debug('platformDetails', platform_1);
|
|
9516
|
+
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
9517
|
+
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
9518
|
+
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
9519
|
+
});
|
|
9520
|
+
set({
|
|
9521
|
+
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
9522
|
+
});
|
|
9523
|
+
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
9524
|
+
selectedCamera = iphoneContinuityCamera;
|
|
9525
|
+
}
|
|
9526
|
+
} 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) {
|
|
9527
|
+
return c.label.startsWith('camera2 ');
|
|
9528
|
+
})) {
|
|
9529
|
+
availableCameras = availableCameras.sort(function (a, b) {
|
|
9530
|
+
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
9531
|
+
});
|
|
9532
|
+
debug('cameras have been sorted', availableCameras);
|
|
9533
|
+
}
|
|
9534
|
+
if (preferFrontFacingCamera) {
|
|
9535
|
+
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
9536
|
+
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
9537
|
+
});
|
|
9538
|
+
}
|
|
9539
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
9540
|
+
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
9541
|
+
}));
|
|
9542
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
9543
|
+
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
9544
|
+
}));
|
|
9545
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
9546
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
9547
|
+
}));
|
|
9548
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
9549
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
9550
|
+
}));
|
|
9551
|
+
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
9552
|
+
if (!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) {
|
|
9553
|
+
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
9554
|
+
}
|
|
9555
|
+
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
9556
|
+
debug('selectedCamera', selectedCamera);
|
|
9557
|
+
set({
|
|
9558
|
+
videoDevice: selectedCamera
|
|
9559
|
+
});
|
|
9560
|
+
constraints = {
|
|
9561
|
+
audio: false,
|
|
9562
|
+
video: {
|
|
9563
|
+
deviceId: {
|
|
9564
|
+
exact: selectedCamera.deviceId
|
|
9565
|
+
},
|
|
9566
|
+
width: {
|
|
9567
|
+
ideal: config.maxVideoWidth
|
|
9568
|
+
},
|
|
9569
|
+
aspectRatio: 1.777777778,
|
|
9570
|
+
frameRate: {}
|
|
9571
|
+
}
|
|
9572
|
+
};
|
|
9573
|
+
if (config.maxFps) {
|
|
9574
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9575
|
+
// @ts-ignore
|
|
9576
|
+
constraints.video.frameRate = {
|
|
9577
|
+
max: config.maxFps
|
|
9578
|
+
};
|
|
9579
|
+
}
|
|
9580
|
+
stream_1 = null;
|
|
9581
|
+
_e.label = 3;
|
|
9582
|
+
case 3:
|
|
9583
|
+
_e.trys.push([3, 5,, 6]);
|
|
9584
|
+
debug('obtaining camera access with constraints', constraints);
|
|
9585
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
9586
|
+
case 4:
|
|
9587
|
+
stream_1 = _e.sent();
|
|
9588
|
+
return [3 /*break*/, 6];
|
|
9589
|
+
case 5:
|
|
9590
|
+
e_1 = _e.sent();
|
|
9591
|
+
if (e_1.name === 'NotAllowedError') {
|
|
9592
|
+
if (preferIphoneContinuityCamera) {
|
|
9593
|
+
set({
|
|
9594
|
+
iphoneContinuityCameraAvailable: false,
|
|
9595
|
+
iphoneContinuityCameraDenied: true
|
|
9596
|
+
});
|
|
9597
|
+
} else {
|
|
9598
|
+
set({
|
|
9599
|
+
cameraAccessDenied: true
|
|
9600
|
+
});
|
|
9601
|
+
}
|
|
9602
|
+
return [2 /*return*/];
|
|
9603
|
+
}
|
|
9604
|
+
return [3 /*break*/, 6];
|
|
9605
|
+
case 6:
|
|
9606
|
+
if (!!stream_1) return [3 /*break*/, 10];
|
|
9607
|
+
_e.label = 7;
|
|
9608
|
+
case 7:
|
|
9609
|
+
_e.trys.push([7, 9,, 10]);
|
|
9610
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
9611
|
+
audio: false,
|
|
9612
|
+
video: true
|
|
9613
|
+
})];
|
|
9614
|
+
case 8:
|
|
9615
|
+
stream_1 = _e.sent();
|
|
9616
|
+
debug('opened stream with no width and height constraints');
|
|
9617
|
+
return [3 /*break*/, 10];
|
|
9618
|
+
case 9:
|
|
9619
|
+
_e.sent();
|
|
9620
|
+
debug('cannot open stream at all');
|
|
9621
|
+
return [3 /*break*/, 10];
|
|
9622
|
+
case 10:
|
|
9623
|
+
if (!stream_1) {
|
|
9624
|
+
error('failed to open camera');
|
|
9625
|
+
throw new Error('failed to open camera');
|
|
9626
|
+
}
|
|
9627
|
+
debug('camera access granted with constraints', constraints);
|
|
9628
|
+
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
9629
|
+
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
9630
|
+
debug('someone unplugged the continuity camera');
|
|
9631
|
+
set({
|
|
9632
|
+
videoStream: null,
|
|
9633
|
+
videoDevice: null,
|
|
9634
|
+
cameraReady: false,
|
|
9635
|
+
iphoneContinuityCameraAvailable: false,
|
|
9636
|
+
iphoneContinuityCameraDenied: true
|
|
9637
|
+
});
|
|
9638
|
+
get().requestCameraAccess();
|
|
9639
|
+
} else {
|
|
9640
|
+
debug('someone unplugged the webcam');
|
|
9641
|
+
releaseCameraAccess();
|
|
9642
|
+
set({
|
|
9643
|
+
videoStream: null,
|
|
9644
|
+
videoDevice: null,
|
|
9645
|
+
videoLoaded: false,
|
|
9646
|
+
cameraReady: false,
|
|
9647
|
+
cameraAccessDenied: true
|
|
9648
|
+
});
|
|
9649
|
+
}
|
|
9650
|
+
};
|
|
9651
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
9652
|
+
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
9653
|
+
videoTrack_1.onended = handleStreamEnded_1;
|
|
9654
|
+
camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
9655
|
+
setTimeout(function () {
|
|
9656
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
9657
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
9658
|
+
videoTrack_1.onmute = handleStreamEnded_1;
|
|
9659
|
+
set({
|
|
9660
|
+
camera: camera_1,
|
|
9661
|
+
cameraReady: true,
|
|
9662
|
+
cameraAccessDenied: false,
|
|
9663
|
+
isRearFacing: camera_1.isRearFacing,
|
|
9664
|
+
videoStream: stream_1
|
|
9665
|
+
});
|
|
9666
|
+
}, 500);
|
|
9667
|
+
return [3 /*break*/, 12];
|
|
9668
|
+
case 11:
|
|
9669
|
+
e_3 = _e.sent();
|
|
9670
|
+
if (e_3.name === 'NotAllowedError') {
|
|
9671
|
+
error('camera access has been blocked by the user', e_3);
|
|
9672
|
+
set({
|
|
9673
|
+
cameraAccessDenied: true
|
|
9674
|
+
});
|
|
9675
|
+
} else {
|
|
9676
|
+
error('camera access encountered some other error', e_3);
|
|
9677
|
+
throw e_3;
|
|
9678
|
+
}
|
|
9679
|
+
return [3 /*break*/, 12];
|
|
9680
|
+
case 12:
|
|
9681
|
+
return [2 /*return*/];
|
|
9682
|
+
}
|
|
9683
|
+
});
|
|
9684
|
+
});
|
|
9685
|
+
},
|
|
9686
|
+
releaseCameraAccess: function releaseCameraAccess() {
|
|
9687
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9688
|
+
var camera;
|
|
9689
|
+
return __generator(this, function (_a) {
|
|
9690
|
+
camera = get().camera;
|
|
9691
|
+
if (!camera) return [2 /*return*/];
|
|
9692
|
+
camera.release();
|
|
9693
|
+
set({
|
|
9694
|
+
camera: null,
|
|
9695
|
+
cameraReady: false,
|
|
9696
|
+
cameraAccessDenied: false
|
|
9697
|
+
});
|
|
9698
|
+
return [2 /*return*/];
|
|
9699
|
+
});
|
|
9700
|
+
});
|
|
9701
|
+
},
|
|
9702
|
+
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
9703
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9704
|
+
var stream_2;
|
|
9705
|
+
return __generator(this, function (_a) {
|
|
9706
|
+
switch (_a.label) {
|
|
9707
|
+
case 0:
|
|
9708
|
+
get().releaseMicrophoneAccess();
|
|
9709
|
+
_a.label = 1;
|
|
9710
|
+
case 1:
|
|
9711
|
+
_a.trys.push([1, 3,, 4]);
|
|
9712
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
9713
|
+
audio: true,
|
|
9714
|
+
video: false
|
|
9715
|
+
})
|
|
9716
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
9717
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
9718
|
+
];
|
|
9719
|
+
case 2:
|
|
9720
|
+
stream_2 = _a.sent();
|
|
9721
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
9722
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
9723
|
+
setTimeout(function () {
|
|
9724
|
+
set({
|
|
9725
|
+
audioStream: stream_2,
|
|
9726
|
+
microphoneReady: true,
|
|
9727
|
+
microphoneAccessDenied: false
|
|
9728
|
+
});
|
|
9729
|
+
var track = stream_2.getAudioTracks()[0];
|
|
9730
|
+
track.onended = function () {
|
|
9731
|
+
return set({
|
|
9732
|
+
microphoneReady: false,
|
|
9733
|
+
microphoneAccessDenied: true
|
|
9734
|
+
});
|
|
9735
|
+
};
|
|
9736
|
+
track.onmute = function () {
|
|
9737
|
+
return set({
|
|
9738
|
+
microphoneReady: false,
|
|
9739
|
+
microphoneAccessDenied: true
|
|
9740
|
+
});
|
|
9741
|
+
};
|
|
9742
|
+
}, 500);
|
|
9743
|
+
return [3 /*break*/, 4];
|
|
9744
|
+
case 3:
|
|
9745
|
+
_a.sent();
|
|
9746
|
+
set({
|
|
9747
|
+
microphoneAccessDenied: true
|
|
9748
|
+
});
|
|
9749
|
+
return [3 /*break*/, 4];
|
|
9750
|
+
case 4:
|
|
9751
|
+
return [2 /*return*/];
|
|
9752
|
+
}
|
|
9753
|
+
});
|
|
9754
|
+
});
|
|
9755
|
+
},
|
|
9756
|
+
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
9757
|
+
var _a;
|
|
9758
|
+
var audioStream = get().audioStream;
|
|
9759
|
+
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
9760
|
+
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
9761
|
+
var _a;
|
|
9762
|
+
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
9763
|
+
});
|
|
9764
|
+
set({
|
|
9765
|
+
audioStream: null,
|
|
9766
|
+
microphoneReady: false,
|
|
9767
|
+
microphoneAccessDenied: false
|
|
9768
|
+
});
|
|
9769
|
+
}
|
|
9770
|
+
});
|
|
9771
|
+
});
|
|
9772
|
+
if (config.requestAccessAutomatically) {
|
|
9773
|
+
void store.getState().requestCameraAccess();
|
|
9774
|
+
}
|
|
9775
|
+
return _assign(_assign({}, store), {
|
|
9776
|
+
destroy: function destroy() {
|
|
9777
|
+
store.getState().releaseCameraAccess();
|
|
9778
|
+
store.getState().releaseMicrophoneAccess();
|
|
9779
|
+
}
|
|
9780
|
+
});
|
|
9781
|
+
};
|
|
9782
|
+
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
9783
|
+
function CameraStoreProvider(_a) {
|
|
9784
|
+
var children = _a.children,
|
|
9785
|
+
_b = _a.requestAccessAutomatically,
|
|
9786
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
9787
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
9788
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
9789
|
+
_d = _a.preferFrontFacingCamera,
|
|
9790
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
9791
|
+
_e = _a.maxVideoWidth,
|
|
9792
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
9793
|
+
maxFps = _a.maxFps,
|
|
9794
|
+
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
9795
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
9796
|
+
_f = _a.requireMicrophoneAccess,
|
|
9797
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f;
|
|
9798
|
+
var videoRef = React.useRef(null);
|
|
9799
|
+
var store = React.useRef();
|
|
9800
|
+
store.current || (store.current = createCameraStore({
|
|
9801
|
+
videoRef: videoRef,
|
|
9802
|
+
requestAccessAutomatically: requestAccessAutomatically,
|
|
9803
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
9804
|
+
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
9805
|
+
maxVideoWidth: maxVideoWidth,
|
|
9806
|
+
maxFps: maxFps,
|
|
9807
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
9808
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
9809
|
+
requireMicrophoneAccess: requireMicrophoneAccess
|
|
9810
|
+
}));
|
|
9811
|
+
React.useEffect(function () {
|
|
9812
|
+
var _a, _b, _c;
|
|
9813
|
+
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
9814
|
+
if (!state) return;
|
|
9815
|
+
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
9816
|
+
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
9817
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
9818
|
+
preferFrontFacingCamera: preferFrontFacingCamera
|
|
9819
|
+
});
|
|
9820
|
+
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
9821
|
+
}
|
|
9822
|
+
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
9823
|
+
React.useEffect(function () {
|
|
9824
|
+
var _a;
|
|
9825
|
+
if (!requireMicrophoneAccess) return;
|
|
9826
|
+
(_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
|
|
9843
9827
|
return function () {
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
timer && clearTimeout(timer);
|
|
9828
|
+
var _a;
|
|
9829
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().releaseMicrophoneAccess();
|
|
9847
9830
|
};
|
|
9848
|
-
}, [
|
|
9849
|
-
|
|
9850
|
-
startedAtRef.current = new Date();
|
|
9851
|
-
setRunning(true);
|
|
9852
|
-
}, []);
|
|
9853
|
-
var stop = React.useCallback(function () {
|
|
9854
|
-
loopId.current += 1; // force the loop to stop immediately.
|
|
9855
|
-
setRunning(false);
|
|
9856
|
-
startedAtRef.current = null;
|
|
9857
|
-
}, []);
|
|
9858
|
-
React.useEffect(function startAutomatically() {
|
|
9859
|
-
if (autoStart) start();
|
|
9831
|
+
}, [requireMicrophoneAccess]);
|
|
9832
|
+
React.useEffect(function () {
|
|
9860
9833
|
return function () {
|
|
9861
|
-
|
|
9834
|
+
var _a;
|
|
9835
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
9862
9836
|
};
|
|
9863
|
-
}, [
|
|
9864
|
-
return {
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9837
|
+
}, []);
|
|
9838
|
+
return /*#__PURE__*/React.createElement(CameraStoreContext.Provider, {
|
|
9839
|
+
value: store.current
|
|
9840
|
+
}, children);
|
|
9841
|
+
}
|
|
9842
|
+
function useCameraStore(selector) {
|
|
9843
|
+
var store = React.useContext(CameraStoreContext);
|
|
9844
|
+
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
9845
|
+
return useStore(store, selector);
|
|
9868
9846
|
}
|
|
9869
9847
|
|
|
9870
9848
|
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
@@ -9912,7 +9890,7 @@
|
|
|
9912
9890
|
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
9913
9891
|
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
9914
9892
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
|
|
9915
|
-
var _h =
|
|
9893
|
+
var _h = useCameraStore(),
|
|
9916
9894
|
videoRef = _h.videoRef,
|
|
9917
9895
|
videoLoaded = _h.videoLoaded,
|
|
9918
9896
|
cameraReady = _h.cameraReady;
|
|
@@ -9935,7 +9913,8 @@
|
|
|
9935
9913
|
modelPath: documentDetectionModelPath,
|
|
9936
9914
|
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
9937
9915
|
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
9938
|
-
onModelError: onDocumentDetectionModelError
|
|
9916
|
+
onModelError: onDocumentDetectionModelError,
|
|
9917
|
+
videoRef: videoRef
|
|
9939
9918
|
}),
|
|
9940
9919
|
ready = _o.ready,
|
|
9941
9920
|
modelDownloadProgress = _o.modelDownloadProgress,
|
|
@@ -10052,10 +10031,12 @@
|
|
|
10052
10031
|
var _e = React.useState({}),
|
|
10053
10032
|
focusThresholds = _e[0],
|
|
10054
10033
|
setFocusThresholds = _e[1];
|
|
10034
|
+
var videoRef = useCameraStore().videoRef;
|
|
10055
10035
|
var _f = useLoadFocusModel({
|
|
10056
10036
|
modelPath: focusModelPath,
|
|
10057
10037
|
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
10058
|
-
onModelError: onFocusModelError
|
|
10038
|
+
onModelError: onFocusModelError,
|
|
10039
|
+
videoRef: videoRef
|
|
10059
10040
|
}),
|
|
10060
10041
|
ready = _f.ready,
|
|
10061
10042
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -11495,9 +11476,9 @@
|
|
|
11495
11476
|
return e;
|
|
11496
11477
|
}
|
|
11497
11478
|
|
|
11498
|
-
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11499
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11500
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11479
|
+
function _createForOfIteratorHelperLoose$1(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray$1(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11480
|
+
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
|
|
11481
|
+
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11501
11482
|
var consoleLogger = {
|
|
11502
11483
|
type: 'logger',
|
|
11503
11484
|
log: function log(args) {
|
|
@@ -12344,7 +12325,7 @@
|
|
|
12344
12325
|
}
|
|
12345
12326
|
if (!useOptionsReplaceForData) {
|
|
12346
12327
|
data = _extends({}, data);
|
|
12347
|
-
for (var _iterator = _createForOfIteratorHelperLoose(optionsKeys), _step; !(_step = _iterator()).done;) {
|
|
12328
|
+
for (var _iterator = _createForOfIteratorHelperLoose$1(optionsKeys), _step; !(_step = _iterator()).done;) {
|
|
12348
12329
|
var key = _step.value;
|
|
12349
12330
|
delete data[key];
|
|
12350
12331
|
}
|
|
@@ -14050,31 +14031,33 @@
|
|
|
14050
14031
|
var templateObject_1$D, templateObject_2$w, templateObject_3$o, templateObject_4$i, templateObject_5$b;
|
|
14051
14032
|
|
|
14052
14033
|
var IdCapture = function IdCapture(_a) {
|
|
14053
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
14034
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
14054
14035
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
14055
|
-
|
|
14056
|
-
thresholds =
|
|
14036
|
+
_j = _a.thresholds,
|
|
14037
|
+
thresholds = _j === void 0 ? defaultIdCaptureThresholds : _j,
|
|
14057
14038
|
guidanceMessage = _a.guidanceMessage,
|
|
14058
14039
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
14059
14040
|
onCapture = _a.onCapture,
|
|
14060
|
-
|
|
14061
|
-
classNames =
|
|
14062
|
-
|
|
14063
|
-
colors =
|
|
14064
|
-
|
|
14065
|
-
rawVerbiage =
|
|
14066
|
-
|
|
14067
|
-
debugMode =
|
|
14068
|
-
var
|
|
14069
|
-
ref =
|
|
14070
|
-
|
|
14071
|
-
width =
|
|
14072
|
-
|
|
14073
|
-
height =
|
|
14074
|
-
var
|
|
14075
|
-
state =
|
|
14076
|
-
dispatch =
|
|
14077
|
-
var
|
|
14041
|
+
_k = _a.classNames,
|
|
14042
|
+
classNames = _k === void 0 ? {} : _k,
|
|
14043
|
+
_l = _a.colors,
|
|
14044
|
+
colors = _l === void 0 ? {} : _l,
|
|
14045
|
+
_m = _a.verbiage,
|
|
14046
|
+
rawVerbiage = _m === void 0 ? {} : _m,
|
|
14047
|
+
_o = _a.debugMode,
|
|
14048
|
+
debugMode = _o === void 0 ? false : _o;
|
|
14049
|
+
var _p = useResizeObserver(),
|
|
14050
|
+
ref = _p.ref,
|
|
14051
|
+
_q = _p.width,
|
|
14052
|
+
width = _q === void 0 ? 1 : _q,
|
|
14053
|
+
_r = _p.height,
|
|
14054
|
+
height = _r === void 0 ? 1 : _r;
|
|
14055
|
+
var _s = useIdCaptureState(),
|
|
14056
|
+
state = _s[0],
|
|
14057
|
+
dispatch = _s[1];
|
|
14058
|
+
var _t = useCameraStore(),
|
|
14059
|
+
camera = _t.camera,
|
|
14060
|
+
isRearFacing = _t.isRearFacing;
|
|
14078
14061
|
var _u = React.useContext(IdCaptureModelsContext),
|
|
14079
14062
|
modelsReady = _u.ready,
|
|
14080
14063
|
setThresholds = _u.setThresholds,
|
|
@@ -14186,17 +14169,16 @@
|
|
|
14186
14169
|
classNames: classNames.overrideWrongDocumentTypeGuidanceDialog,
|
|
14187
14170
|
verbiage: rawVerbiage.overrideWrongDocumentTypeGuidanceDialog
|
|
14188
14171
|
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugBoundingBoxOverlay, {
|
|
14189
|
-
"$flipX": !
|
|
14172
|
+
"$flipX": !isRearFacing,
|
|
14190
14173
|
scaling: debugScalingDetails
|
|
14191
14174
|
}, state.detectedObjects.map(function (obj, i) {
|
|
14192
|
-
var _a;
|
|
14193
14175
|
return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
14194
14176
|
key: i,
|
|
14195
14177
|
obj: obj,
|
|
14196
14178
|
scaling: debugScalingDetails,
|
|
14197
|
-
flipX: !
|
|
14179
|
+
flipX: !isRearFacing
|
|
14198
14180
|
});
|
|
14199
|
-
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null,
|
|
14181
|
+
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
14200
14182
|
};
|
|
14201
14183
|
var timeSince = function timeSince(t) {
|
|
14202
14184
|
if (!t) return 0;
|
|
@@ -14213,7 +14195,9 @@
|
|
|
14213
14195
|
colors = _e === void 0 ? {} : _e,
|
|
14214
14196
|
_f = _a.verbiage,
|
|
14215
14197
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
14216
|
-
var requestCameraAccess =
|
|
14198
|
+
var requestCameraAccess = useCameraStore(function (state) {
|
|
14199
|
+
return state.requestCameraAccess;
|
|
14200
|
+
});
|
|
14217
14201
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/camera-disable-icon.png');
|
|
14218
14202
|
var verbiage = useTranslations(rawVerbiage, {
|
|
14219
14203
|
headingText: 'Your camera permission is disabled',
|
|
@@ -14861,7 +14845,7 @@
|
|
|
14861
14845
|
var _o = React.useContext(IdCaptureModelsContext),
|
|
14862
14846
|
modelsReady = _o.ready,
|
|
14863
14847
|
modelDownloadProgress = _o.modelDownloadProgress;
|
|
14864
|
-
var _p =
|
|
14848
|
+
var _p = useCameraStore(),
|
|
14865
14849
|
cameraReady = _p.cameraReady,
|
|
14866
14850
|
cameraAccessDenied = _p.cameraAccessDenied,
|
|
14867
14851
|
iphoneContinuityCameraAvailable = _p.iphoneContinuityCameraAvailable,
|
|
@@ -15039,6 +15023,71 @@
|
|
|
15039
15023
|
});
|
|
15040
15024
|
var templateObject_1$y, templateObject_2$t, templateObject_3$l, templateObject_4$f, templateObject_5$a, templateObject_6$8, templateObject_7$5, templateObject_8$2, templateObject_9$2, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16, templateObject_17, templateObject_18;
|
|
15041
15025
|
|
|
15026
|
+
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15027
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15028
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15029
|
+
var isIterable = function isIterable(obj) {
|
|
15030
|
+
return Symbol.iterator in obj;
|
|
15031
|
+
};
|
|
15032
|
+
var compareMapLike = function compareMapLike(iterableA, iterableB) {
|
|
15033
|
+
var mapA = iterableA instanceof Map ? iterableA : new Map(iterableA);
|
|
15034
|
+
var mapB = iterableB instanceof Map ? iterableB : new Map(iterableB);
|
|
15035
|
+
if (mapA.size !== mapB.size) return false;
|
|
15036
|
+
for (var _iterator = _createForOfIteratorHelperLoose(mapA), _step; !(_step = _iterator()).done;) {
|
|
15037
|
+
var _step$value = _step.value,
|
|
15038
|
+
key = _step$value[0],
|
|
15039
|
+
value = _step$value[1];
|
|
15040
|
+
if (!Object.is(value, mapB.get(key))) {
|
|
15041
|
+
return false;
|
|
15042
|
+
}
|
|
15043
|
+
}
|
|
15044
|
+
return true;
|
|
15045
|
+
};
|
|
15046
|
+
function shallow(objA, objB) {
|
|
15047
|
+
if (Object.is(objA, objB)) {
|
|
15048
|
+
return true;
|
|
15049
|
+
}
|
|
15050
|
+
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
15051
|
+
return false;
|
|
15052
|
+
}
|
|
15053
|
+
if (isIterable(objA) && isIterable(objB)) {
|
|
15054
|
+
var iteratorA = objA[Symbol.iterator]();
|
|
15055
|
+
var iteratorB = objB[Symbol.iterator]();
|
|
15056
|
+
var nextA = iteratorA.next();
|
|
15057
|
+
var nextB = iteratorB.next();
|
|
15058
|
+
if (Array.isArray(nextA.value) && Array.isArray(nextB.value) && nextA.value.length === 2 && nextB.value.length === 2) {
|
|
15059
|
+
return compareMapLike(objA, objB);
|
|
15060
|
+
}
|
|
15061
|
+
while (!nextA.done && !nextB.done) {
|
|
15062
|
+
if (!Object.is(nextA.value, nextB.value)) {
|
|
15063
|
+
return false;
|
|
15064
|
+
}
|
|
15065
|
+
nextA = iteratorA.next();
|
|
15066
|
+
nextB = iteratorB.next();
|
|
15067
|
+
}
|
|
15068
|
+
return !!nextA.done && !!nextB.done;
|
|
15069
|
+
}
|
|
15070
|
+
var keysA = Object.keys(objA);
|
|
15071
|
+
if (keysA.length !== Object.keys(objB).length) {
|
|
15072
|
+
return false;
|
|
15073
|
+
}
|
|
15074
|
+
for (var _i = 0, _keysA = keysA; _i < _keysA.length; _i++) {
|
|
15075
|
+
var keyA = _keysA[_i];
|
|
15076
|
+
if (!Object.hasOwn(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {
|
|
15077
|
+
return false;
|
|
15078
|
+
}
|
|
15079
|
+
}
|
|
15080
|
+
return true;
|
|
15081
|
+
}
|
|
15082
|
+
|
|
15083
|
+
function useShallow(selector) {
|
|
15084
|
+
var prev = React.useRef();
|
|
15085
|
+
return function (state) {
|
|
15086
|
+
var next = selector(state);
|
|
15087
|
+
return shallow(prev.current, next) ? prev.current : prev.current = next;
|
|
15088
|
+
};
|
|
15089
|
+
}
|
|
15090
|
+
|
|
15042
15091
|
var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
|
|
15043
15092
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$s || (templateObject_2$s = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
15044
15093
|
var IdCaptureLoadingOverlayLegacy = function IdCaptureLoadingOverlayLegacy(_a) {
|
|
@@ -15059,7 +15108,14 @@
|
|
|
15059
15108
|
var _l = React.useContext(IdCaptureModelsContext),
|
|
15060
15109
|
modelsReady = _l.ready,
|
|
15061
15110
|
modelDownloadProgress = _l.modelDownloadProgress;
|
|
15062
|
-
var _m =
|
|
15111
|
+
var _m = useCameraStore(useShallow(function (state) {
|
|
15112
|
+
return {
|
|
15113
|
+
cameraReady: state.cameraReady,
|
|
15114
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
15115
|
+
iphoneContinuityCameraAvailable: state.iphoneContinuityCameraAvailable,
|
|
15116
|
+
setIphoneContinuityCameraAllowed: state.setIphoneContinuityCameraAllowed
|
|
15117
|
+
};
|
|
15118
|
+
})),
|
|
15063
15119
|
cameraReady = _m.cameraReady,
|
|
15064
15120
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
15065
15121
|
iphoneContinuityCameraAvailable = _m.iphoneContinuityCameraAvailable,
|
|
@@ -15605,23 +15661,24 @@
|
|
|
15605
15661
|
}
|
|
15606
15662
|
|
|
15607
15663
|
var IdVideoCaptureFlipIdPrompt = function IdVideoCaptureFlipIdPrompt(_a) {
|
|
15608
|
-
var _b
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
classNames = _d === void 0 ? {} : _d,
|
|
15664
|
+
var _b = _a.idCaptureGuideImages,
|
|
15665
|
+
idCaptureGuideImages = _b === void 0 ? defaultIdCaptureGuideImages : _b,
|
|
15666
|
+
_c = _a.classNames,
|
|
15667
|
+
classNames = _c === void 0 ? {} : _c,
|
|
15613
15668
|
borderWidth = _a.borderWidth,
|
|
15614
15669
|
borderColor = _a.borderColor,
|
|
15615
15670
|
borderRadius = _a.borderRadius,
|
|
15616
15671
|
imageStyle = _a.imageStyle;
|
|
15617
|
-
var
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15672
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
15673
|
+
return state.isRearFacing;
|
|
15674
|
+
});
|
|
15675
|
+
var isMirrored = !isRearFacing;
|
|
15676
|
+
var _d = React.useState(1),
|
|
15677
|
+
transitionTime = _d[0],
|
|
15678
|
+
setTransitionTime = _d[1];
|
|
15679
|
+
var _e = React.useState(0),
|
|
15680
|
+
rotationAngle = _e[0],
|
|
15681
|
+
setRotationAngle = _e[1];
|
|
15625
15682
|
var frontTransforms = ["rotateY(".concat(rotationAngle, "deg)")];
|
|
15626
15683
|
if (isMirrored) frontTransforms.push('scaleX(-1)');
|
|
15627
15684
|
var backTransforms = ["rotateY(".concat(180 - rotationAngle, "deg)")];
|
|
@@ -16145,29 +16202,30 @@
|
|
|
16145
16202
|
var templateObject_1$r, templateObject_2$n;
|
|
16146
16203
|
|
|
16147
16204
|
function IdCaptureGuides(_a) {
|
|
16148
|
-
var _b,
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
rawVerbiage = _o === void 0 ? {} : _o;
|
|
16205
|
+
var _b = _a.guideType,
|
|
16206
|
+
guideType = _b === void 0 ? 'fit' : _b,
|
|
16207
|
+
_c = _a.status,
|
|
16208
|
+
status = _c === void 0 ? 'ready' : _c,
|
|
16209
|
+
_d = _a.progress,
|
|
16210
|
+
progress = _d === void 0 ? 0 : _d,
|
|
16211
|
+
_e = _a.portraitGuidesOnMobile,
|
|
16212
|
+
portraitGuidesOnMobile = _e === void 0 ? true : _e,
|
|
16213
|
+
_f = _a.requestedAction,
|
|
16214
|
+
requestedAction = _f === void 0 ? 'SHOW_ID_FRONT' : _f,
|
|
16215
|
+
_g = _a.isBackToFront,
|
|
16216
|
+
isBackToFront = _g === void 0 ? false : _g,
|
|
16217
|
+
_h = _a.images,
|
|
16218
|
+
images = _h === void 0 ? defaultIdCaptureGuideImages : _h,
|
|
16219
|
+
_j = _a.classNames,
|
|
16220
|
+
classNames = _j === void 0 ? {} : _j,
|
|
16221
|
+
_k = _a.colors,
|
|
16222
|
+
colors = _k === void 0 ? {} : _k,
|
|
16223
|
+
_l = _a.verbiage,
|
|
16224
|
+
rawVerbiage = _l === void 0 ? {} : _l;
|
|
16169
16225
|
var state = useIdCaptureState()[0];
|
|
16170
|
-
var
|
|
16226
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
16227
|
+
return state.isRearFacing;
|
|
16228
|
+
});
|
|
16171
16229
|
var verbiage = useTranslations(rawVerbiage, {
|
|
16172
16230
|
instructionText: 'Scan the front of ID',
|
|
16173
16231
|
capturingText: 'Capturing...',
|
|
@@ -16179,7 +16237,7 @@
|
|
|
16179
16237
|
status: status,
|
|
16180
16238
|
progress: progress,
|
|
16181
16239
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
16182
|
-
isMirrored: !
|
|
16240
|
+
isMirrored: !isRearFacing,
|
|
16183
16241
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
16184
16242
|
imageVisible: requestedAction === 'FLIP_ID' || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
|
|
16185
16243
|
})), guideType === 'fit' && ( /*#__PURE__*/React.createElement(IdCaptureFitGuide, {
|
|
@@ -16189,7 +16247,7 @@
|
|
|
16189
16247
|
status: status,
|
|
16190
16248
|
progress: progress,
|
|
16191
16249
|
instruction: state.captureFailed ? verbiage.captureFailedText : state.capturing ? verbiage === null || verbiage === void 0 ? void 0 : verbiage.capturingText : verbiage.instructionText,
|
|
16192
|
-
isMirrored: !
|
|
16250
|
+
isMirrored: !isRearFacing,
|
|
16193
16251
|
isBackToFront: isBackToFront,
|
|
16194
16252
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
16195
16253
|
borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
|
|
@@ -16288,48 +16346,6 @@
|
|
|
16288
16346
|
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"])));
|
|
16289
16347
|
var templateObject_1$q, templateObject_2$m, templateObject_3$h, templateObject_4$b;
|
|
16290
16348
|
|
|
16291
|
-
var CameraVideoTag = function CameraVideoTag(_a) {
|
|
16292
|
-
var _b;
|
|
16293
|
-
var className = _a.className;
|
|
16294
|
-
var _c = React.useContext(CameraStateContext),
|
|
16295
|
-
videoRef = _c.videoRef,
|
|
16296
|
-
setVideoLoaded = _c.setVideoLoaded,
|
|
16297
|
-
onVideoUnmounted = _c.onVideoUnmounted,
|
|
16298
|
-
cameraRef = _c.cameraRef;
|
|
16299
|
-
React.useEffect(function notifyCameraProviderOfUnmount() {
|
|
16300
|
-
var videoElement = videoRef.current;
|
|
16301
|
-
if (!videoElement) return;
|
|
16302
|
-
return function () {
|
|
16303
|
-
onVideoUnmounted(videoElement);
|
|
16304
|
-
};
|
|
16305
|
-
}, [onVideoUnmounted, videoRef]);
|
|
16306
|
-
React.useEffect(function setVideoLoadedToFalseOnMount() {
|
|
16307
|
-
setVideoLoaded(false);
|
|
16308
|
-
}, [setVideoLoaded]);
|
|
16309
|
-
React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
16310
|
-
var _a;
|
|
16311
|
-
if (videoRef.current && ((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.stream)) {
|
|
16312
|
-
videoRef.current.srcObject = cameraRef.current.stream;
|
|
16313
|
-
}
|
|
16314
|
-
}, [cameraRef, videoRef]);
|
|
16315
|
-
var onLoadedData = React.useCallback(function () {
|
|
16316
|
-
setVideoLoaded(true);
|
|
16317
|
-
}, [setVideoLoaded]);
|
|
16318
|
-
return /*#__PURE__*/React.createElement(FullscreenVideoTag, {
|
|
16319
|
-
className: className,
|
|
16320
|
-
autoPlay: true,
|
|
16321
|
-
playsInline: true,
|
|
16322
|
-
muted: true,
|
|
16323
|
-
ref: videoRef,
|
|
16324
|
-
onLoadedData: onLoadedData,
|
|
16325
|
-
"$isRearFacing": (_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing
|
|
16326
|
-
});
|
|
16327
|
-
};
|
|
16328
|
-
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) {
|
|
16329
|
-
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
16330
|
-
});
|
|
16331
|
-
var templateObject_1$p;
|
|
16332
|
-
|
|
16333
16349
|
var documentCaptureInitialState = {
|
|
16334
16350
|
documents: [],
|
|
16335
16351
|
currentDocumentIndex: 0,
|
|
@@ -16448,8 +16464,8 @@
|
|
|
16448
16464
|
var _c = React.useReducer(documentCaptureStateReducer, documentCaptureInitialState),
|
|
16449
16465
|
state = _c[0],
|
|
16450
16466
|
dispatch = _c[1];
|
|
16451
|
-
var _d =
|
|
16452
|
-
|
|
16467
|
+
var _d = useCameraStore(),
|
|
16468
|
+
videoStream = _d.videoStream,
|
|
16453
16469
|
videoRef = _d.videoRef;
|
|
16454
16470
|
var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
|
|
16455
16471
|
var uploadCapturedDocument = React.useCallback(function (content, filetype) {
|
|
@@ -16540,8 +16556,7 @@
|
|
|
16540
16556
|
}, [onResize]);
|
|
16541
16557
|
var videoTag = videoRef.current;
|
|
16542
16558
|
React.useEffect(function () {
|
|
16543
|
-
if (!state.capturing) return;
|
|
16544
|
-
if (!cameraRef.current) return;
|
|
16559
|
+
if (!state.capturing || !(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active)) return;
|
|
16545
16560
|
function onComplete(content) {
|
|
16546
16561
|
if (!content) return;
|
|
16547
16562
|
var contentUrl = URL.createObjectURL(content);
|
|
@@ -16554,7 +16569,7 @@
|
|
|
16554
16569
|
});
|
|
16555
16570
|
}
|
|
16556
16571
|
if (typeof ImageCapture !== 'undefined') {
|
|
16557
|
-
var tracks =
|
|
16572
|
+
var tracks = videoStream.getTracks();
|
|
16558
16573
|
var videoCameraTrack = tracks.find(function (track) {
|
|
16559
16574
|
return track.kind === 'video';
|
|
16560
16575
|
});
|
|
@@ -16569,7 +16584,7 @@
|
|
|
16569
16584
|
drawToCanvas(canvas, videoTag);
|
|
16570
16585
|
canvas.toBlob(onComplete);
|
|
16571
16586
|
}
|
|
16572
|
-
}, [
|
|
16587
|
+
}, [state.capturing, videoStream, videoTag]);
|
|
16573
16588
|
var stateWithActions = React.useMemo(function () {
|
|
16574
16589
|
return _assign(_assign({}, state), {
|
|
16575
16590
|
uploadCapturedDocument: uploadCapturedDocument
|
|
@@ -16684,52 +16699,85 @@
|
|
|
16684
16699
|
ref: canvasRef
|
|
16685
16700
|
}));
|
|
16686
16701
|
};
|
|
16687
|
-
var CanvasWrapper = styled.div(templateObject_1$
|
|
16702
|
+
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) {
|
|
16688
16703
|
return props.$maskColor;
|
|
16689
16704
|
});
|
|
16690
16705
|
var Canvas = styled.canvas(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n display: block;\n"], ["\n display: block;\n"])));
|
|
16691
|
-
var templateObject_1$
|
|
16706
|
+
var templateObject_1$p, templateObject_2$l;
|
|
16692
16707
|
|
|
16693
|
-
var CameraFeedWrapper = styled.div(templateObject_1$
|
|
16708
|
+
var CameraFeedWrapper = styled.div(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) {
|
|
16694
16709
|
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;") : "";
|
|
16695
16710
|
});
|
|
16711
|
+
var templateObject_1$o;
|
|
16712
|
+
|
|
16713
|
+
var CameraVideoTag = function CameraVideoTag(props) {
|
|
16714
|
+
var _a = useCameraStore(useShallow(function (store) {
|
|
16715
|
+
return {
|
|
16716
|
+
videoRef: store.videoRef,
|
|
16717
|
+
videoStream: store.videoStream,
|
|
16718
|
+
onVideoMounted: store.onVideoMounted,
|
|
16719
|
+
isRearFacing: store.isRearFacing
|
|
16720
|
+
};
|
|
16721
|
+
})),
|
|
16722
|
+
videoRef = _a.videoRef,
|
|
16723
|
+
videoStream = _a.videoStream,
|
|
16724
|
+
onVideoMounted = _a.onVideoMounted,
|
|
16725
|
+
isRearFacing = _a.isRearFacing;
|
|
16726
|
+
React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
|
|
16727
|
+
if (videoRef.current && videoStream) {
|
|
16728
|
+
debug('attaching camera stream to video tag');
|
|
16729
|
+
videoRef.current.srcObject = videoStream;
|
|
16730
|
+
}
|
|
16731
|
+
}, [videoStream, videoRef]);
|
|
16732
|
+
return /*#__PURE__*/React.createElement(FullscreenVideoTag, _assign({
|
|
16733
|
+
autoPlay: true,
|
|
16734
|
+
playsInline: true,
|
|
16735
|
+
muted: true,
|
|
16736
|
+
ref: videoRef,
|
|
16737
|
+
onLoadedData: onVideoMounted,
|
|
16738
|
+
"$isRearFacing": isRearFacing
|
|
16739
|
+
}, props));
|
|
16740
|
+
};
|
|
16741
|
+
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) {
|
|
16742
|
+
return props.$isRearFacing ? '' : 'scaleX(-1)';
|
|
16743
|
+
});
|
|
16696
16744
|
var templateObject_1$n;
|
|
16697
16745
|
|
|
16698
16746
|
var DocumentCaptureScreen = function DocumentCaptureScreen(_a) {
|
|
16699
|
-
var _b, _c, _d, _e, _f
|
|
16747
|
+
var _b, _c, _d, _e, _f;
|
|
16700
16748
|
var onCaptureClicked = _a.onCaptureClicked,
|
|
16701
|
-
|
|
16702
|
-
classNames =
|
|
16703
|
-
|
|
16704
|
-
rawVerbiage =
|
|
16705
|
-
var
|
|
16706
|
-
|
|
16707
|
-
documents =
|
|
16708
|
-
currentDocumentIndex =
|
|
16709
|
-
rectX =
|
|
16710
|
-
rectY =
|
|
16711
|
-
rectWidth =
|
|
16712
|
-
rectHeight =
|
|
16713
|
-
rectOffsetTop =
|
|
16714
|
-
capturing =
|
|
16715
|
-
uploadCapturedDocument =
|
|
16716
|
-
dispatch =
|
|
16717
|
-
var
|
|
16718
|
-
title =
|
|
16719
|
-
aspectRatio =
|
|
16720
|
-
cameraFeedMode =
|
|
16721
|
-
instructions =
|
|
16722
|
-
contentUrl =
|
|
16723
|
-
content =
|
|
16724
|
-
uploadState =
|
|
16725
|
-
var
|
|
16726
|
-
|
|
16727
|
-
cameraReady =
|
|
16728
|
-
cameraAccessDenied =
|
|
16729
|
-
requestCameraAccess =
|
|
16730
|
-
var
|
|
16731
|
-
cameraAccessRequested =
|
|
16732
|
-
setCameraAccessRequested =
|
|
16749
|
+
_g = _a.classNames,
|
|
16750
|
+
classNames = _g === void 0 ? {} : _g,
|
|
16751
|
+
_h = _a.verbiage,
|
|
16752
|
+
rawVerbiage = _h === void 0 ? {} : _h;
|
|
16753
|
+
var _j = useDocumentCaptureState(),
|
|
16754
|
+
_k = _j[0],
|
|
16755
|
+
documents = _k.documents,
|
|
16756
|
+
currentDocumentIndex = _k.currentDocumentIndex,
|
|
16757
|
+
rectX = _k.rectX,
|
|
16758
|
+
rectY = _k.rectY,
|
|
16759
|
+
rectWidth = _k.rectWidth,
|
|
16760
|
+
rectHeight = _k.rectHeight,
|
|
16761
|
+
rectOffsetTop = _k.rectOffsetTop,
|
|
16762
|
+
capturing = _k.capturing,
|
|
16763
|
+
uploadCapturedDocument = _k.uploadCapturedDocument,
|
|
16764
|
+
dispatch = _j[1];
|
|
16765
|
+
var _l = (_b = documents[currentDocumentIndex]) !== null && _b !== void 0 ? _b : {},
|
|
16766
|
+
title = _l.title,
|
|
16767
|
+
aspectRatio = _l.aspectRatio,
|
|
16768
|
+
cameraFeedMode = _l.cameraFeedMode,
|
|
16769
|
+
instructions = _l.instructions,
|
|
16770
|
+
contentUrl = _l.contentUrl,
|
|
16771
|
+
content = _l.content,
|
|
16772
|
+
uploadState = _l.uploadState;
|
|
16773
|
+
var _m = useCameraStore(),
|
|
16774
|
+
videoStream = _m.videoStream,
|
|
16775
|
+
cameraReady = _m.cameraReady,
|
|
16776
|
+
cameraAccessDenied = _m.cameraAccessDenied,
|
|
16777
|
+
requestCameraAccess = _m.requestCameraAccess;
|
|
16778
|
+
var _o = React.useState(false),
|
|
16779
|
+
cameraAccessRequested = _o[0],
|
|
16780
|
+
setCameraAccessRequested = _o[1];
|
|
16733
16781
|
var cameraAccessNeeded =
|
|
16734
16782
|
// we should force the browser to ask for camera access if...
|
|
16735
16783
|
uploadState === 'not_started' &&
|
|
@@ -16738,14 +16786,14 @@
|
|
|
16738
16786
|
// and the user hasn't passed a media blob for the current document...
|
|
16739
16787
|
!cameraAccessRequested &&
|
|
16740
16788
|
// and we haven't already tried to force a camera request...
|
|
16741
|
-
!(
|
|
16789
|
+
!(videoStream === null || videoStream === void 0 ? void 0 : videoStream.active); // and we don't already have camera access.
|
|
16742
16790
|
React.useEffect(function requestCameraAccessIfNeeded() {
|
|
16743
16791
|
if (!cameraAccessNeeded) return;
|
|
16744
16792
|
setCameraAccessRequested(true);
|
|
16745
16793
|
requestCameraAccess();
|
|
16746
16794
|
}, [cameraAccessNeeded, requestCameraAccess]);
|
|
16747
16795
|
var theme = styled.useTheme();
|
|
16748
|
-
var maskColor = (
|
|
16796
|
+
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)";
|
|
16749
16797
|
var verbiage = useTranslations(rawVerbiage, {
|
|
16750
16798
|
headingText: title,
|
|
16751
16799
|
loadingBtnText: 'Camera initializing...',
|
|
@@ -16778,7 +16826,7 @@
|
|
|
16778
16826
|
});
|
|
16779
16827
|
}
|
|
16780
16828
|
return /*#__PURE__*/React.createElement(PageContainer, {
|
|
16781
|
-
className: "flex ".concat((
|
|
16829
|
+
className: "flex ".concat((_f = classNames.container) !== null && _f !== void 0 ? _f : '')
|
|
16782
16830
|
}, /*#__PURE__*/React.createElement(CameraFeedWrapper, {
|
|
16783
16831
|
className: classNames.cameraFeedWrapper,
|
|
16784
16832
|
"$mode": cameraFeedMode !== null && cameraFeedMode !== void 0 ? cameraFeedMode : 'snapToGuides',
|
|
@@ -17203,7 +17251,7 @@
|
|
|
17203
17251
|
var _3 = useIdCaptureState(),
|
|
17204
17252
|
state = _3[0],
|
|
17205
17253
|
dispatch = _3[1];
|
|
17206
|
-
var _4 =
|
|
17254
|
+
var _4 = useCameraStore(),
|
|
17207
17255
|
cameraAccessDenied = _4.cameraAccessDenied,
|
|
17208
17256
|
requestCameraAccess = _4.requestCameraAccess,
|
|
17209
17257
|
releaseCameraAccess = _4.releaseCameraAccess;
|
|
@@ -17328,7 +17376,7 @@
|
|
|
17328
17376
|
type: 'resetWizard'
|
|
17329
17377
|
});
|
|
17330
17378
|
onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
|
|
17331
|
-
requestCameraAccess();
|
|
17379
|
+
void requestCameraAccess();
|
|
17332
17380
|
}, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
|
|
17333
17381
|
React.useEffect(function () {
|
|
17334
17382
|
if (submissionStatus !== SubmissionStatus.READY) {
|
|
@@ -18151,7 +18199,13 @@
|
|
|
18151
18199
|
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
18152
18200
|
_d = _a.requireVerticalFaceCentering,
|
|
18153
18201
|
requireVerticalFaceCentering = _d === void 0 ? true : _d;
|
|
18154
|
-
var _e =
|
|
18202
|
+
var _e = useCameraStore(useShallow(function (state) {
|
|
18203
|
+
return {
|
|
18204
|
+
videoRef: state.videoRef,
|
|
18205
|
+
videoLoaded: state.videoLoaded,
|
|
18206
|
+
cameraReady: state.cameraReady
|
|
18207
|
+
};
|
|
18208
|
+
})),
|
|
18155
18209
|
videoRef = _e.videoRef,
|
|
18156
18210
|
videoLoaded = _e.videoLoaded,
|
|
18157
18211
|
cameraReady = _e.cameraReady;
|
|
@@ -18159,7 +18213,8 @@
|
|
|
18159
18213
|
var onPredictionHandler = React.useRef();
|
|
18160
18214
|
var _f = useLoadFaceDetector({
|
|
18161
18215
|
onModelError: onModelError,
|
|
18162
|
-
modelLoadTimeoutMs: modelLoadTimeoutMs
|
|
18216
|
+
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
18217
|
+
videoRef: videoRef
|
|
18163
18218
|
}),
|
|
18164
18219
|
ready = _f.ready,
|
|
18165
18220
|
modelDownloadProgress = _f.modelDownloadProgress,
|
|
@@ -18492,8 +18547,14 @@
|
|
|
18492
18547
|
prediction = _t.prediction,
|
|
18493
18548
|
dispatch = _s[1];
|
|
18494
18549
|
var lastPredictionCanvas = React.useRef(null);
|
|
18495
|
-
var _u =
|
|
18496
|
-
|
|
18550
|
+
var _u = useCameraStore(useShallow(function (state) {
|
|
18551
|
+
return {
|
|
18552
|
+
camera: state.camera,
|
|
18553
|
+
cameraReady: state.cameraReady,
|
|
18554
|
+
videoRef: state.videoRef
|
|
18555
|
+
};
|
|
18556
|
+
})),
|
|
18557
|
+
camera = _u.camera,
|
|
18497
18558
|
videoRef = _u.videoRef;
|
|
18498
18559
|
var _v = React.useContext(SelfieGuidanceModelsContext),
|
|
18499
18560
|
onPredictionMade = _v.onPredictionMade,
|
|
@@ -18583,7 +18644,7 @@
|
|
|
18583
18644
|
face: prediction.face,
|
|
18584
18645
|
scaling: debugScalingDetails,
|
|
18585
18646
|
color: satisfied ? 'green' : 'red'
|
|
18586
|
-
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null,
|
|
18647
|
+
}))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? '✅' : '❌', " Face Centered", /*#__PURE__*/React.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.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React.createElement("br", null), !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) ? '✅' : '❌', " Face Is Stable", /*#__PURE__*/React.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.createElement(ExitCaptureButton, {
|
|
18587
18648
|
onClick: onExit,
|
|
18588
18649
|
className: classNames.exitCaptureBtn
|
|
18589
18650
|
}));
|
|
@@ -19039,7 +19100,9 @@
|
|
|
19039
19100
|
colors = _e === void 0 ? {} : _e,
|
|
19040
19101
|
_f = _a.verbiage,
|
|
19041
19102
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
19042
|
-
var requestMicrophoneAccess =
|
|
19103
|
+
var requestMicrophoneAccess = useCameraStore(function (state) {
|
|
19104
|
+
return state.requestMicrophoneAccess;
|
|
19105
|
+
});
|
|
19043
19106
|
assets.imageUrl || (assets.imageUrl = DEFAULT_CDN_URL + '/microphone-disable-icon.svg');
|
|
19044
19107
|
var verbiage = useTranslations(rawVerbiage, {
|
|
19045
19108
|
headingText: 'Your microphone permission is disabled',
|
|
@@ -19087,7 +19150,13 @@
|
|
|
19087
19150
|
colors = _e === void 0 ? {} : _e,
|
|
19088
19151
|
_f = _a.verbiage,
|
|
19089
19152
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
19090
|
-
var _g =
|
|
19153
|
+
var _g = useCameraStore(useShallow(function (state) {
|
|
19154
|
+
return {
|
|
19155
|
+
cameraReady: state.cameraReady,
|
|
19156
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
19157
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
19158
|
+
};
|
|
19159
|
+
})),
|
|
19091
19160
|
cameraReady = _g.cameraReady,
|
|
19092
19161
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
19093
19162
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -19174,7 +19243,13 @@
|
|
|
19174
19243
|
colors = _e === void 0 ? {} : _e,
|
|
19175
19244
|
_f = _a.verbiage,
|
|
19176
19245
|
rawVerbiage = _f === void 0 ? {} : _f;
|
|
19177
|
-
var _g =
|
|
19246
|
+
var _g = useCameraStore(useShallow(function (state) {
|
|
19247
|
+
return {
|
|
19248
|
+
cameraReady: state.cameraReady,
|
|
19249
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
19250
|
+
microphoneAccessDenied: state.microphoneAccessDenied
|
|
19251
|
+
};
|
|
19252
|
+
})),
|
|
19178
19253
|
cameraReady = _g.cameraReady,
|
|
19179
19254
|
cameraAccessDenied = _g.cameraAccessDenied,
|
|
19180
19255
|
microphoneAccessDenied = _g.microphoneAccessDenied;
|
|
@@ -19391,7 +19466,13 @@
|
|
|
19391
19466
|
livenessCheckRequest = _t.livenessCheckRequest,
|
|
19392
19467
|
setSelfieImage = _t.setSelfieImage,
|
|
19393
19468
|
logSelfieCaptureAttempt = _t.logSelfieCaptureAttempt;
|
|
19394
|
-
var _u =
|
|
19469
|
+
var _u = useCameraStore(useShallow(function (state) {
|
|
19470
|
+
return {
|
|
19471
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
19472
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
19473
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
19474
|
+
};
|
|
19475
|
+
})),
|
|
19395
19476
|
cameraAccessDenied = _u.cameraAccessDenied,
|
|
19396
19477
|
requestCameraAccess = _u.requestCameraAccess,
|
|
19397
19478
|
releaseCameraAccess = _u.releaseCameraAccess;
|
|
@@ -20880,10 +20961,10 @@
|
|
|
20880
20961
|
setSignatureVideoUrl = _e[1];
|
|
20881
20962
|
var signatureRecorder = React.useRef(null);
|
|
20882
20963
|
var recordedChunks = React.useRef([]);
|
|
20883
|
-
var _f =
|
|
20884
|
-
|
|
20964
|
+
var _f = useCameraStore(),
|
|
20965
|
+
camera = _f.camera,
|
|
20885
20966
|
videoRef = _f.videoRef;
|
|
20886
|
-
var _g = useVideoRecorder(
|
|
20967
|
+
var _g = useVideoRecorder(camera),
|
|
20887
20968
|
isRecordingVideo = _g.isRecordingVideo,
|
|
20888
20969
|
startRecordingVideo = _g.startRecordingVideo,
|
|
20889
20970
|
stopRecordingVideo = _g.stopRecordingVideo,
|
|
@@ -20951,8 +21032,8 @@
|
|
|
20951
21032
|
var animationFrame = React.useRef(0);
|
|
20952
21033
|
React.useEffect(function () {
|
|
20953
21034
|
var _a;
|
|
20954
|
-
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !
|
|
20955
|
-
var _b = [
|
|
21035
|
+
if (!signaturePad.current || !videoRef.current || !outputCanvas.current || !camera || !isRecording || !isRecordingVideo) return;
|
|
21036
|
+
var _b = [camera.width, camera.height],
|
|
20956
21037
|
w = _b[0],
|
|
20957
21038
|
h = _b[1];
|
|
20958
21039
|
var isPortrait = typeof window !== 'undefined' && window.innerWidth < window.innerHeight;
|
|
@@ -20985,7 +21066,7 @@
|
|
|
20985
21066
|
return function () {
|
|
20986
21067
|
cancelAnimationFrame(animationFrame.current);
|
|
20987
21068
|
};
|
|
20988
|
-
}, [
|
|
21069
|
+
}, [camera, isRecording, isRecordingVideo, videoRef]);
|
|
20989
21070
|
var onAcceptClicked = React.useCallback(function () {
|
|
20990
21071
|
return __awaiter(_this, void 0, void 0, function () {
|
|
20991
21072
|
var imageUrl;
|
|
@@ -21114,27 +21195,29 @@
|
|
|
21114
21195
|
var templateObject_1$9, templateObject_2$8, templateObject_3$8, templateObject_4$3, templateObject_5$2, templateObject_6$2, templateObject_7$1;
|
|
21115
21196
|
|
|
21116
21197
|
var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
21117
|
-
var _b
|
|
21198
|
+
var _b;
|
|
21118
21199
|
var onVideoCaptured = _a.onVideoCaptured,
|
|
21119
21200
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
21120
21201
|
onExit = _a.onExit,
|
|
21121
21202
|
guidesComponent = _a.guidesComponent,
|
|
21122
|
-
|
|
21123
|
-
classNames =
|
|
21124
|
-
|
|
21125
|
-
colors =
|
|
21126
|
-
|
|
21127
|
-
rawVerbiage =
|
|
21128
|
-
|
|
21129
|
-
debugMode =
|
|
21130
|
-
var
|
|
21203
|
+
_c = _a.classNames,
|
|
21204
|
+
classNames = _c === void 0 ? {} : _c,
|
|
21205
|
+
_d = _a.colors,
|
|
21206
|
+
colors = _d === void 0 ? {} : _d,
|
|
21207
|
+
_e = _a.verbiage,
|
|
21208
|
+
rawVerbiage = _e === void 0 ? {} : _e,
|
|
21209
|
+
_f = _a.debugMode,
|
|
21210
|
+
debugMode = _f === void 0 ? false : _f;
|
|
21211
|
+
var camera = useCameraStore(function (state) {
|
|
21212
|
+
return state.camera;
|
|
21213
|
+
});
|
|
21131
21214
|
var onPredictionMade = React.useContext(SelfieGuidanceModelsContext).onPredictionMade;
|
|
21132
|
-
var
|
|
21133
|
-
signatureData =
|
|
21134
|
-
signatureDataUrl =
|
|
21135
|
-
signatureVideoData =
|
|
21136
|
-
startRecording =
|
|
21137
|
-
stopRecording =
|
|
21215
|
+
var _g = useVideoSignatureContext(),
|
|
21216
|
+
signatureData = _g.signatureData,
|
|
21217
|
+
signatureDataUrl = _g.signatureDataUrl,
|
|
21218
|
+
signatureVideoData = _g.signatureVideoData,
|
|
21219
|
+
startRecording = _g.startRecording,
|
|
21220
|
+
stopRecording = _g.stopRecording;
|
|
21138
21221
|
React.useEffect(function () {
|
|
21139
21222
|
startRecording();
|
|
21140
21223
|
return function () {
|
|
@@ -21151,9 +21234,9 @@
|
|
|
21151
21234
|
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(signatureVideoData, signatureData, signatureDataUrl);
|
|
21152
21235
|
}
|
|
21153
21236
|
}, [onVideoCaptured, signatureData, signatureDataUrl, signatureVideoData]);
|
|
21154
|
-
var
|
|
21155
|
-
numFramesWithoutFaces =
|
|
21156
|
-
setNumFramesWithoutFaces =
|
|
21237
|
+
var _h = React.useState(0),
|
|
21238
|
+
numFramesWithoutFaces = _h[0],
|
|
21239
|
+
setNumFramesWithoutFaces = _h[1];
|
|
21157
21240
|
React.useEffect(function () {
|
|
21158
21241
|
onPredictionMade(function (_a) {
|
|
21159
21242
|
var face = _a.face;
|
|
@@ -21180,7 +21263,7 @@
|
|
|
21180
21263
|
}, verbiage.guidanceMessageText))), /*#__PURE__*/React.createElement(GuidesComponent, {
|
|
21181
21264
|
classNames: classNames.videoSignatureGuidesClassNames,
|
|
21182
21265
|
status: "success"
|
|
21183
|
-
}), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, "Video: ",
|
|
21266
|
+
}), debugMode && ( /*#__PURE__*/React.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.createElement(ExitCaptureButton, {
|
|
21184
21267
|
onClick: onExit,
|
|
21185
21268
|
className: classNames.exitCaptureBtn
|
|
21186
21269
|
}));
|
|
@@ -21274,7 +21357,13 @@
|
|
|
21274
21357
|
setSignatureData = _l.setSignatureData,
|
|
21275
21358
|
setSignatureVideoUrl = _l.setSignatureVideoUrl,
|
|
21276
21359
|
logSelfieCaptureAttempt = _l.logSelfieCaptureAttempt;
|
|
21277
|
-
var _m =
|
|
21360
|
+
var _m = useCameraStore(useShallow(function (state) {
|
|
21361
|
+
return {
|
|
21362
|
+
cameraAccessDenied: state.cameraAccessDenied,
|
|
21363
|
+
requestCameraAccess: state.requestCameraAccess,
|
|
21364
|
+
releaseCameraAccess: state.releaseCameraAccess
|
|
21365
|
+
};
|
|
21366
|
+
})),
|
|
21278
21367
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
21279
21368
|
requestCameraAccess = _m.requestCameraAccess,
|
|
21280
21369
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
@@ -21434,27 +21523,29 @@
|
|
|
21434
21523
|
};
|
|
21435
21524
|
|
|
21436
21525
|
var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
|
|
21437
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y
|
|
21438
|
-
var
|
|
21439
|
-
requestedAction =
|
|
21440
|
-
|
|
21441
|
-
satisfied =
|
|
21442
|
-
|
|
21443
|
-
faceGuideStatus =
|
|
21526
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
21527
|
+
var _z = _a.requestedAction,
|
|
21528
|
+
requestedAction = _z === void 0 ? 'SHOW_ID_FRONT' : _z,
|
|
21529
|
+
_0 = _a.satisfied,
|
|
21530
|
+
satisfied = _0 === void 0 ? false : _0,
|
|
21531
|
+
_1 = _a.faceGuideStatus,
|
|
21532
|
+
faceGuideStatus = _1 === void 0 ? 'success' : _1,
|
|
21444
21533
|
faceGuideBorderWidth = _a.faceGuideBorderWidth,
|
|
21445
21534
|
faceGuideBorderColor = _a.faceGuideBorderColor,
|
|
21446
|
-
|
|
21447
|
-
idCardGuideStatus =
|
|
21535
|
+
_2 = _a.idCardGuideStatus,
|
|
21536
|
+
idCardGuideStatus = _2 === void 0 ? 'ready' : _2,
|
|
21448
21537
|
idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
|
|
21449
21538
|
idCardGuideBorderColor = _a.idCardGuideBorderColor,
|
|
21450
21539
|
idCardCaptureProgress = _a.idCardCaptureProgress,
|
|
21451
|
-
|
|
21452
|
-
userSuppliedImages =
|
|
21453
|
-
|
|
21454
|
-
classNames =
|
|
21455
|
-
|
|
21456
|
-
rawVerbiage =
|
|
21457
|
-
var
|
|
21540
|
+
_3 = _a.idCardCaptureGuideImages,
|
|
21541
|
+
userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
|
|
21542
|
+
_4 = _a.classNames,
|
|
21543
|
+
classNames = _4 === void 0 ? {} : _4,
|
|
21544
|
+
_5 = _a.verbiage,
|
|
21545
|
+
rawVerbiage = _5 === void 0 ? {} : _5;
|
|
21546
|
+
var isRearFacing = useCameraStore(function (state) {
|
|
21547
|
+
return state.isRearFacing;
|
|
21548
|
+
});
|
|
21458
21549
|
var verbiage = useTranslations(rawVerbiage, {
|
|
21459
21550
|
idFrontInstructionText: 'Display the front of your ID card...',
|
|
21460
21551
|
idBackInstructionText: 'Display the back of your ID card...',
|
|
@@ -21467,17 +21558,17 @@
|
|
|
21467
21558
|
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';
|
|
21468
21559
|
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;
|
|
21469
21560
|
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';
|
|
21470
|
-
var
|
|
21471
|
-
idCardGuideRef =
|
|
21472
|
-
|
|
21473
|
-
idCardGuideWidth =
|
|
21474
|
-
|
|
21475
|
-
idCardGuideHeight =
|
|
21561
|
+
var _6 = useResizeObserver(),
|
|
21562
|
+
idCardGuideRef = _6.ref,
|
|
21563
|
+
_7 = _6.width,
|
|
21564
|
+
idCardGuideWidth = _7 === void 0 ? 0 : _7,
|
|
21565
|
+
_8 = _6.height,
|
|
21566
|
+
idCardGuideHeight = _8 === void 0 ? 0 : _8;
|
|
21476
21567
|
var idCaptureGuideImages = useGuideImages(userSuppliedImages);
|
|
21477
21568
|
var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
|
|
21478
|
-
var
|
|
21479
|
-
aspectRatio =
|
|
21480
|
-
setAspectRatio =
|
|
21569
|
+
var _9 = React.useState(undefined),
|
|
21570
|
+
aspectRatio = _9[0],
|
|
21571
|
+
setAspectRatio = _9[1];
|
|
21481
21572
|
var onImageLoaded = React.useCallback(function (e) {
|
|
21482
21573
|
var _a, _b, _c, _d;
|
|
21483
21574
|
var img = e.currentTarget;
|
|
@@ -21524,7 +21615,7 @@
|
|
|
21524
21615
|
}, /*#__PURE__*/React.createElement(IdCardGuideImage, {
|
|
21525
21616
|
alt: "",
|
|
21526
21617
|
className: classNames.idCardGuideImage,
|
|
21527
|
-
"$isMirrored": !
|
|
21618
|
+
"$isMirrored": !isRearFacing,
|
|
21528
21619
|
style: idCardImageStyle,
|
|
21529
21620
|
src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
|
|
21530
21621
|
onLoad: onImageLoaded
|
|
@@ -21538,8 +21629,8 @@
|
|
|
21538
21629
|
className: classNames.idCardGuideInstructionsContainer
|
|
21539
21630
|
}, /*#__PURE__*/React.createElement(IdCardGuideInstructions, {
|
|
21540
21631
|
className: classNames.idCardGuideInstructions,
|
|
21541
|
-
"$textColor": (
|
|
21542
|
-
"$background": (
|
|
21632
|
+
"$textColor": (_w = (_v = theme.idVideoCapture) === null || _v === void 0 ? void 0 : _v.idCardGuides) === null || _w === void 0 ? void 0 : _w.instructionsTextColor,
|
|
21633
|
+
"$background": (_y = (_x = theme.idVideoCapture) === null || _x === void 0 ? void 0 : _x.idCardGuides) === null || _y === void 0 ? void 0 : _y.instructionsBackgroundColor
|
|
21543
21634
|
}, instructionText))))));
|
|
21544
21635
|
};
|
|
21545
21636
|
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) {
|
|
@@ -21684,99 +21775,100 @@
|
|
|
21684
21775
|
flipShortcutThreshold: 0.7
|
|
21685
21776
|
};
|
|
21686
21777
|
var IdVideoCapture = function IdVideoCapture(_a) {
|
|
21687
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v
|
|
21778
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
21688
21779
|
var onComplete = _a.onComplete,
|
|
21689
21780
|
onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
|
|
21690
21781
|
onIdBackImageCaptured = _a.onIdBackImageCaptured,
|
|
21691
21782
|
onFaceNotDetected = _a.onFaceNotDetected,
|
|
21692
21783
|
onRecordingFailed = _a.onRecordingFailed,
|
|
21693
21784
|
onExitCapture = _a.onExitCapture,
|
|
21694
|
-
|
|
21695
|
-
idCaptureModelsEnabled =
|
|
21696
|
-
|
|
21697
|
-
idCardCaptureGuideImages =
|
|
21698
|
-
|
|
21699
|
-
idCardFrontDelay =
|
|
21700
|
-
|
|
21701
|
-
videoIdCaptureThresholds =
|
|
21702
|
-
|
|
21703
|
-
skipShowIdCardBack =
|
|
21704
|
-
|
|
21705
|
-
captureCountdownSeconds =
|
|
21785
|
+
_w = _a.idCaptureModelsEnabled,
|
|
21786
|
+
idCaptureModelsEnabled = _w === void 0 ? true : _w,
|
|
21787
|
+
_x = _a.idCardCaptureGuideImages,
|
|
21788
|
+
idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
|
|
21789
|
+
_y = _a.idCardFrontDelay,
|
|
21790
|
+
idCardFrontDelay = _y === void 0 ? 1000 : _y,
|
|
21791
|
+
_z = _a.videoIdCaptureThresholds,
|
|
21792
|
+
videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
|
|
21793
|
+
_0 = _a.skipShowIdCardBack,
|
|
21794
|
+
skipShowIdCardBack = _0 === void 0 ? false : _0,
|
|
21795
|
+
_1 = _a.captureCountdownSeconds,
|
|
21796
|
+
captureCountdownSeconds = _1 === void 0 ? 3 : _1,
|
|
21706
21797
|
readTextPrompt = _a.readTextPrompt,
|
|
21707
|
-
|
|
21708
|
-
readTextTimeoutDurationMs =
|
|
21709
|
-
|
|
21710
|
-
readTextMinReadingMs =
|
|
21711
|
-
|
|
21712
|
-
disableFaceDetectionWhileAudioCapture =
|
|
21713
|
-
|
|
21714
|
-
disableFaceDetectionWhileAudioCaptureMsDelay =
|
|
21715
|
-
|
|
21716
|
-
mergeAVStreams =
|
|
21717
|
-
|
|
21718
|
-
classNames =
|
|
21719
|
-
|
|
21720
|
-
colors =
|
|
21721
|
-
|
|
21722
|
-
rawVerbiage =
|
|
21723
|
-
|
|
21724
|
-
debugMode =
|
|
21725
|
-
var
|
|
21726
|
-
ref =
|
|
21727
|
-
|
|
21728
|
-
width =
|
|
21729
|
-
|
|
21730
|
-
height =
|
|
21731
|
-
var
|
|
21732
|
-
|
|
21733
|
-
videoRef =
|
|
21734
|
-
videoLoaded =
|
|
21735
|
-
cameraReady =
|
|
21736
|
-
microphoneReady =
|
|
21737
|
-
audioStream =
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
|
|
21798
|
+
_2 = _a.readTextTimeoutDurationMs,
|
|
21799
|
+
readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
|
|
21800
|
+
_3 = _a.readTextMinReadingMs,
|
|
21801
|
+
readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
|
|
21802
|
+
_4 = _a.disableFaceDetectionWhileAudioCapture,
|
|
21803
|
+
disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
|
|
21804
|
+
_5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
|
|
21805
|
+
disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
|
|
21806
|
+
_6 = _a.mergeAVStreams,
|
|
21807
|
+
mergeAVStreams = _6 === void 0 ? false : _6,
|
|
21808
|
+
_7 = _a.classNames,
|
|
21809
|
+
classNames = _7 === void 0 ? {} : _7,
|
|
21810
|
+
_8 = _a.colors,
|
|
21811
|
+
colors = _8 === void 0 ? {} : _8,
|
|
21812
|
+
_9 = _a.verbiage,
|
|
21813
|
+
rawVerbiage = _9 === void 0 ? {} : _9,
|
|
21814
|
+
_10 = _a.debugMode,
|
|
21815
|
+
debugMode = _10 === void 0 ? false : _10;
|
|
21816
|
+
var _11 = useResizeObserver(),
|
|
21817
|
+
ref = _11.ref,
|
|
21818
|
+
_12 = _11.width,
|
|
21819
|
+
width = _12 === void 0 ? 1 : _12,
|
|
21820
|
+
_13 = _11.height,
|
|
21821
|
+
height = _13 === void 0 ? 1 : _13;
|
|
21822
|
+
var _14 = useCameraStore(),
|
|
21823
|
+
camera = _14.camera,
|
|
21824
|
+
videoRef = _14.videoRef,
|
|
21825
|
+
videoLoaded = _14.videoLoaded,
|
|
21826
|
+
cameraReady = _14.cameraReady,
|
|
21827
|
+
microphoneReady = _14.microphoneReady,
|
|
21828
|
+
audioStream = _14.audioStream,
|
|
21829
|
+
isRearFacing = _14.isRearFacing,
|
|
21830
|
+
releaseCameraAccess = _14.releaseCameraAccess;
|
|
21831
|
+
var _15 = React.useState([]),
|
|
21832
|
+
detectedObjects = _15[0],
|
|
21833
|
+
setDetectedObjects = _15[1];
|
|
21834
|
+
var _16 = React.useState(null),
|
|
21835
|
+
face = _16[0],
|
|
21836
|
+
setFace = _16[1];
|
|
21837
|
+
var _17 = React.useContext(IdCaptureModelsContext),
|
|
21838
|
+
idModelsReady = _17.ready,
|
|
21839
|
+
startIdModels = _17.start,
|
|
21840
|
+
stopIdModels = _17.stop,
|
|
21841
|
+
onIdPredictionMade = _17.onPredictionMade,
|
|
21842
|
+
setThresholds = _17.setThresholds,
|
|
21843
|
+
setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
|
|
21844
|
+
bestFrameDetails = _17.bestFrameDetails,
|
|
21845
|
+
resetBestFrame = _17.resetBestFrame,
|
|
21846
|
+
idModelError = _17.modelError;
|
|
21847
|
+
var _18 = React.useState(null),
|
|
21848
|
+
videoStartsAt = _18[0],
|
|
21849
|
+
setVideoStartsAt = _18[1];
|
|
21850
|
+
var _19 = React.useContext(SubmissionContext),
|
|
21851
|
+
setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
|
|
21852
|
+
setExpectedAudioText = _19.setExpectedAudioText;
|
|
21853
|
+
var _20 = React.useContext(SelfieGuidanceModelsContext),
|
|
21854
|
+
startSelfieGuidance = _20.start,
|
|
21855
|
+
stopSelfieGuidance = _20.stop,
|
|
21856
|
+
onSelfiePredictionMade = _20.onPredictionMade,
|
|
21857
|
+
selfieModelError = _20.error;
|
|
21858
|
+
var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
|
|
21859
|
+
isRecordingVideo = _21.isRecordingVideo,
|
|
21860
|
+
startRecordingVideo = _21.startRecordingVideo,
|
|
21861
|
+
startRecordingAudio = _21.startRecordingAudio,
|
|
21862
|
+
stopRecordingVideo = _21.stopRecordingVideo,
|
|
21863
|
+
stopRecordingAudio = _21.stopRecordingAudio,
|
|
21864
|
+
videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
|
|
21865
|
+
audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
|
|
21866
|
+
videoUrl = _21.videoUrl,
|
|
21867
|
+
audioUrl = _21.audioUrl;
|
|
21776
21868
|
var countdownTimeoutRef = React.useRef(undefined);
|
|
21777
|
-
var
|
|
21778
|
-
countdownRemaining =
|
|
21779
|
-
setCountdownRemaining =
|
|
21869
|
+
var _22 = React.useState(-1),
|
|
21870
|
+
countdownRemaining = _22[0],
|
|
21871
|
+
setCountdownRemaining = _22[1];
|
|
21780
21872
|
React.useEffect(function () {
|
|
21781
21873
|
if (!isRecordingVideo && !videoUrl) {
|
|
21782
21874
|
startRecordingVideo();
|
|
@@ -21787,24 +21879,24 @@
|
|
|
21787
21879
|
var needsAudio = !!readTextPrompt && !mergeAVStreams;
|
|
21788
21880
|
var audioReady = !needsAudio || audioUrl;
|
|
21789
21881
|
if (videoUrl && audioReady) {
|
|
21790
|
-
|
|
21882
|
+
releaseCameraAccess();
|
|
21791
21883
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl, audioUrl);
|
|
21792
21884
|
}
|
|
21793
|
-
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt,
|
|
21885
|
+
}, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
|
|
21794
21886
|
React.useEffect(function () {
|
|
21795
|
-
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
|
|
21887
|
+
if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
|
|
21796
21888
|
onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
|
|
21797
21889
|
}
|
|
21798
|
-
}, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
|
|
21799
|
-
var
|
|
21800
|
-
requestedAction =
|
|
21801
|
-
setRequestedAction =
|
|
21890
|
+
}, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
|
|
21891
|
+
var _23 = React.useState('SHOW_ID_FRONT'),
|
|
21892
|
+
requestedAction = _23[0],
|
|
21893
|
+
setRequestedAction = _23[1];
|
|
21802
21894
|
var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
|
|
21803
21895
|
React.useEffect(function startModelsWhenCapturing() {
|
|
21804
21896
|
if (!shouldRunIdModels) return;
|
|
21805
21897
|
startIdModels();
|
|
21806
21898
|
return function () {
|
|
21807
|
-
stopIdModels();
|
|
21899
|
+
return stopIdModels();
|
|
21808
21900
|
};
|
|
21809
21901
|
}, [shouldRunIdModels, startIdModels, stopIdModels]);
|
|
21810
21902
|
React.useEffect(function () {
|
|
@@ -21818,18 +21910,18 @@
|
|
|
21818
21910
|
bottom: 1
|
|
21819
21911
|
});
|
|
21820
21912
|
}, [setDocumentDetectionBoundaries]);
|
|
21821
|
-
var
|
|
21822
|
-
currentDetectionScore =
|
|
21823
|
-
setCurrentDetectionScore =
|
|
21824
|
-
var
|
|
21825
|
-
currentDetectedDocumentType =
|
|
21826
|
-
setCurrentDetectedDocumentType =
|
|
21913
|
+
var _24 = React.useState(0),
|
|
21914
|
+
currentDetectionScore = _24[0],
|
|
21915
|
+
setCurrentDetectionScore = _24[1];
|
|
21916
|
+
var _25 = React.useState('none'),
|
|
21917
|
+
currentDetectedDocumentType = _25[0],
|
|
21918
|
+
setCurrentDetectedDocumentType = _25[1];
|
|
21919
|
+
var _26 = React.useState(0),
|
|
21920
|
+
currentFocusScore = _26[0],
|
|
21921
|
+
setCurrentFocusScore = _26[1];
|
|
21827
21922
|
var _27 = React.useState(0),
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
var _28 = React.useState(0),
|
|
21831
|
-
goodFramesCount = _28[0],
|
|
21832
|
-
setGoodFramesCount = _28[1];
|
|
21923
|
+
goodFramesCount = _27[0],
|
|
21924
|
+
setGoodFramesCount = _27[1];
|
|
21833
21925
|
var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
|
|
21834
21926
|
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
21835
21927
|
React.useEffect(function () {
|
|
@@ -21850,9 +21942,9 @@
|
|
|
21850
21942
|
} : 0);
|
|
21851
21943
|
});
|
|
21852
21944
|
}, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
|
|
21853
|
-
var
|
|
21854
|
-
idFrontCaptureStartedAt =
|
|
21855
|
-
setFirstGoodFrameTime =
|
|
21945
|
+
var _28 = React.useState(null),
|
|
21946
|
+
idFrontCaptureStartedAt = _28[0],
|
|
21947
|
+
setFirstGoodFrameTime = _28[1];
|
|
21856
21948
|
React.useEffect(function () {
|
|
21857
21949
|
if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
|
|
21858
21950
|
}, [goodFramesCount]);
|
|
@@ -21873,9 +21965,9 @@
|
|
|
21873
21965
|
var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
|
|
21874
21966
|
var faceBox = face === null || face === void 0 ? void 0 : face.box;
|
|
21875
21967
|
var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
|
|
21876
|
-
var
|
|
21877
|
-
countdownStartedAt =
|
|
21878
|
-
setCountdownStartedAt =
|
|
21968
|
+
var _29 = React.useState(),
|
|
21969
|
+
countdownStartedAt = _29[0],
|
|
21970
|
+
setCountdownStartedAt = _29[1];
|
|
21879
21971
|
var photoCanvas = React.useRef(null);
|
|
21880
21972
|
var frameLock = React.useRef(false);
|
|
21881
21973
|
var captureFrame = React.useCallback(function () {
|
|
@@ -21998,9 +22090,9 @@
|
|
|
21998
22090
|
stopSelfieGuidance();
|
|
21999
22091
|
};
|
|
22000
22092
|
}, [startSelfieGuidance, stopSelfieGuidance]);
|
|
22001
|
-
var
|
|
22002
|
-
numFramesWithoutFaces =
|
|
22003
|
-
setNumFramesWithoutFaces =
|
|
22093
|
+
var _30 = React.useState(0),
|
|
22094
|
+
numFramesWithoutFaces = _30[0],
|
|
22095
|
+
setNumFramesWithoutFaces = _30[1];
|
|
22004
22096
|
onSelfiePredictionMade(f(React.useCallback(function (_a) {
|
|
22005
22097
|
var face = _a.face;
|
|
22006
22098
|
if (selfieModelError) return;
|
|
@@ -22016,12 +22108,12 @@
|
|
|
22016
22108
|
}
|
|
22017
22109
|
}, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
|
|
22018
22110
|
var theme = styled.useTheme();
|
|
22019
|
-
var
|
|
22111
|
+
var _31 = useTranslations(rawVerbiage, {
|
|
22020
22112
|
faceNotCenteredText: 'Please move your face to the center...',
|
|
22021
22113
|
captureBtnText: 'Capture'
|
|
22022
22114
|
}),
|
|
22023
|
-
captureBtnText =
|
|
22024
|
-
faceNotCenteredText =
|
|
22115
|
+
captureBtnText = _31.captureBtnText,
|
|
22116
|
+
faceNotCenteredText = _31.faceNotCenteredText;
|
|
22025
22117
|
var debugScalingDetails = useDebugScalingDetails({
|
|
22026
22118
|
enabled: debugMode,
|
|
22027
22119
|
pageWidth: width,
|
|
@@ -22030,8 +22122,6 @@
|
|
|
22030
22122
|
videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
|
|
22031
22123
|
});
|
|
22032
22124
|
var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
|
|
22033
|
-
// const searchingForIdCard =
|
|
22034
|
-
// idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet
|
|
22035
22125
|
var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
|
|
22036
22126
|
return /*#__PURE__*/React.createElement(PageContainer, {
|
|
22037
22127
|
ref: ref,
|
|
@@ -22057,15 +22147,14 @@
|
|
|
22057
22147
|
faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
|
|
22058
22148
|
idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
|
|
22059
22149
|
}), debugMode && capturingId && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
22060
|
-
"$flipX": !
|
|
22150
|
+
"$flipX": !isRearFacing
|
|
22061
22151
|
}, detectedObjects.map(function (obj, i) {
|
|
22062
|
-
var _a;
|
|
22063
22152
|
return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
22064
22153
|
key: i,
|
|
22065
22154
|
obj: obj,
|
|
22066
22155
|
scaling: debugScalingDetails,
|
|
22067
22156
|
color: "blue",
|
|
22068
|
-
flipX: !
|
|
22157
|
+
flipX: !isRearFacing
|
|
22069
22158
|
});
|
|
22070
22159
|
})), /*#__PURE__*/React.createElement(DebugBoundingBoxOverlay, null, face && ( /*#__PURE__*/React.createElement(SelfieCaptureFaceDebugBox, {
|
|
22071
22160
|
face: face,
|
|
@@ -22074,9 +22163,9 @@
|
|
|
22074
22163
|
className: classNames.guidanceMessageContainer
|
|
22075
22164
|
}, /*#__PURE__*/React.createElement(GuidanceMessage, {
|
|
22076
22165
|
className: classNames.guidanceMessage,
|
|
22077
|
-
"$background": (
|
|
22078
|
-
"$textColor": (
|
|
22079
|
-
}, guidanceText))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null,
|
|
22166
|
+
"$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',
|
|
22167
|
+
"$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'
|
|
22168
|
+
}, guidanceText))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React.createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React.createElement("br", null), "Document Type: ", currentDetectedDocumentType, /*#__PURE__*/React.createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React.createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React.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.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.createElement(CountdownContainer, {
|
|
22080
22169
|
className: classNames.countdownContainer
|
|
22081
22170
|
}, /*#__PURE__*/React.createElement(Countdown, {
|
|
22082
22171
|
className: classNames.countdown
|
|
@@ -22085,7 +22174,7 @@
|
|
|
22085
22174
|
}, /*#__PURE__*/React.createElement(CaptureButton, {
|
|
22086
22175
|
finished: true,
|
|
22087
22176
|
onClick: function onClick() {
|
|
22088
|
-
setCountdownStartedAt(new Date());
|
|
22177
|
+
return setCountdownStartedAt(new Date());
|
|
22089
22178
|
},
|
|
22090
22179
|
disabled: !!countdownStartedAt || frameLock.current,
|
|
22091
22180
|
className: classNames.captureBtn
|
|
@@ -22373,16 +22462,14 @@
|
|
|
22373
22462
|
className: "flex"
|
|
22374
22463
|
}, /*#__PURE__*/React.createElement(Spinner$1, null));
|
|
22375
22464
|
}
|
|
22376
|
-
return /*#__PURE__*/React.createElement(
|
|
22377
|
-
|
|
22378
|
-
preferContinuityCamera: isCapturingId,
|
|
22465
|
+
return /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
22466
|
+
preferIphoneContinuityCamera: isCapturingId,
|
|
22379
22467
|
preferFrontFacingCamera: !isCapturingId,
|
|
22380
22468
|
requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
|
|
22381
22469
|
maxVideoWidth: isCapturingId ? 1920 : 1280,
|
|
22382
22470
|
maxFps: isCapturingId ? 60 : 30,
|
|
22383
22471
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
22384
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22385
|
-
debugMode: debugMode
|
|
22472
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22386
22473
|
}, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
|
|
22387
22474
|
autoStart: false,
|
|
22388
22475
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
@@ -22393,7 +22480,7 @@
|
|
|
22393
22480
|
autoStart: false,
|
|
22394
22481
|
onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
|
|
22395
22482
|
modelLoadTimeoutMs: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.modelLoadTimeoutMs,
|
|
22396
|
-
requireVerticalFaceCentering:
|
|
22483
|
+
requireVerticalFaceCentering: false
|
|
22397
22484
|
}, /*#__PURE__*/React.createElement(PageContainer, {
|
|
22398
22485
|
className: "flex ".concat((_k = classNames.container) !== null && _k !== void 0 ? _k : '')
|
|
22399
22486
|
}, ['CHECKING_LIVENESS', 'CAPTURING_VIDEO'].includes(captureState) && /*#__PURE__*/React.createElement(CameraVideoTag, {
|
|
@@ -22508,17 +22595,15 @@
|
|
|
22508
22595
|
_o = _a.captureSignatureVideo,
|
|
22509
22596
|
captureSignatureVideo = _o === void 0 ? false : _o,
|
|
22510
22597
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
22511
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied
|
|
22512
|
-
|
|
22513
|
-
|
|
22514
|
-
|
|
22515
|
-
|
|
22516
|
-
|
|
22517
|
-
|
|
22518
|
-
|
|
22519
|
-
|
|
22520
|
-
checkIndex = _r[0],
|
|
22521
|
-
setCheckIndex = _r[1];
|
|
22598
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied;
|
|
22599
|
+
var _p = React.useContext(SubmissionContext),
|
|
22600
|
+
submit = _p.submit,
|
|
22601
|
+
submissionStatus = _p.submissionStatus,
|
|
22602
|
+
setSignatureData = _p.setSignatureData,
|
|
22603
|
+
setAdditionalDocuments = _p.setAdditionalDocuments;
|
|
22604
|
+
var _q = React.useState(0),
|
|
22605
|
+
checkIndex = _q[0],
|
|
22606
|
+
setCheckIndex = _q[1];
|
|
22522
22607
|
var checks = React.useMemo(function () {
|
|
22523
22608
|
var _a, _b;
|
|
22524
22609
|
var checks = __spreadArray([], userChecks, true);
|
|
@@ -22596,16 +22681,6 @@
|
|
|
22596
22681
|
return i + 1;
|
|
22597
22682
|
});
|
|
22598
22683
|
}, [onVideoSignatureCompleteProp]);
|
|
22599
|
-
var _s = React.useState(0),
|
|
22600
|
-
videoSignatureAttempts = _s[0],
|
|
22601
|
-
setVideoSignatureAttempts = _s[1];
|
|
22602
|
-
var onVideoSignatureRetryProp = videoSignatureCaptureProps.onRetryClicked;
|
|
22603
|
-
var onVideoSignatureRetry = React.useCallback(function () {
|
|
22604
|
-
onVideoSignatureRetryProp === null || onVideoSignatureRetryProp === void 0 ? void 0 : onVideoSignatureRetryProp();
|
|
22605
|
-
setVideoSignatureAttempts(function (n) {
|
|
22606
|
-
return n + 1;
|
|
22607
|
-
});
|
|
22608
|
-
}, [onVideoSignatureRetryProp]);
|
|
22609
22684
|
var onAdditionalDocumentCaptureCompleteProp = additionalDocumentCaptureProps === null || additionalDocumentCaptureProps === void 0 ? void 0 : additionalDocumentCaptureProps.onComplete;
|
|
22610
22685
|
var onAdditionalDocumentCaptureComplete = React.useCallback(function (uploadedDocuments) {
|
|
22611
22686
|
setAdditionalDocuments(uploadedDocuments);
|
|
@@ -22634,11 +22709,9 @@
|
|
|
22634
22709
|
}
|
|
22635
22710
|
switch (checks[checkIndex]) {
|
|
22636
22711
|
case 'IdCapture':
|
|
22637
|
-
return /*#__PURE__*/React.createElement(
|
|
22638
|
-
key: "IdCaptureCamera",
|
|
22712
|
+
return /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
22639
22713
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
22640
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22641
|
-
debugMode: debugMode
|
|
22714
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22642
22715
|
}, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
|
|
22643
22716
|
autoStart: false,
|
|
22644
22717
|
documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
|
|
@@ -22655,13 +22728,11 @@
|
|
|
22655
22728
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22656
22729
|
}));
|
|
22657
22730
|
case 'FaceLiveness':
|
|
22658
|
-
return /*#__PURE__*/React.createElement(
|
|
22659
|
-
key: "FaceLivenessCamera",
|
|
22731
|
+
return /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
22660
22732
|
preferFrontFacingCamera: true,
|
|
22661
|
-
|
|
22733
|
+
preferIphoneContinuityCamera: false,
|
|
22662
22734
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
22663
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22664
|
-
debugMode: debugMode
|
|
22735
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22665
22736
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
22666
22737
|
autoStart: false,
|
|
22667
22738
|
onModelError: faceLivenessProps.onModelError,
|
|
@@ -22674,15 +22745,13 @@
|
|
|
22674
22745
|
onAccept: onSignatureCaptureSuccess
|
|
22675
22746
|
}));
|
|
22676
22747
|
case 'VideoSignatureCapture':
|
|
22677
|
-
return /*#__PURE__*/React.createElement(
|
|
22678
|
-
|
|
22679
|
-
preferContinuityCamera: false,
|
|
22748
|
+
return /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
22749
|
+
preferIphoneContinuityCamera: false,
|
|
22680
22750
|
preferFrontFacingCamera: true,
|
|
22681
22751
|
maxVideoWidth: 1280,
|
|
22682
22752
|
maxFps: 30,
|
|
22683
22753
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
22684
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22685
|
-
debugMode: debugMode
|
|
22754
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
22686
22755
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
22687
22756
|
autoStart: false,
|
|
22688
22757
|
throttleMs: 250,
|
|
@@ -22690,8 +22759,7 @@
|
|
|
22690
22759
|
modelLoadTimeoutMs: videoSignatureCaptureProps.modelLoadTimeoutMs,
|
|
22691
22760
|
requireVerticalFaceCentering: false
|
|
22692
22761
|
}, /*#__PURE__*/React.createElement(VideoSignatureWizard, _assign({}, videoSignatureCaptureProps, {
|
|
22693
|
-
onComplete: onVideoSignatureComplete
|
|
22694
|
-
onRetryClicked: onVideoSignatureRetry
|
|
22762
|
+
onComplete: onVideoSignatureComplete
|
|
22695
22763
|
}))));
|
|
22696
22764
|
case 'AdditionalDocumentCapture':
|
|
22697
22765
|
return /*#__PURE__*/React.createElement(AdditionalDocumentCaptureWizard, _assign({}, additionalDocumentCaptureProps, {
|
|
@@ -23142,8 +23210,7 @@
|
|
|
23142
23210
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
23143
23211
|
captureSignature: captureSignature,
|
|
23144
23212
|
captureSignatureVideo: captureSignatureVideo,
|
|
23145
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
23146
|
-
debugMode: debugMode
|
|
23213
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
23147
23214
|
}))));
|
|
23148
23215
|
};
|
|
23149
23216
|
|
|
@@ -23249,8 +23316,7 @@
|
|
|
23249
23316
|
return ['FaceLiveness'];
|
|
23250
23317
|
}, []),
|
|
23251
23318
|
faceLivenessProps: faceLivenessProps,
|
|
23252
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
23253
|
-
debugMode: debugMode
|
|
23319
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
23254
23320
|
}))));
|
|
23255
23321
|
};
|
|
23256
23322
|
|
|
@@ -23483,8 +23549,7 @@
|
|
|
23483
23549
|
additionalDocumentCaptureProps: additionalDocumentCaptureProps,
|
|
23484
23550
|
captureSignature: captureSignature,
|
|
23485
23551
|
captureSignatureVideo: captureSignatureVideo,
|
|
23486
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
23487
|
-
debugMode: debugMode
|
|
23552
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
23488
23553
|
}))));
|
|
23489
23554
|
};
|
|
23490
23555
|
|
|
@@ -23739,8 +23804,7 @@
|
|
|
23739
23804
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
23740
23805
|
captureSignature: captureSignature,
|
|
23741
23806
|
captureSignatureVideo: captureSignatureVideo,
|
|
23742
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
23743
|
-
debugMode: debugMode
|
|
23807
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
23744
23808
|
}))));
|
|
23745
23809
|
};
|
|
23746
23810
|
|
|
@@ -24072,7 +24136,7 @@
|
|
|
24072
24136
|
var _l = React.useState('LOADING'),
|
|
24073
24137
|
captureState = _l[0],
|
|
24074
24138
|
setCaptureState = _l[1];
|
|
24075
|
-
var _m =
|
|
24139
|
+
var _m = useCameraStore(),
|
|
24076
24140
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
24077
24141
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
24078
24142
|
var _o = React.useContext(SelfieGuidanceModelsContext),
|
|
@@ -24278,10 +24342,9 @@
|
|
|
24278
24342
|
onSubmit: onSubmit,
|
|
24279
24343
|
geolocationEnabled: geolocationEnabled,
|
|
24280
24344
|
geolocationRequired: geolocationRequired
|
|
24281
|
-
}, /*#__PURE__*/React.createElement(
|
|
24345
|
+
}, /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
24282
24346
|
preferFrontFacingCamera: true,
|
|
24283
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
24284
|
-
debugMode: debugMode
|
|
24347
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
24285
24348
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
24286
24349
|
autoStart: false,
|
|
24287
24350
|
onModelError: onModelError,
|
|
@@ -24630,7 +24693,7 @@
|
|
|
24630
24693
|
var _l = React.useState('LOADING'),
|
|
24631
24694
|
captureState = _l[0],
|
|
24632
24695
|
setCaptureState = _l[1];
|
|
24633
|
-
var _m =
|
|
24696
|
+
var _m = useCameraStore(),
|
|
24634
24697
|
cameraAccessDenied = _m.cameraAccessDenied,
|
|
24635
24698
|
releaseCameraAccess = _m.releaseCameraAccess;
|
|
24636
24699
|
var _o = React.useContext(SelfieGuidanceModelsContext),
|
|
@@ -24834,10 +24897,9 @@
|
|
|
24834
24897
|
onSubmit: onSubmit,
|
|
24835
24898
|
geolocationEnabled: geolocationEnabled,
|
|
24836
24899
|
geolocationRequired: geolocationRequired
|
|
24837
|
-
}, /*#__PURE__*/React.createElement(
|
|
24900
|
+
}, /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
24838
24901
|
preferFrontFacingCamera: true,
|
|
24839
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
24840
|
-
debugMode: debugMode
|
|
24902
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
24841
24903
|
}, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
|
|
24842
24904
|
autoStart: false,
|
|
24843
24905
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -25164,8 +25226,7 @@
|
|
|
25164
25226
|
captureSignature: captureSignature,
|
|
25165
25227
|
captureSignatureVideo: captureSignatureVideo,
|
|
25166
25228
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
25167
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
25168
|
-
debugMode: debugMode
|
|
25229
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
25169
25230
|
}))));
|
|
25170
25231
|
};
|
|
25171
25232
|
|
|
@@ -25322,8 +25383,7 @@
|
|
|
25322
25383
|
videoSignatureCaptureProps: videoSignatureCaptureProps,
|
|
25323
25384
|
captureSignature: captureSignature,
|
|
25324
25385
|
captureSignatureVideo: captureSignatureVideo,
|
|
25325
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
25326
|
-
debugMode: debugMode
|
|
25386
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
25327
25387
|
}))));
|
|
25328
25388
|
};
|
|
25329
25389
|
|
|
@@ -25381,11 +25441,10 @@
|
|
|
25381
25441
|
onDocumentUploadFailed: onDocumentUploadFailed,
|
|
25382
25442
|
geolocationEnabled: geolocationEnabled,
|
|
25383
25443
|
geolocationRequired: geolocationRequired
|
|
25384
|
-
}, /*#__PURE__*/React.createElement(
|
|
25444
|
+
}, /*#__PURE__*/React.createElement(CameraStoreProvider, {
|
|
25385
25445
|
requestAccessAutomatically: false,
|
|
25386
|
-
|
|
25387
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
25388
|
-
debugMode: debugMode
|
|
25446
|
+
preferIphoneContinuityCamera: true,
|
|
25447
|
+
onCameraAccessDenied: onCameraAccessDenied
|
|
25389
25448
|
}, /*#__PURE__*/React.createElement(DocumentCaptureWizard, {
|
|
25390
25449
|
onSuccess: onComplete,
|
|
25391
25450
|
onExitCapture: onExitCapture,
|