idmission-web-sdk 2.3.78 → 2.3.79

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
@@ -205,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
205
205
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
206
206
  };
207
207
 
208
- var webSdkVersion = '2.3.78';
208
+ var webSdkVersion = '2.3.79';
209
209
 
210
210
  function getPlatform() {
211
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2854,7 +2854,29 @@ function processFaceDetectorPrediction(_a) {
2854
2854
  _c = _a.stabilityThreshold,
2855
2855
  stabilityThreshold = _c === void 0 ? 0.7 : _c,
2856
2856
  _d = _a.noseDistanceThreshold,
2857
- noseDistanceThreshold = _d === void 0 ? 0.025 : _d;
2857
+ noseDistanceThreshold = _d === void 0 ? 0.025 : _d,
2858
+ _e = _a.xBoundary,
2859
+ xBoundary = _e === void 0 ? 0.01 : _e,
2860
+ // this represents the edge that the sides of the face box should not cross -- 1% of video width
2861
+ _f = _a.yBoundary,
2862
+ // this represents the edge that the sides of the face box should not cross -- 1% of video width
2863
+ yBoundary = _f === void 0 ? 0.01 : _f,
2864
+ // this represents the edge that the top or bottom of the face box should not cross -- 1% of video height
2865
+ _g = _a.xCentroidBoundary,
2866
+ // this represents the edge that the top or bottom of the face box should not cross -- 1% of video height
2867
+ xCentroidBoundary = _g === void 0 ? 0.125 : _g,
2868
+ // this represents the edge that the centroid of the face should not cross -- 12.5% of video width
2869
+ _h = _a.yCentroidBoundary,
2870
+ // this represents the edge that the centroid of the face should not cross -- 12.5% of video width
2871
+ yCentroidBoundary = _h === void 0 ? 0.125 : _h,
2872
+ // this represents the edge that the centroid of the face should not cross -- 12.5% of video height
2873
+ _j = _a.foreheadRatio,
2874
+ // this represents the edge that the centroid of the face should not cross -- 12.5% of video height
2875
+ foreheadRatio = _j === void 0 ? 0.275 : _j,
2876
+ // we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
2877
+ _k = _a.noseTrackingThreshold,
2878
+ // we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
2879
+ noseTrackingThreshold = _k === void 0 ? 0.2 : _k;
2858
2880
  var face = faces[0];
2859
2881
  var faceNotDetected = faces.length === 0;
2860
2882
  var faceNotCentered = false,
@@ -2862,28 +2884,37 @@ function processFaceDetectorPrediction(_a) {
2862
2884
  faceTooClose = false,
2863
2885
  faceTooFar = false;
2864
2886
  if (face) {
2865
- // calculate centroids
2866
- var vCX = videoWidth / 2;
2867
- var vCY = videoHeight / 2;
2868
- var fCX = (face.box.xMin + face.box.xMax) / 2;
2869
- var fCY = (face.box.yMin + face.box.yMax) / 2;
2887
+ // calculate frame centroids
2888
+ var frameCX = videoWidth / 2;
2889
+ var frameCY = videoHeight / 2;
2890
+ // calculate head bounding box, with forehead extension
2891
+ var foreheadSize = face.box.height * foreheadRatio;
2892
+ var headXMin = face.box.xMin;
2893
+ var headXMax = face.box.xMax;
2894
+ var headYMin = face.box.yMin - foreheadSize;
2895
+ var headYMax = face.box.yMax;
2896
+ // calculate head centroids
2897
+ var headCX = (headXMin + headXMax) / 2;
2898
+ var headCY = (headYMin + headYMax) / 2;
2870
2899
  // calculate thresholds
2871
- var vTX = videoWidth * 0.125;
2872
- var vTY = videoHeight * 0.125;
2873
- var fTW = face.box.width * 0.2;
2874
- var fTH = face.box.height * 0.2;
2875
- var nose = face.keypoints[2]; //.find((k) => k.name === 'noseTip')
2876
- if (nose) {
2877
- faceLookingAway = Math.abs(fCX - nose.x) > fTW || Math.abs(fCY - nose.y) > fTH;
2878
- var faceNotCenteredHorizontally = Math.abs(vCX - fCX) > vTX;
2879
- var faceNotCenteredVertically = Math.abs(vCY + 50 - fCY) > vTY;
2880
- faceNotCentered = faceNotCenteredHorizontally || requireVerticalFaceCentering && faceNotCenteredVertically;
2881
- }
2900
+ var vTX = videoWidth * xBoundary;
2901
+ var vTY = videoHeight * yBoundary;
2902
+ var vCTX = videoWidth * xCentroidBoundary;
2903
+ var vCTY = videoHeight * yCentroidBoundary;
2904
+ var faceNotCenteredHorizontally = Math.abs(frameCX - headCX) > vCTX;
2905
+ var faceNotCenteredVertically = Math.abs(frameCY - headCY) > vCTY;
2906
+ var faceViolatesHorizontalBoundary = headXMin < vTX || headXMax > videoWidth - vTX;
2907
+ var faceViolatesVerticalBoundary = headYMin < vTY || headYMax > videoHeight - vTY;
2908
+ faceNotCentered = faceViolatesHorizontalBoundary || faceViolatesVerticalBoundary || faceNotCenteredHorizontally || requireVerticalFaceCentering && faceNotCenteredVertically;
2882
2909
  var isMobile = videoWidth < videoHeight;
2883
2910
  var tooCloseMultiple = 1.5;
2884
2911
  var tooFarMultiple = isMobile ? 6 : 7;
2885
2912
  faceTooClose = face.box.width > videoWidth / tooCloseMultiple;
2886
2913
  faceTooFar = face.box.width < videoWidth / tooFarMultiple;
2914
+ var nose = face.keypoints[2];
2915
+ var fTW = face.box.width * noseTrackingThreshold;
2916
+ var fTH = face.box.height * noseTrackingThreshold;
2917
+ faceLookingAway = !nose || Math.abs(headCX - nose.x) > fTW || Math.abs(headCY - nose.y) > fTH;
2887
2918
  }
2888
2919
  var faceInGuides = !faceNotDetected && !faceNotCentered && !faceLookingAway && !faceTooClose && !faceTooFar;
2889
2920
  if (lastFaceDetectionTime > 0) {
@@ -10695,7 +10726,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
10695
10726
  });
10696
10727
  }
10697
10728
  });
