idmission-web-sdk 2.1.7 → 2.1.8

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
@@ -8,13 +8,13 @@ import { useTranslation, initReactI18next } from 'react-i18next';
8
8
  import { Upload } from 'tus-js-client';
9
9
  import useResizeObserver from 'use-resize-observer';
10
10
  import { ImageSegmenter, FilesetResolver, ImageClassifier, FaceDetector, ObjectDetector } from '@mediapipe/tasks-vision';
11
- import { useDebouncedCallback } from 'use-debounce';
11
+ import { useDebouncedCallback, useThrottledCallback } from 'use-debounce';
12
12
  import { createPortal } from 'react-dom';
13
13
  import LanguageDetector from 'i18next-browser-languagedetector';
14
14
  import i18n from 'i18next';
15
15
  import SignatureCanvas from 'react-signature-canvas';
16
16
 
17
- var webSdkVersion = '2.1.7';
17
+ var webSdkVersion = '2.1.8';
18
18
 
19
19
  function getPlatform() {
20
20
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2243,39 +2243,15 @@ function preloadVisionRuntime() {
2243
2243
  });
2244
2244
  }
2245
2245
 
2246
- function _isNavigatorDefined() {
2247
- return typeof navigator !== 'undefined' && navigator != null;
2248
- }
2249
- function isMobile(nav) {
2250
- if (nav || _isNavigatorDefined()) {
2251
- if (!nav) {
2252
- nav = navigator;
2253
- }
2254
- if (nav.product === 'ReactNative') {
2255
- return true;
2256
- }
2257
- var a = nav.userAgent || nav.vendor || (
2258
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2259
- // @ts-ignore
2260
- typeof window !== 'undefined' ? window.opera : '');
2261
- if (!a) {
2262
- var navAny = nav;
2263
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2264
- // @ts-ignore
2265
- return navAny.userAgentData && navAny.userAgentData.mobile;
2266
- }
2267
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
2268
- // tslint:disable-next-line:max-line-length
2269
- /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
2246
+ function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
2247
+ if (quality === void 0) {
2248
+ quality = 0.92;
2270
2249
  }
2271
- return false;
2272
- }
2273
-
2274
- function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
2275
- if (!rawCanvas || !cropCanvas) return '';
2250
+ if (!rawCanvas || !cropCanvas || !resizeCanvas) return '';
2276
2251
  var rawCtx = rawCanvas.getContext('2d');
2277
2252
  var cropCtx = cropCanvas.getContext('2d');
2278
- if (!rawCtx || !cropCtx) throw new Error('could not get 2d context');
2253
+ var resizeCtx = resizeCanvas.getContext('2d');
2254
+ if (!rawCtx || !cropCtx || !resizeCtx) throw new Error('could not get 2d context');
2279
2255
  rawCanvas.width = frame.width;
2280
2256
  rawCanvas.height = frame.height;
2281
2257
  rawCtx.putImageData(frame, 0, 0);
@@ -2285,7 +2261,7 @@ function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
2285
2261
  var frameHeight = frame.height;
2286
2262
  var xPadding = frameHeight * 0.6 - width;
2287
2263
  var xPos = Math.max(0, xMin - xPadding / 2);
2288
- if (isMobile()) {
2264
+ if (frame.height > frame.width) {
2289
2265
  cropCanvas.width = frame.width;
2290
2266
  cropCanvas.height = frame.height;
2291
2267
  cropCtx.drawImage(rawCanvas, 0, 0, cropCanvas.width, cropCanvas.height);
@@ -2294,9 +2270,14 @@ function cropToShoulders(rawCanvas, cropCanvas, frame, face) {
2294
2270
  cropCanvas.height = frame.height;
2295
2271
  cropCtx.drawImage(rawCanvas, xPos, 0, cropCanvas.width, cropCanvas.height, 0, 0, cropCanvas.width, cropCanvas.height);
2296
2272
  }
2297
- var dataURL = cropCanvas.toDataURL('image/jpeg', 0.92);
2273
+ resizeCanvas.height = maxHeight !== null && maxHeight !== void 0 ? maxHeight : cropCanvas.height;
2274
+ resizeCanvas.width = cropCanvas.width * (resizeCanvas.height / cropCanvas.height);
2275
+ resizeCtx === null || resizeCtx === void 0 ? void 0 : resizeCtx.drawImage(cropCanvas, 0, 0, resizeCanvas.width, resizeCanvas.height);
2276
+ var dataURL = resizeCanvas.toDataURL('image/jpeg', quality);
2277
+ log('cropToShoulders size', new TextEncoder().encode(dataURL).length);
2298
2278
  clearCanvas(rawCanvas);
2299
2279
  clearCanvas(cropCanvas);
2280
+ clearCanvas(resizeCanvas);
2300
2281
  return dataURL;
2301
2282
  }
2302
2283
  function cropToDetectedObjectBox(frame, box, canvas) {
@@ -3629,6 +3610,34 @@ function FocusModelProvider(_a) {
3629
3610
  }), children);
3630
3611
  }
