idmission-web-sdk 2.2.157 → 2.2.159

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/dist/sdk2.esm.js CHANGED
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.157';
206
+ var webSdkVersion = '2.2.159';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1177,83 +1177,85 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1177
1177
  _y = _a.estimateAge,
1178
1178
  estimateAge = _y === void 0 ? false : _y,
1179
1179
  _z = _a.predictGender,
1180
- predictGender = _z === void 0 ? false : _z;
1180
+ predictGender = _z === void 0 ? false : _z,
1181
+ _0 = _a.throwErrorsOnFailure,
1182
+ throwErrorsOnFailure = _0 === void 0 ? !userSuppliedOnRequestFailure : _0;
1181
1183
  var sessionId = useAuthContext()[0].sessionId;
1182
- var _0 = useState(SubmissionStatus.READY),
1183
- submissionStatus = _0[0],
1184
- setSubmissionStatus = _0[1];
1185
- var _1 = useState(null),
1186
- submissionRequest = _1[0],
1187
- setSubmissionRequest = _1[1];
1184
+ var _1 = useState(SubmissionStatus.READY),
1185
+ submissionStatus = _1[0],
1186
+ setSubmissionStatus = _1[1];
1188
1187
  var _2 = useState(null),
1189
- submissionResponse = _2[0],
1190
- setSubmissionResponse = _2[1];
1188
+ submissionRequest = _2[0],
1189
+ setSubmissionRequest = _2[1];
1191
1190
  var _3 = useState(null),
1192
- submissionError = _3[0],
1193
- setSubmissionError = _3[1];
1191
+ submissionResponse = _3[0],
1192
+ setSubmissionResponse = _3[1];
1194
1193
  var _4 = useState(null),
1195
- retrySubmission = _4[0],
1196
- setRetrySubmission = _4[1];
1194
+ submissionError = _4[0],
1195
+ setSubmissionError = _4[1];
1197
1196
  var _5 = useState(null),
1198
- livenessCheckRequest = _5[0],
1199
- setLivenessCheckRequest = _5[1];
1197
+ retrySubmission = _5[0],
1198
+ setRetrySubmission = _5[1];
1200
1199
  var _6 = useState(null),
1201
- idFrontImage = _6[0],
1202
- setIdFrontImage = _6[1];
1200
+ livenessCheckRequest = _6[0],
1201
+ setLivenessCheckRequest = _6[1];
1203
1202
  var _7 = useState(null),
1204
- idBackImage = _7[0],
1205
- setIdBackImage = _7[1];
1203
+ idFrontImage = _7[0],
1204
+ setIdFrontImage = _7[1];
1206
1205
  var _8 = useState(null),
1207
- passportImage = _8[0],
1208
- setPassportImage = _8[1];
1206
+ idBackImage = _8[0],
1207
+ setIdBackImage = _8[1];
1209
1208
  var _9 = useState(null),
1210
- selfieImage = _9[0],
1211
- setSelfieImage = _9[1];
1209
+ passportImage = _9[0],
1210
+ setPassportImage = _9[1];
1212
1211
  var _10 = useState(null),
1213
- signatureData = _10[0],
1214
- setSignatureData = _10[1];
1212
+ selfieImage = _10[0],
1213
+ setSelfieImage = _10[1];
1215
1214
  var _11 = useState(null),
1216
- signatureVideoUrl = _11[0],
1217
- setSignatureVideoUrl = _11[1];
1215
+ signatureData = _11[0],
1216
+ setSignatureData = _11[1];
1218
1217
  var _12 = useState(null),
1219
- idCaptureVideoUrl = _12[0],
1220
- setIdCaptureVideoUrl = _12[1];
1218
+ signatureVideoUrl = _12[0],
1219
+ setSignatureVideoUrl = _12[1];
1221
1220
  var _13 = useState(null),
1222
- idCaptureVideoIdFrontImage = _13[0],
1223
- setIdCaptureVideoIdFrontImage = _13[1];
1221
+ idCaptureVideoUrl = _13[0],
1222
+ setIdCaptureVideoUrl = _13[1];
1224
1223
  var _14 = useState(null),
1225
- idCaptureVideoIdBackImage = _14[0],
1226
- setIdCaptureVideoIdBackImage = _14[1];
1224
+ idCaptureVideoIdFrontImage = _14[0],
1225
+ setIdCaptureVideoIdFrontImage = _14[1];
1227
1226
  var _15 = useState(null),
1228
- idCaptureVideoAudioUrl = _15[0],
1229
- setIdCaptureVideoAudioUrl = _15[1];
1227
+ idCaptureVideoIdBackImage = _15[0],
1228
+ setIdCaptureVideoIdBackImage = _15[1];
1230
1229
  var _16 = useState(null),
1231
- idCaptureVideoAudioStartsAt = _16[0],
1232
- setIdCaptureVideoAudioStartsAt = _16[1];
1230
+ idCaptureVideoAudioUrl = _16[0],
1231
+ setIdCaptureVideoAudioUrl = _16[1];
1233
1232
  var _17 = useState(null),
1234
- expectedAudioText = _17[0],
1235
- setExpectedAudioText = _17[1];
1233
+ idCaptureVideoAudioStartsAt = _17[0],
1234
+ setIdCaptureVideoAudioStartsAt = _17[1];
1236
1235
  var _18 = useState(null),
1237
- additionalDocuments = _18[0],
1238
- setAdditionalDocuments = _18[1];
1236
+ expectedAudioText = _18[0],
1237
+ setExpectedAudioText = _18[1];
1239
1238
  var _19 = useState(null),
