idmission-web-sdk 1.0.14 → 1.0.16

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.
@@ -12,12 +12,20 @@ export type IdCaptureAssets = {
12
12
  export type IdCaptureColors = {
13
13
  guideBoxUnsatisfiedColor?: string;
14
14
  guideBoxSatisfiedColor?: string;
15
+ guidanceMessagesSatisfiedBackgroundColor?: string;
16
+ guidanceMessagesUnsatisfiedBackgroundColor?: string;
17
+ guidanceMessagesSatisfiedTextColor?: string;
18
+ guidanceMessagesUnsatisfiedTextColor?: string;
15
19
  };
16
20
  export type IdCaptureVerbiage = {
17
21
  instructionText?: CustomerSuppliedVerbiage;
18
22
  processingIdCardText?: CustomerSuppliedVerbiage;
19
23
  capturingText?: CustomerSuppliedVerbiage;
20
24
  captureFailedText?: CustomerSuppliedVerbiage;
25
+ guidanceSatisfiedText?: CustomerSuppliedVerbiage;
26
+ guidanceTooBlurryText?: CustomerSuppliedVerbiage;
27
+ guidanceNotCenteredText?: CustomerSuppliedVerbiage;
28
+ guidanceNotDetectedText?: CustomerSuppliedVerbiage;
21
29
  };
22
30
  export type IdCaptureProps = {
23
31
  requiredDocumentType?: DocumentType;
@@ -31,6 +39,8 @@ export type IdCaptureProps = {
31
39
  barcodeScanningEnabled?: boolean;
32
40
  maxBarcodeScanAttempts?: number;
33
41
  focusScoreThreshold?: number;
42
+ guidanceMessage?: string;
43
+ guidanceSatisfied?: boolean;
34
44
  onPrediction?: (prediction: IdCapturePrediction) => void;
35
45
  onBarcodeScanned?: (result: PDF417DetectionResult) => void;
36
46
  onCapture?: (frame: string, width: number, height: number, metadata: CaptureAttemptMetadata) => void;
@@ -42,4 +52,4 @@ export type IdCaptureProps = {
42
52
  verbiage?: IdCaptureVerbiage;
43
53
  debugMode?: boolean;
44
54
  };
45
- export declare const IdCapture: ({ requiredDocumentType, autoCaptureEnabled, autoCaptureScoreThreshold, autoCaptureGoodFramesRequired, autoCaptureBarcodeRequired, mrzDetectionScoreThreshold, passportPageDetectionThreshold, pdf417DetectionThreshold, focusScoreThreshold, barcodeScanningEnabled, maxBarcodeScanAttempts, onPrediction, onBarcodeScanned, onCapture, onExit, processingScreen, processingDelay, assets, colors, verbiage: rawVerbiage, debugMode, }: IdCaptureProps) => React.ReactElement;
55
+ export declare const IdCapture: ({ requiredDocumentType, autoCaptureEnabled, autoCaptureScoreThreshold, autoCaptureGoodFramesRequired, autoCaptureBarcodeRequired, mrzDetectionScoreThreshold, passportPageDetectionThreshold, pdf417DetectionThreshold, focusScoreThreshold, barcodeScanningEnabled, maxBarcodeScanAttempts, guidanceMessage, guidanceSatisfied, onPrediction, onBarcodeScanned, onCapture, onExit, processingScreen, processingDelay, assets, colors, verbiage: rawVerbiage, debugMode, }: IdCaptureProps) => React.ReactElement;
@@ -17,6 +17,10 @@ declare const _default: {
17
17
  'ID Card Front': string;
18
18
  'ID Card Back': string;
19
19
  Passport: string;
20
+ 'Document not detected': string;
21
+ 'Document is not centered': string;
22
+ 'Document out of focus \u2013 try improving the lighting': string;
23
+ 'Document detected, hold still...': string;
20
24
  'Capturing...': string;
21
25
  'Capture failed!': string;
22
26
  'Please flip your ID card...': string;
@@ -25,6 +25,10 @@ export declare const resources: {
25
25
  'ID Card Front': string;
26
26
  'ID Card Back': string;
27
27
  Passport: string;
28
+ 'Document not detected': string;
29
+ 'Document is not centered': string;
30
+ 'Document out of focus \u2013 try improving the lighting': string;
31
+ 'Document detected, hold still...': string;
28
32
  'Capturing...': string;
29
33
  'Capture failed!': string;
30
34
  'Please flip your ID card...': string;
@@ -50,7 +50,7 @@ var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObs
50
50
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
51
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
52
52
 
53
- var webSdkVersion = '1.0.14';
53
+ var webSdkVersion = '1.0.16';
54
54
 
55
55
  function getPlatform() {
56
56
  return window.platform;
@@ -9097,6 +9097,10 @@ var esTranslation = {
9097
9097
  'ID Card Front': 'Frente de la ID',
9098
9098
  'ID Card Back': 'Reverso de la ID',
9099
9099
  Passport: 'Pasaporte',
9100
+ 'Document not detected': 'No se ha detectado el documento',
9101
+ 'Document is not centered': 'Documento no centrado',
9102
+ 'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
9103
+ 'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
9100
9104
  'Capturing...': 'Capturando...',
9101
9105
  'Capture failed!': 'Falló la captura',
9102
9106
  'Please flip your ID card...': 'Por favor voltea la identificación...',
@@ -9181,6 +9185,19 @@ function useTranslations(verbiage, fallbacks) {
9181
9185
  }, [fallbacks, i18n.language, t, verbiage]);
9182
9186
  }
9183
9187
 
9188
+ var GuidanceMessageContainer = styled__default['default'].div(templateObject_1$3 || (templateObject_1$3 = tslib.__makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
9189
+ var $top = _a.$top;
9190
+ return $top !== null && $top !== void 0 ? $top : '10vh';
9191
+ });
9192
+ var GuidanceMessage = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n"], ["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n"])), function (_a) {
9193
+ var $background = _a.$background;
9194
+ return $background !== null && $background !== void 0 ? $background : '#ccc';
9195
+ }, function (_a) {
9196
+ var $textColor = _a.$textColor;
9197
+ return $textColor !== null && $textColor !== void 0 ? $textColor : 'black';
9198
+ });
9199
+ var templateObject_1$3, templateObject_2$1;
9200
+
9184
9201
  var initialState$5 = {
9185
9202
  videoWidth: 0,
9186
9203
  videoHeight: 0,
@@ -9258,6 +9275,7 @@ var reducer$5 = function reducer(state, action) {
9258
9275
  }
9259
9276
  var documentInBounds = false;
9260
9277
  if (bestDocumentOrPassport) {
9278
+ var boundaryPx = 20;
9261
9279
  var _b = bestDocumentOrPassport.bbox,
9262
9280
  boundaryX = _b[0],
9263
9281
  boundaryY = _b[1],
@@ -9267,7 +9285,7 @@ var reducer$5 = function reducer(state, action) {
9267
9285
  boundaryWidth *= frameWidth;
9268
9286
  boundaryY *= frameHeight;
9269
9287
  boundaryHeight *= frameHeight;
9270
- documentInBounds = boundaryY > 5 && boundaryY + boundaryHeight + 5 < frameHeight && (boundaryX > 5 || boundaryX < 5 && boundaryX + boundaryWidth > frameWidth * 0.8) && boundaryX + boundaryWidth + 5 < frameWidth;
9288
+ documentInBounds = boundaryY > boundaryPx && boundaryY + boundaryHeight + boundaryPx < frameHeight && (boundaryX > boundaryPx || boundaryX < boundaryPx && boundaryX + boundaryWidth > frameWidth * 0.8) && boundaryX + boundaryWidth + boundaryPx < frameWidth;
9271
9289
  }
9272
9290
  var barcodeScanRequired = state.autoCaptureBarcodeRequired === true || state.autoCaptureBarcodeRequired === 'mobile' && isMobile();
9273
9291
  var shouldScanBarcode = state.barcodeScanningEnabled && pdf417DetectionThresholdMet && barcodeScanRequired;
@@ -9368,6 +9386,8 @@ var IdCapture = function IdCapture(_a) {
9368
9386
  barcodeScanningEnabled = _o === void 0 ? true : _o,
9369
9387
  _p = _a.maxBarcodeScanAttempts,
9370
9388
  maxBarcodeScanAttempts = _p === void 0 ? 10 : _p,
9389
+ guidanceMessage = _a.guidanceMessage,
9390
+ guidanceSatisfied = _a.guidanceSatisfied,
9371
9391
  onPrediction = _a.onPrediction,
9372
9392
  onBarcodeScanned = _a.onBarcodeScanned,
9373
9393
  onCapture = _a.onCapture,
@@ -9602,11 +9622,17 @@ var IdCapture = function IdCapture(_a) {
9602
9622
  }, [getBestFrame, onCapture, processingDelay, shouldCapture, state.barcodeResult]);
9603
9623
  colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = 'white');
9604
9624
  colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = 'green');
9625
+ colors.guidanceMessagesSatisfiedBackgroundColor || (colors.guidanceMessagesSatisfiedBackgroundColor = 'green');
9626
+ colors.guidanceMessagesSatisfiedTextColor || (colors.guidanceMessagesSatisfiedTextColor = 'white');
9605
9627
  var verbiage = useTranslations(rawVerbiage, {
9606
9628
  instructionText: 'Scan the front of ID',
9607
9629
  processingIdCardText: 'ID card front captured.',
9608
9630
  capturingText: 'Capturing...',
9609
- captureFailedText: 'Capture failed!'
9631
+ captureFailedText: 'Capture failed!',
9632
+ guidanceSatisfiedText: 'Document detected, hold still...',
9633
+ guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
9634
+ guidanceNotCenteredText: 'Document is not centered',
9635
+ guidanceNotDetectedText: 'Document not detected'
9610
9636
  });
9611
9637
  var debugScalingDetails = useDebugScalingDetails({
9612
9638
  enabled: debugMode,
@@ -9615,6 +9641,9 @@ var IdCapture = function IdCapture(_a) {
9615
9641
  videoWidth: state.videoWidth,
9616
9642
  videoHeight: state.videoHeight
9617
9643
  });
9644
+ var satisfied = state.isGoodFrame;
9645
+ if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
9646
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
9618
9647
  if (processingFrame) {
9619
9648
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, processingScreen, imageURL && /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
9620
9649
  text: verbiage.processingIdCardText,
@@ -9642,7 +9671,12 @@ var IdCapture = function IdCapture(_a) {
9642
9671
  landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
9643
9672
  isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
9644
9673
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor
9645
- }), debugMode && state.detectedObjects.length > 0 && /*#__PURE__*/React__default['default'].createElement(ObjectDetectionDebugOverlay, {
9674
+ }), guidanceMessage !== '' && /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
9675
+ "$top": "82.5vh"
9676
+ }, /*#__PURE__*/React__default['default'].createElement(GuidanceMessage, {
9677
+ "$background": satisfied ? colors.guidanceMessagesSatisfiedBackgroundColor : colors.guidanceMessagesUnsatisfiedBackgroundColor,
9678
+ "$textColor": satisfied ? colors.guidanceMessagesSatisfiedTextColor : colors.guidanceMessagesUnsatisfiedTextColor
9679
+ }, guidanceMessage)), debugMode && state.detectedObjects.length > 0 && /*#__PURE__*/React__default['default'].createElement(ObjectDetectionDebugOverlay, {
9646
9680
  "$flipX": !((_d = cameraRef.current) === null || _d === void 0 ? void 0 : _d.isRearFacing)
9647
9681
  }, state.detectedObjects.map(function (obj, i) {
9648
9682
  var _a;
@@ -10083,10 +10117,10 @@ var CameraVideoTag = function CameraVideoTag() {
10083
10117
  "$isRearFacing": (_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing
10084
10118
  });
10085
10119
  };
10086
- var FullscreenVideoTag = styled__default['default'].video(templateObject_1$3 || (templateObject_1$3 = tslib.__makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n object-fit: cover;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n object-fit: cover;\n"])), function (props) {
10120
+ var FullscreenVideoTag = styled__default['default'].video(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n object-fit: cover;\n"], ["\n transform: ", ";\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n object-fit: cover;\n"])), function (props) {
10087
10121
  return props.$isRearFacing ? '' : 'scaleX(-1)';
10088
10122
  });
10089
- var templateObject_1$3;
10123
+ var templateObject_1$2;
10090
10124
 
10091
10125
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
10092
10126
  var _this = this;
@@ -10834,19 +10868,6 @@ var HighPerformanceSelfieGuidanceModelsProvider = function HighPerformanceSelfie
10834
10868
  }, children);
10835
10869
  };
10836
10870
 
10837
- var GuidanceMessageContainer = styled__default['default'].div(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
10838
- var $top = _a.$top;
10839
- return $top !== null && $top !== void 0 ? $top : '10vh';
10840
- });
10841
- var GuidanceMessage = styled__default['default'].div(templateObject_2$1 || (templateObject_2$1 = tslib.__makeTemplateObject(["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n"], ["\n margin-left: auto;\n margin-right: auto;\n background: ", ";\n color: ", ";\n padding: 10px 12px 8px;\n border-radius: 8px;\n"])), function (_a) {
10842
- var $background = _a.$background;
10843
- return $background !== null && $background !== void 0 ? $background : '#ccc';
10844
- }, function (_a) {
10845
- var $textColor = _a.$textColor;
10846
- return $textColor !== null && $textColor !== void 0 ? $textColor : 'black';
10847
- });
10848
- var templateObject_1$2, templateObject_2$1;
10849
-
10850
10871
  var useTimeout = function useTimeout(durationMs, onTimeout, timeoutAverted, shouldWaitLonger) {
10851
10872
  var _a = React.useState(false),
10852
10873
  timedOut = _a[0],
@@ -10959,9 +10980,6 @@ var SelfieCaptureFallback = function SelfieCaptureFallback(_a) {
10959
10980
  onClick: function onClick() {
10960
10981
  setLoading(true);
10961
10982
  onFinished === null || onFinished === void 0 ? void 0 : onFinished(image);
10962
- },
10963
- style: {
10964
- marginLeft: 12
10965
10983
  }
10966
10984
  }, loading ? verbiage.doneBtnLoadingText : verbiage.doneBtnText))));
10967
10985
  };
@@ -11172,9 +11190,9 @@ var SelfieCapture = function SelfieCapture(_a) {
11172
11190
  guidanceMoveForwardText: 'Move forward...',
11173
11191
  guidanceMoveToCenterText: 'Move to the center...'
11174
11192
  });
11175
- guidanceMessage || (guidanceMessage = state.faceReady ? verbiage.guidanceHoldStillText : state.faceLookingAway ? verbiage.guidanceLookStraightText : state.faceTooClose ? verbiage.guidanceMoveBackText : state.faceTooFar ? verbiage.guidanceMoveForwardText : state.faceNotCentered ? verbiage.guidanceMoveToCenterText : '');
11176
11193
  var satisfied = state.faceReady;
11177
11194
  if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
11195
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceHoldStillText : state.faceLookingAway ? verbiage.guidanceLookStraightText : state.faceTooClose ? verbiage.guidanceMoveBackText : state.faceTooFar ? verbiage.guidanceMoveForwardText : state.faceNotCentered ? verbiage.guidanceMoveToCenterText : '');
11178
11196
  if (guidanceError) {
11179
11197
  return /*#__PURE__*/React__default['default'].createElement(SelfieCaptureFallback, null);
11180
11198
  }