3631
3612
 
3613
+ function _isNavigatorDefined() {
3614
+ return typeof navigator !== 'undefined' && navigator != null;
3615
+ }
3616
+ function isMobile(nav) {
3617
+ if (nav || _isNavigatorDefined()) {
3618
+ if (!nav) {
3619
+ nav = navigator;
3620
+ }
3621
+ if (nav.product === 'ReactNative') {
3622
+ return true;
3623
+ }
3624
+ var a = nav.userAgent || nav.vendor || (
3625
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3626
+ // @ts-ignore
3627
+ typeof window !== 'undefined' ? window.opera : '');
3628
+ if (!a) {
3629
+ var navAny = nav;
3630
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3631
+ // @ts-ignore
3632
+ return navAny.userAgentData && navAny.userAgentData.mobile;
3633
+ }
3634
+ return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
3635
+ // tslint:disable-next-line:max-line-length
3636
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
3637
+ }
3638
+ return false;
3639
+ }
3640
+
3632
3641
  var onMobile = isMobile();
3633
3642
  var defaultIdCaptureThresholds = {
3634
3643
  detection: defaultDocumentDetectionThresholds,
@@ -7908,9 +7917,6 @@ var templateObject_1$j, templateObject_2$d, templateObject_3$c, templateObject_4
7908
7917
  var initialState$3 = {
7909
7918
  videoWidth: 0,
7910
7919
  videoHeight: 0,
7911
- capturing: false,
7912
- captured: false,
7913
- captureFailed: false,
7914
7920
  frame: null,
7915
7921
  faces: [],
7916
7922
  faceNotCentered: false,
@@ -7918,36 +7924,12 @@ var initialState$3 = {
7918
7924
  faceTooClose: false,
7919
7925
  faceTooFar: false,
7920
7926
  faceReady: false,
7921
- faceReadyAt: null,
7922
- goodFramesCount: 0,
7923
- goodFramesThreshold: 1,
7924
- goodFramesThresholdMet: false
7927
+ faceReadyAt: null
7925
7928
  };
7926
7929
  var reducer$3 = function reducer(state, action) {
7927
7930
  switch (action.type) {
7928
7931
  case 'configure':
7929
- return __assign(__assign({}, state), {
7930
- videoWidth: action.payload.videoWidth,
7931
- videoHeight: action.payload.videoHeight
7932
- });
7933
- case 'capturing':
7934
- return __assign(__assign({}, state), {
7935
- capturing: true,
7936
- captured: false,
7937
- captureFailed: false
7938
- });
7939
- case 'captured':
7940
- return __assign(__assign({}, state), {
7941
- capturing: false,
7942
- captured: true,
7943
- captureFailed: false
7944
- });
7945
- case 'captureFailed':
7946
- return __assign(__assign({}, state), {
7947
- capturing: false,
7948
- captured: false,
7949
- captureFailed: true
7950
- });
7932
+ return __assign(__assign({}, state), action.payload);
7951
7933
  case 'facesDetected':
7952
7934
  {
7953
7935
  var faces = action.payload.faces;
@@ -7956,8 +7938,7 @@ var reducer$3 = function reducer(state, action) {
7956
7938
  faceLookingAway = false,
7957
7939
  faceTooClose = false,
7958
7940
  faceTooFar = false,
7959
- faceReadyAt = state.faceReadyAt,
7960
- goodFramesCount = state.goodFramesCount;
7941
+ faceReadyAt = state.faceReadyAt;
7961
7942
  if (face) {
7962
7943
  // calculate centroids
7963
7944
  var vCX = state.videoWidth / 2;
@@ -7983,7 +7964,6 @@ var reducer$3 = function reducer(state, action) {
7983
7964
  var faceReady = !faceNotCentered && !faceLookingAway && !faceTooClose && !faceTooFar;
7984
7965
  if (!faceReady) {
7985
7966
  faceReadyAt = null;
7986
- goodFramesCount = 0;
7987
7967
  } else if (!state.faceReady) {
7988
7968
  faceReadyAt = new Date();
7989
7969
  }
@@ -7994,8 +7974,7 @@ var reducer$3 = function reducer(state, action) {
7994
7974
  faceTooClose: faceTooClose,
7995
7975
  faceTooFar: faceTooFar,
7996
7976
  faceReady: faceReady,
7997
- faceReadyAt: faceReadyAt,
7998
- goodFramesCount: goodFramesCount
7977
+ faceReadyAt: faceReadyAt
7999
7978
  });
8000
7979
  }
8001
7980
  }
@@ -8047,16 +8026,14 @@ var SelfieCapture = function SelfieCapture(_a) {
8047
8026
  });
8048
8027
  }
8049
8028
  }, [cameraReady, videoRef]);
8050
- useEffect(function () {
8051
- onPredictionMade(function (prediction) {
8052
- dispatch({
8053
- type: 'facesDetected',
8054
- payload: {
8055
- faces: prediction
8056
- }
8057
- });
8029
+ onPredictionMade(useThrottledCallback(function (prediction) {
8030
+ dispatch({
8031
+ type: 'facesDetected',
8032
+ payload: {
8033
+ faces: prediction
8034
+ }
8058
8035
  });
8059
- }, [onPredictionMade]);
8036
+ }, 16));
8060
8037
  var _p = useState(false),
8061
8038
  captureReady = _p[0],
8062
8039
  setCaptureReady = _p[1];
@@ -8075,22 +8052,14 @@ var SelfieCapture = function SelfieCapture(_a) {
8075
8052
  };
8076
8053
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, state.faceReady]);
8077
8054
  useEffect(function () {
8078
- (function () {
8079
- return __awaiter(void 0, void 0, void 0, function () {
8080
- var ctx, imageData;
8081
- return __generator(this, function (_a) {
8082
- if (captureReady && videoRef.current && lastPredictionCanvas.current && state.faces.length > 0) {
8083
- drawToCanvas(lastPredictionCanvas.current, videoRef.current);
8084
- ctx = lastPredictionCanvas.current.getContext('2d');
8085
- if (!ctx) return [2 /*return*/];
8086
- imageData = ctx.getImageData(0, 0, videoRef.current.videoWidth, videoRef.current.videoHeight);
8087
- onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData, state.faces[0]);
8088
- clearCanvas(lastPredictionCanvas.current);
8089
- }
8090
- return [2 /*return*/];
8091
- });
8092
- });
8093
- })();
8055
+ if (captureReady && videoRef.current && lastPredictionCanvas.current && state.faces.length > 0) {
8056
+ drawToCanvas(lastPredictionCanvas.current, videoRef.current);
8057
+ var ctx = lastPredictionCanvas.current.getContext('2d');
8058
+ if (!ctx) return;
8059
+ var imageData = ctx.getImageData(0, 0, videoRef.current.videoWidth, videoRef.current.videoHeight);
8060
+ onSelfieCaptured === null || onSelfieCaptured === void 0 ? void 0 : onSelfieCaptured(imageData, state.faces[0]);
8061
+ clearCanvas(lastPredictionCanvas.current);
8062
+ }
8094
8063
  }, [captureReady, onSelfieCaptured, state.faces, videoRef]);