10698
- }, [onPredictionMade, resetBestFrame]);
10729
+ }, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
10699
10730
  useEffect(function () {
10700
10731
  if (state.captureState === 'complete') stop();
10701
10732
  }, [state.captureState, stop]);
@@ -14083,12 +14114,10 @@ function VideoSignatureGuides(_a) {
14083
14114
  }, /*#__PURE__*/React__default.createElement(Inner$1, {
14084
14115
  className: classNames.inner
14085
14116
  }, /*#__PURE__*/React__default.createElement(FaceGuideContainer$1, {
14117
+ className: classNames.faceGuideContainer,
14086
14118
  style: {
14087
- opacity: mode === 'both' || mode === 'face' ? 1 : 0,
14088
- transitionDelay: '2s',
14089
- transition: 'opacity 500ms ease-in-out'
14090
- },
14091
- className: classNames.faceGuideContainer
14119
+ opacity: mode === 'both' || mode === 'face' ? 1 : 0
14120
+ }
14092
14121
  }, /*#__PURE__*/React__default.createElement(StyledSelfieCaptureAnimatedMask, {
14093
14122
  className: classNames.faceGuide,
14094
14123
  status: requestedAction === 'VERIFY_LIVENESS' ? faceGuideStatus : 'success',
@@ -14096,12 +14125,10 @@ function VideoSignatureGuides(_a) {
14096
14125
  borderColor: faceGuideBorderColor,
14097
14126
  verticalAlign: "bottom"
14098
14127
  })), /*#__PURE__*/React__default.createElement(SignaturePadContainer, {
14128
+ className: classNames.signaturePadContainer,
14099
14129
  style: {
14100
- opacity: mode === 'both' || mode === 'signature' ? 1 : 0,
14101
- transitionDelay: '2s',
14102
- transition: 'opacity 500ms ease-in-out'
14103
- },
14104
- className: classNames.signaturePadContainer
14130
+ opacity: mode === 'both' || mode === 'signature' ? 1 : 0
14131
+ }
14105
14132
  }, /*#__PURE__*/React__default.createElement(VideoSignaturePad, {
14106
14133
  onAcceptBtnClicked: onAcceptBtnClicked,
14107
14134
  onClearBtnClicked: onClearBtnClicked,
@@ -14117,9 +14144,9 @@ var Container$3 = styled.div(templateObject_1$a || (templateObject_1$a = __makeT
14117
14144
  return (_a = props.theme) === null || _a === void 0 ? void 0 : _a.fontFamily;
14118
14145
  });
14119
14146
  var Inner$1 = styled.div(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"], ["\n width: 100%;\n height: 100%;\n max-height: 1280px;\n display: flex;\n margin: auto;\n align-items: center;\n flex-direction: column;\n"])));
14120
- var FaceGuideContainer$1 = styled.div(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n position: relative;\n height: 50%;\n"], ["\n position: relative;\n height: 50%;\n"])));
14147
+ var FaceGuideContainer$1 = styled.div(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n position: relative;\n height: 50%;\n transition: opacity 500ms ease-in-out;\n transition-delay: 2s;\n"], ["\n position: relative;\n height: 50%;\n transition: opacity 500ms ease-in-out;\n transition-delay: 2s;\n"])));
14121
14148
  var StyledSelfieCaptureAnimatedMask = styled(SelfieCaptureAnimatedMaskWithStatus)(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["\n max-width: 100%;\n height: 100%;\n"], ["\n max-width: 100%;\n height: 100%;\n"])));
14122
- var SignaturePadContainer = styled.div(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"], ["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n"])));
14149
+ var SignaturePadContainer = styled.div(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n transition: opacity 500ms ease-in-out;\n transition-delay: 2s;\n"], ["\n position: relative;\n max-width: 100%;\n height: 50%;\n aspect-ratio: 2;\n transition: opacity 500ms ease-in-out;\n transition-delay: 2s;\n"])));
14123
14150
  var templateObject_1$a, templateObject_2$9, templateObject_3$8, templateObject_4$4, templateObject_5$3;
14124
14151
 
14125
14152
  var DEFAULT_MIN_SIGNATURE_PAD_POINTS = 10;
@@ -14688,7 +14715,7 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
14688
14715
  component: guidesComponent,
14689
14716
  showFaceGuideThenSignaturePad: showFaceGuideThenSignaturePad
14690
14717
  }));
14691
- }, [captureAudio, classNames === null || classNames === void 0 ? void 0 : classNames.guides, guidesComponent, restartVideoOnSignaturePadCleared, verbiage === null || verbiage === void 0 ? void 0 : verbiage.guides]);
14718
+ }, [captureAudio, classNames === null || classNames === void 0 ? void 0 : classNames.guides, guidesComponent, restartVideoOnSignaturePadCleared, showFaceGuideThenSignaturePad, verbiage === null || verbiage === void 0 ? void 0 : verbiage.guides]);
14692
14719
  var onExitAfterFailureProp = faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onExitAfterFailure;
14693
14720
  var onExitAfterFailure = useCallback(function (resp, req) {
14694
14721
  onExitAfterFailureProp === null || onExitAfterFailureProp === void 0 ? void 0 : onExitAfterFailureProp(resp, req);