veryfi-lens-wasm 3.1.0 → 3.1.2
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/api.js +26 -1
- package/core/capture/prescription_label.js +1 -1
- package/core/constants.js +1 -1
- package/package.json +1 -1
package/core/api.js
CHANGED
|
@@ -60,7 +60,19 @@ const buildJsonData = async () => {
|
|
|
60
60
|
const UAData = flattenObject(parseUA());
|
|
61
61
|
if ('os_name' in UAData) { UAData.device_platform = UAData.os_name; delete UAData.os_name; }
|
|
62
62
|
if ('os_version' in UAData) { UAData.system_ver = UAData.os_version; delete UAData.os_version; }
|
|
63
|
-
|
|
63
|
+
const meta = getMetaData();
|
|
64
|
+
// Legacy aliases for FastAPI deployments that still read the pre-rename
|
|
65
|
+
// field names (device_id, app_version, os_version, sdk, device_vendor).
|
|
66
|
+
// The current FastAPI uses uuid/app_ver/system_ver/sdk_version/device_platform;
|
|
67
|
+
// emitting both keeps the new SDK compatible with both server versions.
|
|
68
|
+
const legacyAliases = {
|
|
69
|
+
device_id: meta.uuid,
|
|
70
|
+
app_version: meta.app_ver,
|
|
71
|
+
os_version: UAData.system_ver,
|
|
72
|
+
sdk: meta.sdk_version,
|
|
73
|
+
device_vendor: UAData.device_platform,
|
|
74
|
+
};
|
|
75
|
+
return { ...browserData, ...UAData, ...meta, ...legacyAliases };
|
|
64
76
|
};
|
|
65
77
|
|
|
66
78
|
// Legacy per-crop flow: posts each captured scan to /rest/send-cropped, which
|
|
@@ -234,6 +246,19 @@ export const ensurePackageUploaded = async () => {
|
|
|
234
246
|
return state.docReadyResult;
|
|
235
247
|
};
|
|
236
248
|
|
|
249
|
+
// When packageMode is on and the SDK's submit button is disabled, the partner
|
|
250
|
+
// has no submit signal to trigger uploadPackage(). To still surface
|
|
251
|
+
// { bucket, package_path, file_name, package_id } to the partner via the
|
|
252
|
+
// showCamera setter, eagerly upload here and merge the result into the
|
|
253
|
+
// payload. Callers that know more captures are still expected (checks front
|
|
254
|
+
// when back is required, anydocs page captures before "Done") pass
|
|
255
|
+
// autoUpload: false so the upload is deferred to the actual last capture.
|
|
256
|
+
//
|
|
257
|
+
// Returns true when the call was the finalizing fire — the package was
|
|
258
|
+
// uploaded and the setter received { ...payload, ...packageInfo }. Callers
|
|
259
|
+
// use this to know when to tear down the overlay (since the SDK's submit
|
|
260
|
+
// button is hidden and there's no other teardown trigger). Returns false in
|
|
261
|
+
// all other cases (packageMode: false, enableSubmit: true, or autoUpload: false).
|
|
237
262
|
export const fireResultSetter = async (payload, { autoUpload = true } = {}) => {
|
|
238
263
|
if (typeof state.resultSetter !== 'function') return false;
|
|
239
264
|
if (autoUpload && state.packageMode && !state.enableSubmit) {
|
|
@@ -241,7 +241,7 @@ const startRecording = () => {
|
|
|
241
241
|
startCroppedDrawLoop(state.videoRef, region);
|
|
242
242
|
state.debug_mode && console.log(`[prescription_label] Cropping video to ${cropCanvas.width}x${cropCanvas.height} (source region ${Math.round(region.srcW)}x${Math.round(region.srcH)} at ${Math.round(region.srcX)},${Math.round(region.srcY)})`);
|
|
243
243
|
previewStream = cropCanvas.captureStream(30);
|
|
244
|
-
submissionStream = cropCanvas.captureStream(
|
|
244
|
+
submissionStream = cropCanvas.captureStream(2);
|
|
245
245
|
} catch (e) {
|
|
246
246
|
console.warn('[prescription_label] Failed to set up cropped recording stream, falling back to full video:', e);
|
|
247
247
|
stopCroppedDrawLoop();
|
package/core/constants.js
CHANGED