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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.80';
214
+ var webSdkVersion = '2.2.81';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2618,28 +2618,41 @@
2618
2618
  }, [buildSubmissionPayload, defaultOnSubmit]);
2619
2619
  var buildLivenessCheckPayload = React.useCallback(function (imageDataUrl) {
2620
2620
  return __awaiter(void 0, void 0, void 0, function () {
2621
- var request, onBeforeLivenessCheckResult;
2622
- var _a, _b, _c;
2623
- return __generator(this, function (_d) {
2624
- switch (_d.label) {
2621
+ var selfie, request, onBeforeLivenessCheckResult;
2622
+ return __generator(this, function (_a) {
2623
+ switch (_a.label) {
2625
2624
  case 0:
2626
- _a = {
2625
+ selfie = imageDataUrl;
2626
+ if (!documentServiceUrl) return [3 /*break*/, 2];
2627
+ if (!selfie.startsWith('data:')) {
2628
+ selfie = "data:image/jpeg;base64,".concat(selfie);
2629
+ }
2630
+ return [4 /*yield*/, uploadDocument(selfie, {
2631
+ filename: 'liveness',
2632
+ filetype: 'image/jpeg'
2633
+ })];
2634
+ case 1:
2635
+ selfie = _a.sent();
2636
+ _a.label = 2;
2637
+ case 2:
2638
+ request = {
2627
2639
  securityData: {
2628
2640
  userName: '',
2629
2641
  password: '',
2630
2642
  merchantId: 0
2643
+ },
2644
+ customerData: {
2645
+ biometricData: {
2646
+ selfie: selfie
2647
+ }
2648
+ },
2649
+ additionalData: {
2650
+ uniqueRequestId: new Date().getTime().toString(),
2651
+ stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
2652
+ estimateAge: 'N',
2653
+ predictGender: 'N'
2631
2654
  }
2632
2655
  };
2633
- _b = {};
2634
- _c = {};
2635
- return [4 /*yield*/, dataUrlToBase64(imageDataUrl)];
2636
- case 1:
2637
- request = (_a.customerData = (_b.biometricData = (_c.selfie = _d.sent(), _c), _b), _a.additionalData = {
2638
- uniqueRequestId: new Date().getTime().toString(),
2639
- stripSpecialCharacters: webhooksStripSpecialCharacters ? 'Y' : 'N',
2640
- estimateAge: 'N',
2641
- predictGender: 'N'
2642
- }, _a);
2643
2656
  if (clientRequestID) {
2644
2657
  request.additionalData.clientRequestID = clientRequestID;
2645
2658
  }
@@ -2658,19 +2671,19 @@
2658
2671
  idBackCaptureAttempts: idBackCaptureAttempts,
2659
2672
  geolocationResult: geolocationResult
2660
2673
  });
2661
- if (!onBeforeLivenessCheck.current) return [3 /*break*/, 3];
2674
+ if (!onBeforeLivenessCheck.current) return [3 /*break*/, 4];
2662
2675
  return [4 /*yield*/, onBeforeLivenessCheck.current(request)];
2663
- case 2:
2664
- onBeforeLivenessCheckResult = _d.sent();
2665
- if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
2666
- _d.label = 3;
2667
2676
  case 3:
2677
+ onBeforeLivenessCheckResult = _a.sent();
2678
+ if (onBeforeLivenessCheckResult) request = onBeforeLivenessCheckResult;
2679
+ _a.label = 4;
2680
+ case 4:
2668
2681
  setLivenessCheckRequest(request);
2669
2682
  return [2 /*return*/, request];
2670
2683
  }
2671
2684
  });
2672
2685
  });
2673
- }, [clientRequestID, geolocationResult, idBackCaptureAttempts, idCardForFaceMatch, idFrontCaptureAttempts, selfieCaptureAttempts, webhooksStripSpecialCharacters]);
2686
+ }, [clientRequestID, documentServiceUrl, geolocationResult, idBackCaptureAttempts, idCardForFaceMatch, idFrontCaptureAttempts, selfieCaptureAttempts, uploadDocument, webhooksStripSpecialCharacters]);
2674
2687
  var checkLiveness = React.useCallback(function (imageDataUrl) {
2675
2688
  return __awaiter(void 0, void 0, void 0, function () {
2676
2689
  var request, host, endpoint, response, statusMessage, submissionResponse_3, e_2, err;