idmission-web-sdk 2.0.3 → 2.1.0

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.
Files changed (32) hide show
  1. package/README.md +36 -28
  2. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +3 -12
  3. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +3 -12
  4. package/dist/components/customer_flows/IdValidation.d.ts +3 -12
  5. package/dist/components/customer_flows/VideoIdValidation.d.ts +3 -12
  6. package/dist/components/id_capture/CapturedDocuments.d.ts +2 -0
  7. package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
  8. package/dist/components/id_capture/IdCapture.d.ts +4 -14
  9. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +7 -22
  10. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +11 -38
  11. package/dist/components/id_capture/IdCaptureSuccess.d.ts +2 -3
  12. package/dist/components/id_capture/IdCaptureWizard.d.ts +3 -9
  13. package/dist/components/video_id/IdVideoCapture.d.ts +12 -7
  14. package/dist/components/video_id/IdVideoCaptureWizard.d.ts +3 -8
  15. package/dist/lib/models/DocumentDetection.d.ts +15 -12
  16. package/dist/lib/models/Focus.d.ts +6 -2
  17. package/dist/sdk2.cjs.development.js +754 -920
  18. package/dist/sdk2.cjs.development.js.map +1 -1
  19. package/dist/sdk2.cjs.production.js +1 -1
  20. package/dist/sdk2.cjs.production.js.map +1 -1
  21. package/dist/sdk2.esm.js +754 -920
  22. package/dist/sdk2.esm.js.map +1 -1
  23. package/dist/sdk2.umd.development.js +754 -920
  24. package/dist/sdk2.umd.development.js.map +1 -1
  25. package/dist/sdk2.umd.production.js +1 -1
  26. package/dist/sdk2.umd.production.js.map +1 -1
  27. package/dist/stories/Components/IdCapture/LicenseBackCapture.stories.d.ts +0 -48
  28. package/dist/stories/Components/IdCapture/LicenseFrontCapture.stories.d.ts +0 -45
  29. package/dist/stories/Components/IdCapture/PassportCapture.stories.d.ts +0 -47
  30. package/dist/stories/Components/IdCapture/Wizard.stories.d.ts +1 -77
  31. package/dist/version.d.ts +1 -1
  32. package/package.json +1 -1
@@ -140,7 +140,7 @@
140
140
  return cooked;
141
141
  }
142
142
 
143
- var webSdkVersion = '2.0.3';
143
+ var webSdkVersion = '2.1.0';
144
144
 
145
145
  function getPlatform() {
146
146
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2185,10 +2185,6 @@
2185
2185
  }, [refCallback, size.width, size.height]);
2186
2186
  }
2187
2187
 
2188
- function supportsNativeBarcodeScanning() {
2189
- return 'BarcodeDetector' in window;
2190
- }
2191
-
2192
2188
  function getFrameDimensions(frame) {
2193
2189
  var frameWidth = frame.width,
2194
2190
  frameHeight = frame.height;
@@ -3062,10 +3058,14 @@
3062
3058
  });
3063
3059
  }
3064
3060
 
3065
- var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240523/model_float16.tflite";
3061
+ var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240619/model_fp16.tflite";
3066
3062
  var defaultFocusModelLoadTimeoutMs = 45000;
3067
3063
  var defaultFocusThresholds = {
3068
- idCard: {
3064
+ idCardFront: {
3065
+ desktop: 0,
3066
+ mobile: 0.3
3067
+ },
3068
+ idCardBack: {
3069
3069
  desktop: 0,
3070
3070
  mobile: 0.3
3071
3071
  },
@@ -3686,14 +3686,19 @@
3686
3686
  });
3687
3687
  }
3688
3688
 
3689
- var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240611/model_fp16.tflite";
3689
+ var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240614/model_fp16.tflite";
3690
3690
  var defaultDocumentDetectionScoreThreshold = 0.1;
3691
3691
  var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
3692
3692
  var defaultDocumentDetectionThresholds = {
3693
- idCard: 0.8,
3694
- passport: 0.5,
3695
- mrz: 0.5,
3696
- pdf417: 0.15
3693
+ idCardFront: 0.8,
3694
+ idCardBack: 0.8,
3695
+ passport: 0.5
3696
+ };
3697
+ var documentTypeDisplayNames = {
3698
+ idCardFront: 'ID card front',
3699
+ idCardBack: 'ID card back',
3700
+ passport: 'Passport',
3701
+ none: 'None'
3697
3702
  };
3698
3703
  var detectors = {};
3699
3704
  function loadDocumentDetector(modelAssetPath, scoreThreshold) {
@@ -3848,34 +3853,33 @@
3848
3853
  return n > 0;
3849
3854
  });
3850
3855
  });
3851
- var bestIdCard = detectedObjects.find(function (obj) {
3856
+ var bestIdCardFront = detectedObjects.find(function (obj) {
3852
3857
  return obj.label === 'Document';
3853
3858
  });
3859
+ var bestIdCardBack = detectedObjects.find(function (obj) {
3860
+ return obj.label === 'Document back';
3861
+ });
3854
3862
  var bestPassportPage = detectedObjects.find(function (obj) {
3855
3863
  return obj.label === 'Passport page';
3856
3864
  });
3857
- var passportDetectionScore = (_a = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _a !== void 0 ? _a : 0;
3858
- var passportDetectionThresholdMet = passportDetectionScore >= ((_b = thresholds.passport) !== null && _b !== void 0 ? _b : 0);
3859
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : bestIdCard;
3860
- var detectionScore = (_c = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _c !== void 0 ? _c : 0;
3861
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : thresholds.idCard;
3865
+ var idCardFrontDetectionScore = (_a = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _a !== void 0 ? _a : 0;
3866
+ var idCardBackDetectionScore = (_b = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _b !== void 0 ? _b : 0;
3867
+ var passportDetectionScore = (_c = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _c !== void 0 ? _c : 0;
3868
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_d = thresholds.idCardFront) !== null && _d !== void 0 ? _d : 0);
3869
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_e = thresholds.idCardBack) !== null && _e !== void 0 ? _e : 0);
3870
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_f = thresholds.passport) !== null && _f !== void 0 ? _f : 0);
3871
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3872
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3873
+ var detectionScore = (_g = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _g !== void 0 ? _g : 0;
3862
3874
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3863
3875
  var detectedDocumentType = 'none';
3864
3876
  if (passportDetectionThresholdMet) {
3865
3877
  detectedDocumentType = 'passport';
3878
+ } else if (idCardBackDetectionThresholdMet) {
3879
+ detectedDocumentType = 'idCardBack';
3866
3880
  } else if (detectionThresholdMet) {
3867
- detectedDocumentType = 'idCard';
3881
+ detectedDocumentType = 'idCardFront';
3868
3882
  }
3869
- var bestMrz = detectedObjects.find(function (obj) {
3870
- return obj.label === 'MRZ';
3871
- });
3872
- var mrzDetectionScore = (_d = bestMrz === null || bestMrz === void 0 ? void 0 : bestMrz.score) !== null && _d !== void 0 ? _d : 0;
3873
- var mrzDetectionThresholdMet = mrzDetectionScore >= ((_e = thresholds.mrz) !== null && _e !== void 0 ? _e : 0);
3874
- var bestPdf417 = detectedObjects.find(function (obj) {
3875
- return obj.label === 'PDF417';
3876
- });
3877
- var pdf417DetectionScore = (_f = bestPdf417 === null || bestPdf417 === void 0 ? void 0 : bestPdf417.score) !== null && _f !== void 0 ? _f : 0;
3878
- var pdf417DetectionThresholdMet = pdf417DetectionScore >= ((_g = thresholds.pdf417) !== null && _g !== void 0 ? _g : 0);
3879
3883
  var documentInBounds = false;
3880
3884
  if (bestDocument) {
3881
3885
  var boundaryPx = 20;
@@ -3905,15 +3909,13 @@
3905
3909
  detectionTime: time,
3906
3910
  detectionThresholdMet: detectionThresholdMet,
3907
3911
  detectedDocumentType: detectedDocumentType,
3912
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
3913
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
3914
+ idCardBackDetectionScore: idCardBackDetectionScore,
3915
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3908
3916
  passportDetectionScore: passportDetectionScore,
3909
3917
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3910
- mrzDetectionScore: mrzDetectionScore,
3911
- mrzDetectionThresholdMet: mrzDetectionThresholdMet,
3912
- pdf417DetectionScore: pdf417DetectionScore,
3913
- pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
3914
3918
  bestDocument: bestDocument,
3915
- bestMrz: bestMrz,
3916
- bestPdf417: bestPdf417,
3917
3919
  documentInBounds: documentInBounds,
3918
3920
  documentTooClose: documentTooClose,
3919
3921
  frameWidth: frameWidth,
@@ -4161,24 +4163,26 @@
4161
4163
  focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
4162
4164
  _c = _a.focusModelLoadTimeoutMs,
4163
4165
  focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
4164
- onFocusModelError = _a.onFocusModelError;
4166
+ onFocusModelError = _a.onFocusModelError,
4167
+ _d = _a.showCanvases,
4168
+ showCanvases = _d === void 0 ? false : _d;
4165
4169
  var cropCanvas = React.useRef(null);
4166
4170
  var rotateCanvas = React.useRef(null);
4167
- var _d = React.useState({}),
4168
- focusThresholds = _d[0],
4169
- setFocusThresholds = _d[1];
4170
- var _e = React.useState(0),
4171
- focusPredictionTime = _e[0],
4172
- setFocusPredictionTime = _e[1];
4173
- var _f = useLoadFocusModel({
4171
+ var _e = React.useState({}),
4172
+ focusThresholds = _e[0],
4173
+ setFocusThresholds = _e[1];
4174
+ var _f = React.useState(0),
4175
+ focusPredictionTime = _f[0],
4176
+ setFocusPredictionTime = _f[1];
4177
+ var _g = useLoadFocusModel({
4174
4178
  modelPath: focusModelPath,
4175
4179
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
4176
4180
  onModelError: onFocusModelError
4177
4181
  }),
4178
- model = _f.model,
4179
- ready = _f.ready,
4180
- modelDownloadProgress = _f.modelDownloadProgress,
4181
- modelError = _f.modelError;
4182
+ model = _g.model,
4183
+ ready = _g.ready,
4184
+ modelDownloadProgress = _g.modelDownloadProgress,
4185
+ modelError = _g.modelError;
4182
4186
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
4183
4187
  if (!model.current) return null;
4184
4188
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
@@ -4199,13 +4203,23 @@
4199
4203
  return /*#__PURE__*/React__default['default'].createElement(FocusModelContext.Provider, {
4200
4204
  value: value
4201
4205
  }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
4202
- ref: rotateCanvas
4206
+ ref: rotateCanvas,
4207
+ style: showCanvases ? {
4208
+ display: 'block'
4209
+ } : undefined
4203
4210
  }), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
4204
- ref: cropCanvas
4211
+ ref: cropCanvas,
4212
+ style: showCanvases ? {
4213
+ display: 'block'
4214
+ } : undefined
4205
4215
  }), children);
4206
4216
  }
4207
4217
 
4208
4218
  var onMobile = isMobile();
4219
+ var defaultIdCaptureThresholds = {
4220
+ detection: defaultDocumentDetectionThresholds,
4221
+ focus: defaultFocusThresholds
4222
+ };
4209
4223
  var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4210
4224
  ready: false,
4211
4225
  start: function start() {
@@ -4216,7 +4230,7 @@
4216
4230
  },
4217
4231
  modelDownloadProgress: 0,
4218
4232
  modelError: null,
4219
- thresholds: {},
4233
+ thresholds: defaultIdCaptureThresholds,
4220
4234
  setThresholds: function setThresholds() {
4221
4235
  return null;
4222
4236
  },
@@ -4231,6 +4245,10 @@
4231
4245
  },
4232
4246
  resetBestFrame: function resetBestFrame() {
4233
4247
  return null;
4248
+ },
4249
+ requiredDocumentType: 'none',
4250
+ setRequiredDocumentType: function setRequiredDocumentType() {
4251
+ return null;
4234
4252
  }
4235
4253
  });
4236
4254
  function IdCaptureModelsProviderInner(_a) {
@@ -4263,26 +4281,34 @@
4263
4281
  var bestPredictionCanvas = React.useRef(null);
4264
4282
  var bestFocusScore = React.useRef(0);
4265
4283
  var stopDetection = React.useRef(0);
4284
+ var _e = React.useState('none'),
4285
+ requiredDocumentType = _e[0],
4286
+ setRequiredDocumentType = _e[1];
4266
4287
  var thresholds = React.useMemo(function () {
4267
4288
  return __assign$1(__assign$1({}, documentDetectionThresholds), {
4268
4289
  focus: focusThresholds
4269
4290
  });
4270
4291
  }, [documentDetectionThresholds, focusThresholds]);
4271
4292
  var setThresholds = React.useCallback(function (thresholds) {
4272
- setDocumentDetectionThresholds(thresholds);
4273
- if (thresholds.focus) setFocusThresholds(thresholds.focus);
4293
+ if (thresholds.detection) {
4294
+ setDocumentDetectionThresholds(thresholds.detection);
4295
+ }
4296
+ if (thresholds.focus) {
4297
+ setFocusThresholds(thresholds.focus);
4298
+ }
4274
4299
  }, [setDocumentDetectionThresholds, setFocusThresholds]);
4275
4300
  React.useEffect(function handleDetections() {
4276
4301
  var _this = this;
4277
4302
  onDocumentDetected(function (prediction) {
4278
4303
  return __awaiter(_this, void 0, void 0, function () {
4279
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, focusPrediction, focusThresholdSet, focusThreshold;
4304
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4280
4305
  var _a, _b, _c, _d, _e;
4281
4306
  return __generator(this, function (_f) {
4282
4307
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4283
4308
  stopDetectionAtStart = stopDetection.current;
4284
4309
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4285
- if (prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
4310
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
4311
+ if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
4286
4312
  focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_a = prediction.bestDocument) === null || _a === void 0 ? void 0 : _a.box);
4287
4313
  if (focusPrediction) {
4288
4314
  focusScore = focusPrediction.score;
@@ -4311,7 +4337,7 @@
4311
4337
  });
4312
4338
  });
4313
4339
  });
4314
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, thresholds.focus]);
4340
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4315
4341
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4316
4342
  React.useEffect(function handleModelErrors() {
4317
4343
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
@@ -4325,9 +4351,9 @@
4325
4351
  canvas: bestPredictionCanvas.current
4326
4352
  });
4327
4353
  }, [bestFrameDetails]);
