idmission-web-sdk 1.0.14 → 1.0.15

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;
@@ -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.15';
54
54
 
55
55
  function getPlatform() {
56
56
  return window.platform;
@@ -9181,6 +9181,19 @@ function useTranslations(verbiage, fallbacks) {
9181
9181
  }, [fallbacks, i18n.language, t, verbiage]);
9182
9182
  }
9183
9183
 
9184
+ 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) {
9185
+ var $top = _a.$top;
9186
+ return $top !== null && $top !== void 0 ? $top : '10vh';
9187
+ });
9188
+ 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) {
9189
+ var $background = _a.$background;
9190
+ return $background !== null && $background !== void 0 ? $background : '#ccc';
9191
+ }, function (_a) {
9192
+ var $textColor = _a.$textColor;
9193
+ return $textColor !== null && $textColor !== void 0 ? $textColor : 'black';
9194
+ });
9195
+ var templateObject_1$3, templateObject_2$1;
9196
+
9184
9197
  var initialState$5 = {
9185
9198
  videoWidth: 0,
9186
9199
  videoHeight: 0,
@@ -9258,6 +9271,7 @@ var reducer$5 = function reducer(state, action) {
9258
9271
  }
9259
9272
  var documentInBounds = false;
9260
9273
  if (bestDocumentOrPassport) {
9274
+ var boundaryPx = 20;
9261
9275
  var _b = bestDocumentOrPassport.bbox,
9262
9276
  boundaryX = _b[0],
9263
9277
  boundaryY = _b[1],
@@ -9267,7 +9281,7 @@ var reducer$5 = function reducer(state, action) {
9267
9281
  boundaryWidth *= frameWidth;
9268
9282
  boundaryY *= frameHeight;
9269
9283
  boundaryHeight *= frameHeight;
9270
- documentInBounds = boundaryY > 5 && boundaryY + boundaryHeight + 5 < frameHeight && (boundaryX > 5 || boundaryX < 5 && boundaryX + boundaryWidth > frameWidth * 0.8) && boundaryX + boundaryWidth + 5 < frameWidth;
9284
+ documentInBounds = boundaryY > boundaryPx && boundaryY + boundaryHeight + boundaryPx < frameHeight && (boundaryX > boundaryPx || boundaryX < boundaryPx && boundaryX + boundaryWidth > frameWidth * 0.8) && boundaryX + boundaryWidth + boundaryPx < frameWidth;
9271
9285
  }
9272
9286
  var barcodeScanRequired = state.autoCaptureBarcodeRequired === true || state.autoCaptureBarcodeRequired === 'mobile' && isMobile();
9273
9287
  var shouldScanBarcode = state.barcodeScanningEnabled && pdf417DetectionThresholdMet && barcodeScanRequired;
@@ -9368,6 +9382,8 @@ var IdCapture = function IdCapture(_a) {
9368
9382
  barcodeScanningEnabled = _o === void 0 ? true : _o,
9369
9383
  _p = _a.maxBarcodeScanAttempts,
9370
9384
  maxBarcodeScanAttempts = _p === void 0 ? 10 : _p,
9385
+ guidanceMessage = _a.guidanceMessage,
9386
+ guidanceSatisfied = _a.guidanceSatisfied,
9371
9387
  onPrediction = _a.onPrediction,
9372
9388
  onBarcodeScanned = _a.onBarcodeScanned,
9373
9389
  onCapture = _a.onCapture,
@@ -9602,11 +9618,17 @@ var IdCapture = function IdCapture(_a) {
9602
9618
  }, [getBestFrame, onCapture, processingDelay, shouldCapture, state.barcodeResult]);
9603
9619
  colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = 'white');
9604
9620
  colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = 'green');
9621
+ colors.guidanceMessagesSatisfiedBackgroundColor || (colors.guidanceMessagesSatisfiedBackgroundColor = 'green');
9622
+ colors.guidanceMessagesSatisfiedTextColor || (colors.guidanceMessagesSatisfiedTextColor = 'white');
9605
9623
  var verbiage = useTranslations(rawVerbiage, {
9606
9624
  instructionText: 'Scan the front of ID',
9607
9625
  processingIdCardText: 'ID card front captured.',
9608
9626
  capturingText: 'Capturing...',
9609
- captureFailedText: 'Capture failed!'
9627
+ captureFailedText: 'Capture failed!',
9628
+ guidanceSatisfiedText: 'Document detected, hold still...',
9629
+ guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
9630
+ guidanceNotCenteredText: 'Document is not centered',
9631
+ guidanceNotDetectedText: 'Document not detected'
9610
9632
  });
