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.
@@ -116,6 +116,8 @@ export interface CustomerEnrollmentProps extends PropsWithChildren {
116
116
  idCaptureModelLoadTimeoutMs?: number;
117
117
  /** Number of milliseconds indicating the maximum amount of time that should be spent trying to load the guided capture experience before giving up and resorting to the stock camera instead. Defaults to 45000 (45 seconds). */
118
118
  selfieCaptureModelLoadTimeoutMs?: number;
119
+ /** Boolean to indicate whether to allow the user to capture the back of the ID card before capturing the front. Defaults to `false`. */
120
+ allowIdCardBackToFrontCapture?: boolean;
119
121
  /** Callback function that fires immediately prior to each document upload, giving the client application an opportunity to specify custom asynchronous logic that captures the document contents before it is exchanged for a document token. The document content and metadata are passed in as parameters and a promise resolving to void or false should be returned. If the returned promise resolves to false, the document will not be uploaded. */
120
122
  onBeforeDocumentUpload?: OnBeforeDocumentUpload;
121
123
  /** Callback function that fires when progress information is available for a document upload. The progress info and metadata are passed in as parameters. */
@@ -113,6 +113,8 @@ export interface IdAndFaceValidationProps extends PropsWithChildren {
113
113
  idCaptureModelLoadTimeoutMs?: number;
114
114
  /** Number of milliseconds indicating the maximum amount of time that should be spent trying to load the guided capture experience before giving up and resorting to the stock camera instead. Defaults to 45000 (45 seconds). */
115
115
  selfieCaptureModelLoadTimeoutMs?: number;
116
+ /** Boolean to indicate whether to allow the user to capture the back of the ID card before capturing the front. Defaults to `false`. */
117
+ allowIdCardBackToFrontCapture?: boolean;
116
118
  /** Callback function that fires immediately prior to each document upload, giving the client application an opportunity to specify custom asynchronous logic that captures the document contents before it is exchanged for a document token. The document content and metadata are passed in as parameters and a promise resolving to void or false should be returned. If the returned promise resolves to false, the document will not be uploaded. */
117
119
  onBeforeDocumentUpload?: OnBeforeDocumentUpload;
118
120
  /** Callback function that fires when progress information is available for a document upload. The progress info and metadata are passed in as parameters. */
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.1.21';
237
+ var webSdkVersion = '2.1.22';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -12175,21 +12175,13 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
12175
12175
  }
12176
12176
  }, [numFramesWithoutFaces, onFaceNotDetected]);
12177
12177
  function onAcceptClicked() {
12178
+ var _a;
12178
12179
  if (!signaturePad.current) return;
12179
12180
  var signatureData = signatureDataToIdmissionFormat(signaturePad.current);
12180
12181
  setSignatureData(signatureData);
12181
- var signatureCanvas = signaturePad.current.getCanvas();
12182
- var scaledHeight = signatureCanvas.height * 600 / signatureCanvas.width;
12183
- var svgB64Url = signaturePad.current.getSignaturePad()._toSVG();
12184
- var svgContent = atob(svgB64Url.replace('data:image/svg+xml;base64,', ''));
12185
- 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, "\""));
12186
- var scaledSvgUrl = 'data:image/svg+xml;base64,' + btoa(scaledSvgContent);
12187
- convertSVGtoImg(scaledSvgUrl).then(function (dataUrl) {
12188
- var _a;
12189
- dataUrl && setSignatureDataUrl(dataUrl);
12190
- stopRecordingVideo();
12191
- (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
12192
- });
12182
+ setSignatureDataUrl(signaturePad.current.toDataURL());
12183
+ stopRecordingVideo();
12184
+ (_a = signatureRecorder.current) === null || _a === void 0 ? void 0 : _a.stop();
12193
12185
  }
12194
12186
  return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
12195
12187
  className: "flex ".concat((_b = classNames.container) !== null && _b !== void 0 ? _b : '')
@@ -12235,50 +12227,6 @@ var VideoSignatureCapture = function VideoSignatureCapture(_a) {
12235
12227
  }));
