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
package/dist/sdk2.esm.js
CHANGED
|
@@ -205,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
205
205
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
-
var webSdkVersion = '2.3.
|
|
208
|
+
var webSdkVersion = '2.3.88';
|
|
209
209
|
|
|
210
210
|
function getPlatform() {
|
|
211
211
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -1145,12 +1145,6 @@ var SubmissionContext = /*#__PURE__*/createContext({
|
|
|
1145
1145
|
setIdCaptureVideoUrl: function setIdCaptureVideoUrl() {
|
|
1146
1146
|
return null;
|
|
1147
1147
|
},
|
|
1148
|
-
setSignatureStartTimestamp: function setSignatureStartTimestamp() {
|
|
1149
|
-
return null;
|
|
1150
|
-
},
|
|
1151
|
-
setSignatureEndTimestamp: function setSignatureEndTimestamp() {
|
|
1152
|
-
return null;
|
|
1153
|
-
},
|
|
1154
1148
|
setIdCaptureVideoIdFrontImage: function setIdCaptureVideoIdFrontImage() {
|
|
1155
1149
|
return null;
|
|
1156
1150
|
},
|
|
@@ -1315,50 +1309,44 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1315
1309
|
signatureVideoUrl = _16[0],
|
|
1316
1310
|
setSignatureVideoUrl = _16[1];
|
|
1317
1311
|
var _17 = useState(null),
|
|
1318
|
-
|
|
1319
|
-
|
|
1312
|
+
idCaptureVideoUrl = _17[0],
|
|
1313
|
+
setIdCaptureVideoUrl = _17[1];
|
|
1320
1314
|
var _18 = useState(null),
|
|
1321
|
-
|
|
1322
|
-
|
|
1315
|
+
idCaptureVideoIdFrontImage = _18[0],
|
|
1316
|
+
setIdCaptureVideoIdFrontImage = _18[1];
|
|
1323
1317
|
var _19 = useState(null),
|
|
1324
|
-
|
|
1325
|
-
|
|
1318
|
+
idCaptureVideoIdBackImage = _19[0],
|
|
1319
|
+
setIdCaptureVideoIdBackImage = _19[1];
|
|
1326
1320
|
var _20 = useState(null),
|
|
1327
|
-
|
|
1328
|
-
|
|
1321
|
+
idCaptureVideoAudioUrl = _20[0],
|
|
1322
|
+
setIdCaptureVideoAudioUrl = _20[1];
|
|
1329
1323
|
var _21 = useState(null),
|
|
1330
|
-
|
|
1331
|
-
|
|
1324
|
+
idCaptureVideoAudioStartsAt = _21[0],
|
|
1325
|
+
setIdCaptureVideoAudioStartsAt = _21[1];
|
|
1332
1326
|
var _22 = useState(null),
|
|
1333
|
-
|
|
1334
|
-
|
|
1327
|
+
expectedAudioText = _22[0],
|
|
1328
|
+
setExpectedAudioText = _22[1];
|
|
1335
1329
|
var _23 = useState(null),
|
|
1336
|
-
|
|
1337
|
-
|
|
1330
|
+
additionalDocuments = _23[0],
|
|
1331
|
+
setAdditionalDocuments = _23[1];
|
|
1338
1332
|
var _24 = useState(null),
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
var _25 = useState(
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
var _26 = useState(
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
var _27 = useState(
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
var _28 = useState(
|
|
1351
|
-
|
|
1352
|
-
|
|
1333
|
+
geolocationResult = _24[0],
|
|
1334
|
+
setGeolocationResult = _24[1];
|
|
1335
|
+
var _25 = useState(0),
|
|
1336
|
+
geolocationAttempts = _25[0],
|
|
1337
|
+
setGeolocationAttempts = _25[1];
|
|
1338
|
+
var _26 = useState(false),
|
|
1339
|
+
geolocationBlocked = _26[0],
|
|
1340
|
+
setGeolocationBlocked = _26[1];
|
|
1341
|
+
var _27 = useState([]),
|
|
1342
|
+
idFrontCaptureAttempts = _27[0],
|
|
1343
|
+
setIdFrontCaptureAttempts = _27[1];
|
|
1344
|
+
var _28 = useState([]),
|
|
1345
|
+
idBackCaptureAttempts = _28[0],
|
|
1346
|
+
setIdBackCaptureAttempts = _28[1];
|
|
1353
1347
|
var _29 = useState([]),
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
var _30 = useState([]),
|
|
1357
|
-
idBackCaptureAttempts = _30[0],
|
|
1358
|
-
setIdBackCaptureAttempts = _30[1];
|
|
1359
|
-
var _31 = useState([]),
|
|
1360
|
-
selfieCaptureAttempts = _31[0],
|
|
1361
|
-
setSelfieCaptureAttempts = _31[1];
|
|
1348
|
+
selfieCaptureAttempts = _29[0],
|
|
1349
|
+
setSelfieCaptureAttempts = _29[1];
|
|
1362
1350
|
var logIdFrontCaptureAttempt = useCallback(function (attempt) {
|
|
1363
1351
|
setIdFrontCaptureAttempts(function (attempts) {
|
|
1364
1352
|
return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
|
|
@@ -1635,12 +1623,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1635
1623
|
submissionRequest.customerData.signatureData.signatureVideo = documents.signatureVideo;
|
|
1636
1624
|
}
|
|
1637
1625
|
}
|
|
1638
|
-
if (signatureStartTimestamp) {
|
|
1639
|
-
submissionRequest.customerData.signatureStartTimestamp = signatureStartTimestamp;
|
|
1640
|
-
}
|
|
1641
|
-
if (signatureEndTimestamp) {
|
|
1642
|
-
submissionRequest.customerData.signatureEndTimestamp = signatureEndTimestamp;
|
|
1643
|
-
}
|
|
1644
1626
|
if (additionalDocuments) {
|
|
1645
1627
|
submissionRequest.customerData.additionalDocuments = additionalDocuments.map(function (d) {
|
|
1646
1628
|
return _assign(_assign({}, d), {
|
|
@@ -1683,7 +1665,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1683
1665
|
}
|
|
1684
1666
|
});
|
|
1685
1667
|
});
|
|
1686
|
-
}, [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,
|
|
1668
|
+
}, [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]);
|
|
1687
1669
|
var defaultOnSubmit = useCallback(function () {
|
|
1688
1670
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1689
1671
|
var submissionResponse_1, payload, host, endpoint, response, statusMessage, submissionResponse_2, e_1, err;
|
|
@@ -1980,8 +1962,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
|
|
|
1980
1962
|
setSelfieImage: setSelfieImage,
|
|
1981
1963
|
setSignatureData: setSignatureData,
|
|
1982
1964
|
setSignatureVideoUrl: setSignatureVideoUrl,
|
|
1983
|
-
setSignatureStartTimestamp: setSignatureStartTimestamp,
|
|
1984
|
-
setSignatureEndTimestamp: setSignatureEndTimestamp,
|
|
1985
1965
|
setIdCaptureVideoUrl: setIdCaptureVideoUrl,
|
|
1986
1966
|
setIdCaptureVideoIdFrontImage: setIdCaptureVideoIdFrontImage,
|
|
1987
1967
|
setIdCaptureVideoIdBackImage: setIdCaptureVideoIdBackImage,
|
|
@@ -2896,14 +2876,29 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2896
2876
|
// 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.
|
|
2897
2877
|
_k = _a.noseTrackingThreshold,
|
|
2898
2878
|
// 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.
|
|
2899
|
-
noseTrackingThreshold = _k === void 0 ? 0.2 : _k
|
|
2879
|
+
noseTrackingThreshold = _k === void 0 ? 0.2 : _k,
|
|
2880
|
+
// 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
|
|
2881
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
2882
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
2883
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold,
|
|
2884
|
+
brightness = _a.brightness,
|
|
2885
|
+
range = _a.range,
|
|
2886
|
+
variance = _a.variance;
|
|
2900
2887
|
var face = faces[0];
|
|
2901
2888
|
var faceNotDetected = faces.length === 0;
|
|
2902
2889
|
var faceNotCentered = false,
|
|
2903
2890
|
faceLookingAway = false,
|
|
2904
2891
|
faceTooClose = false,
|
|
2905
|
-
faceTooFar = false
|
|
2906
|
-
|
|
2892
|
+
faceTooFar = false,
|
|
2893
|
+
faceVisibilityTooLow = false;
|
|
2894
|
+
var hasAnyThreshold = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
2895
|
+
if (hasAnyThreshold) {
|
|
2896
|
+
var tooDark = minCaptureBrightnessThreshold !== undefined && brightness !== undefined && brightness < minCaptureBrightnessThreshold;
|
|
2897
|
+
var tooLowRange = minCaptureRangeThreshold !== undefined && range !== undefined && range < minCaptureRangeThreshold;
|
|
2898
|
+
var tooLowVariance = minCaptureVarianceThreshold !== undefined && variance !== undefined && variance < minCaptureVarianceThreshold;
|
|
2899
|
+
faceVisibilityTooLow = !!(tooDark || tooLowRange || tooLowVariance);
|
|
2900
|
+
}
|
|
2901
|
+
if (face && !faceVisibilityTooLow) {
|
|
2907
2902
|
// calculate frame centroids
|
|
2908
2903
|
var frameCX = videoWidth / 2;
|
|
2909
2904
|
var frameCY = videoHeight / 2;
|
|
@@ -2942,7 +2937,7 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2942
2937
|
}
|
|
2943
2938
|
var faceIsStable = false,
|
|
2944
2939
|
noseIsStable = false;
|
|
2945
|
-
if (faceInGuides) {
|
|
2940
|
+
if (faceInGuides && !faceVisibilityTooLow) {
|
|
2946
2941
|
var framesNeeded = Math.max(Math.ceil(average(framesNeededSamples$1)), 5);
|
|
2947
2942
|
trackFace(face, framesNeeded, videoWidth, videoHeight);
|
|
2948
2943
|
faceIsStable = lastNFaces.length >= framesNeeded && !lastNFacePairs.some(function (pair) {
|
|
@@ -2952,7 +2947,7 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2952
2947
|
return pair.distance > noseDistanceThreshold;
|
|
2953
2948
|
});
|
|
2954
2949
|
}
|
|
2955
|
-
var faceReady = faceInGuides && faceIsStable && noseIsStable;
|
|
2950
|
+
var faceReady = faceInGuides && faceIsStable && noseIsStable && !faceVisibilityTooLow;
|
|
2956
2951
|
return {
|
|
2957
2952
|
face: face,
|
|
2958
2953
|
faceNotDetected: faceNotDetected,
|
|
@@ -2963,7 +2958,8 @@ function processFaceDetectorPrediction(_a) {
|
|
|
2963
2958
|
faceReady: faceReady,
|
|
2964
2959
|
faceReadyAt: faceReady ? new Date() : null,
|
|
2965
2960
|
faceIsStable: faceIsStable,
|
|
2966
|
-
noseIsStable: noseIsStable
|
|
2961
|
+
noseIsStable: noseIsStable,
|
|
2962
|
+
faceVisibilityTooLow: faceVisibilityTooLow
|
|
2967
2963
|
};
|
|
2968
2964
|
}
|
|
2969
2965
|
function testFaceDetectionAgainstKnownImage(detector) {
|
|
@@ -3840,6 +3836,7 @@ var es = {
|
|
|
3840
3836
|
'Move forward...': 'Hay que moverse hacia adelante...',
|
|
3841
3837
|
'Move to the center...': 'Hay que moverse hacia el centro...',
|
|
3842
3838
|
'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
|
|
3839
|
+
'Improve lighting conditions...': 'Hay que buscar mejor iluminación...',
|
|
3843
3840
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
|
|
3844
3841
|
'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
|
|
3845
3842
|
'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
|
|
@@ -3971,6 +3968,7 @@ var de = {
|
|
|
3971
3968
|
'Move forward...': 'Nach vorne bewegen...',
|
|
3972
3969
|
'Move to the center...': 'In die Mitte bewegen...',
|
|
3973
3970
|
'Waiting for face to be detected...': 'Warte auf die Gesichtserkennung...',
|
|
3971
|
+
'Improve lighting conditions...': 'Beleuchtungsbedingungen verbessern...',
|
|
3974
3972
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Bitte Augenbedeckung entfernen (Sonnenbrille, Augenklappe usw.)...',
|
|
3975
3973
|
'Please remove your head coverings (hat scarf etc.)...': 'Bitte Kopfbedeckung abnehmen (Mütze, Schal usw.)...',
|
|
3976
3974
|
'Please remove your mask...': 'Bitte Maske ablegen...',
|
|
@@ -4102,6 +4100,7 @@ var fr = {
|
|
|
4102
4100
|
'Move forward...': 'Avancez...',
|
|
4103
4101
|
'Move to the center...': 'Déplacez-vous vers le centre...',
|
|
4104
4102
|
'Waiting for face to be detected...': 'En attente de détection du visage...',
|
|
4103
|
+
'Improve lighting conditions...': "Améliorer les conditions d'éclairage...",
|
|
4105
4104
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Veuillez retirer ce qui recouvre vos yeux (lunettes de soleil, cache-œil, etc.)...',
|
|
4106
4105
|
'Please remove your head coverings (hat scarf etc.)...': 'Veuillez retirer vos couvre-chefs (chapeau, foulard, etc.)...',
|
|
4107
4106
|
'Please remove your mask...': 'Veuillez retirer votre masque...',
|
|
@@ -4233,6 +4232,7 @@ var it = {
|
|
|
4233
4232
|
'Move forward...': 'Spostarsi più vicino...',
|
|
4234
4233
|
'Move to the center...': 'Spostarsi al centro...',
|
|
4235
4234
|
'Waiting for face to be detected...': 'In attesa che venga rilevato il volto...',
|
|
4235
|
+
'Improve lighting conditions...': 'Migliorare le condizioni di illuminazione...',
|
|
4236
4236
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Rimuovere tutto ciò che copre gli occhi (occhiali da sole, bende, ecc.)...',
|
|
4237
4237
|
'Please remove your head coverings (hat scarf etc.)...': 'Rimuovere tutto ciò che ricopre il capo (cappello, sciarpa, ecc.)...',
|
|
4238
4238
|
'Please remove your mask...': 'Rimuovere la mascherina...',
|
|
@@ -4364,6 +4364,7 @@ var ja = {
|
|
|
4364
4364
|
'Move forward...': '近づいてください…',
|
|
4365
4365
|
'Move to the center...': '中央へ移動してください…',
|
|
4366
4366
|
'Waiting for face to be detected...': '顔が検出されるのを待っています…',
|
|
4367
|
+
'Improve lighting conditions...': '照明条件を改善してください…',
|
|
4367
4368
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': '目を覆うもの(サングラスや眼帯など)を取り外してください…',
|
|
4368
4369
|
'Please remove your head coverings (hat scarf etc.)...': '頭を覆うもの(帽子やスカーフなど)を取り外してください…',
|
|
4369
4370
|
'Please remove your mask...': 'マスクを取り外してください…',
|
|
@@ -4495,6 +4496,7 @@ var pt = {
|
|
|
4495
4496
|
'Move forward...': 'Mover para frente...',
|
|
4496
4497
|
'Move to the center...': 'Mover para o centro...',
|
|
4497
4498
|
'Waiting for face to be detected...': 'Aguardando a detecção de rosto...',
|
|
4499
|
+
'Improve lighting conditions...': 'Melhore as condições de iluminação...',
|
|
4498
4500
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Por favor, remova as coberturas dos olhos (óculos de sol, tapa-olho, etc.)...',
|
|
4499
4501
|
'Please remove your head coverings (hat scarf etc.)...': 'Por favor, remova as coberturas da cabeça (chapéu, cachecol, etc.)...',
|
|
4500
4502
|
'Please remove your mask...': 'Por favor, remova sua máscara...',
|
|
@@ -4626,6 +4628,7 @@ var ru = {
|
|
|
4626
4628
|
'Move forward...': 'Подвиньтесь вперед…',
|
|
4627
4629
|
'Move to the center...': 'Переместите к центру…',
|
|
4628
4630
|
'Waiting for face to be detected...': 'Ожидание обнаружения лица…',
|
|
4631
|
+
'Improve lighting conditions...': 'Улучшите условия освещения…',
|
|
4629
4632
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Снимите предметы, закрывающие глаза (солнцезащитные очки, повязку и т.д.)…',
|
|
4630
4633
|
'Please remove your head coverings (hat scarf etc.)...': 'Снимите предметы, покрывающие голову (шапку, шарф и т.д.)…',
|
|
4631
4634
|
'Please remove your mask...': 'Снимите маску…',
|
|
@@ -4757,6 +4760,7 @@ var zh = {
|
|
|
4757
4760
|
'Move forward...': '請前進...',
|
|
4758
4761
|
'Move to the center...': '請移至中心...',
|
|
4759
4762
|
'Waiting for face to be detected...': '正在等待臉部辨識...',
|
|
4763
|
+
'Improve lighting conditions...': '改善照明條件...',
|
|
4760
4764
|
'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
|
|
4761
4765
|
'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
|
|
4762
4766
|
'Please remove your mask...': '請脫下口罩...',
|
|
@@ -11636,6 +11640,110 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
|
|
|
11636
11640
|
};
|
|
11637
11641
|
var templateObject_1$n, templateObject_2$l;
|
|
11638
11642
|
|
|
11643
|
+
function detectBrightnessAndContrast(frame, brightnessAverager) {
|
|
11644
|
+
var ctx = frame.getContext('2d');
|
|
11645
|
+
if (!ctx || frame.width === 0 || frame.height === 0) return {};
|
|
11646
|
+
var imageData = ctx.getImageData(0, 0, frame.width, frame.height);
|
|
11647
|
+
var pixels = imageData.data; // This is already Uint8ClampedArray
|
|
11648
|
+
var width = frame.width;
|
|
11649
|
+
var sampleResolution = 10;
|
|
11650
|
+
var xStep = Math.max(1, Math.floor(width / sampleResolution));
|
|
11651
|
+
var yStep = Math.max(1, Math.floor(frame.height / sampleResolution));
|
|
11652
|
+
var brightness = 0;
|
|
11653
|
+
var brightnessForVariance = 0;
|
|
11654
|
+
var minBrightness = Infinity;
|
|
11655
|
+
var maxBrightness = -Infinity;
|
|
11656
|
+
var iterations = 0;
|
|
11657
|
+
for (var y = Math.floor(yStep / 2); y < frame.height; y += yStep) {
|
|
11658
|
+
for (var x = Math.floor(xStep / 2); x < width; x += xStep) {
|
|
11659
|
+
var pixelIndex = (y * width + x) * 4;
|
|
11660
|
+
var r = pixels[pixelIndex];
|
|
11661
|
+
var g = pixels[pixelIndex + 1];
|
|
11662
|
+
var b = pixels[pixelIndex + 2];
|
|
11663
|
+
// https://en.wikipedia.org/wiki/Relative_luminance
|
|
11664
|
+
// pixels are represented by 4 channels/bytes, thus a step of 4
|
|
11665
|
+
// the luminance formula is: 0.2126 * R + 0.7152 * G + 0.0722 * B (alpha is not used in this formula)
|
|
11666
|
+
var luminance = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
11667
|
+
brightness += luminance;
|
|
11668
|
+
brightnessForVariance += luminance * luminance;
|
|
11669
|
+
minBrightness = Math.min(minBrightness, luminance);
|
|
11670
|
+
maxBrightness = Math.max(maxBrightness, luminance);
|
|
11671
|
+
iterations++;
|
|
11672
|
+
}
|
|
11673
|
+
}
|
|
11674
|
+
var _a = brightnessAverager(brightness / iterations),
|
|
11675
|
+
avg = _a.avg,
|
|
11676
|
+
isFull = _a.isFull;
|
|
11677
|
+
var range = maxBrightness - minBrightness;
|
|
11678
|
+
var variance = brightnessForVariance / iterations - Math.pow(brightness / iterations, 2);
|
|
11679
|
+
return {
|
|
11680
|
+
brightness: isFull ? avg : undefined,
|
|
11681
|
+
range: isFull ? range : undefined,
|
|
11682
|
+
variance: isFull ? variance : undefined
|
|
11683
|
+
};
|
|
11684
|
+
}
|
|
11685
|
+
function createRunningAvgFIFO(capacity) {
|
|
11686
|
+
var cap = capacity | 0;
|
|
11687
|
+
var buf = new Float64Array(cap);
|
|
11688
|
+
var head = 0; // next write index
|
|
11689
|
+
var count = 0; // how many valid items (<= cap)
|
|
11690
|
+
var sum = 0;
|
|
11691
|
+
return {
|
|
11692
|
+
add: function add(x) {
|
|
11693
|
+
if (count === cap) {
|
|
11694
|
+
sum -= buf[head];
|
|
11695
|
+
} else {
|
|
11696
|
+
count++;
|
|
11697
|
+
}
|
|
11698
|
+
buf[head] = x;
|
|
11699
|
+
sum += x;
|
|
11700
|
+
head = head + 1 === cap ? 0 : head + 1;
|
|
11701
|
+
return {
|
|
11702
|
+
avg: sum / count,
|
|
11703
|
+
isFull: count === cap
|
|
11704
|
+
};
|
|
11705
|
+
},
|
|
11706
|
+
avg: function avg() {
|
|
11707
|
+
return count ? sum / count : 0;
|
|
11708
|
+
},
|
|
11709
|
+
size: function size() {
|
|
11710
|
+
return count;
|
|
11711
|
+
},
|
|
11712
|
+
clear: function clear() {
|
|
11713
|
+
head = 0;
|
|
11714
|
+
count = 0;
|
|
11715
|
+
sum = 0;
|
|
11716
|
+
},
|
|
11717
|
+
isFull: function isFull() {
|
|
11718
|
+
return count === cap;
|
|
11719
|
+
}
|
|
11720
|
+
};
|
|
11721
|
+
}
|
|
11722
|
+
function useRunningAvg(capacity) {
|
|
11723
|
+
var fifoRef = useRef();
|
|
11724
|
+
if (!fifoRef.current) fifoRef.current = createRunningAvgFIFO(capacity);
|
|
11725
|
+
useEffect(function () {
|
|
11726
|
+
fifoRef.current = createRunningAvgFIFO(capacity);
|
|
11727
|
+
}, [capacity]);
|
|
11728
|
+
return {
|
|
11729
|
+
addToAverage: function addToAverage(x) {
|
|
11730
|
+
return fifoRef.current.add(x);
|
|
11731
|
+
},
|
|
11732
|
+
average: function average() {
|
|
11733
|
+
return fifoRef.current.avg();
|
|
11734
|
+
},
|
|
11735
|
+
size: function size() {
|
|
11736
|
+
return fifoRef.current.size();
|
|
11737
|
+
},
|
|
11738
|
+
isFull: function isFull() {
|
|
11739
|
+
return fifoRef.current.isFull();
|
|
11740
|
+
},
|
|
11741
|
+
clear: function clear() {
|
|
11742
|
+
return fifoRef.current.clear();
|
|
11743
|
+
}
|
|
11744
|
+
};
|
|
11745
|
+
}
|
|
11746
|
+
|
|
11639
11747
|
var SelfieGuidanceModelsContext = /*#__PURE__*/createContext({
|
|
11640
11748
|
start: function start() {
|
|
11641
11749
|
return null;
|
|
@@ -11665,7 +11773,10 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11665
11773
|
_c = _a.modelLoadTimeoutMs,
|
|
11666
11774
|
modelLoadTimeoutMs = _c === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _c,
|
|
11667
11775
|
_d = _a.requireVerticalFaceCentering,
|
|
11668
|
-
requireVerticalFaceCentering = _d === void 0 ? true : _d
|
|
11776
|
+
requireVerticalFaceCentering = _d === void 0 ? true : _d,
|
|
11777
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
11778
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
11779
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold;
|
|
11669
11780
|
var _e = useCameraStore(useShallow(function (state) {
|
|
11670
11781
|
return {
|
|
11671
11782
|
videoRef: state.videoRef,
|
|
@@ -11678,6 +11789,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11678
11789
|
cameraReady = _e.cameraReady;
|
|
11679
11790
|
var canvasRef = useRef(null);
|
|
11680
11791
|
var onPredictionHandler = useRef();
|
|
11792
|
+
var addToAverage = useRunningAvg(5).addToAverage;
|
|
11681
11793
|
var _f = useLoadFaceDetector({
|
|
11682
11794
|
onModelError: onModelError,
|
|
11683
11795
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -11690,7 +11802,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11690
11802
|
modelError = _f.modelError;
|
|
11691
11803
|
var _g = useFrameLoop(useCallback(function () {
|
|
11692
11804
|
return __awaiter(_this, void 0, void 0, function () {
|
|
11693
|
-
var vw, vh, ctx, prediction, processed, e_1;
|
|
11805
|
+
var vw, vh, ctx, thresholdsProvided, brightnessResults, brightness, range, variance, prediction, processed, e_1;
|
|
11694
11806
|
var _a, _b;
|
|
11695
11807
|
return __generator(this, function (_c) {
|
|
11696
11808
|
switch (_c.label) {
|
|
@@ -11708,12 +11820,23 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11708
11820
|
_c.label = 1;
|
|
11709
11821
|
case 1:
|
|
11710
11822
|
_c.trys.push([1, 3,, 4]);
|
|
11823
|
+
thresholdsProvided = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
|
|
11824
|
+
brightnessResults = thresholdsProvided ? detectBrightnessAndContrast(canvasRef.current, addToAverage) : undefined;
|
|
11825
|
+
brightness = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.brightness;
|
|
11826
|
+
range = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.range;
|
|
11827
|
+
variance = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.variance;
|
|
11711
11828
|
prediction = makeFaceDetectorPrediction(canvasRef.current);
|
|
11712
11829
|
processed = processFaceDetectorPrediction({
|
|
11713
11830
|
faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
|
|
11714
11831
|
videoWidth: vw,
|
|
11715
11832
|
videoHeight: vh,
|
|
11716
|
-
requireVerticalFaceCentering: requireVerticalFaceCentering
|
|
11833
|
+
requireVerticalFaceCentering: requireVerticalFaceCentering,
|
|
11834
|
+
minCaptureBrightnessThreshold: minCaptureBrightnessThreshold,
|
|
11835
|
+
minCaptureRangeThreshold: minCaptureRangeThreshold,
|
|
11836
|
+
minCaptureVarianceThreshold: minCaptureVarianceThreshold,
|
|
11837
|
+
brightness: brightness,
|
|
11838
|
+
range: range,
|
|
11839
|
+
variance: variance
|
|
11717
11840
|
});
|
|
11718
11841
|
setLastFaceDetectionAt(new Date().getTime());
|
|
11719
11842
|
// setLastPrediction(processed)
|
|
@@ -11731,7 +11854,7 @@ function SelfieGuidanceModelsProvider(_a) {
|
|
|
11731
11854
|
}
|
|
11732
11855
|
});
|
|
11733
11856
|
});
|
|
11734
|
-
}, [cameraReady, modelError, ready, requireVerticalFaceCentering, videoLoaded, videoRef]), {
|
|
11857
|
+
}, [cameraReady, modelError, ready, requireVerticalFaceCentering, videoLoaded, videoRef, addToAverage, minCaptureBrightnessThreshold, minCaptureRangeThreshold, minCaptureVarianceThreshold]), {
|
|
11735
11858
|
throttleMs: throttleMs,
|
|
11736
11859
|
autoStart: autoStart
|
|
11737
11860
|
}),
|
|
@@ -12104,6 +12227,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
12104
12227
|
guidanceMoveForwardText: 'Move forward...',
|
|
12105
12228
|
guidanceMoveToCenterText: 'Move to the center...',
|
|
12106
12229
|
guidanceNoFaceDetectedText: 'Waiting for face to be detected...',
|
|
12230
|
+
guidanceVisibilityTooLowText: 'Improve lighting conditions...',
|
|
12107
12231
|
guidanceNotStableText: 'Please hold still...',
|
|
12108
12232
|
guidanceManualCaptureText: 'Position your face in the circle and click to capture.',
|
|
12109
12233
|
manualCaptureBtnText: 'Capture'
|
|
@@ -12111,7 +12235,7 @@ var SelfieCapture = function SelfieCapture(_a) {
|
|
|
12111
12235
|
var allowManualCapture = !!guidanceError && allowManualSelfieCaptureOnLoadingError;
|
|
12112
12236
|
var satisfied = allowManualCapture || ((_b = prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) !== null && _b !== void 0 ? _b : false);
|
|
12113
12237
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
12114
|
-
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 : '');
|
|
12238
|
+
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 : '');
|
|
12115
12239
|
if (guidanceError && !allowManualSelfieCaptureOnLoadingError) {
|
|
12116
12240
|
return /*#__PURE__*/React__default.createElement(SelfieCaptureFallback, {
|
|
12117
12241
|
classNames: classNames.fallback
|
|
@@ -13661,16 +13785,6 @@ var Container$4 = styled.div(templateObject_1$c || (templateObject_1$c = __makeT
|
|
|
13661
13785
|
var AcceptBtn$1 = styled(LoaderButton)(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
|
|
13662
13786
|
var templateObject_1$c, templateObject_2$b;
|
|
13663
13787
|
|
|
13664
|
-
function isBlob(blobPart) {
|
|
13665
|
-
return typeof Blob !== 'undefined' && blobPart instanceof Blob;
|
|
13666
|
-
}
|
|
13667
|
-
function inferBlobType(blobPart) {
|
|
13668
|
-
var _a;
|
|
13669
|
-
if (!isBlob(blobPart)) return undefined;
|
|
13670
|
-
var t = ((_a = blobPart.type) !== null && _a !== void 0 ? _a : '').trim();
|
|
13671
|
-
return t.length > 0 ? t : undefined;
|
|
13672
|
-
}
|
|
13673
|
-
|
|
13674
13788
|
var videoRecorder = null;
|
|
13675
13789
|
var audioRecorder = null;
|
|
13676
13790
|
var videoChunks = [];
|
|
@@ -13804,9 +13918,8 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13804
13918
|
useVideoRecorderStore.getState().clearRecordedData();
|
|
13805
13919
|
}, []);
|
|
13806
13920
|
var processVideo = useCallback(function () {
|
|
13807
|
-
var inferredType = inferBlobType(videoChunks[0]) || (videoRecorder === null || videoRecorder === void 0 ? void 0 : videoRecorder.mimeType) || 'video/mp4';
|
|
13808
13921
|
var videoBlob = new Blob(videoChunks, {
|
|
13809
|
-
type:
|
|
13922
|
+
type: 'video/mp4'
|
|
13810
13923
|
});
|
|
13811
13924
|
useVideoRecorderStore.setState({
|
|
13812
13925
|
videoUrl: URL.createObjectURL(videoBlob),
|
|
@@ -13816,9 +13929,8 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13816
13929
|
setVideoRecorder(null);
|
|
13817
13930
|
}, []);
|
|
13818
13931
|
var processAudio = useCallback(function () {
|
|
13819
|
-
var inferredType = inferBlobType(audioChunks[0]) || (audioRecorder === null || audioRecorder === void 0 ? void 0 : audioRecorder.mimeType) || 'audio/mp4';
|
|
13820
13932
|
var audioBlob = new Blob(audioChunks, {
|
|
13821
|
-
type:
|
|
13933
|
+
type: 'audio/mp4'
|
|
13822
13934
|
});
|
|
13823
13935
|
useVideoRecorderStore.setState({
|
|
13824
13936
|
audioUrl: URL.createObjectURL(audioBlob),
|
|
@@ -13858,7 +13970,6 @@ var useVideoRecorder = function useVideoRecorder(mergeAVStreams) {
|
|
|
13858
13970
|
}, [audioRecordingIntentionallyStopped, audioRecordingStopped, audioUrl, isRecordingAudio, isRecordingVideo, videoRecordingIntentionallyStopped, videoRecordingStopped, videoUrl]);
|
|
13859
13971
|
};
|
|
13860
13972
|
|
|
13861
|
-
var RECORDING_TIMESTAMP_PADDING_MS = 1000;
|
|
13862
13973
|
var signatureRecorder = null;
|
|
13863
13974
|
var signatureChunks = [];
|
|
13864
13975
|
var videoSignatureInitialState = {
|
|
@@ -13871,6 +13982,7 @@ var videoSignatureInitialState = {
|
|
|
13871
13982
|
clearRecordedData: function clearRecordedData() {
|
|
13872
13983
|
return null;
|
|
13873
13984
|
},
|
|
13985
|
+
isRecording: false,
|
|
13874
13986
|
signaturePad: {
|
|
13875
13987
|
current: null
|
|
13876
13988
|
},
|
|
@@ -13893,7 +14005,7 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
13893
14005
|
if (!camera) throw new Error('Camera not found');
|
|
13894
14006
|
// set our flag and clear whatever we have recorded so far.
|
|
13895
14007
|
set({
|
|
13896
|
-
|
|
14008
|
+
isRecording: true
|
|
13897
14009
|
});
|
|
13898
14010
|
signatureChunks = [];
|
|
13899
14011
|
// start recording video and audio
|
|
@@ -13907,52 +14019,27 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
13907
14019
|
videoBitsPerSecond: 270000,
|
|
13908
14020
|
audioBitsPerSecond: 32000
|
|
13909
14021
|
});
|
|
13910
|
-
var hasFirstChunk = false;
|
|
13911
14022
|
signatureRecorder.ondataavailable = function (event) {
|
|
13912
14023
|
signatureChunks.push(event.data);
|
|
13913
|
-
if (!hasFirstChunk) {
|
|
13914
|
-
hasFirstChunk = true;
|
|
13915
|
-
set({
|
|
13916
|
-
firstChunkReceivedAt: performance.now(),
|
|
13917
|
-
lastChunkReceivedAt: performance.now()
|
|
13918
|
-
});
|
|
13919
|
-
} else {
|
|
13920
|
-
set({
|
|
13921
|
-
lastChunkReceivedAt: performance.now()
|
|
13922
|
-
});
|
|
13923
|
-
}
|
|
13924
14024
|
};
|
|
13925
14025
|
signatureRecorder.start(100);
|
|
13926
14026
|
},
|
|
13927
14027
|
stopRecording: function stopRecording(signatureData, imageUrl) {
|
|
13928
14028
|
set({
|
|
13929
|
-
|
|
13930
|
-
recordingStoppedAt: performance.now()
|
|
13931
|
-
});
|
|
13932
|
-
waitForOneMoreChunk().then(function () {
|
|
13933
|
-
if (!signatureRecorder) return;
|
|
13934
|
-
signatureRecorder.stop();
|
|
13935
|
-
signatureRecorder.onstop = function () {
|
|
13936
|
-
var inferredType = inferBlobType(signatureChunks[0]) || (signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.mimeType) || 'video/mp4';
|
|
13937
|
-
var blob = new Blob(signatureChunks, {
|
|
13938
|
-
type: inferredType
|
|
13939
|
-
});
|
|
13940
|
-
signatureChunks = [];
|
|
13941
|
-
signatureRecorder = null;
|
|
13942
|
-
if (!signatureData) return;
|
|
13943
|
-
var _a = get(),
|
|
13944
|
-
onSignatureVideoCaptured = _a.onSignatureVideoCaptured,
|
|
13945
|
-
recordingStartedAt = _a.recordingStartedAt,
|
|
13946
|
-
signatureStartedAt = _a.signatureStartedAt,
|
|
13947
|
-
signatureEndedAt = _a.signatureEndedAt,
|
|
13948
|
-
lastChunkReceivedAt = _a.lastChunkReceivedAt;
|
|
13949
|
-
var endMs = Math.min(signatureEndedAt !== null && signatureEndedAt !== void 0 ? signatureEndedAt : Infinity, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity);
|
|
13950
|
-
var signatureStartTimestamp = signatureStartedAt && recordingStartedAt ? formatTimestamp(Math.max(0, signatureStartedAt - recordingStartedAt - RECORDING_TIMESTAMP_PADDING_MS)) : undefined;
|
|
13951
|
-
var signatureEndTimestamp = endMs !== Infinity && recordingStartedAt ? formatTimestamp(Math.min(endMs - recordingStartedAt + RECORDING_TIMESTAMP_PADDING_MS, lastChunkReceivedAt !== null && lastChunkReceivedAt !== void 0 ? lastChunkReceivedAt : Infinity)) : undefined;
|
|
13952
|
-
onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null, signatureStartTimestamp, signatureEndTimestamp);
|
|
13953
|
-
};
|
|
13954
|
-
useVideoRecorderStore.getState().stopRecording();
|
|
14029
|
+
isRecording: false
|
|
13955
14030
|
});
|
|
14031
|
+
if (!signatureRecorder) return;
|
|
14032
|
+
signatureRecorder.stop();
|
|
14033
|
+
signatureRecorder.onstop = function () {
|
|
14034
|
+
var blob = new Blob(signatureChunks, {
|
|
14035
|
+
type: 'video/mp4'
|
|
14036
|
+
});
|
|
14037
|
+
signatureChunks = [];
|
|
14038
|
+
signatureRecorder = null;
|
|
14039
|
+
if (!signatureData) return;
|
|
14040
|
+
get().onSignatureVideoCaptured(blob, signatureData, imageUrl !== null && imageUrl !== void 0 ? imageUrl : null);
|
|
14041
|
+
};
|
|
14042
|
+
useVideoRecorderStore.getState().stopRecording();
|
|
13956
14043
|
},
|
|
13957
14044
|
clearRecordedData: function clearRecordedData() {
|
|
13958
14045
|
signatureChunks = [];
|
|
@@ -13961,42 +14048,13 @@ var useVideoSignatureStore = create()(devtools(function (set, get) {
|
|
|
13961
14048
|
signatureRecorder === null || signatureRecorder === void 0 ? void 0 : signatureRecorder.stop();
|
|
13962
14049
|
signatureRecorder = null;
|
|
13963
14050
|
set({
|
|
13964
|
-
|
|
13965
|
-
recordingStoppedAt: undefined,
|
|
13966
|
-
firstChunkReceivedAt: undefined,
|
|
13967
|
-
lastChunkReceivedAt: undefined,
|
|
14051
|
+
isRecording: false,
|
|
13968
14052
|
signaturePadEmpty: true,
|
|
13969
|
-
signatureValid: false
|
|
13970
|
-
signatureStartedAt: undefined,
|
|
13971
|
-
signatureEndedAt: undefined
|
|
14053
|
+
signatureValid: false
|
|
13972
14054
|
});
|
|
13973
14055
|
}
|
|
13974
14056
|
});
|
|
13975
14057
|
}));
|
|
13976
|
-
function waitForOneMoreChunk(timeoutMs) {
|
|
13977
|
-
if (timeoutMs === void 0) {
|
|
13978
|
-
timeoutMs = 3000;
|
|
13979
|
-
}
|
|
13980
|
-
var start = performance.now();
|
|
13981
|
-
return new Promise(function (resolve) {
|
|
13982
|
-
var initialLastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
13983
|
-
if (!initialLastChunkReceivedAt) return resolve();
|
|
13984
|
-
function gotAChunk() {
|
|
13985
|
-
var lastChunkReceivedAt = useVideoSignatureStore.getState().lastChunkReceivedAt;
|
|
13986
|
-
return performance.now() - start > timeoutMs || !lastChunkReceivedAt || !initialLastChunkReceivedAt || lastChunkReceivedAt > initialLastChunkReceivedAt;
|
|
13987
|
-
}
|
|
13988
|
-
setTimeout(function () {
|
|
13989
|
-
if (gotAChunk()) return resolve(); // check immediately
|
|
13990
|
-
// otherwise, check every 100ms
|
|
13991
|
-
var interval = setInterval(function () {
|
|
13992
|
-
if (gotAChunk()) {
|
|
13993
|
-
clearInterval(interval);
|
|
13994
|
-
resolve();
|
|
13995
|
-
}
|
|
13996
|
-
}, 100);
|
|
13997
|
-
}, 0);
|
|
13998
|
-
});
|
|
13999
|
-
}
|
|
14000
14058
|
function VideoSignatureContextProvider(_a) {
|
|
14001
14059
|
var _this = this;
|
|
14002
14060
|
var _b, _c;
|
|
@@ -14015,14 +14073,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14015
14073
|
// clear recorded data when the component is mounted
|
|
14016
14074
|
useVideoSignatureStore.getState().clearRecordedData();
|
|
14017
14075
|
}, []);
|
|
14018
|
-
var
|
|
14019
|
-
return {
|
|
14020
|
-
recordingStartedAt: state.recordingStartedAt,
|
|
14021
|
-
recordingStoppedAt: state.recordingStoppedAt
|
|
14022
|
-
};
|
|
14023
|
-
})),
|
|
14024
|
-
recordingStartedAt = _e.recordingStartedAt,
|
|
14025
|
-
recordingStoppedAt = _e.recordingStoppedAt;
|
|
14076
|
+
var isRecording = useVideoSignatureStore().isRecording;
|
|
14026
14077
|
useFrameLoop(useCallback(function () {
|
|
14027
14078
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14028
14079
|
var signaturePad, ctx, _a, w, h, isPortrait, rect;
|
|
@@ -14049,7 +14100,7 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14049
14100
|
});
|
|
14050
14101
|
});
|
|
14051
14102
|
}, [videoRef]), {
|
|
14052
|
-
autoStart:
|
|
14103
|
+
autoStart: isRecording,
|
|
14053
14104
|
throttleMs: 1000 / 24
|
|
14054
14105
|
});
|
|
14055
14106
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -14058,17 +14109,6 @@ function VideoSignatureContextProvider(_a) {
|
|
|
14058
14109
|
height: (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.videoHeight
|
|
14059
14110
|
}));
|
|
14060
14111
|
}
|
|
14061
|
-
function formatTimestamp(durationMs) {
|
|
14062
|
-
// should be in the format of 00:00:00:00 (hh:mm:ss:cs)
|
|
14063
|
-
var hours = Math.floor(durationMs / 3600000);
|
|
14064
|
-
var minutes = Math.floor(durationMs % 3600000 / 60000);
|
|
14065
|
-
var seconds = Math.floor(durationMs % 60000 / 1000);
|
|
14066
|
-
var milliseconds = durationMs % 1000;
|
|
14067
|
-
// Convert milliseconds to centiseconds (1/100th of a second)
|
|
14068
|
-
var centiseconds = Math.floor(milliseconds / 10);
|
|
14069
|
-
var csString = centiseconds.toString().padStart(2, '0');
|
|
14070
|
-
return "".concat(hours.toString().padStart(2, '0'), ":") + "".concat(minutes.toString().padStart(2, '0'), ":") + "".concat(seconds.toString().padStart(2, '0'), ":") + "".concat(csString);
|
|
14071
|
-
}
|
|
14072
14112
|
|
|
14073
14113
|
function VideoSignaturePad(_a) {
|
|
14074
14114
|
var onAcceptBtnClicked = _a.onAcceptBtnClicked,
|
|
@@ -14130,11 +14170,8 @@ function VideoSignaturePad(_a) {
|
|
|
14130
14170
|
ref: signaturePad,
|
|
14131
14171
|
canvasProps: canvasProps,
|
|
14132
14172
|
onBegin: function onBegin() {
|
|
14133
|
-
return useVideoSignatureStore.setState(
|
|
14134
|
-
|
|
14135
|
-
signaturePadEmpty: false,
|
|
14136
|
-
signatureStartedAt: s.signatureStartedAt || performance.now()
|
|
14137
|
-
};
|
|
14173
|
+
return useVideoSignatureStore.setState({
|
|
14174
|
+
signaturePadEmpty: false
|
|
14138
14175
|
});
|
|
14139
14176
|
},
|
|
14140
14177
|
onEnd: function onEnd() {
|
|
@@ -14144,8 +14181,7 @@ function VideoSignaturePad(_a) {
|
|
|
14144
14181
|
return point;
|
|
14145
14182
|
});
|
|
14146
14183
|
useVideoSignatureStore.setState({
|
|
14147
|
-
signatureValid: points.length >= minSignaturePadPoints
|
|
14148
|
-
signatureEndedAt: performance.now()
|
|
14184
|
+
signatureValid: points.length >= minSignaturePadPoints
|
|
14149
14185
|
});
|
|
14150
14186
|
}
|
|
14151
14187
|
}), !headTrackingSatisfied && !!verbiage.headTrackingUnsatisfiedText ? ( /*#__PURE__*/React__default.createElement(SignaturePadContentContainer, {
|
|
@@ -14212,12 +14248,6 @@ function VideoSignatureGuides(_a) {
|
|
|
14212
14248
|
useEffect(function () {
|
|
14213
14249
|
if (guideToDisplay) setMode(guideToDisplay);
|
|
14214
14250
|
}, [guideToDisplay]);
|
|
14215
|
-
var firstChunkReceivedAt = useVideoSignatureStore(useShallow(function (state) {
|
|
14216
|
-
return {
|
|
14217
|
-
firstChunkReceivedAt: state.firstChunkReceivedAt
|
|
14218
|
-
};
|
|
14219
|
-
})).firstChunkReceivedAt;
|
|
14220
|
-
var signaturePadDisabled = requestedAction !== 'CAPTURE_SIGNATURE' || !firstChunkReceivedAt;
|
|
14221
14251
|
return /*#__PURE__*/React__default.createElement(Container$3, {
|
|
14222
14252
|
className: classNames.container
|
|
14223
14253
|
}, /*#__PURE__*/React__default.createElement(Inner$1, {
|
|
@@ -14241,7 +14271,7 @@ function VideoSignatureGuides(_a) {
|
|
|
14241
14271
|
}, /*#__PURE__*/React__default.createElement(VideoSignaturePad, {
|
|
14242
14272
|
onAcceptBtnClicked: onAcceptBtnClicked,
|
|
14243
14273
|
onClearBtnClicked: onClearBtnClicked,
|
|
14244
|
-
disabled:
|
|
14274
|
+
disabled: requestedAction !== 'CAPTURE_SIGNATURE',
|
|
14245
14275
|
headTrackingSatisfied: headTrackingSatisfied,
|
|
14246
14276
|
minSignaturePadPoints: minSignaturePadPoints,
|
|
14247
14277
|
classNames: classNames,
|
|
@@ -14298,11 +14328,9 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14298
14328
|
onHeadTrackingPredictionMade = _o.onPredictionMade,
|
|
14299
14329
|
startHeadTracking = _o.start,
|
|
14300
14330
|
stopHeadTracking = _o.stop;
|
|
14301
|
-
var
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
};
|
|
14305
|
-
})).firstChunkReceivedAt;
|
|
14331
|
+
var _p = useVideoSignatureStore(),
|
|
14332
|
+
clearRecordedData = _p.clearRecordedData,
|
|
14333
|
+
isRecording = _p.isRecording;
|
|
14306
14334
|
useEffect(function () {
|
|
14307
14335
|
useVideoSignatureStore.setState({
|
|
14308
14336
|
onSignatureVideoCaptured: onSignatureVideoCaptured
|
|
@@ -14321,15 +14349,15 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14321
14349
|
var verbiage = useTranslations(rawVerbiage, {
|
|
14322
14350
|
guidanceMessageText: 'Please sign the box below'
|
|
14323
14351
|
});
|
|
14324
|
-
var
|
|
14325
|
-
headTrackingSatisfied =
|
|
14326
|
-
setHeadTrackingSatisfied =
|
|
14327
|
-
var
|
|
14328
|
-
lastFace =
|
|
14329
|
-
setLastFace =
|
|
14330
|
-
var
|
|
14331
|
-
numFramesWithoutFaces =
|
|
14332
|
-
setNumFramesWithoutFaces =
|
|
14352
|
+
var _q = useState(true),
|
|
14353
|
+
headTrackingSatisfied = _q[0],
|
|
14354
|
+
setHeadTrackingSatisfied = _q[1];
|
|
14355
|
+
var _r = useState(null),
|
|
14356
|
+
lastFace = _r[0],
|
|
14357
|
+
setLastFace = _r[1];
|
|
14358
|
+
var _s = useState(0),
|
|
14359
|
+
numFramesWithoutFaces = _s[0],
|
|
14360
|
+
setNumFramesWithoutFaces = _s[1];
|
|
14333
14361
|
onHeadTrackingPredictionMade(useThrottledCallback(useCallback(function (_a) {
|
|
14334
14362
|
var face = _a.face;
|
|
14335
14363
|
if (headTrackingDisabled) return;
|
|
@@ -14344,12 +14372,12 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14344
14372
|
return n + 1;
|
|
14345
14373
|
});
|
|
14346
14374
|
}, [headTrackingBoundaryPercentage, headTrackingBoundaryType, headTrackingDisabled, videoHeight, videoWidth]), 16));
|
|
14347
|
-
var
|
|
14348
|
-
ref =
|
|
14349
|
-
|
|
14350
|
-
width =
|
|
14351
|
-
|
|
14352
|
-
height =
|
|
14375
|
+
var _t = useResizeObserver(),
|
|
14376
|
+
ref = _t.ref,
|
|
14377
|
+
_u = _t.width,
|
|
14378
|
+
width = _u === void 0 ? 1 : _u,
|
|
14379
|
+
_v = _t.height,
|
|
14380
|
+
height = _v === void 0 ? 1 : _v;
|
|
14353
14381
|
var debugScalingDetails = useDebugScalingDetails({
|
|
14354
14382
|
enabled: debugMode,
|
|
14355
14383
|
pageWidth: width,
|
|
@@ -14380,19 +14408,13 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
|
|
|
14380
14408
|
classNames: classNames.guides,
|
|
14381
14409
|
verbiage: rawVerbiage.guides,
|
|
14382
14410
|
onClearBtnClicked: restartVideoOnSignaturePadCleared ? function () {
|
|
14383
|
-
return setTimeout(
|
|
14384
|
-
|
|
14385
|
-
}, 100);
|
|
14386
|
-
} : function () {
|
|
14387
|
-
return useVideoSignatureStore.setState({
|
|
14388
|
-
signatureStartedAt: undefined
|
|
14389
|
-
});
|
|
14390
|
-
}
|
|
14411
|
+
return setTimeout(clearRecordedData, 100);
|
|
14412
|
+
} : undefined
|
|
14391
14413
|
}), debugMode && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, null, lastFace && ( /*#__PURE__*/React__default.createElement(SelfieCaptureFaceDebugBox, {
|
|
14392
14414
|
face: lastFace,
|
|
14393
14415
|
scaling: debugScalingDetails,
|
|
14394
14416
|
color: headTrackingSatisfied ? 'green' : 'red'
|
|
14395
|
-
}))), /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__default.createElement("br", null), "Recording: ",
|
|
14417
|
+
}))), /*#__PURE__*/React__default.createElement(DebugStatsPane, null, "Video: ", videoWidth, "x", videoHeight, /*#__PURE__*/React__default.createElement("br", null), "Recording: ", isRecording ? 'true' : 'false'))), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
14396
14418
|
onClick: onExit,
|
|
14397
14419
|
className: classNames.exitCaptureBtn
|
|
14398
14420
|
}));
|
|
@@ -14723,8 +14745,6 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14723
14745
|
setSelfieImage = _u.setSelfieImage,
|
|
14724
14746
|
setSignatureData = _u.setSignatureData,
|
|
14725
14747
|
setSignatureVideoUrl = _u.setSignatureVideoUrl,
|
|
14726
|
-
setSignatureStartTimestamp = _u.setSignatureStartTimestamp,
|
|
14727
|
-
setSignatureEndTimestamp = _u.setSignatureEndTimestamp,
|
|
14728
14748
|
logSelfieCaptureAttempt = _u.logSelfieCaptureAttempt,
|
|
14729
14749
|
uploadDocument = _u.uploadDocument;
|
|
14730
14750
|
var cameraAccessDenied = useCameraStore(useShallow(function (state) {
|
|
@@ -14784,14 +14804,12 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
|
|
|
14784
14804
|
filetype: 'image/jpeg'
|
|
14785
14805
|
}).then(onSelfieCaptured);
|
|
14786
14806
|
}, [logCaptureMetadata, onSelfieCaptured, setSelfieImage, uploadDocument]);
|
|
14787
|
-
var onSignatureCaptureCompleted = useCallback(function (videoData, signatureData, signatureImageData
|
|
14807
|
+
var onSignatureCaptureCompleted = useCallback(function (videoData, signatureData, signatureImageData) {
|
|
14788
14808
|
setSignatureData(signatureData);
|
|
14789
14809
|
setSignatureVideoUrl(URL.createObjectURL(videoData));
|
|
14790
|
-
if (signatureStartTimestamp) setSignatureStartTimestamp(signatureStartTimestamp);
|
|
14791
|
-
if (signatureEndTimestamp) setSignatureEndTimestamp(signatureEndTimestamp);
|
|
14792
14810
|
setCaptureState('SUCCESS');
|
|
14793
|
-
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData
|
|
14794
|
-
}, [onVideoCaptured, setSignatureData,
|
|
14811
|
+
onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
|
|
14812
|
+
}, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
|
|
14795
14813
|
var _x = useState(true),
|
|
14796
14814
|
showLoadingOverlay = _x[0],
|
|
14797
14815
|
setShowLoadingOverlay = _x[1];
|
|
@@ -14960,7 +14978,6 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
14960
14978
|
var onClearBtnClicked = useCallback(function () {
|
|
14961
14979
|
var _a, _b;
|
|
14962
14980
|
useVideoSignatureStore.setState({
|
|
14963
|
-
signatureStartedAt: undefined,
|
|
14964
14981
|
signaturePadEmpty: true,
|
|
14965
14982
|
signatureValid: false
|
|
14966
14983
|
});
|
|
@@ -15011,7 +15028,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
|
|
|
15011
15028
|
throttleMs: 250,
|
|
15012
15029
|
onModelError: props.onModelError,
|
|
15013
15030
|
modelLoadTimeoutMs: props.modelLoadTimeoutMs,
|
|
15014
|
-
requireVerticalFaceCentering: false
|
|
15031
|
+
requireVerticalFaceCentering: false,
|
|
15032
|
+
minCaptureBrightnessThreshold: props.minCaptureBrightnessThreshold,
|
|
15033
|
+
minCaptureRangeThreshold: props.minCaptureRangeThreshold,
|
|
15034
|
+
minCaptureVarianceThreshold: props.minCaptureVarianceThreshold
|
|
15015
15035
|
}, /*#__PURE__*/React__default.createElement(VideoSignatureWizard, _assign({}, props, {
|
|
15016
15036
|
onRetryClicked: onRetryClicked
|
|
15017
15037
|
}))));
|
|
@@ -18762,6 +18782,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18762
18782
|
guidesComponent = _a.guidesComponent,
|
|
18763
18783
|
_q = _a.showFaceGuideThenSignaturePad,
|
|
18764
18784
|
showFaceGuideThenSignaturePad = _q === void 0 ? false : _q,
|
|
18785
|
+
minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
|
|
18786
|
+
minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
|
|
18787
|
+
minCaptureVarianceThreshold = _a.minCaptureVarianceThreshold,
|
|
18765
18788
|
_r = _a.theme,
|
|
18766
18789
|
theme = _r === void 0 ? 'default' : _r,
|
|
18767
18790
|
classNames = _a.classNames,
|
|
@@ -18832,6 +18855,9 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18832
18855
|
allowManualSelfieCaptureOnLoadingError: allowManualSelfieCaptureOnLoadingError,
|
|
18833
18856
|
guidesComponent: guidesComponent,
|
|
18834
18857
|
showFaceGuideThenSignaturePad: showFaceGuideThenSignaturePad,
|
|
18858
|
+
minCaptureBrightnessThreshold: minCaptureBrightnessThreshold,
|
|
18859
|
+
minCaptureRangeThreshold: minCaptureRangeThreshold,
|
|
18860
|
+
minCaptureVarianceThreshold: minCaptureVarianceThreshold,
|
|
18835
18861
|
classNames: classNames,
|
|
18836
18862
|
colors: colors,
|
|
18837
18863
|
debugMode: debugMode,
|
|
@@ -18839,7 +18865,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
18839
18865
|
onModelError: onModelError,
|
|
18840
18866
|
onUserCancel: onUserCancel
|
|
18841
18867
|
};
|
|
18842
|
-
}, [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])
|
|
18868
|
+
}, [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])
|
|
18843
18869
|
})))));
|
|
18844
18870
|
};
|
|
18845
18871
|
|