idmission-web-sdk 2.3.63 → 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.63';
208
+ var webSdkVersion = '2.3.65';
209
209
 
210
210
  function getPlatform() {
211
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2232,7 +2232,6 @@ function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quali
2232
2232
  xMin = _b.xMin,
2233
2233
  width = _b.width;
2234
2234
  var desiredWidth = frame.height * 0.6;
2235
- alert("this side! ".concat(desiredWidth, "x").concat(frame.height));
2236
2235
  var faceCenterX = xMin + width / 2;
2237
2236
  var xPos = Math.max(0, faceCenterX - desiredWidth / 2);
2238
2237
  cropCanvas.width = desiredWidth;
@@ -3272,6 +3271,9 @@ function useLoadDocumentDetector(_a) {
3272
3271
  setModelLoadState('warming');
3273
3272
  setModelWarmingStartedAt(new Date().getTime());
3274
3273
  clearTimeout(modelLoadTimeout);
3274
+ return [4 /*yield*/, testDocumentDetectionAgainstKnownImage(model)];
3275
+ case 1:
3276
+ _b.sent();
3275
3277
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
3276
3278
  cancelled = false;
3277
3279
  cancelVideoReady = function cancelVideoReady() {
@@ -3279,7 +3281,7 @@ function useLoadDocumentDetector(_a) {
3279
3281
  cancel();
3280
3282
  };
3281
3283
  return [4 /*yield*/, videoReady];
3282
- case 1:
3284
+ case 2:
3283
3285
  _b.sent();
3284
3286
  setTimeout(function () {
3285
3287
  if (cancelled) return;
@@ -3518,6 +3520,26 @@ function applyNonMaxSuppression(detectedObjects, isGoodBox) {
3518
3520
  return !!obj;
3519
3521
  });
3520
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
+ }
3521
3543
 
3522
3544
  function useFrameLoop(fn, options) {
3523
3545
  if (options === void 0) {