idmission-web-sdk 2.3.167 → 2.3.168-feature-barcode-recapture-99e7dd3
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;
|
|
@@ -4649,8 +4649,13 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4649
4649
|
if (!selectedVideoStreamId) return;
|
|
4650
4650
|
var srcObject = e.currentTarget.srcObject;
|
|
4651
4651
|
if (srcObject.id === selectedVideoStreamId) {
|
|
4652
|
+
var _a = e.currentTarget,
|
|
4653
|
+
videoWidth = _a.videoWidth,
|
|
4654
|
+
videoHeight = _a.videoHeight;
|
|
4652
4655
|
set({
|
|
4653
|
-
videoLoaded: true
|
|
4656
|
+
videoLoaded: true,
|
|
4657
|
+
videoWidth: videoWidth,
|
|
4658
|
+
videoHeight: videoHeight
|
|
4654
4659
|
});
|
|
4655
4660
|
} else {
|
|
4656
4661
|
set({
|
|
@@ -4963,26 +4968,25 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4963
4968
|
};
|
|
4964
4969
|
var CameraStoreContext = /*#__PURE__*/createContext(undefined);
|
|
4965
4970
|
function CameraStoreProvider(_a) {
|
|
4966
|
-
var _b;
|
|
4967
4971
|
var children = _a.children,
|
|
4968
|
-
|
|
4969
|
-
requestAccessAutomatically =
|
|
4970
|
-
|
|
4971
|
-
preferIphoneContinuityCamera =
|
|
4972
|
-
|
|
4973
|
-
preferFrontFacingCamera =
|
|
4974
|
-
|
|
4975
|
-
maxVideoWidth =
|
|
4972
|
+
_b = _a.requestAccessAutomatically,
|
|
4973
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
4974
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
4975
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
4976
|
+
_d = _a.preferFrontFacingCamera,
|
|
4977
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
4978
|
+
_e = _a.maxVideoWidth,
|
|
4979
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
4976
4980
|
maxFps = _a.maxFps,
|
|
4977
4981
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
4978
4982
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
4979
4983
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
4980
|
-
|
|
4981
|
-
requireMicrophoneAccess =
|
|
4982
|
-
|
|
4983
|
-
classNames =
|
|
4984
|
-
|
|
4985
|
-
verbiage =
|
|
4984
|
+
_f = _a.requireMicrophoneAccess,
|
|
4985
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
4986
|
+
_g = _a.classNames,
|
|
4987
|
+
classNames = _g === void 0 ? {} : _g,
|
|
4988
|
+
_h = _a.verbiage,
|
|
4989
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
4986
4990
|
var videoRef = useRef(null);
|
|
4987
4991
|
var store = useRef(undefined);
|
|
4988
4992
|
store.current || (store.current = createCameraStore({
|
|
@@ -4996,16 +5000,6 @@ function CameraStoreProvider(_a) {
|
|
|
4996
5000
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
4997
5001
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
4998
5002
|
}));
|
|
4999
|
-
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
5000
|
-
videoWidth = _k.videoWidth,
|
|
5001
|
-
videoHeight = _k.videoHeight;
|
|
5002
|
-
useEffect(function () {
|
|
5003
|
-
var _a;
|
|
5004
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
5005
|
-
videoWidth: videoWidth,
|
|
5006
|
-
videoHeight: videoHeight
|
|
5007
|
-
});
|
|
5008
|
-
}, [videoWidth, videoHeight]);
|
|
5009
5003
|
useEffect(function () {
|
|
5010
5004
|
var _a, _b, _c;
|
|
5011
5005
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -6084,6 +6078,15 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
6084
6078
|
getBestBarcode: function getBestBarcode() {
|
|
6085
6079
|
return null;
|
|
6086
6080
|
},
|
|
6081
|
+
startBarcodeRecapturePhase: function startBarcodeRecapturePhase() {
|
|
6082
|
+
return null;
|
|
6083
|
+
},
|
|
6084
|
+
getInitialCaptureBestBarcode: function getInitialCaptureBestBarcode() {
|
|
6085
|
+
return null;
|
|
6086
|
+
},
|
|
6087
|
+
getRecaptureBestBarcode: function getRecaptureBestBarcode() {
|
|
6088
|
+
return null;
|
|
6089
|
+
},
|
|
6087
6090
|
requiredDocumentType: 'none',
|
|
6088
6091
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
6089
6092
|
return null;
|
|
@@ -6143,6 +6146,14 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6143
6146
|
var bestBarcodeScore = useRef(0);
|
|
6144
6147
|
var stopDetection = useRef(0);
|
|
6145
6148
|
var analyzeBarcodeReadability = useBarcodeReadabilityAnalysis();
|
|
6149
|
+
// Barcode recapture tracking - separate canvases for initial and recapture sequences
|
|
6150
|
+
var initialCaptureBarcodeCanvas = useRef(null);
|
|
6151
|
+
var initialCaptureBarcodeDetails = useRef(null);
|
|
6152
|
+
var initialCaptureBarcodeScore = useRef(0);
|
|
6153
|
+
var recaptureBarcodeCanvas = useRef(null);
|
|
6154
|
+
var recaptureBarcodeDetails = useRef(null);
|
|
6155
|
+
var recaptureBarcodeScore = useRef(0);
|
|
6156
|
+
var isRecapturePhase = useRef(false);
|
|
6146
6157
|
var _h = useState('none'),
|
|
6147
6158
|
requiredDocumentType = _h[0],
|
|
6148
6159
|
setRequiredDocumentType = _h[1];
|
|
@@ -6167,10 +6178,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6167
6178
|
var _this = this;
|
|
6168
6179
|
onDocumentDetected(function (prediction) {
|
|
6169
6180
|
return __awaiter(_this, void 0, void 0, function () {
|
|
6170
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
6171
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6172
|
-
return __generator(this, function (
|
|
6173
|
-
switch (
|
|
6181
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, isInRecapturePhase, shouldRunBarcodeAnalysisDuringRecapture, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult, ctx, barcodeAnalysisResult, ctx;
|
|
6182
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6183
|
+
return __generator(this, function (_k) {
|
|
6184
|
+
switch (_k.label) {
|
|
6174
6185
|
case 0:
|
|
6175
6186
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
6176
6187
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -6184,7 +6195,9 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6184
6195
|
prediction.singlePageDetectionThresholdMet = false;
|
|
6185
6196
|
}
|
|
6186
6197
|
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'));
|
|
6187
|
-
|
|
6198
|
+
isInRecapturePhase = isRecapturePhase.current;
|
|
6199
|
+
shouldRunBarcodeAnalysisDuringRecapture = isInRecapturePhase && isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentIsStable && prediction.bestDocument && prediction.bestPDF417;
|
|
6200
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 3];
|
|
6188
6201
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
6189
6202
|
if (focusPrediction) {
|
|
6190
6203
|
focusScore = focusPrediction.score;
|
|
@@ -6207,7 +6220,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6207
6220
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
6208
6221
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6209
6222
|
case 1:
|
|
6210
|
-
barcodeAnalysisResult =
|
|
6223
|
+
barcodeAnalysisResult = _k.sent();
|
|
6211
6224
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6212
6225
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6213
6226
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -6217,15 +6230,61 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6217
6230
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6218
6231
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6219
6232
|
}
|
|
6220
|
-
|
|
6233
|
+
// During recapture phase, also track best barcode separately for recapture sequence
|
|
6234
|
+
if (isRecapturePhase.current && recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6235
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6236
|
+
recaptureBarcodeDetails.current = (_g = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _g !== void 0 ? _g : null;
|
|
6237
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
6238
|
+
if (bestBarcodeCanvas.current) {
|
|
6239
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6240
|
+
if (ctx) {
|
|
6241
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6242
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6243
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6244
|
+
}
|
|
6245
|
+
}
|
|
6246
|
+
}
|
|
6247
|
+
_k.label = 2;
|
|
6221
6248
|
case 2:
|
|
6249
|
+
return [3 /*break*/, 5];
|
|
6250
|
+
case 3:
|
|
6251
|
+
if (!shouldRunBarcodeAnalysisDuringRecapture) return [3 /*break*/, 5];
|
|
6252
|
+
if (!(enableBarcodeReadabilityModel && croppedDocumentCanvas.current && stopDetectionAtStart === stopDetection.current)) return [3 /*break*/, 5];
|
|
6253
|
+
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6254
|
+
case 4:
|
|
6255
|
+
barcodeAnalysisResult = _k.sent();
|
|
6256
|
+
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6257
|
+
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6258
|
+
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
6259
|
+
if (barcodeAnalysisResult.newBestBarcodeScore) {
|
|
6260
|
+
bestBarcodeScore.current = barcodeAnalysisResult.newBestBarcodeScore;
|
|
6261
|
+
}
|
|
6262
|
+
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6263
|
+
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6264
|
+
}
|
|
6265
|
+
// Track best barcode separately for recapture sequence
|
|
6266
|
+
if (recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6267
|
+
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6268
|
+
recaptureBarcodeDetails.current = (_h = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _h !== void 0 ? _h : null;
|
|
6269
|
+
// Copy the current best barcode canvas to recapture canvas
|
|
6270
|
+
if (bestBarcodeCanvas.current) {
|
|
6271
|
+
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6272
|
+
if (ctx) {
|
|
6273
|
+
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6274
|
+
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6275
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6276
|
+
}
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
_k.label = 5;
|
|
6280
|
+
case 5:
|
|
6222
6281
|
/**
|
|
6223
6282
|
* @note
|
|
6224
6283
|
* This should ALWAYS be called.
|
|
6225
6284
|
* Do not return early from this function unless
|
|
6226
6285
|
* lastPredictionCanvas.current is not set
|
|
6227
6286
|
*/
|
|
6228
|
-
(
|
|
6287
|
+
(_j = onPredictionHandler.current) === null || _j === void 0 ? void 0 : _j.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
6229
6288
|
focusScore: focusScore,
|
|
6230
6289
|
focusPredictionTime: focusPredictionTime,
|
|
6231
6290
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -6258,19 +6317,58 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6258
6317
|
canvas: bestBarcodeCanvas.current
|
|
6259
6318
|
});
|
|
6260
6319
|
}, []);
|
|
6320
|
+
var startBarcodeRecapturePhase = useCallback(function () {
|
|
6321
|
+
// Snapshot current best barcode to initial capture canvas
|
|
6322
|
+
if (bestBarcodeCanvas.current && initialCaptureBarcodeCanvas.current) {
|
|
6323
|
+
var ctx = initialCaptureBarcodeCanvas.current.getContext('2d');
|
|
6324
|
+
if (ctx) {
|
|
6325
|
+
initialCaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6326
|
+
initialCaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6327
|
+
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6328
|
+
}
|
|
6329
|
+
}
|
|
6330
|
+
initialCaptureBarcodeDetails.current = bestBarcodeDetails.current ? _assign({}, bestBarcodeDetails.current) : null;
|
|
6331
|
+
initialCaptureBarcodeScore.current = bestBarcodeScore.current;
|
|
6332
|
+
// Reset recapture tracking
|
|
6333
|
+
recaptureBarcodeScore.current = 0;
|
|
6334
|
+
recaptureBarcodeDetails.current = null;
|
|
6335
|
+
// Enter recapture phase
|
|
6336
|
+
isRecapturePhase.current = true;
|
|
6337
|
+
}, []);
|
|
6338
|
+
var getInitialCaptureBestBarcode = useCallback(function () {
|
|
6339
|
+
if (!initialCaptureBarcodeDetails.current || !initialCaptureBarcodeCanvas.current) return null;
|
|
6340
|
+
return _assign(_assign({}, initialCaptureBarcodeDetails.current), {
|
|
6341
|
+
canvas: initialCaptureBarcodeCanvas.current
|
|
6342
|
+
});
|
|
6343
|
+
}, []);
|
|
6344
|
+
var getRecaptureBestBarcode = useCallback(function () {
|
|
6345
|
+
if (!recaptureBarcodeDetails.current || !recaptureBarcodeCanvas.current) return null;
|
|
6346
|
+
return _assign(_assign({}, recaptureBarcodeDetails.current), {
|
|
6347
|
+
canvas: recaptureBarcodeCanvas.current
|
|
6348
|
+
});
|
|
6349
|
+
}, []);
|
|
6261
6350
|
var _j = useState(0),
|
|
6262
6351
|
canvasKey = _j[0],
|
|
6263
6352
|
setCanvasKey = _j[1];
|
|
6264
6353
|
var resetBestFrame = useCallback(function () {
|
|
6354
|
+
// During recapture phase, preserve all canvas state to avoid race conditions
|
|
6355
|
+
// that could result in black/empty barcode images on slow devices
|
|
6356
|
+
if (isRecapturePhase.current) {
|
|
6357
|
+
return;
|
|
6358
|
+
}
|
|
6265
6359
|
stopDetection.current += 1;
|
|
6266
|
-
setCanvasKey(function (n) {
|
|
6267
|
-
return n + 1;
|
|
6268
|
-
});
|
|
6269
6360
|
clearDocumentDetectionLastPredictionCanvas();
|
|
6270
6361
|
bestFrameDetails.current = null;
|
|
6271
6362
|
bestFocusScore.current = 0;
|
|
6272
6363
|
bestBarcodeScore.current = 0;
|
|
6273
6364
|
bestBarcodeDetails.current = null;
|
|
6365
|
+
setCanvasKey(function (n) {
|
|
6366
|
+
return n + 1;
|
|
6367
|
+
});
|
|
6368
|
+
initialCaptureBarcodeScore.current = 0;
|
|
6369
|
+
initialCaptureBarcodeDetails.current = null;
|
|
6370
|
+
recaptureBarcodeScore.current = 0;
|
|
6371
|
+
recaptureBarcodeDetails.current = null;
|
|
6274
6372
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
6275
6373
|
useEffect(function () {
|
|
6276
6374
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -6336,10 +6434,13 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6336
6434
|
bestFrameDetails: bestFrameDetails,
|
|
6337
6435
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
6338
6436
|
getBestBarcode: getBestBarcode,
|
|
6437
|
+
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
6438
|
+
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
6439
|
+
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
6339
6440
|
requiredDocumentType: requiredDocumentType,
|
|
6340
6441
|
setRequiredDocumentType: setRequiredDocumentType
|
|
6341
6442
|
};
|
|
6342
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
6443
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, startBarcodeRecapturePhase, getInitialCaptureBestBarcode, getRecaptureBestBarcode, requiredDocumentType]);
|
|
6343
6444
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
6344
6445
|
value: value
|
|
6345
6446
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -6351,6 +6452,12 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6351
6452
|
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6352
6453
|
key: "cd-".concat(canvasKey),
|
|
6353
6454
|
ref: croppedDocumentCanvas
|
|
6455
|
+
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6456
|
+
key: "icb-".concat(canvasKey),
|
|
6457
|
+
ref: initialCaptureBarcodeCanvas
|
|
6458
|
+
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6459
|
+
key: "rcb-".concat(canvasKey),
|
|
6460
|
+
ref: recaptureBarcodeCanvas
|
|
6354
6461
|
})), children);
|
|
6355
6462
|
}
|
|
6356
6463
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -6445,6 +6552,8 @@ var initialState$5 = {
|
|
|
6445
6552
|
singlePageDetectionThresholdMet: false,
|
|
6446
6553
|
focusScore: 0,
|
|
6447
6554
|
focusThresholdMet: false,
|
|
6555
|
+
pdf417PredictionScore: 0,
|
|
6556
|
+
pdf417PredictionThresholdMet: false,
|
|
6448
6557
|
isGoodFrame: false,
|
|
6449
6558
|
goodFramesCount: 0,
|
|
6450
6559
|
goodFramesThreshold: 3,
|
|
@@ -6466,30 +6575,42 @@ var initialState$5 = {
|
|
|
6466
6575
|
uploadingDocumentsType: null,
|
|
6467
6576
|
operationStartedAt: null,
|
|
6468
6577
|
captureStartedAt: null,
|
|
6578
|
+
barcodeRecaptureStartedAt: null,
|
|
6579
|
+
initialBarcodeScore: 0,
|
|
6580
|
+
recaptureBarcodeScore: null,
|
|
6581
|
+
barcodeRecaptureThreshold: 0,
|
|
6582
|
+
barcodeRecaptureTimeoutMs: 5000,
|
|
6583
|
+
initialCaptureBarcodeImage: null,
|
|
6584
|
+
recaptureBarcodeImage: null,
|
|
6469
6585
|
dispatch: function dispatch() {
|
|
6470
6586
|
return null;
|
|
6471
6587
|
}
|
|
6472
6588
|
};
|
|
6473
6589
|
var _reducer = function reducer(state, action) {
|
|
6474
6590
|
var _a;
|
|
6591
|
+
var _b, _c;
|
|
6475
6592
|
switch (action.type) {
|
|
6476
6593
|
case 'configureWizard':
|
|
6477
6594
|
{
|
|
6478
|
-
var
|
|
6479
|
-
captureRequirement =
|
|
6480
|
-
precapturedDocuments =
|
|
6481
|
-
allowSinglePageIdCapture =
|
|
6482
|
-
allowIdCardBackToFrontCapture =
|
|
6483
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
6484
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
6485
|
-
allowUploadingDocumentsFromStorage =
|
|
6595
|
+
var _d = action.payload,
|
|
6596
|
+
captureRequirement = _d.captureRequirement,
|
|
6597
|
+
precapturedDocuments = _d.precapturedDocuments,
|
|
6598
|
+
allowSinglePageIdCapture = _d.allowSinglePageIdCapture,
|
|
6599
|
+
allowIdCardBackToFrontCapture = _d.allowIdCardBackToFrontCapture,
|
|
6600
|
+
enableOverrideWrongDocumentTypeDialog = _d.enableOverrideWrongDocumentTypeDialog,
|
|
6601
|
+
allowOverrideWrongDocumentTypeAfterMs = _d.allowOverrideWrongDocumentTypeAfterMs,
|
|
6602
|
+
allowUploadingDocumentsFromStorage = _d.allowUploadingDocumentsFromStorage,
|
|
6603
|
+
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
6604
|
+
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
6486
6605
|
var newState = _assign(_assign({}, state), {
|
|
6487
6606
|
captureRequirement: captureRequirement,
|
|
6488
6607
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
6489
6608
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
6490
6609
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
6491
6610
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
6492
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6611
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
6612
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
6613
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
6493
6614
|
});
|
|
6494
6615
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
6495
6616
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -6546,26 +6667,28 @@ var _reducer = function reducer(state, action) {
|
|
|
6546
6667
|
});
|
|
6547
6668
|
case 'objectsDetected':
|
|
6548
6669
|
{
|
|
6549
|
-
var
|
|
6550
|
-
detectedObjects =
|
|
6551
|
-
detectionThresholdMet =
|
|
6552
|
-
detectedDocumentType =
|
|
6553
|
-
idCardFrontDetectionScore =
|
|
6554
|
-
idCardFrontDetectionThresholdMet =
|
|
6555
|
-
idCardBackDetectionScore =
|
|
6556
|
-
idCardBackDetectionThresholdMet =
|
|
6557
|
-
passportDetectionScore =
|
|
6558
|
-
passportDetectionThresholdMet =
|
|
6559
|
-
singlePageDetectionScore =
|
|
6560
|
-
singlePageDetectionThresholdMet =
|
|
6561
|
-
bestDocument =
|
|
6562
|
-
documentInBounds =
|
|
6563
|
-
documentTooClose =
|
|
6564
|
-
documentIsStable =
|
|
6565
|
-
focusScore =
|
|
6566
|
-
focusThresholdMet =
|
|
6567
|
-
|
|
6568
|
-
|
|
6670
|
+
var _e = action.payload.prediction,
|
|
6671
|
+
detectedObjects = _e.detectedObjects,
|
|
6672
|
+
detectionThresholdMet = _e.detectionThresholdMet,
|
|
6673
|
+
detectedDocumentType = _e.detectedDocumentType,
|
|
6674
|
+
idCardFrontDetectionScore = _e.idCardFrontDetectionScore,
|
|
6675
|
+
idCardFrontDetectionThresholdMet = _e.idCardFrontDetectionThresholdMet,
|
|
6676
|
+
idCardBackDetectionScore = _e.idCardBackDetectionScore,
|
|
6677
|
+
idCardBackDetectionThresholdMet = _e.idCardBackDetectionThresholdMet,
|
|
6678
|
+
passportDetectionScore = _e.passportDetectionScore,
|
|
6679
|
+
passportDetectionThresholdMet = _e.passportDetectionThresholdMet,
|
|
6680
|
+
singlePageDetectionScore = _e.singlePageDetectionScore,
|
|
6681
|
+
singlePageDetectionThresholdMet = _e.singlePageDetectionThresholdMet,
|
|
6682
|
+
bestDocument = _e.bestDocument,
|
|
6683
|
+
documentInBounds = _e.documentInBounds,
|
|
6684
|
+
documentTooClose = _e.documentTooClose,
|
|
6685
|
+
documentIsStable = _e.documentIsStable,
|
|
6686
|
+
focusScore = _e.focusScore,
|
|
6687
|
+
focusThresholdMet = _e.focusThresholdMet,
|
|
6688
|
+
pdf417PredictionScore = _e.pdf417PredictionScore,
|
|
6689
|
+
pdf417PredictionThresholdMet = _e.pdf417PredictionThresholdMet,
|
|
6690
|
+
frameWidth = _e.frameWidth,
|
|
6691
|
+
frameHeight = _e.frameHeight;
|
|
6569
6692
|
var frameCapturedAt = new Date();
|
|
6570
6693
|
var frameCaptureRate = 0;
|
|
6571
6694
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -6645,6 +6768,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6645
6768
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
6646
6769
|
focusScore: focusScore,
|
|
6647
6770
|
focusThresholdMet: focusThresholdMet,
|
|
6771
|
+
pdf417PredictionScore: pdf417PredictionScore,
|
|
6772
|
+
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
6648
6773
|
isGoodFrame: isGoodFrame,
|
|
6649
6774
|
goodFramesCount: goodFramesCount,
|
|
6650
6775
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -6698,7 +6823,18 @@ var _reducer = function reducer(state, action) {
|
|
|
6698
6823
|
});
|
|
6699
6824
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
6700
6825
|
if (remainingRequirements.length === 0) {
|
|
6701
|
-
|
|
6826
|
+
// Check if we just captured ID back and need barcode recapture
|
|
6827
|
+
var justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
6828
|
+
var barcodeScore = (_c = (_b = state.capturedDocuments.idBarcodeImage) === null || _b === void 0 ? void 0 : _b.barcodeReadabilityScore) !== null && _c !== void 0 ? _c : 0;
|
|
6829
|
+
var needsBarcodeRecapture = justCapturedIdBack && state.barcodeRecaptureThreshold > 0 && barcodeScore < state.barcodeRecaptureThreshold;
|
|
6830
|
+
if (needsBarcodeRecapture) {
|
|
6831
|
+
// Skip 'complete' and go directly to barcode recapture
|
|
6832
|
+
newState.captureState = 'requestingBetterBarcode';
|
|
6833
|
+
newState.barcodeRecaptureStartedAt = new Date();
|
|
6834
|
+
newState.initialBarcodeScore = barcodeScore;
|
|
6835
|
+
} else {
|
|
6836
|
+
newState.captureState = 'complete';
|
|
6837
|
+
}
|
|
6702
6838
|
} else {
|
|
6703
6839
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
6704
6840
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -6725,8 +6861,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6725
6861
|
case 'documentsCaptured':
|
|
6726
6862
|
{
|
|
6727
6863
|
var newState = _assign({}, state);
|
|
6728
|
-
for (var
|
|
6729
|
-
var doc =
|
|
6864
|
+
for (var _f = 0, _g = action.payload; _f < _g.length; _f++) {
|
|
6865
|
+
var doc = _g[_f];
|
|
6730
6866
|
newState = _reducer(newState, {
|
|
6731
6867
|
type: 'documentCaptured',
|
|
6732
6868
|
payload: doc
|
|
@@ -6776,13 +6912,49 @@ var _reducer = function reducer(state, action) {
|
|
|
6776
6912
|
requestedDocumentType: requestedDocumentType
|
|
6777
6913
|
});
|
|
6778
6914
|
}
|
|
6915
|
+
case 'barcodeRecaptureStarted':
|
|
6916
|
+
return _assign(_assign({}, state), {
|
|
6917
|
+
captureState: 'requestingBetterBarcode',
|
|
6918
|
+
barcodeRecaptureStartedAt: new Date(),
|
|
6919
|
+
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
6920
|
+
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
6921
|
+
recaptureBarcodeScore: null,
|
|
6922
|
+
recaptureBarcodeImage: null,
|
|
6923
|
+
goodFramesCount: 0,
|
|
6924
|
+
capturing: false
|
|
6925
|
+
});
|
|
6926
|
+
case 'barcodeRecaptureScoreUpdated':
|
|
6927
|
+
return _assign(_assign({}, state), {
|
|
6928
|
+
recaptureBarcodeScore: action.payload.recaptureBarcodeScore
|
|
6929
|
+
});
|
|
6930
|
+
case 'recaptureBarcodeImageCaptured':
|
|
6931
|
+
return _assign(_assign({}, state), {
|
|
6932
|
+
recaptureBarcodeImage: action.payload.recaptureBarcodeImage
|
|
6933
|
+
});
|
|
6934
|
+
case 'barcodeRecaptureCompleted':
|
|
6935
|
+
return _assign(_assign({}, state), {
|
|
6936
|
+
captureState: 'complete',
|
|
6937
|
+
barcodeRecaptureStartedAt: null
|
|
6938
|
+
});
|
|
6779
6939
|
case 'resetWizard':
|
|
6780
6940
|
return _assign(_assign({}, initialState$5), {
|
|
6781
6941
|
dispatch: state.dispatch,
|
|
6942
|
+
// Preserve all configuration values
|
|
6943
|
+
captureRequirement: state.captureRequirement,
|
|
6944
|
+
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
6945
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
6946
|
+
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
6947
|
+
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
6782
6948
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6949
|
+
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
6950
|
+
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
6951
|
+
// Reset capture-specific state
|
|
6783
6952
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
6784
|
-
|
|
6785
|
-
|
|
6953
|
+
barcodeRecaptureStartedAt: null,
|
|
6954
|
+
initialBarcodeScore: 0,
|
|
6955
|
+
recaptureBarcodeScore: null,
|
|
6956
|
+
initialCaptureBarcodeImage: null,
|
|
6957
|
+
recaptureBarcodeImage: null
|
|
6786
6958
|
});
|
|
6787
6959
|
default:
|
|
6788
6960
|
return state;
|
|
@@ -7214,36 +7386,36 @@ function extractSize(entry, sizeType) {
|
|
|
7214
7386
|
}
|
|
7215
7387
|
|
|
7216
7388
|
var IdCapture = function IdCapture(_a) {
|
|
7217
|
-
var _b, _c, _d, _e, _f, _g;
|
|
7389
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
7218
7390
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
7219
|
-
|
|
7220
|
-
thresholds =
|
|
7391
|
+
_k = _a.thresholds,
|
|
7392
|
+
thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
|
|
7221
7393
|
guidanceMessage = _a.guidanceMessage,
|
|
7222
7394
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
7223
7395
|
onCapture = _a.onCapture,
|
|
7224
|
-
|
|
7225
|
-
classNames =
|
|
7226
|
-
|
|
7227
|
-
colors =
|
|
7228
|
-
|
|
7229
|
-
rawVerbiage =
|
|
7230
|
-
|
|
7231
|
-
debugMode =
|
|
7232
|
-
var
|
|
7233
|
-
ref =
|
|
7234
|
-
|
|
7235
|
-
width =
|
|
7236
|
-
|
|
7237
|
-
height =
|
|
7396
|
+
_l = _a.classNames,
|
|
7397
|
+
classNames = _l === void 0 ? {} : _l,
|
|
7398
|
+
_m = _a.colors,
|
|
7399
|
+
colors = _m === void 0 ? {} : _m,
|
|
7400
|
+
_o = _a.verbiage,
|
|
7401
|
+
rawVerbiage = _o === void 0 ? {} : _o,
|
|
7402
|
+
_p = _a.debugMode,
|
|
7403
|
+
debugMode = _p === void 0 ? false : _p;
|
|
7404
|
+
var _q = useResizeObserver(),
|
|
7405
|
+
ref = _q.ref,
|
|
7406
|
+
_r = _q.width,
|
|
7407
|
+
width = _r === void 0 ? 1 : _r,
|
|
7408
|
+
_s = _q.height,
|
|
7409
|
+
height = _s === void 0 ? 1 : _s;
|
|
7238
7410
|
var state = useIdCaptureStore();
|
|
7239
7411
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
7240
|
-
var
|
|
7241
|
-
modelsReady =
|
|
7242
|
-
setThresholds =
|
|
7243
|
-
detectionTime =
|
|
7244
|
-
focusPredictionTime =
|
|
7245
|
-
getBestFrame =
|
|
7246
|
-
getBestBarcode =
|
|
7412
|
+
var _t = useIdCaptureModelsContext(),
|
|
7413
|
+
modelsReady = _t.ready,
|
|
7414
|
+
setThresholds = _t.setThresholds,
|
|
7415
|
+
detectionTime = _t.detectionTime,
|
|
7416
|
+
focusPredictionTime = _t.focusPredictionTime,
|
|
7417
|
+
getBestFrame = _t.getBestFrame,
|
|
7418
|
+
getBestBarcode = _t.getBestBarcode;
|
|
7247
7419
|
useEffect(function () {
|
|
7248
7420
|
return dispatchIdCaptureAction({
|
|
7249
7421
|
type: 'captureInitialized'
|
|
@@ -7268,7 +7440,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7268
7440
|
}
|
|
7269
7441
|
});
|
|
7270
7442
|
}, [height, width]);
|
|
7271
|
-
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7443
|
+
var shouldCapture = state.captureState === 'capturing' && state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7272
7444
|
useEffect(function () {
|
|
7273
7445
|
if (!shouldCapture) return;
|
|
7274
7446
|
dispatchIdCaptureAction({
|
|
@@ -7368,13 +7540,18 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7368
7540
|
"$flipX": !isRearFacing,
|
|
7369
7541
|
scaling: debugScalingDetails
|
|
7370
7542
|
}, state.detectedObjects.map(function (obj, i) {
|
|
7543
|
+
// During barcode recapture, render PDF417 barcodes with green color
|
|
7544
|
+
var isBarcodeRecapture = state.captureState === 'requestingBetterBarcode';
|
|
7545
|
+
var isBarcode = obj.label === 'PDF417';
|
|
7546
|
+
var color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
7371
7547
|
return /*#__PURE__*/React__default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
7372
7548
|
key: i,
|
|
7373
7549
|
obj: obj,
|
|
7374
7550
|
scaling: debugScalingDetails,
|
|
7375
|
-
flipX: !isRearFacing
|
|
7551
|
+
flipX: !isRearFacing,
|
|
7552
|
+
color: color
|
|
7376
7553
|
});
|
|
7377
|
-
}))), 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")))));
|
|
7554
|
+
}))), 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")))));
|
|
7378
7555
|
};
|
|
7379
7556
|
var timeSince = function timeSince(t) {
|
|
7380
7557
|
if (!t) return 0;
|
|
@@ -8254,11 +8431,11 @@ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templa
|
|
|
8254
8431
|
var _a, _b, _c, _d;
|
|
8255
8432
|
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;
|
|
8256
8433
|
});
|
|
8257
|
-
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
8434
|
+
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
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.progressBarIndicatorColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-primary-500)';
|
|
8260
8437
|
});
|
|
8261
|
-
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$
|
|
8438
|
+
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) {
|
|
8262
8439
|
var _a, _b, _c, _d, _e, _f;
|
|
8263
8440
|
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, ";") : '';
|
|
8264
8441
|
}, function (props) {
|
|
@@ -8277,7 +8454,7 @@ var ContinueButton$1 = styled(LoaderButton)(templateObject_8$4 || (templateObjec
|
|
|
8277
8454
|
var _a, _b, _c, _d;
|
|
8278
8455
|
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';
|
|
8279
8456
|
});
|
|
8280
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
8457
|
+
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;
|
|
8281
8458
|
|
|
8282
8459
|
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"])));
|
|
8283
8460
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -8464,6 +8641,14 @@ var FlexCard = styled(Card)(templateObject_2$z || (templateObject_2$z = __makeTe
|
|
|
8464
8641
|
var templateObject_1$D, templateObject_2$z;
|
|
8465
8642
|
|
|
8466
8643
|
var imageDisplayOrder = ['idCardFront', 'idCardBack', 'idBarcodeImage', 'passport', 'singlePage', 'idFrontIrImage', 'idBackIrImage', 'idFrontUvImage', 'idBackUvImage'];
|
|
8644
|
+
var downloadImage = function downloadImage(dataUrl, filename) {
|
|
8645
|
+
var link = document.createElement('a');
|
|
8646
|
+
link.href = dataUrl;
|
|
8647
|
+
link.download = filename;
|
|
8648
|
+
document.body.appendChild(link);
|
|
8649
|
+
link.click();
|
|
8650
|
+
document.body.removeChild(link);
|
|
8651
|
+
};
|
|
8467
8652
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
8468
8653
|
var capturedDocuments = _a.capturedDocuments,
|
|
8469
8654
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -8475,8 +8660,22 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8475
8660
|
_d = _a.verbiage,
|
|
8476
8661
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
8477
8662
|
_e = _a.debugMode,
|
|
8478
|
-
debugMode = _e === void 0 ? false : _e
|
|
8663
|
+
debugMode = _e === void 0 ? false : _e,
|
|
8664
|
+
initialBarcodeScore = _a.initialBarcodeScore,
|
|
8665
|
+
recaptureBarcodeScore = _a.recaptureBarcodeScore,
|
|
8666
|
+
initialCaptureBarcodeImage = _a.initialCaptureBarcodeImage,
|
|
8667
|
+
recaptureBarcodeImage = _a.recaptureBarcodeImage;
|
|
8479
8668
|
var submissionStatus = useContext(SubmissionContext).submissionStatus;
|
|
8669
|
+
if (debugMode) {
|
|
8670
|
+
log('[IdCaptureSuccess] Debug info:', {
|
|
8671
|
+
debugMode: debugMode,
|
|
8672
|
+
initialBarcodeScore: initialBarcodeScore,
|
|
8673
|
+
recaptureBarcodeScore: recaptureBarcodeScore,
|
|
8674
|
+
shouldShow: debugMode && initialBarcodeScore !== undefined,
|
|
8675
|
+
condition1: debugMode,
|
|
8676
|
+
condition2: initialBarcodeScore !== undefined
|
|
8677
|
+
});
|
|
8678
|
+
}
|
|
8480
8679
|
var verbiage = useTranslations(rawVerbiage, {
|
|
8481
8680
|
headingText: 'ID Capture Successful',
|
|
8482
8681
|
retryText: 'Retry',
|
|
@@ -8496,6 +8695,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8496
8695
|
}, /*#__PURE__*/React__default.createElement(ImageRow, {
|
|
8497
8696
|
className: classNames.imageRow
|
|
8498
8697
|
}, imageDisplayOrder.map(function (name) {
|
|
8698
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8499
8699
|
var doc = capturedDocuments[name];
|
|
8500
8700
|
if (!doc) return null;
|
|
8501
8701
|
return /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
@@ -8505,7 +8705,57 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8505
8705
|
image: doc,
|
|
8506
8706
|
className: classNames.image,
|
|
8507
8707
|
alt: doc.documentType
|
|
8508
|
-
}), debugMode && (/*#__PURE__*/React__default.createElement(
|
|
8708
|
+
}), 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, {
|
|
8709
|
+
"$score": (_a = doc.barcodeReadabilityScore) !== null && _a !== void 0 ? _a : 0,
|
|
8710
|
+
"$type": "readability"
|
|
8711
|
+
}, ((_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, {
|
|
8712
|
+
"$improved": recaptureBarcodeScore > initialBarcodeScore
|
|
8713
|
+
}, 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, {
|
|
8714
|
+
style: {
|
|
8715
|
+
marginTop: '0.25rem'
|
|
8716
|
+
}
|
|
8717
|
+
}, "\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, {
|
|
8718
|
+
src: initialCaptureBarcodeImage,
|
|
8719
|
+
alt: "Initial capture barcode",
|
|
8720
|
+
onDoubleClick: function onDoubleClick() {
|
|
8721
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8722
|
+
},
|
|
8723
|
+
title: "Double-click to download"
|
|
8724
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8725
|
+
"$isHigher": initialBarcodeScore >= recaptureBarcodeScore
|
|
8726
|
+
}, initialBarcodeScore.toFixed(3)))), recaptureBarcodeImage && (/*#__PURE__*/React__default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageLabel, null, "Recapture"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImage, {
|
|
8727
|
+
src: recaptureBarcodeImage,
|
|
8728
|
+
alt: "Recapture barcode",
|
|
8729
|
+
onDoubleClick: function onDoubleClick() {
|
|
8730
|
+
return downloadImage(recaptureBarcodeImage, "barcode-recapture-".concat(recaptureBarcodeScore.toFixed(3), ".jpg"));
|
|
8731
|
+
},
|
|
8732
|
+
title: "Double-click to download"
|
|
8733
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8734
|
+
"$isHigher": recaptureBarcodeScore > initialBarcodeScore
|
|
8735
|
+
}, 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, {
|
|
8736
|
+
style: {
|
|
8737
|
+
marginTop: '0.25rem'
|
|
8738
|
+
}
|
|
8739
|
+
}, "\uD83D\uDD0D Barcode Image (kept)"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImagesContainer, {
|
|
8740
|
+
style: {
|
|
8741
|
+
gridTemplateColumns: '1fr'
|
|
8742
|
+
}
|
|
8743
|
+
}, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__default.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React__default.createElement(BarcodeComparisonImage, {
|
|
8744
|
+
src: initialCaptureBarcodeImage,
|
|
8745
|
+
alt: "Initial capture barcode",
|
|
8746
|
+
onDoubleClick: function onDoubleClick() {
|
|
8747
|
+
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8748
|
+
},
|
|
8749
|
+
title: "Double-click to download"
|
|
8750
|
+
}), /*#__PURE__*/React__default.createElement(BarcodeComparisonScoreLabel, {
|
|
8751
|
+
"$isHigher": true
|
|
8752
|
+
}, 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, {
|
|
8753
|
+
"$score": (_c = doc.detectionScore) !== null && _c !== void 0 ? _c : 0,
|
|
8754
|
+
"$type": "detection"
|
|
8755
|
+
}, ((_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, {
|
|
8756
|
+
"$score": (_e = doc.focusScore) !== null && _e !== void 0 ? _e : 0,
|
|
8757
|
+
"$type": "focus"
|
|
8758
|
+
}, ((_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))))))));
|
|
8509
8759
|
}))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
|
|
8510
8760
|
className: classNames.buttonsRow
|
|
8511
8761
|
}, /*#__PURE__*/React__default.createElement(WideButton, {
|
|
@@ -8528,8 +8778,91 @@ var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$y || (templ
|
|
|
8528
8778
|
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"])));
|
|
8529
8779
|
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"])));
|
|
8530
8780
|
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"])));
|
|
8531
|
-
var
|
|
8532
|
-
var
|
|
8781
|
+
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"])));
|
|
8782
|
+
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"])));
|
|
8783
|
+
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"])));
|
|
8784
|
+
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"])));
|
|
8785
|
+
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) {
|
|
8786
|
+
var $score = _a.$score,
|
|
8787
|
+
$type = _a.$type;
|
|
8788
|
+
var thresholds = $type === 'readability' ? {
|
|
8789
|
+
good: 0.5,
|
|
8790
|
+
medium: 0.2
|
|
8791
|
+
} : $type === 'detection' ? {
|
|
8792
|
+
good: 0.7,
|
|
8793
|
+
medium: 0.4
|
|
8794
|
+
} : {
|
|
8795
|
+
good: 0.7,
|
|
8796
|
+
medium: 0.4
|
|
8797
|
+
};
|
|
8798
|
+
if ($score >= thresholds.good) return '#d4edda';
|
|
8799
|
+
if ($score >= thresholds.medium) return '#fff3cd';
|
|
8800
|
+
return '#f8d7da';
|
|
8801
|
+
}, function (_a) {
|
|
8802
|
+
var $score = _a.$score,
|
|
8803
|
+
$type = _a.$type;
|
|
8804
|
+
var thresholds = $type === 'readability' ? {
|
|
8805
|
+
good: 0.5,
|
|
8806
|
+
medium: 0.2
|
|
8807
|
+
} : $type === 'detection' ? {
|
|
8808
|
+
good: 0.7,
|
|
8809
|
+
medium: 0.4
|
|
8810
|
+
} : {
|
|
8811
|
+
good: 0.7,
|
|
8812
|
+
medium: 0.4
|
|
8813
|
+
};
|
|
8814
|
+
if ($score >= thresholds.good) return '#155724';
|
|
8815
|
+
if ($score >= thresholds.medium) return '#856404';
|
|
8816
|
+
return '#721c24';
|
|
8817
|
+
}, function (_a) {
|
|
8818
|
+
var $score = _a.$score,
|
|
8819
|
+
$type = _a.$type;
|
|
8820
|
+
var thresholds = $type === 'readability' ? {
|
|
8821
|
+
good: 0.5,
|
|
8822
|
+
medium: 0.2
|
|
8823
|
+
} : $type === 'detection' ? {
|
|
8824
|
+
good: 0.7,
|
|
8825
|
+
medium: 0.4
|
|
8826
|
+
} : {
|
|
8827
|
+
good: 0.7,
|
|
8828
|
+
medium: 0.4
|
|
8829
|
+
};
|
|
8830
|
+
if ($score >= thresholds.good) return '#c3e6cb';
|
|
8831
|
+
if ($score >= thresholds.medium) return '#ffeaa7';
|
|
8832
|
+
return '#f5c6cb';
|
|
8833
|
+
});
|
|
8834
|
+
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"])));
|
|
8835
|
+
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"])));
|
|
8836
|
+
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"])));
|
|
8837
|
+
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"])));
|
|
8838
|
+
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"])));
|
|
8839
|
+
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"])));
|
|
8840
|
+
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"])));
|
|
8841
|
+
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) {
|
|
8842
|
+
var $improved = _a.$improved;
|
|
8843
|
+
return $improved ? '#d4edda' : '#e2e3e5';
|
|
8844
|
+
}, function (_a) {
|
|
8845
|
+
var $improved = _a.$improved;
|
|
8846
|
+
return $improved ? '#155724' : '#383d41';
|
|
8847
|
+
}, function (_a) {
|
|
8848
|
+
var $improved = _a.$improved;
|
|
8849
|
+
return $improved ? '#c3e6cb' : '#d6d8db';
|
|
8850
|
+
});
|
|
8851
|
+
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"])));
|
|
8852
|
+
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"])));
|
|
8853
|
+
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"])));
|
|
8854
|
+
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"])));
|
|
8855
|
+
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) {
|
|
8856
|
+
var $isHigher = _a.$isHigher;
|
|
8857
|
+
return $isHigher ? '#155724' : '#495057';
|
|
8858
|
+
}, function (_a) {
|
|
8859
|
+
var $isHigher = _a.$isHigher;
|
|
8860
|
+
return $isHigher ? '#d4edda' : 'white';
|
|
8861
|
+
}, function (_a) {
|
|
8862
|
+
var $isHigher = _a.$isHigher;
|
|
8863
|
+
return $isHigher ? '#c3e6cb' : '#dee2e6';
|
|
8864
|
+
});
|
|
8865
|
+
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;
|
|
8533
8866
|
|
|
8534
8867
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
8535
8868
|
var _this = this;
|
|
@@ -11059,7 +11392,7 @@ var lastDocumentDetectedAtDefaults = {
|
|
|
11059
11392
|
none: null
|
|
11060
11393
|
};
|
|
11061
11394
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
11062
|
-
var _b, _c, _d, _e, _f;
|
|
11395
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11063
11396
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
11064
11397
|
onLoadingProgress = _a.onLoadingProgress,
|
|
11065
11398
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -11070,86 +11403,115 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11070
11403
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
11071
11404
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
11072
11405
|
onDocumentDetected = _a.onDocumentDetected,
|
|
11073
|
-
|
|
11074
|
-
documentDetectionThrottleMs =
|
|
11075
|
-
|
|
11076
|
-
loadingOverlayMode =
|
|
11406
|
+
_m = _a.documentDetectionThrottleMs,
|
|
11407
|
+
documentDetectionThrottleMs = _m === void 0 ? 0 : _m,
|
|
11408
|
+
_o = _a.loadingOverlayMode,
|
|
11409
|
+
loadingOverlayMode = _o === void 0 ? 'default' : _o,
|
|
11077
11410
|
customOverlayContent = _a.customOverlayContent,
|
|
11078
11411
|
precapturedDocuments = _a.precapturedDocuments,
|
|
11079
|
-
|
|
11080
|
-
captureRequirement =
|
|
11081
|
-
|
|
11082
|
-
allowSinglePageIdCapture =
|
|
11083
|
-
|
|
11084
|
-
separateIdCardCaptureSequence =
|
|
11085
|
-
|
|
11086
|
-
thresholds =
|
|
11087
|
-
|
|
11088
|
-
skipSuccessScreen =
|
|
11412
|
+
_p = _a.captureRequirement,
|
|
11413
|
+
captureRequirement = _p === void 0 ? 'idCardOrPassport' : _p,
|
|
11414
|
+
_q = _a.allowSinglePageIdCapture,
|
|
11415
|
+
allowSinglePageIdCapture = _q === void 0 ? false : _q,
|
|
11416
|
+
_r = _a.separateIdCardCaptureSequence,
|
|
11417
|
+
separateIdCardCaptureSequence = _r === void 0 ? false : _r,
|
|
11418
|
+
_s = _a.thresholds,
|
|
11419
|
+
thresholds = _s === void 0 ? defaultIdCaptureThresholds : _s,
|
|
11420
|
+
_t = _a.skipSuccessScreen,
|
|
11421
|
+
skipSuccessScreen = _t === void 0 ? false : _t,
|
|
11089
11422
|
instructions = _a.instructions,
|
|
11090
|
-
|
|
11091
|
-
releaseCameraAccessOnExit =
|
|
11092
|
-
|
|
11093
|
-
guideType =
|
|
11094
|
-
|
|
11095
|
-
portraitGuidesOnMobile =
|
|
11096
|
-
|
|
11097
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
11098
|
-
|
|
11099
|
-
silentFallback =
|
|
11100
|
-
|
|
11101
|
-
forceFallbackMode =
|
|
11102
|
-
|
|
11103
|
-
allowIdCardBackToFrontCapture =
|
|
11104
|
-
|
|
11105
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
11106
|
-
|
|
11107
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
11108
|
-
|
|
11109
|
-
allowUploadingDocumentsFromStorage =
|
|
11110
|
-
|
|
11111
|
-
guideImages =
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11423
|
+
_u = _a.releaseCameraAccessOnExit,
|
|
11424
|
+
releaseCameraAccessOnExit = _u === void 0 ? true : _u,
|
|
11425
|
+
_v = _a.guideType,
|
|
11426
|
+
guideType = _v === void 0 ? 'fit' : _v,
|
|
11427
|
+
_w = _a.portraitGuidesOnMobile,
|
|
11428
|
+
portraitGuidesOnMobile = _w === void 0 ? true : _w,
|
|
11429
|
+
_x = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
11430
|
+
rotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
|
|
11431
|
+
_y = _a.silentFallback,
|
|
11432
|
+
silentFallback = _y === void 0 ? false : _y,
|
|
11433
|
+
_z = _a.forceFallbackMode,
|
|
11434
|
+
forceFallbackMode = _z === void 0 ? false : _z,
|
|
11435
|
+
_0 = _a.allowIdCardBackToFrontCapture,
|
|
11436
|
+
allowIdCardBackToFrontCapture = _0 === void 0 ? false : _0,
|
|
11437
|
+
_1 = _a.enableOverrideWrongDocumentTypeDialog,
|
|
11438
|
+
enableOverrideWrongDocumentTypeDialog = _1 === void 0 ? false : _1,
|
|
11439
|
+
_2 = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
11440
|
+
allowOverrideWrongDocumentTypeAfterMs = _2 === void 0 ? 8000 : _2,
|
|
11441
|
+
_3 = _a.allowUploadingDocumentsFromStorage,
|
|
11442
|
+
allowUploadingDocumentsFromStorage = _3 === void 0 ? false : _3,
|
|
11443
|
+
_4 = _a.guideImages,
|
|
11444
|
+
guideImages = _4 === void 0 ? defaultIdCaptureGuideImages : _4,
|
|
11445
|
+
_5 = _a.barcodeRecaptureThreshold,
|
|
11446
|
+
barcodeRecaptureThreshold = _5 === void 0 ? 1 : _5,
|
|
11447
|
+
_6 = _a.barcodeRecaptureTimeoutMs,
|
|
11448
|
+
barcodeRecaptureTimeoutMs = _6 === void 0 ? 5000 : _6,
|
|
11449
|
+
_7 = _a.barcodeRecaptureMoveCloserTimeoutMs,
|
|
11450
|
+
barcodeRecaptureMoveCloserTimeoutMs = _7 === void 0 ? 10000 : _7,
|
|
11451
|
+
_8 = _a.barcodeRecaptureBboxGrowthPct,
|
|
11452
|
+
barcodeRecaptureBboxGrowthPct = _8 === void 0 ? 20 : _8,
|
|
11453
|
+
_9 = _a.documentEdgeDistancePct,
|
|
11454
|
+
documentEdgeDistancePct = _9 === void 0 ? 0 : _9,
|
|
11455
|
+
_10 = _a.assets,
|
|
11456
|
+
assets = _10 === void 0 ? {} : _10,
|
|
11457
|
+
_11 = _a.classNames,
|
|
11458
|
+
classNames = _11 === void 0 ? {} : _11,
|
|
11459
|
+
_12 = _a.colors,
|
|
11460
|
+
colors = _12 === void 0 ? {} : _12,
|
|
11461
|
+
_13 = _a.verbiage,
|
|
11462
|
+
verbiage = _13 === void 0 ? {} : _13,
|
|
11463
|
+
_14 = _a.debugMode,
|
|
11464
|
+
debugMode = _14 === void 0 ? false : _14;
|
|
11124
11465
|
var state = useIdCaptureStore();
|
|
11125
|
-
var
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11466
|
+
var isCapturing = state.captureState === 'capturing' || state.captureState === 'requestingBetterBarcode';
|
|
11467
|
+
var _15 = useCameraStore(),
|
|
11468
|
+
cameraAccessDenied = _15.cameraAccessDenied,
|
|
11469
|
+
requestCameraAccess = _15.requestCameraAccess,
|
|
11470
|
+
releaseCameraAccess = _15.releaseCameraAccess;
|
|
11471
|
+
var _16 = useState(false),
|
|
11472
|
+
overlayDismissed = _16[0],
|
|
11473
|
+
setOverlayDismissed = _16[1];
|
|
11474
|
+
var _17 = useSubmissionContext(),
|
|
11475
|
+
submissionStatus = _17.submissionStatus,
|
|
11476
|
+
setIdFrontImage = _17.setIdFrontImage,
|
|
11477
|
+
setIdBackImage = _17.setIdBackImage,
|
|
11478
|
+
setPassportImage = _17.setPassportImage,
|
|
11479
|
+
setIdFrontIrImage = _17.setIdFrontIrImage,
|
|
11480
|
+
setIdBackIrImage = _17.setIdBackIrImage,
|
|
11481
|
+
setIdFrontUvImage = _17.setIdFrontUvImage,
|
|
11482
|
+
setIdBackUvImage = _17.setIdBackUvImage,
|
|
11483
|
+
setIdBarcodeImage = _17.setIdBarcodeImage,
|
|
11484
|
+
logIdFrontCaptureAttempt = _17.logIdFrontCaptureAttempt,
|
|
11485
|
+
logIdBackCaptureAttempt = _17.logIdBackCaptureAttempt;
|
|
11486
|
+
var _18 = useIdCaptureModelsContext(),
|
|
11487
|
+
start = _18.start,
|
|
11488
|
+
stop = _18.stop,
|
|
11489
|
+
onPredictionMade = _18.onPredictionMade,
|
|
11490
|
+
setRequiredDocumentType = _18.setRequiredDocumentType,
|
|
11491
|
+
modelError = _18.modelError,
|
|
11492
|
+
resetBestFrame = _18.resetBestFrame,
|
|
11493
|
+
documentDetectionBoundaries = _18.documentDetectionBoundaries,
|
|
11494
|
+
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
11495
|
+
getBestBarcode = _18.getBestBarcode,
|
|
11496
|
+
startBarcodeRecapturePhase = _18.startBarcodeRecapturePhase,
|
|
11497
|
+
getRecaptureBestBarcode = _18.getRecaptureBestBarcode;
|
|
11498
|
+
var initialBarcodeBboxRef = useRef(null);
|
|
11499
|
+
var recapturePhaseStartedRef = useRef(false);
|
|
11500
|
+
var _19 = useState(false),
|
|
11501
|
+
barcodeRecaptureGrowthSatisfied = _19[0],
|
|
11502
|
+
setBarcodeRecaptureGrowthSatisfied = _19[1];
|
|
11503
|
+
useEffect(function () {
|
|
11504
|
+
// Reset recapture gating whenever we enter/exit the recapture flow
|
|
11505
|
+
if (state.captureState === 'requestingBetterBarcode') {
|
|
11506
|
+
initialBarcodeBboxRef.current = null;
|
|
11507
|
+
recapturePhaseStartedRef.current = false;
|
|
11508
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11509
|
+
return;
|
|
11510
|
+
}
|
|
11511
|
+
initialBarcodeBboxRef.current = null;
|
|
11512
|
+
recapturePhaseStartedRef.current = false;
|
|
11513
|
+
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11514
|
+
}, [state.captureState]);
|
|
11153
11515
|
useEffect(function () {
|
|
11154
11516
|
dispatchIdCaptureAction({
|
|
11155
11517
|
type: 'configureWizard',
|
|
@@ -11160,10 +11522,12 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11160
11522
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
11161
11523
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
11162
11524
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
11163
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11525
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage,
|
|
11526
|
+
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
11527
|
+
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
11164
11528
|
}
|
|
11165
11529
|
});
|
|
11166
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11530
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, barcodeRecaptureThreshold, barcodeRecaptureTimeoutMs, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11167
11531
|
useEffect(function () {
|
|
11168
11532
|
var _a;
|
|
11169
11533
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -11175,8 +11539,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11175
11539
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
11176
11540
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
11177
11541
|
useEffect(function () {
|
|
11542
|
+
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
11543
|
+
if (state.captureState === 'requestingBetterBarcode') return;
|
|
11178
11544
|
if (documentCount) resetBestFrame();
|
|
11179
|
-
}, [documentCount, resetBestFrame]);
|
|
11545
|
+
}, [documentCount, resetBestFrame, state.captureState]);
|
|
11180
11546
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
11181
11547
|
var lastDocumentDetectedAt = useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
11182
11548
|
var logCaptureMetadata = useCallback(function (metadata) {
|
|
@@ -11195,24 +11561,62 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11195
11561
|
}
|
|
11196
11562
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
11197
11563
|
useEffect(function startModelsWhenCapturing() {
|
|
11198
|
-
if (!overlayDismissed ||
|
|
11564
|
+
if (!overlayDismissed || !isCapturing) return;
|
|
11199
11565
|
dispatchIdCaptureAction({
|
|
11200
11566
|
type: 'captureStarted'
|
|
11201
11567
|
});
|
|
11202
11568
|
start();
|
|
11203
|
-
}, [overlayDismissed, start
|
|
11569
|
+
}, [isCapturing, overlayDismissed, start]);
|
|
11204
11570
|
useEffect(function () {
|
|
11205
11571
|
onPredictionMade(function (prediction) {
|
|
11206
|
-
var _a;
|
|
11207
|
-
var
|
|
11208
|
-
captureState =
|
|
11209
|
-
requestedDocumentType =
|
|
11572
|
+
var _a, _b, _c, _d;
|
|
11573
|
+
var _e = useIdCaptureStore.getState(),
|
|
11574
|
+
captureState = _e.captureState,
|
|
11575
|
+
requestedDocumentType = _e.requestedDocumentType;
|
|
11210
11576
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
11211
11577
|
var thresholdMet = prediction[k];
|
|
11212
|
-
if (captureState === 'capturing') {
|
|
11578
|
+
if (captureState === 'capturing' || captureState === 'requestingBetterBarcode') {
|
|
11579
|
+
// During barcode recapture, wait until the barcode bbox grows by a configurable %
|
|
11580
|
+
// (to confirm the user moved the camera closer) before we start recapture processing.
|
|
11581
|
+
if (captureState === 'requestingBetterBarcode') {
|
|
11582
|
+
var growthPct = Math.max(0, Math.min(barcodeRecaptureBboxGrowthPct, 200));
|
|
11583
|
+
var requiredMultiplier = 1 + growthPct / 100;
|
|
11584
|
+
if (!recapturePhaseStartedRef.current) {
|
|
11585
|
+
// If growth requirement is disabled, begin recapture immediately.
|
|
11586
|
+
if (requiredMultiplier === 1) {
|
|
11587
|
+
recapturePhaseStartedRef.current = true;
|
|
11588
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11589
|
+
startBarcodeRecapturePhase();
|
|
11590
|
+
} else {
|
|
11591
|
+
var pdf417Box = (_a = prediction.bestPDF417) === null || _a === void 0 ? void 0 : _a.box;
|
|
11592
|
+
var frameWidth = (_b = prediction.frameWidth) !== null && _b !== void 0 ? _b : 0;
|
|
11593
|
+
var frameHeight = (_c = prediction.frameHeight) !== null && _c !== void 0 ? _c : 0;
|
|
11594
|
+
if (pdf417Box && frameWidth > 0 && frameHeight > 0) {
|
|
11595
|
+
var widthRatio = pdf417Box.width / frameWidth;
|
|
11596
|
+
var heightRatio = pdf417Box.height / frameHeight;
|
|
11597
|
+
if (!initialBarcodeBboxRef.current) {
|
|
11598
|
+
// First observed bbox when we enter recapture.
|
|
11599
|
+
initialBarcodeBboxRef.current = {
|
|
11600
|
+
widthRatio: widthRatio,
|
|
11601
|
+
heightRatio: heightRatio
|
|
11602
|
+
};
|
|
11603
|
+
} else {
|
|
11604
|
+
var baseline = initialBarcodeBboxRef.current;
|
|
11605
|
+
var widthSatisfied = widthRatio >= baseline.widthRatio * requiredMultiplier;
|
|
11606
|
+
var heightSatisfied = heightRatio >= baseline.heightRatio * requiredMultiplier;
|
|
11607
|
+
if (widthSatisfied && heightSatisfied) {
|
|
11608
|
+
recapturePhaseStartedRef.current = true;
|
|
11609
|
+
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11610
|
+
startBarcodeRecapturePhase();
|
|
11611
|
+
}
|
|
11612
|
+
}
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
}
|
|
11616
|
+
}
|
|
11213
11617
|
if (prediction.detectedDocumentType !== 'none') {
|
|
11214
11618
|
var now = Date.now();
|
|
11215
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
11619
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_d = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _d !== void 0 ? _d : 0) > documentDetectionThrottleMs) {
|
|
11216
11620
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
11217
11621
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
11218
11622
|
}
|
|
@@ -11230,7 +11634,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11230
11634
|
});
|
|
11231
11635
|
}
|
|
11232
11636
|
});
|
|
11233
|
-
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
11637
|
+
}, [barcodeRecaptureBboxGrowthPct, documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame, startBarcodeRecapturePhase]);
|
|
11234
11638
|
useEffect(function () {
|
|
11235
11639
|
if (state.captureState === 'complete') stop();
|
|
11236
11640
|
}, [state.captureState, stop]);
|
|
@@ -11285,9 +11689,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11285
11689
|
type: 'resetWizard'
|
|
11286
11690
|
});
|
|
11287
11691
|
}, []);
|
|
11288
|
-
var
|
|
11289
|
-
attempt =
|
|
11290
|
-
setAttempt =
|
|
11692
|
+
var _20 = useState(0),
|
|
11693
|
+
attempt = _20[0],
|
|
11694
|
+
setAttempt = _20[1];
|
|
11291
11695
|
var onExit = useCallback(function () {
|
|
11292
11696
|
releaseCameraAccess();
|
|
11293
11697
|
setOverlayDismissed(false);
|
|
@@ -11313,20 +11717,25 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11313
11717
|
});
|
|
11314
11718
|
}
|
|
11315
11719
|
}, [cameraAccessDenied]);
|
|
11720
|
+
var guidanceBarcodeRecaptureText = (_b = verbiage.guidanceBarcodeRecaptureText) !== null && _b !== void 0 ? _b : 'Please move the barcode closer to the camera';
|
|
11721
|
+
var guidanceBarcodeRecaptureInProgressText = (_c = verbiage.guidanceBarcodeRecaptureInProgressText) !== null && _c !== void 0 ? _c : 'Barcode capture in progress, please hold still';
|
|
11722
|
+
var barcodeRecaptureGuidanceMessage = barcodeRecaptureGrowthSatisfied ? guidanceBarcodeRecaptureInProgressText : guidanceBarcodeRecaptureText;
|
|
11316
11723
|
var idCaptureVerbiages = {
|
|
11317
11724
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
11318
11725
|
instructionText: 'Scan the front of ID',
|
|
11319
11726
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
11320
11727
|
}),
|
|
11321
11728
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
11322
|
-
instructionText: 'Scan the back of ID'
|
|
11729
|
+
instructionText: state.captureState === 'requestingBetterBarcode' ? barcodeRecaptureGuidanceMessage : 'Scan the back of ID'
|
|
11323
11730
|
}),
|
|
11324
11731
|
passport: useTranslations(verbiage.passport, {
|
|
11325
11732
|
instructionText: 'Scan the ID page of passport'
|
|
11326
11733
|
})
|
|
11327
11734
|
};
|
|
11328
11735
|
var theme = useTheme();
|
|
11329
|
-
|
|
11736
|
+
// During barcode recapture, use idCardBack verbiage to show barcode recapture message
|
|
11737
|
+
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
11738
|
+
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
11330
11739
|
useEffect(function () {
|
|
11331
11740
|
if (separateIdCardCaptureSequence) return;
|
|
11332
11741
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -11340,6 +11749,130 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11340
11749
|
clearTimeout(t);
|
|
11341
11750
|
};
|
|
11342
11751
|
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
11752
|
+
// Handle barcode recapture start - snapshot initial barcode and initialize recapture state
|
|
11753
|
+
useEffect(function () {
|
|
11754
|
+
var _a, _b;
|
|
11755
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11756
|
+
if (state.initialCaptureBarcodeImage !== null) return; // Already initialized
|
|
11757
|
+
// Get the initial barcode image from capturedDocuments (since resetBestFrame clears the canvas)
|
|
11758
|
+
var initialBarcodeImage = (_b = (_a = state.capturedDocuments.idBarcodeImage) === null || _a === void 0 ? void 0 : _a.imageData) !== null && _b !== void 0 ? _b : null;
|
|
11759
|
+
dispatchIdCaptureAction({
|
|
11760
|
+
type: 'barcodeRecaptureStarted',
|
|
11761
|
+
payload: {
|
|
11762
|
+
initialBarcodeScore: state.initialBarcodeScore,
|
|
11763
|
+
initialCaptureBarcodeImage: initialBarcodeImage
|
|
11764
|
+
}
|
|
11765
|
+
});
|
|
11766
|
+
}, [state.captureState, (_d = state.capturedDocuments.idBarcodeImage) === null || _d === void 0 ? void 0 : _d.imageData, state.initialBarcodeScore, state.initialCaptureBarcodeImage]);
|
|
11767
|
+
// Handle barcode recapture timeout
|
|
11768
|
+
useEffect(function () {
|
|
11769
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11770
|
+
// Continue detection to try to get a better barcode
|
|
11771
|
+
setTimeout(start, 100);
|
|
11772
|
+
var t = setTimeout(function () {
|
|
11773
|
+
// Move-closer window expired before recapture began
|
|
11774
|
+
if (recapturePhaseStartedRef.current) return;
|
|
11775
|
+
var bestBarcode = getBestBarcode();
|
|
11776
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11777
|
+
if (improved) {
|
|
11778
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. Found better barcode anyway: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11779
|
+
// Persist the "after" image for debug visual comparison, even if the
|
|
11780
|
+
// model-provider recapture tracker was never started.
|
|
11781
|
+
dispatchIdCaptureAction({
|
|
11782
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11783
|
+
payload: {
|
|
11784
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11785
|
+
}
|
|
11786
|
+
});
|
|
11787
|
+
dispatchIdCaptureAction({
|
|
11788
|
+
type: 'barcodeCaptured',
|
|
11789
|
+
payload: {
|
|
11790
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11791
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
11792
|
+
}
|
|
11793
|
+
});
|
|
11794
|
+
} else {
|
|
11795
|
+
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. No better barcode found. Initial score: ".concat(state.initialBarcodeScore.toFixed(3)));
|
|
11796
|
+
}
|
|
11797
|
+
// Record that recapture was attempted (for diagnostics)
|
|
11798
|
+
dispatchIdCaptureAction({
|
|
11799
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
11800
|
+
payload: {
|
|
11801
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : state.initialBarcodeScore
|
|
11802
|
+
}
|
|
11803
|
+
});
|
|
11804
|
+
dispatchIdCaptureAction({
|
|
11805
|
+
type: 'barcodeRecaptureCompleted'
|
|
11806
|
+
});
|
|
11807
|
+
}, barcodeRecaptureMoveCloserTimeoutMs);
|
|
11808
|
+
return function () {
|
|
11809
|
+
return clearTimeout(t);
|
|
11810
|
+
};
|
|
11811
|
+
}, [barcodeRecaptureMoveCloserTimeoutMs, getBestBarcode, start, state.captureState, state.initialBarcodeScore]);
|
|
11812
|
+
useEffect(function () {
|
|
11813
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11814
|
+
if (!barcodeRecaptureGrowthSatisfied) return;
|
|
11815
|
+
var t = setTimeout(function () {
|
|
11816
|
+
var _a, _b;
|
|
11817
|
+
// Capture window expired - complete with whatever barcode we have
|
|
11818
|
+
var recaptureBarcode = getRecaptureBestBarcode();
|
|
11819
|
+
var bestBarcode = getBestBarcode();
|
|
11820
|
+
var recaptureScore = (_a = recaptureBarcode === null || recaptureBarcode === void 0 ? void 0 : recaptureBarcode.score) !== null && _a !== void 0 ? _a : null;
|
|
11821
|
+
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11822
|
+
// Store the recapture score for diagnostic purposes
|
|
11823
|
+
dispatchIdCaptureAction({
|
|
11824
|
+
type: 'barcodeRecaptureScoreUpdated',
|
|
11825
|
+
payload: {
|
|
11826
|
+
recaptureBarcodeScore: improved ? bestBarcode.score : recaptureScore !== null && recaptureScore !== void 0 ? recaptureScore : state.initialBarcodeScore
|
|
11827
|
+
}
|
|
11828
|
+
});
|
|
11829
|
+
// Store the recapture barcode image if we found one
|
|
11830
|
+
if (recaptureBarcode) {
|
|
11831
|
+
dispatchIdCaptureAction({
|
|
11832
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11833
|
+
payload: {
|
|
11834
|
+
recaptureBarcodeImage: recaptureBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11835
|
+
}
|
|
11836
|
+
});
|
|
11837
|
+
} else if (improved) {
|
|
11838
|
+
// If we improved but don't have a recapture-specific best tracked,
|
|
11839
|
+
// still persist the "after" image so debug visual comparison works.
|
|
11840
|
+
dispatchIdCaptureAction({
|
|
11841
|
+
type: 'recaptureBarcodeImageCaptured',
|
|
11842
|
+
payload: {
|
|
11843
|
+
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11844
|
+
}
|
|
11845
|
+
});
|
|
11846
|
+
}
|
|
11847
|
+
if (improved) {
|
|
11848
|
+
log("[IdCaptureWizard] Barcode recapture completed. Found better barcode: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11849
|
+
dispatchIdCaptureAction({
|
|
11850
|
+
type: 'barcodeCaptured',
|
|
11851
|
+
payload: {
|
|
11852
|
+
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11853
|
+
barcodeReadabilityScore: bestBarcode.score
|
|
11854
|
+
}
|
|
11855
|
+
});
|
|
11856
|
+
} else {
|
|
11857
|
+
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)));
|
|
11858
|
+
}
|
|
11859
|
+
dispatchIdCaptureAction({
|
|
11860
|
+
type: 'barcodeRecaptureCompleted'
|
|
11861
|
+
});
|
|
11862
|
+
}, barcodeRecaptureTimeoutMs);
|
|
11863
|
+
return function () {
|
|
11864
|
+
return clearTimeout(t);
|
|
11865
|
+
};
|
|
11866
|
+
}, [barcodeRecaptureGrowthSatisfied, barcodeRecaptureTimeoutMs, getBestBarcode, getRecaptureBestBarcode, state.captureState, state.initialBarcodeScore]);
|
|
11867
|
+
// Continue detection during barcode recapture and update barcode if better one found
|
|
11868
|
+
useEffect(function () {
|
|
11869
|
+
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11870
|
+
// Set required document type to idCardBack for barcode detection
|
|
11871
|
+
setRequiredDocumentType('idCardBack');
|
|
11872
|
+
return function () {
|
|
11873
|
+
setRequiredDocumentType('none');
|
|
11874
|
+
};
|
|
11875
|
+
}, [setRequiredDocumentType, state.captureState]);
|
|
11343
11876
|
useEffect(function () {
|
|
11344
11877
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
11345
11878
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -11378,9 +11911,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11378
11911
|
});
|
|
11379
11912
|
});
|
|
11380
11913
|
}, []);
|
|
11381
|
-
var
|
|
11382
|
-
progressStarted =
|
|
11383
|
-
setProgressStarted =
|
|
11914
|
+
var _21 = useState(false),
|
|
11915
|
+
progressStarted = _21[0],
|
|
11916
|
+
setProgressStarted = _21[1];
|
|
11384
11917
|
useEffect(function () {
|
|
11385
11918
|
if (state.captureState === 'capturing') {
|
|
11386
11919
|
setProgressStarted(false);
|
|
@@ -11408,9 +11941,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11408
11941
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
11409
11942
|
});
|
|
11410
11943
|
}
|
|
11411
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
11944
|
+
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';
|
|
11412
11945
|
var guidesStatus = !overlayDismissed ? 'disabled' : state.isGoodFrame ? 'capturing' : 'ready';
|
|
11413
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ScalingCameraFeed, null), overlayDismissed && state.captureState === 'capturing' && (/*#__PURE__*/React__default.createElement(IdCapture, {
|
|
11946
|
+
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, {
|
|
11414
11947
|
requiredDocumentType: state.requestedDocumentType,
|
|
11415
11948
|
thresholds: thresholds,
|
|
11416
11949
|
onCapture: onCapture,
|
|
@@ -11418,11 +11951,18 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11418
11951
|
colors: colors,
|
|
11419
11952
|
verbiage: idCaptureVerbiage,
|
|
11420
11953
|
debugMode: debugMode
|
|
11421
|
-
})), /*#__PURE__*/React__default.createElement(
|
|
11954
|
+
})), overlayDismissed && state.captureState === 'requestingBetterBarcode' && (/*#__PURE__*/React__default.createElement(GuidanceMessageContainer, {
|
|
11955
|
+
"$top": "",
|
|
11956
|
+
"$bottom": "12.5%",
|
|
11957
|
+
className: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.guidanceMessageContainer
|
|
11958
|
+
}, /*#__PURE__*/React__default.createElement(GuidanceMessage, {
|
|
11959
|
+
"$variant": "default",
|
|
11960
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.guidanceMessage
|
|
11961
|
+
}, barcodeRecaptureGuidanceMessage))), /*#__PURE__*/React__default.createElement(IdCaptureGuides, {
|
|
11422
11962
|
key: "guides".concat(attempt),
|
|
11423
11963
|
guideType: guideType,
|
|
11424
11964
|
status: guidesStatus,
|
|
11425
|
-
progress: progressStarted &&
|
|
11965
|
+
progress: progressStarted && isCapturing ? 1 : 0,
|
|
11426
11966
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
11427
11967
|
requestedAction: requestedAction,
|
|
11428
11968
|
images: guideImages,
|
|
@@ -11430,15 +11970,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11430
11970
|
colors: colors,
|
|
11431
11971
|
verbiage: idCaptureVerbiage,
|
|
11432
11972
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
11433
|
-
}), debugMode && !((
|
|
11434
|
-
classNames: (
|
|
11435
|
-
text: (
|
|
11973
|
+
}), 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, {
|
|
11974
|
+
classNames: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.imagePreview,
|
|
11975
|
+
text: (_k = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _k === void 0 ? void 0 : _k.processingIdCardText,
|
|
11436
11976
|
imageUrl: state.imageUrl
|
|
11437
11977
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React__default.createElement("div", {
|
|
11438
11978
|
id: "idmission-above-guides-content"
|
|
11439
11979
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
11440
11980
|
onClick: onExit,
|
|
11441
|
-
className: (
|
|
11981
|
+
className: (_l = classNames.capture) === null || _l === void 0 ? void 0 : _l.exitCaptureBtn
|
|
11442
11982
|
})), !overlayDismissed && (/*#__PURE__*/React__default.createElement(IdCaptureLoadingOverlay, {
|
|
11443
11983
|
key: "loading".concat(attempt),
|
|
11444
11984
|
mode: loadingOverlayMode,
|
|
@@ -11476,7 +12016,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11476
12016
|
onRetryClick: onRetryClick,
|
|
11477
12017
|
colors: colors.success,
|
|
11478
12018
|
verbiage: verbiage.success,
|
|
11479
|
-
debugMode: debugMode
|
|
12019
|
+
debugMode: debugMode,
|
|
12020
|
+
initialBarcodeScore:
|
|
12021
|
+
// Show diagnostic info if recapture occurred (indicated by recaptureBarcodeScore being set)
|
|
12022
|
+
// If recapture occurred, initialBarcodeScore was set (even if it's 0, which is valid)
|
|
12023
|
+
state.recaptureBarcodeScore !== null ? state.initialBarcodeScore : undefined,
|
|
12024
|
+
recaptureBarcodeScore: state.recaptureBarcodeScore,
|
|
12025
|
+
initialCaptureBarcodeImage: state.initialCaptureBarcodeImage,
|
|
12026
|
+
recaptureBarcodeImage: state.recaptureBarcodeImage
|
|
11480
12027
|
})));
|
|
11481
12028
|
};
|
|
11482
12029
|
function IdCaptureWizardWithProviders(_a) {
|