idmission-web-sdk 2.3.170 → 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 +776 -229
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +776 -229
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +776 -229
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/package.json +1 -1
package/dist/sdk2.esm.js
CHANGED
|
@@ -497,8 +497,8 @@ var OverlayImageContainer = styled.div(templateObject_3$u || (templateObject_3$u
|
|
|
497
497
|
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"])));
|
|
498
498
|
var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$g || (templateObject_5$g = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
|
|
499
499
|
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"])));
|
|
500
|
-
var WideButton = styled(LoaderButton)(templateObject_7$
|
|
501
|
-
var WideBorderButton = styled(WideButton)(templateObject_8$
|
|
500
|
+
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"])));
|
|
501
|
+
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) {
|
|
502
502
|
var _a, _b;
|
|
503
503
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.textColor) !== null && _b !== void 0 ? _b : 'black';
|
|
504
504
|
}, function (props) {
|
|
@@ -508,34 +508,34 @@ var WideBorderButton = styled(WideButton)(templateObject_8$5 || (templateObject_
|
|
|
508
508
|
var _a, _b;
|
|
509
509
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
|
|
510
510
|
});
|
|
511
|
-
var LoadingOverlayInner = styled(OverlayInner$2)(templateObject_9$
|
|
512
|
-
var LoadingOverlayHeader = styled.div(templateObject_10$
|
|
511
|
+
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"])));
|
|
512
|
+
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) {
|
|
513
513
|
var _a;
|
|
514
514
|
return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
|
|
515
515
|
}, function (props) {
|
|
516
516
|
return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
|
|
517
517
|
});
|
|
518
|
-
var LoadingOverlayGuidanceMessage = styled(GuidanceMessage)(templateObject_11$
|
|
519
|
-
var LoadingOverlayImageContainer = styled(OverlayImageContainer)(templateObject_12$
|
|
518
|
+
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"])));
|
|
519
|
+
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"])));
|
|
520
520
|
var LoadingOverlayProgressBarBackground = styled.div.attrs({
|
|
521
521
|
className: 'loading-overlay-progress-bar-background'
|
|
522
|
-
})(templateObject_13$
|
|
522
|
+
})(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"])));
|
|
523
523
|
var LoadingOverlayProgressBar = styled.span.attrs({
|
|
524
524
|
className: 'loading-overlay-progress-bar'
|
|
525
|
-
})(templateObject_14$
|
|
525
|
+
})(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) {
|
|
526
526
|
return props.$progress;
|
|
527
527
|
});
|
|
528
528
|
var LoadingOverlayProgressIndicator = styled.span.attrs({
|
|
529
529
|
className: 'loading-overlay-progress-indicator'
|
|
530
|
-
})(templateObject_15$
|
|
531
|
-
var LoadingOverlayButtonsRow = styled(ButtonsRow$2)(templateObject_16$
|
|
532
|
-
var LoadingOverlayLoadingListContainer = styled.div(templateObject_17$
|
|
533
|
-
var LoadingOverlayLoadingList = styled.ul(templateObject_18$
|
|
534
|
-
var LoadingOverlayLoadingListItem = styled.li(templateObject_19$
|
|
535
|
-
var LoadingOverlayProgressContainer = styled.div(templateObject_20$
|
|
536
|
-
var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21$
|
|
537
|
-
var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22$
|
|
538
|
-
var templateObject_1$N, templateObject_2$I, templateObject_3$u, templateObject_4$o, templateObject_5$g, templateObject_6$a, templateObject_7$
|
|
530
|
+
})(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);
|
|
531
|
+
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"])));
|
|
532
|
+
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"])));
|
|
533
|
+
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"])));
|
|
534
|
+
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"])));
|
|
535
|
+
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"])));
|
|
536
|
+
var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21$2 || (templateObject_21$2 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
|
|
537
|
+
var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22$2 || (templateObject_22$2 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
538
|
+
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;
|
|
539
539
|
|
|
540
540
|
var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
|
|
541
541
|
var accessBlockedImageUrl = _a.accessBlockedImageUrl;
|
|
@@ -4653,8 +4653,13 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4653
4653
|
if (!selectedVideoStreamId) return;
|
|
4654
4654
|
var srcObject = e.currentTarget.srcObject;
|
|
4655
4655
|
if (srcObject.id === selectedVideoStreamId) {
|
|
4656
|
+
var _a = e.currentTarget,
|
|
4657
|
+
videoWidth = _a.videoWidth,
|
|
4658
|
+
videoHeight = _a.videoHeight;
|
|
4656
4659
|
set({
|
|
4657
|
-
videoLoaded: true
|
|
4660
|
+
videoLoaded: true,
|
|
4661
|
+
videoWidth: videoWidth,
|
|
4662
|
+
videoHeight: videoHeight
|
|
4658
4663
|
});
|
|
4659
4664
|
} else {
|
|
4660
4665
|
set({
|
|
@@ -4967,26 +4972,25 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4967
4972
|
};
|
|
4968
4973
|
var CameraStoreContext = /*#__PURE__*/createContext(undefined);
|
|
4969
4974
|
function CameraStoreProvider(_a) {
|
|
4970
|
-
var _b;
|
|
4971
4975
|
var children = _a.children,
|
|
4972
|
-
|
|
4973
|
-
requestAccessAutomatically =
|
|
4974
|
-
|
|
4975
|
-
preferIphoneContinuityCamera =
|
|
4976
|
-
|
|
4977
|
-
preferFrontFacingCamera =
|
|
4978
|
-
|
|
4979
|
-
maxVideoWidth =
|
|
4976
|
+
_b = _a.requestAccessAutomatically,
|
|
4977
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
4978
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
4979
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
4980
|
+
_d = _a.preferFrontFacingCamera,
|
|
4981
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
4982
|
+
_e = _a.maxVideoWidth,
|
|
4983
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
4980
4984
|
maxFps = _a.maxFps,
|
|
4981
4985
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
4982
4986
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
4983
4987
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
4984
|
-
|
|
4985
|
-
requireMicrophoneAccess =
|
|
4986
|
-
|
|
4987
|
-
classNames =
|
|
4988
|
-
|
|
4989
|
-
verbiage =
|
|
4988
|
+
_f = _a.requireMicrophoneAccess,
|
|
4989
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
4990
|
+
_g = _a.classNames,
|
|
4991
|
+
classNames = _g === void 0 ? {} : _g,
|
|
4992
|
+
_h = _a.verbiage,
|
|
4993
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
4990
4994
|
var videoRef = useRef(null);
|
|
4991
4995
|
var store = useRef(undefined);
|
|
4992
4996
|
store.current || (store.current = createCameraStore({
|
|
@@ -5000,16 +5004,6 @@ function CameraStoreProvider(_a) {
|
|
|
5000
5004
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
5001
5005
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
5002
5006
|
}));
|
|
5003
|
-
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
5004
|
-
videoWidth = _k.videoWidth,
|
|
5005
|
-
videoHeight = _k.videoHeight;
|
|
5006
|
-
useEffect(function () {
|
|
5007
|
-
var _a;
|
|
5008
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
5009
|
-
videoWidth: videoWidth,
|
|
5010
|
-
videoHeight: videoHeight
|
|
5011
|
-
});
|
|
5012
|
-
}, [videoWidth, videoHeight]);
|
|
5013
5007
|
useEffect(function () {
|
|
5014
5008
|
var _a, _b, _c;
|
|
5015
5009
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -6088,6 +6082,15 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
6088
6082
|
getBestBarcode: function getBestBarcode() {
|
|
6089
6083
|
return null;
|
|
6090
6084
|
},
|
|
6085
|
+
startBarcodeRecapturePhase: function startBarcodeRecapturePhase() {
|
|
6086
|
+
return null;
|
|
6087
|
+
},
|
|
6088
|
+
getInitialCaptureBestBarcode: function getInitialCaptureBestBarcode() {
|
|
6089
|
+
return null;
|
|
6090
|
+
},
|
|
6091
|
+
getRecaptureBestBarcode: function getRecaptureBestBarcode() {
|
|
6092
|
+
return null;
|
|
6093
|
+
},
|
|
6091
6094
|
requiredDocumentType: 'none',
|
|
6092
6095
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
6093
6096
|
return null;
|
|
@@ -6147,6 +6150,14 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6147
6150
|
var bestBarcodeScore = useRef(0);
|
|
6148
6151
|
var stopDetection = useRef(0);
|
|
6149
6152
|
var analyzeBarcodeReadability = useBarcodeReadabilityAnalysis();
|
|
6153
|
+
// Barcode recapture tracking - separate canvases for initial and recapture sequences
|
|
6154
|
+
var initialCaptureBarcodeCanvas = useRef(null);
|
|
6155
|
+
var initialCaptureBarcodeDetails = useRef(null);
|
|
6156
|
+
var initialCaptureBarcodeScore = useRef(0);
|
|
6157
|
+
var recaptureBarcodeCanvas = useRef(null);
|
|
6158
|
+
var recaptureBarcodeDetails = useRef(null);
|
|
6159
|
+
var recaptureBarcodeScore = useRef(0);
|
|
6160
|
+
var isRecapturePhase = useRef(false);
|
|
6150
6161
|
var _h = useState('none'),
|
|
6151
6162
|
requiredDocumentType = _h[0],
|
|
6152
6163
|
setRequiredDocumentType = _h[1];
|
|
@@ -6171,10 +6182,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6171
6182
|
var _this = this;
|
|
6172
6183
|
onDocumentDetected(function (prediction) {
|
|
6173
6184
|
return __awaiter(_this, void 0, void 0, function () {
|
|
6174
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
6175
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6176
|
-
return __generator(this, function (
|
|
6177
|
-
switch (
|
|
6185
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, isInRecapturePhase, shouldRunBarcodeAnalysisDuringRecapture, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult, ctx, barcodeAnalysisResult, ctx;
|
|
6186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6187
|
+
return __generator(this, function (_k) {
|
|
6188
|
+
switch (_k.label) {
|
|
6178
6189
|
case 0:
|
|
6179
6190
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
6180
6191
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -6188,7 +6199,9 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6188
6199
|
prediction.singlePageDetectionThresholdMet = false;
|
|
6189
6200
|
}
|
|
6190
6201
|
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'));
|
|
6191
|
-
|
|
6202
|
+
isInRecapturePhase = isRecapturePhase.current;
|
|
6203
|
+
shouldRunBarcodeAnalysisDuringRecapture = isInRecapturePhase && isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentIsStable && prediction.bestDocument && prediction.bestPDF417;
|
|
6204
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 3];
|
|
6192
6205
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
6193
6206
|
if (focusPrediction) {
|
|
6194
6207
|
focusScore = focusPrediction.score;
|
|
@@ -6211,7 +6224,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6211
6224
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
6212
6225
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6213
6226
|
case 1:
|
|
6214
|
-
barcodeAnalysisResult =
|
|
6227
|
+
barcodeAnalysisResult = _k.sent();
|
|
6215
6228
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6216
6229
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6217
6230
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -6221,15 +6234,61 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6221
6234
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6222
6235
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6223
6236
|
}
|
|
6224
|
-
|
|
6237
|
+
// During recapture phase, also track best barcode separately for recapture sequence
|
|
6238
|
+
if (isRecapturePhase.current && recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6239
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6240
|
+
recaptureBarcodeDetails.current = (_g = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _g !== void 0 ? _g : null;
|
|
6241
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
6242
|
+
if (bestBarcodeCanvas.current) {
|
|
6243
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6244
|
+
if (ctx) {
|
|
6245
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6246
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6247
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6248
|
+
}
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
_k.label = 2;
|
|
6225
6252
|
case 2:
|
|
6253
|
+
return [3 /*break*/, 5];
|
|
6254
|
+
case 3:
|
|
6255
|
+
if (!shouldRunBarcodeAnalysisDuringRecapture) return [3 /*break*/, 5];
|
|
6256
|
+
if (!(enableBarcodeReadabilityModel && croppedDocumentCanvas.current && stopDetectionAtStart === stopDetection.current)) return [3 /*break*/, 5];
|
|
6257
|
+
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6258
|
+
case 4:
|
|
6259
|
+
barcodeAnalysisResult = _k.sent();
|
|
6260
|
+
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6261
|
+
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6262
|
+
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
6263
|
+
if (barcodeAnalysisResult.newBestBarcodeScore) {
|
|
6264
|
+
bestBarcodeScore.current = barcodeAnalysisResult.newBestBarcodeScore;
|
|
6265
|
+
}
|
|
6266
|
+
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6267
|
+
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6268
|
+
}
|
|
6269
|
+
// Track best barcode separately for recapture sequence
|
|
6270
|
+
if (recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6271
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6272
|
+
recaptureBarcodeDetails.current = (_h = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _h !== void 0 ? _h : null;
|
|
6273
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
6274
|
+
if (bestBarcodeCanvas.current) {
|
|
6275
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6276
|
+
if (ctx) {
|
|
6277
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6278
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6279
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
}
|
|
6283
|
+
_k.label = 5;
|
|
6284
|
+
case 5:
|
|
6226
6285
|
/**
|
|
6227
6286
|
* @note
|
|
6228
6287
|
* This should ALWAYS be called.
|
|
6229
6288
|
* Do not return early from this function unless
|
|
6230
6289
|
* lastPredictionCanvas.current is not set
|
|
6231
6290
|
*/
|
|
6232
|
-
(
|
|
6291
|
+
(_j = onPredictionHandler.current) === null || _j === void 0 ? void 0 : _j.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
6233
6292
|
focusScore: focusScore,
|
|
6234
6293
|
focusPredictionTime: focusPredictionTime,
|
|
6235
6294
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -6262,19 +6321,58 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6262
6321
|
canvas: bestBarcodeCanvas.current
|
|
6263
6322
|
});
|
|
6264
6323
|
}, []);
|
|
6324
|
+
var startBarcodeRecapturePhase = useCallback(function () {
|
|
6325
|
+
// Snapshot current best barcode to initial capture canvas
|
|
6326
|
+
if (bestBarcodeCanvas.current && initialCaptureBarcodeCanvas.current) {
|
|
6327
|
+
var ctx = initialCaptureBarcodeCanvas.current.getContext('2d');
|
|
6328
|
+
if (ctx) {
|
|
6329
|
+
initialCaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6330
|
+
initialCaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6331
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
initialCaptureBarcodeDetails.current = bestBarcodeDetails.current ? _assign({}, bestBarcodeDetails.current) : null;
|
|
6335
|
+
initialCaptureBarcodeScore.current = bestBarcodeScore.current;
|
|
6336
|
+
// Reset recapture tracking
|
|
6337
|
+
recaptureBarcodeScore.current = 0;
|
|
6338
|
+
recaptureBarcodeDetails.current = null;
|
|
6339
|
+
// Enter recapture phase
|
|
6340
|
+
isRecapturePhase.current = true;
|
|
6341
|
+
}, []);
|
|
6342
|
+
var getInitialCaptureBestBarcode = useCallback(function () {
|
|
6343
|
+
if (!initialCaptureBarcodeDetails.current || !initialCaptureBarcodeCanvas.current) return null;
|
|
6344
|
+
return _assign(_assign({}, initialCaptureBarcodeDetails.current), {
|
|
6345
|
+
canvas: initialCaptureBarcodeCanvas.current
|
|
6346
|
+
});
|
|
6347
|
+
}, []);
|
|
6348
|
+
var getRecaptureBestBarcode = useCallback(function () {
|
|
6349
|
+
if (!recaptureBarcodeDetails.current || !recaptureBarcodeCanvas.current) return null;
|
|
6350
|
+
return _assign(_assign({}, recaptureBarcodeDetails.current), {
|
|
6351
|
+
canvas: recaptureBarcodeCanvas.current
|
|
6352
|
+
});
|
|
6353
|
+
}, []);
|
|
6265
6354
|
var _j = useState(0),
|
|
6266
6355
|
canvasKey = _j[0],
|
|
6267
6356
|
setCanvasKey = _j[1];
|
|
6268
6357
|
var resetBestFrame = useCallback(function () {
|
|
6358
|
+
// During recapture phase, preserve all canvas state to avoid race conditions
|
|
6359
|
+
// that could result in black/empty barcode images on slow devices
|
|
6360
|
+
if (isRecapturePhase.current) {
|
|
6361
|
+
return;
|
|
6362
|
+
}
|
|
6269
6363
|
stopDetection.current += 1;
|
|
6270
|
-
setCanvasKey(function (n) {
|
|
6271
|
-
return n + 1;
|
|
6272
|
-
});
|
|
6273
6364
|
clearDocumentDetectionLastPredictionCanvas();
|
|
6274
6365
|
bestFrameDetails.current = null;
|
|
6275
6366
|
bestFocusScore.current = 0;
|
|
6276
6367
|
bestBarcodeScore.current = 0;
|
|
6277
6368
|
bestBarcodeDetails.current = null;
|
|
6369
|
+
setCanvasKey(function (n) {
|
|
6370
|
+
return n + 1;
|
|
6371
|
+
});
|
|
6372
|
+
initialCaptureBarcodeScore.current = 0;
|
|
6373
|
+
initialCaptureBarcodeDetails.current = null;
|
|
6374
|
+
recaptureBarcodeScore.current = 0;
|
|
6375
|
+
recaptureBarcodeDetails.current = null;
|
|
6278
6376
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
6279
6377
|
useEffect(function () {
|
|
6280
6378
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -6340,10 +6438,13 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6340
6438
|
bestFrameDetails: bestFrameDetails,
|
|
6341
6439
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
6342
6440
|
getBestBarcode: getBestBarcode,
|
|
6441
|
+
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
6442
|
+
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
6443
|
+
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
6343
6444
|
requiredDocumentType: requiredDocumentType,
|
|
6344
6445
|
setRequiredDocumentType: setRequiredDocumentType
|
|
6345
6446
|
};
|
|
6346
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
6447
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, startBarcodeRecapturePhase, getInitialCaptureBestBarcode, getRecaptureBestBarcode, requiredDocumentType]);
|
|
6347
6448
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
6348
6449
|
value: value
|
|
6349
6450
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -6355,6 +6456,12 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6355
6456
|
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6356
6457
|
key: "cd-".concat(canvasKey),
|
|
6357
6458
|
ref: croppedDocumentCanvas
|
|
6459
|
+
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6460
|
+
key: "icb-".concat(canvasKey),
|
|
6461
|
+
ref: initialCaptureBarcodeCanvas
|
|
6462
|
+
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6463
|
+
key: "rcb-".concat(canvasKey),
|
|
6464
|
+
ref: recaptureBarcodeCanvas
|
|
6358
6465
|
})), children);
|
|
6359
6466
|
}
|
|
6360
6467
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -6449,6 +6556,8 @@ var initialState$5 = {
|
|
|
6449
6556
|
singlePageDetectionThresholdMet: false,
|
|
6450
6557
|
focusScore: 0,
|
|
6451
6558
|
focusThresholdMet: false,
|
|
6559
|
+
pdf417PredictionScore: 0,
|
|
6560
|
+
pdf417PredictionThresholdMet: false,
|
|
6452
6561
|
isGoodFrame: false,
|
|
6453
6562
|
goodFramesCount: 0,
|
|
6454
6563
|
goodFramesThreshold: 3,
|
|
@@ -6470,30 +6579,42 @@ var initialState$5 = {
|
|
|
6470
6579
|
uploadingDocumentsType: null,
|
|
6471
6580
|
operationStartedAt: null,
|
|
6472
6581
|
captureStartedAt: null,
|
|
6582
|
+
barcodeRecaptureStartedAt: null,
|
|
6583
|
+
initialBarcodeScore: 0,
|
|
6584
|
+
recaptureBarcodeScore: null,
|
|
6585
|
+
barcodeRecaptureThreshold: 0,
|
|
6586
|
+
barcodeRecaptureTimeoutMs: 5000,
|
|
6587
|
+
initialCaptureBarcodeImage: null,
|
|
6588
|
+
recaptureBarcodeImage: null,
|
|
6473
6589
|
dispatch: function dispatch() {
|
|
6474
6590
|
return null;
|
|
6475
6591
|
}
|
|
6476
6592
|
};
|
|
6477
6593
|
var _reducer = function reducer(state, action) {
|
|
6478
6594
|
var _a;
|
|
6595
|
+
var _b, _c;
|
|
6479
6596
|
switch (action.type) {
|
|
6480
6597
|
case 'configureWizard':
|
|
6481
6598
|
{
|
|
6482
|
-
var
|
|
6483
|
-
captureRequirement =
|
|
6484
|
-
precapturedDocuments =
|
|
6485
|
-
allowSinglePageIdCapture =
|
|
6486
|
-
allowIdCardBackToFrontCapture =
|
|
6487
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
6488
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
6489
|
-
allowUploadingDocumentsFromStorage =
|
|
6599
|
+
var _d = action.payload,
|
|
6600
|
+
captureRequirement = _d.captureRequirement,
|
|
6601
|
+
precapturedDocuments = _d.precapturedDocuments,
|
|
6602
|
+
allowSinglePageIdCapture = _d.allowSinglePageIdCapture,
|
|
6603
|
+
allowIdCardBackToFrontCapture = _d.allowIdCardBackToFrontCapture,
|
|
6604
|
+
enableOverrideWrongDocumentTypeDialog = _d.enableOverrideWrongDocumentTypeDialog,
|
|
6605
|
+
allowOverrideWrongDocumentTypeAfterMs = _d.allowOverrideWrongDocumentTypeAfterMs,
|
|
6606
|
+
allowUploadingDocumentsFromStorage = _d.allowUploadingDocumentsFromStorage,
|
|
6607
|
+
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
6608
|
+
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
6490
6609
|
var newState = _assign(_assign({}, state), {
|
|
6491
6610
|
captureRequirement: captureRequirement,
|
|
6492
6611
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
6493
6612
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
6494
6613
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
6495
6614
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
6496
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6615
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
6616
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
6617
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
6497
6618
|
});
|
|
6498
6619
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
6499
6620
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -6550,26 +6671,28 @@ var _reducer = function reducer(state, action) {
|
|
|
6550
6671
|
});
|
|
6551
6672
|
case 'objectsDetected':
|
|
6552
6673
|
{
|
|
6553
|
-
var
|
|
6554
|
-
detectedObjects =
|
|
6555
|
-
detectionThresholdMet =
|
|
6556
|
-
detectedDocumentType =
|
|
6557
|
-
idCardFrontDetectionScore =
|
|
6558
|
-
idCardFrontDetectionThresholdMet =
|
|
6559
|
-
idCardBackDetectionScore =
|
|
6560
|
-
idCardBackDetectionThresholdMet =
|
|
6561
|
-
passportDetectionScore =
|
|
6562
|
-
passportDetectionThresholdMet =
|
|
6563
|
-
singlePageDetectionScore =
|
|
6564
|
-
singlePageDetectionThresholdMet =
|
|
6565
|
-
bestDocument =
|
|
6566
|
-
documentInBounds =
|
|
6567
|
-
documentTooClose =
|
|
6568
|
-
documentIsStable =
|
|
6569
|
-
focusScore =
|
|
6570
|
-
focusThresholdMet =
|
|
6571
|
-
|
|
6572
|
-
|
|
6674
|
+
var _e = action.payload.prediction,
|
|
6675
|
+
detectedObjects = _e.detectedObjects,
|
|
6676
|
+
detectionThresholdMet = _e.detectionThresholdMet,
|
|
6677
|
+
detectedDocumentType = _e.detectedDocumentType,
|
|
6678
|
+
idCardFrontDetectionScore = _e.idCardFrontDetectionScore,
|
|
6679
|
+
idCardFrontDetectionThresholdMet = _e.idCardFrontDetectionThresholdMet,
|
|
6680
|
+
idCardBackDetectionScore = _e.idCardBackDetectionScore,
|
|
6681
|
+
idCardBackDetectionThresholdMet = _e.idCardBackDetectionThresholdMet,
|
|
6682
|
+
passportDetectionScore = _e.passportDetectionScore,
|
|
6683
|
+
passportDetectionThresholdMet = _e.passportDetectionThresholdMet,
|
|
6684
|
+
singlePageDetectionScore = _e.singlePageDetectionScore,
|
|
6685
|
+
singlePageDetectionThresholdMet = _e.singlePageDetectionThresholdMet,
|
|
6686
|
+
bestDocument = _e.bestDocument,
|
|
6687
|
+
documentInBounds = _e.documentInBounds,
|
|
6688
|
+
documentTooClose = _e.documentTooClose,
|
|
6689
|
+
documentIsStable = _e.documentIsStable,
|
|
6690
|
+
focusScore = _e.focusScore,
|
|
6691
|
+
focusThresholdMet = _e.focusThresholdMet,
|
|
6692
|
+
pdf417PredictionScore = _e.pdf417PredictionScore,
|
|
6693
|
+
pdf417PredictionThresholdMet = _e.pdf417PredictionThresholdMet,
|
|
6694
|
+
frameWidth = _e.frameWidth,
|
|
6695
|
+
frameHeight = _e.frameHeight;
|
|
6573
6696
|
var frameCapturedAt = new Date();
|
|
6574
6697
|
var frameCaptureRate = 0;
|
|
6575
6698
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -6649,6 +6772,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6649
6772
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
6650
6773
|
focusScore: focusScore,
|
|
6651
6774
|
focusThresholdMet: focusThresholdMet,
|
|
6775
|
+
pdf417PredictionScore: pdf417PredictionScore,
|
|
6776
|
+
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
6652
6777
|
isGoodFrame: isGoodFrame,
|
|
6653
6778
|
goodFramesCount: goodFramesCount,
|
|
6654
6779
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -6702,7 +6827,18 @@ var _reducer = function reducer(state, action) {
|
|
|
6702
6827
|
});
|
|
6703
6828
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
6704
6829
|
if (remainingRequirements.length === 0) {
|
|
6705
|
-
|
|
6830
|
+
// Check if we just captured ID back and need barcode recapture
|
|
6831
|
+
var justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
6832
|
+
var barcodeScore = (_c = (_b = state.capturedDocuments.idBarcodeImage) === null || _b === void 0 ? void 0 : _b.barcodeReadabilityScore) !== null && _c !== void 0 ? _c : 0;
|
|
6833
|
+
var needsBarcodeRecapture = justCapturedIdBack && state.barcodeRecaptureThreshold > 0 && barcodeScore < state.barcodeRecaptureThreshold;
|
|
6834
|
+
if (needsBarcodeRecapture) {
|
|
6835
|
+
// Skip 'complete' and go directly to barcode recapture
|
|
6836
|
+
newState.captureState = 'requestingBetterBarcode';
|
|
6837
|
+
newState.barcodeRecaptureStartedAt = new Date();
|
|
6838
|
+
newState.initialBarcodeScore = barcodeScore;
|
|
6839
|
+
} else {
|
|
6840
|
+
newState.captureState = 'complete';
|
|
6841
|
+
}
|
|
6706
6842
|
} else {
|
|
6707
6843
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
6708
6844
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -6729,8 +6865,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6729
6865
|
case 'documentsCaptured':
|
|
6730
6866
|
{
|
|
6731
6867
|
var newState = _assign({}, state);
|
|
6732
|
-
for (var
|
|
6733
|
-
var doc =
|
|
6868
|
+
for (var _f = 0, _g = action.payload; _f < _g.length; _f++) {
|
|
6869
|
+
var doc = _g[_f];
|
|
6734
6870
|
newState = _reducer(newState, {
|
|
6735
6871
|
type: 'documentCaptured',
|
|
6736
6872
|
payload: doc
|
|
@@ -6780,13 +6916,49 @@ var _reducer = function reducer(state, action) {
|
|
|
6780
6916
|
requestedDocumentType: requestedDocumentType
|
|
6781
6917
|
});
|
|
6782
6918
|
}
|
|
6919
|
+
case 'barcodeRecaptureStarted':
|
|
6920
|
+
return _assign(_assign({}, state), {
|
|
6921
|
+
captureState: 'requestingBetterBarcode',
|
|
6922
|
+
barcodeRecaptureStartedAt: new Date(),
|
|
6923
|
+
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
6924
|
+
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
6925
|
+
recaptureBarcodeScore: null,
|
|
6926
|
+
recaptureBarcodeImage: null,
|
|
6927
|
+
goodFramesCount: 0,
|
|
6928
|
+
capturing: false
|
|
6929
|
+
});
|
|
6930
|
+
case 'barcodeRecaptureScoreUpdated':
|
|
6931
|
+
return _assign(_assign({}, state), {
|
|
6932
|
+
recaptureBarcodeScore: action.payload.recaptureBarcodeScore
|
|
6933
|
+
});
|
|
6934
|
+
case 'recaptureBarcodeImageCaptured':
|
|
6935
|
+
return _assign(_assign({}, state), {
|
|
6936
|
+
recaptureBarcodeImage: action.payload.recaptureBarcodeImage
|
|
6937
|
+
});
|
|
6938
|
+
case 'barcodeRecaptureCompleted':
|
|
6939
|
+
return _assign(_assign({}, state), {
|
|
6940
|
+
captureState: 'complete',
|
|
6941
|
+
barcodeRecaptureStartedAt: null
|
|
6942
|
+
});
|
|
6783
6943
|
case 'resetWizard':
|
|
6784
6944
|
return _assign(_assign({}, initialState$5), {
|
|
6785
6945
|
dispatch: state.dispatch,
|
|
6946
|
+
// Preserve all configuration values
|
|
6947
|
+
captureRequirement: state.captureRequirement,
|
|
6948
|
+
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
6949
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
6950
|
+
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
6951
|
+
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
6786
6952
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6953
|
+
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
6954
|
+
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
6955
|
+
// Reset capture-specific state
|
|
6787
6956
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
6788
|
-
|
|
6789
|
-
|
|
6957
|
+
barcodeRecaptureStartedAt: null,
|
|
6958
|
+
initialBarcodeScore: 0,
|
|
6959
|
+
recaptureBarcodeScore: null,
|
|
6960
|
+
initialCaptureBarcodeImage: null,
|
|
6961
|
+
recaptureBarcodeImage: null
|
|
6790
6962
|
});
|
|
6791
6963
|
default:
|
|
6792
6964
|
return state;
|
|
@@ -7218,36 +7390,36 @@ function extractSize(entry, sizeType) {
|
|
|
7218
7390
|
}
|
|
7219
7391
|
|
|
7220
7392
|
var IdCapture = function IdCapture(_a) {
|
|
7221
|
-
var _b, _c, _d, _e, _f, _g;
|
|
7393
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7222
7394
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
7223
|
-
|
|
7224
|
-
thresholds =
|
|
7395
|
+
_k = _a.thresholds,
|
|
7396
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
7225
7397
|
guidanceMessage = _a.guidanceMessage,
|
|
7226
7398
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
7227
7399
|
onCapture = _a.onCapture,
|
|
7228
|
-
|
|
7229
|
-
classNames =
|
|
7230
|
-
|
|
7231
|
-
colors =
|
|
7232
|
-
|
|
7233
|
-
rawVerbiage =
|
|
7234
|
-
|
|
7235
|
-
debugMode =
|
|
7236
|
-
var
|
|
7237
|
-
ref =
|
|
7238
|
-
|
|
7239
|
-
width =
|
|
7240
|
-
|
|
7241
|
-
height =
|
|
7400
|
+
_l = _a.classNames,
|
|
7401
|
+
classNames = _l === void 0 ? {} : _l,
|
|
7402
|
+
_m = _a.colors,
|
|
7403
|
+
colors = _m === void 0 ? {} : _m,
|
|
7404
|
+
_o = _a.verbiage,
|
|
7405
|
+
rawVerbiage = _o === void 0 ? {} : _o,
|
|
7406
|
+
_p = _a.debugMode,
|
|
7407
|
+
debugMode = _p === void 0 ? false : _p;
|
|
7408
|
+
var _q = useResizeObserver(),
|
|
7409
|
+
ref = _q.ref,
|
|
7410
|
+
_r = _q.width,
|
|
7411
|
+
width = _r === void 0 ? 1 : _r,
|
|
7412
|
+
_s = _q.height,
|
|
7413
|
+
height = _s === void 0 ? 1 : _s;
|
|
7242
7414
|
var state = useIdCaptureStore();
|
|
7243
7415
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
7244
|
-
var
|
|
7245
|
-
modelsReady =
|
|
7246
|
-
setThresholds =
|
|
7247
|
-
detectionTime =
|
|
7248
|
-
focusPredictionTime =
|
|
7249
|
-
getBestFrame =
|
|
7250
|
-
getBestBarcode =
|
|
7416
|
+
var _t = useIdCaptureModelsContext(),
|
|
7417
|
+
modelsReady = _t.ready,
|
|
7418
|
+
setThresholds = _t.setThresholds,
|
|
7419
|
+
detectionTime = _t.detectionTime,
|
|
7420
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
7421
|
+
getBestFrame = _t.getBestFrame,
|
|
7422
|
+
getBestBarcode = _t.getBestBarcode;
|
|
7251
7423
|
useEffect(function () {
|
|
7252
7424
|
return dispatchIdCaptureAction({
|
|
7253
7425
|
type: 'captureInitialized'
|
|
@@ -7272,7 +7444,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7272
7444
|
}
|
|
7273
7445
|
});
|
|
7274
7446
|
}, [height, width]);
|
|
7275
|
-
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7447
|
+
var shouldCapture = state.captureState === 'capturing' && state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7276
7448
|
useEffect(function () {
|
|
7277
7449
|
if (!shouldCapture) return;
|
|
7278
7450
|
dispatchIdCaptureAction({
|
|
@@ -7372,13 +7544,18 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7372
7544
|
"$flipX": !isRearFacing,
|
|
7373
7545
|
scaling: debugScalingDetails
|
|
7374
7546
|
}, state.detectedObjects.map(function (obj, i) {
|
|
7547
|
+
// During barcode recapture, render PDF417 barcodes with green color
|
|
7548
|
+
var isBarcodeRecapture = state.captureState === 'requestingBetterBarcode';
|
|
7549
|
+
var isBarcode = obj.label === 'PDF417';
|
|
7550
|
+
var color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
7375
7551
|
return /*#__PURE__*/React__default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
7376
7552
|
key: i,
|
|
7377
7553
|
obj: obj,
|
|
7378
7554
|
scaling: debugScalingDetails,
|
|
7379
|
-
flipX: !isRearFacing
|
|
7555
|
+
flipX: !isRearFacing,
|
|
7556
|
+
color: color
|
|
7380
7557
|
});
|
|
7381
|
-
}))), debugMode && (/*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.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__default.createElement("br", null), modelsReady ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
7558
|
+
}))), debugMode && (/*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.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__default.createElement("br", null), modelsReady ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.pdf417PredictionThresholdMet ? '✅' : '❌', " Current Barcode Score: ", state.pdf417PredictionScore.toFixed(3), /*#__PURE__*/React__default.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__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
7382
7559
|
};
|
|
7383
7560
|
var timeSince = function timeSince(t) {
|
|
7384
7561
|
if (!t) return 0;
|
|
@@ -8258,11 +8435,11 @@ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templa
|
|
|
8258
8435
|
var _a, _b, _c, _d;
|
|
8259
8436
|
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;
|
|
8260
8437
|
});
|
|
8261
|
-
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
8438
|
+
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
8262
8439
|
var _a, _b, _c, _d;
|
|
8263
8440
|
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)';
|
|
8264
8441
|
});
|
|
8265
|
-
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$
|
|
8442
|
+
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) {
|
|
8266
8443
|
var _a, _b, _c, _d, _e, _f;
|
|
8267
8444
|
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, ";") : '';
|
|
8268
8445
|
}, function (props) {
|
|
@@ -8281,7 +8458,7 @@ var ContinueButton$1 = styled(LoaderButton)(templateObject_8$4 || (templateObjec
|
|
|
8281
8458
|
var _a, _b, _c, _d;
|
|
8282
8459
|
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';
|
|
8283
8460
|
});
|
|
8284
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
8461
|
+
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;
|
|
8285
8462
|
|
|
8286
8463
|
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"])));
|
|
8287
8464
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -8468,6 +8645,14 @@ var FlexCard = styled(Card)(templateObject_2$z || (templateObject_2$z = __makeTe
|
|
|
8468
8645
|
var templateObject_1$D, templateObject_2$z;
|
|
8469
8646
|
|
|
8470
8647
|
var imageDisplayOrder = ['idCardFront', 'idCardBack', 'idBarcodeImage', 'passport', 'singlePage', 'idFrontIrImage', 'idBackIrImage', 'idFrontUvImage', 'idBackUvImage'];
|
|
8648
|
+
var downloadImage = function downloadImage(dataUrl, filename) {
|
|
8649
|
+
var link = document.createElement('a');
|
|
8650
|
+
link.href = dataUrl;
|
|
8651
|
+
link.download = filename;
|
|
8652
|
+
document.body.appendChild(link);
|
|
8653
|
+
link.click();
|
|
8654
|
+
document.body.removeChild(link);
|
|
8655
|
+
};
|
|
8471
8656
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
8472
8657
|
var capturedDocuments = _a.capturedDocuments,
|
|
8473
8658
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -8479,8 +8664,22 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8479
8664
|
_d = _a.verbiage,
|
|
8480
8665
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
8481
8666
|
_e = _a.debugMode,
|
|
8482
|
-
debugMode = _e === void 0 ? false : _e
|
|
8667
|
+
debugMode = _e === void 0 ? false : _e,
|
|
8668
|
+
initialBarcodeScore = _a.initialBarcodeScore,
|
|
8669
|
+
recaptureBarcodeScore = _a.recaptureBarcodeScore,
|
|
8670
|
+
initialCaptureBarcodeImage = _a.initialCaptureBarcodeImage,
|
|
8671
|
+
recaptureBarcodeImage = _a.recaptureBarcodeImage;
|
|
8483
8672
|
var submissionStatus = useContext(SubmissionContext).submissionStatus;
|
|
8673
|
+
if (debugMode) {
|
|
8674
|
+
log('[IdCaptureSuccess] Debug info:', {
|
|
8675
|
+
debugMode: debugMode,
|
|
8676
|
+
initialBarcodeScore: initialBarcodeScore,
|
|
8677
|
+
recaptureBarcodeScore: recaptureBarcodeScore,
|
|
8678
|
+
shouldShow: debugMode && initialBarcodeScore !== undefined,
|
|
8679
|
+
condition1: debugMode,
|
|
8680
|
+
condition2: initialBarcodeScore !== undefined
|
|
8681
|
+
});
|
|
8682
|
+
}
|
|
8484
8683
|
var verbiage = useTranslations(rawVerbiage, {
|
|
8485
8684
|
headingText: 'ID Capture Successful',
|
|
8486
8685
|
retryText: 'Retry',
|
|
@@ -8500,6 +8699,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8500
8699
|
}, /*#__PURE__*/React__default.createElement(ImageRow, {
|
|
8501
8700
|
className: classNames.imageRow
|
|
8502
8701
|
}, imageDisplayOrder.map(function (name) {
|
|
8702
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8503
8703
|
var doc = capturedDocuments[name];
|
|
8504
8704
|
if (!doc) return null;
|
|
8505
8705
|
return /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
@@ -8509,7 +8709,57 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8509
8709
|
image: doc,
|
|
8510
8710
|
className: classNames.image,
|
|
8511
8711
|
alt: doc.documentType
|
|
8512
|
-
}), debugMode && (/*#__PURE__*/React__default.createElement(
|
|
8712
|
+
}), debugMode && (/*#__PURE__*/React__default.createElement(DebugInfoContainer, null, name === 'idBarcodeImage' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Document Type:"), /*#__PURE__*/React__default.createElement(DebugValue, null, doc.documentType)), /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Readability Score:"), /*#__PURE__*/React__default.createElement(ScoreBadge, {
|
|
8713
|
+
"$score": (_a = doc.barcodeReadabilityScore) !== null && _a !== void 0 ? _a : 0,
|
|
8714
|
+
"$type": "readability"
|
|
8715
|
+
}, ((_b = doc.barcodeReadabilityScore) !== null && _b !== void 0 ? _b : 0).toFixed(3))), initialBarcodeScore !== undefined && (recaptureBarcodeScore !== null && recaptureBarcodeScore !== undefined ? (/*#__PURE__*/React__default.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React__default.createElement(ComparisonHeader, null, "\uD83D\uDCCA Barcode Recapture Analysis"), /*#__PURE__*/React__default.createElement(ComparisonRow, null, /*#__PURE__*/React__default.createElement(ComparisonLabel, null, "Initial Capture:"), /*#__PURE__*/React__default.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React__default.createElement(ComparisonRow, null, /*#__PURE__*/React__default.createElement(ComparisonLabel, null, "After Recapture:"), /*#__PURE__*/React__default.createElement(ComparisonScoreBadge, null, recaptureBarcodeScore.toFixed(3))), /*#__PURE__*/React__default.createElement(ComparisonDivider, null), /*#__PURE__*/React__default.createElement(ComparisonRow, null, /*#__PURE__*/React__default.createElement(ComparisonLabel, null, "Improvement:"), /*#__PURE__*/React__default.createElement(ImprovementBadge, {
|
|
8716
|
+
"$improved": recaptureBarcodeScore > initialBarcodeScore
|
|
8717
|
+
}, recaptureBarcodeScore > initialBarcodeScore ? '↑' : '→', ' ', Math.abs(recaptureBarcodeScore - initialBarcodeScore).toFixed(3), ' ', "(", recaptureBarcodeScore > initialBarcodeScore ? 'Better' : 'Same/Worse', ")")), (initialCaptureBarcodeImage || recaptureBarcodeImage) && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ComparisonDivider, null), /*#__PURE__*/React__default.createElement(ComparisonHeader, {
|
|
8718
|
+
style: {
|
|
8719
|
+
marginTop: '0.25rem'
|
|
8720
|
+
}
|
|
8721
|
+
}, "\uD83D\uDD0D Visual Comparison"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImagesContainer, null, initialCaptureBarcodeImage && (/*#__PURE__*/React__default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImage, {
|
|
8722
|
+
src: initialCaptureBarcodeImage,
|
|
8723
|
+
alt: "Initial capture barcode",
|
|
8724
|
+
onDoubleClick: function onDoubleClick() {
|
|
8725
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8726
|
+
},
|
|
8727
|
+
title: "Double-click to download"
|
|
8728
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8729
|
+
"$isHigher": initialBarcodeScore >= recaptureBarcodeScore
|
|
8730
|
+
}, initialBarcodeScore.toFixed(3)))), recaptureBarcodeImage && (/*#__PURE__*/React__default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageLabel, null, "Recapture"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImage, {
|
|
8731
|
+
src: recaptureBarcodeImage,
|
|
8732
|
+
alt: "Recapture barcode",
|
|
8733
|
+
onDoubleClick: function onDoubleClick() {
|
|
8734
|
+
return downloadImage(recaptureBarcodeImage, "barcode-recapture-".concat(recaptureBarcodeScore.toFixed(3), ".jpg"));
|
|
8735
|
+
},
|
|
8736
|
+
title: "Double-click to download"
|
|
8737
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8738
|
+
"$isHigher": recaptureBarcodeScore > initialBarcodeScore
|
|
8739
|
+
}, recaptureBarcodeScore.toFixed(3))))))))) : (/*#__PURE__*/React__default.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React__default.createElement(ComparisonHeader, null, "\u26A0\uFE0F Recapture Attempted"), /*#__PURE__*/React__default.createElement(ComparisonRow, null, /*#__PURE__*/React__default.createElement(ComparisonLabel, null, "Initial Score:"), /*#__PURE__*/React__default.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React__default.createElement(ComparisonRow, null, /*#__PURE__*/React__default.createElement(ComparisonLabel, null, "Recapture Result:"), /*#__PURE__*/React__default.createElement(ComparisonValue, null, "No barcode found")), initialCaptureBarcodeImage && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ComparisonDivider, null), /*#__PURE__*/React__default.createElement(ComparisonHeader, {
|
|
8740
|
+
style: {
|
|
8741
|
+
marginTop: '0.25rem'
|
|
8742
|
+
}
|
|
8743
|
+
}, "\uD83D\uDD0D Barcode Image (kept)"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImagesContainer, {
|
|
8744
|
+
style: {
|
|
8745
|
+
gridTemplateColumns: '1fr'
|
|
8746
|
+
}
|
|
8747
|
+
}, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImage, {
|
|
8748
|
+
src: initialCaptureBarcodeImage,
|
|
8749
|
+
alt: "Initial capture barcode",
|
|
8750
|
+
onDoubleClick: function onDoubleClick() {
|
|
8751
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8752
|
+
},
|
|
8753
|
+
title: "Double-click to download"
|
|
8754
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8755
|
+
"$isHigher": true
|
|
8756
|
+
}, initialBarcodeScore.toFixed(3))))))))))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Document Type:"), /*#__PURE__*/React__default.createElement(DebugValue, null, doc.documentType)), /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Detection Score:"), /*#__PURE__*/React__default.createElement(ScoreBadge, {
|
|
8757
|
+
"$score": (_c = doc.detectionScore) !== null && _c !== void 0 ? _c : 0,
|
|
8758
|
+
"$type": "detection"
|
|
8759
|
+
}, ((_d = doc.detectionScore) !== null && _d !== void 0 ? _d : 0).toFixed(3))), /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Focus Score:"), /*#__PURE__*/React__default.createElement(ScoreBadge, {
|
|
8760
|
+
"$score": (_e = doc.focusScore) !== null && _e !== void 0 ? _e : 0,
|
|
8761
|
+
"$type": "focus"
|
|
8762
|
+
}, ((_f = doc.focusScore) !== null && _f !== void 0 ? _f : 0).toFixed(3))), /*#__PURE__*/React__default.createElement(DebugSection, null, /*#__PURE__*/React__default.createElement(DebugLabel, null, "Bounding Box:"), /*#__PURE__*/React__default.createElement(DebugValue, null, JSON.stringify(doc.boundingBox, null, 2))))))));
|
|
8513
8763
|
}))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
|
|
8514
8764
|
className: classNames.buttonsRow
|
|
8515
8765
|
}, /*#__PURE__*/React__default.createElement(WideButton, {
|
|
@@ -8532,8 +8782,91 @@ var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$y || (templ
|
|
|
8532
8782
|
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"])));
|
|
8533
8783
|
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"])));
|
|
8534
8784
|
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"])));
|
|
8535
|
-
var
|
|
8536
|
-
var
|
|
8785
|
+
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"])));
|
|
8786
|
+
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"])));
|
|
8787
|
+
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"])));
|
|
8788
|
+
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"])));
|
|
8789
|
+
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) {
|
|
8790
|
+
var $score = _a.$score,
|
|
8791
|
+
$type = _a.$type;
|
|
8792
|
+
var thresholds = $type === 'readability' ? {
|
|
8793
|
+
good: 0.5,
|
|
8794
|
+
medium: 0.2
|
|
8795
|
+
} : $type === 'detection' ? {
|
|
8796
|
+
good: 0.7,
|
|
8797
|
+
medium: 0.4
|
|
8798
|
+
} : {
|
|
8799
|
+
good: 0.7,
|
|
8800
|
+
medium: 0.4
|
|
8801
|
+
};
|
|
8802
|
+
if ($score >= thresholds.good) return '#d4edda';
|
|
8803
|
+
if ($score >= thresholds.medium) return '#fff3cd';
|
|
8804
|
+
return '#f8d7da';
|
|
8805
|
+
}, function (_a) {
|
|
8806
|
+
var $score = _a.$score,
|
|
8807
|
+
$type = _a.$type;
|
|
8808
|
+
var thresholds = $type === 'readability' ? {
|
|
8809
|
+
good: 0.5,
|
|
8810
|
+
medium: 0.2
|
|
8811
|
+
} : $type === 'detection' ? {
|
|
8812
|
+
good: 0.7,
|
|
8813
|
+
medium: 0.4
|
|
8814
|
+
} : {
|
|
8815
|
+
good: 0.7,
|
|
8816
|
+
medium: 0.4
|
|
8817
|
+
};
|
|
8818
|
+
if ($score >= thresholds.good) return '#155724';
|
|
8819
|
+
if ($score >= thresholds.medium) return '#856404';
|
|
8820
|
+
return '#721c24';
|
|
8821
|
+
}, function (_a) {
|
|
8822
|
+
var $score = _a.$score,
|
|
8823
|
+
$type = _a.$type;
|
|
8824
|
+
var thresholds = $type === 'readability' ? {
|
|
8825
|
+
good: 0.5,
|
|
8826
|
+
medium: 0.2
|
|
8827
|
+
} : $type === 'detection' ? {
|
|
8828
|
+
good: 0.7,
|
|
8829
|
+
medium: 0.4
|
|
8830
|
+
} : {
|
|
8831
|
+
good: 0.7,
|
|
8832
|
+
medium: 0.4
|
|
8833
|
+
};
|
|
8834
|
+
if ($score >= thresholds.good) return '#c3e6cb';
|
|
8835
|
+
if ($score >= thresholds.medium) return '#ffeaa7';
|
|
8836
|
+
return '#f5c6cb';
|
|
8837
|
+
});
|
|
8838
|
+
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"])));
|
|
8839
|
+
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"])));
|
|
8840
|
+
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"])));
|
|
8841
|
+
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"])));
|
|
8842
|
+
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"])));
|
|
8843
|
+
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"])));
|
|
8844
|
+
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"])));
|
|
8845
|
+
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) {
|
|
8846
|
+
var $improved = _a.$improved;
|
|
8847
|
+
return $improved ? '#d4edda' : '#e2e3e5';
|
|
8848
|
+
}, function (_a) {
|
|
8849
|
+
var $improved = _a.$improved;
|
|
8850
|
+
return $improved ? '#155724' : '#383d41';
|
|
8851
|
+
}, function (_a) {
|
|
8852
|
+
var $improved = _a.$improved;
|
|
8853
|
+
return $improved ? '#c3e6cb' : '#d6d8db';
|
|
8854
|
+
});
|
|
8855
|
+
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"])));
|
|
8856
|
+
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"])));
|
|
8857
|
+
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"])));
|
|
8858
|
+
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"])));
|
|
8859
|
+
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) {
|
|
8860
|
+
var $isHigher = _a.$isHigher;
|
|
8861
|
+
return $isHigher ? '#155724' : '#495057';
|
|
8862
|
+
}, function (_a) {
|
|
8863
|
+
var $isHigher = _a.$isHigher;
|
|
8864
|
+
return $isHigher ? '#d4edda' : 'white';
|
|
8865
|
+
}, function (_a) {
|
|
8866
|
+
var $isHigher = _a.$isHigher;
|
|
8867
|
+
return $isHigher ? '#c3e6cb' : '#dee2e6';
|
|
8868
|
+
});
|
|
8869
|
+
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;
|
|
8537
8870
|
|
|
8538
8871
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
8539
8872
|
var _this = this;
|
|
@@ -11063,7 +11396,7 @@ var lastDocumentDetectedAtDefaults = {
|
|
|
11063
11396
|
none: null
|
|
11064
11397
|
};
|
|
11065
11398
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
11066
|
-
var _b, _c, _d, _e, _f;
|
|
11399
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11067
11400
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
11068
11401
|
onLoadingProgress = _a.onLoadingProgress,
|
|
11069
11402
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -11074,86 +11407,115 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11074
11407
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
11075
11408
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
11076
11409
|
onDocumentDetected = _a.onDocumentDetected,
|
|
11077
|
-
|
|
11078
|
-
documentDetectionThrottleMs =
|
|
11079
|
-
|
|
11080
|
-
loadingOverlayMode =
|
|
11410
|
+
_m = _a.documentDetectionThrottleMs,
|
|
11411
|
+
documentDetectionThrottleMs = _m === void 0 ? 0 : _m,
|
|
11412
|
+
_o = _a.loadingOverlayMode,
|
|
11413
|
+
loadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
11081
11414
|
customOverlayContent = _a.customOverlayContent,
|
|
11082
11415
|
precapturedDocuments = _a.precapturedDocuments,
|
|
11083
|
-
|
|
11084
|
-
captureRequirement =
|
|
11085
|
-
|
|
11086
|
-
allowSinglePageIdCapture =
|
|
11087
|
-
|
|
11088
|
-
separateIdCardCaptureSequence =
|
|
11089
|
-
|
|
11090
|
-
thresholds =
|
|
11091
|
-
|
|
11092
|
-
skipSuccessScreen =
|
|
11416
|
+
_p = _a.captureRequirement,
|
|
11417
|
+
captureRequirement = _p === void 0 ? 'idCardOrPassport' : _p,
|
|
11418
|
+
_q = _a.allowSinglePageIdCapture,
|
|
11419
|
+
allowSinglePageIdCapture = _q === void 0 ? false : _q,
|
|
11420
|
+
_r = _a.separateIdCardCaptureSequence,
|
|
11421
|
+
separateIdCardCaptureSequence = _r === void 0 ? false : _r,
|
|
11422
|
+
_s = _a.thresholds,
|
|
11423
|
+
thresholds = _s === void 0 ? defaultIdCaptureThresholds : _s,
|
|
11424
|
+
_t = _a.skipSuccessScreen,
|
|
11425
|
+
skipSuccessScreen = _t === void 0 ? false : _t,
|
|
11093
11426
|
instructions = _a.instructions,
|
|
11094
|
-
|
|
11095
|
-
releaseCameraAccessOnExit =
|
|
11096
|
-
|
|
11097
|
-
guideType =
|
|
11098
|
-
|
|
11099
|
-
portraitGuidesOnMobile =
|
|
11100
|
-
|
|
11101
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
11102
|
-
|
|
11103
|
-
silentFallback =
|
|
11104
|
-
|
|
11105
|
-
forceFallbackMode =
|
|
11106
|
-
|
|
11107
|
-
allowIdCardBackToFrontCapture =
|
|
11108
|
-
|
|
11109
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
11110
|
-
|
|
11111
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
11112
|
-
|
|
11113
|
-
allowUploadingDocumentsFromStorage =
|
|
11114
|
-
|
|
11115
|
-
guideImages =
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11427
|
+
_u = _a.releaseCameraAccessOnExit,
|
|
11428
|
+
releaseCameraAccessOnExit = _u === void 0 ? true : _u,
|
|
11429
|
+
_v = _a.guideType,
|
|
11430
|
+
guideType = _v === void 0 ? 'fit' : _v,
|
|
11431
|
+
_w = _a.portraitGuidesOnMobile,
|
|
11432
|
+
portraitGuidesOnMobile = _w === void 0 ? true : _w,
|
|
11433
|
+
_x = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
11434
|
+
rotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
|
|
11435
|
+
_y = _a.silentFallback,
|
|
11436
|
+
silentFallback = _y === void 0 ? false : _y,
|
|
11437
|
+
_z = _a.forceFallbackMode,
|
|
11438
|
+
forceFallbackMode = _z === void 0 ? false : _z,
|
|
11439
|
+
_0 = _a.allowIdCardBackToFrontCapture,
|
|
11440
|
+
allowIdCardBackToFrontCapture = _0 === void 0 ? false : _0,
|
|
11441
|
+
_1 = _a.enableOverrideWrongDocumentTypeDialog,
|
|
11442
|
+
enableOverrideWrongDocumentTypeDialog = _1 === void 0 ? false : _1,
|
|
11443
|
+
_2 = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
11444
|
+
allowOverrideWrongDocumentTypeAfterMs = _2 === void 0 ? 8000 : _2,
|
|
11445
|
+
_3 = _a.allowUploadingDocumentsFromStorage,
|
|
11446
|
+
allowUploadingDocumentsFromStorage = _3 === void 0 ? false : _3,
|
|
11447
|
+
_4 = _a.guideImages,
|
|
11448
|
+
guideImages = _4 === void 0 ? defaultIdCaptureGuideImages : _4,
|
|
11449
|
+
_5 = _a.barcodeRecaptureThreshold,
|
|
11450
|
+
barcodeRecaptureThreshold = _5 === void 0 ? 1 : _5,
|
|
11451
|
+
_6 = _a.barcodeRecaptureTimeoutMs,
|
|
11452
|
+
barcodeRecaptureTimeoutMs = _6 === void 0 ? 5000 : _6,
|
|
11453
|
+
_7 = _a.barcodeRecaptureMoveCloserTimeoutMs,
|
|
11454
|
+
barcodeRecaptureMoveCloserTimeoutMs = _7 === void 0 ? 10000 : _7,
|
|
11455
|
+
_8 = _a.barcodeRecaptureBboxGrowthPct,
|
|
11456
|
+
barcodeRecaptureBboxGrowthPct = _8 === void 0 ? 20 : _8,
|
|
11457
|
+
_9 = _a.documentEdgeDistancePct,
|
|
11458
|
+
documentEdgeDistancePct = _9 === void 0 ? 0 : _9,
|
|
11459
|
+
_10 = _a.assets,
|
|
11460
|
+
assets = _10 === void 0 ? {} : _10,
|
|
11461
|
+
_11 = _a.classNames,
|
|
11462
|
+
classNames = _11 === void 0 ? {} : _11,
|
|
11463
|
+
_12 = _a.colors,
|
|
11464
|
+
colors = _12 === void 0 ? {} : _12,
|
|
11465
|
+
_13 = _a.verbiage,
|
|
11466
|
+
verbiage = _13 === void 0 ? {} : _13,
|
|
11467
|
+
_14 = _a.debugMode,
|
|
11468
|
+
debugMode = _14 === void 0 ? false : _14;
|
|
11128
11469
|
var state = useIdCaptureStore();
|
|
11129
|
-
var
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11470
|
+
var isCapturing = state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode';
|
|
11471
|
+
var _15 = useCameraStore(),
|
|
11472
|
+
cameraAccessDenied = _15.cameraAccessDenied,
|
|
11473
|
+
requestCameraAccess = _15.requestCameraAccess,
|
|
11474
|
+
releaseCameraAccess = _15.releaseCameraAccess;
|
|
11475
|
+
var _16 = useState(false),
|
|
11476
|
+
overlayDismissed = _16[0],
|
|
11477
|
+
setOverlayDismissed = _16[1];
|
|
11478
|
+
var _17 = useSubmissionContext(),
|
|
11479
|
+
submissionStatus = _17.submissionStatus,
|
|
11480
|
+
setIdFrontImage = _17.setIdFrontImage,
|
|
11481
|
+
setIdBackImage = _17.setIdBackImage,
|
|
11482
|
+
setPassportImage = _17.setPassportImage,
|
|
11483
|
+
setIdFrontIrImage = _17.setIdFrontIrImage,
|
|
11484
|
+
setIdBackIrImage = _17.setIdBackIrImage,
|
|
11485
|
+
setIdFrontUvImage = _17.setIdFrontUvImage,
|
|
11486
|
+
setIdBackUvImage = _17.setIdBackUvImage,
|
|
11487
|
+
setIdBarcodeImage = _17.setIdBarcodeImage,
|
|
11488
|
+
logIdFrontCaptureAttempt = _17.logIdFrontCaptureAttempt,
|
|
11489
|
+
logIdBackCaptureAttempt = _17.logIdBackCaptureAttempt;
|
|
11490
|
+
var _18 = useIdCaptureModelsContext(),
|
|
11491
|
+
start = _18.start,
|
|
11492
|
+
stop = _18.stop,
|
|
11493
|
+
onPredictionMade = _18.onPredictionMade,
|
|
11494
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
11495
|
+
modelError = _18.modelError,
|
|
11496
|
+
resetBestFrame = _18.resetBestFrame,
|
|
11497
|
+
documentDetectionBoundaries = _18.documentDetectionBoundaries,
|
|
11498
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
11499
|
+
getBestBarcode = _18.getBestBarcode,
|
|
11500
|
+
startBarcodeRecapturePhase = _18.startBarcodeRecapturePhase,
|
|
11501
|
+
getRecaptureBestBarcode = _18.getRecaptureBestBarcode;
|
|
11502
|
+
var initialBarcodeBboxRef = useRef(null);
|
|
11503
|
+
var recapturePhaseStartedRef = useRef(false);
|
|
11504
|
+
var _19 = useState(false),
|
|
11505
|
+
barcodeRecaptureGrowthSatisfied = _19[0],
|
|
11506
|
+
setBarcodeRecaptureGrowthSatisfied = _19[1];
|
|
11507
|
+
useEffect(function () {
|
|
11508
|
+
// Reset recapture gating whenever we enter/exit the recapture flow
|
|
11509
|
+
if (state.captureState === 'requestingBetterBarcode') {
|
|
11510
|
+
initialBarcodeBboxRef.current = null;
|
|
11511
|
+
recapturePhaseStartedRef.current = false;
|
|
11512
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11513
|
+
return;
|
|
11514
|
+
}
|
|
11515
|
+
initialBarcodeBboxRef.current = null;
|
|
11516
|
+
recapturePhaseStartedRef.current = false;
|
|
11517
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11518
|
+
}, [state.captureState]);
|
|
11157
11519
|
useEffect(function () {
|
|
11158
11520
|
dispatchIdCaptureAction({
|
|
11159
11521
|
type: 'configureWizard',
|
|
@@ -11164,10 +11526,12 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11164
11526
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
11165
11527
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
11166
11528
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
11167
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11529
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
11530
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
11531
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
11168
11532
|
}
|
|
11169
11533
|
});
|
|
11170
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11534
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, barcodeRecaptureThreshold, barcodeRecaptureTimeoutMs, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11171
11535
|
useEffect(function () {
|
|
11172
11536
|
var _a;
|
|
11173
11537
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -11179,8 +11543,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11179
11543
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
11180
11544
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
11181
11545
|
useEffect(function () {
|
|
11546
|
+
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
11547
|
+
if (state.captureState === 'requestingBetterBarcode') return;
|
|
11182
11548
|
if (documentCount) resetBestFrame();
|
|
11183
|
-
}, [documentCount, resetBestFrame]);
|
|
11549
|
+
}, [documentCount, resetBestFrame, state.captureState]);
|
|
11184
11550
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
11185
11551
|
var lastDocumentDetectedAt = useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
11186
11552
|
var logCaptureMetadata = useCallback(function (metadata) {
|
|
@@ -11199,24 +11565,62 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11199
11565
|
}
|
|
11200
11566
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
11201
11567
|
useEffect(function startModelsWhenCapturing() {
|
|
11202
|
-
if (!overlayDismissed ||
|
|
11568
|
+
if (!overlayDismissed || !isCapturing) return;
|
|
11203
11569
|
dispatchIdCaptureAction({
|
|
11204
11570
|
type: 'captureStarted'
|
|
11205
11571
|
});
|
|
11206
11572
|
start();
|
|
11207
|
-
}, [overlayDismissed, start
|
|
11573
|
+
}, [isCapturing, overlayDismissed, start]);
|
|
11208
11574
|
useEffect(function () {
|
|
11209
11575
|
onPredictionMade(function (prediction) {
|
|
11210
|
-
var _a;
|
|
11211
|
-
var
|
|
11212
|
-
captureState =
|
|
11213
|
-
requestedDocumentType =
|
|
11576
|
+
var _a, _b, _c, _d;
|
|
11577
|
+
var _e = useIdCaptureStore.getState(),
|
|
11578
|
+
captureState = _e.captureState,
|
|
11579
|
+
requestedDocumentType = _e.requestedDocumentType;
|
|
11214
11580
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
11215
11581
|
var thresholdMet = prediction[k];
|
|
11216
|
-
if (captureState === 'capturing') {
|
|
11582
|
+
if (captureState === 'capturing' || captureState === 'requestingBetterBarcode') {
|
|
11583
|
+
// During barcode recapture, wait until the barcode bbox grows by a configurable %
|
|
11584
|
+
// (to confirm the user moved the camera closer) before we start recapture processing.
|
|
11585
|
+
if (captureState === 'requestingBetterBarcode') {
|
|
11586
|
+
var growthPct = Math.max(0, Math.min(barcodeRecaptureBboxGrowthPct, 200));
|
|
11587
|
+
var requiredMultiplier = 1 + growthPct / 100;
|
|
11588
|
+
if (!recapturePhaseStartedRef.current) {
|
|
11589
|
+
// If growth requirement is disabled, begin recapture immediately.
|
|
11590
|
+
if (requiredMultiplier === 1) {
|
|
11591
|
+
recapturePhaseStartedRef.current = true;
|
|
11592
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11593
|
+
startBarcodeRecapturePhase();
|
|
11594
|
+
} else {
|
|
11595
|
+
var pdf417Box = (_a = prediction.bestPDF417) === null || _a === void 0 ? void 0 : _a.box;
|
|
11596
|
+
var frameWidth = (_b = prediction.frameWidth) !== null && _b !== void 0 ? _b : 0;
|
|
11597
|
+
var frameHeight = (_c = prediction.frameHeight) !== null && _c !== void 0 ? _c : 0;
|
|
11598
|
+
if (pdf417Box && frameWidth > 0 && frameHeight > 0) {
|
|
11599
|
+
var widthRatio = pdf417Box.width / frameWidth;
|
|
11600
|
+
var heightRatio = pdf417Box.height / frameHeight;
|
|
11601
|
+
if (!initialBarcodeBboxRef.current) {
|
|
11602
|
+
// First observed bbox when we enter recapture.
|
|
11603
|
+
initialBarcodeBboxRef.current = {
|
|
11604
|
+
widthRatio: widthRatio,
|
|
11605
|
+
heightRatio: heightRatio
|
|
11606
|
+
};
|
|
11607
|
+
} else {
|
|
11608
|
+
var baseline = initialBarcodeBboxRef.current;
|
|
11609
|
+
var widthSatisfied = widthRatio >= baseline.widthRatio * requiredMultiplier;
|
|
11610
|
+
var heightSatisfied = heightRatio >= baseline.heightRatio * requiredMultiplier;
|
|
11611
|
+
if (widthSatisfied && heightSatisfied) {
|
|
11612
|
+
recapturePhaseStartedRef.current = true;
|
|
11613
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11614
|
+
startBarcodeRecapturePhase();
|
|
11615
|
+
}
|
|
11616
|
+
}
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
}
|
|
11620
|
+
}
|
|
11217
11621
|
if (prediction.detectedDocumentType !== 'none') {
|
|
11218
11622
|
var now = Date.now();
|
|
11219
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
11623
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_d = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _d !== void 0 ? _d : 0) > documentDetectionThrottleMs) {
|
|
11220
11624
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
11221
11625
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
11222
11626
|
}
|
|
@@ -11234,7 +11638,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11234
11638
|
});
|
|
11235
11639
|
}
|
|
11236
11640
|
});
|
|
11237
|
-
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
11641
|
+
}, [barcodeRecaptureBboxGrowthPct, documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame, startBarcodeRecapturePhase]);
|
|
11238
11642
|
useEffect(function () {
|
|
11239
11643
|
if (state.captureState === 'complete') stop();
|
|
11240
11644
|
}, [state.captureState, stop]);
|
|
@@ -11289,9 +11693,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11289
11693
|
type: 'resetWizard'
|
|
11290
11694
|
});
|
|
11291
11695
|
}, []);
|
|
11292
|
-
var
|
|
11293
|
-
attempt =
|
|
11294
|
-
setAttempt =
|
|
11696
|
+
var _20 = useState(0),
|
|
11697
|
+
attempt = _20[0],
|
|
11698
|
+
setAttempt = _20[1];
|
|
11295
11699
|
var onExit = useCallback(function () {
|
|
11296
11700
|
releaseCameraAccess();
|
|
11297
11701
|
setOverlayDismissed(false);
|
|
@@ -11317,20 +11721,25 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11317
11721
|
});
|
|
11318
11722
|
}
|
|
11319
11723
|
}, [cameraAccessDenied]);
|
|
11724
|
+
var guidanceBarcodeRecaptureText = (_b = verbiage.guidanceBarcodeRecaptureText) !== null && _b !== void 0 ? _b : 'Please move the barcode closer to the camera';
|
|
11725
|
+
var guidanceBarcodeRecaptureInProgressText = (_c = verbiage.guidanceBarcodeRecaptureInProgressText) !== null && _c !== void 0 ? _c : 'Barcode capture in progress, please hold still';
|
|
11726
|
+
var barcodeRecaptureGuidanceMessage = barcodeRecaptureGrowthSatisfied ? guidanceBarcodeRecaptureInProgressText : guidanceBarcodeRecaptureText;
|
|
11320
11727
|
var idCaptureVerbiages = {
|
|
11321
11728
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
11322
11729
|
instructionText: 'Scan the front of ID',
|
|
11323
11730
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
11324
11731
|
}),
|
|
11325
11732
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
11326
|
-
instructionText: 'Scan the back of ID'
|
|
11733
|
+
instructionText: state.captureState === 'requestingBetterBarcode' ? barcodeRecaptureGuidanceMessage : 'Scan the back of ID'
|
|
11327
11734
|
}),
|
|
11328
11735
|
passport: useTranslations(verbiage.passport, {
|
|
11329
11736
|
instructionText: 'Scan the ID page of passport'
|
|
11330
11737
|
})
|
|
11331
11738
|
};
|
|
11332
11739
|
var theme = useTheme();
|
|
11333
|
-
|
|
11740
|
+
// During barcode recapture, use idCardBack verbiage to show barcode recapture message
|
|
11741
|
+
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
11742
|
+
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
11334
11743
|
useEffect(function () {
|
|
11335
11744
|
if (separateIdCardCaptureSequence) return;
|
|
11336
11745
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -11344,6 +11753,130 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11344
11753
|
clearTimeout(t);
|
|
11345
11754
|
};
|
|
11346
11755
|
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
11756
|
+
// Handle barcode recapture start - snapshot initial barcode and initialize recapture state
|
|
11757
|
+
useEffect(function () {
|
|
11758
|
+
var _a, _b;
|
|
11759
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11760
|
+
if (state.initialCaptureBarcodeImage !== null) return; // Already initialized
|
|
11761
|
+
// Get the initial barcode image from capturedDocuments (since resetBestFrame clears the canvas)
|
|
11762
|
+
var initialBarcodeImage = (_b = (_a = state.capturedDocuments.idBarcodeImage) === null || _a === void 0 ? void 0 : _a.imageData) !== null && _b !== void 0 ? _b : null;
|
|
11763
|
+
dispatchIdCaptureAction({
|
|
11764
|
+
type: 'barcodeRecaptureStarted',
|
|
11765
|
+
payload: {
|
|
11766
|
+
initialBarcodeScore: state.initialBarcodeScore,
|
|
11767
|
+
initialCaptureBarcodeImage: initialBarcodeImage
|
|
11768
|
+
}
|
|
11769
|
+
});
|
|
11770
|
+
}, [state.captureState, (_d = state.capturedDocuments.idBarcodeImage) === null || _d === void 0 ? void 0 : _d.imageData, state.initialBarcodeScore, state.initialCaptureBarcodeImage]);
|
|
11771
|
+
// Handle barcode recapture timeout
|
|
11772
|
+
useEffect(function () {
|
|
11773
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11774
|
+
// Continue detection to try to get a better barcode
|
|
11775
|
+
setTimeout(start, 100);
|
|
11776
|
+
var t = setTimeout(function () {
|
|
11777
|
+
// Move-closer window expired before recapture began
|
|
11778
|
+
if (recapturePhaseStartedRef.current) return;
|
|
11779
|
+
var bestBarcode = getBestBarcode();
|
|
11780
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11781
|
+
if (improved) {
|
|
11782
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. Found better barcode anyway: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11783
|
+
// Persist the "after" image for debug visual comparison, even if the
|
|
11784
|
+
// model-provider recapture tracker was never started.
|
|
11785
|
+
dispatchIdCaptureAction({
|
|
11786
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11787
|
+
payload: {
|
|
11788
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11789
|
+
}
|
|
11790
|
+
});
|
|
11791
|
+
dispatchIdCaptureAction({
|
|
11792
|
+
type: 'barcodeCaptured',
|
|
11793
|
+
payload: {
|
|
11794
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11795
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
11796
|
+
}
|
|
11797
|
+
});
|
|
11798
|
+
} else {
|
|
11799
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. No better barcode found. Initial score: ".concat(state.initialBarcodeScore.toFixed(3)));
|
|
11800
|
+
}
|
|
11801
|
+
// Record that recapture was attempted (for diagnostics)
|
|
11802
|
+
dispatchIdCaptureAction({
|
|
11803
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
11804
|
+
payload: {
|
|
11805
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : state.initialBarcodeScore
|
|
11806
|
+
}
|
|
11807
|
+
});
|
|
11808
|
+
dispatchIdCaptureAction({
|
|
11809
|
+
type: 'barcodeRecaptureCompleted'
|
|
11810
|
+
});
|
|
11811
|
+
}, barcodeRecaptureMoveCloserTimeoutMs);
|
|
11812
|
+
return function () {
|
|
11813
|
+
return clearTimeout(t);
|
|
11814
|
+
};
|
|
11815
|
+
}, [barcodeRecaptureMoveCloserTimeoutMs, getBestBarcode, start, state.captureState, state.initialBarcodeScore]);
|
|
11816
|
+
useEffect(function () {
|
|
11817
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11818
|
+
if (!barcodeRecaptureGrowthSatisfied) return;
|
|
11819
|
+
var t = setTimeout(function () {
|
|
11820
|
+
var _a, _b;
|
|
11821
|
+
// Capture window expired - complete with whatever barcode we have
|
|
11822
|
+
var recaptureBarcode = getRecaptureBestBarcode();
|
|
11823
|
+
var bestBarcode = getBestBarcode();
|
|
11824
|
+
var recaptureScore = (_a = recaptureBarcode === null || recaptureBarcode === void 0 ? void 0 : recaptureBarcode.score) !== null && _a !== void 0 ? _a : null;
|
|
11825
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11826
|
+
// Store the recapture score for diagnostic purposes
|
|
11827
|
+
dispatchIdCaptureAction({
|
|
11828
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
11829
|
+
payload: {
|
|
11830
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : recaptureScore !== null && recaptureScore !== void 0 ? recaptureScore : state.initialBarcodeScore
|
|
11831
|
+
}
|
|
11832
|
+
});
|
|
11833
|
+
// Store the recapture barcode image if we found one
|
|
11834
|
+
if (recaptureBarcode) {
|
|
11835
|
+
dispatchIdCaptureAction({
|
|
11836
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11837
|
+
payload: {
|
|
11838
|
+
recaptureBarcodeImage: recaptureBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11839
|
+
}
|
|
11840
|
+
});
|
|
11841
|
+
} else if (improved) {
|
|
11842
|
+
// If we improved but don't have a recapture-specific best tracked,
|
|
11843
|
+
// still persist the "after" image so debug visual comparison works.
|
|
11844
|
+
dispatchIdCaptureAction({
|
|
11845
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11846
|
+
payload: {
|
|
11847
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11848
|
+
}
|
|
11849
|
+
});
|
|
11850
|
+
}
|
|
11851
|
+
if (improved) {
|
|
11852
|
+
log("[IdCaptureWizard] Barcode recapture completed. Found better barcode: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11853
|
+
dispatchIdCaptureAction({
|
|
11854
|
+
type: 'barcodeCaptured',
|
|
11855
|
+
payload: {
|
|
11856
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11857
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
11858
|
+
}
|
|
11859
|
+
});
|
|
11860
|
+
} else {
|
|
11861
|
+
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)));
|
|
11862
|
+
}
|
|
11863
|
+
dispatchIdCaptureAction({
|
|
11864
|
+
type: 'barcodeRecaptureCompleted'
|
|
11865
|
+
});
|
|
11866
|
+
}, barcodeRecaptureTimeoutMs);
|
|
11867
|
+
return function () {
|
|
11868
|
+
return clearTimeout(t);
|
|
11869
|
+
};
|
|
11870
|
+
}, [barcodeRecaptureGrowthSatisfied, barcodeRecaptureTimeoutMs, getBestBarcode, getRecaptureBestBarcode, state.captureState, state.initialBarcodeScore]);
|
|
11871
|
+
// Continue detection during barcode recapture and update barcode if better one found
|
|
11872
|
+
useEffect(function () {
|
|
11873
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11874
|
+
// Set required document type to idCardBack for barcode detection
|
|
11875
|
+
setRequiredDocumentType('idCardBack');
|
|
11876
|
+
return function () {
|
|
11877
|
+
setRequiredDocumentType('none');
|
|
11878
|
+
};
|
|
11879
|
+
}, [setRequiredDocumentType, state.captureState]);
|
|
11347
11880
|
useEffect(function () {
|
|
11348
11881
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
11349
11882
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -11382,9 +11915,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11382
11915
|
});
|
|
11383
11916
|
});
|
|
11384
11917
|
}, []);
|
|
11385
|
-
var
|
|
11386
|
-
progressStarted =
|
|
11387
|
-
setProgressStarted =
|
|
11918
|
+
var _21 = useState(false),
|
|
11919
|
+
progressStarted = _21[0],
|
|
11920
|
+
setProgressStarted = _21[1];
|
|
11388
11921
|
useEffect(function () {
|
|
11389
11922
|
if (state.captureState === 'capturing') {
|
|
11390
11923
|
setProgressStarted(false);
|
|
@@ -11412,9 +11945,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11412
11945
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
11413
11946
|
});
|
|
11414
11947
|
}
|
|
11415
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
11948
|
+
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';
|
|
11416
11949
|
var guidesStatus = !overlayDismissed ? 'disabled' : state.isGoodFrame ? 'capturing' : 'ready';
|
|
11417
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ScalingCameraFeed, null), overlayDismissed && state.captureState === 'capturing' && (/*#__PURE__*/React__default.createElement(IdCapture, {
|
|
11950
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ScalingCameraFeed, null), overlayDismissed && (state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode') && (/*#__PURE__*/React__default.createElement(IdCapture, {
|
|
11418
11951
|
requiredDocumentType: state.requestedDocumentType,
|
|
11419
11952
|
thresholds: thresholds,
|
|
11420
11953
|
onCapture: onCapture,
|
|
@@ -11422,11 +11955,18 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11422
11955
|
colors: colors,
|
|
11423
11956
|
verbiage: idCaptureVerbiage,
|
|
11424
11957
|
debugMode: debugMode
|
|
11425
|
-
})), /*#__PURE__*/React__default.createElement(
|
|
11958
|
+
})), overlayDismissed && state.captureState === 'requestingBetterBarcode' && (/*#__PURE__*/React__default.createElement(GuidanceMessageContainer, {
|
|
11959
|
+
"$top": "",
|
|
11960
|
+
"$bottom": "12.5%",
|
|
11961
|
+
className: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.guidanceMessageContainer
|
|
11962
|
+
}, /*#__PURE__*/React__default.createElement(GuidanceMessage, {
|
|
11963
|
+
"$variant": "default",
|
|
11964
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.guidanceMessage
|
|
11965
|
+
}, barcodeRecaptureGuidanceMessage))), /*#__PURE__*/React__default.createElement(IdCaptureGuides, {
|
|
11426
11966
|
key: "guides".concat(attempt),
|
|
11427
11967
|
guideType: guideType,
|
|
11428
11968
|
status: guidesStatus,
|
|
11429
|
-
progress: progressStarted &&
|
|
11969
|
+
progress: progressStarted && isCapturing ? 1 : 0,
|
|
11430
11970
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
11431
11971
|
requestedAction: requestedAction,
|
|
11432
11972
|
images: guideImages,
|
|
@@ -11434,15 +11974,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11434
11974
|
colors: colors,
|
|
11435
11975
|
verbiage: idCaptureVerbiage,
|
|
11436
11976
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
11437
|
-
}), debugMode && !((
|
|
11438
|
-
classNames: (
|
|
11439
|
-
text: (
|
|
11977
|
+
}), 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__default.createElement(IdCaptureImagePreview, {
|
|
11978
|
+
classNames: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.imagePreview,
|
|
11979
|
+
text: (_k = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _k === void 0 ? void 0 : _k.processingIdCardText,
|
|
11440
11980
|
imageUrl: state.imageUrl
|
|
11441
11981
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React__default.createElement("div", {
|
|
11442
11982
|
id: "idmission-above-guides-content"
|
|
11443
11983
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
11444
11984
|
onClick: onExit,
|
|
11445
|
-
className: (
|
|
11985
|
+
className: (_l = classNames.capture) === null || _l === void 0 ? void 0 : _l.exitCaptureBtn
|
|
11446
11986
|
})), !overlayDismissed && (/*#__PURE__*/React__default.createElement(IdCaptureLoadingOverlay, {
|
|
11447
11987
|
key: "loading".concat(attempt),
|
|
11448
11988
|
mode: loadingOverlayMode,
|
|
@@ -11480,7 +12020,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11480
12020
|
onRetryClick: onRetryClick,
|
|
11481
12021
|
colors: colors.success,
|
|
11482
12022
|
verbiage: verbiage.success,
|
|
11483
|
-
debugMode: debugMode
|
|
12023
|
+
debugMode: debugMode,
|
|
12024
|
+
initialBarcodeScore:
|
|
12025
|
+
// Show diagnostic info if recapture occurred (indicated by recaptureBarcodeScore being set)
|
|
12026
|
+
// If recapture occurred, initialBarcodeScore was set (even if it's 0, which is valid)
|
|
12027
|
+
state.recaptureBarcodeScore !== null ? state.initialBarcodeScore : undefined,
|
|
12028
|
+
recaptureBarcodeScore: state.recaptureBarcodeScore,
|
|
12029
|
+
initialCaptureBarcodeImage: state.initialCaptureBarcodeImage,
|
|
12030
|
+
recaptureBarcodeImage: state.recaptureBarcodeImage
|
|
11484
12031
|
})));
|
|
11485
12032
|
};
|
|
11486
12033
|
function IdCaptureWizardWithProviders(_a) {
|