4328
- var _e = React.useState(0),
4329
- canvasKey = _e[0],
4330
- setCanvasKey = _e[1];
4354
+ var _f = React.useState(0),
4355
+ canvasKey = _f[0],
4356
+ setCanvasKey = _f[1];
4331
4357
  var resetBestFrame = React.useCallback(function () {
4332
4358
  stopDetection.current += 1;
4333
4359
  setCanvasKey(function (n) {
@@ -4337,6 +4363,9 @@
4337
4363
  setBestFrameDetails(null);
4338
4364
  bestFocusScore.current = 0;
4339
4365
  }, [clearDocumentDetectionLastPredictionCanvas]);
4366
+ React.useEffect(function () {
4367
+ requiredDocumentType && resetBestFrame();
4368
+ }, [requiredDocumentType, resetBestFrame]);
4340
4369
  var value = React.useMemo(function () {
4341
4370
  return {
4342
4371
  ready: documentDetectionModelReady && focusModelReady,
@@ -4351,9 +4380,11 @@
4351
4380
  focusPredictionTime: focusPredictionTime,
4352
4381
  getBestFrame: getBestFrame,
4353
4382
  resetBestFrame: resetBestFrame,
4354
- bestFrameDetails: bestFrameDetails
4383
+ bestFrameDetails: bestFrameDetails,
4384
+ requiredDocumentType: requiredDocumentType,
4385
+ setRequiredDocumentType: setRequiredDocumentType
4355
4386
  };
4356
- }, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
4387
+ }, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
4357
4388
  return /*#__PURE__*/React__default['default'].createElement(IdCaptureModelsContext.Provider, {
4358
4389
  value: value
4359
4390
  }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
@@ -4404,28 +4435,19 @@
4404
4435
  videoHeight: 0,
4405
4436
  detectedObjects: [],
4406
4437
  bestDocument: undefined,
4407
- bestMrz: undefined,
4408
- bestPdf417: undefined,
4409
- documentType: 'none',
4438
+ detectedDocumentType: 'none',
4439
+ detectionThresholdMet: false,
4410
4440
  documentInBounds: false,
4411
4441
  documentTooClose: false,
4412
- documentDetectionScore: 0,
4413
- documentDetectionThresholdMet: false,
4414
- passportPageDetectionScore: 0,
4415
- passportPageDetectionThresholdMet: false,
4416
- mrzDetectionScore: 0,
4417
- mrzDetectionThresholdMet: false,
4418
- pdf417DetectionScore: 0,
4419
- pdf417DetectionThresholdMet: false,
4442
+ flipRequired: false,
4443
+ idCardFrontDetectionScore: 0,
4444
+ idCardFrontDetectionThresholdMet: false,
4445
+ idCardBackDetectionScore: 0,
4446
+ idCardBackDetectionThresholdMet: false,
4447
+ passportDetectionScore: 0,
4448
+ passportDetectionThresholdMet: false,
4420
4449
  focusScore: 0,
4421
4450
  focusThresholdMet: false,
4422
- barcodeScanningEnabled: false,
4423
- barcodeResult: null,
4424
- waitingForBarcodeScan: false,
4425
- shouldScanBarcode: false,
4426
- autoCaptureBarcodeRequired: 'mobile',
4427
- barcodeScanFailedAttempts: 0,
4428
- maxBarcodeScanAttempts: 10,
4429
4451
  isGoodFrame: false,
4430
4452
  goodFramesCount: 0,
4431
4453
  goodFramesThreshold: 3,
@@ -4439,8 +4461,6 @@
4439
4461
  capturedDocuments: {},
4440
4462
  captureRequirement: 'idCardOrPassport',
4441
4463
  requestedDocumentType: 'idCardFront',
4442
- detectedDocumentType: 'none',
4443
- differentDocumentTypeDetections: 0,
4444
4464
  operationStartedAt: null,
4445
4465
  captureStartedAt: null
4446
4466
  };
@@ -4475,11 +4495,6 @@
4475
4495
  newState.operationStartedAt = new Date();
4476
4496
  return newState;
4477
4497
  }
4478
- case 'configureCapture':
4479
- return __assign$1(__assign$1(__assign$1({}, state), action.payload), {
4480
- capturing: false,
4481
- captureFailed: false
4482
- });
4483
4498
  case 'setRequiredDocumentType':
4484
4499
  return __assign$1(__assign$1({}, state), {
4485
4500
  requiredDocumentType: action.payload
@@ -4516,18 +4531,15 @@
4516
4531
  case 'objectsDetected':
4517
4532
  var _d = action.payload.prediction,
4518
4533
  detectedObjects = _d.detectedObjects,
4519
- detectionScore = _d.detectionScore,
4520
4534
  detectionThresholdMet = _d.detectionThresholdMet,
4521
4535
  detectedDocumentType = _d.detectedDocumentType,
4536
+ idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
4537
+ idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
4538
+ idCardBackDetectionScore = _d.idCardBackDetectionScore,
4539
+ idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4522
4540
  passportDetectionScore = _d.passportDetectionScore,
4523
4541
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4524
- mrzDetectionScore = _d.mrzDetectionScore,
4525
- mrzDetectionThresholdMet = _d.mrzDetectionThresholdMet,
4526
- pdf417DetectionScore = _d.pdf417DetectionScore,
4527
- pdf417DetectionThresholdMet = _d.pdf417DetectionThresholdMet,
4528
4542
  bestDocument = _d.bestDocument,
4529
- bestMrz = _d.bestMrz,
4530
- bestPdf417 = _d.bestPdf417,
4531
4543
  documentInBounds = _d.documentInBounds,
4532
4544
  documentTooClose = _d.documentTooClose,
4533
4545
  focusScore = _d.focusScore,
@@ -4543,84 +4555,48 @@
4543
4555
  goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
4544
4556
  }
4545
4557
  }
4546
- var barcodeScanRequired = state.autoCaptureBarcodeRequired === true || state.autoCaptureBarcodeRequired === 'mobile' && isMobile();
4547
- var shouldScanBarcode = state.barcodeScanningEnabled && pdf417DetectionThresholdMet && barcodeScanRequired;
4548
- var waitingForBarcodeScan = shouldScanBarcode && !state.barcodeResult;
4549
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && focusThresholdMet;
4558
+ var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
4559
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && focusThresholdMet;
4550
4560
  var goodFramesCount = state.goodFramesCount;
4551
4561
  if (isGoodFrame) {
4552
4562
  goodFramesCount += 1;
4553
4563
  }
4564
+ var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
4565
+ var requestedDocumentType = state.requestedDocumentType;
4566
+ if (state.captureRequirement === 'idCardOrPassport') {
4567
+ if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
4568
+ requestedDocumentType = 'passport';
4569
+ }
4570
+ if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
4571
+ requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
4572
+ }
4573
+ }
4554
4574
  return __assign$1(__assign$1({}, state), {
4555
4575
  videoWidth: frameWidth,
4556
4576
  videoHeight: frameHeight,
4557
4577
  detectedObjects: detectedObjects,
4558
4578
  bestDocument: bestDocument,
4559
- bestMrz: bestMrz,
4560
- bestPdf417: bestPdf417,
4561
- documentType: detectedDocumentType,
4579
+ requestedDocumentType: requestedDocumentType,
4580
+ detectedDocumentType: detectedDocumentType,
4581
+ detectionThresholdMet: detectionThresholdMet,
4562
4582
  documentInBounds: documentInBounds,
4563
4583
  documentTooClose: documentTooClose,
4564
- documentDetectionScore: detectionScore,
4565
- documentDetectionThresholdMet: detectionThresholdMet,
4566
- mrzDetectionScore: mrzDetectionScore,
4567
- mrzDetectionThresholdMet: mrzDetectionThresholdMet,
4568
- pdf417DetectionScore: pdf417DetectionScore,
4569
- pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
4570
- passportPageDetectionScore: passportDetectionScore,
4571
- passportPageDetectionThresholdMet: passportDetectionThresholdMet,
4584
+ flipRequired: flipRequired,
4585
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
4586
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
4587
+ idCardBackDetectionScore: idCardBackDetectionScore,
4588
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4589
+ passportDetectionScore: passportDetectionScore,
4590
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
4572
4591
  focusScore: focusScore,
4573
4592
  focusThresholdMet: focusThresholdMet,
4574
- shouldScanBarcode: shouldScanBarcode,
4575
- waitingForBarcodeScan: waitingForBarcodeScan,
4576
4593
  isGoodFrame: isGoodFrame,
4577
4594
  goodFramesCount: goodFramesCount,
4578
4595
  goodFramesThreshold: goodFramesThreshold,
4579
- goodFramesThresholdMet: goodFramesCount >= goodFramesThreshold,
4596
+ goodFramesThresholdMet: goodFramesThresholdMet,
4580
4597
  lastFrameCapturedAt: frameCapturedAt,
4581
4598
  frameCaptureRate: frameCaptureRate
4582
4599
  });
4583
- case 'predictionMade':
4584
- {
4585
- var _e = action.payload,
4586
- detectedDocumentType_1 = _e.detectedDocumentType,
4587
- passportDetectionScore_1 = _e.passportDetectionScore;
4588
- var requestedDocumentType = state.requestedDocumentType;
4589
- var newState = __assign$1(__assign$1({}, state), {
4590
- detectedDocumentType: detectedDocumentType_1
4591
- });
4592
- if (state.captureRequirement === 'idCardOrPassport') {
4593
- var predictionIsRequestedType = requestedDocumentType.startsWith(detectedDocumentType_1);
4594
- if (predictionIsRequestedType) {
4595
- newState.differentDocumentTypeDetections = 0;
4596
- }
4597
- if (detectedDocumentType_1 === 'passport' && requestedDocumentType !== 'passport') {
4598
- newState.requestedDocumentType = 'passport';
4599
- }
4600
- if (requestedDocumentType === 'passport' && passportDetectionScore_1 < 0.3) {
4601
- newState.requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
4602
- }
4603
- }
4604
- return newState;
4605
- }
4606
- case 'barcodeScanned':
4607
- return __assign$1(__assign$1({}, state), {
4608
- barcodeResult: action.payload.result,
4609
- waitingForBarcodeScan: false,
4610
- autoCaptureBarcodeRequired: false
4611
- });
4612
- case 'barcodeScanFailed':
4613
- {
4614
- var newState = __assign$1(__assign$1({}, state), {
4615
- barcodeScanFailedAttempts: state.barcodeScanFailedAttempts + 1
4616
- });
4617
- if (newState.barcodeScanFailedAttempts >= newState.maxBarcodeScanAttempts) {
4618
- newState.autoCaptureBarcodeRequired = false;
4619
- newState.shouldScanBarcode = false;
4620
- newState.waitingForBarcodeScan = false;
4621
- }
4622
- return newState;
4623
- }
4624
4600
  case 'captureStarted':
4625
4601
  return __assign$1(__assign$1({}, state), {
4626
4602
  captureStartedAt: new Date(),
@@ -4672,8 +4648,9 @@
4672
4648
  newState_1.requestedDocumentType = remainingRequirements[0];
4673
4649
  if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack') {
4674
4650
  newState_1.captureState = 'requestingFlip';
4675
- newState_1.documentDetectionThresholdMet = false;
4676
- newState_1.passportPageDetectionThresholdMet = false;
4651
+ newState_1.idCardFrontDetectionThresholdMet = false;
4652
+ newState_1.idCardBackDetectionThresholdMet = false;
4653
+ newState_1.passportDetectionThresholdMet = false;
4677
4654
  }
4678
4655
  }
4679
4656
  return newState_1;
@@ -4704,8 +4681,9 @@
4704
4681
  newState_2.requestedDocumentType = remainingRequirements[0];
4705
4682
  if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack') {
4706
4683
  newState_2.captureState = 'requestingFlip';
4707
- newState_2.documentDetectionThresholdMet = false;
4708
- newState_2.passportPageDetectionThresholdMet = false;
4684
+ newState_2.idCardFrontDetectionThresholdMet = false;
4685
+ newState_2.idCardBackDetectionThresholdMet = false;
4686
+ newState_2.passportDetectionThresholdMet = false;
4709
4687
  }
4710
4688
  }
4711
4689
  return newState_2;
@@ -7835,85 +7813,42 @@
7835
7813
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
7836
7814
 
7837
7815
  var IdCapture = function IdCapture(_a) {
7838
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
7816
+ var _b, _c, _d, _e, _f, _g, _h, _j;
7839
7817
  var requiredDocumentType = _a.requiredDocumentType,
7840
- _m = _a.autoCaptureEnabled,
7841
- autoCaptureEnabled = _m === void 0 ? true : _m,
7842
- _o = _a.autoCaptureBarcodeRequired,
7843
- autoCaptureBarcodeRequired = _o === void 0 ? 'mobile' : _o,
7844
- _p = _a.idCardDetectionThreshold,
7845
- idCardDetectionThreshold = _p === void 0 ? defaultDocumentDetectionThresholds.idCard : _p,
7846
- _q = _a.passportDetectionThreshold,
7847
- passportDetectionThreshold = _q === void 0 ? defaultDocumentDetectionThresholds.passport : _q,
7848
- _r = _a.mrzDetectionScoreThreshold,
7849
- mrzDetectionScoreThreshold = _r === void 0 ? defaultDocumentDetectionThresholds.mrz : _r,
7850
- _s = _a.pdf417DetectionThreshold,
7851
- pdf417DetectionThreshold = _s === void 0 ? defaultDocumentDetectionThresholds.pdf417 : _s,
7852
- _t = _a.idCardFocusScoreThreshold,
7853
- idCardFocusScoreThreshold = _t === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _t,
7854
- _u = _a.passportFocusScoreThreshold,
7855
- passportFocusScoreThreshold = _u === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _u,
7856
- _v = _a.barcodeScanningEnabled,
7857
- barcodeScanningEnabled = _v === void 0 ? true : _v,
7858
- _w = _a.maxBarcodeScanAttempts,
7859
- maxBarcodeScanAttempts = _w === void 0 ? 10 : _w,
7818
+ _k = _a.thresholds,
7819
+ thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
7860
7820
  guidanceMessage = _a.guidanceMessage,
7861
7821
  guidanceSatisfied = _a.guidanceSatisfied,
7862
- onPrediction = _a.onPrediction,
7863
7822
  onCapture = _a.onCapture,
7864
- _x = _a.assets,
7865
- assets = _x === void 0 ? {} : _x,
7866
- _y = _a.classNames,
7867
- classNames = _y === void 0 ? {} : _y,
7868
- _z = _a.colors,
7869
- colors = _z === void 0 ? {} : _z,
7870
- _0 = _a.verbiage,
7871
- rawVerbiage = _0 === void 0 ? {} : _0,
7872
- _1 = _a.debugMode,
7873
- debugMode = _1 === void 0 ? false : _1;
7874
- var _2 = useResizeObserver(),
7875
- ref = _2.ref,
7876
- _3 = _2.width,
7877
- width = _3 === void 0 ? 1 : _3,
7878
- _4 = _2.height,
7879
- height = _4 === void 0 ? 1 : _4;
7880
- var _5 = useIdCaptureState(),
7881
- state = _5[0],
7882
- dispatch = _5[1];
7823
+ _l = _a.assets,
7824
+ assets = _l === void 0 ? {} : _l,
7825
+ _m = _a.classNames,
7826
+ classNames = _m === void 0 ? {} : _m,
7827
+ _o = _a.colors,
7828
+ colors = _o === void 0 ? {} : _o,
7829
+ _p = _a.verbiage,
7830
+ rawVerbiage = _p === void 0 ? {} : _p,
7831
+ _q = _a.debugMode,
7832
+ debugMode = _q === void 0 ? false : _q;
7833
+ var _r = useResizeObserver(),
7834
+ ref = _r.ref,
7835
+ _s = _r.width,
7836
+ width = _s === void 0 ? 1 : _s,
7837
+ _t = _r.height,
7838
+ height = _t === void 0 ? 1 : _t;
7839
+ var _u = useIdCaptureState(),
7840
+ state = _u[0],
7841
+ dispatch = _u[1];
7883
7842
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
7884
- var _6 = React.useContext(IdCaptureModelsContext),
7885
- modelsReady = _6.ready,
7886
- setThresholds = _6.setThresholds,
7887
- onPredictionMade = _6.onPredictionMade,
7888
- detectionTime = _6.detectionTime,
7889
- focusPredictionTime = _6.focusPredictionTime,
7890
- getBestFrame = _6.getBestFrame;
7843
+ var _v = React.useContext(IdCaptureModelsContext),
7844
+ modelsReady = _v.ready,
7845
+ setThresholds = _v.setThresholds,
7846
+ detectionTime = _v.detectionTime,
7847
+ focusPredictionTime = _v.focusPredictionTime,
7848
+ getBestFrame = _v.getBestFrame;
7891
7849
  React.useEffect(function () {
7892
- dispatch({
7893
- type: 'configureCapture',
7894
- payload: {
7895
- autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
7896
- barcodeScanningEnabled: barcodeScanningEnabled,
7897
- maxBarcodeScanAttempts: maxBarcodeScanAttempts
7898
- }
7899
- });
7900
- }, [autoCaptureBarcodeRequired, barcodeScanningEnabled, dispatch, maxBarcodeScanAttempts]);
7901
- React.useEffect(function () {
7902
- setThresholds({
7903
- idCard: idCardDetectionThreshold,
7904
- passport: passportDetectionThreshold,
7905
- mrz: mrzDetectionScoreThreshold,
7906
- pdf417: pdf417DetectionThreshold,
7907
- focus: {
7908
- idCard: {
7909
- mobile: idCardFocusScoreThreshold
7910
- },
7911
- passport: {
7912
- mobile: passportFocusScoreThreshold
7913
- }
7914
- }
7915
- });
7916
- }, [idCardDetectionThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, passportDetectionThreshold, passportFocusScoreThreshold, pdf417DetectionThreshold, setThresholds]);
7850
+ setThresholds(thresholds);
7851
+ }, [thresholds, setThresholds]);
7917
7852
  React.useEffect(function () {
7918
7853
  if (!requiredDocumentType) return;
7919
7854
  dispatch({
@@ -7930,18 +7865,7 @@
7930
7865
  }
7931
7866
  });
7932
7867
  }, [dispatch, height, width]);