1240
- geolocationResult = _19[0],
1241
- setGeolocationResult = _19[1];
1242
- var _20 = useState(0),
1243
- geolocationAttempts = _20[0],
1244
- setGeolocationAttempts = _20[1];
1245
- var _21 = useState(false),
1246
- geolocationBlocked = _21[0],
1247
- setGeolocationBlocked = _21[1];
1248
- var _22 = useState([]),
1249
- idFrontCaptureAttempts = _22[0],
1250
- setIdFrontCaptureAttempts = _22[1];
1239
+ additionalDocuments = _19[0],
1240
+ setAdditionalDocuments = _19[1];
1241
+ var _20 = useState(null),
1242
+ geolocationResult = _20[0],
1243
+ setGeolocationResult = _20[1];
1244
+ var _21 = useState(0),
1245
+ geolocationAttempts = _21[0],
1246
+ setGeolocationAttempts = _21[1];
1247
+ var _22 = useState(false),
1248
+ geolocationBlocked = _22[0],
1249
+ setGeolocationBlocked = _22[1];
1251
1250
  var _23 = useState([]),
1252
- idBackCaptureAttempts = _23[0],
1253
- setIdBackCaptureAttempts = _23[1];
1251
+ idFrontCaptureAttempts = _23[0],
1252
+ setIdFrontCaptureAttempts = _23[1];
1254
1253
  var _24 = useState([]),
1255
- selfieCaptureAttempts = _24[0],
1256
- setSelfieCaptureAttempts = _24[1];
1254
+ idBackCaptureAttempts = _24[0],
1255
+ setIdBackCaptureAttempts = _24[1];
1256
+ var _25 = useState([]),
1257
+ selfieCaptureAttempts = _25[0],
1258
+ setSelfieCaptureAttempts = _25[1];
1257
1259
  var logIdFrontCaptureAttempt = useCallback(function (attempt) {
1258
1260
  setIdFrontCaptureAttempts(function (attempts) {
1259
1261
  return __spreadArray(__spreadArray([], attempts, true), [attempt], false);
@@ -1339,11 +1341,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1339
1341
  onDocumentUploadProgress: onDocumentUploadProgress.current,
1340
1342
  onDocumentUploaded: onDocumentUploaded.current,
1341
1343
  onDocumentUploadFailed: onDocumentUploadFailed.current
1344
+ })["catch"](function (e) {
1345
+ if (!throwErrorsOnFailure) throw e;
1346
+ return '';
1342
1347
  })];
1343
1348
  }
1344
1349
  });
1345
1350
  });
1346
- }, [documentServiceUrl, jobId, sessionId, taskId]);
1351
+ }, [documentServiceUrl, jobId, sessionId, taskId, throwErrorsOnFailure]);
1347
1352
  var buildSubmissionPayload = useCallback(function () {
1348
1353
  return __awaiter(void 0, void 0, void 0, function () {
1349
1354
  function uploadIfPossible(src_1, filename_1) {
@@ -1479,10 +1484,6 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1479
1484
  submissionRequest.customerData.idData.idImageFront = documents.passportImage;
1480
1485
  }
1481
1486
  if (documents.selfieImage) {
1482
- // if (action === SubmissionAction.IDENTIFY) {
1483
- // // TODO: remove once API is fixed
1484
- // submissionRequest.biometricData = { selfie: documents.selfieImage }
1485
- // }
1486
1487
  submissionRequest.customerData.biometricData = {
1487
1488
  selfie: documents.selfieImage
1488
1489
  };
@@ -1630,13 +1631,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1630
1631
  } : defaultOnSubmit;
1631
1632
  });
1632
1633
  (_c = onRequestFailure.current) === null || _c === void 0 ? void 0 : _c.call(onRequestFailure, err);
1633
- throw err;
1634
+ if (throwErrorsOnFailure) throw err;
1635
+ return [3 /*break*/, 8];
1634
1636
  case 8:
1635
1637
  return [2 /*return*/];
1636
1638
  }
1637
1639
  });
1638
1640
  });
1639
- }, [action, buildSubmissionPayload, submissionUrl, environment, idFrontImage, idBackImage, passportImage, selfieImage, sessionId, sendBase64DocumentsInSwaggerProxy]);
1641
+ }, [action, buildSubmissionPayload, submissionUrl, environment, idFrontImage, idBackImage, passportImage, selfieImage, sessionId, sendBase64DocumentsInSwaggerProxy, throwErrorsOnFailure]);
1640
1642
  var submit = useCallback(function () {
1641
1643
  return __awaiter(void 0, void 0, void 0, function () {
1642
1644
  var _a, _b;
@@ -1784,13 +1786,14 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1784
1786
  };
1785
1787
  });
1786
1788
  (_a = onRequestFailure.current) === null || _a === void 0 ? void 0 : _a.call(onRequestFailure, err);
1787
- throw err;
1789
+ if (throwErrorsOnFailure) throw err;
1790
+ return [3 /*break*/, 7];
1788
1791
  case 7:
1789
1792
  return [2 /*return*/];
1790
1793
  }
1791
1794
  });
1792
1795
  });
1793
- }, [buildLivenessCheckPayload, submissionUrl, environment, idCardForFaceMatch, sessionId, sendBase64DocumentsInSwaggerProxy]);
1796
+ }, [buildLivenessCheckPayload, submissionUrl, environment, idCardForFaceMatch, sessionId, sendBase64DocumentsInSwaggerProxy, throwErrorsOnFailure]);
1794
1797
  var retryLocationAccess = useCallback(function () {
1795
1798
  setGeolocationAttempts(function (n) {
1796
1799
  return n + 1;