idmission-web-sdk 2.1.21 → 2.1.22

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.
@@ -215,7 +215,7 @@
215
215
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
216
216
  };
217
217
 
218
- var webSdkVersion = '2.1.21';
218
+ var webSdkVersion = '2.1.22';
219
219
 
220
220
  function getPlatform() {
221
221
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -21777,21 +21777,13 @@
21777
21777
  }
21778
21778
  }, [numFramesWithoutFaces, onFaceNotDetected]);
21779
21779
  function onAcceptClicked() {
21780
+ var _a;
21780
21781
  if (!signaturePad.current) return;
21781
21782
  var signatureData = signatureDataToIdmissionFormat(signaturePad.current);
21782
21783
  setSignatureData(signatureData);
21783
- var signatureCanvas = signaturePad.current.getCanvas();
21784
- var scaledHeight = signatureCanvas.height * 600 / signatureCanvas.width;
21785
- var svgB64Url = signaturePad.current.getSignaturePad()._toSVG();
21786
- var svgContent = atob(svgB64Url.replace('data:image/svg+xml;base64,', ''));
21787
- var scaledSvgContent = svgContent.replace(/width="[0-9.]+"/, "width=\"600\"").replace(/height="[0-9.]+"/, "height=\"".concat(scaledHeight, "\"")).replace(/viewBox="0 0 [0-9.]+ [0-9.]+"/, "viewBox=\"0 0 ".concat(signatureCanvas.width, " ").concat(signatureCanvas.height, "\""));
21788
- var scaledSvgUrl = 'data:image/svg+xml;base64,' + btoa(scaledSvgContent);
21789
- convertSVGtoImg(scaledSvgUrl).then(function (dataUrl) {
21790
- var _a;
21791
- dataUrl && setSignatureDataUrl(dataUrl);
21792
- stopRecordingVideo();
21793
- (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
21794
- });
21784
+ setSignatureDataUrl(signaturePad.current.toDataURL());
21785
+ stopRecordingVideo();
21786
+ (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
21795
21787
  }
21796
21788
  return /*#__PURE__*/React.createElement(PageContainer, {
21797
21789
  className: "flex ".concat((_b = classNames.container) !== null && _b !== void 0 ? _b : '')
@@ -21837,50 +21829,6 @@
21837
21829
  }));
21838
21830
  };
21839
21831
  var AcceptBtn = styled(LoaderButton)(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
21840
- var loadImage = function loadImage(url) {
21841
- return __awaiter(void 0, void 0, void 0, function () {
21842
- var img;
21843
- return __generator(this, function (_a) {
21844
- img = document.createElement('img');
21845
- img.src = url;
21846
- return [2 /*return*/, new Promise(function (resolve, reject) {
21847
- img.onload = function () {
21848
- return resolve(img);
21849
- };
21850
- img.onerror = reject;
21851
- })];
21852
- });
21853
- });
21854
- };
21855
- var convertSVGtoImg = function convertSVGtoImg(svgData_1) {
21856
- var args_1 = [];
21857
- for (var _i = 1; _i < arguments.length; _i++) {
21858
- args_1[_i - 1] = arguments[_i];
21859
- }
21860
- return __awaiter(void 0, __spreadArray([svgData_1], args_1, true), void 0, function (svgData, format) {
21861
- var img, canvas, ctx;
21862
- if (format === void 0) {
21863
- format = 'jpeg';
21864
- }
21865
- return __generator(this, function (_a) {
21866
- switch (_a.label) {
21867
- case 0:
21868
- return [4 /*yield*/, loadImage(svgData)];
21869
- case 1:
21870
- img = _a.sent();
21871
- canvas = document.createElement('canvas');
21872
- canvas.width = img.naturalWidth;
21873
- canvas.height = img.naturalHeight;
21874
- ctx = canvas.getContext('2d');
21875
- if (!ctx) return [2 /*return*/];
21876
- ctx.fillStyle = 'white';
21877
- ctx.fillRect(0, 0, canvas.width, canvas.height);
21878
- ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
21879
- return [2 /*return*/, canvas.toDataURL("image/".concat(format), 1.0)];
21880
- }
21881
- });
21882
- });
21883
- };
21884
21832
  var templateObject_1$a;
21885
21833
 
21886
21834
  var VideoSignatureSuccess = function VideoSignatureSuccess(_a) {
@@ -22020,22 +21968,18 @@
22020
21968
  });
22021
21969
  });
22022
21970
  }, [logCaptureMetadata, selfieImage, setSelfieImage]);
