veryfi-lens-wasm 2.0.13-beta.3 → 2.1.0

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.
@@ -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 ? 'scaleX(-1)' : 'scaleX(-1) scale(1.5)';
32
+ video.style.transform = isLandscape ? 'none' : '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 = 'scaleX(-1)';
41
+ video.style.transform = 'none';
42
42
  video.style.objectFit = 'cover';
43
43
  }
44
44
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfi-lens-wasm",
3
- "version": "2.0.13-beta.3",
3
+ "version": "2.1.0",
4
4
  "description": "Lens For Web SDK with WASM",
5
5
  "main": "veryfi-lens.js",
6
6
  "type": "module",
package/veryfi-lens.js CHANGED
@@ -1056,7 +1056,7 @@ const VeryfiLens = (function () {
1056
1056
  try {
1057
1057
  state.updateHandler && state.updateHandler({ status: 'validation_started' });
1058
1058
  const response = await fetch(
1059
- 'https://lens.veryfi.com/rest/validate_partner',
1059
+ "https://lens.veryfi.com/rest/validate_partner",
1060
1060
  {
1061
1061
  method: 'POST',
1062
1062
  headers: {
@@ -1123,6 +1123,7 @@ const VeryfiLens = (function () {
1123
1123
  headers: {
1124
1124
  "Content-Type": "application/json",
1125
1125
  "CLIENT-ID": state.clientId,
1126
+ "SESSION-ID": state.clientData.session
1126
1127
  },
1127
1128
  body: JSON.stringify(payload)
1128
1129
  }
@@ -1151,52 +1152,18 @@ const VeryfiLens = (function () {
1151
1152
  const spinner = createSpinner(document.body, 'Submitting document...');
1152
1153
  spinner.show();
1153
1154
  state.updateHandler && state.updateHandler({ status: 'submission_started' });
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
1155
 
1169
- const processDocumentUrl = `https://lens.veryfi.com/api/${calculatedUrl}`;
1156
+ const processDocumentUrl = "https://lens.veryfi.com/api/document";
1170
1157
  const deviceData = await getDeviceData();
1171
1158
 
1172
- // Determine document type based on current lens flavor
1173
- const computedDocType =
1174
- state.lensFlavor === 'checks' ? 'checks' :
1175
- state.lensFlavor === 'caps' ? 'caps' :
1176
- state.lensFlavor === 'code_strips' ? 'code_strips' :
1177
- 'documents';
1178
-
1179
- const isOcrFlavor = state.lensFlavor === 'caps' || state.lensFlavor === 'code_strips';
1180
- const ocr_type = state.lensFlavor === 'caps' ? 'pepsico_caps' : 'pepsico_codes';
1181
-
1182
- let requestBody;
1183
- if (isOcrFlavor) {
1184
- requestBody = {
1185
- "file_data": image,
1186
- "ocr_type": ocr_type,
1187
- "meta.device_data.uuid": state.uuidv4,
1188
- ...state.customData
1189
- };
1190
- } else {
1191
- requestBody = {
1192
- image: image,
1193
- doc_type: computedDocType,
1194
- resource: "api",
1195
- client_name: state.clientData.client_name,
1196
- device_data: deviceData,
1197
- ...state.customData
1198
- };
1199
- }
1159
+ const requestBody = {
1160
+ image: image,
1161
+ doc_type: state.lensFlavor === 'checks' ? 'checks' : 'documents',
1162
+ resource: "api",
1163
+ client_name: state.clientData.client_name,
1164
+ device_data: deviceData,
1165
+ ...state.customData
1166
+ };
1200
1167
 
1201
1168
  const requestOptions = {
1202
1169
  method: 'POST',
@@ -1998,8 +1965,8 @@ const VeryfiLens = (function () {
1998
1965
  }
1999
1966
  };
2000
1967
 
2001
- const getDeviceData = async () => {
2002
- // await generateDeviceIDifNeeded();
1968
+ const getDeviceData = async () => {
1969
+ // await generateDeviceIDifNeeded(); // Already called in init
2003
1970
  const browserData = await getBrowserData();
2004
1971
  const UAData = flattenObject(parseUA());
2005
1972
 
@@ -2070,7 +2037,7 @@ const VeryfiLens = (function () {
2070
2037
  FingerprintJS.defaultScriptUrlPattern
2071
2038
  ]
2072
2039
  });
2073
- const result = await fp.get({ timeout: 20000 }); // 10 second timeout
2040
+ const result = await fp.get({ timeout: 20000 });
2074
2041
  state.visitorId = result.visitorId;
2075
2042
  state.debug_mode && console.log("Basic fingerprint obtained:", state.visitorId);
2076
2043
  } catch (error) {