idmission-web-sdk 2.3.168 → 2.3.169-feature-barcode-recapture-9469f04
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/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +6 -0
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +32 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +7 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +21 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +776 -229
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +776 -229
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +776 -229
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/package.json +1 -1
|
@@ -504,8 +504,8 @@
|
|
|
504
504
|
var OverlayImageRow = styled.div(templateObject_4$o || (templateObject_4$o = __makeTemplateObject(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100% - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"], ["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100% - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));
|
|
505
505
|
var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$g || (templateObject_5$g = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
|
|
506
506
|
var ButtonsColumn = styled.div(templateObject_6$a || (templateObject_6$a = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
|
|
507
|
-
var WideButton = styled(LoaderButton)(templateObject_7$
|
|
508
|
-
var WideBorderButton = styled(WideButton)(templateObject_8$
|
|
507
|
+
var WideButton = styled(LoaderButton)(templateObject_7$7 || (templateObject_7$7 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
|
|
508
|
+
var WideBorderButton = styled(WideButton)(templateObject_8$6 || (templateObject_8$6 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"], ["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"])), function (props) {
|
|
509
509
|
var _a, _b;
|
|
510
510
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.textColor) !== null && _b !== void 0 ? _b : 'black';
|
|
511
511
|
}, function (props) {
|
|
@@ -515,34 +515,34 @@
|
|
|
515
515
|
var _a, _b;
|
|
516
516
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
|
|
517
517
|
});
|
|
518
|
-
var LoadingOverlayInner = styled(OverlayInner$2)(templateObject_9$
|
|
519
|
-
var LoadingOverlayHeader = styled.div(templateObject_10$
|
|
518
|
+
var LoadingOverlayInner = styled(OverlayInner$2)(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n display: flex;\n flex-direction: column;\n padding: 0;\n"], ["\n position: relative;\n height: 100%;\n display: flex;\n flex-direction: column;\n padding: 0;\n"])));
|
|
519
|
+
var LoadingOverlayHeader = styled.div(templateObject_10$3 || (templateObject_10$3 = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n ", "\n padding-bottom: 0;\n"])), function (props) {
|
|
520
520
|
var _a;
|
|
521
521
|
return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
|
|
522
522
|
}, function (props) {
|
|
523
523
|
return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
|
|
524
524
|
});
|
|
525
|
-
var LoadingOverlayGuidanceMessage = styled(GuidanceMessage)(templateObject_11$
|
|
526
|
-
var LoadingOverlayImageContainer = styled(OverlayImageContainer)(templateObject_12$
|
|
525
|
+
var LoadingOverlayGuidanceMessage = styled(GuidanceMessage)(templateObject_11$3 || (templateObject_11$3 = __makeTemplateObject(["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n"], ["\n padding: 16px 24px;\n margin-top: 16px;\n font-size: 18px;\n font-weight: bold;\n"])));
|
|
526
|
+
var LoadingOverlayImageContainer = styled(OverlayImageContainer)(templateObject_12$3 || (templateObject_12$3 = __makeTemplateObject(["\n padding: 0;\n max-height: 100%;\n pointer-events: none;\n"], ["\n padding: 0;\n max-height: 100%;\n pointer-events: none;\n"])));
|
|
527
527
|
var LoadingOverlayProgressBarBackground = styled.div.attrs({
|
|
528
528
|
className: 'loading-overlay-progress-bar-background'
|
|
529
|
-
})(templateObject_13$
|
|
529
|
+
})(templateObject_13$3 || (templateObject_13$3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
|
|
530
530
|
var LoadingOverlayProgressBar = styled.span.attrs({
|
|
531
531
|
className: 'loading-overlay-progress-bar'
|
|
532
|
-
})(templateObject_14$
|
|
532
|
+
})(templateObject_14$2 || (templateObject_14$2 = __makeTemplateObject(["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n"], ["\n display: block;\n width: ", "%;\n height: 100%;\n left: 0;\n top: 0;\n position: absolute;\n"])), function (props) {
|
|
533
533
|
return props.$progress;
|
|
534
534
|
});
|
|
535
535
|
var LoadingOverlayProgressIndicator = styled.span.attrs({
|
|
536
536
|
className: 'loading-overlay-progress-indicator'
|
|
537
|
-
})(templateObject_15$
|
|
538
|
-
var LoadingOverlayButtonsRow = styled(ButtonsRow$2)(templateObject_16$
|
|
539
|
-
var LoadingOverlayLoadingListContainer = styled.div(templateObject_17$
|
|
540
|
-
var LoadingOverlayLoadingList = styled.ul(templateObject_18$
|
|
541
|
-
var LoadingOverlayLoadingListItem = styled.li(templateObject_19$
|
|
542
|
-
var LoadingOverlayProgressContainer = styled.div(templateObject_20$
|
|
543
|
-
var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21$
|
|
544
|
-
var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22$
|
|
545
|
-
var templateObject_1$N, templateObject_2$I, templateObject_3$u, templateObject_4$o, templateObject_5$g, templateObject_6$a, templateObject_7$
|
|
537
|
+
})(templateObject_15$2 || (templateObject_15$2 = __makeTemplateObject(["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"], ["\n display: block;\n height: 100%;\n animation: ", " 3s ease-in-out;\n animation-fill-mode: both;\n"])), progressBarAnimation);
|
|
538
|
+
var LoadingOverlayButtonsRow = styled(ButtonsRow$2)(templateObject_16$2 || (templateObject_16$2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n min-height: 100px;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n"], ["\n display: flex;\n flex-direction: row;\n padding: 15px 25px;\n min-height: 100px;\n width: 100%;\n box-sizing: border-box;\n position: relative;\n"])));
|
|
539
|
+
var LoadingOverlayLoadingListContainer = styled.div(templateObject_17$2 || (templateObject_17$2 = __makeTemplateObject(["\n display: flex;\n position: relative;\n z-index: 2;\n"], ["\n display: flex;\n position: relative;\n z-index: 2;\n"])));
|
|
540
|
+
var LoadingOverlayLoadingList = styled.ul(templateObject_18$2 || (templateObject_18$2 = __makeTemplateObject(["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"], ["\n display: block;\n margin: auto;\n list-style: none;\n padding: 0;\n"])));
|
|
541
|
+
var LoadingOverlayLoadingListItem = styled.li(templateObject_19$2 || (templateObject_19$2 = __makeTemplateObject(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n"], ["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n padding: 2px 1.25rem 2px 0;\n line-height: 1rem;\n"])));
|
|
542
|
+
var LoadingOverlayProgressContainer = styled.div(templateObject_20$2 || (templateObject_20$2 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
|
|
543
|
+
var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21$2 || (templateObject_21$2 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
|
|
544
|
+
var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22$2 || (templateObject_22$2 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
545
|
+
var templateObject_1$N, templateObject_2$I, templateObject_3$u, templateObject_4$o, templateObject_5$g, templateObject_6$a, templateObject_7$7, templateObject_8$6, templateObject_9$4, templateObject_10$3, templateObject_11$3, templateObject_12$3, templateObject_13$3, templateObject_14$2, templateObject_15$2, templateObject_16$2, templateObject_17$2, templateObject_18$2, templateObject_19$2, templateObject_20$2, templateObject_21$2, templateObject_22$2;
|
|
546
546
|
|
|
547
547
|
function _extends() {
|
|
548
548
|
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
@@ -13409,8 +13409,13 @@
|
|
|
13409
13409
|
if (!selectedVideoStreamId) return;
|
|
13410
13410
|
var srcObject = e.currentTarget.srcObject;
|
|
13411
13411
|
if (srcObject.id === selectedVideoStreamId) {
|
|
13412
|
+
var _a = e.currentTarget,
|
|
13413
|
+
videoWidth = _a.videoWidth,
|
|
13414
|
+
videoHeight = _a.videoHeight;
|
|
13412
13415
|
set({
|
|
13413
|
-
videoLoaded: true
|
|
13416
|
+
videoLoaded: true,
|
|
13417
|
+
videoWidth: videoWidth,
|
|
13418
|
+
videoHeight: videoHeight
|
|
13414
13419
|
});
|
|
13415
13420
|
} else {
|
|
13416
13421
|
set({
|
|
@@ -13723,26 +13728,25 @@
|
|
|
13723
13728
|
};
|
|
13724
13729
|
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
13725
13730
|
function CameraStoreProvider(_a) {
|
|
13726
|
-
var _b;
|
|
13727
13731
|
var children = _a.children,
|
|
13728
|
-
|
|
13729
|
-
requestAccessAutomatically =
|
|
13730
|
-
|
|
13731
|
-
preferIphoneContinuityCamera =
|
|
13732
|
-
|
|
13733
|
-
preferFrontFacingCamera =
|
|
13734
|
-
|
|
13735
|
-
maxVideoWidth =
|
|
13732
|
+
_b = _a.requestAccessAutomatically,
|
|
13733
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
13734
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
13735
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
13736
|
+
_d = _a.preferFrontFacingCamera,
|
|
13737
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
13738
|
+
_e = _a.maxVideoWidth,
|
|
13739
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
13736
13740
|
maxFps = _a.maxFps,
|
|
13737
13741
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
13738
13742
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
13739
13743
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
13740
|
-
|
|
13741
|
-
requireMicrophoneAccess =
|
|
13742
|
-
|
|
13743
|
-
classNames =
|
|
13744
|
-
|
|
13745
|
-
verbiage =
|
|
13744
|
+
_f = _a.requireMicrophoneAccess,
|
|
13745
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
13746
|
+
_g = _a.classNames,
|
|
13747
|
+
classNames = _g === void 0 ? {} : _g,
|
|
13748
|
+
_h = _a.verbiage,
|
|
13749
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
13746
13750
|
var videoRef = React.useRef(null);
|
|
13747
13751
|
var store = React.useRef(undefined);
|
|
13748
13752
|
store.current || (store.current = createCameraStore({
|
|
@@ -13756,16 +13760,6 @@
|
|
|
13756
13760
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
13757
13761
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
13758
13762
|
}));
|
|
13759
|
-
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
13760
|
-
videoWidth = _k.videoWidth,
|
|
13761
|
-
videoHeight = _k.videoHeight;
|
|
13762
|
-
React.useEffect(function () {
|
|
13763
|
-
var _a;
|
|
13764
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
13765
|
-
videoWidth: videoWidth,
|
|
13766
|
-
videoHeight: videoHeight
|
|
13767
|
-
});
|
|
13768
|
-
}, [videoWidth, videoHeight]);
|
|
13769
13763
|
React.useEffect(function () {
|
|
13770
13764
|
var _a, _b, _c;
|
|
13771
13765
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -14844,6 +14838,15 @@
|
|
|
14844
14838
|
getBestBarcode: function getBestBarcode() {
|
|
14845
14839
|
return null;
|
|
14846
14840
|
},
|
|
14841
|
+
startBarcodeRecapturePhase: function startBarcodeRecapturePhase() {
|
|
14842
|
+
return null;
|
|
14843
|
+
},
|
|
14844
|
+
getInitialCaptureBestBarcode: function getInitialCaptureBestBarcode() {
|
|
14845
|
+
return null;
|
|
14846
|
+
},
|
|
14847
|
+
getRecaptureBestBarcode: function getRecaptureBestBarcode() {
|
|
14848
|
+
return null;
|
|
14849
|
+
},
|
|
14847
14850
|
requiredDocumentType: 'none',
|
|
14848
14851
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
14849
14852
|
return null;
|
|
@@ -14903,6 +14906,14 @@
|
|
|
14903
14906
|
var bestBarcodeScore = React.useRef(0);
|
|
14904
14907
|
var stopDetection = React.useRef(0);
|
|
14905
14908
|
var analyzeBarcodeReadability = useBarcodeReadabilityAnalysis();
|
|
14909
|
+
// Barcode recapture tracking - separate canvases for initial and recapture sequences
|
|
14910
|
+
var initialCaptureBarcodeCanvas = React.useRef(null);
|
|
14911
|
+
var initialCaptureBarcodeDetails = React.useRef(null);
|
|
14912
|
+
var initialCaptureBarcodeScore = React.useRef(0);
|
|
14913
|
+
var recaptureBarcodeCanvas = React.useRef(null);
|
|
14914
|
+
var recaptureBarcodeDetails = React.useRef(null);
|
|
14915
|
+
var recaptureBarcodeScore = React.useRef(0);
|
|
14916
|
+
var isRecapturePhase = React.useRef(false);
|
|
14906
14917
|
var _h = React.useState('none'),
|
|
14907
14918
|
requiredDocumentType = _h[0],
|
|
14908
14919
|
setRequiredDocumentType = _h[1];
|
|
@@ -14927,10 +14938,10 @@
|
|
|
14927
14938
|
var _this = this;
|
|
14928
14939
|
onDocumentDetected(function (prediction) {
|
|
14929
14940
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14930
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
14931
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14932
|
-
return __generator(this, function (
|
|
14933
|
-
switch (
|
|
14941
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, isInRecapturePhase, shouldRunBarcodeAnalysisDuringRecapture, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult, ctx, barcodeAnalysisResult, ctx;
|
|
14942
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14943
|
+
return __generator(this, function (_k) {
|
|
14944
|
+
switch (_k.label) {
|
|
14934
14945
|
case 0:
|
|
14935
14946
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
14936
14947
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -14944,7 +14955,9 @@
|
|
|
14944
14955
|
prediction.singlePageDetectionThresholdMet = false;
|
|
14945
14956
|
}
|
|
14946
14957
|
isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
|
|
14947
|
-
|
|
14958
|
+
isInRecapturePhase = isRecapturePhase.current;
|
|
14959
|
+
shouldRunBarcodeAnalysisDuringRecapture = isInRecapturePhase && isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentIsStable && prediction.bestDocument && prediction.bestPDF417;
|
|
14960
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 3];
|
|
14948
14961
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
14949
14962
|
if (focusPrediction) {
|
|
14950
14963
|
focusScore = focusPrediction.score;
|
|
@@ -14967,7 +14980,7 @@
|
|
|
14967
14980
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
14968
14981
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
14969
14982
|
case 1:
|
|
14970
|
-
barcodeAnalysisResult =
|
|
14983
|
+
barcodeAnalysisResult = _k.sent();
|
|
14971
14984
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
14972
14985
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
14973
14986
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -14977,15 +14990,61 @@
|
|
|
14977
14990
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
14978
14991
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
14979
14992
|
}
|
|
14980
|
-
|
|
14993
|
+
// During recapture phase, also track best barcode separately for recapture sequence
|
|
14994
|
+
if (isRecapturePhase.current && recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
14995
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
14996
|
+
recaptureBarcodeDetails.current = (_g = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _g !== void 0 ? _g : null;
|
|
14997
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
14998
|
+
if (bestBarcodeCanvas.current) {
|
|
14999
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
15000
|
+
if (ctx) {
|
|
15001
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15002
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15003
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15004
|
+
}
|
|
15005
|
+
}
|
|
15006
|
+
}
|
|
15007
|
+
_k.label = 2;
|
|
14981
15008
|
case 2:
|
|
15009
|
+
return [3 /*break*/, 5];
|
|
15010
|
+
case 3:
|
|
15011
|
+
if (!shouldRunBarcodeAnalysisDuringRecapture) return [3 /*break*/, 5];
|
|
15012
|
+
if (!(enableBarcodeReadabilityModel && croppedDocumentCanvas.current && stopDetectionAtStart === stopDetection.current)) return [3 /*break*/, 5];
|
|
15013
|
+
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
15014
|
+
case 4:
|
|
15015
|
+
barcodeAnalysisResult = _k.sent();
|
|
15016
|
+
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
15017
|
+
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
15018
|
+
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
15019
|
+
if (barcodeAnalysisResult.newBestBarcodeScore) {
|
|
15020
|
+
bestBarcodeScore.current = barcodeAnalysisResult.newBestBarcodeScore;
|
|
15021
|
+
}
|
|
15022
|
+
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
15023
|
+
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
15024
|
+
}
|
|
15025
|
+
// Track best barcode separately for recapture sequence
|
|
15026
|
+
if (recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
15027
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
15028
|
+
recaptureBarcodeDetails.current = (_h = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _h !== void 0 ? _h : null;
|
|
15029
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
15030
|
+
if (bestBarcodeCanvas.current) {
|
|
15031
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
15032
|
+
if (ctx) {
|
|
15033
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15034
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15035
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15036
|
+
}
|
|
15037
|
+
}
|
|
15038
|
+
}
|
|
15039
|
+
_k.label = 5;
|
|
15040
|
+
case 5:
|
|
14982
15041
|
/**
|
|
14983
15042
|
* @note
|
|
14984
15043
|
* This should ALWAYS be called.
|
|
14985
15044
|
* Do not return early from this function unless
|
|
14986
15045
|
* lastPredictionCanvas.current is not set
|
|
14987
15046
|
*/
|
|
14988
|
-
(
|
|
15047
|
+
(_j = onPredictionHandler.current) === null || _j === void 0 ? void 0 : _j.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
14989
15048
|
focusScore: focusScore,
|
|
14990
15049
|
focusPredictionTime: focusPredictionTime,
|
|
14991
15050
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -15018,19 +15077,58 @@
|
|
|
15018
15077
|
canvas: bestBarcodeCanvas.current
|
|
15019
15078
|
});
|
|
15020
15079
|
}, []);
|
|
15080
|
+
var startBarcodeRecapturePhase = React.useCallback(function () {
|
|
15081
|
+
// Snapshot current best barcode to initial capture canvas
|
|
15082
|
+
if (bestBarcodeCanvas.current && initialCaptureBarcodeCanvas.current) {
|
|
15083
|
+
var ctx = initialCaptureBarcodeCanvas.current.getContext('2d');
|
|
15084
|
+
if (ctx) {
|
|
15085
|
+
initialCaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15086
|
+
initialCaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15087
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15088
|
+
}
|
|
15089
|
+
}
|
|
15090
|
+
initialCaptureBarcodeDetails.current = bestBarcodeDetails.current ? _assign({}, bestBarcodeDetails.current) : null;
|
|
15091
|
+
initialCaptureBarcodeScore.current = bestBarcodeScore.current;
|
|
15092
|
+
// Reset recapture tracking
|
|
15093
|
+
recaptureBarcodeScore.current = 0;
|
|
15094
|
+
recaptureBarcodeDetails.current = null;
|
|
15095
|
+
// Enter recapture phase
|
|
15096
|
+
isRecapturePhase.current = true;
|
|
15097
|
+
}, []);
|
|
15098
|
+
var getInitialCaptureBestBarcode = React.useCallback(function () {
|
|
15099
|
+
if (!initialCaptureBarcodeDetails.current || !initialCaptureBarcodeCanvas.current) return null;
|
|
15100
|
+
return _assign(_assign({}, initialCaptureBarcodeDetails.current), {
|
|
15101
|
+
canvas: initialCaptureBarcodeCanvas.current
|
|
15102
|
+
});
|
|
15103
|
+
}, []);
|
|
15104
|
+
var getRecaptureBestBarcode = React.useCallback(function () {
|
|
15105
|
+
if (!recaptureBarcodeDetails.current || !recaptureBarcodeCanvas.current) return null;
|
|
15106
|
+
return _assign(_assign({}, recaptureBarcodeDetails.current), {
|
|
15107
|
+
canvas: recaptureBarcodeCanvas.current
|
|
15108
|
+
});
|
|
15109
|
+
}, []);
|
|
15021
15110
|
var _j = React.useState(0),
|
|
15022
15111
|
canvasKey = _j[0],
|
|
15023
15112
|
setCanvasKey = _j[1];
|
|
15024
15113
|
var resetBestFrame = React.useCallback(function () {
|
|
15114
|
+
// During recapture phase, preserve all canvas state to avoid race conditions
|
|
15115
|
+
// that could result in black/empty barcode images on slow devices
|
|
15116
|
+
if (isRecapturePhase.current) {
|
|
15117
|
+
return;
|
|
15118
|
+
}
|
|
15025
15119
|
stopDetection.current += 1;
|
|
15026
|
-
setCanvasKey(function (n) {
|
|
15027
|
-
return n + 1;
|
|
15028
|
-
});
|
|
15029
15120
|
clearDocumentDetectionLastPredictionCanvas();
|
|
15030
15121
|
bestFrameDetails.current = null;
|
|
15031
15122
|
bestFocusScore.current = 0;
|
|
15032
15123
|
bestBarcodeScore.current = 0;
|
|
15033
15124
|
bestBarcodeDetails.current = null;
|
|
15125
|
+
setCanvasKey(function (n) {
|
|
15126
|
+
return n + 1;
|
|
15127
|
+
});
|
|
15128
|
+
initialCaptureBarcodeScore.current = 0;
|
|
15129
|
+
initialCaptureBarcodeDetails.current = null;
|
|
15130
|
+
recaptureBarcodeScore.current = 0;
|
|
15131
|
+
recaptureBarcodeDetails.current = null;
|
|
15034
15132
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
15035
15133
|
React.useEffect(function () {
|
|
15036
15134
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -15096,10 +15194,13 @@
|
|
|
15096
15194
|
bestFrameDetails: bestFrameDetails,
|
|
15097
15195
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
15098
15196
|
getBestBarcode: getBestBarcode,
|
|
15197
|
+
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
15198
|
+
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
15199
|
+
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
15099
15200
|
requiredDocumentType: requiredDocumentType,
|
|
15100
15201
|
setRequiredDocumentType: setRequiredDocumentType
|
|
15101
15202
|
};
|
|
15102
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
15203
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, startBarcodeRecapturePhase, getInitialCaptureBestBarcode, getRecaptureBestBarcode, requiredDocumentType]);
|
|
15103
15204
|
return /*#__PURE__*/React.createElement(IdCaptureModelsContext.Provider, {
|
|
15104
15205
|
value: value
|
|
15105
15206
|
}, /*#__PURE__*/React.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -15111,6 +15212,12 @@
|
|
|
15111
15212
|
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15112
15213
|
key: "cd-".concat(canvasKey),
|
|
15113
15214
|
ref: croppedDocumentCanvas
|
|
15215
|
+
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15216
|
+
key: "icb-".concat(canvasKey),
|
|
15217
|
+
ref: initialCaptureBarcodeCanvas
|
|
15218
|
+
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15219
|
+
key: "rcb-".concat(canvasKey),
|
|
15220
|
+
ref: recaptureBarcodeCanvas
|
|
15114
15221
|
})), children);
|
|
15115
15222
|
}
|
|
15116
15223
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -15568,6 +15675,8 @@
|
|
|
15568
15675
|
singlePageDetectionThresholdMet: false,
|
|
15569
15676
|
focusScore: 0,
|
|
15570
15677
|
focusThresholdMet: false,
|
|
15678
|
+
pdf417PredictionScore: 0,
|
|
15679
|
+
pdf417PredictionThresholdMet: false,
|
|
15571
15680
|
isGoodFrame: false,
|
|
15572
15681
|
goodFramesCount: 0,
|
|
15573
15682
|
goodFramesThreshold: 3,
|
|
@@ -15589,30 +15698,42 @@
|
|
|
15589
15698
|
uploadingDocumentsType: null,
|
|
15590
15699
|
operationStartedAt: null,
|
|
15591
15700
|
captureStartedAt: null,
|
|
15701
|
+
barcodeRecaptureStartedAt: null,
|
|
15702
|
+
initialBarcodeScore: 0,
|
|
15703
|
+
recaptureBarcodeScore: null,
|
|
15704
|
+
barcodeRecaptureThreshold: 0,
|
|
15705
|
+
barcodeRecaptureTimeoutMs: 5000,
|
|
15706
|
+
initialCaptureBarcodeImage: null,
|
|
15707
|
+
recaptureBarcodeImage: null,
|
|
15592
15708
|
dispatch: function dispatch() {
|
|
15593
15709
|
return null;
|
|
15594
15710
|
}
|
|
15595
15711
|
};
|
|
15596
15712
|
var _reducer = function reducer(state, action) {
|
|
15597
15713
|
var _a;
|
|
15714
|
+
var _b, _c;
|
|
15598
15715
|
switch (action.type) {
|
|
15599
15716
|
case 'configureWizard':
|
|
15600
15717
|
{
|
|
15601
|
-
var
|
|
15602
|
-
captureRequirement =
|
|
15603
|
-
precapturedDocuments =
|
|
15604
|
-
allowSinglePageIdCapture =
|
|
15605
|
-
allowIdCardBackToFrontCapture =
|
|
15606
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
15607
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
15608
|
-
allowUploadingDocumentsFromStorage =
|
|
15718
|
+
var _d = action.payload,
|
|
15719
|
+
captureRequirement = _d.captureRequirement,
|
|
15720
|
+
precapturedDocuments = _d.precapturedDocuments,
|
|
15721
|
+
allowSinglePageIdCapture = _d.allowSinglePageIdCapture,
|
|
15722
|
+
allowIdCardBackToFrontCapture = _d.allowIdCardBackToFrontCapture,
|
|
15723
|
+
enableOverrideWrongDocumentTypeDialog = _d.enableOverrideWrongDocumentTypeDialog,
|
|
15724
|
+
allowOverrideWrongDocumentTypeAfterMs = _d.allowOverrideWrongDocumentTypeAfterMs,
|
|
15725
|
+
allowUploadingDocumentsFromStorage = _d.allowUploadingDocumentsFromStorage,
|
|
15726
|
+
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
15727
|
+
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
15609
15728
|
var newState = _assign(_assign({}, state), {
|
|
15610
15729
|
captureRequirement: captureRequirement,
|
|
15611
15730
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
15612
15731
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
15613
15732
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
15614
15733
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
15615
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
15734
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
15735
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
15736
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
15616
15737
|
});
|
|
15617
15738
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
15618
15739
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -15669,26 +15790,28 @@
|
|
|
15669
15790
|
});
|
|
15670
15791
|
case 'objectsDetected':
|
|
15671
15792
|
{
|
|
15672
|
-
var
|
|
15673
|
-
detectedObjects =
|
|
15674
|
-
detectionThresholdMet =
|
|
15675
|
-
detectedDocumentType =
|
|
15676
|
-
idCardFrontDetectionScore =
|
|
15677
|
-
idCardFrontDetectionThresholdMet =
|
|
15678
|
-
idCardBackDetectionScore =
|
|
15679
|
-
idCardBackDetectionThresholdMet =
|
|
15680
|
-
passportDetectionScore =
|
|
15681
|
-
passportDetectionThresholdMet =
|
|
15682
|
-
singlePageDetectionScore =
|
|
15683
|
-
singlePageDetectionThresholdMet =
|
|
15684
|
-
bestDocument =
|
|
15685
|
-
documentInBounds =
|
|
15686
|
-
documentTooClose =
|
|
15687
|
-
documentIsStable =
|
|
15688
|
-
focusScore =
|
|
15689
|
-
focusThresholdMet =
|
|
15690
|
-
|
|
15691
|
-
|
|
15793
|
+
var _e = action.payload.prediction,
|
|
15794
|
+
detectedObjects = _e.detectedObjects,
|
|
15795
|
+
detectionThresholdMet = _e.detectionThresholdMet,
|
|
15796
|
+
detectedDocumentType = _e.detectedDocumentType,
|
|
15797
|
+
idCardFrontDetectionScore = _e.idCardFrontDetectionScore,
|
|
15798
|
+
idCardFrontDetectionThresholdMet = _e.idCardFrontDetectionThresholdMet,
|
|
15799
|
+
idCardBackDetectionScore = _e.idCardBackDetectionScore,
|
|
15800
|
+
idCardBackDetectionThresholdMet = _e.idCardBackDetectionThresholdMet,
|
|
15801
|
+
passportDetectionScore = _e.passportDetectionScore,
|
|
15802
|
+
passportDetectionThresholdMet = _e.passportDetectionThresholdMet,
|
|
15803
|
+
singlePageDetectionScore = _e.singlePageDetectionScore,
|
|
15804
|
+
singlePageDetectionThresholdMet = _e.singlePageDetectionThresholdMet,
|
|
15805
|
+
bestDocument = _e.bestDocument,
|
|
15806
|
+
documentInBounds = _e.documentInBounds,
|
|
15807
|
+
documentTooClose = _e.documentTooClose,
|
|
15808
|
+
documentIsStable = _e.documentIsStable,
|
|
15809
|
+
focusScore = _e.focusScore,
|
|
15810
|
+
focusThresholdMet = _e.focusThresholdMet,
|
|
15811
|
+
pdf417PredictionScore = _e.pdf417PredictionScore,
|
|
15812
|
+
pdf417PredictionThresholdMet = _e.pdf417PredictionThresholdMet,
|
|
15813
|
+
frameWidth = _e.frameWidth,
|
|
15814
|
+
frameHeight = _e.frameHeight;
|
|
15692
15815
|
var frameCapturedAt = new Date();
|
|
15693
15816
|
var frameCaptureRate = 0;
|
|
15694
15817
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -15768,6 +15891,8 @@
|
|
|
15768
15891
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
15769
15892
|
focusScore: focusScore,
|
|
15770
15893
|
focusThresholdMet: focusThresholdMet,
|
|
15894
|
+
pdf417PredictionScore: pdf417PredictionScore,
|
|
15895
|
+
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
15771
15896
|
isGoodFrame: isGoodFrame,
|
|
15772
15897
|
goodFramesCount: goodFramesCount,
|
|
15773
15898
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -15821,7 +15946,18 @@
|
|
|
15821
15946
|
});
|
|
15822
15947
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
15823
15948
|
if (remainingRequirements.length === 0) {
|
|
15824
|
-
|
|
15949
|
+
// Check if we just captured ID back and need barcode recapture
|
|
15950
|
+
var justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
15951
|
+
var barcodeScore = (_c = (_b = state.capturedDocuments.idBarcodeImage) === null || _b === void 0 ? void 0 : _b.barcodeReadabilityScore) !== null && _c !== void 0 ? _c : 0;
|
|
15952
|
+
var needsBarcodeRecapture = justCapturedIdBack && state.barcodeRecaptureThreshold > 0 && barcodeScore < state.barcodeRecaptureThreshold;
|
|
15953
|
+
if (needsBarcodeRecapture) {
|
|
15954
|
+
// Skip 'complete' and go directly to barcode recapture
|
|
15955
|
+
newState.captureState = 'requestingBetterBarcode';
|
|
15956
|
+
newState.barcodeRecaptureStartedAt = new Date();
|
|
15957
|
+
newState.initialBarcodeScore = barcodeScore;
|
|
15958
|
+
} else {
|
|
15959
|
+
newState.captureState = 'complete';
|
|
15960
|
+
}
|
|
15825
15961
|
} else {
|
|
15826
15962
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
15827
15963
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -15848,8 +15984,8 @@
|
|
|
15848
15984
|
case 'documentsCaptured':
|
|
15849
15985
|
{
|
|
15850
15986
|
var newState = _assign({}, state);
|
|
15851
|
-
for (var
|
|
15852
|
-
var doc =
|
|
15987
|
+
for (var _f = 0, _g = action.payload; _f < _g.length; _f++) {
|
|
15988
|
+
var doc = _g[_f];
|
|
15853
15989
|
newState = _reducer(newState, {
|
|
15854
15990
|
type: 'documentCaptured',
|
|
15855
15991
|
payload: doc
|
|
@@ -15899,13 +16035,49 @@
|
|
|
15899
16035
|
requestedDocumentType: requestedDocumentType
|
|
15900
16036
|
});
|
|
15901
16037
|
}
|
|
16038
|
+
case 'barcodeRecaptureStarted':
|
|
16039
|
+
return _assign(_assign({}, state), {
|
|
16040
|
+
captureState: 'requestingBetterBarcode',
|
|
16041
|
+
barcodeRecaptureStartedAt: new Date(),
|
|
16042
|
+
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
16043
|
+
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
16044
|
+
recaptureBarcodeScore: null,
|
|
16045
|
+
recaptureBarcodeImage: null,
|
|
16046
|
+
goodFramesCount: 0,
|
|
16047
|
+
capturing: false
|
|
16048
|
+
});
|
|
16049
|
+
case 'barcodeRecaptureScoreUpdated':
|
|
16050
|
+
return _assign(_assign({}, state), {
|
|
16051
|
+
recaptureBarcodeScore: action.payload.recaptureBarcodeScore
|
|
16052
|
+
});
|
|
16053
|
+
case 'recaptureBarcodeImageCaptured':
|
|
16054
|
+
return _assign(_assign({}, state), {
|
|
16055
|
+
recaptureBarcodeImage: action.payload.recaptureBarcodeImage
|
|
16056
|
+
});
|
|
16057
|
+
case 'barcodeRecaptureCompleted':
|
|
16058
|
+
return _assign(_assign({}, state), {
|
|
16059
|
+
captureState: 'complete',
|
|
16060
|
+
barcodeRecaptureStartedAt: null
|
|
16061
|
+
});
|
|
15902
16062
|
case 'resetWizard':
|
|
15903
16063
|
return _assign(_assign({}, initialState$5), {
|
|
15904
16064
|
dispatch: state.dispatch,
|
|
16065
|
+
// Preserve all configuration values
|
|
16066
|
+
captureRequirement: state.captureRequirement,
|
|
16067
|
+
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
16068
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
16069
|
+
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
16070
|
+
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
15905
16071
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
16072
|
+
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
16073
|
+
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
16074
|
+
// Reset capture-specific state
|
|
15906
16075
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
15907
|
-
|
|
15908
|
-
|
|
16076
|
+
barcodeRecaptureStartedAt: null,
|
|
16077
|
+
initialBarcodeScore: 0,
|
|
16078
|
+
recaptureBarcodeScore: null,
|
|
16079
|
+
initialCaptureBarcodeImage: null,
|
|
16080
|
+
recaptureBarcodeImage: null
|
|
15909
16081
|
});
|
|
15910
16082
|
default:
|
|
15911
16083
|
return state;
|
|
@@ -16337,36 +16509,36 @@
|
|
|
16337
16509
|
}
|
|
16338
16510
|
|
|
16339
16511
|
var IdCapture = function IdCapture(_a) {
|
|
16340
|
-
var _b, _c, _d, _e, _f, _g;
|
|
16512
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16341
16513
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
16342
|
-
|
|
16343
|
-
thresholds =
|
|
16514
|
+
_k = _a.thresholds,
|
|
16515
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
16344
16516
|
guidanceMessage = _a.guidanceMessage,
|
|
16345
16517
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
16346
16518
|
onCapture = _a.onCapture,
|
|
16347
|
-
|
|
16348
|
-
classNames =
|
|
16349
|
-
|
|
16350
|
-
colors =
|
|
16351
|
-
|
|
16352
|
-
rawVerbiage =
|
|
16353
|
-
|
|
16354
|
-
debugMode =
|
|
16355
|
-
var
|
|
16356
|
-
ref =
|
|
16357
|
-
|
|
16358
|
-
width =
|
|
16359
|
-
|
|
16360
|
-
height =
|
|
16519
|
+
_l = _a.classNames,
|
|
16520
|
+
classNames = _l === void 0 ? {} : _l,
|
|
16521
|
+
_m = _a.colors,
|
|
16522
|
+
colors = _m === void 0 ? {} : _m,
|
|
16523
|
+
_o = _a.verbiage,
|
|
16524
|
+
rawVerbiage = _o === void 0 ? {} : _o,
|
|
16525
|
+
_p = _a.debugMode,
|
|
16526
|
+
debugMode = _p === void 0 ? false : _p;
|
|
16527
|
+
var _q = useResizeObserver(),
|
|
16528
|
+
ref = _q.ref,
|
|
16529
|
+
_r = _q.width,
|
|
16530
|
+
width = _r === void 0 ? 1 : _r,
|
|
16531
|
+
_s = _q.height,
|
|
16532
|
+
height = _s === void 0 ? 1 : _s;
|
|
16361
16533
|
var state = useIdCaptureStore();
|
|
16362
16534
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
16363
|
-
var
|
|
16364
|
-
modelsReady =
|
|
16365
|
-
setThresholds =
|
|
16366
|
-
detectionTime =
|
|
16367
|
-
focusPredictionTime =
|
|
16368
|
-
getBestFrame =
|
|
16369
|
-
getBestBarcode =
|
|
16535
|
+
var _t = useIdCaptureModelsContext(),
|
|
16536
|
+
modelsReady = _t.ready,
|
|
16537
|
+
setThresholds = _t.setThresholds,
|
|
16538
|
+
detectionTime = _t.detectionTime,
|
|
16539
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
16540
|
+
getBestFrame = _t.getBestFrame,
|
|
16541
|
+
getBestBarcode = _t.getBestBarcode;
|
|
16370
16542
|
React.useEffect(function () {
|
|
16371
16543
|
return dispatchIdCaptureAction({
|
|
16372
16544
|
type: 'captureInitialized'
|
|
@@ -16391,7 +16563,7 @@
|
|
|
16391
16563
|
}
|
|
16392
16564
|
});
|
|
16393
16565
|
}, [height, width]);
|
|
16394
|
-
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
16566
|
+
var shouldCapture = state.captureState === 'capturing' && state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
16395
16567
|
React.useEffect(function () {
|
|
16396
16568
|
if (!shouldCapture) return;
|
|
16397
16569
|
dispatchIdCaptureAction({
|
|
@@ -16491,13 +16663,18 @@
|
|
|
16491
16663
|
"$flipX": !isRearFacing,
|
|
16492
16664
|
scaling: debugScalingDetails
|
|
16493
16665
|
}, state.detectedObjects.map(function (obj, i) {
|
|
16666
|
+
// During barcode recapture, render PDF417 barcodes with green color
|
|
16667
|
+
var isBarcodeRecapture = state.captureState === 'requestingBetterBarcode';
|
|
16668
|
+
var isBarcode = obj.label === 'PDF417';
|
|
16669
|
+
var color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
16494
16670
|
return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
16495
16671
|
key: i,
|
|
16496
16672
|
obj: obj,
|
|
16497
16673
|
scaling: debugScalingDetails,
|
|
16498
|
-
flipX: !isRearFacing
|
|
16674
|
+
flipX: !isRearFacing,
|
|
16675
|
+
color: color
|
|
16499
16676
|
});
|
|
16500
|
-
}))), debugMode && (/*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? (/*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : (/*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
16677
|
+
}))), debugMode && (/*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React.createElement("br", null), modelsReady ? (/*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.pdf417PredictionThresholdMet ? '✅' : '❌', " Current Barcode Score: ", state.pdf417PredictionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), getBestBarcode() ? '✅' : '❌', " Best Barcode Score:", ' ', (_j = (_h = getBestBarcode()) === null || _h === void 0 ? void 0 : _h.score.toFixed(3)) !== null && _j !== void 0 ? _j : 'N/A', /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : (/*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
|
|
16501
16678
|
};
|
|
16502
16679
|
var timeSince = function timeSince(t) {
|
|
16503
16680
|
if (!t) return 0;
|
|
@@ -17392,11 +17569,11 @@
|
|
|
17392
17569
|
var _a, _b, _c, _d;
|
|
17393
17570
|
return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarBackgroundOpacity) !== null && _d !== void 0 ? _d : 0.75;
|
|
17394
17571
|
});
|
|
17395
|
-
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
17572
|
+
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
17396
17573
|
var _a, _b, _c, _d;
|
|
17397
17574
|
return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarIndicatorColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-primary-500)';
|
|
17398
17575
|
});
|
|
17399
|
-
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$
|
|
17576
|
+
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$5 || (templateObject_8$5 = __makeTemplateObject(["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n \n &:focus-visible {\n ", "\n box-shadow: none;\n }\n\n &.disabled {\n background: ", ";\n color: ", ";\n border: ", ";\n }\n"], ["\n margin: auto;\n white-space: nowrap;\n ", "\n ", "\n \n &:focus-visible {\n ", "\n box-shadow: none;\n }\n\n &.disabled {\n background: ", ";\n color: ", ";\n border: ", ";\n }\n"])), function (props) {
|
|
17400
17577
|
var _a, _b, _c, _d, _e, _f;
|
|
17401
17578
|
return ((_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarFontSize) ? "font-size: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.idCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.progressBarFontSize, ";") : '';
|
|
17402
17579
|
}, function (props) {
|
|
@@ -17415,7 +17592,7 @@
|
|
|
17415
17592
|
var _a, _b, _c, _d;
|
|
17416
17593
|
return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.continueBtnDisabledBorder) !== null && _d !== void 0 ? _d : 'none';
|
|
17417
17594
|
});
|
|
17418
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
17595
|
+
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$6, templateObject_8$5;
|
|
17419
17596
|
|
|
17420
17597
|
var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
|
|
17421
17598
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -17602,6 +17779,14 @@
|
|
|
17602
17779
|
var templateObject_1$D, templateObject_2$z;
|
|
17603
17780
|
|
|
17604
17781
|
var imageDisplayOrder = ['idCardFront', 'idCardBack', 'idBarcodeImage', 'passport', 'singlePage', 'idFrontIrImage', 'idBackIrImage', 'idFrontUvImage', 'idBackUvImage'];
|
|
17782
|
+
var downloadImage = function downloadImage(dataUrl, filename) {
|
|
17783
|
+
var link = document.createElement('a');
|
|
17784
|
+
link.href = dataUrl;
|
|
17785
|
+
link.download = filename;
|
|
17786
|
+
document.body.appendChild(link);
|
|
17787
|
+
link.click();
|
|
17788
|
+
document.body.removeChild(link);
|
|
17789
|
+
};
|
|
17605
17790
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
17606
17791
|
var capturedDocuments = _a.capturedDocuments,
|
|
17607
17792
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -17613,8 +17798,22 @@
|
|
|
17613
17798
|
_d = _a.verbiage,
|
|
17614
17799
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
17615
17800
|
_e = _a.debugMode,
|
|
17616
|
-
debugMode = _e === void 0 ? false : _e
|
|
17801
|
+
debugMode = _e === void 0 ? false : _e,
|
|
17802
|
+
initialBarcodeScore = _a.initialBarcodeScore,
|
|
17803
|
+
recaptureBarcodeScore = _a.recaptureBarcodeScore,
|
|
17804
|
+
initialCaptureBarcodeImage = _a.initialCaptureBarcodeImage,
|
|
17805
|
+
recaptureBarcodeImage = _a.recaptureBarcodeImage;
|
|
17617
17806
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
17807
|
+
if (debugMode) {
|
|
17808
|
+
log('[IdCaptureSuccess] Debug info:', {
|
|
17809
|
+
debugMode: debugMode,
|
|
17810
|
+
initialBarcodeScore: initialBarcodeScore,
|
|
17811
|
+
recaptureBarcodeScore: recaptureBarcodeScore,
|
|
17812
|
+
shouldShow: debugMode && initialBarcodeScore !== undefined,
|
|
17813
|
+
condition1: debugMode,
|
|
17814
|
+
condition2: initialBarcodeScore !== undefined
|
|
17815
|
+
});
|
|
17816
|
+
}
|
|
17618
17817
|
var verbiage = useTranslations(rawVerbiage, {
|
|
17619
17818
|
headingText: 'ID Capture Successful',
|
|
17620
17819
|
retryText: 'Retry',
|
|
@@ -17634,6 +17833,7 @@
|
|
|
17634
17833
|
}, /*#__PURE__*/React.createElement(ImageRow, {
|
|
17635
17834
|
className: classNames.imageRow
|
|
17636
17835
|
}, imageDisplayOrder.map(function (name) {
|
|
17836
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17637
17837
|
var doc = capturedDocuments[name];
|
|
17638
17838
|
if (!doc) return null;
|
|
17639
17839
|
return /*#__PURE__*/React.createElement(ImageCol$1, {
|
|
@@ -17643,7 +17843,57 @@
|
|
|
17643
17843
|
image: doc,
|
|
17644
17844
|
className: classNames.image,
|
|
17645
17845
|
alt: doc.documentType
|
|
17646
|
-
}), debugMode && (/*#__PURE__*/React.createElement(
|
|
17846
|
+
}), debugMode && (/*#__PURE__*/React.createElement(DebugInfoContainer, null, name === 'idBarcodeImage' ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Document Type:"), /*#__PURE__*/React.createElement(DebugValue, null, doc.documentType)), /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Readability Score:"), /*#__PURE__*/React.createElement(ScoreBadge, {
|
|
17847
|
+
"$score": (_a = doc.barcodeReadabilityScore) !== null && _a !== void 0 ? _a : 0,
|
|
17848
|
+
"$type": "readability"
|
|
17849
|
+
}, ((_b = doc.barcodeReadabilityScore) !== null && _b !== void 0 ? _b : 0).toFixed(3))), initialBarcodeScore !== undefined && (recaptureBarcodeScore !== null && recaptureBarcodeScore !== undefined ? (/*#__PURE__*/React.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React.createElement(ComparisonHeader, null, "\uD83D\uDCCA Barcode Recapture Analysis"), /*#__PURE__*/React.createElement(ComparisonRow, null, /*#__PURE__*/React.createElement(ComparisonLabel, null, "Initial Capture:"), /*#__PURE__*/React.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React.createElement(ComparisonRow, null, /*#__PURE__*/React.createElement(ComparisonLabel, null, "After Recapture:"), /*#__PURE__*/React.createElement(ComparisonScoreBadge, null, recaptureBarcodeScore.toFixed(3))), /*#__PURE__*/React.createElement(ComparisonDivider, null), /*#__PURE__*/React.createElement(ComparisonRow, null, /*#__PURE__*/React.createElement(ComparisonLabel, null, "Improvement:"), /*#__PURE__*/React.createElement(ImprovementBadge, {
|
|
17850
|
+
"$improved": recaptureBarcodeScore > initialBarcodeScore
|
|
17851
|
+
}, recaptureBarcodeScore > initialBarcodeScore ? '↑' : '→', ' ', Math.abs(recaptureBarcodeScore - initialBarcodeScore).toFixed(3), ' ', "(", recaptureBarcodeScore > initialBarcodeScore ? 'Better' : 'Same/Worse', ")")), (initialCaptureBarcodeImage || recaptureBarcodeImage) && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComparisonDivider, null), /*#__PURE__*/React.createElement(ComparisonHeader, {
|
|
17852
|
+
style: {
|
|
17853
|
+
marginTop: '0.25rem'
|
|
17854
|
+
}
|
|
17855
|
+
}, "\uD83D\uDD0D Visual Comparison"), /*#__PURE__*/React.createElement(BarcodeComparisonImagesContainer, null, initialCaptureBarcodeImage && (/*#__PURE__*/React.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React.createElement(BarcodeComparisonImage, {
|
|
17856
|
+
src: initialCaptureBarcodeImage,
|
|
17857
|
+
alt: "Initial capture barcode",
|
|
17858
|
+
onDoubleClick: function onDoubleClick() {
|
|
17859
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
17860
|
+
},
|
|
17861
|
+
title: "Double-click to download"
|
|
17862
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17863
|
+
"$isHigher": initialBarcodeScore >= recaptureBarcodeScore
|
|
17864
|
+
}, initialBarcodeScore.toFixed(3)))), recaptureBarcodeImage && (/*#__PURE__*/React.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React.createElement(BarcodeComparisonImageLabel, null, "Recapture"), /*#__PURE__*/React.createElement(BarcodeComparisonImage, {
|
|
17865
|
+
src: recaptureBarcodeImage,
|
|
17866
|
+
alt: "Recapture barcode",
|
|
17867
|
+
onDoubleClick: function onDoubleClick() {
|
|
17868
|
+
return downloadImage(recaptureBarcodeImage, "barcode-recapture-".concat(recaptureBarcodeScore.toFixed(3), ".jpg"));
|
|
17869
|
+
},
|
|
17870
|
+
title: "Double-click to download"
|
|
17871
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17872
|
+
"$isHigher": recaptureBarcodeScore > initialBarcodeScore
|
|
17873
|
+
}, recaptureBarcodeScore.toFixed(3))))))))) : (/*#__PURE__*/React.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React.createElement(ComparisonHeader, null, "\u26A0\uFE0F Recapture Attempted"), /*#__PURE__*/React.createElement(ComparisonRow, null, /*#__PURE__*/React.createElement(ComparisonLabel, null, "Initial Score:"), /*#__PURE__*/React.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React.createElement(ComparisonRow, null, /*#__PURE__*/React.createElement(ComparisonLabel, null, "Recapture Result:"), /*#__PURE__*/React.createElement(ComparisonValue, null, "No barcode found")), initialCaptureBarcodeImage && (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ComparisonDivider, null), /*#__PURE__*/React.createElement(ComparisonHeader, {
|
|
17874
|
+
style: {
|
|
17875
|
+
marginTop: '0.25rem'
|
|
17876
|
+
}
|
|
17877
|
+
}, "\uD83D\uDD0D Barcode Image (kept)"), /*#__PURE__*/React.createElement(BarcodeComparisonImagesContainer, {
|
|
17878
|
+
style: {
|
|
17879
|
+
gridTemplateColumns: '1fr'
|
|
17880
|
+
}
|
|
17881
|
+
}, /*#__PURE__*/React.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React.createElement(BarcodeComparisonImage, {
|
|
17882
|
+
src: initialCaptureBarcodeImage,
|
|
17883
|
+
alt: "Initial capture barcode",
|
|
17884
|
+
onDoubleClick: function onDoubleClick() {
|
|
17885
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
17886
|
+
},
|
|
17887
|
+
title: "Double-click to download"
|
|
17888
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17889
|
+
"$isHigher": true
|
|
17890
|
+
}, initialBarcodeScore.toFixed(3))))))))))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Document Type:"), /*#__PURE__*/React.createElement(DebugValue, null, doc.documentType)), /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Detection Score:"), /*#__PURE__*/React.createElement(ScoreBadge, {
|
|
17891
|
+
"$score": (_c = doc.detectionScore) !== null && _c !== void 0 ? _c : 0,
|
|
17892
|
+
"$type": "detection"
|
|
17893
|
+
}, ((_d = doc.detectionScore) !== null && _d !== void 0 ? _d : 0).toFixed(3))), /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Focus Score:"), /*#__PURE__*/React.createElement(ScoreBadge, {
|
|
17894
|
+
"$score": (_e = doc.focusScore) !== null && _e !== void 0 ? _e : 0,
|
|
17895
|
+
"$type": "focus"
|
|
17896
|
+
}, ((_f = doc.focusScore) !== null && _f !== void 0 ? _f : 0).toFixed(3))), /*#__PURE__*/React.createElement(DebugSection, null, /*#__PURE__*/React.createElement(DebugLabel, null, "Bounding Box:"), /*#__PURE__*/React.createElement(DebugValue, null, JSON.stringify(doc.boundingBox, null, 2))))))));
|
|
17647
17897
|
}))), /*#__PURE__*/React.createElement(ButtonsColumn, {
|
|
17648
17898
|
className: classNames.buttonsRow
|
|
17649
17899
|
}, /*#__PURE__*/React.createElement(WideButton, {
|
|
@@ -17666,8 +17916,91 @@
|
|
|
17666
17916
|
var ImageRow = styled(OverlayImageRow)(templateObject_3$o || (templateObject_3$o = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n position: relative;\n width: 100%;\n"], ["\n max-width: 100%;\n flex-direction: column;\n position: relative;\n width: 100%;\n"])));
|
|
17667
17917
|
var ImageCol$1 = styled.div(templateObject_4$i || (templateObject_4$i = __makeTemplateObject(["\n width: 450px;\n max-width: 100%;\n max-height: none !important;\n"], ["\n width: 450px;\n max-width: 100%;\n max-height: none !important;\n"])));
|
|
17668
17918
|
var StyledImage = styled(CapturedDocumentImg)(templateObject_5$d || (templateObject_5$d = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
|
|
17669
|
-
var
|
|
17670
|
-
var
|
|
17919
|
+
var DebugInfoContainer = styled.div(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n margin-top: 0.5rem;\n margin-bottom: 1rem;\n padding: 0.625rem;\n background: #f8f9fa;\n border-radius: 6px;\n border: 1px solid #e9ecef;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 0.8125rem;\n line-height: 1.35;\n text-align: left;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n margin-top: 0.5rem;\n margin-bottom: 1rem;\n padding: 0.625rem;\n background: #f8f9fa;\n border-radius: 6px;\n border: 1px solid #e9ecef;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 0.8125rem;\n line-height: 1.35;\n text-align: left;\n"])));
|
|
17920
|
+
var DebugSection = styled.div(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0;\n"], ["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0;\n"])));
|
|
17921
|
+
var DebugLabel = styled.span(templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n font-weight: 600;\n color: #495057;\n font-size: 0.8125rem;\n flex-shrink: 0;\n width: 110px;\n"], ["\n font-weight: 600;\n color: #495057;\n font-size: 0.8125rem;\n flex-shrink: 0;\n width: 110px;\n"])));
|
|
17922
|
+
var DebugValue = styled.span(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["\n color: #212529;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 0.8125rem;\n"], ["\n color: #212529;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 0.8125rem;\n"])));
|
|
17923
|
+
var ScoreBadge = styled.span(templateObject_10$2 || (templateObject_10$2 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: ", ";\n color: ", ";\n border: 1px solid\n ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: ", ";\n color: ", ";\n border: 1px solid\n ", ";\n"])), function (_a) {
|
|
17924
|
+
var $score = _a.$score,
|
|
17925
|
+
$type = _a.$type;
|
|
17926
|
+
var thresholds = $type === 'readability' ? {
|
|
17927
|
+
good: 0.5,
|
|
17928
|
+
medium: 0.2
|
|
17929
|
+
} : $type === 'detection' ? {
|
|
17930
|
+
good: 0.7,
|
|
17931
|
+
medium: 0.4
|
|
17932
|
+
} : {
|
|
17933
|
+
good: 0.7,
|
|
17934
|
+
medium: 0.4
|
|
17935
|
+
};
|
|
17936
|
+
if ($score >= thresholds.good) return '#d4edda';
|
|
17937
|
+
if ($score >= thresholds.medium) return '#fff3cd';
|
|
17938
|
+
return '#f8d7da';
|
|
17939
|
+
}, function (_a) {
|
|
17940
|
+
var $score = _a.$score,
|
|
17941
|
+
$type = _a.$type;
|
|
17942
|
+
var thresholds = $type === 'readability' ? {
|
|
17943
|
+
good: 0.5,
|
|
17944
|
+
medium: 0.2
|
|
17945
|
+
} : $type === 'detection' ? {
|
|
17946
|
+
good: 0.7,
|
|
17947
|
+
medium: 0.4
|
|
17948
|
+
} : {
|
|
17949
|
+
good: 0.7,
|
|
17950
|
+
medium: 0.4
|
|
17951
|
+
};
|
|
17952
|
+
if ($score >= thresholds.good) return '#155724';
|
|
17953
|
+
if ($score >= thresholds.medium) return '#856404';
|
|
17954
|
+
return '#721c24';
|
|
17955
|
+
}, function (_a) {
|
|
17956
|
+
var $score = _a.$score,
|
|
17957
|
+
$type = _a.$type;
|
|
17958
|
+
var thresholds = $type === 'readability' ? {
|
|
17959
|
+
good: 0.5,
|
|
17960
|
+
medium: 0.2
|
|
17961
|
+
} : $type === 'detection' ? {
|
|
17962
|
+
good: 0.7,
|
|
17963
|
+
medium: 0.4
|
|
17964
|
+
} : {
|
|
17965
|
+
good: 0.7,
|
|
17966
|
+
medium: 0.4
|
|
17967
|
+
};
|
|
17968
|
+
if ($score >= thresholds.good) return '#c3e6cb';
|
|
17969
|
+
if ($score >= thresholds.medium) return '#ffeaa7';
|
|
17970
|
+
return '#f5c6cb';
|
|
17971
|
+
});
|
|
17972
|
+
var BarcodeComparisonCard = styled.div(templateObject_11$2 || (templateObject_11$2 = __makeTemplateObject(["\n margin-top: 0.375rem;\n padding: 0.625rem;\n background: #e7f3ff;\n border-radius: 6px;\n border: 1px solid #b3d9ff;\n"], ["\n margin-top: 0.375rem;\n padding: 0.625rem;\n background: #e7f3ff;\n border-radius: 6px;\n border: 1px solid #b3d9ff;\n"])));
|
|
17973
|
+
var ComparisonHeader = styled.div(templateObject_12$2 || (templateObject_12$2 = __makeTemplateObject(["\n font-size: 0.8125rem;\n font-weight: 700;\n margin-bottom: 0.375rem;\n display: flex;\n align-items: center;\n gap: 0.375rem;\n color: #004085;\n"], ["\n font-size: 0.8125rem;\n font-weight: 700;\n margin-bottom: 0.375rem;\n display: flex;\n align-items: center;\n gap: 0.375rem;\n color: #004085;\n"])));
|
|
17974
|
+
var ComparisonRow = styled.div(templateObject_13$2 || (templateObject_13$2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0.25rem;\n gap: 0.75rem;\n font-size: 0.8125rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0.25rem;\n gap: 0.75rem;\n font-size: 0.8125rem;\n\n &:last-child {\n margin-bottom: 0;\n }\n"])));
|
|
17975
|
+
var ComparisonLabel = styled.span(templateObject_14$1 || (templateObject_14$1 = __makeTemplateObject(["\n font-weight: 500;\n color: #495057;\n"], ["\n font-weight: 500;\n color: #495057;\n"])));
|
|
17976
|
+
var ComparisonValue = styled.span(templateObject_15$1 || (templateObject_15$1 = __makeTemplateObject(["\n font-weight: 600;\n color: #212529;\n"], ["\n font-weight: 600;\n color: #212529;\n"])));
|
|
17977
|
+
var ComparisonDivider = styled.hr(templateObject_16$1 || (templateObject_16$1 = __makeTemplateObject(["\n border: none;\n border-top: 1px solid #b3d9ff;\n margin: 0.375rem 0;\n"], ["\n border: none;\n border-top: 1px solid #b3d9ff;\n margin: 0.375rem 0;\n"])));
|
|
17978
|
+
var ComparisonScoreBadge = styled.span(templateObject_17$1 || (templateObject_17$1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: white;\n color: #212529;\n border: 1px solid #dee2e6;\n"], ["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: white;\n color: #212529;\n border: 1px solid #dee2e6;\n"])));
|
|
17979
|
+
var ImprovementBadge = styled.span(templateObject_18$1 || (templateObject_18$1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: ", ";\n color: ", ";\n border: 1px solid ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n padding: 0.1875rem 0.5rem;\n border-radius: 4px;\n font-weight: 600;\n font-size: 0.75rem;\n background: ", ";\n color: ", ";\n border: 1px solid ", ";\n"])), function (_a) {
|
|
17980
|
+
var $improved = _a.$improved;
|
|
17981
|
+
return $improved ? '#d4edda' : '#e2e3e5';
|
|
17982
|
+
}, function (_a) {
|
|
17983
|
+
var $improved = _a.$improved;
|
|
17984
|
+
return $improved ? '#155724' : '#383d41';
|
|
17985
|
+
}, function (_a) {
|
|
17986
|
+
var $improved = _a.$improved;
|
|
17987
|
+
return $improved ? '#c3e6cb' : '#d6d8db';
|
|
17988
|
+
});
|
|
17989
|
+
var BarcodeComparisonImagesContainer = styled.div(templateObject_19$1 || (templateObject_19$1 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 1rem;\n margin-top: 0.75rem;\n padding: 0.5rem;\n background: rgba(255, 255, 255, 0.5);\n border-radius: 6px;\n"], ["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 1rem;\n margin-top: 0.75rem;\n padding: 0.5rem;\n background: rgba(255, 255, 255, 0.5);\n border-radius: 6px;\n"])));
|
|
17990
|
+
var BarcodeComparisonImageWrapper = styled.div(templateObject_20$1 || (templateObject_20$1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.375rem;\n"], ["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 0.375rem;\n"])));
|
|
17991
|
+
var BarcodeComparisonImageLabel = styled.span(templateObject_21$1 || (templateObject_21$1 = __makeTemplateObject(["\n font-size: 0.75rem;\n font-weight: 700;\n color: #004085;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.25rem 0.5rem;\n background: white;\n border-radius: 4px;\n border: 1px solid #b3d9ff;\n"], ["\n font-size: 0.75rem;\n font-weight: 700;\n color: #004085;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n padding: 0.25rem 0.5rem;\n background: white;\n border-radius: 4px;\n border: 1px solid #b3d9ff;\n"])));
|
|
17992
|
+
var BarcodeComparisonImage = styled.img(templateObject_22$1 || (templateObject_22$1 = __makeTemplateObject(["\n width: 100%;\n height: auto;\n border-radius: 6px;\n border: 2px solid #dee2e6;\n background: white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n transition:\n transform 0.15s ease,\n box-shadow 0.15s ease;\n\n &:hover {\n transform: scale(1.02);\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);\n }\n\n &:active {\n transform: scale(0.98);\n }\n"], ["\n width: 100%;\n height: auto;\n border-radius: 6px;\n border: 2px solid #dee2e6;\n background: white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n cursor: pointer;\n transition:\n transform 0.15s ease,\n box-shadow 0.15s ease;\n\n &:hover {\n transform: scale(1.02);\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);\n }\n\n &:active {\n transform: scale(0.98);\n }\n"])));
|
|
17993
|
+
var BarcodeComparisonScoreLabel = styled.span(templateObject_23$1 || (templateObject_23$1 = __makeTemplateObject(["\n font-size: 0.8125rem;\n font-weight: 700;\n color: ", ";\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n padding: 0.25rem 0.5rem;\n background: ", ";\n border-radius: 4px;\n border: 1px solid ", ";\n"], ["\n font-size: 0.8125rem;\n font-weight: 700;\n color: ", ";\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n padding: 0.25rem 0.5rem;\n background: ", ";\n border-radius: 4px;\n border: 1px solid ", ";\n"])), function (_a) {
|
|
17994
|
+
var $isHigher = _a.$isHigher;
|
|
17995
|
+
return $isHigher ? '#155724' : '#495057';
|
|
17996
|
+
}, function (_a) {
|
|
17997
|
+
var $isHigher = _a.$isHigher;
|
|
17998
|
+
return $isHigher ? '#d4edda' : 'white';
|
|
17999
|
+
}, function (_a) {
|
|
18000
|
+
var $isHigher = _a.$isHigher;
|
|
18001
|
+
return $isHigher ? '#c3e6cb' : '#dee2e6';
|
|
18002
|
+
});
|
|
18003
|
+
var templateObject_1$C, templateObject_2$y, templateObject_3$o, templateObject_4$i, templateObject_5$d, templateObject_6$8, templateObject_7$5, templateObject_8$4, templateObject_9$3, templateObject_10$2, templateObject_11$2, templateObject_12$2, templateObject_13$2, templateObject_14$1, templateObject_15$1, templateObject_16$1, templateObject_17$1, templateObject_18$1, templateObject_19$1, templateObject_20$1, templateObject_21$1, templateObject_22$1, templateObject_23$1;
|
|
17671
18004
|
|
|
17672
18005
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
17673
18006
|
var _this = this;
|
|
@@ -20197,7 +20530,7 @@
|
|
|
20197
20530
|
none: null
|
|
20198
20531
|
};
|
|
20199
20532
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
20200
|
-
var _b, _c, _d, _e, _f;
|
|
20533
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
20201
20534
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
20202
20535
|
onLoadingProgress = _a.onLoadingProgress,
|
|
20203
20536
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -20208,86 +20541,115 @@
|
|
|
20208
20541
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
20209
20542
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
20210
20543
|
onDocumentDetected = _a.onDocumentDetected,
|
|
20211
|
-
|
|
20212
|
-
documentDetectionThrottleMs =
|
|
20213
|
-
|
|
20214
|
-
loadingOverlayMode =
|
|
20544
|
+
_m = _a.documentDetectionThrottleMs,
|
|
20545
|
+
documentDetectionThrottleMs = _m === void 0 ? 0 : _m,
|
|
20546
|
+
_o = _a.loadingOverlayMode,
|
|
20547
|
+
loadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
20215
20548
|
customOverlayContent = _a.customOverlayContent,
|
|
20216
20549
|
precapturedDocuments = _a.precapturedDocuments,
|
|
20217
|
-
|
|
20218
|
-
captureRequirement =
|
|
20219
|
-
|
|
20220
|
-
allowSinglePageIdCapture =
|
|
20221
|
-
|
|
20222
|
-
separateIdCardCaptureSequence =
|
|
20223
|
-
|
|
20224
|
-
thresholds =
|
|
20225
|
-
|
|
20226
|
-
skipSuccessScreen =
|
|
20550
|
+
_p = _a.captureRequirement,
|
|
20551
|
+
captureRequirement = _p === void 0 ? 'idCardOrPassport' : _p,
|
|
20552
|
+
_q = _a.allowSinglePageIdCapture,
|
|
20553
|
+
allowSinglePageIdCapture = _q === void 0 ? false : _q,
|
|
20554
|
+
_r = _a.separateIdCardCaptureSequence,
|
|
20555
|
+
separateIdCardCaptureSequence = _r === void 0 ? false : _r,
|
|
20556
|
+
_s = _a.thresholds,
|
|
20557
|
+
thresholds = _s === void 0 ? defaultIdCaptureThresholds : _s,
|
|
20558
|
+
_t = _a.skipSuccessScreen,
|
|
20559
|
+
skipSuccessScreen = _t === void 0 ? false : _t,
|
|
20227
20560
|
instructions = _a.instructions,
|
|
20228
|
-
|
|
20229
|
-
releaseCameraAccessOnExit =
|
|
20230
|
-
|
|
20231
|
-
guideType =
|
|
20232
|
-
|
|
20233
|
-
portraitGuidesOnMobile =
|
|
20234
|
-
|
|
20235
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
20236
|
-
|
|
20237
|
-
silentFallback =
|
|
20238
|
-
|
|
20239
|
-
forceFallbackMode =
|
|
20240
|
-
|
|
20241
|
-
allowIdCardBackToFrontCapture =
|
|
20242
|
-
|
|
20243
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
20244
|
-
|
|
20245
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
20246
|
-
|
|
20247
|
-
allowUploadingDocumentsFromStorage =
|
|
20248
|
-
|
|
20249
|
-
guideImages =
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
|
|
20561
|
+
_u = _a.releaseCameraAccessOnExit,
|
|
20562
|
+
releaseCameraAccessOnExit = _u === void 0 ? true : _u,
|
|
20563
|
+
_v = _a.guideType,
|
|
20564
|
+
guideType = _v === void 0 ? 'fit' : _v,
|
|
20565
|
+
_w = _a.portraitGuidesOnMobile,
|
|
20566
|
+
portraitGuidesOnMobile = _w === void 0 ? true : _w,
|
|
20567
|
+
_x = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
20568
|
+
rotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
|
|
20569
|
+
_y = _a.silentFallback,
|
|
20570
|
+
silentFallback = _y === void 0 ? false : _y,
|
|
20571
|
+
_z = _a.forceFallbackMode,
|
|
20572
|
+
forceFallbackMode = _z === void 0 ? false : _z,
|
|
20573
|
+
_0 = _a.allowIdCardBackToFrontCapture,
|
|
20574
|
+
allowIdCardBackToFrontCapture = _0 === void 0 ? false : _0,
|
|
20575
|
+
_1 = _a.enableOverrideWrongDocumentTypeDialog,
|
|
20576
|
+
enableOverrideWrongDocumentTypeDialog = _1 === void 0 ? false : _1,
|
|
20577
|
+
_2 = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
20578
|
+
allowOverrideWrongDocumentTypeAfterMs = _2 === void 0 ? 8000 : _2,
|
|
20579
|
+
_3 = _a.allowUploadingDocumentsFromStorage,
|
|
20580
|
+
allowUploadingDocumentsFromStorage = _3 === void 0 ? false : _3,
|
|
20581
|
+
_4 = _a.guideImages,
|
|
20582
|
+
guideImages = _4 === void 0 ? defaultIdCaptureGuideImages : _4,
|
|
20583
|
+
_5 = _a.barcodeRecaptureThreshold,
|
|
20584
|
+
barcodeRecaptureThreshold = _5 === void 0 ? 1 : _5,
|
|
20585
|
+
_6 = _a.barcodeRecaptureTimeoutMs,
|
|
20586
|
+
barcodeRecaptureTimeoutMs = _6 === void 0 ? 5000 : _6,
|
|
20587
|
+
_7 = _a.barcodeRecaptureMoveCloserTimeoutMs,
|
|
20588
|
+
barcodeRecaptureMoveCloserTimeoutMs = _7 === void 0 ? 10000 : _7,
|
|
20589
|
+
_8 = _a.barcodeRecaptureBboxGrowthPct,
|
|
20590
|
+
barcodeRecaptureBboxGrowthPct = _8 === void 0 ? 20 : _8,
|
|
20591
|
+
_9 = _a.documentEdgeDistancePct,
|
|
20592
|
+
documentEdgeDistancePct = _9 === void 0 ? 0 : _9,
|
|
20593
|
+
_10 = _a.assets,
|
|
20594
|
+
assets = _10 === void 0 ? {} : _10,
|
|
20595
|
+
_11 = _a.classNames,
|
|
20596
|
+
classNames = _11 === void 0 ? {} : _11,
|
|
20597
|
+
_12 = _a.colors,
|
|
20598
|
+
colors = _12 === void 0 ? {} : _12,
|
|
20599
|
+
_13 = _a.verbiage,
|
|
20600
|
+
verbiage = _13 === void 0 ? {} : _13,
|
|
20601
|
+
_14 = _a.debugMode,
|
|
20602
|
+
debugMode = _14 === void 0 ? false : _14;
|
|
20262
20603
|
var state = useIdCaptureStore();
|
|
20263
|
-
var
|
|
20264
|
-
|
|
20265
|
-
|
|
20266
|
-
|
|
20267
|
-
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20604
|
+
var isCapturing = state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode';
|
|
20605
|
+
var _15 = useCameraStore(),
|
|
20606
|
+
cameraAccessDenied = _15.cameraAccessDenied,
|
|
20607
|
+
requestCameraAccess = _15.requestCameraAccess,
|
|
20608
|
+
releaseCameraAccess = _15.releaseCameraAccess;
|
|
20609
|
+
var _16 = React.useState(false),
|
|
20610
|
+
overlayDismissed = _16[0],
|
|
20611
|
+
setOverlayDismissed = _16[1];
|
|
20612
|
+
var _17 = useSubmissionContext(),
|
|
20613
|
+
submissionStatus = _17.submissionStatus,
|
|
20614
|
+
setIdFrontImage = _17.setIdFrontImage,
|
|
20615
|
+
setIdBackImage = _17.setIdBackImage,
|
|
20616
|
+
setPassportImage = _17.setPassportImage,
|
|
20617
|
+
setIdFrontIrImage = _17.setIdFrontIrImage,
|
|
20618
|
+
setIdBackIrImage = _17.setIdBackIrImage,
|
|
20619
|
+
setIdFrontUvImage = _17.setIdFrontUvImage,
|
|
20620
|
+
setIdBackUvImage = _17.setIdBackUvImage,
|
|
20621
|
+
setIdBarcodeImage = _17.setIdBarcodeImage,
|
|
20622
|
+
logIdFrontCaptureAttempt = _17.logIdFrontCaptureAttempt,
|
|
20623
|
+
logIdBackCaptureAttempt = _17.logIdBackCaptureAttempt;
|
|
20624
|
+
var _18 = useIdCaptureModelsContext(),
|
|
20625
|
+
start = _18.start,
|
|
20626
|
+
stop = _18.stop,
|
|
20627
|
+
onPredictionMade = _18.onPredictionMade,
|
|
20628
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
20629
|
+
modelError = _18.modelError,
|
|
20630
|
+
resetBestFrame = _18.resetBestFrame,
|
|
20631
|
+
documentDetectionBoundaries = _18.documentDetectionBoundaries,
|
|
20632
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
20633
|
+
getBestBarcode = _18.getBestBarcode,
|
|
20634
|
+
startBarcodeRecapturePhase = _18.startBarcodeRecapturePhase,
|
|
20635
|
+
getRecaptureBestBarcode = _18.getRecaptureBestBarcode;
|
|
20636
|
+
var initialBarcodeBboxRef = React.useRef(null);
|
|
20637
|
+
var recapturePhaseStartedRef = React.useRef(false);
|
|
20638
|
+
var _19 = React.useState(false),
|
|
20639
|
+
barcodeRecaptureGrowthSatisfied = _19[0],
|
|
20640
|
+
setBarcodeRecaptureGrowthSatisfied = _19[1];
|
|
20641
|
+
React.useEffect(function () {
|
|
20642
|
+
// Reset recapture gating whenever we enter/exit the recapture flow
|
|
20643
|
+
if (state.captureState === 'requestingBetterBarcode') {
|
|
20644
|
+
initialBarcodeBboxRef.current = null;
|
|
20645
|
+
recapturePhaseStartedRef.current = false;
|
|
20646
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
20647
|
+
return;
|
|
20648
|
+
}
|
|
20649
|
+
initialBarcodeBboxRef.current = null;
|
|
20650
|
+
recapturePhaseStartedRef.current = false;
|
|
20651
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
20652
|
+
}, [state.captureState]);
|
|
20291
20653
|
React.useEffect(function () {
|
|
20292
20654
|
dispatchIdCaptureAction({
|
|
20293
20655
|
type: 'configureWizard',
|
|
@@ -20298,10 +20660,12 @@
|
|
|
20298
20660
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
20299
20661
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
20300
20662
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
20301
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
20663
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
20664
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
20665
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
20302
20666
|
}
|
|
20303
20667
|
});
|
|
20304
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
20668
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, barcodeRecaptureThreshold, barcodeRecaptureTimeoutMs, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
20305
20669
|
React.useEffect(function () {
|
|
20306
20670
|
var _a;
|
|
20307
20671
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -20313,8 +20677,10 @@
|
|
|
20313
20677
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
20314
20678
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
20315
20679
|
React.useEffect(function () {
|
|
20680
|
+
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
20681
|
+
if (state.captureState === 'requestingBetterBarcode') return;
|
|
20316
20682
|
if (documentCount) resetBestFrame();
|
|
20317
|
-
}, [documentCount, resetBestFrame]);
|
|
20683
|
+
}, [documentCount, resetBestFrame, state.captureState]);
|
|
20318
20684
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
20319
20685
|
var lastDocumentDetectedAt = React.useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
20320
20686
|
var logCaptureMetadata = React.useCallback(function (metadata) {
|
|
@@ -20333,24 +20699,62 @@
|
|
|
20333
20699
|
}
|
|
20334
20700
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
20335
20701
|
React.useEffect(function startModelsWhenCapturing() {
|
|
20336
|
-
if (!overlayDismissed ||
|
|
20702
|
+
if (!overlayDismissed || !isCapturing) return;
|
|
20337
20703
|
dispatchIdCaptureAction({
|
|
20338
20704
|
type: 'captureStarted'
|
|
20339
20705
|
});
|
|
20340
20706
|
start();
|
|
20341
|
-
}, [overlayDismissed, start
|
|
20707
|
+
}, [isCapturing, overlayDismissed, start]);
|
|
20342
20708
|
React.useEffect(function () {
|
|
20343
20709
|
onPredictionMade(function (prediction) {
|
|
20344
|
-
var _a;
|
|
20345
|
-
var
|
|
20346
|
-
captureState =
|
|
20347
|
-
requestedDocumentType =
|
|
20710
|
+
var _a, _b, _c, _d;
|
|
20711
|
+
var _e = useIdCaptureStore.getState(),
|
|
20712
|
+
captureState = _e.captureState,
|
|
20713
|
+
requestedDocumentType = _e.requestedDocumentType;
|
|
20348
20714
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
20349
20715
|
var thresholdMet = prediction[k];
|
|
20350
|
-
if (captureState === 'capturing') {
|
|
20716
|
+
if (captureState === 'capturing' || captureState === 'requestingBetterBarcode') {
|
|
20717
|
+
// During barcode recapture, wait until the barcode bbox grows by a configurable %
|
|
20718
|
+
// (to confirm the user moved the camera closer) before we start recapture processing.
|
|
20719
|
+
if (captureState === 'requestingBetterBarcode') {
|
|
20720
|
+
var growthPct = Math.max(0, Math.min(barcodeRecaptureBboxGrowthPct, 200));
|
|
20721
|
+
var requiredMultiplier = 1 + growthPct / 100;
|
|
20722
|
+
if (!recapturePhaseStartedRef.current) {
|
|
20723
|
+
// If growth requirement is disabled, begin recapture immediately.
|
|
20724
|
+
if (requiredMultiplier === 1) {
|
|
20725
|
+
recapturePhaseStartedRef.current = true;
|
|
20726
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
20727
|
+
startBarcodeRecapturePhase();
|
|
20728
|
+
} else {
|
|
20729
|
+
var pdf417Box = (_a = prediction.bestPDF417) === null || _a === void 0 ? void 0 : _a.box;
|
|
20730
|
+
var frameWidth = (_b = prediction.frameWidth) !== null && _b !== void 0 ? _b : 0;
|
|
20731
|
+
var frameHeight = (_c = prediction.frameHeight) !== null && _c !== void 0 ? _c : 0;
|
|
20732
|
+
if (pdf417Box && frameWidth > 0 && frameHeight > 0) {
|
|
20733
|
+
var widthRatio = pdf417Box.width / frameWidth;
|
|
20734
|
+
var heightRatio = pdf417Box.height / frameHeight;
|
|
20735
|
+
if (!initialBarcodeBboxRef.current) {
|
|
20736
|
+
// First observed bbox when we enter recapture.
|
|
20737
|
+
initialBarcodeBboxRef.current = {
|
|
20738
|
+
widthRatio: widthRatio,
|
|
20739
|
+
heightRatio: heightRatio
|
|
20740
|
+
};
|
|
20741
|
+
} else {
|
|
20742
|
+
var baseline = initialBarcodeBboxRef.current;
|
|
20743
|
+
var widthSatisfied = widthRatio >= baseline.widthRatio * requiredMultiplier;
|
|
20744
|
+
var heightSatisfied = heightRatio >= baseline.heightRatio * requiredMultiplier;
|
|
20745
|
+
if (widthSatisfied && heightSatisfied) {
|
|
20746
|
+
recapturePhaseStartedRef.current = true;
|
|
20747
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
20748
|
+
startBarcodeRecapturePhase();
|
|
20749
|
+
}
|
|
20750
|
+
}
|
|
20751
|
+
}
|
|
20752
|
+
}
|
|
20753
|
+
}
|
|
20754
|
+
}
|
|
20351
20755
|
if (prediction.detectedDocumentType !== 'none') {
|
|
20352
20756
|
var now = Date.now();
|
|
20353
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
20757
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_d = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _d !== void 0 ? _d : 0) > documentDetectionThrottleMs) {
|
|
20354
20758
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
20355
20759
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
20356
20760
|
}
|
|
@@ -20368,7 +20772,7 @@
|
|
|
20368
20772
|
});
|
|
20369
20773
|
}
|
|
20370
20774
|
});
|
|
20371
|
-
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
20775
|
+
}, [barcodeRecaptureBboxGrowthPct, documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame, startBarcodeRecapturePhase]);
|
|
20372
20776
|
React.useEffect(function () {
|
|
20373
20777
|
if (state.captureState === 'complete') stop();
|
|
20374
20778
|
}, [state.captureState, stop]);
|
|
@@ -20423,9 +20827,9 @@
|
|
|
20423
20827
|
type: 'resetWizard'
|
|
20424
20828
|
});
|
|
20425
20829
|
}, []);
|
|
20426
|
-
var
|
|
20427
|
-
attempt =
|
|
20428
|
-
setAttempt =
|
|
20830
|
+
var _20 = React.useState(0),
|
|
20831
|
+
attempt = _20[0],
|
|
20832
|
+
setAttempt = _20[1];
|
|
20429
20833
|
var onExit = React.useCallback(function () {
|
|
20430
20834
|
releaseCameraAccess();
|
|
20431
20835
|
setOverlayDismissed(false);
|
|
@@ -20451,20 +20855,25 @@
|
|
|
20451
20855
|
});
|
|
20452
20856
|
}
|
|
20453
20857
|
}, [cameraAccessDenied]);
|
|
20858
|
+
var guidanceBarcodeRecaptureText = (_b = verbiage.guidanceBarcodeRecaptureText) !== null && _b !== void 0 ? _b : 'Please move the barcode closer to the camera';
|
|
20859
|
+
var guidanceBarcodeRecaptureInProgressText = (_c = verbiage.guidanceBarcodeRecaptureInProgressText) !== null && _c !== void 0 ? _c : 'Barcode capture in progress, please hold still';
|
|
20860
|
+
var barcodeRecaptureGuidanceMessage = barcodeRecaptureGrowthSatisfied ? guidanceBarcodeRecaptureInProgressText : guidanceBarcodeRecaptureText;
|
|
20454
20861
|
var idCaptureVerbiages = {
|
|
20455
20862
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
20456
20863
|
instructionText: 'Scan the front of ID',
|
|
20457
20864
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
20458
20865
|
}),
|
|
20459
20866
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
20460
|
-
instructionText: 'Scan the back of ID'
|
|
20867
|
+
instructionText: state.captureState === 'requestingBetterBarcode' ? barcodeRecaptureGuidanceMessage : 'Scan the back of ID'
|
|
20461
20868
|
}),
|
|
20462
20869
|
passport: useTranslations(verbiage.passport, {
|
|
20463
20870
|
instructionText: 'Scan the ID page of passport'
|
|
20464
20871
|
})
|
|
20465
20872
|
};
|
|
20466
20873
|
var theme = styled.useTheme();
|
|
20467
|
-
|
|
20874
|
+
// During barcode recapture, use idCardBack verbiage to show barcode recapture message
|
|
20875
|
+
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
20876
|
+
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
20468
20877
|
React.useEffect(function () {
|
|
20469
20878
|
if (separateIdCardCaptureSequence) return;
|
|
20470
20879
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -20478,6 +20887,130 @@
|
|
|
20478
20887
|
clearTimeout(t);
|
|
20479
20888
|
};
|
|
20480
20889
|
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
20890
|
+
// Handle barcode recapture start - snapshot initial barcode and initialize recapture state
|
|
20891
|
+
React.useEffect(function () {
|
|
20892
|
+
var _a, _b;
|
|
20893
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20894
|
+
if (state.initialCaptureBarcodeImage !== null) return; // Already initialized
|
|
20895
|
+
// Get the initial barcode image from capturedDocuments (since resetBestFrame clears the canvas)
|
|
20896
|
+
var initialBarcodeImage = (_b = (_a = state.capturedDocuments.idBarcodeImage) === null || _a === void 0 ? void 0 : _a.imageData) !== null && _b !== void 0 ? _b : null;
|
|
20897
|
+
dispatchIdCaptureAction({
|
|
20898
|
+
type: 'barcodeRecaptureStarted',
|
|
20899
|
+
payload: {
|
|
20900
|
+
initialBarcodeScore: state.initialBarcodeScore,
|
|
20901
|
+
initialCaptureBarcodeImage: initialBarcodeImage
|
|
20902
|
+
}
|
|
20903
|
+
});
|
|
20904
|
+
}, [state.captureState, (_d = state.capturedDocuments.idBarcodeImage) === null || _d === void 0 ? void 0 : _d.imageData, state.initialBarcodeScore, state.initialCaptureBarcodeImage]);
|
|
20905
|
+
// Handle barcode recapture timeout
|
|
20906
|
+
React.useEffect(function () {
|
|
20907
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20908
|
+
// Continue detection to try to get a better barcode
|
|
20909
|
+
setTimeout(start, 100);
|
|
20910
|
+
var t = setTimeout(function () {
|
|
20911
|
+
// Move-closer window expired before recapture began
|
|
20912
|
+
if (recapturePhaseStartedRef.current) return;
|
|
20913
|
+
var bestBarcode = getBestBarcode();
|
|
20914
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
20915
|
+
if (improved) {
|
|
20916
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. Found better barcode anyway: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
20917
|
+
// Persist the "after" image for debug visual comparison, even if the
|
|
20918
|
+
// model-provider recapture tracker was never started.
|
|
20919
|
+
dispatchIdCaptureAction({
|
|
20920
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20921
|
+
payload: {
|
|
20922
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20923
|
+
}
|
|
20924
|
+
});
|
|
20925
|
+
dispatchIdCaptureAction({
|
|
20926
|
+
type: 'barcodeCaptured',
|
|
20927
|
+
payload: {
|
|
20928
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
20929
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
20930
|
+
}
|
|
20931
|
+
});
|
|
20932
|
+
} else {
|
|
20933
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. No better barcode found. Initial score: ".concat(state.initialBarcodeScore.toFixed(3)));
|
|
20934
|
+
}
|
|
20935
|
+
// Record that recapture was attempted (for diagnostics)
|
|
20936
|
+
dispatchIdCaptureAction({
|
|
20937
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
20938
|
+
payload: {
|
|
20939
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : state.initialBarcodeScore
|
|
20940
|
+
}
|
|
20941
|
+
});
|
|
20942
|
+
dispatchIdCaptureAction({
|
|
20943
|
+
type: 'barcodeRecaptureCompleted'
|
|
20944
|
+
});
|
|
20945
|
+
}, barcodeRecaptureMoveCloserTimeoutMs);
|
|
20946
|
+
return function () {
|
|
20947
|
+
return clearTimeout(t);
|
|
20948
|
+
};
|
|
20949
|
+
}, [barcodeRecaptureMoveCloserTimeoutMs, getBestBarcode, start, state.captureState, state.initialBarcodeScore]);
|
|
20950
|
+
React.useEffect(function () {
|
|
20951
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20952
|
+
if (!barcodeRecaptureGrowthSatisfied) return;
|
|
20953
|
+
var t = setTimeout(function () {
|
|
20954
|
+
var _a, _b;
|
|
20955
|
+
// Capture window expired - complete with whatever barcode we have
|
|
20956
|
+
var recaptureBarcode = getRecaptureBestBarcode();
|
|
20957
|
+
var bestBarcode = getBestBarcode();
|
|
20958
|
+
var recaptureScore = (_a = recaptureBarcode === null || recaptureBarcode === void 0 ? void 0 : recaptureBarcode.score) !== null && _a !== void 0 ? _a : null;
|
|
20959
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
20960
|
+
// Store the recapture score for diagnostic purposes
|
|
20961
|
+
dispatchIdCaptureAction({
|
|
20962
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
20963
|
+
payload: {
|
|
20964
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : recaptureScore !== null && recaptureScore !== void 0 ? recaptureScore : state.initialBarcodeScore
|
|
20965
|
+
}
|
|
20966
|
+
});
|
|
20967
|
+
// Store the recapture barcode image if we found one
|
|
20968
|
+
if (recaptureBarcode) {
|
|
20969
|
+
dispatchIdCaptureAction({
|
|
20970
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20971
|
+
payload: {
|
|
20972
|
+
recaptureBarcodeImage: recaptureBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20973
|
+
}
|
|
20974
|
+
});
|
|
20975
|
+
} else if (improved) {
|
|
20976
|
+
// If we improved but don't have a recapture-specific best tracked,
|
|
20977
|
+
// still persist the "after" image so debug visual comparison works.
|
|
20978
|
+
dispatchIdCaptureAction({
|
|
20979
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20980
|
+
payload: {
|
|
20981
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20982
|
+
}
|
|
20983
|
+
});
|
|
20984
|
+
}
|
|
20985
|
+
if (improved) {
|
|
20986
|
+
log("[IdCaptureWizard] Barcode recapture completed. Found better barcode: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
20987
|
+
dispatchIdCaptureAction({
|
|
20988
|
+
type: 'barcodeCaptured',
|
|
20989
|
+
payload: {
|
|
20990
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
20991
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
20992
|
+
}
|
|
20993
|
+
});
|
|
20994
|
+
} else {
|
|
20995
|
+
log("[IdCaptureWizard] Barcode recapture completed. No better barcode found. Best recapture score: ".concat((_b = recaptureScore === null || recaptureScore === void 0 ? void 0 : recaptureScore.toFixed(3)) !== null && _b !== void 0 ? _b : 'none', ", initial score: ").concat(state.initialBarcodeScore.toFixed(3)));
|
|
20996
|
+
}
|
|
20997
|
+
dispatchIdCaptureAction({
|
|
20998
|
+
type: 'barcodeRecaptureCompleted'
|
|
20999
|
+
});
|
|
21000
|
+
}, barcodeRecaptureTimeoutMs);
|
|
21001
|
+
return function () {
|
|
21002
|
+
return clearTimeout(t);
|
|
21003
|
+
};
|
|
21004
|
+
}, [barcodeRecaptureGrowthSatisfied, barcodeRecaptureTimeoutMs, getBestBarcode, getRecaptureBestBarcode, state.captureState, state.initialBarcodeScore]);
|
|
21005
|
+
// Continue detection during barcode recapture and update barcode if better one found
|
|
21006
|
+
React.useEffect(function () {
|
|
21007
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
21008
|
+
// Set required document type to idCardBack for barcode detection
|
|
21009
|
+
setRequiredDocumentType('idCardBack');
|
|
21010
|
+
return function () {
|
|
21011
|
+
setRequiredDocumentType('none');
|
|
21012
|
+
};
|
|
21013
|
+
}, [setRequiredDocumentType, state.captureState]);
|
|
20481
21014
|
React.useEffect(function () {
|
|
20482
21015
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
20483
21016
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -20516,9 +21049,9 @@
|
|
|
20516
21049
|
});
|
|
20517
21050
|
});
|
|
20518
21051
|
}, []);
|
|
20519
|
-
var
|
|
20520
|
-
progressStarted =
|
|
20521
|
-
setProgressStarted =
|
|
21052
|
+
var _21 = React.useState(false),
|
|
21053
|
+
progressStarted = _21[0],
|
|
21054
|
+
setProgressStarted = _21[1];
|
|
20522
21055
|
React.useEffect(function () {
|
|
20523
21056
|
if (state.captureState === 'capturing') {
|
|
20524
21057
|
setProgressStarted(false);
|
|
@@ -20546,9 +21079,9 @@
|
|
|
20546
21079
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
20547
21080
|
});
|
|
20548
21081
|
}
|
|
20549
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
21082
|
+
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.captureState === 'requestingBetterBarcode' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
20550
21083
|
var guidesStatus = !overlayDismissed ? 'disabled' : state.isGoodFrame ? 'capturing' : 'ready';
|
|
20551
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScalingCameraFeed, null), overlayDismissed && state.captureState === 'capturing' && (/*#__PURE__*/React.createElement(IdCapture, {
|
|
21084
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScalingCameraFeed, null), overlayDismissed && (state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode') && (/*#__PURE__*/React.createElement(IdCapture, {
|
|
20552
21085
|
requiredDocumentType: state.requestedDocumentType,
|
|
20553
21086
|
thresholds: thresholds,
|
|
20554
21087
|
onCapture: onCapture,
|
|
@@ -20556,11 +21089,18 @@
|
|
|
20556
21089
|
colors: colors,
|
|
20557
21090
|
verbiage: idCaptureVerbiage,
|
|
20558
21091
|
debugMode: debugMode
|
|
20559
|
-
})), /*#__PURE__*/React.createElement(
|
|
21092
|
+
})), overlayDismissed && state.captureState === 'requestingBetterBarcode' && (/*#__PURE__*/React.createElement(GuidanceMessageContainer, {
|
|
21093
|
+
"$top": "",
|
|
21094
|
+
"$bottom": "12.5%",
|
|
21095
|
+
className: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.guidanceMessageContainer
|
|
21096
|
+
}, /*#__PURE__*/React.createElement(GuidanceMessage, {
|
|
21097
|
+
"$variant": "default",
|
|
21098
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.guidanceMessage
|
|
21099
|
+
}, barcodeRecaptureGuidanceMessage))), /*#__PURE__*/React.createElement(IdCaptureGuides, {
|
|
20560
21100
|
key: "guides".concat(attempt),
|
|
20561
21101
|
guideType: guideType,
|
|
20562
21102
|
status: guidesStatus,
|
|
20563
|
-
progress: progressStarted &&
|
|
21103
|
+
progress: progressStarted && isCapturing ? 1 : 0,
|
|
20564
21104
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
20565
21105
|
requestedAction: requestedAction,
|
|
20566
21106
|
images: guideImages,
|
|
@@ -20568,15 +21108,15 @@
|
|
|
20568
21108
|
colors: colors,
|
|
20569
21109
|
verbiage: idCaptureVerbiage,
|
|
20570
21110
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
20571
|
-
}), debugMode && !((
|
|
20572
|
-
classNames: (
|
|
20573
|
-
text: (
|
|
21111
|
+
}), debugMode && !((_h = (_g = theme.idCapture) === null || _g === void 0 ? void 0 : _g.capturePreview) === null || _h === void 0 ? void 0 : _h.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && state.imageUrl && (/*#__PURE__*/React.createElement(IdCaptureImagePreview, {
|
|
21112
|
+
classNames: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.imagePreview,
|
|
21113
|
+
text: (_k = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _k === void 0 ? void 0 : _k.processingIdCardText,
|
|
20574
21114
|
imageUrl: state.imageUrl
|
|
20575
21115
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React.createElement("div", {
|
|
20576
21116
|
id: "idmission-above-guides-content"
|
|
20577
21117
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React.createElement(ExitCaptureButton, {
|
|
20578
21118
|
onClick: onExit,
|
|
20579
|
-
className: (
|
|
21119
|
+
className: (_l = classNames.capture) === null || _l === void 0 ? void 0 : _l.exitCaptureBtn
|
|
20580
21120
|
})), !overlayDismissed && (/*#__PURE__*/React.createElement(IdCaptureLoadingOverlay, {
|
|
20581
21121
|
key: "loading".concat(attempt),
|
|
20582
21122
|
mode: loadingOverlayMode,
|
|
@@ -20614,7 +21154,14 @@
|
|
|
20614
21154
|
onRetryClick: onRetryClick,
|
|
20615
21155
|
colors: colors.success,
|
|
20616
21156
|
verbiage: verbiage.success,
|
|
20617
|
-
debugMode: debugMode
|
|
21157
|
+
debugMode: debugMode,
|
|
21158
|
+
initialBarcodeScore:
|
|
21159
|
+
// Show diagnostic info if recapture occurred (indicated by recaptureBarcodeScore being set)
|
|
21160
|
+
// If recapture occurred, initialBarcodeScore was set (even if it's 0, which is valid)
|
|
21161
|
+
state.recaptureBarcodeScore !== null ? state.initialBarcodeScore : undefined,
|
|
21162
|
+
recaptureBarcodeScore: state.recaptureBarcodeScore,
|
|
21163
|
+
initialCaptureBarcodeImage: state.initialCaptureBarcodeImage,
|
|
21164
|
+
recaptureBarcodeImage: state.recaptureBarcodeImage
|
|
20618
21165
|
})));
|
|
20619
21166
|
};
|
|
20620
21167
|
function IdCaptureWizardWithProviders(_a) {
|