7933
- React.useEffect(function () {
7934
- onPredictionMade(function (prediction) {
7935
- dispatch({
7936
- type: 'objectsDetected',
7937
- payload: {
7938
- prediction: prediction
7939
- }
7940
- });
7941
- onPrediction === null || onPrediction === void 0 ? void 0 : onPrediction(prediction);
7942
- });
7943
- }, [dispatch, onPrediction, onPredictionMade]);
7944
- var shouldCapture = autoCaptureEnabled && state.goodFramesThresholdMet && !state.capturing && !state.waitingForBarcodeScan && timeSince(state.captureStartedAt) >= 3000;
7868
+ var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
7945
7869
  React.useEffect(function () {
7946
7870
  if (!shouldCapture) return;
7947
7871
  dispatch({
@@ -7955,29 +7879,13 @@
7955
7879
  });
7956
7880
  return;
7957
7881
  }
7958
- var originalCanvas = bestFrame.canvas,
7882
+ var canvas = bestFrame.canvas,
7959
7883
  documentType = bestFrame.documentType,
7960
7884
  boundingBox = bestFrame.boundingBox,
7961
7885
  detectionScore = bestFrame.detectionScore,
7962
7886
  focusScore = bestFrame.focusScore;
7963
- var width = originalCanvas.width,
7964
- height = originalCanvas.height;
7965
- var canvas = originalCanvas;
7966
- // resize image to 2k max if barcode is read
7967
- var isGreaterThan2k = width > 1920 && height > 1080 || width > 1080 && height > 1920;
7968
- if (isGreaterThan2k && !!state.barcodeResult) {
7969
- canvas = document.createElement('canvas');
7970
- if (width > height) {
7971
- canvas.width = 1920;
7972
- canvas.height = height * (1920 / width);
7973
- } else {
7974
- canvas.height = 1920;
7975
- canvas.width = width * (1920 / height);
7976
- }
7977
- var ctx2d = canvas.getContext('2d');
7978
- if (!ctx2d) return;
7979
- ctx2d.drawImage(originalCanvas, 0, 0, canvas.width, canvas.height);
7980
- }
7887
+ var width = canvas.width,
7888
+ height = canvas.height;
7981
7889
  var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
7982
7890
  dispatch({
7983
7891
  type: 'frameCaptured',
@@ -8001,18 +7909,17 @@
8001
7909
  type: 'captured'
8002
7910
  });
8003
7911
  }, 0);
8004
- }, [dispatch, getBestFrame, onCapture, shouldCapture, state.barcodeResult, state.captureStartedAt, state.requestedDocumentType]);
7912
+ }, [dispatch, getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
8005
7913
  assets.portraitGuidesImageUrl || (assets.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
8006
7914
  assets.landscapeGuidesImageUrl || (assets.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
8007
7915
  var theme = styled.useTheme();
8008
- colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_f = (_e = (_d = theme.idCapture) === null || _d === void 0 ? void 0 : _d.guideBox) === null || _e === void 0 ? void 0 : _e.unsatisfiedColor) !== null && _f !== void 0 ? _f : 'white');
8009
- colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_j = (_h = (_g = theme.idCapture) === null || _g === void 0 ? void 0 : _g.guideBox) === null || _h === void 0 ? void 0 : _h.satisfiedColor) !== null && _j !== void 0 ? _j : 'green');
7916
+ colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.unsatisfiedColor) !== null && _d !== void 0 ? _d : 'white');
7917
+ colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.satisfiedColor) !== null && _g !== void 0 ? _g : 'green');
8010
7918
  var verbiage = useTranslations(rawVerbiage, {
8011
7919
  instructionText: 'Scan the front of ID',
8012
7920
  processingIdCardText: 'ID card front captured.',
8013
- capturingText: 'Capturing...',
8014
- captureFailedText: 'Capture failed!',
8015
- guidanceSatisfiedText: 'Document detected, hold still...',
7921
+ guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
7922
+ guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
8016
7923
  guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
8017
7924
  guidanceNotCenteredText: 'Document is not centered',
8018
7925
  guidanceTooCloseText: 'Document too close, please back up',
@@ -8027,10 +7934,10 @@
8027
7934
  });
8028
7935
  var satisfied = state.isGoodFrame;
8029
7936
  if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
8030
- guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
7937
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.flipRequired ? verbiage.guidancePleaseFlipText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
8031
7938
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
8032
7939
  ref: ref,
8033
- className: "flex ".concat((_k = classNames.container) !== null && _k !== void 0 ? _k : '')
7940
+ className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
8034
7941
  }, guidanceMessage !== '' && ( /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
8035
7942
  "$top": "",
8036
7943
  "$bottom": "12.5dvh",
@@ -8039,7 +7946,7 @@
8039
7946
  "$variant": satisfied ? 'positive' : 'default',
8040
7947
  className: classNames.guidanceMessage
8041
7948
  }, guidanceMessage))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugBoundingBoxOverlay, {
8042
- "$flipX": !((_l = cameraRef.current) === null || _l === void 0 ? void 0 : _l.isRearFacing),
7949
+ "$flipX": !((_j = cameraRef.current) === null || _j === void 0 ? void 0 : _j.isRearFacing),
8043
7950
  scaling: debugScalingDetails
8044
7951
  }, state.detectedObjects.map(function (obj, i) {
8045
7952
  var _a;
@@ -8049,7 +7956,7 @@
8049
7956
  scaling: debugScalingDetails,
8050
7957
  flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
8051
7958
  });
8052
- }))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.documentDetectionThresholdMet ? '✅' : '❌', " Document Score: ", state.documentDetectionScore.toFixed(3), " (", state.documentType, ")", /*#__PURE__*/React__default['default'].createElement("br", null), state.passportPageDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportPageDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default['default'].createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold, barcodeScanningEnabled && state.autoCaptureBarcodeRequired ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("br", null), state.barcodeResult ? '✅' : '❌', " Barcode Scanned (", supportsNativeBarcodeScanning() ? 'Native' : 'ZXing', ",", ' ', state.barcodeScanFailedAttempts, "/", state.maxBarcodeScanAttempts, " failed attempts)")) : null)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u274C Models not ready")))));
7959
+ }))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.documentInBounds ? '' : '❌', " Document In Bounds", /*#__PURE__*/React__default['default'].createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u274C Models not ready")))));
8053
7960
  };
8054
7961
  var timeSince = function timeSince(t) {
8055
7962
  if (!t) return 0;
@@ -8983,11 +8890,7 @@
8983
8890
  setUrl(cropToDetectedObjectBox(imgRef.current, bbox).toDataURL('image/jpeg', 0.95));
8984
8891
  }, 100);
8985
8892
  }
8986
- return /*#__PURE__*/React__default['default'].createElement("div", {
8987
- style: {
8988
- position: 'relative'
8989
- }
8990
- }, /*#__PURE__*/React__default['default'].createElement("img", {
8893
+ return /*#__PURE__*/React__default['default'].createElement("img", {
8991
8894
  ref: imgRef,
8992
8895
  alt: alt,
8993
8896
  className: className,
@@ -9007,13 +8910,12 @@
9007
8910
  (_a = link.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(link);
9008
8911
  });
9009
8912
  }
9010
- }));
8913
+ });
9011
8914
  };
9012
8915
 
9013
8916
  var OverlayInstruction = styled__default['default'].p(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
9014
8917
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
9015
8918
  var capturedDocuments = _a.capturedDocuments,
9016
- // barcodeResult,
9017
8919
  onSubmitClick = _a.onSubmitClick,
9018
8920
  onRetryClick = _a.onRetryClick,
9019
8921
  _b = _a.classNames,
@@ -9021,7 +8923,9 @@
9021
8923
  _c = _a.colors,
9022
8924
  colors = _c === void 0 ? {} : _c,
9023
8925
  _d = _a.verbiage,
9024
- rawVerbiage = _d === void 0 ? {} : _d;
8926
+ rawVerbiage = _d === void 0 ? {} : _d,
8927
+ _e = _a.debugMode,
8928
+ debugMode = _e === void 0 ? false : _e;
9025
8929
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
9026
8930
  var idCardFront = capturedDocuments.idCardFront,
9027
8931
  idCardBack = capturedDocuments.idCardBack,
@@ -9056,7 +8960,7 @@
9056
8960
  image: idCardFront,
9057
8961
  className: classNames.image,
9058
8962
  alt: verbiage.idCardFrontText
9059
- })))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
8963
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
9060
8964
  className: classNames.imageCol
9061
8965
  }, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
9062
8966
  className: classNames.imageHeading
@@ -9066,7 +8970,7 @@
9066
8970
  image: idCardBack,
9067
8971
  className: classNames.image,
9068
8972
  alt: verbiage.idCardBackText
9069
- })))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
8973
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
9070
8974
  className: classNames.imageCol
9071
8975
  }, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
9072
8976
  className: classNames.imageHeading
@@ -9076,7 +8980,7 @@
9076
8980
  image: passport,
9077
8981
  className: classNames.image,
9078
8982
  alt: verbiage.passportText
9079
- })))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
8983
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
9080
8984
  className: classNames.instruction
9081
8985
  }, verbiage.instructionText), /*#__PURE__*/React__default['default'].createElement(ButtonsRow, {
9082
8986
  className: classNames.buttonsRow
@@ -9678,13 +9582,8 @@
9678
9582
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
9679
9583
  var verbiage = useTranslations(rawVerbiage, {
9680
9584
  instructionText: 'Scan the front of ID',
9681
- processingIdCardText: 'ID card front captured.',
9682
9585
  capturingText: 'Capturing...',
9683
- captureFailedText: 'Capture failed!',
9684
- guidanceSatisfiedText: 'Document detected, hold still...',
9685
- guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
9686
- guidanceNotCenteredText: 'Document is not centered',
9687
- guidanceNotDetectedText: 'Document not detected'
9586
+ captureFailedText: 'Capture failed!'
9688
9587
  });
9689
9588
  var isMobile = window.innerWidth < window.innerHeight;
9690
9589
  var frontImageUrl = portraitGuidesOnMobile && isMobile ? flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontPortraitGuidesImageUrl : flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontLandscapeGuidesImageUrl;
@@ -9698,7 +9597,7 @@
9698
9597
  landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
9699
9598
  isMirrored: !((_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing),
9700
9599
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
9701
- imageVisible: requestingFlip || !state.documentDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
9600
+ imageVisible: requestingFlip || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
9702
9601
  })), guideType === 'fit' && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureFitGuide, {
9703
9602
  classNames: classNames,
9704
9603
  requestingFlip: requestingFlip,
@@ -9708,7 +9607,7 @@
9708
9607
  backImageUrl: backImageUrl,
9709
9608
  isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
9710
9609
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
9711
- imageVisible: requestingFlip || !state.documentDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
9610
+ imageVisible: requestingFlip || !state.detectionThresholdMet || !state.documentInBounds || state.documentTooClose || state.flipRequired
9712
9611
  })));
9713
9612
  }
9714
9613
 
@@ -10603,78 +10502,66 @@
10603
10502
  var templateObject_1$l, templateObject_2$f, templateObject_3$d, templateObject_4$8, templateObject_5$4, templateObject_6$3;
10604
10503
 
