idmission-web-sdk 2.3.64 → 2.3.65

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.65';
209
209
 
210
210
  function getPlatform() {
211
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -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) {