veryfi-lens-wasm 3.5.11 → 3.5.12
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/core/constants.js +1 -1
- package/core/lifecycle.js +4 -25
- package/core/overlay-controls.js +3 -1
- package/flavors/long_document.js +4 -0
- package/package.json +1 -1
package/core/constants.js
CHANGED
package/core/lifecycle.js
CHANGED
|
@@ -2,14 +2,8 @@ import { state, refs, resetState, actions } from './state.js';
|
|
|
2
2
|
import { getVideo, displayVideo, clearCameraPermissionDenied } from './camera.js';
|
|
3
3
|
import { initializeWasmWrapper, sendWasm, sendCardWasm, getLongImage, logDocument, stopWasm, resetAutoCaptureCounters, resetFieldDetectorBootstrap } from './wasm-processing.js';
|
|
4
4
|
import { hideVideoOverlay, showVideoOverlay } from './overlay-controls.js';
|
|
5
|
-
import { docReady, handleSubmit, fireResultSetter } from './api.js';
|
|
6
|
-
import { createSubmitButton } from '../components/submitButton.js';
|
|
7
5
|
import { createVideo } from '../components/video.js';
|
|
8
|
-
import {
|
|
9
|
-
cancelCropFieldDetection,
|
|
10
|
-
onCropPreviewReady,
|
|
11
|
-
holdSubmitForFieldDetectionIfNeeded,
|
|
12
|
-
} from './crop-field-detection.js';
|
|
6
|
+
import { cancelCropFieldDetection } from './crop-field-detection.js';
|
|
13
7
|
import { bootstrapTesseract, resetTesseractBootstrap, terminateTesseract } from './tesseract-ocr.js';
|
|
14
8
|
import { createLongPreview } from '../components/longPreview.js';
|
|
15
9
|
import { createCheckOverlay } from '../components/checkOverlay.js';
|
|
@@ -119,6 +113,7 @@ export const newStartLens = async () => {
|
|
|
119
113
|
state.isStitchingProcess = false;
|
|
120
114
|
state.doc_type = "long_receipt";
|
|
121
115
|
if (state.enableLongReceiptPreview) {
|
|
116
|
+
state.longPreview?.remove();
|
|
122
117
|
state.longPreview = createLongPreview(state.container);
|
|
123
118
|
}
|
|
124
119
|
break;
|
|
@@ -238,24 +233,8 @@ export const stopStitching = async () => {
|
|
|
238
233
|
}
|
|
239
234
|
hideVideoOverlay();
|
|
240
235
|
state.longPreview?.hide?.();
|
|
241
|
-
|
|
242
|
-
state.
|
|
243
|
-
await fireResultSetter({ ...state.docReadyResult, image: state.finalImage });
|
|
244
|
-
const partnerDriven =
|
|
245
|
-
state.packageMode && !state.enableSubmit && typeof state.customSubmitHandler !== 'function';
|
|
246
|
-
state.submitButton = createSubmitButton(
|
|
247
|
-
state.videoOverlay.overlay,
|
|
248
|
-
() => {
|
|
249
|
-
if (!partnerDriven) {
|
|
250
|
-
handleSubmit(state.finalImage);
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
() => actions.removeOverlay(),
|
|
254
|
-
{ buttonText: partnerDriven ? 'Done' : 'Submit' }
|
|
255
|
-
);
|
|
256
|
-
(state.enableSubmit || partnerDriven) && state.submitButton.show();
|
|
257
|
-
holdSubmitForFieldDetectionIfNeeded();
|
|
258
|
-
void onCropPreviewReady();
|
|
236
|
+
const { commitCaptureToReview } = await import('./review-flow.js');
|
|
237
|
+
await commitCaptureToReview({ kind: 'image', data: state.finalImage });
|
|
259
238
|
state.updateHandler?.({ status: 'stitching_completed' });
|
|
260
239
|
};
|
|
261
240
|
|
package/core/overlay-controls.js
CHANGED
|
@@ -39,7 +39,9 @@ export const showVideoOverlay = () => {
|
|
|
39
39
|
if (state.boxRef) state.boxRef.style.display = 'block';
|
|
40
40
|
if (state.frameRef) state.frameRef.style.display = 'block';
|
|
41
41
|
|
|
42
|
-
if (state.
|
|
42
|
+
if (state.stitchingButton) {
|
|
43
|
+
state.stitchingButton.show();
|
|
44
|
+
} else if (state.captureButton?.button) {
|
|
43
45
|
state.captureButton.button.style.display = 'block';
|
|
44
46
|
}
|
|
45
47
|
|
package/flavors/long_document.js
CHANGED
|
@@ -12,6 +12,10 @@ export const setup = async (state, refs, actions) => {
|
|
|
12
12
|
actions.checkIfDocumentOnCapture = checkIfDocumentOnCapture;
|
|
13
13
|
actions.startStitching = startStitching;
|
|
14
14
|
actions.stopStitching = stopStitching;
|
|
15
|
+
// A stitched long receipt is always a single page, but several of them can be
|
|
16
|
+
// captured in one session when the partner enables multiSubmission/maxDocuments.
|
|
17
|
+
state.maxPagesPerDocument = 1;
|
|
18
|
+
if (state.maxDocuments == null) state.maxDocuments = state.multiSubmission ? null : 1;
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
export const render = async (state, refs, actions) => {
|