veryfi-lens-wasm 2.0.8 → 2.0.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/veryfi-lens.js +26 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfi-lens-wasm",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Lens For Web SDK with WASM",
5
5
  "main": "veryfi-lens.js",
6
6
  "type": "module",
package/veryfi-lens.js CHANGED
@@ -1401,7 +1401,7 @@ const VeryfiLens = (function () {
1401
1401
  }
1402
1402
  break;
1403
1403
  case "checks":
1404
- captureChecks();
1404
+ await captureChecks();
1405
1405
  break;
1406
1406
  default:
1407
1407
  state.finalImage = await cropWasm();
@@ -1410,8 +1410,6 @@ const VeryfiLens = (function () {
1410
1410
  if (state.lensFlavor !== 'checks' && state.resultSetter && typeof state.resultSetter === 'function') {
1411
1411
  state.resultSetter(state.finalImage);
1412
1412
  state.updateHandler && state.updateHandler({ status: 'capture_completed' });
1413
- } else if (state.lensFlavor === 'checks' && state.resultSetter && typeof state.resultSetter === 'function') {
1414
- state.resultSetter = [state.frontImage, state.backImage];
1415
1413
  }
1416
1414
 
1417
1415
  stopLens();
@@ -1424,11 +1422,12 @@ const VeryfiLens = (function () {
1424
1422
  state.docReadyResult = await docReady();
1425
1423
  state.updateHandler && state.updateHandler({ status: 'processing_completed' });
1426
1424
  state.debug_mode && console.log("Document processed successfully");
1427
- }
1428
1425
 
1429
1426
  if (state.resultSetter && typeof state.resultSetter === 'function') {
1430
1427
  state.resultSetter({ ...state.docReadyResult, image: state.finalImage });
1431
1428
  }
1429
+ }
1430
+
1432
1431
 
1433
1432
  const isBlurry = checkIfBlurOnCapture();
1434
1433
 
@@ -1496,6 +1495,20 @@ const VeryfiLens = (function () {
1496
1495
  state.cropImgRef.showSuccessBorder();
1497
1496
  }
1498
1497
 
1498
+ // Process the front image with docReady
1499
+ state.updateHandler && state.updateHandler({ status: 'processing_started' });
1500
+ state.docReadyResult = await docReady();
1501
+ state.updateHandler && state.updateHandler({ status: 'processing_completed' });
1502
+ state.debug_mode && console.log("Front check image processed successfully");
1503
+
1504
+ // Update result setter with processed result
1505
+ if (state.resultSetter && typeof state.resultSetter === 'function') {
1506
+ state.resultSetter({
1507
+ ...state.docReadyResult,
1508
+ frontImage: state.frontImage
1509
+ });
1510
+ }
1511
+
1499
1512
  if (state.captureBackOfCheck) {
1500
1513
  const checkCaptureModal = createCheckCaptureModal(
1501
1514
  state.container,
@@ -1531,11 +1544,6 @@ const VeryfiLens = (function () {
1531
1544
  }, removeOverlay);
1532
1545
  state.enableSubmit && state.submitButton.show();
1533
1546
  }
1534
- if (state.resultSetter && typeof state.resultSetter === 'function') {
1535
- state.resultSetter({
1536
- frontImage: state.frontImage
1537
- });
1538
- }
1539
1547
  }
1540
1548
  );
1541
1549
  checkCaptureModal.show();
@@ -1564,6 +1572,12 @@ const VeryfiLens = (function () {
1564
1572
  return;
1565
1573
  }
1566
1574
 
1575
+ // Process the back image with docReady
1576
+ state.updateHandler && state.updateHandler({ status: 'processing_started' });
1577
+ state.docReadyResult = await docReady();
1578
+ state.updateHandler && state.updateHandler({ status: 'processing_completed' });
1579
+ state.debug_mode && console.log("Back check image processed successfully");
1580
+
1567
1581
  // Both checks passed, show success border
1568
1582
  if (state.cropImgRef && typeof state.cropImgRef.showSuccessBorder === 'function') {
1569
1583
  state.cropImgRef.showSuccessBorder();
@@ -1592,9 +1606,11 @@ const VeryfiLens = (function () {
1592
1606
  state.enableSubmit && state.submitButton.show();
1593
1607
  }
1594
1608
 
1595
- // Call success handler with properly structured data
1609
+ // Call success handler with properly structured data including docReady results
1596
1610
  if (state.resultSetter && typeof state.resultSetter === 'function') {
1611
+ state.debug_mode && console.log("Setting result setter");
1597
1612
  state.resultSetter({
1613
+ ...state.docReadyResult,
1598
1614
  frontImage: state.frontImage,
1599
1615
  backImage: state.backImage
1600
1616
  });