smartcomply-web-sdk 1.0.86 → 1.0.88

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 (31) hide show
  1. package/dist/camera/ActionDetector.d.ts +4 -0
  2. package/dist/camera/ActionDetector.d.ts.map +1 -1
  3. package/dist/camera/ActionDetector.js +6 -0
  4. package/dist/camera/ActionDetector.js.map +1 -1
  5. package/dist/client/Smartcomply.d.ts +1 -1
  6. package/dist/client/Smartcomply.js +1 -1
  7. package/dist/esm/camera/ActionDetector.d.ts +4 -0
  8. package/dist/esm/camera/ActionDetector.d.ts.map +1 -1
  9. package/dist/esm/camera/ActionDetector.js +6 -0
  10. package/dist/esm/camera/ActionDetector.js.map +1 -1
  11. package/dist/esm/client/Smartcomply.d.ts +1 -1
  12. package/dist/esm/client/Smartcomply.js +1 -1
  13. package/dist/esm/flow/DocumentCapture.d.ts +5 -7
  14. package/dist/esm/flow/DocumentCapture.d.ts.map +1 -1
  15. package/dist/esm/flow/DocumentCapture.js +26 -33
  16. package/dist/esm/flow/DocumentCapture.js.map +1 -1
  17. package/dist/esm/modules/liveness/liveness.d.ts +4 -1
  18. package/dist/esm/modules/liveness/liveness.d.ts.map +1 -1
  19. package/dist/esm/modules/liveness/liveness.js +10 -2
  20. package/dist/esm/modules/liveness/liveness.js.map +1 -1
  21. package/dist/flow/DocumentCapture.d.ts +5 -7
  22. package/dist/flow/DocumentCapture.d.ts.map +1 -1
  23. package/dist/flow/DocumentCapture.js +26 -33
  24. package/dist/flow/DocumentCapture.js.map +1 -1
  25. package/dist/modules/liveness/liveness.d.ts +4 -1
  26. package/dist/modules/liveness/liveness.d.ts.map +1 -1
  27. package/dist/modules/liveness/liveness.js +10 -2
  28. package/dist/modules/liveness/liveness.js.map +1 -1
  29. package/dist/smartcomply.browser.js +23 -24
  30. package/dist/smartcomply.browser.js.map +2 -2
  31. package/package.json +1 -1
@@ -4660,6 +4660,12 @@ var SmartComplySDK = (() => {
4660
4660
  }
4661
4661
  return this.buildProgress(true);
4662
4662
  }
