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