9611
9633
  var debugScalingDetails = useDebugScalingDetails({
9612
9634
  enabled: debugMode,
@@ -9615,6 +9637,9 @@ var IdCapture = function IdCapture(_a) {
9615
9637
  videoWidth: state.videoWidth,
9616
9638
  videoHeight: state.videoHeight
9617
9639
  });
9640
+ var satisfied = state.isGoodFrame;
9641
+ if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
9642
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
9618
9643
  if (processingFrame) {
9619
9644
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, processingScreen, imageURL && /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
9620
9645
  text: verbiage.processingIdCardText,
@@ -9642,7 +9667,12 @@ var IdCapture = function IdCapture(_a) {
9642
9667
  landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
9643
9668
  isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
9644
9669
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor
9645
- }), debugMode && state.detectedObjects.length > 0 && /*#__PURE__*/React__default['default'].createElement(ObjectDetectionDebugOverlay, {
9670
+ }), guidanceMessage !== '' && /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
9671
+ "$top": "82.5vh"
9672
+ }, /*#__PURE__*/React__default['default'].createElement(GuidanceMessage, {
9673
+ "$background": satisfied ? colors.guidanceMessagesSatisfiedBackgroundColor : colors.guidanceMessagesUnsatisfiedBackgroundColor,
9674
+ "$textColor": satisfied ? colors.guidanceMessagesSatisfiedTextColor : colors.guidanceMessagesUnsatisfiedTextColor
9675
+ }, guidanceMessage)), debugMode && state.detectedObjects.length > 0 && /*#__PURE__*/React__default['default'].createElement(ObjectDetectionDebugOverlay, {
9646
9676
  "$flipX": !((_d = cameraRef.current) === null || _d === void 0 ? void 0 : _d.isRearFacing)
9647
9677
  }, state.detectedObjects.map(function (obj, i) {
9648
9678
  var _a;
@@ -10083,10 +10113,10 @@ var CameraVideoTag = function CameraVideoTag() {
10083
10113
  "$isRearFacing": (_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing
10084
10114
  });
10085
10115
  };
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) {
10116
+ 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
10117
  return props.$isRearFacing ? '' : 'scaleX(-1)';
10088
10118
  });
10089
- var templateObject_1$3;
10119
+ var templateObject_1$2;
10090
10120
 
10091
10121
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
10092
10122
  var _this = this;
@@ -10834,19 +10864,6 @@ var HighPerformanceSelfieGuidanceModelsProvider = function HighPerformanceSelfie
10834
10864
  }, children);
10835
10865
  };
10836
10866
 
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
10867
  var useTimeout = function useTimeout(durationMs, onTimeout, timeoutAverted, shouldWaitLonger) {
10851
10868
  var _a = React.useState(false),
10852
10869
  timedOut = _a[0],
@@ -10959,9 +10976,6 @@ var SelfieCaptureFallback = function SelfieCaptureFallback(_a) {
10959
10976
  onClick: function onClick() {
10960
10977
  setLoading(true);
10961
10978
  onFinished === null || onFinished === void 0 ? void 0 : onFinished(image);
10962
- },
10963
- style: {
10964
- marginLeft: 12
10965
10979
  }
10966
10980
  }, loading ? verbiage.doneBtnLoadingText : verbiage.doneBtnText))));
10967
10981
  };
@@ -11172,9 +11186,9 @@ var SelfieCapture = function SelfieCapture(_a) {
11172
11186
  guidanceMoveForwardText: 'Move forward...',
11173
11187
  guidanceMoveToCenterText: 'Move to the center...'
11174
11188
  });
11175
- guidanceMessage || (guidanceMessage = state.faceReady ? verbiage.guidanceHoldStillText : state.faceLookingAway ? verbiage.guidanceLookStraightText : state.faceTooClose ? verbiage.guidanceMoveBackText : state.faceTooFar ? verbiage.guidanceMoveForwardText : state.faceNotCentered ? verbiage.guidanceMoveToCenterText : '');
11176
11189
  var satisfied = state.faceReady;
11177
11190
  if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
11191
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceHoldStillText : state.faceLookingAway ? verbiage.guidanceLookStraightText : state.faceTooClose ? verbiage.guidanceMoveBackText : state.faceTooFar ? verbiage.guidanceMoveForwardText : state.faceNotCentered ? verbiage.guidanceMoveToCenterText : '');
11178
11192
  if (guidanceError) {
11179
11193
  return /*#__PURE__*/React__default['default'].createElement(SelfieCaptureFallback, null);
11180
11194
  }