8095
8064
  var _q = useTimeout(timeoutDurationMs, onTimeout),
8096
8065
  timedOut = _q.timedOut,
@@ -8139,7 +8108,7 @@ var SelfieCapture = function SelfieCapture(_a) {
8139
8108
  scaling: debugScalingDetails,
8140
8109
  color: satisfied ? 'green' : 'red'
8141
8110
  });
8142
- }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), !state.faceNotCentered ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__default.createElement("br", null), !state.faceTooClose && !state.faceTooFar ? '✅' : '❌', " Face", ' ', state.faceTooClose ? 'Too Close' : state.faceTooFar ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__default.createElement("br", null), !state.faceLookingAway ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " ", state.goodFramesCount, ' ', "Good Frames", /*#__PURE__*/React__default.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
8111
+ }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), !state.faceNotCentered ? '✅' : '❌', " Face Centered", /*#__PURE__*/React__default.createElement("br", null), !state.faceTooClose && !state.faceTooFar ? '✅' : '❌', " Face", ' ', state.faceTooClose ? 'Too Close' : state.faceTooFar ? 'Too Far' : 'Distance Correct', /*#__PURE__*/React__default.createElement("br", null), !state.faceLookingAway ? '✅' : '❌', " Face Looking Forward", /*#__PURE__*/React__default.createElement("br", null), !timedOut ? '✅' : '❌', " Time Remaining:", ' ', Math.max(0, timeoutDurationMs - (new Date().getTime() - (timeoutStartedAt !== null && timeoutStartedAt !== void 0 ? timeoutStartedAt : new Date()).getTime())), "ms")), /*#__PURE__*/React__default.createElement(ExitCaptureButton, {
8143
8112
  onClick: onExit,
8144
8113
  className: classNames.exitCaptureBtn
8145
8114
  }));