22023
- var _p = React.useState(null),
22024
- signatureDataUrl = _p[0],
22025
- setSignatureDataUrl = _p[1];
22026
21971
  var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData) {
22027
21972
  setSignatureData(signatureData);
22028
21973
  setSignatureVideoUrl(URL.createObjectURL(videoData));
22029
21974
  setCaptureState('SUCCESS');
22030
- setSignatureDataUrl(signatureImageData);
22031
21975
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
22032
21976
  }, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
22033
21977
  var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
22034
21978
  setCaptureState('CHECKING_LIVENESS');
22035
21979
  }, []);
22036
- var _q = React.useState(0),
22037
- attempt = _q[0],
22038
- setAttempt = _q[1];
21980
+ var _p = React.useState(0),
21981
+ attempt = _p[0],
21982
+ setAttempt = _p[1];
22039
21983
  var onExit = React.useCallback(function () {
22040
21984
  releaseCameraAccess();
22041
21985
  setAttempt(function (n) {
@@ -22085,17 +22029,14 @@
22085
22029
  });
22086
22030
  case 'SUCCESS':
22087
22031
  if (!showSuccessScreen) return;
22088
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VideoSignatureSuccess, {
22032
+ return /*#__PURE__*/React.createElement(VideoSignatureSuccess, {
22089
22033
  videoUrl: signatureVideoUrl !== null && signatureVideoUrl !== void 0 ? signatureVideoUrl : '',
22090
22034
  onDoneClick: onComplete,
22091
22035
  onRetryClick: onRetry,
22092
22036
  classNames: classNames.success,
22093
22037
  colors: colors.success,
22094
22038
  verbiage: verbiage.success
22095
- }), signatureDataUrl && /*#__PURE__*/React.createElement("img", {
22096
- src: signatureDataUrl,
22097
- alt: ""
22098
- }));
22039
+ });
22099
22040
  default:
22100
22041
  return null;
22101
22042
  }
@@ -23965,6 +23906,8 @@
23965
23906
  idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
23966
23907
  _o = _a.selfieCaptureModelLoadTimeoutMs,
23967
23908
  selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
23909
+ _p = _a.allowIdCardBackToFrontCapture,
23910
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
23968
23911
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
23969
23912
  onDocumentUploaded = _a.onDocumentUploaded,
23970
23913
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -23981,28 +23924,28 @@
23981
23924
  onIdCaptureModelError = _a.onIdCaptureModelError,
23982
23925
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
23983
23926
  onCameraAccessDenied = _a.onCameraAccessDenied,
23984
- _p = _a.captureSignature,
23985
- captureSignature = _p === void 0 ? false : _p,
23986
- _q = _a.captureSignatureVideo,
23987
- captureSignatureVideo = _q === void 0 ? false : _q,
23988
- _r = _a.captureAdditionalDocuments,
23989
- captureAdditionalDocuments = _r === void 0 ? [] : _r,
23990
- _s = _a.theme,
23991
- theme = _s === void 0 ? 'default' : _s,
23992
- _t = _a.assets,
23993
- assets = _t === void 0 ? {} : _t,
23994
- _u = _a.classNames,
23995
- classNames = _u === void 0 ? {} : _u,
23996
- _v = _a.colors,
23997
- colors = _v === void 0 ? {} : _v,
23998
- _w = _a.verbiage,
23999
- verbiage = _w === void 0 ? {} : _w,
24000
- _x = _a.geolocationEnabled,
24001
- geolocationEnabled = _x === void 0 ? true : _x,
24002
- _y = _a.geolocationRequired,
24003
- geolocationRequired = _y === void 0 ? false : _y,
24004
- _z = _a.debugMode,
24005
- debugMode = _z === void 0 ? false : _z;
23927
+ _q = _a.captureSignature,
23928
+ captureSignature = _q === void 0 ? false : _q,
23929
+ _r = _a.captureSignatureVideo,
23930
+ captureSignatureVideo = _r === void 0 ? false : _r,
23931
+ _s = _a.captureAdditionalDocuments,
23932
+ captureAdditionalDocuments = _s === void 0 ? [] : _s,
23933
+ _t = _a.theme,
23934
+ theme = _t === void 0 ? 'default' : _t,
23935
+ _u = _a.assets,
23936
+ assets = _u === void 0 ? {} : _u,
23937
+ _v = _a.classNames,
23938
+ classNames = _v === void 0 ? {} : _v,
23939
+ _w = _a.colors,
23940
+ colors = _w === void 0 ? {} : _w,
23941
+ _x = _a.verbiage,
23942
+ verbiage = _x === void 0 ? {} : _x,
23943
+ _y = _a.geolocationEnabled,
23944
+ geolocationEnabled = _y === void 0 ? true : _y,
23945
+ _z = _a.geolocationRequired,
23946
+ geolocationRequired = _z === void 0 ? false : _z,
23947
+ _0 = _a.debugMode,
23948
+ debugMode = _0 === void 0 ? false : _0;
24006
23949
  useLanguage(lang);
