idmission-web-sdk 2.3.170-disable-tus-cached-upload-resuming-9bf8fe4 → 2.3.171-feature-barcode-recapture-a8375e9
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 +777 -230
- 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 +777 -230
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +777 -230
- 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/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.3.
|
|
214
|
+
var webSdkVersion = '2.3.170';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -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) {
|
|
@@ -13413,8 +13413,13 @@
|
|
|
13413
13413
|
if (!selectedVideoStreamId) return;
|
|
13414
13414
|
var srcObject = e.currentTarget.srcObject;
|
|
13415
13415
|
if (srcObject.id === selectedVideoStreamId) {
|
|
13416
|
+
var _a = e.currentTarget,
|
|
13417
|
+
videoWidth = _a.videoWidth,
|
|
13418
|
+
videoHeight = _a.videoHeight;
|
|
13416
13419
|
set({
|
|
13417
|
-
videoLoaded: true
|
|
13420
|
+
videoLoaded: true,
|
|
13421
|
+
videoWidth: videoWidth,
|
|
13422
|
+
videoHeight: videoHeight
|
|
13418
13423
|
});
|
|
13419
13424
|
} else {
|
|
13420
13425
|
set({
|
|
@@ -13727,26 +13732,25 @@
|
|
|
13727
13732
|
};
|
|
13728
13733
|
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
13729
13734
|
function CameraStoreProvider(_a) {
|
|
13730
|
-
var _b;
|
|
13731
13735
|
var children = _a.children,
|
|
13732
|
-
|
|
13733
|
-
requestAccessAutomatically =
|
|
13734
|
-
|
|
13735
|
-
preferIphoneContinuityCamera =
|
|
13736
|
-
|
|
13737
|
-
preferFrontFacingCamera =
|
|
13738
|
-
|
|
13739
|
-
maxVideoWidth =
|
|
13736
|
+
_b = _a.requestAccessAutomatically,
|
|
13737
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
13738
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
13739
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
13740
|
+
_d = _a.preferFrontFacingCamera,
|
|
13741
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
13742
|
+
_e = _a.maxVideoWidth,
|
|
13743
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
13740
13744
|
maxFps = _a.maxFps,
|
|
13741
13745
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
13742
13746
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
13743
13747
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
13744
|
-
|
|
13745
|
-
requireMicrophoneAccess =
|
|
13746
|
-
|
|
13747
|
-
classNames =
|
|
13748
|
-
|
|
13749
|
-
verbiage =
|
|
13748
|
+
_f = _a.requireMicrophoneAccess,
|
|
13749
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
13750
|
+
_g = _a.classNames,
|
|
13751
|
+
classNames = _g === void 0 ? {} : _g,
|
|
13752
|
+
_h = _a.verbiage,
|
|
13753
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
13750
13754
|
var videoRef = React.useRef(null);
|
|
13751
13755
|
var store = React.useRef(undefined);
|
|
13752
13756
|
store.current || (store.current = createCameraStore({
|
|
@@ -13760,16 +13764,6 @@
|
|
|
13760
13764
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
13761
13765
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
13762
13766
|
}));
|
|
13763
|
-
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
13764
|
-
videoWidth = _k.videoWidth,
|
|
13765
|
-
videoHeight = _k.videoHeight;
|
|
13766
|
-
React.useEffect(function () {
|
|
13767
|
-
var _a;
|
|
13768
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
13769
|
-
videoWidth: videoWidth,
|
|
13770
|
-
videoHeight: videoHeight
|
|
13771
|
-
});
|
|
13772
|
-
}, [videoWidth, videoHeight]);
|
|
13773
13767
|
React.useEffect(function () {
|
|
13774
13768
|
var _a, _b, _c;
|
|
13775
13769
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -14848,6 +14842,15 @@
|
|
|
14848
14842
|
getBestBarcode: function getBestBarcode() {
|
|
14849
14843
|
return null;
|
|
14850
14844
|
},
|
|
14845
|
+
startBarcodeRecapturePhase: function startBarcodeRecapturePhase() {
|
|
14846
|
+
return null;
|
|
14847
|
+
},
|
|
14848
|
+
getInitialCaptureBestBarcode: function getInitialCaptureBestBarcode() {
|
|
14849
|
+
return null;
|
|
14850
|
+
},
|
|
14851
|
+
getRecaptureBestBarcode: function getRecaptureBestBarcode() {
|
|
14852
|
+
return null;
|
|
14853
|
+
},
|
|
14851
14854
|
requiredDocumentType: 'none',
|
|
14852
14855
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
14853
14856
|
return null;
|
|
@@ -14907,6 +14910,14 @@
|
|
|
14907
14910
|
var bestBarcodeScore = React.useRef(0);
|
|
14908
14911
|
var stopDetection = React.useRef(0);
|
|
14909
14912
|
var analyzeBarcodeReadability = useBarcodeReadabilityAnalysis();
|
|
14913
|
+
// Barcode recapture tracking - separate canvases for initial and recapture sequences
|
|
14914
|
+
var initialCaptureBarcodeCanvas = React.useRef(null);
|
|
14915
|
+
var initialCaptureBarcodeDetails = React.useRef(null);
|
|
14916
|
+
var initialCaptureBarcodeScore = React.useRef(0);
|
|
14917
|
+
var recaptureBarcodeCanvas = React.useRef(null);
|
|
14918
|
+
var recaptureBarcodeDetails = React.useRef(null);
|
|
14919
|
+
var recaptureBarcodeScore = React.useRef(0);
|
|
14920
|
+
var isRecapturePhase = React.useRef(false);
|
|
14910
14921
|
var _h = React.useState('none'),
|
|
14911
14922
|
requiredDocumentType = _h[0],
|
|
14912
14923
|
setRequiredDocumentType = _h[1];
|
|
@@ -14931,10 +14942,10 @@
|
|
|
14931
14942
|
var _this = this;
|
|
14932
14943
|
onDocumentDetected(function (prediction) {
|
|
14933
14944
|
return __awaiter(_this, void 0, void 0, function () {
|
|
14934
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
14935
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14936
|
-
return __generator(this, function (
|
|
14937
|
-
switch (
|
|
14945
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, isInRecapturePhase, shouldRunBarcodeAnalysisDuringRecapture, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult, ctx, barcodeAnalysisResult, ctx;
|
|
14946
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14947
|
+
return __generator(this, function (_k) {
|
|
14948
|
+
switch (_k.label) {
|
|
14938
14949
|
case 0:
|
|
14939
14950
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
14940
14951
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -14948,7 +14959,9 @@
|
|
|
14948
14959
|
prediction.singlePageDetectionThresholdMet = false;
|
|
14949
14960
|
}
|
|
14950
14961
|
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'));
|
|
14951
|
-
|
|
14962
|
+
isInRecapturePhase = isRecapturePhase.current;
|
|
14963
|
+
shouldRunBarcodeAnalysisDuringRecapture = isInRecapturePhase && isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentIsStable && prediction.bestDocument && prediction.bestPDF417;
|
|
14964
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 3];
|
|
14952
14965
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
14953
14966
|
if (focusPrediction) {
|
|
14954
14967
|
focusScore = focusPrediction.score;
|
|
@@ -14971,7 +14984,7 @@
|
|
|
14971
14984
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
14972
14985
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
14973
14986
|
case 1:
|
|
14974
|
-
barcodeAnalysisResult =
|
|
14987
|
+
barcodeAnalysisResult = _k.sent();
|
|
14975
14988
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
14976
14989
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
14977
14990
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -14981,15 +14994,61 @@
|
|
|
14981
14994
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
14982
14995
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
14983
14996
|
}
|
|
14984
|
-
|
|
14997
|
+
// During recapture phase, also track best barcode separately for recapture sequence
|
|
14998
|
+
if (isRecapturePhase.current && recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
14999
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
15000
|
+
recaptureBarcodeDetails.current = (_g = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _g !== void 0 ? _g : null;
|
|
15001
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
15002
|
+
if (bestBarcodeCanvas.current) {
|
|
15003
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
15004
|
+
if (ctx) {
|
|
15005
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15006
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15007
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15008
|
+
}
|
|
15009
|
+
}
|
|
15010
|
+
}
|
|
15011
|
+
_k.label = 2;
|
|
14985
15012
|
case 2:
|
|
15013
|
+
return [3 /*break*/, 5];
|
|
15014
|
+
case 3:
|
|
15015
|
+
if (!shouldRunBarcodeAnalysisDuringRecapture) return [3 /*break*/, 5];
|
|
15016
|
+
if (!(enableBarcodeReadabilityModel && croppedDocumentCanvas.current && stopDetectionAtStart === stopDetection.current)) return [3 /*break*/, 5];
|
|
15017
|
+
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
15018
|
+
case 4:
|
|
15019
|
+
barcodeAnalysisResult = _k.sent();
|
|
15020
|
+
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
15021
|
+
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
15022
|
+
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
15023
|
+
if (barcodeAnalysisResult.newBestBarcodeScore) {
|
|
15024
|
+
bestBarcodeScore.current = barcodeAnalysisResult.newBestBarcodeScore;
|
|
15025
|
+
}
|
|
15026
|
+
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
15027
|
+
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
15028
|
+
}
|
|
15029
|
+
// Track best barcode separately for recapture sequence
|
|
15030
|
+
if (recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
15031
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
15032
|
+
recaptureBarcodeDetails.current = (_h = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _h !== void 0 ? _h : null;
|
|
15033
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
15034
|
+
if (bestBarcodeCanvas.current) {
|
|
15035
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
15036
|
+
if (ctx) {
|
|
15037
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15038
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15039
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15040
|
+
}
|
|
15041
|
+
}
|
|
15042
|
+
}
|
|
15043
|
+
_k.label = 5;
|
|
15044
|
+
case 5:
|
|
14986
15045
|
/**
|
|
14987
15046
|
* @note
|
|
14988
15047
|
* This should ALWAYS be called.
|
|
14989
15048
|
* Do not return early from this function unless
|
|
14990
15049
|
* lastPredictionCanvas.current is not set
|
|
14991
15050
|
*/
|
|
14992
|
-
(
|
|
15051
|
+
(_j = onPredictionHandler.current) === null || _j === void 0 ? void 0 : _j.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
14993
15052
|
focusScore: focusScore,
|
|
14994
15053
|
focusPredictionTime: focusPredictionTime,
|
|
14995
15054
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -15022,19 +15081,58 @@
|
|
|
15022
15081
|
canvas: bestBarcodeCanvas.current
|
|
15023
15082
|
});
|
|
15024
15083
|
}, []);
|
|
15084
|
+
var startBarcodeRecapturePhase = React.useCallback(function () {
|
|
15085
|
+
// Snapshot current best barcode to initial capture canvas
|
|
15086
|
+
if (bestBarcodeCanvas.current && initialCaptureBarcodeCanvas.current) {
|
|
15087
|
+
var ctx = initialCaptureBarcodeCanvas.current.getContext('2d');
|
|
15088
|
+
if (ctx) {
|
|
15089
|
+
initialCaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
15090
|
+
initialCaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
15091
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
initialCaptureBarcodeDetails.current = bestBarcodeDetails.current ? _assign({}, bestBarcodeDetails.current) : null;
|
|
15095
|
+
initialCaptureBarcodeScore.current = bestBarcodeScore.current;
|
|
15096
|
+
// Reset recapture tracking
|
|
15097
|
+
recaptureBarcodeScore.current = 0;
|
|
15098
|
+
recaptureBarcodeDetails.current = null;
|
|
15099
|
+
// Enter recapture phase
|
|
15100
|
+
isRecapturePhase.current = true;
|
|
15101
|
+
}, []);
|
|
15102
|
+
var getInitialCaptureBestBarcode = React.useCallback(function () {
|
|
15103
|
+
if (!initialCaptureBarcodeDetails.current || !initialCaptureBarcodeCanvas.current) return null;
|
|
15104
|
+
return _assign(_assign({}, initialCaptureBarcodeDetails.current), {
|
|
15105
|
+
canvas: initialCaptureBarcodeCanvas.current
|
|
15106
|
+
});
|
|
15107
|
+
}, []);
|
|
15108
|
+
var getRecaptureBestBarcode = React.useCallback(function () {
|
|
15109
|
+
if (!recaptureBarcodeDetails.current || !recaptureBarcodeCanvas.current) return null;
|
|
15110
|
+
return _assign(_assign({}, recaptureBarcodeDetails.current), {
|
|
15111
|
+
canvas: recaptureBarcodeCanvas.current
|
|
15112
|
+
});
|
|
15113
|
+
}, []);
|
|
15025
15114
|
var _j = React.useState(0),
|
|
15026
15115
|
canvasKey = _j[0],
|
|
15027
15116
|
setCanvasKey = _j[1];
|
|
15028
15117
|
var resetBestFrame = React.useCallback(function () {
|
|
15118
|
+
// During recapture phase, preserve all canvas state to avoid race conditions
|
|
15119
|
+
// that could result in black/empty barcode images on slow devices
|
|
15120
|
+
if (isRecapturePhase.current) {
|
|
15121
|
+
return;
|
|
15122
|
+
}
|
|
15029
15123
|
stopDetection.current += 1;
|
|
15030
|
-
setCanvasKey(function (n) {
|
|
15031
|
-
return n + 1;
|
|
15032
|
-
});
|
|
15033
15124
|
clearDocumentDetectionLastPredictionCanvas();
|
|
15034
15125
|
bestFrameDetails.current = null;
|
|
15035
15126
|
bestFocusScore.current = 0;
|
|
15036
15127
|
bestBarcodeScore.current = 0;
|
|
15037
15128
|
bestBarcodeDetails.current = null;
|
|
15129
|
+
setCanvasKey(function (n) {
|
|
15130
|
+
return n + 1;
|
|
15131
|
+
});
|
|
15132
|
+
initialCaptureBarcodeScore.current = 0;
|
|
15133
|
+
initialCaptureBarcodeDetails.current = null;
|
|
15134
|
+
recaptureBarcodeScore.current = 0;
|
|
15135
|
+
recaptureBarcodeDetails.current = null;
|
|
15038
15136
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
15039
15137
|
React.useEffect(function () {
|
|
15040
15138
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -15100,10 +15198,13 @@
|
|
|
15100
15198
|
bestFrameDetails: bestFrameDetails,
|
|
15101
15199
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
15102
15200
|
getBestBarcode: getBestBarcode,
|
|
15201
|
+
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
15202
|
+
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
15203
|
+
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
15103
15204
|
requiredDocumentType: requiredDocumentType,
|
|
15104
15205
|
setRequiredDocumentType: setRequiredDocumentType
|
|
15105
15206
|
};
|
|
15106
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
15207
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, startBarcodeRecapturePhase, getInitialCaptureBestBarcode, getRecaptureBestBarcode, requiredDocumentType]);
|
|
15107
15208
|
return /*#__PURE__*/React.createElement(IdCaptureModelsContext.Provider, {
|
|
15108
15209
|
value: value
|
|
15109
15210
|
}, /*#__PURE__*/React.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -15115,6 +15216,12 @@
|
|
|
15115
15216
|
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15116
15217
|
key: "cd-".concat(canvasKey),
|
|
15117
15218
|
ref: croppedDocumentCanvas
|
|
15219
|
+
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15220
|
+
key: "icb-".concat(canvasKey),
|
|
15221
|
+
ref: initialCaptureBarcodeCanvas
|
|
15222
|
+
}), /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
15223
|
+
key: "rcb-".concat(canvasKey),
|
|
15224
|
+
ref: recaptureBarcodeCanvas
|
|
15118
15225
|
})), children);
|
|
15119
15226
|
}
|
|
15120
15227
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -15572,6 +15679,8 @@
|
|
|
15572
15679
|
singlePageDetectionThresholdMet: false,
|
|
15573
15680
|
focusScore: 0,
|
|
15574
15681
|
focusThresholdMet: false,
|
|
15682
|
+
pdf417PredictionScore: 0,
|
|
15683
|
+
pdf417PredictionThresholdMet: false,
|
|
15575
15684
|
isGoodFrame: false,
|
|
15576
15685
|
goodFramesCount: 0,
|
|
15577
15686
|
goodFramesThreshold: 3,
|
|
@@ -15593,30 +15702,42 @@
|
|
|
15593
15702
|
uploadingDocumentsType: null,
|
|
15594
15703
|
operationStartedAt: null,
|
|
15595
15704
|
captureStartedAt: null,
|
|
15705
|
+
barcodeRecaptureStartedAt: null,
|
|
15706
|
+
initialBarcodeScore: 0,
|
|
15707
|
+
recaptureBarcodeScore: null,
|
|
15708
|
+
barcodeRecaptureThreshold: 0,
|
|
15709
|
+
barcodeRecaptureTimeoutMs: 5000,
|
|
15710
|
+
initialCaptureBarcodeImage: null,
|
|
15711
|
+
recaptureBarcodeImage: null,
|
|
15596
15712
|
dispatch: function dispatch() {
|
|
15597
15713
|
return null;
|
|
15598
15714
|
}
|
|
15599
15715
|
};
|
|
15600
15716
|
var _reducer = function reducer(state, action) {
|
|
15601
15717
|
var _a;
|
|
15718
|
+
var _b, _c;
|
|
15602
15719
|
switch (action.type) {
|
|
15603
15720
|
case 'configureWizard':
|
|
15604
15721
|
{
|
|
15605
|
-
var
|
|
15606
|
-
captureRequirement =
|
|
15607
|
-
precapturedDocuments =
|
|
15608
|
-
allowSinglePageIdCapture =
|
|
15609
|
-
allowIdCardBackToFrontCapture =
|
|
15610
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
15611
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
15612
|
-
allowUploadingDocumentsFromStorage =
|
|
15722
|
+
var _d = action.payload,
|
|
15723
|
+
captureRequirement = _d.captureRequirement,
|
|
15724
|
+
precapturedDocuments = _d.precapturedDocuments,
|
|
15725
|
+
allowSinglePageIdCapture = _d.allowSinglePageIdCapture,
|
|
15726
|
+
allowIdCardBackToFrontCapture = _d.allowIdCardBackToFrontCapture,
|
|
15727
|
+
enableOverrideWrongDocumentTypeDialog = _d.enableOverrideWrongDocumentTypeDialog,
|
|
15728
|
+
allowOverrideWrongDocumentTypeAfterMs = _d.allowOverrideWrongDocumentTypeAfterMs,
|
|
15729
|
+
allowUploadingDocumentsFromStorage = _d.allowUploadingDocumentsFromStorage,
|
|
15730
|
+
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
15731
|
+
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
15613
15732
|
var newState = _assign(_assign({}, state), {
|
|
15614
15733
|
captureRequirement: captureRequirement,
|
|
15615
15734
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
15616
15735
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
15617
15736
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
15618
15737
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
15619
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
15738
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
15739
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
15740
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
15620
15741
|
});
|
|
15621
15742
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
15622
15743
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -15673,26 +15794,28 @@
|
|
|
15673
15794
|
});
|
|
15674
15795
|
case 'objectsDetected':
|
|
15675
15796
|
{
|
|
15676
|
-
var
|
|
15677
|
-
detectedObjects =
|
|
15678
|
-
detectionThresholdMet =
|
|
15679
|
-
detectedDocumentType =
|
|
15680
|
-
idCardFrontDetectionScore =
|
|
15681
|
-
idCardFrontDetectionThresholdMet =
|
|
15682
|
-
idCardBackDetectionScore =
|
|
15683
|
-
idCardBackDetectionThresholdMet =
|
|
15684
|
-
passportDetectionScore =
|
|
15685
|
-
passportDetectionThresholdMet =
|
|
15686
|
-
singlePageDetectionScore =
|
|
15687
|
-
singlePageDetectionThresholdMet =
|
|
15688
|
-
bestDocument =
|
|
15689
|
-
documentInBounds =
|
|
15690
|
-
documentTooClose =
|
|
15691
|
-
documentIsStable =
|
|
15692
|
-
focusScore =
|
|
15693
|
-
focusThresholdMet =
|
|
15694
|
-
|
|
15695
|
-
|
|
15797
|
+
var _e = action.payload.prediction,
|
|
15798
|
+
detectedObjects = _e.detectedObjects,
|
|
15799
|
+
detectionThresholdMet = _e.detectionThresholdMet,
|
|
15800
|
+
detectedDocumentType = _e.detectedDocumentType,
|
|
15801
|
+
idCardFrontDetectionScore = _e.idCardFrontDetectionScore,
|
|
15802
|
+
idCardFrontDetectionThresholdMet = _e.idCardFrontDetectionThresholdMet,
|
|
15803
|
+
idCardBackDetectionScore = _e.idCardBackDetectionScore,
|
|
15804
|
+
idCardBackDetectionThresholdMet = _e.idCardBackDetectionThresholdMet,
|
|
15805
|
+
passportDetectionScore = _e.passportDetectionScore,
|
|
15806
|
+
passportDetectionThresholdMet = _e.passportDetectionThresholdMet,
|
|
15807
|
+
singlePageDetectionScore = _e.singlePageDetectionScore,
|
|
15808
|
+
singlePageDetectionThresholdMet = _e.singlePageDetectionThresholdMet,
|
|
15809
|
+
bestDocument = _e.bestDocument,
|
|
15810
|
+
documentInBounds = _e.documentInBounds,
|
|
15811
|
+
documentTooClose = _e.documentTooClose,
|
|
15812
|
+
documentIsStable = _e.documentIsStable,
|
|
15813
|
+
focusScore = _e.focusScore,
|
|
15814
|
+
focusThresholdMet = _e.focusThresholdMet,
|
|
15815
|
+
pdf417PredictionScore = _e.pdf417PredictionScore,
|
|
15816
|
+
pdf417PredictionThresholdMet = _e.pdf417PredictionThresholdMet,
|
|
15817
|
+
frameWidth = _e.frameWidth,
|
|
15818
|
+
frameHeight = _e.frameHeight;
|
|
15696
15819
|
var frameCapturedAt = new Date();
|
|
15697
15820
|
var frameCaptureRate = 0;
|
|
15698
15821
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -15772,6 +15895,8 @@
|
|
|
15772
15895
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
15773
15896
|
focusScore: focusScore,
|
|
15774
15897
|
focusThresholdMet: focusThresholdMet,
|
|
15898
|
+
pdf417PredictionScore: pdf417PredictionScore,
|
|
15899
|
+
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
15775
15900
|
isGoodFrame: isGoodFrame,
|
|
15776
15901
|
goodFramesCount: goodFramesCount,
|
|
15777
15902
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -15825,7 +15950,18 @@
|
|
|
15825
15950
|
});
|
|
15826
15951
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
15827
15952
|
if (remainingRequirements.length === 0) {
|
|
15828
|
-
|
|
15953
|
+
// Check if we just captured ID back and need barcode recapture
|
|
15954
|
+
var justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
15955
|
+
var barcodeScore = (_c = (_b = state.capturedDocuments.idBarcodeImage) === null || _b === void 0 ? void 0 : _b.barcodeReadabilityScore) !== null && _c !== void 0 ? _c : 0;
|
|
15956
|
+
var needsBarcodeRecapture = justCapturedIdBack && state.barcodeRecaptureThreshold > 0 && barcodeScore < state.barcodeRecaptureThreshold;
|
|
15957
|
+
if (needsBarcodeRecapture) {
|
|
15958
|
+
// Skip 'complete' and go directly to barcode recapture
|
|
15959
|
+
newState.captureState = 'requestingBetterBarcode';
|
|
15960
|
+
newState.barcodeRecaptureStartedAt = new Date();
|
|
15961
|
+
newState.initialBarcodeScore = barcodeScore;
|
|
15962
|
+
} else {
|
|
15963
|
+
newState.captureState = 'complete';
|
|
15964
|
+
}
|
|
15829
15965
|
} else {
|
|
15830
15966
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
15831
15967
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -15852,8 +15988,8 @@
|
|
|
15852
15988
|
case 'documentsCaptured':
|
|
15853
15989
|
{
|
|
15854
15990
|
var newState = _assign({}, state);
|
|
15855
|
-
for (var
|
|
15856
|
-
var doc =
|
|
15991
|
+
for (var _f = 0, _g = action.payload; _f < _g.length; _f++) {
|
|
15992
|
+
var doc = _g[_f];
|
|
15857
15993
|
newState = _reducer(newState, {
|
|
15858
15994
|
type: 'documentCaptured',
|
|
15859
15995
|
payload: doc
|
|
@@ -15903,13 +16039,49 @@
|
|
|
15903
16039
|
requestedDocumentType: requestedDocumentType
|
|
15904
16040
|
});
|
|
15905
16041
|
}
|
|
16042
|
+
case 'barcodeRecaptureStarted':
|
|
16043
|
+
return _assign(_assign({}, state), {
|
|
16044
|
+
captureState: 'requestingBetterBarcode',
|
|
16045
|
+
barcodeRecaptureStartedAt: new Date(),
|
|
16046
|
+
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
16047
|
+
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
16048
|
+
recaptureBarcodeScore: null,
|
|
16049
|
+
recaptureBarcodeImage: null,
|
|
16050
|
+
goodFramesCount: 0,
|
|
16051
|
+
capturing: false
|
|
16052
|
+
});
|
|
16053
|
+
case 'barcodeRecaptureScoreUpdated':
|
|
16054
|
+
return _assign(_assign({}, state), {
|
|
16055
|
+
recaptureBarcodeScore: action.payload.recaptureBarcodeScore
|
|
16056
|
+
});
|
|
16057
|
+
case 'recaptureBarcodeImageCaptured':
|
|
16058
|
+
return _assign(_assign({}, state), {
|
|
16059
|
+
recaptureBarcodeImage: action.payload.recaptureBarcodeImage
|
|
16060
|
+
});
|
|
16061
|
+
case 'barcodeRecaptureCompleted':
|
|
16062
|
+
return _assign(_assign({}, state), {
|
|
16063
|
+
captureState: 'complete',
|
|
16064
|
+
barcodeRecaptureStartedAt: null
|
|
16065
|
+
});
|
|
15906
16066
|
case 'resetWizard':
|
|
15907
16067
|
return _assign(_assign({}, initialState$5), {
|
|
15908
16068
|
dispatch: state.dispatch,
|
|
16069
|
+
// Preserve all configuration values
|
|
16070
|
+
captureRequirement: state.captureRequirement,
|
|
16071
|
+
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
16072
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
16073
|
+
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
16074
|
+
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
15909
16075
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
16076
|
+
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
16077
|
+
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
16078
|
+
// Reset capture-specific state
|
|
15910
16079
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
15911
|
-
|
|
15912
|
-
|
|
16080
|
+
barcodeRecaptureStartedAt: null,
|
|
16081
|
+
initialBarcodeScore: 0,
|
|
16082
|
+
recaptureBarcodeScore: null,
|
|
16083
|
+
initialCaptureBarcodeImage: null,
|
|
16084
|
+
recaptureBarcodeImage: null
|
|
15913
16085
|
});
|
|
15914
16086
|
default:
|
|
15915
16087
|
return state;
|
|
@@ -16341,36 +16513,36 @@
|
|
|
16341
16513
|
}
|
|
16342
16514
|
|
|
16343
16515
|
var IdCapture = function IdCapture(_a) {
|
|
16344
|
-
var _b, _c, _d, _e, _f, _g;
|
|
16516
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16345
16517
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
16346
|
-
|
|
16347
|
-
thresholds =
|
|
16518
|
+
_k = _a.thresholds,
|
|
16519
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
16348
16520
|
guidanceMessage = _a.guidanceMessage,
|
|
16349
16521
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
16350
16522
|
onCapture = _a.onCapture,
|
|
16351
|
-
|
|
16352
|
-
classNames =
|
|
16353
|
-
|
|
16354
|
-
colors =
|
|
16355
|
-
|
|
16356
|
-
rawVerbiage =
|
|
16357
|
-
|
|
16358
|
-
debugMode =
|
|
16359
|
-
var
|
|
16360
|
-
ref =
|
|
16361
|
-
|
|
16362
|
-
width =
|
|
16363
|
-
|
|
16364
|
-
height =
|
|
16523
|
+
_l = _a.classNames,
|
|
16524
|
+
classNames = _l === void 0 ? {} : _l,
|
|
16525
|
+
_m = _a.colors,
|
|
16526
|
+
colors = _m === void 0 ? {} : _m,
|
|
16527
|
+
_o = _a.verbiage,
|
|
16528
|
+
rawVerbiage = _o === void 0 ? {} : _o,
|
|
16529
|
+
_p = _a.debugMode,
|
|
16530
|
+
debugMode = _p === void 0 ? false : _p;
|
|
16531
|
+
var _q = useResizeObserver(),
|
|
16532
|
+
ref = _q.ref,
|
|
16533
|
+
_r = _q.width,
|
|
16534
|
+
width = _r === void 0 ? 1 : _r,
|
|
16535
|
+
_s = _q.height,
|
|
16536
|
+
height = _s === void 0 ? 1 : _s;
|
|
16365
16537
|
var state = useIdCaptureStore();
|
|
16366
16538
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
16367
|
-
var
|
|
16368
|
-
modelsReady =
|
|
16369
|
-
setThresholds =
|
|
16370
|
-
detectionTime =
|
|
16371
|
-
focusPredictionTime =
|
|
16372
|
-
getBestFrame =
|
|
16373
|
-
getBestBarcode =
|
|
16539
|
+
var _t = useIdCaptureModelsContext(),
|
|
16540
|
+
modelsReady = _t.ready,
|
|
16541
|
+
setThresholds = _t.setThresholds,
|
|
16542
|
+
detectionTime = _t.detectionTime,
|
|
16543
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
16544
|
+
getBestFrame = _t.getBestFrame,
|
|
16545
|
+
getBestBarcode = _t.getBestBarcode;
|
|
16374
16546
|
React.useEffect(function () {
|
|
16375
16547
|
return dispatchIdCaptureAction({
|
|
16376
16548
|
type: 'captureInitialized'
|
|
@@ -16395,7 +16567,7 @@
|
|
|
16395
16567
|
}
|
|
16396
16568
|
});
|
|
16397
16569
|
}, [height, width]);
|
|
16398
|
-
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
16570
|
+
var shouldCapture = state.captureState === 'capturing' && state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
16399
16571
|
React.useEffect(function () {
|
|
16400
16572
|
if (!shouldCapture) return;
|
|
16401
16573
|
dispatchIdCaptureAction({
|
|
@@ -16495,13 +16667,18 @@
|
|
|
16495
16667
|
"$flipX": !isRearFacing,
|
|
16496
16668
|
scaling: debugScalingDetails
|
|
16497
16669
|
}, state.detectedObjects.map(function (obj, i) {
|
|
16670
|
+
// During barcode recapture, render PDF417 barcodes with green color
|
|
16671
|
+
var isBarcodeRecapture = state.captureState === 'requestingBetterBarcode';
|
|
16672
|
+
var isBarcode = obj.label === 'PDF417';
|
|
16673
|
+
var color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
16498
16674
|
return /*#__PURE__*/React.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
16499
16675
|
key: i,
|
|
16500
16676
|
obj: obj,
|
|
16501
16677
|
scaling: debugScalingDetails,
|
|
16502
|
-
flipX: !isRearFacing
|
|
16678
|
+
flipX: !isRearFacing,
|
|
16679
|
+
color: color
|
|
16503
16680
|
});
|
|
16504
|
-
}))), 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")))));
|
|
16681
|
+
}))), 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")))));
|
|
16505
16682
|
};
|
|
16506
16683
|
var timeSince = function timeSince(t) {
|
|
16507
16684
|
if (!t) return 0;
|
|
@@ -17396,11 +17573,11 @@
|
|
|
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.progressBarBackgroundOpacity) !== null && _d !== void 0 ? _d : 0.75;
|
|
17398
17575
|
});
|
|
17399
|
-
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
17576
|
+
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
17400
17577
|
var _a, _b, _c, _d;
|
|
17401
17578
|
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)';
|
|
17402
17579
|
});
|
|
17403
|
-
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$
|
|
17580
|
+
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) {
|
|
17404
17581
|
var _a, _b, _c, _d, _e, _f;
|
|
17405
17582
|
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, ";") : '';
|
|
17406
17583
|
}, function (props) {
|
|
@@ -17419,7 +17596,7 @@
|
|
|
17419
17596
|
var _a, _b, _c, _d;
|
|
17420
17597
|
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';
|
|
17421
17598
|
});
|
|
17422
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
17599
|
+
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;
|
|
17423
17600
|
|
|
17424
17601
|
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"])));
|
|
17425
17602
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -17606,6 +17783,14 @@
|
|
|
17606
17783
|
var templateObject_1$D, templateObject_2$z;
|
|
17607
17784
|
|
|
17608
17785
|
var imageDisplayOrder = ['idCardFront', 'idCardBack', 'idBarcodeImage', 'passport', 'singlePage', 'idFrontIrImage', 'idBackIrImage', 'idFrontUvImage', 'idBackUvImage'];
|
|
17786
|
+
var downloadImage = function downloadImage(dataUrl, filename) {
|
|
17787
|
+
var link = document.createElement('a');
|
|
17788
|
+
link.href = dataUrl;
|
|
17789
|
+
link.download = filename;
|
|
17790
|
+
document.body.appendChild(link);
|
|
17791
|
+
link.click();
|
|
17792
|
+
document.body.removeChild(link);
|
|
17793
|
+
};
|
|
17609
17794
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
17610
17795
|
var capturedDocuments = _a.capturedDocuments,
|
|
17611
17796
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -17617,8 +17802,22 @@
|
|
|
17617
17802
|
_d = _a.verbiage,
|
|
17618
17803
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
17619
17804
|
_e = _a.debugMode,
|
|
17620
|
-
debugMode = _e === void 0 ? false : _e
|
|
17805
|
+
debugMode = _e === void 0 ? false : _e,
|
|
17806
|
+
initialBarcodeScore = _a.initialBarcodeScore,
|
|
17807
|
+
recaptureBarcodeScore = _a.recaptureBarcodeScore,
|
|
17808
|
+
initialCaptureBarcodeImage = _a.initialCaptureBarcodeImage,
|
|
17809
|
+
recaptureBarcodeImage = _a.recaptureBarcodeImage;
|
|
17621
17810
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
17811
|
+
if (debugMode) {
|
|
17812
|
+
log('[IdCaptureSuccess] Debug info:', {
|
|
17813
|
+
debugMode: debugMode,
|
|
17814
|
+
initialBarcodeScore: initialBarcodeScore,
|
|
17815
|
+
recaptureBarcodeScore: recaptureBarcodeScore,
|
|
17816
|
+
shouldShow: debugMode && initialBarcodeScore !== undefined,
|
|
17817
|
+
condition1: debugMode,
|
|
17818
|
+
condition2: initialBarcodeScore !== undefined
|
|
17819
|
+
});
|
|
17820
|
+
}
|
|
17622
17821
|
var verbiage = useTranslations(rawVerbiage, {
|
|
17623
17822
|
headingText: 'ID Capture Successful',
|
|
17624
17823
|
retryText: 'Retry',
|
|
@@ -17638,6 +17837,7 @@
|
|
|
17638
17837
|
}, /*#__PURE__*/React.createElement(ImageRow, {
|
|
17639
17838
|
className: classNames.imageRow
|
|
17640
17839
|
}, imageDisplayOrder.map(function (name) {
|
|
17840
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17641
17841
|
var doc = capturedDocuments[name];
|
|
17642
17842
|
if (!doc) return null;
|
|
17643
17843
|
return /*#__PURE__*/React.createElement(ImageCol$1, {
|
|
@@ -17647,7 +17847,57 @@
|
|
|
17647
17847
|
image: doc,
|
|
17648
17848
|
className: classNames.image,
|
|
17649
17849
|
alt: doc.documentType
|
|
17650
|
-
}), debugMode && (/*#__PURE__*/React.createElement(
|
|
17850
|
+
}), 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, {
|
|
17851
|
+
"$score": (_a = doc.barcodeReadabilityScore) !== null && _a !== void 0 ? _a : 0,
|
|
17852
|
+
"$type": "readability"
|
|
17853
|
+
}, ((_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, {
|
|
17854
|
+
"$improved": recaptureBarcodeScore > initialBarcodeScore
|
|
17855
|
+
}, 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, {
|
|
17856
|
+
style: {
|
|
17857
|
+
marginTop: '0.25rem'
|
|
17858
|
+
}
|
|
17859
|
+
}, "\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, {
|
|
17860
|
+
src: initialCaptureBarcodeImage,
|
|
17861
|
+
alt: "Initial capture barcode",
|
|
17862
|
+
onDoubleClick: function onDoubleClick() {
|
|
17863
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
17864
|
+
},
|
|
17865
|
+
title: "Double-click to download"
|
|
17866
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17867
|
+
"$isHigher": initialBarcodeScore >= recaptureBarcodeScore
|
|
17868
|
+
}, initialBarcodeScore.toFixed(3)))), recaptureBarcodeImage && (/*#__PURE__*/React.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React.createElement(BarcodeComparisonImageLabel, null, "Recapture"), /*#__PURE__*/React.createElement(BarcodeComparisonImage, {
|
|
17869
|
+
src: recaptureBarcodeImage,
|
|
17870
|
+
alt: "Recapture barcode",
|
|
17871
|
+
onDoubleClick: function onDoubleClick() {
|
|
17872
|
+
return downloadImage(recaptureBarcodeImage, "barcode-recapture-".concat(recaptureBarcodeScore.toFixed(3), ".jpg"));
|
|
17873
|
+
},
|
|
17874
|
+
title: "Double-click to download"
|
|
17875
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17876
|
+
"$isHigher": recaptureBarcodeScore > initialBarcodeScore
|
|
17877
|
+
}, 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, {
|
|
17878
|
+
style: {
|
|
17879
|
+
marginTop: '0.25rem'
|
|
17880
|
+
}
|
|
17881
|
+
}, "\uD83D\uDD0D Barcode Image (kept)"), /*#__PURE__*/React.createElement(BarcodeComparisonImagesContainer, {
|
|
17882
|
+
style: {
|
|
17883
|
+
gridTemplateColumns: '1fr'
|
|
17884
|
+
}
|
|
17885
|
+
}, /*#__PURE__*/React.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React.createElement(BarcodeComparisonImage, {
|
|
17886
|
+
src: initialCaptureBarcodeImage,
|
|
17887
|
+
alt: "Initial capture barcode",
|
|
17888
|
+
onDoubleClick: function onDoubleClick() {
|
|
17889
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
17890
|
+
},
|
|
17891
|
+
title: "Double-click to download"
|
|
17892
|
+
}), /*#__PURE__*/React.createElement(BarcodeComparisonScoreLabel, {
|
|
17893
|
+
"$isHigher": true
|
|
17894
|
+
}, 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, {
|
|
17895
|
+
"$score": (_c = doc.detectionScore) !== null && _c !== void 0 ? _c : 0,
|
|
17896
|
+
"$type": "detection"
|
|
17897
|
+
}, ((_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, {
|
|
17898
|
+
"$score": (_e = doc.focusScore) !== null && _e !== void 0 ? _e : 0,
|
|
17899
|
+
"$type": "focus"
|
|
17900
|
+
}, ((_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))))))));
|
|
17651
17901
|
}))), /*#__PURE__*/React.createElement(ButtonsColumn, {
|
|
17652
17902
|
className: classNames.buttonsRow
|
|
17653
17903
|
}, /*#__PURE__*/React.createElement(WideButton, {
|
|
@@ -17670,8 +17920,91 @@
|
|
|
17670
17920
|
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"])));
|
|
17671
17921
|
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"])));
|
|
17672
17922
|
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"])));
|
|
17673
|
-
var
|
|
17674
|
-
var
|
|
17923
|
+
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"])));
|
|
17924
|
+
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"])));
|
|
17925
|
+
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"])));
|
|
17926
|
+
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"])));
|
|
17927
|
+
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) {
|
|
17928
|
+
var $score = _a.$score,
|
|
17929
|
+
$type = _a.$type;
|
|
17930
|
+
var thresholds = $type === 'readability' ? {
|
|
17931
|
+
good: 0.5,
|
|
17932
|
+
medium: 0.2
|
|
17933
|
+
} : $type === 'detection' ? {
|
|
17934
|
+
good: 0.7,
|
|
17935
|
+
medium: 0.4
|
|
17936
|
+
} : {
|
|
17937
|
+
good: 0.7,
|
|
17938
|
+
medium: 0.4
|
|
17939
|
+
};
|
|
17940
|
+
if ($score >= thresholds.good) return '#d4edda';
|
|
17941
|
+
if ($score >= thresholds.medium) return '#fff3cd';
|
|
17942
|
+
return '#f8d7da';
|
|
17943
|
+
}, function (_a) {
|
|
17944
|
+
var $score = _a.$score,
|
|
17945
|
+
$type = _a.$type;
|
|
17946
|
+
var thresholds = $type === 'readability' ? {
|
|
17947
|
+
good: 0.5,
|
|
17948
|
+
medium: 0.2
|
|
17949
|
+
} : $type === 'detection' ? {
|
|
17950
|
+
good: 0.7,
|
|
17951
|
+
medium: 0.4
|
|
17952
|
+
} : {
|
|
17953
|
+
good: 0.7,
|
|
17954
|
+
medium: 0.4
|
|
17955
|
+
};
|
|
17956
|
+
if ($score >= thresholds.good) return '#155724';
|
|
17957
|
+
if ($score >= thresholds.medium) return '#856404';
|
|
17958
|
+
return '#721c24';
|
|
17959
|
+
}, function (_a) {
|
|
17960
|
+
var $score = _a.$score,
|
|
17961
|
+
$type = _a.$type;
|
|
17962
|
+
var thresholds = $type === 'readability' ? {
|
|
17963
|
+
good: 0.5,
|
|
17964
|
+
medium: 0.2
|
|
17965
|
+
} : $type === 'detection' ? {
|
|
17966
|
+
good: 0.7,
|
|
17967
|
+
medium: 0.4
|
|
17968
|
+
} : {
|
|
17969
|
+
good: 0.7,
|
|
17970
|
+
medium: 0.4
|
|
17971
|
+
};
|
|
17972
|
+
if ($score >= thresholds.good) return '#c3e6cb';
|
|
17973
|
+
if ($score >= thresholds.medium) return '#ffeaa7';
|
|
17974
|
+
return '#f5c6cb';
|
|
17975
|
+
});
|
|
17976
|
+
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"])));
|
|
17977
|
+
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"])));
|
|
17978
|
+
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"])));
|
|
17979
|
+
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"])));
|
|
17980
|
+
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"])));
|
|
17981
|
+
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"])));
|
|
17982
|
+
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"])));
|
|
17983
|
+
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) {
|
|
17984
|
+
var $improved = _a.$improved;
|
|
17985
|
+
return $improved ? '#d4edda' : '#e2e3e5';
|
|
17986
|
+
}, function (_a) {
|
|
17987
|
+
var $improved = _a.$improved;
|
|
17988
|
+
return $improved ? '#155724' : '#383d41';
|
|
17989
|
+
}, function (_a) {
|
|
17990
|
+
var $improved = _a.$improved;
|
|
17991
|
+
return $improved ? '#c3e6cb' : '#d6d8db';
|
|
17992
|
+
});
|
|
17993
|
+
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"])));
|
|
17994
|
+
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"])));
|
|
17995
|
+
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"])));
|
|
17996
|
+
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"])));
|
|
17997
|
+
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) {
|
|
17998
|
+
var $isHigher = _a.$isHigher;
|
|
17999
|
+
return $isHigher ? '#155724' : '#495057';
|
|
18000
|
+
}, function (_a) {
|
|
18001
|
+
var $isHigher = _a.$isHigher;
|
|
18002
|
+
return $isHigher ? '#d4edda' : 'white';
|
|
18003
|
+
}, function (_a) {
|
|
18004
|
+
var $isHigher = _a.$isHigher;
|
|
18005
|
+
return $isHigher ? '#c3e6cb' : '#dee2e6';
|
|
18006
|
+
});
|
|
18007
|
+
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;
|
|
17675
18008
|
|
|
17676
18009
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
17677
18010
|
var _this = this;
|
|
@@ -20201,7 +20534,7 @@
|
|
|
20201
20534
|
none: null
|
|
20202
20535
|
};
|
|
20203
20536
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
20204
|
-
var _b, _c, _d, _e, _f;
|
|
20537
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
20205
20538
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
20206
20539
|
onLoadingProgress = _a.onLoadingProgress,
|
|
20207
20540
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -20212,86 +20545,115 @@
|
|
|
20212
20545
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
20213
20546
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
20214
20547
|
onDocumentDetected = _a.onDocumentDetected,
|
|
20215
|
-
|
|
20216
|
-
documentDetectionThrottleMs =
|
|
20217
|
-
|
|
20218
|
-
loadingOverlayMode =
|
|
20548
|
+
_m = _a.documentDetectionThrottleMs,
|
|
20549
|
+
documentDetectionThrottleMs = _m === void 0 ? 0 : _m,
|
|
20550
|
+
_o = _a.loadingOverlayMode,
|
|
20551
|
+
loadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
20219
20552
|
customOverlayContent = _a.customOverlayContent,
|
|
20220
20553
|
precapturedDocuments = _a.precapturedDocuments,
|
|
20221
|
-
|
|
20222
|
-
captureRequirement =
|
|
20223
|
-
|
|
20224
|
-
allowSinglePageIdCapture =
|
|
20225
|
-
|
|
20226
|
-
separateIdCardCaptureSequence =
|
|
20227
|
-
|
|
20228
|
-
thresholds =
|
|
20229
|
-
|
|
20230
|
-
skipSuccessScreen =
|
|
20554
|
+
_p = _a.captureRequirement,
|
|
20555
|
+
captureRequirement = _p === void 0 ? 'idCardOrPassport' : _p,
|
|
20556
|
+
_q = _a.allowSinglePageIdCapture,
|
|
20557
|
+
allowSinglePageIdCapture = _q === void 0 ? false : _q,
|
|
20558
|
+
_r = _a.separateIdCardCaptureSequence,
|
|
20559
|
+
separateIdCardCaptureSequence = _r === void 0 ? false : _r,
|
|
20560
|
+
_s = _a.thresholds,
|
|
20561
|
+
thresholds = _s === void 0 ? defaultIdCaptureThresholds : _s,
|
|
20562
|
+
_t = _a.skipSuccessScreen,
|
|
20563
|
+
skipSuccessScreen = _t === void 0 ? false : _t,
|
|
20231
20564
|
instructions = _a.instructions,
|
|
20232
|
-
|
|
20233
|
-
releaseCameraAccessOnExit =
|
|
20234
|
-
|
|
20235
|
-
guideType =
|
|
20236
|
-
|
|
20237
|
-
portraitGuidesOnMobile =
|
|
20238
|
-
|
|
20239
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
20240
|
-
|
|
20241
|
-
silentFallback =
|
|
20242
|
-
|
|
20243
|
-
forceFallbackMode =
|
|
20244
|
-
|
|
20245
|
-
allowIdCardBackToFrontCapture =
|
|
20246
|
-
|
|
20247
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
20248
|
-
|
|
20249
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
20250
|
-
|
|
20251
|
-
allowUploadingDocumentsFromStorage =
|
|
20252
|
-
|
|
20253
|
-
guideImages =
|
|
20254
|
-
|
|
20255
|
-
|
|
20256
|
-
|
|
20257
|
-
|
|
20258
|
-
|
|
20259
|
-
|
|
20260
|
-
|
|
20261
|
-
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
|
|
20265
|
-
|
|
20565
|
+
_u = _a.releaseCameraAccessOnExit,
|
|
20566
|
+
releaseCameraAccessOnExit = _u === void 0 ? true : _u,
|
|
20567
|
+
_v = _a.guideType,
|
|
20568
|
+
guideType = _v === void 0 ? 'fit' : _v,
|
|
20569
|
+
_w = _a.portraitGuidesOnMobile,
|
|
20570
|
+
portraitGuidesOnMobile = _w === void 0 ? true : _w,
|
|
20571
|
+
_x = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
20572
|
+
rotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
|
|
20573
|
+
_y = _a.silentFallback,
|
|
20574
|
+
silentFallback = _y === void 0 ? false : _y,
|
|
20575
|
+
_z = _a.forceFallbackMode,
|
|
20576
|
+
forceFallbackMode = _z === void 0 ? false : _z,
|
|
20577
|
+
_0 = _a.allowIdCardBackToFrontCapture,
|
|
20578
|
+
allowIdCardBackToFrontCapture = _0 === void 0 ? false : _0,
|
|
20579
|
+
_1 = _a.enableOverrideWrongDocumentTypeDialog,
|
|
20580
|
+
enableOverrideWrongDocumentTypeDialog = _1 === void 0 ? false : _1,
|
|
20581
|
+
_2 = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
20582
|
+
allowOverrideWrongDocumentTypeAfterMs = _2 === void 0 ? 8000 : _2,
|
|
20583
|
+
_3 = _a.allowUploadingDocumentsFromStorage,
|
|
20584
|
+
allowUploadingDocumentsFromStorage = _3 === void 0 ? false : _3,
|
|
20585
|
+
_4 = _a.guideImages,
|
|
20586
|
+
guideImages = _4 === void 0 ? defaultIdCaptureGuideImages : _4,
|
|
20587
|
+
_5 = _a.barcodeRecaptureThreshold,
|
|
20588
|
+
barcodeRecaptureThreshold = _5 === void 0 ? 1 : _5,
|
|
20589
|
+
_6 = _a.barcodeRecaptureTimeoutMs,
|
|
20590
|
+
barcodeRecaptureTimeoutMs = _6 === void 0 ? 5000 : _6,
|
|
20591
|
+
_7 = _a.barcodeRecaptureMoveCloserTimeoutMs,
|
|
20592
|
+
barcodeRecaptureMoveCloserTimeoutMs = _7 === void 0 ? 10000 : _7,
|
|
20593
|
+
_8 = _a.barcodeRecaptureBboxGrowthPct,
|
|
20594
|
+
barcodeRecaptureBboxGrowthPct = _8 === void 0 ? 20 : _8,
|
|
20595
|
+
_9 = _a.documentEdgeDistancePct,
|
|
20596
|
+
documentEdgeDistancePct = _9 === void 0 ? 0 : _9,
|
|
20597
|
+
_10 = _a.assets,
|
|
20598
|
+
assets = _10 === void 0 ? {} : _10,
|
|
20599
|
+
_11 = _a.classNames,
|
|
20600
|
+
classNames = _11 === void 0 ? {} : _11,
|
|
20601
|
+
_12 = _a.colors,
|
|
20602
|
+
colors = _12 === void 0 ? {} : _12,
|
|
20603
|
+
_13 = _a.verbiage,
|
|
20604
|
+
verbiage = _13 === void 0 ? {} : _13,
|
|
20605
|
+
_14 = _a.debugMode,
|
|
20606
|
+
debugMode = _14 === void 0 ? false : _14;
|
|
20266
20607
|
var state = useIdCaptureStore();
|
|
20267
|
-
var
|
|
20268
|
-
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20280
|
-
|
|
20281
|
-
|
|
20282
|
-
|
|
20283
|
-
|
|
20284
|
-
|
|
20285
|
-
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20608
|
+
var isCapturing = state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode';
|
|
20609
|
+
var _15 = useCameraStore(),
|
|
20610
|
+
cameraAccessDenied = _15.cameraAccessDenied,
|
|
20611
|
+
requestCameraAccess = _15.requestCameraAccess,
|
|
20612
|
+
releaseCameraAccess = _15.releaseCameraAccess;
|
|
20613
|
+
var _16 = React.useState(false),
|
|
20614
|
+
overlayDismissed = _16[0],
|
|
20615
|
+
setOverlayDismissed = _16[1];
|
|
20616
|
+
var _17 = useSubmissionContext(),
|
|
20617
|
+
submissionStatus = _17.submissionStatus,
|
|
20618
|
+
setIdFrontImage = _17.setIdFrontImage,
|
|
20619
|
+
setIdBackImage = _17.setIdBackImage,
|
|
20620
|
+
setPassportImage = _17.setPassportImage,
|
|
20621
|
+
setIdFrontIrImage = _17.setIdFrontIrImage,
|
|
20622
|
+
setIdBackIrImage = _17.setIdBackIrImage,
|
|
20623
|
+
setIdFrontUvImage = _17.setIdFrontUvImage,
|
|
20624
|
+
setIdBackUvImage = _17.setIdBackUvImage,
|
|
20625
|
+
setIdBarcodeImage = _17.setIdBarcodeImage,
|
|
20626
|
+
logIdFrontCaptureAttempt = _17.logIdFrontCaptureAttempt,
|
|
20627
|
+
logIdBackCaptureAttempt = _17.logIdBackCaptureAttempt;
|
|
20628
|
+
var _18 = useIdCaptureModelsContext(),
|
|
20629
|
+
start = _18.start,
|
|
20630
|
+
stop = _18.stop,
|
|
20631
|
+
onPredictionMade = _18.onPredictionMade,
|
|
20632
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
20633
|
+
modelError = _18.modelError,
|
|
20634
|
+
resetBestFrame = _18.resetBestFrame,
|
|
20635
|
+
documentDetectionBoundaries = _18.documentDetectionBoundaries,
|
|
20636
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
20637
|
+
getBestBarcode = _18.getBestBarcode,
|
|
20638
|
+
startBarcodeRecapturePhase = _18.startBarcodeRecapturePhase,
|
|
20639
|
+
getRecaptureBestBarcode = _18.getRecaptureBestBarcode;
|
|
20640
|
+
var initialBarcodeBboxRef = React.useRef(null);
|
|
20641
|
+
var recapturePhaseStartedRef = React.useRef(false);
|
|
20642
|
+
var _19 = React.useState(false),
|
|
20643
|
+
barcodeRecaptureGrowthSatisfied = _19[0],
|
|
20644
|
+
setBarcodeRecaptureGrowthSatisfied = _19[1];
|
|
20645
|
+
React.useEffect(function () {
|
|
20646
|
+
// Reset recapture gating whenever we enter/exit the recapture flow
|
|
20647
|
+
if (state.captureState === 'requestingBetterBarcode') {
|
|
20648
|
+
initialBarcodeBboxRef.current = null;
|
|
20649
|
+
recapturePhaseStartedRef.current = false;
|
|
20650
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
20651
|
+
return;
|
|
20652
|
+
}
|
|
20653
|
+
initialBarcodeBboxRef.current = null;
|
|
20654
|
+
recapturePhaseStartedRef.current = false;
|
|
20655
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
20656
|
+
}, [state.captureState]);
|
|
20295
20657
|
React.useEffect(function () {
|
|
20296
20658
|
dispatchIdCaptureAction({
|
|
20297
20659
|
type: 'configureWizard',
|
|
@@ -20302,10 +20664,12 @@
|
|
|
20302
20664
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
20303
20665
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
20304
20666
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
20305
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
20667
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
20668
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
20669
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
20306
20670
|
}
|
|
20307
20671
|
});
|
|
20308
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
20672
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, barcodeRecaptureThreshold, barcodeRecaptureTimeoutMs, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
20309
20673
|
React.useEffect(function () {
|
|
20310
20674
|
var _a;
|
|
20311
20675
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -20317,8 +20681,10 @@
|
|
|
20317
20681
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
20318
20682
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
20319
20683
|
React.useEffect(function () {
|
|
20684
|
+
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
20685
|
+
if (state.captureState === 'requestingBetterBarcode') return;
|
|
20320
20686
|
if (documentCount) resetBestFrame();
|
|
20321
|
-
}, [documentCount, resetBestFrame]);
|
|
20687
|
+
}, [documentCount, resetBestFrame, state.captureState]);
|
|
20322
20688
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
20323
20689
|
var lastDocumentDetectedAt = React.useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
20324
20690
|
var logCaptureMetadata = React.useCallback(function (metadata) {
|
|
@@ -20337,24 +20703,62 @@
|
|
|
20337
20703
|
}
|
|
20338
20704
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
20339
20705
|
React.useEffect(function startModelsWhenCapturing() {
|
|
20340
|
-
if (!overlayDismissed ||
|
|
20706
|
+
if (!overlayDismissed || !isCapturing) return;
|
|
20341
20707
|
dispatchIdCaptureAction({
|
|
20342
20708
|
type: 'captureStarted'
|
|
20343
20709
|
});
|
|
20344
20710
|
start();
|
|
20345
|
-
}, [overlayDismissed, start
|
|
20711
|
+
}, [isCapturing, overlayDismissed, start]);
|
|
20346
20712
|
React.useEffect(function () {
|
|
20347
20713
|
onPredictionMade(function (prediction) {
|
|
20348
|
-
var _a;
|
|
20349
|
-
var
|
|
20350
|
-
captureState =
|
|
20351
|
-
requestedDocumentType =
|
|
20714
|
+
var _a, _b, _c, _d;
|
|
20715
|
+
var _e = useIdCaptureStore.getState(),
|
|
20716
|
+
captureState = _e.captureState,
|
|
20717
|
+
requestedDocumentType = _e.requestedDocumentType;
|
|
20352
20718
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
20353
20719
|
var thresholdMet = prediction[k];
|
|
20354
|
-
if (captureState === 'capturing') {
|
|
20720
|
+
if (captureState === 'capturing' || captureState === 'requestingBetterBarcode') {
|
|
20721
|
+
// During barcode recapture, wait until the barcode bbox grows by a configurable %
|
|
20722
|
+
// (to confirm the user moved the camera closer) before we start recapture processing.
|
|
20723
|
+
if (captureState === 'requestingBetterBarcode') {
|
|
20724
|
+
var growthPct = Math.max(0, Math.min(barcodeRecaptureBboxGrowthPct, 200));
|
|
20725
|
+
var requiredMultiplier = 1 + growthPct / 100;
|
|
20726
|
+
if (!recapturePhaseStartedRef.current) {
|
|
20727
|
+
// If growth requirement is disabled, begin recapture immediately.
|
|
20728
|
+
if (requiredMultiplier === 1) {
|
|
20729
|
+
recapturePhaseStartedRef.current = true;
|
|
20730
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
20731
|
+
startBarcodeRecapturePhase();
|
|
20732
|
+
} else {
|
|
20733
|
+
var pdf417Box = (_a = prediction.bestPDF417) === null || _a === void 0 ? void 0 : _a.box;
|
|
20734
|
+
var frameWidth = (_b = prediction.frameWidth) !== null && _b !== void 0 ? _b : 0;
|
|
20735
|
+
var frameHeight = (_c = prediction.frameHeight) !== null && _c !== void 0 ? _c : 0;
|
|
20736
|
+
if (pdf417Box && frameWidth > 0 && frameHeight > 0) {
|
|
20737
|
+
var widthRatio = pdf417Box.width / frameWidth;
|
|
20738
|
+
var heightRatio = pdf417Box.height / frameHeight;
|
|
20739
|
+
if (!initialBarcodeBboxRef.current) {
|
|
20740
|
+
// First observed bbox when we enter recapture.
|
|
20741
|
+
initialBarcodeBboxRef.current = {
|
|
20742
|
+
widthRatio: widthRatio,
|
|
20743
|
+
heightRatio: heightRatio
|
|
20744
|
+
};
|
|
20745
|
+
} else {
|
|
20746
|
+
var baseline = initialBarcodeBboxRef.current;
|
|
20747
|
+
var widthSatisfied = widthRatio >= baseline.widthRatio * requiredMultiplier;
|
|
20748
|
+
var heightSatisfied = heightRatio >= baseline.heightRatio * requiredMultiplier;
|
|
20749
|
+
if (widthSatisfied && heightSatisfied) {
|
|
20750
|
+
recapturePhaseStartedRef.current = true;
|
|
20751
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
20752
|
+
startBarcodeRecapturePhase();
|
|
20753
|
+
}
|
|
20754
|
+
}
|
|
20755
|
+
}
|
|
20756
|
+
}
|
|
20757
|
+
}
|
|
20758
|
+
}
|
|
20355
20759
|
if (prediction.detectedDocumentType !== 'none') {
|
|
20356
20760
|
var now = Date.now();
|
|
20357
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
20761
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_d = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _d !== void 0 ? _d : 0) > documentDetectionThrottleMs) {
|
|
20358
20762
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
20359
20763
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
20360
20764
|
}
|
|
@@ -20372,7 +20776,7 @@
|
|
|
20372
20776
|
});
|
|
20373
20777
|
}
|
|
20374
20778
|
});
|
|
20375
|
-
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
20779
|
+
}, [barcodeRecaptureBboxGrowthPct, documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame, startBarcodeRecapturePhase]);
|
|
20376
20780
|
React.useEffect(function () {
|
|
20377
20781
|
if (state.captureState === 'complete') stop();
|
|
20378
20782
|
}, [state.captureState, stop]);
|
|
@@ -20427,9 +20831,9 @@
|
|
|
20427
20831
|
type: 'resetWizard'
|
|
20428
20832
|
});
|
|
20429
20833
|
}, []);
|
|
20430
|
-
var
|
|
20431
|
-
attempt =
|
|
20432
|
-
setAttempt =
|
|
20834
|
+
var _20 = React.useState(0),
|
|
20835
|
+
attempt = _20[0],
|
|
20836
|
+
setAttempt = _20[1];
|
|
20433
20837
|
var onExit = React.useCallback(function () {
|
|
20434
20838
|
releaseCameraAccess();
|
|
20435
20839
|
setOverlayDismissed(false);
|
|
@@ -20455,20 +20859,25 @@
|
|
|
20455
20859
|
});
|
|
20456
20860
|
}
|
|
20457
20861
|
}, [cameraAccessDenied]);
|
|
20862
|
+
var guidanceBarcodeRecaptureText = (_b = verbiage.guidanceBarcodeRecaptureText) !== null && _b !== void 0 ? _b : 'Please move the barcode closer to the camera';
|
|
20863
|
+
var guidanceBarcodeRecaptureInProgressText = (_c = verbiage.guidanceBarcodeRecaptureInProgressText) !== null && _c !== void 0 ? _c : 'Barcode capture in progress, please hold still';
|
|
20864
|
+
var barcodeRecaptureGuidanceMessage = barcodeRecaptureGrowthSatisfied ? guidanceBarcodeRecaptureInProgressText : guidanceBarcodeRecaptureText;
|
|
20458
20865
|
var idCaptureVerbiages = {
|
|
20459
20866
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
20460
20867
|
instructionText: 'Scan the front of ID',
|
|
20461
20868
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
20462
20869
|
}),
|
|
20463
20870
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
20464
|
-
instructionText: 'Scan the back of ID'
|
|
20871
|
+
instructionText: state.captureState === 'requestingBetterBarcode' ? barcodeRecaptureGuidanceMessage : 'Scan the back of ID'
|
|
20465
20872
|
}),
|
|
20466
20873
|
passport: useTranslations(verbiage.passport, {
|
|
20467
20874
|
instructionText: 'Scan the ID page of passport'
|
|
20468
20875
|
})
|
|
20469
20876
|
};
|
|
20470
20877
|
var theme = styled.useTheme();
|
|
20471
|
-
|
|
20878
|
+
// During barcode recapture, use idCardBack verbiage to show barcode recapture message
|
|
20879
|
+
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
20880
|
+
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
20472
20881
|
React.useEffect(function () {
|
|
20473
20882
|
if (separateIdCardCaptureSequence) return;
|
|
20474
20883
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -20482,6 +20891,130 @@
|
|
|
20482
20891
|
clearTimeout(t);
|
|
20483
20892
|
};
|
|
20484
20893
|
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
20894
|
+
// Handle barcode recapture start - snapshot initial barcode and initialize recapture state
|
|
20895
|
+
React.useEffect(function () {
|
|
20896
|
+
var _a, _b;
|
|
20897
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20898
|
+
if (state.initialCaptureBarcodeImage !== null) return; // Already initialized
|
|
20899
|
+
// Get the initial barcode image from capturedDocuments (since resetBestFrame clears the canvas)
|
|
20900
|
+
var initialBarcodeImage = (_b = (_a = state.capturedDocuments.idBarcodeImage) === null || _a === void 0 ? void 0 : _a.imageData) !== null && _b !== void 0 ? _b : null;
|
|
20901
|
+
dispatchIdCaptureAction({
|
|
20902
|
+
type: 'barcodeRecaptureStarted',
|
|
20903
|
+
payload: {
|
|
20904
|
+
initialBarcodeScore: state.initialBarcodeScore,
|
|
20905
|
+
initialCaptureBarcodeImage: initialBarcodeImage
|
|
20906
|
+
}
|
|
20907
|
+
});
|
|
20908
|
+
}, [state.captureState, (_d = state.capturedDocuments.idBarcodeImage) === null || _d === void 0 ? void 0 : _d.imageData, state.initialBarcodeScore, state.initialCaptureBarcodeImage]);
|
|
20909
|
+
// Handle barcode recapture timeout
|
|
20910
|
+
React.useEffect(function () {
|
|
20911
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20912
|
+
// Continue detection to try to get a better barcode
|
|
20913
|
+
setTimeout(start, 100);
|
|
20914
|
+
var t = setTimeout(function () {
|
|
20915
|
+
// Move-closer window expired before recapture began
|
|
20916
|
+
if (recapturePhaseStartedRef.current) return;
|
|
20917
|
+
var bestBarcode = getBestBarcode();
|
|
20918
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
20919
|
+
if (improved) {
|
|
20920
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. Found better barcode anyway: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
20921
|
+
// Persist the "after" image for debug visual comparison, even if the
|
|
20922
|
+
// model-provider recapture tracker was never started.
|
|
20923
|
+
dispatchIdCaptureAction({
|
|
20924
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20925
|
+
payload: {
|
|
20926
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20927
|
+
}
|
|
20928
|
+
});
|
|
20929
|
+
dispatchIdCaptureAction({
|
|
20930
|
+
type: 'barcodeCaptured',
|
|
20931
|
+
payload: {
|
|
20932
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
20933
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
20934
|
+
}
|
|
20935
|
+
});
|
|
20936
|
+
} else {
|
|
20937
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. No better barcode found. Initial score: ".concat(state.initialBarcodeScore.toFixed(3)));
|
|
20938
|
+
}
|
|
20939
|
+
// Record that recapture was attempted (for diagnostics)
|
|
20940
|
+
dispatchIdCaptureAction({
|
|
20941
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
20942
|
+
payload: {
|
|
20943
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : state.initialBarcodeScore
|
|
20944
|
+
}
|
|
20945
|
+
});
|
|
20946
|
+
dispatchIdCaptureAction({
|
|
20947
|
+
type: 'barcodeRecaptureCompleted'
|
|
20948
|
+
});
|
|
20949
|
+
}, barcodeRecaptureMoveCloserTimeoutMs);
|
|
20950
|
+
return function () {
|
|
20951
|
+
return clearTimeout(t);
|
|
20952
|
+
};
|
|
20953
|
+
}, [barcodeRecaptureMoveCloserTimeoutMs, getBestBarcode, start, state.captureState, state.initialBarcodeScore]);
|
|
20954
|
+
React.useEffect(function () {
|
|
20955
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
20956
|
+
if (!barcodeRecaptureGrowthSatisfied) return;
|
|
20957
|
+
var t = setTimeout(function () {
|
|
20958
|
+
var _a, _b;
|
|
20959
|
+
// Capture window expired - complete with whatever barcode we have
|
|
20960
|
+
var recaptureBarcode = getRecaptureBestBarcode();
|
|
20961
|
+
var bestBarcode = getBestBarcode();
|
|
20962
|
+
var recaptureScore = (_a = recaptureBarcode === null || recaptureBarcode === void 0 ? void 0 : recaptureBarcode.score) !== null && _a !== void 0 ? _a : null;
|
|
20963
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
20964
|
+
// Store the recapture score for diagnostic purposes
|
|
20965
|
+
dispatchIdCaptureAction({
|
|
20966
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
20967
|
+
payload: {
|
|
20968
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : recaptureScore !== null && recaptureScore !== void 0 ? recaptureScore : state.initialBarcodeScore
|
|
20969
|
+
}
|
|
20970
|
+
});
|
|
20971
|
+
// Store the recapture barcode image if we found one
|
|
20972
|
+
if (recaptureBarcode) {
|
|
20973
|
+
dispatchIdCaptureAction({
|
|
20974
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20975
|
+
payload: {
|
|
20976
|
+
recaptureBarcodeImage: recaptureBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20977
|
+
}
|
|
20978
|
+
});
|
|
20979
|
+
} else if (improved) {
|
|
20980
|
+
// If we improved but don't have a recapture-specific best tracked,
|
|
20981
|
+
// still persist the "after" image so debug visual comparison works.
|
|
20982
|
+
dispatchIdCaptureAction({
|
|
20983
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
20984
|
+
payload: {
|
|
20985
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
20986
|
+
}
|
|
20987
|
+
});
|
|
20988
|
+
}
|
|
20989
|
+
if (improved) {
|
|
20990
|
+
log("[IdCaptureWizard] Barcode recapture completed. Found better barcode: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
20991
|
+
dispatchIdCaptureAction({
|
|
20992
|
+
type: 'barcodeCaptured',
|
|
20993
|
+
payload: {
|
|
20994
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
20995
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
20996
|
+
}
|
|
20997
|
+
});
|
|
20998
|
+
} else {
|
|
20999
|
+
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)));
|
|
21000
|
+
}
|
|
21001
|
+
dispatchIdCaptureAction({
|
|
21002
|
+
type: 'barcodeRecaptureCompleted'
|
|
21003
|
+
});
|
|
21004
|
+
}, barcodeRecaptureTimeoutMs);
|
|
21005
|
+
return function () {
|
|
21006
|
+
return clearTimeout(t);
|
|
21007
|
+
};
|
|
21008
|
+
}, [barcodeRecaptureGrowthSatisfied, barcodeRecaptureTimeoutMs, getBestBarcode, getRecaptureBestBarcode, state.captureState, state.initialBarcodeScore]);
|
|
21009
|
+
// Continue detection during barcode recapture and update barcode if better one found
|
|
21010
|
+
React.useEffect(function () {
|
|
21011
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
21012
|
+
// Set required document type to idCardBack for barcode detection
|
|
21013
|
+
setRequiredDocumentType('idCardBack');
|
|
21014
|
+
return function () {
|
|
21015
|
+
setRequiredDocumentType('none');
|
|
21016
|
+
};
|
|
21017
|
+
}, [setRequiredDocumentType, state.captureState]);
|
|
20485
21018
|
React.useEffect(function () {
|
|
20486
21019
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
20487
21020
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -20520,9 +21053,9 @@
|
|
|
20520
21053
|
});
|
|
20521
21054
|
});
|
|
20522
21055
|
}, []);
|
|
20523
|
-
var
|
|
20524
|
-
progressStarted =
|
|
20525
|
-
setProgressStarted =
|
|
21056
|
+
var _21 = React.useState(false),
|
|
21057
|
+
progressStarted = _21[0],
|
|
21058
|
+
setProgressStarted = _21[1];
|
|
20526
21059
|
React.useEffect(function () {
|
|
20527
21060
|
if (state.captureState === 'capturing') {
|
|
20528
21061
|
setProgressStarted(false);
|
|
@@ -20550,9 +21083,9 @@
|
|
|
20550
21083
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
20551
21084
|
});
|
|
20552
21085
|
}
|
|
20553
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
21086
|
+
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';
|
|
20554
21087
|
var guidesStatus = !overlayDismissed ? 'disabled' : state.isGoodFrame ? 'capturing' : 'ready';
|
|
20555
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScalingCameraFeed, null), overlayDismissed && state.captureState === 'capturing' && (/*#__PURE__*/React.createElement(IdCapture, {
|
|
21088
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ScalingCameraFeed, null), overlayDismissed && (state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode') && (/*#__PURE__*/React.createElement(IdCapture, {
|
|
20556
21089
|
requiredDocumentType: state.requestedDocumentType,
|
|
20557
21090
|
thresholds: thresholds,
|
|
20558
21091
|
onCapture: onCapture,
|
|
@@ -20560,11 +21093,18 @@
|
|
|
20560
21093
|
colors: colors,
|
|
20561
21094
|
verbiage: idCaptureVerbiage,
|
|
20562
21095
|
debugMode: debugMode
|
|
20563
|
-
})), /*#__PURE__*/React.createElement(
|
|
21096
|
+
})), overlayDismissed && state.captureState === 'requestingBetterBarcode' && (/*#__PURE__*/React.createElement(GuidanceMessageContainer, {
|
|
21097
|
+
"$top": "",
|
|
21098
|
+
"$bottom": "12.5%",
|
|
21099
|
+
className: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.guidanceMessageContainer
|
|
21100
|
+
}, /*#__PURE__*/React.createElement(GuidanceMessage, {
|
|
21101
|
+
"$variant": "default",
|
|
21102
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.guidanceMessage
|
|
21103
|
+
}, barcodeRecaptureGuidanceMessage))), /*#__PURE__*/React.createElement(IdCaptureGuides, {
|
|
20564
21104
|
key: "guides".concat(attempt),
|
|
20565
21105
|
guideType: guideType,
|
|
20566
21106
|
status: guidesStatus,
|
|
20567
|
-
progress: progressStarted &&
|
|
21107
|
+
progress: progressStarted && isCapturing ? 1 : 0,
|
|
20568
21108
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
20569
21109
|
requestedAction: requestedAction,
|
|
20570
21110
|
images: guideImages,
|
|
@@ -20572,15 +21112,15 @@
|
|
|
20572
21112
|
colors: colors,
|
|
20573
21113
|
verbiage: idCaptureVerbiage,
|
|
20574
21114
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
20575
|
-
}), debugMode && !((
|
|
20576
|
-
classNames: (
|
|
20577
|
-
text: (
|
|
21115
|
+
}), 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, {
|
|
21116
|
+
classNames: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.imagePreview,
|
|
21117
|
+
text: (_k = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _k === void 0 ? void 0 : _k.processingIdCardText,
|
|
20578
21118
|
imageUrl: state.imageUrl
|
|
20579
21119
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React.createElement("div", {
|
|
20580
21120
|
id: "idmission-above-guides-content"
|
|
20581
21121
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React.createElement(ExitCaptureButton, {
|
|
20582
21122
|
onClick: onExit,
|
|
20583
|
-
className: (
|
|
21123
|
+
className: (_l = classNames.capture) === null || _l === void 0 ? void 0 : _l.exitCaptureBtn
|
|
20584
21124
|
})), !overlayDismissed && (/*#__PURE__*/React.createElement(IdCaptureLoadingOverlay, {
|
|
20585
21125
|
key: "loading".concat(attempt),
|
|
20586
21126
|
mode: loadingOverlayMode,
|
|
@@ -20618,7 +21158,14 @@
|
|
|
20618
21158
|
onRetryClick: onRetryClick,
|
|
20619
21159
|
colors: colors.success,
|
|
20620
21160
|
verbiage: verbiage.success,
|
|
20621
|
-
debugMode: debugMode
|
|
21161
|
+
debugMode: debugMode,
|
|
21162
|
+
initialBarcodeScore:
|
|
21163
|
+
// Show diagnostic info if recapture occurred (indicated by recaptureBarcodeScore being set)
|
|
21164
|
+
// If recapture occurred, initialBarcodeScore was set (even if it's 0, which is valid)
|
|
21165
|
+
state.recaptureBarcodeScore !== null ? state.initialBarcodeScore : undefined,
|
|
21166
|
+
recaptureBarcodeScore: state.recaptureBarcodeScore,
|
|
21167
|
+
initialCaptureBarcodeImage: state.initialCaptureBarcodeImage,
|
|
21168
|
+
recaptureBarcodeImage: state.recaptureBarcodeImage
|
|
20622
21169
|
})));
|
|
20623
21170
|
};
|
|
20624
21171
|
function IdCaptureWizardWithProviders(_a) {
|