idmission-web-sdk 2.3.64 → 2.3.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk2.esm.js CHANGED
@@ -205,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
205
205
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
206
206
  };
207
207
 
208
- var webSdkVersion = '2.3.64';
208
+ var webSdkVersion = '2.3.66';
209
209
 
210
210
  function getPlatform() {
211
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2447,7 +2447,7 @@ function average(arr) {
2447
2447
 
2448
2448
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2449
2449
 
2450
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250111_090328.tflite");
2450
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250815_115859.tflite");
2451
2451
 
2452
2452
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2453
2453
 
@@ -3271,6 +3271,9 @@ function useLoadDocumentDetector(_a) {
3271
3271
  setModelLoadState('warming');
3272
3272
  setModelWarmingStartedAt(new Date().getTime());
3273
3273
  clearTimeout(modelLoadTimeout);
3274
+ return [4 /*yield*/, testDocumentDetectionAgainstKnownImage(model)];
3275
+ case 1:
3276
+ _b.sent();
3274
3277
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
3275
3278
  cancelled = false;
3276
3279
  cancelVideoReady = function cancelVideoReady() {
@@ -3278,7 +3281,7 @@ function useLoadDocumentDetector(_a) {
3278
3281
  cancel();
3279
3282
  };
3280
3283
  return [4 /*yield*/, videoReady];
3281
- case 1:
3284
+ case 2:
3282
3285
  _b.sent();
3283
3286
  setTimeout(function () {
3284
3287
  if (cancelled) return;
@@ -3517,6 +3520,26 @@ function applyNonMaxSuppression(detectedObjects, isGoodBox) {
3517
3520
  return !!obj;
3518
3521
  });
3519
3522
  }
3523
+ function testDocumentDetectionAgainstKnownImage(detector) {
3524
+ return new Promise(function (resolve, reject) {
3525
+ var img = new Image();
3526
+ img.crossOrigin = 'anonymous';
3527
+ img.onload = function () {
3528
+ var prediction = detector.detectForVideo(img, performance.now());
3529
+ if (prediction.detections.length > 0) {
3530
+ debug('document detection test result', prediction.detections);
3531
+ resolve(void 0);
3532
+ } else {
3533
+ warn('document detection test failed');
3534
+ reject(new Error('testDocumentDetectionAgainstKnownImage failed to predict'));
3535
+ }
3536
+ };
3537
+ img.onerror = function () {
3538
+ return reject(new Error('testDocumentDetectionAgainstKnownImage failed to load image'));
3539
+ };
3540
+ img.src = "".concat(DEFAULT_CDN_URL, "/id-card-test.jpg");
3541
+ });
3542
+ }
3520
3543
 
3521
3544
  function useFrameLoop(fn, options) {
3522
3545
  if (options === void 0) {
@@ -15614,7 +15637,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
15614
15637
  verbiage = _7 === void 0 ? {} : _7,
15615
15638
  _8 = _a.debugMode,
15616
15639
  debugMode = _8 === void 0 ? false : _8;
15617
- var _9 = useContext(SubmissionContext),
15640
+ var _9 = useSubmissionContext(),
15618
15641
  passportImage = _9.passportImage,
15619
15642
  submissionStatus = _9.submissionStatus,
15620
15643
  idCaptureVideoUrl = _9.idCaptureVideoUrl,