24007
23950
  useDebugLogging(debugMode);
24008
23951
  var idCaptureProps = React.useMemo(function () {
@@ -24023,10 +23966,11 @@
24023
23966
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
24024
23967
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
24025
23968
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
23969
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
24026
23970
  skipSuccessScreen: skipSuccessScreen,
24027
23971
  debugMode: debugMode
24028
23972
  };
24029
- }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
23973
+ }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, skipSuccessScreen, debugMode]);
24030
23974
  var faceLivenessProps = React.useMemo(function () {
24031
23975
  return {
24032
23976
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
@@ -24187,6 +24131,8 @@
24187
24131
  idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
24188
24132
  _o = _a.selfieCaptureModelLoadTimeoutMs,
24189
24133
  selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
24134
+ _p = _a.allowIdCardBackToFrontCapture,
24135
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
24190
24136
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
24191
24137
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
24192
24138
  onDocumentUploaded = _a.onDocumentUploaded,
@@ -24202,28 +24148,28 @@
24202
24148
  onIdCaptureModelError = _a.onIdCaptureModelError,
24203
24149
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
24204
24150
  onCameraAccessDenied = _a.onCameraAccessDenied,
24205
- _p = _a.captureSignature,
24206
- captureSignature = _p === void 0 ? false : _p,
24207
- _q = _a.captureSignatureVideo,
24208
- captureSignatureVideo = _q === void 0 ? false : _q,
24209
- _r = _a.captureAdditionalDocuments,
24210
- captureAdditionalDocuments = _r === void 0 ? [] : _r,
24211
- _s = _a.theme,
24212
- theme = _s === void 0 ? 'default' : _s,
24213
- _t = _a.assets,
24214
- assets = _t === void 0 ? {} : _t,
24215
- _u = _a.classNames,
24216
- classNames = _u === void 0 ? {} : _u,
24217
- _v = _a.colors,
24218
- colors = _v === void 0 ? {} : _v,
24219
- _w = _a.verbiage,
24220
- verbiage = _w === void 0 ? {} : _w,
24221
- _x = _a.geolocationEnabled,
24222
- geolocationEnabled = _x === void 0 ? true : _x,
24223
- _y = _a.geolocationRequired,
24224
- geolocationRequired = _y === void 0 ? false : _y,
24225
- _z = _a.debugMode,
24226
- debugMode = _z === void 0 ? false : _z;
24151
+ _q = _a.captureSignature,
24152
+ captureSignature = _q === void 0 ? false : _q,
24153
+ _r = _a.captureSignatureVideo,
24154
+ captureSignatureVideo = _r === void 0 ? false : _r,
24155
+ _s = _a.captureAdditionalDocuments,
24156
+ captureAdditionalDocuments = _s === void 0 ? [] : _s,
24157
+ _t = _a.theme,
24158
+ theme = _t === void 0 ? 'default' : _t,
24159
+ _u = _a.assets,
24160
+ assets = _u === void 0 ? {} : _u,
24161
+ _v = _a.classNames,
24162
+ classNames = _v === void 0 ? {} : _v,
24163
+ _w = _a.colors,
24164
+ colors = _w === void 0 ? {} : _w,
24165
+ _x = _a.verbiage,
24166
+ verbiage = _x === void 0 ? {} : _x,
24167
+ _y = _a.geolocationEnabled,
24168
+ geolocationEnabled = _y === void 0 ? true : _y,
24169
+ _z = _a.geolocationRequired,
24170
+ geolocationRequired = _z === void 0 ? false : _z,
24171
+ _0 = _a.debugMode,
24172
+ debugMode = _0 === void 0 ? false : _0;
24227
24173
  useLanguage(lang);
24228
24174
  useDebugLogging(debugMode);
24229
24175
  var idCaptureProps = React.useMemo(function () {
@@ -24240,13 +24186,14 @@
24240
24186
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
24241
24187
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
24242
24188
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
24189
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
24243
24190
  onExitCapture: onExitCapture,
24244
24191
  onUserCancel: onUserCancel,
24245
24192
  onModelError: onIdCaptureModelError,
24246
24193
  skipSuccessScreen: skipSuccessScreen,
24247
24194
  debugMode: debugMode
24248
24195
  };
24249
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
24196
+ }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
24250
24197
  var faceLivenessProps = React.useMemo(function () {
24251
24198
  return {
24252
24199
  onExitCapture: onExitCapture,