12236
12228
  };
12237
12229
  var AcceptBtn = styled__default.default(LoaderButton)(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n margin-left: auto;\n"], ["\n margin-left: auto;\n"])));
12238
- var loadImage = function loadImage(url) {
12239
- return __awaiter(void 0, void 0, void 0, function () {
12240
- var img;
12241
- return __generator(this, function (_a) {
12242
- img = document.createElement('img');
12243
- img.src = url;
12244
- return [2 /*return*/, new Promise(function (resolve, reject) {
12245
- img.onload = function () {
12246
- return resolve(img);
12247
- };
12248
- img.onerror = reject;
12249
- })];
12250
- });
12251
- });
12252
- };
12253
- var convertSVGtoImg = function convertSVGtoImg(svgData_1) {
12254
- var args_1 = [];
12255
- for (var _i = 1; _i < arguments.length; _i++) {
12256
- args_1[_i - 1] = arguments[_i];
12257
- }
12258
- return __awaiter(void 0, __spreadArray([svgData_1], args_1, true), void 0, function (svgData, format) {
12259
- var img, canvas, ctx;
12260
- if (format === void 0) {
12261
- format = 'jpeg';
12262
- }
12263
- return __generator(this, function (_a) {
12264
- switch (_a.label) {
12265
- case 0:
12266
- return [4 /*yield*/, loadImage(svgData)];
12267
- case 1:
12268
- img = _a.sent();
12269
- canvas = document.createElement('canvas');
12270
- canvas.width = img.naturalWidth;
12271
- canvas.height = img.naturalHeight;
12272
- ctx = canvas.getContext('2d');
12273
- if (!ctx) return [2 /*return*/];
12274
- ctx.fillStyle = 'white';
12275
- ctx.fillRect(0, 0, canvas.width, canvas.height);
12276
- ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
12277
- return [2 /*return*/, canvas.toDataURL("image/".concat(format), 1.0)];
12278
- }
12279
- });
12280
- });
12281
- };
12282
12230
  var templateObject_1$a;
12283
12231
 
12284
12232
  var VideoSignatureSuccess = function VideoSignatureSuccess(_a) {
@@ -12418,22 +12366,18 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
12418
12366
  });
12419
12367
  });
12420
12368
  }, [logCaptureMetadata, selfieImage, setSelfieImage]);
12421
- var _p = React.useState(null),
12422
- signatureDataUrl = _p[0],
12423
- setSignatureDataUrl = _p[1];
12424
12369
  var onSignatureCaptureCompleted = React.useCallback(function (videoData, signatureData, signatureImageData) {
12425
12370
  setSignatureData(signatureData);
12426
12371
  setSignatureVideoUrl(URL.createObjectURL(videoData));
12427
12372
  setCaptureState('SUCCESS');
12428
- setSignatureDataUrl(signatureImageData);
12429
12373
  onVideoCaptured === null || onVideoCaptured === void 0 ? void 0 : onVideoCaptured(videoData, signatureData, signatureImageData);
12430
12374
  }, [onVideoCaptured, setSignatureData, setSignatureVideoUrl]);
12431
12375
  var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
12432
12376
  setCaptureState('CHECKING_LIVENESS');
12433
12377
  }, []);
12434
- var _q = React.useState(0),
12435
- attempt = _q[0],
12436
- setAttempt = _q[1];
12378
+ var _p = React.useState(0),
12379
+ attempt = _p[0],
12380
+ setAttempt = _p[1];
12437
12381
  var onExit = React.useCallback(function () {
12438
12382
  releaseCameraAccess();
12439
12383
  setAttempt(function (n) {
@@ -12483,17 +12427,14 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
12483
12427
  });
12484
12428
  case 'SUCCESS':
12485
12429
  if (!showSuccessScreen) return;
12486
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(VideoSignatureSuccess, {
12430
+ return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureSuccess, {
12487
12431
  videoUrl: signatureVideoUrl !== null && signatureVideoUrl !== void 0 ? signatureVideoUrl : '',
12488
12432
  onDoneClick: onComplete,
12489
12433
  onRetryClick: onRetry,
12490
12434
  classNames: classNames.success,
12491
12435
  colors: colors.success,
12492
12436
  verbiage: verbiage.success
12493
- }), signatureDataUrl && /*#__PURE__*/React__namespace.default.createElement("img", {
12494
- src: signatureDataUrl,
12495
- alt: ""
12496
- }));
12437
+ });
12497
12438
  default:
