idmission-web-sdk 2.3.168-feature-barcode-recapture-99e7dd3 → 2.3.169-add-virginia-instance-to-auth-form-a3e1a79
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 +0 -6
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +1 -32
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +1 -7
- package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -21
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/contexts/AuthStateContext.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +233 -778
- 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 +233 -778
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +233 -778
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -235,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
235
235
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
var webSdkVersion = '2.3.
|
|
238
|
+
var webSdkVersion = '2.3.168';
|
|
239
239
|
|
|
240
240
|
function getPlatform() {
|
|
241
241
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -528,8 +528,8 @@ var OverlayImageContainer = styled__default.default.div(templateObject_3$u || (t
|
|
|
528
528
|
var OverlayImageRow = styled__default.default.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"])));
|
|
529
529
|
var GrayOverlayContainer = styled__default.default(OverlayContainer)(templateObject_5$g || (templateObject_5$g = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
|
|
530
530
|
var ButtonsColumn = styled__default.default.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"])));
|
|
531
|
-
var WideButton = styled__default.default(LoaderButton)(templateObject_7$
|
|
532
|
-
var WideBorderButton = styled__default.default(WideButton)(templateObject_8$
|
|
531
|
+
var WideButton = styled__default.default(LoaderButton)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
|
|
532
|
+
var WideBorderButton = styled__default.default(WideButton)(templateObject_8$5 || (templateObject_8$5 = __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) {
|
|
533
533
|
var _a, _b;
|
|
534
534
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.textColor) !== null && _b !== void 0 ? _b : 'black';
|
|
535
535
|
}, function (props) {
|
|
@@ -539,34 +539,34 @@ var WideBorderButton = styled__default.default(WideButton)(templateObject_8$6 ||
|
|
|
539
539
|
var _a, _b;
|
|
540
540
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
|
|
541
541
|
});
|
|
542
|
-
var LoadingOverlayInner = styled__default.default(OverlayInner$2)(templateObject_9$
|
|
543
|
-
var LoadingOverlayHeader = styled__default.default.div(templateObject_10$
|
|
542
|
+
var LoadingOverlayInner = styled__default.default(OverlayInner$2)(templateObject_9$3 || (templateObject_9$3 = __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"])));
|
|
543
|
+
var LoadingOverlayHeader = styled__default.default.div(templateObject_10$2 || (templateObject_10$2 = __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) {
|
|
544
544
|
var _a;
|
|
545
545
|
return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
|
|
546
546
|
}, function (props) {
|
|
547
547
|
return props.theme.padding ? "box-sizing: border-box; padding: ".concat(props.theme.padding, ";") : "";
|
|
548
548
|
});
|
|
549
|
-
var LoadingOverlayGuidanceMessage = styled__default.default(GuidanceMessage)(templateObject_11$
|
|
550
|
-
var LoadingOverlayImageContainer = styled__default.default(OverlayImageContainer)(templateObject_12$
|
|
549
|
+
var LoadingOverlayGuidanceMessage = styled__default.default(GuidanceMessage)(templateObject_11$2 || (templateObject_11$2 = __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"])));
|
|
550
|
+
var LoadingOverlayImageContainer = styled__default.default(OverlayImageContainer)(templateObject_12$2 || (templateObject_12$2 = __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"])));
|
|
551
551
|
var LoadingOverlayProgressBarBackground = styled__default.default.div.attrs({
|
|
552
552
|
className: 'loading-overlay-progress-bar-background'
|
|
553
|
-
})(templateObject_13$
|
|
553
|
+
})(templateObject_13$2 || (templateObject_13$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"])));
|
|
554
554
|
var LoadingOverlayProgressBar = styled__default.default.span.attrs({
|
|
555
555
|
className: 'loading-overlay-progress-bar'
|
|
556
|
-
})(templateObject_14$
|
|
556
|
+
})(templateObject_14$1 || (templateObject_14$1 = __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) {
|
|
557
557
|
return props.$progress;
|
|
558
558
|
});
|
|
559
559
|
var LoadingOverlayProgressIndicator = styled__default.default.span.attrs({
|
|
560
560
|
className: 'loading-overlay-progress-indicator'
|
|
561
|
-
})(templateObject_15$
|
|
562
|
-
var LoadingOverlayButtonsRow = styled__default.default(ButtonsRow$2)(templateObject_16$
|
|
563
|
-
var LoadingOverlayLoadingListContainer = styled__default.default.div(templateObject_17$
|
|
564
|
-
var LoadingOverlayLoadingList = styled__default.default.ul(templateObject_18$
|
|
565
|
-
var LoadingOverlayLoadingListItem = styled__default.default.li(templateObject_19$
|
|
566
|
-
var LoadingOverlayProgressContainer = styled__default.default.div(templateObject_20$
|
|
567
|
-
var LoadingOverlayCustomLoadingGraphic = styled__default.default.img(templateObject_21$
|
|
568
|
-
var LoadingOverlayContinueButtonContainer = styled__default.default.div(templateObject_22$
|
|
569
|
-
var templateObject_1$N, templateObject_2$I, templateObject_3$u, templateObject_4$o, templateObject_5$g, templateObject_6$a, templateObject_7$
|
|
561
|
+
})(templateObject_15$1 || (templateObject_15$1 = __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);
|
|
562
|
+
var LoadingOverlayButtonsRow = styled__default.default(ButtonsRow$2)(templateObject_16$1 || (templateObject_16$1 = __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"])));
|
|
563
|
+
var LoadingOverlayLoadingListContainer = styled__default.default.div(templateObject_17$1 || (templateObject_17$1 = __makeTemplateObject(["\n display: flex;\n position: relative;\n z-index: 2;\n"], ["\n display: flex;\n position: relative;\n z-index: 2;\n"])));
|
|
564
|
+
var LoadingOverlayLoadingList = styled__default.default.ul(templateObject_18$1 || (templateObject_18$1 = __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"])));
|
|
565
|
+
var LoadingOverlayLoadingListItem = styled__default.default.li(templateObject_19$1 || (templateObject_19$1 = __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"])));
|
|
566
|
+
var LoadingOverlayProgressContainer = styled__default.default.div(templateObject_20$1 || (templateObject_20$1 = __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"])));
|
|
567
|
+
var LoadingOverlayCustomLoadingGraphic = styled__default.default.img(templateObject_21$1 || (templateObject_21$1 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
|
|
568
|
+
var LoadingOverlayContinueButtonContainer = styled__default.default.div(templateObject_22$1 || (templateObject_22$1 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
569
|
+
var templateObject_1$N, templateObject_2$I, templateObject_3$u, templateObject_4$o, templateObject_5$g, templateObject_6$a, templateObject_7$6, templateObject_8$5, 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;
|
|
570
570
|
|
|
571
571
|
var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
|
|
572
572
|
var accessBlockedImageUrl = _a.accessBlockedImageUrl;
|
|
@@ -866,7 +866,7 @@ var error = function error() {
|
|
|
866
866
|
}; // eslint-disable-line no-console
|
|
867
867
|
|
|
868
868
|
exports.defaultAuthUrl = 'https://portal-api.idmission.com';
|
|
869
|
-
var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
|
|
869
|
+
var allowedAuthUrls = ['https://portal-api.idmission.com', 'https://prod-virginia.portal-api.idmission.xyz', 'https://portal-api-uat.idmission.com', 'https://portal-api-demo.idmission.com', 'https://portal-api-dev.idmission.com', 'http://localhost:10000'];
|
|
870
870
|
function setDefaultAuthUrl(url) {
|
|
871
871
|
if (!allowedAuthUrls.includes(url)) throw new Error('invalid auth url');
|
|
872
872
|
exports.defaultAuthUrl = url;
|
|
@@ -2212,6 +2212,8 @@ function calculateMd5(blob) {
|
|
|
2212
2212
|
function getEnvFromUrl(url) {
|
|
2213
2213
|
if (url.startsWith('https://portal-api.idmission.com')) {
|
|
2214
2214
|
return 'prod';
|
|
2215
|
+
} else if (url.startsWith('https://prod-virginia.portal-api.idmission.xyz')) {
|
|
2216
|
+
return 'prod';
|
|
2215
2217
|
} else if (url.startsWith('https://portal-api-uat.idmission.com')) {
|
|
2216
2218
|
return 'uat';
|
|
2217
2219
|
} else if (url.startsWith('https://portal-api-demo.idmission.com')) {
|
|
@@ -4680,13 +4682,8 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4680
4682
|
if (!selectedVideoStreamId) return;
|
|
4681
4683
|
var srcObject = e.currentTarget.srcObject;
|
|
4682
4684
|
if (srcObject.id === selectedVideoStreamId) {
|
|
4683
|
-
var _a = e.currentTarget,
|
|
4684
|
-
videoWidth = _a.videoWidth,
|
|
4685
|
-
videoHeight = _a.videoHeight;
|
|
4686
4685
|
set({
|
|
4687
|
-
videoLoaded: true
|
|
4688
|
-
videoWidth: videoWidth,
|
|
4689
|
-
videoHeight: videoHeight
|
|
4686
|
+
videoLoaded: true
|
|
4690
4687
|
});
|
|
4691
4688
|
} else {
|
|
4692
4689
|
set({
|
|
@@ -4999,25 +4996,26 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4999
4996
|
};
|
|
5000
4997
|
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
5001
4998
|
function CameraStoreProvider(_a) {
|
|
4999
|
+
var _b;
|
|
5002
5000
|
var children = _a.children,
|
|
5003
|
-
|
|
5004
|
-
requestAccessAutomatically =
|
|
5005
|
-
|
|
5006
|
-
preferIphoneContinuityCamera =
|
|
5007
|
-
|
|
5008
|
-
preferFrontFacingCamera =
|
|
5009
|
-
|
|
5010
|
-
maxVideoWidth =
|
|
5001
|
+
_c = _a.requestAccessAutomatically,
|
|
5002
|
+
requestAccessAutomatically = _c === void 0 ? true : _c,
|
|
5003
|
+
_d = _a.preferIphoneContinuityCamera,
|
|
5004
|
+
preferIphoneContinuityCamera = _d === void 0 ? true : _d,
|
|
5005
|
+
_e = _a.preferFrontFacingCamera,
|
|
5006
|
+
preferFrontFacingCamera = _e === void 0 ? false : _e,
|
|
5007
|
+
_f = _a.maxVideoWidth,
|
|
5008
|
+
maxVideoWidth = _f === void 0 ? 1920 : _f,
|
|
5011
5009
|
maxFps = _a.maxFps,
|
|
5012
5010
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
5013
5011
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
5014
5012
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
5015
|
-
|
|
5016
|
-
requireMicrophoneAccess =
|
|
5017
|
-
|
|
5018
|
-
classNames =
|
|
5019
|
-
|
|
5020
|
-
verbiage =
|
|
5013
|
+
_g = _a.requireMicrophoneAccess,
|
|
5014
|
+
requireMicrophoneAccess = _g === void 0 ? false : _g,
|
|
5015
|
+
_h = _a.classNames,
|
|
5016
|
+
classNames = _h === void 0 ? {} : _h,
|
|
5017
|
+
_j = _a.verbiage,
|
|
5018
|
+
verbiage = _j === void 0 ? {} : _j;
|
|
5021
5019
|
var videoRef = React.useRef(null);
|
|
5022
5020
|
var store = React.useRef(undefined);
|
|
5023
5021
|
store.current || (store.current = createCameraStore({
|
|
@@ -5031,6 +5029,16 @@ function CameraStoreProvider(_a) {
|
|
|
5031
5029
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
5032
5030
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
5033
5031
|
}));
|
|
5032
|
+
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
5033
|
+
videoWidth = _k.videoWidth,
|
|
5034
|
+
videoHeight = _k.videoHeight;
|
|
5035
|
+
React.useEffect(function () {
|
|
5036
|
+
var _a;
|
|
5037
|
+
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
5038
|
+
videoWidth: videoWidth,
|
|
5039
|
+
videoHeight: videoHeight
|
|
5040
|
+
});
|
|
5041
|
+
}, [videoWidth, videoHeight]);
|
|
5034
5042
|
React.useEffect(function () {
|
|
5035
5043
|
var _a, _b, _c;
|
|
5036
5044
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -6109,15 +6117,6 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
|
6109
6117
|
getBestBarcode: function getBestBarcode() {
|
|
6110
6118
|
return null;
|
|
6111
6119
|
},
|
|
6112
|
-
startBarcodeRecapturePhase: function startBarcodeRecapturePhase() {
|
|
6113
|
-
return null;
|
|
6114
|
-
},
|
|
6115
|
-
getInitialCaptureBestBarcode: function getInitialCaptureBestBarcode() {
|
|
6116
|
-
return null;
|
|
6117
|
-
},
|
|
6118
|
-
getRecaptureBestBarcode: function getRecaptureBestBarcode() {
|
|
6119
|
-
return null;
|
|
6120
|
-
},
|
|
6121
6120
|
requiredDocumentType: 'none',
|
|
6122
6121
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
6123
6122
|
return null;
|
|
@@ -6177,14 +6176,6 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6177
6176
|
var bestBarcodeScore = React.useRef(0);
|
|
6178
6177
|
var stopDetection = React.useRef(0);
|
|
6179
6178
|
var analyzeBarcodeReadability = useBarcodeReadabilityAnalysis();
|
|
6180
|
-
// Barcode recapture tracking - separate canvases for initial and recapture sequences
|
|
6181
|
-
var initialCaptureBarcodeCanvas = React.useRef(null);
|
|
6182
|
-
var initialCaptureBarcodeDetails = React.useRef(null);
|
|
6183
|
-
var initialCaptureBarcodeScore = React.useRef(0);
|
|
6184
|
-
var recaptureBarcodeCanvas = React.useRef(null);
|
|
6185
|
-
var recaptureBarcodeDetails = React.useRef(null);
|
|
6186
|
-
var recaptureBarcodeScore = React.useRef(0);
|
|
6187
|
-
var isRecapturePhase = React.useRef(false);
|
|
6188
6179
|
var _h = React.useState('none'),
|
|
6189
6180
|
requiredDocumentType = _h[0],
|
|
6190
6181
|
setRequiredDocumentType = _h[1];
|
|
@@ -6209,10 +6200,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6209
6200
|
var _this = this;
|
|
6210
6201
|
onDocumentDetected(function (prediction) {
|
|
6211
6202
|
return __awaiter(_this, void 0, void 0, function () {
|
|
6212
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType,
|
|
6213
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6214
|
-
return __generator(this, function (
|
|
6215
|
-
switch (
|
|
6203
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
6204
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6205
|
+
return __generator(this, function (_h) {
|
|
6206
|
+
switch (_h.label) {
|
|
6216
6207
|
case 0:
|
|
6217
6208
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
6218
6209
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -6226,9 +6217,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6226
6217
|
prediction.singlePageDetectionThresholdMet = false;
|
|
6227
6218
|
}
|
|
6228
6219
|
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'));
|
|
6229
|
-
|
|
6230
|
-
shouldRunBarcodeAnalysisDuringRecapture = isInRecapturePhase && isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentIsStable && prediction.bestDocument && prediction.bestPDF417;
|
|
6231
|
-
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 3];
|
|
6220
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 2];
|
|
6232
6221
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
6233
6222
|
if (focusPrediction) {
|
|
6234
6223
|
focusScore = focusPrediction.score;
|
|
@@ -6251,7 +6240,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6251
6240
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
6252
6241
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6253
6242
|
case 1:
|
|
6254
|
-
barcodeAnalysisResult =
|
|
6243
|
+
barcodeAnalysisResult = _h.sent();
|
|
6255
6244
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6256
6245
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6257
6246
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -6261,61 +6250,15 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6261
6250
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6262
6251
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6263
6252
|
}
|
|
6264
|
-
|
|
6265
|
-
if (isRecapturePhase.current && recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6266
|
-
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6267
|
-
recaptureBarcodeDetails.current = (_g = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _g !== void 0 ? _g : null;
|
|
6268
|
-
// Copy the current best barcode canvas to recapture canvas
|
|
6269
|
-
if (bestBarcodeCanvas.current) {
|
|
6270
|
-
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6271
|
-
if (ctx) {
|
|
6272
|
-
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6273
|
-
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6274
|
-
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6275
|
-
}
|
|
6276
|
-
}
|
|
6277
|
-
}
|
|
6278
|
-
_k.label = 2;
|
|
6253
|
+
_h.label = 2;
|
|
6279
6254
|
case 2:
|
|
6280
|
-
return [3 /*break*/, 5];
|
|
6281
|
-
case 3:
|
|
6282
|
-
if (!shouldRunBarcodeAnalysisDuringRecapture) return [3 /*break*/, 5];
|
|
6283
|
-
if (!(enableBarcodeReadabilityModel && croppedDocumentCanvas.current && stopDetectionAtStart === stopDetection.current)) return [3 /*break*/, 5];
|
|
6284
|
-
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6285
|
-
case 4:
|
|
6286
|
-
barcodeAnalysisResult = _k.sent();
|
|
6287
|
-
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6288
|
-
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6289
|
-
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
6290
|
-
if (barcodeAnalysisResult.newBestBarcodeScore) {
|
|
6291
|
-
bestBarcodeScore.current = barcodeAnalysisResult.newBestBarcodeScore;
|
|
6292
|
-
}
|
|
6293
|
-
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6294
|
-
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6295
|
-
}
|
|
6296
|
-
// Track best barcode separately for recapture sequence
|
|
6297
|
-
if (recaptureBarcodeCanvas.current && pdf417PredictionScore > recaptureBarcodeScore.current) {
|
|
6298
|
-
recaptureBarcodeScore.current = pdf417PredictionScore;
|
|
6299
|
-
recaptureBarcodeDetails.current = (_h = barcodeAnalysisResult.newBestBarcodeDetails) !== null && _h !== void 0 ? _h : null;
|
|
6300
|
-
// Copy the current best barcode canvas to recapture canvas
|
|
6301
|
-
if (bestBarcodeCanvas.current) {
|
|
6302
|
-
ctx = recaptureBarcodeCanvas.current.getContext('2d');
|
|
6303
|
-
if (ctx) {
|
|
6304
|
-
recaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6305
|
-
recaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6306
|
-
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6307
|
-
}
|
|
6308
|
-
}
|
|
6309
|
-
}
|
|
6310
|
-
_k.label = 5;
|
|
6311
|
-
case 5:
|
|
6312
6255
|
/**
|
|
6313
6256
|
* @note
|
|
6314
6257
|
* This should ALWAYS be called.
|
|
6315
6258
|
* Do not return early from this function unless
|
|
6316
6259
|
* lastPredictionCanvas.current is not set
|
|
6317
6260
|
*/
|
|
6318
|
-
(
|
|
6261
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
6319
6262
|
focusScore: focusScore,
|
|
6320
6263
|
focusPredictionTime: focusPredictionTime,
|
|
6321
6264
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -6348,58 +6291,19 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6348
6291
|
canvas: bestBarcodeCanvas.current
|
|
6349
6292
|
});
|
|
6350
6293
|
}, []);
|
|
6351
|
-
var startBarcodeRecapturePhase = React.useCallback(function () {
|
|
6352
|
-
// Snapshot current best barcode to initial capture canvas
|
|
6353
|
-
if (bestBarcodeCanvas.current && initialCaptureBarcodeCanvas.current) {
|
|
6354
|
-
var ctx = initialCaptureBarcodeCanvas.current.getContext('2d');
|
|
6355
|
-
if (ctx) {
|
|
6356
|
-
initialCaptureBarcodeCanvas.current.width = bestBarcodeCanvas.current.width;
|
|
6357
|
-
initialCaptureBarcodeCanvas.current.height = bestBarcodeCanvas.current.height;
|
|
6358
|
-
ctx.drawImage(bestBarcodeCanvas.current, 0, 0);
|
|
6359
|
-
}
|
|
6360
|
-
}
|
|
6361
|
-
initialCaptureBarcodeDetails.current = bestBarcodeDetails.current ? _assign({}, bestBarcodeDetails.current) : null;
|
|
6362
|
-
initialCaptureBarcodeScore.current = bestBarcodeScore.current;
|
|
6363
|
-
// Reset recapture tracking
|
|
6364
|
-
recaptureBarcodeScore.current = 0;
|
|
6365
|
-
recaptureBarcodeDetails.current = null;
|
|
6366
|
-
// Enter recapture phase
|
|
6367
|
-
isRecapturePhase.current = true;
|
|
6368
|
-
}, []);
|
|
6369
|
-
var getInitialCaptureBestBarcode = React.useCallback(function () {
|
|
6370
|
-
if (!initialCaptureBarcodeDetails.current || !initialCaptureBarcodeCanvas.current) return null;
|
|
6371
|
-
return _assign(_assign({}, initialCaptureBarcodeDetails.current), {
|
|
6372
|
-
canvas: initialCaptureBarcodeCanvas.current
|
|
6373
|
-
});
|
|
6374
|
-
}, []);
|
|
6375
|
-
var getRecaptureBestBarcode = React.useCallback(function () {
|
|
6376
|
-
if (!recaptureBarcodeDetails.current || !recaptureBarcodeCanvas.current) return null;
|
|
6377
|
-
return _assign(_assign({}, recaptureBarcodeDetails.current), {
|
|
6378
|
-
canvas: recaptureBarcodeCanvas.current
|
|
6379
|
-
});
|
|
6380
|
-
}, []);
|
|
6381
6294
|
var _j = React.useState(0),
|
|
6382
6295
|
canvasKey = _j[0],
|
|
6383
6296
|
setCanvasKey = _j[1];
|
|
6384
6297
|
var resetBestFrame = React.useCallback(function () {
|
|
6385
|
-
// During recapture phase, preserve all canvas state to avoid race conditions
|
|
6386
|
-
// that could result in black/empty barcode images on slow devices
|
|
6387
|
-
if (isRecapturePhase.current) {
|
|
6388
|
-
return;
|
|
6389
|
-
}
|
|
6390
6298
|
stopDetection.current += 1;
|
|
6299
|
+
setCanvasKey(function (n) {
|
|
6300
|
+
return n + 1;
|
|
6301
|
+
});
|
|
6391
6302
|
clearDocumentDetectionLastPredictionCanvas();
|
|
6392
6303
|
bestFrameDetails.current = null;
|
|
6393
6304
|
bestFocusScore.current = 0;
|
|
6394
6305
|
bestBarcodeScore.current = 0;
|
|
6395
6306
|
bestBarcodeDetails.current = null;
|
|
6396
|
-
setCanvasKey(function (n) {
|
|
6397
|
-
return n + 1;
|
|
6398
|
-
});
|
|
6399
|
-
initialCaptureBarcodeScore.current = 0;
|
|
6400
|
-
initialCaptureBarcodeDetails.current = null;
|
|
6401
|
-
recaptureBarcodeScore.current = 0;
|
|
6402
|
-
recaptureBarcodeDetails.current = null;
|
|
6403
6307
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
6404
6308
|
React.useEffect(function () {
|
|
6405
6309
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -6465,13 +6369,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6465
6369
|
bestFrameDetails: bestFrameDetails,
|
|
6466
6370
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
6467
6371
|
getBestBarcode: getBestBarcode,
|
|
6468
|
-
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
6469
|
-
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
6470
|
-
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
6471
6372
|
requiredDocumentType: requiredDocumentType,
|
|
6472
6373
|
setRequiredDocumentType: setRequiredDocumentType
|
|
6473
6374
|
};
|
|
6474
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode,
|
|
6375
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
6475
6376
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
|
|
6476
6377
|
value: value
|
|
6477
6378
|
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
@@ -6483,12 +6384,6 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6483
6384
|
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
6484
6385
|
key: "cd-".concat(canvasKey),
|
|
6485
6386
|
ref: croppedDocumentCanvas
|
|
6486
|
-
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
6487
|
-
key: "icb-".concat(canvasKey),
|
|
6488
|
-
ref: initialCaptureBarcodeCanvas
|
|
6489
|
-
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
6490
|
-
key: "rcb-".concat(canvasKey),
|
|
6491
|
-
ref: recaptureBarcodeCanvas
|
|
6492
6387
|
})), children);
|
|
6493
6388
|
}
|
|
6494
6389
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -6583,8 +6478,6 @@ var initialState$5 = {
|
|
|
6583
6478
|
singlePageDetectionThresholdMet: false,
|
|
6584
6479
|
focusScore: 0,
|
|
6585
6480
|
focusThresholdMet: false,
|
|
6586
|
-
pdf417PredictionScore: 0,
|
|
6587
|
-
pdf417PredictionThresholdMet: false,
|
|
6588
6481
|
isGoodFrame: false,
|
|
6589
6482
|
goodFramesCount: 0,
|
|
6590
6483
|
goodFramesThreshold: 3,
|
|
@@ -6606,42 +6499,30 @@ var initialState$5 = {
|
|
|
6606
6499
|
uploadingDocumentsType: null,
|
|
6607
6500
|
operationStartedAt: null,
|
|
6608
6501
|
captureStartedAt: null,
|
|
6609
|
-
barcodeRecaptureStartedAt: null,
|
|
6610
|
-
initialBarcodeScore: 0,
|
|
6611
|
-
recaptureBarcodeScore: null,
|
|
6612
|
-
barcodeRecaptureThreshold: 0,
|
|
6613
|
-
barcodeRecaptureTimeoutMs: 5000,
|
|
6614
|
-
initialCaptureBarcodeImage: null,
|
|
6615
|
-
recaptureBarcodeImage: null,
|
|
6616
6502
|
dispatch: function dispatch() {
|
|
6617
6503
|
return null;
|
|
6618
6504
|
}
|
|
6619
6505
|
};
|
|
6620
6506
|
var _reducer = function reducer(state, action) {
|
|
6621
6507
|
var _a;
|
|
6622
|
-
var _b, _c;
|
|
6623
6508
|
switch (action.type) {
|
|
6624
6509
|
case 'configureWizard':
|
|
6625
6510
|
{
|
|
6626
|
-
var
|
|
6627
|
-
captureRequirement =
|
|
6628
|
-
precapturedDocuments =
|
|
6629
|
-
allowSinglePageIdCapture =
|
|
6630
|
-
allowIdCardBackToFrontCapture =
|
|
6631
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
6632
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
6633
|
-
allowUploadingDocumentsFromStorage =
|
|
6634
|
-
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
6635
|
-
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
6511
|
+
var _b = action.payload,
|
|
6512
|
+
captureRequirement = _b.captureRequirement,
|
|
6513
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
6514
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
6515
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
6516
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
6517
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
6518
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
6636
6519
|
var newState = _assign(_assign({}, state), {
|
|
6637
6520
|
captureRequirement: captureRequirement,
|
|
6638
6521
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
6639
6522
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
6640
6523
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
6641
6524
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
6642
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6643
|
-
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
6644
|
-
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
6525
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6645
6526
|
});
|
|
6646
6527
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
6647
6528
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -6698,28 +6579,26 @@ var _reducer = function reducer(state, action) {
|
|
|
6698
6579
|
});
|
|
6699
6580
|
case 'objectsDetected':
|
|
6700
6581
|
{
|
|
6701
|
-
var
|
|
6702
|
-
detectedObjects =
|
|
6703
|
-
detectionThresholdMet =
|
|
6704
|
-
detectedDocumentType =
|
|
6705
|
-
idCardFrontDetectionScore =
|
|
6706
|
-
idCardFrontDetectionThresholdMet =
|
|
6707
|
-
idCardBackDetectionScore =
|
|
6708
|
-
idCardBackDetectionThresholdMet =
|
|
6709
|
-
passportDetectionScore =
|
|
6710
|
-
passportDetectionThresholdMet =
|
|
6711
|
-
singlePageDetectionScore =
|
|
6712
|
-
singlePageDetectionThresholdMet =
|
|
6713
|
-
bestDocument =
|
|
6714
|
-
documentInBounds =
|
|
6715
|
-
documentTooClose =
|
|
6716
|
-
documentIsStable =
|
|
6717
|
-
focusScore =
|
|
6718
|
-
focusThresholdMet =
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
frameWidth = _e.frameWidth,
|
|
6722
|
-
frameHeight = _e.frameHeight;
|
|
6582
|
+
var _c = action.payload.prediction,
|
|
6583
|
+
detectedObjects = _c.detectedObjects,
|
|
6584
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
6585
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
6586
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
6587
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
6588
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
6589
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
6590
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
6591
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
6592
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
6593
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
6594
|
+
bestDocument = _c.bestDocument,
|
|
6595
|
+
documentInBounds = _c.documentInBounds,
|
|
6596
|
+
documentTooClose = _c.documentTooClose,
|
|
6597
|
+
documentIsStable = _c.documentIsStable,
|
|
6598
|
+
focusScore = _c.focusScore,
|
|
6599
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
6600
|
+
frameWidth = _c.frameWidth,
|
|
6601
|
+
frameHeight = _c.frameHeight;
|
|
6723
6602
|
var frameCapturedAt = new Date();
|
|
6724
6603
|
var frameCaptureRate = 0;
|
|
6725
6604
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -6799,8 +6678,6 @@ var _reducer = function reducer(state, action) {
|
|
|
6799
6678
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
6800
6679
|
focusScore: focusScore,
|
|
6801
6680
|
focusThresholdMet: focusThresholdMet,
|
|
6802
|
-
pdf417PredictionScore: pdf417PredictionScore,
|
|
6803
|
-
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
6804
6681
|
isGoodFrame: isGoodFrame,
|
|
6805
6682
|
goodFramesCount: goodFramesCount,
|
|
6806
6683
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -6854,18 +6731,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6854
6731
|
});
|
|
6855
6732
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
6856
6733
|
if (remainingRequirements.length === 0) {
|
|
6857
|
-
|
|
6858
|
-
var justCapturedIdBack = action.payload.documentType === 'idCardBack';
|
|
6859
|
-
var barcodeScore = (_c = (_b = state.capturedDocuments.idBarcodeImage) === null || _b === void 0 ? void 0 : _b.barcodeReadabilityScore) !== null && _c !== void 0 ? _c : 0;
|
|
6860
|
-
var needsBarcodeRecapture = justCapturedIdBack && state.barcodeRecaptureThreshold > 0 && barcodeScore < state.barcodeRecaptureThreshold;
|
|
6861
|
-
if (needsBarcodeRecapture) {
|
|
6862
|
-
// Skip 'complete' and go directly to barcode recapture
|
|
6863
|
-
newState.captureState = 'requestingBetterBarcode';
|
|
6864
|
-
newState.barcodeRecaptureStartedAt = new Date();
|
|
6865
|
-
newState.initialBarcodeScore = barcodeScore;
|
|
6866
|
-
} else {
|
|
6867
|
-
newState.captureState = 'complete';
|
|
6868
|
-
}
|
|
6734
|
+
newState.captureState = 'complete';
|
|
6869
6735
|
} else {
|
|
6870
6736
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
6871
6737
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -6892,8 +6758,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6892
6758
|
case 'documentsCaptured':
|
|
6893
6759
|
{
|
|
6894
6760
|
var newState = _assign({}, state);
|
|
6895
|
-
for (var
|
|
6896
|
-
var doc =
|
|
6761
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
6762
|
+
var doc = _e[_d];
|
|
6897
6763
|
newState = _reducer(newState, {
|
|
6898
6764
|
type: 'documentCaptured',
|
|
6899
6765
|
payload: doc
|
|
@@ -6943,49 +6809,13 @@ var _reducer = function reducer(state, action) {
|
|
|
6943
6809
|
requestedDocumentType: requestedDocumentType
|
|
6944
6810
|
});
|
|
6945
6811
|
}
|
|
6946
|
-
case 'barcodeRecaptureStarted':
|
|
6947
|
-
return _assign(_assign({}, state), {
|
|
6948
|
-
captureState: 'requestingBetterBarcode',
|
|
6949
|
-
barcodeRecaptureStartedAt: new Date(),
|
|
6950
|
-
initialBarcodeScore: action.payload.initialBarcodeScore,
|
|
6951
|
-
initialCaptureBarcodeImage: action.payload.initialCaptureBarcodeImage,
|
|
6952
|
-
recaptureBarcodeScore: null,
|
|
6953
|
-
recaptureBarcodeImage: null,
|
|
6954
|
-
goodFramesCount: 0,
|
|
6955
|
-
capturing: false
|
|
6956
|
-
});
|
|
6957
|
-
case 'barcodeRecaptureScoreUpdated':
|
|
6958
|
-
return _assign(_assign({}, state), {
|
|
6959
|
-
recaptureBarcodeScore: action.payload.recaptureBarcodeScore
|
|
6960
|
-
});
|
|
6961
|
-
case 'recaptureBarcodeImageCaptured':
|
|
6962
|
-
return _assign(_assign({}, state), {
|
|
6963
|
-
recaptureBarcodeImage: action.payload.recaptureBarcodeImage
|
|
6964
|
-
});
|
|
6965
|
-
case 'barcodeRecaptureCompleted':
|
|
6966
|
-
return _assign(_assign({}, state), {
|
|
6967
|
-
captureState: 'complete',
|
|
6968
|
-
barcodeRecaptureStartedAt: null
|
|
6969
|
-
});
|
|
6970
6812
|
case 'resetWizard':
|
|
6971
6813
|
return _assign(_assign({}, initialState$5), {
|
|
6972
6814
|
dispatch: state.dispatch,
|
|
6973
|
-
// Preserve all configuration values
|
|
6974
|
-
captureRequirement: state.captureRequirement,
|
|
6975
|
-
allowSinglePageIdCapture: state.allowSinglePageIdCapture,
|
|
6976
|
-
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture,
|
|
6977
|
-
enableOverrideWrongDocumentTypeDialog: state.enableOverrideWrongDocumentTypeDialog,
|
|
6978
|
-
allowOverrideWrongDocumentTypeAfterMs: state.allowOverrideWrongDocumentTypeAfterMs,
|
|
6979
6815
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6980
|
-
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
6981
|
-
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
6982
|
-
// Reset capture-specific state
|
|
6983
6816
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
recaptureBarcodeScore: null,
|
|
6987
|
-
initialCaptureBarcodeImage: null,
|
|
6988
|
-
recaptureBarcodeImage: null
|
|
6817
|
+
captureRequirement: state.captureRequirement,
|
|
6818
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
6989
6819
|
});
|
|
6990
6820
|
default:
|
|
6991
6821
|
return state;
|
|
@@ -7417,36 +7247,36 @@ function extractSize(entry, sizeType) {
|
|
|
7417
7247
|
}
|
|
7418
7248
|
|
|
7419
7249
|
var IdCapture = function IdCapture(_a) {
|
|
7420
|
-
var _b, _c, _d, _e, _f, _g
|
|
7250
|
+
var _b, _c, _d, _e, _f, _g;
|
|
7421
7251
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
7422
|
-
|
|
7423
|
-
thresholds =
|
|
7252
|
+
_h = _a.thresholds,
|
|
7253
|
+
thresholds = _h === void 0 ? defaultIdCaptureThresholds : _h,
|
|
7424
7254
|
guidanceMessage = _a.guidanceMessage,
|
|
7425
7255
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
7426
7256
|
onCapture = _a.onCapture,
|
|
7427
|
-
|
|
7428
|
-
classNames =
|
|
7429
|
-
|
|
7430
|
-
colors =
|
|
7431
|
-
|
|
7432
|
-
rawVerbiage =
|
|
7433
|
-
|
|
7434
|
-
debugMode =
|
|
7435
|
-
var
|
|
7436
|
-
ref =
|
|
7437
|
-
|
|
7438
|
-
width =
|
|
7439
|
-
|
|
7440
|
-
height =
|
|
7257
|
+
_j = _a.classNames,
|
|
7258
|
+
classNames = _j === void 0 ? {} : _j,
|
|
7259
|
+
_k = _a.colors,
|
|
7260
|
+
colors = _k === void 0 ? {} : _k,
|
|
7261
|
+
_l = _a.verbiage,
|
|
7262
|
+
rawVerbiage = _l === void 0 ? {} : _l,
|
|
7263
|
+
_m = _a.debugMode,
|
|
7264
|
+
debugMode = _m === void 0 ? false : _m;
|
|
7265
|
+
var _o = useResizeObserver(),
|
|
7266
|
+
ref = _o.ref,
|
|
7267
|
+
_p = _o.width,
|
|
7268
|
+
width = _p === void 0 ? 1 : _p,
|
|
7269
|
+
_q = _o.height,
|
|
7270
|
+
height = _q === void 0 ? 1 : _q;
|
|
7441
7271
|
var state = useIdCaptureStore();
|
|
7442
7272
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
7443
|
-
var
|
|
7444
|
-
modelsReady =
|
|
7445
|
-
setThresholds =
|
|
7446
|
-
detectionTime =
|
|
7447
|
-
focusPredictionTime =
|
|
7448
|
-
getBestFrame =
|
|
7449
|
-
getBestBarcode =
|
|
7273
|
+
var _r = useIdCaptureModelsContext(),
|
|
7274
|
+
modelsReady = _r.ready,
|
|
7275
|
+
setThresholds = _r.setThresholds,
|
|
7276
|
+
detectionTime = _r.detectionTime,
|
|
7277
|
+
focusPredictionTime = _r.focusPredictionTime,
|
|
7278
|
+
getBestFrame = _r.getBestFrame,
|
|
7279
|
+
getBestBarcode = _r.getBestBarcode;
|
|
7450
7280
|
React.useEffect(function () {
|
|
7451
7281
|
return dispatchIdCaptureAction({
|
|
7452
7282
|
type: 'captureInitialized'
|
|
@@ -7471,7 +7301,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7471
7301
|
}
|
|
7472
7302
|
});
|
|
7473
7303
|
}, [height, width]);
|
|
7474
|
-
var shouldCapture = state.
|
|
7304
|
+
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7475
7305
|
React.useEffect(function () {
|
|
7476
7306
|
if (!shouldCapture) return;
|
|
7477
7307
|
dispatchIdCaptureAction({
|
|
@@ -7571,18 +7401,13 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7571
7401
|
"$flipX": !isRearFacing,
|
|
7572
7402
|
scaling: debugScalingDetails
|
|
7573
7403
|
}, state.detectedObjects.map(function (obj, i) {
|
|
7574
|
-
// During barcode recapture, render PDF417 barcodes with green color
|
|
7575
|
-
var isBarcodeRecapture = state.captureState === 'requestingBetterBarcode';
|
|
7576
|
-
var isBarcode = obj.label === 'PDF417';
|
|
7577
|
-
var color = isBarcodeRecapture && isBarcode ? 'green' : undefined;
|
|
7578
7404
|
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
7579
7405
|
key: i,
|
|
7580
7406
|
obj: obj,
|
|
7581
7407
|
scaling: debugScalingDetails,
|
|
7582
|
-
flipX: !isRearFacing
|
|
7583
|
-
color: color
|
|
7408
|
+
flipX: !isRearFacing
|
|
7584
7409
|
});
|
|
7585
|
-
}))), debugMode && (/*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.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__namespace.default.createElement("br", null), modelsReady ? (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.
|
|
7410
|
+
}))), debugMode && (/*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.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__namespace.default.createElement("br", null), modelsReady ? (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
|
|
7586
7411
|
};
|
|
7587
7412
|
var timeSince = function timeSince(t) {
|
|
7588
7413
|
if (!t) return 0;
|
|
@@ -8462,11 +8287,11 @@ var ProgressBarBackground$1 = styled__default.default(LoadingOverlayProgressBarB
|
|
|
8462
8287
|
var _a, _b, _c, _d;
|
|
8463
8288
|
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;
|
|
8464
8289
|
});
|
|
8465
|
-
var ProgressIndicator$1 = styled__default.default(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
8290
|
+
var ProgressIndicator$1 = styled__default.default(LoadingOverlayProgressIndicator)(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
8466
8291
|
var _a, _b, _c, _d;
|
|
8467
8292
|
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)';
|
|
8468
8293
|
});
|
|
8469
|
-
var ContinueButton$1 = styled__default.default(LoaderButton)(templateObject_8$
|
|
8294
|
+
var ContinueButton$1 = styled__default.default(LoaderButton)(templateObject_8$4 || (templateObject_8$4 = __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) {
|
|
8470
8295
|
var _a, _b, _c, _d, _e, _f;
|
|
8471
8296
|
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, ";") : '';
|
|
8472
8297
|
}, function (props) {
|
|
@@ -8485,7 +8310,7 @@ var ContinueButton$1 = styled__default.default(LoaderButton)(templateObject_8$5
|
|
|
8485
8310
|
var _a, _b, _c, _d;
|
|
8486
8311
|
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';
|
|
8487
8312
|
});
|
|
8488
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
8313
|
+
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$5, templateObject_8$4;
|
|
8489
8314
|
|
|
8490
8315
|
var ContinuityCameraCheckboxContainer = styled__default.default.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"])));
|
|
8491
8316
|
var ContinuityCameraCheckbox = styled__default.default.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -8672,14 +8497,6 @@ var FlexCard = styled__default.default(Card)(templateObject_2$z || (templateObje
|
|
|
8672
8497
|
var templateObject_1$D, templateObject_2$z;
|
|
8673
8498
|
|
|
8674
8499
|
var imageDisplayOrder = ['idCardFront', 'idCardBack', 'idBarcodeImage', 'passport', 'singlePage', 'idFrontIrImage', 'idBackIrImage', 'idFrontUvImage', 'idBackUvImage'];
|
|
8675
|
-
var downloadImage = function downloadImage(dataUrl, filename) {
|
|
8676
|
-
var link = document.createElement('a');
|
|
8677
|
-
link.href = dataUrl;
|
|
8678
|
-
link.download = filename;
|
|
8679
|
-
document.body.appendChild(link);
|
|
8680
|
-
link.click();
|
|
8681
|
-
document.body.removeChild(link);
|
|
8682
|
-
};
|
|
8683
8500
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
8684
8501
|
var capturedDocuments = _a.capturedDocuments,
|
|
8685
8502
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -8691,22 +8508,8 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8691
8508
|
_d = _a.verbiage,
|
|
8692
8509
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
8693
8510
|
_e = _a.debugMode,
|
|
8694
|
-
debugMode = _e === void 0 ? false : _e
|
|
8695
|
-
initialBarcodeScore = _a.initialBarcodeScore,
|
|
8696
|
-
recaptureBarcodeScore = _a.recaptureBarcodeScore,
|
|
8697
|
-
initialCaptureBarcodeImage = _a.initialCaptureBarcodeImage,
|
|
8698
|
-
recaptureBarcodeImage = _a.recaptureBarcodeImage;
|
|
8511
|
+
debugMode = _e === void 0 ? false : _e;
|
|
8699
8512
|
var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
|
|
8700
|
-
if (debugMode) {
|
|
8701
|
-
log('[IdCaptureSuccess] Debug info:', {
|
|
8702
|
-
debugMode: debugMode,
|
|
8703
|
-
initialBarcodeScore: initialBarcodeScore,
|
|
8704
|
-
recaptureBarcodeScore: recaptureBarcodeScore,
|
|
8705
|
-
shouldShow: debugMode && initialBarcodeScore !== undefined,
|
|
8706
|
-
condition1: debugMode,
|
|
8707
|
-
condition2: initialBarcodeScore !== undefined
|
|
8708
|
-
});
|
|
8709
|
-
}
|
|
8710
8513
|
var verbiage = useTranslations(rawVerbiage, {
|
|
8711
8514
|
headingText: 'ID Capture Successful',
|
|
8712
8515
|
retryText: 'Retry',
|
|
@@ -8726,7 +8529,6 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8726
8529
|
}, /*#__PURE__*/React__namespace.default.createElement(ImageRow, {
|
|
8727
8530
|
className: classNames.imageRow
|
|
8728
8531
|
}, imageDisplayOrder.map(function (name) {
|
|
8729
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8730
8532
|
var doc = capturedDocuments[name];
|
|
8731
8533
|
if (!doc) return null;
|
|
8732
8534
|
return /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
|
|
@@ -8736,57 +8538,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8736
8538
|
image: doc,
|
|
8737
8539
|
className: classNames.image,
|
|
8738
8540
|
alt: doc.documentType
|
|
8739
|
-
}), debugMode && (/*#__PURE__*/React__namespace.default.createElement(
|
|
8740
|
-
"$score": (_a = doc.barcodeReadabilityScore) !== null && _a !== void 0 ? _a : 0,
|
|
8741
|
-
"$type": "readability"
|
|
8742
|
-
}, ((_b = doc.barcodeReadabilityScore) !== null && _b !== void 0 ? _b : 0).toFixed(3))), initialBarcodeScore !== undefined && (recaptureBarcodeScore !== null && recaptureBarcodeScore !== undefined ? (/*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonHeader, null, "\uD83D\uDCCA Barcode Recapture Analysis"), /*#__PURE__*/React__namespace.default.createElement(ComparisonRow, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonLabel, null, "Initial Capture:"), /*#__PURE__*/React__namespace.default.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React__namespace.default.createElement(ComparisonRow, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonLabel, null, "After Recapture:"), /*#__PURE__*/React__namespace.default.createElement(ComparisonScoreBadge, null, recaptureBarcodeScore.toFixed(3))), /*#__PURE__*/React__namespace.default.createElement(ComparisonDivider, null), /*#__PURE__*/React__namespace.default.createElement(ComparisonRow, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonLabel, null, "Improvement:"), /*#__PURE__*/React__namespace.default.createElement(ImprovementBadge, {
|
|
8743
|
-
"$improved": recaptureBarcodeScore > initialBarcodeScore
|
|
8744
|
-
}, recaptureBarcodeScore > initialBarcodeScore ? '↑' : '→', ' ', Math.abs(recaptureBarcodeScore - initialBarcodeScore).toFixed(3), ' ', "(", recaptureBarcodeScore > initialBarcodeScore ? 'Better' : 'Same/Worse', ")")), (initialCaptureBarcodeImage || recaptureBarcodeImage) && (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonDivider, null), /*#__PURE__*/React__namespace.default.createElement(ComparisonHeader, {
|
|
8745
|
-
style: {
|
|
8746
|
-
marginTop: '0.25rem'
|
|
8747
|
-
}
|
|
8748
|
-
}, "\uD83D\uDD0D Visual Comparison"), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImagesContainer, null, initialCaptureBarcodeImage && (/*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImage, {
|
|
8749
|
-
src: initialCaptureBarcodeImage,
|
|
8750
|
-
alt: "Initial capture barcode",
|
|
8751
|
-
onDoubleClick: function onDoubleClick() {
|
|
8752
|
-
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8753
|
-
},
|
|
8754
|
-
title: "Double-click to download"
|
|
8755
|
-
}), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonScoreLabel, {
|
|
8756
|
-
"$isHigher": initialBarcodeScore >= recaptureBarcodeScore
|
|
8757
|
-
}, initialBarcodeScore.toFixed(3)))), recaptureBarcodeImage && (/*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageLabel, null, "Recapture"), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImage, {
|
|
8758
|
-
src: recaptureBarcodeImage,
|
|
8759
|
-
alt: "Recapture barcode",
|
|
8760
|
-
onDoubleClick: function onDoubleClick() {
|
|
8761
|
-
return downloadImage(recaptureBarcodeImage, "barcode-recapture-".concat(recaptureBarcodeScore.toFixed(3), ".jpg"));
|
|
8762
|
-
},
|
|
8763
|
-
title: "Double-click to download"
|
|
8764
|
-
}), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonScoreLabel, {
|
|
8765
|
-
"$isHigher": recaptureBarcodeScore > initialBarcodeScore
|
|
8766
|
-
}, recaptureBarcodeScore.toFixed(3))))))))) : (/*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonCard, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonHeader, null, "\u26A0\uFE0F Recapture Attempted"), /*#__PURE__*/React__namespace.default.createElement(ComparisonRow, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonLabel, null, "Initial Score:"), /*#__PURE__*/React__namespace.default.createElement(ComparisonScoreBadge, null, initialBarcodeScore.toFixed(3))), /*#__PURE__*/React__namespace.default.createElement(ComparisonRow, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonLabel, null, "Recapture Result:"), /*#__PURE__*/React__namespace.default.createElement(ComparisonValue, null, "No barcode found")), initialCaptureBarcodeImage && (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ComparisonDivider, null), /*#__PURE__*/React__namespace.default.createElement(ComparisonHeader, {
|
|
8767
|
-
style: {
|
|
8768
|
-
marginTop: '0.25rem'
|
|
8769
|
-
}
|
|
8770
|
-
}, "\uD83D\uDD0D Barcode Image (kept)"), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImagesContainer, {
|
|
8771
|
-
style: {
|
|
8772
|
-
gridTemplateColumns: '1fr'
|
|
8773
|
-
}
|
|
8774
|
-
}, /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageWrapper, null, /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImageLabel, null, "Initial Capture"), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonImage, {
|
|
8775
|
-
src: initialCaptureBarcodeImage,
|
|
8776
|
-
alt: "Initial capture barcode",
|
|
8777
|
-
onDoubleClick: function onDoubleClick() {
|
|
8778
|
-
return downloadImage(initialCaptureBarcodeImage, "barcode-initial-".concat(initialBarcodeScore.toFixed(3), ".jpg"));
|
|
8779
|
-
},
|
|
8780
|
-
title: "Double-click to download"
|
|
8781
|
-
}), /*#__PURE__*/React__namespace.default.createElement(BarcodeComparisonScoreLabel, {
|
|
8782
|
-
"$isHigher": true
|
|
8783
|
-
}, initialBarcodeScore.toFixed(3))))))))))) : (/*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(DebugSection, null, /*#__PURE__*/React__namespace.default.createElement(DebugLabel, null, "Document Type:"), /*#__PURE__*/React__namespace.default.createElement(DebugValue, null, doc.documentType)), /*#__PURE__*/React__namespace.default.createElement(DebugSection, null, /*#__PURE__*/React__namespace.default.createElement(DebugLabel, null, "Detection Score:"), /*#__PURE__*/React__namespace.default.createElement(ScoreBadge, {
|
|
8784
|
-
"$score": (_c = doc.detectionScore) !== null && _c !== void 0 ? _c : 0,
|
|
8785
|
-
"$type": "detection"
|
|
8786
|
-
}, ((_d = doc.detectionScore) !== null && _d !== void 0 ? _d : 0).toFixed(3))), /*#__PURE__*/React__namespace.default.createElement(DebugSection, null, /*#__PURE__*/React__namespace.default.createElement(DebugLabel, null, "Focus Score:"), /*#__PURE__*/React__namespace.default.createElement(ScoreBadge, {
|
|
8787
|
-
"$score": (_e = doc.focusScore) !== null && _e !== void 0 ? _e : 0,
|
|
8788
|
-
"$type": "focus"
|
|
8789
|
-
}, ((_f = doc.focusScore) !== null && _f !== void 0 ? _f : 0).toFixed(3))), /*#__PURE__*/React__namespace.default.createElement(DebugSection, null, /*#__PURE__*/React__namespace.default.createElement(DebugLabel, null, "Bounding Box:"), /*#__PURE__*/React__namespace.default.createElement(DebugValue, null, JSON.stringify(doc.boundingBox, null, 2))))))));
|
|
8541
|
+
}), debugMode && (/*#__PURE__*/React__namespace.default.createElement(DebugPre, null, name === 'idBarcodeImage' ? "Document Type: ".concat(doc.documentType, "\nReadability Score: ").concat(doc.barcodeReadabilityScore) : "Document Type: ".concat(doc.documentType, "\nDetection Score: ").concat(doc.detectionScore, "\nFocus Score: ").concat(doc.focusScore, "\nBounding Box: ").concat(JSON.stringify(doc.boundingBox)))));
|
|
8790
8542
|
}))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
|
|
8791
8543
|
className: classNames.buttonsRow
|
|
8792
8544
|
}, /*#__PURE__*/React__namespace.default.createElement(WideButton, {
|
|
@@ -8809,91 +8561,8 @@ var ImagesContainer = styled__default.default(OverlayImageContainer)(templateObj
|
|
|
8809
8561
|
var ImageRow = styled__default.default(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"])));
|
|
8810
8562
|
var ImageCol$1 = styled__default.default.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"])));
|
|
8811
8563
|
var StyledImage = styled__default.default(CapturedDocumentImg)(templateObject_5$d || (templateObject_5$d = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
|
|
8812
|
-
var
|
|
8813
|
-
var
|
|
8814
|
-
var DebugLabel = styled__default.default.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"])));
|
|
8815
|
-
var DebugValue = styled__default.default.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"])));
|
|
8816
|
-
var ScoreBadge = styled__default.default.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) {
|
|
8817
|
-
var $score = _a.$score,
|
|
8818
|
-
$type = _a.$type;
|
|
8819
|
-
var thresholds = $type === 'readability' ? {
|
|
8820
|
-
good: 0.5,
|
|
8821
|
-
medium: 0.2
|
|
8822
|
-
} : $type === 'detection' ? {
|
|
8823
|
-
good: 0.7,
|
|
8824
|
-
medium: 0.4
|
|
8825
|
-
} : {
|
|
8826
|
-
good: 0.7,
|
|
8827
|
-
medium: 0.4
|
|
8828
|
-
};
|
|
8829
|
-
if ($score >= thresholds.good) return '#d4edda';
|
|
8830
|
-
if ($score >= thresholds.medium) return '#fff3cd';
|
|
8831
|
-
return '#f8d7da';
|
|
8832
|
-
}, function (_a) {
|
|
8833
|
-
var $score = _a.$score,
|
|
8834
|
-
$type = _a.$type;
|
|
8835
|
-
var thresholds = $type === 'readability' ? {
|
|
8836
|
-
good: 0.5,
|
|
8837
|
-
medium: 0.2
|
|
8838
|
-
} : $type === 'detection' ? {
|
|
8839
|
-
good: 0.7,
|
|
8840
|
-
medium: 0.4
|
|
8841
|
-
} : {
|
|
8842
|
-
good: 0.7,
|
|
8843
|
-
medium: 0.4
|
|
8844
|
-
};
|
|
8845
|
-
if ($score >= thresholds.good) return '#155724';
|
|
8846
|
-
if ($score >= thresholds.medium) return '#856404';
|
|
8847
|
-
return '#721c24';
|
|
8848
|
-
}, function (_a) {
|
|
8849
|
-
var $score = _a.$score,
|
|
8850
|
-
$type = _a.$type;
|
|
8851
|
-
var thresholds = $type === 'readability' ? {
|
|
8852
|
-
good: 0.5,
|
|
8853
|
-
medium: 0.2
|
|
8854
|
-
} : $type === 'detection' ? {
|
|
8855
|
-
good: 0.7,
|
|
8856
|
-
medium: 0.4
|
|
8857
|
-
} : {
|
|
8858
|
-
good: 0.7,
|
|
8859
|
-
medium: 0.4
|
|
8860
|
-
};
|
|
8861
|
-
if ($score >= thresholds.good) return '#c3e6cb';
|
|
8862
|
-
if ($score >= thresholds.medium) return '#ffeaa7';
|
|
8863
|
-
return '#f5c6cb';
|
|
8864
|
-
});
|
|
8865
|
-
var BarcodeComparisonCard = styled__default.default.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"])));
|
|
8866
|
-
var ComparisonHeader = styled__default.default.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"])));
|
|
8867
|
-
var ComparisonRow = styled__default.default.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"])));
|
|
8868
|
-
var ComparisonLabel = styled__default.default.span(templateObject_14$1 || (templateObject_14$1 = __makeTemplateObject(["\n font-weight: 500;\n color: #495057;\n"], ["\n font-weight: 500;\n color: #495057;\n"])));
|
|
8869
|
-
var ComparisonValue = styled__default.default.span(templateObject_15$1 || (templateObject_15$1 = __makeTemplateObject(["\n font-weight: 600;\n color: #212529;\n"], ["\n font-weight: 600;\n color: #212529;\n"])));
|
|
8870
|
-
var ComparisonDivider = styled__default.default.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"])));
|
|
8871
|
-
var ComparisonScoreBadge = styled__default.default.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"])));
|
|
8872
|
-
var ImprovementBadge = styled__default.default.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) {
|
|
8873
|
-
var $improved = _a.$improved;
|
|
8874
|
-
return $improved ? '#d4edda' : '#e2e3e5';
|
|
8875
|
-
}, function (_a) {
|
|
8876
|
-
var $improved = _a.$improved;
|
|
8877
|
-
return $improved ? '#155724' : '#383d41';
|
|
8878
|
-
}, function (_a) {
|
|
8879
|
-
var $improved = _a.$improved;
|
|
8880
|
-
return $improved ? '#c3e6cb' : '#d6d8db';
|
|
8881
|
-
});
|
|
8882
|
-
var BarcodeComparisonImagesContainer = styled__default.default.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"])));
|
|
8883
|
-
var BarcodeComparisonImageWrapper = styled__default.default.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"])));
|
|
8884
|
-
var BarcodeComparisonImageLabel = styled__default.default.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"])));
|
|
8885
|
-
var BarcodeComparisonImage = styled__default.default.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"])));
|
|
8886
|
-
var BarcodeComparisonScoreLabel = styled__default.default.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) {
|
|
8887
|
-
var $isHigher = _a.$isHigher;
|
|
8888
|
-
return $isHigher ? '#155724' : '#495057';
|
|
8889
|
-
}, function (_a) {
|
|
8890
|
-
var $isHigher = _a.$isHigher;
|
|
8891
|
-
return $isHigher ? '#d4edda' : 'white';
|
|
8892
|
-
}, function (_a) {
|
|
8893
|
-
var $isHigher = _a.$isHigher;
|
|
8894
|
-
return $isHigher ? '#c3e6cb' : '#dee2e6';
|
|
8895
|
-
});
|
|
8896
|
-
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;
|
|
8564
|
+
var DebugPre = styled__default.default.pre(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"], ["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"])));
|
|
8565
|
+
var templateObject_1$C, templateObject_2$y, templateObject_3$o, templateObject_4$i, templateObject_5$d, templateObject_6$8;
|
|
8897
8566
|
|
|
8898
8567
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
8899
8568
|
var _this = this;
|
|
@@ -11423,7 +11092,7 @@ var lastDocumentDetectedAtDefaults = {
|
|
|
11423
11092
|
none: null
|
|
11424
11093
|
};
|
|
11425
11094
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
11426
|
-
var _b, _c, _d, _e, _f
|
|
11095
|
+
var _b, _c, _d, _e, _f;
|
|
11427
11096
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
11428
11097
|
onLoadingProgress = _a.onLoadingProgress,
|
|
11429
11098
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -11434,115 +11103,86 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11434
11103
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
11435
11104
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
11436
11105
|
onDocumentDetected = _a.onDocumentDetected,
|
|
11437
|
-
|
|
11438
|
-
documentDetectionThrottleMs =
|
|
11439
|
-
|
|
11440
|
-
loadingOverlayMode =
|
|
11106
|
+
_g = _a.documentDetectionThrottleMs,
|
|
11107
|
+
documentDetectionThrottleMs = _g === void 0 ? 0 : _g,
|
|
11108
|
+
_h = _a.loadingOverlayMode,
|
|
11109
|
+
loadingOverlayMode = _h === void 0 ? 'default' : _h,
|
|
11441
11110
|
customOverlayContent = _a.customOverlayContent,
|
|
11442
11111
|
precapturedDocuments = _a.precapturedDocuments,
|
|
11443
|
-
|
|
11444
|
-
captureRequirement =
|
|
11445
|
-
|
|
11446
|
-
allowSinglePageIdCapture =
|
|
11447
|
-
|
|
11448
|
-
separateIdCardCaptureSequence =
|
|
11449
|
-
|
|
11450
|
-
thresholds =
|
|
11451
|
-
|
|
11452
|
-
skipSuccessScreen =
|
|
11112
|
+
_j = _a.captureRequirement,
|
|
11113
|
+
captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
|
|
11114
|
+
_k = _a.allowSinglePageIdCapture,
|
|
11115
|
+
allowSinglePageIdCapture = _k === void 0 ? false : _k,
|
|
11116
|
+
_l = _a.separateIdCardCaptureSequence,
|
|
11117
|
+
separateIdCardCaptureSequence = _l === void 0 ? false : _l,
|
|
11118
|
+
_m = _a.thresholds,
|
|
11119
|
+
thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
|
|
11120
|
+
_o = _a.skipSuccessScreen,
|
|
11121
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
11453
11122
|
instructions = _a.instructions,
|
|
11454
|
-
|
|
11455
|
-
releaseCameraAccessOnExit =
|
|
11456
|
-
|
|
11457
|
-
guideType =
|
|
11458
|
-
|
|
11459
|
-
portraitGuidesOnMobile =
|
|
11460
|
-
|
|
11461
|
-
rotateLoadingOverlayImageWhenPortrait =
|
|
11462
|
-
|
|
11463
|
-
silentFallback =
|
|
11464
|
-
|
|
11465
|
-
forceFallbackMode =
|
|
11466
|
-
|
|
11467
|
-
allowIdCardBackToFrontCapture =
|
|
11468
|
-
|
|
11469
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
11470
|
-
|
|
11471
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
11472
|
-
|
|
11473
|
-
allowUploadingDocumentsFromStorage =
|
|
11474
|
-
|
|
11475
|
-
guideImages =
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
_11 = _a.classNames,
|
|
11489
|
-
classNames = _11 === void 0 ? {} : _11,
|
|
11490
|
-
_12 = _a.colors,
|
|
11491
|
-
colors = _12 === void 0 ? {} : _12,
|
|
11492
|
-
_13 = _a.verbiage,
|
|
11493
|
-
verbiage = _13 === void 0 ? {} : _13,
|
|
11494
|
-
_14 = _a.debugMode,
|
|
11495
|
-
debugMode = _14 === void 0 ? false : _14;
|
|
11123
|
+
_p = _a.releaseCameraAccessOnExit,
|
|
11124
|
+
releaseCameraAccessOnExit = _p === void 0 ? true : _p,
|
|
11125
|
+
_q = _a.guideType,
|
|
11126
|
+
guideType = _q === void 0 ? 'fit' : _q,
|
|
11127
|
+
_r = _a.portraitGuidesOnMobile,
|
|
11128
|
+
portraitGuidesOnMobile = _r === void 0 ? true : _r,
|
|
11129
|
+
_s = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
11130
|
+
rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
11131
|
+
_t = _a.silentFallback,
|
|
11132
|
+
silentFallback = _t === void 0 ? false : _t,
|
|
11133
|
+
_u = _a.forceFallbackMode,
|
|
11134
|
+
forceFallbackMode = _u === void 0 ? false : _u,
|
|
11135
|
+
_v = _a.allowIdCardBackToFrontCapture,
|
|
11136
|
+
allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
|
|
11137
|
+
_w = _a.enableOverrideWrongDocumentTypeDialog,
|
|
11138
|
+
enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
|
|
11139
|
+
_x = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
11140
|
+
allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
|
|
11141
|
+
_y = _a.allowUploadingDocumentsFromStorage,
|
|
11142
|
+
allowUploadingDocumentsFromStorage = _y === void 0 ? false : _y,
|
|
11143
|
+
_z = _a.guideImages,
|
|
11144
|
+
guideImages = _z === void 0 ? defaultIdCaptureGuideImages : _z,
|
|
11145
|
+
_0 = _a.documentEdgeDistancePct,
|
|
11146
|
+
documentEdgeDistancePct = _0 === void 0 ? 0 : _0,
|
|
11147
|
+
_1 = _a.assets,
|
|
11148
|
+
assets = _1 === void 0 ? {} : _1,
|
|
11149
|
+
_2 = _a.classNames,
|
|
11150
|
+
classNames = _2 === void 0 ? {} : _2,
|
|
11151
|
+
_3 = _a.colors,
|
|
11152
|
+
colors = _3 === void 0 ? {} : _3,
|
|
11153
|
+
_4 = _a.verbiage,
|
|
11154
|
+
verbiage = _4 === void 0 ? {} : _4,
|
|
11155
|
+
_5 = _a.debugMode,
|
|
11156
|
+
debugMode = _5 === void 0 ? false : _5;
|
|
11496
11157
|
var state = useIdCaptureStore();
|
|
11497
|
-
var
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
|
|
11526
|
-
getBestBarcode = _18.getBestBarcode,
|
|
11527
|
-
startBarcodeRecapturePhase = _18.startBarcodeRecapturePhase,
|
|
11528
|
-
getRecaptureBestBarcode = _18.getRecaptureBestBarcode;
|
|
11529
|
-
var initialBarcodeBboxRef = React.useRef(null);
|
|
11530
|
-
var recapturePhaseStartedRef = React.useRef(false);
|
|
11531
|
-
var _19 = React.useState(false),
|
|
11532
|
-
barcodeRecaptureGrowthSatisfied = _19[0],
|
|
11533
|
-
setBarcodeRecaptureGrowthSatisfied = _19[1];
|
|
11534
|
-
React.useEffect(function () {
|
|
11535
|
-
// Reset recapture gating whenever we enter/exit the recapture flow
|
|
11536
|
-
if (state.captureState === 'requestingBetterBarcode') {
|
|
11537
|
-
initialBarcodeBboxRef.current = null;
|
|
11538
|
-
recapturePhaseStartedRef.current = false;
|
|
11539
|
-
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11540
|
-
return;
|
|
11541
|
-
}
|
|
11542
|
-
initialBarcodeBboxRef.current = null;
|
|
11543
|
-
recapturePhaseStartedRef.current = false;
|
|
11544
|
-
setBarcodeRecaptureGrowthSatisfied(false);
|
|
11545
|
-
}, [state.captureState]);
|
|
11158
|
+
var _6 = useCameraStore(),
|
|
11159
|
+
cameraAccessDenied = _6.cameraAccessDenied,
|
|
11160
|
+
requestCameraAccess = _6.requestCameraAccess,
|
|
11161
|
+
releaseCameraAccess = _6.releaseCameraAccess;
|
|
11162
|
+
var _7 = React.useState(false),
|
|
11163
|
+
overlayDismissed = _7[0],
|
|
11164
|
+
setOverlayDismissed = _7[1];
|
|
11165
|
+
var _8 = useSubmissionContext(),
|
|
11166
|
+
submissionStatus = _8.submissionStatus,
|
|
11167
|
+
setIdFrontImage = _8.setIdFrontImage,
|
|
11168
|
+
setIdBackImage = _8.setIdBackImage,
|
|
11169
|
+
setPassportImage = _8.setPassportImage,
|
|
11170
|
+
setIdFrontIrImage = _8.setIdFrontIrImage,
|
|
11171
|
+
setIdBackIrImage = _8.setIdBackIrImage,
|
|
11172
|
+
setIdFrontUvImage = _8.setIdFrontUvImage,
|
|
11173
|
+
setIdBackUvImage = _8.setIdBackUvImage,
|
|
11174
|
+
setIdBarcodeImage = _8.setIdBarcodeImage,
|
|
11175
|
+
logIdFrontCaptureAttempt = _8.logIdFrontCaptureAttempt,
|
|
11176
|
+
logIdBackCaptureAttempt = _8.logIdBackCaptureAttempt;
|
|
11177
|
+
var _9 = useIdCaptureModelsContext(),
|
|
11178
|
+
start = _9.start,
|
|
11179
|
+
stop = _9.stop,
|
|
11180
|
+
onPredictionMade = _9.onPredictionMade,
|
|
11181
|
+
setRequiredDocumentType = _9.setRequiredDocumentType,
|
|
11182
|
+
modelError = _9.modelError,
|
|
11183
|
+
resetBestFrame = _9.resetBestFrame,
|
|
11184
|
+
documentDetectionBoundaries = _9.documentDetectionBoundaries,
|
|
11185
|
+
setDocumentDetectionBoundaries = _9.setDocumentDetectionBoundaries;
|
|
11546
11186
|
React.useEffect(function () {
|
|
11547
11187
|
dispatchIdCaptureAction({
|
|
11548
11188
|
type: 'configureWizard',
|
|
@@ -11553,12 +11193,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11553
11193
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
11554
11194
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
11555
11195
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
11556
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11557
|
-
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
11558
|
-
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
11196
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11559
11197
|
}
|
|
11560
11198
|
});
|
|
11561
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage,
|
|
11199
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11562
11200
|
React.useEffect(function () {
|
|
11563
11201
|
var _a;
|
|
11564
11202
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -11570,10 +11208,8 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11570
11208
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
11571
11209
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
11572
11210
|
React.useEffect(function () {
|
|
11573
|
-
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
11574
|
-
if (state.captureState === 'requestingBetterBarcode') return;
|
|
11575
11211
|
if (documentCount) resetBestFrame();
|
|
11576
|
-
}, [documentCount, resetBestFrame
|
|
11212
|
+
}, [documentCount, resetBestFrame]);
|
|
11577
11213
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
11578
11214
|
var lastDocumentDetectedAt = React.useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
11579
11215
|
var logCaptureMetadata = React.useCallback(function (metadata) {
|
|
@@ -11592,62 +11228,24 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11592
11228
|
}
|
|
11593
11229
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
11594
11230
|
React.useEffect(function startModelsWhenCapturing() {
|
|
11595
|
-
if (!overlayDismissed ||
|
|
11231
|
+
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
11596
11232
|
dispatchIdCaptureAction({
|
|
11597
11233
|
type: 'captureStarted'
|
|
11598
11234
|
});
|
|
11599
11235
|
start();
|
|
11600
|
-
}, [
|
|
11236
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
11601
11237
|
React.useEffect(function () {
|
|
11602
11238
|
onPredictionMade(function (prediction) {
|
|
11603
|
-
var _a
|
|
11604
|
-
var
|
|
11605
|
-
captureState =
|
|
11606
|
-
requestedDocumentType =
|
|
11239
|
+
var _a;
|
|
11240
|
+
var _b = useIdCaptureStore.getState(),
|
|
11241
|
+
captureState = _b.captureState,
|
|
11242
|
+
requestedDocumentType = _b.requestedDocumentType;
|
|
11607
11243
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
11608
11244
|
var thresholdMet = prediction[k];
|
|
11609
|
-
if (captureState === 'capturing'
|
|
11610
|
-
// During barcode recapture, wait until the barcode bbox grows by a configurable %
|
|
11611
|
-
// (to confirm the user moved the camera closer) before we start recapture processing.
|
|
11612
|
-
if (captureState === 'requestingBetterBarcode') {
|
|
11613
|
-
var growthPct = Math.max(0, Math.min(barcodeRecaptureBboxGrowthPct, 200));
|
|
11614
|
-
var requiredMultiplier = 1 + growthPct / 100;
|
|
11615
|
-
if (!recapturePhaseStartedRef.current) {
|
|
11616
|
-
// If growth requirement is disabled, begin recapture immediately.
|
|
11617
|
-
if (requiredMultiplier === 1) {
|
|
11618
|
-
recapturePhaseStartedRef.current = true;
|
|
11619
|
-
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11620
|
-
startBarcodeRecapturePhase();
|
|
11621
|
-
} else {
|
|
11622
|
-
var pdf417Box = (_a = prediction.bestPDF417) === null || _a === void 0 ? void 0 : _a.box;
|
|
11623
|
-
var frameWidth = (_b = prediction.frameWidth) !== null && _b !== void 0 ? _b : 0;
|
|
11624
|
-
var frameHeight = (_c = prediction.frameHeight) !== null && _c !== void 0 ? _c : 0;
|
|
11625
|
-
if (pdf417Box && frameWidth > 0 && frameHeight > 0) {
|
|
11626
|
-
var widthRatio = pdf417Box.width / frameWidth;
|
|
11627
|
-
var heightRatio = pdf417Box.height / frameHeight;
|
|
11628
|
-
if (!initialBarcodeBboxRef.current) {
|
|
11629
|
-
// First observed bbox when we enter recapture.
|
|
11630
|
-
initialBarcodeBboxRef.current = {
|
|
11631
|
-
widthRatio: widthRatio,
|
|
11632
|
-
heightRatio: heightRatio
|
|
11633
|
-
};
|
|
11634
|
-
} else {
|
|
11635
|
-
var baseline = initialBarcodeBboxRef.current;
|
|
11636
|
-
var widthSatisfied = widthRatio >= baseline.widthRatio * requiredMultiplier;
|
|
11637
|
-
var heightSatisfied = heightRatio >= baseline.heightRatio * requiredMultiplier;
|
|
11638
|
-
if (widthSatisfied && heightSatisfied) {
|
|
11639
|
-
recapturePhaseStartedRef.current = true;
|
|
11640
|
-
setBarcodeRecaptureGrowthSatisfied(true);
|
|
11641
|
-
startBarcodeRecapturePhase();
|
|
11642
|
-
}
|
|
11643
|
-
}
|
|
11644
|
-
}
|
|
11645
|
-
}
|
|
11646
|
-
}
|
|
11647
|
-
}
|
|
11245
|
+
if (captureState === 'capturing') {
|
|
11648
11246
|
if (prediction.detectedDocumentType !== 'none') {
|
|
11649
11247
|
var now = Date.now();
|
|
11650
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
11248
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_a = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _a !== void 0 ? _a : 0) > documentDetectionThrottleMs) {
|
|
11651
11249
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
11652
11250
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
11653
11251
|
}
|
|
@@ -11665,7 +11263,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11665
11263
|
});
|
|
11666
11264
|
}
|
|
11667
11265
|
});
|
|
11668
|
-
}, [
|
|
11266
|
+
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
11669
11267
|
React.useEffect(function () {
|
|
11670
11268
|
if (state.captureState === 'complete') stop();
|
|
11671
11269
|
}, [state.captureState, stop]);
|
|
@@ -11720,9 +11318,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11720
11318
|
type: 'resetWizard'
|
|
11721
11319
|
});
|
|
11722
11320
|
}, []);
|
|
11723
|
-
var
|
|
11724
|
-
attempt =
|
|
11725
|
-
setAttempt =
|
|
11321
|
+
var _10 = React.useState(0),
|
|
11322
|
+
attempt = _10[0],
|
|
11323
|
+
setAttempt = _10[1];
|
|
11726
11324
|
var onExit = React.useCallback(function () {
|
|
11727
11325
|
releaseCameraAccess();
|
|
11728
11326
|
setOverlayDismissed(false);
|
|
@@ -11748,25 +11346,20 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11748
11346
|
});
|
|
11749
11347
|
}
|
|
11750
11348
|
}, [cameraAccessDenied]);
|
|
11751
|
-
var guidanceBarcodeRecaptureText = (_b = verbiage.guidanceBarcodeRecaptureText) !== null && _b !== void 0 ? _b : 'Please move the barcode closer to the camera';
|
|
11752
|
-
var guidanceBarcodeRecaptureInProgressText = (_c = verbiage.guidanceBarcodeRecaptureInProgressText) !== null && _c !== void 0 ? _c : 'Barcode capture in progress, please hold still';
|
|
11753
|
-
var barcodeRecaptureGuidanceMessage = barcodeRecaptureGrowthSatisfied ? guidanceBarcodeRecaptureInProgressText : guidanceBarcodeRecaptureText;
|
|
11754
11349
|
var idCaptureVerbiages = {
|
|
11755
11350
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
11756
11351
|
instructionText: 'Scan the front of ID',
|
|
11757
11352
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
11758
11353
|
}),
|
|
11759
11354
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
11760
|
-
instructionText:
|
|
11355
|
+
instructionText: 'Scan the back of ID'
|
|
11761
11356
|
}),
|
|
11762
11357
|
passport: useTranslations(verbiage.passport, {
|
|
11763
11358
|
instructionText: 'Scan the ID page of passport'
|
|
11764
11359
|
})
|
|
11765
11360
|
};
|
|
11766
11361
|
var theme = styled.useTheme();
|
|
11767
|
-
|
|
11768
|
-
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
11769
|
-
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
11362
|
+
var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
|
|
11770
11363
|
React.useEffect(function () {
|
|
11771
11364
|
if (separateIdCardCaptureSequence) return;
|
|
11772
11365
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -11780,130 +11373,6 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11780
11373
|
clearTimeout(t);
|
|
11781
11374
|
};
|
|
11782
11375
|
}, [resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
|
|
11783
|
-
// Handle barcode recapture start - snapshot initial barcode and initialize recapture state
|
|
11784
|
-
React.useEffect(function () {
|
|
11785
|
-
var _a, _b;
|
|
11786
|
-
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11787
|
-
if (state.initialCaptureBarcodeImage !== null) return; // Already initialized
|
|
11788
|
-
// Get the initial barcode image from capturedDocuments (since resetBestFrame clears the canvas)
|
|
11789
|
-
var initialBarcodeImage = (_b = (_a = state.capturedDocuments.idBarcodeImage) === null || _a === void 0 ? void 0 : _a.imageData) !== null && _b !== void 0 ? _b : null;
|
|
11790
|
-
dispatchIdCaptureAction({
|
|
11791
|
-
type: 'barcodeRecaptureStarted',
|
|
11792
|
-
payload: {
|
|
11793
|
-
initialBarcodeScore: state.initialBarcodeScore,
|
|
11794
|
-
initialCaptureBarcodeImage: initialBarcodeImage
|
|
11795
|
-
}
|
|
11796
|
-
});
|
|
11797
|
-
}, [state.captureState, (_d = state.capturedDocuments.idBarcodeImage) === null || _d === void 0 ? void 0 : _d.imageData, state.initialBarcodeScore, state.initialCaptureBarcodeImage]);
|
|
11798
|
-
// Handle barcode recapture timeout
|
|
11799
|
-
React.useEffect(function () {
|
|
11800
|
-
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11801
|
-
// Continue detection to try to get a better barcode
|
|
11802
|
-
setTimeout(start, 100);
|
|
11803
|
-
var t = setTimeout(function () {
|
|
11804
|
-
// Move-closer window expired before recapture began
|
|
11805
|
-
if (recapturePhaseStartedRef.current) return;
|
|
11806
|
-
var bestBarcode = getBestBarcode();
|
|
11807
|
-
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11808
|
-
if (improved) {
|
|
11809
|
-
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. Found better barcode anyway: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11810
|
-
// Persist the "after" image for debug visual comparison, even if the
|
|
11811
|
-
// model-provider recapture tracker was never started.
|
|
11812
|
-
dispatchIdCaptureAction({
|
|
11813
|
-
type: 'recaptureBarcodeImageCaptured',
|
|
11814
|
-
payload: {
|
|
11815
|
-
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11816
|
-
}
|
|
11817
|
-
});
|
|
11818
|
-
dispatchIdCaptureAction({
|
|
11819
|
-
type: 'barcodeCaptured',
|
|
11820
|
-
payload: {
|
|
11821
|
-
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11822
|
-
barcodeReadabilityScore: bestBarcode.score
|
|
11823
|
-
}
|
|
11824
|
-
});
|
|
11825
|
-
} else {
|
|
11826
|
-
log("[IdCaptureWizard] Barcode recapture move-closer window timed out. No better barcode found. Initial score: ".concat(state.initialBarcodeScore.toFixed(3)));
|
|
11827
|
-
}
|
|
11828
|
-
// Record that recapture was attempted (for diagnostics)
|
|
11829
|
-
dispatchIdCaptureAction({
|
|
11830
|
-
type: 'barcodeRecaptureScoreUpdated',
|
|
11831
|
-
payload: {
|
|
11832
|
-
recaptureBarcodeScore: improved ? bestBarcode.score : state.initialBarcodeScore
|
|
11833
|
-
}
|
|
11834
|
-
});
|
|
11835
|
-
dispatchIdCaptureAction({
|
|
11836
|
-
type: 'barcodeRecaptureCompleted'
|
|
11837
|
-
});
|
|
11838
|
-
}, barcodeRecaptureMoveCloserTimeoutMs);
|
|
11839
|
-
return function () {
|
|
11840
|
-
return clearTimeout(t);
|
|
11841
|
-
};
|
|
11842
|
-
}, [barcodeRecaptureMoveCloserTimeoutMs, getBestBarcode, start, state.captureState, state.initialBarcodeScore]);
|
|
11843
|
-
React.useEffect(function () {
|
|
11844
|
-
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11845
|
-
if (!barcodeRecaptureGrowthSatisfied) return;
|
|
11846
|
-
var t = setTimeout(function () {
|
|
11847
|
-
var _a, _b;
|
|
11848
|
-
// Capture window expired - complete with whatever barcode we have
|
|
11849
|
-
var recaptureBarcode = getRecaptureBestBarcode();
|
|
11850
|
-
var bestBarcode = getBestBarcode();
|
|
11851
|
-
var recaptureScore = (_a = recaptureBarcode === null || recaptureBarcode === void 0 ? void 0 : recaptureBarcode.score) !== null && _a !== void 0 ? _a : null;
|
|
11852
|
-
var improved = !!bestBarcode && bestBarcode.score > state.initialBarcodeScore;
|
|
11853
|
-
// Store the recapture score for diagnostic purposes
|
|
11854
|
-
dispatchIdCaptureAction({
|
|
11855
|
-
type: 'barcodeRecaptureScoreUpdated',
|
|
11856
|
-
payload: {
|
|
11857
|
-
recaptureBarcodeScore: improved ? bestBarcode.score : recaptureScore !== null && recaptureScore !== void 0 ? recaptureScore : state.initialBarcodeScore
|
|
11858
|
-
}
|
|
11859
|
-
});
|
|
11860
|
-
// Store the recapture barcode image if we found one
|
|
11861
|
-
if (recaptureBarcode) {
|
|
11862
|
-
dispatchIdCaptureAction({
|
|
11863
|
-
type: 'recaptureBarcodeImageCaptured',
|
|
11864
|
-
payload: {
|
|
11865
|
-
recaptureBarcodeImage: recaptureBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11866
|
-
}
|
|
11867
|
-
});
|
|
11868
|
-
} else if (improved) {
|
|
11869
|
-
// If we improved but don't have a recapture-specific best tracked,
|
|
11870
|
-
// still persist the "after" image so debug visual comparison works.
|
|
11871
|
-
dispatchIdCaptureAction({
|
|
11872
|
-
type: 'recaptureBarcodeImageCaptured',
|
|
11873
|
-
payload: {
|
|
11874
|
-
recaptureBarcodeImage: bestBarcode.canvas.toDataURL('image/jpeg', 0.95)
|
|
11875
|
-
}
|
|
11876
|
-
});
|
|
11877
|
-
}
|
|
11878
|
-
if (improved) {
|
|
11879
|
-
log("[IdCaptureWizard] Barcode recapture completed. Found better barcode: ".concat(bestBarcode.score.toFixed(3), " (was ").concat(state.initialBarcodeScore.toFixed(3), ")"));
|
|
11880
|
-
dispatchIdCaptureAction({
|
|
11881
|
-
type: 'barcodeCaptured',
|
|
11882
|
-
payload: {
|
|
11883
|
-
imageUrl: bestBarcode.canvas.toDataURL('image/jpeg', 0.95),
|
|
11884
|
-
barcodeReadabilityScore: bestBarcode.score
|
|
11885
|
-
}
|
|
11886
|
-
});
|
|
11887
|
-
} else {
|
|
11888
|
-
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)));
|
|
11889
|
-
}
|
|
11890
|
-
dispatchIdCaptureAction({
|
|
11891
|
-
type: 'barcodeRecaptureCompleted'
|
|
11892
|
-
});
|
|
11893
|
-
}, barcodeRecaptureTimeoutMs);
|
|
11894
|
-
return function () {
|
|
11895
|
-
return clearTimeout(t);
|
|
11896
|
-
};
|
|
11897
|
-
}, [barcodeRecaptureGrowthSatisfied, barcodeRecaptureTimeoutMs, getBestBarcode, getRecaptureBestBarcode, state.captureState, state.initialBarcodeScore]);
|
|
11898
|
-
// Continue detection during barcode recapture and update barcode if better one found
|
|
11899
|
-
React.useEffect(function () {
|
|
11900
|
-
if (state.captureState !== 'requestingBetterBarcode') return;
|
|
11901
|
-
// Set required document type to idCardBack for barcode detection
|
|
11902
|
-
setRequiredDocumentType('idCardBack');
|
|
11903
|
-
return function () {
|
|
11904
|
-
setRequiredDocumentType('none');
|
|
11905
|
-
};
|
|
11906
|
-
}, [setRequiredDocumentType, state.captureState]);
|
|
11907
11376
|
React.useEffect(function () {
|
|
11908
11377
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
11909
11378
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -11942,9 +11411,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11942
11411
|
});
|
|
11943
11412
|
});
|
|
11944
11413
|
}, []);
|
|
11945
|
-
var
|
|
11946
|
-
progressStarted =
|
|
11947
|
-
setProgressStarted =
|
|
11414
|
+
var _11 = React.useState(false),
|
|
11415
|
+
progressStarted = _11[0],
|
|
11416
|
+
setProgressStarted = _11[1];
|
|
11948
11417
|
React.useEffect(function () {
|
|
11949
11418
|
if (state.captureState === 'capturing') {
|
|
11950
11419
|
setProgressStarted(false);
|
|
@@ -11972,9 +11441,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11972
11441
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
11973
11442
|
});
|
|
11974
11443
|
}
|
|
11975
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.
|
|
11444
|
+
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
11976
11445
|
var guidesStatus = !overlayDismissed ? 'disabled' : state.isGoodFrame ? 'capturing' : 'ready';
|
|
11977
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ScalingCameraFeed, null), overlayDismissed &&
|
|
11446
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ScalingCameraFeed, null), overlayDismissed && state.captureState === 'capturing' && (/*#__PURE__*/React__namespace.default.createElement(IdCapture, {
|
|
11978
11447
|
requiredDocumentType: state.requestedDocumentType,
|
|
11979
11448
|
thresholds: thresholds,
|
|
11980
11449
|
onCapture: onCapture,
|
|
@@ -11982,18 +11451,11 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11982
11451
|
colors: colors,
|
|
11983
11452
|
verbiage: idCaptureVerbiage,
|
|
11984
11453
|
debugMode: debugMode
|
|
11985
|
-
})),
|
|
11986
|
-
"$top": "",
|
|
11987
|
-
"$bottom": "12.5%",
|
|
11988
|
-
className: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.guidanceMessageContainer
|
|
11989
|
-
}, /*#__PURE__*/React__namespace.default.createElement(GuidanceMessage, {
|
|
11990
|
-
"$variant": "default",
|
|
11991
|
-
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.guidanceMessage
|
|
11992
|
-
}, barcodeRecaptureGuidanceMessage))), /*#__PURE__*/React__namespace.default.createElement(IdCaptureGuides, {
|
|
11454
|
+
})), /*#__PURE__*/React__namespace.default.createElement(IdCaptureGuides, {
|
|
11993
11455
|
key: "guides".concat(attempt),
|
|
11994
11456
|
guideType: guideType,
|
|
11995
11457
|
status: guidesStatus,
|
|
11996
|
-
progress: progressStarted &&
|
|
11458
|
+
progress: progressStarted && state.captureState === 'capturing' ? 1 : 0,
|
|
11997
11459
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
11998
11460
|
requestedAction: requestedAction,
|
|
11999
11461
|
images: guideImages,
|
|
@@ -12001,15 +11463,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
12001
11463
|
colors: colors,
|
|
12002
11464
|
verbiage: idCaptureVerbiage,
|
|
12003
11465
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
12004
|
-
}), debugMode && !((
|
|
12005
|
-
classNames: (
|
|
12006
|
-
text: (
|
|
11466
|
+
}), debugMode && !((_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.capturePreview) === null || _c === void 0 ? void 0 : _c.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && state.imageUrl && (/*#__PURE__*/React__namespace.default.createElement(IdCaptureImagePreview, {
|
|
11467
|
+
classNames: (_d = classNames.capture) === null || _d === void 0 ? void 0 : _d.imagePreview,
|
|
11468
|
+
text: (_e = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _e === void 0 ? void 0 : _e.processingIdCardText,
|
|
12007
11469
|
imageUrl: state.imageUrl
|
|
12008
11470
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React__namespace.default.createElement("div", {
|
|
12009
11471
|
id: "idmission-above-guides-content"
|
|
12010
11472
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React__namespace.default.createElement(ExitCaptureButton, {
|
|
12011
11473
|
onClick: onExit,
|
|
12012
|
-
className: (
|
|
11474
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.exitCaptureBtn
|
|
12013
11475
|
})), !overlayDismissed && (/*#__PURE__*/React__namespace.default.createElement(IdCaptureLoadingOverlay, {
|
|
12014
11476
|
key: "loading".concat(attempt),
|
|
12015
11477
|
mode: loadingOverlayMode,
|
|
@@ -12047,14 +11509,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
12047
11509
|
onRetryClick: onRetryClick,
|
|
12048
11510
|
colors: colors.success,
|
|
12049
11511
|
verbiage: verbiage.success,
|
|
12050
|
-
debugMode: debugMode
|
|
12051
|
-
initialBarcodeScore:
|
|
12052
|
-
// Show diagnostic info if recapture occurred (indicated by recaptureBarcodeScore being set)
|
|
12053
|
-
// If recapture occurred, initialBarcodeScore was set (even if it's 0, which is valid)
|
|
12054
|
-
state.recaptureBarcodeScore !== null ? state.initialBarcodeScore : undefined,
|
|
12055
|
-
recaptureBarcodeScore: state.recaptureBarcodeScore,
|
|
12056
|
-
initialCaptureBarcodeImage: state.initialCaptureBarcodeImage,
|
|
12057
|
-
recaptureBarcodeImage: state.recaptureBarcodeImage
|
|
11512
|
+
debugMode: debugMode
|
|
12058
11513
|
})));
|
|
12059
11514
|
};
|
|
12060
11515
|
function IdCaptureWizardWithProviders(_a) {
|