4663
+ /** Snapshot of what's been detected so far — for reading the result after
4664
+ * the scan loop has already ended (e.g. to report alongside the submit
4665
+ * payload), without needing another detection frame. */
4666
+ getProgress() {
4667
+ return this.buildProgress(true);
4668
+ }
4663
4669
  buildProgress(faceDetected) {
4664
4670
  return {
4665
4671
  faceDetected,
@@ -5317,7 +5323,7 @@ var SmartComplySDK = (() => {
5317
5323
  *
5318
5324
  * Pass onProgress for 0–1 upload-fraction callbacks (via LivenessUploader).
5319
5325
  */
5320
- async submit(entryId, videoBlob, snapshotBlob, autoshotBlob, videoDurationSeconds, videoSizeBytes, onProgress) {
5326
+ async submit(entryId, videoBlob, snapshotBlob, autoshotBlob, videoDurationSeconds, videoSizeBytes, onProgress, clientScanProgress) {
5321
5327
  const formData = new FormData();
5322
5328
  formData.append("entry", String(entryId));
5323
5329
  formData.append("video", videoBlob, "liveness.webm");
@@ -5331,6 +5337,10 @@ var SmartComplySDK = (() => {
5331
5337
  if (videoSizeBytes !== void 0) {
5332
5338
  formData.append("video_size_bytes", String(videoSizeBytes));
5333
5339
  }
5340
+ if (clientScanProgress) {
5341
+ formData.append("client_blink_detected", String(clientScanProgress.blinkDetected));
5342
+ formData.append("client_motion_detected", String(clientScanProgress.motionDetected));
5343
+ }
5334
5344
  if (onProgress) {
5335
5345
  const uploader = new LivenessUploader(this.http);
5336
5346
  return uploader.upload(
@@ -5594,7 +5604,8 @@ var SmartComplySDK = (() => {
5594
5604
  (fraction) => {
5595
5605
  const pct = Math.round(fraction * 100);
5596
5606
  ui2.updateInstruction(pct < 100 ? `Uploading... ${pct}%` : "Verifying...");
5597
- }
5607
+ },
5608
+ actionDetector.getProgress()
5598
5609
  );
5599
5610
  await ui2.showResult(
5600
5611
  submitResult.status === "failed" ? "failed" : "processing",
@@ -5780,7 +5791,7 @@ var SmartComplySDK = (() => {
5780
5791
  * CDN tag they installed with (e.g. @1, which floats to the latest
5781
5792
  * matching release) actually resolved to the version they expect.
5782
5793
  */
5783
- _SmartComply.VERSION = "1.0.86";
5794
+ _SmartComply.VERSION = "1.0.88";
5784
5795
  var SmartComply = _SmartComply;
5785
5796
 
5786
5797
  // src/flow/theme.ts
@@ -6821,7 +6832,7 @@ var SmartComplySDK = (() => {
6821
6832
  URL.revokeObjectURL(currentUrl);
6822
6833
  currentUrl = URL.createObjectURL(rotated);
6823
6834
  img.src = currentUrl;
6824
- this._checkPhotoQuality(currentBlob, qualityNotice, theme, useBtn);
6835
+ this._checkPhotoQuality(currentBlob, qualityNotice);
6825
6836
  } catch {
6826
6837
  } finally {
6827
6838
  isRotating = false;
@@ -6868,7 +6879,7 @@ var SmartComplySDK = (() => {
6868
6879
  btnRow.appendChild(retakeBtn);
6869
6880
  btnRow.appendChild(useBtn);
6870
6881
  this.root.appendChild(btnRow);
6871
- this._checkPhotoQuality(currentBlob, qualityNotice, theme, useBtn);
6882
+ this._checkPhotoQuality(currentBlob, qualityNotice);
6872
6883
  }
6873
6884
  /**
6874
6885
  * Runs the shared client-side quality heuristics — blur/glare/contrast/
@@ -6888,15 +6899,13 @@ var SmartComplySDK = (() => {
6888
6899
  * question, matching the same border-edge + interior-variance heuristic
6889
6900
  * the camera loop already uses.
6890
6901
  *
6891
- * A framing failure disables useBtn — unlike the blur/glare nudge, this
6892
- * one blocks: a cropped ID reads as a confident, wrong identity downstream
6893
- * (partial OCR fields, a registry check against a truncated ID number)
6894
- * with no further chance to catch it, so the user must retake/re-upload
6895
- * rather than being trusted to notice an advisory nudge and act on it
6896
- * voluntarily. Fails open on decode error — this heuristic not running at
6897
- * all must not lock the user out of a photo it never actually scored.
6902
+ * A framing failure shows the same nudge as blur/glare, but no longer
6903
+ * disables useBtn — see the comment above qualityNotice's creation in
6904
+ * showPreview for why. Fails open on decode error — this heuristic not
6905
+ * running at all must not lock the user out of a photo it never actually
6906
+ * scored.
6898
6907
  */
6899
- async _checkPhotoQuality(imageData, noticeEl, theme, useBtn) {
6908
+ async _checkPhotoQuality(imageData, noticeEl) {
6900
6909
  try {
6901
6910
  const canvas = await this._blobToCanvas(imageData, 640);
6902
6911
  const ctx = canvas.getContext("2d");
@@ -6906,20 +6915,10 @@ var SmartComplySDK = (() => {
6906
6915
  if (!framing.isFramed) {
6907
6916
  if (noticeEl.isConnected) {
6908
6917
  noticeEl.style.display = "block";
6909
- noticeEl.textContent = framing.interiorVariance < 0.25 ? "We couldn't detect a document in this photo — make sure the ID is clearly visible and try again." : "Part of the document looks cut off — make sure all four corners are visible and try again.";
6910
- }
6911
- if (useBtn.isConnected) {
6912
- useBtn.disabled = true;
6913
- useBtn.style.opacity = "0.5";
6914
- useBtn.style.cursor = "not-allowed";
6918
+ noticeEl.textContent = framing.interiorVariance < 0.25 ? "We couldn't detect a document in this photo — if the ID isn't clearly visible, consider retaking it." : "Part of the document may be cut off — if any corners are missing, consider retaking it.";
6915
6919
  }
6916
6920
  return;
6917
6921
  }
6918
- if (useBtn.isConnected) {
6919
- useBtn.disabled = false;
6920
- useBtn.style.opacity = "1";
6921
- useBtn.style.cursor = "pointer";
6922
- }
6923
6922
  const result = assessQuality(pixels);
6924
6923
  if (noticeEl.isConnected && !result.isValid) {
6925
6924
  noticeEl.style.display = "block";