12498
12439
  return null;
12499
12440
  }
@@ -14363,6 +14304,8 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
14363
14304
  idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
14364
14305
  _o = _a.selfieCaptureModelLoadTimeoutMs,
14365
14306
  selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
14307
+ _p = _a.allowIdCardBackToFrontCapture,
14308
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
14366
14309
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
14367
14310
  onDocumentUploaded = _a.onDocumentUploaded,
14368
14311
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -14379,28 +14322,28 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
14379
14322
  onIdCaptureModelError = _a.onIdCaptureModelError,
14380
14323
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
14381
14324
  onCameraAccessDenied = _a.onCameraAccessDenied,
14382
- _p = _a.captureSignature,
14383
- captureSignature = _p === void 0 ? false : _p,
14384
- _q = _a.captureSignatureVideo,
14385
- captureSignatureVideo = _q === void 0 ? false : _q,
14386
- _r = _a.captureAdditionalDocuments,
14387
- captureAdditionalDocuments = _r === void 0 ? [] : _r,
14388
- _s = _a.theme,
14389
- theme = _s === void 0 ? 'default' : _s,
14390
- _t = _a.assets,
14391
- assets = _t === void 0 ? {} : _t,
14392
- _u = _a.classNames,
14393
- classNames = _u === void 0 ? {} : _u,
14394
- _v = _a.colors,
14395
- colors = _v === void 0 ? {} : _v,
14396
- _w = _a.verbiage,
14397
- verbiage = _w === void 0 ? {} : _w,
14398
- _x = _a.geolocationEnabled,
14399
- geolocationEnabled = _x === void 0 ? true : _x,
14400
- _y = _a.geolocationRequired,
14401
- geolocationRequired = _y === void 0 ? false : _y,
14402
- _z = _a.debugMode,
14403
- debugMode = _z === void 0 ? false : _z;
14325
+ _q = _a.captureSignature,
14326
+ captureSignature = _q === void 0 ? false : _q,
14327
+ _r = _a.captureSignatureVideo,
14328
+ captureSignatureVideo = _r === void 0 ? false : _r,
14329
+ _s = _a.captureAdditionalDocuments,
14330
+ captureAdditionalDocuments = _s === void 0 ? [] : _s,
14331
+ _t = _a.theme,
14332
+ theme = _t === void 0 ? 'default' : _t,
14333
+ _u = _a.assets,
14334
+ assets = _u === void 0 ? {} : _u,
14335
+ _v = _a.classNames,
14336
+ classNames = _v === void 0 ? {} : _v,
14337
+ _w = _a.colors,
14338
+ colors = _w === void 0 ? {} : _w,
14339
+ _x = _a.verbiage,
14340
+ verbiage = _x === void 0 ? {} : _x,
14341
+ _y = _a.geolocationEnabled,
14342
+ geolocationEnabled = _y === void 0 ? true : _y,
14343
+ _z = _a.geolocationRequired,
14344
+ geolocationRequired = _z === void 0 ? false : _z,
14345
+ _0 = _a.debugMode,
14346
+ debugMode = _0 === void 0 ? false : _0;
14404
14347
  useLanguage(lang);
14405
14348
  useDebugLogging(debugMode);