10605
10504
  var IdCaptureWizard = function IdCaptureWizard(_a) {
10606
- var _b, _c, _d, _e, _f, _g, _h, _j;
10607
- var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
10505
+ var _b, _c, _d, _e, _f, _g;
10506
+ var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
10608
10507
  var onSuccess = _a.onSuccess,
10609
10508
  onExitCapture = _a.onExitCapture,
10610
10509
  onUserCancel = _a.onUserCancel,
10611
- _v = _a.loadingOverlayMode,
10612
- loadingOverlayMode = _v === void 0 ? 'default' : _v,
10510
+ _t = _a.loadingOverlayMode,
10511
+ loadingOverlayMode = _t === void 0 ? 'default' : _t,
10613
10512
  precapturedDocuments = _a.precapturedDocuments,
10614
- _w = _a.captureRequirement,
10615
- captureRequirement = _w === void 0 ? 'idCardOrPassport' : _w,
10616
- _x = _a.separateIdCardCaptureSequence,
10617
- separateIdCardCaptureSequence = _x === void 0 ? false : _x,
10618
- _y = _a.autoCaptureEnabled,
10619
- autoCaptureEnabled = _y === void 0 ? true : _y,
10620
- _z = _a.autoCaptureBarcodeRequired,
10621
- autoCaptureBarcodeRequired = _z === void 0 ? 'mobile' : _z,
10622
- _0 = _a.barcodeScanningEnabled,
10623
- barcodeScanningEnabled = _0 === void 0 ? false : _0,
10624
- _1 = _a.idCardAutoCaptureScoreThreshold,
10625
- idCardAutoCaptureScoreThreshold = _1 === void 0 ? defaultDocumentDetectionThresholds.idCard : _1,
10626
- _2 = _a.passportAutoCaptureScoreThreshold,
10627
- passportAutoCaptureScoreThreshold = _2 === void 0 ? defaultDocumentDetectionThresholds.passport : _2,
10628
- _3 = _a.mrzDetectionScoreThreshold,
10629
- mrzDetectionScoreThreshold = _3 === void 0 ? defaultDocumentDetectionThresholds.mrz : _3,
10630
- _4 = _a.idCardFocusScoreThreshold,
10631
- idCardFocusScoreThreshold = _4 === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _4,
10632
- _5 = _a.passportFocusScoreThreshold,
10633
- passportFocusScoreThreshold = _5 === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _5,
10634
- _6 = _a.skipSuccessScreen,
10635
- skipSuccessScreen = _6 === void 0 ? false : _6,
10513
+ _u = _a.captureRequirement,
10514
+ captureRequirement = _u === void 0 ? 'idCardOrPassport' : _u,
10515
+ _v = _a.separateIdCardCaptureSequence,
10516
+ separateIdCardCaptureSequence = _v === void 0 ? false : _v,
10517
+ _w = _a.thresholds,
10518
+ thresholds = _w === void 0 ? defaultIdCaptureThresholds : _w,
10519
+ _x = _a.skipSuccessScreen,
10520
+ skipSuccessScreen = _x === void 0 ? false : _x,
10636
10521
  instructions = _a.instructions,
10637
- _7 = _a.releaseCameraAccessOnExit,
10638
- releaseCameraAccessOnExit = _7 === void 0 ? true : _7,
10639
- _8 = _a.guideType,
10640
- guideType = _8 === void 0 ? 'fit' : _8,
10641
- _9 = _a.portraitGuidesOnMobile,
10642
- portraitGuidesOnMobile = _9 === void 0 ? false : _9,
10643
- _10 = _a.rotateLoadingOverlayImageWhenPortrait,
10644
- rotateLoadingOverlayImageWhenPortrait = _10 === void 0 ? true : _10,
10645
- _11 = _a.silentFallback,
10646
- silentFallback = _11 === void 0 ? false : _11,
10647
- _12 = _a.assets,
10648
- assets = _12 === void 0 ? {} : _12,
10649
- _13 = _a.classNames,
10650
- classNames = _13 === void 0 ? {} : _13,
10651
- _14 = _a.colors,
10652
- colors = _14 === void 0 ? {} : _14,
10653
- _15 = _a.verbiage,
10654
- verbiage = _15 === void 0 ? {} : _15,
10655
- _16 = _a.debugMode,
10656
- debugMode = _16 === void 0 ? false : _16;
10657
- var _17 = useIdCaptureState(),
10658
- state = _17[0],
10659
- dispatch = _17[1];
10660
- var _18 = React.useContext(CameraStateContext),
10661
- cameraAccessDenied = _18.cameraAccessDenied,
10662
- releaseCameraAccess = _18.releaseCameraAccess;
10663
- var _19 = React.useState(false),
10664
- overlayDismissed = _19[0],
10665
- setOverlayDismissed = _19[1];
10666
- var _20 = React.useContext(SubmissionContext),
10667
- submissionStatus = _20.submissionStatus,
10668
- setIdFrontImage = _20.setIdFrontImage,
10669
- setIdBackImage = _20.setIdBackImage,
10670
- setPassportImage = _20.setPassportImage,
10671
- logIdFrontCaptureAttempt = _20.logIdFrontCaptureAttempt,
10672
- logIdBackCaptureAttempt = _20.logIdBackCaptureAttempt;
10673
- var _21 = React.useContext(IdCaptureModelsContext),
10674
- start = _21.start,
10675
- stop = _21.stop,
10676
- modelError = _21.modelError,
10677
- resetBestFrame = _21.resetBestFrame;
10522
+ _y = _a.releaseCameraAccessOnExit,
10523
+ releaseCameraAccessOnExit = _y === void 0 ? true : _y,
10524
+ _z = _a.guideType,
10525
+ guideType = _z === void 0 ? 'fit' : _z,
10526
+ _0 = _a.portraitGuidesOnMobile,
10527
+ portraitGuidesOnMobile = _0 === void 0 ? false : _0,
10528
+ _1 = _a.rotateLoadingOverlayImageWhenPortrait,
10529
+ rotateLoadingOverlayImageWhenPortrait = _1 === void 0 ? true : _1,
10530
+ _2 = _a.silentFallback,
10531
+ silentFallback = _2 === void 0 ? false : _2,
10532
+ _3 = _a.assets,
10533
+ assets = _3 === void 0 ? {} : _3,
10534
+ _4 = _a.classNames,
10535
+ classNames = _4 === void 0 ? {} : _4,
10536
+ _5 = _a.colors,
10537
+ colors = _5 === void 0 ? {} : _5,
10538
+ _6 = _a.verbiage,
10539
+ verbiage = _6 === void 0 ? {} : _6,
10540
+ _7 = _a.debugMode,
10541
+ debugMode = _7 === void 0 ? false : _7;
10542
+ var _8 = useIdCaptureState(),
10543
+ state = _8[0],
10544
+ dispatch = _8[1];
10545
+ var _9 = React.useContext(CameraStateContext),
10546
+ cameraAccessDenied = _9.cameraAccessDenied,
10547
+ releaseCameraAccess = _9.releaseCameraAccess;
10548
+ var _10 = React.useState(false),
10549
+ overlayDismissed = _10[0],
10550
+ setOverlayDismissed = _10[1];
10551
+ var _11 = React.useContext(SubmissionContext),
10552
+ submissionStatus = _11.submissionStatus,
10553
+ setIdFrontImage = _11.setIdFrontImage,
10554
+ setIdBackImage = _11.setIdBackImage,
10555
+ setPassportImage = _11.setPassportImage,
10556
+ logIdFrontCaptureAttempt = _11.logIdFrontCaptureAttempt,
10557
+ logIdBackCaptureAttempt = _11.logIdBackCaptureAttempt;
10558
+ var _12 = React.useContext(IdCaptureModelsContext),
10559
+ start = _12.start,
10560
+ stop = _12.stop,
10561
+ onPredictionMade = _12.onPredictionMade,
10562
+ setRequiredDocumentType = _12.setRequiredDocumentType,
10563
+ modelError = _12.modelError,
10564
+ resetBestFrame = _12.resetBestFrame;
10678
10565
  React.useEffect(function () {
10679
10566
  dispatch({
10680
10567
  type: 'configureWizard',
@@ -10699,16 +10586,29 @@
10699
10586
  type: 'captureStarted'
10700
10587
  });
10701
10588
  start();
10702
- return function () {
10703
- stop();
10704
- };
10705
- }, [dispatch, overlayDismissed, start, state.captureState, stop]);
10706
- var onPrediction = React.useCallback(function (prediction) {
10707
- dispatch({
10708
- type: 'predictionMade',
10709
- payload: prediction
10589
+ }, [dispatch, overlayDismissed, start, state.captureState]);
10590
+ React.useEffect(function () {
10591
+ onPredictionMade(function (prediction) {
10592
+ if (state.captureState === 'capturing') {
10593
+ dispatch({
10594
+ type: 'objectsDetected',
10595
+ payload: {
10596
+ prediction: prediction
10597
+ }
10598
+ });
10599
+ } else if (state.captureState === 'requestingFlip') {
10600
+ if (prediction.idCardBackDetectionThresholdMet) {
10601
+ resetBestFrame();
10602
+ dispatch({
10603
+ type: 'flipRequestCompleted'
10604
+ });
10605
+ }
10606
+ }
10710
10607
  });
10711
- }, [dispatch]);
10608
+ }, [dispatch, onPredictionMade, resetBestFrame, state.captureState]);
10609
+ React.useEffect(function () {
10610
+ if (state.captureState === 'complete') stop();
10611
+ }, [state.captureState, stop]);
10712
10612
  var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
10713
10613
  logCaptureMetadata(metadata);
10714
10614
  dispatch({
@@ -10718,7 +10618,9 @@
10718
10618
  width: width,
10719
10619
  height: height,
10720
10620
  documentType: documentType,
10721
- boundingBox: metadata.boundingBox
10621
+ boundingBox: metadata.boundingBox,
10622
+ detectionScore: metadata.bestDetectionScore,
10623
+ focusScore: metadata.bestFocusScore
10722
10624
  }
10723
10625
  });
10724
10626
  }, [dispatch, logCaptureMetadata]);
@@ -10748,9 +10650,9 @@
10748
10650
  type: 'resetWizard'
10749
10651
  });
10750
10652
  }, [dispatch]);
