idmission-web-sdk 2.3.87 → 2.3.88
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/customer_flows/SignatureKYC.d.ts +6 -0
- package/dist/components/customer_flows/SignatureKYC.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieCapture.d.ts +4 -0
- package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts +4 -1
- package/dist/components/selfie_capture/SelfieGuidanceModelsProvider.d.ts.map +1 -1
- package/dist/components/submission/SubmissionProvider.d.ts +0 -2
- package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/components/submission/types.d.ts +0 -2
- package/dist/components/submission/types.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureCapture.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts +2 -7
- package/dist/components/video_signature_capture/VideoSignatureContext.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureGuides.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignaturePad.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts +4 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/lib/camera/useVideoRecorder.d.ts.map +1 -1
- package/dist/lib/locales/de.d.ts +1 -0
- package/dist/lib/locales/de.d.ts.map +1 -1
- package/dist/lib/locales/es.d.ts +1 -0
- package/dist/lib/locales/es.d.ts.map +1 -1
- package/dist/lib/locales/fr.d.ts +1 -0
- package/dist/lib/locales/fr.d.ts.map +1 -1
- package/dist/lib/locales/index.d.ts +8 -0
- package/dist/lib/locales/index.d.ts.map +1 -1
- package/dist/lib/locales/it.d.ts +1 -0
- package/dist/lib/locales/it.d.ts.map +1 -1
- package/dist/lib/locales/ja.d.ts +1 -0
- package/dist/lib/locales/ja.d.ts.map +1 -1
- package/dist/lib/locales/pt.d.ts +1 -0
- package/dist/lib/locales/pt.d.ts.map +1 -1
- package/dist/lib/locales/ru.d.ts +1 -0
- package/dist/lib/locales/ru.d.ts.map +1 -1
- package/dist/lib/locales/zh.d.ts +1 -0
- package/dist/lib/locales/zh.d.ts.map +1 -1
- package/dist/lib/models/FaceDetection.d.ts +9 -1
- package/dist/lib/models/FaceDetection.d.ts.map +1 -1
- package/dist/lib/utils/lighting.d.ts +19 -0
- package/dist/lib/utils/lighting.d.ts.map +1 -0
- package/dist/sdk2.cjs.development.js +247 -221
- 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 +247 -221
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +247 -221
- 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 +3 -3
- package/dist/lib/utils/blobs.d.ts +0 -3
- package/dist/lib/utils/blobs.d.ts.map +0 -1
|
@@ -236,7 +236,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
236
236
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
237
237
|
};
|
|
238
238
|
|
|
239
|
-
var webSdkVersion = '2.3.
|
|
239
|
+
var webSdkVersion = '2.3.88';
|
|
240
240
|
|
|
241
241
|
function getPlatform() {
|
|
242
242
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1176,12 +1176,6 @@ var SubmissionContext = /*#__PURE__*/React.createContext({
|
|
|
1176
1176
|
setIdCaptureVideoUrl: function setIdCaptureVideoUrl() {
|
|
1177
1177
|
return null;
|
|
1178
1178
|
},
|
|
1179
|
-
setSignatureStartTimestamp: function setSignatureStartTimestamp() {
|
|
1180
|
-
return null;
|
|
1181
|
-
},
|
|
1182
|
-
setSignatureEndTimestamp: function setSignatureEndTimestamp() {
|
|
1183
|
-
return null;
|
|
1184
|
-
},
|
|
1185
1179
|
setIdCaptureVideoIdFrontImage: function setIdCaptureVideoIdFrontImage() {
|
|
1186
1180
|
return null;
|
|
1187
1181
|
},
|
|
@@ -1346,50 +1340,44 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1346
1340
|
signatureVideoUrl = _16[0],
|
|
1347
1341
|
setSignatureVideoUrl = _16[1];
|
|
1348
1342
|
var _17 = React.useState(null),
|
|
1349
|
-
|
|
1350
|
-
|
|
1343
|
+
idCaptureVideoUrl = _17[0],
|
|
1344
|
+
setIdCaptureVideoUrl = _17[1];
|
|
1351
1345
|
var _18 = React.useState(null),
|
|
1352
|
-
|
|
1353
|
-
|
|
1346
|
+
idCaptureVideoIdFrontImage = _18[0],
|
|
1347
|
+
setIdCaptureVideoIdFrontImage = _18[1];
|
|
1354
1348
|
var _19 = React.useState(null),
|
|
1355
|
-
|
|
1356
|
-
|
|
1349
|
+
idCaptureVideoIdBackImage = _19[0],
|
|
1350
|
+
setIdCaptureVideoIdBackImage = _19[1];
|
|
1357
1351
|
var _20 = React.useState(null),
|
|
1358
|
-
|
|
1359
|
-
|
|
1352
|
+
idCaptureVideoAudioUrl = _20[0],
|
|
1353
|
+
setIdCaptureVideoAudioUrl = _20[1];
|
|
1360
1354
|
var _21 = React.useState(null),
|
|
1361
|
-
|
|
1362
|
-
|
|
1355
|
+
idCaptureVideoAudioStartsAt = _21[0],
|
|
1356
|
+
setIdCaptureVideoAudioStartsAt = _21[1];
|
|
1363
1357
|
var _22 = React.useState(null),
|
|
1364
|
-
|
|
1365
|
-
|
|
1358
|
+
expectedAudioText = _22[0],
|
|
1359
|
+
setExpectedAudioText = _22[1];
|
|
1366
1360
|
var _23 = React.useState(null),
|
|
1367
|
-
|
|
1368
|
-
|
|
1361
|
+
additionalDocuments = _23[0],
|
|
1362
|
+
setAdditionalDocuments = _23[1];
|
|
1369
1363
|
var _24 = React.useState(null),
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
var _25 = React.useState(
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
var _26 = React.useState(
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
var _27 = React.useState(
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
var _28 = React.useState(
|
|
1382
|
-
|
|
1383
|
-
|
|
1364
|
+
geolocationResult = _24[0],
|
|
1365
|
+
setGeolocationResult = _24[1];
|
|
1366
|
+
var _25 = React.useState(0),
|
|
1367
|
+
geolocationAttempts = _25[0],
|
|
1368
|
+
setGeolocationAttempts = _25[1];
|
|
1369
|
+
var _26 = React.useState(false),
|
|
1370
|
+
geolocationBlocked = _26[0],
|
|
1371
|
+
setGeolocationBlocked = _26[1];
|
|
1372
|
+
var _27 = React.useState([]),
|
|
1373
|
+
idFrontCaptureAttempts = _27[0],
|
|
1374
|
+
setIdFrontCaptureAttempts = _27[1];
|
|
1375
|
+
var _28 = React.useState([]),
|
|
1376
|
+
idBackCaptureAttempts = _28[0],
|
|
1377
|
+
setIdBackCaptureAttempts = _28[1];
|
|
1384
1378
|
var _29 = React.useState([]),
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
var _30 = React.useState([]),
|
|
1388
|
-
idBackCaptureAttempts = _30[0],
|
|
1389
|
-
setIdBackCaptureAttempts = _30[1];
|
|
1390
|
-
var _31 = React.useState([]),
|
|
1391
|
-
selfieCaptureAttempts = _31[0],
|
|
1392
|
-
setSelfieCaptureAttempts = _31[1];
|
|
1379
|
+
selfieCaptureAttempts = _29[0],
|
|
1380
|
+
setSelfieCaptureAttempts = _29[1];
|
|
1393
1381
|
var logIdFrontCaptureAttempt = React.useCallback(function (attempt) {
|
|
1394
1382
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
1395
1383
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -1666,12 +1654,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1666
1654
|
submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
|
|
1667
1655
|
}
|
|
1668
1656
|
}
|
|
1669
|
-
if (signatureStartTimestamp) {
|
|
1670
|
-
submissionRequest.customerData.signatureStartTimestamp = signatureStartTimestamp;
|
|
1671
|
-
}
|
|
1672
|
-
if (signatureEndTimestamp) {
|
|
1673
|
-
submissionRequest.customerData.signatureEndTimestamp = signatureEndTimestamp;
|
|
1674
|
-
}
|
|
1675
1657
|
if (additionalDocuments) {
|
|
1676
1658
|
submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
|
|
1677
1659
|
return _assign(_assign({}, d), {
|
|
@@ -1714,7 +1696,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1714
1696
|
}
|
|
1715
1697
|
});
|
|
1716
1698
|
});
|
|
1717
|
-
}, [additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, clientRequestID, companyId, customerDataMatchConfig, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idBackIrImage, idBackUvImage, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idCardForFaceMatch, idData, idFrontCaptureAttempts, idFrontImage, idFrontIrImage, idFrontUvImage, idImageResolutionCheck, jobId, manualReviewRequired, needImmediateResponse, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData,
|
|
1699
|
+
}, [additionalDocuments, bypassAgeValidation, bypassNameMatching, cardData, clientRequestID, companyId, customerDataMatchConfig, deduplicationEnabled, deduplicationSynchronous, documentServiceUrl, enrollmentId, expectedAudioText, geolocationResult, idBackCaptureAttempts, idBackImage, idBackImageRequired, idBackIrImage, idBackUvImage, idCaptureVideoAudioStartsAt, idCaptureVideoAudioUrl, idCaptureVideoIdBackImage, idCaptureVideoIdFrontImage, idCaptureVideoUrl, idCardForFaceMatch, idData, idFrontCaptureAttempts, idFrontImage, idFrontIrImage, idFrontUvImage, idImageResolutionCheck, jobId, manualReviewRequired, needImmediateResponse, passportImage, personalData, selfieCaptureAttempts, selfieImage, signatureData, signatureVideoUrl, uploadDocument, verifyIdWithExternalDatabases, webhooksClientTraceId, webhooksEnabled, webhooksFireOnReview, webhooksFireOnReviewURL, webhooksSendInputImages, webhooksSendProcessedImages, webhooksStripSpecialCharacters, webhooksURL]);
|
|
1718
1700
|
var defaultOnSubmit = React.useCallback(function () {
|
|
1719
1701
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1720
1702
|
var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
|
|
@@ -2011,8 +1993,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
2011
1993
|
setSelfieImage: setSelfieImage,
|
|
2012
1994
|
setSignatureData: setSignatureData,
|
|
2013
1995
|
setSignatureVideoUrl: setSignatureVideoUrl,
|
|
2014
|
-
setSignatureStartTimestamp: setSignatureStartTimestamp,
|
|
2015
|
-
setSignatureEndTimestamp: setSignatureEndTimestamp,
|
|
2016
1996
|
setIdCaptureVideoUrl: setIdCaptureVideoUrl,
|
|
2017
1997
|
setIdCaptureVideoIdFrontImage: setIdCaptureVideoIdFrontImage,
|
|
2018
1998
|
setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
|
|
@@ -2927,14 +2907,29 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2927
2907
|
// we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
|
|
2928
2908
|
_k = _a.noseTrackingThreshold,
|
|
2929
2909
|
// we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
|
|
2930
|
-
noseTrackingThreshold = _k === void 0 ? 0.2 : _k
|
|
2910
|
+
noseTrackingThreshold = _k === void 0 ? 0.2 : _k,
|
|
2911
|
+
// this represents the maximum distance that the nose can be from the center of the face box -- 20% of the face box width or height
|
|
2912
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
2913
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
2914
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold,
|
|
2915
|
+
brightness = _a.brightness,
|
|
2916
|
+
range = _a.range,
|
|
2917
|
+
variance = _a.variance;
|
|
2931
2918
|
var face = faces[0];
|
|
2932
2919
|
var faceNotDetected = faces.length === 0;
|
|
2933
2920
|
var faceNotCentered = false,
|
|
2934
2921
|
faceLookingAway = false,
|
|
2935
2922
|
faceTooClose = false,
|
|
2936
|
-
faceTooFar = false
|
|
2937
|
-
|
|
2923
|
+
faceTooFar = false,
|
|
2924
|
+
faceVisibilityTooLow = false;
|
|
2925
|
+
var hasAnyThreshold = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
2926
|
+
if (hasAnyThreshold) {
|
|
2927
|
+
var tooDark = minCaptureBrightnessThreshold !== undefined && brightness !== undefined && brightness < minCaptureBrightnessThreshold;
|
|
2928
|
+
var tooLowRange = minCaptureRangeThreshold !== undefined && range !== undefined && range < minCaptureRangeThreshold;
|
|
2929
|
+
var tooLowVariance = minCaptureVarianceThreshold !== undefined && variance !== undefined && variance < minCaptureVarianceThreshold;
|
|
2930
|
+
faceVisibilityTooLow = !!(tooDark || tooLowRange || tooLowVariance);
|
|
2931
|
+
}
|
|
2932
|
+
if (face && !faceVisibilityTooLow) {
|
|
2938
2933
|
// calculate frame centroids
|
|
2939
2934
|
var frameCX = videoWidth / 2;
|
|
2940
2935
|
var frameCY = videoHeight / 2;
|
|
@@ -2973,7 +2968,7 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2973
2968
|
}
|
|
2974
2969
|
var faceIsStable = false,
|
|
2975
2970
|
noseIsStable = false;
|
|
2976
|
-
if (faceInGuides) {
|
|
2971
|
+
if (faceInGuides && !faceVisibilityTooLow) {
|
|
2977
2972
|
var framesNeeded = Math.max(Math.ceil(average(framesNeededSamples$1)), 5);
|
|
2978
2973
|
trackFace(face, framesNeeded, videoWidth, videoHeight);
|
|
2979
2974
|
faceIsStable = lastNFaces.length >= framesNeeded && !lastNFacePairs.some(function (pair) {
|
|
@@ -2983,7 +2978,7 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2983
2978
|
return pair.distance > noseDistanceThreshold;
|
|
2984
2979
|
});
|
|
2985
2980
|
}
|
|
2986
|
-
var faceReady = faceInGuides && faceIsStable && noseIsStable;
|
|
2981
|
+
var faceReady = faceInGuides && faceIsStable && noseIsStable && !faceVisibilityTooLow;
|
|
2987
2982
|
return {
|
|
2988
2983
|
face: face,
|
|
2989
2984
|
faceNotDetected: faceNotDetected,
|
|
@@ -2994,7 +2989,8 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2994
2989
|
faceReady: faceReady,
|
|
2995
2990
|
faceReadyAt: faceReady ? new Date() : null,
|
|
2996
2991
|
faceIsStable: faceIsStable,
|
|
2997
|
-
noseIsStable: noseIsStable
|
|
2992
|
+
noseIsStable: noseIsStable,
|
|
2993
|
+
faceVisibilityTooLow: faceVisibilityTooLow
|
|
2998
2994
|
};
|
|
2999
2995
|
}
|
|
3000
2996
|
function testFaceDetectionAgainstKnownImage(detector) {
|
|
@@ -3871,6 +3867,7 @@ var es = {
|
|
|
3871
3867
|
'Move forward...': 'Hay que moverse hacia adelante...',
|
|
3872
3868
|
'Move to the center...': 'Hay que moverse hacia el centro...',
|
|
3873
3869
|
'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
|
|
3870
|
+
'Improve lighting conditions...': 'Hay que buscar mejor iluminación...',
|
|
3874
3871
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
|
|
3875
3872
|
'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
|
|
3876
3873
|
'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
|
|
@@ -4002,6 +3999,7 @@ var de = {
|
|
|
4002
3999
|
'Move forward...': 'Nach vorne bewegen...',
|
|
4003
4000
|
'Move to the center...': 'In die Mitte bewegen...',
|
|
4004
4001
|
'Waiting for face to be detected...': 'Warte auf die Gesichtserkennung...',
|
|
4002
|
+
'Improve lighting conditions...': 'Beleuchtungsbedingungen verbessern...',
|
|
4005
4003
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Bitte Augenbedeckung entfernen (Sonnenbrille, Augenklappe usw.)...',
|
|
4006
4004
|
'Please remove your head coverings (hat scarf etc.)...': 'Bitte Kopfbedeckung abnehmen (Mütze, Schal usw.)...',
|
|
4007
4005
|
'Please remove your mask...': 'Bitte Maske ablegen...',
|
|
@@ -4133,6 +4131,7 @@ var fr = {
|
|
|
4133
4131
|
'Move forward...': 'Avancez...',
|
|
4134
4132
|
'Move to the center...': 'Déplacez-vous vers le centre...',
|
|
4135
4133
|
'Waiting for face to be detected...': 'En attente de détection du visage...',
|
|
4134
|
+
'Improve lighting conditions...': "Améliorer les conditions d'éclairage...",
|
|
4136
4135
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Veuillez retirer ce qui recouvre vos yeux (lunettes de soleil, cache-œil, etc.)...',
|
|
4137
4136
|
'Please remove your head coverings (hat scarf etc.)...': 'Veuillez retirer vos couvre-chefs (chapeau, foulard, etc.)...',
|
|
4138
4137
|
'Please remove your mask...': 'Veuillez retirer votre masque...',
|
|
@@ -4264,6 +4263,7 @@ var it = {
|
|
|
4264
4263
|
'Move forward...': 'Spostarsi più vicino...',
|
|
4265
4264
|
'Move to the center...': 'Spostarsi al centro...',
|
|
4266
4265
|
'Waiting for face to be detected...': 'In attesa che venga rilevato il volto...',
|
|
4266
|
+
'Improve lighting conditions...': 'Migliorare le condizioni di illuminazione...',
|
|
4267
4267
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Rimuovere tutto ciò che copre gli occhi (occhiali da sole, bende, ecc.)...',
|
|
4268
4268
|
'Please remove your head coverings (hat scarf etc.)...': 'Rimuovere tutto ciò che ricopre il capo (cappello, sciarpa, ecc.)...',
|
|
4269
4269
|
'Please remove your mask...': 'Rimuovere la mascherina...',
|
|
@@ -4395,6 +4395,7 @@ var ja = {
|
|
|
4395
4395
|
'Move forward...': '近づいてください…',
|
|
4396
4396
|
'Move to the center...': '中央へ移動してください…',
|
|
4397
4397
|
'Waiting for face to be detected...': '顔が検出されるのを待っています…',
|
|
4398
|
+
'Improve lighting conditions...': '照明条件を改善してください…',
|
|
4398
4399
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': '目を覆うもの(サングラスや眼帯など)を取り外してください…',
|
|
4399
4400
|
'Please remove your head coverings (hat scarf etc.)...': '頭を覆うもの(帽子やスカーフなど)を取り外してください…',
|
|
4400
4401
|
'Please remove your mask...': 'マスクを取り外してください…',
|
|
@@ -4526,6 +4527,7 @@ var pt = {
|
|
|
4526
4527
|
'Move forward...': 'Mover para frente...',
|
|
4527
4528
|
'Move to the center...': 'Mover para o centro...',
|
|
4528
4529
|
'Waiting for face to be detected...': 'Aguardando a detecção de rosto...',
|
|
4530
|
+
'Improve lighting conditions...': 'Melhore as condições de iluminação...',
|
|
4529
4531
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Por favor, remova as coberturas dos olhos (óculos de sol, tapa-olho, etc.)...',
|
|
4530
4532
|
'Please remove your head coverings (hat scarf etc.)...': 'Por favor, remova as coberturas da cabeça (chapéu, cachecol, etc.)...',
|
|
4531
4533
|
'Please remove your mask...': 'Por favor, remova sua máscara...',
|
|
@@ -4657,6 +4659,7 @@ var ru = {
|
|
|
4657
4659
|
'Move forward...': 'Подвиньтесь вперед…',
|
|
4658
4660
|
'Move to the center...': 'Переместите к центру…',
|
|
4659
4661
|
'Waiting for face to be detected...': 'Ожидание обнаружения лица…',
|
|
4662
|
+
'Improve lighting conditions...': 'Улучшите условия освещения…',
|
|
4660
4663
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Снимите предметы, закрывающие глаза (солнцезащитные очки, повязку и т.д.)…',
|
|
4661
4664
|
'Please remove your head coverings (hat scarf etc.)...': 'Снимите предметы, покрывающие голову (шапку, шарф и т.д.)…',
|
|
4662
4665
|
'Please remove your mask...': 'Снимите маску…',
|
|
@@ -4788,6 +4791,7 @@ var zh = {
|
|
|
4788
4791
|
'Move forward...': '請前進...',
|
|
4789
4792
|
'Move to the center...': '請移至中心...',
|
|
4790
4793
|
'Waiting for face to be detected...': '正在等待臉部辨識...',
|
|
4794
|
+
'Improve lighting conditions...': '改善照明條件...',
|
|
4791
4795
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
|
|
4792
4796
|
'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
|
|
4793
4797
|
'Please remove your mask...': '請脫下口罩...',
|
|
@@ -11667,6 +11671,110 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
|
|
|
11667
11671
|
};
|
|
11668
11672
|
var templateObject_1$n, templateObject_2$l;
|
|
11669
11673
|
|
|
11674
|
+
function detectBrightnessAndContrast(frame, brightnessAverager) {
|
|
11675
|
+
var ctx = frame.getContext('2d');
|
|
11676
|
+
if (!ctx || frame.width === 0 || frame.height === 0) return {};
|
|
11677
|
+
var imageData = ctx.getImageData(0, 0, frame.width, frame.height);
|
|
11678
|
+
var pixels = imageData.data; // This is already Uint8ClampedArray
|
|
11679
|
+
var width = frame.width;
|
|
11680
|
+
var sampleResolution = 10;
|
|
11681
|
+
var xStep = Math.max(1, Math.floor(width / sampleResolution));
|
|
11682
|
+
var yStep = Math.max(1, Math.floor(frame.height / sampleResolution));
|
|
11683
|
+
var brightness = 0;
|
|
11684
|
+
var brightnessForVariance = 0;
|
|
11685
|
+
var minBrightness = Infinity;
|
|
11686
|
+
var maxBrightness = -Infinity;
|
|
11687
|
+
var iterations = 0;
|
|
11688
|
+
for (var y = Math.floor(yStep / 2); y < frame.height; y += yStep) {
|
|
11689
|
+
for (var x = Math.floor(xStep / 2); x < width; x += xStep) {
|
|
11690
|
+
var pixelIndex = (y * width + x) * 4;
|
|
11691
|
+
var r = pixels[pixelIndex];
|
|
11692
|
+
var g = pixels[pixelIndex + 1];
|
|
11693
|
+
var b = pixels[pixelIndex + 2];
|
|
11694
|
+
// https://en.wikipedia.org/wiki/Relative_luminance
|
|
11695
|
+
// pixels are represented by 4 channels/bytes, thus a step of 4
|
|
11696
|
+
// the luminance formula is: 0.2126 * R + 0.7152 * G + 0.0722 * B (alpha is not used in this formula)
|
|
11697
|
+
var luminance = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
11698
|
+
brightness += luminance;
|
|
11699
|
+
brightnessForVariance += luminance * luminance;
|
|
11700
|
+
minBrightness = Math.min(minBrightness, luminance);
|
|
11701
|
+
maxBrightness = Math.max(maxBrightness, luminance);
|
|
11702
|
+
iterations++;
|
|
11703
|
+
}
|
|
11704
|
+
}
|
|
11705
|
+
var _a = brightnessAverager(brightness / iterations),
|
|
11706
|
+
avg = _a.avg,
|
|
11707
|
+
isFull = _a.isFull;
|
|
11708
|
+
var range = maxBrightness - minBrightness;
|
|
11709
|
+
var variance = brightnessForVariance / iterations - Math.pow(brightness / iterations, 2);
|
|
11710
|
+
return {
|
|
11711
|
+
brightness: isFull ? avg : undefined,
|
|
11712
|
+
range: isFull ? range : undefined,
|
|
11713
|
+
variance: isFull ? variance : undefined
|
|
11714
|
+
};
|
|
11715
|
+
}
|
|
11716
|
+
function createRunningAvgFIFO(capacity) {
|
|
11717
|
+
var cap = capacity | 0;
|
|
11718
|
+
var buf = new Float64Array(cap);
|
|
11719
|
+
var head = 0; // next write index
|
|
11720
|
+
var count = 0; // how many valid items (<= cap)
|
|
11721
|
+
var sum = 0;
|
|
11722
|
+
return {
|
|
11723
|
+
add: function add(x) {
|
|
11724
|
+
if (count === cap) {
|
|
11725
|
+
sum -= buf[head];
|
|
11726
|
+
} else {
|
|
11727
|
+
count++;
|
|
11728
|
+
}
|
|
11729
|
+
buf[head] = x;
|
|
11730
|
+
sum += x;
|
|
11731
|
+
head = head + 1 === cap ? 0 : head + 1;
|
|
11732
|
+
return {
|
|
11733
|
+
avg: sum / count,
|
|
11734
|
+
isFull: count === cap
|
|
11735
|
+
};
|
|
11736
|
+
},
|
|
11737
|
+
avg: function avg() {
|
|
11738
|
+
return count ? sum / count : 0;
|
|
11739
|
+
},
|
|
11740
|
+
size: function size() {
|
|
11741
|
+
return count;
|
|
11742
|
+
},
|
|
11743
|
+
clear: function clear() {
|
|
11744
|
+
head = 0;
|
|
11745
|
+
count = 0;
|
|
11746
|
+
sum = 0;
|
|
11747
|
+
},
|
|
11748
|
+
isFull: function isFull() {
|
|
11749
|
+
return count === cap;
|
|
11750
|
+
}
|
|
11751
|
+
};
|
|
11752
|
+
}
|
|
11753
|
+
function useRunningAvg(capacity) {
|
|
11754
|
+
var fifoRef = React.useRef();
|
|
11755
|
+
if (!fifoRef.current) fifoRef.current = createRunningAvgFIFO(capacity);
|
|
11756
|
+
React.useEffect(function () {
|
|
11757
|
+
fifoRef.current = createRunningAvgFIFO(capacity);
|
|
11758
|
+
}, [capacity]);
|
|
11759
|
+
return {
|
|
11760
|
+
addToAverage: function addToAverage(x) {
|
|
11761
|
+
return fifoRef.current.add(x);
|
|
11762
|
+
},
|
|
11763
|
+
average: function average() {
|
|
11764
|
+
return fifoRef.current.avg();
|
|
11765
|
+
},
|
|
11766
|
+
size: function size() {
|
|
11767
|
+
return fifoRef.current.size();
|
|
11768
|
+
},
|
|
11769
|
+
isFull: function isFull() {
|
|
11770
|
+
return fifoRef.current.isFull();
|
|
11771
|
+
},
|
|
11772
|
+
clear: function clear() {
|
|
11773
|
+
return fifoRef.current.clear();
|
|
11774
|
+
}
|
|
11775
|
+
};
|
|
11776
|
+
}
|
|
11777
|
+
|
|
11670
11778
|
var SelfieGuidanceModelsContext = /*#__PURE__*/React.createContext({
|
|
11671
11779
|
start: function start() {
|
|
11672
11780
|
return null;
|
|
@@ -11696,7 +11804,10 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11696
11804
|
_c = _a.modelLoadTimeoutMs,
|
|
11697
11805
|
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
11698
11806
|
_d = _a.requireVerticalFaceCentering,
|
|
11699
|
-
requireVerticalFaceCentering = _d === void 0 ? true : _d
|
|
11807
|
+
requireVerticalFaceCentering = _d === void 0 ? true : _d,
|
|
11808
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
11809
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
11810
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold;
|
|
11700
11811
|
var _e = useCameraStore(shallow.useShallow(function (state) {
|
|
11701
11812
|
return {
|
|
11702
11813
|
videoRef: state.videoRef,
|
|
@@ -11709,6 +11820,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11709
11820
|
cameraReady = _e.cameraReady;
|
|
11710
11821
|
var canvasRef = React.useRef(null);
|
|
11711
11822
|
var onPredictionHandler = React.useRef();
|
|
11823
|
+
var addToAverage = useRunningAvg(5).addToAverage;
|
|
11712
11824
|
var _f = useLoadFaceDetector({
|
|
11713
11825
|
onModelError: onModelError,
|
|
11714
11826
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -11721,7 +11833,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11721
11833
|
modelError = _f.modelError;
|
|
11722
11834
|
var _g = useFrameLoop(React.useCallback(function () {
|
|
11723
11835
|
return __awaiter(_this, void 0, void 0, function () {
|
|
11724
|
-
var vw, vh, ctx, prediction, processed, e_1;
|
|
11836
|
+
var vw, vh, ctx, thresholdsProvided, brightnessResults, brightness, range, variance, prediction, processed, e_1;
|
|
11725
11837
|
var _a, _b;
|
|
11726
11838
|
return __generator(this, function (_c) {
|
|
11727
11839
|
switch (_c.label) {
|
|
@@ -11739,12 +11851,23 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11739
11851
|
_c.label = 1;
|
|
11740
11852
|
case 1:
|
|
11741
11853
|
_c.trys.push([1, 3,, 4]);
|
|
11854
|
+
thresholdsProvided = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
11855
|
+
brightnessResults = thresholdsProvided ? detectBrightnessAndContrast(canvasRef.current, addToAverage) : undefined;
|
|
11856
|
+
brightness = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.brightness;
|
|
11857
|
+
range = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.range;
|
|
11858
|
+
variance = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.variance;
|
|
11742
11859
|
prediction = makeFaceDetectorPrediction(canvasRef.current);
|
|
11743
11860
|
processed = processFaceDetectorPrediction({
|
|
11744
11861
|
faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
|
|
11745
11862
|
videoWidth: vw,
|
|
11746
11863
|
videoHeight: vh,
|
|
11747
|
-
requireVerticalFaceCentering: requireVerticalFaceCentering
|
|
11864
|
+
requireVerticalFaceCentering: requireVerticalFaceCentering,
|
|
11865
|
+
minCaptureBrightnessThreshold: minCaptureBrightnessThreshold,
|
|
11866
|
+
minCaptureRangeThreshold: minCaptureRangeThreshold,
|
|
11867
|
+
minCaptureVarianceThreshold: minCaptureVarianceThreshold,
|
|
11868
|
+
brightness: brightness,
|
|
11869
|
+
range: range,
|
|
11870
|
+
variance: variance
|
|
11748
11871
|
});
|
|
11749
11872
|
setLastFaceDetectionAt(new Date().getTime());
|
|
11750
11873
|
// setLastPrediction(processed)
|
|
@@ -11762,7 +11885,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11762
11885
|
}
|
|
11763
11886
|
});
|
|
11764
11887
|
});
|
|
11765
|
-
}, [cameraReady, modelError, ready, requireVerticalFaceCentering, videoLoaded, videoRef]), {
|
|
11888
|
+
}, [cameraReady, modelError, ready, requireVerticalFaceCentering, videoLoaded, videoRef, addToAverage, minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold]), {
|
|
11766
11889
|
throttleMs: throttleMs,
|
|
11767
11890
|
autoStart: autoStart
|
|
11768
11891
|
}),
|
|
@@ -12135,6 +12258,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
12135
12258
|
guidanceMoveForwardText: 'Move forward...',
|
|
12136
12259
|
guidanceMoveToCenterText: 'Move to the center...',
|
|
12137
12260
|
guidanceNoFaceDetectedText: 'Waiting for face to be detected...',
|
|
12261
|
+
guidanceVisibilityTooLowText: 'Improve lighting conditions...',
|
|
12138
12262
|
guidanceNotStableText: 'Please hold still...',
|
|
12139
12263
|
guidanceManualCaptureText: 'Position your face in the circle and click to capture.',
|
|
12140
12264
|
manualCaptureBtnText: 'Capture'
|
|
@@ -12142,7 +12266,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
12142
12266
|
var allowManualCapture = !!guidanceError && allowManualSelfieCaptureOnLoadingError;
|
|
12143
12267
|
var satisfied = allowManualCapture || ((_b = prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) !== null && _b !== void 0 ? _b : false);
|
|
12144
12268
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
12145
|
-
guidanceMessage || (guidanceMessage = allowManualCapture ? verbiage.guidanceManualCaptureText : satisfied ? verbiage.guidanceHoldStillText : !prediction || (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotDetected) ? verbiage.guidanceNoFaceDetectedText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? verbiage.guidanceMoveToCenterText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? verbiage.guidanceLookStraightText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? verbiage.guidanceMoveBackText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? verbiage.guidanceMoveForwardText : !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) || !(prediction === null || prediction === void 0 ? void 0 : prediction.noseIsStable) ? verbiage.guidanceNotStableText : '');
|
|
12269
|
+
guidanceMessage || (guidanceMessage = allowManualCapture ? verbiage.guidanceManualCaptureText : satisfied ? verbiage.guidanceHoldStillText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceVisibilityTooLow) ? verbiage.guidanceVisibilityTooLowText : !prediction || (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotDetected) ? verbiage.guidanceNoFaceDetectedText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceNotCentered) ? verbiage.guidanceMoveToCenterText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceLookingAway) ? verbiage.guidanceLookStraightText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooClose) ? verbiage.guidanceMoveBackText : (prediction === null || prediction === void 0 ? void 0 : prediction.faceTooFar) ? verbiage.guidanceMoveForwardText : !(prediction === null || prediction === void 0 ? void 0 : prediction.faceIsStable) || !(prediction === null || prediction === void 0 ? void 0 : prediction.noseIsStable) ? verbiage.guidanceNotStableText : '');
|
|
12146
12270
|
if (guidanceError && !allowManualSelfieCaptureOnLoadingError) {
|
|
12147
12271
|
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFallback, {
|
|
12148
12272
|
classNames: classNames.fallback
|
|
@@ -13692,16 +13816,6 @@ var Container$4 = styled__default.default.div(templateObject_1$c || (templateObj
|
|
|
13692
13816
|
var AcceptBtn$1 = styled__default.default(LoaderButton)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
13693
13817
|
var templateObject_1$c, templateObject_2$b;
|
|
13694
13818
|
|
|
13695
|
-
function isBlob(blobPart) {
|
|
13696
|
-
return typeof Blob !== 'undefined' && blobPart instanceof Blob;
|
|
13697
|
-
}
|
|
13698
|
-
function inferBlobType(blobPart) {
|
|
13699
|
-
var _a;
|
|
13700
|
-
if (!isBlob(blobPart)) return undefined;
|
|
13701
|
-
var t = ((_a = blobPart.type) !== null && _a !== void 0 ? _a : '').trim();
|
|
13702
|
-
return t.length > 0 ? t : undefined;
|
|
13703
|
-
}
|
|
13704
|
-
|
|
13705
13819
|
var videoRecorder = null;
|
|
13706
13820
|
var audioRecorder = null;
|
|
13707
13821
|
var videoChunks = [];
|
|
@@ -13835,9 +13949,8 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13835
13949
|
useVideoRecorderStore.getState().clearRecordedData();
|
|
13836
13950
|
}, []);
|
|
13837
13951
|
var processVideo = React.useCallback(function () {
|
|
13838
|
-
var inferredType = inferBlobType(videoChunks[0]) || (videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.mimeType) || 'video/mp4';
|
|
13839
13952
|
var videoBlob = new Blob(videoChunks, {
|
|
13840
|
-
type:
|
|
13953
|
+
type: 'video/mp4'
|
|
13841
13954
|
});
|
|
13842
13955
|
useVideoRecorderStore.setState({
|
|
13843
13956
|
videoUrl: URL.createObjectURL(videoBlob),
|
|
@@ -13847,9 +13960,8 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13847
13960
|
setVideoRecorder(null);
|
|
13848
13961
|
}, []);
|
|
13849
13962
|
var processAudio = React.useCallback(function () {
|
|
13850
|
-
var inferredType = inferBlobType(audioChunks[0]) || (audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.mimeType) || 'audio/mp4';
|
|
13851
13963
|
var audioBlob = new Blob(audioChunks, {
|
|
13852
|
-
type:
|
|
13964
|
+
type: 'audio/mp4'
|
|
13853
13965
|
});
|
|
13854
13966
|
useVideoRecorderStore.setState({
|
|
13855
13967
|
audioUrl: URL.createObjectURL(audioBlob),
|
|
@@ -13889,7 +14001,6 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13889
14001
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
13890
14002
|
};
|
|
13891
14003
|
|
|
13892
|
-
var RECORDING_TIMESTAMP_PADDING_MS = 1000;
|
|
13893
14004
|
var signatureRecorder = null;
|
|
13894
14005
|
var signatureChunks = [];
|
|
13895
14006
|
var videoSignatureInitialState = {
|
|
@@ -13902,6 +14013,7 @@ var videoSignatureInitialState = {
|
|
|
13902
14013
|
clearRecordedData: function clearRecordedData() {
|
|
13903
14014
|
return null;
|
|
13904
14015
|
},
|
|
14016
|
+
isRecording: false,
|
|
13905
14017
|
signaturePad: {
|
|
13906
14018
|
current: null
|
|
13907
14019
|
},
|
|
@@ -13924,7 +14036,7 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
13924
14036
|
if (!camera) throw new Error('Camera not found');
|
|
13925
14037
|
// set our flag and clear whatever we have recorded so far.
|
|
13926
14038
|
set({
|
|
13927
|
-
|
|
14039
|
+
isRecording: true
|
|
13928
14040
|
});
|
|
13929
14041
|
signatureChunks = [];
|
|
13930
14042
|
// start recording video and audio
|
|
@@ -13938,52 +14050,27 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
13938
14050
|
videoBitsPerSecond: 270000,
|
|
13939
14051
|
audioBitsPerSecond: 32000
|
|
13940
14052
|
});
|
|
13941
|
-
var hasFirstChunk = false;
|
|
13942
14053
|
signatureRecorder.ondataavailable = function (event) {
|
|
13943
14054
|
signatureChunks.push(event.data);
|
|
13944
|
-
if (!hasFirstChunk) {
|
|
13945
|
-
hasFirstChunk = true;
|
|
13946
|
-
set({
|
|
13947
|
-
firstChunkReceivedAt: performance.now(),
|
|
13948
|
-
lastChunkReceivedAt: performance.now()
|
|
13949
|
-
});
|
|
13950
|
-
} else {
|
|
13951
|
-
set({
|
|
13952
|
-
lastChunkReceivedAt: performance.now()
|
|
13953
|
-
});
|
|
13954
|
-
}
|
|
13955
14055
|
};
|
|
13956
14056
|
signatureRecorder.start(100);
|
|
13957
14057
|
},
|
|
13958
14058
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
13959
14059
|
set({
|
|
13960
|
-
|
|
13961
|
-
recordingStoppedAt: performance.now()
|
|
13962
|
-
});
|
|
13963
|
-
waitForOneMoreChunk().then(function () {
|
|
13964
|
-
if (!signatureRecorder) return;
|
|
13965
|
-
signatureRecorder.stop();
|
|
13966
|
-
signatureRecorder.onstop = function () {
|
|
13967
|
-
var inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
13968
|
-
var blob = new Blob(signatureChunks, {
|
|
13969
|
-
type: inferredType
|
|
13970
|
-
});
|
|
13971
|
-
signatureChunks = [];
|
|
13972
|
-
signatureRecorder = null;
|
|
13973
|
-
if (!signatureData) return;
|
|
13974
|
-
var _a = get(),
|
|
13975
|
-
onSignatureVideoCaptured = _a.onSignatureVideoCaptured,
|
|
13976
|
-
recordingStartedAt = _a.recordingStartedAt,
|
|
13977
|
-
signatureStartedAt = _a.signatureStartedAt,
|
|
13978
|
-
signatureEndedAt = _a.signatureEndedAt,
|
|
13979
|
-
lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
13980
|
-
var endMs = Math.min(signatureEndedAt !== null && signatureEndedAt !== void 0 ? signatureEndedAt : Infinity, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity);
|
|
13981
|
-
var signatureStartTimestamp = signatureStartedAt && recordingStartedAt ? formatTimestamp(Math.max(0, signatureStartedAt - recordingStartedAt - RECORDING_TIMESTAMP_PADDING_MS)) : undefined;
|
|
13982
|
-
var signatureEndTimestamp = endMs !== Infinity && recordingStartedAt ? formatTimestamp(Math.min(endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity)) : undefined;
|
|
13983
|
-
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, signatureStartTimestamp, signatureEndTimestamp);
|
|
13984
|
-
};
|
|
13985
|
-
useVideoRecorderStore.getState().stopRecording();
|
|
14060
|
+
isRecording: false
|
|
13986
14061
|
});
|
|
14062
|
+
if (!signatureRecorder) return;
|
|
14063
|
+
signatureRecorder.stop();
|
|
14064
|
+
signatureRecorder.onstop = function () {
|
|
14065
|
+
var blob = new Blob(signatureChunks, {
|
|
14066
|
+
type: 'video/mp4'
|
|
14067
|
+
});
|
|
14068
|
+
signatureChunks = [];
|
|
14069
|
+
signatureRecorder = null;
|
|
14070
|
+
if (!signatureData) return;
|
|
14071
|
+
get().onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null);
|
|
14072
|
+
};
|
|
14073
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
13987
14074
|
},
|
|
13988
14075
|
clearRecordedData: function clearRecordedData() {
|
|
13989
14076
|
signatureChunks = [];
|
|
@@ -13992,42 +14079,13 @@ var useVideoSignatureStore = zustand.create()(middleware.devtools(function (set,
|
|
|
13992
14079
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
13993
14080
|
signatureRecorder = null;
|
|
13994
14081
|
set({
|
|
13995
|
-
|
|
13996
|
-
recordingStoppedAt: undefined,
|
|
13997
|
-
firstChunkReceivedAt: undefined,
|
|
13998
|
-
lastChunkReceivedAt: undefined,
|
|
14082
|
+
isRecording: false,
|
|
13999
14083
|
signaturePadEmpty: true,
|
|
14000
|
-
signatureValid: false
|
|
14001
|
-
signatureStartedAt: undefined,
|
|
14002
|
-
signatureEndedAt: undefined
|
|
14084
|
+
signatureValid: false
|
|
14003
14085
|
});
|
|
14004
14086
|
}
|
|
14005
14087
|
});
|
|
14006
14088
|
}));
|
|
14007
|
-
function waitForOneMoreChunk(timeoutMs) {
|
|
14008
|
-
if (timeoutMs === void 0) {
|
|
14009
|
-
timeoutMs = 3000;
|
|
14010
|
-
}
|
|
14011
|
-
var start = performance.now();
|
|
14012
|
-
return new Promise(function (resolve) {
|
|
14013
|
-
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14014
|
-
if (!initialLastChunkReceivedAt) return resolve();
|
|
14015
|
-
function gotAChunk() {
|
|
14016
|
-
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
14017
|
-
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
14018
|
-
}
|
|
14019
|
-
setTimeout(function () {
|
|
14020
|
-
if (gotAChunk()) return resolve(); // check immediately
|
|
14021
|
-
// otherwise, check every 100ms
|
|
14022
|
-
var interval = setInterval(function () {
|
|
14023
|
-
if (gotAChunk()) {
|
|
14024
|
-
clearInterval(interval);
|
|
14025
|
-
resolve();
|
|
14026
|
-
}
|
|
14027
|
-
}, 100);
|
|
14028
|
-
}, 0);
|
|
14029
|
-
});
|
|
14030
|
-
}
|
|
14031
14089
|
function VideoSignatureContextProvider(_a) {
|
|
14032
14090
|
var _this = this;
|
|
14033
14091
|
var _b, _c;
|
|
@@ -14046,14 +14104,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14046
14104
|
// clear recorded data when the component is mounted
|
|
14047
14105
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
14048
14106
|
}, []);
|
|
14049
|
-
var
|
|
14050
|
-
return {
|
|
14051
|
-
recordingStartedAt: state.recordingStartedAt,
|
|
14052
|
-
recordingStoppedAt: state.recordingStoppedAt
|
|
14053
|
-
};
|
|
14054
|
-
})),
|
|
14055
|
-
recordingStartedAt = _e.recordingStartedAt,
|
|
14056
|
-
recordingStoppedAt = _e.recordingStoppedAt;
|
|
14107
|
+
var isRecording = useVideoSignatureStore().isRecording;
|
|
14057
14108
|
useFrameLoop(React.useCallback(function () {
|
|
14058
14109
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14059
14110
|
var signaturePad, ctx, _a, w, h, isPortrait, rect;
|
|
@@ -14080,7 +14131,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14080
14131
|
});
|
|
14081
14132
|
});
|
|
14082
14133
|
}, [videoRef]), {
|
|
14083
|
-
autoStart:
|
|
14134
|
+
autoStart: isRecording,
|
|
14084
14135
|
throttleMs: 1000 / 24
|
|
14085
14136
|
});
|
|
14086
14137
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
@@ -14089,17 +14140,6 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14089
14140
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14090
14141
|
}));
|
|
14091
14142
|
}
|
|
14092
|
-
function formatTimestamp(durationMs) {
|
|
14093
|
-
// should be in the format of 00:00:00:00 (hh:mm:ss:cs)
|
|
14094
|
-
var hours = Math.floor(durationMs / 3600000);
|
|
14095
|
-
var minutes = Math.floor(durationMs % 3600000 / 60000);
|
|
14096
|
-
var seconds = Math.floor(durationMs % 60000 / 1000);
|
|
14097
|
-
var milliseconds = durationMs % 1000;
|
|
14098
|
-
// Convert milliseconds to centiseconds (1/100th of a second)
|
|
14099
|
-
var centiseconds = Math.floor(milliseconds / 10);
|
|
14100
|
-
var csString = centiseconds.toString().padStart(2, '0');
|
|
14101
|
-
return "".concat(hours.toString().padStart(2, '0'), ":") + "".concat(minutes.toString().padStart(2, '0'), ":") + "".concat(seconds.toString().padStart(2, '0'), ":") + "".concat(csString);
|
|
14102
|
-
}
|
|
14103
14143
|
|
|
14104
14144
|
function VideoSignaturePad(_a) {
|
|
14105
14145
|
var onAcceptBtnClicked = _a.onAcceptBtnClicked,
|
|
@@ -14161,11 +14201,8 @@ function VideoSignaturePad(_a) {
|
|
|
14161
14201
|
ref: signaturePad,
|
|
14162
14202
|
canvasProps: canvasProps,
|
|
14163
14203
|
onBegin: function onBegin() {
|
|
14164
|
-
return useVideoSignatureStore.setState(
|
|
14165
|
-
|
|
14166
|
-
signaturePadEmpty: false,
|
|
14167
|
-
signatureStartedAt: s.signatureStartedAt || performance.now()
|
|
14168
|
-
};
|
|
14204
|
+
return useVideoSignatureStore.setState({
|
|
14205
|
+
signaturePadEmpty: false
|
|
14169
14206
|
});
|
|
14170
14207
|
},
|
|
14171
14208
|
onEnd: function onEnd() {
|
|
@@ -14175,8 +14212,7 @@ function VideoSignaturePad(_a) {
|
|
|
14175
14212
|
return point;
|
|
14176
14213
|
});
|
|
14177
14214
|
useVideoSignatureStore.setState({
|
|
14178
|
-
signatureValid: points.length >= minSignaturePadPoints
|
|
14179
|
-
signatureEndedAt: performance.now()
|
|
14215
|
+
signatureValid: points.length >= minSignaturePadPoints
|
|
14180
14216
|
});
|
|
14181
14217
|
}
|
|
14182
14218
|
}), !headTrackingSatisfied && !!verbiage.headTrackingUnsatisfiedText ? ( /*#__PURE__*/React__namespace.default.createElement(SignaturePadContentContainer, {
|
|
@@ -14243,12 +14279,6 @@ function VideoSignatureGuides(_a) {
|
|
|
14243
14279
|
React.useEffect(function () {
|
|
14244
14280
|
if (guideToDisplay) setMode(guideToDisplay);
|
|
14245
14281
|
}, [guideToDisplay]);
|
|
14246
|
-
var firstChunkReceivedAt = useVideoSignatureStore(shallow.useShallow(function (state) {
|
|
14247
|
-
return {
|
|
14248
|
-
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14249
|
-
};
|
|
14250
|
-
})).firstChunkReceivedAt;
|
|
14251
|
-
var signaturePadDisabled = requestedAction !== 'CAPTURE_SIGNATURE' || !firstChunkReceivedAt;
|
|
14252
14282
|
return /*#__PURE__*/React__namespace.default.createElement(Container$3, {
|
|
14253
14283
|
className: classNames.container
|
|
14254
14284
|
}, /*#__PURE__*/React__namespace.default.createElement(Inner$1, {
|
|
@@ -14272,7 +14302,7 @@ function VideoSignatureGuides(_a) {
|
|
|
14272
14302
|
}, /*#__PURE__*/React__namespace.default.createElement(VideoSignaturePad, {
|
|
14273
14303
|
onAcceptBtnClicked: onAcceptBtnClicked,
|
|
14274
14304
|
onClearBtnClicked: onClearBtnClicked,
|
|
14275
|
-
disabled:
|
|
14305
|
+
disabled: requestedAction !== 'CAPTURE_SIGNATURE',
|
|
14276
14306
|
headTrackingSatisfied: headTrackingSatisfied,
|
|
14277
14307
|
minSignaturePadPoints: minSignaturePadPoints,
|
|
14278
14308
|
classNames: classNames,
|
|
@@ -14329,11 +14359,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14329
14359
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
14330
14360
|
startHeadTracking = _o.start,
|
|
14331
14361
|
stopHeadTracking = _o.stop;
|
|
14332
|
-
var
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
};
|
|
14336
|
-
})).firstChunkReceivedAt;
|
|
14362
|
+
var _p = useVideoSignatureStore(),
|
|
14363
|
+
clearRecordedData = _p.clearRecordedData,
|
|
14364
|
+
isRecording = _p.isRecording;
|
|
14337
14365
|
React.useEffect(function () {
|
|
14338
14366
|
useVideoSignatureStore.setState({
|
|
14339
14367
|
onSignatureVideoCaptured: onSignatureVideoCaptured
|
|
@@ -14352,15 +14380,15 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14352
14380
|
var verbiage = useTranslations(rawVerbiage, {
|
|
14353
14381
|
guidanceMessageText: 'Please sign the box below'
|
|
14354
14382
|
});
|
|
14355
|
-
var
|
|
14356
|
-
headTrackingSatisfied =
|
|
14357
|
-
setHeadTrackingSatisfied =
|
|
14358
|
-
var
|
|
14359
|
-
lastFace =
|
|
14360
|
-
setLastFace =
|
|
14361
|
-
var
|
|
14362
|
-
numFramesWithoutFaces =
|
|
14363
|
-
setNumFramesWithoutFaces =
|
|
14383
|
+
var _q = React.useState(true),
|
|
14384
|
+
headTrackingSatisfied = _q[0],
|
|
14385
|
+
setHeadTrackingSatisfied = _q[1];
|
|
14386
|
+
var _r = React.useState(null),
|
|
14387
|
+
lastFace = _r[0],
|
|
14388
|
+
setLastFace = _r[1];
|
|
14389
|
+
var _s = React.useState(0),
|
|
14390
|
+
numFramesWithoutFaces = _s[0],
|
|
14391
|
+
setNumFramesWithoutFaces = _s[1];
|
|
14364
14392
|
onHeadTrackingPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
|
|
14365
14393
|
var face = _a.face;
|
|
14366
14394
|
if (headTrackingDisabled) return;
|
|
@@ -14375,12 +14403,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14375
14403
|
return n + 1;
|
|
14376
14404
|
});
|
|
14377
14405
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
14378
|
-
var
|
|
14379
|
-
ref =
|
|
14380
|
-
|
|
14381
|
-
width =
|
|
14382
|
-
|
|
14383
|
-
height =
|
|
14406
|
+
var _t = useResizeObserver(),
|
|
14407
|
+
ref = _t.ref,
|
|
14408
|
+
_u = _t.width,
|
|
14409
|
+
width = _u === void 0 ? 1 : _u,
|
|
14410
|
+
_v = _t.height,
|
|
14411
|
+
height = _v === void 0 ? 1 : _v;
|
|
14384
14412
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14385
14413
|
enabled: debugMode,
|
|
14386
14414
|
pageWidth: width,
|
|
@@ -14411,19 +14439,13 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14411
14439
|
classNames: classNames.guides,
|
|
14412
14440
|
verbiage: rawVerbiage.guides,
|
|
14413
14441
|
onClearBtnClicked: restartVideoOnSignaturePadCleared ? function () {
|
|
14414
|
-
return setTimeout(
|
|
14415
|
-
|
|
14416
|
-
}, 100);
|
|
14417
|
-
} : function () {
|
|
14418
|
-
return useVideoSignatureStore.setState({
|
|
14419
|
-
signatureStartedAt: undefined
|
|
14420
|
-
});
|
|
14421
|
-
}
|
|
14442
|
+
return setTimeout(clearRecordedData, 100);
|
|
14443
|
+
} : undefined
|
|
14422
14444
|
}), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, null, lastFace && ( /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceDebugBox, {
|
|
14423
14445
|
face: lastFace,
|
|
14424
14446
|
scaling: debugScalingDetails,
|
|
14425
14447
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
14426
|
-
}))), /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__namespace.default.createElement("br", null), "Recording: ",
|
|
14448
|
+
}))), /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__namespace.default.createElement("br", null), "Recording: ", isRecording ? 'true' : 'false'))), /*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
14427
14449
|
onClick: onExit,
|
|
14428
14450
|
className: classNames.exitCaptureBtn
|
|
14429
14451
|
}));
|
|
@@ -14754,8 +14776,6 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14754
14776
|
setSelfieImage = _u.setSelfieImage,
|
|
14755
14777
|
setSignatureData = _u.setSignatureData,
|
|
14756
14778
|
setSignatureVideoUrl = _u.setSignatureVideoUrl,
|
|
14757
|
-
setSignatureStartTimestamp = _u.setSignatureStartTimestamp,
|
|
14758
|
-
setSignatureEndTimestamp = _u.setSignatureEndTimestamp,
|
|
14759
14779
|
logSelfieCaptureAttempt = _u.logSelfieCaptureAttempt,
|
|
14760
14780
|
uploadDocument = _u.uploadDocument;
|
|
14761
14781
|
var cameraAccessDenied = useCameraStore(shallow.useShallow(function (state) {
|
|
@@ -14815,14 +14835,12 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14815
14835
|
filetype: 'image/jpeg'
|
|
14816
14836
|
}).then(onSelfieCaptured);
|
|
14817
14837
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
14818
|
-
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData
|
|
14838
|
+
var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData) {
|
|
14819
14839
|
setSignatureData(signatureData);
|
|
14820
14840
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
14821
|
-
if (signatureStartTimestamp) setSignatureStartTimestamp(signatureStartTimestamp);
|
|
14822
|
-
if (signatureEndTimestamp) setSignatureEndTimestamp(signatureEndTimestamp);
|
|
14823
14841
|
setCaptureState('SUCCESS');
|
|
14824
|
-
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData
|
|
14825
|
-
}, [onVideoCaptured, setSignatureData,
|
|
14842
|
+
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
|
|
14843
|
+
}, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
|
|
14826
14844
|
var _x = React.useState(true),
|
|
14827
14845
|
showLoadingOverlay = _x[0],
|
|
14828
14846
|
setShowLoadingOverlay = _x[1];
|
|
@@ -14991,7 +15009,6 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
14991
15009
|
var onClearBtnClicked = React.useCallback(function () {
|
|
14992
15010
|
var _a, _b;
|
|
14993
15011
|
useVideoSignatureStore.setState({
|
|
14994
|
-
signatureStartedAt: undefined,
|
|
14995
15012
|
signaturePadEmpty: true,
|
|
14996
15013
|
signatureValid: false
|
|
14997
15014
|
});
|
|
@@ -15042,7 +15059,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
|
|
|
15042
15059
|
throttleMs: 250,
|
|
15043
15060
|
onModelError: props.onModelError,
|
|
15044
15061
|
modelLoadTimeoutMs: props.modelLoadTimeoutMs,
|
|
15045
|
-
requireVerticalFaceCentering: false
|
|
15062
|
+
requireVerticalFaceCentering: false,
|
|
15063
|
+
minCaptureBrightnessThreshold: props.minCaptureBrightnessThreshold,
|
|
15064
|
+
minCaptureRangeThreshold: props.minCaptureRangeThreshold,
|
|
15065
|
+
minCaptureVarianceThreshold: props.minCaptureVarianceThreshold
|
|
15046
15066
|
}, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizard, _assign({}, props, {
|
|
15047
15067
|
onRetryClicked: onRetryClicked
|
|
15048
15068
|
}))));
|
|
@@ -18793,6 +18813,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18793
18813
|
guidesComponent = _a.guidesComponent,
|
|
18794
18814
|
_q = _a.showFaceGuideThenSignaturePad,
|
|
18795
18815
|
showFaceGuideThenSignaturePad = _q === void 0 ? false : _q,
|
|
18816
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
18817
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
18818
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold,
|
|
18796
18819
|
_r = _a.theme,
|
|
18797
18820
|
theme = _r === void 0 ? 'default' : _r,
|
|
18798
18821
|
classNames = _a.classNames,
|
|
@@ -18863,6 +18886,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18863
18886
|
allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError,
|
|
18864
18887
|
guidesComponent: guidesComponent,
|
|
18865
18888
|
showFaceGuideThenSignaturePad: showFaceGuideThenSignaturePad,
|
|
18889
|
+
minCaptureBrightnessThreshold: minCaptureBrightnessThreshold,
|
|
18890
|
+
minCaptureRangeThreshold: minCaptureRangeThreshold,
|
|
18891
|
+
minCaptureVarianceThreshold: minCaptureVarianceThreshold,
|
|
18866
18892
|
classNames: classNames,
|
|
18867
18893
|
colors: colors,
|
|
18868
18894
|
debugMode: debugMode,
|
|
@@ -18870,7 +18896,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18870
18896
|
onModelError: onModelError,
|
|
18871
18897
|
onUserCancel: onUserCancel
|
|
18872
18898
|
};
|
|
18873
|
-
}, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onSelfieCaptured, customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, minSignaturePadPoints, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, restartVideoOnSignaturePadCleared, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, guidesComponent, showFaceGuideThenSignaturePad, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
|
|
18899
|
+
}, [onLoadingStarted, onLoadingProgress, onLoadingCompleted, onLoadingFailed, onSelfieCaptured, customOverlayContent, onLoadingOverlayDismissed, loadingOverlayMode, skipSuccessScreen, captureAudio, minSignaturePadPoints, headTrackingDisabled, headTrackingBoundaryPercentage, headTrackingBoundaryType, modelLoadTimeoutMs, faceLivenessProps, allowSignatureAfterLivenessCheckFailure, restartVideoOnSignaturePadCleared, skipLivenessValidation, allowManualSelfieCaptureOnLoadingError, guidesComponent, showFaceGuideThenSignaturePad, minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold, classNames, colors, debugMode, verbiage, onModelError, onUserCancel])
|
|
18874
18900
|
})))));
|
|
18875
18901
|
};
|
|
18876
18902
|
|