14406
14349
  var idCaptureProps = React.useMemo(function () {
@@ -14421,10 +14364,11 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
14421
14364
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
14422
14365
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
14423
14366
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
14367
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
14424
14368
  skipSuccessScreen: skipSuccessScreen,
14425
14369
  debugMode: debugMode
14426
14370
  };
14427
- }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
14371
+ }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, skipSuccessScreen, debugMode]);
14428
14372
  var faceLivenessProps = React.useMemo(function () {
14429
14373
  return {
14430
14374
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
@@ -14585,6 +14529,8 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
14585
14529
  idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
14586
14530
  _o = _a.selfieCaptureModelLoadTimeoutMs,
14587
14531
  selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
14532
+ _p = _a.allowIdCardBackToFrontCapture,
14533
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
14588
14534
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
14589
14535
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
14590
14536
  onDocumentUploaded = _a.onDocumentUploaded,
@@ -14600,28 +14546,28 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
14600
14546
  onIdCaptureModelError = _a.onIdCaptureModelError,
14601
14547
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
14602
14548
  onCameraAccessDenied = _a.onCameraAccessDenied,
14603
- _p = _a.captureSignature,
14604
- captureSignature = _p === void 0 ? false : _p,
14605
- _q = _a.captureSignatureVideo,
14606
- captureSignatureVideo = _q === void 0 ? false : _q,
14607
- _r = _a.captureAdditionalDocuments,
14608
- captureAdditionalDocuments = _r === void 0 ? [] : _r,
14609
- _s = _a.theme,
14610
- theme = _s === void 0 ? 'default' : _s,
14611
- _t = _a.assets,
14612
- assets = _t === void 0 ? {} : _t,
14613
- _u = _a.classNames,
14614
- classNames = _u === void 0 ? {} : _u,
14615
- _v = _a.colors,
14616
- colors = _v === void 0 ? {} : _v,
14617
- _w = _a.verbiage,
14618
- verbiage = _w === void 0 ? {} : _w,
14619
- _x = _a.geolocationEnabled,
14620
- geolocationEnabled = _x === void 0 ? true : _x,
14621
- _y = _a.geolocationRequired,
14622
- geolocationRequired = _y === void 0 ? false : _y,
14623
- _z = _a.debugMode,
14624
- debugMode = _z === void 0 ? false : _z;
14549
+ _q = _a.captureSignature,
14550
+ captureSignature = _q === void 0 ? false : _q,
14551
+ _r = _a.captureSignatureVideo,
14552
+ captureSignatureVideo = _r === void 0 ? false : _r,
14553
+ _s = _a.captureAdditionalDocuments,
14554
+ captureAdditionalDocuments = _s === void 0 ? [] : _s,
14555
+ _t = _a.theme,
14556
+ theme = _t === void 0 ? 'default' : _t,
14557
+ _u = _a.assets,
14558
+ assets = _u === void 0 ? {} : _u,
14559
+ _v = _a.classNames,
14560
+ classNames = _v === void 0 ? {} : _v,
14561
+ _w = _a.colors,
14562
+ colors = _w === void 0 ? {} : _w,
14563
+ _x = _a.verbiage,
14564
+ verbiage = _x === void 0 ? {} : _x,
14565
+ _y = _a.geolocationEnabled,
14566
+ geolocationEnabled = _y === void 0 ? true : _y,
14567
+ _z = _a.geolocationRequired,
14568
+ geolocationRequired = _z === void 0 ? false : _z,
14569
+ _0 = _a.debugMode,
14570
+ debugMode = _0 === void 0 ? false : _0;
14625
14571
  useLanguage(lang);
14626
14572
  useDebugLogging(debugMode);
14627
14573
  var idCaptureProps = React.useMemo(function () {
@@ -14638,13 +14584,14 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
14638
14584
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
14639
14585
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
14640
14586
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
14587
+ allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
14641
14588
  onExitCapture: onExitCapture,
14642
14589
  onUserCancel: onUserCancel,
14643
14590
  onModelError: onIdCaptureModelError,
14644
14591
  skipSuccessScreen: skipSuccessScreen,
14645
14592
  debugMode: debugMode
14646
14593
  };
14647
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
14594
+ }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
14648
14595
  var faceLivenessProps = React.useMemo(function () {
14649
14596
  return {
14650
14597
  onExitCapture: onExitCapture,