10751
- var _22 = React.useState(0),
10752
- attempt = _22[0],
10753
- setAttempt = _22[1];
10653
+ var _13 = React.useState(0),
10654
+ attempt = _13[0],
10655
+ setAttempt = _13[1];
10754
10656
  var onExit = React.useCallback(function () {
10755
10657
  setOverlayDismissed(false);
10756
10658
  setAttempt(function (n) {
@@ -10775,19 +10677,19 @@
10775
10677
  }
10776
10678
  }, [cameraAccessDenied]);
10777
10679
  assets.idCardFront || (assets.idCardFront = {});
10778
- (_k = assets.idCardFront).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
10779
- (_l = assets.idCardFront).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
10680
+ (_h = assets.idCardFront).portraitGuidesImageUrl || (_h.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
10681
+ (_j = assets.idCardFront).landscapeGuidesImageUrl || (_j.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
10780
10682
  assets.idCardBack || (assets.idCardBack = {});
10781
- (_m = assets.idCardBack).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
10782
- (_o = assets.idCardBack).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
10683
+ (_k = assets.idCardBack).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
10684
+ (_l = assets.idCardBack).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
10783
10685
  assets.passport || (assets.passport = {});
10784
- (_p = assets.passport).portraitGuidesImageUrl || (_p.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
10785
- (_q = assets.passport).landscapeGuidesImageUrl || (_q.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
10686
+ (_m = assets.passport).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
10687
+ (_o = assets.passport).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
10786
10688
  assets.flipIdPrompt || (assets.flipIdPrompt = {});
10787
- (_r = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_r.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
10788
- (_s = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_s.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
10789
- (_t = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_t.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
10790
- (_u = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_u.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
10689
+ (_p = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_p.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
10690
+ (_q = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_q.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
10691
+ (_r = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_r.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
10692
+ (_s = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_s.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
10791
10693
  var idCaptureVerbiages = {
10792
10694
  idCardFront: useTranslations(verbiage.idCardFront, {
10793
10695
  instructionText: 'Scan the front of ID',
@@ -10801,24 +10703,35 @@
10801
10703
  })
10802
10704
  };
10803
10705
  var theme = styled.useTheme();
10804
- var _23 = useIdCaptureState()[0],
10805
- guideRectX = _23.guideRectX,
10806
- guideRectY = _23.guideRectY,
10807
- guideRectWidth = _23.guideRectWidth,
10808
- guideRectHeight = _23.guideRectHeight,
10809
- imageUrl = _23.imageUrl;
10706
+ var _14 = useIdCaptureState()[0],
10707
+ guideRectX = _14.guideRectX,
10708
+ guideRectY = _14.guideRectY,
10709
+ guideRectWidth = _14.guideRectWidth,
10710
+ guideRectHeight = _14.guideRectHeight,
10711
+ imageUrl = _14.imageUrl;
10810
10712
  var idCaptureAssets = assets[state.requestedDocumentType];
10811
10713
  var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
10812
10714
  React.useEffect(function () {
10813
10715
  if (separateIdCardCaptureSequence) return;
10814
- if (state.captureState === 'requestingFlip') {
10815
- setTimeout(function () {
10816
- dispatch({
10817
- type: 'flipRequestCompleted'
10818
- });
10819
- }, 6000);
10716
+ if (state.captureState !== 'requestingFlip') return;
10717
+ var t = setTimeout(function () {
10718
+ resetBestFrame();
10719
+ dispatch({
10720
+ type: 'flipRequestCompleted'
10721
+ });
10722
+ }, 6000);
10723
+ return function () {
10724
+ clearTimeout(t);
10725
+ };
10726
+ }, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
10727
+ React.useEffect(function () {
10728
+ if (state.requestedDocumentType === 'idCardBack') {
10729
+ setRequiredDocumentType('idCardBack');
10820
10730
  }
10821
- }, [dispatch, separateIdCardCaptureSequence, state.captureState]);
10731
+ return function () {
10732
+ setRequiredDocumentType('none');
10733
+ };
10734
+ }, [setRequiredDocumentType, state.requestedDocumentType]);
10822
10735
  var handleCapture = React.useCallback(function (imageData) {
10823
10736
  return __awaiter(void 0, void 0, void 0, function () {
10824
10737
  var base64ImageData;
@@ -10852,7 +10765,7 @@
10852
10765
  });
10853
10766
  }
10854
10767
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
10855
- className: "flex ".concat((_d = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _d !== void 0 ? _d : '')
10768
+ className: "flex ".concat((_b = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _b !== void 0 ? _b : '')
10856
10769
  }, state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement(CameraFeedWrapper, {
10857
10770
  "$x": guideRectX,
10858
10771
  "$y": guideRectY,
@@ -10863,15 +10776,7 @@
10863
10776
  className: classNames === null || classNames === void 0 ? void 0 : classNames.cameraFeed
10864
10777
  }))), overlayDismissed && state.captureState === 'capturing' && ( /*#__PURE__*/React__default['default'].createElement(IdCapture, {
10865
10778
  requiredDocumentType: state.requestedDocumentType,
10866
- autoCaptureEnabled: autoCaptureEnabled,
10867
- idCardDetectionThreshold: idCardAutoCaptureScoreThreshold,
10868
- passportDetectionThreshold: passportAutoCaptureScoreThreshold,
10869
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
10870
- passportFocusScoreThreshold: passportFocusScoreThreshold,
10871
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
10872
- autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
10873
- barcodeScanningEnabled: barcodeScanningEnabled && state.requestedDocumentType === 'idCardBack',
10874
- onPrediction: onPrediction,
10779
+ thresholds: thresholds,
10875
10780
  onCapture: onCapture,
10876
10781
  assets: idCaptureAssets,
10877
10782
  classNames: classNames === null || classNames === void 0 ? void 0 : classNames.capture,
@@ -10887,15 +10792,15 @@
10887
10792
  assets: idCaptureAssets,
10888
10793
  colors: colors,
10889
10794
  verbiage: idCaptureVerbiage
10890
- }), !((_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.capturePreview) === null || _f === void 0 ? void 0 : _f.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && imageUrl && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
10891
- classNames: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.imagePreview,
10892
- text: (_h = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _h === void 0 ? void 0 : _h.processingIdCardText,
10795
+ }), !((_d = (_c = theme.idCapture) === null || _c === void 0 ? void 0 : _c.capturePreview) === null || _d === void 0 ? void 0 : _d.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && imageUrl && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
10796
+ classNames: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.imagePreview,
10797
+ text: (_f = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _f === void 0 ? void 0 : _f.processingIdCardText,
10893
10798
  imageUrl: imageUrl
10894
10799
  })), state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement("div", {
10895
10800
  id: "idmission-above-guides-content"
10896
10801
  })), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
10897
10802
  onClick: onExit,
10898
- className: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.exitCaptureBtn
10803
+ className: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.exitCaptureBtn
10899
10804
  }), !overlayDismissed && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingOverlay, {
10900
10805
  key: attempt,
10901
10806
  mode: loadingOverlayMode,
@@ -10922,12 +10827,12 @@
10922
10827
  verbiage: verbiage.success
10923
10828
  })), state.captureState === 'complete' && showSuccessScreen && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureSuccess, {
10924
10829
  capturedDocuments: state.capturedDocuments,
10925
- barcodeResult: state.barcodeResult,
10926
10830
  classNames: classNames.success,
10927
10831
  onSubmitClick: onSubmitClick,
10928
10832
  onRetryClick: onRetryClick,
10929
10833
  colors: colors.success,
10930
- verbiage: verbiage.success
10834
+ verbiage: verbiage.success,
10835
+ debugMode: debugMode
10931
10836
  })));
10932
10837
  };
10933
10838
 
@@ -13616,7 +13521,7 @@
13616
13521
  var processAudio = React.useCallback(function () {
13617
13522
  var _a;
13618
13523
  var audioBlob = new Blob(audioChunks.current, {
13619
- type: 'audio/ogg; codecs=opus'
13524
+ type: 'audio/mp4'
13620
13525
  });
13621
13526
  audioChunks.current = [];
13622
13527
  setAudioUrl(URL.createObjectURL(audioBlob));
@@ -14407,6 +14312,31 @@
14407
14312
  var templateObject_1$6, templateObject_2$6, templateObject_3$6, templateObject_4$1, templateObject_5, templateObject_6;
14408
14313
 
14409
14314
  var edgeBoundary = 0.05;
14315
+ var defaultVideoIdCaptureThresholds = {
14316
+ detection: {
14317
+ idCardFront: 0.6,
14318
+ idCardBack: 0.6,
14319
+ passport: 1
14320
+ },
14321
+ focus: {
14322
+ idCardFront: {
14323
+ desktop: 0,
14324
+ mobile: 0
14325
+ },
14326
+ idCardBack: {
14327
+ desktop: 0,
14328
+ mobile: 0
14329
+ },
14330
+ passport: {
14331
+ desktop: 0,
14332
+ mobile: 0
14333
+ }
14334
+ },
14335
+ goodFrames: {
14336
+ idCardFront: 1,
14337
+ idCardBack: 1
14338
+ }
14339
+ };
14410
14340
  var IdVideoCapture = function IdVideoCapture(_a) {
14411
14341
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
14412
14342
  var onComplete = _a.onComplete,
@@ -14418,96 +14348,85 @@
14418
14348
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
14419
14349
  _x = _a.idCardFrontDelay,
14420
14350
  idCardFrontDelay = _x === void 0 ? 1000 : _x,
14421
- _y = _a.idCardFrontDetectionThreshold,
14422
- idCardFrontDetectionThreshold = _y === void 0 ? 0.6 : _y,
14423
- _z = _a.idCardFrontFocusThreshold,
14424
- idCardFrontFocusThreshold = _z === void 0 ? 0 : _z,
14425
- _0 = _a.goodIdCardFrontFramesThreshold,
14426
- goodIdCardFrontFramesThreshold = _0 === void 0 ? 1 : _0,
14427
- _1 = _a.idCardBackDetectionThreshold,
14428
- idCardBackDetectionThreshold = _1 === void 0 ? 0.6 : _1,
14429
- _2 = _a.idCardBackFocusThreshold,
14430
- idCardBackFocusThreshold = _2 === void 0 ? 0 : _2,
14431
- _3 = _a.goodIdCardBackFramesThreshold,
14432
- goodIdCardBackFramesThreshold = _3 === void 0 ? 1 : _3,
14433
- _4 = _a.skipShowIdCardBack,
14434
- skipShowIdCardBack = _4 === void 0 ? false : _4,
14435
- _5 = _a.captureCountdownSeconds,
14436
- captureCountdownSeconds = _5 === void 0 ? 3 : _5,
14351
+ _y = _a.videoIdCaptureThresholds,
14352
+ videoIdCaptureThresholds = _y === void 0 ? defaultVideoIdCaptureThresholds : _y,
14353
+ _z = _a.skipShowIdCardBack,
14354
+ skipShowIdCardBack = _z === void 0 ? false : _z,
14355
+ _0 = _a.captureCountdownSeconds,
14356
+ captureCountdownSeconds = _0 === void 0 ? 3 : _0,
14437
14357
  readTextPrompt = _a.readTextPrompt,
14438
- _6 = _a.readTextTimeoutDurationMs,
14439
- readTextTimeoutDurationMs = _6 === void 0 ? 15000 : _6,
14440
- _7 = _a.readTextMinReadingMs,
14441
- readTextMinReadingMs = _7 === void 0 ? 10000 : _7,
14442
- _8 = _a.disableFaceDetectionWhileAudioCapture,
14443
- disableFaceDetectionWhileAudioCapture = _8 === void 0 ? false : _8,
14444
- _9 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
14445
- disableFaceDetectionWhileAudioCaptureMsDelay = _9 === void 0 ? 2000 : _9,
14446
- _10 = _a.mergeAVStreams,
14447
- mergeAVStreams = _10 === void 0 ? false : _10,
14448
- _11 = _a.assets,
14449
- assets = _11 === void 0 ? {} : _11,
14450
- _12 = _a.classNames,
14451
- classNames = _12 === void 0 ? {} : _12,
14452
- _13 = _a.colors,
14453
- colors = _13 === void 0 ? {} : _13,
14454
- _14 = _a.verbiage,
14455
- rawVerbiage = _14 === void 0 ? {} : _14,
14456
- _15 = _a.debugMode,
14457
- debugMode = _15 === void 0 ? false : _15;
14458
- var _16 = useResizeObserver(),
14459
- ref = _16.ref,
14460
- _17 = _16.width,
14461
- width = _17 === void 0 ? 1 : _17,
14462
- _18 = _16.height,
14463
- height = _18 === void 0 ? 1 : _18;
14464
- var _19 = React.useContext(CameraStateContext),
14465
- cameraRef = _19.cameraRef,
14466
- videoRef = _19.videoRef,
14467
- videoLoaded = _19.videoLoaded,
14468
- cameraReady = _19.cameraReady,
14469
- microphoneReady = _19.microphoneReady,
14470
- audioStream = _19.audioStream,
14471
- setVideoLoaded = _19.setVideoLoaded,
14472
- takePhoto = _19.takePhoto;
14473
- var _20 = React.useState([]),
14474
- detectedObjects = _20[0],
14475
- setDetectedObjects = _20[1];
14476
- var _21 = React.useState([]),
14477
- faces = _21[0],
14478
- setFaces = _21[1];
14479
- var _22 = React.useContext(IdCaptureModelsContext),
14480
- idModelsReady = _22.ready,
14481
- startIdModels = _22.start,
14482
- stopIdModels = _22.stop,
14483
- onIdPredictionMade = _22.onPredictionMade,
14484
- setThresholds = _22.setThresholds,
14485
- bestFrameDetails = _22.bestFrameDetails,
14486
- resetBestFrame = _22.resetBestFrame,
14487
- idModelError = _22.modelError;
14488
- var _23 = React.useState(null),
14489
- videoStartsAt = _23[0],
14490
- setVideoStartsAt = _23[1];
14491
- var _24 = React.useContext(SubmissionContext),
14492
- setIdCaptureVideoAudioStartsAt = _24.setIdCaptureVideoAudioStartsAt,
14493
- setExpectedAudioText = _24.setExpectedAudioText;
14494
- var _25 = React.useContext(SelfieGuidanceModelsContext),
14495
- onSelfiePredictionMade = _25.onPredictionMade,
14496
- selfieModelError = _25.error;
14497
- var _26 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
14498
- isRecordingVideo = _26.isRecordingVideo,
14499
- startRecordingVideo = _26.startRecordingVideo,
14500
- startRecordingAudio = _26.startRecordingAudio,
14501
- stopRecordingVideo = _26.stopRecordingVideo,
14502
- stopRecordingAudio = _26.stopRecordingAudio,
14503
- videoRecordingUnintentionallyStopped = _26.videoRecordingUnintentionallyStopped,
14504
- audioRecordingUnintentionallyStopped = _26.audioRecordingUnintentionallyStopped,
14505
- videoUrl = _26.videoUrl,
14506
- audioUrl = _26.audioUrl;
14358
+ _1 = _a.readTextTimeoutDurationMs,
14359
+ readTextTimeoutDurationMs = _1 === void 0 ? 15000 : _1,
14360
+ _2 = _a.readTextMinReadingMs,
14361
+ readTextMinReadingMs = _2 === void 0 ? 10000 : _2,
14362
+ _3 = _a.disableFaceDetectionWhileAudioCapture,
14363
+ disableFaceDetectionWhileAudioCapture = _3 === void 0 ? false : _3,
14364
+ _4 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
14365
+ disableFaceDetectionWhileAudioCaptureMsDelay = _4 === void 0 ? 2000 : _4,
14366
+ _5 = _a.mergeAVStreams,
14367
+ mergeAVStreams = _5 === void 0 ? false : _5,
14368
+ _6 = _a.assets,
14369
+ assets = _6 === void 0 ? {} : _6,
14370
+ _7 = _a.classNames,
14371
+ classNames = _7 === void 0 ? {} : _7,
14372
+ _8 = _a.colors,
14373
+ colors = _8 === void 0 ? {} : _8,
14374
+ _9 = _a.verbiage,
14375
+ rawVerbiage = _9 === void 0 ? {} : _9,
14376
+ _10 = _a.debugMode,
14377
+ debugMode = _10 === void 0 ? false : _10;
14378
+ var _11 = useResizeObserver(),
14379
+ ref = _11.ref,
14380
+ _12 = _11.width,
14381
+ width = _12 === void 0 ? 1 : _12,
14382
+ _13 = _11.height,
14383
+ height = _13 === void 0 ? 1 : _13;
14384
+ var _14 = React.useContext(CameraStateContext),
14385
+ cameraRef = _14.cameraRef,
14386
+ videoRef = _14.videoRef,
14387
+ videoLoaded = _14.videoLoaded,
14388
+ cameraReady = _14.cameraReady,
14389
+ microphoneReady = _14.microphoneReady,
14390
+ audioStream = _14.audioStream,
14391
+ setVideoLoaded = _14.setVideoLoaded;
14392
+ var _15 = React.useState([]),
14393
+ detectedObjects = _15[0],
14394
+ setDetectedObjects = _15[1];
14395
+ var _16 = React.useState([]),
14396
+ faces = _16[0],
14397
+ setFaces = _16[1];
14398
+ var _17 = React.useContext(IdCaptureModelsContext),
14399
+ idModelsReady = _17.ready,
14400
+ startIdModels = _17.start,
14401
+ stopIdModels = _17.stop,
14402
+ onIdPredictionMade = _17.onPredictionMade,
14403
+ setThresholds = _17.setThresholds,
14404
+ bestFrameDetails = _17.bestFrameDetails,
14405
+ resetBestFrame = _17.resetBestFrame,
14406
+ idModelError = _17.modelError;
14407
+ var _18 = React.useState(null),
14408
+ videoStartsAt = _18[0],
14409
+ setVideoStartsAt = _18[1];
14410
+ var _19 = React.useContext(SubmissionContext),
14411
+ setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
14412
+ setExpectedAudioText = _19.setExpectedAudioText;
14413
+ var _20 = React.useContext(SelfieGuidanceModelsContext),
14414
+ onSelfiePredictionMade = _20.onPredictionMade,
14415
+ selfieModelError = _20.error;
14416
+ var _21 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
14417
+ isRecordingVideo = _21.isRecordingVideo,
14418
+ startRecordingVideo = _21.startRecordingVideo,
14419
+ startRecordingAudio = _21.startRecordingAudio,
14420
+ stopRecordingVideo = _21.stopRecordingVideo,
14421
+ stopRecordingAudio = _21.stopRecordingAudio,
14422
+ videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
14423
+ audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
14424
+ videoUrl = _21.videoUrl,
14425
+ audioUrl = _21.audioUrl;
14507
14426
  var countdownTimeoutRef = React.useRef(undefined);
14508
- var _27 = React.useState(0),
14509
- countdownRemaining = _27[0],
14510
- setCountdownRemaining = _27[1];
14427
+ var _22 = React.useState(-1),
14428
+ countdownRemaining = _22[0],
14429
+ setCountdownRemaining = _22[1];
14511
14430
  React.useEffect(function () {
14512
14431
  if (!isRecordingVideo && !videoUrl) {
14513
14432
  startRecordingVideo();
@@ -14527,41 +14446,30 @@
14527
14446
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
14528
14447
  }
14529
14448
  }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
14530
- var shouldCaptureFrames = React.useRef(false);
14531
- React.useEffect(function () {
14532
- shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && !idModelError && (!readTextPrompt || microphoneReady);
14533
- }, [cameraReady, idModelError, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
14534
- var _28 = React.useState('SHOW_ID_FRONT'),
14535
- requestedAction = _28[0],
14536
- setRequestedAction = _28[1];
14449
+ var _23 = React.useState('SHOW_ID_FRONT'),
14450
+ requestedAction = _23[0],
14451
+ setRequestedAction = _23[1];
14452
+ var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
14537
14453
  React.useEffect(function startModelsWhenCapturing() {
14538
- if (!shouldCaptureFrames.current && requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
14454
+ if (!shouldRunIdModels) return;
14539
14455
  startIdModels();
14540
14456
  return function () {
14541
14457
  stopIdModels();
14542
14458
  };
14543
- }, [requestedAction, startIdModels, stopIdModels]);
14459
+ }, [shouldRunIdModels, startIdModels, stopIdModels]);
14544
14460
  React.useEffect(function () {
14545
- setThresholds({
14546
- idCard: requestedAction === 'SHOW_ID_FRONT' ? idCardFrontDetectionThreshold : requestedAction === 'SHOW_ID_BACK' ? idCardBackDetectionThreshold : 1,
14547
- passport: 1,
14548
- focus: {
14549
- idCard: {
14550
- mobile: requestedAction === 'SHOW_ID_FRONT' ? idCardFrontFocusThreshold : requestedAction === 'SHOW_ID_BACK' ? idCardBackFocusThreshold : 0
14551
- }
14552
- }
14553
- });
14554
- }, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
14555
- var _29 = React.useState(0),
14556
- currentDetectionScore = _29[0],
14557
- setCurrentDetectionScore = _29[1];
14558
- var _30 = React.useState(0),
14559
- currentFocusScore = _30[0],
14560
- setCurrentFocusScore = _30[1];
14561
- var _31 = React.useState(0),
14562
- goodFramesCount = _31[0],
14563
- setGoodFramesCount = _31[1];
14564
- var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
14461
+ setThresholds(videoIdCaptureThresholds);
14462
+ }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
14463
+ var _24 = React.useState(0),
14464
+ currentDetectionScore = _24[0],
14465
+ setCurrentDetectionScore = _24[1];
14466
+ var _25 = React.useState(0),
14467
+ currentFocusScore = _25[0],
14468
+ setCurrentFocusScore = _25[1];
14469
+ var _26 = React.useState(0),
14470
+ goodFramesCount = _26[0],
14471
+ setGoodFramesCount = _26[1];
14472
+ var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
14565
14473
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
14566
14474
  React.useEffect(function () {
14567
14475
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -14569,18 +14477,19 @@
14569
14477
  setDetectedObjects(prediction.detectedObjects);
14570
14478
  setCurrentDetectionScore(prediction.detectionScore);
14571
14479
  setCurrentFocusScore(prediction.focusScore);
14572
- if (prediction.detectionThresholdMet && prediction.focusThresholdMet) {
14573
- setGoodFramesCount(function (n) {
14574
- return n + 1;
14575
- });
14576
- } else {
14577
- setGoodFramesCount(0);
14480
+ var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
14481
+ var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
14482
+ if (requestedAction === 'FLIP_ID' && isGoodFrame) {
14483
+ return setRequestedAction('SHOW_ID_BACK');
14578
14484
  }
14485
+ setGoodFramesCount(isGoodFrame ? function (n) {
14486
+ return n + 1;
14487
+ } : 0);
14579
14488
  });
14580
- }, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade, idModelError]);
14581
- var _32 = React.useState(null),
14582
- idFrontCaptureStartedAt = _32[0],
14583
- setFirstGoodFrameTime = _32[1];
14489
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
14490
+ var _27 = React.useState(null),
14491
+ idFrontCaptureStartedAt = _27[0],
14492
+ setFirstGoodFrameTime = _27[1];
14584
14493
  React.useEffect(function () {
14585
14494
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
14586
14495
  }, [goodFramesCount]);
@@ -14601,73 +14510,56 @@
14601
14510
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
14602
14511
  var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
14603
14512
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
14604
- var _33 = React.useState(),
14605
- countdownStartedAt = _33[0],
14606
- setCountdownStartedAt = _33[1];
14513
+ var _28 = React.useState(),
14514
+ countdownStartedAt = _28[0],
14515
+ setCountdownStartedAt = _28[1];
14516
+ var photoCanvas = React.useRef(null);
14607
14517
  var frameLock = React.useRef(false);
14608
14518
  var captureFrame = React.useCallback(function () {
14609
14519
  return __awaiter(void 0, void 0, void 0, function () {
14610
- var frame, frameBase64, _a;
14611
- return __generator(this, function (_b) {
14612
- switch (_b.label) {
14520
+ var frameBase64;
14521
+ return __generator(this, function (_a) {
14522
+ switch (_a.label) {
14613
14523
  case 0:
14614
14524
  if (frameLock.current) return [2 /*return*/];
14615
14525
  frameLock.current = true;
14616
- return [4 /*yield*/, takePhoto()];
14617
- case 1:
14618
- frame = _b.sent();
14619
- if (!frame) {
14526
+ drawToCanvas(photoCanvas.current, videoRef.current);
14527
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
14528
+ if (!frameBase64) {
14620
14529
  frameLock.current = false;
14621
14530
  return [2 /*return*/];
14622
14531
  }
14623
- _b.label = 2;
14624
- case 2:
14625
- _b.trys.push([2,, 10, 11]);
14626
- _a = frame;
14627
- if (!_a) return [3 /*break*/, 4];
14628
- return [4 /*yield*/, new Promise(function (resolve) {
14629
- var reader = new FileReader();
14630
- reader.onloadend = function () {
14631
- return resolve(reader.result);
14632
- };
14633
- reader.readAsDataURL(frame);
14634
- })];
14635
- case 3:
14636
- _a = _b.sent();
14637
- _b.label = 4;
14638
- case 4:
14639
- frameBase64 = _a;
14640
- if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 8];
14532
+ _a.label = 1;
14533
+ case 1:
14534
+ _a.trys.push([1,, 7, 8]);
14535
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
14641
14536
  if (onIdFrontImageCaptured) {
14642
- frameBase64 && onIdFrontImageCaptured(frameBase64);
14537
+ onIdFrontImageCaptured(frameBase64);
14643
14538
  }
14644
- if (!skipShowIdCardBack) return [3 /*break*/, 7];
14645
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 5];
14539
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
14540
+ if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
14646
14541
  return [2 /*return*/, onIdBackCaptureComplete()];
14647
- case 5:
14542
+ case 2:
14648
14543
  return [4 /*yield*/, skipShowIdCardBack()];
14649
- case 6:
14650
- if (_b.sent()) {
14544
+ case 3:
14545
+ if (_a.sent()) {
14651
14546
  return [2 /*return*/, onIdBackCaptureComplete()];
14652
14547
  }
14653
- _b.label = 7;
14654
- case 7:
14548
+ _a.label = 4;
14549
+ case 4:
14655
14550
  setRequestedAction('FLIP_ID');
14656
- setTimeout(function () {
14657
- setRequestedAction('SHOW_ID_BACK');
14658
- }, 6000);
14659
- return [3 /*break*/, 9];
14660
- case 8:
14551
+ return [3 /*break*/, 6];
14552
+ case 5:
14661
14553
  if (requestedAction == 'SHOW_ID_BACK') {
14662
14554
  if (onIdBackImageCaptured) {
14663
- frameBase64 && onIdBackImageCaptured(frameBase64);
14555
+ onIdBackImageCaptured(frameBase64);
14664
14556
  }
14665
14557
  onIdBackCaptureComplete();
14666
14558
  }
14667
- _b.label = 9;
14668
- case 9:
14669
- return [3 /*break*/, 11];
14670
- case 10:
14559
+ _a.label = 6;
14560
+ case 6:
14561
+ return [3 /*break*/, 8];
14562
+ case 7:
14671
14563
  setDetectedObjects([]);
14672
14564
  setCurrentDetectionScore(0);
14673
14565
  setCurrentFocusScore(0);
@@ -14679,17 +14571,27 @@
14679
14571
  clearTimeout(countdownTimeoutRef.current);
14680
14572
  }
14681
14573
  return [7 /*endfinally*/];
14682
- case 11:
14574
+ case 8:
14683
14575
  return [2 /*return*/];
14684
14576
  }
14685
14577
  });
14686
14578
  });
14687
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, takePhoto]);
14579
+ }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
14580
+ var isFlipping = requestedAction === 'FLIP_ID';
14581
+ React.useEffect(function () {
14582
+ if (!isFlipping) return;
14583
+ var t = setTimeout(function () {
14584
+ setRequestedAction('SHOW_ID_BACK');
14585
+ }, 6000);
14586
+ return function () {
14587
+ clearTimeout(t);
14588
+ };
14589
+ }, [isFlipping]);
14688
14590
  var stopRecording = React.useCallback(function () {
14689
14591
  stopRecordingVideo();
14690
14592
  stopRecordingAudio();
14691
14593
  }, [stopRecordingAudio, stopRecordingVideo]);
14692
- var satisfied = goodFramesThresholdMet && faceCentered && delaySatisfied;
14594
+ var satisfied = !isFlipping && goodFramesThresholdMet && faceCentered && delaySatisfied;
14693
14595
  React.useEffect(function () {
14694
14596
  if (satisfied && !countdownStartedAt) {
14695
14597
  setCountdownStartedAt(new Date());
@@ -14709,10 +14611,7 @@
14709
14611
  }, 1000);
14710
14612
  return;
14711
14613
  }
14712
- if (countdownStartedAt) {
14713
- captureFrame();
14714
- }
14715
- }, [captureFrame, countdownStartedAt, countdownTimeoutRef]);
14614
+ }, [countdownTimeoutRef]);
14716
14615
  React.useEffect(function () {
14717
14616
  if (!countdownStartedAt) return;
14718
14617
  setCountdownRemaining(captureCountdownSeconds);
@@ -14722,11 +14621,17 @@
14722
14621
  return function () {
14723
14622
  clearTimeout(countdownTimeoutRef.current);
14724
14623
  };
14725
- }, [captureCountdownSeconds, captureFrame, countdownStartedAt, manualCountdown]);
14624
+ }, [captureCountdownSeconds, countdownStartedAt, manualCountdown]);
14625
+ React.useEffect(function () {
14626
+ if (countdownRemaining === 0) {
14627
+ setCountdownRemaining(-1);
14628
+ captureFrame().then();
14629
+ }
14630
+ }, [captureFrame, countdownRemaining]);
14726
14631
  var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
14727
- var _34 = React.useState(0),
14728
- numFramesWithoutFaces = _34[0],
14729
- setNumFramesWithoutFaces = _34[1];
14632
+ var _29 = React.useState(0),
14633
+ numFramesWithoutFaces = _29[0],
14634
+ setNumFramesWithoutFaces = _29[1];
14730
14635
  React.useEffect(function () {
14731
14636
  if (!selfieModelError) {
14732
14637
  onSelfiePredictionMade(function (faces) {
@@ -14744,14 +14649,14 @@
14744
14649
  }
14745
14650
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
14746
14651
  var theme = styled.useTheme();
14747
- var _35 = useTranslations(rawVerbiage, {
14652
+ var _30 = useTranslations(rawVerbiage, {
14748
14653
  faceNotCenteredText: 'Please move your face to the center...',
14749
14654
  searchingForIdCardText: 'Searching for ID card...',
14750
14655
  captureBtnText: 'Capture'
14751
14656
  }),
14752
- captureBtnText = _35.captureBtnText,
14753
- faceNotCenteredText = _35.faceNotCenteredText,
14754
- searchingForIdCardText = _35.searchingForIdCardText;
14657
+ captureBtnText = _30.captureBtnText,
14658
+ faceNotCenteredText = _30.faceNotCenteredText,
14659
+ searchingForIdCardText = _30.searchingForIdCardText;
14755
14660
  var debugScalingDetails = useDebugScalingDetails({
14756
14661
  enabled: debugMode,
14757
14662
  pageWidth: width,
@@ -14765,7 +14670,9 @@
14765
14670
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
14766
14671
  ref: ref,
14767
14672
  className: "flex ".concat((_l = classNames.container) !== null && _l !== void 0 ? _l : '')
14768
- }, requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default['default'].createElement(ReadTextPrompt, {
14673
+ }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
14674
+ ref: photoCanvas
14675
+ }), requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default['default'].createElement(ReadTextPrompt, {
14769
14676
  text: readTextPrompt,
14770
14677
  startedAt: timeoutStartedAt || undefined,
14771
14678
  durationMs: readTextTimeoutDurationMs,
@@ -14804,7 +14711,7 @@
14804
14711
  className: classNames.guidanceMessage,
14805
14712
  "$background": (_q = (_p = (_o = theme.guidanceMessages) === null || _o === void 0 ? void 0 : _o.negative) === null || _p === void 0 ? void 0 : _p.backgroundColor) !== null && _q !== void 0 ? _q : 'red',
14806
14713
  "$textColor": (_t = (_s = (_r = theme.guidanceMessages) === null || _r === void 0 ? void 0 : _r.negative) === null || _s === void 0 ? void 0 : _s.textColor) !== null && _t !== void 0 ? _t : 'white'
14807
- }, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)), !!countdownRemaining && capturingId && ( /*#__PURE__*/React__default['default'].createElement(CountdownContainer, {
14714
+ }, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React__default['default'].createElement(CountdownContainer, {
14808
14715
  className: classNames.countdownContainer
14809
14716
  }, /*#__PURE__*/React__default['default'].createElement(Countdown, {
14810
14717
  className: classNames.countdown
@@ -14959,64 +14866,60 @@
14959
14866
  faceLivenessProps = _h === void 0 ? {} : _h,
14960
14867
  _j = _a.idCaptureModelsEnabled,
14961
14868
  idCaptureModelsEnabled = _j === void 0 ? true : _j,
14962
- idCardFrontDetectionThreshold = _a.idCardFrontDetectionThreshold,
14963
- idCardBackDetectionThreshold = _a.idCardBackDetectionThreshold,
14964
- idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
14965
- idCardBackFocusThreshold = _a.idCardBackFocusThreshold,
14966
- goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
14967
- goodIdCardBackFramesThreshold = _a.goodIdCardBackFramesThreshold,
14869
+ _k = _a.videoIdCaptureThresholds,
14870
+ videoIdCaptureThresholds = _k === void 0 ? defaultVideoIdCaptureThresholds : _k,
14968
14871
  readTextPrompt = _a.readTextPrompt,
14969
14872
  readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
14970
14873
  readTextMinReadingMs = _a.readTextMinReadingMs,
14971
- _k = _a.skipIdCapture,
14972
- skipIdCapture = _k === void 0 ? false : _k,
14973
- _l = _a.skipShowIdCardBack,
14974
- skipShowIdCardBack = _l === void 0 ? false : _l,
14975
- _m = _a.skipSuccessScreen,
14976
- skipSuccessScreen = _m === void 0 ? false : _m,
14977
- _o = _a.idCaptureLoadingOverlayMode,
14978
- idCaptureLoadingOverlayMode = _o === void 0 ? 'default' : _o,
14979
- _p = _a.idCaptureGuideType,
14980
- idCaptureGuideType = _p === void 0 ? 'fit' : _p,
14981
- _q = _a.idCapturePortraitGuidesOnMobile,
14982
- idCapturePortraitGuidesOnMobile = _q === void 0 ? false : _q,
14983
- _r = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
14984
- idCaptureRotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
14985
- _s = _a.idCaptureModelLoadTimeoutMs,
14986
- idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _s,
14987
- _t = _a.faceLivenessLoadingOverlayMode,
14988
- faceLivenessLoadingOverlayMode = _t === void 0 ? 'default' : _t,
14989
- _u = _a.disableFaceDetectionWhileAudioCapture,
14990
- disableFaceDetectionWhileAudioCapture = _u === void 0 ? true : _u,
14991
- _v = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
14992
- disableFaceDetectionWhileAudioCaptureMsDelay = _v === void 0 ? 2000 : _v,
14993
- _w = _a.silentFallback,
14994
- silentFallback = _w === void 0 ? false : _w,
14995
- _x = _a.mergeAVStreams,
14996
- mergeAVStreams = _x === void 0 ? false : _x,
14997
- _y = _a.assets,
14998
- assets = _y === void 0 ? {} : _y,
14999
- _z = _a.classNames,
15000
- classNames = _z === void 0 ? {} : _z,
15001
- _0 = _a.colors,
15002
- colors = _0 === void 0 ? {} : _0,
15003
- _1 = _a.verbiage,
15004
- verbiage = _1 === void 0 ? {} : _1,
15005
- _2 = _a.debugMode,
15006
- debugMode = _2 === void 0 ? false : _2;
15007
- var _3 = React.useContext(SubmissionContext),
15008
- submissionStatus = _3.submissionStatus,
15009
- idCaptureVideoUrl = _3.idCaptureVideoUrl,
15010
- idCaptureVideoAudioUrl = _3.idCaptureVideoAudioUrl,
15011
- idCaptureVideoIdFrontImage = _3.idCaptureVideoIdFrontImage,
15012
- idCaptureVideoIdBackImage = _3.idCaptureVideoIdBackImage,
15013
- setIdCaptureVideoUrl = _3.setIdCaptureVideoUrl,
15014
- setIdCaptureVideoIdFrontImage = _3.setIdCaptureVideoIdFrontImage,
15015
- setIdCaptureVideoIdBackImage = _3.setIdCaptureVideoIdBackImage,
15016
- setIdCaptureVideoAudioUrl = _3.setIdCaptureVideoAudioUrl;
15017
- var _4 = React.useState('CAPTURING_ID'),
15018
- captureState = _4[0],
15019
- setCaptureState = _4[1];
14874
+ _l = _a.skipIdCapture,
14875
+ skipIdCapture = _l === void 0 ? false : _l,
14876
+ _m = _a.skipShowIdCardBack,
14877
+ skipShowIdCardBack = _m === void 0 ? false : _m,
14878
+ _o = _a.skipSuccessScreen,
14879
+ skipSuccessScreen = _o === void 0 ? false : _o,
14880
+ _p = _a.idCaptureLoadingOverlayMode,
14881
+ idCaptureLoadingOverlayMode = _p === void 0 ? 'default' : _p,
14882
+ _q = _a.idCaptureGuideType,
14883
+ idCaptureGuideType = _q === void 0 ? 'fit' : _q,
14884
+ _r = _a.idCapturePortraitGuidesOnMobile,
14885
+ idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
14886
+ _s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
14887
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
14888
+ _t = _a.idCaptureModelLoadTimeoutMs,
14889
+ idCaptureModelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
14890
+ _u = _a.faceLivenessLoadingOverlayMode,
14891
+ faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
14892
+ _v = _a.disableFaceDetectionWhileAudioCapture,
14893
+ disableFaceDetectionWhileAudioCapture = _v === void 0 ? true : _v,
14894
+ _w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
14895
+ disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
14896
+ _x = _a.silentFallback,
14897
+ silentFallback = _x === void 0 ? false : _x,
14898
+ _y = _a.mergeAVStreams,
14899
+ mergeAVStreams = _y === void 0 ? false : _y,
14900
+ _z = _a.assets,
14901
+ assets = _z === void 0 ? {} : _z,
14902
+ _0 = _a.classNames,
14903
+ classNames = _0 === void 0 ? {} : _0,
14904
+ _1 = _a.colors,
14905
+ colors = _1 === void 0 ? {} : _1,
14906
+ _2 = _a.verbiage,
14907
+ verbiage = _2 === void 0 ? {} : _2,
14908
+ _3 = _a.debugMode,
14909
+ debugMode = _3 === void 0 ? false : _3;
14910
+ var _4 = React.useContext(SubmissionContext),
14911
+ submissionStatus = _4.submissionStatus,
14912
+ idCaptureVideoUrl = _4.idCaptureVideoUrl,
14913
+ idCaptureVideoAudioUrl = _4.idCaptureVideoAudioUrl,
14914
+ idCaptureVideoIdFrontImage = _4.idCaptureVideoIdFrontImage,
14915
+ idCaptureVideoIdBackImage = _4.idCaptureVideoIdBackImage,
14916
+ setIdCaptureVideoUrl = _4.setIdCaptureVideoUrl,
14917
+ setIdCaptureVideoIdFrontImage = _4.setIdCaptureVideoIdFrontImage,
14918
+ setIdCaptureVideoIdBackImage = _4.setIdCaptureVideoIdBackImage,
14919
+ setIdCaptureVideoAudioUrl = _4.setIdCaptureVideoAudioUrl;
14920
+ var _5 = React.useState('CAPTURING_ID'),
14921
+ captureState = _5[0],
14922
+ setCaptureState = _5[1];
15020
14923
  React.useEffect(function () {
15021
14924
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
15022
14925
  }, [captureState, skipIdCapture]);
@@ -15047,9 +14950,9 @@
15047
14950
  var onVideoCaptureFaceNotDetected = React.useCallback(function () {
15048
14951
  setCaptureState('CHECKING_LIVENESS');
15049
14952
  }, []);
15050
- var _5 = React.useState(0),
15051
- attempt = _5[0],
15052
- setAttempt = _5[1];
14953
+ var _6 = React.useState(0),
14954
+ attempt = _6[0],
14955
+ setAttempt = _6[1];
15053
14956
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
15054
14957
  var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
15055
14958
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -15153,12 +15056,7 @@
15153
15056
  onFaceNotDetected: onVideoCaptureFaceNotDetected,
15154
15057
  onRecordingFailed: onRecordingFailed,
15155
15058
  idCaptureModelsEnabled: idCaptureModelsEnabled,
15156
- idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
15157
- idCardBackDetectionThreshold: idCardBackDetectionThreshold,
15158
- idCardFrontFocusThreshold: idCardFrontFocusThreshold,
15159
- idCardBackFocusThreshold: idCardBackFocusThreshold,
15160
- goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
15161
- goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
15059
+ videoIdCaptureThresholds: videoIdCaptureThresholds,
15162
15060
  skipShowIdCardBack: skipShowIdCardBack,
15163
15061
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
15164
15062
  disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
@@ -15619,9 +15517,8 @@
15619
15517
  * Render a fullscreen ID capture component that instructs the user to photograph both sides of their ID card, or full page of their passport.
15620
15518
  */
15621
15519
  var IdValidation = function IdValidation(_a) {
15622
- var _b, _c;
15623
- var _d = _a.lang,
15624
- lang = _d === void 0 ? 'auto' : _d,
15520
+ var _b = _a.lang,
15521
+ lang = _b === void 0 ? 'auto' : _b,
15625
15522
  sessionId = _a.sessionId,
15626
15523
  clientRequestID = _a.clientRequestID,
15627
15524
  submissionUrl = _a.submissionUrl,
@@ -15644,35 +15541,25 @@
15644
15541
  webhooksFireOnReview = _a.webhooksFireOnReview,
15645
15542
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
15646
15543
  precapturedDocuments = _a.precapturedDocuments,
15647
- _e = _a.loadingOverlayMode,
15648
- loadingOverlayMode = _e === void 0 ? 'default' : _e,
15649
- _f = _a.idCaptureRequirement,
15650
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
15651
- _g = _a.separateIdCardCaptureSequence,
15652
- separateIdCardCaptureSequence = _g === void 0 ? false : _g,
15653
- _h = _a.idAutoCaptureEnabled,
15654
- idAutoCaptureEnabled = _h === void 0 ? true : _h,
15655
- _j = _a.idCardAutoCaptureScoreThreshold,
15656
- idCardAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.idCard : _j,
15657
- _k = _a.passportAutoCaptureScoreThreshold,
15658
- passportAutoCaptureScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.passport : _k,
15659
- _l = _a.mrzDetectionScoreThreshold,
15660
- mrzDetectionScoreThreshold = _l === void 0 ? defaultDocumentDetectionThresholds.mrz : _l,
15661
- _m = _a.idCardFocusScoreThreshold,
15662
- idCardFocusScoreThreshold = _m === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _m,
15663
- _o = _a.passportFocusScoreThreshold,
15664
- passportFocusScoreThreshold = _o === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _o,
15665
- _p = _a.skipSuccessScreen,
15666
- skipSuccessScreen = _p === void 0 ? false : _p,
15544
+ _c = _a.loadingOverlayMode,
15545
+ loadingOverlayMode = _c === void 0 ? 'default' : _c,
15546
+ _d = _a.idCaptureRequirement,
15547
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
15548
+ _e = _a.separateIdCardCaptureSequence,
15549
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
15550
+ _f = _a.idCaptureThresholds,
15551
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
15552
+ _g = _a.skipSuccessScreen,
15553
+ skipSuccessScreen = _g === void 0 ? false : _g,
15667
15554
  instructions = _a.instructions,
15668
- _q = _a.guideType,
15669
- guideType = _q === void 0 ? 'fit' : _q,
15670
- _r = _a.portraitGuidesOnMobile,
15671
- portraitGuidesOnMobile = _r === void 0 ? false : _r,
15672
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
15673
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
15674
- _t = _a.modelLoadTimeoutMs,
15675
- modelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
15555
+ _h = _a.guideType,
15556
+ guideType = _h === void 0 ? 'fit' : _h,
15557
+ _j = _a.portraitGuidesOnMobile,
15558
+ portraitGuidesOnMobile = _j === void 0 ? false : _j,
15559
+ _k = _a.rotateLoadingOverlayImageWhenPortrait,
15560
+ rotateLoadingOverlayImageWhenPortrait = _k === void 0 ? true : _k,
15561
+ _l = _a.modelLoadTimeoutMs,
15562
+ modelLoadTimeoutMs = _l === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _l,
15676
15563
  onBeforeSubmit = _a.onBeforeSubmit,
15677
15564
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
15678
15565
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -15686,28 +15573,28 @@
15686
15573
  onUserCancel = _a.onUserCancel,
15687
15574
  onModelError = _a.onModelError,
15688
15575
  onCameraAccessDenied = _a.onCameraAccessDenied,
15689
- _u = _a.theme,
15690
- theme = _u === void 0 ? 'default' : _u,
15691
- _v = _a.assets,
15692
- assets = _v === void 0 ? {} : _v,
15693
- _w = _a.classNames,
15694
- classNames = _w === void 0 ? {} : _w,
15695
- _x = _a.colors,
15696
- colors = _x === void 0 ? {} : _x,
15697
- _y = _a.verbiage,
15698
- verbiage = _y === void 0 ? {} : _y,
15699
- _z = _a.captureSignature,
15700
- captureSignature = _z === void 0 ? false : _z,
15701
- _0 = _a.captureSignatureVideo,
15702
- captureSignatureVideo = _0 === void 0 ? false : _0,
15703
- _1 = _a.captureAdditionalDocuments,
15704
- captureAdditionalDocuments = _1 === void 0 ? [] : _1,
15705
- _2 = _a.geolocationEnabled,
15706
- geolocationEnabled = _2 === void 0 ? true : _2,
15707
- _3 = _a.geolocationRequired,
15708
- geolocationRequired = _3 === void 0 ? false : _3,
15709
- _4 = _a.debugMode,
15710
- debugMode = _4 === void 0 ? false : _4;
15576
+ _m = _a.theme,
15577
+ theme = _m === void 0 ? 'default' : _m,
15578
+ _o = _a.assets,
15579
+ assets = _o === void 0 ? {} : _o,
15580
+ _p = _a.classNames,
15581
+ classNames = _p === void 0 ? {} : _p,
15582
+ _q = _a.colors,
15583
+ colors = _q === void 0 ? {} : _q,
15584
+ _r = _a.verbiage,
15585
+ verbiage = _r === void 0 ? {} : _r,
15586
+ _s = _a.captureSignature,
15587
+ captureSignature = _s === void 0 ? false : _s,
15588
+ _t = _a.captureSignatureVideo,
15589
+ captureSignatureVideo = _t === void 0 ? false : _t,
15590
+ _u = _a.captureAdditionalDocuments,
15591
+ captureAdditionalDocuments = _u === void 0 ? [] : _u,
15592
+ _v = _a.geolocationEnabled,
15593
+ geolocationEnabled = _v === void 0 ? true : _v,
15594
+ _w = _a.geolocationRequired,
15595
+ geolocationRequired = _w === void 0 ? false : _w,
15596
+ _x = _a.debugMode,
15597
+ debugMode = _x === void 0 ? false : _x;
15711
15598
  useLanguage(lang);
15712
15599
  useDebugLogging(debugMode);
15713
15600
  var idCaptureProps = React.useMemo(function () {
@@ -15718,13 +15605,7 @@
15718
15605
  precapturedDocuments: precapturedDocuments,
15719
15606
  captureRequirement: idCaptureRequirement,
15720
15607
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
15721
- autoCaptureEnabled: idAutoCaptureEnabled,
15722
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
15723
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
15724
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
15725
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
15726
- passportFocusScoreThreshold: passportFocusScoreThreshold,
15727
- barcodeScanningEnabled: false,
15608
+ thresholds: idCaptureThresholds,
15728
15609
  skipSuccessScreen: skipSuccessScreen,
15729
15610
  loadingOverlayMode: loadingOverlayMode,
15730
15611
  instructions: instructions,
@@ -15738,7 +15619,7 @@
15738
15619
  verbiage: verbiage,
15739
15620
  debugMode: debugMode
15740
15621
  };
15741
- }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idAutoCaptureEnabled, idCardAutoCaptureScoreThreshold, passportAutoCaptureScoreThreshold, mrzDetectionScoreThreshold, idCardFocusScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
15622
+ }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
15742
15623
  var additionalDocumentCaptureProps = React.useMemo(function () {
15743
15624
  return {
15744
15625
  documents: captureAdditionalDocuments,
@@ -15932,9 +15813,8 @@
15932
15813
  * Render a fullscreen capture component that performs `IDValidation` and `FaceValidation` sequentially.
15933
15814
  * */
15934
15815
  var IdAndFaceValidation = function IdAndFaceValidation(_a) {
15935
- var _b, _c;
15936
- var _d = _a.lang,
15937
- lang = _d === void 0 ? 'auto' : _d,
15816
+ var _b = _a.lang,
15817
+ lang = _b === void 0 ? 'auto' : _b,
15938
15818
  sessionId = _a.sessionId,
15939
15819
  authUrl = _a.authUrl,
15940
15820
  submissionUrl = _a.submissionUrl,
@@ -15956,39 +15836,29 @@
15956
15836
  webhooksFireOnReview = _a.webhooksFireOnReview,
15957
15837
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
15958
15838
  precapturedDocuments = _a.precapturedDocuments,
15959
- _e = _a.idCaptureLoadingOverlayMode,
15960
- idCaptureLoadingOverlayMode = _e === void 0 ? 'default' : _e,
15961
- _f = _a.idCaptureRequirement,
15962
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
15963
- _g = _a.idAutoCaptureEnabled,
15964
- idAutoCaptureEnabled = _g === void 0 ? true : _g,
15965
- _h = _a.idCardAutoCaptureScoreThreshold,
15966
- idCardAutoCaptureScoreThreshold = _h === void 0 ? defaultDocumentDetectionThresholds.idCard : _h,
15967
- _j = _a.passportAutoCaptureScoreThreshold,
15968
- passportAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.passport : _j,
15969
- _k = _a.mrzDetectionScoreThreshold,
15970
- mrzDetectionScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.mrz : _k,
15971
- _l = _a.idCardFocusScoreThreshold,
15972
- idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
15973
- _m = _a.passportFocusScoreThreshold,
15974
- passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
15975
- _o = _a.faceLivenessLoadingOverlayMode,
15976
- faceLivenessLoadingOverlayMode = _o === void 0 ? 'default' : _o,
15977
- _p = _a.faceLivenessTimeoutDurationMs,
15978
- faceLivenessTimeoutDurationMs = _p === void 0 ? 15000 : _p,
15979
- _q = _a.skipSuccessScreen,
15980
- skipSuccessScreen = _q === void 0 ? false : _q,
15839
+ _c = _a.idCaptureLoadingOverlayMode,
15840
+ idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
15841
+ _d = _a.idCaptureRequirement,
15842
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
15843
+ _e = _a.idCaptureThresholds,
15844
+ idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
15845
+ _f = _a.faceLivenessLoadingOverlayMode,
15846
+ faceLivenessLoadingOverlayMode = _f === void 0 ? 'default' : _f,
15847
+ _g = _a.faceLivenessTimeoutDurationMs,
15848
+ faceLivenessTimeoutDurationMs = _g === void 0 ? 15000 : _g,
15849
+ _h = _a.skipSuccessScreen,
15850
+ skipSuccessScreen = _h === void 0 ? false : _h,
15981
15851
  idCaptureInstructions = _a.idCaptureInstructions,
15982
- _r = _a.idCaptureGuideType,
15983
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
15984
- _s = _a.idCapturePortraitGuidesOnMobile,
15985
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
15986
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
15987
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
15988
- _u = _a.idCaptureModelLoadTimeoutMs,
15989
- idCaptureModelLoadTimeoutMs = _u === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _u,
15990
- _v = _a.selfieCaptureModelLoadTimeoutMs,
15991
- selfieCaptureModelLoadTimeoutMs = _v === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _v,
15852
+ _j = _a.idCaptureGuideType,
15853
+ idCaptureGuideType = _j === void 0 ? 'fit' : _j,
15854
+ _k = _a.idCapturePortraitGuidesOnMobile,
15855
+ idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
15856
+ _l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
15857
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
15858
+ _m = _a.idCaptureModelLoadTimeoutMs,
15859
+ idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
15860
+ _o = _a.selfieCaptureModelLoadTimeoutMs,
15861
+ selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
15992
15862
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
15993
15863
  onDocumentUploaded = _a.onDocumentUploaded,
15994
15864
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -16005,28 +15875,28 @@
16005
15875
  onIdCaptureModelError = _a.onIdCaptureModelError,
16006
15876
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
16007
15877
  onCameraAccessDenied = _a.onCameraAccessDenied,
16008
- _w = _a.captureSignature,
16009
- captureSignature = _w === void 0 ? false : _w,
16010
- _x = _a.captureSignatureVideo,
16011
- captureSignatureVideo = _x === void 0 ? false : _x,
16012
- _y = _a.captureAdditionalDocuments,
16013
- captureAdditionalDocuments = _y === void 0 ? [] : _y,
16014
- _z = _a.theme,
16015
- theme = _z === void 0 ? 'default' : _z,
16016
- _0 = _a.assets,
16017
- assets = _0 === void 0 ? {} : _0,
16018
- _1 = _a.classNames,
16019
- classNames = _1 === void 0 ? {} : _1,
16020
- _2 = _a.colors,
16021
- colors = _2 === void 0 ? {} : _2,
16022
- _3 = _a.verbiage,
16023
- verbiage = _3 === void 0 ? {} : _3,
16024
- _4 = _a.geolocationEnabled,
16025
- geolocationEnabled = _4 === void 0 ? true : _4,
16026
- _5 = _a.geolocationRequired,
16027
- geolocationRequired = _5 === void 0 ? false : _5,
16028
- _6 = _a.debugMode,
16029
- debugMode = _6 === void 0 ? false : _6;
15878
+ _p = _a.captureSignature,
15879
+ captureSignature = _p === void 0 ? false : _p,
15880
+ _q = _a.captureSignatureVideo,
15881
+ captureSignatureVideo = _q === void 0 ? false : _q,
15882
+ _r = _a.captureAdditionalDocuments,
15883
+ captureAdditionalDocuments = _r === void 0 ? [] : _r,
15884
+ _s = _a.theme,
15885
+ theme = _s === void 0 ? 'default' : _s,
15886
+ _t = _a.assets,
15887
+ assets = _t === void 0 ? {} : _t,
15888
+ _u = _a.classNames,
15889
+ classNames = _u === void 0 ? {} : _u,
15890
+ _v = _a.colors,
15891
+ colors = _v === void 0 ? {} : _v,
15892
+ _w = _a.verbiage,
15893
+ verbiage = _w === void 0 ? {} : _w,
15894
+ _x = _a.geolocationEnabled,
15895
+ geolocationEnabled = _x === void 0 ? true : _x,
15896
+ _y = _a.geolocationRequired,
15897
+ geolocationRequired = _y === void 0 ? false : _y,
15898
+ _z = _a.debugMode,
15899
+ debugMode = _z === void 0 ? false : _z;
16030
15900
  useLanguage(lang);
16031
15901
  useDebugLogging(debugMode);
16032
15902
  var idCaptureProps = React.useMemo(function () {
@@ -16040,12 +15910,7 @@
16040
15910
  verbiage: verbiage.idCapture,
16041
15911
  precapturedDocuments: precapturedDocuments,
16042
15912
  captureRequirement: idCaptureRequirement,
16043
- autoCaptureEnabled: idAutoCaptureEnabled,
16044
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
16045
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
16046
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
16047
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
16048
- passportFocusScoreThreshold: passportFocusScoreThreshold,
15913
+ thresholds: idCaptureThresholds,
16049
15914
  loadingOverlayMode: idCaptureLoadingOverlayMode,
16050
15915
  instructions: idCaptureInstructions,
16051
15916
  guideType: idCaptureGuideType,
@@ -16055,7 +15920,7 @@
16055
15920
  skipSuccessScreen: skipSuccessScreen,
16056
15921
  debugMode: debugMode
16057
15922
  };
16058
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, debugMode, idAutoCaptureEnabled, idCaptureGuideType, idCaptureInstructions, idCaptureLoadingOverlayMode, idCaptureModelLoadTimeoutMs, idCapturePortraitGuidesOnMobile, idCaptureRequirement, idCaptureRotateLoadingOverlayImageWhenPortrait, idCardAutoCaptureScoreThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, onExitCapture, onIdCaptureModelError, onUserCancel, passportAutoCaptureScoreThreshold, passportFocusScoreThreshold, precapturedDocuments, skipSuccessScreen, verbiage.idCapture]);
15923
+ }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
16059
15924
  var faceLivenessProps = React.useMemo(function () {
16060
15925
  return {
16061
15926
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
@@ -16163,10 +16028,9 @@
16163
16028
  * Render a fullscreen capture component that performs IDValidation and FaceValidation sequentially, and then stores the results in IDmission's customer database using the supplied `enrollmentId` for later verification or 1:N matching.
16164
16029
  */
16165
16030
  var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollment(_a) {
16166
- var _b, _c;
16167
16031
  var enrollmentId = _a.enrollmentId,
16168
- _d = _a.lang,
16169
- lang = _d === void 0 ? 'auto' : _d,
16032
+ _b = _a.lang,
16033
+ lang = _b === void 0 ? 'auto' : _b,
16170
16034
  sessionId = _a.sessionId,
16171
16035
  authUrl = _a.authUrl,
16172
16036
  submissionUrl = _a.submissionUrl,
@@ -16190,39 +16054,29 @@
16190
16054
  webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
16191
16055
  webhooksFireOnReview = _a.webhooksFireOnReview,
16192
16056
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
16193
- _e = _a.idCaptureLoadingOverlayMode,
16194
- idCaptureLoadingOverlayMode = _e === void 0 ? 'default' : _e,
16195
- _f = _a.idCaptureRequirement,
16196
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
16197
- _g = _a.idAutoCaptureEnabled,
16198
- idAutoCaptureEnabled = _g === void 0 ? true : _g,
16199
- _h = _a.idCardAutoCaptureScoreThreshold,
16200
- idCardAutoCaptureScoreThreshold = _h === void 0 ? defaultDocumentDetectionThresholds.idCard : _h,
16201
- _j = _a.passportAutoCaptureScoreThreshold,
16202
- passportAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.passport : _j,
16203
- _k = _a.mrzDetectionScoreThreshold,
16204
- mrzDetectionScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.mrz : _k,
16205
- _l = _a.idCardFocusScoreThreshold,
16206
- idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
16207
- _m = _a.passportFocusScoreThreshold,
16208
- passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
16209
- _o = _a.faceLivenessTimeoutDurationMs,
16210
- faceLivenessTimeoutDurationMs = _o === void 0 ? 15000 : _o,
16211
- _p = _a.faceLivenessLoadingOverlayMode,
16212
- faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
16213
- _q = _a.skipSuccessScreen,
16214
- skipSuccessScreen = _q === void 0 ? false : _q,
16057
+ _c = _a.idCaptureLoadingOverlayMode,
16058
+ idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
16059
+ _d = _a.idCaptureRequirement,
16060
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
16061
+ _e = _a.idCaptureThresholds,
16062
+ idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
16063
+ _f = _a.faceLivenessTimeoutDurationMs,
16064
+ faceLivenessTimeoutDurationMs = _f === void 0 ? 15000 : _f,
16065
+ _g = _a.faceLivenessLoadingOverlayMode,
16066
+ faceLivenessLoadingOverlayMode = _g === void 0 ? 'default' : _g,
16067
+ _h = _a.skipSuccessScreen,
16068
+ skipSuccessScreen = _h === void 0 ? false : _h,
16215
16069
  idCaptureInstructions = _a.idCaptureInstructions,
16216
- _r = _a.idCaptureGuideType,
16217
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
16218
- _s = _a.idCapturePortraitGuidesOnMobile,
16219
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
16220
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
16221
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
16222
- _u = _a.idCaptureModelLoadTimeoutMs,
16223
- idCaptureModelLoadTimeoutMs = _u === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _u,
16224
- _v = _a.selfieCaptureModelLoadTimeoutMs,
16225
- selfieCaptureModelLoadTimeoutMs = _v === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _v,
16070
+ _j = _a.idCaptureGuideType,
16071
+ idCaptureGuideType = _j === void 0 ? 'fit' : _j,
16072
+ _k = _a.idCapturePortraitGuidesOnMobile,
16073
+ idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
16074
+ _l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
16075
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
16076
+ _m = _a.idCaptureModelLoadTimeoutMs,
16077
+ idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
16078
+ _o = _a.selfieCaptureModelLoadTimeoutMs,
16079
+ selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
16226
16080
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
16227
16081
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
16228
16082
  onDocumentUploaded = _a.onDocumentUploaded,
@@ -16238,28 +16092,28 @@
16238
16092
  onIdCaptureModelError = _a.onIdCaptureModelError,
16239
16093
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
16240
16094
  onCameraAccessDenied = _a.onCameraAccessDenied,
16241
- _w = _a.captureSignature,
16242
- captureSignature = _w === void 0 ? false : _w,
16243
- _x = _a.captureSignatureVideo,
16244
- captureSignatureVideo = _x === void 0 ? false : _x,
16245
- _y = _a.captureAdditionalDocuments,
16246
- captureAdditionalDocuments = _y === void 0 ? [] : _y,
16247
- _z = _a.theme,
16248
- theme = _z === void 0 ? 'default' : _z,
16249
- _0 = _a.assets,
16250
- assets = _0 === void 0 ? {} : _0,
16251
- _1 = _a.classNames,
16252
- classNames = _1 === void 0 ? {} : _1,
16253
- _2 = _a.colors,
16254
- colors = _2 === void 0 ? {} : _2,
16255
- _3 = _a.verbiage,
16256
- verbiage = _3 === void 0 ? {} : _3,
16257
- _4 = _a.geolocationEnabled,
16258
- geolocationEnabled = _4 === void 0 ? true : _4,
16259
- _5 = _a.geolocationRequired,
16260
- geolocationRequired = _5 === void 0 ? false : _5,
16261
- _6 = _a.debugMode,
16262
- debugMode = _6 === void 0 ? false : _6;
16095
+ _p = _a.captureSignature,
16096
+ captureSignature = _p === void 0 ? false : _p,
16097
+ _q = _a.captureSignatureVideo,
16098
+ captureSignatureVideo = _q === void 0 ? false : _q,
16099
+ _r = _a.captureAdditionalDocuments,
16100
+ captureAdditionalDocuments = _r === void 0 ? [] : _r,
16101
+ _s = _a.theme,
16102
+ theme = _s === void 0 ? 'default' : _s,
16103
+ _t = _a.assets,
16104
+ assets = _t === void 0 ? {} : _t,
16105
+ _u = _a.classNames,
16106
+ classNames = _u === void 0 ? {} : _u,
16107
+ _v = _a.colors,
16108
+ colors = _v === void 0 ? {} : _v,
16109
+ _w = _a.verbiage,
16110
+ verbiage = _w === void 0 ? {} : _w,
16111
+ _x = _a.geolocationEnabled,
16112
+ geolocationEnabled = _x === void 0 ? true : _x,
16113
+ _y = _a.geolocationRequired,
16114
+ geolocationRequired = _y === void 0 ? false : _y,
16115
+ _z = _a.debugMode,
16116
+ debugMode = _z === void 0 ? false : _z;
16263
16117
  useLanguage(lang);
16264
16118
  useDebugLogging(debugMode);
16265
16119
  var idCaptureProps = React.useMemo(function () {
@@ -16269,12 +16123,7 @@
16269
16123
  colors: colors.idCapture,
16270
16124
  verbiage: verbiage.idCapture,
16271
16125
  captureRequirement: idCaptureRequirement,
16272
- autoCaptureEnabled: idAutoCaptureEnabled,
16273
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
16274
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
16275
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
16276
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
16277
- passportFocusScoreThreshold: passportFocusScoreThreshold,
16126
+ thresholds: idCaptureThresholds,
16278
16127
  loadingOverlayMode: idCaptureLoadingOverlayMode,
16279
16128
  instructions: idCaptureInstructions,
16280
16129
  guideType: idCaptureGuideType,
@@ -16287,7 +16136,7 @@
16287
16136
  skipSuccessScreen: skipSuccessScreen,
16288
16137
  debugMode: debugMode
16289
16138
  };
16290
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, debugMode, idAutoCaptureEnabled, idCaptureGuideType, idCaptureInstructions, idCaptureLoadingOverlayMode, idCaptureModelLoadTimeoutMs, idCapturePortraitGuidesOnMobile, idCaptureRequirement, idCaptureRotateLoadingOverlayImageWhenPortrait, idCardAutoCaptureScoreThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, onExitCapture, onIdCaptureModelError, onUserCancel, passportAutoCaptureScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, verbiage.idCapture]);
16139
+ }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
16291
16140
  var faceLivenessProps = React.useMemo(function () {
16292
16141
  return {
16293
16142
  onExitCapture: onExitCapture,
@@ -17625,70 +17474,60 @@
17625
17474
  faceLivenessProps = _a.faceLivenessProps,
17626
17475
  _c = _a.idCaptureModelsEnabled,
17627
17476
  idCaptureModelsEnabled = _c === void 0 ? true : _c,
17628
- _d = _a.idCardFrontDetectionThreshold,
17629
- idCardFrontDetectionThreshold = _d === void 0 ? 0.6 : _d,
17630
- _e = _a.idCardFrontFocusThreshold,
17631
- idCardFrontFocusThreshold = _e === void 0 ? 0 : _e,
17632
- _f = _a.goodIdCardFrontFramesThreshold,
17633
- goodIdCardFrontFramesThreshold = _f === void 0 ? 1 : _f,
17634
- _g = _a.idCardBackDetectionThreshold,
17635
- idCardBackDetectionThreshold = _g === void 0 ? 0.6 : _g,
17636
- _h = _a.idCardBackFocusThreshold,
17637
- idCardBackFocusThreshold = _h === void 0 ? 0 : _h,
17638
- _j = _a.goodIdCardBackFramesThreshold,
17639
- goodIdCardBackFramesThreshold = _j === void 0 ? 1 : _j,
17477
+ _d = _a.videoIdCaptureThresholds,
17478
+ videoIdCaptureThresholds = _d === void 0 ? defaultVideoIdCaptureThresholds : _d,
17640
17479
  readTextPrompt = _a.readTextPrompt,
17641
- _k = _a.readTextTimeoutDurationMs,
17642
- readTextTimeoutDurationMs = _k === void 0 ? 15000 : _k,
17643
- _l = _a.readTextMinReadingMs,
17644
- readTextMinReadingMs = _l === void 0 ? 10000 : _l,
17645
- _m = _a.skipSuccessScreen,
17646
- skipSuccessScreen = _m === void 0 ? false : _m,
17647
- _o = _a.skipIdCapture,
17648
- skipIdCapture = _o === void 0 ? false : _o,
17649
- _p = _a.skipShowIdCardBack,
17650
- skipShowIdCardBack = _p === void 0 ? false : _p,
17651
- _q = _a.idCaptureLoadingOverlayMode,
17652
- idCaptureLoadingOverlayMode = _q === void 0 ? 'default' : _q,
17653
- _r = _a.idCaptureGuideType,
17654
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
17655
- _s = _a.idCapturePortraitGuidesOnMobile,
17656
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
17657
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
17658
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
17480
+ _e = _a.readTextTimeoutDurationMs,
17481
+ readTextTimeoutDurationMs = _e === void 0 ? 15000 : _e,
17482
+ _f = _a.readTextMinReadingMs,
17483
+ readTextMinReadingMs = _f === void 0 ? 10000 : _f,
17484
+ _g = _a.skipSuccessScreen,
17485
+ skipSuccessScreen = _g === void 0 ? false : _g,
17486
+ _h = _a.skipIdCapture,
17487
+ skipIdCapture = _h === void 0 ? false : _h,
17488
+ _j = _a.skipShowIdCardBack,
17489
+ skipShowIdCardBack = _j === void 0 ? false : _j,
17490
+ _k = _a.idCaptureLoadingOverlayMode,
17491
+ idCaptureLoadingOverlayMode = _k === void 0 ? 'default' : _k,
17492
+ _l = _a.idCaptureGuideType,
17493
+ idCaptureGuideType = _l === void 0 ? 'fit' : _l,
17494
+ _m = _a.idCapturePortraitGuidesOnMobile,
17495
+ idCapturePortraitGuidesOnMobile = _m === void 0 ? false : _m,
17496
+ _o = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
17497
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _o === void 0 ? true : _o,
17659
17498
  idCardForFaceMatch = _a.idCardForFaceMatch,
17660
- _u = _a.faceLivenessLoadingOverlayMode,
17661
- faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
17662
- _v = _a.disableFaceDetectionWhileAudioCapture,
17663
- disableFaceDetectionWhileAudioCapture = _v === void 0 ? false : _v,
17664
- _w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
17665
- disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
17666
- _x = _a.silentFallback,
17667
- silentFallback = _x === void 0 ? false : _x,
17668
- _y = _a.mergeAVStreams,
17669
- mergeAVStreams = _y === void 0 ? false : _y,
17670
- _z = _a.theme,
17671
- theme = _z === void 0 ? 'default' : _z,
17672
- _0 = _a.assets,
17673
- assets = _0 === void 0 ? {} : _0,
17674
- _1 = _a.classNames,
17675
- classNames = _1 === void 0 ? {} : _1,
17676
- _2 = _a.colors,
17677
- colors = _2 === void 0 ? {} : _2,
17678
- _3 = _a.verbiage,
17679
- verbiage = _3 === void 0 ? {} : _3,
17680
- _4 = _a.captureSignature,
17681
- captureSignature = _4 === void 0 ? false : _4,
17682
- _5 = _a.captureSignatureVideo,
17683
- captureSignatureVideo = _5 === void 0 ? false : _5,
17684
- _6 = _a.captureAdditionalDocuments,
17685
- captureAdditionalDocuments = _6 === void 0 ? [] : _6,
17686
- _7 = _a.geolocationEnabled,
17687
- geolocationEnabled = _7 === void 0 ? true : _7,
17688
- _8 = _a.geolocationRequired,
17689
- geolocationRequired = _8 === void 0 ? false : _8,
17690
- _9 = _a.debugMode,
17691
- debugMode = _9 === void 0 ? false : _9;
17499
+ _p = _a.faceLivenessLoadingOverlayMode,
17500
+ faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
17501
+ _q = _a.disableFaceDetectionWhileAudioCapture,
17502
+ disableFaceDetectionWhileAudioCapture = _q === void 0 ? false : _q,
17503
+ _r = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
17504
+ disableFaceDetectionWhileAudioCaptureMsDelay = _r === void 0 ? 2000 : _r,
17505
+ _s = _a.silentFallback,
17506
+ silentFallback = _s === void 0 ? false : _s,
17507
+ _t = _a.mergeAVStreams,
17508
+ mergeAVStreams = _t === void 0 ? false : _t,
17509
+ _u = _a.theme,
17510
+ theme = _u === void 0 ? 'default' : _u,
17511
+ _v = _a.assets,
17512
+ assets = _v === void 0 ? {} : _v,
17513
+ _w = _a.classNames,
17514
+ classNames = _w === void 0 ? {} : _w,
17515
+ _x = _a.colors,
17516
+ colors = _x === void 0 ? {} : _x,
17517
+ _y = _a.verbiage,
17518
+ verbiage = _y === void 0 ? {} : _y,
17519
+ _z = _a.captureSignature,
17520
+ captureSignature = _z === void 0 ? false : _z,
17521
+ _0 = _a.captureSignatureVideo,
17522
+ captureSignatureVideo = _0 === void 0 ? false : _0,
17523
+ _1 = _a.captureAdditionalDocuments,
17524
+ captureAdditionalDocuments = _1 === void 0 ? [] : _1,
17525
+ _2 = _a.geolocationEnabled,
17526
+ geolocationEnabled = _2 === void 0 ? true : _2,
17527
+ _3 = _a.geolocationRequired,
17528
+ geolocationRequired = _3 === void 0 ? false : _3,
17529
+ _4 = _a.debugMode,
17530
+ debugMode = _4 === void 0 ? false : _4;
17692
17531
  useLanguage(lang);
17693
17532
  useDebugLogging(debugMode);
17694
17533
  var videoIdCaptureProps = React.useMemo(function () {
@@ -17696,12 +17535,7 @@
17696
17535
  idCaptureProps: idCaptureProps,
17697
17536
  faceLivenessProps: faceLivenessProps,
17698
17537
  idCaptureModelsEnabled: idCaptureModelsEnabled,
17699
- idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
17700
- idCardFrontFocusThreshold: idCardFrontFocusThreshold,
17701
- goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
17702
- idCardBackDetectionThreshold: idCardBackDetectionThreshold,
17703
- idCardBackFocusThreshold: idCardBackFocusThreshold,
17704
- goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
17538
+ videoIdCaptureThresholds: videoIdCaptureThresholds,
17705
17539
  readTextPrompt: readTextPrompt,
17706
17540
  readTextTimeoutDurationMs: readTextTimeoutDurationMs,
17707
17541
  readTextMinReadingMs: readTextMinReadingMs,
@@ -17726,7 +17560,7 @@
17726
17560
  verbiage: verbiage,
17727
17561
  debugMode: debugMode
17728
17562
  };
17729
- }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
17563
+ }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
17730
17564
  var additionalDocumentCaptureProps = React.useMemo(function () {
17731
17565
  return {
17732
17566
  documents: captureAdditionalDocuments,