@@ -8259,6 +8228,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
8259
8228
  setImageUrl = _m[1];
8260
8229
  var rawCanvas = useRef(null);
8261
8230
  var cropCanvas = useRef(null);
8231
+ var resizeCanvas = useRef(null);
8262
8232
  var theme = useTheme();
8263
8233
  var onSelfieCaptured = useCallback(function (frame, face) {
8264
8234
  onCapture === null || onCapture === void 0 ? void 0 : onCapture();
@@ -8287,7 +8257,7 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
8287
8257
  switch (_b.label) {
8288
8258
  case 0:
8289
8259
  _b.trys.push([0, 3,, 4]);
8290
- imageUrl_1 = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
8260
+ imageUrl_1 = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face, 0.92, 500);
8291
8261
  setImageUrl(imageUrl_1);
8292
8262
  _a = checkLiveness;
8293
8263
  return [4 /*yield*/, dataUrlToBase64(imageUrl_1)];
@@ -8400,6 +8370,8 @@ var FaceLivenessCapture = function FaceLivenessCapture(_a) {
8400
8370
  ref: rawCanvas
8401
8371
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
8402
8372
  ref: cropCanvas
8373
+ }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
8374
+ ref: resizeCanvas
8403
8375
  }), /*#__PURE__*/React__default.createElement(SelfieCapture, {
8404
8376
  onSelfieCaptured: onSelfieCaptured,
8405
8377
  onExit: onExit,
@@ -12494,6 +12466,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12494
12466
  setImageUrl = _k[1];
12495
12467
  var rawCanvas = useRef(null);
12496
12468
  var cropCanvas = useRef(null);
12469
+ var resizeCanvas = useRef(null);
12497
12470
  var onSelfieCaptured = useCallback(function (frame, face) {
12498
12471
  dispatch({
12499
12472
  type: 'verificationReady',
@@ -12506,7 +12479,7 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12506
12479
  var isReady = state.requestState === 'CAPTURED';
12507
12480
  useEffect(function () {
12508
12481
  if (!frame || !face || submissionError) return;
12509
- var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
12482
+ var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face);
12510
12483
  setImageUrl(imageUrl);
12511
12484
  dataUrlToBase64(imageUrl).then(function (img) {
12512
12485
  setSelfieImage(img);
@@ -12569,6 +12542,8 @@ var CustomerVerificationCapture = function CustomerVerificationCapture(_a) {
12569
12542
  ref: rawCanvas
12570
12543
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
12571
12544
  ref: cropCanvas
12545
+ }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
12546
+ ref: resizeCanvas
12572
12547
  }), /*#__PURE__*/React__default.createElement(SelfieCapture, {
12573
12548
  onSelfieCaptured: onSelfieCaptured,
12574
12549
  onExit: onExit,
@@ -13047,6 +13022,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13047
13022
  setImageUrl = _k[1];
13048
13023
  var rawCanvas = useRef(null);
13049
13024
  var cropCanvas = useRef(null);
13025
+ var resizeCanvas = useRef(null);
13050
13026
  var onSelfieCaptured = useCallback(function (frame, face) {
13051
13027
  dispatch({
13052
13028
  type: 'identificationReady',
@@ -13061,7 +13037,7 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13061
13037
  var isReady = state.requestState === 'CAPTURED';
13062
13038
  useEffect(function () {
13063
13039
  if (!frame || !face || submissionError) return;
13064
- var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, frame, face);
13040
+ var imageUrl = cropToShoulders(rawCanvas.current, cropCanvas.current, resizeCanvas.current, frame, face);
13065
13041
  setImageUrl(imageUrl);
13066
13042
  dataUrlToBase64(imageUrl).then(function (img) {
13067
13043
  setSelfieImage(img);
@@ -13124,6 +13100,8 @@ var CustomerIdentificationCapture = function CustomerIdentificationCapture(_a) {
13124
13100
  ref: rawCanvas
13125
13101
  }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
13126
13102
  ref: cropCanvas
13103
+ }), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
13104
+ ref: resizeCanvas
13127
13105
  }), /*#__PURE__*/React__default.createElement(SelfieCapture, {
13128
13106
  onSelfieCaptured: onSelfieCaptured,
13129
13107
  onExit: onExit,