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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.3.64';
214
+ var webSdkVersion = '2.3.65';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9175,6 +9175,9 @@
9175
9175
  setModelLoadState('warming');
9176
9176
  setModelWarmingStartedAt(new Date().getTime());
9177
9177
  clearTimeout(modelLoadTimeout);
9178
+ return [4 /*yield*/, testDocumentDetectionAgainstKnownImage(model)];
9179
+ case 1:
9180
+ _b.sent();
9178
9181
  _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
9179
9182
  cancelled = false;
9180
9183
  cancelVideoReady = function cancelVideoReady() {
@@ -9182,7 +9185,7 @@
9182
9185
  cancel();
9183
9186
  };
9184
9187
  return [4 /*yield*/, videoReady];
9185
- case 1:
9188
+ case 2:
9186
9189
  _b.sent();
9187
9190
  setTimeout(function () {
9188
9191
  if (cancelled) return;
@@ -9421,6 +9424,26 @@
9421
9424
  return !!obj;
9422
9425
  });
9423
9426
  }
9427
+ function testDocumentDetectionAgainstKnownImage(detector) {
9428
+ return new Promise(function (resolve, reject) {
9429
+ var img = new Image();
9430
+ img.crossOrigin = 'anonymous';
9431
+ img.onload = function () {
9432
+ var prediction = detector.detectForVideo(img, performance.now());
9433
+ if (prediction.detections.length > 0) {
9434
+ debug('document detection test result', prediction.detections);
9435
+ resolve(void 0);
9436
+ } else {
9437
+ warn('document detection test failed');
9438
+ reject(new Error('testDocumentDetectionAgainstKnownImage failed to predict'));
9439
+ }
9440
+ };
9441
+ img.onerror = function () {
9442
+ return reject(new Error('testDocumentDetectionAgainstKnownImage failed to load image'));
9443
+ };
9444
+ img.src = "".concat(DEFAULT_CDN_URL, "/id-card-test.jpg");
9445
+ });
9446
+ }
9424
9447
 
9425
9448
  function useFrameLoop(fn, options) {
9426
9449
  if (options === void 0) {