idmission-web-sdk 2.2.80 → 2.2.81

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.80';
206
+ var webSdkVersion = '2.2.81';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1646,28 +1646,41 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1646
1646
  }, [buildSubmissionPayload, defaultOnSubmit]);
1647
1647
  var buildLivenessCheckPayload = useCallback(function (imageDataUrl) {
1648
1648
  return __awaiter(void 0, void 0, void 0, function () {
1649
- var request, onBeforeLivenessCheckResult;
1650
- var _a, _b, _c;
1651
- return __generator(this, function (_d) {
1652
- switch (_d.label) {
1649
+ var selfie, request, onBeforeLivenessCheckResult;
1650
+ return __generator(this, function (_a) {
1651
+ switch (_a.label) {
1653
1652
  case 0:
1654
- _a = {
1653
+ selfie = imageDataUrl;
1654
+ if (!documentServiceUrl) return [3 /*break*/, 2];
1655
+ if (!selfie.startsWith('data:')) {
1656
+ selfie = "data:image/jpeg;base64,".concat(selfie);
1657
+ }
1658
+ return [4 /*yield*/, uploadDocument(selfie, {
1659
+ filename: 'liveness',
1660
+ filetype: 'image/jpeg'
1661
+ })];
1662
+ case 1:
1663
+ selfie = _a.sent();
1664
+ _a.label = 2;
1665
+ case 2:
1666
+ request = {
1655
1667
  securityData: {
1656
1668
  userName: '',
1657
1669
  password: '',
1658
1670
  merchantId: 0
1671
+ },
1672
+ customerData: {
1673
+ biometricData: {
1674
+ selfie: selfie
1675
+ }
1676
+ },
1677
+ additionalData: {
1678
+ uniqueRequestId: new Date().getTime().toString(),
1679
+ stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
1680
+ estimateAge: 'N',
1681
+ predictGender: 'N'
1659
1682
  }
1660
1683
  };
1661
- _b = {};
1662
- _c = {};
1663
- return [4 /*yield*/, dataUrlToBase64(imageDataUrl)];
1664
- case 1:
1665
- request = (_a.customerData = (_b.biometricData = (_c.selfie = _d.sent(), _c), _b), _a.additionalData = {
1666
- uniqueRequestId: new Date().getTime().toString(),
1667
- stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
1668
- estimateAge: 'N',
1669
- predictGender: 'N'
1670
- }, _a);
1671
1684
  if (clientRequestID) {
1672
1685
  request.additionalData.clientRequestID = clientRequestID;
1673
1686
  }
@@ -1686,19 +1699,19 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1686
1699
  idBackCaptureAttempts: idBackCaptureAttempts,
1687
1700
  geolocationResult: geolocationResult
1688
1701
  });
1689
- if (!onBeforeLivenessCheck.current) return [3 /*break*/, 3];
1702
+ if (!onBeforeLivenessCheck.current) return [3 /*break*/, 4];
1690
1703
  return [4 /*yield*/, onBeforeLivenessCheck.current(request)];
1691
- case 2:
1692
- onBeforeLivenessCheckResult = _d.sent();
1693
- if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
1694
- _d.label = 3;
1695
1704
  case 3:
1705
+ onBeforeLivenessCheckResult = _a.sent();
1706
+ if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
1707
+ _a.label = 4;
1708
+ case 4:
1696
1709
  setLivenessCheckRequest(request);
1697
1710
  return [2 /*return*/, request];
1698
1711
  }
1699
1712
  });
1700
1713
  });
1701
- }, [clientRequestID, geolocationResult, idBackCaptureAttempts, idCardForFaceMatch, idFrontCaptureAttempts, selfieCaptureAttempts, webhooksStripSpecialCharacters]);
1714
+ }, [clientRequestID, documentServiceUrl, geolocationResult, idBackCaptureAttempts, idCardForFaceMatch, idFrontCaptureAttempts, selfieCaptureAttempts, uploadDocument, webhooksStripSpecialCharacters]);
1702
1715
  var checkLiveness = useCallback(function (imageDataUrl) {
1703
1716
  return __awaiter(void 0, void 0, void 0, function () {
1704
1717
  var request, host, endpoint, response, statusMessage, submissionResponse_3, e_2, err;