idmission-web-sdk 2.3.169-feature-barcode-recapture-9469f04 → 2.3.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +0 -6
- package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +1 -32
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureSuccess.d.ts +1 -7
- package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -21
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
- package/dist/contexts/AuthStateContext.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +233 -778
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +233 -778
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +233 -778
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
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')) {
|
|
@@ -4649,13 +4651,8 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4649
4651
|
if (!selectedVideoStreamId) return;
|
|
4650
4652
|
var srcObject = e.currentTarget.srcObject;
|
|
4651
4653
|
if (srcObject.id === selectedVideoStreamId) {
|
|
4652
|
-
var _a = e.currentTarget,
|
|
4653
|
-
videoWidth = _a.videoWidth,
|
|
4654
|
-
videoHeight = _a.videoHeight;
|
|
4655
4654
|
set({
|
|
4656
|
-
videoLoaded: true
|
|
4657
|
-
videoWidth: videoWidth,
|
|
4658
|
-
videoHeight: videoHeight
|
|
4655
|
+
videoLoaded: true
|
|
4659
4656
|
});
|
|
4660
4657
|
} else {
|
|
4661
4658
|
set({
|
|
@@ -4968,25 +4965,26 @@ var createCameraStore = function createCameraStore(config) {
|
|
|
4968
4965
|
};
|
|
4969
4966
|
var CameraStoreContext = /*#__PURE__*/createContext(undefined);
|
|
4970
4967
|
function CameraStoreProvider(_a) {
|
|
4968
|
+
var _b;
|
|
4971
4969
|
var children = _a.children,
|
|
4972
|
-
|
|
4973
|
-
requestAccessAutomatically =
|
|
4974
|
-
|
|
4975
|
-
preferIphoneContinuityCamera =
|
|
4976
|
-
|
|
4977
|
-
preferFrontFacingCamera =
|
|
4978
|
-
|
|
4979
|
-
maxVideoWidth =
|
|
4970
|
+
_c = _a.requestAccessAutomatically,
|
|
4971
|
+
requestAccessAutomatically = _c === void 0 ? true : _c,
|
|
4972
|
+
_d = _a.preferIphoneContinuityCamera,
|
|
4973
|
+
preferIphoneContinuityCamera = _d === void 0 ? true : _d,
|
|
4974
|
+
_e = _a.preferFrontFacingCamera,
|
|
4975
|
+
preferFrontFacingCamera = _e === void 0 ? false : _e,
|
|
4976
|
+
_f = _a.maxVideoWidth,
|
|
4977
|
+
maxVideoWidth = _f === void 0 ? 1920 : _f,
|
|
4980
4978
|
maxFps = _a.maxFps,
|
|
4981
4979
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
4982
4980
|
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
4983
4981
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
4984
|
-
|
|
4985
|
-
requireMicrophoneAccess =
|
|
4986
|
-
|
|
4987
|
-
classNames =
|
|
4988
|
-
|
|
4989
|
-
verbiage =
|
|
4982
|
+
_g = _a.requireMicrophoneAccess,
|
|
4983
|
+
requireMicrophoneAccess = _g === void 0 ? false : _g,
|
|
4984
|
+
_h = _a.classNames,
|
|
4985
|
+
classNames = _h === void 0 ? {} : _h,
|
|
4986
|
+
_j = _a.verbiage,
|
|
4987
|
+
verbiage = _j === void 0 ? {} : _j;
|
|
4990
4988
|
var videoRef = useRef(null);
|
|
4991
4989
|
var store = useRef(undefined);
|
|
4992
4990
|
store.current || (store.current = createCameraStore({
|
|
@@ -5000,6 +4998,16 @@ function CameraStoreProvider(_a) {
|
|
|
5000
4998
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
5001
4999
|
requireMicrophoneAccess: requireMicrophoneAccess
|
|
5002
5000
|
}));
|
|
5001
|
+
var _k = (_b = videoRef.current) !== null && _b !== void 0 ? _b : {},
|
|
5002
|
+
videoWidth = _k.videoWidth,
|
|
5003
|
+
videoHeight = _k.videoHeight;
|
|
5004
|
+
useEffect(function () {
|
|
5005
|
+
var _a;
|
|
5006
|
+
(_a = store.current) === null || _a === void 0 ? void 0 : _a.setState({
|
|
5007
|
+
videoWidth: videoWidth,
|
|
5008
|
+
videoHeight: videoHeight
|
|
5009
|
+
});
|
|
5010
|
+
}, [videoWidth, videoHeight]);
|
|
5003
5011
|
useEffect(function () {
|
|
5004
5012
|
var _a, _b, _c;
|
|
5005
5013
|
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
@@ -6078,15 +6086,6 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
|
|
|
6078
6086
|
getBestBarcode: function getBestBarcode() {
|
|
6079
6087
|
return null;
|
|
6080
6088
|
},
|
|
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
6089
|
requiredDocumentType: 'none',
|
|
6091
6090
|
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
6092
6091
|
return null;
|
|
@@ -6146,14 +6145,6 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6146
6145
|
var bestBarcodeScore = useRef(0);
|
|
6147
6146
|
var stopDetection = useRef(0);
|
|
6148
6147
|
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
6148
|
var _h = useState('none'),
|
|
6158
6149
|
requiredDocumentType = _h[0],
|
|
6159
6150
|
setRequiredDocumentType = _h[1];
|
|
@@ -6178,10 +6169,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6178
6169
|
var _this = this;
|
|
6179
6170
|
onDocumentDetected(function (prediction) {
|
|
6180
6171
|
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 (
|
|
6172
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, pdf417PredictionTime, pdf417PredictionScore, pdf417PredictionThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold, barcodeAnalysisResult;
|
|
6173
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6174
|
+
return __generator(this, function (_h) {
|
|
6175
|
+
switch (_h.label) {
|
|
6185
6176
|
case 0:
|
|
6186
6177
|
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
6187
6178
|
stopDetectionAtStart = stopDetection.current;
|
|
@@ -6195,9 +6186,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6195
6186
|
prediction.singlePageDetectionThresholdMet = false;
|
|
6196
6187
|
}
|
|
6197
6188
|
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];
|
|
6189
|
+
if (!(isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable)) return [3 /*break*/, 2];
|
|
6201
6190
|
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
6202
6191
|
if (focusPrediction) {
|
|
6203
6192
|
focusScore = focusPrediction.score;
|
|
@@ -6220,7 +6209,7 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6220
6209
|
if (!(enableBarcodeReadabilityModel && prediction.bestDocument && prediction.bestPDF417 && croppedDocumentCanvas.current)) return [3 /*break*/, 2];
|
|
6221
6210
|
return [4 /*yield*/, analyzeBarcodeReadability(prediction, lastPredictionCanvas.current, croppedDocumentCanvas.current, bestBarcodeCanvas.current, bestBarcodeScore.current)];
|
|
6222
6211
|
case 1:
|
|
6223
|
-
barcodeAnalysisResult =
|
|
6212
|
+
barcodeAnalysisResult = _h.sent();
|
|
6224
6213
|
pdf417PredictionTime = barcodeAnalysisResult.pdf417PredictionTime;
|
|
6225
6214
|
pdf417PredictionScore = barcodeAnalysisResult.pdf417PredictionScore;
|
|
6226
6215
|
pdf417PredictionThresholdMet = barcodeAnalysisResult.pdf417PredictionThresholdMet;
|
|
@@ -6230,61 +6219,15 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6230
6219
|
if (barcodeAnalysisResult.newBestBarcodeDetails) {
|
|
6231
6220
|
bestBarcodeDetails.current = barcodeAnalysisResult.newBestBarcodeDetails;
|
|
6232
6221
|
}
|
|
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;
|
|
6222
|
+
_h.label = 2;
|
|
6248
6223
|
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
6224
|
/**
|
|
6282
6225
|
* @note
|
|
6283
6226
|
* This should ALWAYS be called.
|
|
6284
6227
|
* Do not return early from this function unless
|
|
6285
6228
|
* lastPredictionCanvas.current is not set
|
|
6286
6229
|
*/
|
|
6287
|
-
(
|
|
6230
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
6288
6231
|
focusScore: focusScore,
|
|
6289
6232
|
focusPredictionTime: focusPredictionTime,
|
|
6290
6233
|
focusThresholdMet: focusThresholdMet,
|
|
@@ -6317,58 +6260,19 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6317
6260
|
canvas: bestBarcodeCanvas.current
|
|
6318
6261
|
});
|
|
6319
6262
|
}, []);
|
|
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
6263
|
var _j = useState(0),
|
|
6351
6264
|
canvasKey = _j[0],
|
|
6352
6265
|
setCanvasKey = _j[1];
|
|
6353
6266
|
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
6267
|
stopDetection.current += 1;
|
|
6268
|
+
setCanvasKey(function (n) {
|
|
6269
|
+
return n + 1;
|
|
6270
|
+
});
|
|
6360
6271
|
clearDocumentDetectionLastPredictionCanvas();
|
|
6361
6272
|
bestFrameDetails.current = null;
|
|
6362
6273
|
bestFocusScore.current = 0;
|
|
6363
6274
|
bestBarcodeScore.current = 0;
|
|
6364
6275
|
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
6276
|
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
6373
6277
|
useEffect(function () {
|
|
6374
6278
|
if (requiredDocumentType) resetBestFrame();
|
|
@@ -6434,13 +6338,10 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6434
6338
|
bestFrameDetails: bestFrameDetails,
|
|
6435
6339
|
bestBarcodeDetails: bestBarcodeDetails,
|
|
6436
6340
|
getBestBarcode: getBestBarcode,
|
|
6437
|
-
startBarcodeRecapturePhase: startBarcodeRecapturePhase,
|
|
6438
|
-
getInitialCaptureBestBarcode: getInitialCaptureBestBarcode,
|
|
6439
|
-
getRecaptureBestBarcode: getRecaptureBestBarcode,
|
|
6440
6341
|
requiredDocumentType: requiredDocumentType,
|
|
6441
6342
|
setRequiredDocumentType: setRequiredDocumentType
|
|
6442
6343
|
};
|
|
6443
|
-
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode,
|
|
6344
|
+
}, [ready, modelDownloadProgress, modelLoadState, modelWarmingStartedAt, modelError, startDocumentDetection, stopDocumentDetection, load, thresholds, setThresholds, documentDetectionBoundaries, setDocumentDetectionBoundaries, onPredictionMade, detectionTime, focusPredictionTime, barcodeReadabilityPredictionTime, getBestFrame, resetBestFrame, getBestBarcode, requiredDocumentType]);
|
|
6444
6345
|
return /*#__PURE__*/React__default.createElement(IdCaptureModelsContext.Provider, {
|
|
6445
6346
|
value: value
|
|
6446
6347
|
}, /*#__PURE__*/React__default.createElement(InvisibleCanvasContainer, null, /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
@@ -6452,12 +6353,6 @@ function IdCaptureModelsProviderInner(_a) {
|
|
|
6452
6353
|
}), /*#__PURE__*/React__default.createElement(InvisibleCanvas, {
|
|
6453
6354
|
key: "cd-".concat(canvasKey),
|
|
6454
6355
|
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
6356
|
})), children);
|
|
6462
6357
|
}
|
|
6463
6358
|
function IdCaptureModelsProvider(_a) {
|
|
@@ -6552,8 +6447,6 @@ var initialState$5 = {
|
|
|
6552
6447
|
singlePageDetectionThresholdMet: false,
|
|
6553
6448
|
focusScore: 0,
|
|
6554
6449
|
focusThresholdMet: false,
|
|
6555
|
-
pdf417PredictionScore: 0,
|
|
6556
|
-
pdf417PredictionThresholdMet: false,
|
|
6557
6450
|
isGoodFrame: false,
|
|
6558
6451
|
goodFramesCount: 0,
|
|
6559
6452
|
goodFramesThreshold: 3,
|
|
@@ -6575,42 +6468,30 @@ var initialState$5 = {
|
|
|
6575
6468
|
uploadingDocumentsType: null,
|
|
6576
6469
|
operationStartedAt: null,
|
|
6577
6470
|
captureStartedAt: null,
|
|
6578
|
-
barcodeRecaptureStartedAt: null,
|
|
6579
|
-
initialBarcodeScore: 0,
|
|
6580
|
-
recaptureBarcodeScore: null,
|
|
6581
|
-
barcodeRecaptureThreshold: 0,
|
|
6582
|
-
barcodeRecaptureTimeoutMs: 5000,
|
|
6583
|
-
initialCaptureBarcodeImage: null,
|
|
6584
|
-
recaptureBarcodeImage: null,
|
|
6585
6471
|
dispatch: function dispatch() {
|
|
6586
6472
|
return null;
|
|
6587
6473
|
}
|
|
6588
6474
|
};
|
|
6589
6475
|
var _reducer = function reducer(state, action) {
|
|
6590
6476
|
var _a;
|
|
6591
|
-
var _b, _c;
|
|
6592
6477
|
switch (action.type) {
|
|
6593
6478
|
case 'configureWizard':
|
|
6594
6479
|
{
|
|
6595
|
-
var
|
|
6596
|
-
captureRequirement =
|
|
6597
|
-
precapturedDocuments =
|
|
6598
|
-
allowSinglePageIdCapture =
|
|
6599
|
-
allowIdCardBackToFrontCapture =
|
|
6600
|
-
enableOverrideWrongDocumentTypeDialog =
|
|
6601
|
-
allowOverrideWrongDocumentTypeAfterMs =
|
|
6602
|
-
allowUploadingDocumentsFromStorage =
|
|
6603
|
-
barcodeRecaptureThreshold = _d.barcodeRecaptureThreshold,
|
|
6604
|
-
barcodeRecaptureTimeoutMs = _d.barcodeRecaptureTimeoutMs;
|
|
6480
|
+
var _b = action.payload,
|
|
6481
|
+
captureRequirement = _b.captureRequirement,
|
|
6482
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
6483
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
6484
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
6485
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
6486
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
6487
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
6605
6488
|
var newState = _assign(_assign({}, state), {
|
|
6606
6489
|
captureRequirement: captureRequirement,
|
|
6607
6490
|
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
6608
6491
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
6609
6492
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
6610
6493
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
6611
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6612
|
-
barcodeRecaptureThreshold: barcodeRecaptureThreshold !== null && barcodeRecaptureThreshold !== void 0 ? barcodeRecaptureThreshold : 0,
|
|
6613
|
-
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs !== null && barcodeRecaptureTimeoutMs !== void 0 ? barcodeRecaptureTimeoutMs : 5000
|
|
6494
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
6614
6495
|
});
|
|
6615
6496
|
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
6616
6497
|
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
@@ -6667,28 +6548,26 @@ var _reducer = function reducer(state, action) {
|
|
|
6667
6548
|
});
|
|
6668
6549
|
case 'objectsDetected':
|
|
6669
6550
|
{
|
|
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;
|
|
6551
|
+
var _c = action.payload.prediction,
|
|
6552
|
+
detectedObjects = _c.detectedObjects,
|
|
6553
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
6554
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
6555
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
6556
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
6557
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
6558
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
6559
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
6560
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
6561
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
6562
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
6563
|
+
bestDocument = _c.bestDocument,
|
|
6564
|
+
documentInBounds = _c.documentInBounds,
|
|
6565
|
+
documentTooClose = _c.documentTooClose,
|
|
6566
|
+
documentIsStable = _c.documentIsStable,
|
|
6567
|
+
focusScore = _c.focusScore,
|
|
6568
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
6569
|
+
frameWidth = _c.frameWidth,
|
|
6570
|
+
frameHeight = _c.frameHeight;
|
|
6692
6571
|
var frameCapturedAt = new Date();
|
|
6693
6572
|
var frameCaptureRate = 0;
|
|
6694
6573
|
var goodFramesThreshold = state.goodFramesThreshold;
|
|
@@ -6768,8 +6647,6 @@ var _reducer = function reducer(state, action) {
|
|
|
6768
6647
|
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
6769
6648
|
focusScore: focusScore,
|
|
6770
6649
|
focusThresholdMet: focusThresholdMet,
|
|
6771
|
-
pdf417PredictionScore: pdf417PredictionScore,
|
|
6772
|
-
pdf417PredictionThresholdMet: pdf417PredictionThresholdMet,
|
|
6773
6650
|
isGoodFrame: isGoodFrame,
|
|
6774
6651
|
goodFramesCount: goodFramesCount,
|
|
6775
6652
|
goodFramesThreshold: goodFramesThreshold,
|
|
@@ -6823,18 +6700,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6823
6700
|
});
|
|
6824
6701
|
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
6825
6702
|
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
|
-
}
|
|
6703
|
+
newState.captureState = 'complete';
|
|
6838
6704
|
} else {
|
|
6839
6705
|
newState.requestedDocumentType = remainingRequirements[0];
|
|
6840
6706
|
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
@@ -6861,8 +6727,8 @@ var _reducer = function reducer(state, action) {
|
|
|
6861
6727
|
case 'documentsCaptured':
|
|
6862
6728
|
{
|
|
6863
6729
|
var newState = _assign({}, state);
|
|
6864
|
-
for (var
|
|
6865
|
-
var doc =
|
|
6730
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
6731
|
+
var doc = _e[_d];
|
|
6866
6732
|
newState = _reducer(newState, {
|
|
6867
6733
|
type: 'documentCaptured',
|
|
6868
6734
|
payload: doc
|
|
@@ -6912,49 +6778,13 @@ var _reducer = function reducer(state, action) {
|
|
|
6912
6778
|
requestedDocumentType: requestedDocumentType
|
|
6913
6779
|
});
|
|
6914
6780
|
}
|
|
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
6781
|
case 'resetWizard':
|
|
6940
6782
|
return _assign(_assign({}, initialState$5), {
|
|
6941
6783
|
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
6784
|
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6949
|
-
barcodeRecaptureThreshold: state.barcodeRecaptureThreshold,
|
|
6950
|
-
barcodeRecaptureTimeoutMs: state.barcodeRecaptureTimeoutMs,
|
|
6951
|
-
// Reset capture-specific state
|
|
6952
6785
|
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
recaptureBarcodeScore: null,
|
|
6956
|
-
initialCaptureBarcodeImage: null,
|
|
6957
|
-
recaptureBarcodeImage: null
|
|
6786
|
+
captureRequirement: state.captureRequirement,
|
|
6787
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
6958
6788
|
});
|
|
6959
6789
|
default:
|
|
6960
6790
|
return state;
|
|
@@ -7386,36 +7216,36 @@ function extractSize(entry, sizeType) {
|
|
|
7386
7216
|
}
|
|
7387
7217
|
|
|
7388
7218
|
var IdCapture = function IdCapture(_a) {
|
|
7389
|
-
var _b, _c, _d, _e, _f, _g
|
|
7219
|
+
var _b, _c, _d, _e, _f, _g;
|
|
7390
7220
|
var requiredDocumentType = _a.requiredDocumentType,
|
|
7391
|
-
|
|
7392
|
-
thresholds =
|
|
7221
|
+
_h = _a.thresholds,
|
|
7222
|
+
thresholds = _h === void 0 ? defaultIdCaptureThresholds : _h,
|
|
7393
7223
|
guidanceMessage = _a.guidanceMessage,
|
|
7394
7224
|
guidanceSatisfied = _a.guidanceSatisfied,
|
|
7395
7225
|
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 =
|
|
7226
|
+
_j = _a.classNames,
|
|
7227
|
+
classNames = _j === void 0 ? {} : _j,
|
|
7228
|
+
_k = _a.colors,
|
|
7229
|
+
colors = _k === void 0 ? {} : _k,
|
|
7230
|
+
_l = _a.verbiage,
|
|
7231
|
+
rawVerbiage = _l === void 0 ? {} : _l,
|
|
7232
|
+
_m = _a.debugMode,
|
|
7233
|
+
debugMode = _m === void 0 ? false : _m;
|
|
7234
|
+
var _o = useResizeObserver(),
|
|
7235
|
+
ref = _o.ref,
|
|
7236
|
+
_p = _o.width,
|
|
7237
|
+
width = _p === void 0 ? 1 : _p,
|
|
7238
|
+
_q = _o.height,
|
|
7239
|
+
height = _q === void 0 ? 1 : _q;
|
|
7410
7240
|
var state = useIdCaptureStore();
|
|
7411
7241
|
var isRearFacing = useCameraStore().isRearFacing;
|
|
7412
|
-
var
|
|
7413
|
-
modelsReady =
|
|
7414
|
-
setThresholds =
|
|
7415
|
-
detectionTime =
|
|
7416
|
-
focusPredictionTime =
|
|
7417
|
-
getBestFrame =
|
|
7418
|
-
getBestBarcode =
|
|
7242
|
+
var _r = useIdCaptureModelsContext(),
|
|
7243
|
+
modelsReady = _r.ready,
|
|
7244
|
+
setThresholds = _r.setThresholds,
|
|
7245
|
+
detectionTime = _r.detectionTime,
|
|
7246
|
+
focusPredictionTime = _r.focusPredictionTime,
|
|
7247
|
+
getBestFrame = _r.getBestFrame,
|
|
7248
|
+
getBestBarcode = _r.getBestBarcode;
|
|
7419
7249
|
useEffect(function () {
|
|
7420
7250
|
return dispatchIdCaptureAction({
|
|
7421
7251
|
type: 'captureInitialized'
|
|
@@ -7440,7 +7270,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7440
7270
|
}
|
|
7441
7271
|
});
|
|
7442
7272
|
}, [height, width]);
|
|
7443
|
-
var shouldCapture = state.
|
|
7273
|
+
var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
|
|
7444
7274
|
useEffect(function () {
|
|
7445
7275
|
if (!shouldCapture) return;
|
|
7446
7276
|
dispatchIdCaptureAction({
|
|
@@ -7540,18 +7370,13 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7540
7370
|
"$flipX": !isRearFacing,
|
|
7541
7371
|
scaling: debugScalingDetails
|
|
7542
7372
|
}, 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
7373
|
return /*#__PURE__*/React__default.createElement(IdCaptureDetectedObjectDebugBox, {
|
|
7548
7374
|
key: i,
|
|
7549
7375
|
obj: obj,
|
|
7550
7376
|
scaling: debugScalingDetails,
|
|
7551
|
-
flipX: !isRearFacing
|
|
7552
|
-
color: color
|
|
7377
|
+
flipX: !isRearFacing
|
|
7553
7378
|
});
|
|
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.
|
|
7379
|
+
}))), 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
7380
|
};
|
|
7556
7381
|
var timeSince = function timeSince(t) {
|
|
7557
7382
|
if (!t) return 0;
|
|
@@ -8431,11 +8256,11 @@ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templa
|
|
|
8431
8256
|
var _a, _b, _c, _d;
|
|
8432
8257
|
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
8258
|
});
|
|
8434
|
-
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$
|
|
8259
|
+
var ProgressIndicator$1 = styled(LoadingOverlayProgressIndicator)(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) {
|
|
8435
8260
|
var _a, _b, _c, _d;
|
|
8436
8261
|
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
8262
|
});
|
|
8438
|
-
var ContinueButton$1 = styled(LoaderButton)(templateObject_8$
|
|
8263
|
+
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
8264
|
var _a, _b, _c, _d, _e, _f;
|
|
8440
8265
|
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
8266
|
}, function (props) {
|
|
@@ -8454,7 +8279,7 @@ var ContinueButton$1 = styled(LoaderButton)(templateObject_8$5 || (templateObjec
|
|
|
8454
8279
|
var _a, _b, _c, _d;
|
|
8455
8280
|
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
8281
|
});
|
|
8457
|
-
var templateObject_1$F, templateObject_2$B, templateObject_3$p, templateObject_4$j, templateObject_5$e, templateObject_6$9, templateObject_7$
|
|
8282
|
+
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
8283
|
|
|
8459
8284
|
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
8285
|
var ContinuityCameraCheckbox = styled.input(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
|
|
@@ -8641,14 +8466,6 @@ var FlexCard = styled(Card)(templateObject_2$z || (templateObject_2$z = __makeTe
|
|
|
8641
8466
|
var templateObject_1$D, templateObject_2$z;
|
|
8642
8467
|
|
|
8643
8468
|
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
8469
|
var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
8653
8470
|
var capturedDocuments = _a.capturedDocuments,
|
|
8654
8471
|
onSubmitClick = _a.onSubmitClick,
|
|
@@ -8660,22 +8477,8 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8660
8477
|
_d = _a.verbiage,
|
|
8661
8478
|
rawVerbiage = _d === void 0 ? {} : _d,
|
|
8662
8479
|
_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;
|
|
8480
|
+
debugMode = _e === void 0 ? false : _e;
|
|
8668
8481
|
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
8482
|
var verbiage = useTranslations(rawVerbiage, {
|
|
8680
8483
|
headingText: 'ID Capture Successful',
|
|
8681
8484
|
retryText: 'Retry',
|
|
@@ -8695,7 +8498,6 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8695
8498
|
}, /*#__PURE__*/React__default.createElement(ImageRow, {
|
|
8696
8499
|
className: classNames.imageRow
|
|
8697
8500
|
}, imageDisplayOrder.map(function (name) {
|
|
8698
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8699
8501
|
var doc = capturedDocuments[name];
|
|
8700
8502
|
if (!doc) return null;
|
|
8701
8503
|
return /*#__PURE__*/React__default.createElement(ImageCol$1, {
|
|
@@ -8705,57 +8507,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
|
|
|
8705
8507
|
image: doc,
|
|
8706
8508
|
className: classNames.image,
|
|
8707
8509
|
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))))))));
|
|
8510
|
+
}), 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
8511
|
}))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
|
|
8760
8512
|
className: classNames.buttonsRow
|
|
8761
8513
|
}, /*#__PURE__*/React__default.createElement(WideButton, {
|
|
@@ -8778,91 +8530,8 @@ var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$y || (templ
|
|
|
8778
8530
|
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
8531
|
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
8532
|
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;
|
|
8533
|
+
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"])));
|
|
8534
|
+
var templateObject_1$C, templateObject_2$y, templateObject_3$o, templateObject_4$i, templateObject_5$d, templateObject_6$8;
|
|
8866
8535
|
|
|
8867
8536
|
function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
|
|
8868
8537
|
var _this = this;
|
|
@@ -11392,7 +11061,7 @@ var lastDocumentDetectedAtDefaults = {
|
|
|
11392
11061
|
none: null
|
|
11393
11062
|
};
|
|
11394
11063
|
var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
11395
|
-
var _b, _c, _d, _e, _f
|
|
11064
|
+
var _b, _c, _d, _e, _f;
|
|
11396
11065
|
var onLoadingStarted = _a.onLoadingStarted,
|
|
11397
11066
|
onLoadingProgress = _a.onLoadingProgress,
|
|
11398
11067
|
onLoadingCompleted = _a.onLoadingCompleted,
|
|
@@ -11403,115 +11072,86 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11403
11072
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
11404
11073
|
onDocumentCaptured = _a.onDocumentCaptured,
|
|
11405
11074
|
onDocumentDetected = _a.onDocumentDetected,
|
|
11406
|
-
|
|
11407
|
-
documentDetectionThrottleMs =
|
|
11408
|
-
|
|
11409
|
-
loadingOverlayMode =
|
|
11075
|
+
_g = _a.documentDetectionThrottleMs,
|
|
11076
|
+
documentDetectionThrottleMs = _g === void 0 ? 0 : _g,
|
|
11077
|
+
_h = _a.loadingOverlayMode,
|
|
11078
|
+
loadingOverlayMode = _h === void 0 ? 'default' : _h,
|
|
11410
11079
|
customOverlayContent = _a.customOverlayContent,
|
|
11411
11080
|
precapturedDocuments = _a.precapturedDocuments,
|
|
11412
|
-
|
|
11413
|
-
captureRequirement =
|
|
11414
|
-
|
|
11415
|
-
allowSinglePageIdCapture =
|
|
11416
|
-
|
|
11417
|
-
separateIdCardCaptureSequence =
|
|
11418
|
-
|
|
11419
|
-
thresholds =
|
|
11420
|
-
|
|
11421
|
-
skipSuccessScreen =
|
|
11081
|
+
_j = _a.captureRequirement,
|
|
11082
|
+
captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
|
|
11083
|
+
_k = _a.allowSinglePageIdCapture,
|
|
11084
|
+
allowSinglePageIdCapture = _k === void 0 ? false : _k,
|
|
11085
|
+
_l = _a.separateIdCardCaptureSequence,
|
|
11086
|
+
separateIdCardCaptureSequence = _l === void 0 ? false : _l,
|
|
11087
|
+
_m = _a.thresholds,
|
|
11088
|
+
thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
|
|
11089
|
+
_o = _a.skipSuccessScreen,
|
|
11090
|
+
skipSuccessScreen = _o === void 0 ? false : _o,
|
|
11422
11091
|
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;
|
|
11092
|
+
_p = _a.releaseCameraAccessOnExit,
|
|
11093
|
+
releaseCameraAccessOnExit = _p === void 0 ? true : _p,
|
|
11094
|
+
_q = _a.guideType,
|
|
11095
|
+
guideType = _q === void 0 ? 'fit' : _q,
|
|
11096
|
+
_r = _a.portraitGuidesOnMobile,
|
|
11097
|
+
portraitGuidesOnMobile = _r === void 0 ? true : _r,
|
|
11098
|
+
_s = _a.rotateLoadingOverlayImageWhenPortrait,
|
|
11099
|
+
rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
|
|
11100
|
+
_t = _a.silentFallback,
|
|
11101
|
+
silentFallback = _t === void 0 ? false : _t,
|
|
11102
|
+
_u = _a.forceFallbackMode,
|
|
11103
|
+
forceFallbackMode = _u === void 0 ? false : _u,
|
|
11104
|
+
_v = _a.allowIdCardBackToFrontCapture,
|
|
11105
|
+
allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
|
|
11106
|
+
_w = _a.enableOverrideWrongDocumentTypeDialog,
|
|
11107
|
+
enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
|
|
11108
|
+
_x = _a.allowOverrideWrongDocumentTypeAfterMs,
|
|
11109
|
+
allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
|
|
11110
|
+
_y = _a.allowUploadingDocumentsFromStorage,
|
|
11111
|
+
allowUploadingDocumentsFromStorage = _y === void 0 ? false : _y,
|
|
11112
|
+
_z = _a.guideImages,
|
|
11113
|
+
guideImages = _z === void 0 ? defaultIdCaptureGuideImages : _z,
|
|
11114
|
+
_0 = _a.documentEdgeDistancePct,
|
|
11115
|
+
documentEdgeDistancePct = _0 === void 0 ? 0 : _0,
|
|
11116
|
+
_1 = _a.assets,
|
|
11117
|
+
assets = _1 === void 0 ? {} : _1,
|
|
11118
|
+
_2 = _a.classNames,
|
|
11119
|
+
classNames = _2 === void 0 ? {} : _2,
|
|
11120
|
+
_3 = _a.colors,
|
|
11121
|
+
colors = _3 === void 0 ? {} : _3,
|
|
11122
|
+
_4 = _a.verbiage,
|
|
11123
|
+
verbiage = _4 === void 0 ? {} : _4,
|
|
11124
|
+
_5 = _a.debugMode,
|
|
11125
|
+
debugMode = _5 === void 0 ? false : _5;
|
|
11465
11126
|
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]);
|
|
11127
|
+
var _6 = useCameraStore(),
|
|
11128
|
+
cameraAccessDenied = _6.cameraAccessDenied,
|
|
11129
|
+
requestCameraAccess = _6.requestCameraAccess,
|
|
11130
|
+
releaseCameraAccess = _6.releaseCameraAccess;
|
|
11131
|
+
var _7 = useState(false),
|
|
11132
|
+
overlayDismissed = _7[0],
|
|
11133
|
+
setOverlayDismissed = _7[1];
|
|
11134
|
+
var _8 = useSubmissionContext(),
|
|
11135
|
+
submissionStatus = _8.submissionStatus,
|
|
11136
|
+
setIdFrontImage = _8.setIdFrontImage,
|
|
11137
|
+
setIdBackImage = _8.setIdBackImage,
|
|
11138
|
+
setPassportImage = _8.setPassportImage,
|
|
11139
|
+
setIdFrontIrImage = _8.setIdFrontIrImage,
|
|
11140
|
+
setIdBackIrImage = _8.setIdBackIrImage,
|
|
11141
|
+
setIdFrontUvImage = _8.setIdFrontUvImage,
|
|
11142
|
+
setIdBackUvImage = _8.setIdBackUvImage,
|
|
11143
|
+
setIdBarcodeImage = _8.setIdBarcodeImage,
|
|
11144
|
+
logIdFrontCaptureAttempt = _8.logIdFrontCaptureAttempt,
|
|
11145
|
+
logIdBackCaptureAttempt = _8.logIdBackCaptureAttempt;
|
|
11146
|
+
var _9 = useIdCaptureModelsContext(),
|
|
11147
|
+
start = _9.start,
|
|
11148
|
+
stop = _9.stop,
|
|
11149
|
+
onPredictionMade = _9.onPredictionMade,
|
|
11150
|
+
setRequiredDocumentType = _9.setRequiredDocumentType,
|
|
11151
|
+
modelError = _9.modelError,
|
|
11152
|
+
resetBestFrame = _9.resetBestFrame,
|
|
11153
|
+
documentDetectionBoundaries = _9.documentDetectionBoundaries,
|
|
11154
|
+
setDocumentDetectionBoundaries = _9.setDocumentDetectionBoundaries;
|
|
11515
11155
|
useEffect(function () {
|
|
11516
11156
|
dispatchIdCaptureAction({
|
|
11517
11157
|
type: 'configureWizard',
|
|
@@ -11522,12 +11162,10 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11522
11162
|
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
|
|
11523
11163
|
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
11524
11164
|
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
11525
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11526
|
-
barcodeRecaptureThreshold: barcodeRecaptureThreshold,
|
|
11527
|
-
barcodeRecaptureTimeoutMs: barcodeRecaptureTimeoutMs
|
|
11165
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
11528
11166
|
}
|
|
11529
11167
|
});
|
|
11530
|
-
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage,
|
|
11168
|
+
}, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, allowUploadingDocumentsFromStorage, captureRequirement, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
|
|
11531
11169
|
useEffect(function () {
|
|
11532
11170
|
var _a;
|
|
11533
11171
|
var desiredEdgeDistance = documentEdgeDistancePct !== null && documentEdgeDistancePct !== void 0 ? documentEdgeDistancePct : 0;
|
|
@@ -11539,10 +11177,8 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11539
11177
|
}, [documentDetectionBoundaries, documentEdgeDistancePct, setDocumentDetectionBoundaries]);
|
|
11540
11178
|
var documentCount = Object.keys(state.capturedDocuments).length;
|
|
11541
11179
|
useEffect(function () {
|
|
11542
|
-
// Skip reset during barcode recapture - the recapture flow manages its own canvas state
|
|
11543
|
-
if (state.captureState === 'requestingBetterBarcode') return;
|
|
11544
11180
|
if (documentCount) resetBestFrame();
|
|
11545
|
-
}, [documentCount, resetBestFrame
|
|
11181
|
+
}, [documentCount, resetBestFrame]);
|
|
11546
11182
|
var isFallbackMode = forceFallbackMode || modelError;
|
|
11547
11183
|
var lastDocumentDetectedAt = useRef(_assign({}, lastDocumentDetectedAtDefaults));
|
|
11548
11184
|
var logCaptureMetadata = useCallback(function (metadata) {
|
|
@@ -11561,62 +11197,24 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11561
11197
|
}
|
|
11562
11198
|
}, [isFallbackMode, logIdBackCaptureAttempt, logIdFrontCaptureAttempt]);
|
|
11563
11199
|
useEffect(function startModelsWhenCapturing() {
|
|
11564
|
-
if (!overlayDismissed ||
|
|
11200
|
+
if (!overlayDismissed || state.captureState !== 'capturing') return;
|
|
11565
11201
|
dispatchIdCaptureAction({
|
|
11566
11202
|
type: 'captureStarted'
|
|
11567
11203
|
});
|
|
11568
11204
|
start();
|
|
11569
|
-
}, [
|
|
11205
|
+
}, [overlayDismissed, start, state.captureState]);
|
|
11570
11206
|
useEffect(function () {
|
|
11571
11207
|
onPredictionMade(function (prediction) {
|
|
11572
|
-
var _a
|
|
11573
|
-
var
|
|
11574
|
-
captureState =
|
|
11575
|
-
requestedDocumentType =
|
|
11208
|
+
var _a;
|
|
11209
|
+
var _b = useIdCaptureStore.getState(),
|
|
11210
|
+
captureState = _b.captureState,
|
|
11211
|
+
requestedDocumentType = _b.requestedDocumentType;
|
|
11576
11212
|
var k = "".concat(requestedDocumentType, "DetectionThresholdMet");
|
|
11577
11213
|
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
|
-
}
|
|
11214
|
+
if (captureState === 'capturing') {
|
|
11617
11215
|
if (prediction.detectedDocumentType !== 'none') {
|
|
11618
11216
|
var now = Date.now();
|
|
11619
|
-
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((
|
|
11217
|
+
if (!lastDocumentDetectedAt.current[prediction.detectedDocumentType] || documentDetectionThrottleMs && now - ((_a = lastDocumentDetectedAt.current[prediction.detectedDocumentType]) !== null && _a !== void 0 ? _a : 0) > documentDetectionThrottleMs) {
|
|
11620
11218
|
lastDocumentDetectedAt.current[prediction.detectedDocumentType] = now;
|
|
11621
11219
|
onDocumentDetected === null || onDocumentDetected === void 0 ? void 0 : onDocumentDetected(prediction.detectedDocumentType);
|
|
11622
11220
|
}
|
|
@@ -11634,7 +11232,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11634
11232
|
});
|
|
11635
11233
|
}
|
|
11636
11234
|
});
|
|
11637
|
-
}, [
|
|
11235
|
+
}, [documentDetectionThrottleMs, onDocumentDetected, onPredictionMade, resetBestFrame]);
|
|
11638
11236
|
useEffect(function () {
|
|
11639
11237
|
if (state.captureState === 'complete') stop();
|
|
11640
11238
|
}, [state.captureState, stop]);
|
|
@@ -11689,9 +11287,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11689
11287
|
type: 'resetWizard'
|
|
11690
11288
|
});
|
|
11691
11289
|
}, []);
|
|
11692
|
-
var
|
|
11693
|
-
attempt =
|
|
11694
|
-
setAttempt =
|
|
11290
|
+
var _10 = useState(0),
|
|
11291
|
+
attempt = _10[0],
|
|
11292
|
+
setAttempt = _10[1];
|
|
11695
11293
|
var onExit = useCallback(function () {
|
|
11696
11294
|
releaseCameraAccess();
|
|
11697
11295
|
setOverlayDismissed(false);
|
|
@@ -11717,25 +11315,20 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11717
11315
|
});
|
|
11718
11316
|
}
|
|
11719
11317
|
}, [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
11318
|
var idCaptureVerbiages = {
|
|
11724
11319
|
idCardFront: useTranslations(verbiage.idCardFront, {
|
|
11725
11320
|
instructionText: 'Scan the front of ID',
|
|
11726
11321
|
processingIdCardText: "ID card ".concat('idCardFront' in state.capturedDocuments ? 'front' : 'back', " captured.")
|
|
11727
11322
|
}),
|
|
11728
11323
|
idCardBack: useTranslations(verbiage.idCardBack, {
|
|
11729
|
-
instructionText:
|
|
11324
|
+
instructionText: 'Scan the back of ID'
|
|
11730
11325
|
}),
|
|
11731
11326
|
passport: useTranslations(verbiage.passport, {
|
|
11732
11327
|
instructionText: 'Scan the ID page of passport'
|
|
11733
11328
|
})
|
|
11734
11329
|
};
|
|
11735
11330
|
var theme = useTheme();
|
|
11736
|
-
|
|
11737
|
-
var verbiageKey = state.captureState === 'requestingBetterBarcode' ? 'idCardBack' : state.requestedDocumentType;
|
|
11738
|
-
var idCaptureVerbiage = idCaptureVerbiages[verbiageKey];
|
|
11331
|
+
var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
|
|
11739
11332
|
useEffect(function () {
|
|
11740
11333
|
if (separateIdCardCaptureSequence) return;
|
|
11741
11334
|
if (state.captureState !== 'requestingFlip') return;
|
|
@@ -11749,130 +11342,6 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11749
11342
|
clearTimeout(t);
|
|
11750
11343
|
};
|
|
11751
11344
|
}, [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
11345
|
useEffect(function () {
|
|
11877
11346
|
if (state.requestedDocumentType === 'idCardFront') {
|
|
11878
11347
|
if (captureRequirement === 'idCardOrPassport') {
|
|
@@ -11911,9 +11380,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11911
11380
|
});
|
|
11912
11381
|
});
|
|
11913
11382
|
}, []);
|
|
11914
|
-
var
|
|
11915
|
-
progressStarted =
|
|
11916
|
-
setProgressStarted =
|
|
11383
|
+
var _11 = useState(false),
|
|
11384
|
+
progressStarted = _11[0],
|
|
11385
|
+
setProgressStarted = _11[1];
|
|
11917
11386
|
useEffect(function () {
|
|
11918
11387
|
if (state.captureState === 'capturing') {
|
|
11919
11388
|
setProgressStarted(false);
|
|
@@ -11941,9 +11410,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11941
11410
|
verbiage: verbiage.uploadOrCaptureScreen
|
|
11942
11411
|
});
|
|
11943
11412
|
}
|
|
11944
|
-
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.
|
|
11413
|
+
var requestedAction = state.captureState === 'requestingFlip' ? 'FLIP_ID' : state.requestedDocumentType === 'idCardBack' ? 'SHOW_ID_BACK' : state.requestedDocumentType === 'passport' ? 'SHOW_PASSPORT' : 'SHOW_ID_FRONT';
|
|
11945
11414
|
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 &&
|
|
11415
|
+
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
11416
|
requiredDocumentType: state.requestedDocumentType,
|
|
11948
11417
|
thresholds: thresholds,
|
|
11949
11418
|
onCapture: onCapture,
|
|
@@ -11951,18 +11420,11 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11951
11420
|
colors: colors,
|
|
11952
11421
|
verbiage: idCaptureVerbiage,
|
|
11953
11422
|
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, {
|
|
11423
|
+
})), /*#__PURE__*/React__default.createElement(IdCaptureGuides, {
|
|
11962
11424
|
key: "guides".concat(attempt),
|
|
11963
11425
|
guideType: guideType,
|
|
11964
11426
|
status: guidesStatus,
|
|
11965
|
-
progress: progressStarted &&
|
|
11427
|
+
progress: progressStarted && state.captureState === 'capturing' ? 1 : 0,
|
|
11966
11428
|
portraitGuidesOnMobile: portraitGuidesOnMobile,
|
|
11967
11429
|
requestedAction: requestedAction,
|
|
11968
11430
|
images: guideImages,
|
|
@@ -11970,15 +11432,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
11970
11432
|
colors: colors,
|
|
11971
11433
|
verbiage: idCaptureVerbiage,
|
|
11972
11434
|
isBackToFront: state.allowIdCardBackToFrontCapture && 'idCardBack' in state.capturedDocuments
|
|
11973
|
-
}), debugMode && !((
|
|
11974
|
-
classNames: (
|
|
11975
|
-
text: (
|
|
11435
|
+
}), 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, {
|
|
11436
|
+
classNames: (_d = classNames.capture) === null || _d === void 0 ? void 0 : _d.imagePreview,
|
|
11437
|
+
text: (_e = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _e === void 0 ? void 0 : _e.processingIdCardText,
|
|
11976
11438
|
imageUrl: state.imageUrl
|
|
11977
11439
|
})), state.captureState !== 'complete' && (/*#__PURE__*/React__default.createElement("div", {
|
|
11978
11440
|
id: "idmission-above-guides-content"
|
|
11979
11441
|
})), (!customOverlayContent || !!customOverlayContent && overlayDismissed) && (/*#__PURE__*/React__default.createElement(ExitCaptureButton, {
|
|
11980
11442
|
onClick: onExit,
|
|
11981
|
-
className: (
|
|
11443
|
+
className: (_f = classNames.capture) === null || _f === void 0 ? void 0 : _f.exitCaptureBtn
|
|
11982
11444
|
})), !overlayDismissed && (/*#__PURE__*/React__default.createElement(IdCaptureLoadingOverlay, {
|
|
11983
11445
|
key: "loading".concat(attempt),
|
|
11984
11446
|
mode: loadingOverlayMode,
|
|
@@ -12016,14 +11478,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
|
|
|
12016
11478
|
onRetryClick: onRetryClick,
|
|
12017
11479
|
colors: colors.success,
|
|
12018
11480
|
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
|
|
11481
|
+
debugMode: debugMode
|
|
12027
11482
|
})));
|
|
12028
11483
|
};
|
|
12029
11484
|
function IdCaptureWizardWithProviders(_a) {
|