veryfi-lens-wasm 2.0.12 → 2.0.13-beta.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/components/video.js +2 -2
- package/package.json +1 -1
- package/veryfi-lens.js +43 -10
package/components/video.js
CHANGED
|
@@ -29,7 +29,7 @@ export const createVideo = (container) => {
|
|
|
29
29
|
video.style.maxWidth = 'none';
|
|
30
30
|
video.style.top = '0';
|
|
31
31
|
video.style.left = '0';
|
|
32
|
-
video.style.transform = isLandscape ? '
|
|
32
|
+
video.style.transform = isLandscape ? 'scaleX(-1)' : 'scaleX(-1) scale(1.5)';
|
|
33
33
|
video.style.objectFit = isLandscape ? 'cover' : 'cover';
|
|
34
34
|
} else {
|
|
35
35
|
video.style.position = 'absolute';
|
|
@@ -38,7 +38,7 @@ export const createVideo = (container) => {
|
|
|
38
38
|
video.style.maxWidth = '500px';
|
|
39
39
|
video.style.top = '';
|
|
40
40
|
video.style.left = '';
|
|
41
|
-
video.style.transform = '
|
|
41
|
+
video.style.transform = 'scaleX(-1)';
|
|
42
42
|
video.style.objectFit = 'cover';
|
|
43
43
|
}
|
|
44
44
|
} else {
|
package/package.json
CHANGED
package/veryfi-lens.js
CHANGED
|
@@ -1151,18 +1151,51 @@ const VeryfiLens = (function () {
|
|
|
1151
1151
|
const spinner = createSpinner(document.body, 'Submitting document...');
|
|
1152
1152
|
spinner.show();
|
|
1153
1153
|
state.updateHandler && state.updateHandler({ status: 'submission_started' });
|
|
1154
|
-
|
|
1155
|
-
|
|
1154
|
+
let calculatedUrl
|
|
1155
|
+
switch (state.lensFlavor) {
|
|
1156
|
+
case 'checks':
|
|
1157
|
+
calculatedUrl = "document"
|
|
1158
|
+
break;
|
|
1159
|
+
case 'caps':
|
|
1160
|
+
calculatedUrl = "ocr";
|
|
1161
|
+
break;
|
|
1162
|
+
case 'code_strips':
|
|
1163
|
+
calculatedUrl = "ocr";
|
|
1164
|
+
break;
|
|
1165
|
+
default:
|
|
1166
|
+
calculatedUrl = "document";
|
|
1167
|
+
}
|
|
1168
|
+
const processDocumentUrl = `https://lens.veryfi.com/api/${calculatedUrl}`;
|
|
1156
1169
|
const deviceData = await getDeviceData();
|
|
1157
1170
|
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1171
|
+
// Determine document type based on current lens flavor
|
|
1172
|
+
const computedDocType =
|
|
1173
|
+
state.lensFlavor === 'checks' ? 'checks' :
|
|
1174
|
+
state.lensFlavor === 'caps' ? 'caps' :
|
|
1175
|
+
state.lensFlavor === 'code_strips' ? 'code_strips' :
|
|
1176
|
+
'documents';
|
|
1177
|
+
|
|
1178
|
+
const isOcrFlavor = state.lensFlavor === 'caps' || state.lensFlavor === 'code_strips';
|
|
1179
|
+
const ocr_type = state.lensFlavor === 'caps' ? 'pesico_caps' : 'pepsico_codes';
|
|
1180
|
+
|
|
1181
|
+
let requestBody;
|
|
1182
|
+
if (isOcrFlavor) {
|
|
1183
|
+
requestBody = {
|
|
1184
|
+
"file_data": image,
|
|
1185
|
+
"ocr_type": ocr_type,
|
|
1186
|
+
"meta.device_data.uuid": state.uuidv4,
|
|
1187
|
+
...state.customData
|
|
1188
|
+
};
|
|
1189
|
+
} else {
|
|
1190
|
+
requestBody = {
|
|
1191
|
+
image: image,
|
|
1192
|
+
doc_type: computedDocType,
|
|
1193
|
+
resource: "api",
|
|
1194
|
+
client_name: state.clientData.client_name,
|
|
1195
|
+
device_data: deviceData,
|
|
1196
|
+
...state.customData
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1166
1199
|
|
|
1167
1200
|
const requestOptions = {
|
|
1168
1201
|
method: 'POST',
|