idmission-web-sdk 2.2.162 → 2.2.164
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/CompositeWizard.d.ts +2 -1
- package/dist/components/CompositeWizard.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts +2 -0
- package/dist/components/customer_flows/CustomerBiometricsEnrollment.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +2 -0
- package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerIdentification.d.ts +2 -0
- package/dist/components/customer_flows/CustomerIdentification.d.ts.map +1 -1
- package/dist/components/customer_flows/CustomerVerification.d.ts +2 -0
- package/dist/components/customer_flows/CustomerVerification.d.ts.map +1 -1
- package/dist/components/customer_flows/DocumentCapture.d.ts +2 -0
- package/dist/components/customer_flows/DocumentCapture.d.ts.map +1 -1
- package/dist/components/customer_flows/FaceValidation.d.ts +2 -0
- package/dist/components/customer_flows/FaceValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts +2 -0
- package/dist/components/customer_flows/IdAndFaceValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/IdValidation.d.ts +2 -0
- package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
- package/dist/components/customer_flows/SignatureKYC.d.ts +2 -0
- package/dist/components/customer_flows/SignatureKYC.d.ts.map +1 -1
- package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -0
- package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
- package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts +3 -0
- package/dist/components/customer_identification/CustomerIdentificationWizard.d.ts.map +1 -1
- package/dist/components/customer_verification/CustomerVerificationWizard.d.ts +3 -0
- package/dist/components/customer_verification/CustomerVerificationWizard.d.ts.map +1 -1
- package/dist/components/document_capture/DocumentCaptureWizard.d.ts +7 -2
- package/dist/components/document_capture/DocumentCaptureWizard.d.ts.map +1 -1
- package/dist/components/face_liveness/FaceLivenessWizard.d.ts +3 -0
- package/dist/components/face_liveness/FaceLivenessWizard.d.ts.map +1 -1
- package/dist/components/id_capture/IdCaptureWizard.d.ts +3 -0
- package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts +5 -1
- package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts +4 -0
- package/dist/components/video_signature_capture/VideoSignatureWizard.d.ts.map +1 -1
- package/dist/lib/camera/cameraStore.d.ts +21 -1
- package/dist/lib/camera/cameraStore.d.ts.map +1 -1
- package/dist/lib/locales/es.d.ts +2 -0
- package/dist/lib/locales/es.d.ts.map +1 -1
- package/dist/lib/locales/index.d.ts +2 -0
- package/dist/lib/locales/index.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +2027 -1932
- 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 +2028 -1933
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +5715 -5620
- 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
|
@@ -9,12 +9,12 @@ var tusJsClient = require('tus-js-client');
|
|
|
9
9
|
var SparkMD5 = require('spark-md5');
|
|
10
10
|
var tasksVision = require('@mediapipe/tasks-vision');
|
|
11
11
|
var zustand = require('zustand');
|
|
12
|
+
var LanguageDetector = require('i18next-browser-languagedetector');
|
|
13
|
+
var i18n = require('i18next');
|
|
12
14
|
var useDebounce = require('use-debounce');
|
|
13
15
|
var middleware = require('zustand/middleware');
|
|
14
16
|
var shallow = require('zustand/react/shallow');
|
|
15
17
|
var reactDom = require('react-dom');
|
|
16
|
-
var LanguageDetector = require('i18next-browser-languagedetector');
|
|
17
|
-
var i18n = require('i18next');
|
|
18
18
|
var SignatureCanvas = require('react-signature-canvas');
|
|
19
19
|
|
|
20
20
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -233,7 +233,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
233
233
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
var webSdkVersion = '2.2.
|
|
236
|
+
var webSdkVersion = '2.2.164';
|
|
237
237
|
|
|
238
238
|
function getPlatform() {
|
|
239
239
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -394,7 +394,7 @@ function videoDataUrlToB64(url) {
|
|
|
394
394
|
});
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
var PageContainerDiv = styled__default.default.div(templateObject_1$
|
|
397
|
+
var PageContainerDiv = styled__default.default.div(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"], ["\n ", "\n\n ", "\n\n &.flex {\n display: flex;\n }\n\n &.padded {\n box-sizing: border-box;\n padding: 16px 24px;\n }\n"])), function (props) {
|
|
398
398
|
var _a;
|
|
399
399
|
return props.theme.isFullscreen === false ? "" : "\n position: fixed;\n top: 0;\n left: 0;\n width: var(--app-width);\n height: calc(\n var(--app-height) - ".concat((_a = props.$heightOffset) !== null && _a !== void 0 ? _a : 0, "px\n );\n overflow-x: hidden;\n overflow-y: auto;\n ");
|
|
400
400
|
}, function (props) {
|
|
@@ -434,7 +434,7 @@ var PageContainer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
434
434
|
}, dimensionsCalculated && children);
|
|
435
435
|
});
|
|
436
436
|
PageContainer.displayName = 'PageContainer';
|
|
437
|
-
var templateObject_1$
|
|
437
|
+
var templateObject_1$N;
|
|
438
438
|
|
|
439
439
|
var LoaderButton = function LoaderButton(_a) {
|
|
440
440
|
var children = _a.children,
|
|
@@ -491,18 +491,18 @@ var LoaderButton = function LoaderButton(_a) {
|
|
|
491
491
|
className: "ladda-label"
|
|
492
492
|
}, children));
|
|
493
493
|
};
|
|
494
|
-
var StyledButton = styled__default.default.button(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
|
|
494
|
+
var StyledButton = styled__default.default.button(templateObject_1$M || (templateObject_1$M = __makeTemplateObject(["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"], ["\n ", "\n\n /*!\n * Ladda\n * http://lab.hakim.se/ladda\n * MIT licensed\n *\n * Copyright (C) 2018 Hakim El Hattab, http://hakim.se\n */\n\n position: relative;\n\n .ladda-spinner {\n position: absolute;\n z-index: 2;\n display: inline-block;\n width: 32px;\n top: 50%;\n margin-top: 0;\n opacity: 0;\n pointer-events: none;\n }\n .ladda-label {\n position: relative;\n z-index: 3;\n }\n .ladda-progress {\n position: absolute;\n width: 0;\n height: 100%;\n left: 0;\n top: 0;\n background: rgba(0, 0, 0, 0.2);\n display: none;\n transition: 0.1s linear all !important;\n }\n &[data-loading] .ladda-progress {\n display: block;\n }\n\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n\n .ladda-spinner,\n .ladda-label {\n transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;\n }\n &[data-style='zoom-in'],\n &[data-style='zoom-in'] .ladda-spinner,\n &[data-style='zoom-in'] .ladda-label,\n &[data-style='zoom-out'],\n &[data-style='zoom-out'] .ladda-spinner,\n &[data-style='zoom-out'] .ladda-label {\n transition: 0.3s ease all !important;\n }\n &[data-style='expand-right'] .ladda-spinner {\n right: -6px;\n }\n &[data-style='expand-right'][data-size='s'] .ladda-spinner,\n &[data-style='expand-right'][data-size='xs'] .ladda-spinner {\n right: -12px;\n }\n &[data-style='expand-right'][data-loading] {\n padding-right: 56px;\n }\n &[data-style='expand-right'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-right'][data-loading][data-size='s'],\n &[data-style='expand-right'][data-loading][data-size='xs'] {\n padding-right: 40px;\n }\n &[data-style='expand-left'] .ladda-spinner {\n left: 26px;\n }\n &[data-style='expand-left'][data-size='s'] .ladda-spinner,\n &[data-style='expand-left'][data-size='xs'] .ladda-spinner {\n left: 4px;\n }\n &[data-style='expand-left'][data-loading] {\n padding-left: 56px;\n }\n &[data-style='expand-left'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-left'][data-loading][data-size='s'],\n &[data-style='expand-left'][data-loading][data-size='xs'] {\n padding-left: 40px;\n }\n &[data-style='expand-up'] {\n overflow: hidden;\n }\n &[data-style='expand-up'] .ladda-spinner {\n top: -32px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-up'][data-loading] {\n padding-top: 54px;\n }\n &[data-style='expand-up'][data-loading] .ladda-spinner {\n opacity: 1;\n top: 26px;\n margin-top: 0;\n }\n &[data-style='expand-up'][data-loading][data-size='s'],\n &[data-style='expand-up'][data-loading][data-size='xs'] {\n padding-top: 32px;\n }\n &[data-style='expand-up'][data-loading][data-size='s'] .ladda-spinner,\n &[data-style='expand-up'][data-loading][data-size='xs'] .ladda-spinner {\n top: 4px;\n }\n &[data-style='expand-down'] {\n overflow: hidden;\n }\n &[data-style='expand-down'] .ladda-spinner {\n top: 62px;\n left: 50%;\n margin-left: 0;\n }\n &[data-style='expand-down'][data-size='s'] .ladda-spinner,\n &[data-style='expand-down'][data-size='xs'] .ladda-spinner {\n top: 40px;\n }\n &[data-style='expand-down'][data-loading] {\n padding-bottom: 54px;\n }\n &[data-style='expand-down'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='expand-down'][data-loading][data-size='s'],\n &[data-style='expand-down'][data-loading][data-size='xs'] {\n padding-bottom: 32px;\n }\n &[data-style='slide-left'] {\n overflow: hidden;\n }\n &[data-style='slide-left'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-left'] .ladda-spinner {\n left: 100%;\n margin-left: 0;\n }\n &[data-style='slide-left'][data-loading] .ladda-label {\n opacity: 0;\n left: -100%;\n }\n &[data-style='slide-left'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-right'] {\n overflow: hidden;\n }\n &[data-style='slide-right'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-right'] .ladda-spinner {\n right: 100%;\n margin-left: 0;\n left: 16px;\n }\n [dir='rtl'] &[data-style='slide-right'] .ladda-spinner {\n right: auto;\n }\n &[data-style='slide-right'][data-loading] .ladda-label {\n opacity: 0;\n left: 100%;\n }\n &[data-style='slide-right'][data-loading] .ladda-spinner {\n opacity: 1;\n left: 50%;\n }\n &[data-style='slide-up'] {\n overflow: hidden;\n }\n &[data-style='slide-up'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-up'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: 1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-label {\n opacity: 0;\n top: -1em;\n }\n &[data-style='slide-up'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='slide-down'] {\n overflow: hidden;\n }\n &[data-style='slide-down'] .ladda-label {\n position: relative;\n }\n &[data-style='slide-down'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n margin-top: -2em;\n }\n &[data-style='slide-down'][data-loading] .ladda-label {\n opacity: 0;\n top: 1em;\n }\n &[data-style='slide-down'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-top: 0;\n }\n &[data-style='zoom-out'] {\n overflow: hidden;\n }\n &[data-style='zoom-out'] .ladda-spinner {\n left: 50%;\n margin-left: 32px;\n transform: scale(2.5);\n }\n &[data-style='zoom-out'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-out'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(0.5);\n }\n &[data-style='zoom-out'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='zoom-in'] {\n overflow: hidden;\n }\n &[data-style='zoom-in'] .ladda-spinner {\n left: 50%;\n margin-left: -16px;\n transform: scale(0.2);\n }\n &[data-style='zoom-in'] .ladda-label {\n position: relative;\n display: inline-block;\n }\n &[data-style='zoom-in'][data-loading] .ladda-label {\n opacity: 0;\n transform: scale(2.2);\n }\n &[data-style='zoom-in'][data-loading] .ladda-spinner {\n opacity: 1;\n margin-left: 0;\n transform: none;\n }\n &[data-style='contract'] {\n overflow: hidden;\n width: 100px;\n }\n &[data-style='contract'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract'][data-loading] {\n border-radius: 50%;\n width: 52px;\n }\n &[data-style='contract'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n &[data-style='contract-overlay'] {\n overflow: hidden;\n width: 100px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0);\n }\n &[data-style='contract-overlay'] .ladda-spinner {\n left: 50%;\n margin-left: 0;\n }\n &[data-style='contract-overlay'][data-loading] {\n border-radius: 50%;\n width: 52px;\n box-shadow: 0px 0px 0px 2000px rgba(0, 0, 0, 0.8);\n }\n &[data-style='contract-overlay'][data-loading] .ladda-label {\n opacity: 0;\n }\n &[data-style='contract-overlay'][data-loading] .ladda-spinner {\n opacity: 1;\n }\n [dir='rtl'] .ladda-spinner > div {\n left: 25% !important;\n }\n"])), function (props) {
|
|
495
495
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
496
496
|
return ((_a = props.theme.buttons) === null || _a === void 0 ? void 0 : _a.style) === 'bootstrap' && "\n border-radius: 0;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n text-transform: none;\n -webkit-appearance: button;\n \n &:not(:disabled),\n &[type='button']:not(:disabled),\n &[type='reset']:not(:disabled),\n &[type='submit']:not(:disabled) {\n cursor: pointer;\n }\n \n &:focus:not(:focus-visible) {\n outline: 0;\n }\n \n --bs-btn-padding-x: 0.75rem;\n --bs-btn-padding-y: 0.375rem;\n --bs-btn-font-family: ;\n --bs-btn-font-size: 1rem;\n --bs-btn-font-weight: 400;\n --bs-btn-line-height: 1.5;\n --bs-btn-color: var(--bs-body-color);\n --bs-btn-bg: transparent;\n --bs-btn-border-width: var(--bs-border-width);\n --bs-btn-border-color: transparent;\n --bs-btn-border-radius: var(--bs-border-radius);\n --bs-btn-hover-border-color: transparent;\n --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15),\n 0 1px 1px rgba(0, 0, 0, 0.075);\n --bs-btn-disabled-opacity: 0.65;\n --bs-btn-focus-box-shadow: 0 0 0 0.25rem\n rgba(var(--bs-btn-focus-shadow-rgb), 0.5);\n display: inline-block;\n padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x);\n font-family: var(--bs-btn-font-family);\n font-size: var(--bs-btn-font-size);\n font-weight: var(--bs-btn-font-weight);\n line-height: var(--bs-btn-line-height);\n color: var(--bs-btn-color);\n text-align: center;\n text-decoration: none;\n vertical-align: middle;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n border: var(--bs-btn-border-width) solid var(--bs-btn-border-color);\n border-radius: var(--bs-btn-border-radius);\n background-color: var(--bs-btn-bg);\n //transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,\n // border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n \n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n \n &:hover {\n filter: brightness(1.15);\n }\n \n &:focus-visible {\n color: var(--bs-btn-hover-color);\n background-color: var(--bs-btn-hover-bg);\n border-color: var(--bs-btn-hover-border-color);\n outline: 0;\n box-shadow: var(--bs-btn-focus-box-shadow);\n }\n \n &:disabled,\n &.disabled,\n fieldset:disabled & {\n color: var(--bs-btn-disabled-color);\n pointer-events: none;\n background-color: var(--bs-btn-disabled-bg);\n border-color: var(--bs-btn-disabled-border-color);\n opacity: var(--bs-btn-disabled-opacity);\n }\n \n --bs-btn-color: ".concat((_f = (_b = props.$textColor) !== null && _b !== void 0 ? _b : (_e = (_c = props.theme.buttons) === null || _c === void 0 ? void 0 : _c[(_d = props.$variant) !== null && _d !== void 0 ? _d : 'primary']) === null || _e === void 0 ? void 0 : _e.textColor) !== null && _f !== void 0 ? _f : '#fff', ";\n --bs-btn-bg: ").concat((_l = (_g = props.$backgroundColor) !== null && _g !== void 0 ? _g : (_k = (_h = props.theme.buttons) === null || _h === void 0 ? void 0 : _h[(_j = props.$variant) !== null && _j !== void 0 ? _j : 'primary']) === null || _k === void 0 ? void 0 : _k.backgroundColor) !== null && _l !== void 0 ? _l : '#0d6efd', ";\n --bs-btn-border-color: var(--bs-btn-bg);\n --bs-btn-focus-shadow-rgb: 49, 132, 253;\n --bs-btn-active-color: #fff;\n --bs-btn-active-bg: #0a58ca;\n --bs-btn-active-border-color: #0a53be;\n --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n --bs-btn-disabled-color: ").concat((_q = (_m = props.$disabledTextColor) !== null && _m !== void 0 ? _m : (_p = (_o = props.theme.buttons) === null || _o === void 0 ? void 0 : _o.loading) === null || _p === void 0 ? void 0 : _p.textColor) !== null && _q !== void 0 ? _q : '#fff', ";\n --bs-btn-disabled-bg: ").concat((_u = (_r = props.$disabledBackgroundColor) !== null && _r !== void 0 ? _r : (_t = (_s = props.theme.buttons) === null || _s === void 0 ? void 0 : _s.loading) === null || _t === void 0 ? void 0 : _t.backgroundColor) !== null && _u !== void 0 ? _u : 'gray', ";\n --bs-btn-disabled-border-color: ").concat((_v = props.$disabledBackgroundColor) !== null && _v !== void 0 ? _v : '#0d6efd', ";\n \n --bs-btn-padding-y: 14px;\n --bs-btn-padding-x: 1rem;\n --bs-btn-font-size: 18px;\n --bs-btn-border-radius: 4px;\n ");
|
|
497
497
|
});
|
|
498
|
-
var templateObject_1$
|
|
498
|
+
var templateObject_1$M;
|
|
499
499
|
|
|
500
|
-
var OverlayContainer = styled__default.default(PageContainer)(templateObject_1$
|
|
500
|
+
var OverlayContainer = styled__default.default(PageContainer)(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n background: ", ";\n ", "\n z-index: 10000;\n"], ["\n background: ", ";\n ", "\n z-index: 10000;\n"])), function (props) {
|
|
501
501
|
return props.theme.background ? "".concat(props.theme.background) : "white";
|
|
502
502
|
}, function (props) {
|
|
503
503
|
return props.theme.textColor ? "color: ".concat(props.theme.textColor, ";") : "";
|
|
504
504
|
});
|
|
505
|
-
var OverlayInner$2 = styled__default.default.div(templateObject_2$
|
|
505
|
+
var OverlayInner$2 = styled__default.default.div(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"], ["\n text-align: ", ";\n display: flex;\n flex-direction: column;\n flex-wrap: nowrap;\n max-width: 100dvw;\n max-height: 100dvh;\n width: 100%;\n height: 100%;\n ", "\n"])), function (props) {
|
|
506
506
|
var _a;
|
|
507
507
|
return (_a = props.theme.textAlign) !== null && _a !== void 0 ? _a : 'center';
|
|
508
508
|
}, function (props) {
|
|
@@ -523,7 +523,7 @@ var WideBorderButton = styled__default.default(WideButton)(templateObject_8$4 ||
|
|
|
523
523
|
var _a, _b;
|
|
524
524
|
return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
|
|
525
525
|
});
|
|
526
|
-
var templateObject_1$
|
|
526
|
+
var templateObject_1$L, templateObject_2$C, templateObject_3$s, templateObject_4$m, templateObject_5$d, templateObject_6$a, templateObject_7$7, templateObject_8$4;
|
|
527
527
|
|
|
528
528
|
var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
|
|
529
529
|
var accessBlockedImageUrl = _a.accessBlockedImageUrl;
|
|
@@ -770,13 +770,13 @@ var SessionValidationErrorOverlay = function SessionValidationErrorOverlay(_a) {
|
|
|
770
770
|
}, retryText)))));
|
|
771
771
|
};
|
|
772
772
|
|
|
773
|
-
var wavesAnimation = styled.keyframes(templateObject_1$
|
|
774
|
-
var progressBarAnimation = styled.keyframes(templateObject_2$
|
|
773
|
+
var wavesAnimation = styled.keyframes(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"], ["\n 0% {\n opacity: 0;\n transform: scale3d(1, 1, 1);\n }\n 80% {\n opacity: 1;\n }\n 100% {\n transform: scale3d(2, 2, 1);\n opacity: 0;\n }\n"])));
|
|
774
|
+
var progressBarAnimation = styled.keyframes(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"], ["\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n"])));
|
|
775
775
|
var dualRingSpinnerAnimation = styled.keyframes(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
776
776
|
var progressBorderAnimation = styled.keyframes(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n to {\n stroke-dashoffset: 0;\n }\n"], ["\n to {\n stroke-dashoffset: 0;\n }\n"])));
|
|
777
|
-
var templateObject_1$
|
|
777
|
+
var templateObject_1$K, templateObject_2$B, templateObject_3$r, templateObject_4$l;
|
|
778
778
|
|
|
779
|
-
var Spinner = styled__default.default.div(templateObject_1$
|
|
779
|
+
var Spinner = styled__default.default.div(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"], ["\n display: inline-block;\n width: ", "px;\n height: ", "px;\n margin: auto;\n\n &:after {\n content: ' ';\n display: block;\n width: ", "px;\n height: ", "px;\n margin: 8px;\n border-radius: 50%;\n border: ", "px solid\n ", ";\n border-color: ", " transparent\n ", " transparent;\n animation: ", " 1.2s linear infinite;\n box-sizing: content-box;\n }\n"])), function (_a) {
|
|
780
780
|
var $size = _a.$size;
|
|
781
781
|
return $size !== null && $size !== void 0 ? $size : 80;
|
|
782
782
|
}, function (_a) {
|
|
@@ -801,7 +801,7 @@ var Spinner = styled__default.default.div(templateObject_1$I || (templateObject_
|
|
|
801
801
|
var $color = _a.$color;
|
|
802
802
|
return $color !== null && $color !== void 0 ? $color : '#888';
|
|
803
803
|
}, dualRingSpinnerAnimation);
|
|
804
|
-
var templateObject_1$
|
|
804
|
+
var templateObject_1$J;
|
|
805
805
|
|
|
806
806
|
exports.defaultAuthUrl = 'https://portal-api.idmission.com';
|
|
807
807
|
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'];
|
|
@@ -2091,7 +2091,7 @@ function getFrameDimensions(frame) {
|
|
|
2091
2091
|
return [frameWidth, frameHeight];
|
|
2092
2092
|
}
|
|
2093
2093
|
|
|
2094
|
-
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$
|
|
2094
|
+
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
2095
2095
|
function drawToCanvas(canvas, frame, width, height) {
|
|
2096
2096
|
if (!canvas) return;
|
|
2097
2097
|
var ctx = canvas.getContext('2d');
|
|
@@ -2111,7 +2111,7 @@ function clearCanvas(canvas) {
|
|
|
2111
2111
|
var _a;
|
|
2112
2112
|
(_a = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.clearRect(0, 0, canvas === null || canvas === void 0 ? void 0 : canvas.width, canvas === null || canvas === void 0 ? void 0 : canvas.height);
|
|
2113
2113
|
}
|
|
2114
|
-
var templateObject_1$
|
|
2114
|
+
var templateObject_1$I;
|
|
2115
2115
|
|
|
2116
2116
|
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
2117
2117
|
if (quality === void 0) {
|
|
@@ -3534,1690 +3534,133 @@ function releaseCameraAccess() {
|
|
|
3534
3534
|
currentCamera = undefined;
|
|
3535
3535
|
}
|
|
3536
3536
|
|
|
3537
|
-
var
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
};
|
|
3665
|
-
}
|
|
3666
|
-
stream_1 = null;
|
|
3667
|
-
_e.label = 3;
|
|
3668
|
-
case 3:
|
|
3669
|
-
_e.trys.push([3, 5,, 6]);
|
|
3670
|
-
debug('obtaining camera access with constraints', constraints);
|
|
3671
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
3672
|
-
case 4:
|
|
3673
|
-
stream_1 = _e.sent();
|
|
3674
|
-
return [3 /*break*/, 6];
|
|
3675
|
-
case 5:
|
|
3676
|
-
e_1 = _e.sent();
|
|
3677
|
-
if (e_1.name === 'NotAllowedError') {
|
|
3678
|
-
if (preferIphoneContinuityCamera) {
|
|
3679
|
-
set({
|
|
3680
|
-
iphoneContinuityCameraAvailable: false,
|
|
3681
|
-
iphoneContinuityCameraDenied: true
|
|
3682
|
-
});
|
|
3683
|
-
} else {
|
|
3684
|
-
set({
|
|
3685
|
-
cameraAccessDenied: true
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
return [2 /*return*/];
|
|
3689
|
-
}
|
|
3690
|
-
return [3 /*break*/, 6];
|
|
3691
|
-
case 6:
|
|
3692
|
-
if (!!stream_1) return [3 /*break*/, 10];
|
|
3693
|
-
_e.label = 7;
|
|
3694
|
-
case 7:
|
|
3695
|
-
_e.trys.push([7, 9,, 10]);
|
|
3696
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3697
|
-
audio: false,
|
|
3698
|
-
video: true
|
|
3699
|
-
})];
|
|
3700
|
-
case 8:
|
|
3701
|
-
stream_1 = _e.sent();
|
|
3702
|
-
debug('opened stream with no width and height constraints');
|
|
3703
|
-
return [3 /*break*/, 10];
|
|
3704
|
-
case 9:
|
|
3705
|
-
e_2 = _e.sent();
|
|
3706
|
-
debug('cannot open stream at all', e_2);
|
|
3707
|
-
return [3 /*break*/, 10];
|
|
3708
|
-
case 10:
|
|
3709
|
-
if (!stream_1) {
|
|
3710
|
-
error('failed to open camera');
|
|
3711
|
-
throw new Error('failed to open camera: ');
|
|
3712
|
-
}
|
|
3713
|
-
debug('camera access granted with constraints', constraints);
|
|
3714
|
-
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
3715
|
-
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
3716
|
-
debug('someone unplugged the continuity camera');
|
|
3717
|
-
set({
|
|
3718
|
-
videoStream: null,
|
|
3719
|
-
videoDevice: null,
|
|
3720
|
-
cameraReady: false,
|
|
3721
|
-
iphoneContinuityCameraAvailable: false,
|
|
3722
|
-
iphoneContinuityCameraDenied: true
|
|
3723
|
-
});
|
|
3724
|
-
get().requestCameraAccess();
|
|
3725
|
-
} else {
|
|
3726
|
-
debug('someone unplugged the webcam');
|
|
3727
|
-
releaseCameraAccess();
|
|
3728
|
-
set({
|
|
3729
|
-
videoStream: null,
|
|
3730
|
-
videoDevice: null,
|
|
3731
|
-
videoLoaded: false,
|
|
3732
|
-
cameraReady: false,
|
|
3733
|
-
cameraAccessDenied: true
|
|
3734
|
-
});
|
|
3735
|
-
}
|
|
3736
|
-
};
|
|
3737
|
-
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
3738
|
-
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
3739
|
-
videoTrack_1.onended = handleStreamEnded_1;
|
|
3740
|
-
camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
3741
|
-
setTimeout(function () {
|
|
3742
|
-
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
3743
|
-
// when the camera access is being requested. This delay is a workaround for that.
|
|
3744
|
-
videoTrack_1.onmute = function () {
|
|
3745
|
-
if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
|
|
3746
|
-
};
|
|
3747
|
-
set({
|
|
3748
|
-
camera: camera_1,
|
|
3749
|
-
cameraReady: true,
|
|
3750
|
-
cameraAccessDenied: false,
|
|
3751
|
-
isRearFacing: camera_1.isRearFacing,
|
|
3752
|
-
videoStream: stream_1
|
|
3753
|
-
});
|
|
3754
|
-
}, 500);
|
|
3755
|
-
return [3 /*break*/, 12];
|
|
3756
|
-
case 11:
|
|
3757
|
-
e_3 = _e.sent();
|
|
3758
|
-
if (e_3.name === 'NotAllowedError') {
|
|
3759
|
-
error('camera access has been blocked by the user', e_3);
|
|
3760
|
-
set({
|
|
3761
|
-
cameraAccessDenied: true
|
|
3762
|
-
});
|
|
3763
|
-
} else {
|
|
3764
|
-
error('camera access encountered some other error', e_3);
|
|
3765
|
-
throw e_3;
|
|
3766
|
-
}
|
|
3767
|
-
return [3 /*break*/, 12];
|
|
3768
|
-
case 12:
|
|
3769
|
-
return [2 /*return*/];
|
|
3770
|
-
}
|
|
3771
|
-
});
|
|
3772
|
-
});
|
|
3773
|
-
},
|
|
3774
|
-
releaseCameraAccess: function releaseCameraAccess() {
|
|
3775
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3776
|
-
var camera;
|
|
3777
|
-
return __generator(this, function (_a) {
|
|
3778
|
-
camera = get().camera;
|
|
3779
|
-
if (!camera) return [2 /*return*/];
|
|
3780
|
-
camera.release();
|
|
3781
|
-
set({
|
|
3782
|
-
camera: null,
|
|
3783
|
-
cameraReady: false,
|
|
3784
|
-
cameraAccessDenied: false
|
|
3785
|
-
});
|
|
3786
|
-
return [2 /*return*/];
|
|
3787
|
-
});
|
|
3788
|
-
});
|
|
3789
|
-
},
|
|
3790
|
-
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
3791
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3792
|
-
var stream_2, e_4;
|
|
3793
|
-
return __generator(this, function (_a) {
|
|
3794
|
-
switch (_a.label) {
|
|
3795
|
-
case 0:
|
|
3796
|
-
get().releaseMicrophoneAccess();
|
|
3797
|
-
_a.label = 1;
|
|
3798
|
-
case 1:
|
|
3799
|
-
_a.trys.push([1, 3,, 4]);
|
|
3800
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3801
|
-
audio: true,
|
|
3802
|
-
video: false
|
|
3803
|
-
})
|
|
3804
|
-
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
3805
|
-
// when the camera access is being requested. This delay is a workaround for that.
|
|
3806
|
-
];
|
|
3807
|
-
case 2:
|
|
3808
|
-
stream_2 = _a.sent();
|
|
3809
|
-
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
3810
|
-
// when the camera access is being requested. This delay is a workaround for that.
|
|
3811
|
-
setTimeout(function () {
|
|
3812
|
-
set({
|
|
3813
|
-
audioStream: stream_2,
|
|
3814
|
-
microphoneReady: true,
|
|
3815
|
-
microphoneAccessDenied: false
|
|
3816
|
-
});
|
|
3817
|
-
var handleStreamEnded = function handleStreamEnded() {
|
|
3818
|
-
set({
|
|
3819
|
-
microphoneReady: false,
|
|
3820
|
-
microphoneAccessDenied: true
|
|
3821
|
-
});
|
|
3822
|
-
};
|
|
3823
|
-
var track = stream_2.getAudioTracks()[0];
|
|
3824
|
-
track.onended = handleStreamEnded;
|
|
3825
|
-
track.onmute = function () {
|
|
3826
|
-
if (track.readyState !== 'live') handleStreamEnded();
|
|
3827
|
-
};
|
|
3828
|
-
}, 500);
|
|
3829
|
-
return [3 /*break*/, 4];
|
|
3830
|
-
case 3:
|
|
3831
|
-
e_4 = _a.sent();
|
|
3832
|
-
debug('failed to open microphone', e_4);
|
|
3833
|
-
set({
|
|
3834
|
-
microphoneAccessDenied: true
|
|
3835
|
-
});
|
|
3836
|
-
return [3 /*break*/, 4];
|
|
3837
|
-
case 4:
|
|
3838
|
-
return [2 /*return*/];
|
|
3839
|
-
}
|
|
3840
|
-
});
|
|
3841
|
-
});
|
|
3842
|
-
},
|
|
3843
|
-
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
3844
|
-
var _a;
|
|
3845
|
-
var audioStream = get().audioStream;
|
|
3846
|
-
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
3847
|
-
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
3848
|
-
var _a;
|
|
3849
|
-
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
3850
|
-
});
|
|
3851
|
-
set({
|
|
3852
|
-
audioStream: null,
|
|
3853
|
-
microphoneReady: false,
|
|
3854
|
-
microphoneAccessDenied: false
|
|
3855
|
-
});
|
|
3856
|
-
}
|
|
3857
|
-
});
|
|
3858
|
-
});
|
|
3859
|
-
if (config.requestAccessAutomatically) {
|
|
3860
|
-
void store.getState().requestCameraAccess();
|
|
3861
|
-
}
|
|
3862
|
-
return _assign(_assign({}, store), {
|
|
3863
|
-
destroy: function destroy() {
|
|
3864
|
-
store.getState().releaseCameraAccess();
|
|
3865
|
-
store.getState().releaseMicrophoneAccess();
|
|
3866
|
-
}
|
|
3867
|
-
});
|
|
3868
|
-
};
|
|
3869
|
-
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
3870
|
-
function CameraStoreProvider(_a) {
|
|
3871
|
-
var children = _a.children,
|
|
3872
|
-
_b = _a.requestAccessAutomatically,
|
|
3873
|
-
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
3874
|
-
_c = _a.preferIphoneContinuityCamera,
|
|
3875
|
-
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
3876
|
-
_d = _a.preferFrontFacingCamera,
|
|
3877
|
-
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
3878
|
-
_e = _a.maxVideoWidth,
|
|
3879
|
-
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
3880
|
-
maxFps = _a.maxFps,
|
|
3881
|
-
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
3882
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
3883
|
-
_f = _a.requireMicrophoneAccess,
|
|
3884
|
-
requireMicrophoneAccess = _f === void 0 ? false : _f;
|
|
3885
|
-
var videoRef = React.useRef(null);
|
|
3886
|
-
var store = React.useRef();
|
|
3887
|
-
store.current || (store.current = createCameraStore({
|
|
3888
|
-
videoRef: videoRef,
|
|
3889
|
-
requestAccessAutomatically: requestAccessAutomatically,
|
|
3890
|
-
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3891
|
-
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
3892
|
-
maxVideoWidth: maxVideoWidth,
|
|
3893
|
-
maxFps: maxFps,
|
|
3894
|
-
onCameraAccessDenied: onCameraAccessDenied,
|
|
3895
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
3896
|
-
requireMicrophoneAccess: requireMicrophoneAccess
|
|
3897
|
-
}));
|
|
3898
|
-
React.useEffect(function () {
|
|
3899
|
-
var _a, _b, _c;
|
|
3900
|
-
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
3901
|
-
if (!state) return;
|
|
3902
|
-
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
3903
|
-
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
3904
|
-
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3905
|
-
preferFrontFacingCamera: preferFrontFacingCamera
|
|
3906
|
-
});
|
|
3907
|
-
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
3908
|
-
}
|
|
3909
|
-
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
3910
|
-
React.useEffect(function () {
|
|
3911
|
-
var _a;
|
|
3912
|
-
if (requireMicrophoneAccess) {
|
|
3913
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
|
|
3914
|
-
}
|
|
3915
|
-
}, [requireMicrophoneAccess]);
|
|
3916
|
-
React.useEffect(function () {
|
|
3917
|
-
return function () {
|
|
3918
|
-
var _a;
|
|
3919
|
-
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3920
|
-
};
|
|
3921
|
-
}, []);
|
|
3922
|
-
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
|
|
3923
|
-
value: store.current
|
|
3924
|
-
}, children);
|
|
3925
|
-
}
|
|
3926
|
-
function useCameraStore(selector) {
|
|
3927
|
-
var store = React.useContext(CameraStoreContext);
|
|
3928
|
-
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
3929
|
-
return zustand.useStore(store, selector);
|
|
3930
|
-
}
|
|
3931
|
-
|
|
3932
|
-
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
3933
|
-
startDocumentDetection: function startDocumentDetection() {
|
|
3934
|
-
return null;
|
|
3935
|
-
},
|
|
3936
|
-
stopDocumentDetection: function stopDocumentDetection() {
|
|
3937
|
-
return null;
|
|
3938
|
-
},
|
|
3939
|
-
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
3940
|
-
return null;
|
|
3941
|
-
},
|
|
3942
|
-
documentDetectionModelReady: false,
|
|
3943
|
-
documentDetectionModelDownloadProgress: 0,
|
|
3944
|
-
documentDetectionModelError: null,
|
|
3945
|
-
onDocumentDetected: function onDocumentDetected() {
|
|
3946
|
-
return null;
|
|
3947
|
-
},
|
|
3948
|
-
detectionTime: 0,
|
|
3949
|
-
documentDetectionThresholds: {},
|
|
3950
|
-
setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
|
|
3951
|
-
return null;
|
|
3952
|
-
},
|
|
3953
|
-
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
3954
|
-
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
3955
|
-
return null;
|
|
3956
|
-
},
|
|
3957
|
-
documentDetectionLastPredictionCanvas: {
|
|
3958
|
-
current: null
|
|
3959
|
-
},
|
|
3960
|
-
clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
|
|
3961
|
-
return null;
|
|
3962
|
-
}
|
|
3963
|
-
});
|
|
3964
|
-
function DocumentDetectionModelProvider(_a) {
|
|
3965
|
-
var _this = this;
|
|
3966
|
-
var _b = _a.autoStart,
|
|
3967
|
-
autoStart = _b === void 0 ? true : _b,
|
|
3968
|
-
children = _a.children,
|
|
3969
|
-
_c = _a.throttleMs,
|
|
3970
|
-
throttleMs = _c === void 0 ? 16 : _c,
|
|
3971
|
-
_d = _a.delayAfterStartMs,
|
|
3972
|
-
delayAfterStartMs = _d === void 0 ? 0 : _d,
|
|
3973
|
-
_e = _a.documentDetectionModelPath,
|
|
3974
|
-
documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
|
|
3975
|
-
_f = _a.documentDetectionModelScoreThreshold,
|
|
3976
|
-
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
3977
|
-
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
3978
|
-
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3979
|
-
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
3980
|
-
_h = _a.shouldLoadModels,
|
|
3981
|
-
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
3982
|
-
var _j = useCameraStore(),
|
|
3983
|
-
videoRef = _j.videoRef,
|
|
3984
|
-
videoLoaded = _j.videoLoaded,
|
|
3985
|
-
cameraReady = _j.cameraReady;
|
|
3986
|
-
var lastPredictionCanvas = React.useRef(null);
|
|
3987
|
-
var onPredictionHandler = React.useRef();
|
|
3988
|
-
var _k = React.useState({}),
|
|
3989
|
-
documentDetectionThresholds = _k[0],
|
|
3990
|
-
setDocumentDetectionThresholds = _k[1];
|
|
3991
|
-
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
3992
|
-
documentDetectionBoundaries = _l[0],
|
|
3993
|
-
setDocumentDetectionBoundaries = _l[1];
|
|
3994
|
-
var _m = React.useState(0),
|
|
3995
|
-
timesAllZero = _m[0],
|
|
3996
|
-
setTimesAllZero = _m[1];
|
|
3997
|
-
var _o = React.useState(0),
|
|
3998
|
-
canvasKey = _o[0],
|
|
3999
|
-
setCanvasKey = _o[1];
|
|
4000
|
-
var stopDetection = React.useRef(0);
|
|
4001
|
-
var _p = React.useState(shouldLoadModelsProp),
|
|
4002
|
-
shouldLoadModels = _p[0],
|
|
4003
|
-
setShouldLoadModels = _p[1];
|
|
4004
|
-
var load = React.useCallback(function () {
|
|
4005
|
-
return setShouldLoadModels(true);
|
|
4006
|
-
}, []);
|
|
4007
|
-
var _q = useLoadDocumentDetector({
|
|
4008
|
-
modelPath: documentDetectionModelPath,
|
|
4009
|
-
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
4010
|
-
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
4011
|
-
onModelError: onDocumentDetectionModelError,
|
|
4012
|
-
videoRef: videoRef,
|
|
4013
|
-
shouldLoadModels: shouldLoadModels
|
|
4014
|
-
}),
|
|
4015
|
-
ready = _q.ready,
|
|
4016
|
-
modelDownloadProgress = _q.modelDownloadProgress,
|
|
4017
|
-
modelError = _q.modelError,
|
|
4018
|
-
setModelError = _q.setModelError;
|
|
4019
|
-
var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
4020
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
4021
|
-
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
4022
|
-
var _a;
|
|
4023
|
-
return __generator(this, function (_b) {
|
|
4024
|
-
switch (_b.label) {
|
|
4025
|
-
case 0:
|
|
4026
|
-
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
|
|
4027
|
-
stopDetectionAtStart = stopDetection.current;
|
|
4028
|
-
vw = videoRef.current.videoWidth;
|
|
4029
|
-
vh = videoRef.current.videoHeight;
|
|
4030
|
-
lastPredictionCanvas.current.width = vw;
|
|
4031
|
-
lastPredictionCanvas.current.height = vh;
|
|
4032
|
-
ctx = lastPredictionCanvas.current.getContext('2d');
|
|
4033
|
-
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
|
|
4034
|
-
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
4035
|
-
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
4036
|
-
return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
|
|
4037
|
-
case 1:
|
|
4038
|
-
prediction = _b.sent();
|
|
4039
|
-
if (!prediction) return [3 /*break*/, 3];
|
|
4040
|
-
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
4041
|
-
processedPrediction.frameId = frameId;
|
|
4042
|
-
setLastDetectionAt(new Date().getTime());
|
|
4043
|
-
debug(processedPrediction);
|
|
4044
|
-
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
4045
|
-
return n + 1;
|
|
4046
|
-
});
|
|
4047
|
-
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
4048
|
-
if (timeRunning < delayAfterStartMs) return [2 /*return*/];
|
|
4049
|
-
return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
|
|
4050
|
-
case 2:
|
|
4051
|
-
_b.sent();
|
|
4052
|
-
_b.label = 3;
|
|
4053
|
-
case 3:
|
|
4054
|
-
return [2 /*return*/];
|
|
4055
|
-
}
|
|
4056
|
-
});
|
|
4057
|
-
});
|
|
4058
|
-
}, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
|
|
4059
|
-
throttleMs: throttleMs,
|
|
4060
|
-
autoStart: autoStart
|
|
4061
|
-
}),
|
|
4062
|
-
start = _r.start,
|
|
4063
|
-
stop = _r.stop;
|
|
4064
|
-
React.useEffect(function setErrorIfAllZero() {
|
|
4065
|
-
if (timesAllZero >= 2) {
|
|
4066
|
-
setModelError(new Error('model is returning all zeroes'));
|
|
4067
|
-
}
|
|
4068
|
-
}, [setModelError, timesAllZero]);
|
|
4069
|
-
var onDocumentDetected = React.useCallback(function (handler) {
|
|
4070
|
-
onPredictionHandler.current = handler;
|
|
4071
|
-
}, []);
|
|
4072
|
-
var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
|
|
4073
|
-
stopDetection.current += 1;
|
|
4074
|
-
setCanvasKey(function (n) {
|
|
4075
|
-
return n + 1;
|
|
4076
|
-
});
|
|
4077
|
-
}, []);
|
|
4078
|
-
var value = React.useMemo(function () {
|
|
4079
|
-
return {
|
|
4080
|
-
startDocumentDetection: start,
|
|
4081
|
-
stopDocumentDetection: stop,
|
|
4082
|
-
loadDocumentDetectionModel: load,
|
|
4083
|
-
documentDetectionModelReady: ready,
|
|
4084
|
-
documentDetectionModelError: modelError,
|
|
4085
|
-
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
4086
|
-
onDocumentDetected: onDocumentDetected,
|
|
4087
|
-
detectionTime: lastDetectionTime,
|
|
4088
|
-
documentDetectionThresholds: documentDetectionThresholds,
|
|
4089
|
-
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
4090
|
-
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
4091
|
-
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
4092
|
-
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
4093
|
-
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
4094
|
-
};
|
|
4095
|
-
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
4096
|
-
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
4097
|
-
value: value
|
|
4098
|
-
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
4099
|
-
key: canvasKey,
|
|
4100
|
-
ref: lastPredictionCanvas
|
|
4101
|
-
}), children);
|
|
4102
|
-
}
|
|
4103
|
-
|
|
4104
|
-
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
4105
|
-
loadFocusModel: function loadFocusModel() {
|
|
4106
|
-
return null;
|
|
4107
|
-
},
|
|
4108
|
-
focusModelReady: false,
|
|
4109
|
-
focusModelDownloadProgress: 0,
|
|
4110
|
-
focusModelError: null,
|
|
4111
|
-
focusThresholds: {},
|
|
4112
|
-
setFocusThresholds: function setFocusThresholds() {
|
|
4113
|
-
return null;
|
|
4114
|
-
},
|
|
4115
|
-
makeFocusPrediction: function makeFocusPrediction() {
|
|
4116
|
-
return null;
|
|
4117
|
-
},
|
|
4118
|
-
focusPredictionTime: 0
|
|
4119
|
-
});
|
|
4120
|
-
function FocusModelProvider(_a) {
|
|
4121
|
-
var children = _a.children,
|
|
4122
|
-
_b = _a.focusModelPath,
|
|
4123
|
-
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
4124
|
-
_c = _a.focusModelLoadTimeoutMs,
|
|
4125
|
-
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
4126
|
-
onFocusModelError = _a.onFocusModelError,
|
|
4127
|
-
_d = _a.showCanvases,
|
|
4128
|
-
showCanvases = _d === void 0 ? false : _d,
|
|
4129
|
-
_e = _a.shouldLoadModels,
|
|
4130
|
-
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
4131
|
-
var cropCanvas = React.useRef(null);
|
|
4132
|
-
var rotateCanvas = React.useRef(null);
|
|
4133
|
-
var _f = React.useState({}),
|
|
4134
|
-
focusThresholds = _f[0],
|
|
4135
|
-
setFocusThresholds = _f[1];
|
|
4136
|
-
var videoRef = useCameraStore().videoRef;
|
|
4137
|
-
var _g = React.useState(shouldLoadModelsProp),
|
|
4138
|
-
shouldLoadModels = _g[0],
|
|
4139
|
-
setShouldLoadModels = _g[1];
|
|
4140
|
-
var load = React.useCallback(function () {
|
|
4141
|
-
return setShouldLoadModels(true);
|
|
4142
|
-
}, []);
|
|
4143
|
-
var _h = useLoadFocusModel({
|
|
4144
|
-
modelPath: focusModelPath,
|
|
4145
|
-
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4146
|
-
onModelError: onFocusModelError,
|
|
4147
|
-
videoRef: videoRef,
|
|
4148
|
-
shouldLoadModels: shouldLoadModels
|
|
4149
|
-
}),
|
|
4150
|
-
ready = _h.ready,
|
|
4151
|
-
modelDownloadProgress = _h.modelDownloadProgress,
|
|
4152
|
-
modelError = _h.modelError;
|
|
4153
|
-
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
4154
|
-
if (!ready) return null;
|
|
4155
|
-
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
4156
|
-
if (!prediction) return null;
|
|
4157
|
-
setLastFocusPredictionAt(prediction.predictionTime);
|
|
4158
|
-
return prediction;
|
|
4159
|
-
}, [ready]);
|
|
4160
|
-
var value = React.useMemo(function () {
|
|
4161
|
-
return {
|
|
4162
|
-
loadFocusModel: load,
|
|
4163
|
-
focusModelReady: ready,
|
|
4164
|
-
focusModelDownloadProgress: modelDownloadProgress,
|
|
4165
|
-
focusModelError: modelError,
|
|
4166
|
-
makeFocusPrediction: makeFocusPrediction,
|
|
4167
|
-
focusPredictionTime: lastFocusPredictionTime,
|
|
4168
|
-
focusThresholds: focusThresholds,
|
|
4169
|
-
setFocusThresholds: setFocusThresholds
|
|
4170
|
-
};
|
|
4171
|
-
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
4172
|
-
return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
|
|
4173
|
-
value: value
|
|
4174
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4175
|
-
ref: rotateCanvas,
|
|
4176
|
-
style: showCanvases ? {
|
|
4177
|
-
display: 'block'
|
|
4178
|
-
} : undefined
|
|
4179
|
-
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4180
|
-
ref: cropCanvas,
|
|
4181
|
-
style: showCanvases ? {
|
|
4182
|
-
display: 'block'
|
|
4183
|
-
} : undefined
|
|
4184
|
-
}), children);
|
|
4185
|
-
}
|
|
4186
|
-
|
|
4187
|
-
function _isNavigatorDefined() {
|
|
4188
|
-
return typeof navigator !== 'undefined' && navigator != null;
|
|
4189
|
-
}
|
|
4190
|
-
var isMobileCache;
|
|
4191
|
-
function isMobile() {
|
|
4192
|
-
if (isMobileCache !== undefined) return isMobileCache;
|
|
4193
|
-
isMobileCache = evaluateIsMobile();
|
|
4194
|
-
return isMobileCache;
|
|
4195
|
-
}
|
|
4196
|
-
function evaluateIsMobile(nav) {
|
|
4197
|
-
if (nav || _isNavigatorDefined()) {
|
|
4198
|
-
if (!nav) {
|
|
4199
|
-
nav = navigator;
|
|
4200
|
-
}
|
|
4201
|
-
if (nav.product === 'ReactNative') {
|
|
4202
|
-
return true;
|
|
4203
|
-
}
|
|
4204
|
-
var a = nav.userAgent || nav.vendor || (
|
|
4205
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4206
|
-
// @ts-ignore
|
|
4207
|
-
typeof window !== 'undefined' ? window.opera : '');
|
|
4208
|
-
if (!a) {
|
|
4209
|
-
var navAny = nav;
|
|
4210
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4211
|
-
// @ts-ignore
|
|
4212
|
-
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
4213
|
-
}
|
|
4214
|
-
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
4215
|
-
}
|
|
4216
|
-
return false;
|
|
4217
|
-
}
|
|
4218
|
-
|
|
4219
|
-
var onMobile = isMobile();
|
|
4220
|
-
var defaultIdCaptureThresholds = {
|
|
4221
|
-
detection: defaultDocumentDetectionThresholds,
|
|
4222
|
-
focus: defaultFocusThresholds
|
|
4223
|
-
};
|
|
4224
|
-
var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
4225
|
-
ready: false,
|
|
4226
|
-
start: function start() {
|
|
4227
|
-
return null;
|
|
4228
|
-
},
|
|
4229
|
-
stop: function stop() {
|
|
4230
|
-
return null;
|
|
4231
|
-
},
|
|
4232
|
-
load: function load() {
|
|
4233
|
-
return null;
|
|
4234
|
-
},
|
|
4235
|
-
modelDownloadProgress: 0,
|
|
4236
|
-
modelError: null,
|
|
4237
|
-
thresholds: defaultIdCaptureThresholds,
|
|
4238
|
-
setThresholds: function setThresholds() {
|
|
4239
|
-
return null;
|
|
4240
|
-
},
|
|
4241
|
-
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
4242
|
-
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
4243
|
-
return null;
|
|
4244
|
-
},
|
|
4245
|
-
onPredictionMade: function onPredictionMade() {
|
|
4246
|
-
return null;
|
|
4247
|
-
},
|
|
4248
|
-
detectionTime: 0,
|
|
4249
|
-
focusPredictionTime: 0,
|
|
4250
|
-
bestFrameDetails: {
|
|
4251
|
-
current: null
|
|
4252
|
-
},
|
|
4253
|
-
getBestFrame: function getBestFrame() {
|
|
4254
|
-
return null;
|
|
4255
|
-
},
|
|
4256
|
-
resetBestFrame: function resetBestFrame() {
|
|
4257
|
-
return null;
|
|
4258
|
-
},
|
|
4259
|
-
requiredDocumentType: 'none',
|
|
4260
|
-
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
4261
|
-
return null;
|
|
4262
|
-
}
|
|
4263
|
-
});
|
|
4264
|
-
function IdCaptureModelsProviderInner(_a) {
|
|
4265
|
-
var children = _a.children,
|
|
4266
|
-
onModelError = _a.onModelError,
|
|
4267
|
-
_b = _a.allowSinglePageIdCapture,
|
|
4268
|
-
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
4269
|
-
var _c = React.useContext(DocumentDetectionModelContext),
|
|
4270
|
-
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
4271
|
-
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
4272
|
-
startDocumentDetection = _c.startDocumentDetection,
|
|
4273
|
-
stopDocumentDetection = _c.stopDocumentDetection,
|
|
4274
|
-
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
4275
|
-
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
4276
|
-
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
4277
|
-
onDocumentDetected = _c.onDocumentDetected,
|
|
4278
|
-
detectionTime = _c.detectionTime,
|
|
4279
|
-
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
4280
|
-
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
4281
|
-
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
4282
|
-
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
4283
|
-
documentDetectionModelError = _c.documentDetectionModelError;
|
|
4284
|
-
var _d = React.useContext(FocusModelContext),
|
|
4285
|
-
loadFocusModel = _d.loadFocusModel,
|
|
4286
|
-
focusModelReady = _d.focusModelReady,
|
|
4287
|
-
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
4288
|
-
makeFocusPrediction = _d.makeFocusPrediction,
|
|
4289
|
-
focusThresholds = _d.focusThresholds,
|
|
4290
|
-
setFocusThresholds = _d.setFocusThresholds,
|
|
4291
|
-
focusPredictionTime = _d.focusPredictionTime,
|
|
4292
|
-
focusModelError = _d.focusModelError;
|
|
4293
|
-
var onPredictionHandler = React.useRef();
|
|
4294
|
-
var bestFrameDetails = React.useRef(null);
|
|
4295
|
-
var bestPredictionCanvas = React.useRef(null);
|
|
4296
|
-
var bestFocusScore = React.useRef(0);
|
|
4297
|
-
var stopDetection = React.useRef(0);
|
|
4298
|
-
var _e = React.useState('none'),
|
|
4299
|
-
requiredDocumentType = _e[0],
|
|
4300
|
-
setRequiredDocumentType = _e[1];
|
|
4301
|
-
var thresholds = React.useMemo(function () {
|
|
4302
|
-
return _assign(_assign({}, documentDetectionThresholds), {
|
|
4303
|
-
focus: focusThresholds
|
|
4304
|
-
});
|
|
4305
|
-
}, [documentDetectionThresholds, focusThresholds]);
|
|
4306
|
-
var setThresholds = React.useCallback(function (thresholds) {
|
|
4307
|
-
if (thresholds.detection) {
|
|
4308
|
-
setDocumentDetectionThresholds(thresholds.detection);
|
|
4309
|
-
}
|
|
4310
|
-
if (thresholds.focus) {
|
|
4311
|
-
setFocusThresholds(thresholds.focus);
|
|
4312
|
-
}
|
|
4313
|
-
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
4314
|
-
React.useEffect(function handleDetections() {
|
|
4315
|
-
var _this = this;
|
|
4316
|
-
onDocumentDetected(function (prediction) {
|
|
4317
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
4318
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4319
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4320
|
-
return __generator(this, function (_h) {
|
|
4321
|
-
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4322
|
-
stopDetectionAtStart = stopDetection.current;
|
|
4323
|
-
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4324
|
-
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
4325
|
-
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
4326
|
-
prediction.detectedDocumentType = 'passport';
|
|
4327
|
-
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
4328
|
-
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
4329
|
-
prediction.singlePageDetectionScore = 0;
|
|
4330
|
-
prediction.singlePageDetectionThresholdMet = false;
|
|
4331
|
-
}
|
|
4332
|
-
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'));
|
|
4333
|
-
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
4334
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
4335
|
-
if (focusPrediction) {
|
|
4336
|
-
focusScore = focusPrediction.score;
|
|
4337
|
-
focusPredictionTime = focusPrediction.predictionTime;
|
|
4338
|
-
}
|
|
4339
|
-
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
4340
|
-
focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
|
|
4341
|
-
focusThresholdMet = focusScore >= focusThreshold;
|
|
4342
|
-
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
4343
|
-
bestFocusScore.current = focusScore;
|
|
4344
|
-
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
4345
|
-
bestFrameDetails.current = {
|
|
4346
|
-
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
4347
|
-
documentType: prediction.detectedDocumentType,
|
|
4348
|
-
detectionScore: prediction.detectionScore,
|
|
4349
|
-
focusScore: focusScore
|
|
4350
|
-
};
|
|
4351
|
-
}
|
|
4352
|
-
}
|
|
4353
|
-
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
4354
|
-
focusScore: focusScore,
|
|
4355
|
-
focusPredictionTime: focusPredictionTime,
|
|
4356
|
-
focusThresholdMet: focusThresholdMet
|
|
4357
|
-
}));
|
|
4358
|
-
return [2 /*return*/];
|
|
4359
|
-
});
|
|
4360
|
-
});
|
|
4361
|
-
});
|
|
4362
|
-
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
4363
|
-
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
4364
|
-
React.useEffect(function handleModelErrors() {
|
|
4365
|
-
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
4366
|
-
}, [modelError, onModelError]);
|
|
4367
|
-
var onPredictionMade = React.useCallback(function (handler) {
|
|
4368
|
-
onPredictionHandler.current = handler;
|
|
4369
|
-
}, []);
|
|
4370
|
-
var getBestFrame = React.useCallback(function () {
|
|
4371
|
-
if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
|
|
4372
|
-
return _assign(_assign({}, bestFrameDetails.current), {
|
|
4373
|
-
canvas: bestPredictionCanvas.current
|
|
4374
|
-
});
|
|
4375
|
-
}, []);
|
|
4376
|
-
var _f = React.useState(0),
|
|
4377
|
-
canvasKey = _f[0],
|
|
4378
|
-
setCanvasKey = _f[1];
|
|
4379
|
-
var resetBestFrame = React.useCallback(function () {
|
|
4380
|
-
stopDetection.current += 1;
|
|
4381
|
-
setCanvasKey(function (n) {
|
|
4382
|
-
return n + 1;
|
|
4383
|
-
});
|
|
4384
|
-
clearDocumentDetectionLastPredictionCanvas();
|
|
4385
|
-
bestFrameDetails.current = null;
|
|
4386
|
-
bestFocusScore.current = 0;
|
|
4387
|
-
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
4388
|
-
React.useEffect(function () {
|
|
4389
|
-
if (requiredDocumentType) resetBestFrame();
|
|
4390
|
-
}, [requiredDocumentType, resetBestFrame]);
|
|
4391
|
-
var load = React.useCallback(function () {
|
|
4392
|
-
loadDocumentDetectionModel();
|
|
4393
|
-
loadFocusModel();
|
|
4394
|
-
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
4395
|
-
var value = React.useMemo(function () {
|
|
4396
|
-
return {
|
|
4397
|
-
ready: documentDetectionModelReady && focusModelReady,
|
|
4398
|
-
modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
|
|
4399
|
-
modelError: modelError,
|
|
4400
|
-
start: startDocumentDetection,
|
|
4401
|
-
stop: stopDocumentDetection,
|
|
4402
|
-
load: load,
|
|
4403
|
-
thresholds: thresholds,
|
|
4404
|
-
setThresholds: setThresholds,
|
|
4405
|
-
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
4406
|
-
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
4407
|
-
onPredictionMade: onPredictionMade,
|
|
4408
|
-
detectionTime: detectionTime,
|
|
4409
|
-
focusPredictionTime: focusPredictionTime,
|
|
4410
|
-
getBestFrame: getBestFrame,
|
|
4411
|
-
resetBestFrame: resetBestFrame,
|
|
4412
|
-
bestFrameDetails: bestFrameDetails,
|
|
4413
|
-
requiredDocumentType: requiredDocumentType,
|
|
4414
|
-
setRequiredDocumentType: setRequiredDocumentType
|
|
4415
|
-
};
|
|
4416
|
-
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4417
|
-
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
|
|
4418
|
-
value: value
|
|
4419
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4420
|
-
key: canvasKey,
|
|
4421
|
-
ref: bestPredictionCanvas
|
|
4422
|
-
}), children);
|
|
4423
|
-
}
|
|
4424
|
-
function IdCaptureModelsProvider(_a) {
|
|
4425
|
-
var children = _a.children,
|
|
4426
|
-
props = __rest(_a, ["children"]);
|
|
4427
|
-
return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
|
|
4428
|
-
}
|
|
4429
|
-
|
|
4430
|
-
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
4431
|
-
|
|
4432
|
-
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
4433
|
-
idCardFront: ['idCardFront'],
|
|
4434
|
-
idCardBack: ['idCardBack'],
|
|
4435
|
-
passport: ['passport'],
|
|
4436
|
-
idCard: ['idCardFront', 'idCardBack'],
|
|
4437
|
-
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
4438
|
-
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
4439
|
-
};
|
|
4440
|
-
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4441
|
-
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
4442
|
-
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
4443
|
-
}
|
|
4444
|
-
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4445
|
-
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
4446
|
-
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
4447
|
-
}
|
|
4448
|
-
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
4449
|
-
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
4450
|
-
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
4451
|
-
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
4452
|
-
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
4453
|
-
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4454
|
-
return !v.includes('idCard');
|
|
4455
|
-
});
|
|
4456
|
-
}
|
|
4457
|
-
if (isIdCardOrPassport) {
|
|
4458
|
-
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4459
|
-
return v !== 'passport';
|
|
4460
|
-
});
|
|
4461
|
-
}
|
|
4462
|
-
return acceptedTypes.filter(function (v) {
|
|
4463
|
-
return !(v in capturedDocuments);
|
|
4464
|
-
});
|
|
4465
|
-
}
|
|
4466
|
-
|
|
4467
|
-
var initialState$4 = {
|
|
4468
|
-
initialDrawComplete: false,
|
|
4469
|
-
redrawing: false,
|
|
4470
|
-
guideRectX: 0,
|
|
4471
|
-
guideRectY: 0,
|
|
4472
|
-
guideRectWidth: 0,
|
|
4473
|
-
guideRectHeight: 0,
|
|
4474
|
-
guideRectOffsetTop: 0,
|
|
4475
|
-
guideImageWidth: 0,
|
|
4476
|
-
guideImageHeight: 0,
|
|
4477
|
-
pageWidth: 0,
|
|
4478
|
-
pageHeight: 0,
|
|
4479
|
-
videoWidth: 0,
|
|
4480
|
-
videoHeight: 0,
|
|
4481
|
-
detectedObjects: [],
|
|
4482
|
-
bestDocument: undefined,
|
|
4483
|
-
detectedDocumentType: 'none',
|
|
4484
|
-
detectionThresholdMet: false,
|
|
4485
|
-
documentInBounds: false,
|
|
4486
|
-
documentTooClose: false,
|
|
4487
|
-
documentIsStable: false,
|
|
4488
|
-
flipRequired: false,
|
|
4489
|
-
backDetectedFirst: false,
|
|
4490
|
-
idCardDetectedButNotAllowed: false,
|
|
4491
|
-
passportDetectedButNotAllowed: false,
|
|
4492
|
-
enableOverrideWrongDocumentTypeDialog: false,
|
|
4493
|
-
allowOverrideWrongDocumentTypeAfterMs: 8000,
|
|
4494
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4495
|
-
overrideWrongDocumentTypeGuidance: false,
|
|
4496
|
-
wrongDocumentTypePredictions: 0,
|
|
4497
|
-
idCardFrontDetectionScore: 0,
|
|
4498
|
-
idCardFrontDetectionThresholdMet: false,
|
|
4499
|
-
idCardBackDetectionScore: 0,
|
|
4500
|
-
idCardBackDetectionThresholdMet: false,
|
|
4501
|
-
passportDetectionScore: 0,
|
|
4502
|
-
passportDetectionThresholdMet: false,
|
|
4503
|
-
singlePageDetectionScore: 0,
|
|
4504
|
-
singlePageDetectionThresholdMet: false,
|
|
4505
|
-
focusScore: 0,
|
|
4506
|
-
focusThresholdMet: false,
|
|
4507
|
-
isGoodFrame: false,
|
|
4508
|
-
goodFramesCount: 0,
|
|
4509
|
-
goodFramesThreshold: 3,
|
|
4510
|
-
goodFramesThresholdMet: false,
|
|
4511
|
-
lastFrameCapturedAt: null,
|
|
4512
|
-
frameCaptureRate: 0,
|
|
4513
|
-
capturing: false,
|
|
4514
|
-
captureFailed: false,
|
|
4515
|
-
imageUrl: null,
|
|
4516
|
-
captureState: 'initializing',
|
|
4517
|
-
capturedDocuments: {},
|
|
4518
|
-
captureRequirement: 'idCardOrPassport',
|
|
4519
|
-
requestedDocumentType: 'idCardFront',
|
|
4520
|
-
allowSinglePageIdCapture: false,
|
|
4521
|
-
allowIdCardBackToFrontCapture: false,
|
|
4522
|
-
allowUploadingDocumentsFromStorage: false,
|
|
4523
|
-
isUploadingDocumentsFromStorage: false,
|
|
4524
|
-
uploadingDocumentsType: null,
|
|
4525
|
-
operationStartedAt: null,
|
|
4526
|
-
captureStartedAt: null,
|
|
4527
|
-
dispatch: function dispatch() {
|
|
4528
|
-
return null;
|
|
4529
|
-
}
|
|
4530
|
-
};
|
|
4531
|
-
var _reducer = function reducer(state, action) {
|
|
4532
|
-
var _a;
|
|
4533
|
-
switch (action.type) {
|
|
4534
|
-
case 'configureWizard':
|
|
4535
|
-
{
|
|
4536
|
-
var _b = action.payload,
|
|
4537
|
-
captureRequirement = _b.captureRequirement,
|
|
4538
|
-
precapturedDocuments = _b.precapturedDocuments,
|
|
4539
|
-
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
4540
|
-
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
4541
|
-
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
4542
|
-
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
4543
|
-
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
4544
|
-
var newState = _assign(_assign({}, state), {
|
|
4545
|
-
captureRequirement: captureRequirement,
|
|
4546
|
-
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
4547
|
-
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
4548
|
-
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
4549
|
-
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
4550
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
4551
|
-
});
|
|
4552
|
-
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
4553
|
-
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
4554
|
-
if (precapturedDocuments) {
|
|
4555
|
-
for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
|
|
4556
|
-
var k = CapturedDocumentTypeValues_1[_i];
|
|
4557
|
-
var payload = precapturedDocuments[k];
|
|
4558
|
-
if (payload) {
|
|
4559
|
-
newState.requestedDocumentType = k;
|
|
4560
|
-
newState = _reducer(newState, {
|
|
4561
|
-
type: 'documentCaptured',
|
|
4562
|
-
payload: payload
|
|
4563
|
-
});
|
|
4564
|
-
}
|
|
4565
|
-
}
|
|
4566
|
-
}
|
|
4567
|
-
if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
|
|
4568
|
-
newState.captureState = 'capturing';
|
|
4569
|
-
}
|
|
4570
|
-
return newState;
|
|
4571
|
-
}
|
|
4572
|
-
case 'setRequiredDocumentType':
|
|
4573
|
-
return _assign(_assign({}, state), {
|
|
4574
|
-
requiredDocumentType: action.payload
|
|
4575
|
-
});
|
|
4576
|
-
case 'redrawRequested':
|
|
4577
|
-
return _assign(_assign({}, state), {
|
|
4578
|
-
redrawing: true,
|
|
4579
|
-
guideRectX: 0,
|
|
4580
|
-
guideRectY: 0,
|
|
4581
|
-
guideRectWidth: 0,
|
|
4582
|
-
guideRectHeight: 0,
|
|
4583
|
-
guideRectOffsetTop: 0
|
|
4584
|
-
});
|
|
4585
|
-
case 'redrawInProgress':
|
|
4586
|
-
return _assign(_assign({}, state), {
|
|
4587
|
-
redrawing: false,
|
|
4588
|
-
guideRectX: 0,
|
|
4589
|
-
guideRectY: 0,
|
|
4590
|
-
guideRectWidth: 0,
|
|
4591
|
-
guideRectHeight: 0,
|
|
4592
|
-
guideRectOffsetTop: 0
|
|
4593
|
-
});
|
|
4594
|
-
case 'redrawCompleted':
|
|
4595
|
-
return _assign(_assign(_assign({}, state), action.payload), {
|
|
4596
|
-
initialDrawComplete: true
|
|
4597
|
-
});
|
|
4598
|
-
case 'pageRendered':
|
|
4599
|
-
return _assign(_assign({}, state), action.payload);
|
|
4600
|
-
case 'guideImageLoaded':
|
|
4601
|
-
return _assign(_assign({}, state), {
|
|
4602
|
-
guideImageWidth: action.payload.width,
|
|
4603
|
-
guideImageHeight: action.payload.height
|
|
4604
|
-
});
|
|
4605
|
-
case 'objectsDetected':
|
|
4606
|
-
{
|
|
4607
|
-
var _c = action.payload.prediction,
|
|
4608
|
-
detectedObjects = _c.detectedObjects,
|
|
4609
|
-
detectionThresholdMet = _c.detectionThresholdMet,
|
|
4610
|
-
detectedDocumentType = _c.detectedDocumentType,
|
|
4611
|
-
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
4612
|
-
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
4613
|
-
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
4614
|
-
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
4615
|
-
passportDetectionScore = _c.passportDetectionScore,
|
|
4616
|
-
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
4617
|
-
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
4618
|
-
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
4619
|
-
bestDocument = _c.bestDocument,
|
|
4620
|
-
documentInBounds = _c.documentInBounds,
|
|
4621
|
-
documentTooClose = _c.documentTooClose,
|
|
4622
|
-
documentIsStable = _c.documentIsStable,
|
|
4623
|
-
focusScore = _c.focusScore,
|
|
4624
|
-
focusThresholdMet = _c.focusThresholdMet,
|
|
4625
|
-
frameWidth = _c.frameWidth,
|
|
4626
|
-
frameHeight = _c.frameHeight;
|
|
4627
|
-
var frameCapturedAt = new Date();
|
|
4628
|
-
var frameCaptureRate = 0;
|
|
4629
|
-
var goodFramesThreshold = state.goodFramesThreshold;
|
|
4630
|
-
if (state.lastFrameCapturedAt) {
|
|
4631
|
-
var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
4632
|
-
if (frameTime > 0) {
|
|
4633
|
-
frameCaptureRate = 1000.0 / frameTime;
|
|
4634
|
-
if (frameCaptureRate > 0) {
|
|
4635
|
-
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
4636
|
-
}
|
|
4637
|
-
}
|
|
4638
|
-
}
|
|
4639
|
-
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
4640
|
-
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
4641
|
-
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
4642
|
-
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
4643
|
-
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
4644
|
-
var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
|
|
4645
|
-
var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
|
|
4646
|
-
var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
|
|
4647
|
-
var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
|
|
4648
|
-
var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
4649
|
-
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
4650
|
-
wrongDocumentTypePredictions += 1;
|
|
4651
|
-
}
|
|
4652
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
4653
|
-
var captureStartedAt = state.captureStartedAt;
|
|
4654
|
-
var goodFramesCount = state.goodFramesCount;
|
|
4655
|
-
if (isGoodFrame) {
|
|
4656
|
-
goodFramesCount += 1;
|
|
4657
|
-
captureStartedAt || (captureStartedAt = new Date());
|
|
4658
|
-
}
|
|
4659
|
-
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
4660
|
-
var requestedDocumentType = state.requestedDocumentType;
|
|
4661
|
-
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
4662
|
-
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
4663
|
-
requestedDocumentType = 'idCardFront';
|
|
4664
|
-
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
4665
|
-
requestedDocumentType = 'idCardBack';
|
|
4666
|
-
}
|
|
4667
|
-
}
|
|
4668
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4669
|
-
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
4670
|
-
requestedDocumentType = 'passport';
|
|
4671
|
-
}
|
|
4672
|
-
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
4673
|
-
requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
|
|
4677
|
-
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
4678
|
-
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
4679
|
-
return _assign(_assign({}, state), {
|
|
4680
|
-
videoWidth: frameWidth,
|
|
4681
|
-
videoHeight: frameHeight,
|
|
4682
|
-
detectedObjects: detectedObjects,
|
|
4683
|
-
bestDocument: bestDocument,
|
|
4684
|
-
requestedDocumentType: requestedDocumentType,
|
|
4685
|
-
detectedDocumentType: detectedDocumentType,
|
|
4686
|
-
detectionThresholdMet: detectionThresholdMet,
|
|
4687
|
-
documentInBounds: documentInBounds,
|
|
4688
|
-
documentTooClose: documentTooClose,
|
|
4689
|
-
documentIsStable: documentIsStable,
|
|
4690
|
-
flipRequired: flipRequired,
|
|
4691
|
-
backDetectedFirst: backDetectedFirst,
|
|
4692
|
-
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
4693
|
-
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
4694
|
-
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
4695
|
-
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
4696
|
-
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4697
|
-
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4698
|
-
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4699
|
-
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4700
|
-
passportDetectionScore: passportDetectionScore,
|
|
4701
|
-
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4702
|
-
singlePageDetectionScore: singlePageDetectionScore,
|
|
4703
|
-
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
4704
|
-
focusScore: focusScore,
|
|
4705
|
-
focusThresholdMet: focusThresholdMet,
|
|
4706
|
-
isGoodFrame: isGoodFrame,
|
|
4707
|
-
goodFramesCount: goodFramesCount,
|
|
4708
|
-
goodFramesThreshold: goodFramesThreshold,
|
|
4709
|
-
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
4710
|
-
captureStartedAt: captureStartedAt,
|
|
4711
|
-
lastFrameCapturedAt: frameCapturedAt,
|
|
4712
|
-
frameCaptureRate: frameCaptureRate
|
|
4713
|
-
});
|
|
4714
|
-
}
|
|
4715
|
-
case 'captureInitialized':
|
|
4716
|
-
return _assign(_assign({}, state), {
|
|
4717
|
-
captureState: 'capturing',
|
|
4718
|
-
isUploadingDocumentsFromStorage: false
|
|
4719
|
-
});
|
|
4720
|
-
case 'captureStarted':
|
|
4721
|
-
return _assign(_assign({}, state), {
|
|
4722
|
-
operationStartedAt: new Date(),
|
|
4723
|
-
captureStartedAt: null,
|
|
4724
|
-
capturing: false,
|
|
4725
|
-
captureFailed: false
|
|
4726
|
-
});
|
|
4727
|
-
case 'capturing':
|
|
4728
|
-
return _assign(_assign({}, state), {
|
|
4729
|
-
capturing: true,
|
|
4730
|
-
captureFailed: false
|
|
4731
|
-
});
|
|
4732
|
-
case 'captured':
|
|
4733
|
-
return _assign(_assign({}, state), {
|
|
4734
|
-
capturing: false,
|
|
4735
|
-
captureFailed: false
|
|
4736
|
-
});
|
|
4737
|
-
case 'frameCaptured':
|
|
4738
|
-
return _assign(_assign({}, state), {
|
|
4739
|
-
imageUrl: action.payload.imageUrl
|
|
4740
|
-
});
|
|
4741
|
-
case 'captureFailed':
|
|
4742
|
-
return _assign(_assign({}, state), {
|
|
4743
|
-
capturing: false,
|
|
4744
|
-
captureFailed: true
|
|
4745
|
-
});
|
|
4746
|
-
case 'documentCaptured':
|
|
4747
|
-
{
|
|
4748
|
-
var newState = _assign(_assign({}, state), {
|
|
4749
|
-
capturing: false,
|
|
4750
|
-
captureFailed: false,
|
|
4751
|
-
allowOverrideFlipRequirement: false,
|
|
4752
|
-
overrideFlipRequirement: false,
|
|
4753
|
-
goodFramesCount: 0,
|
|
4754
|
-
wrongDocumentTypePredictions: 0,
|
|
4755
|
-
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
4756
|
-
});
|
|
4757
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4758
|
-
if (remainingRequirements.length === 0) {
|
|
4759
|
-
newState.captureState = 'complete';
|
|
4760
|
-
} else {
|
|
4761
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
4762
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4763
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4764
|
-
newState.captureState = 'requestingFlip';
|
|
4765
|
-
}
|
|
4766
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
4767
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
4768
|
-
newState.passportDetectionThresholdMet = false;
|
|
4769
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
4770
|
-
}
|
|
4771
|
-
}
|
|
4772
|
-
return newState;
|
|
4773
|
-
}
|
|
4774
|
-
case 'documentCapturedManually':
|
|
4775
|
-
return _reducer(state, {
|
|
4776
|
-
type: 'documentCaptured',
|
|
4777
|
-
payload: _assign(_assign({}, action.payload), {
|
|
4778
|
-
documentType: state.requestedDocumentType,
|
|
4779
|
-
width: 0,
|
|
4780
|
-
height: 0
|
|
4781
|
-
})
|
|
4782
|
-
});
|
|
4783
|
-
case 'documentsCaptured':
|
|
4784
|
-
{
|
|
4785
|
-
var newState = _assign({}, state);
|
|
4786
|
-
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
4787
|
-
var doc = _e[_d];
|
|
4788
|
-
newState = _reducer(newState, {
|
|
4789
|
-
type: 'documentCaptured',
|
|
4790
|
-
payload: doc
|
|
4791
|
-
});
|
|
4792
|
-
}
|
|
4793
|
-
return newState;
|
|
4794
|
-
}
|
|
4795
|
-
case 'flipRequestCompleted':
|
|
4796
|
-
return _assign(_assign({}, state), {
|
|
4797
|
-
captureState: 'capturing',
|
|
4798
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4799
|
-
overrideWrongDocumentTypeGuidance: false,
|
|
4800
|
-
wrongDocumentTypePredictions: 0
|
|
4801
|
-
});
|
|
4802
|
-
case 'allowOverrideFlipRequirement':
|
|
4803
|
-
return _assign(_assign({}, state), {
|
|
4804
|
-
allowOverrideWrongDocumentTypeGuidance: true
|
|
4805
|
-
});
|
|
4806
|
-
case 'overrideFlipRequirement':
|
|
4807
|
-
return _assign(_assign({}, state), {
|
|
4808
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4809
|
-
overrideWrongDocumentTypeGuidance: true
|
|
4810
|
-
});
|
|
4811
|
-
case 'setUploadingDocumentsFromStorage':
|
|
4812
|
-
return _assign(_assign({}, state), {
|
|
4813
|
-
isUploadingDocumentsFromStorage: action.payload,
|
|
4814
|
-
captureState: action.payload ? 'initializing' : 'capturing'
|
|
4815
|
-
});
|
|
4816
|
-
case 'setUploadingDocumentsType':
|
|
4817
|
-
{
|
|
4818
|
-
var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
|
|
4819
|
-
var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
|
|
4820
|
-
return _assign(_assign({}, state), {
|
|
4821
|
-
captureState: action.payload ? 'uploading' : 'initializing',
|
|
4822
|
-
uploadingDocumentsType: uploadingDocumentsType,
|
|
4823
|
-
requestedDocumentType: requestedDocumentType
|
|
4824
|
-
});
|
|
4825
|
-
}
|
|
4826
|
-
case 'resetWizard':
|
|
4827
|
-
return _assign(_assign({}, initialState$4), {
|
|
4828
|
-
dispatch: state.dispatch,
|
|
4829
|
-
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
4830
|
-
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
4831
|
-
captureRequirement: state.captureRequirement,
|
|
4832
|
-
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
4833
|
-
});
|
|
4834
|
-
default:
|
|
4835
|
-
return state;
|
|
4836
|
-
}
|
|
4837
|
-
};
|
|
4838
|
-
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
4839
|
-
return _assign(_assign({}, initialState$4), {
|
|
4840
|
-
dispatch: function dispatch(action) {
|
|
4841
|
-
return set(function (state) {
|
|
4842
|
-
return _reducer(state, action);
|
|
4843
|
-
}, undefined, action);
|
|
4844
|
-
}
|
|
4845
|
-
});
|
|
4846
|
-
}));
|
|
4847
|
-
function IdCaptureStateProvider(_a) {
|
|
4848
|
-
var children = _a.children;
|
|
4849
|
-
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
|
|
4850
|
-
return state.overrideWrongDocumentTypeGuidance;
|
|
4851
|
-
}));
|
|
4852
|
-
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
4853
|
-
React.useEffect(function () {
|
|
4854
|
-
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
4855
|
-
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
4856
|
-
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
4857
|
-
dispatchIdCaptureAction({
|
|
4858
|
-
type: 'redrawRequested'
|
|
4859
|
-
});
|
|
4860
|
-
}, 500);
|
|
4861
|
-
React.useLayoutEffect(function () {
|
|
4862
|
-
if (typeof window === 'undefined') return;
|
|
4863
|
-
window.addEventListener('resize', onResize);
|
|
4864
|
-
return function () {
|
|
4865
|
-
return window.removeEventListener('resize', onResize);
|
|
4866
|
-
};
|
|
4867
|
-
}, [onResize]);
|
|
4868
|
-
React.useEffect(function resetWhenProviderUnmounts() {
|
|
4869
|
-
return function () {
|
|
4870
|
-
return useIdCaptureStore.getState().dispatch({
|
|
4871
|
-
type: 'resetWizard'
|
|
4872
|
-
});
|
|
4873
|
-
};
|
|
4874
|
-
}, []);
|
|
4875
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
4876
|
-
}
|
|
4877
|
-
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
4878
|
-
return useIdCaptureStore.getState().dispatch(action);
|
|
4879
|
-
};
|
|
4880
|
-
|
|
4881
|
-
function DebugStatsPane(_a) {
|
|
4882
|
-
var children = _a.children;
|
|
4883
|
-
var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
|
|
4884
|
-
var portalLocation = document.getElementById('idmission-above-guides-content');
|
|
4885
|
-
if (!portalLocation) return element;
|
|
4886
|
-
return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
|
|
4887
|
-
}
|
|
4888
|
-
var DebugStatsPaneDiv = styled__default.default.span(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
|
|
4889
|
-
var ObjectDetectionDebugOverlayDiv = styled__default.default.div(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
4890
|
-
var $flipX = _a.$flipX;
|
|
4891
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4892
|
-
});
|
|
4893
|
-
var ObjectDetectionDebugBox = styled__default.default.div(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
4894
|
-
var $color = _a.$color;
|
|
4895
|
-
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
4896
|
-
}, function (_a) {
|
|
4897
|
-
var $color = _a.$color;
|
|
4898
|
-
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
4899
|
-
}, function (_a) {
|
|
4900
|
-
var $flipX = _a.$flipX;
|
|
4901
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4902
|
-
});
|
|
4903
|
-
var FaceDetectionKeypointMarker = styled__default.default.div(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
4904
|
-
var $color = _a.$color;
|
|
4905
|
-
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
4906
|
-
}, function (_a) {
|
|
4907
|
-
var $color = _a.$color;
|
|
4908
|
-
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
4909
|
-
}, function (_a) {
|
|
4910
|
-
var $flipX = _a.$flipX;
|
|
4911
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4912
|
-
});
|
|
4913
|
-
function useDebugScalingDetails(_a) {
|
|
4914
|
-
var _b = _a.enabled,
|
|
4915
|
-
enabled = _b === void 0 ? true : _b,
|
|
4916
|
-
pageWidth = _a.pageWidth,
|
|
4917
|
-
pageHeight = _a.pageHeight,
|
|
4918
|
-
videoWidth = _a.videoWidth,
|
|
4919
|
-
videoHeight = _a.videoHeight;
|
|
4920
|
-
return React.useMemo(function () {
|
|
4921
|
-
var horizontal = false,
|
|
4922
|
-
scaledWidth = 0,
|
|
4923
|
-
scaledHeight = 0,
|
|
4924
|
-
xOffset = 0,
|
|
4925
|
-
yOffset = 0;
|
|
4926
|
-
if (enabled) {
|
|
4927
|
-
horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
|
|
4928
|
-
if (horizontal) {
|
|
4929
|
-
scaledWidth = videoWidth * (pageHeight / videoHeight);
|
|
4930
|
-
xOffset = (scaledWidth - pageWidth) / 2;
|
|
4931
|
-
} else {
|
|
4932
|
-
scaledHeight = videoHeight * (pageWidth / videoWidth);
|
|
4933
|
-
yOffset = (scaledHeight - pageHeight) / 2;
|
|
4934
|
-
}
|
|
4935
|
-
}
|
|
4936
|
-
return {
|
|
4937
|
-
horizontal: horizontal,
|
|
4938
|
-
pageWidth: pageWidth,
|
|
4939
|
-
pageHeight: pageHeight,
|
|
4940
|
-
videoWidth: videoWidth,
|
|
4941
|
-
videoHeight: videoHeight,
|
|
4942
|
-
scaledWidth: scaledWidth,
|
|
4943
|
-
scaledHeight: scaledHeight,
|
|
4944
|
-
xOffset: xOffset,
|
|
4945
|
-
yOffset: yOffset
|
|
4946
|
-
};
|
|
4947
|
-
}, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
|
|
4948
|
-
}
|
|
4949
|
-
var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
4950
|
-
var scaling = _a.scaling,
|
|
4951
|
-
$flipX = _a.$flipX,
|
|
4952
|
-
children = _a.children;
|
|
4953
|
-
var _b = useIdCaptureStore(),
|
|
4954
|
-
guideRectWidth = _b.guideRectWidth,
|
|
4955
|
-
guideRectHeight = _b.guideRectHeight,
|
|
4956
|
-
guideRectX = _b.guideRectX,
|
|
4957
|
-
guideRectY = _b.guideRectY;
|
|
4958
|
-
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
4959
|
-
id: "debug-overlay-div",
|
|
4960
|
-
"$flipX": $flipX,
|
|
4961
|
-
style: {
|
|
4962
|
-
top: guideRectY,
|
|
4963
|
-
left: guideRectX,
|
|
4964
|
-
width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
|
|
4965
|
-
height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
|
|
4966
|
-
}
|
|
4967
|
-
}, children);
|
|
4968
|
-
};
|
|
4969
|
-
function IdCaptureDetectedObjectDebugBox(_a) {
|
|
4970
|
-
var obj = _a.obj,
|
|
4971
|
-
flipX = _a.flipX,
|
|
4972
|
-
_b = _a.color,
|
|
4973
|
-
color = _b === void 0 ? 'green' : _b,
|
|
4974
|
-
scaling = _a.scaling;
|
|
4975
|
-
var horizontal = scaling.horizontal,
|
|
4976
|
-
pageWidth = scaling.pageWidth,
|
|
4977
|
-
pageHeight = scaling.pageHeight,
|
|
4978
|
-
videoWidth = scaling.videoWidth,
|
|
4979
|
-
videoHeight = scaling.videoHeight,
|
|
4980
|
-
scaledWidth = scaling.scaledWidth,
|
|
4981
|
-
scaledHeight = scaling.scaledHeight,
|
|
4982
|
-
xOffset = scaling.xOffset,
|
|
4983
|
-
yOffset = scaling.yOffset;
|
|
4984
|
-
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
4985
|
-
var top;
|
|
4986
|
-
var left;
|
|
4987
|
-
var width;
|
|
4988
|
-
var height;
|
|
4989
|
-
if (horizontal) {
|
|
4990
|
-
top = obj.box.yMin / videoHeight * pageHeight;
|
|
4991
|
-
left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
4992
|
-
width = obj.box.width / videoWidth * scaledWidth;
|
|
4993
|
-
height = obj.box.height / videoHeight * pageHeight;
|
|
4994
|
-
} else {
|
|
4995
|
-
top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
4996
|
-
left = obj.box.xMin / videoWidth * pageWidth;
|
|
4997
|
-
width = obj.box.width / videoWidth * pageWidth;
|
|
4998
|
-
height = obj.box.height / videoHeight * scaledHeight;
|
|
4999
|
-
}
|
|
5000
|
-
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
5001
|
-
"$flipX": flipX,
|
|
5002
|
-
"$color": color,
|
|
5003
|
-
style: {
|
|
5004
|
-
top: top,
|
|
5005
|
-
left: left,
|
|
5006
|
-
width: width,
|
|
5007
|
-
height: height
|
|
5008
|
-
}
|
|
5009
|
-
});
|
|
5010
|
-
}
|
|
5011
|
-
function SelfieCaptureFaceDebugBox(_a) {
|
|
5012
|
-
var face = _a.face,
|
|
5013
|
-
flipX = _a.flipX,
|
|
5014
|
-
_b = _a.color,
|
|
5015
|
-
color = _b === void 0 ? 'green' : _b,
|
|
5016
|
-
scaling = _a.scaling;
|
|
5017
|
-
var horizontal = scaling.horizontal,
|
|
5018
|
-
pageWidth = scaling.pageWidth,
|
|
5019
|
-
pageHeight = scaling.pageHeight,
|
|
5020
|
-
videoWidth = scaling.videoWidth,
|
|
5021
|
-
videoHeight = scaling.videoHeight,
|
|
5022
|
-
scaledWidth = scaling.scaledWidth,
|
|
5023
|
-
scaledHeight = scaling.scaledHeight,
|
|
5024
|
-
xOffset = scaling.xOffset,
|
|
5025
|
-
yOffset = scaling.yOffset;
|
|
5026
|
-
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
5027
|
-
var top;
|
|
5028
|
-
var left;
|
|
5029
|
-
var width;
|
|
5030
|
-
var height;
|
|
5031
|
-
if (horizontal) {
|
|
5032
|
-
top = face.box.yMin / videoHeight * pageHeight;
|
|
5033
|
-
left = face.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
5034
|
-
width = face.box.width / videoWidth * scaledWidth;
|
|
5035
|
-
height = face.box.height / videoHeight * pageHeight;
|
|
5036
|
-
} else {
|
|
5037
|
-
top = face.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
5038
|
-
left = face.box.xMin / videoWidth * pageWidth;
|
|
5039
|
-
width = face.box.width / videoWidth * pageWidth;
|
|
5040
|
-
height = face.box.height / videoHeight * scaledHeight;
|
|
5041
|
-
}
|
|
5042
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
5043
|
-
"$flipX": flipX,
|
|
5044
|
-
"$color": color,
|
|
5045
|
-
style: {
|
|
5046
|
-
top: top,
|
|
5047
|
-
left: left,
|
|
5048
|
-
width: width,
|
|
5049
|
-
height: height
|
|
5050
|
-
}
|
|
5051
|
-
}), face.keypoints.map(function (point, ii) {
|
|
5052
|
-
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
|
|
5053
|
-
key: ii,
|
|
5054
|
-
point: point,
|
|
5055
|
-
scaling: scaling,
|
|
5056
|
-
flipX: flipX
|
|
5057
|
-
});
|
|
5058
|
-
}));
|
|
5059
|
-
}
|
|
5060
|
-
function SelfieCaptureFaceKeypoint(_a) {
|
|
5061
|
-
var point = _a.point,
|
|
5062
|
-
flipX = _a.flipX,
|
|
5063
|
-
_b = _a.color,
|
|
5064
|
-
color = _b === void 0 ? 'red' : _b,
|
|
5065
|
-
_c = _a.scaling,
|
|
5066
|
-
horizontal = _c.horizontal,
|
|
5067
|
-
pageWidth = _c.pageWidth,
|
|
5068
|
-
pageHeight = _c.pageHeight,
|
|
5069
|
-
videoWidth = _c.videoWidth,
|
|
5070
|
-
videoHeight = _c.videoHeight,
|
|
5071
|
-
scaledWidth = _c.scaledWidth,
|
|
5072
|
-
scaledHeight = _c.scaledHeight,
|
|
5073
|
-
xOffset = _c.xOffset,
|
|
5074
|
-
yOffset = _c.yOffset;
|
|
5075
|
-
var left, top;
|
|
5076
|
-
if (horizontal) {
|
|
5077
|
-
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
5078
|
-
top = point.y / videoHeight * pageHeight;
|
|
5079
|
-
} else {
|
|
5080
|
-
left = point.x / videoWidth * pageWidth;
|
|
5081
|
-
top = point.y / videoHeight * scaledHeight - yOffset;
|
|
5082
|
-
}
|
|
5083
|
-
top -= 2;
|
|
5084
|
-
left -= 2;
|
|
5085
|
-
return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
|
|
5086
|
-
"$flipX": flipX,
|
|
5087
|
-
"$color": color,
|
|
5088
|
-
style: {
|
|
5089
|
-
top: top,
|
|
5090
|
-
left: left
|
|
5091
|
-
}
|
|
5092
|
-
});
|
|
5093
|
-
}
|
|
5094
|
-
var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
|
|
5095
|
-
|
|
5096
|
-
var en = {};
|
|
5097
|
-
|
|
5098
|
-
var es = {
|
|
5099
|
-
'English - en': 'Spanish - es',
|
|
5100
|
-
'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
|
|
5101
|
-
'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
|
|
5102
|
-
'Models warming up...': 'Preparando modelos...',
|
|
5103
|
-
'Camera initializing...': 'Inicializando la cámara...',
|
|
5104
|
-
'Camera access blocked': 'Acceso bloqueado a la cámara',
|
|
5105
|
-
'Location access blocked': 'Acceso bloqueado a la localización',
|
|
5106
|
-
Continue: 'Continuar',
|
|
5107
|
-
'Processing...': 'Procesando…',
|
|
5108
|
-
'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
|
|
5109
|
-
'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': 'Esta aplicación requiere el acceso a la cámara para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la cámara en el explorador actual.',
|
|
5110
|
-
'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
|
|
5111
|
-
'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere tener acceso al micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso al micrófono en el explorador actual.',
|
|
5112
|
-
'Your location permission is disabled': 'El permiso de la localización está desactivado',
|
|
5113
|
-
'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': 'Esta aplicación requiere el acceso a la localización para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la localización en el explorador actual.',
|
|
5114
|
-
Retry: 'Reintentar',
|
|
5115
|
-
'Scan the front of ID': 'Escanear el frente de la ID',
|
|
5116
|
-
'Scan the back of ID': 'Escanear el reverso de la ID',
|
|
5117
|
-
'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
|
|
5118
|
-
'ID Card Front': 'Frente de la identificación',
|
|
5119
|
-
'ID Card Back': 'Reverso de la identificación',
|
|
5120
|
-
Passport: 'Pasaporte',
|
|
5121
|
-
'Document not detected': 'No se ha detectado el documento',
|
|
5122
|
-
'Document is not centered': 'Documento no centrado',
|
|
5123
|
-
'Document too close please back up': 'Documento muy cerca, favor de alejarse',
|
|
5124
|
-
'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
|
|
5125
|
-
'Document out of focus – try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
|
|
5126
|
-
'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
|
|
5127
|
-
'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
|
|
5128
|
-
'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
|
|
5129
|
-
'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
|
|
5130
|
-
'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
|
|
5131
|
-
'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
|
|
5132
|
-
'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
|
|
5133
|
-
'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
|
|
5134
|
-
'Capturing...': 'Capturando...',
|
|
5135
|
-
'Capture failed!': '¡Error de captura!',
|
|
5136
|
-
'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
|
|
5137
|
-
'ID card front captured.': 'Se ha capturado el frente de la ID',
|
|
5138
|
-
'ID card back captured.': 'Se ha capturado el reverso de la ID',
|
|
5139
|
-
'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
|
|
5140
|
-
'Verify the entire ID was captured clearly with no glare.': 'Hay que verificar que toda la identificación se haya capturado con nitidez y sin reflejos.',
|
|
5141
|
-
Submit: 'Enviar',
|
|
5142
|
-
'Submitting...': 'Enviando...',
|
|
5143
|
-
'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
|
|
5144
|
-
'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
|
|
5145
|
-
'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
|
|
5146
|
-
'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
|
|
5147
|
-
'Please hold still...': 'Favor de no moverse...',
|
|
5148
|
-
'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
|
|
5149
|
-
'Move back...': 'Hay que moverse hacia atrás...',
|
|
5150
|
-
'Move forward...': 'Hay que moverse hacia adelante...',
|
|
5151
|
-
'Move to the center...': 'Hay que moverse hacia el centro...',
|
|
5152
|
-
'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
|
|
5153
|
-
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
|
|
5154
|
-
'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
|
|
5155
|
-
'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
|
|
5156
|
-
'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
|
|
5157
|
-
Exit: 'Salir',
|
|
5158
|
-
'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
|
|
5159
|
-
Done: 'Terminar',
|
|
5160
|
-
'Could not verify your face.': 'No se pudo verificar el rostro.',
|
|
5161
|
-
'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
|
|
5162
|
-
'Customer has been identified!': '¡Se ha identificado al cliente!',
|
|
5163
|
-
'Customer not found': 'Cliente no encontrado',
|
|
5164
|
-
'Additional document capture': 'Captura adicional de documentos',
|
|
5165
|
-
Next: 'Siguiente',
|
|
5166
|
-
'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
|
|
5167
|
-
Accept: 'Aceptar',
|
|
5168
|
-
Clear: 'Borrar',
|
|
5169
|
-
'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
|
|
5170
|
-
'Network unreachable': 'No hay conexión a internet.',
|
|
5171
|
-
"We're having trouble reaching our services please check your connection and try again.": '`Estamos teniendo problemas para alcanzar nuestros servicios, por favor hay que verificar la conexión a internet e intentar de nuevo.`',
|
|
5172
|
-
"We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
|
|
5173
|
-
'Document Capture': 'Captura de documento',
|
|
5174
|
-
Capture: 'Capturar',
|
|
5175
|
-
'Retry capture': 'Reintentar la captura',
|
|
5176
|
-
Upload: 'Enviar',
|
|
5177
|
-
'Uploading...': 'Procesando...',
|
|
5178
|
-
'Upload succeeded!': '¡Proceso completo!',
|
|
5179
|
-
'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
|
|
5180
|
-
'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
|
|
5181
|
-
'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
|
|
5182
|
-
'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
|
|
5183
|
-
'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
|
|
5184
|
-
'Searching for ID card...': 'Localizando la identificación...',
|
|
5185
|
-
'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
|
|
5186
|
-
'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
|
|
5187
|
-
'ID Front Image': 'Frente de la ID',
|
|
5188
|
-
'ID Back Image': 'Reverso de la ID',
|
|
5189
|
-
"We're having some trouble.": 'Se ha presentado un problema.',
|
|
5190
|
-
'On-device capture guidance failed, please capture a selfie manually.': 'La captura automática para toma de selfie falló. Por favor, hay que tomarse la selfie manualmente.',
|
|
5191
|
-
'Verifying...': 'Verificando....',
|
|
5192
|
-
'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
|
|
5193
|
-
'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
|
|
5194
|
-
'Please capture the front of your ID card, or the ID page of your passport.': 'Hay que capturar el frente de la identificación o la página de datos del pasaporte.',
|
|
5195
|
-
'Please capture the back of your ID card, or click Done if submitting a passport.': 'Hay que capturar el reverso de la identificación o hay que presionar el botón de Terminar si se trata de un pasaporte.',
|
|
5196
|
-
'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
|
|
5197
|
-
'On-device capture guidance failed, please capture a photo of your ID card manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación manualmente.',
|
|
5198
|
-
'On-device capture guidance failed, please capture a photo of your passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto del pasaporte manualmente.',
|
|
5199
|
-
'On-device capture guidance failed, please capture photos of your ID card and passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación y del pasaporte manualmente.',
|
|
5200
|
-
'On-device capture guidance failed, please capture photos of your ID card or passport manually.': 'La captura automática falló. Por favor hay que tomar una foto de la identificación o del pasaporte manualmente.',
|
|
5201
|
-
'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
|
|
5202
|
-
'Capture back of ID card': 'Captura del reverso',
|
|
5203
|
-
'Downloading...': 'Descargando...',
|
|
5204
|
-
'Accessing camera...': 'Accediendo a la cámara',
|
|
5205
|
-
'Camera ready': 'Cámara lista',
|
|
5206
|
-
'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
|
|
5207
|
-
'Guided capture experience ready': 'Experiencia guiada lista',
|
|
5208
|
-
"Let's Go!": '¡Vamos!',
|
|
5209
|
-
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': 'Estamos teniendo problemas para identificar el lado correcto de la identificación,¿continuar con la captura?',
|
|
5210
|
-
OK: 'Sí',
|
|
5211
|
-
'Capture with Camera': 'Capturar con la cámara',
|
|
5212
|
-
OR: 'O',
|
|
5213
|
-
'Upload from Storage': 'Adjuntar del almacenamiento',
|
|
5214
|
-
'Select ID Type': 'Seleccionar el tipo de ID',
|
|
5215
|
-
'ID Card': 'Identificación',
|
|
5216
|
-
'Upload Passport': 'Adjuntar pasaporte',
|
|
5217
|
-
'Upload ID Front': 'Adjuntar el frente de la ID',
|
|
5218
|
-
'Upload ID Back': 'Adjuntar el reverso de la ID',
|
|
5219
|
-
Cancel: 'Cancelar',
|
|
5220
|
-
'Upload the back of the ID if it is not included in the front image.': 'Adjuntar el reverso de la ID si no se incluye en la imagen del frente'
|
|
3537
|
+
var en = {};
|
|
3538
|
+
|
|
3539
|
+
var es = {
|
|
3540
|
+
'English - en': 'Spanish - es',
|
|
3541
|
+
'Use your device camera to capture your ID': 'Hay que utilizar la cámara del dispositivo para capturar la identificación',
|
|
3542
|
+
'Use your iPhone as a webcam': 'Hay que usar el iPhone como cámara web',
|
|
3543
|
+
'Models warming up...': 'Preparando modelos...',
|
|
3544
|
+
'Camera initializing...': 'Inicializando la cámara...',
|
|
3545
|
+
'Camera access blocked': 'Acceso bloqueado a la cámara',
|
|
3546
|
+
'Location access blocked': 'Acceso bloqueado a la localización',
|
|
3547
|
+
Continue: 'Continuar',
|
|
3548
|
+
'Processing...': 'Procesando…',
|
|
3549
|
+
'Your camera permission is disabled': 'El permiso de la cámara está desactivado',
|
|
3550
|
+
'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': 'Esta aplicación requiere el acceso a la cámara para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la cámara en el explorador actual.',
|
|
3551
|
+
'Your microphone permission is disabled': 'El permiso del micrófono está desactivado',
|
|
3552
|
+
'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': 'Esta aplicación requiere tener acceso al micrófono para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso al micrófono en el explorador actual.',
|
|
3553
|
+
'Your location permission is disabled': 'El permiso de la localización está desactivado',
|
|
3554
|
+
'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': 'Esta aplicación requiere el acceso a la localización para continuar. Hay que aceptar el permiso una vez que se muestre la ventana en el explorador. Si no aparece la ventana para otorgar permisos entonces hay que dirigirse a Configuración y otorgar el permiso a la localización en el explorador actual.',
|
|
3555
|
+
Retry: 'Reintentar',
|
|
3556
|
+
'Scan the front of ID': 'Escanear el frente de la ID',
|
|
3557
|
+
'Scan the back of ID': 'Escanear el reverso de la ID',
|
|
3558
|
+
'Scan the ID page of passport': 'Escanear la página de identificación del pasaporte',
|
|
3559
|
+
'ID Card Front': 'Frente de la identificación',
|
|
3560
|
+
'ID Card Back': 'Reverso de la identificación',
|
|
3561
|
+
Passport: 'Pasaporte',
|
|
3562
|
+
'Document not detected': 'No se ha detectado el documento',
|
|
3563
|
+
'Document is not centered': 'Documento no centrado',
|
|
3564
|
+
'Document too close please back up': 'Documento muy cerca, favor de alejarse',
|
|
3565
|
+
'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
|
|
3566
|
+
'Document out of focus – try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
|
|
3567
|
+
'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
|
|
3568
|
+
'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
|
|
3569
|
+
'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
|
|
3570
|
+
'Passport detected please scan an ID card instead': 'Se ha detectado un pasaporte, por favor hay que escanear una credencial',
|
|
3571
|
+
'Document detected, hold still...': 'Se ha detectado el documento, no moverse por favor...',
|
|
3572
|
+
'ID card front detected, hold still...': 'Frente de la ID detectado, no moverse...',
|
|
3573
|
+
'ID card back detected, hold still...': 'Reverso de la ID detectado, no moverse...',
|
|
3574
|
+
'Passport detected, hold still...': 'Pasaporte detectado, no moverse...',
|
|
3575
|
+
'Capturing...': 'Capturando...',
|
|
3576
|
+
'Capture failed!': '¡Error de captura!',
|
|
3577
|
+
'Please flip your ID card...': 'Por favor, hay que voltear la identificación...',
|
|
3578
|
+
'ID card front captured.': 'Se ha capturado el frente de la ID',
|
|
3579
|
+
'ID card back captured.': 'Se ha capturado el reverso de la ID',
|
|
3580
|
+
'ID Capture Successful': 'La captura de la identificación se ha realizado correctamente',
|
|
3581
|
+
'Verify the entire ID was captured clearly with no glare.': 'Hay que verificar que toda la identificación se haya capturado con nitidez y sin reflejos.',
|
|
3582
|
+
Submit: 'Enviar',
|
|
3583
|
+
'Submitting...': 'Enviando...',
|
|
3584
|
+
'Use your device camera to capture your face': 'Hay que utilizar la cámara del dispositivo para capturar el rostro',
|
|
3585
|
+
'Remove Sunglasses & Hat': 'Hay que quitarse los lentes y la gorra',
|
|
3586
|
+
'Avoid Excessive Backlighting': 'Hay que evitar tanta luz por detrás',
|
|
3587
|
+
'Hold still for a few seconds...': 'Hay que quedarse quieto unos segundos...',
|
|
3588
|
+
'Please hold still...': 'Favor de no moverse...',
|
|
3589
|
+
'Look straight into the camera...': 'Hay que mirar directamente a la cámara...',
|
|
3590
|
+
'Move back...': 'Hay que moverse hacia atrás...',
|
|
3591
|
+
'Move forward...': 'Hay que moverse hacia adelante...',
|
|
3592
|
+
'Move to the center...': 'Hay que moverse hacia el centro...',
|
|
3593
|
+
'Waiting for face to be detected...': 'Esperando que se detecte la cara...',
|
|
3594
|
+
'Please remove your eye coverings (sunglasses eye patch etc.)...': 'Hay que quitarse lo que cubre los ojos (lentes, parche, etc.)...',
|
|
3595
|
+
'Please remove your head coverings (hat scarf etc.)...': 'Hay que quitarse lo que cubre la cabeza (gorra, mascada, etc.)...',
|
|
3596
|
+
'Please remove your mask...': 'Hay que quitarse el cubrebocas...',
|
|
3597
|
+
'Live face not detected, please try again': 'Rostro vivo no detectado. Por favor, hay que intentar de nuevo.',
|
|
3598
|
+
Exit: 'Salir',
|
|
3599
|
+
'Face liveness has been verified!': 'Se ha verificado la prueba de vida.',
|
|
3600
|
+
Done: 'Terminar',
|
|
3601
|
+
'Could not verify your face.': 'No se pudo verificar el rostro.',
|
|
3602
|
+
'An error occurred while verifying your face.': 'Se ha producido un error al verificar el rostro.',
|
|
3603
|
+
'Customer has been identified!': '¡Se ha identificado al cliente!',
|
|
3604
|
+
'Customer not found': 'Cliente no encontrado',
|
|
3605
|
+
'Additional document capture': 'Captura adicional de documentos',
|
|
3606
|
+
Next: 'Siguiente',
|
|
3607
|
+
'Please sign the box below': 'Hay que firmar en el siguiente cuadro',
|
|
3608
|
+
Accept: 'Aceptar',
|
|
3609
|
+
Clear: 'Borrar',
|
|
3610
|
+
'Video signature has been successfully captured!': 'La video firma se ha capturado correctamente.',
|
|
3611
|
+
'Network unreachable': 'No hay conexión a internet.',
|
|
3612
|
+
"We're having trouble reaching our services please check your connection and try again.": '`Estamos teniendo problemas para alcanzar nuestros servicios, por favor hay que verificar la conexión a internet e intentar de nuevo.`',
|
|
3613
|
+
"We're sorry an unexpected error has occurred.": '`Lo sentimos, se ha producido un error inesperado.`',
|
|
3614
|
+
'Document Capture': 'Captura de documento',
|
|
3615
|
+
Capture: 'Capturar',
|
|
3616
|
+
'Retry capture': 'Reintentar la captura',
|
|
3617
|
+
Upload: 'Enviar',
|
|
3618
|
+
'Uploading...': 'Procesando...',
|
|
3619
|
+
'Upload succeeded!': '¡Proceso completo!',
|
|
3620
|
+
'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no hay que moverse',
|
|
3621
|
+
'Display the front of your ID card...': 'Hay que mostrar el frente de la ID...',
|
|
3622
|
+
'Display the back of your ID card...': 'Hay que mostrar el reverso de la ID...',
|
|
3623
|
+
'Display the ID page of your passport...': 'Hay que mostrar la página de datos del pasaporte...',
|
|
3624
|
+
'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
|
|
3625
|
+
'Searching for ID card...': 'Localizando la identificación...',
|
|
3626
|
+
'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
|
|
3627
|
+
'Video ID has been successfully captured!': '¡Video ID capturado exitosamente!',
|
|
3628
|
+
'ID Front Image': 'Frente de la ID',
|
|
3629
|
+
'ID Back Image': 'Reverso de la ID',
|
|
3630
|
+
"We're having some trouble.": 'Se ha presentado un problema.',
|
|
3631
|
+
'On-device capture guidance failed, please capture a selfie manually.': 'La captura automática para toma de selfie falló. Por favor, hay que tomarse la selfie manualmente.',
|
|
3632
|
+
'Verifying...': 'Verificando....',
|
|
3633
|
+
'Please capture the front of your ID card.': 'Hay que capturar el frente de la identificación.',
|
|
3634
|
+
'Please capture the back of your ID card.': 'Hay que capturar el reverso de la identificación.',
|
|
3635
|
+
'Please capture the front of your ID card, or the ID page of your passport.': 'Hay que capturar el frente de la identificación o la página de datos del pasaporte.',
|
|
3636
|
+
'Please capture the back of your ID card, or click Done if submitting a passport.': 'Hay que capturar el reverso de la identificación o hay que presionar el botón de Terminar si se trata de un pasaporte.',
|
|
3637
|
+
'Please capture the ID page of your passport.': 'Hay que capturar la página de datos del pasaporte.',
|
|
3638
|
+
'On-device capture guidance failed, please capture a photo of your ID card manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación manualmente.',
|
|
3639
|
+
'On-device capture guidance failed, please capture a photo of your passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto del pasaporte manualmente.',
|
|
3640
|
+
'On-device capture guidance failed, please capture photos of your ID card and passport manually.': 'La captura automática falló. Por favor, hay que tomar una foto de la identificación y del pasaporte manualmente.',
|
|
3641
|
+
'On-device capture guidance failed, please capture photos of your ID card or passport manually.': 'La captura automática falló. Por favor hay que tomar una foto de la identificación o del pasaporte manualmente.',
|
|
3642
|
+
'Capture ID page of passport': 'Captura pasaporte (página de la foto)',
|
|
3643
|
+
'Capture back of ID card': 'Captura del reverso',
|
|
3644
|
+
'Downloading...': 'Descargando...',
|
|
3645
|
+
'Accessing camera...': 'Accediendo a la cámara',
|
|
3646
|
+
'Camera ready': 'Cámara lista',
|
|
3647
|
+
'Loading guided capture experience...': 'Cargando la experiencia guiada para la captura....',
|
|
3648
|
+
'Guided capture experience ready': 'Experiencia guiada lista',
|
|
3649
|
+
"Let's Go!": '¡Vamos!',
|
|
3650
|
+
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': 'Estamos teniendo problemas para identificar el lado correcto de la identificación,¿continuar con la captura?',
|
|
3651
|
+
OK: 'Sí',
|
|
3652
|
+
'Capture with Camera': 'Capturar con la cámara',
|
|
3653
|
+
OR: 'O',
|
|
3654
|
+
'Upload from Storage': 'Adjuntar del almacenamiento',
|
|
3655
|
+
'Select ID Type': 'Seleccionar el tipo de ID',
|
|
3656
|
+
'ID Card': 'Identificación',
|
|
3657
|
+
'Upload Passport': 'Adjuntar pasaporte',
|
|
3658
|
+
'Upload ID Front': 'Adjuntar el frente de la ID',
|
|
3659
|
+
'Upload ID Back': 'Adjuntar el reverso de la ID',
|
|
3660
|
+
Cancel: 'Cancelar',
|
|
3661
|
+
'Upload the back of the ID if it is not included in the front image.': 'Adjuntar el reverso de la ID si no se incluye en la imagen del frente',
|
|
3662
|
+
'Camera tampering detected': 'Se ha detectado un intento de manipulación de la cámara',
|
|
3663
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Lo sentimos, pero parece que la cámara está siendo manipulada. Por favor, verifique su dispositivo y vuelva a intentarlo recargando la página.'
|
|
5221
3664
|
};
|
|
5222
3665
|
|
|
5223
3666
|
var de = {
|
|
@@ -5970,212 +4413,1821 @@ var ru = {
|
|
|
5970
4413
|
'Upload the back of the ID if it is not included in the front image.': 'Загрузите заднюю сторону удостоверения, если она не включена в изображение передней стороны.\r\n'
|
|
5971
4414
|
};
|
|
5972
4415
|
|
|
5973
|
-
var zh = {
|
|
5974
|
-
'English - en': 'Chinese (Traditional) - zh',
|
|
5975
|
-
'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
|
|
5976
|
-
'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
|
|
5977
|
-
'Models warming up...': '正在暖機...',
|
|
5978
|
-
'Camera initializing...': '相機正在初始化...',
|
|
5979
|
-
'Camera access blocked': '相機存取遭封鎖',
|
|
5980
|
-
'Location access blocked': '位置存取遭封鎖',
|
|
5981
|
-
Continue: '繼續',
|
|
5982
|
-
'Processing...': '正在處理...',
|
|
5983
|
-
'Your camera permission is disabled': '已停用相機權限',
|
|
5984
|
-
'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
|
|
5985
|
-
'Your microphone permission is disabled': '已停用麥克風權限',
|
|
5986
|
-
'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
|
|
5987
|
-
'Your location permission is disabled': '已停用位置權限',
|
|
5988
|
-
'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
|
|
5989
|
-
Retry: '重試',
|
|
5990
|
-
'Scan the front of ID': '掃描證件正面',
|
|
5991
|
-
'Scan the back of ID': '掃描證件背面',
|
|
5992
|
-
'Scan the ID page of passport': '掃描護照的 ID 頁面',
|
|
5993
|
-
'ID Card Front': '證件正面',
|
|
5994
|
-
'ID Card Back': '證件背面',
|
|
5995
|
-
Passport: '護照',
|
|
5996
|
-
'Document not detected': '未偵測到文件',
|
|
5997
|
-
'Document is not centered': '文件未置中',
|
|
5998
|
-
'Document too close please back up': '文件太近,請後退',
|
|
5999
|
-
'Please hold your ID document steady': '請拿穩證件',
|
|
6000
|
-
'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
|
|
6001
|
-
'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
|
|
6002
|
-
'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
|
|
6003
|
-
'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
|
|
6004
|
-
'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
|
|
6005
|
-
'Document detected, hold still...': '偵測到的文件保持不動...',
|
|
6006
|
-
'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
|
|
6007
|
-
'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
|
|
6008
|
-
'Passport detected, hold still...': '偵測到的護照保持不動...',
|
|
6009
|
-
'Capturing...': '正在拍攝...',
|
|
6010
|
-
'Capture failed!': '拍攝失敗!',
|
|
6011
|
-
'Please flip your ID card...': '請將證件翻面...',
|
|
6012
|
-
'ID card front captured.': '已拍攝證件正面。',
|
|
6013
|
-
'ID card back captured.': '已拍攝證件背面。',
|
|
6014
|
-
'ID Capture Successful': '證件拍攝成功',
|
|
6015
|
-
'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
|
|
6016
|
-
Submit: '提交',
|
|
6017
|
-
'Submitting...': '正在提交...',
|
|
6018
|
-
'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
|
|
6019
|
-
'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
|
|
6020
|
-
'Avoid Excessive Backlighting': '避免過度背光',
|
|
6021
|
-
'Hold still for a few seconds...': '請保持不動幾秒...',
|
|
6022
|
-
'Please hold still...': '請保持不動...',
|
|
6023
|
-
'Look straight into the camera...': '請直視相機...',
|
|
6024
|
-
'Move back...': '請後退...',
|
|
6025
|
-
'Move forward...': '請前進...',
|
|
6026
|
-
'Move to the center...': '請移至中心...',
|
|
6027
|
-
'Waiting for face to be detected...': '正在等待臉部辨識...',
|
|
6028
|
-
'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
|
|
6029
|
-
'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
|
|
6030
|
-
'Please remove your mask...': '請脫下口罩...',
|
|
6031
|
-
'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
|
|
6032
|
-
Exit: '退出',
|
|
6033
|
-
'Face liveness has been verified!': '已驗證人臉活體!',
|
|
6034
|
-
Done: '完成',
|
|
6035
|
-
'Could not verify your face.': '無法驗證您的臉部。',
|
|
6036
|
-
'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
|
|
6037
|
-
'Customer has been identified!': '已識別客戶!',
|
|
6038
|
-
'Customer not found': '找不到客戶',
|
|
6039
|
-
'Additional document capture': '其他文件拍攝',
|
|
6040
|
-
Next: '下一步',
|
|
6041
|
-
'Please sign the box below': '請在下方的方框中簽名',
|
|
6042
|
-
Accept: '接受',
|
|
6043
|
-
Clear: '清除',
|
|
6044
|
-
'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
|
|
6045
|
-
'Network unreachable': '網路無法連線',
|
|
6046
|
-
"We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
|
|
6047
|
-
"We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
|
|
6048
|
-
'Document Capture': '文件拍攝',
|
|
6049
|
-
Capture: '拍攝',
|
|
6050
|
-
'Retry capture': '重試拍攝',
|
|
6051
|
-
Upload: '上傳',
|
|
6052
|
-
'Uploading...': '正在上傳...',
|
|
6053
|
-
'Upload succeeded!': '上傳成功!',
|
|
6054
|
-
'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
|
|
6055
|
-
'Display the front of your ID card...': '出示證件正面...',
|
|
6056
|
-
'Display the back of your ID card...': '出示證件背面...',
|
|
6057
|
-
'Display the ID page of your passport...': '出示護照的 ID 頁面...',
|
|
6058
|
-
'Please move your face to the center...': '請將臉部移至中心...',
|
|
6059
|
-
'Searching for ID card...': '正在搜尋證件...',
|
|
6060
|
-
'Please read the following text aloud': '請大聲讀出以下文字',
|
|
6061
|
-
'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
|
|
6062
|
-
'ID Front Image': '證件正面影像',
|
|
6063
|
-
'ID Back Image': '證件背面影像',
|
|
6064
|
-
"We're having some trouble.": '發生一些問題。',
|
|
6065
|
-
'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
|
|
6066
|
-
'Verifying...': '正在驗證...',
|
|
6067
|
-
'Please capture the front of your ID card.': '請拍攝證件正面。',
|
|
6068
|
-
'Please capture the back of your ID card.': '請拍攝證件背面。',
|
|
6069
|
-
'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
|
|
6070
|
-
'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
|
|
6071
|
-
'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
|
|
6072
|
-
'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
|
|
6073
|
-
'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
|
|
6074
|
-
'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
|
|
6075
|
-
'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
|
|
6076
|
-
'Capture ID page of passport': '拍攝護照的 ID 頁面',
|
|
6077
|
-
'Capture back of ID card': '拍攝證件背面',
|
|
6078
|
-
'Downloading...': '正在下載...',
|
|
6079
|
-
'Accessing camera...': '正在存取相機...',
|
|
6080
|
-
'Camera ready': '相機就緒',
|
|
6081
|
-
'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
|
|
6082
|
-
'Guided capture experience ready': '引導式拍攝體驗就緒',
|
|
6083
|
-
"Let's Go!": '開始!',
|
|
6084
|
-
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
|
|
6085
|
-
OK: '確定',
|
|
6086
|
-
'Capture with Camera': '使用相机拍摄',
|
|
6087
|
-
OR: '或者',
|
|
6088
|
-
'Upload from Storage': '从存储中上传',
|
|
6089
|
-
'Select ID Type': '选择身份证类型',
|
|
6090
|
-
'ID Card': '身份证',
|
|
6091
|
-
'Upload Passport': '上传护照',
|
|
6092
|
-
'Upload ID Front': '上传身份证正面',
|
|
6093
|
-
'Upload ID Back': '上传身份证背面',
|
|
6094
|
-
Cancel: '取消',
|
|
6095
|
-
'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
|
|
4416
|
+
var zh = {
|
|
4417
|
+
'English - en': 'Chinese (Traditional) - zh',
|
|
4418
|
+
'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
|
|
4419
|
+
'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
|
|
4420
|
+
'Models warming up...': '正在暖機...',
|
|
4421
|
+
'Camera initializing...': '相機正在初始化...',
|
|
4422
|
+
'Camera access blocked': '相機存取遭封鎖',
|
|
4423
|
+
'Location access blocked': '位置存取遭封鎖',
|
|
4424
|
+
Continue: '繼續',
|
|
4425
|
+
'Processing...': '正在處理...',
|
|
4426
|
+
'Your camera permission is disabled': '已停用相機權限',
|
|
4427
|
+
'This application requires access to your camera to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for camera permissions you must go to settings and provide camera access to the current browser.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
|
|
4428
|
+
'Your microphone permission is disabled': '已停用麥克風權限',
|
|
4429
|
+
'This application requires access to your microphone to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for microphone permissions you must go to settings and provide microphone access to the current browser.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
|
|
4430
|
+
'Your location permission is disabled': '已停用位置權限',
|
|
4431
|
+
'This application requires access to your location to continue. Please accept the permission once prompted by the browser. If the browser does not prompt for location permissions you must go to settings and provide location access to the current browser.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
|
|
4432
|
+
Retry: '重試',
|
|
4433
|
+
'Scan the front of ID': '掃描證件正面',
|
|
4434
|
+
'Scan the back of ID': '掃描證件背面',
|
|
4435
|
+
'Scan the ID page of passport': '掃描護照的 ID 頁面',
|
|
4436
|
+
'ID Card Front': '證件正面',
|
|
4437
|
+
'ID Card Back': '證件背面',
|
|
4438
|
+
Passport: '護照',
|
|
4439
|
+
'Document not detected': '未偵測到文件',
|
|
4440
|
+
'Document is not centered': '文件未置中',
|
|
4441
|
+
'Document too close please back up': '文件太近,請後退',
|
|
4442
|
+
'Please hold your ID document steady': '請拿穩證件',
|
|
4443
|
+
'Document out of focus – try improving the lighting': '文件失焦 – 請嘗試改善燈光',
|
|
4444
|
+
'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
|
|
4445
|
+
'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
|
|
4446
|
+
'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
|
|
4447
|
+
'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
|
|
4448
|
+
'Document detected, hold still...': '偵測到的文件保持不動...',
|
|
4449
|
+
'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
|
|
4450
|
+
'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
|
|
4451
|
+
'Passport detected, hold still...': '偵測到的護照保持不動...',
|
|
4452
|
+
'Capturing...': '正在拍攝...',
|
|
4453
|
+
'Capture failed!': '拍攝失敗!',
|
|
4454
|
+
'Please flip your ID card...': '請將證件翻面...',
|
|
4455
|
+
'ID card front captured.': '已拍攝證件正面。',
|
|
4456
|
+
'ID card back captured.': '已拍攝證件背面。',
|
|
4457
|
+
'ID Capture Successful': '證件拍攝成功',
|
|
4458
|
+
'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
|
|
4459
|
+
Submit: '提交',
|
|
4460
|
+
'Submitting...': '正在提交...',
|
|
4461
|
+
'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
|
|
4462
|
+
'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
|
|
4463
|
+
'Avoid Excessive Backlighting': '避免過度背光',
|
|
4464
|
+
'Hold still for a few seconds...': '請保持不動幾秒...',
|
|
4465
|
+
'Please hold still...': '請保持不動...',
|
|
4466
|
+
'Look straight into the camera...': '請直視相機...',
|
|
4467
|
+
'Move back...': '請後退...',
|
|
4468
|
+
'Move forward...': '請前進...',
|
|
4469
|
+
'Move to the center...': '請移至中心...',
|
|
4470
|
+
'Waiting for face to be detected...': '正在等待臉部辨識...',
|
|
4471
|
+
'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
|
|
4472
|
+
'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
|
|
4473
|
+
'Please remove your mask...': '請脫下口罩...',
|
|
4474
|
+
'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
|
|
4475
|
+
Exit: '退出',
|
|
4476
|
+
'Face liveness has been verified!': '已驗證人臉活體!',
|
|
4477
|
+
Done: '完成',
|
|
4478
|
+
'Could not verify your face.': '無法驗證您的臉部。',
|
|
4479
|
+
'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
|
|
4480
|
+
'Customer has been identified!': '已識別客戶!',
|
|
4481
|
+
'Customer not found': '找不到客戶',
|
|
4482
|
+
'Additional document capture': '其他文件拍攝',
|
|
4483
|
+
Next: '下一步',
|
|
4484
|
+
'Please sign the box below': '請在下方的方框中簽名',
|
|
4485
|
+
Accept: '接受',
|
|
4486
|
+
Clear: '清除',
|
|
4487
|
+
'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
|
|
4488
|
+
'Network unreachable': '網路無法連線',
|
|
4489
|
+
"We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
|
|
4490
|
+
"We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
|
|
4491
|
+
'Document Capture': '文件拍攝',
|
|
4492
|
+
Capture: '拍攝',
|
|
4493
|
+
'Retry capture': '重試拍攝',
|
|
4494
|
+
Upload: '上傳',
|
|
4495
|
+
'Uploading...': '正在上傳...',
|
|
4496
|
+
'Upload succeeded!': '上傳成功!',
|
|
4497
|
+
'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
|
|
4498
|
+
'Display the front of your ID card...': '出示證件正面...',
|
|
4499
|
+
'Display the back of your ID card...': '出示證件背面...',
|
|
4500
|
+
'Display the ID page of your passport...': '出示護照的 ID 頁面...',
|
|
4501
|
+
'Please move your face to the center...': '請將臉部移至中心...',
|
|
4502
|
+
'Searching for ID card...': '正在搜尋證件...',
|
|
4503
|
+
'Please read the following text aloud': '請大聲讀出以下文字',
|
|
4504
|
+
'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
|
|
4505
|
+
'ID Front Image': '證件正面影像',
|
|
4506
|
+
'ID Back Image': '證件背面影像',
|
|
4507
|
+
"We're having some trouble.": '發生一些問題。',
|
|
4508
|
+
'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
|
|
4509
|
+
'Verifying...': '正在驗證...',
|
|
4510
|
+
'Please capture the front of your ID card.': '請拍攝證件正面。',
|
|
4511
|
+
'Please capture the back of your ID card.': '請拍攝證件背面。',
|
|
4512
|
+
'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
|
|
4513
|
+
'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
|
|
4514
|
+
'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
|
|
4515
|
+
'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
|
|
4516
|
+
'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
|
|
4517
|
+
'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
|
|
4518
|
+
'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
|
|
4519
|
+
'Capture ID page of passport': '拍攝護照的 ID 頁面',
|
|
4520
|
+
'Capture back of ID card': '拍攝證件背面',
|
|
4521
|
+
'Downloading...': '正在下載...',
|
|
4522
|
+
'Accessing camera...': '正在存取相機...',
|
|
4523
|
+
'Camera ready': '相機就緒',
|
|
4524
|
+
'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
|
|
4525
|
+
'Guided capture experience ready': '引導式拍攝體驗就緒',
|
|
4526
|
+
"Let's Go!": '開始!',
|
|
4527
|
+
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
|
|
4528
|
+
OK: '確定',
|
|
4529
|
+
'Capture with Camera': '使用相机拍摄',
|
|
4530
|
+
OR: '或者',
|
|
4531
|
+
'Upload from Storage': '从存储中上传',
|
|
4532
|
+
'Select ID Type': '选择身份证类型',
|
|
4533
|
+
'ID Card': '身份证',
|
|
4534
|
+
'Upload Passport': '上传护照',
|
|
4535
|
+
'Upload ID Front': '上传身份证正面',
|
|
4536
|
+
'Upload ID Back': '上传身份证背面',
|
|
4537
|
+
Cancel: '取消',
|
|
4538
|
+
'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。'
|
|
4539
|
+
};
|
|
4540
|
+
|
|
4541
|
+
var resources = {
|
|
4542
|
+
en: {
|
|
4543
|
+
translation: en
|
|
4544
|
+
},
|
|
4545
|
+
es: {
|
|
4546
|
+
translation: es
|
|
4547
|
+
},
|
|
4548
|
+
de: {
|
|
4549
|
+
translation: de
|
|
4550
|
+
},
|
|
4551
|
+
fr: {
|
|
4552
|
+
translation: fr
|
|
4553
|
+
},
|
|
4554
|
+
it: {
|
|
4555
|
+
translation: it
|
|
4556
|
+
},
|
|
4557
|
+
ja: {
|
|
4558
|
+
translation: ja
|
|
4559
|
+
},
|
|
4560
|
+
pt: {
|
|
4561
|
+
translation: pt
|
|
4562
|
+
},
|
|
4563
|
+
ru: {
|
|
4564
|
+
translation: ru
|
|
4565
|
+
},
|
|
4566
|
+
zh: {
|
|
4567
|
+
translation: zh
|
|
4568
|
+
}
|
|
4569
|
+
};
|
|
4570
|
+
function initializeI18n() {
|
|
4571
|
+
void i18n__default.default.use(LanguageDetector__default.default).use(reactI18next.initReactI18next).init({
|
|
4572
|
+
resources: resources,
|
|
4573
|
+
detection: {
|
|
4574
|
+
caches: []
|
|
4575
|
+
},
|
|
4576
|
+
fallbackLng: 'en',
|
|
4577
|
+
debug: false,
|
|
4578
|
+
interpolation: {
|
|
4579
|
+
escapeValue: false
|
|
4580
|
+
}
|
|
4581
|
+
});
|
|
4582
|
+
}
|
|
4583
|
+
var useLanguage = function useLanguage(lang) {
|
|
4584
|
+
var i18n = reactI18next.useTranslation().i18n;
|
|
4585
|
+
React.useEffect(function () {
|
|
4586
|
+
if (lang !== 'auto') {
|
|
4587
|
+
void i18n.changeLanguage(lang);
|
|
4588
|
+
} else {
|
|
4589
|
+
void i18n.changeLanguage(); // call without argument to use detection
|
|
4590
|
+
}
|
|
4591
|
+
}, [i18n, lang]);
|
|
4592
|
+
};
|
|
4593
|
+
function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
|
|
4594
|
+
if (typeof verbiage === 'string') return verbiage;
|
|
4595
|
+
if (typeof verbiage === 'object') {
|
|
4596
|
+
var translations = verbiage;
|
|
4597
|
+
if (translations[currentLanguage]) return translations[currentLanguage];
|
|
4598
|
+
var nonLocaleLang = currentLanguage.split('-')[0];
|
|
4599
|
+
if (translations[nonLocaleLang]) return translations[nonLocaleLang];
|
|
4600
|
+
}
|
|
4601
|
+
return t(fallback);
|
|
4602
|
+
}
|
|
4603
|
+
function useVerbiage(verbiage, fallback) {
|
|
4604
|
+
var _a = reactI18next.useTranslation(),
|
|
4605
|
+
t = _a.t,
|
|
4606
|
+
i18n = _a.i18n;
|
|
4607
|
+
return React.useMemo(function () {
|
|
4608
|
+
return evaluateVerbiage(t, i18n.language, verbiage, fallback);
|
|
4609
|
+
}, [fallback, i18n.language, t, verbiage]);
|
|
4610
|
+
}
|
|
4611
|
+
function useTranslations(verbiage, fallbacks) {
|
|
4612
|
+
var _a = reactI18next.useTranslation(),
|
|
4613
|
+
t = _a.t,
|
|
4614
|
+
i18n = _a.i18n;
|
|
4615
|
+
return React.useMemo(function () {
|
|
4616
|
+
return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
|
|
4617
|
+
var _a;
|
|
4618
|
+
return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
|
|
4619
|
+
}, {}));
|
|
4620
|
+
}, [fallbacks, i18n.language, t, verbiage]);
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
var initialState$5 = {
|
|
4624
|
+
videoRef: {
|
|
4625
|
+
current: null
|
|
4626
|
+
},
|
|
4627
|
+
videoLoaded: false,
|
|
4628
|
+
videoStream: null,
|
|
4629
|
+
videoDevice: null,
|
|
4630
|
+
isRearFacing: false,
|
|
4631
|
+
camera: null,
|
|
4632
|
+
cameraReady: false,
|
|
4633
|
+
cameraAccessDenied: false,
|
|
4634
|
+
iphoneContinuityCameraAvailable: false,
|
|
4635
|
+
iphoneContinuityCameraDenied: false,
|
|
4636
|
+
preferIphoneContinuityCamera: true,
|
|
4637
|
+
cameraTamperingDetected: false,
|
|
4638
|
+
audioStream: null,
|
|
4639
|
+
microphoneReady: false,
|
|
4640
|
+
microphoneAccessDenied: false
|
|
4641
|
+
};
|
|
4642
|
+
var createCameraStore = function createCameraStore(config) {
|
|
4643
|
+
var store = zustand.createStore(function (set, get) {
|
|
4644
|
+
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
4645
|
+
reset: function reset() {
|
|
4646
|
+
return set(_assign(_assign({}, initialState$5), config));
|
|
4647
|
+
},
|
|
4648
|
+
setConfig: function setConfig(config) {
|
|
4649
|
+
return set(config);
|
|
4650
|
+
},
|
|
4651
|
+
onVideoMounted: function onVideoMounted(e) {
|
|
4652
|
+
var _a;
|
|
4653
|
+
var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
|
|
4654
|
+
if (!selectedVideoStreamId) return;
|
|
4655
|
+
var srcObject = e.currentTarget.srcObject;
|
|
4656
|
+
if (srcObject.id === selectedVideoStreamId) {
|
|
4657
|
+
set({
|
|
4658
|
+
videoLoaded: true
|
|
4659
|
+
});
|
|
4660
|
+
} else {
|
|
4661
|
+
set({
|
|
4662
|
+
cameraTamperingDetected: true
|
|
4663
|
+
});
|
|
4664
|
+
}
|
|
4665
|
+
},
|
|
4666
|
+
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
4667
|
+
return set({
|
|
4668
|
+
preferIphoneContinuityCamera: value
|
|
4669
|
+
});
|
|
4670
|
+
},
|
|
4671
|
+
requestCameraAccess: function requestCameraAccess() {
|
|
4672
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4673
|
+
var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
|
|
4674
|
+
var _b, _c, _d;
|
|
4675
|
+
return __generator(this, function (_e) {
|
|
4676
|
+
switch (_e.label) {
|
|
4677
|
+
case 0:
|
|
4678
|
+
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
4679
|
+
releaseCameraAccess();
|
|
4680
|
+
_e.label = 1;
|
|
4681
|
+
case 1:
|
|
4682
|
+
_e.trys.push([1, 11,, 12]);
|
|
4683
|
+
return [4 /*yield*/, listAvailableCameras()];
|
|
4684
|
+
case 2:
|
|
4685
|
+
availableCameras = _e.sent();
|
|
4686
|
+
selectedCamera = void 0;
|
|
4687
|
+
debug('availableCameras', availableCameras);
|
|
4688
|
+
platform_1 = getPlatform();
|
|
4689
|
+
debug('platformDetails', platform_1);
|
|
4690
|
+
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
4691
|
+
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
4692
|
+
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
4693
|
+
});
|
|
4694
|
+
set({
|
|
4695
|
+
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
4696
|
+
});
|
|
4697
|
+
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
4698
|
+
selectedCamera = iphoneContinuityCamera;
|
|
4699
|
+
}
|
|
4700
|
+
} else if (((_b = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _b === void 0 ? void 0 : _b.family) === 'Android' || availableCameras.every(function (c) {
|
|
4701
|
+
return c.label.startsWith('camera2 ');
|
|
4702
|
+
})) {
|
|
4703
|
+
availableCameras = availableCameras.sort(function (a, b) {
|
|
4704
|
+
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
4705
|
+
});
|
|
4706
|
+
debug('cameras have been sorted', availableCameras);
|
|
4707
|
+
}
|
|
4708
|
+
if (preferFrontFacingCamera) {
|
|
4709
|
+
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4710
|
+
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
4711
|
+
});
|
|
4712
|
+
}
|
|
4713
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4714
|
+
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
4715
|
+
}));
|
|
4716
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4717
|
+
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
4718
|
+
}));
|
|
4719
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4720
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
4721
|
+
}));
|
|
4722
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4723
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
4724
|
+
}));
|
|
4725
|
+
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
4726
|
+
if (!preferFrontFacingCamera && ((_c = platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) === null || _c === void 0 ? void 0 : _c.family) === 'iOS' && availableCameras.length > 0) {
|
|
4727
|
+
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
4728
|
+
}
|
|
4729
|
+
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
4730
|
+
debug('selectedCamera', selectedCamera);
|
|
4731
|
+
set({
|
|
4732
|
+
videoDevice: selectedCamera
|
|
4733
|
+
});
|
|
4734
|
+
constraints = {
|
|
4735
|
+
audio: false,
|
|
4736
|
+
video: {
|
|
4737
|
+
deviceId: {
|
|
4738
|
+
exact: selectedCamera.deviceId
|
|
4739
|
+
},
|
|
4740
|
+
width: {
|
|
4741
|
+
ideal: config.maxVideoWidth
|
|
4742
|
+
},
|
|
4743
|
+
aspectRatio: 1.777777778,
|
|
4744
|
+
frameRate: {}
|
|
4745
|
+
}
|
|
4746
|
+
};
|
|
4747
|
+
if (config.maxFps) {
|
|
4748
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4749
|
+
// @ts-ignore
|
|
4750
|
+
constraints.video.frameRate = {
|
|
4751
|
+
max: config.maxFps
|
|
4752
|
+
};
|
|
4753
|
+
}
|
|
4754
|
+
stream_1 = null;
|
|
4755
|
+
_e.label = 3;
|
|
4756
|
+
case 3:
|
|
4757
|
+
_e.trys.push([3, 5,, 6]);
|
|
4758
|
+
debug('obtaining camera access with constraints', constraints);
|
|
4759
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
4760
|
+
case 4:
|
|
4761
|
+
stream_1 = _e.sent();
|
|
4762
|
+
return [3 /*break*/, 6];
|
|
4763
|
+
case 5:
|
|
4764
|
+
e_1 = _e.sent();
|
|
4765
|
+
if (e_1.name === 'NotAllowedError') {
|
|
4766
|
+
if (preferIphoneContinuityCamera) {
|
|
4767
|
+
set({
|
|
4768
|
+
iphoneContinuityCameraAvailable: false,
|
|
4769
|
+
iphoneContinuityCameraDenied: true
|
|
4770
|
+
});
|
|
4771
|
+
} else {
|
|
4772
|
+
set({
|
|
4773
|
+
cameraAccessDenied: true
|
|
4774
|
+
});
|
|
4775
|
+
}
|
|
4776
|
+
return [2 /*return*/];
|
|
4777
|
+
}
|
|
4778
|
+
return [3 /*break*/, 6];
|
|
4779
|
+
case 6:
|
|
4780
|
+
if (!!stream_1) return [3 /*break*/, 10];
|
|
4781
|
+
_e.label = 7;
|
|
4782
|
+
case 7:
|
|
4783
|
+
_e.trys.push([7, 9,, 10]);
|
|
4784
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
4785
|
+
audio: false,
|
|
4786
|
+
video: true
|
|
4787
|
+
})];
|
|
4788
|
+
case 8:
|
|
4789
|
+
stream_1 = _e.sent();
|
|
4790
|
+
debug('opened stream with no width and height constraints');
|
|
4791
|
+
return [3 /*break*/, 10];
|
|
4792
|
+
case 9:
|
|
4793
|
+
e_2 = _e.sent();
|
|
4794
|
+
debug('cannot open stream at all', e_2);
|
|
4795
|
+
return [3 /*break*/, 10];
|
|
4796
|
+
case 10:
|
|
4797
|
+
if (!stream_1) {
|
|
4798
|
+
error('failed to open camera');
|
|
4799
|
+
throw new Error('failed to open camera: ');
|
|
4800
|
+
}
|
|
4801
|
+
debug('camera access granted with constraints', constraints);
|
|
4802
|
+
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
4803
|
+
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
4804
|
+
debug('someone unplugged the continuity camera');
|
|
4805
|
+
set({
|
|
4806
|
+
videoStream: null,
|
|
4807
|
+
videoDevice: null,
|
|
4808
|
+
cameraReady: false,
|
|
4809
|
+
iphoneContinuityCameraAvailable: false,
|
|
4810
|
+
iphoneContinuityCameraDenied: true
|
|
4811
|
+
});
|
|
4812
|
+
get().requestCameraAccess();
|
|
4813
|
+
} else {
|
|
4814
|
+
debug('someone unplugged the webcam');
|
|
4815
|
+
releaseCameraAccess();
|
|
4816
|
+
set({
|
|
4817
|
+
videoStream: null,
|
|
4818
|
+
videoDevice: null,
|
|
4819
|
+
videoLoaded: false,
|
|
4820
|
+
cameraReady: false,
|
|
4821
|
+
cameraAccessDenied: true
|
|
4822
|
+
});
|
|
4823
|
+
}
|
|
4824
|
+
};
|
|
4825
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
4826
|
+
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
4827
|
+
videoTrack_1.onended = handleStreamEnded_1;
|
|
4828
|
+
camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
4829
|
+
setTimeout(function () {
|
|
4830
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4831
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4832
|
+
videoTrack_1.onmute = function () {
|
|
4833
|
+
if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
|
|
4834
|
+
};
|
|
4835
|
+
set({
|
|
4836
|
+
camera: camera_1,
|
|
4837
|
+
cameraReady: true,
|
|
4838
|
+
cameraAccessDenied: false,
|
|
4839
|
+
isRearFacing: camera_1.isRearFacing,
|
|
4840
|
+
videoStream: stream_1
|
|
4841
|
+
});
|
|
4842
|
+
}, 500);
|
|
4843
|
+
return [3 /*break*/, 12];
|
|
4844
|
+
case 11:
|
|
4845
|
+
e_3 = _e.sent();
|
|
4846
|
+
if (e_3.name === 'NotAllowedError') {
|
|
4847
|
+
error('camera access has been blocked by the user', e_3);
|
|
4848
|
+
set({
|
|
4849
|
+
cameraAccessDenied: true
|
|
4850
|
+
});
|
|
4851
|
+
} else {
|
|
4852
|
+
error('camera access encountered some other error', e_3);
|
|
4853
|
+
throw e_3;
|
|
4854
|
+
}
|
|
4855
|
+
return [3 /*break*/, 12];
|
|
4856
|
+
case 12:
|
|
4857
|
+
return [2 /*return*/];
|
|
4858
|
+
}
|
|
4859
|
+
});
|
|
4860
|
+
});
|
|
4861
|
+
},
|
|
4862
|
+
releaseCameraAccess: function releaseCameraAccess() {
|
|
4863
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4864
|
+
var camera;
|
|
4865
|
+
return __generator(this, function (_a) {
|
|
4866
|
+
camera = get().camera;
|
|
4867
|
+
if (!camera) return [2 /*return*/];
|
|
4868
|
+
camera.release();
|
|
4869
|
+
set({
|
|
4870
|
+
camera: null,
|
|
4871
|
+
cameraReady: false,
|
|
4872
|
+
cameraAccessDenied: false,
|
|
4873
|
+
videoDevice: null,
|
|
4874
|
+
videoStream: null,
|
|
4875
|
+
videoLoaded: false
|
|
4876
|
+
});
|
|
4877
|
+
return [2 /*return*/];
|
|
4878
|
+
});
|
|
4879
|
+
});
|
|
4880
|
+
},
|
|
4881
|
+
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
4882
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4883
|
+
var stream_2, e_4;
|
|
4884
|
+
return __generator(this, function (_a) {
|
|
4885
|
+
switch (_a.label) {
|
|
4886
|
+
case 0:
|
|
4887
|
+
get().releaseMicrophoneAccess();
|
|
4888
|
+
_a.label = 1;
|
|
4889
|
+
case 1:
|
|
4890
|
+
_a.trys.push([1, 3,, 4]);
|
|
4891
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
4892
|
+
audio: true,
|
|
4893
|
+
video: false
|
|
4894
|
+
})
|
|
4895
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4896
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4897
|
+
];
|
|
4898
|
+
case 2:
|
|
4899
|
+
stream_2 = _a.sent();
|
|
4900
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4901
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4902
|
+
setTimeout(function () {
|
|
4903
|
+
set({
|
|
4904
|
+
audioStream: stream_2,
|
|
4905
|
+
microphoneReady: true,
|
|
4906
|
+
microphoneAccessDenied: false
|
|
4907
|
+
});
|
|
4908
|
+
var handleStreamEnded = function handleStreamEnded() {
|
|
4909
|
+
set({
|
|
4910
|
+
microphoneReady: false,
|
|
4911
|
+
microphoneAccessDenied: true
|
|
4912
|
+
});
|
|
4913
|
+
};
|
|
4914
|
+
var track = stream_2.getAudioTracks()[0];
|
|
4915
|
+
track.onended = handleStreamEnded;
|
|
4916
|
+
track.onmute = function () {
|
|
4917
|
+
if (track.readyState !== 'live') handleStreamEnded();
|
|
4918
|
+
};
|
|
4919
|
+
}, 500);
|
|
4920
|
+
return [3 /*break*/, 4];
|
|
4921
|
+
case 3:
|
|
4922
|
+
e_4 = _a.sent();
|
|
4923
|
+
debug('failed to open microphone', e_4);
|
|
4924
|
+
set({
|
|
4925
|
+
microphoneAccessDenied: true
|
|
4926
|
+
});
|
|
4927
|
+
return [3 /*break*/, 4];
|
|
4928
|
+
case 4:
|
|
4929
|
+
return [2 /*return*/];
|
|
4930
|
+
}
|
|
4931
|
+
});
|
|
4932
|
+
});
|
|
4933
|
+
},
|
|
4934
|
+
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
4935
|
+
var _a;
|
|
4936
|
+
var audioStream = get().audioStream;
|
|
4937
|
+
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
4938
|
+
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
4939
|
+
var _a;
|
|
4940
|
+
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
4941
|
+
});
|
|
4942
|
+
set({
|
|
4943
|
+
audioStream: null,
|
|
4944
|
+
microphoneReady: false,
|
|
4945
|
+
microphoneAccessDenied: false
|
|
4946
|
+
});
|
|
4947
|
+
}
|
|
4948
|
+
});
|
|
4949
|
+
});
|
|
4950
|
+
if (config.requestAccessAutomatically) {
|
|
4951
|
+
void store.getState().requestCameraAccess();
|
|
4952
|
+
}
|
|
4953
|
+
return _assign(_assign({}, store), {
|
|
4954
|
+
destroy: function destroy() {
|
|
4955
|
+
store.getState().releaseCameraAccess();
|
|
4956
|
+
store.getState().releaseMicrophoneAccess();
|
|
4957
|
+
}
|
|
4958
|
+
});
|
|
4959
|
+
};
|
|
4960
|
+
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
4961
|
+
function CameraStoreProvider(_a) {
|
|
4962
|
+
var children = _a.children,
|
|
4963
|
+
_b = _a.requestAccessAutomatically,
|
|
4964
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
4965
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
4966
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
4967
|
+
_d = _a.preferFrontFacingCamera,
|
|
4968
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
4969
|
+
_e = _a.maxVideoWidth,
|
|
4970
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
4971
|
+
maxFps = _a.maxFps,
|
|
4972
|
+
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
4973
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
4974
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
4975
|
+
_f = _a.requireMicrophoneAccess,
|
|
4976
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
4977
|
+
_g = _a.classNames,
|
|
4978
|
+
classNames = _g === void 0 ? {} : _g,
|
|
4979
|
+
_h = _a.verbiage,
|
|
4980
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
4981
|
+
var videoRef = React.useRef(null);
|
|
4982
|
+
var store = React.useRef();
|
|
4983
|
+
store.current || (store.current = createCameraStore({
|
|
4984
|
+
videoRef: videoRef,
|
|
4985
|
+
requestAccessAutomatically: requestAccessAutomatically,
|
|
4986
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
4987
|
+
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
4988
|
+
maxVideoWidth: maxVideoWidth,
|
|
4989
|
+
maxFps: maxFps,
|
|
4990
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
4991
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
4992
|
+
requireMicrophoneAccess: requireMicrophoneAccess
|
|
4993
|
+
}));
|
|
4994
|
+
React.useEffect(function () {
|
|
4995
|
+
var _a, _b, _c;
|
|
4996
|
+
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
4997
|
+
if (!state) return;
|
|
4998
|
+
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
4999
|
+
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
5000
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
5001
|
+
preferFrontFacingCamera: preferFrontFacingCamera
|
|
5002
|
+
});
|
|
5003
|
+
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
5004
|
+
}
|
|
5005
|
+
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
5006
|
+
React.useEffect(function () {
|
|
5007
|
+
var _a;
|
|
5008
|
+
if (requireMicrophoneAccess) {
|
|
5009
|
+
(_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
|
|
5010
|
+
}
|
|
5011
|
+
}, [requireMicrophoneAccess]);
|
|
5012
|
+
React.useEffect(function () {
|
|
5013
|
+
return function () {
|
|
5014
|
+
var _a;
|
|
5015
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
5016
|
+
};
|
|
5017
|
+
}, []);
|
|
5018
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
|
|
5019
|
+
value: store.current
|
|
5020
|
+
}, /*#__PURE__*/React__namespace.default.createElement(CameraTamperSeal, {
|
|
5021
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
5022
|
+
classNames: classNames.cameraTamperSeal,
|
|
5023
|
+
verbiage: verbiage.cameraTamperSeal
|
|
5024
|
+
}, children));
|
|
5025
|
+
}
|
|
5026
|
+
function CameraTamperSeal(_a) {
|
|
5027
|
+
var children = _a.children,
|
|
5028
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
5029
|
+
_b = _a.classNames,
|
|
5030
|
+
classNames = _b === void 0 ? {} : _b,
|
|
5031
|
+
_c = _a.verbiage,
|
|
5032
|
+
rawVerbiage = _c === void 0 ? {} : _c;
|
|
5033
|
+
var cameraTamperingDetected = useCameraStore().cameraTamperingDetected;
|
|
5034
|
+
var _d = useTranslations(rawVerbiage, {
|
|
5035
|
+
headingText: 'Camera tampering detected',
|
|
5036
|
+
messageText: "We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page."
|
|
5037
|
+
}),
|
|
5038
|
+
headingText = _d.headingText,
|
|
5039
|
+
messageText = _d.messageText;
|
|
5040
|
+
var onCameraTamperingDetectedRef = React.useRef(onCameraTamperingDetected);
|
|
5041
|
+
React.useEffect(function () {
|
|
5042
|
+
onCameraTamperingDetectedRef.current = onCameraTamperingDetected;
|
|
5043
|
+
}, [onCameraTamperingDetected]);
|
|
5044
|
+
React.useEffect(function () {
|
|
5045
|
+
var _a;
|
|
5046
|
+
if (cameraTamperingDetected) (_a = onCameraTamperingDetectedRef.current) === null || _a === void 0 ? void 0 : _a.call(onCameraTamperingDetectedRef);
|
|
5047
|
+
}, [cameraTamperingDetected]);
|
|
5048
|
+
if (!cameraTamperingDetected) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
5049
|
+
return /*#__PURE__*/React__namespace.default.createElement(OverlayContainer, {
|
|
5050
|
+
className: classNames.container
|
|
5051
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayInner$4, {
|
|
5052
|
+
className: classNames.inner
|
|
5053
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayHeading, {
|
|
5054
|
+
className: classNames.heading
|
|
5055
|
+
}, headingText), /*#__PURE__*/React__namespace.default.createElement("p", {
|
|
5056
|
+
className: classNames.message
|
|
5057
|
+
}, messageText)));
|
|
5058
|
+
}
|
|
5059
|
+
var StyledOverlayInner$4 = styled__default.default(OverlayInner$2)(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["\n justify-content: center;\n"], ["\n justify-content: center;\n"])));
|
|
5060
|
+
var StyledOverlayHeading = styled__default.default.h3(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
|
|
5061
|
+
function useCameraStore(selector) {
|
|
5062
|
+
var store = React.useContext(CameraStoreContext);
|
|
5063
|
+
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
5064
|
+
return zustand.useStore(store, selector);
|
|
5065
|
+
}
|
|
5066
|
+
var templateObject_1$H, templateObject_2$A;
|
|
5067
|
+
|
|
5068
|
+
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
5069
|
+
startDocumentDetection: function startDocumentDetection() {
|
|
5070
|
+
return null;
|
|
5071
|
+
},
|
|
5072
|
+
stopDocumentDetection: function stopDocumentDetection() {
|
|
5073
|
+
return null;
|
|
5074
|
+
},
|
|
5075
|
+
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
5076
|
+
return null;
|
|
5077
|
+
},
|
|
5078
|
+
documentDetectionModelReady: false,
|
|
5079
|
+
documentDetectionModelDownloadProgress: 0,
|
|
5080
|
+
documentDetectionModelError: null,
|
|
5081
|
+
onDocumentDetected: function onDocumentDetected() {
|
|
5082
|
+
return null;
|
|
5083
|
+
},
|
|
5084
|
+
detectionTime: 0,
|
|
5085
|
+
documentDetectionThresholds: {},
|
|
5086
|
+
setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
|
|
5087
|
+
return null;
|
|
5088
|
+
},
|
|
5089
|
+
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
5090
|
+
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
5091
|
+
return null;
|
|
5092
|
+
},
|
|
5093
|
+
documentDetectionLastPredictionCanvas: {
|
|
5094
|
+
current: null
|
|
5095
|
+
},
|
|
5096
|
+
clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
|
|
5097
|
+
return null;
|
|
5098
|
+
}
|
|
5099
|
+
});
|
|
5100
|
+
function DocumentDetectionModelProvider(_a) {
|
|
5101
|
+
var _this = this;
|
|
5102
|
+
var _b = _a.autoStart,
|
|
5103
|
+
autoStart = _b === void 0 ? true : _b,
|
|
5104
|
+
children = _a.children,
|
|
5105
|
+
_c = _a.throttleMs,
|
|
5106
|
+
throttleMs = _c === void 0 ? 16 : _c,
|
|
5107
|
+
_d = _a.delayAfterStartMs,
|
|
5108
|
+
delayAfterStartMs = _d === void 0 ? 0 : _d,
|
|
5109
|
+
_e = _a.documentDetectionModelPath,
|
|
5110
|
+
documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
|
|
5111
|
+
_f = _a.documentDetectionModelScoreThreshold,
|
|
5112
|
+
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
5113
|
+
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
5114
|
+
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
5115
|
+
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
5116
|
+
_h = _a.shouldLoadModels,
|
|
5117
|
+
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
5118
|
+
var _j = useCameraStore(),
|
|
5119
|
+
videoRef = _j.videoRef,
|
|
5120
|
+
videoLoaded = _j.videoLoaded,
|
|
5121
|
+
cameraReady = _j.cameraReady;
|
|
5122
|
+
var lastPredictionCanvas = React.useRef(null);
|
|
5123
|
+
var onPredictionHandler = React.useRef();
|
|
5124
|
+
var _k = React.useState({}),
|
|
5125
|
+
documentDetectionThresholds = _k[0],
|
|
5126
|
+
setDocumentDetectionThresholds = _k[1];
|
|
5127
|
+
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
5128
|
+
documentDetectionBoundaries = _l[0],
|
|
5129
|
+
setDocumentDetectionBoundaries = _l[1];
|
|
5130
|
+
var _m = React.useState(0),
|
|
5131
|
+
timesAllZero = _m[0],
|
|
5132
|
+
setTimesAllZero = _m[1];
|
|
5133
|
+
var _o = React.useState(0),
|
|
5134
|
+
canvasKey = _o[0],
|
|
5135
|
+
setCanvasKey = _o[1];
|
|
5136
|
+
var stopDetection = React.useRef(0);
|
|
5137
|
+
var _p = React.useState(shouldLoadModelsProp),
|
|
5138
|
+
shouldLoadModels = _p[0],
|
|
5139
|
+
setShouldLoadModels = _p[1];
|
|
5140
|
+
var load = React.useCallback(function () {
|
|
5141
|
+
return setShouldLoadModels(true);
|
|
5142
|
+
}, []);
|
|
5143
|
+
var _q = useLoadDocumentDetector({
|
|
5144
|
+
modelPath: documentDetectionModelPath,
|
|
5145
|
+
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
5146
|
+
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
5147
|
+
onModelError: onDocumentDetectionModelError,
|
|
5148
|
+
videoRef: videoRef,
|
|
5149
|
+
shouldLoadModels: shouldLoadModels
|
|
5150
|
+
}),
|
|
5151
|
+
ready = _q.ready,
|
|
5152
|
+
modelDownloadProgress = _q.modelDownloadProgress,
|
|
5153
|
+
modelError = _q.modelError,
|
|
5154
|
+
setModelError = _q.setModelError;
|
|
5155
|
+
var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
5156
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
5157
|
+
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
5158
|
+
var _a;
|
|
5159
|
+
return __generator(this, function (_b) {
|
|
5160
|
+
switch (_b.label) {
|
|
5161
|
+
case 0:
|
|
5162
|
+
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
|
|
5163
|
+
stopDetectionAtStart = stopDetection.current;
|
|
5164
|
+
vw = videoRef.current.videoWidth;
|
|
5165
|
+
vh = videoRef.current.videoHeight;
|
|
5166
|
+
lastPredictionCanvas.current.width = vw;
|
|
5167
|
+
lastPredictionCanvas.current.height = vh;
|
|
5168
|
+
ctx = lastPredictionCanvas.current.getContext('2d');
|
|
5169
|
+
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
|
|
5170
|
+
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
5171
|
+
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
5172
|
+
return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
|
|
5173
|
+
case 1:
|
|
5174
|
+
prediction = _b.sent();
|
|
5175
|
+
if (!prediction) return [3 /*break*/, 3];
|
|
5176
|
+
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
5177
|
+
processedPrediction.frameId = frameId;
|
|
5178
|
+
setLastDetectionAt(new Date().getTime());
|
|
5179
|
+
debug(processedPrediction);
|
|
5180
|
+
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
5181
|
+
return n + 1;
|
|
5182
|
+
});
|
|
5183
|
+
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
5184
|
+
if (timeRunning < delayAfterStartMs) return [2 /*return*/];
|
|
5185
|
+
return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
|
|
5186
|
+
case 2:
|
|
5187
|
+
_b.sent();
|
|
5188
|
+
_b.label = 3;
|
|
5189
|
+
case 3:
|
|
5190
|
+
return [2 /*return*/];
|
|
5191
|
+
}
|
|
5192
|
+
});
|
|
5193
|
+
});
|
|
5194
|
+
}, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
|
|
5195
|
+
throttleMs: throttleMs,
|
|
5196
|
+
autoStart: autoStart
|
|
5197
|
+
}),
|
|
5198
|
+
start = _r.start,
|
|
5199
|
+
stop = _r.stop;
|
|
5200
|
+
React.useEffect(function setErrorIfAllZero() {
|
|
5201
|
+
if (timesAllZero >= 2) {
|
|
5202
|
+
setModelError(new Error('model is returning all zeroes'));
|
|
5203
|
+
}
|
|
5204
|
+
}, [setModelError, timesAllZero]);
|
|
5205
|
+
var onDocumentDetected = React.useCallback(function (handler) {
|
|
5206
|
+
onPredictionHandler.current = handler;
|
|
5207
|
+
}, []);
|
|
5208
|
+
var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
|
|
5209
|
+
stopDetection.current += 1;
|
|
5210
|
+
setCanvasKey(function (n) {
|
|
5211
|
+
return n + 1;
|
|
5212
|
+
});
|
|
5213
|
+
}, []);
|
|
5214
|
+
var value = React.useMemo(function () {
|
|
5215
|
+
return {
|
|
5216
|
+
startDocumentDetection: start,
|
|
5217
|
+
stopDocumentDetection: stop,
|
|
5218
|
+
loadDocumentDetectionModel: load,
|
|
5219
|
+
documentDetectionModelReady: ready,
|
|
5220
|
+
documentDetectionModelError: modelError,
|
|
5221
|
+
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
5222
|
+
onDocumentDetected: onDocumentDetected,
|
|
5223
|
+
detectionTime: lastDetectionTime,
|
|
5224
|
+
documentDetectionThresholds: documentDetectionThresholds,
|
|
5225
|
+
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
5226
|
+
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
5227
|
+
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
5228
|
+
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
5229
|
+
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
5230
|
+
};
|
|
5231
|
+
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
5232
|
+
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
5233
|
+
value: value
|
|
5234
|
+
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
5235
|
+
key: canvasKey,
|
|
5236
|
+
ref: lastPredictionCanvas
|
|
5237
|
+
}), children);
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
5241
|
+
loadFocusModel: function loadFocusModel() {
|
|
5242
|
+
return null;
|
|
5243
|
+
},
|
|
5244
|
+
focusModelReady: false,
|
|
5245
|
+
focusModelDownloadProgress: 0,
|
|
5246
|
+
focusModelError: null,
|
|
5247
|
+
focusThresholds: {},
|
|
5248
|
+
setFocusThresholds: function setFocusThresholds() {
|
|
5249
|
+
return null;
|
|
5250
|
+
},
|
|
5251
|
+
makeFocusPrediction: function makeFocusPrediction() {
|
|
5252
|
+
return null;
|
|
5253
|
+
},
|
|
5254
|
+
focusPredictionTime: 0
|
|
5255
|
+
});
|
|
5256
|
+
function FocusModelProvider(_a) {
|
|
5257
|
+
var children = _a.children,
|
|
5258
|
+
_b = _a.focusModelPath,
|
|
5259
|
+
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
5260
|
+
_c = _a.focusModelLoadTimeoutMs,
|
|
5261
|
+
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
5262
|
+
onFocusModelError = _a.onFocusModelError,
|
|
5263
|
+
_d = _a.showCanvases,
|
|
5264
|
+
showCanvases = _d === void 0 ? false : _d,
|
|
5265
|
+
_e = _a.shouldLoadModels,
|
|
5266
|
+
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
5267
|
+
var cropCanvas = React.useRef(null);
|
|
5268
|
+
var rotateCanvas = React.useRef(null);
|
|
5269
|
+
var _f = React.useState({}),
|
|
5270
|
+
focusThresholds = _f[0],
|
|
5271
|
+
setFocusThresholds = _f[1];
|
|
5272
|
+
var videoRef = useCameraStore().videoRef;
|
|
5273
|
+
var _g = React.useState(shouldLoadModelsProp),
|
|
5274
|
+
shouldLoadModels = _g[0],
|
|
5275
|
+
setShouldLoadModels = _g[1];
|
|
5276
|
+
var load = React.useCallback(function () {
|
|
5277
|
+
return setShouldLoadModels(true);
|
|
5278
|
+
}, []);
|
|
5279
|
+
var _h = useLoadFocusModel({
|
|
5280
|
+
modelPath: focusModelPath,
|
|
5281
|
+
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
5282
|
+
onModelError: onFocusModelError,
|
|
5283
|
+
videoRef: videoRef,
|
|
5284
|
+
shouldLoadModels: shouldLoadModels
|
|
5285
|
+
}),
|
|
5286
|
+
ready = _h.ready,
|
|
5287
|
+
modelDownloadProgress = _h.modelDownloadProgress,
|
|
5288
|
+
modelError = _h.modelError;
|
|
5289
|
+
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
5290
|
+
if (!ready) return null;
|
|
5291
|
+
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
5292
|
+
if (!prediction) return null;
|
|
5293
|
+
setLastFocusPredictionAt(prediction.predictionTime);
|
|
5294
|
+
return prediction;
|
|
5295
|
+
}, [ready]);
|
|
5296
|
+
var value = React.useMemo(function () {
|
|
5297
|
+
return {
|
|
5298
|
+
loadFocusModel: load,
|
|
5299
|
+
focusModelReady: ready,
|
|
5300
|
+
focusModelDownloadProgress: modelDownloadProgress,
|
|
5301
|
+
focusModelError: modelError,
|
|
5302
|
+
makeFocusPrediction: makeFocusPrediction,
|
|
5303
|
+
focusPredictionTime: lastFocusPredictionTime,
|
|
5304
|
+
focusThresholds: focusThresholds,
|
|
5305
|
+
setFocusThresholds: setFocusThresholds
|
|
5306
|
+
};
|
|
5307
|
+
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
5308
|
+
return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
|
|
5309
|
+
value: value
|
|
5310
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5311
|
+
ref: rotateCanvas,
|
|
5312
|
+
style: showCanvases ? {
|
|
5313
|
+
display: 'block'
|
|
5314
|
+
} : undefined
|
|
5315
|
+
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5316
|
+
ref: cropCanvas,
|
|
5317
|
+
style: showCanvases ? {
|
|
5318
|
+
display: 'block'
|
|
5319
|
+
} : undefined
|
|
5320
|
+
}), children);
|
|
5321
|
+
}
|
|
5322
|
+
|
|
5323
|
+
function _isNavigatorDefined() {
|
|
5324
|
+
return typeof navigator !== 'undefined' && navigator != null;
|
|
5325
|
+
}
|
|
5326
|
+
var isMobileCache;
|
|
5327
|
+
function isMobile() {
|
|
5328
|
+
if (isMobileCache !== undefined) return isMobileCache;
|
|
5329
|
+
isMobileCache = evaluateIsMobile();
|
|
5330
|
+
return isMobileCache;
|
|
5331
|
+
}
|
|
5332
|
+
function evaluateIsMobile(nav) {
|
|
5333
|
+
if (nav || _isNavigatorDefined()) {
|
|
5334
|
+
if (!nav) {
|
|
5335
|
+
nav = navigator;
|
|
5336
|
+
}
|
|
5337
|
+
if (nav.product === 'ReactNative') {
|
|
5338
|
+
return true;
|
|
5339
|
+
}
|
|
5340
|
+
var a = nav.userAgent || nav.vendor || (
|
|
5341
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5342
|
+
// @ts-ignore
|
|
5343
|
+
typeof window !== 'undefined' ? window.opera : '');
|
|
5344
|
+
if (!a) {
|
|
5345
|
+
var navAny = nav;
|
|
5346
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5347
|
+
// @ts-ignore
|
|
5348
|
+
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
5349
|
+
}
|
|
5350
|
+
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
5351
|
+
}
|
|
5352
|
+
return false;
|
|
5353
|
+
}
|
|
5354
|
+
|
|
5355
|
+
var onMobile = isMobile();
|
|
5356
|
+
var defaultIdCaptureThresholds = {
|
|
5357
|
+
detection: defaultDocumentDetectionThresholds,
|
|
5358
|
+
focus: defaultFocusThresholds
|
|
5359
|
+
};
|
|
5360
|
+
var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
5361
|
+
ready: false,
|
|
5362
|
+
start: function start() {
|
|
5363
|
+
return null;
|
|
5364
|
+
},
|
|
5365
|
+
stop: function stop() {
|
|
5366
|
+
return null;
|
|
5367
|
+
},
|
|
5368
|
+
load: function load() {
|
|
5369
|
+
return null;
|
|
5370
|
+
},
|
|
5371
|
+
modelDownloadProgress: 0,
|
|
5372
|
+
modelError: null,
|
|
5373
|
+
thresholds: defaultIdCaptureThresholds,
|
|
5374
|
+
setThresholds: function setThresholds() {
|
|
5375
|
+
return null;
|
|
5376
|
+
},
|
|
5377
|
+
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
5378
|
+
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
5379
|
+
return null;
|
|
5380
|
+
},
|
|
5381
|
+
onPredictionMade: function onPredictionMade() {
|
|
5382
|
+
return null;
|
|
5383
|
+
},
|
|
5384
|
+
detectionTime: 0,
|
|
5385
|
+
focusPredictionTime: 0,
|
|
5386
|
+
bestFrameDetails: {
|
|
5387
|
+
current: null
|
|
5388
|
+
},
|
|
5389
|
+
getBestFrame: function getBestFrame() {
|
|
5390
|
+
return null;
|
|
5391
|
+
},
|
|
5392
|
+
resetBestFrame: function resetBestFrame() {
|
|
5393
|
+
return null;
|
|
5394
|
+
},
|
|
5395
|
+
requiredDocumentType: 'none',
|
|
5396
|
+
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
5397
|
+
return null;
|
|
5398
|
+
}
|
|
5399
|
+
});
|
|
5400
|
+
function IdCaptureModelsProviderInner(_a) {
|
|
5401
|
+
var children = _a.children,
|
|
5402
|
+
onModelError = _a.onModelError,
|
|
5403
|
+
_b = _a.allowSinglePageIdCapture,
|
|
5404
|
+
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
5405
|
+
var _c = React.useContext(DocumentDetectionModelContext),
|
|
5406
|
+
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
5407
|
+
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
5408
|
+
startDocumentDetection = _c.startDocumentDetection,
|
|
5409
|
+
stopDocumentDetection = _c.stopDocumentDetection,
|
|
5410
|
+
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
5411
|
+
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
5412
|
+
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
5413
|
+
onDocumentDetected = _c.onDocumentDetected,
|
|
5414
|
+
detectionTime = _c.detectionTime,
|
|
5415
|
+
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
5416
|
+
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
5417
|
+
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
5418
|
+
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
5419
|
+
documentDetectionModelError = _c.documentDetectionModelError;
|
|
5420
|
+
var _d = React.useContext(FocusModelContext),
|
|
5421
|
+
loadFocusModel = _d.loadFocusModel,
|
|
5422
|
+
focusModelReady = _d.focusModelReady,
|
|
5423
|
+
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
5424
|
+
makeFocusPrediction = _d.makeFocusPrediction,
|
|
5425
|
+
focusThresholds = _d.focusThresholds,
|
|
5426
|
+
setFocusThresholds = _d.setFocusThresholds,
|
|
5427
|
+
focusPredictionTime = _d.focusPredictionTime,
|
|
5428
|
+
focusModelError = _d.focusModelError;
|
|
5429
|
+
var onPredictionHandler = React.useRef();
|
|
5430
|
+
var bestFrameDetails = React.useRef(null);
|
|
5431
|
+
var bestPredictionCanvas = React.useRef(null);
|
|
5432
|
+
var bestFocusScore = React.useRef(0);
|
|
5433
|
+
var stopDetection = React.useRef(0);
|
|
5434
|
+
var _e = React.useState('none'),
|
|
5435
|
+
requiredDocumentType = _e[0],
|
|
5436
|
+
setRequiredDocumentType = _e[1];
|
|
5437
|
+
var thresholds = React.useMemo(function () {
|
|
5438
|
+
return _assign(_assign({}, documentDetectionThresholds), {
|
|
5439
|
+
focus: focusThresholds
|
|
5440
|
+
});
|
|
5441
|
+
}, [documentDetectionThresholds, focusThresholds]);
|
|
5442
|
+
var setThresholds = React.useCallback(function (thresholds) {
|
|
5443
|
+
if (thresholds.detection) {
|
|
5444
|
+
setDocumentDetectionThresholds(thresholds.detection);
|
|
5445
|
+
}
|
|
5446
|
+
if (thresholds.focus) {
|
|
5447
|
+
setFocusThresholds(thresholds.focus);
|
|
5448
|
+
}
|
|
5449
|
+
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
5450
|
+
React.useEffect(function handleDetections() {
|
|
5451
|
+
var _this = this;
|
|
5452
|
+
onDocumentDetected(function (prediction) {
|
|
5453
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
5454
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
5455
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5456
|
+
return __generator(this, function (_h) {
|
|
5457
|
+
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
5458
|
+
stopDetectionAtStart = stopDetection.current;
|
|
5459
|
+
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
5460
|
+
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
5461
|
+
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
5462
|
+
prediction.detectedDocumentType = 'passport';
|
|
5463
|
+
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
5464
|
+
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
5465
|
+
prediction.singlePageDetectionScore = 0;
|
|
5466
|
+
prediction.singlePageDetectionThresholdMet = false;
|
|
5467
|
+
}
|
|
5468
|
+
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'));
|
|
5469
|
+
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
5470
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
5471
|
+
if (focusPrediction) {
|
|
5472
|
+
focusScore = focusPrediction.score;
|
|
5473
|
+
focusPredictionTime = focusPrediction.predictionTime;
|
|
5474
|
+
}
|
|
5475
|
+
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
5476
|
+
focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
|
|
5477
|
+
focusThresholdMet = focusScore >= focusThreshold;
|
|
5478
|
+
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
5479
|
+
bestFocusScore.current = focusScore;
|
|
5480
|
+
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
5481
|
+
bestFrameDetails.current = {
|
|
5482
|
+
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
5483
|
+
documentType: prediction.detectedDocumentType,
|
|
5484
|
+
detectionScore: prediction.detectionScore,
|
|
5485
|
+
focusScore: focusScore
|
|
5486
|
+
};
|
|
5487
|
+
}
|
|
5488
|
+
}
|
|
5489
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
5490
|
+
focusScore: focusScore,
|
|
5491
|
+
focusPredictionTime: focusPredictionTime,
|
|
5492
|
+
focusThresholdMet: focusThresholdMet
|
|
5493
|
+
}));
|
|
5494
|
+
return [2 /*return*/];
|
|
5495
|
+
});
|
|
5496
|
+
});
|
|
5497
|
+
});
|
|
5498
|
+
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
5499
|
+
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
5500
|
+
React.useEffect(function handleModelErrors() {
|
|
5501
|
+
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
5502
|
+
}, [modelError, onModelError]);
|
|
5503
|
+
var onPredictionMade = React.useCallback(function (handler) {
|
|
5504
|
+
onPredictionHandler.current = handler;
|
|
5505
|
+
}, []);
|
|
5506
|
+
var getBestFrame = React.useCallback(function () {
|
|
5507
|
+
if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
|
|
5508
|
+
return _assign(_assign({}, bestFrameDetails.current), {
|
|
5509
|
+
canvas: bestPredictionCanvas.current
|
|
5510
|
+
});
|
|
5511
|
+
}, []);
|
|
5512
|
+
var _f = React.useState(0),
|
|
5513
|
+
canvasKey = _f[0],
|
|
5514
|
+
setCanvasKey = _f[1];
|
|
5515
|
+
var resetBestFrame = React.useCallback(function () {
|
|
5516
|
+
stopDetection.current += 1;
|
|
5517
|
+
setCanvasKey(function (n) {
|
|
5518
|
+
return n + 1;
|
|
5519
|
+
});
|
|
5520
|
+
clearDocumentDetectionLastPredictionCanvas();
|
|
5521
|
+
bestFrameDetails.current = null;
|
|
5522
|
+
bestFocusScore.current = 0;
|
|
5523
|
+
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
5524
|
+
React.useEffect(function () {
|
|
5525
|
+
if (requiredDocumentType) resetBestFrame();
|
|
5526
|
+
}, [requiredDocumentType, resetBestFrame]);
|
|
5527
|
+
var load = React.useCallback(function () {
|
|
5528
|
+
loadDocumentDetectionModel();
|
|
5529
|
+
loadFocusModel();
|
|
5530
|
+
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
5531
|
+
var value = React.useMemo(function () {
|
|
5532
|
+
return {
|
|
5533
|
+
ready: documentDetectionModelReady && focusModelReady,
|
|
5534
|
+
modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
|
|
5535
|
+
modelError: modelError,
|
|
5536
|
+
start: startDocumentDetection,
|
|
5537
|
+
stop: stopDocumentDetection,
|
|
5538
|
+
load: load,
|
|
5539
|
+
thresholds: thresholds,
|
|
5540
|
+
setThresholds: setThresholds,
|
|
5541
|
+
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
5542
|
+
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
5543
|
+
onPredictionMade: onPredictionMade,
|
|
5544
|
+
detectionTime: detectionTime,
|
|
5545
|
+
focusPredictionTime: focusPredictionTime,
|
|
5546
|
+
getBestFrame: getBestFrame,
|
|
5547
|
+
resetBestFrame: resetBestFrame,
|
|
5548
|
+
bestFrameDetails: bestFrameDetails,
|
|
5549
|
+
requiredDocumentType: requiredDocumentType,
|
|
5550
|
+
setRequiredDocumentType: setRequiredDocumentType
|
|
5551
|
+
};
|
|
5552
|
+
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
5553
|
+
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
|
|
5554
|
+
value: value
|
|
5555
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5556
|
+
key: canvasKey,
|
|
5557
|
+
ref: bestPredictionCanvas
|
|
5558
|
+
}), children);
|
|
5559
|
+
}
|
|
5560
|
+
function IdCaptureModelsProvider(_a) {
|
|
5561
|
+
var children = _a.children,
|
|
5562
|
+
props = __rest(_a, ["children"]);
|
|
5563
|
+
return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
|
|
5564
|
+
}
|
|
5565
|
+
|
|
5566
|
+
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
5567
|
+
|
|
5568
|
+
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
5569
|
+
idCardFront: ['idCardFront'],
|
|
5570
|
+
idCardBack: ['idCardBack'],
|
|
5571
|
+
passport: ['passport'],
|
|
5572
|
+
idCard: ['idCardFront', 'idCardBack'],
|
|
5573
|
+
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
5574
|
+
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
6096
5575
|
};
|
|
5576
|
+
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
5577
|
+
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
5578
|
+
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
5579
|
+
}
|
|
5580
|
+
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
5581
|
+
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
5582
|
+
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
5583
|
+
}
|
|
5584
|
+
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
5585
|
+
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
5586
|
+
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
5587
|
+
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
5588
|
+
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
5589
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
5590
|
+
return !v.includes('idCard');
|
|
5591
|
+
});
|
|
5592
|
+
}
|
|
5593
|
+
if (isIdCardOrPassport) {
|
|
5594
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
5595
|
+
return v !== 'passport';
|
|
5596
|
+
});
|
|
5597
|
+
}
|
|
5598
|
+
return acceptedTypes.filter(function (v) {
|
|
5599
|
+
return !(v in capturedDocuments);
|
|
5600
|
+
});
|
|
5601
|
+
}
|
|
6097
5602
|
|
|
6098
|
-
var
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
5603
|
+
var initialState$4 = {
|
|
5604
|
+
initialDrawComplete: false,
|
|
5605
|
+
redrawing: false,
|
|
5606
|
+
guideRectX: 0,
|
|
5607
|
+
guideRectY: 0,
|
|
5608
|
+
guideRectWidth: 0,
|
|
5609
|
+
guideRectHeight: 0,
|
|
5610
|
+
guideRectOffsetTop: 0,
|
|
5611
|
+
guideImageWidth: 0,
|
|
5612
|
+
guideImageHeight: 0,
|
|
5613
|
+
pageWidth: 0,
|
|
5614
|
+
pageHeight: 0,
|
|
5615
|
+
videoWidth: 0,
|
|
5616
|
+
videoHeight: 0,
|
|
5617
|
+
detectedObjects: [],
|
|
5618
|
+
bestDocument: undefined,
|
|
5619
|
+
detectedDocumentType: 'none',
|
|
5620
|
+
detectionThresholdMet: false,
|
|
5621
|
+
documentInBounds: false,
|
|
5622
|
+
documentTooClose: false,
|
|
5623
|
+
documentIsStable: false,
|
|
5624
|
+
flipRequired: false,
|
|
5625
|
+
backDetectedFirst: false,
|
|
5626
|
+
idCardDetectedButNotAllowed: false,
|
|
5627
|
+
passportDetectedButNotAllowed: false,
|
|
5628
|
+
enableOverrideWrongDocumentTypeDialog: false,
|
|
5629
|
+
allowOverrideWrongDocumentTypeAfterMs: 8000,
|
|
5630
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
5631
|
+
overrideWrongDocumentTypeGuidance: false,
|
|
5632
|
+
wrongDocumentTypePredictions: 0,
|
|
5633
|
+
idCardFrontDetectionScore: 0,
|
|
5634
|
+
idCardFrontDetectionThresholdMet: false,
|
|
5635
|
+
idCardBackDetectionScore: 0,
|
|
5636
|
+
idCardBackDetectionThresholdMet: false,
|
|
5637
|
+
passportDetectionScore: 0,
|
|
5638
|
+
passportDetectionThresholdMet: false,
|
|
5639
|
+
singlePageDetectionScore: 0,
|
|
5640
|
+
singlePageDetectionThresholdMet: false,
|
|
5641
|
+
focusScore: 0,
|
|
5642
|
+
focusThresholdMet: false,
|
|
5643
|
+
isGoodFrame: false,
|
|
5644
|
+
goodFramesCount: 0,
|
|
5645
|
+
goodFramesThreshold: 3,
|
|
5646
|
+
goodFramesThresholdMet: false,
|
|
5647
|
+
lastFrameCapturedAt: null,
|
|
5648
|
+
frameCaptureRate: 0,
|
|
5649
|
+
capturing: false,
|
|
5650
|
+
captureFailed: false,
|
|
5651
|
+
imageUrl: null,
|
|
5652
|
+
captureState: 'initializing',
|
|
5653
|
+
capturedDocuments: {},
|
|
5654
|
+
captureRequirement: 'idCardOrPassport',
|
|
5655
|
+
requestedDocumentType: 'idCardFront',
|
|
5656
|
+
allowSinglePageIdCapture: false,
|
|
5657
|
+
allowIdCardBackToFrontCapture: false,
|
|
5658
|
+
allowUploadingDocumentsFromStorage: false,
|
|
5659
|
+
isUploadingDocumentsFromStorage: false,
|
|
5660
|
+
uploadingDocumentsType: null,
|
|
5661
|
+
operationStartedAt: null,
|
|
5662
|
+
captureStartedAt: null,
|
|
5663
|
+
dispatch: function dispatch() {
|
|
5664
|
+
return null;
|
|
5665
|
+
}
|
|
5666
|
+
};
|
|
5667
|
+
var _reducer = function reducer(state, action) {
|
|
5668
|
+
var _a;
|
|
5669
|
+
switch (action.type) {
|
|
5670
|
+
case 'configureWizard':
|
|
5671
|
+
{
|
|
5672
|
+
var _b = action.payload,
|
|
5673
|
+
captureRequirement = _b.captureRequirement,
|
|
5674
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
5675
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
5676
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
5677
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
5678
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
5679
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
5680
|
+
var newState = _assign(_assign({}, state), {
|
|
5681
|
+
captureRequirement: captureRequirement,
|
|
5682
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
5683
|
+
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
5684
|
+
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
5685
|
+
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
5686
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
5687
|
+
});
|
|
5688
|
+
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
5689
|
+
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
5690
|
+
if (precapturedDocuments) {
|
|
5691
|
+
for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
|
|
5692
|
+
var k = CapturedDocumentTypeValues_1[_i];
|
|
5693
|
+
var payload = precapturedDocuments[k];
|
|
5694
|
+
if (payload) {
|
|
5695
|
+
newState.requestedDocumentType = k;
|
|
5696
|
+
newState = _reducer(newState, {
|
|
5697
|
+
type: 'documentCaptured',
|
|
5698
|
+
payload: payload
|
|
5699
|
+
});
|
|
5700
|
+
}
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
|
|
5704
|
+
newState.captureState = 'capturing';
|
|
5705
|
+
}
|
|
5706
|
+
return newState;
|
|
5707
|
+
}
|
|
5708
|
+
case 'setRequiredDocumentType':
|
|
5709
|
+
return _assign(_assign({}, state), {
|
|
5710
|
+
requiredDocumentType: action.payload
|
|
5711
|
+
});
|
|
5712
|
+
case 'redrawRequested':
|
|
5713
|
+
return _assign(_assign({}, state), {
|
|
5714
|
+
redrawing: true,
|
|
5715
|
+
guideRectX: 0,
|
|
5716
|
+
guideRectY: 0,
|
|
5717
|
+
guideRectWidth: 0,
|
|
5718
|
+
guideRectHeight: 0,
|
|
5719
|
+
guideRectOffsetTop: 0
|
|
5720
|
+
});
|
|
5721
|
+
case 'redrawInProgress':
|
|
5722
|
+
return _assign(_assign({}, state), {
|
|
5723
|
+
redrawing: false,
|
|
5724
|
+
guideRectX: 0,
|
|
5725
|
+
guideRectY: 0,
|
|
5726
|
+
guideRectWidth: 0,
|
|
5727
|
+
guideRectHeight: 0,
|
|
5728
|
+
guideRectOffsetTop: 0
|
|
5729
|
+
});
|
|
5730
|
+
case 'redrawCompleted':
|
|
5731
|
+
return _assign(_assign(_assign({}, state), action.payload), {
|
|
5732
|
+
initialDrawComplete: true
|
|
5733
|
+
});
|
|
5734
|
+
case 'pageRendered':
|
|
5735
|
+
return _assign(_assign({}, state), action.payload);
|
|
5736
|
+
case 'guideImageLoaded':
|
|
5737
|
+
return _assign(_assign({}, state), {
|
|
5738
|
+
guideImageWidth: action.payload.width,
|
|
5739
|
+
guideImageHeight: action.payload.height
|
|
5740
|
+
});
|
|
5741
|
+
case 'objectsDetected':
|
|
5742
|
+
{
|
|
5743
|
+
var _c = action.payload.prediction,
|
|
5744
|
+
detectedObjects = _c.detectedObjects,
|
|
5745
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
5746
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
5747
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
5748
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
5749
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
5750
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
5751
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
5752
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
5753
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
5754
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
5755
|
+
bestDocument = _c.bestDocument,
|
|
5756
|
+
documentInBounds = _c.documentInBounds,
|
|
5757
|
+
documentTooClose = _c.documentTooClose,
|
|
5758
|
+
documentIsStable = _c.documentIsStable,
|
|
5759
|
+
focusScore = _c.focusScore,
|
|
5760
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
5761
|
+
frameWidth = _c.frameWidth,
|
|
5762
|
+
frameHeight = _c.frameHeight;
|
|
5763
|
+
var frameCapturedAt = new Date();
|
|
5764
|
+
var frameCaptureRate = 0;
|
|
5765
|
+
var goodFramesThreshold = state.goodFramesThreshold;
|
|
5766
|
+
if (state.lastFrameCapturedAt) {
|
|
5767
|
+
var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
5768
|
+
if (frameTime > 0) {
|
|
5769
|
+
frameCaptureRate = 1000.0 / frameTime;
|
|
5770
|
+
if (frameCaptureRate > 0) {
|
|
5771
|
+
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
5772
|
+
}
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
5776
|
+
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
5777
|
+
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
5778
|
+
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
5779
|
+
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
5780
|
+
var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
|
|
5781
|
+
var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
|
|
5782
|
+
var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
|
|
5783
|
+
var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
|
|
5784
|
+
var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
5785
|
+
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
5786
|
+
wrongDocumentTypePredictions += 1;
|
|
5787
|
+
}
|
|
5788
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
5789
|
+
var captureStartedAt = state.captureStartedAt;
|
|
5790
|
+
var goodFramesCount = state.goodFramesCount;
|
|
5791
|
+
if (isGoodFrame) {
|
|
5792
|
+
goodFramesCount += 1;
|
|
5793
|
+
captureStartedAt || (captureStartedAt = new Date());
|
|
5794
|
+
}
|
|
5795
|
+
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
5796
|
+
var requestedDocumentType = state.requestedDocumentType;
|
|
5797
|
+
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
5798
|
+
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
5799
|
+
requestedDocumentType = 'idCardFront';
|
|
5800
|
+
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
5801
|
+
requestedDocumentType = 'idCardBack';
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
5805
|
+
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
5806
|
+
requestedDocumentType = 'passport';
|
|
5807
|
+
}
|
|
5808
|
+
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
5809
|
+
requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
|
|
5810
|
+
}
|
|
5811
|
+
}
|
|
5812
|
+
var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
|
|
5813
|
+
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
5814
|
+
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
5815
|
+
return _assign(_assign({}, state), {
|
|
5816
|
+
videoWidth: frameWidth,
|
|
5817
|
+
videoHeight: frameHeight,
|
|
5818
|
+
detectedObjects: detectedObjects,
|
|
5819
|
+
bestDocument: bestDocument,
|
|
5820
|
+
requestedDocumentType: requestedDocumentType,
|
|
5821
|
+
detectedDocumentType: detectedDocumentType,
|
|
5822
|
+
detectionThresholdMet: detectionThresholdMet,
|
|
5823
|
+
documentInBounds: documentInBounds,
|
|
5824
|
+
documentTooClose: documentTooClose,
|
|
5825
|
+
documentIsStable: documentIsStable,
|
|
5826
|
+
flipRequired: flipRequired,
|
|
5827
|
+
backDetectedFirst: backDetectedFirst,
|
|
5828
|
+
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
5829
|
+
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
5830
|
+
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
5831
|
+
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
5832
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
5833
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
5834
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
5835
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
5836
|
+
passportDetectionScore: passportDetectionScore,
|
|
5837
|
+
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
5838
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
5839
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
5840
|
+
focusScore: focusScore,
|
|
5841
|
+
focusThresholdMet: focusThresholdMet,
|
|
5842
|
+
isGoodFrame: isGoodFrame,
|
|
5843
|
+
goodFramesCount: goodFramesCount,
|
|
5844
|
+
goodFramesThreshold: goodFramesThreshold,
|
|
5845
|
+
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
5846
|
+
captureStartedAt: captureStartedAt,
|
|
5847
|
+
lastFrameCapturedAt: frameCapturedAt,
|
|
5848
|
+
frameCaptureRate: frameCaptureRate
|
|
5849
|
+
});
|
|
5850
|
+
}
|
|
5851
|
+
case 'captureInitialized':
|
|
5852
|
+
return _assign(_assign({}, state), {
|
|
5853
|
+
captureState: 'capturing',
|
|
5854
|
+
isUploadingDocumentsFromStorage: false
|
|
5855
|
+
});
|
|
5856
|
+
case 'captureStarted':
|
|
5857
|
+
return _assign(_assign({}, state), {
|
|
5858
|
+
operationStartedAt: new Date(),
|
|
5859
|
+
captureStartedAt: null,
|
|
5860
|
+
capturing: false,
|
|
5861
|
+
captureFailed: false
|
|
5862
|
+
});
|
|
5863
|
+
case 'capturing':
|
|
5864
|
+
return _assign(_assign({}, state), {
|
|
5865
|
+
capturing: true,
|
|
5866
|
+
captureFailed: false
|
|
5867
|
+
});
|
|
5868
|
+
case 'captured':
|
|
5869
|
+
return _assign(_assign({}, state), {
|
|
5870
|
+
capturing: false,
|
|
5871
|
+
captureFailed: false
|
|
5872
|
+
});
|
|
5873
|
+
case 'frameCaptured':
|
|
5874
|
+
return _assign(_assign({}, state), {
|
|
5875
|
+
imageUrl: action.payload.imageUrl
|
|
5876
|
+
});
|
|
5877
|
+
case 'captureFailed':
|
|
5878
|
+
return _assign(_assign({}, state), {
|
|
5879
|
+
capturing: false,
|
|
5880
|
+
captureFailed: true
|
|
5881
|
+
});
|
|
5882
|
+
case 'documentCaptured':
|
|
5883
|
+
{
|
|
5884
|
+
var newState = _assign(_assign({}, state), {
|
|
5885
|
+
capturing: false,
|
|
5886
|
+
captureFailed: false,
|
|
5887
|
+
allowOverrideFlipRequirement: false,
|
|
5888
|
+
overrideFlipRequirement: false,
|
|
5889
|
+
goodFramesCount: 0,
|
|
5890
|
+
wrongDocumentTypePredictions: 0,
|
|
5891
|
+
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
5892
|
+
});
|
|
5893
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
5894
|
+
if (remainingRequirements.length === 0) {
|
|
5895
|
+
newState.captureState = 'complete';
|
|
5896
|
+
} else {
|
|
5897
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
5898
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
5899
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
5900
|
+
newState.captureState = 'requestingFlip';
|
|
5901
|
+
}
|
|
5902
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
5903
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
5904
|
+
newState.passportDetectionThresholdMet = false;
|
|
5905
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
5906
|
+
}
|
|
5907
|
+
}
|
|
5908
|
+
return newState;
|
|
5909
|
+
}
|
|
5910
|
+
case 'documentCapturedManually':
|
|
5911
|
+
return _reducer(state, {
|
|
5912
|
+
type: 'documentCaptured',
|
|
5913
|
+
payload: _assign(_assign({}, action.payload), {
|
|
5914
|
+
documentType: state.requestedDocumentType,
|
|
5915
|
+
width: 0,
|
|
5916
|
+
height: 0
|
|
5917
|
+
})
|
|
5918
|
+
});
|
|
5919
|
+
case 'documentsCaptured':
|
|
5920
|
+
{
|
|
5921
|
+
var newState = _assign({}, state);
|
|
5922
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
5923
|
+
var doc = _e[_d];
|
|
5924
|
+
newState = _reducer(newState, {
|
|
5925
|
+
type: 'documentCaptured',
|
|
5926
|
+
payload: doc
|
|
5927
|
+
});
|
|
5928
|
+
}
|
|
5929
|
+
return newState;
|
|
5930
|
+
}
|
|
5931
|
+
case 'flipRequestCompleted':
|
|
5932
|
+
return _assign(_assign({}, state), {
|
|
5933
|
+
captureState: 'capturing',
|
|
5934
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
5935
|
+
overrideWrongDocumentTypeGuidance: false,
|
|
5936
|
+
wrongDocumentTypePredictions: 0
|
|
5937
|
+
});
|
|
5938
|
+
case 'allowOverrideFlipRequirement':
|
|
5939
|
+
return _assign(_assign({}, state), {
|
|
5940
|
+
allowOverrideWrongDocumentTypeGuidance: true
|
|
5941
|
+
});
|
|
5942
|
+
case 'overrideFlipRequirement':
|
|
5943
|
+
return _assign(_assign({}, state), {
|
|
5944
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
5945
|
+
overrideWrongDocumentTypeGuidance: true
|
|
5946
|
+
});
|
|
5947
|
+
case 'setUploadingDocumentsFromStorage':
|
|
5948
|
+
return _assign(_assign({}, state), {
|
|
5949
|
+
isUploadingDocumentsFromStorage: action.payload,
|
|
5950
|
+
captureState: action.payload ? 'initializing' : 'capturing'
|
|
5951
|
+
});
|
|
5952
|
+
case 'setUploadingDocumentsType':
|
|
5953
|
+
{
|
|
5954
|
+
var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
|
|
5955
|
+
var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
|
|
5956
|
+
return _assign(_assign({}, state), {
|
|
5957
|
+
captureState: action.payload ? 'uploading' : 'initializing',
|
|
5958
|
+
uploadingDocumentsType: uploadingDocumentsType,
|
|
5959
|
+
requestedDocumentType: requestedDocumentType
|
|
5960
|
+
});
|
|
5961
|
+
}
|
|
5962
|
+
case 'resetWizard':
|
|
5963
|
+
return _assign(_assign({}, initialState$4), {
|
|
5964
|
+
dispatch: state.dispatch,
|
|
5965
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
5966
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
5967
|
+
captureRequirement: state.captureRequirement,
|
|
5968
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
5969
|
+
});
|
|
5970
|
+
default:
|
|
5971
|
+
return state;
|
|
6125
5972
|
}
|
|
6126
5973
|
};
|
|
6127
|
-
function
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
5974
|
+
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
5975
|
+
return _assign(_assign({}, initialState$4), {
|
|
5976
|
+
dispatch: function dispatch(action) {
|
|
5977
|
+
return set(function (state) {
|
|
5978
|
+
return _reducer(state, action);
|
|
5979
|
+
}, undefined, action);
|
|
5980
|
+
}
|
|
5981
|
+
});
|
|
5982
|
+
}));
|
|
5983
|
+
function IdCaptureStateProvider(_a) {
|
|
5984
|
+
var children = _a.children;
|
|
5985
|
+
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
|
|
5986
|
+
return state.overrideWrongDocumentTypeGuidance;
|
|
5987
|
+
}));
|
|
5988
|
+
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
5989
|
+
React.useEffect(function () {
|
|
5990
|
+
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
5991
|
+
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
5992
|
+
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
5993
|
+
dispatchIdCaptureAction({
|
|
5994
|
+
type: 'redrawRequested'
|
|
5995
|
+
});
|
|
5996
|
+
}, 500);
|
|
5997
|
+
React.useLayoutEffect(function () {
|
|
5998
|
+
if (typeof window === 'undefined') return;
|
|
5999
|
+
window.addEventListener('resize', onResize);
|
|
6000
|
+
return function () {
|
|
6001
|
+
return window.removeEventListener('resize', onResize);
|
|
6002
|
+
};
|
|
6003
|
+
}, [onResize]);
|
|
6004
|
+
React.useEffect(function resetWhenProviderUnmounts() {
|
|
6005
|
+
return function () {
|
|
6006
|
+
return useIdCaptureStore.getState().dispatch({
|
|
6007
|
+
type: 'resetWizard'
|
|
6008
|
+
});
|
|
6009
|
+
};
|
|
6010
|
+
}, []);
|
|
6011
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
6012
|
+
}
|
|
6013
|
+
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
6014
|
+
return useIdCaptureStore.getState().dispatch(action);
|
|
6015
|
+
};
|
|
6016
|
+
|
|
6017
|
+
function DebugStatsPane(_a) {
|
|
6018
|
+
var children = _a.children;
|
|
6019
|
+
var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
|
|
6020
|
+
var portalLocation = document.getElementById('idmission-above-guides-content');
|
|
6021
|
+
if (!portalLocation) return element;
|
|
6022
|
+
return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
|
|
6023
|
+
}
|
|
6024
|
+
var DebugStatsPaneDiv = styled__default.default.span(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"], ["\n font-size: 16px;\n font-family: monospace;\n position: absolute;\n left: 20px;\n bottom: 20px;\n margin-right: 20px;\n padding: 8px;\n color: limegreen;\n background: rgba(0, 0, 0, 0.5);\n z-index: 10002;\n"])));
|
|
6025
|
+
var ObjectDetectionDebugOverlayDiv = styled__default.default.div(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n z-index: 1001;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n overflow: hidden;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
6026
|
+
var $flipX = _a.$flipX;
|
|
6027
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6028
|
+
});
|
|
6029
|
+
var ObjectDetectionDebugBox = styled__default.default.div(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"], ["\n font: 10px monospace;\n position: absolute;\n border: 3px solid ", ";\n color: ", ";\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
6030
|
+
var $color = _a.$color;
|
|
6031
|
+
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
6032
|
+
}, function (_a) {
|
|
6033
|
+
var $color = _a.$color;
|
|
6034
|
+
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
6035
|
+
}, function (_a) {
|
|
6036
|
+
var $flipX = _a.$flipX;
|
|
6037
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6038
|
+
});
|
|
6039
|
+
var FaceDetectionKeypointMarker = styled__default.default.div(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n width: 4px;\n height: 4px;\n border: 2px solid ", ";\n font: 10px monospace;\n color: ", ";\n border-radius: 50%;\n ", "\n transform-style: preserve-3d;\n"])), function (_a) {
|
|
6040
|
+
var $color = _a.$color;
|
|
6041
|
+
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
6042
|
+
}, function (_a) {
|
|
6043
|
+
var $color = _a.$color;
|
|
6044
|
+
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
6045
|
+
}, function (_a) {
|
|
6046
|
+
var $flipX = _a.$flipX;
|
|
6047
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6048
|
+
});
|
|
6049
|
+
function useDebugScalingDetails(_a) {
|
|
6050
|
+
var _b = _a.enabled,
|
|
6051
|
+
enabled = _b === void 0 ? true : _b,
|
|
6052
|
+
pageWidth = _a.pageWidth,
|
|
6053
|
+
pageHeight = _a.pageHeight,
|
|
6054
|
+
videoWidth = _a.videoWidth,
|
|
6055
|
+
videoHeight = _a.videoHeight;
|
|
6056
|
+
return React.useMemo(function () {
|
|
6057
|
+
var horizontal = false,
|
|
6058
|
+
scaledWidth = 0,
|
|
6059
|
+
scaledHeight = 0,
|
|
6060
|
+
xOffset = 0,
|
|
6061
|
+
yOffset = 0;
|
|
6062
|
+
if (enabled) {
|
|
6063
|
+
horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
|
|
6064
|
+
if (horizontal) {
|
|
6065
|
+
scaledWidth = videoWidth * (pageHeight / videoHeight);
|
|
6066
|
+
xOffset = (scaledWidth - pageWidth) / 2;
|
|
6067
|
+
} else {
|
|
6068
|
+
scaledHeight = videoHeight * (pageWidth / videoWidth);
|
|
6069
|
+
yOffset = (scaledHeight - pageHeight) / 2;
|
|
6070
|
+
}
|
|
6137
6071
|
}
|
|
6138
|
-
|
|
6072
|
+
return {
|
|
6073
|
+
horizontal: horizontal,
|
|
6074
|
+
pageWidth: pageWidth,
|
|
6075
|
+
pageHeight: pageHeight,
|
|
6076
|
+
videoWidth: videoWidth,
|
|
6077
|
+
videoHeight: videoHeight,
|
|
6078
|
+
scaledWidth: scaledWidth,
|
|
6079
|
+
scaledHeight: scaledHeight,
|
|
6080
|
+
xOffset: xOffset,
|
|
6081
|
+
yOffset: yOffset
|
|
6082
|
+
};
|
|
6083
|
+
}, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
|
|
6139
6084
|
}
|
|
6140
|
-
var
|
|
6141
|
-
var
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6085
|
+
var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
6086
|
+
var scaling = _a.scaling,
|
|
6087
|
+
$flipX = _a.$flipX,
|
|
6088
|
+
children = _a.children;
|
|
6089
|
+
var _b = useIdCaptureStore(),
|
|
6090
|
+
guideRectWidth = _b.guideRectWidth,
|
|
6091
|
+
guideRectHeight = _b.guideRectHeight,
|
|
6092
|
+
guideRectX = _b.guideRectX,
|
|
6093
|
+
guideRectY = _b.guideRectY;
|
|
6094
|
+
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
6095
|
+
id: "debug-overlay-div",
|
|
6096
|
+
"$flipX": $flipX,
|
|
6097
|
+
style: {
|
|
6098
|
+
top: guideRectY,
|
|
6099
|
+
left: guideRectX,
|
|
6100
|
+
width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
|
|
6101
|
+
height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
|
|
6147
6102
|
}
|
|
6148
|
-
},
|
|
6103
|
+
}, children);
|
|
6149
6104
|
};
|
|
6150
|
-
function
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6105
|
+
function IdCaptureDetectedObjectDebugBox(_a) {
|
|
6106
|
+
var obj = _a.obj,
|
|
6107
|
+
flipX = _a.flipX,
|
|
6108
|
+
_b = _a.color,
|
|
6109
|
+
color = _b === void 0 ? 'green' : _b,
|
|
6110
|
+
scaling = _a.scaling;
|
|
6111
|
+
var horizontal = scaling.horizontal,
|
|
6112
|
+
pageWidth = scaling.pageWidth,
|
|
6113
|
+
pageHeight = scaling.pageHeight,
|
|
6114
|
+
videoWidth = scaling.videoWidth,
|
|
6115
|
+
videoHeight = scaling.videoHeight,
|
|
6116
|
+
scaledWidth = scaling.scaledWidth,
|
|
6117
|
+
scaledHeight = scaling.scaledHeight,
|
|
6118
|
+
xOffset = scaling.xOffset,
|
|
6119
|
+
yOffset = scaling.yOffset;
|
|
6120
|
+
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
6121
|
+
var top;
|
|
6122
|
+
var left;
|
|
6123
|
+
var width;
|
|
6124
|
+
var height;
|
|
6125
|
+
if (horizontal) {
|
|
6126
|
+
top = obj.box.yMin / videoHeight * pageHeight;
|
|
6127
|
+
left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
6128
|
+
width = obj.box.width / videoWidth * scaledWidth;
|
|
6129
|
+
height = obj.box.height / videoHeight * pageHeight;
|
|
6130
|
+
} else {
|
|
6131
|
+
top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
6132
|
+
left = obj.box.xMin / videoWidth * pageWidth;
|
|
6133
|
+
width = obj.box.width / videoWidth * pageWidth;
|
|
6134
|
+
height = obj.box.height / videoHeight * scaledHeight;
|
|
6157
6135
|
}
|
|
6158
|
-
return
|
|
6136
|
+
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
6137
|
+
"$flipX": flipX,
|
|
6138
|
+
"$color": color,
|
|
6139
|
+
style: {
|
|
6140
|
+
top: top,
|
|
6141
|
+
left: left,
|
|
6142
|
+
width: width,
|
|
6143
|
+
height: height
|
|
6144
|
+
}
|
|
6145
|
+
});
|
|
6159
6146
|
}
|
|
6160
|
-
function
|
|
6161
|
-
var
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6147
|
+
function SelfieCaptureFaceDebugBox(_a) {
|
|
6148
|
+
var face = _a.face,
|
|
6149
|
+
flipX = _a.flipX,
|
|
6150
|
+
_b = _a.color,
|
|
6151
|
+
color = _b === void 0 ? 'green' : _b,
|
|
6152
|
+
scaling = _a.scaling;
|
|
6153
|
+
var horizontal = scaling.horizontal,
|
|
6154
|
+
pageWidth = scaling.pageWidth,
|
|
6155
|
+
pageHeight = scaling.pageHeight,
|
|
6156
|
+
videoWidth = scaling.videoWidth,
|
|
6157
|
+
videoHeight = scaling.videoHeight,
|
|
6158
|
+
scaledWidth = scaling.scaledWidth,
|
|
6159
|
+
scaledHeight = scaling.scaledHeight,
|
|
6160
|
+
xOffset = scaling.xOffset,
|
|
6161
|
+
yOffset = scaling.yOffset;
|
|
6162
|
+
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
6163
|
+
var top;
|
|
6164
|
+
var left;
|
|
6165
|
+
var width;
|
|
6166
|
+
var height;
|
|
6167
|
+
if (horizontal) {
|
|
6168
|
+
top = face.box.yMin / videoHeight * pageHeight;
|
|
6169
|
+
left = face.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
6170
|
+
width = face.box.width / videoWidth * scaledWidth;
|
|
6171
|
+
height = face.box.height / videoHeight * pageHeight;
|
|
6172
|
+
} else {
|
|
6173
|
+
top = face.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
6174
|
+
left = face.box.xMin / videoWidth * pageWidth;
|
|
6175
|
+
width = face.box.width / videoWidth * pageWidth;
|
|
6176
|
+
height = face.box.height / videoHeight * scaledHeight;
|
|
6177
|
+
}
|
|
6178
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
6179
|
+
"$flipX": flipX,
|
|
6180
|
+
"$color": color,
|
|
6181
|
+
style: {
|
|
6182
|
+
top: top,
|
|
6183
|
+
left: left,
|
|
6184
|
+
width: width,
|
|
6185
|
+
height: height
|
|
6186
|
+
}
|
|
6187
|
+
}), face.keypoints.map(function (point, ii) {
|
|
6188
|
+
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
|
|
6189
|
+
key: ii,
|
|
6190
|
+
point: point,
|
|
6191
|
+
scaling: scaling,
|
|
6192
|
+
flipX: flipX
|
|
6193
|
+
});
|
|
6194
|
+
}));
|
|
6167
6195
|
}
|
|
6168
|
-
function
|
|
6169
|
-
var
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6196
|
+
function SelfieCaptureFaceKeypoint(_a) {
|
|
6197
|
+
var point = _a.point,
|
|
6198
|
+
flipX = _a.flipX,
|
|
6199
|
+
_b = _a.color,
|
|
6200
|
+
color = _b === void 0 ? 'red' : _b,
|
|
6201
|
+
_c = _a.scaling,
|
|
6202
|
+
horizontal = _c.horizontal,
|
|
6203
|
+
pageWidth = _c.pageWidth,
|
|
6204
|
+
pageHeight = _c.pageHeight,
|
|
6205
|
+
videoWidth = _c.videoWidth,
|
|
6206
|
+
videoHeight = _c.videoHeight,
|
|
6207
|
+
scaledWidth = _c.scaledWidth,
|
|
6208
|
+
scaledHeight = _c.scaledHeight,
|
|
6209
|
+
xOffset = _c.xOffset,
|
|
6210
|
+
yOffset = _c.yOffset;
|
|
6211
|
+
var left, top;
|
|
6212
|
+
if (horizontal) {
|
|
6213
|
+
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
6214
|
+
top = point.y / videoHeight * pageHeight;
|
|
6215
|
+
} else {
|
|
6216
|
+
left = point.x / videoWidth * pageWidth;
|
|
6217
|
+
top = point.y / videoHeight * scaledHeight - yOffset;
|
|
6218
|
+
}
|
|
6219
|
+
top -= 2;
|
|
6220
|
+
left -= 2;
|
|
6221
|
+
return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
|
|
6222
|
+
"$flipX": flipX,
|
|
6223
|
+
"$color": color,
|
|
6224
|
+
style: {
|
|
6225
|
+
top: top,
|
|
6226
|
+
left: left
|
|
6227
|
+
}
|
|
6228
|
+
});
|
|
6178
6229
|
}
|
|
6230
|
+
var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
|
|
6179
6231
|
|
|
6180
6232
|
var GuidanceMessageContainerDiv = styled__default.default.div(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"], ["\n position: absolute;\n top: calc(", ");\n ", "\n font-weight: bold;\n width: 100%;\n display: flex;\n"])), function (_a) {
|
|
6181
6233
|
var $top = _a.$top;
|
|
@@ -13779,9 +13831,10 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
13779
13831
|
});
|
|
13780
13832
|
}
|
|
13781
13833
|
var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
|
|
13782
|
-
var _a
|
|
13783
|
-
|
|
13784
|
-
|
|
13834
|
+
var _a, _b;
|
|
13835
|
+
var _c = React.useState(0),
|
|
13836
|
+
attempts = _c[0],
|
|
13837
|
+
setAttempts = _c[1];
|
|
13785
13838
|
var onRetryClickedProp = props.onRetryClicked;
|
|
13786
13839
|
var onRetryClicked = React.useCallback(function () {
|
|
13787
13840
|
setAttempts(function (n) {
|
|
@@ -13797,7 +13850,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
|
|
|
13797
13850
|
maxVideoWidth: 1280,
|
|
13798
13851
|
maxFps: 30,
|
|
13799
13852
|
onCameraAccessDenied: props.onCameraAccessDenied,
|
|
13800
|
-
|
|
13853
|
+
onCameraTamperingDetected: props.onCameraTamperingDetected,
|
|
13854
|
+
onMicrophoneAccessDenied: props.onMicrophoneAccessDenied,
|
|
13855
|
+
classNames: (_a = props.classNames) === null || _a === void 0 ? void 0 : _a.cameraStoreProvider,
|
|
13856
|
+
verbiage: (_b = props.verbiage) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider
|
|
13801
13857
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
13802
13858
|
autoStart: false,
|
|
13803
13859
|
throttleMs: 250,
|
|
@@ -14636,6 +14692,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14636
14692
|
onUserCancel = _a.onUserCancel,
|
|
14637
14693
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
14638
14694
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
14695
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
14639
14696
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
14640
14697
|
_l = _a.idCaptureProps,
|
|
14641
14698
|
idCaptureProps = _l === void 0 ? {} : _l,
|
|
@@ -14794,7 +14851,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14794
14851
|
maxVideoWidth: isCapturingId ? 1920 : 1280,
|
|
14795
14852
|
maxFps: isCapturingId ? 60 : 30,
|
|
14796
14853
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
14797
|
-
|
|
14854
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
14855
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
14856
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
14857
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
14798
14858
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
14799
14859
|
autoStart: false,
|
|
14800
14860
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
@@ -14905,35 +14965,36 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14905
14965
|
};
|
|
14906
14966
|
|
|
14907
14967
|
function CompositeWizard(_a) {
|
|
14908
|
-
var _b, _c, _d, _e, _f;
|
|
14968
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
14909
14969
|
var userChecks = _a.checks,
|
|
14910
|
-
|
|
14911
|
-
idCaptureProps =
|
|
14912
|
-
|
|
14913
|
-
faceLivenessProps =
|
|
14970
|
+
_l = _a.idCaptureProps,
|
|
14971
|
+
idCaptureProps = _l === void 0 ? {} : _l,
|
|
14972
|
+
_m = _a.faceLivenessProps,
|
|
14973
|
+
faceLivenessProps = _m === void 0 ? {} : _m,
|
|
14914
14974
|
additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
|
|
14915
|
-
|
|
14916
|
-
signatureCaptureProps =
|
|
14917
|
-
|
|
14918
|
-
videoSignatureCaptureProps =
|
|
14919
|
-
|
|
14920
|
-
videoIdCaptureProps =
|
|
14921
|
-
|
|
14922
|
-
captureSignature =
|
|
14923
|
-
|
|
14924
|
-
captureSignatureVideo =
|
|
14975
|
+
_o = _a.signatureCaptureProps,
|
|
14976
|
+
signatureCaptureProps = _o === void 0 ? {} : _o,
|
|
14977
|
+
_p = _a.videoSignatureCaptureProps,
|
|
14978
|
+
videoSignatureCaptureProps = _p === void 0 ? {} : _p,
|
|
14979
|
+
_q = _a.videoIdCaptureProps,
|
|
14980
|
+
videoIdCaptureProps = _q === void 0 ? {} : _q,
|
|
14981
|
+
_r = _a.captureSignature,
|
|
14982
|
+
captureSignature = _r === void 0 ? false : _r,
|
|
14983
|
+
_s = _a.captureSignatureVideo,
|
|
14984
|
+
captureSignatureVideo = _s === void 0 ? false : _s,
|
|
14925
14985
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
14986
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
14926
14987
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
14927
|
-
|
|
14928
|
-
debugMode =
|
|
14929
|
-
var
|
|
14930
|
-
submit =
|
|
14931
|
-
submissionStatus =
|
|
14932
|
-
setSignatureData =
|
|
14933
|
-
setAdditionalDocuments =
|
|
14934
|
-
var
|
|
14935
|
-
checkIndex =
|
|
14936
|
-
setCheckIndex =
|
|
14988
|
+
_t = _a.debugMode,
|
|
14989
|
+
debugMode = _t === void 0 ? false : _t;
|
|
14990
|
+
var _u = React.useContext(SubmissionContext),
|
|
14991
|
+
submit = _u.submit,
|
|
14992
|
+
submissionStatus = _u.submissionStatus,
|
|
14993
|
+
setSignatureData = _u.setSignatureData,
|
|
14994
|
+
setAdditionalDocuments = _u.setAdditionalDocuments;
|
|
14995
|
+
var _v = React.useState(0),
|
|
14996
|
+
checkIndex = _v[0],
|
|
14997
|
+
setCheckIndex = _v[1];
|
|
14937
14998
|
var checks = React.useMemo(function () {
|
|
14938
14999
|
var _a, _b;
|
|
14939
15000
|
var checks = __spreadArray([], userChecks, true);
|
|
@@ -15044,13 +15105,16 @@ function CompositeWizard(_a) {
|
|
|
15044
15105
|
case 'IdCapture':
|
|
15045
15106
|
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
15046
15107
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15108
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15047
15109
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
15048
|
-
requestAccessAutomatically: shouldLoadIdCaptureModels
|
|
15110
|
+
requestAccessAutomatically: shouldLoadIdCaptureModels,
|
|
15111
|
+
classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
|
|
15112
|
+
verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
|
|
15049
15113
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
15050
15114
|
autoStart: false,
|
|
15051
15115
|
shouldLoadModels: shouldLoadIdCaptureModels,
|
|
15052
|
-
documentDetectionModelUrl: (
|
|
15053
|
-
focusModelUrl: (
|
|
15116
|
+
documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
15117
|
+
focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
|
|
15054
15118
|
onModelError: idCaptureProps.onModelError,
|
|
15055
15119
|
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
|
|
15056
15120
|
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
@@ -15061,6 +15125,7 @@ function CompositeWizard(_a) {
|
|
|
15061
15125
|
return /*#__PURE__*/React__namespace.default.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
|
|
15062
15126
|
onComplete: onVideoIdCaptureComplete,
|
|
15063
15127
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15128
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15064
15129
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15065
15130
|
}));
|
|
15066
15131
|
case 'FaceLiveness':
|
|
@@ -15068,7 +15133,10 @@ function CompositeWizard(_a) {
|
|
|
15068
15133
|
preferFrontFacingCamera: true,
|
|
15069
15134
|
preferIphoneContinuityCamera: false,
|
|
15070
15135
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15071
|
-
|
|
15136
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15137
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
15138
|
+
classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
|
|
15139
|
+
verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
|
|
15072
15140
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
15073
15141
|
autoStart: false,
|
|
15074
15142
|
onModelError: faceLivenessProps.onModelError,
|
|
@@ -15084,6 +15152,7 @@ function CompositeWizard(_a) {
|
|
|
15084
15152
|
return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardWithProviders, _assign({}, videoSignatureCaptureProps, {
|
|
15085
15153
|
onComplete: onVideoSignatureComplete,
|
|
15086
15154
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15155
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15087
15156
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15088
15157
|
}));
|
|
15089
15158
|
case 'AdditionalDocumentCapture':
|
|
@@ -15413,6 +15482,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
15413
15482
|
onUserCancel = _a.onUserCancel,
|
|
15414
15483
|
onModelError = _a.onModelError,
|
|
15415
15484
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15485
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15416
15486
|
_u = _a.theme,
|
|
15417
15487
|
theme = _u === void 0 ? 'default' : _u,
|
|
15418
15488
|
_v = _a.assets,
|
|
@@ -15554,6 +15624,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
15554
15624
|
captureSignature: captureSignature,
|
|
15555
15625
|
captureSignatureVideo: captureSignatureVideo,
|
|
15556
15626
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15627
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15557
15628
|
debugMode: debugMode
|
|
15558
15629
|
}))));
|
|
15559
15630
|
};
|
|
@@ -15608,6 +15679,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
15608
15679
|
onUserCancel = _a.onUserCancel,
|
|
15609
15680
|
onModelError = _a.onModelError,
|
|
15610
15681
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15682
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15611
15683
|
_j = _a.theme,
|
|
15612
15684
|
theme = _j === void 0 ? 'default' : _j,
|
|
15613
15685
|
assets = _a.assets,
|
|
@@ -15683,6 +15755,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
15683
15755
|
}, []),
|
|
15684
15756
|
faceLivenessProps: faceLivenessProps,
|
|
15685
15757
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15758
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15686
15759
|
debugMode: debugMode
|
|
15687
15760
|
}))));
|
|
15688
15761
|
};
|
|
@@ -15779,6 +15852,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
15779
15852
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
15780
15853
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
15781
15854
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15855
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15782
15856
|
_y = _a.captureSignature,
|
|
15783
15857
|
captureSignature = _y === void 0 ? false : _y,
|
|
15784
15858
|
_z = _a.captureSignatureVideo,
|
|
@@ -15942,6 +16016,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
15942
16016
|
captureSignature: captureSignature,
|
|
15943
16017
|
captureSignatureVideo: captureSignatureVideo,
|
|
15944
16018
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
16019
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15945
16020
|
debugMode: debugMode
|
|
15946
16021
|
}))));
|
|
15947
16022
|
};
|
|
@@ -16041,6 +16116,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
16041
16116
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
16042
16117
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
16043
16118
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
16119
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
16044
16120
|
_y = _a.captureSignature,
|
|
16045
16121
|
captureSignature = _y === void 0 ? false : _y,
|
|
16046
16122
|
_z = _a.captureSignatureVideo,
|
|
@@ -16226,6 +16302,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
16226
16302
|
captureSignature: captureSignature,
|
|
16227
16303
|
captureSignatureVideo: captureSignatureVideo,
|
|
16228
16304
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
16305
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
16229
16306
|
debugMode: debugMode
|
|
16230
16307
|
}))));
|
|
16231
16308
|
};
|
|
@@ -16735,6 +16812,7 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
16735
16812
|
onUserCancel = _a.onUserCancel,
|
|
16736
16813
|
onModelError = _a.onModelError,
|
|
16737
16814
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
16815
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
16738
16816
|
_h = _a.geolocationEnabled,
|
|
16739
16817
|
geolocationEnabled = _h === void 0 ? true : _h,
|
|
16740
16818
|
_j = _a.geolocationRequired,
|
|
@@ -16776,7 +16854,10 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
16776
16854
|
useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
|
|
16777
16855
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
16778
16856
|
preferFrontFacingCamera: true,
|
|
16779
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
16857
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
16858
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
16859
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
16860
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
16780
16861
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
16781
16862
|
autoStart: false,
|
|
16782
16863
|
onModelError: onModelError,
|
|
@@ -17296,6 +17377,7 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
17296
17377
|
onUserCancel = _a.onUserCancel,
|
|
17297
17378
|
onModelError = _a.onModelError,
|
|
17298
17379
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17380
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17299
17381
|
_g = _a.theme,
|
|
17300
17382
|
theme = _g === void 0 ? 'default' : _g,
|
|
17301
17383
|
assets = _a.assets,
|
|
@@ -17341,7 +17423,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
17341
17423
|
useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
|
|
17342
17424
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
17343
17425
|
preferFrontFacingCamera: true,
|
|
17344
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
17426
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
17427
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17428
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
17429
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
17345
17430
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
17346
17431
|
autoStart: false,
|
|
17347
17432
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -17389,6 +17474,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
17389
17474
|
onUserCancel = _a.onUserCancel,
|
|
17390
17475
|
onModelError = _a.onModelError,
|
|
17391
17476
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17477
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17392
17478
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
17393
17479
|
_c = _a.loadingOverlayMode,
|
|
17394
17480
|
loadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
@@ -17447,6 +17533,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
17447
17533
|
return ['VideoSignatureCapture'];
|
|
17448
17534
|
}, []),
|
|
17449
17535
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
17536
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17450
17537
|
videoSignatureCaptureProps: React.useMemo(function () {
|
|
17451
17538
|
return {
|
|
17452
17539
|
customOverlayContent: customOverlayContent,
|
|
@@ -17515,6 +17602,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
17515
17602
|
onExitAfterFailure = _a.onExitAfterFailure,
|
|
17516
17603
|
onUserCancel = _a.onUserCancel,
|
|
17517
17604
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17605
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17518
17606
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
17519
17607
|
idCaptureProps = _a.idCaptureProps,
|
|
17520
17608
|
faceLivenessProps = _a.faceLivenessProps,
|
|
@@ -17698,6 +17786,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
17698
17786
|
captureSignature: captureSignature,
|
|
17699
17787
|
captureSignatureVideo: captureSignatureVideo,
|
|
17700
17788
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
17789
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17701
17790
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
17702
17791
|
debugMode: debugMode
|
|
17703
17792
|
}))));
|
|
@@ -17753,6 +17842,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
17753
17842
|
onUserCancel = _a.onUserCancel,
|
|
17754
17843
|
onModelError = _a.onModelError,
|
|
17755
17844
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17845
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17756
17846
|
_h = _a.captureAdditionalDocuments,
|
|
17757
17847
|
captureAdditionalDocuments = _h === void 0 ? [] : _h,
|
|
17758
17848
|
_j = _a.captureSignature,
|
|
@@ -17874,6 +17964,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
17874
17964
|
captureSignature: captureSignature,
|
|
17875
17965
|
captureSignatureVideo: captureSignatureVideo,
|
|
17876
17966
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
17967
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17877
17968
|
debugMode: debugMode
|
|
17878
17969
|
}))));
|
|
17879
17970
|
};
|
|
@@ -17901,6 +17992,7 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
17901
17992
|
onExitCapture = _a.onExitCapture,
|
|
17902
17993
|
onUserCancel = _a.onUserCancel,
|
|
17903
17994
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17995
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17904
17996
|
_c = _a.documents,
|
|
17905
17997
|
documents = _c === void 0 ? [] : _c,
|
|
17906
17998
|
aspectRatio = _a.aspectRatio,
|
|
@@ -17943,7 +18035,10 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
17943
18035
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
17944
18036
|
requestAccessAutomatically: false,
|
|
17945
18037
|
preferIphoneContinuityCamera: true,
|
|
17946
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
18038
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
18039
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
18040
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
18041
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
17947
18042
|
}, /*#__PURE__*/React__namespace.default.createElement(DocumentCaptureWizard, {
|
|
17948
18043
|
onSuccess: onComplete,
|
|
17949
18044
|
onExitCapture: onExitCapture,
|