idmission-web-sdk 2.2.163 → 2.2.165
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/contexts/AuthStateContext.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/de.d.ts +3 -1
- package/dist/lib/locales/de.d.ts.map +1 -1
- package/dist/lib/locales/es.d.ts +3 -1
- package/dist/lib/locales/es.d.ts.map +1 -1
- package/dist/lib/locales/fr.d.ts +3 -1
- package/dist/lib/locales/fr.d.ts.map +1 -1
- package/dist/lib/locales/index.d.ts +23 -7
- package/dist/lib/locales/index.d.ts.map +1 -1
- package/dist/lib/locales/it.d.ts +3 -1
- package/dist/lib/locales/it.d.ts.map +1 -1
- package/dist/lib/locales/ja.d.ts +3 -1
- package/dist/lib/locales/ja.d.ts.map +1 -1
- package/dist/lib/locales/pt.d.ts +3 -1
- package/dist/lib/locales/pt.d.ts.map +1 -1
- package/dist/lib/locales/ru.d.ts +2 -0
- package/dist/lib/locales/ru.d.ts.map +1 -1
- package/dist/lib/locales/zh.d.ts +3 -1
- package/dist/lib/locales/zh.d.ts.map +1 -1
- package/dist/sdk2.cjs.development.js +2117 -1958
- 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 +2118 -1959
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +5883 -5724
- 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.165';
|
|
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,62 @@ 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
|
+
|
|
806
|
+
var LogLevel;
|
|
807
|
+
(function (LogLevel) {
|
|
808
|
+
LogLevel[LogLevel["Off"] = 0] = "Off";
|
|
809
|
+
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
810
|
+
LogLevel[LogLevel["Warn"] = 2] = "Warn";
|
|
811
|
+
LogLevel[LogLevel["Info"] = 3] = "Info";
|
|
812
|
+
LogLevel[LogLevel["Debug"] = 4] = "Debug";
|
|
813
|
+
})(LogLevel || (LogLevel = {}));
|
|
814
|
+
var logLevel = LogLevel.Warn;
|
|
815
|
+
function useLogLevel(newLogLevel) {
|
|
816
|
+
React.useEffect(function () {
|
|
817
|
+
var oldLogLevel = logLevel;
|
|
818
|
+
if (newLogLevel === oldLogLevel) return;
|
|
819
|
+
logLevel = newLogLevel;
|
|
820
|
+
return function () {
|
|
821
|
+
logLevel = oldLogLevel;
|
|
822
|
+
};
|
|
823
|
+
}, [newLogLevel]);
|
|
824
|
+
}
|
|
825
|
+
function useDebugLogging(enabled) {
|
|
826
|
+
useLogLevel(enabled ? LogLevel.Debug : logLevel);
|
|
827
|
+
}
|
|
828
|
+
function debug() {
|
|
829
|
+
var parts = [];
|
|
830
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
831
|
+
parts[_i] = arguments[_i];
|
|
832
|
+
}
|
|
833
|
+
if (logLevel < LogLevel.Debug) return;
|
|
834
|
+
console.debug.apply(console, parts); // eslint-disable-line no-console
|
|
835
|
+
}
|
|
836
|
+
function log() {
|
|
837
|
+
var parts = [];
|
|
838
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
839
|
+
parts[_i] = arguments[_i];
|
|
840
|
+
}
|
|
841
|
+
if (logLevel < LogLevel.Info) return;
|
|
842
|
+
console.log.apply(console, parts); // eslint-disable-line no-console
|
|
843
|
+
}
|
|
844
|
+
function warn() {
|
|
845
|
+
var parts = [];
|
|
846
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
847
|
+
parts[_i] = arguments[_i];
|
|
848
|
+
}
|
|
849
|
+
if (logLevel < LogLevel.Warn) return;
|
|
850
|
+
console.warn.apply(console, parts); // eslint-disable-line no-console
|
|
851
|
+
}
|
|
852
|
+
function error() {
|
|
853
|
+
var parts = [];
|
|
854
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
855
|
+
parts[_i] = arguments[_i];
|
|
856
|
+
}
|
|
857
|
+
if (logLevel < LogLevel.Error) return;
|
|
858
|
+
console.error.apply(console, parts); // eslint-disable-line no-console
|
|
859
|
+
}
|
|
805
860
|
|
|
806
861
|
exports.defaultAuthUrl = 'https://portal-api.idmission.com';
|
|
807
862
|
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'];
|
|
@@ -840,8 +895,95 @@ var reducer$4 = function reducer(state, action) {
|
|
|
840
895
|
return state;
|
|
841
896
|
}
|
|
842
897
|
};
|
|
898
|
+
function makeValidateSessionRequest(authUrl_1, sessionId_1) {
|
|
899
|
+
return __awaiter(this, arguments, void 0, function (authUrl, sessionId, retryCount) {
|
|
900
|
+
var maxRetries, baseDelay, response, delay_1, error_1, delay_2;
|
|
901
|
+
if (retryCount === void 0) {
|
|
902
|
+
retryCount = 0;
|
|
903
|
+
}
|
|
904
|
+
return __generator(this, function (_a) {
|
|
905
|
+
switch (_a.label) {
|
|
906
|
+
case 0:
|
|
907
|
+
maxRetries = 10;
|
|
908
|
+
baseDelay = 1000 // 1 second
|
|
909
|
+
;
|
|
910
|
+
_a.label = 1;
|
|
911
|
+
case 1:
|
|
912
|
+
_a.trys.push([1, 4,, 6]);
|
|
913
|
+
return [4 /*yield*/, fetch("".concat(authUrl, "/portal.sessions.v1.SessionsService/ValidateSession"), {
|
|
914
|
+
method: 'POST',
|
|
915
|
+
headers: {
|
|
916
|
+
'Content-Type': 'application/json'
|
|
917
|
+
},
|
|
918
|
+
body: JSON.stringify({
|
|
919
|
+
id: sessionId
|
|
920
|
+
})
|
|
921
|
+
})
|
|
922
|
+
// If the request was successful or we've hit max retries, return the response
|
|
923
|
+
];
|
|
924
|
+
case 2:
|
|
925
|
+
response = _a.sent();
|
|
926
|
+
// If the request was successful or we've hit max retries, return the response
|
|
927
|
+
if (response.ok || retryCount >= maxRetries) {
|
|
928
|
+
return [2 /*return*/, response];
|
|
929
|
+
}
|
|
930
|
+
delay_1 = baseDelay * Math.pow(2, retryCount) // Exponential backoff
|
|
931
|
+
;
|
|
932
|
+
return [4 /*yield*/, new Promise(function (resolve) {
|
|
933
|
+
return setTimeout(resolve, delay_1);
|
|
934
|
+
})];
|
|
935
|
+
case 3:
|
|
936
|
+
_a.sent();
|
|
937
|
+
return [2 /*return*/, makeValidateSessionRequest(authUrl, sessionId, retryCount + 1)];
|
|
938
|
+
case 4:
|
|
939
|
+
error_1 = _a.sent();
|
|
940
|
+
// If we've hit max retries, throw the error
|
|
941
|
+
if (retryCount >= maxRetries) {
|
|
942
|
+
throw error_1;
|
|
943
|
+
}
|
|
944
|
+
delay_2 = baseDelay * Math.pow(2, retryCount);
|
|
945
|
+
return [4 /*yield*/, new Promise(function (resolve) {
|
|
946
|
+
return setTimeout(resolve, delay_2);
|
|
947
|
+
})];
|
|
948
|
+
case 5:
|
|
949
|
+
_a.sent();
|
|
950
|
+
return [2 /*return*/, makeValidateSessionRequest(authUrl, sessionId, retryCount + 1)];
|
|
951
|
+
case 6:
|
|
952
|
+
return [2 /*return*/];
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
function validateSession(authUrl, sessionId) {
|
|
958
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
959
|
+
var resp, respText, message, valid, respJson;
|
|
960
|
+
return __generator(this, function (_a) {
|
|
961
|
+
switch (_a.label) {
|
|
962
|
+
case 0:
|
|
963
|
+
return [4 /*yield*/, makeValidateSessionRequest(authUrl, sessionId)];
|
|
964
|
+
case 1:
|
|
965
|
+
resp = _a.sent();
|
|
966
|
+
return [4 /*yield*/, resp.text()];
|
|
967
|
+
case 2:
|
|
968
|
+
respText = _a.sent();
|
|
969
|
+
message = respText;
|
|
970
|
+
valid = false;
|
|
971
|
+
try {
|
|
972
|
+
respJson = JSON.parse(respText);
|
|
973
|
+
message = respJson.message;
|
|
974
|
+
valid = respJson.valid;
|
|
975
|
+
} catch (e) {
|
|
976
|
+
warn('Failed to parse session validation response', e);
|
|
977
|
+
}
|
|
978
|
+
if (!resp.ok) {
|
|
979
|
+
throw new SessionValidationFailedError(new Error(message), authUrl);
|
|
980
|
+
}
|
|
981
|
+
return [2 /*return*/, valid];
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
}
|
|
843
986
|
function useAuthReducer(authUrl, sessionId) {
|
|
844
|
-
var _this = this;
|
|
845
987
|
if (authUrl === void 0) {
|
|
846
988
|
authUrl = exports.defaultAuthUrl;
|
|
847
989
|
}
|
|
@@ -887,51 +1029,17 @@ function useAuthReducer(authUrl, sessionId) {
|
|
|
887
1029
|
type: 'setCheckState',
|
|
888
1030
|
payload: 'RUNNING'
|
|
889
1031
|
});
|
|
890
|
-
(function () {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
headers: {
|
|
900
|
-
'Content-Type': 'application/json'
|
|
901
|
-
},
|
|
902
|
-
body: JSON.stringify({
|
|
903
|
-
id: resolvedSessionId
|
|
904
|
-
})
|
|
905
|
-
})];
|
|
906
|
-
case 1:
|
|
907
|
-
resp = _b.sent();
|
|
908
|
-
return [4 /*yield*/, resp.json()];
|
|
909
|
-
case 2:
|
|
910
|
-
_a = _b.sent(), valid = _a.valid, message = _a.message;
|
|
911
|
-
if (!resp.ok) {
|
|
912
|
-
dispatch({
|
|
913
|
-
type: 'setError',
|
|
914
|
-
payload: new SessionValidationFailedError(new Error(message), authUrl)
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
dispatch({
|
|
918
|
-
type: 'setCheckState',
|
|
919
|
-
payload: valid ? 'PASSED' : 'FAILED'
|
|
920
|
-
});
|
|
921
|
-
return [3 /*break*/, 4];
|
|
922
|
-
case 3:
|
|
923
|
-
e_1 = _b.sent();
|
|
924
|
-
dispatch({
|
|
925
|
-
type: 'setError',
|
|
926
|
-
payload: new SessionValidationFailedError(e_1, authUrl)
|
|
927
|
-
});
|
|
928
|
-
return [3 /*break*/, 4];
|
|
929
|
-
case 4:
|
|
930
|
-
return [2 /*return*/];
|
|
931
|
-
}
|
|
932
|
-
});
|
|
1032
|
+
validateSession(authUrl, resolvedSessionId).then(function (valid) {
|
|
1033
|
+
dispatch({
|
|
1034
|
+
type: 'setCheckState',
|
|
1035
|
+
payload: valid ? 'PASSED' : 'FAILED'
|
|
1036
|
+
});
|
|
1037
|
+
})["catch"](function (e) {
|
|
1038
|
+
dispatch({
|
|
1039
|
+
type: 'setError',
|
|
1040
|
+
payload: new SessionValidationFailedError(e, authUrl)
|
|
933
1041
|
});
|
|
934
|
-
})
|
|
1042
|
+
});
|
|
935
1043
|
}
|
|
936
1044
|
}, [authUrl, sessionCheckState, resolvedSessionId, sessionId]);
|
|
937
1045
|
return [state, dispatch];
|
|
@@ -982,61 +1090,6 @@ function AuthProvider(_a) {
|
|
|
982
1090
|
}, children));
|
|
983
1091
|
}
|
|
984
1092
|
|
|
985
|
-
var LogLevel;
|
|
986
|
-
(function (LogLevel) {
|
|
987
|
-
LogLevel[LogLevel["Off"] = 0] = "Off";
|
|
988
|
-
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
989
|
-
LogLevel[LogLevel["Warn"] = 2] = "Warn";
|
|
990
|
-
LogLevel[LogLevel["Info"] = 3] = "Info";
|
|
991
|
-
LogLevel[LogLevel["Debug"] = 4] = "Debug";
|
|
992
|
-
})(LogLevel || (LogLevel = {}));
|
|
993
|
-
var logLevel = LogLevel.Warn;
|
|
994
|
-
function useLogLevel(newLogLevel) {
|
|
995
|
-
React.useEffect(function () {
|
|
996
|
-
var oldLogLevel = logLevel;
|
|
997
|
-
if (newLogLevel === oldLogLevel) return;
|
|
998
|
-
logLevel = newLogLevel;
|
|
999
|
-
return function () {
|
|
1000
|
-
logLevel = oldLogLevel;
|
|
1001
|
-
};
|
|
1002
|
-
}, [newLogLevel]);
|
|
1003
|
-
}
|
|
1004
|
-
function useDebugLogging(enabled) {
|
|
1005
|
-
useLogLevel(enabled ? LogLevel.Debug : logLevel);
|
|
1006
|
-
}
|
|
1007
|
-
function debug() {
|
|
1008
|
-
var parts = [];
|
|
1009
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1010
|
-
parts[_i] = arguments[_i];
|
|
1011
|
-
}
|
|
1012
|
-
if (logLevel < LogLevel.Debug) return;
|
|
1013
|
-
console.debug.apply(console, parts); // eslint-disable-line no-console
|
|
1014
|
-
}
|
|
1015
|
-
function log() {
|
|
1016
|
-
var parts = [];
|
|
1017
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1018
|
-
parts[_i] = arguments[_i];
|
|
1019
|
-
}
|
|
1020
|
-
if (logLevel < LogLevel.Info) return;
|
|
1021
|
-
console.log.apply(console, parts); // eslint-disable-line no-console
|
|
1022
|
-
}
|
|
1023
|
-
function warn() {
|
|
1024
|
-
var parts = [];
|
|
1025
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1026
|
-
parts[_i] = arguments[_i];
|
|
1027
|
-
}
|
|
1028
|
-
if (logLevel < LogLevel.Warn) return;
|
|
1029
|
-
console.warn.apply(console, parts); // eslint-disable-line no-console
|
|
1030
|
-
}
|
|
1031
|
-
function error() {
|
|
1032
|
-
var parts = [];
|
|
1033
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1034
|
-
parts[_i] = arguments[_i];
|
|
1035
|
-
}
|
|
1036
|
-
if (logLevel < LogLevel.Error) return;
|
|
1037
|
-
console.error.apply(console, parts); // eslint-disable-line no-console
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
1093
|
exports.defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
|
|
1041
1094
|
function setDefaultSubmissionUrl(url) {
|
|
1042
1095
|
exports.defaultSubmissionUrl = url;
|
|
@@ -2091,7 +2144,7 @@ function getFrameDimensions(frame) {
|
|
|
2091
2144
|
return [frameWidth, frameHeight];
|
|
2092
2145
|
}
|
|
2093
2146
|
|
|
2094
|
-
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$
|
|
2147
|
+
var InvisibleCanvas = styled__default.default.canvas(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n display: none;\n"], ["\n display: none;\n"])));
|
|
2095
2148
|
function drawToCanvas(canvas, frame, width, height) {
|
|
2096
2149
|
if (!canvas) return;
|
|
2097
2150
|
var ctx = canvas.getContext('2d');
|
|
@@ -2111,7 +2164,7 @@ function clearCanvas(canvas) {
|
|
|
2111
2164
|
var _a;
|
|
2112
2165
|
(_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
2166
|
}
|
|
2114
|
-
var templateObject_1$
|
|
2167
|
+
var templateObject_1$I;
|
|
2115
2168
|
|
|
2116
2169
|
function cropToShoulders(rawCanvas, cropCanvas, resizeCanvas, frame, face, quality, maxHeight) {
|
|
2117
2170
|
if (quality === void 0) {
|
|
@@ -3534,1568 +3587,6 @@ function releaseCameraAccess() {
|
|
|
3534
3587
|
currentCamera = undefined;
|
|
3535
3588
|
}
|
|
3536
3589
|
|
|
3537
|
-
var initialState$5 = {
|
|
3538
|
-
videoRef: {
|
|
3539
|
-
current: null
|
|
3540
|
-
},
|
|
3541
|
-
videoLoaded: false,
|
|
3542
|
-
videoStream: null,
|
|
3543
|
-
videoDevice: null,
|
|
3544
|
-
isRearFacing: false,
|
|
3545
|
-
camera: null,
|
|
3546
|
-
cameraReady: false,
|
|
3547
|
-
cameraAccessDenied: false,
|
|
3548
|
-
iphoneContinuityCameraAvailable: false,
|
|
3549
|
-
iphoneContinuityCameraDenied: false,
|
|
3550
|
-
preferIphoneContinuityCamera: true,
|
|
3551
|
-
audioStream: null,
|
|
3552
|
-
microphoneReady: false,
|
|
3553
|
-
microphoneAccessDenied: false
|
|
3554
|
-
};
|
|
3555
|
-
var createCameraStore = function createCameraStore(config) {
|
|
3556
|
-
var store = zustand.createStore(function (set, get) {
|
|
3557
|
-
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
3558
|
-
reset: function reset() {
|
|
3559
|
-
return set(_assign(_assign({}, initialState$5), config));
|
|
3560
|
-
},
|
|
3561
|
-
setConfig: function setConfig(config) {
|
|
3562
|
-
return set(config);
|
|
3563
|
-
},
|
|
3564
|
-
onVideoMounted: function onVideoMounted(e) {
|
|
3565
|
-
var _a;
|
|
3566
|
-
var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
|
|
3567
|
-
if (!selectedVideoStreamId) return;
|
|
3568
|
-
var srcObject = e.currentTarget.srcObject;
|
|
3569
|
-
if (srcObject.id !== selectedVideoStreamId) {
|
|
3570
|
-
warn('camera tampering detected, reloading the page.');
|
|
3571
|
-
window.location.reload();
|
|
3572
|
-
return;
|
|
3573
|
-
}
|
|
3574
|
-
set({
|
|
3575
|
-
videoLoaded: true
|
|
3576
|
-
});
|
|
3577
|
-
},
|
|
3578
|
-
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
3579
|
-
return set({
|
|
3580
|
-
preferIphoneContinuityCamera: value
|
|
3581
|
-
});
|
|
3582
|
-
},
|
|
3583
|
-
requestCameraAccess: function requestCameraAccess() {
|
|
3584
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3585
|
-
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;
|
|
3586
|
-
var _b, _c, _d;
|
|
3587
|
-
return __generator(this, function (_e) {
|
|
3588
|
-
switch (_e.label) {
|
|
3589
|
-
case 0:
|
|
3590
|
-
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
3591
|
-
releaseCameraAccess();
|
|
3592
|
-
_e.label = 1;
|
|
3593
|
-
case 1:
|
|
3594
|
-
_e.trys.push([1, 11,, 12]);
|
|
3595
|
-
return [4 /*yield*/, listAvailableCameras()];
|
|
3596
|
-
case 2:
|
|
3597
|
-
availableCameras = _e.sent();
|
|
3598
|
-
selectedCamera = void 0;
|
|
3599
|
-
debug('availableCameras', availableCameras);
|
|
3600
|
-
platform_1 = getPlatform();
|
|
3601
|
-
debug('platformDetails', platform_1);
|
|
3602
|
-
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
3603
|
-
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
3604
|
-
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
3605
|
-
});
|
|
3606
|
-
set({
|
|
3607
|
-
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
3608
|
-
});
|
|
3609
|
-
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
3610
|
-
selectedCamera = iphoneContinuityCamera;
|
|
3611
|
-
}
|
|
3612
|
-
} 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) {
|
|
3613
|
-
return c.label.startsWith('camera2 ');
|
|
3614
|
-
})) {
|
|
3615
|
-
availableCameras = availableCameras.sort(function (a, b) {
|
|
3616
|
-
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
3617
|
-
});
|
|
3618
|
-
debug('cameras have been sorted', availableCameras);
|
|
3619
|
-
}
|
|
3620
|
-
if (preferFrontFacingCamera) {
|
|
3621
|
-
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3622
|
-
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
3623
|
-
});
|
|
3624
|
-
}
|
|
3625
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3626
|
-
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
3627
|
-
}));
|
|
3628
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3629
|
-
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
3630
|
-
}));
|
|
3631
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3632
|
-
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
3633
|
-
}));
|
|
3634
|
-
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
3635
|
-
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
3636
|
-
}));
|
|
3637
|
-
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
3638
|
-
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) {
|
|
3639
|
-
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
3640
|
-
}
|
|
3641
|
-
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
3642
|
-
debug('selectedCamera', selectedCamera);
|
|
3643
|
-
set({
|
|
3644
|
-
videoDevice: selectedCamera
|
|
3645
|
-
});
|
|
3646
|
-
constraints = {
|
|
3647
|
-
audio: false,
|
|
3648
|
-
video: {
|
|
3649
|
-
deviceId: {
|
|
3650
|
-
exact: selectedCamera.deviceId
|
|
3651
|
-
},
|
|
3652
|
-
width: {
|
|
3653
|
-
ideal: config.maxVideoWidth
|
|
3654
|
-
},
|
|
3655
|
-
aspectRatio: 1.777777778,
|
|
3656
|
-
frameRate: {}
|
|
3657
|
-
}
|
|
3658
|
-
};
|
|
3659
|
-
if (config.maxFps) {
|
|
3660
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3661
|
-
// @ts-ignore
|
|
3662
|
-
constraints.video.frameRate = {
|
|
3663
|
-
max: config.maxFps
|
|
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
|
-
videoDevice: null,
|
|
3786
|
-
videoStream: null,
|
|
3787
|
-
videoLoaded: false
|
|
3788
|
-
});
|
|
3789
|
-
return [2 /*return*/];
|
|
3790
|
-
});
|
|
3791
|
-
});
|
|
3792
|
-
},
|
|
3793
|
-
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
3794
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
3795
|
-
var stream_2, e_4;
|
|
3796
|
-
return __generator(this, function (_a) {
|
|
3797
|
-
switch (_a.label) {
|
|
3798
|
-
case 0:
|
|
3799
|
-
get().releaseMicrophoneAccess();
|
|
3800
|
-
_a.label = 1;
|
|
3801
|
-
case 1:
|
|
3802
|
-
_a.trys.push([1, 3,, 4]);
|
|
3803
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
3804
|
-
audio: true,
|
|
3805
|
-
video: false
|
|
3806
|
-
})
|
|
3807
|
-
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
3808
|
-
// when the camera access is being requested. This delay is a workaround for that.
|
|
3809
|
-
];
|
|
3810
|
-
case 2:
|
|
3811
|
-
stream_2 = _a.sent();
|
|
3812
|
-
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
3813
|
-
// when the camera access is being requested. This delay is a workaround for that.
|
|
3814
|
-
setTimeout(function () {
|
|
3815
|
-
set({
|
|
3816
|
-
audioStream: stream_2,
|
|
3817
|
-
microphoneReady: true,
|
|
3818
|
-
microphoneAccessDenied: false
|
|
3819
|
-
});
|
|
3820
|
-
var handleStreamEnded = function handleStreamEnded() {
|
|
3821
|
-
set({
|
|
3822
|
-
microphoneReady: false,
|
|
3823
|
-
microphoneAccessDenied: true
|
|
3824
|
-
});
|
|
3825
|
-
};
|
|
3826
|
-
var track = stream_2.getAudioTracks()[0];
|
|
3827
|
-
track.onended = handleStreamEnded;
|
|
3828
|
-
track.onmute = function () {
|
|
3829
|
-
if (track.readyState !== 'live') handleStreamEnded();
|
|
3830
|
-
};
|
|
3831
|
-
}, 500);
|
|
3832
|
-
return [3 /*break*/, 4];
|
|
3833
|
-
case 3:
|
|
3834
|
-
e_4 = _a.sent();
|
|
3835
|
-
debug('failed to open microphone', e_4);
|
|
3836
|
-
set({
|
|
3837
|
-
microphoneAccessDenied: true
|
|
3838
|
-
});
|
|
3839
|
-
return [3 /*break*/, 4];
|
|
3840
|
-
case 4:
|
|
3841
|
-
return [2 /*return*/];
|
|
3842
|
-
}
|
|
3843
|
-
});
|
|
3844
|
-
});
|
|
3845
|
-
},
|
|
3846
|
-
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
3847
|
-
var _a;
|
|
3848
|
-
var audioStream = get().audioStream;
|
|
3849
|
-
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
3850
|
-
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
3851
|
-
var _a;
|
|
3852
|
-
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
3853
|
-
});
|
|
3854
|
-
set({
|
|
3855
|
-
audioStream: null,
|
|
3856
|
-
microphoneReady: false,
|
|
3857
|
-
microphoneAccessDenied: false
|
|
3858
|
-
});
|
|
3859
|
-
}
|
|
3860
|
-
});
|
|
3861
|
-
});
|
|
3862
|
-
if (config.requestAccessAutomatically) {
|
|
3863
|
-
void store.getState().requestCameraAccess();
|
|
3864
|
-
}
|
|
3865
|
-
return _assign(_assign({}, store), {
|
|
3866
|
-
destroy: function destroy() {
|
|
3867
|
-
store.getState().releaseCameraAccess();
|
|
3868
|
-
store.getState().releaseMicrophoneAccess();
|
|
3869
|
-
}
|
|
3870
|
-
});
|
|
3871
|
-
};
|
|
3872
|
-
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
3873
|
-
function CameraStoreProvider(_a) {
|
|
3874
|
-
var children = _a.children,
|
|
3875
|
-
_b = _a.requestAccessAutomatically,
|
|
3876
|
-
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
3877
|
-
_c = _a.preferIphoneContinuityCamera,
|
|
3878
|
-
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
3879
|
-
_d = _a.preferFrontFacingCamera,
|
|
3880
|
-
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
3881
|
-
_e = _a.maxVideoWidth,
|
|
3882
|
-
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
3883
|
-
maxFps = _a.maxFps,
|
|
3884
|
-
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
3885
|
-
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
3886
|
-
_f = _a.requireMicrophoneAccess,
|
|
3887
|
-
requireMicrophoneAccess = _f === void 0 ? false : _f;
|
|
3888
|
-
var videoRef = React.useRef(null);
|
|
3889
|
-
var store = React.useRef();
|
|
3890
|
-
store.current || (store.current = createCameraStore({
|
|
3891
|
-
videoRef: videoRef,
|
|
3892
|
-
requestAccessAutomatically: requestAccessAutomatically,
|
|
3893
|
-
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3894
|
-
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
3895
|
-
maxVideoWidth: maxVideoWidth,
|
|
3896
|
-
maxFps: maxFps,
|
|
3897
|
-
onCameraAccessDenied: onCameraAccessDenied,
|
|
3898
|
-
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
3899
|
-
requireMicrophoneAccess: requireMicrophoneAccess
|
|
3900
|
-
}));
|
|
3901
|
-
React.useEffect(function () {
|
|
3902
|
-
var _a, _b, _c;
|
|
3903
|
-
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
3904
|
-
if (!state) return;
|
|
3905
|
-
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
3906
|
-
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
3907
|
-
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
3908
|
-
preferFrontFacingCamera: preferFrontFacingCamera
|
|
3909
|
-
});
|
|
3910
|
-
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
3911
|
-
}
|
|
3912
|
-
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
3913
|
-
React.useEffect(function () {
|
|
3914
|
-
var _a;
|
|
3915
|
-
if (requireMicrophoneAccess) {
|
|
3916
|
-
(_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
|
|
3917
|
-
}
|
|
3918
|
-
}, [requireMicrophoneAccess]);
|
|
3919
|
-
React.useEffect(function () {
|
|
3920
|
-
return function () {
|
|
3921
|
-
var _a;
|
|
3922
|
-
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
3923
|
-
};
|
|
3924
|
-
}, []);
|
|
3925
|
-
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
|
|
3926
|
-
value: store.current
|
|
3927
|
-
}, children);
|
|
3928
|
-
}
|
|
3929
|
-
function useCameraStore(selector) {
|
|
3930
|
-
var store = React.useContext(CameraStoreContext);
|
|
3931
|
-
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
3932
|
-
return zustand.useStore(store, selector);
|
|
3933
|
-
}
|
|
3934
|
-
|
|
3935
|
-
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
3936
|
-
startDocumentDetection: function startDocumentDetection() {
|
|
3937
|
-
return null;
|
|
3938
|
-
},
|
|
3939
|
-
stopDocumentDetection: function stopDocumentDetection() {
|
|
3940
|
-
return null;
|
|
3941
|
-
},
|
|
3942
|
-
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
3943
|
-
return null;
|
|
3944
|
-
},
|
|
3945
|
-
documentDetectionModelReady: false,
|
|
3946
|
-
documentDetectionModelDownloadProgress: 0,
|
|
3947
|
-
documentDetectionModelError: null,
|
|
3948
|
-
onDocumentDetected: function onDocumentDetected() {
|
|
3949
|
-
return null;
|
|
3950
|
-
},
|
|
3951
|
-
detectionTime: 0,
|
|
3952
|
-
documentDetectionThresholds: {},
|
|
3953
|
-
setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
|
|
3954
|
-
return null;
|
|
3955
|
-
},
|
|
3956
|
-
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
3957
|
-
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
3958
|
-
return null;
|
|
3959
|
-
},
|
|
3960
|
-
documentDetectionLastPredictionCanvas: {
|
|
3961
|
-
current: null
|
|
3962
|
-
},
|
|
3963
|
-
clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
|
|
3964
|
-
return null;
|
|
3965
|
-
}
|
|
3966
|
-
});
|
|
3967
|
-
function DocumentDetectionModelProvider(_a) {
|
|
3968
|
-
var _this = this;
|
|
3969
|
-
var _b = _a.autoStart,
|
|
3970
|
-
autoStart = _b === void 0 ? true : _b,
|
|
3971
|
-
children = _a.children,
|
|
3972
|
-
_c = _a.throttleMs,
|
|
3973
|
-
throttleMs = _c === void 0 ? 16 : _c,
|
|
3974
|
-
_d = _a.delayAfterStartMs,
|
|
3975
|
-
delayAfterStartMs = _d === void 0 ? 0 : _d,
|
|
3976
|
-
_e = _a.documentDetectionModelPath,
|
|
3977
|
-
documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
|
|
3978
|
-
_f = _a.documentDetectionModelScoreThreshold,
|
|
3979
|
-
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
3980
|
-
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
3981
|
-
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
3982
|
-
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
3983
|
-
_h = _a.shouldLoadModels,
|
|
3984
|
-
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
3985
|
-
var _j = useCameraStore(),
|
|
3986
|
-
videoRef = _j.videoRef,
|
|
3987
|
-
videoLoaded = _j.videoLoaded,
|
|
3988
|
-
cameraReady = _j.cameraReady;
|
|
3989
|
-
var lastPredictionCanvas = React.useRef(null);
|
|
3990
|
-
var onPredictionHandler = React.useRef();
|
|
3991
|
-
var _k = React.useState({}),
|
|
3992
|
-
documentDetectionThresholds = _k[0],
|
|
3993
|
-
setDocumentDetectionThresholds = _k[1];
|
|
3994
|
-
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
3995
|
-
documentDetectionBoundaries = _l[0],
|
|
3996
|
-
setDocumentDetectionBoundaries = _l[1];
|
|
3997
|
-
var _m = React.useState(0),
|
|
3998
|
-
timesAllZero = _m[0],
|
|
3999
|
-
setTimesAllZero = _m[1];
|
|
4000
|
-
var _o = React.useState(0),
|
|
4001
|
-
canvasKey = _o[0],
|
|
4002
|
-
setCanvasKey = _o[1];
|
|
4003
|
-
var stopDetection = React.useRef(0);
|
|
4004
|
-
var _p = React.useState(shouldLoadModelsProp),
|
|
4005
|
-
shouldLoadModels = _p[0],
|
|
4006
|
-
setShouldLoadModels = _p[1];
|
|
4007
|
-
var load = React.useCallback(function () {
|
|
4008
|
-
return setShouldLoadModels(true);
|
|
4009
|
-
}, []);
|
|
4010
|
-
var _q = useLoadDocumentDetector({
|
|
4011
|
-
modelPath: documentDetectionModelPath,
|
|
4012
|
-
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
4013
|
-
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
4014
|
-
onModelError: onDocumentDetectionModelError,
|
|
4015
|
-
videoRef: videoRef,
|
|
4016
|
-
shouldLoadModels: shouldLoadModels
|
|
4017
|
-
}),
|
|
4018
|
-
ready = _q.ready,
|
|
4019
|
-
modelDownloadProgress = _q.modelDownloadProgress,
|
|
4020
|
-
modelError = _q.modelError,
|
|
4021
|
-
setModelError = _q.setModelError;
|
|
4022
|
-
var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
4023
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
4024
|
-
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
4025
|
-
var _a;
|
|
4026
|
-
return __generator(this, function (_b) {
|
|
4027
|
-
switch (_b.label) {
|
|
4028
|
-
case 0:
|
|
4029
|
-
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
|
|
4030
|
-
stopDetectionAtStart = stopDetection.current;
|
|
4031
|
-
vw = videoRef.current.videoWidth;
|
|
4032
|
-
vh = videoRef.current.videoHeight;
|
|
4033
|
-
lastPredictionCanvas.current.width = vw;
|
|
4034
|
-
lastPredictionCanvas.current.height = vh;
|
|
4035
|
-
ctx = lastPredictionCanvas.current.getContext('2d');
|
|
4036
|
-
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
|
|
4037
|
-
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
4038
|
-
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
4039
|
-
return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
|
|
4040
|
-
case 1:
|
|
4041
|
-
prediction = _b.sent();
|
|
4042
|
-
if (!prediction) return [3 /*break*/, 3];
|
|
4043
|
-
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
4044
|
-
processedPrediction.frameId = frameId;
|
|
4045
|
-
setLastDetectionAt(new Date().getTime());
|
|
4046
|
-
debug(processedPrediction);
|
|
4047
|
-
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
4048
|
-
return n + 1;
|
|
4049
|
-
});
|
|
4050
|
-
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
4051
|
-
if (timeRunning < delayAfterStartMs) return [2 /*return*/];
|
|
4052
|
-
return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
|
|
4053
|
-
case 2:
|
|
4054
|
-
_b.sent();
|
|
4055
|
-
_b.label = 3;
|
|
4056
|
-
case 3:
|
|
4057
|
-
return [2 /*return*/];
|
|
4058
|
-
}
|
|
4059
|
-
});
|
|
4060
|
-
});
|
|
4061
|
-
}, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
|
|
4062
|
-
throttleMs: throttleMs,
|
|
4063
|
-
autoStart: autoStart
|
|
4064
|
-
}),
|
|
4065
|
-
start = _r.start,
|
|
4066
|
-
stop = _r.stop;
|
|
4067
|
-
React.useEffect(function setErrorIfAllZero() {
|
|
4068
|
-
if (timesAllZero >= 2) {
|
|
4069
|
-
setModelError(new Error('model is returning all zeroes'));
|
|
4070
|
-
}
|
|
4071
|
-
}, [setModelError, timesAllZero]);
|
|
4072
|
-
var onDocumentDetected = React.useCallback(function (handler) {
|
|
4073
|
-
onPredictionHandler.current = handler;
|
|
4074
|
-
}, []);
|
|
4075
|
-
var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
|
|
4076
|
-
stopDetection.current += 1;
|
|
4077
|
-
setCanvasKey(function (n) {
|
|
4078
|
-
return n + 1;
|
|
4079
|
-
});
|
|
4080
|
-
}, []);
|
|
4081
|
-
var value = React.useMemo(function () {
|
|
4082
|
-
return {
|
|
4083
|
-
startDocumentDetection: start,
|
|
4084
|
-
stopDocumentDetection: stop,
|
|
4085
|
-
loadDocumentDetectionModel: load,
|
|
4086
|
-
documentDetectionModelReady: ready,
|
|
4087
|
-
documentDetectionModelError: modelError,
|
|
4088
|
-
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
4089
|
-
onDocumentDetected: onDocumentDetected,
|
|
4090
|
-
detectionTime: lastDetectionTime,
|
|
4091
|
-
documentDetectionThresholds: documentDetectionThresholds,
|
|
4092
|
-
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
4093
|
-
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
4094
|
-
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
4095
|
-
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
4096
|
-
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
4097
|
-
};
|
|
4098
|
-
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
4099
|
-
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
4100
|
-
value: value
|
|
4101
|
-
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
4102
|
-
key: canvasKey,
|
|
4103
|
-
ref: lastPredictionCanvas
|
|
4104
|
-
}), children);
|
|
4105
|
-
}
|
|
4106
|
-
|
|
4107
|
-
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
4108
|
-
loadFocusModel: function loadFocusModel() {
|
|
4109
|
-
return null;
|
|
4110
|
-
},
|
|
4111
|
-
focusModelReady: false,
|
|
4112
|
-
focusModelDownloadProgress: 0,
|
|
4113
|
-
focusModelError: null,
|
|
4114
|
-
focusThresholds: {},
|
|
4115
|
-
setFocusThresholds: function setFocusThresholds() {
|
|
4116
|
-
return null;
|
|
4117
|
-
},
|
|
4118
|
-
makeFocusPrediction: function makeFocusPrediction() {
|
|
4119
|
-
return null;
|
|
4120
|
-
},
|
|
4121
|
-
focusPredictionTime: 0
|
|
4122
|
-
});
|
|
4123
|
-
function FocusModelProvider(_a) {
|
|
4124
|
-
var children = _a.children,
|
|
4125
|
-
_b = _a.focusModelPath,
|
|
4126
|
-
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
4127
|
-
_c = _a.focusModelLoadTimeoutMs,
|
|
4128
|
-
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
4129
|
-
onFocusModelError = _a.onFocusModelError,
|
|
4130
|
-
_d = _a.showCanvases,
|
|
4131
|
-
showCanvases = _d === void 0 ? false : _d,
|
|
4132
|
-
_e = _a.shouldLoadModels,
|
|
4133
|
-
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
4134
|
-
var cropCanvas = React.useRef(null);
|
|
4135
|
-
var rotateCanvas = React.useRef(null);
|
|
4136
|
-
var _f = React.useState({}),
|
|
4137
|
-
focusThresholds = _f[0],
|
|
4138
|
-
setFocusThresholds = _f[1];
|
|
4139
|
-
var videoRef = useCameraStore().videoRef;
|
|
4140
|
-
var _g = React.useState(shouldLoadModelsProp),
|
|
4141
|
-
shouldLoadModels = _g[0],
|
|
4142
|
-
setShouldLoadModels = _g[1];
|
|
4143
|
-
var load = React.useCallback(function () {
|
|
4144
|
-
return setShouldLoadModels(true);
|
|
4145
|
-
}, []);
|
|
4146
|
-
var _h = useLoadFocusModel({
|
|
4147
|
-
modelPath: focusModelPath,
|
|
4148
|
-
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
4149
|
-
onModelError: onFocusModelError,
|
|
4150
|
-
videoRef: videoRef,
|
|
4151
|
-
shouldLoadModels: shouldLoadModels
|
|
4152
|
-
}),
|
|
4153
|
-
ready = _h.ready,
|
|
4154
|
-
modelDownloadProgress = _h.modelDownloadProgress,
|
|
4155
|
-
modelError = _h.modelError;
|
|
4156
|
-
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
4157
|
-
if (!ready) return null;
|
|
4158
|
-
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
4159
|
-
if (!prediction) return null;
|
|
4160
|
-
setLastFocusPredictionAt(prediction.predictionTime);
|
|
4161
|
-
return prediction;
|
|
4162
|
-
}, [ready]);
|
|
4163
|
-
var value = React.useMemo(function () {
|
|
4164
|
-
return {
|
|
4165
|
-
loadFocusModel: load,
|
|
4166
|
-
focusModelReady: ready,
|
|
4167
|
-
focusModelDownloadProgress: modelDownloadProgress,
|
|
4168
|
-
focusModelError: modelError,
|
|
4169
|
-
makeFocusPrediction: makeFocusPrediction,
|
|
4170
|
-
focusPredictionTime: lastFocusPredictionTime,
|
|
4171
|
-
focusThresholds: focusThresholds,
|
|
4172
|
-
setFocusThresholds: setFocusThresholds
|
|
4173
|
-
};
|
|
4174
|
-
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
4175
|
-
return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
|
|
4176
|
-
value: value
|
|
4177
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4178
|
-
ref: rotateCanvas,
|
|
4179
|
-
style: showCanvases ? {
|
|
4180
|
-
display: 'block'
|
|
4181
|
-
} : undefined
|
|
4182
|
-
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4183
|
-
ref: cropCanvas,
|
|
4184
|
-
style: showCanvases ? {
|
|
4185
|
-
display: 'block'
|
|
4186
|
-
} : undefined
|
|
4187
|
-
}), children);
|
|
4188
|
-
}
|
|
4189
|
-
|
|
4190
|
-
function _isNavigatorDefined() {
|
|
4191
|
-
return typeof navigator !== 'undefined' && navigator != null;
|
|
4192
|
-
}
|
|
4193
|
-
var isMobileCache;
|
|
4194
|
-
function isMobile() {
|
|
4195
|
-
if (isMobileCache !== undefined) return isMobileCache;
|
|
4196
|
-
isMobileCache = evaluateIsMobile();
|
|
4197
|
-
return isMobileCache;
|
|
4198
|
-
}
|
|
4199
|
-
function evaluateIsMobile(nav) {
|
|
4200
|
-
if (nav || _isNavigatorDefined()) {
|
|
4201
|
-
if (!nav) {
|
|
4202
|
-
nav = navigator;
|
|
4203
|
-
}
|
|
4204
|
-
if (nav.product === 'ReactNative') {
|
|
4205
|
-
return true;
|
|
4206
|
-
}
|
|
4207
|
-
var a = nav.userAgent || nav.vendor || (
|
|
4208
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4209
|
-
// @ts-ignore
|
|
4210
|
-
typeof window !== 'undefined' ? window.opera : '');
|
|
4211
|
-
if (!a) {
|
|
4212
|
-
var navAny = nav;
|
|
4213
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4214
|
-
// @ts-ignore
|
|
4215
|
-
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
4216
|
-
}
|
|
4217
|
-
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));
|
|
4218
|
-
}
|
|
4219
|
-
return false;
|
|
4220
|
-
}
|
|
4221
|
-
|
|
4222
|
-
var onMobile = isMobile();
|
|
4223
|
-
var defaultIdCaptureThresholds = {
|
|
4224
|
-
detection: defaultDocumentDetectionThresholds,
|
|
4225
|
-
focus: defaultFocusThresholds
|
|
4226
|
-
};
|
|
4227
|
-
var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
4228
|
-
ready: false,
|
|
4229
|
-
start: function start() {
|
|
4230
|
-
return null;
|
|
4231
|
-
},
|
|
4232
|
-
stop: function stop() {
|
|
4233
|
-
return null;
|
|
4234
|
-
},
|
|
4235
|
-
load: function load() {
|
|
4236
|
-
return null;
|
|
4237
|
-
},
|
|
4238
|
-
modelDownloadProgress: 0,
|
|
4239
|
-
modelError: null,
|
|
4240
|
-
thresholds: defaultIdCaptureThresholds,
|
|
4241
|
-
setThresholds: function setThresholds() {
|
|
4242
|
-
return null;
|
|
4243
|
-
},
|
|
4244
|
-
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
4245
|
-
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
4246
|
-
return null;
|
|
4247
|
-
},
|
|
4248
|
-
onPredictionMade: function onPredictionMade() {
|
|
4249
|
-
return null;
|
|
4250
|
-
},
|
|
4251
|
-
detectionTime: 0,
|
|
4252
|
-
focusPredictionTime: 0,
|
|
4253
|
-
bestFrameDetails: {
|
|
4254
|
-
current: null
|
|
4255
|
-
},
|
|
4256
|
-
getBestFrame: function getBestFrame() {
|
|
4257
|
-
return null;
|
|
4258
|
-
},
|
|
4259
|
-
resetBestFrame: function resetBestFrame() {
|
|
4260
|
-
return null;
|
|
4261
|
-
},
|
|
4262
|
-
requiredDocumentType: 'none',
|
|
4263
|
-
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
4264
|
-
return null;
|
|
4265
|
-
}
|
|
4266
|
-
});
|
|
4267
|
-
function IdCaptureModelsProviderInner(_a) {
|
|
4268
|
-
var children = _a.children,
|
|
4269
|
-
onModelError = _a.onModelError,
|
|
4270
|
-
_b = _a.allowSinglePageIdCapture,
|
|
4271
|
-
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
4272
|
-
var _c = React.useContext(DocumentDetectionModelContext),
|
|
4273
|
-
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
4274
|
-
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
4275
|
-
startDocumentDetection = _c.startDocumentDetection,
|
|
4276
|
-
stopDocumentDetection = _c.stopDocumentDetection,
|
|
4277
|
-
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
4278
|
-
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
4279
|
-
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
4280
|
-
onDocumentDetected = _c.onDocumentDetected,
|
|
4281
|
-
detectionTime = _c.detectionTime,
|
|
4282
|
-
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
4283
|
-
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
4284
|
-
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
4285
|
-
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
4286
|
-
documentDetectionModelError = _c.documentDetectionModelError;
|
|
4287
|
-
var _d = React.useContext(FocusModelContext),
|
|
4288
|
-
loadFocusModel = _d.loadFocusModel,
|
|
4289
|
-
focusModelReady = _d.focusModelReady,
|
|
4290
|
-
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
4291
|
-
makeFocusPrediction = _d.makeFocusPrediction,
|
|
4292
|
-
focusThresholds = _d.focusThresholds,
|
|
4293
|
-
setFocusThresholds = _d.setFocusThresholds,
|
|
4294
|
-
focusPredictionTime = _d.focusPredictionTime,
|
|
4295
|
-
focusModelError = _d.focusModelError;
|
|
4296
|
-
var onPredictionHandler = React.useRef();
|
|
4297
|
-
var bestFrameDetails = React.useRef(null);
|
|
4298
|
-
var bestPredictionCanvas = React.useRef(null);
|
|
4299
|
-
var bestFocusScore = React.useRef(0);
|
|
4300
|
-
var stopDetection = React.useRef(0);
|
|
4301
|
-
var _e = React.useState('none'),
|
|
4302
|
-
requiredDocumentType = _e[0],
|
|
4303
|
-
setRequiredDocumentType = _e[1];
|
|
4304
|
-
var thresholds = React.useMemo(function () {
|
|
4305
|
-
return _assign(_assign({}, documentDetectionThresholds), {
|
|
4306
|
-
focus: focusThresholds
|
|
4307
|
-
});
|
|
4308
|
-
}, [documentDetectionThresholds, focusThresholds]);
|
|
4309
|
-
var setThresholds = React.useCallback(function (thresholds) {
|
|
4310
|
-
if (thresholds.detection) {
|
|
4311
|
-
setDocumentDetectionThresholds(thresholds.detection);
|
|
4312
|
-
}
|
|
4313
|
-
if (thresholds.focus) {
|
|
4314
|
-
setFocusThresholds(thresholds.focus);
|
|
4315
|
-
}
|
|
4316
|
-
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
4317
|
-
React.useEffect(function handleDetections() {
|
|
4318
|
-
var _this = this;
|
|
4319
|
-
onDocumentDetected(function (prediction) {
|
|
4320
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
4321
|
-
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
4322
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4323
|
-
return __generator(this, function (_h) {
|
|
4324
|
-
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
4325
|
-
stopDetectionAtStart = stopDetection.current;
|
|
4326
|
-
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
4327
|
-
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
4328
|
-
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
4329
|
-
prediction.detectedDocumentType = 'passport';
|
|
4330
|
-
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
4331
|
-
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
4332
|
-
prediction.singlePageDetectionScore = 0;
|
|
4333
|
-
prediction.singlePageDetectionThresholdMet = false;
|
|
4334
|
-
}
|
|
4335
|
-
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'));
|
|
4336
|
-
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
4337
|
-
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
4338
|
-
if (focusPrediction) {
|
|
4339
|
-
focusScore = focusPrediction.score;
|
|
4340
|
-
focusPredictionTime = focusPrediction.predictionTime;
|
|
4341
|
-
}
|
|
4342
|
-
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
4343
|
-
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;
|
|
4344
|
-
focusThresholdMet = focusScore >= focusThreshold;
|
|
4345
|
-
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
4346
|
-
bestFocusScore.current = focusScore;
|
|
4347
|
-
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
4348
|
-
bestFrameDetails.current = {
|
|
4349
|
-
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
4350
|
-
documentType: prediction.detectedDocumentType,
|
|
4351
|
-
detectionScore: prediction.detectionScore,
|
|
4352
|
-
focusScore: focusScore
|
|
4353
|
-
};
|
|
4354
|
-
}
|
|
4355
|
-
}
|
|
4356
|
-
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
4357
|
-
focusScore: focusScore,
|
|
4358
|
-
focusPredictionTime: focusPredictionTime,
|
|
4359
|
-
focusThresholdMet: focusThresholdMet
|
|
4360
|
-
}));
|
|
4361
|
-
return [2 /*return*/];
|
|
4362
|
-
});
|
|
4363
|
-
});
|
|
4364
|
-
});
|
|
4365
|
-
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
4366
|
-
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
4367
|
-
React.useEffect(function handleModelErrors() {
|
|
4368
|
-
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
4369
|
-
}, [modelError, onModelError]);
|
|
4370
|
-
var onPredictionMade = React.useCallback(function (handler) {
|
|
4371
|
-
onPredictionHandler.current = handler;
|
|
4372
|
-
}, []);
|
|
4373
|
-
var getBestFrame = React.useCallback(function () {
|
|
4374
|
-
if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
|
|
4375
|
-
return _assign(_assign({}, bestFrameDetails.current), {
|
|
4376
|
-
canvas: bestPredictionCanvas.current
|
|
4377
|
-
});
|
|
4378
|
-
}, []);
|
|
4379
|
-
var _f = React.useState(0),
|
|
4380
|
-
canvasKey = _f[0],
|
|
4381
|
-
setCanvasKey = _f[1];
|
|
4382
|
-
var resetBestFrame = React.useCallback(function () {
|
|
4383
|
-
stopDetection.current += 1;
|
|
4384
|
-
setCanvasKey(function (n) {
|
|
4385
|
-
return n + 1;
|
|
4386
|
-
});
|
|
4387
|
-
clearDocumentDetectionLastPredictionCanvas();
|
|
4388
|
-
bestFrameDetails.current = null;
|
|
4389
|
-
bestFocusScore.current = 0;
|
|
4390
|
-
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
4391
|
-
React.useEffect(function () {
|
|
4392
|
-
if (requiredDocumentType) resetBestFrame();
|
|
4393
|
-
}, [requiredDocumentType, resetBestFrame]);
|
|
4394
|
-
var load = React.useCallback(function () {
|
|
4395
|
-
loadDocumentDetectionModel();
|
|
4396
|
-
loadFocusModel();
|
|
4397
|
-
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
4398
|
-
var value = React.useMemo(function () {
|
|
4399
|
-
return {
|
|
4400
|
-
ready: documentDetectionModelReady && focusModelReady,
|
|
4401
|
-
modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
|
|
4402
|
-
modelError: modelError,
|
|
4403
|
-
start: startDocumentDetection,
|
|
4404
|
-
stop: stopDocumentDetection,
|
|
4405
|
-
load: load,
|
|
4406
|
-
thresholds: thresholds,
|
|
4407
|
-
setThresholds: setThresholds,
|
|
4408
|
-
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
4409
|
-
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
4410
|
-
onPredictionMade: onPredictionMade,
|
|
4411
|
-
detectionTime: detectionTime,
|
|
4412
|
-
focusPredictionTime: focusPredictionTime,
|
|
4413
|
-
getBestFrame: getBestFrame,
|
|
4414
|
-
resetBestFrame: resetBestFrame,
|
|
4415
|
-
bestFrameDetails: bestFrameDetails,
|
|
4416
|
-
requiredDocumentType: requiredDocumentType,
|
|
4417
|
-
setRequiredDocumentType: setRequiredDocumentType
|
|
4418
|
-
};
|
|
4419
|
-
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
4420
|
-
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
|
|
4421
|
-
value: value
|
|
4422
|
-
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
4423
|
-
key: canvasKey,
|
|
4424
|
-
ref: bestPredictionCanvas
|
|
4425
|
-
}), children);
|
|
4426
|
-
}
|
|
4427
|
-
function IdCaptureModelsProvider(_a) {
|
|
4428
|
-
var children = _a.children,
|
|
4429
|
-
props = __rest(_a, ["children"]);
|
|
4430
|
-
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)));
|
|
4431
|
-
}
|
|
4432
|
-
|
|
4433
|
-
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
4434
|
-
|
|
4435
|
-
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
4436
|
-
idCardFront: ['idCardFront'],
|
|
4437
|
-
idCardBack: ['idCardBack'],
|
|
4438
|
-
passport: ['passport'],
|
|
4439
|
-
idCard: ['idCardFront', 'idCardBack'],
|
|
4440
|
-
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
4441
|
-
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
4442
|
-
};
|
|
4443
|
-
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4444
|
-
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
4445
|
-
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
4446
|
-
}
|
|
4447
|
-
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
4448
|
-
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
4449
|
-
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
4450
|
-
}
|
|
4451
|
-
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
4452
|
-
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
4453
|
-
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
4454
|
-
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
4455
|
-
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
4456
|
-
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4457
|
-
return !v.includes('idCard');
|
|
4458
|
-
});
|
|
4459
|
-
}
|
|
4460
|
-
if (isIdCardOrPassport) {
|
|
4461
|
-
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
4462
|
-
return v !== 'passport';
|
|
4463
|
-
});
|
|
4464
|
-
}
|
|
4465
|
-
return acceptedTypes.filter(function (v) {
|
|
4466
|
-
return !(v in capturedDocuments);
|
|
4467
|
-
});
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4470
|
-
var initialState$4 = {
|
|
4471
|
-
initialDrawComplete: false,
|
|
4472
|
-
redrawing: false,
|
|
4473
|
-
guideRectX: 0,
|
|
4474
|
-
guideRectY: 0,
|
|
4475
|
-
guideRectWidth: 0,
|
|
4476
|
-
guideRectHeight: 0,
|
|
4477
|
-
guideRectOffsetTop: 0,
|
|
4478
|
-
guideImageWidth: 0,
|
|
4479
|
-
guideImageHeight: 0,
|
|
4480
|
-
pageWidth: 0,
|
|
4481
|
-
pageHeight: 0,
|
|
4482
|
-
videoWidth: 0,
|
|
4483
|
-
videoHeight: 0,
|
|
4484
|
-
detectedObjects: [],
|
|
4485
|
-
bestDocument: undefined,
|
|
4486
|
-
detectedDocumentType: 'none',
|
|
4487
|
-
detectionThresholdMet: false,
|
|
4488
|
-
documentInBounds: false,
|
|
4489
|
-
documentTooClose: false,
|
|
4490
|
-
documentIsStable: false,
|
|
4491
|
-
flipRequired: false,
|
|
4492
|
-
backDetectedFirst: false,
|
|
4493
|
-
idCardDetectedButNotAllowed: false,
|
|
4494
|
-
passportDetectedButNotAllowed: false,
|
|
4495
|
-
enableOverrideWrongDocumentTypeDialog: false,
|
|
4496
|
-
allowOverrideWrongDocumentTypeAfterMs: 8000,
|
|
4497
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4498
|
-
overrideWrongDocumentTypeGuidance: false,
|
|
4499
|
-
wrongDocumentTypePredictions: 0,
|
|
4500
|
-
idCardFrontDetectionScore: 0,
|
|
4501
|
-
idCardFrontDetectionThresholdMet: false,
|
|
4502
|
-
idCardBackDetectionScore: 0,
|
|
4503
|
-
idCardBackDetectionThresholdMet: false,
|
|
4504
|
-
passportDetectionScore: 0,
|
|
4505
|
-
passportDetectionThresholdMet: false,
|
|
4506
|
-
singlePageDetectionScore: 0,
|
|
4507
|
-
singlePageDetectionThresholdMet: false,
|
|
4508
|
-
focusScore: 0,
|
|
4509
|
-
focusThresholdMet: false,
|
|
4510
|
-
isGoodFrame: false,
|
|
4511
|
-
goodFramesCount: 0,
|
|
4512
|
-
goodFramesThreshold: 3,
|
|
4513
|
-
goodFramesThresholdMet: false,
|
|
4514
|
-
lastFrameCapturedAt: null,
|
|
4515
|
-
frameCaptureRate: 0,
|
|
4516
|
-
capturing: false,
|
|
4517
|
-
captureFailed: false,
|
|
4518
|
-
imageUrl: null,
|
|
4519
|
-
captureState: 'initializing',
|
|
4520
|
-
capturedDocuments: {},
|
|
4521
|
-
captureRequirement: 'idCardOrPassport',
|
|
4522
|
-
requestedDocumentType: 'idCardFront',
|
|
4523
|
-
allowSinglePageIdCapture: false,
|
|
4524
|
-
allowIdCardBackToFrontCapture: false,
|
|
4525
|
-
allowUploadingDocumentsFromStorage: false,
|
|
4526
|
-
isUploadingDocumentsFromStorage: false,
|
|
4527
|
-
uploadingDocumentsType: null,
|
|
4528
|
-
operationStartedAt: null,
|
|
4529
|
-
captureStartedAt: null,
|
|
4530
|
-
dispatch: function dispatch() {
|
|
4531
|
-
return null;
|
|
4532
|
-
}
|
|
4533
|
-
};
|
|
4534
|
-
var _reducer = function reducer(state, action) {
|
|
4535
|
-
var _a;
|
|
4536
|
-
switch (action.type) {
|
|
4537
|
-
case 'configureWizard':
|
|
4538
|
-
{
|
|
4539
|
-
var _b = action.payload,
|
|
4540
|
-
captureRequirement = _b.captureRequirement,
|
|
4541
|
-
precapturedDocuments = _b.precapturedDocuments,
|
|
4542
|
-
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
4543
|
-
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
4544
|
-
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
4545
|
-
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
4546
|
-
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
4547
|
-
var newState = _assign(_assign({}, state), {
|
|
4548
|
-
captureRequirement: captureRequirement,
|
|
4549
|
-
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
4550
|
-
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
4551
|
-
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
4552
|
-
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
4553
|
-
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
4554
|
-
});
|
|
4555
|
-
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
4556
|
-
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
4557
|
-
if (precapturedDocuments) {
|
|
4558
|
-
for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
|
|
4559
|
-
var k = CapturedDocumentTypeValues_1[_i];
|
|
4560
|
-
var payload = precapturedDocuments[k];
|
|
4561
|
-
if (payload) {
|
|
4562
|
-
newState.requestedDocumentType = k;
|
|
4563
|
-
newState = _reducer(newState, {
|
|
4564
|
-
type: 'documentCaptured',
|
|
4565
|
-
payload: payload
|
|
4566
|
-
});
|
|
4567
|
-
}
|
|
4568
|
-
}
|
|
4569
|
-
}
|
|
4570
|
-
if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
|
|
4571
|
-
newState.captureState = 'capturing';
|
|
4572
|
-
}
|
|
4573
|
-
return newState;
|
|
4574
|
-
}
|
|
4575
|
-
case 'setRequiredDocumentType':
|
|
4576
|
-
return _assign(_assign({}, state), {
|
|
4577
|
-
requiredDocumentType: action.payload
|
|
4578
|
-
});
|
|
4579
|
-
case 'redrawRequested':
|
|
4580
|
-
return _assign(_assign({}, state), {
|
|
4581
|
-
redrawing: true,
|
|
4582
|
-
guideRectX: 0,
|
|
4583
|
-
guideRectY: 0,
|
|
4584
|
-
guideRectWidth: 0,
|
|
4585
|
-
guideRectHeight: 0,
|
|
4586
|
-
guideRectOffsetTop: 0
|
|
4587
|
-
});
|
|
4588
|
-
case 'redrawInProgress':
|
|
4589
|
-
return _assign(_assign({}, state), {
|
|
4590
|
-
redrawing: false,
|
|
4591
|
-
guideRectX: 0,
|
|
4592
|
-
guideRectY: 0,
|
|
4593
|
-
guideRectWidth: 0,
|
|
4594
|
-
guideRectHeight: 0,
|
|
4595
|
-
guideRectOffsetTop: 0
|
|
4596
|
-
});
|
|
4597
|
-
case 'redrawCompleted':
|
|
4598
|
-
return _assign(_assign(_assign({}, state), action.payload), {
|
|
4599
|
-
initialDrawComplete: true
|
|
4600
|
-
});
|
|
4601
|
-
case 'pageRendered':
|
|
4602
|
-
return _assign(_assign({}, state), action.payload);
|
|
4603
|
-
case 'guideImageLoaded':
|
|
4604
|
-
return _assign(_assign({}, state), {
|
|
4605
|
-
guideImageWidth: action.payload.width,
|
|
4606
|
-
guideImageHeight: action.payload.height
|
|
4607
|
-
});
|
|
4608
|
-
case 'objectsDetected':
|
|
4609
|
-
{
|
|
4610
|
-
var _c = action.payload.prediction,
|
|
4611
|
-
detectedObjects = _c.detectedObjects,
|
|
4612
|
-
detectionThresholdMet = _c.detectionThresholdMet,
|
|
4613
|
-
detectedDocumentType = _c.detectedDocumentType,
|
|
4614
|
-
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
4615
|
-
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
4616
|
-
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
4617
|
-
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
4618
|
-
passportDetectionScore = _c.passportDetectionScore,
|
|
4619
|
-
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
4620
|
-
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
4621
|
-
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
4622
|
-
bestDocument = _c.bestDocument,
|
|
4623
|
-
documentInBounds = _c.documentInBounds,
|
|
4624
|
-
documentTooClose = _c.documentTooClose,
|
|
4625
|
-
documentIsStable = _c.documentIsStable,
|
|
4626
|
-
focusScore = _c.focusScore,
|
|
4627
|
-
focusThresholdMet = _c.focusThresholdMet,
|
|
4628
|
-
frameWidth = _c.frameWidth,
|
|
4629
|
-
frameHeight = _c.frameHeight;
|
|
4630
|
-
var frameCapturedAt = new Date();
|
|
4631
|
-
var frameCaptureRate = 0;
|
|
4632
|
-
var goodFramesThreshold = state.goodFramesThreshold;
|
|
4633
|
-
if (state.lastFrameCapturedAt) {
|
|
4634
|
-
var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
4635
|
-
if (frameTime > 0) {
|
|
4636
|
-
frameCaptureRate = 1000.0 / frameTime;
|
|
4637
|
-
if (frameCaptureRate > 0) {
|
|
4638
|
-
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
4639
|
-
}
|
|
4640
|
-
}
|
|
4641
|
-
}
|
|
4642
|
-
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
4643
|
-
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
4644
|
-
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
4645
|
-
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
4646
|
-
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
4647
|
-
var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
|
|
4648
|
-
var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
|
|
4649
|
-
var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
|
|
4650
|
-
var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
|
|
4651
|
-
var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
4652
|
-
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
4653
|
-
wrongDocumentTypePredictions += 1;
|
|
4654
|
-
}
|
|
4655
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
4656
|
-
var captureStartedAt = state.captureStartedAt;
|
|
4657
|
-
var goodFramesCount = state.goodFramesCount;
|
|
4658
|
-
if (isGoodFrame) {
|
|
4659
|
-
goodFramesCount += 1;
|
|
4660
|
-
captureStartedAt || (captureStartedAt = new Date());
|
|
4661
|
-
}
|
|
4662
|
-
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
4663
|
-
var requestedDocumentType = state.requestedDocumentType;
|
|
4664
|
-
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
4665
|
-
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
4666
|
-
requestedDocumentType = 'idCardFront';
|
|
4667
|
-
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
4668
|
-
requestedDocumentType = 'idCardBack';
|
|
4669
|
-
}
|
|
4670
|
-
}
|
|
4671
|
-
if (state.captureRequirement === 'idCardOrPassport') {
|
|
4672
|
-
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
4673
|
-
requestedDocumentType = 'passport';
|
|
4674
|
-
}
|
|
4675
|
-
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
4676
|
-
requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
|
|
4677
|
-
}
|
|
4678
|
-
}
|
|
4679
|
-
var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
|
|
4680
|
-
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
4681
|
-
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
4682
|
-
return _assign(_assign({}, state), {
|
|
4683
|
-
videoWidth: frameWidth,
|
|
4684
|
-
videoHeight: frameHeight,
|
|
4685
|
-
detectedObjects: detectedObjects,
|
|
4686
|
-
bestDocument: bestDocument,
|
|
4687
|
-
requestedDocumentType: requestedDocumentType,
|
|
4688
|
-
detectedDocumentType: detectedDocumentType,
|
|
4689
|
-
detectionThresholdMet: detectionThresholdMet,
|
|
4690
|
-
documentInBounds: documentInBounds,
|
|
4691
|
-
documentTooClose: documentTooClose,
|
|
4692
|
-
documentIsStable: documentIsStable,
|
|
4693
|
-
flipRequired: flipRequired,
|
|
4694
|
-
backDetectedFirst: backDetectedFirst,
|
|
4695
|
-
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
4696
|
-
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
4697
|
-
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
4698
|
-
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
4699
|
-
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
4700
|
-
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
4701
|
-
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
4702
|
-
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
4703
|
-
passportDetectionScore: passportDetectionScore,
|
|
4704
|
-
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
4705
|
-
singlePageDetectionScore: singlePageDetectionScore,
|
|
4706
|
-
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
4707
|
-
focusScore: focusScore,
|
|
4708
|
-
focusThresholdMet: focusThresholdMet,
|
|
4709
|
-
isGoodFrame: isGoodFrame,
|
|
4710
|
-
goodFramesCount: goodFramesCount,
|
|
4711
|
-
goodFramesThreshold: goodFramesThreshold,
|
|
4712
|
-
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
4713
|
-
captureStartedAt: captureStartedAt,
|
|
4714
|
-
lastFrameCapturedAt: frameCapturedAt,
|
|
4715
|
-
frameCaptureRate: frameCaptureRate
|
|
4716
|
-
});
|
|
4717
|
-
}
|
|
4718
|
-
case 'captureInitialized':
|
|
4719
|
-
return _assign(_assign({}, state), {
|
|
4720
|
-
captureState: 'capturing',
|
|
4721
|
-
isUploadingDocumentsFromStorage: false
|
|
4722
|
-
});
|
|
4723
|
-
case 'captureStarted':
|
|
4724
|
-
return _assign(_assign({}, state), {
|
|
4725
|
-
operationStartedAt: new Date(),
|
|
4726
|
-
captureStartedAt: null,
|
|
4727
|
-
capturing: false,
|
|
4728
|
-
captureFailed: false
|
|
4729
|
-
});
|
|
4730
|
-
case 'capturing':
|
|
4731
|
-
return _assign(_assign({}, state), {
|
|
4732
|
-
capturing: true,
|
|
4733
|
-
captureFailed: false
|
|
4734
|
-
});
|
|
4735
|
-
case 'captured':
|
|
4736
|
-
return _assign(_assign({}, state), {
|
|
4737
|
-
capturing: false,
|
|
4738
|
-
captureFailed: false
|
|
4739
|
-
});
|
|
4740
|
-
case 'frameCaptured':
|
|
4741
|
-
return _assign(_assign({}, state), {
|
|
4742
|
-
imageUrl: action.payload.imageUrl
|
|
4743
|
-
});
|
|
4744
|
-
case 'captureFailed':
|
|
4745
|
-
return _assign(_assign({}, state), {
|
|
4746
|
-
capturing: false,
|
|
4747
|
-
captureFailed: true
|
|
4748
|
-
});
|
|
4749
|
-
case 'documentCaptured':
|
|
4750
|
-
{
|
|
4751
|
-
var newState = _assign(_assign({}, state), {
|
|
4752
|
-
capturing: false,
|
|
4753
|
-
captureFailed: false,
|
|
4754
|
-
allowOverrideFlipRequirement: false,
|
|
4755
|
-
overrideFlipRequirement: false,
|
|
4756
|
-
goodFramesCount: 0,
|
|
4757
|
-
wrongDocumentTypePredictions: 0,
|
|
4758
|
-
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
4759
|
-
});
|
|
4760
|
-
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
4761
|
-
if (remainingRequirements.length === 0) {
|
|
4762
|
-
newState.captureState = 'complete';
|
|
4763
|
-
} else {
|
|
4764
|
-
newState.requestedDocumentType = remainingRequirements[0];
|
|
4765
|
-
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
4766
|
-
if (!newState.isUploadingDocumentsFromStorage) {
|
|
4767
|
-
newState.captureState = 'requestingFlip';
|
|
4768
|
-
}
|
|
4769
|
-
newState.idCardFrontDetectionThresholdMet = false;
|
|
4770
|
-
newState.idCardBackDetectionThresholdMet = false;
|
|
4771
|
-
newState.passportDetectionThresholdMet = false;
|
|
4772
|
-
newState.wrongDocumentTypePredictions = 0;
|
|
4773
|
-
}
|
|
4774
|
-
}
|
|
4775
|
-
return newState;
|
|
4776
|
-
}
|
|
4777
|
-
case 'documentCapturedManually':
|
|
4778
|
-
return _reducer(state, {
|
|
4779
|
-
type: 'documentCaptured',
|
|
4780
|
-
payload: _assign(_assign({}, action.payload), {
|
|
4781
|
-
documentType: state.requestedDocumentType,
|
|
4782
|
-
width: 0,
|
|
4783
|
-
height: 0
|
|
4784
|
-
})
|
|
4785
|
-
});
|
|
4786
|
-
case 'documentsCaptured':
|
|
4787
|
-
{
|
|
4788
|
-
var newState = _assign({}, state);
|
|
4789
|
-
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
4790
|
-
var doc = _e[_d];
|
|
4791
|
-
newState = _reducer(newState, {
|
|
4792
|
-
type: 'documentCaptured',
|
|
4793
|
-
payload: doc
|
|
4794
|
-
});
|
|
4795
|
-
}
|
|
4796
|
-
return newState;
|
|
4797
|
-
}
|
|
4798
|
-
case 'flipRequestCompleted':
|
|
4799
|
-
return _assign(_assign({}, state), {
|
|
4800
|
-
captureState: 'capturing',
|
|
4801
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4802
|
-
overrideWrongDocumentTypeGuidance: false,
|
|
4803
|
-
wrongDocumentTypePredictions: 0
|
|
4804
|
-
});
|
|
4805
|
-
case 'allowOverrideFlipRequirement':
|
|
4806
|
-
return _assign(_assign({}, state), {
|
|
4807
|
-
allowOverrideWrongDocumentTypeGuidance: true
|
|
4808
|
-
});
|
|
4809
|
-
case 'overrideFlipRequirement':
|
|
4810
|
-
return _assign(_assign({}, state), {
|
|
4811
|
-
allowOverrideWrongDocumentTypeGuidance: false,
|
|
4812
|
-
overrideWrongDocumentTypeGuidance: true
|
|
4813
|
-
});
|
|
4814
|
-
case 'setUploadingDocumentsFromStorage':
|
|
4815
|
-
return _assign(_assign({}, state), {
|
|
4816
|
-
isUploadingDocumentsFromStorage: action.payload,
|
|
4817
|
-
captureState: action.payload ? 'initializing' : 'capturing'
|
|
4818
|
-
});
|
|
4819
|
-
case 'setUploadingDocumentsType':
|
|
4820
|
-
{
|
|
4821
|
-
var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
|
|
4822
|
-
var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
|
|
4823
|
-
return _assign(_assign({}, state), {
|
|
4824
|
-
captureState: action.payload ? 'uploading' : 'initializing',
|
|
4825
|
-
uploadingDocumentsType: uploadingDocumentsType,
|
|
4826
|
-
requestedDocumentType: requestedDocumentType
|
|
4827
|
-
});
|
|
4828
|
-
}
|
|
4829
|
-
case 'resetWizard':
|
|
4830
|
-
return _assign(_assign({}, initialState$4), {
|
|
4831
|
-
dispatch: state.dispatch,
|
|
4832
|
-
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
4833
|
-
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
4834
|
-
captureRequirement: state.captureRequirement,
|
|
4835
|
-
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
4836
|
-
});
|
|
4837
|
-
default:
|
|
4838
|
-
return state;
|
|
4839
|
-
}
|
|
4840
|
-
};
|
|
4841
|
-
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
4842
|
-
return _assign(_assign({}, initialState$4), {
|
|
4843
|
-
dispatch: function dispatch(action) {
|
|
4844
|
-
return set(function (state) {
|
|
4845
|
-
return _reducer(state, action);
|
|
4846
|
-
}, undefined, action);
|
|
4847
|
-
}
|
|
4848
|
-
});
|
|
4849
|
-
}));
|
|
4850
|
-
function IdCaptureStateProvider(_a) {
|
|
4851
|
-
var children = _a.children;
|
|
4852
|
-
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
|
|
4853
|
-
return state.overrideWrongDocumentTypeGuidance;
|
|
4854
|
-
}));
|
|
4855
|
-
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
4856
|
-
React.useEffect(function () {
|
|
4857
|
-
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
4858
|
-
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
4859
|
-
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
4860
|
-
dispatchIdCaptureAction({
|
|
4861
|
-
type: 'redrawRequested'
|
|
4862
|
-
});
|
|
4863
|
-
}, 500);
|
|
4864
|
-
React.useLayoutEffect(function () {
|
|
4865
|
-
if (typeof window === 'undefined') return;
|
|
4866
|
-
window.addEventListener('resize', onResize);
|
|
4867
|
-
return function () {
|
|
4868
|
-
return window.removeEventListener('resize', onResize);
|
|
4869
|
-
};
|
|
4870
|
-
}, [onResize]);
|
|
4871
|
-
React.useEffect(function resetWhenProviderUnmounts() {
|
|
4872
|
-
return function () {
|
|
4873
|
-
return useIdCaptureStore.getState().dispatch({
|
|
4874
|
-
type: 'resetWizard'
|
|
4875
|
-
});
|
|
4876
|
-
};
|
|
4877
|
-
}, []);
|
|
4878
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
4879
|
-
}
|
|
4880
|
-
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
4881
|
-
return useIdCaptureStore.getState().dispatch(action);
|
|
4882
|
-
};
|
|
4883
|
-
|
|
4884
|
-
function DebugStatsPane(_a) {
|
|
4885
|
-
var children = _a.children;
|
|
4886
|
-
var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
|
|
4887
|
-
var portalLocation = document.getElementById('idmission-above-guides-content');
|
|
4888
|
-
if (!portalLocation) return element;
|
|
4889
|
-
return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
|
|
4890
|
-
}
|
|
4891
|
-
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"])));
|
|
4892
|
-
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) {
|
|
4893
|
-
var $flipX = _a.$flipX;
|
|
4894
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4895
|
-
});
|
|
4896
|
-
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) {
|
|
4897
|
-
var $color = _a.$color;
|
|
4898
|
-
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
4899
|
-
}, function (_a) {
|
|
4900
|
-
var $color = _a.$color;
|
|
4901
|
-
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
4902
|
-
}, function (_a) {
|
|
4903
|
-
var $flipX = _a.$flipX;
|
|
4904
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4905
|
-
});
|
|
4906
|
-
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) {
|
|
4907
|
-
var $color = _a.$color;
|
|
4908
|
-
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
4909
|
-
}, function (_a) {
|
|
4910
|
-
var $color = _a.$color;
|
|
4911
|
-
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
4912
|
-
}, function (_a) {
|
|
4913
|
-
var $flipX = _a.$flipX;
|
|
4914
|
-
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
4915
|
-
});
|
|
4916
|
-
function useDebugScalingDetails(_a) {
|
|
4917
|
-
var _b = _a.enabled,
|
|
4918
|
-
enabled = _b === void 0 ? true : _b,
|
|
4919
|
-
pageWidth = _a.pageWidth,
|
|
4920
|
-
pageHeight = _a.pageHeight,
|
|
4921
|
-
videoWidth = _a.videoWidth,
|
|
4922
|
-
videoHeight = _a.videoHeight;
|
|
4923
|
-
return React.useMemo(function () {
|
|
4924
|
-
var horizontal = false,
|
|
4925
|
-
scaledWidth = 0,
|
|
4926
|
-
scaledHeight = 0,
|
|
4927
|
-
xOffset = 0,
|
|
4928
|
-
yOffset = 0;
|
|
4929
|
-
if (enabled) {
|
|
4930
|
-
horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
|
|
4931
|
-
if (horizontal) {
|
|
4932
|
-
scaledWidth = videoWidth * (pageHeight / videoHeight);
|
|
4933
|
-
xOffset = (scaledWidth - pageWidth) / 2;
|
|
4934
|
-
} else {
|
|
4935
|
-
scaledHeight = videoHeight * (pageWidth / videoWidth);
|
|
4936
|
-
yOffset = (scaledHeight - pageHeight) / 2;
|
|
4937
|
-
}
|
|
4938
|
-
}
|
|
4939
|
-
return {
|
|
4940
|
-
horizontal: horizontal,
|
|
4941
|
-
pageWidth: pageWidth,
|
|
4942
|
-
pageHeight: pageHeight,
|
|
4943
|
-
videoWidth: videoWidth,
|
|
4944
|
-
videoHeight: videoHeight,
|
|
4945
|
-
scaledWidth: scaledWidth,
|
|
4946
|
-
scaledHeight: scaledHeight,
|
|
4947
|
-
xOffset: xOffset,
|
|
4948
|
-
yOffset: yOffset
|
|
4949
|
-
};
|
|
4950
|
-
}, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
|
|
4951
|
-
}
|
|
4952
|
-
var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
4953
|
-
var scaling = _a.scaling,
|
|
4954
|
-
$flipX = _a.$flipX,
|
|
4955
|
-
children = _a.children;
|
|
4956
|
-
var _b = useIdCaptureStore(),
|
|
4957
|
-
guideRectWidth = _b.guideRectWidth,
|
|
4958
|
-
guideRectHeight = _b.guideRectHeight,
|
|
4959
|
-
guideRectX = _b.guideRectX,
|
|
4960
|
-
guideRectY = _b.guideRectY;
|
|
4961
|
-
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
4962
|
-
id: "debug-overlay-div",
|
|
4963
|
-
"$flipX": $flipX,
|
|
4964
|
-
style: {
|
|
4965
|
-
top: guideRectY,
|
|
4966
|
-
left: guideRectX,
|
|
4967
|
-
width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
|
|
4968
|
-
height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
|
|
4969
|
-
}
|
|
4970
|
-
}, children);
|
|
4971
|
-
};
|
|
4972
|
-
function IdCaptureDetectedObjectDebugBox(_a) {
|
|
4973
|
-
var obj = _a.obj,
|
|
4974
|
-
flipX = _a.flipX,
|
|
4975
|
-
_b = _a.color,
|
|
4976
|
-
color = _b === void 0 ? 'green' : _b,
|
|
4977
|
-
scaling = _a.scaling;
|
|
4978
|
-
var horizontal = scaling.horizontal,
|
|
4979
|
-
pageWidth = scaling.pageWidth,
|
|
4980
|
-
pageHeight = scaling.pageHeight,
|
|
4981
|
-
videoWidth = scaling.videoWidth,
|
|
4982
|
-
videoHeight = scaling.videoHeight,
|
|
4983
|
-
scaledWidth = scaling.scaledWidth,
|
|
4984
|
-
scaledHeight = scaling.scaledHeight,
|
|
4985
|
-
xOffset = scaling.xOffset,
|
|
4986
|
-
yOffset = scaling.yOffset;
|
|
4987
|
-
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
4988
|
-
var top;
|
|
4989
|
-
var left;
|
|
4990
|
-
var width;
|
|
4991
|
-
var height;
|
|
4992
|
-
if (horizontal) {
|
|
4993
|
-
top = obj.box.yMin / videoHeight * pageHeight;
|
|
4994
|
-
left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
4995
|
-
width = obj.box.width / videoWidth * scaledWidth;
|
|
4996
|
-
height = obj.box.height / videoHeight * pageHeight;
|
|
4997
|
-
} else {
|
|
4998
|
-
top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
4999
|
-
left = obj.box.xMin / videoWidth * pageWidth;
|
|
5000
|
-
width = obj.box.width / videoWidth * pageWidth;
|
|
5001
|
-
height = obj.box.height / videoHeight * scaledHeight;
|
|
5002
|
-
}
|
|
5003
|
-
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
5004
|
-
"$flipX": flipX,
|
|
5005
|
-
"$color": color,
|
|
5006
|
-
style: {
|
|
5007
|
-
top: top,
|
|
5008
|
-
left: left,
|
|
5009
|
-
width: width,
|
|
5010
|
-
height: height
|
|
5011
|
-
}
|
|
5012
|
-
});
|
|
5013
|
-
}
|
|
5014
|
-
function SelfieCaptureFaceDebugBox(_a) {
|
|
5015
|
-
var face = _a.face,
|
|
5016
|
-
flipX = _a.flipX,
|
|
5017
|
-
_b = _a.color,
|
|
5018
|
-
color = _b === void 0 ? 'green' : _b,
|
|
5019
|
-
scaling = _a.scaling;
|
|
5020
|
-
var horizontal = scaling.horizontal,
|
|
5021
|
-
pageWidth = scaling.pageWidth,
|
|
5022
|
-
pageHeight = scaling.pageHeight,
|
|
5023
|
-
videoWidth = scaling.videoWidth,
|
|
5024
|
-
videoHeight = scaling.videoHeight,
|
|
5025
|
-
scaledWidth = scaling.scaledWidth,
|
|
5026
|
-
scaledHeight = scaling.scaledHeight,
|
|
5027
|
-
xOffset = scaling.xOffset,
|
|
5028
|
-
yOffset = scaling.yOffset;
|
|
5029
|
-
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
5030
|
-
var top;
|
|
5031
|
-
var left;
|
|
5032
|
-
var width;
|
|
5033
|
-
var height;
|
|
5034
|
-
if (horizontal) {
|
|
5035
|
-
top = face.box.yMin / videoHeight * pageHeight;
|
|
5036
|
-
left = face.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
5037
|
-
width = face.box.width / videoWidth * scaledWidth;
|
|
5038
|
-
height = face.box.height / videoHeight * pageHeight;
|
|
5039
|
-
} else {
|
|
5040
|
-
top = face.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
5041
|
-
left = face.box.xMin / videoWidth * pageWidth;
|
|
5042
|
-
width = face.box.width / videoWidth * pageWidth;
|
|
5043
|
-
height = face.box.height / videoHeight * scaledHeight;
|
|
5044
|
-
}
|
|
5045
|
-
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
5046
|
-
"$flipX": flipX,
|
|
5047
|
-
"$color": color,
|
|
5048
|
-
style: {
|
|
5049
|
-
top: top,
|
|
5050
|
-
left: left,
|
|
5051
|
-
width: width,
|
|
5052
|
-
height: height
|
|
5053
|
-
}
|
|
5054
|
-
}), face.keypoints.map(function (point, ii) {
|
|
5055
|
-
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
|
|
5056
|
-
key: ii,
|
|
5057
|
-
point: point,
|
|
5058
|
-
scaling: scaling,
|
|
5059
|
-
flipX: flipX
|
|
5060
|
-
});
|
|
5061
|
-
}));
|
|
5062
|
-
}
|
|
5063
|
-
function SelfieCaptureFaceKeypoint(_a) {
|
|
5064
|
-
var point = _a.point,
|
|
5065
|
-
flipX = _a.flipX,
|
|
5066
|
-
_b = _a.color,
|
|
5067
|
-
color = _b === void 0 ? 'red' : _b,
|
|
5068
|
-
_c = _a.scaling,
|
|
5069
|
-
horizontal = _c.horizontal,
|
|
5070
|
-
pageWidth = _c.pageWidth,
|
|
5071
|
-
pageHeight = _c.pageHeight,
|
|
5072
|
-
videoWidth = _c.videoWidth,
|
|
5073
|
-
videoHeight = _c.videoHeight,
|
|
5074
|
-
scaledWidth = _c.scaledWidth,
|
|
5075
|
-
scaledHeight = _c.scaledHeight,
|
|
5076
|
-
xOffset = _c.xOffset,
|
|
5077
|
-
yOffset = _c.yOffset;
|
|
5078
|
-
var left, top;
|
|
5079
|
-
if (horizontal) {
|
|
5080
|
-
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
5081
|
-
top = point.y / videoHeight * pageHeight;
|
|
5082
|
-
} else {
|
|
5083
|
-
left = point.x / videoWidth * pageWidth;
|
|
5084
|
-
top = point.y / videoHeight * scaledHeight - yOffset;
|
|
5085
|
-
}
|
|
5086
|
-
top -= 2;
|
|
5087
|
-
left -= 2;
|
|
5088
|
-
return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
|
|
5089
|
-
"$flipX": flipX,
|
|
5090
|
-
"$color": color,
|
|
5091
|
-
style: {
|
|
5092
|
-
top: top,
|
|
5093
|
-
left: left
|
|
5094
|
-
}
|
|
5095
|
-
});
|
|
5096
|
-
}
|
|
5097
|
-
var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
|
|
5098
|
-
|
|
5099
3590
|
var en = {};
|
|
5100
3591
|
|
|
5101
3592
|
var es = {
|
|
@@ -5125,7 +3616,7 @@ var es = {
|
|
|
5125
3616
|
'Document is not centered': 'Documento no centrado',
|
|
5126
3617
|
'Document too close please back up': 'Documento muy cerca, favor de alejarse',
|
|
5127
3618
|
'Please hold your ID document steady': 'Por favor, hay que mantener firme su identificación',
|
|
5128
|
-
'Document out of focus
|
|
3619
|
+
'Document out of focus - try improving the lighting': 'Documento no enfocado, hay que tratar de mejorar la iluminación',
|
|
5129
3620
|
'ID card front detected - please flip your ID card': 'Frente de la ID detectado, por favor hay que voltearla',
|
|
5130
3621
|
'ID card back detected - please flip your ID card': 'Reverso de la ID detectado, por favor hay que voltearla',
|
|
5131
3622
|
'ID card detected please scan a passport instead': 'Se ha detectado una credencial, por favor hay que escanear un pasaporte',
|
|
@@ -5220,7 +3711,9 @@ var es = {
|
|
|
5220
3711
|
'Upload ID Front': 'Adjuntar el frente de la ID',
|
|
5221
3712
|
'Upload ID Back': 'Adjuntar el reverso de la ID',
|
|
5222
3713
|
Cancel: 'Cancelar',
|
|
5223
|
-
'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'
|
|
3714
|
+
'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',
|
|
3715
|
+
'Camera tampering detected': 'Se ha detectado un intento de manipulación de la cámara',
|
|
3716
|
+
"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.'
|
|
5224
3717
|
};
|
|
5225
3718
|
|
|
5226
3719
|
var de = {
|
|
@@ -5250,7 +3743,7 @@ var de = {
|
|
|
5250
3743
|
'Document is not centered': 'Dokument ist nicht zentriert',
|
|
5251
3744
|
'Document too close please back up': 'Dokument ist zu nah, bitte Abstand vergrößern',
|
|
5252
3745
|
'Please hold your ID document steady': 'Ihr Ausweisdokument ruhig halten',
|
|
5253
|
-
'Document out of focus
|
|
3746
|
+
'Document out of focus - try improving the lighting': 'Dokument unscharf - versuchen Sie, die Beleuchtung zu verbessern',
|
|
5254
3747
|
'ID card front detected - please flip your ID card': 'Vorderseite des Ausweises erkannt - bitte Ihren Ausweis umdrehen',
|
|
5255
3748
|
'ID card back detected - please flip your ID card': 'Rückseite des Ausweises erkannt - bitte Ihren Ausweis umdrehen',
|
|
5256
3749
|
'ID card detected please scan a passport instead': 'Ausweis erkannt, bitte stattdessen einen Pass scannen',
|
|
@@ -5333,7 +3826,7 @@ var de = {
|
|
|
5333
3826
|
'Camera ready': 'Kamera bereit',
|
|
5334
3827
|
'Loading guided capture experience...': 'Geführte Erfassung wird geladen...',
|
|
5335
3828
|
'Guided capture experience ready': 'Geführte Erfassung bereit',
|
|
5336
|
-
"Let's Go!":
|
|
3829
|
+
"Let's Go!": "Los geht's!",
|
|
5337
3830
|
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': 'Wir haben Probleme, die richtige Seite Ihres Ausweises zu erkennen. Möchten Sie dennoch mit der Erfassung fortfahren?',
|
|
5338
3831
|
OK: 'OK',
|
|
5339
3832
|
'Capture with Camera': 'Mit der Kamera aufnehmen',
|
|
@@ -5345,7 +3838,9 @@ var de = {
|
|
|
5345
3838
|
'Upload ID Front': 'Vorderseite der ID hochladen',
|
|
5346
3839
|
'Upload ID Back': 'Rückseite der ID hochladen',
|
|
5347
3840
|
Cancel: 'Abbrechen',
|
|
5348
|
-
'Upload the back of the ID if it is not included in the front image.': 'Laden Sie die Rückseite des Ausweises hoch, wenn diese nicht im Bild der Vorderseite enthalten ist
|
|
3841
|
+
'Upload the back of the ID if it is not included in the front image.': 'Laden Sie die Rückseite des Ausweises hoch, wenn diese nicht im Bild der Vorderseite enthalten ist.',
|
|
3842
|
+
'Camera tampering detected': 'Kamera manipuliert',
|
|
3843
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Leider scheint die Kamera manipuliert zu werden. Bitte prüfen Sie Ihr Gerät und laden Sie die Seite neu.'
|
|
5349
3844
|
};
|
|
5350
3845
|
|
|
5351
3846
|
var fr = {
|
|
@@ -5375,7 +3870,7 @@ var fr = {
|
|
|
5375
3870
|
'Document is not centered': "Le document n'est pas centré",
|
|
5376
3871
|
'Document too close please back up': 'Document trop proche, veuillez sauvegarder',
|
|
5377
3872
|
'Please hold your ID document steady': "Veuillez maintenir fermement votre pièce d'identité",
|
|
5378
|
-
'Document out of focus
|
|
3873
|
+
'Document out of focus - try improving the lighting': "Document flou - essayez d'améliorer l'éclairage",
|
|
5379
3874
|
'ID card front detected - please flip your ID card': "Recto de la carte d'identité détecté - veuillez retourner votre carte d'identité",
|
|
5380
3875
|
'ID card back detected - please flip your ID card': "Verso de la carte d'identité détectée - veuillez retourner votre carte d'identité",
|
|
5381
3876
|
'ID card detected please scan a passport instead': "Carte d'identité détectée, veuillez scanner plutôt un passeport",
|
|
@@ -5390,7 +3885,7 @@ var fr = {
|
|
|
5390
3885
|
'ID card front captured.': "Recto de la carte d'identité capturé.",
|
|
5391
3886
|
'ID card back captured.': "Verso de la carte d'identité capturé.",
|
|
5392
3887
|
'ID Capture Successful': "Capture d'identité réussie",
|
|
5393
|
-
'Verify the entire ID was captured clearly with no glare.': "Vérifiez que l'intégralité de la pièce d
|
|
3888
|
+
'Verify the entire ID was captured clearly with no glare.': "Vérifiez que l'intégralité de la pièce d'identité a été capturée clairement, sans reflet.",
|
|
5394
3889
|
Submit: 'Soumettre',
|
|
5395
3890
|
'Submitting...': 'Soumission en cours...',
|
|
5396
3891
|
'Use your device camera to capture your face': 'Utilisez la caméra de votre appareil pour capturer votre visage',
|
|
@@ -5434,20 +3929,20 @@ var fr = {
|
|
|
5434
3929
|
'Display the back of your ID card...': "Affichez le verso de votre carte d'identité...",
|
|
5435
3930
|
'Display the ID page of your passport...': "Montrez la page d'identité de votre passeport...",
|
|
5436
3931
|
'Please move your face to the center...': 'Veuillez déplacer votre visage vers le centre...',
|
|
5437
|
-
'Searching for ID card...': "Recherche d
|
|
3932
|
+
'Searching for ID card...': "Recherche d'une carte d'identité...",
|
|
5438
3933
|
'Please read the following text aloud': 'Veuillez lire le texte suivant à voix haute',
|
|
5439
|
-
'Video ID has been successfully captured!': '
|
|
5440
|
-
'ID Front Image':
|
|
5441
|
-
'ID Back Image':
|
|
3934
|
+
'Video ID has been successfully captured!': "L'ID vidéo a été capturé avec succès!",
|
|
3935
|
+
'ID Front Image': "Image recto de la pièce d'identité",
|
|
3936
|
+
'ID Back Image': "Image verso de la pièce d'identité",
|
|
5442
3937
|
"We're having some trouble.": 'Nous rencontrons quelques problèmes.',
|
|
5443
3938
|
'On-device capture guidance failed please capture a selfie manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer un selfie manuellement.",
|
|
5444
3939
|
'Verifying...': 'Vérification en cours...',
|
|
5445
3940
|
'Please capture the front of your ID card.': "Veuillez capturer le recto de votre carte d'identité.",
|
|
5446
3941
|
'Please capture the back of your ID card.': "Veuillez capturer le verso de votre carte d'identité.",
|
|
5447
|
-
'Please capture the front of your ID card, or the ID page of your passport.':
|
|
5448
|
-
'Please capture the back of your ID card, or click Done if submitting a passport.':
|
|
3942
|
+
'Please capture the front of your ID card, or the ID page of your passport.': "Veuillez capturer le recto de votre carte d'identité ou la page d'identité de votre passeport.",
|
|
3943
|
+
'Please capture the back of your ID card, or click Done if submitting a passport.': "Veuillez capturer le verso de votre carte d'identité ou cliquer sur Terminé si vous soumettez un passeport.",
|
|
5449
3944
|
'Please capture the ID page of your passport.': "Veuillez capturer la page d'identité de votre passeport.",
|
|
5450
|
-
'On-device capture guidance failed please capture a photo of your ID card manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer une photo de votre pièce d
|
|
3945
|
+
'On-device capture guidance failed please capture a photo of your ID card manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer une photo de votre pièce d'identité manuellement.",
|
|
5451
3946
|
'On-device capture guidance failed please capture a photo of your passport manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer une photo de votre passeport manuellement.",
|
|
5452
3947
|
'On-device capture guidance failed please capture photos of your ID card and passport manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer manuellement des photos de votre carte d'identité et de votre passeport.",
|
|
5453
3948
|
'On-device capture guidance failed please capture photos of your ID card or passport manually.': "Le guidage de capture sur l'appareil a échoué, veuillez capturer manuellement des photos de votre carte d'identité ou de votre passeport.",
|
|
@@ -5470,7 +3965,9 @@ var fr = {
|
|
|
5470
3965
|
'Upload ID Front': "Télécharger le recto de la pièce d'identité",
|
|
5471
3966
|
'Upload ID Back': "Télécharger le verso de la pièce d'identité",
|
|
5472
3967
|
Cancel: 'Annuler',
|
|
5473
|
-
'Upload the back of the ID if it is not included in the front image.': "Téléchargez le verso de la pièce d'identité si ce n'est pas inclus dans l'image du recto."
|
|
3968
|
+
'Upload the back of the ID if it is not included in the front image.': "Téléchargez le verso de la pièce d'identité si ce n'est pas inclus dans l'image du recto.",
|
|
3969
|
+
'Camera tampering detected': 'Manipulation de la caméra détectée',
|
|
3970
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Nous sommes désolés, mais il semble que la caméra soit manipulée. Veuillez vérifier votre appareil et réessayer en rechargeant la page.'
|
|
5474
3971
|
};
|
|
5475
3972
|
|
|
5476
3973
|
var it = {
|
|
@@ -5493,27 +3990,27 @@ var it = {
|
|
|
5493
3990
|
'Scan the front of ID': 'Scansiona il fronte del documento',
|
|
5494
3991
|
'Scan the back of ID': 'Scansiona il retro del documento',
|
|
5495
3992
|
'Scan the ID page of passport': 'Scansione la pagina identificativa del passaporto',
|
|
5496
|
-
'ID Card Front':
|
|
5497
|
-
'ID Card Back':
|
|
3993
|
+
'ID Card Front': "Fronte documento d'identità",
|
|
3994
|
+
'ID Card Back': "Retro documento d'identità",
|
|
5498
3995
|
Passport: 'Passaporto',
|
|
5499
3996
|
'Document not detected': 'Documento non rilevato',
|
|
5500
3997
|
'Document is not centered': 'Documento non centrato',
|
|
5501
3998
|
'Document too close please back up': 'Documento troppo vicino, allontanarlo',
|
|
5502
|
-
'Please hold your ID document steady':
|
|
5503
|
-
'Document out of focus
|
|
5504
|
-
'ID card front detected - please flip your ID card':
|
|
5505
|
-
'ID card back detected - please flip your ID card':
|
|
5506
|
-
'ID card detected please scan a passport instead':
|
|
5507
|
-
'Passport detected please scan an ID card instead':
|
|
3999
|
+
'Please hold your ID document steady': "Tenere il documento d'identità fermo",
|
|
4000
|
+
'Document out of focus - try improving the lighting': "Documento fuori fuoco - provare a migliorare l'illuminazione",
|
|
4001
|
+
'ID card front detected - please flip your ID card': "Fronte del documento d'identità rilevato - Girare il documento d'identità",
|
|
4002
|
+
'ID card back detected - please flip your ID card': "Retro del documento d'identità rilevato - Girare il documento d'identità",
|
|
4003
|
+
'ID card detected please scan a passport instead': "Documento d'identità rilevato, scansionare un passaporto al suo posto",
|
|
4004
|
+
'Passport detected please scan an ID card instead': "Passaporto rilevato, scansionare una documento d'identità al suo posto",
|
|
5508
4005
|
'Document detected, hold still...': 'Documento rilevato, tenere fermo...',
|
|
5509
|
-
'ID card front detected, hold still...':
|
|
5510
|
-
'ID card back detected, hold still...':
|
|
4006
|
+
'ID card front detected, hold still...': "Fronte documento d'identità rilevato, tenere fermo...",
|
|
4007
|
+
'ID card back detected, hold still...': "Retro documento d'identità rilevato, tenere fermo...",
|
|
5511
4008
|
'Passport detected, hold still...': 'Passaporto rilevato, tenere fermo...',
|
|
5512
4009
|
'Capturing...': 'Acquisizione...',
|
|
5513
4010
|
'Capture failed!': 'Acquisizione non riuscita!',
|
|
5514
|
-
'Please flip your ID card...':
|
|
5515
|
-
'ID card front captured.':
|
|
5516
|
-
'ID card back captured.':
|
|
4011
|
+
'Please flip your ID card...': "Capovolgere il documento d'identità",
|
|
4012
|
+
'ID card front captured.': "Fronte documento d'identità acquisito.",
|
|
4013
|
+
'ID card back captured.': "Retro documento d'identità acquisito.",
|
|
5517
4014
|
'ID Capture Successful': 'Acquisizione documento riuscita',
|
|
5518
4015
|
'Verify the entire ID was captured clearly with no glare.': 'Verificare che tutto il documento sia acquisito chiaramente e senza riflessi.',
|
|
5519
4016
|
Submit: 'Invia',
|
|
@@ -5555,29 +4052,29 @@ var it = {
|
|
|
5555
4052
|
'Uploading...': 'Caricamento...',
|
|
5556
4053
|
'Upload succeeded!': 'Caricamento riuscito!',
|
|
5557
4054
|
'Performing facial recognition, please hold still...': 'Riconoscimento volto in corso, tenere fermo...',
|
|
5558
|
-
'Display the front of your ID card...':
|
|
5559
|
-
'Display the back of your ID card...':
|
|
4055
|
+
'Display the front of your ID card...': "Mostrare il fronte del documento d'identità...",
|
|
4056
|
+
'Display the back of your ID card...': "Mostrare il retro della documento d'identità...",
|
|
5560
4057
|
'Display the ID page of your passport...': 'Mostrare la pagina identificativa del passaporto...',
|
|
5561
4058
|
'Please move your face to the center...': 'Spostare il volto al centro...',
|
|
5562
|
-
'Searching for ID card...':
|
|
4059
|
+
'Searching for ID card...': "Ricerca documento d'identità in corso...",
|
|
5563
4060
|
'Please read the following text aloud': 'Leggere il testo seguente a voce alta',
|
|
5564
|
-
'Video ID has been successfully captured!': '
|
|
5565
|
-
'ID Front Image':
|
|
5566
|
-
'ID Back Image':
|
|
4061
|
+
'Video ID has been successfully captured!': "L'ID video è stato acquisito correttamente!",
|
|
4062
|
+
'ID Front Image': "Immagine fronte documento d'identità",
|
|
4063
|
+
'ID Back Image': "Immagine retro documento d'identità",
|
|
5567
4064
|
"We're having some trouble.": 'Si è verificato un problema.',
|
|
5568
4065
|
'On-device capture guidance failed please capture a selfie manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Scattare un selfie manualmente.",
|
|
5569
4066
|
'Verifying...': 'Verifica...',
|
|
5570
|
-
'Please capture the front of your ID card.':
|
|
5571
|
-
'Please capture the back of your ID card.':
|
|
5572
|
-
'Please capture the front of your ID card, or the ID page of your passport.':
|
|
5573
|
-
'Please capture the back of your ID card, or click Done if submitting a passport.':
|
|
4067
|
+
'Please capture the front of your ID card.': "Acquisire il fronte del documento d'identità.",
|
|
4068
|
+
'Please capture the back of your ID card.': "Acquisire il retro del documento d'identità.",
|
|
4069
|
+
'Please capture the front of your ID card, or the ID page of your passport.': "Acquisire il fronte del documento d'identità o la pagina identificativa del passaporto.",
|
|
4070
|
+
'Please capture the back of your ID card, or click Done if submitting a passport.': "Acquisire il retro del documento d'identità o fare clic su Fatto se si invia un passaporto.",
|
|
5574
4071
|
'Please capture the ID page of your passport.': 'Acquisire la pagina identificativa del passaporto.',
|
|
5575
|
-
'On-device capture guidance failed please capture a photo of your ID card manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire una foto del documento d
|
|
4072
|
+
'On-device capture guidance failed please capture a photo of your ID card manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire una foto del documento d'identità manualmente.",
|
|
5576
4073
|
'On-device capture guidance failed please capture a photo of your passport manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire una foto del passaporto manualmente.",
|
|
5577
|
-
'On-device capture guidance failed please capture photos of your ID card and passport manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire delle foto del documento d
|
|
5578
|
-
'On-device capture guidance failed please capture photos of your ID card or passport manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire delle foto del documento d
|
|
4074
|
+
'On-device capture guidance failed please capture photos of your ID card and passport manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire delle foto del documento d'identità e del passaporto manualmente.",
|
|
4075
|
+
'On-device capture guidance failed please capture photos of your ID card or passport manually.': "La guida all'acquisizione sul dispositivo non è riuscita. Acquisire delle foto del documento d'identità o del passaporto manualmente.",
|
|
5579
4076
|
'Capture ID page of passport': 'Acquisisci pagina identificativa del passaporto',
|
|
5580
|
-
'Capture back of ID card':
|
|
4077
|
+
'Capture back of ID card': "Acquisisci retro del documento d'identità",
|
|
5581
4078
|
'Downloading...': 'Download in corso...',
|
|
5582
4079
|
'Accessing camera...': 'Accesso alla fotocamera...',
|
|
5583
4080
|
'Camera ready': 'Fotocamera pronta',
|
|
@@ -5595,7 +4092,9 @@ var it = {
|
|
|
5595
4092
|
'Upload ID Front': "Carica il fronte dell'ID",
|
|
5596
4093
|
'Upload ID Back': "Carica il retro dell'ID",
|
|
5597
4094
|
Cancel: 'Annulla',
|
|
5598
|
-
'Upload the back of the ID if it is not included in the front image.': "Carica il retro dell'ID se non è incluso nell'immagine del fronte
|
|
4095
|
+
'Upload the back of the ID if it is not included in the front image.': "Carica il retro dell'ID se non è incluso nell'immagine del fronte.",
|
|
4096
|
+
'Camera tampering detected': 'Manipolazione della fotocamera rilevata',
|
|
4097
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Siamo spiacenti, ma sembra che la fotocamera stia venendo manipolata. Controlla il tuo dispositivo e riprova ricaricando la pagina.'
|
|
5599
4098
|
};
|
|
5600
4099
|
|
|
5601
4100
|
var ja = {
|
|
@@ -5625,7 +4124,7 @@ var ja = {
|
|
|
5625
4124
|
'Document is not centered': 'ドキュメントが中央に合っていません',
|
|
5626
4125
|
'Document too close please back up': 'ドキュメントが近すぎます。遠ざけてください',
|
|
5627
4126
|
'Please hold your ID document steady': '身分証が動かないように押さえてください',
|
|
5628
|
-
'Document out of focus
|
|
4127
|
+
'Document out of focus - try improving the lighting': 'ドキュメントの焦点がぼやけています。照明を調節してください',
|
|
5629
4128
|
'ID card front detected - please flip your ID card': '身分証の正面が検出されました。身分証を裏返してください',
|
|
5630
4129
|
'ID card back detected - please flip your ID card': '身分証の背面が検出されました。身分証を裏返してください',
|
|
5631
4130
|
'ID card detected please scan a passport instead': '身分証が検出されました。パスポートをスキャンしてください',
|
|
@@ -5720,7 +4219,9 @@ var ja = {
|
|
|
5720
4219
|
'Upload ID Front': '身分証明書の表面をアップロード',
|
|
5721
4220
|
'Upload ID Back': '身分証明書の裏面をアップロード',
|
|
5722
4221
|
Cancel: 'キャンセル',
|
|
5723
|
-
'Upload the back of the ID if it is not included in the front image.': '表面画像に裏面が含まれていない場合は、裏面をアップロードしてください。'
|
|
4222
|
+
'Upload the back of the ID if it is not included in the front image.': '表面画像に裏面が含まれていない場合は、裏面をアップロードしてください。',
|
|
4223
|
+
'Camera tampering detected': 'カメラの操作が検出されました',
|
|
4224
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'カメラの操作が検出されました。デバイスを確認し、ページを再読み込みしてください。'
|
|
5724
4225
|
};
|
|
5725
4226
|
|
|
5726
4227
|
var pt = {
|
|
@@ -5750,7 +4251,7 @@ var pt = {
|
|
|
5750
4251
|
'Document is not centered': 'Documento não está centralizado',
|
|
5751
4252
|
'Document too close please back up': 'Documento muito próximo, recue',
|
|
5752
4253
|
'Please hold your ID document steady': 'Segure seu documento de identificação com firmeza',
|
|
5753
|
-
'Document out of focus
|
|
4254
|
+
'Document out of focus - try improving the lighting': 'Documento fora de foco - tente melhorar a iluminação',
|
|
5754
4255
|
'ID card front detected - please flip your ID card': 'Detectada a frente da carteira de identidade - vire a carteira de identidade',
|
|
5755
4256
|
'ID card back detected - please flip your ID card': 'Detectado o verso da carteira de identidade - vire a carteira de identidade',
|
|
5756
4257
|
'ID card detected please scan a passport instead': 'Detectada a carteira de identidade - escaneie um passaporte em seu lugar',
|
|
@@ -5845,7 +4346,9 @@ var pt = {
|
|
|
5845
4346
|
'Upload ID Front': 'Carregar frente do ID',
|
|
5846
4347
|
'Upload ID Back': 'Carregar verso do ID',
|
|
5847
4348
|
Cancel: 'Cancelar',
|
|
5848
|
-
'Upload the back of the ID if it is not included in the front image.': 'Carregue o verso do ID se não estiver incluído na imagem da frente.'
|
|
4349
|
+
'Upload the back of the ID if it is not included in the front image.': 'Carregue o verso do ID se não estiver incluído na imagem da frente.',
|
|
4350
|
+
'Camera tampering detected': 'Manipulação da câmera detectada',
|
|
4351
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'Lamentamos, mas parece que a câmera está sendo manipulada. Verifique seu dispositivo e tente novamente recarregando a página.'
|
|
5849
4352
|
};
|
|
5850
4353
|
|
|
5851
4354
|
var ru = {
|
|
@@ -5970,215 +4473,1828 @@ var ru = {
|
|
|
5970
4473
|
'Upload ID Front': 'Загрузить переднюю сторону удостоверения личности',
|
|
5971
4474
|
'Upload ID Back': 'Загрузить заднюю сторону удостоверения личности',
|
|
5972
4475
|
Cancel: 'Отменить',
|
|
5973
|
-
'Upload the back of the ID if it is not included in the front image.': 'Загрузите заднюю сторону удостоверения, если она не включена в изображение передней
|
|
4476
|
+
'Upload the back of the ID if it is not included in the front image.': 'Загрузите заднюю сторону удостоверения, если она не включена в изображение передней стороны.',
|
|
4477
|
+
'Camera tampering detected': 'Обнаружена манипуляция с камерой',
|
|
4478
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": 'К сожалению, кажется, что камера подвергается манипуляциям. Пожалуйста, проверьте свое устройство и попробуйте снова, перезагрузив страницу.'
|
|
4479
|
+
};
|
|
4480
|
+
|
|
4481
|
+
var zh = {
|
|
4482
|
+
'English - en': 'Chinese (Traditional) - zh',
|
|
4483
|
+
'Use your device camera to capture your ID': '使用裝置相機拍攝證件',
|
|
4484
|
+
'Use your iPhone as a webcam': '將 iPhone 當作網路攝影機使用',
|
|
4485
|
+
'Models warming up...': '正在暖機...',
|
|
4486
|
+
'Camera initializing...': '相機正在初始化...',
|
|
4487
|
+
'Camera access blocked': '相機存取遭封鎖',
|
|
4488
|
+
'Location access blocked': '位置存取遭封鎖',
|
|
4489
|
+
Continue: '繼續',
|
|
4490
|
+
'Processing...': '正在處理...',
|
|
4491
|
+
'Your camera permission is disabled': '已停用相機權限',
|
|
4492
|
+
'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.': '此應用程式需要存取相機才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示相機權限,必須前往設定並為目前瀏覽器提供相機存取權限。',
|
|
4493
|
+
'Your microphone permission is disabled': '已停用麥克風權限',
|
|
4494
|
+
'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.': '此應用程式需要存取麥克風才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示麥克風權限,必須前往設定並為目前瀏覽器提供麥克風存取權限。',
|
|
4495
|
+
'Your location permission is disabled': '已停用位置權限',
|
|
4496
|
+
'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.': '此應用程式需要存取位置才能繼續。瀏覽器提示後,請接受權限。如果瀏覽器未提示位置權限,必須前往設定並為目前瀏覽器提供位置存取權限。',
|
|
4497
|
+
Retry: '重試',
|
|
4498
|
+
'Scan the front of ID': '掃描證件正面',
|
|
4499
|
+
'Scan the back of ID': '掃描證件背面',
|
|
4500
|
+
'Scan the ID page of passport': '掃描護照的 ID 頁面',
|
|
4501
|
+
'ID Card Front': '證件正面',
|
|
4502
|
+
'ID Card Back': '證件背面',
|
|
4503
|
+
Passport: '護照',
|
|
4504
|
+
'Document not detected': '未偵測到文件',
|
|
4505
|
+
'Document is not centered': '文件未置中',
|
|
4506
|
+
'Document too close please back up': '文件太近,請後退',
|
|
4507
|
+
'Please hold your ID document steady': '請拿穩證件',
|
|
4508
|
+
'Document out of focus - try improving the lighting': '文件失焦 - 請嘗試改善燈光',
|
|
4509
|
+
'ID card front detected - please flip your ID card': '偵測到證件正面 - 請將證件翻面',
|
|
4510
|
+
'ID card back detected - please flip your ID card': '偵測到證件背面 - 請將證件翻面',
|
|
4511
|
+
'ID card detected please scan a passport instead': '偵測到證件,請掃描護照',
|
|
4512
|
+
'Passport detected please scan an ID card instead': '偵測到護照,請掃描證件',
|
|
4513
|
+
'Document detected, hold still...': '偵測到的文件保持不動...',
|
|
4514
|
+
'ID card front detected, hold still...': '偵測到的證件正面保持不動...',
|
|
4515
|
+
'ID card back detected, hold still...': '偵測到的證件背面保持不動...',
|
|
4516
|
+
'Passport detected, hold still...': '偵測到的護照保持不動...',
|
|
4517
|
+
'Capturing...': '正在拍攝...',
|
|
4518
|
+
'Capture failed!': '拍攝失敗!',
|
|
4519
|
+
'Please flip your ID card...': '請將證件翻面...',
|
|
4520
|
+
'ID card front captured.': '已拍攝證件正面。',
|
|
4521
|
+
'ID card back captured.': '已拍攝證件背面。',
|
|
4522
|
+
'ID Capture Successful': '證件拍攝成功',
|
|
4523
|
+
'Verify the entire ID was captured clearly with no glare.': '確認是否清楚拍攝整個證件,無眩光。',
|
|
4524
|
+
Submit: '提交',
|
|
4525
|
+
'Submitting...': '正在提交...',
|
|
4526
|
+
'Use your device camera to capture your face': '使用裝置相機拍攝您的臉部',
|
|
4527
|
+
'Remove Sunglasses & Hat': '取下太陽眼鏡和帽子',
|
|
4528
|
+
'Avoid Excessive Backlighting': '避免過度背光',
|
|
4529
|
+
'Hold still for a few seconds...': '請保持不動幾秒...',
|
|
4530
|
+
'Please hold still...': '請保持不動...',
|
|
4531
|
+
'Look straight into the camera...': '請直視相機...',
|
|
4532
|
+
'Move back...': '請後退...',
|
|
4533
|
+
'Move forward...': '請前進...',
|
|
4534
|
+
'Move to the center...': '請移至中心...',
|
|
4535
|
+
'Waiting for face to be detected...': '正在等待臉部辨識...',
|
|
4536
|
+
'Please remove your eye coverings (sunglasses eye patch etc.)...': '請取下眼睛遮蓋物(太陽眼鏡、眼罩等)...',
|
|
4537
|
+
'Please remove your head coverings (hat scarf etc.)...': '請取下頭部遮蓋物(帽子、圍巾等)...',
|
|
4538
|
+
'Please remove your mask...': '請脫下口罩...',
|
|
4539
|
+
'Live face not detected, please try again': '未偵測到活體人臉,請再試一次',
|
|
4540
|
+
Exit: '退出',
|
|
4541
|
+
'Face liveness has been verified!': '已驗證人臉活體!',
|
|
4542
|
+
Done: '完成',
|
|
4543
|
+
'Could not verify your face.': '無法驗證您的臉部。',
|
|
4544
|
+
'An error occurred while verifying your face.': '驗證您的臉部時發生錯誤。',
|
|
4545
|
+
'Customer has been identified!': '已識別客戶!',
|
|
4546
|
+
'Customer not found': '找不到客戶',
|
|
4547
|
+
'Additional document capture': '其他文件拍攝',
|
|
4548
|
+
Next: '下一步',
|
|
4549
|
+
'Please sign the box below': '請在下方的方框中簽名',
|
|
4550
|
+
Accept: '接受',
|
|
4551
|
+
Clear: '清除',
|
|
4552
|
+
'Video signature has been successfully captured!': '已成功拍攝影片簽名!',
|
|
4553
|
+
'Network unreachable': '網路無法連線',
|
|
4554
|
+
"We're having trouble reaching our services please check your connection and try again.": '無法與服務連線,請檢查連線並再試一次。',
|
|
4555
|
+
"We're sorry an unexpected error has occurred.": '很抱歉,發生非預期錯誤。',
|
|
4556
|
+
'Document Capture': '文件拍攝',
|
|
4557
|
+
Capture: '拍攝',
|
|
4558
|
+
'Retry capture': '重試拍攝',
|
|
4559
|
+
Upload: '上傳',
|
|
4560
|
+
'Uploading...': '正在上傳...',
|
|
4561
|
+
'Upload succeeded!': '上傳成功!',
|
|
4562
|
+
'Performing facial recognition, please hold still...': '正在進行臉部辨識,請保持不動...',
|
|
4563
|
+
'Display the front of your ID card...': '出示證件正面...',
|
|
4564
|
+
'Display the back of your ID card...': '出示證件背面...',
|
|
4565
|
+
'Display the ID page of your passport...': '出示護照的 ID 頁面...',
|
|
4566
|
+
'Please move your face to the center...': '請將臉部移至中心...',
|
|
4567
|
+
'Searching for ID card...': '正在搜尋證件...',
|
|
4568
|
+
'Please read the following text aloud': '請大聲讀出以下文字',
|
|
4569
|
+
'Video ID has been successfully captured!': '已成功拍攝影片 ID!',
|
|
4570
|
+
'ID Front Image': '證件正面影像',
|
|
4571
|
+
'ID Back Image': '證件背面影像',
|
|
4572
|
+
"We're having some trouble.": '發生一些問題。',
|
|
4573
|
+
'On-device capture guidance failed please capture a selfie manually.': '裝置上拍攝引導失敗,請手動拍攝自拍照',
|
|
4574
|
+
'Verifying...': '正在驗證...',
|
|
4575
|
+
'Please capture the front of your ID card.': '請拍攝證件正面。',
|
|
4576
|
+
'Please capture the back of your ID card.': '請拍攝證件背面。',
|
|
4577
|
+
'Please capture the front of your ID card, or the ID page of your passport.': '請拍攝證件正面或護照的 ID 頁面。',
|
|
4578
|
+
'Please capture the back of your ID card, or click Done if submitting a passport.': '請拍攝證件背面,或者如果提交護照,請按一下「完成」。',
|
|
4579
|
+
'Please capture the ID page of your passport.': '請拍攝護照的 ID 頁面。',
|
|
4580
|
+
'On-device capture guidance failed please capture a photo of your ID card manually.': '裝置上拍攝引導失敗,請手動拍攝證件的照片。',
|
|
4581
|
+
'On-device capture guidance failed please capture a photo of your passport manually.': '裝置上拍攝引導失敗,請手動拍攝護照的照片。',
|
|
4582
|
+
'On-device capture guidance failed please capture photos of your ID card and passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件和護照的照片。',
|
|
4583
|
+
'On-device capture guidance failed please capture photos of your ID card or passport manually.': '裝置上拍攝引導失敗,請手動拍攝證件或護照的照片。',
|
|
4584
|
+
'Capture ID page of passport': '拍攝護照的 ID 頁面',
|
|
4585
|
+
'Capture back of ID card': '拍攝證件背面',
|
|
4586
|
+
'Downloading...': '正在下載...',
|
|
4587
|
+
'Accessing camera...': '正在存取相機...',
|
|
4588
|
+
'Camera ready': '相機就緒',
|
|
4589
|
+
'Loading guided capture experience...': '正在載入引導式拍攝體驗...',
|
|
4590
|
+
'Guided capture experience ready': '引導式拍攝體驗就緒',
|
|
4591
|
+
"Let's Go!": '開始!',
|
|
4592
|
+
'We are having trouble identifying the correct side of your id do you want to continue with capture anyway?': '無法識別證件的正確一面,是否仍要繼續拍攝?',
|
|
4593
|
+
OK: '確定',
|
|
4594
|
+
'Capture with Camera': '使用相机拍摄',
|
|
4595
|
+
OR: '或者',
|
|
4596
|
+
'Upload from Storage': '从存储中上传',
|
|
4597
|
+
'Select ID Type': '选择身份证类型',
|
|
4598
|
+
'ID Card': '身份证',
|
|
4599
|
+
'Upload Passport': '上传护照',
|
|
4600
|
+
'Upload ID Front': '上传身份证正面',
|
|
4601
|
+
'Upload ID Back': '上传身份证背面',
|
|
4602
|
+
Cancel: '取消',
|
|
4603
|
+
'Upload the back of the ID if it is not included in the front image.': '如果正面照片没有包含身份证背面,请上传背面照片。',
|
|
4604
|
+
'Camera tampering detected': '檢測到相機被篡改',
|
|
4605
|
+
"We're sorry, but it looks like the camera is being tampered with. Please check your device and try again by reloading the page.": '很抱歉,看起來相機被篡改了。請檢查您的設備並重新載入頁面。'
|
|
4606
|
+
};
|
|
4607
|
+
|
|
4608
|
+
var resources = {
|
|
4609
|
+
en: {
|
|
4610
|
+
translation: en
|
|
4611
|
+
},
|
|
4612
|
+
es: {
|
|
4613
|
+
translation: es
|
|
4614
|
+
},
|
|
4615
|
+
de: {
|
|
4616
|
+
translation: de
|
|
4617
|
+
},
|
|
4618
|
+
fr: {
|
|
4619
|
+
translation: fr
|
|
4620
|
+
},
|
|
4621
|
+
it: {
|
|
4622
|
+
translation: it
|
|
4623
|
+
},
|
|
4624
|
+
ja: {
|
|
4625
|
+
translation: ja
|
|
4626
|
+
},
|
|
4627
|
+
pt: {
|
|
4628
|
+
translation: pt
|
|
4629
|
+
},
|
|
4630
|
+
ru: {
|
|
4631
|
+
translation: ru
|
|
4632
|
+
},
|
|
4633
|
+
zh: {
|
|
4634
|
+
translation: zh
|
|
4635
|
+
}
|
|
4636
|
+
};
|
|
4637
|
+
function initializeI18n() {
|
|
4638
|
+
void i18n__default.default.use(LanguageDetector__default.default).use(reactI18next.initReactI18next).init({
|
|
4639
|
+
resources: resources,
|
|
4640
|
+
detection: {
|
|
4641
|
+
caches: []
|
|
4642
|
+
},
|
|
4643
|
+
fallbackLng: 'en',
|
|
4644
|
+
debug: false,
|
|
4645
|
+
interpolation: {
|
|
4646
|
+
escapeValue: false
|
|
4647
|
+
}
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
var useLanguage = function useLanguage(lang) {
|
|
4651
|
+
var i18n = reactI18next.useTranslation().i18n;
|
|
4652
|
+
React.useEffect(function () {
|
|
4653
|
+
if (lang !== 'auto') {
|
|
4654
|
+
void i18n.changeLanguage(lang);
|
|
4655
|
+
} else {
|
|
4656
|
+
void i18n.changeLanguage(); // call without argument to use detection
|
|
4657
|
+
}
|
|
4658
|
+
}, [i18n, lang]);
|
|
4659
|
+
};
|
|
4660
|
+
function evaluateVerbiage(t, currentLanguage, verbiage, fallback) {
|
|
4661
|
+
if (typeof verbiage === 'string') return verbiage;
|
|
4662
|
+
if (typeof verbiage === 'object') {
|
|
4663
|
+
var translations = verbiage;
|
|
4664
|
+
if (translations[currentLanguage]) return translations[currentLanguage];
|
|
4665
|
+
var nonLocaleLang = currentLanguage.split('-')[0];
|
|
4666
|
+
if (translations[nonLocaleLang]) return translations[nonLocaleLang];
|
|
4667
|
+
}
|
|
4668
|
+
return t(fallback);
|
|
4669
|
+
}
|
|
4670
|
+
function useVerbiage(verbiage, fallback) {
|
|
4671
|
+
var _a = reactI18next.useTranslation(),
|
|
4672
|
+
t = _a.t,
|
|
4673
|
+
i18n = _a.i18n;
|
|
4674
|
+
return React.useMemo(function () {
|
|
4675
|
+
return evaluateVerbiage(t, i18n.language, verbiage, fallback);
|
|
4676
|
+
}, [fallback, i18n.language, t, verbiage]);
|
|
4677
|
+
}
|
|
4678
|
+
function useTranslations(verbiage, fallbacks) {
|
|
4679
|
+
var _a = reactI18next.useTranslation(),
|
|
4680
|
+
t = _a.t,
|
|
4681
|
+
i18n = _a.i18n;
|
|
4682
|
+
return React.useMemo(function () {
|
|
4683
|
+
return _assign(_assign({}, verbiage), Object.keys(fallbacks).reduce(function (result, key) {
|
|
4684
|
+
var _a;
|
|
4685
|
+
return _assign(_assign({}, result), (_a = {}, _a[key] = evaluateVerbiage(t, i18n.language, verbiage === null || verbiage === void 0 ? void 0 : verbiage[key], fallbacks[key]), _a));
|
|
4686
|
+
}, {}));
|
|
4687
|
+
}, [fallbacks, i18n.language, t, verbiage]);
|
|
4688
|
+
}
|
|
4689
|
+
|
|
4690
|
+
var initialState$5 = {
|
|
4691
|
+
videoRef: {
|
|
4692
|
+
current: null
|
|
4693
|
+
},
|
|
4694
|
+
videoLoaded: false,
|
|
4695
|
+
videoStream: null,
|
|
4696
|
+
videoDevice: null,
|
|
4697
|
+
isRearFacing: false,
|
|
4698
|
+
camera: null,
|
|
4699
|
+
cameraReady: false,
|
|
4700
|
+
cameraAccessDenied: false,
|
|
4701
|
+
iphoneContinuityCameraAvailable: false,
|
|
4702
|
+
iphoneContinuityCameraDenied: false,
|
|
4703
|
+
preferIphoneContinuityCamera: true,
|
|
4704
|
+
cameraTamperingDetected: false,
|
|
4705
|
+
audioStream: null,
|
|
4706
|
+
microphoneReady: false,
|
|
4707
|
+
microphoneAccessDenied: false
|
|
4708
|
+
};
|
|
4709
|
+
var createCameraStore = function createCameraStore(config) {
|
|
4710
|
+
var store = zustand.createStore(function (set, get) {
|
|
4711
|
+
return _assign(_assign(_assign({}, initialState$5), config), {
|
|
4712
|
+
reset: function reset() {
|
|
4713
|
+
return set(_assign(_assign({}, initialState$5), config));
|
|
4714
|
+
},
|
|
4715
|
+
setConfig: function setConfig(config) {
|
|
4716
|
+
return set(config);
|
|
4717
|
+
},
|
|
4718
|
+
onVideoMounted: function onVideoMounted(e) {
|
|
4719
|
+
var _a;
|
|
4720
|
+
var selectedVideoStreamId = (_a = get().videoStream) === null || _a === void 0 ? void 0 : _a.id;
|
|
4721
|
+
if (!selectedVideoStreamId) return;
|
|
4722
|
+
var srcObject = e.currentTarget.srcObject;
|
|
4723
|
+
if (srcObject.id === selectedVideoStreamId) {
|
|
4724
|
+
set({
|
|
4725
|
+
videoLoaded: true
|
|
4726
|
+
});
|
|
4727
|
+
} else {
|
|
4728
|
+
set({
|
|
4729
|
+
cameraTamperingDetected: true
|
|
4730
|
+
});
|
|
4731
|
+
}
|
|
4732
|
+
},
|
|
4733
|
+
setIphoneContinuityCameraAllowed: function setIphoneContinuityCameraAllowed(value) {
|
|
4734
|
+
return set({
|
|
4735
|
+
preferIphoneContinuityCamera: value
|
|
4736
|
+
});
|
|
4737
|
+
},
|
|
4738
|
+
requestCameraAccess: function requestCameraAccess() {
|
|
4739
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4740
|
+
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;
|
|
4741
|
+
var _b, _c, _d;
|
|
4742
|
+
return __generator(this, function (_e) {
|
|
4743
|
+
switch (_e.label) {
|
|
4744
|
+
case 0:
|
|
4745
|
+
_a = get(), videoRef = _a.videoRef, releaseCameraAccess = _a.releaseCameraAccess, preferFrontFacingCamera = _a.preferFrontFacingCamera, preferIphoneContinuityCamera = _a.preferIphoneContinuityCamera, iphoneContinuityCameraDenied = _a.iphoneContinuityCameraDenied;
|
|
4746
|
+
releaseCameraAccess();
|
|
4747
|
+
_e.label = 1;
|
|
4748
|
+
case 1:
|
|
4749
|
+
_e.trys.push([1, 11,, 12]);
|
|
4750
|
+
return [4 /*yield*/, listAvailableCameras()];
|
|
4751
|
+
case 2:
|
|
4752
|
+
availableCameras = _e.sent();
|
|
4753
|
+
selectedCamera = void 0;
|
|
4754
|
+
debug('availableCameras', availableCameras);
|
|
4755
|
+
platform_1 = getPlatform();
|
|
4756
|
+
debug('platformDetails', platform_1);
|
|
4757
|
+
if (!iphoneContinuityCameraDenied && (!(platform_1 === null || platform_1 === void 0 ? void 0 : platform_1.os) || platform_1.os.family === 'OS X')) {
|
|
4758
|
+
iphoneContinuityCamera = availableCameras.find(function (deviceInfo) {
|
|
4759
|
+
return cameraLabelMatches(deviceInfo, 'iphone');
|
|
4760
|
+
});
|
|
4761
|
+
set({
|
|
4762
|
+
iphoneContinuityCameraAvailable: !!iphoneContinuityCamera
|
|
4763
|
+
});
|
|
4764
|
+
if (iphoneContinuityCamera && preferIphoneContinuityCamera) {
|
|
4765
|
+
selectedCamera = iphoneContinuityCamera;
|
|
4766
|
+
}
|
|
4767
|
+
} 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) {
|
|
4768
|
+
return c.label.startsWith('camera2 ');
|
|
4769
|
+
})) {
|
|
4770
|
+
availableCameras = availableCameras.sort(function (a, b) {
|
|
4771
|
+
return a.label.toLowerCase().localeCompare(b.label.toLowerCase());
|
|
4772
|
+
});
|
|
4773
|
+
debug('cameras have been sorted', availableCameras);
|
|
4774
|
+
}
|
|
4775
|
+
if (preferFrontFacingCamera) {
|
|
4776
|
+
selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4777
|
+
return cameraLabelMatches(deviceInfo, frontCameraLabels);
|
|
4778
|
+
});
|
|
4779
|
+
}
|
|
4780
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4781
|
+
return cameraLabelMatches(deviceInfo, 'backtriplecamera');
|
|
4782
|
+
}));
|
|
4783
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4784
|
+
return cameraLabelMatches(deviceInfo, 'backdualcamera');
|
|
4785
|
+
}));
|
|
4786
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4787
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels) && !cameraLabelMatches(deviceInfo, backUltraWideCameraLabels);
|
|
4788
|
+
}));
|
|
4789
|
+
selectedCamera || (selectedCamera = availableCameras.find(function (deviceInfo) {
|
|
4790
|
+
return cameraLabelMatches(deviceInfo, rearCameraLabels);
|
|
4791
|
+
}));
|
|
4792
|
+
// on iOS, the front facing camera always is at the first position in the list, so we skip it if all else fails.
|
|
4793
|
+
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) {
|
|
4794
|
+
selectedCamera || (selectedCamera = availableCameras[1]);
|
|
4795
|
+
}
|
|
4796
|
+
selectedCamera || (selectedCamera = availableCameras[0]);
|
|
4797
|
+
debug('selectedCamera', selectedCamera);
|
|
4798
|
+
set({
|
|
4799
|
+
videoDevice: selectedCamera
|
|
4800
|
+
});
|
|
4801
|
+
constraints = {
|
|
4802
|
+
audio: false,
|
|
4803
|
+
video: {
|
|
4804
|
+
deviceId: {
|
|
4805
|
+
exact: selectedCamera.deviceId
|
|
4806
|
+
},
|
|
4807
|
+
width: {
|
|
4808
|
+
ideal: config.maxVideoWidth
|
|
4809
|
+
},
|
|
4810
|
+
aspectRatio: 1.777777778,
|
|
4811
|
+
frameRate: {}
|
|
4812
|
+
}
|
|
4813
|
+
};
|
|
4814
|
+
if (config.maxFps) {
|
|
4815
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4816
|
+
// @ts-ignore
|
|
4817
|
+
constraints.video.frameRate = {
|
|
4818
|
+
max: config.maxFps
|
|
4819
|
+
};
|
|
4820
|
+
}
|
|
4821
|
+
stream_1 = null;
|
|
4822
|
+
_e.label = 3;
|
|
4823
|
+
case 3:
|
|
4824
|
+
_e.trys.push([3, 5,, 6]);
|
|
4825
|
+
debug('obtaining camera access with constraints', constraints);
|
|
4826
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia(constraints)];
|
|
4827
|
+
case 4:
|
|
4828
|
+
stream_1 = _e.sent();
|
|
4829
|
+
return [3 /*break*/, 6];
|
|
4830
|
+
case 5:
|
|
4831
|
+
e_1 = _e.sent();
|
|
4832
|
+
if (e_1.name === 'NotAllowedError') {
|
|
4833
|
+
if (preferIphoneContinuityCamera) {
|
|
4834
|
+
set({
|
|
4835
|
+
iphoneContinuityCameraAvailable: false,
|
|
4836
|
+
iphoneContinuityCameraDenied: true
|
|
4837
|
+
});
|
|
4838
|
+
} else {
|
|
4839
|
+
set({
|
|
4840
|
+
cameraAccessDenied: true
|
|
4841
|
+
});
|
|
4842
|
+
}
|
|
4843
|
+
return [2 /*return*/];
|
|
4844
|
+
}
|
|
4845
|
+
return [3 /*break*/, 6];
|
|
4846
|
+
case 6:
|
|
4847
|
+
if (!!stream_1) return [3 /*break*/, 10];
|
|
4848
|
+
_e.label = 7;
|
|
4849
|
+
case 7:
|
|
4850
|
+
_e.trys.push([7, 9,, 10]);
|
|
4851
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
4852
|
+
audio: false,
|
|
4853
|
+
video: true
|
|
4854
|
+
})];
|
|
4855
|
+
case 8:
|
|
4856
|
+
stream_1 = _e.sent();
|
|
4857
|
+
debug('opened stream with no width and height constraints');
|
|
4858
|
+
return [3 /*break*/, 10];
|
|
4859
|
+
case 9:
|
|
4860
|
+
e_2 = _e.sent();
|
|
4861
|
+
debug('cannot open stream at all', e_2);
|
|
4862
|
+
return [3 /*break*/, 10];
|
|
4863
|
+
case 10:
|
|
4864
|
+
if (!stream_1) {
|
|
4865
|
+
error('failed to open camera');
|
|
4866
|
+
throw new Error('failed to open camera: ');
|
|
4867
|
+
}
|
|
4868
|
+
debug('camera access granted with constraints', constraints);
|
|
4869
|
+
handleStreamEnded_1 = function handleStreamEnded_1() {
|
|
4870
|
+
if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
|
|
4871
|
+
debug('someone unplugged the continuity camera');
|
|
4872
|
+
set({
|
|
4873
|
+
videoStream: null,
|
|
4874
|
+
videoDevice: null,
|
|
4875
|
+
cameraReady: false,
|
|
4876
|
+
iphoneContinuityCameraAvailable: false,
|
|
4877
|
+
iphoneContinuityCameraDenied: true
|
|
4878
|
+
});
|
|
4879
|
+
get().requestCameraAccess();
|
|
4880
|
+
} else {
|
|
4881
|
+
debug('someone unplugged the webcam');
|
|
4882
|
+
releaseCameraAccess();
|
|
4883
|
+
set({
|
|
4884
|
+
videoStream: null,
|
|
4885
|
+
videoDevice: null,
|
|
4886
|
+
videoLoaded: false,
|
|
4887
|
+
cameraReady: false,
|
|
4888
|
+
cameraAccessDenied: true
|
|
4889
|
+
});
|
|
4890
|
+
}
|
|
4891
|
+
};
|
|
4892
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
|
|
4893
|
+
videoTrack_1 = stream_1.getVideoTracks()[0];
|
|
4894
|
+
videoTrack_1.onended = handleStreamEnded_1;
|
|
4895
|
+
camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
|
|
4896
|
+
setTimeout(function () {
|
|
4897
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4898
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4899
|
+
videoTrack_1.onmute = function () {
|
|
4900
|
+
if (videoTrack_1.readyState !== 'live') handleStreamEnded_1();
|
|
4901
|
+
};
|
|
4902
|
+
set({
|
|
4903
|
+
camera: camera_1,
|
|
4904
|
+
cameraReady: true,
|
|
4905
|
+
cameraAccessDenied: false,
|
|
4906
|
+
isRearFacing: camera_1.isRearFacing,
|
|
4907
|
+
videoStream: stream_1
|
|
4908
|
+
});
|
|
4909
|
+
}, 500);
|
|
4910
|
+
return [3 /*break*/, 12];
|
|
4911
|
+
case 11:
|
|
4912
|
+
e_3 = _e.sent();
|
|
4913
|
+
if (e_3.name === 'NotAllowedError') {
|
|
4914
|
+
error('camera access has been blocked by the user', e_3);
|
|
4915
|
+
set({
|
|
4916
|
+
cameraAccessDenied: true
|
|
4917
|
+
});
|
|
4918
|
+
} else {
|
|
4919
|
+
error('camera access encountered some other error', e_3);
|
|
4920
|
+
throw e_3;
|
|
4921
|
+
}
|
|
4922
|
+
return [3 /*break*/, 12];
|
|
4923
|
+
case 12:
|
|
4924
|
+
return [2 /*return*/];
|
|
4925
|
+
}
|
|
4926
|
+
});
|
|
4927
|
+
});
|
|
4928
|
+
},
|
|
4929
|
+
releaseCameraAccess: function releaseCameraAccess() {
|
|
4930
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4931
|
+
var camera;
|
|
4932
|
+
return __generator(this, function (_a) {
|
|
4933
|
+
camera = get().camera;
|
|
4934
|
+
if (!camera) return [2 /*return*/];
|
|
4935
|
+
camera.release();
|
|
4936
|
+
set({
|
|
4937
|
+
camera: null,
|
|
4938
|
+
cameraReady: false,
|
|
4939
|
+
cameraAccessDenied: false,
|
|
4940
|
+
videoDevice: null,
|
|
4941
|
+
videoStream: null,
|
|
4942
|
+
videoLoaded: false
|
|
4943
|
+
});
|
|
4944
|
+
return [2 /*return*/];
|
|
4945
|
+
});
|
|
4946
|
+
});
|
|
4947
|
+
},
|
|
4948
|
+
requestMicrophoneAccess: function requestMicrophoneAccess() {
|
|
4949
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4950
|
+
var stream_2, e_4;
|
|
4951
|
+
return __generator(this, function (_a) {
|
|
4952
|
+
switch (_a.label) {
|
|
4953
|
+
case 0:
|
|
4954
|
+
get().releaseMicrophoneAccess();
|
|
4955
|
+
_a.label = 1;
|
|
4956
|
+
case 1:
|
|
4957
|
+
_a.trys.push([1, 3,, 4]);
|
|
4958
|
+
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({
|
|
4959
|
+
audio: true,
|
|
4960
|
+
video: false
|
|
4961
|
+
})
|
|
4962
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4963
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4964
|
+
];
|
|
4965
|
+
case 2:
|
|
4966
|
+
stream_2 = _a.sent();
|
|
4967
|
+
// iOS 17 has a strange behavior where the video track flickers between muted and unmuted
|
|
4968
|
+
// when the camera access is being requested. This delay is a workaround for that.
|
|
4969
|
+
setTimeout(function () {
|
|
4970
|
+
set({
|
|
4971
|
+
audioStream: stream_2,
|
|
4972
|
+
microphoneReady: true,
|
|
4973
|
+
microphoneAccessDenied: false
|
|
4974
|
+
});
|
|
4975
|
+
var handleStreamEnded = function handleStreamEnded() {
|
|
4976
|
+
set({
|
|
4977
|
+
microphoneReady: false,
|
|
4978
|
+
microphoneAccessDenied: true
|
|
4979
|
+
});
|
|
4980
|
+
};
|
|
4981
|
+
var track = stream_2.getAudioTracks()[0];
|
|
4982
|
+
track.onended = handleStreamEnded;
|
|
4983
|
+
track.onmute = function () {
|
|
4984
|
+
if (track.readyState !== 'live') handleStreamEnded();
|
|
4985
|
+
};
|
|
4986
|
+
}, 500);
|
|
4987
|
+
return [3 /*break*/, 4];
|
|
4988
|
+
case 3:
|
|
4989
|
+
e_4 = _a.sent();
|
|
4990
|
+
debug('failed to open microphone', e_4);
|
|
4991
|
+
set({
|
|
4992
|
+
microphoneAccessDenied: true
|
|
4993
|
+
});
|
|
4994
|
+
return [3 /*break*/, 4];
|
|
4995
|
+
case 4:
|
|
4996
|
+
return [2 /*return*/];
|
|
4997
|
+
}
|
|
4998
|
+
});
|
|
4999
|
+
});
|
|
5000
|
+
},
|
|
5001
|
+
releaseMicrophoneAccess: function releaseMicrophoneAccess() {
|
|
5002
|
+
var _a;
|
|
5003
|
+
var audioStream = get().audioStream;
|
|
5004
|
+
(_a = audioStream === null || audioStream === void 0 ? void 0 : audioStream.stop) === null || _a === void 0 ? void 0 : _a.call(audioStream);
|
|
5005
|
+
audioStream === null || audioStream === void 0 ? void 0 : audioStream.getAudioTracks().forEach(function (track) {
|
|
5006
|
+
var _a;
|
|
5007
|
+
(_a = track.stop) === null || _a === void 0 ? void 0 : _a.call(track);
|
|
5008
|
+
});
|
|
5009
|
+
set({
|
|
5010
|
+
audioStream: null,
|
|
5011
|
+
microphoneReady: false,
|
|
5012
|
+
microphoneAccessDenied: false
|
|
5013
|
+
});
|
|
5014
|
+
}
|
|
5015
|
+
});
|
|
5016
|
+
});
|
|
5017
|
+
if (config.requestAccessAutomatically) {
|
|
5018
|
+
void store.getState().requestCameraAccess();
|
|
5019
|
+
}
|
|
5020
|
+
return _assign(_assign({}, store), {
|
|
5021
|
+
destroy: function destroy() {
|
|
5022
|
+
store.getState().releaseCameraAccess();
|
|
5023
|
+
store.getState().releaseMicrophoneAccess();
|
|
5024
|
+
}
|
|
5025
|
+
});
|
|
5974
5026
|
};
|
|
5027
|
+
var CameraStoreContext = /*#__PURE__*/React.createContext(undefined);
|
|
5028
|
+
function CameraStoreProvider(_a) {
|
|
5029
|
+
var children = _a.children,
|
|
5030
|
+
_b = _a.requestAccessAutomatically,
|
|
5031
|
+
requestAccessAutomatically = _b === void 0 ? true : _b,
|
|
5032
|
+
_c = _a.preferIphoneContinuityCamera,
|
|
5033
|
+
preferIphoneContinuityCamera = _c === void 0 ? true : _c,
|
|
5034
|
+
_d = _a.preferFrontFacingCamera,
|
|
5035
|
+
preferFrontFacingCamera = _d === void 0 ? false : _d,
|
|
5036
|
+
_e = _a.maxVideoWidth,
|
|
5037
|
+
maxVideoWidth = _e === void 0 ? 1920 : _e,
|
|
5038
|
+
maxFps = _a.maxFps,
|
|
5039
|
+
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
5040
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
5041
|
+
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
5042
|
+
_f = _a.requireMicrophoneAccess,
|
|
5043
|
+
requireMicrophoneAccess = _f === void 0 ? false : _f,
|
|
5044
|
+
_g = _a.classNames,
|
|
5045
|
+
classNames = _g === void 0 ? {} : _g,
|
|
5046
|
+
_h = _a.verbiage,
|
|
5047
|
+
verbiage = _h === void 0 ? {} : _h;
|
|
5048
|
+
var videoRef = React.useRef(null);
|
|
5049
|
+
var store = React.useRef();
|
|
5050
|
+
store.current || (store.current = createCameraStore({
|
|
5051
|
+
videoRef: videoRef,
|
|
5052
|
+
requestAccessAutomatically: requestAccessAutomatically,
|
|
5053
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
5054
|
+
preferFrontFacingCamera: preferFrontFacingCamera,
|
|
5055
|
+
maxVideoWidth: maxVideoWidth,
|
|
5056
|
+
maxFps: maxFps,
|
|
5057
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
5058
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
5059
|
+
requireMicrophoneAccess: requireMicrophoneAccess
|
|
5060
|
+
}));
|
|
5061
|
+
React.useEffect(function () {
|
|
5062
|
+
var _a, _b, _c;
|
|
5063
|
+
var state = (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState();
|
|
5064
|
+
if (!state) return;
|
|
5065
|
+
if (preferIphoneContinuityCamera !== (state === null || state === void 0 ? void 0 : state.preferIphoneContinuityCamera) || preferFrontFacingCamera !== (state === null || state === void 0 ? void 0 : state.preferFrontFacingCamera)) {
|
|
5066
|
+
(_b = store.current) === null || _b === void 0 ? void 0 : _b.setState({
|
|
5067
|
+
preferIphoneContinuityCamera: preferIphoneContinuityCamera,
|
|
5068
|
+
preferFrontFacingCamera: preferFrontFacingCamera
|
|
5069
|
+
});
|
|
5070
|
+
(_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
|
|
5071
|
+
}
|
|
5072
|
+
}, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
|
|
5073
|
+
React.useEffect(function () {
|
|
5074
|
+
var _a;
|
|
5075
|
+
if (requireMicrophoneAccess) {
|
|
5076
|
+
(_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
|
|
5077
|
+
}
|
|
5078
|
+
}, [requireMicrophoneAccess]);
|
|
5079
|
+
React.useEffect(function () {
|
|
5080
|
+
return function () {
|
|
5081
|
+
var _a;
|
|
5082
|
+
return (_a = store.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
5083
|
+
};
|
|
5084
|
+
}, []);
|
|
5085
|
+
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreContext.Provider, {
|
|
5086
|
+
value: store.current
|
|
5087
|
+
}, /*#__PURE__*/React__namespace.default.createElement(CameraTamperSeal, {
|
|
5088
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
5089
|
+
classNames: classNames.cameraTamperSeal,
|
|
5090
|
+
verbiage: verbiage.cameraTamperSeal
|
|
5091
|
+
}, children));
|
|
5092
|
+
}
|
|
5093
|
+
function CameraTamperSeal(_a) {
|
|
5094
|
+
var children = _a.children,
|
|
5095
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
5096
|
+
_b = _a.classNames,
|
|
5097
|
+
classNames = _b === void 0 ? {} : _b,
|
|
5098
|
+
_c = _a.verbiage,
|
|
5099
|
+
rawVerbiage = _c === void 0 ? {} : _c;
|
|
5100
|
+
var cameraTamperingDetected = useCameraStore().cameraTamperingDetected;
|
|
5101
|
+
var _d = useTranslations(rawVerbiage, {
|
|
5102
|
+
headingText: 'Camera tampering detected',
|
|
5103
|
+
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."
|
|
5104
|
+
}),
|
|
5105
|
+
headingText = _d.headingText,
|
|
5106
|
+
messageText = _d.messageText;
|
|
5107
|
+
var onCameraTamperingDetectedRef = React.useRef(onCameraTamperingDetected);
|
|
5108
|
+
React.useEffect(function () {
|
|
5109
|
+
onCameraTamperingDetectedRef.current = onCameraTamperingDetected;
|
|
5110
|
+
}, [onCameraTamperingDetected]);
|
|
5111
|
+
React.useEffect(function () {
|
|
5112
|
+
var _a;
|
|
5113
|
+
if (cameraTamperingDetected) (_a = onCameraTamperingDetectedRef.current) === null || _a === void 0 ? void 0 : _a.call(onCameraTamperingDetectedRef);
|
|
5114
|
+
}, [cameraTamperingDetected]);
|
|
5115
|
+
if (!cameraTamperingDetected) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
5116
|
+
return /*#__PURE__*/React__namespace.default.createElement(OverlayContainer, {
|
|
5117
|
+
className: classNames.container
|
|
5118
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayInner$4, {
|
|
5119
|
+
className: classNames.inner
|
|
5120
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledOverlayHeading, {
|
|
5121
|
+
className: classNames.heading
|
|
5122
|
+
}, headingText), /*#__PURE__*/React__namespace.default.createElement("p", {
|
|
5123
|
+
className: classNames.message
|
|
5124
|
+
}, messageText)));
|
|
5125
|
+
}
|
|
5126
|
+
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"])));
|
|
5127
|
+
var StyledOverlayHeading = styled__default.default.h3(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n margin-bottom: 8px;\n"], ["\n margin-bottom: 8px;\n"])));
|
|
5128
|
+
function useCameraStore(selector) {
|
|
5129
|
+
var store = React.useContext(CameraStoreContext);
|
|
5130
|
+
if (!store) throw new Error('useCameraStore cannot be used without Provider');
|
|
5131
|
+
return zustand.useStore(store, selector);
|
|
5132
|
+
}
|
|
5133
|
+
var templateObject_1$H, templateObject_2$A;
|
|
5134
|
+
|
|
5135
|
+
var DocumentDetectionModelContext = /*#__PURE__*/React.createContext({
|
|
5136
|
+
startDocumentDetection: function startDocumentDetection() {
|
|
5137
|
+
return null;
|
|
5138
|
+
},
|
|
5139
|
+
stopDocumentDetection: function stopDocumentDetection() {
|
|
5140
|
+
return null;
|
|
5141
|
+
},
|
|
5142
|
+
loadDocumentDetectionModel: function loadDocumentDetectionModel() {
|
|
5143
|
+
return null;
|
|
5144
|
+
},
|
|
5145
|
+
documentDetectionModelReady: false,
|
|
5146
|
+
documentDetectionModelDownloadProgress: 0,
|
|
5147
|
+
documentDetectionModelError: null,
|
|
5148
|
+
onDocumentDetected: function onDocumentDetected() {
|
|
5149
|
+
return null;
|
|
5150
|
+
},
|
|
5151
|
+
detectionTime: 0,
|
|
5152
|
+
documentDetectionThresholds: {},
|
|
5153
|
+
setDocumentDetectionThresholds: function setDocumentDetectionThresholds() {
|
|
5154
|
+
return null;
|
|
5155
|
+
},
|
|
5156
|
+
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
5157
|
+
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
5158
|
+
return null;
|
|
5159
|
+
},
|
|
5160
|
+
documentDetectionLastPredictionCanvas: {
|
|
5161
|
+
current: null
|
|
5162
|
+
},
|
|
5163
|
+
clearDocumentDetectionLastPredictionCanvas: function clearDocumentDetectionLastPredictionCanvas() {
|
|
5164
|
+
return null;
|
|
5165
|
+
}
|
|
5166
|
+
});
|
|
5167
|
+
function DocumentDetectionModelProvider(_a) {
|
|
5168
|
+
var _this = this;
|
|
5169
|
+
var _b = _a.autoStart,
|
|
5170
|
+
autoStart = _b === void 0 ? true : _b,
|
|
5171
|
+
children = _a.children,
|
|
5172
|
+
_c = _a.throttleMs,
|
|
5173
|
+
throttleMs = _c === void 0 ? 16 : _c,
|
|
5174
|
+
_d = _a.delayAfterStartMs,
|
|
5175
|
+
delayAfterStartMs = _d === void 0 ? 0 : _d,
|
|
5176
|
+
_e = _a.documentDetectionModelPath,
|
|
5177
|
+
documentDetectionModelPath = _e === void 0 ? defaultDocumentDetectorModelPath : _e,
|
|
5178
|
+
_f = _a.documentDetectionModelScoreThreshold,
|
|
5179
|
+
documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
|
|
5180
|
+
_g = _a.documentDetectionModelLoadTimeoutMs,
|
|
5181
|
+
documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
|
|
5182
|
+
onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
|
|
5183
|
+
_h = _a.shouldLoadModels,
|
|
5184
|
+
shouldLoadModelsProp = _h === void 0 ? true : _h;
|
|
5185
|
+
var _j = useCameraStore(),
|
|
5186
|
+
videoRef = _j.videoRef,
|
|
5187
|
+
videoLoaded = _j.videoLoaded,
|
|
5188
|
+
cameraReady = _j.cameraReady;
|
|
5189
|
+
var lastPredictionCanvas = React.useRef(null);
|
|
5190
|
+
var onPredictionHandler = React.useRef();
|
|
5191
|
+
var _k = React.useState({}),
|
|
5192
|
+
documentDetectionThresholds = _k[0],
|
|
5193
|
+
setDocumentDetectionThresholds = _k[1];
|
|
5194
|
+
var _l = React.useState(defaultDocumentDetectionBoundaries),
|
|
5195
|
+
documentDetectionBoundaries = _l[0],
|
|
5196
|
+
setDocumentDetectionBoundaries = _l[1];
|
|
5197
|
+
var _m = React.useState(0),
|
|
5198
|
+
timesAllZero = _m[0],
|
|
5199
|
+
setTimesAllZero = _m[1];
|
|
5200
|
+
var _o = React.useState(0),
|
|
5201
|
+
canvasKey = _o[0],
|
|
5202
|
+
setCanvasKey = _o[1];
|
|
5203
|
+
var stopDetection = React.useRef(0);
|
|
5204
|
+
var _p = React.useState(shouldLoadModelsProp),
|
|
5205
|
+
shouldLoadModels = _p[0],
|
|
5206
|
+
setShouldLoadModels = _p[1];
|
|
5207
|
+
var load = React.useCallback(function () {
|
|
5208
|
+
return setShouldLoadModels(true);
|
|
5209
|
+
}, []);
|
|
5210
|
+
var _q = useLoadDocumentDetector({
|
|
5211
|
+
modelPath: documentDetectionModelPath,
|
|
5212
|
+
modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
|
|
5213
|
+
scoreThreshold: documentDetectionModelScoreThreshold,
|
|
5214
|
+
onModelError: onDocumentDetectionModelError,
|
|
5215
|
+
videoRef: videoRef,
|
|
5216
|
+
shouldLoadModels: shouldLoadModels
|
|
5217
|
+
}),
|
|
5218
|
+
ready = _q.ready,
|
|
5219
|
+
modelDownloadProgress = _q.modelDownloadProgress,
|
|
5220
|
+
modelError = _q.modelError,
|
|
5221
|
+
setModelError = _q.setModelError;
|
|
5222
|
+
var _r = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
|
|
5223
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
5224
|
+
var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
|
|
5225
|
+
var _a;
|
|
5226
|
+
return __generator(this, function (_b) {
|
|
5227
|
+
switch (_b.label) {
|
|
5228
|
+
case 0:
|
|
5229
|
+
if (!videoLoaded || !cameraReady || !ready || !videoRef.current || !lastPredictionCanvas.current) return [2 /*return*/];
|
|
5230
|
+
stopDetectionAtStart = stopDetection.current;
|
|
5231
|
+
vw = videoRef.current.videoWidth;
|
|
5232
|
+
vh = videoRef.current.videoHeight;
|
|
5233
|
+
lastPredictionCanvas.current.width = vw;
|
|
5234
|
+
lastPredictionCanvas.current.height = vh;
|
|
5235
|
+
ctx = lastPredictionCanvas.current.getContext('2d');
|
|
5236
|
+
if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 3];
|
|
5237
|
+
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
5238
|
+
ctx.drawImage(videoRef.current, 0, 0, vw, vh);
|
|
5239
|
+
return [4 /*yield*/, makeDocumentDetectorPrediction(lastPredictionCanvas.current)];
|
|
5240
|
+
case 1:
|
|
5241
|
+
prediction = _b.sent();
|
|
5242
|
+
if (!prediction) return [3 /*break*/, 3];
|
|
5243
|
+
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
5244
|
+
processedPrediction.frameId = frameId;
|
|
5245
|
+
setLastDetectionAt(new Date().getTime());
|
|
5246
|
+
debug(processedPrediction);
|
|
5247
|
+
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
5248
|
+
return n + 1;
|
|
5249
|
+
});
|
|
5250
|
+
if (stopDetectionAtStart !== stopDetection.current) return [2 /*return*/];
|
|
5251
|
+
if (timeRunning < delayAfterStartMs) return [2 /*return*/];
|
|
5252
|
+
return [4 /*yield*/, (_a = onPredictionHandler.current) === null || _a === void 0 ? void 0 : _a.call(onPredictionHandler, processedPrediction)];
|
|
5253
|
+
case 2:
|
|
5254
|
+
_b.sent();
|
|
5255
|
+
_b.label = 3;
|
|
5256
|
+
case 3:
|
|
5257
|
+
return [2 /*return*/];
|
|
5258
|
+
}
|
|
5259
|
+
});
|
|
5260
|
+
});
|
|
5261
|
+
}, [cameraReady, delayAfterStartMs, documentDetectionBoundaries, documentDetectionThresholds, ready, videoLoaded, videoRef]), {
|
|
5262
|
+
throttleMs: throttleMs,
|
|
5263
|
+
autoStart: autoStart
|
|
5264
|
+
}),
|
|
5265
|
+
start = _r.start,
|
|
5266
|
+
stop = _r.stop;
|
|
5267
|
+
React.useEffect(function setErrorIfAllZero() {
|
|
5268
|
+
if (timesAllZero >= 2) {
|
|
5269
|
+
setModelError(new Error('model is returning all zeroes'));
|
|
5270
|
+
}
|
|
5271
|
+
}, [setModelError, timesAllZero]);
|
|
5272
|
+
var onDocumentDetected = React.useCallback(function (handler) {
|
|
5273
|
+
onPredictionHandler.current = handler;
|
|
5274
|
+
}, []);
|
|
5275
|
+
var clearDocumentDetectionLastPredictionCanvas = React.useCallback(function () {
|
|
5276
|
+
stopDetection.current += 1;
|
|
5277
|
+
setCanvasKey(function (n) {
|
|
5278
|
+
return n + 1;
|
|
5279
|
+
});
|
|
5280
|
+
}, []);
|
|
5281
|
+
var value = React.useMemo(function () {
|
|
5282
|
+
return {
|
|
5283
|
+
startDocumentDetection: start,
|
|
5284
|
+
stopDocumentDetection: stop,
|
|
5285
|
+
loadDocumentDetectionModel: load,
|
|
5286
|
+
documentDetectionModelReady: ready,
|
|
5287
|
+
documentDetectionModelError: modelError,
|
|
5288
|
+
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
5289
|
+
onDocumentDetected: onDocumentDetected,
|
|
5290
|
+
detectionTime: lastDetectionTime,
|
|
5291
|
+
documentDetectionThresholds: documentDetectionThresholds,
|
|
5292
|
+
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
5293
|
+
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
5294
|
+
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
5295
|
+
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
5296
|
+
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
5297
|
+
};
|
|
5298
|
+
}, [start, stop, load, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
5299
|
+
return /*#__PURE__*/React__namespace.createElement(DocumentDetectionModelContext.Provider, {
|
|
5300
|
+
value: value
|
|
5301
|
+
}, /*#__PURE__*/React__namespace.createElement(InvisibleCanvas, {
|
|
5302
|
+
key: canvasKey,
|
|
5303
|
+
ref: lastPredictionCanvas
|
|
5304
|
+
}), children);
|
|
5305
|
+
}
|
|
5975
5306
|
|
|
5976
|
-
var
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
5307
|
+
var FocusModelContext = /*#__PURE__*/React.createContext({
|
|
5308
|
+
loadFocusModel: function loadFocusModel() {
|
|
5309
|
+
return null;
|
|
5310
|
+
},
|
|
5311
|
+
focusModelReady: false,
|
|
5312
|
+
focusModelDownloadProgress: 0,
|
|
5313
|
+
focusModelError: null,
|
|
5314
|
+
focusThresholds: {},
|
|
5315
|
+
setFocusThresholds: function setFocusThresholds() {
|
|
5316
|
+
return null;
|
|
5317
|
+
},
|
|
5318
|
+
makeFocusPrediction: function makeFocusPrediction() {
|
|
5319
|
+
return null;
|
|
5320
|
+
},
|
|
5321
|
+
focusPredictionTime: 0
|
|
5322
|
+
});
|
|
5323
|
+
function FocusModelProvider(_a) {
|
|
5324
|
+
var children = _a.children,
|
|
5325
|
+
_b = _a.focusModelPath,
|
|
5326
|
+
focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
|
|
5327
|
+
_c = _a.focusModelLoadTimeoutMs,
|
|
5328
|
+
focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
|
|
5329
|
+
onFocusModelError = _a.onFocusModelError,
|
|
5330
|
+
_d = _a.showCanvases,
|
|
5331
|
+
showCanvases = _d === void 0 ? false : _d,
|
|
5332
|
+
_e = _a.shouldLoadModels,
|
|
5333
|
+
shouldLoadModelsProp = _e === void 0 ? true : _e;
|
|
5334
|
+
var cropCanvas = React.useRef(null);
|
|
5335
|
+
var rotateCanvas = React.useRef(null);
|
|
5336
|
+
var _f = React.useState({}),
|
|
5337
|
+
focusThresholds = _f[0],
|
|
5338
|
+
setFocusThresholds = _f[1];
|
|
5339
|
+
var videoRef = useCameraStore().videoRef;
|
|
5340
|
+
var _g = React.useState(shouldLoadModelsProp),
|
|
5341
|
+
shouldLoadModels = _g[0],
|
|
5342
|
+
setShouldLoadModels = _g[1];
|
|
5343
|
+
var load = React.useCallback(function () {
|
|
5344
|
+
return setShouldLoadModels(true);
|
|
5345
|
+
}, []);
|
|
5346
|
+
var _h = useLoadFocusModel({
|
|
5347
|
+
modelPath: focusModelPath,
|
|
5348
|
+
modelLoadTimeoutMs: focusModelLoadTimeoutMs,
|
|
5349
|
+
onModelError: onFocusModelError,
|
|
5350
|
+
videoRef: videoRef,
|
|
5351
|
+
shouldLoadModels: shouldLoadModels
|
|
5352
|
+
}),
|
|
5353
|
+
ready = _h.ready,
|
|
5354
|
+
modelDownloadProgress = _h.modelDownloadProgress,
|
|
5355
|
+
modelError = _h.modelError;
|
|
5356
|
+
var makeFocusPrediction = React.useCallback(function (imageData, box) {
|
|
5357
|
+
if (!ready) return null;
|
|
5358
|
+
var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
|
|
5359
|
+
if (!prediction) return null;
|
|
5360
|
+
setLastFocusPredictionAt(prediction.predictionTime);
|
|
5361
|
+
return prediction;
|
|
5362
|
+
}, [ready]);
|
|
5363
|
+
var value = React.useMemo(function () {
|
|
5364
|
+
return {
|
|
5365
|
+
loadFocusModel: load,
|
|
5366
|
+
focusModelReady: ready,
|
|
5367
|
+
focusModelDownloadProgress: modelDownloadProgress,
|
|
5368
|
+
focusModelError: modelError,
|
|
5369
|
+
makeFocusPrediction: makeFocusPrediction,
|
|
5370
|
+
focusPredictionTime: lastFocusPredictionTime,
|
|
5371
|
+
focusThresholds: focusThresholds,
|
|
5372
|
+
setFocusThresholds: setFocusThresholds
|
|
5373
|
+
};
|
|
5374
|
+
}, [focusThresholds, load, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
|
|
5375
|
+
return /*#__PURE__*/React__namespace.default.createElement(FocusModelContext.Provider, {
|
|
5376
|
+
value: value
|
|
5377
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5378
|
+
ref: rotateCanvas,
|
|
5379
|
+
style: showCanvases ? {
|
|
5380
|
+
display: 'block'
|
|
5381
|
+
} : undefined
|
|
5382
|
+
}), /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5383
|
+
ref: cropCanvas,
|
|
5384
|
+
style: showCanvases ? {
|
|
5385
|
+
display: 'block'
|
|
5386
|
+
} : undefined
|
|
5387
|
+
}), children);
|
|
5388
|
+
}
|
|
5389
|
+
|
|
5390
|
+
function _isNavigatorDefined() {
|
|
5391
|
+
return typeof navigator !== 'undefined' && navigator != null;
|
|
5392
|
+
}
|
|
5393
|
+
var isMobileCache;
|
|
5394
|
+
function isMobile() {
|
|
5395
|
+
if (isMobileCache !== undefined) return isMobileCache;
|
|
5396
|
+
isMobileCache = evaluateIsMobile();
|
|
5397
|
+
return isMobileCache;
|
|
5398
|
+
}
|
|
5399
|
+
function evaluateIsMobile(nav) {
|
|
5400
|
+
if (nav || _isNavigatorDefined()) {
|
|
5401
|
+
if (!nav) {
|
|
5402
|
+
nav = navigator;
|
|
5403
|
+
}
|
|
5404
|
+
if (nav.product === 'ReactNative') {
|
|
5405
|
+
return true;
|
|
5406
|
+
}
|
|
5407
|
+
var a = nav.userAgent || nav.vendor || (
|
|
5408
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5409
|
+
// @ts-ignore
|
|
5410
|
+
typeof window !== 'undefined' ? window.opera : '');
|
|
5411
|
+
if (!a) {
|
|
5412
|
+
var navAny = nav;
|
|
5413
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5414
|
+
// @ts-ignore
|
|
5415
|
+
return navAny.userAgentData && navAny.userAgentData.mobile;
|
|
5416
|
+
}
|
|
5417
|
+
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));
|
|
5418
|
+
}
|
|
5419
|
+
return false;
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5422
|
+
var onMobile = isMobile();
|
|
5423
|
+
var defaultIdCaptureThresholds = {
|
|
5424
|
+
detection: defaultDocumentDetectionThresholds,
|
|
5425
|
+
focus: defaultFocusThresholds
|
|
5426
|
+
};
|
|
5427
|
+
var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
|
|
5428
|
+
ready: false,
|
|
5429
|
+
start: function start() {
|
|
5430
|
+
return null;
|
|
5431
|
+
},
|
|
5432
|
+
stop: function stop() {
|
|
5433
|
+
return null;
|
|
5434
|
+
},
|
|
5435
|
+
load: function load() {
|
|
5436
|
+
return null;
|
|
5437
|
+
},
|
|
5438
|
+
modelDownloadProgress: 0,
|
|
5439
|
+
modelError: null,
|
|
5440
|
+
thresholds: defaultIdCaptureThresholds,
|
|
5441
|
+
setThresholds: function setThresholds() {
|
|
5442
|
+
return null;
|
|
5443
|
+
},
|
|
5444
|
+
documentDetectionBoundaries: defaultDocumentDetectionBoundaries,
|
|
5445
|
+
setDocumentDetectionBoundaries: function setDocumentDetectionBoundaries() {
|
|
5446
|
+
return null;
|
|
5447
|
+
},
|
|
5448
|
+
onPredictionMade: function onPredictionMade() {
|
|
5449
|
+
return null;
|
|
5450
|
+
},
|
|
5451
|
+
detectionTime: 0,
|
|
5452
|
+
focusPredictionTime: 0,
|
|
5453
|
+
bestFrameDetails: {
|
|
5454
|
+
current: null
|
|
5455
|
+
},
|
|
5456
|
+
getBestFrame: function getBestFrame() {
|
|
5457
|
+
return null;
|
|
5458
|
+
},
|
|
5459
|
+
resetBestFrame: function resetBestFrame() {
|
|
5460
|
+
return null;
|
|
5461
|
+
},
|
|
5462
|
+
requiredDocumentType: 'none',
|
|
5463
|
+
setRequiredDocumentType: function setRequiredDocumentType() {
|
|
5464
|
+
return null;
|
|
5465
|
+
}
|
|
5466
|
+
});
|
|
5467
|
+
function IdCaptureModelsProviderInner(_a) {
|
|
5468
|
+
var children = _a.children,
|
|
5469
|
+
onModelError = _a.onModelError,
|
|
5470
|
+
_b = _a.allowSinglePageIdCapture,
|
|
5471
|
+
allowSinglePageIdCapture = _b === void 0 ? false : _b;
|
|
5472
|
+
var _c = React.useContext(DocumentDetectionModelContext),
|
|
5473
|
+
documentDetectionModelReady = _c.documentDetectionModelReady,
|
|
5474
|
+
documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
|
|
5475
|
+
startDocumentDetection = _c.startDocumentDetection,
|
|
5476
|
+
stopDocumentDetection = _c.stopDocumentDetection,
|
|
5477
|
+
loadDocumentDetectionModel = _c.loadDocumentDetectionModel,
|
|
5478
|
+
lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
|
|
5479
|
+
clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
|
|
5480
|
+
onDocumentDetected = _c.onDocumentDetected,
|
|
5481
|
+
detectionTime = _c.detectionTime,
|
|
5482
|
+
documentDetectionThresholds = _c.documentDetectionThresholds,
|
|
5483
|
+
setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
|
|
5484
|
+
documentDetectionBoundaries = _c.documentDetectionBoundaries,
|
|
5485
|
+
setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
|
|
5486
|
+
documentDetectionModelError = _c.documentDetectionModelError;
|
|
5487
|
+
var _d = React.useContext(FocusModelContext),
|
|
5488
|
+
loadFocusModel = _d.loadFocusModel,
|
|
5489
|
+
focusModelReady = _d.focusModelReady,
|
|
5490
|
+
focusModelDownloadProgress = _d.focusModelDownloadProgress,
|
|
5491
|
+
makeFocusPrediction = _d.makeFocusPrediction,
|
|
5492
|
+
focusThresholds = _d.focusThresholds,
|
|
5493
|
+
setFocusThresholds = _d.setFocusThresholds,
|
|
5494
|
+
focusPredictionTime = _d.focusPredictionTime,
|
|
5495
|
+
focusModelError = _d.focusModelError;
|
|
5496
|
+
var onPredictionHandler = React.useRef();
|
|
5497
|
+
var bestFrameDetails = React.useRef(null);
|
|
5498
|
+
var bestPredictionCanvas = React.useRef(null);
|
|
5499
|
+
var bestFocusScore = React.useRef(0);
|
|
5500
|
+
var stopDetection = React.useRef(0);
|
|
5501
|
+
var _e = React.useState('none'),
|
|
5502
|
+
requiredDocumentType = _e[0],
|
|
5503
|
+
setRequiredDocumentType = _e[1];
|
|
5504
|
+
var thresholds = React.useMemo(function () {
|
|
5505
|
+
return _assign(_assign({}, documentDetectionThresholds), {
|
|
5506
|
+
focus: focusThresholds
|
|
5507
|
+
});
|
|
5508
|
+
}, [documentDetectionThresholds, focusThresholds]);
|
|
5509
|
+
var setThresholds = React.useCallback(function (thresholds) {
|
|
5510
|
+
if (thresholds.detection) {
|
|
5511
|
+
setDocumentDetectionThresholds(thresholds.detection);
|
|
5512
|
+
}
|
|
5513
|
+
if (thresholds.focus) {
|
|
5514
|
+
setFocusThresholds(thresholds.focus);
|
|
5515
|
+
}
|
|
5516
|
+
}, [setDocumentDetectionThresholds, setFocusThresholds]);
|
|
5517
|
+
React.useEffect(function handleDetections() {
|
|
5518
|
+
var _this = this;
|
|
5519
|
+
onDocumentDetected(function (prediction) {
|
|
5520
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
5521
|
+
var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
|
|
5522
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5523
|
+
return __generator(this, function (_h) {
|
|
5524
|
+
if (!lastPredictionCanvas.current) return [2 /*return*/];
|
|
5525
|
+
stopDetectionAtStart = stopDetection.current;
|
|
5526
|
+
focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
|
|
5527
|
+
isSinglePage = prediction.detectedDocumentType === 'singlePage';
|
|
5528
|
+
if (!allowSinglePageIdCapture && isSinglePage) {
|
|
5529
|
+
prediction.detectedDocumentType = 'passport';
|
|
5530
|
+
prediction.passportDetectionScore = prediction.singlePageDetectionScore;
|
|
5531
|
+
prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
|
|
5532
|
+
prediction.singlePageDetectionScore = 0;
|
|
5533
|
+
prediction.singlePageDetectionThresholdMet = false;
|
|
5534
|
+
}
|
|
5535
|
+
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'));
|
|
5536
|
+
if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
|
|
5537
|
+
focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
|
|
5538
|
+
if (focusPrediction) {
|
|
5539
|
+
focusScore = focusPrediction.score;
|
|
5540
|
+
focusPredictionTime = focusPrediction.predictionTime;
|
|
5541
|
+
}
|
|
5542
|
+
focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
|
|
5543
|
+
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;
|
|
5544
|
+
focusThresholdMet = focusScore >= focusThreshold;
|
|
5545
|
+
if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
|
|
5546
|
+
bestFocusScore.current = focusScore;
|
|
5547
|
+
drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
|
|
5548
|
+
bestFrameDetails.current = {
|
|
5549
|
+
boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
|
|
5550
|
+
documentType: prediction.detectedDocumentType,
|
|
5551
|
+
detectionScore: prediction.detectionScore,
|
|
5552
|
+
focusScore: focusScore
|
|
5553
|
+
};
|
|
5554
|
+
}
|
|
5555
|
+
}
|
|
5556
|
+
(_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
|
|
5557
|
+
focusScore: focusScore,
|
|
5558
|
+
focusPredictionTime: focusPredictionTime,
|
|
5559
|
+
focusThresholdMet: focusThresholdMet
|
|
5560
|
+
}));
|
|
5561
|
+
return [2 /*return*/];
|
|
5562
|
+
});
|
|
5563
|
+
});
|
|
5564
|
+
});
|
|
5565
|
+
}, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
|
|
5566
|
+
var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
|
|
5567
|
+
React.useEffect(function handleModelErrors() {
|
|
5568
|
+
if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
|
|
5569
|
+
}, [modelError, onModelError]);
|
|
5570
|
+
var onPredictionMade = React.useCallback(function (handler) {
|
|
5571
|
+
onPredictionHandler.current = handler;
|
|
5572
|
+
}, []);
|
|
5573
|
+
var getBestFrame = React.useCallback(function () {
|
|
5574
|
+
if (!bestFrameDetails.current || !bestPredictionCanvas.current) return null;
|
|
5575
|
+
return _assign(_assign({}, bestFrameDetails.current), {
|
|
5576
|
+
canvas: bestPredictionCanvas.current
|
|
5577
|
+
});
|
|
5578
|
+
}, []);
|
|
5579
|
+
var _f = React.useState(0),
|
|
5580
|
+
canvasKey = _f[0],
|
|
5581
|
+
setCanvasKey = _f[1];
|
|
5582
|
+
var resetBestFrame = React.useCallback(function () {
|
|
5583
|
+
stopDetection.current += 1;
|
|
5584
|
+
setCanvasKey(function (n) {
|
|
5585
|
+
return n + 1;
|
|
5586
|
+
});
|
|
5587
|
+
clearDocumentDetectionLastPredictionCanvas();
|
|
5588
|
+
bestFrameDetails.current = null;
|
|
5589
|
+
bestFocusScore.current = 0;
|
|
5590
|
+
}, [clearDocumentDetectionLastPredictionCanvas]);
|
|
5591
|
+
React.useEffect(function () {
|
|
5592
|
+
if (requiredDocumentType) resetBestFrame();
|
|
5593
|
+
}, [requiredDocumentType, resetBestFrame]);
|
|
5594
|
+
var load = React.useCallback(function () {
|
|
5595
|
+
loadDocumentDetectionModel();
|
|
5596
|
+
loadFocusModel();
|
|
5597
|
+
}, [loadDocumentDetectionModel, loadFocusModel]);
|
|
5598
|
+
var value = React.useMemo(function () {
|
|
5599
|
+
return {
|
|
5600
|
+
ready: documentDetectionModelReady && focusModelReady,
|
|
5601
|
+
modelDownloadProgress: (documentDetectionModelDownloadProgress + focusModelDownloadProgress) / 2,
|
|
5602
|
+
modelError: modelError,
|
|
5603
|
+
start: startDocumentDetection,
|
|
5604
|
+
stop: stopDocumentDetection,
|
|
5605
|
+
load: load,
|
|
5606
|
+
thresholds: thresholds,
|
|
5607
|
+
setThresholds: setThresholds,
|
|
5608
|
+
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
5609
|
+
setDocumentDetectionBoundaries: setDocumentDetectionBoundaries,
|
|
5610
|
+
onPredictionMade: onPredictionMade,
|
|
5611
|
+
detectionTime: detectionTime,
|
|
5612
|
+
focusPredictionTime: focusPredictionTime,
|
|
5613
|
+
getBestFrame: getBestFrame,
|
|
5614
|
+
resetBestFrame: resetBestFrame,
|
|
5615
|
+
bestFrameDetails: bestFrameDetails,
|
|
5616
|
+
requiredDocumentType: requiredDocumentType,
|
|
5617
|
+
setRequiredDocumentType: setRequiredDocumentType
|
|
5618
|
+
};
|
|
5619
|
+
}, [detectionTime, documentDetectionBoundaries, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, load, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setDocumentDetectionBoundaries, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
|
|
5620
|
+
return /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsContext.Provider, {
|
|
5621
|
+
value: value
|
|
5622
|
+
}, /*#__PURE__*/React__namespace.default.createElement(InvisibleCanvas, {
|
|
5623
|
+
key: canvasKey,
|
|
5624
|
+
ref: bestPredictionCanvas
|
|
5625
|
+
}), children);
|
|
5626
|
+
}
|
|
5627
|
+
function IdCaptureModelsProvider(_a) {
|
|
5628
|
+
var children = _a.children,
|
|
5629
|
+
props = __rest(_a, ["children"]);
|
|
5630
|
+
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)));
|
|
5631
|
+
}
|
|
5632
|
+
|
|
5633
|
+
var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
|
|
5634
|
+
|
|
5635
|
+
var acceptedDocumentTypesForIdCaptureRequirementOption = {
|
|
5636
|
+
idCardFront: ['idCardFront'],
|
|
5637
|
+
idCardBack: ['idCardBack'],
|
|
5638
|
+
passport: ['passport'],
|
|
5639
|
+
idCard: ['idCardFront', 'idCardBack'],
|
|
5640
|
+
idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
|
|
5641
|
+
idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
|
|
6099
5642
|
};
|
|
5643
|
+
function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
5644
|
+
if (idCaptureRequirement === 'idCardOrPassport') return 1;
|
|
5645
|
+
return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
|
|
5646
|
+
}
|
|
5647
|
+
function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
|
|
5648
|
+
if (idCaptureRequirement === 'idCardOrPassport') return 2;
|
|
5649
|
+
return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
|
|
5650
|
+
}
|
|
5651
|
+
function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
|
|
5652
|
+
var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
|
|
5653
|
+
if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
|
|
5654
|
+
var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
|
|
5655
|
+
if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
|
|
5656
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
5657
|
+
return !v.includes('idCard');
|
|
5658
|
+
});
|
|
5659
|
+
}
|
|
5660
|
+
if (isIdCardOrPassport) {
|
|
5661
|
+
acceptedTypes = acceptedTypes.filter(function (v) {
|
|
5662
|
+
return v !== 'passport';
|
|
5663
|
+
});
|
|
5664
|
+
}
|
|
5665
|
+
return acceptedTypes.filter(function (v) {
|
|
5666
|
+
return !(v in capturedDocuments);
|
|
5667
|
+
});
|
|
5668
|
+
}
|
|
6100
5669
|
|
|
6101
|
-
var
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
5670
|
+
var initialState$4 = {
|
|
5671
|
+
initialDrawComplete: false,
|
|
5672
|
+
redrawing: false,
|
|
5673
|
+
guideRectX: 0,
|
|
5674
|
+
guideRectY: 0,
|
|
5675
|
+
guideRectWidth: 0,
|
|
5676
|
+
guideRectHeight: 0,
|
|
5677
|
+
guideRectOffsetTop: 0,
|
|
5678
|
+
guideImageWidth: 0,
|
|
5679
|
+
guideImageHeight: 0,
|
|
5680
|
+
pageWidth: 0,
|
|
5681
|
+
pageHeight: 0,
|
|
5682
|
+
videoWidth: 0,
|
|
5683
|
+
videoHeight: 0,
|
|
5684
|
+
detectedObjects: [],
|
|
5685
|
+
bestDocument: undefined,
|
|
5686
|
+
detectedDocumentType: 'none',
|
|
5687
|
+
detectionThresholdMet: false,
|
|
5688
|
+
documentInBounds: false,
|
|
5689
|
+
documentTooClose: false,
|
|
5690
|
+
documentIsStable: false,
|
|
5691
|
+
flipRequired: false,
|
|
5692
|
+
backDetectedFirst: false,
|
|
5693
|
+
idCardDetectedButNotAllowed: false,
|
|
5694
|
+
passportDetectedButNotAllowed: false,
|
|
5695
|
+
enableOverrideWrongDocumentTypeDialog: false,
|
|
5696
|
+
allowOverrideWrongDocumentTypeAfterMs: 8000,
|
|
5697
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
5698
|
+
overrideWrongDocumentTypeGuidance: false,
|
|
5699
|
+
wrongDocumentTypePredictions: 0,
|
|
5700
|
+
idCardFrontDetectionScore: 0,
|
|
5701
|
+
idCardFrontDetectionThresholdMet: false,
|
|
5702
|
+
idCardBackDetectionScore: 0,
|
|
5703
|
+
idCardBackDetectionThresholdMet: false,
|
|
5704
|
+
passportDetectionScore: 0,
|
|
5705
|
+
passportDetectionThresholdMet: false,
|
|
5706
|
+
singlePageDetectionScore: 0,
|
|
5707
|
+
singlePageDetectionThresholdMet: false,
|
|
5708
|
+
focusScore: 0,
|
|
5709
|
+
focusThresholdMet: false,
|
|
5710
|
+
isGoodFrame: false,
|
|
5711
|
+
goodFramesCount: 0,
|
|
5712
|
+
goodFramesThreshold: 3,
|
|
5713
|
+
goodFramesThresholdMet: false,
|
|
5714
|
+
lastFrameCapturedAt: null,
|
|
5715
|
+
frameCaptureRate: 0,
|
|
5716
|
+
capturing: false,
|
|
5717
|
+
captureFailed: false,
|
|
5718
|
+
imageUrl: null,
|
|
5719
|
+
captureState: 'initializing',
|
|
5720
|
+
capturedDocuments: {},
|
|
5721
|
+
captureRequirement: 'idCardOrPassport',
|
|
5722
|
+
requestedDocumentType: 'idCardFront',
|
|
5723
|
+
allowSinglePageIdCapture: false,
|
|
5724
|
+
allowIdCardBackToFrontCapture: false,
|
|
5725
|
+
allowUploadingDocumentsFromStorage: false,
|
|
5726
|
+
isUploadingDocumentsFromStorage: false,
|
|
5727
|
+
uploadingDocumentsType: null,
|
|
5728
|
+
operationStartedAt: null,
|
|
5729
|
+
captureStartedAt: null,
|
|
5730
|
+
dispatch: function dispatch() {
|
|
5731
|
+
return null;
|
|
5732
|
+
}
|
|
5733
|
+
};
|
|
5734
|
+
var _reducer = function reducer(state, action) {
|
|
5735
|
+
var _a;
|
|
5736
|
+
switch (action.type) {
|
|
5737
|
+
case 'configureWizard':
|
|
5738
|
+
{
|
|
5739
|
+
var _b = action.payload,
|
|
5740
|
+
captureRequirement = _b.captureRequirement,
|
|
5741
|
+
precapturedDocuments = _b.precapturedDocuments,
|
|
5742
|
+
allowSinglePageIdCapture = _b.allowSinglePageIdCapture,
|
|
5743
|
+
allowIdCardBackToFrontCapture = _b.allowIdCardBackToFrontCapture,
|
|
5744
|
+
enableOverrideWrongDocumentTypeDialog = _b.enableOverrideWrongDocumentTypeDialog,
|
|
5745
|
+
allowOverrideWrongDocumentTypeAfterMs = _b.allowOverrideWrongDocumentTypeAfterMs,
|
|
5746
|
+
allowUploadingDocumentsFromStorage = _b.allowUploadingDocumentsFromStorage;
|
|
5747
|
+
var newState = _assign(_assign({}, state), {
|
|
5748
|
+
captureRequirement: captureRequirement,
|
|
5749
|
+
allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
|
|
5750
|
+
allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
|
|
5751
|
+
enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
|
|
5752
|
+
allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
|
|
5753
|
+
allowUploadingDocumentsFromStorage: allowUploadingDocumentsFromStorage
|
|
5754
|
+
});
|
|
5755
|
+
if (captureRequirement === 'idCardBack') newState.requestedDocumentType = 'idCardBack';
|
|
5756
|
+
if (captureRequirement === 'passport') newState.requestedDocumentType = 'passport';
|
|
5757
|
+
if (precapturedDocuments) {
|
|
5758
|
+
for (var _i = 0, CapturedDocumentTypeValues_1 = CapturedDocumentTypeValues; _i < CapturedDocumentTypeValues_1.length; _i++) {
|
|
5759
|
+
var k = CapturedDocumentTypeValues_1[_i];
|
|
5760
|
+
var payload = precapturedDocuments[k];
|
|
5761
|
+
if (payload) {
|
|
5762
|
+
newState.requestedDocumentType = k;
|
|
5763
|
+
newState = _reducer(newState, {
|
|
5764
|
+
type: 'documentCaptured',
|
|
5765
|
+
payload: payload
|
|
5766
|
+
});
|
|
5767
|
+
}
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
if (newState.captureState === 'initializing' && !allowUploadingDocumentsFromStorage) {
|
|
5771
|
+
newState.captureState = 'capturing';
|
|
5772
|
+
}
|
|
5773
|
+
return newState;
|
|
5774
|
+
}
|
|
5775
|
+
case 'setRequiredDocumentType':
|
|
5776
|
+
return _assign(_assign({}, state), {
|
|
5777
|
+
requiredDocumentType: action.payload
|
|
5778
|
+
});
|
|
5779
|
+
case 'redrawRequested':
|
|
5780
|
+
return _assign(_assign({}, state), {
|
|
5781
|
+
redrawing: true,
|
|
5782
|
+
guideRectX: 0,
|
|
5783
|
+
guideRectY: 0,
|
|
5784
|
+
guideRectWidth: 0,
|
|
5785
|
+
guideRectHeight: 0,
|
|
5786
|
+
guideRectOffsetTop: 0
|
|
5787
|
+
});
|
|
5788
|
+
case 'redrawInProgress':
|
|
5789
|
+
return _assign(_assign({}, state), {
|
|
5790
|
+
redrawing: false,
|
|
5791
|
+
guideRectX: 0,
|
|
5792
|
+
guideRectY: 0,
|
|
5793
|
+
guideRectWidth: 0,
|
|
5794
|
+
guideRectHeight: 0,
|
|
5795
|
+
guideRectOffsetTop: 0
|
|
5796
|
+
});
|
|
5797
|
+
case 'redrawCompleted':
|
|
5798
|
+
return _assign(_assign(_assign({}, state), action.payload), {
|
|
5799
|
+
initialDrawComplete: true
|
|
5800
|
+
});
|
|
5801
|
+
case 'pageRendered':
|
|
5802
|
+
return _assign(_assign({}, state), action.payload);
|
|
5803
|
+
case 'guideImageLoaded':
|
|
5804
|
+
return _assign(_assign({}, state), {
|
|
5805
|
+
guideImageWidth: action.payload.width,
|
|
5806
|
+
guideImageHeight: action.payload.height
|
|
5807
|
+
});
|
|
5808
|
+
case 'objectsDetected':
|
|
5809
|
+
{
|
|
5810
|
+
var _c = action.payload.prediction,
|
|
5811
|
+
detectedObjects = _c.detectedObjects,
|
|
5812
|
+
detectionThresholdMet = _c.detectionThresholdMet,
|
|
5813
|
+
detectedDocumentType = _c.detectedDocumentType,
|
|
5814
|
+
idCardFrontDetectionScore = _c.idCardFrontDetectionScore,
|
|
5815
|
+
idCardFrontDetectionThresholdMet = _c.idCardFrontDetectionThresholdMet,
|
|
5816
|
+
idCardBackDetectionScore = _c.idCardBackDetectionScore,
|
|
5817
|
+
idCardBackDetectionThresholdMet = _c.idCardBackDetectionThresholdMet,
|
|
5818
|
+
passportDetectionScore = _c.passportDetectionScore,
|
|
5819
|
+
passportDetectionThresholdMet = _c.passportDetectionThresholdMet,
|
|
5820
|
+
singlePageDetectionScore = _c.singlePageDetectionScore,
|
|
5821
|
+
singlePageDetectionThresholdMet = _c.singlePageDetectionThresholdMet,
|
|
5822
|
+
bestDocument = _c.bestDocument,
|
|
5823
|
+
documentInBounds = _c.documentInBounds,
|
|
5824
|
+
documentTooClose = _c.documentTooClose,
|
|
5825
|
+
documentIsStable = _c.documentIsStable,
|
|
5826
|
+
focusScore = _c.focusScore,
|
|
5827
|
+
focusThresholdMet = _c.focusThresholdMet,
|
|
5828
|
+
frameWidth = _c.frameWidth,
|
|
5829
|
+
frameHeight = _c.frameHeight;
|
|
5830
|
+
var frameCapturedAt = new Date();
|
|
5831
|
+
var frameCaptureRate = 0;
|
|
5832
|
+
var goodFramesThreshold = state.goodFramesThreshold;
|
|
5833
|
+
if (state.lastFrameCapturedAt) {
|
|
5834
|
+
var frameTime = frameCapturedAt.getTime() - state.lastFrameCapturedAt.getTime();
|
|
5835
|
+
if (frameTime > 0) {
|
|
5836
|
+
frameCaptureRate = 1000.0 / frameTime;
|
|
5837
|
+
if (frameCaptureRate > 0) {
|
|
5838
|
+
goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
|
|
5843
|
+
var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
|
|
5844
|
+
var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
|
|
5845
|
+
var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
|
|
5846
|
+
var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
|
|
5847
|
+
var idCardBeingCaptured = idCardFrontWasCaptured && !idCardBackWasCaptured || !idCardFrontWasCaptured && idCardBackWasCaptured;
|
|
5848
|
+
var passportDetectedButNotAllowed = detectedDocumentType === 'passport' && (passportNotAllowed || idCardBeingCaptured);
|
|
5849
|
+
var flipRequired = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardFrontWasCaptured && detectedDocumentType === 'idCardFront' : state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront');
|
|
5850
|
+
var backDetectedFirst = !state.overrideWrongDocumentTypeGuidance && (state.allowIdCardBackToFrontCapture ? idCardBackWasCaptured && detectedDocumentType === 'idCardBack' : state.requestedDocumentType === 'idCardFront' && detectedDocumentType === 'idCardBack');
|
|
5851
|
+
var wrongDocumentTypePredictions = state.wrongDocumentTypePredictions;
|
|
5852
|
+
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
5853
|
+
wrongDocumentTypePredictions += 1;
|
|
5854
|
+
}
|
|
5855
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && !idCardDetectedButNotAllowed && !passportDetectedButNotAllowed && documentIsStable;
|
|
5856
|
+
var captureStartedAt = state.captureStartedAt;
|
|
5857
|
+
var goodFramesCount = state.goodFramesCount;
|
|
5858
|
+
if (isGoodFrame) {
|
|
5859
|
+
goodFramesCount += 1;
|
|
5860
|
+
captureStartedAt || (captureStartedAt = new Date());
|
|
5861
|
+
}
|
|
5862
|
+
var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
|
|
5863
|
+
var requestedDocumentType = state.requestedDocumentType;
|
|
5864
|
+
if (state.captureRequirement.includes('idCard') && state.allowIdCardBackToFrontCapture) {
|
|
5865
|
+
if (detectedDocumentType === 'idCardFront' && state.requestedDocumentType !== 'idCardFront' && !idCardFrontWasCaptured) {
|
|
5866
|
+
requestedDocumentType = 'idCardFront';
|
|
5867
|
+
} else if (detectedDocumentType === 'idCardBack' && state.requestedDocumentType !== 'idCardBack' && !idCardBackWasCaptured) {
|
|
5868
|
+
requestedDocumentType = 'idCardBack';
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
if (state.captureRequirement === 'idCardOrPassport') {
|
|
5872
|
+
if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
|
|
5873
|
+
requestedDocumentType = 'passport';
|
|
5874
|
+
}
|
|
5875
|
+
if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
|
|
5876
|
+
requestedDocumentType = idCardFrontWasCaptured ? 'idCardBack' : 'idCardFront';
|
|
5877
|
+
}
|
|
5878
|
+
}
|
|
5879
|
+
var hasBeenRunningForLongEnough = !!state.operationStartedAt && new Date().getTime() - state.operationStartedAt.getTime() > 1000;
|
|
5880
|
+
var overrideFlipRequirementThreshold = Math.ceil(state.allowOverrideWrongDocumentTypeAfterMs / 1000 * frameCaptureRate);
|
|
5881
|
+
var allowOverrideFlipRequirement = state.enableOverrideWrongDocumentTypeDialog && hasBeenRunningForLongEnough && !state.overrideWrongDocumentTypeGuidance && overrideFlipRequirementThreshold > 0 && (state.allowOverrideWrongDocumentTypeGuidance || wrongDocumentTypePredictions >= overrideFlipRequirementThreshold);
|
|
5882
|
+
return _assign(_assign({}, state), {
|
|
5883
|
+
videoWidth: frameWidth,
|
|
5884
|
+
videoHeight: frameHeight,
|
|
5885
|
+
detectedObjects: detectedObjects,
|
|
5886
|
+
bestDocument: bestDocument,
|
|
5887
|
+
requestedDocumentType: requestedDocumentType,
|
|
5888
|
+
detectedDocumentType: detectedDocumentType,
|
|
5889
|
+
detectionThresholdMet: detectionThresholdMet,
|
|
5890
|
+
documentInBounds: documentInBounds,
|
|
5891
|
+
documentTooClose: documentTooClose,
|
|
5892
|
+
documentIsStable: documentIsStable,
|
|
5893
|
+
flipRequired: flipRequired,
|
|
5894
|
+
backDetectedFirst: backDetectedFirst,
|
|
5895
|
+
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
5896
|
+
passportDetectedButNotAllowed: passportDetectedButNotAllowed,
|
|
5897
|
+
allowOverrideWrongDocumentTypeGuidance: allowOverrideFlipRequirement,
|
|
5898
|
+
wrongDocumentTypePredictions: wrongDocumentTypePredictions,
|
|
5899
|
+
idCardFrontDetectionScore: idCardFrontDetectionScore,
|
|
5900
|
+
idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
|
|
5901
|
+
idCardBackDetectionScore: idCardBackDetectionScore,
|
|
5902
|
+
idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
|
|
5903
|
+
passportDetectionScore: passportDetectionScore,
|
|
5904
|
+
passportDetectionThresholdMet: passportDetectionThresholdMet,
|
|
5905
|
+
singlePageDetectionScore: singlePageDetectionScore,
|
|
5906
|
+
singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
|
|
5907
|
+
focusScore: focusScore,
|
|
5908
|
+
focusThresholdMet: focusThresholdMet,
|
|
5909
|
+
isGoodFrame: isGoodFrame,
|
|
5910
|
+
goodFramesCount: goodFramesCount,
|
|
5911
|
+
goodFramesThreshold: goodFramesThreshold,
|
|
5912
|
+
goodFramesThresholdMet: goodFramesThresholdMet,
|
|
5913
|
+
captureStartedAt: captureStartedAt,
|
|
5914
|
+
lastFrameCapturedAt: frameCapturedAt,
|
|
5915
|
+
frameCaptureRate: frameCaptureRate
|
|
5916
|
+
});
|
|
5917
|
+
}
|
|
5918
|
+
case 'captureInitialized':
|
|
5919
|
+
return _assign(_assign({}, state), {
|
|
5920
|
+
captureState: 'capturing',
|
|
5921
|
+
isUploadingDocumentsFromStorage: false
|
|
5922
|
+
});
|
|
5923
|
+
case 'captureStarted':
|
|
5924
|
+
return _assign(_assign({}, state), {
|
|
5925
|
+
operationStartedAt: new Date(),
|
|
5926
|
+
captureStartedAt: null,
|
|
5927
|
+
capturing: false,
|
|
5928
|
+
captureFailed: false
|
|
5929
|
+
});
|
|
5930
|
+
case 'capturing':
|
|
5931
|
+
return _assign(_assign({}, state), {
|
|
5932
|
+
capturing: true,
|
|
5933
|
+
captureFailed: false
|
|
5934
|
+
});
|
|
5935
|
+
case 'captured':
|
|
5936
|
+
return _assign(_assign({}, state), {
|
|
5937
|
+
capturing: false,
|
|
5938
|
+
captureFailed: false
|
|
5939
|
+
});
|
|
5940
|
+
case 'frameCaptured':
|
|
5941
|
+
return _assign(_assign({}, state), {
|
|
5942
|
+
imageUrl: action.payload.imageUrl
|
|
5943
|
+
});
|
|
5944
|
+
case 'captureFailed':
|
|
5945
|
+
return _assign(_assign({}, state), {
|
|
5946
|
+
capturing: false,
|
|
5947
|
+
captureFailed: true
|
|
5948
|
+
});
|
|
5949
|
+
case 'documentCaptured':
|
|
5950
|
+
{
|
|
5951
|
+
var newState = _assign(_assign({}, state), {
|
|
5952
|
+
capturing: false,
|
|
5953
|
+
captureFailed: false,
|
|
5954
|
+
allowOverrideFlipRequirement: false,
|
|
5955
|
+
overrideFlipRequirement: false,
|
|
5956
|
+
goodFramesCount: 0,
|
|
5957
|
+
wrongDocumentTypePredictions: 0,
|
|
5958
|
+
capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
|
|
5959
|
+
});
|
|
5960
|
+
var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
|
|
5961
|
+
if (remainingRequirements.length === 0) {
|
|
5962
|
+
newState.captureState = 'complete';
|
|
5963
|
+
} else {
|
|
5964
|
+
newState.requestedDocumentType = remainingRequirements[0];
|
|
5965
|
+
if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
|
|
5966
|
+
if (!newState.isUploadingDocumentsFromStorage) {
|
|
5967
|
+
newState.captureState = 'requestingFlip';
|
|
5968
|
+
}
|
|
5969
|
+
newState.idCardFrontDetectionThresholdMet = false;
|
|
5970
|
+
newState.idCardBackDetectionThresholdMet = false;
|
|
5971
|
+
newState.passportDetectionThresholdMet = false;
|
|
5972
|
+
newState.wrongDocumentTypePredictions = 0;
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
return newState;
|
|
5976
|
+
}
|
|
5977
|
+
case 'documentCapturedManually':
|
|
5978
|
+
return _reducer(state, {
|
|
5979
|
+
type: 'documentCaptured',
|
|
5980
|
+
payload: _assign(_assign({}, action.payload), {
|
|
5981
|
+
documentType: state.requestedDocumentType,
|
|
5982
|
+
width: 0,
|
|
5983
|
+
height: 0
|
|
5984
|
+
})
|
|
5985
|
+
});
|
|
5986
|
+
case 'documentsCaptured':
|
|
5987
|
+
{
|
|
5988
|
+
var newState = _assign({}, state);
|
|
5989
|
+
for (var _d = 0, _e = action.payload; _d < _e.length; _d++) {
|
|
5990
|
+
var doc = _e[_d];
|
|
5991
|
+
newState = _reducer(newState, {
|
|
5992
|
+
type: 'documentCaptured',
|
|
5993
|
+
payload: doc
|
|
5994
|
+
});
|
|
5995
|
+
}
|
|
5996
|
+
return newState;
|
|
5997
|
+
}
|
|
5998
|
+
case 'flipRequestCompleted':
|
|
5999
|
+
return _assign(_assign({}, state), {
|
|
6000
|
+
captureState: 'capturing',
|
|
6001
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
6002
|
+
overrideWrongDocumentTypeGuidance: false,
|
|
6003
|
+
wrongDocumentTypePredictions: 0
|
|
6004
|
+
});
|
|
6005
|
+
case 'allowOverrideFlipRequirement':
|
|
6006
|
+
return _assign(_assign({}, state), {
|
|
6007
|
+
allowOverrideWrongDocumentTypeGuidance: true
|
|
6008
|
+
});
|
|
6009
|
+
case 'overrideFlipRequirement':
|
|
6010
|
+
return _assign(_assign({}, state), {
|
|
6011
|
+
allowOverrideWrongDocumentTypeGuidance: false,
|
|
6012
|
+
overrideWrongDocumentTypeGuidance: true
|
|
6013
|
+
});
|
|
6014
|
+
case 'setUploadingDocumentsFromStorage':
|
|
6015
|
+
return _assign(_assign({}, state), {
|
|
6016
|
+
isUploadingDocumentsFromStorage: action.payload,
|
|
6017
|
+
captureState: action.payload ? 'initializing' : 'capturing'
|
|
6018
|
+
});
|
|
6019
|
+
case 'setUploadingDocumentsType':
|
|
6020
|
+
{
|
|
6021
|
+
var requestedDocumentType = !action.payload || action.payload === 'idCard' ? 'idCardFront' : action.payload;
|
|
6022
|
+
var uploadingDocumentsType = action.payload === 'singlePage' ? 'idCard' : action.payload;
|
|
6023
|
+
return _assign(_assign({}, state), {
|
|
6024
|
+
captureState: action.payload ? 'uploading' : 'initializing',
|
|
6025
|
+
uploadingDocumentsType: uploadingDocumentsType,
|
|
6026
|
+
requestedDocumentType: requestedDocumentType
|
|
6027
|
+
});
|
|
6028
|
+
}
|
|
6029
|
+
case 'resetWizard':
|
|
6030
|
+
return _assign(_assign({}, initialState$4), {
|
|
6031
|
+
dispatch: state.dispatch,
|
|
6032
|
+
allowUploadingDocumentsFromStorage: state.allowUploadingDocumentsFromStorage,
|
|
6033
|
+
captureState: state.allowUploadingDocumentsFromStorage ? 'initializing' : 'capturing',
|
|
6034
|
+
captureRequirement: state.captureRequirement,
|
|
6035
|
+
allowIdCardBackToFrontCapture: state.allowIdCardBackToFrontCapture
|
|
6036
|
+
});
|
|
6037
|
+
default:
|
|
6038
|
+
return state;
|
|
6128
6039
|
}
|
|
6129
6040
|
};
|
|
6130
|
-
function
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6041
|
+
var useIdCaptureStore = zustand.create()(middleware.devtools(function (set) {
|
|
6042
|
+
return _assign(_assign({}, initialState$4), {
|
|
6043
|
+
dispatch: function dispatch(action) {
|
|
6044
|
+
return set(function (state) {
|
|
6045
|
+
return _reducer(state, action);
|
|
6046
|
+
}, undefined, action);
|
|
6047
|
+
}
|
|
6048
|
+
});
|
|
6049
|
+
}));
|
|
6050
|
+
function IdCaptureStateProvider(_a) {
|
|
6051
|
+
var children = _a.children;
|
|
6052
|
+
var overrideWrongDocumentTypeGuidance = useIdCaptureStore(shallow.useShallow(function (state) {
|
|
6053
|
+
return state.overrideWrongDocumentTypeGuidance;
|
|
6054
|
+
}));
|
|
6055
|
+
var setRequiredDocumentType = React.useContext(IdCaptureModelsContext).setRequiredDocumentType;
|
|
6056
|
+
React.useEffect(function () {
|
|
6057
|
+
if (overrideWrongDocumentTypeGuidance) setRequiredDocumentType('none');
|
|
6058
|
+
}, [overrideWrongDocumentTypeGuidance, setRequiredDocumentType]);
|
|
6059
|
+
var onResize = useDebounce.useDebouncedCallback(function () {
|
|
6060
|
+
dispatchIdCaptureAction({
|
|
6061
|
+
type: 'redrawRequested'
|
|
6062
|
+
});
|
|
6063
|
+
}, 500);
|
|
6064
|
+
React.useLayoutEffect(function () {
|
|
6065
|
+
if (typeof window === 'undefined') return;
|
|
6066
|
+
window.addEventListener('resize', onResize);
|
|
6067
|
+
return function () {
|
|
6068
|
+
return window.removeEventListener('resize', onResize);
|
|
6069
|
+
};
|
|
6070
|
+
}, [onResize]);
|
|
6071
|
+
React.useEffect(function resetWhenProviderUnmounts() {
|
|
6072
|
+
return function () {
|
|
6073
|
+
return useIdCaptureStore.getState().dispatch({
|
|
6074
|
+
type: 'resetWizard'
|
|
6075
|
+
});
|
|
6076
|
+
};
|
|
6077
|
+
}, []);
|
|
6078
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, children);
|
|
6079
|
+
}
|
|
6080
|
+
var dispatchIdCaptureAction = function dispatchIdCaptureAction(action) {
|
|
6081
|
+
return useIdCaptureStore.getState().dispatch(action);
|
|
6082
|
+
};
|
|
6083
|
+
|
|
6084
|
+
function DebugStatsPane(_a) {
|
|
6085
|
+
var children = _a.children;
|
|
6086
|
+
var element = /*#__PURE__*/React__namespace.default.createElement(DebugStatsPaneDiv, null, children);
|
|
6087
|
+
var portalLocation = document.getElementById('idmission-above-guides-content');
|
|
6088
|
+
if (!portalLocation) return element;
|
|
6089
|
+
return /*#__PURE__*/reactDom.createPortal(element, portalLocation);
|
|
6090
|
+
}
|
|
6091
|
+
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"])));
|
|
6092
|
+
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) {
|
|
6093
|
+
var $flipX = _a.$flipX;
|
|
6094
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6095
|
+
});
|
|
6096
|
+
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) {
|
|
6097
|
+
var $color = _a.$color;
|
|
6098
|
+
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
6099
|
+
}, function (_a) {
|
|
6100
|
+
var $color = _a.$color;
|
|
6101
|
+
return $color !== null && $color !== void 0 ? $color : 'green';
|
|
6102
|
+
}, function (_a) {
|
|
6103
|
+
var $flipX = _a.$flipX;
|
|
6104
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6105
|
+
});
|
|
6106
|
+
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) {
|
|
6107
|
+
var $color = _a.$color;
|
|
6108
|
+
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
6109
|
+
}, function (_a) {
|
|
6110
|
+
var $color = _a.$color;
|
|
6111
|
+
return $color !== null && $color !== void 0 ? $color : 'red';
|
|
6112
|
+
}, function (_a) {
|
|
6113
|
+
var $flipX = _a.$flipX;
|
|
6114
|
+
return $flipX ? 'transform: scaleX(-1);' : '';
|
|
6115
|
+
});
|
|
6116
|
+
function useDebugScalingDetails(_a) {
|
|
6117
|
+
var _b = _a.enabled,
|
|
6118
|
+
enabled = _b === void 0 ? true : _b,
|
|
6119
|
+
pageWidth = _a.pageWidth,
|
|
6120
|
+
pageHeight = _a.pageHeight,
|
|
6121
|
+
videoWidth = _a.videoWidth,
|
|
6122
|
+
videoHeight = _a.videoHeight;
|
|
6123
|
+
return React.useMemo(function () {
|
|
6124
|
+
var horizontal = false,
|
|
6125
|
+
scaledWidth = 0,
|
|
6126
|
+
scaledHeight = 0,
|
|
6127
|
+
xOffset = 0,
|
|
6128
|
+
yOffset = 0;
|
|
6129
|
+
if (enabled) {
|
|
6130
|
+
horizontal = pageWidth / pageHeight < videoWidth / videoHeight;
|
|
6131
|
+
if (horizontal) {
|
|
6132
|
+
scaledWidth = videoWidth * (pageHeight / videoHeight);
|
|
6133
|
+
xOffset = (scaledWidth - pageWidth) / 2;
|
|
6134
|
+
} else {
|
|
6135
|
+
scaledHeight = videoHeight * (pageWidth / videoWidth);
|
|
6136
|
+
yOffset = (scaledHeight - pageHeight) / 2;
|
|
6137
|
+
}
|
|
6140
6138
|
}
|
|
6141
|
-
|
|
6139
|
+
return {
|
|
6140
|
+
horizontal: horizontal,
|
|
6141
|
+
pageWidth: pageWidth,
|
|
6142
|
+
pageHeight: pageHeight,
|
|
6143
|
+
videoWidth: videoWidth,
|
|
6144
|
+
videoHeight: videoHeight,
|
|
6145
|
+
scaledWidth: scaledWidth,
|
|
6146
|
+
scaledHeight: scaledHeight,
|
|
6147
|
+
xOffset: xOffset,
|
|
6148
|
+
yOffset: yOffset
|
|
6149
|
+
};
|
|
6150
|
+
}, [enabled, pageHeight, pageWidth, videoHeight, videoWidth]);
|
|
6142
6151
|
}
|
|
6143
|
-
var
|
|
6144
|
-
var
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6152
|
+
var DebugBoundingBoxOverlay = function DebugBoundingBoxOverlay(_a) {
|
|
6153
|
+
var scaling = _a.scaling,
|
|
6154
|
+
$flipX = _a.$flipX,
|
|
6155
|
+
children = _a.children;
|
|
6156
|
+
var _b = useIdCaptureStore(),
|
|
6157
|
+
guideRectWidth = _b.guideRectWidth,
|
|
6158
|
+
guideRectHeight = _b.guideRectHeight,
|
|
6159
|
+
guideRectX = _b.guideRectX,
|
|
6160
|
+
guideRectY = _b.guideRectY;
|
|
6161
|
+
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
|
|
6162
|
+
id: "debug-overlay-div",
|
|
6163
|
+
"$flipX": $flipX,
|
|
6164
|
+
style: {
|
|
6165
|
+
top: guideRectY,
|
|
6166
|
+
left: guideRectX,
|
|
6167
|
+
width: guideRectWidth || (scaling === null || scaling === void 0 ? void 0 : scaling.pageWidth),
|
|
6168
|
+
height: guideRectHeight || (scaling === null || scaling === void 0 ? void 0 : scaling.pageHeight)
|
|
6150
6169
|
}
|
|
6151
|
-
},
|
|
6170
|
+
}, children);
|
|
6152
6171
|
};
|
|
6153
|
-
function
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6172
|
+
function IdCaptureDetectedObjectDebugBox(_a) {
|
|
6173
|
+
var obj = _a.obj,
|
|
6174
|
+
flipX = _a.flipX,
|
|
6175
|
+
_b = _a.color,
|
|
6176
|
+
color = _b === void 0 ? 'green' : _b,
|
|
6177
|
+
scaling = _a.scaling;
|
|
6178
|
+
var horizontal = scaling.horizontal,
|
|
6179
|
+
pageWidth = scaling.pageWidth,
|
|
6180
|
+
pageHeight = scaling.pageHeight,
|
|
6181
|
+
videoWidth = scaling.videoWidth,
|
|
6182
|
+
videoHeight = scaling.videoHeight,
|
|
6183
|
+
scaledWidth = scaling.scaledWidth,
|
|
6184
|
+
scaledHeight = scaling.scaledHeight,
|
|
6185
|
+
xOffset = scaling.xOffset,
|
|
6186
|
+
yOffset = scaling.yOffset;
|
|
6187
|
+
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
6188
|
+
var top;
|
|
6189
|
+
var left;
|
|
6190
|
+
var width;
|
|
6191
|
+
var height;
|
|
6192
|
+
if (horizontal) {
|
|
6193
|
+
top = obj.box.yMin / videoHeight * pageHeight;
|
|
6194
|
+
left = obj.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
6195
|
+
width = obj.box.width / videoWidth * scaledWidth;
|
|
6196
|
+
height = obj.box.height / videoHeight * pageHeight;
|
|
6197
|
+
} else {
|
|
6198
|
+
top = obj.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
6199
|
+
left = obj.box.xMin / videoWidth * pageWidth;
|
|
6200
|
+
width = obj.box.width / videoWidth * pageWidth;
|
|
6201
|
+
height = obj.box.height / videoHeight * scaledHeight;
|
|
6160
6202
|
}
|
|
6161
|
-
return
|
|
6203
|
+
return /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
6204
|
+
"$flipX": flipX,
|
|
6205
|
+
"$color": color,
|
|
6206
|
+
style: {
|
|
6207
|
+
top: top,
|
|
6208
|
+
left: left,
|
|
6209
|
+
width: width,
|
|
6210
|
+
height: height
|
|
6211
|
+
}
|
|
6212
|
+
});
|
|
6162
6213
|
}
|
|
6163
|
-
function
|
|
6164
|
-
var
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6214
|
+
function SelfieCaptureFaceDebugBox(_a) {
|
|
6215
|
+
var face = _a.face,
|
|
6216
|
+
flipX = _a.flipX,
|
|
6217
|
+
_b = _a.color,
|
|
6218
|
+
color = _b === void 0 ? 'green' : _b,
|
|
6219
|
+
scaling = _a.scaling;
|
|
6220
|
+
var horizontal = scaling.horizontal,
|
|
6221
|
+
pageWidth = scaling.pageWidth,
|
|
6222
|
+
pageHeight = scaling.pageHeight,
|
|
6223
|
+
videoWidth = scaling.videoWidth,
|
|
6224
|
+
videoHeight = scaling.videoHeight,
|
|
6225
|
+
scaledWidth = scaling.scaledWidth,
|
|
6226
|
+
scaledHeight = scaling.scaledHeight,
|
|
6227
|
+
xOffset = scaling.xOffset,
|
|
6228
|
+
yOffset = scaling.yOffset;
|
|
6229
|
+
if (!videoWidth || !videoHeight || !pageWidth || !pageHeight) return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null);
|
|
6230
|
+
var top;
|
|
6231
|
+
var left;
|
|
6232
|
+
var width;
|
|
6233
|
+
var height;
|
|
6234
|
+
if (horizontal) {
|
|
6235
|
+
top = face.box.yMin / videoHeight * pageHeight;
|
|
6236
|
+
left = face.box.xMin / videoWidth * scaledWidth - xOffset;
|
|
6237
|
+
width = face.box.width / videoWidth * scaledWidth;
|
|
6238
|
+
height = face.box.height / videoHeight * pageHeight;
|
|
6239
|
+
} else {
|
|
6240
|
+
top = face.box.yMin / videoHeight * scaledHeight - yOffset;
|
|
6241
|
+
left = face.box.xMin / videoWidth * pageWidth;
|
|
6242
|
+
width = face.box.width / videoWidth * pageWidth;
|
|
6243
|
+
height = face.box.height / videoHeight * scaledHeight;
|
|
6244
|
+
}
|
|
6245
|
+
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugBox, {
|
|
6246
|
+
"$flipX": flipX,
|
|
6247
|
+
"$color": color,
|
|
6248
|
+
style: {
|
|
6249
|
+
top: top,
|
|
6250
|
+
left: left,
|
|
6251
|
+
width: width,
|
|
6252
|
+
height: height
|
|
6253
|
+
}
|
|
6254
|
+
}), face.keypoints.map(function (point, ii) {
|
|
6255
|
+
return /*#__PURE__*/React__namespace.default.createElement(SelfieCaptureFaceKeypoint, {
|
|
6256
|
+
key: ii,
|
|
6257
|
+
point: point,
|
|
6258
|
+
scaling: scaling,
|
|
6259
|
+
flipX: flipX
|
|
6260
|
+
});
|
|
6261
|
+
}));
|
|
6170
6262
|
}
|
|
6171
|
-
function
|
|
6172
|
-
var
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6263
|
+
function SelfieCaptureFaceKeypoint(_a) {
|
|
6264
|
+
var point = _a.point,
|
|
6265
|
+
flipX = _a.flipX,
|
|
6266
|
+
_b = _a.color,
|
|
6267
|
+
color = _b === void 0 ? 'red' : _b,
|
|
6268
|
+
_c = _a.scaling,
|
|
6269
|
+
horizontal = _c.horizontal,
|
|
6270
|
+
pageWidth = _c.pageWidth,
|
|
6271
|
+
pageHeight = _c.pageHeight,
|
|
6272
|
+
videoWidth = _c.videoWidth,
|
|
6273
|
+
videoHeight = _c.videoHeight,
|
|
6274
|
+
scaledWidth = _c.scaledWidth,
|
|
6275
|
+
scaledHeight = _c.scaledHeight,
|
|
6276
|
+
xOffset = _c.xOffset,
|
|
6277
|
+
yOffset = _c.yOffset;
|
|
6278
|
+
var left, top;
|
|
6279
|
+
if (horizontal) {
|
|
6280
|
+
left = point.x / videoWidth * scaledWidth - xOffset;
|
|
6281
|
+
top = point.y / videoHeight * pageHeight;
|
|
6282
|
+
} else {
|
|
6283
|
+
left = point.x / videoWidth * pageWidth;
|
|
6284
|
+
top = point.y / videoHeight * scaledHeight - yOffset;
|
|
6285
|
+
}
|
|
6286
|
+
top -= 2;
|
|
6287
|
+
left -= 2;
|
|
6288
|
+
return /*#__PURE__*/React__namespace.default.createElement(FaceDetectionKeypointMarker, {
|
|
6289
|
+
"$flipX": flipX,
|
|
6290
|
+
"$color": color,
|
|
6291
|
+
style: {
|
|
6292
|
+
top: top,
|
|
6293
|
+
left: left
|
|
6294
|
+
}
|
|
6295
|
+
});
|
|
6181
6296
|
}
|
|
6297
|
+
var templateObject_1$G, templateObject_2$z, templateObject_3$q, templateObject_4$k;
|
|
6182
6298
|
|
|
6183
6299
|
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) {
|
|
6184
6300
|
var $top = _a.$top;
|
|
@@ -13782,9 +13898,10 @@ function VideoSignatureWizardGuides(_a) {
|
|
|
13782
13898
|
});
|
|
13783
13899
|
}
|
|
13784
13900
|
var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProviders(props) {
|
|
13785
|
-
var _a
|
|
13786
|
-
|
|
13787
|
-
|
|
13901
|
+
var _a, _b;
|
|
13902
|
+
var _c = React.useState(0),
|
|
13903
|
+
attempts = _c[0],
|
|
13904
|
+
setAttempts = _c[1];
|
|
13788
13905
|
var onRetryClickedProp = props.onRetryClicked;
|
|
13789
13906
|
var onRetryClicked = React.useCallback(function () {
|
|
13790
13907
|
setAttempts(function (n) {
|
|
@@ -13800,7 +13917,10 @@ var VideoSignatureWizardWithProviders = function VideoSignatureWizardWithProvide
|
|
|
13800
13917
|
maxVideoWidth: 1280,
|
|
13801
13918
|
maxFps: 30,
|
|
13802
13919
|
onCameraAccessDenied: props.onCameraAccessDenied,
|
|
13803
|
-
|
|
13920
|
+
onCameraTamperingDetected: props.onCameraTamperingDetected,
|
|
13921
|
+
onMicrophoneAccessDenied: props.onMicrophoneAccessDenied,
|
|
13922
|
+
classNames: (_a = props.classNames) === null || _a === void 0 ? void 0 : _a.cameraStoreProvider,
|
|
13923
|
+
verbiage: (_b = props.verbiage) === null || _b === void 0 ? void 0 : _b.cameraStoreProvider
|
|
13804
13924
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
13805
13925
|
autoStart: false,
|
|
13806
13926
|
throttleMs: 250,
|
|
@@ -14639,6 +14759,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14639
14759
|
onUserCancel = _a.onUserCancel,
|
|
14640
14760
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
14641
14761
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
14762
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
14642
14763
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
14643
14764
|
_l = _a.idCaptureProps,
|
|
14644
14765
|
idCaptureProps = _l === void 0 ? {} : _l,
|
|
@@ -14797,7 +14918,10 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14797
14918
|
maxVideoWidth: isCapturingId ? 1920 : 1280,
|
|
14798
14919
|
maxFps: isCapturingId ? 60 : 30,
|
|
14799
14920
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
14800
|
-
|
|
14921
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
14922
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
14923
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
14924
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
14801
14925
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
14802
14926
|
autoStart: false,
|
|
14803
14927
|
documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
|
|
@@ -14908,35 +15032,36 @@ var VideoIdWizard = function VideoIdWizard(_a) {
|
|
|
14908
15032
|
};
|
|
14909
15033
|
|
|
14910
15034
|
function CompositeWizard(_a) {
|
|
14911
|
-
var _b, _c, _d, _e, _f;
|
|
15035
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
14912
15036
|
var userChecks = _a.checks,
|
|
14913
|
-
|
|
14914
|
-
idCaptureProps =
|
|
14915
|
-
|
|
14916
|
-
faceLivenessProps =
|
|
15037
|
+
_l = _a.idCaptureProps,
|
|
15038
|
+
idCaptureProps = _l === void 0 ? {} : _l,
|
|
15039
|
+
_m = _a.faceLivenessProps,
|
|
15040
|
+
faceLivenessProps = _m === void 0 ? {} : _m,
|
|
14917
15041
|
additionalDocumentCaptureProps = _a.additionalDocumentCaptureProps,
|
|
14918
|
-
|
|
14919
|
-
signatureCaptureProps =
|
|
14920
|
-
|
|
14921
|
-
videoSignatureCaptureProps =
|
|
14922
|
-
|
|
14923
|
-
videoIdCaptureProps =
|
|
14924
|
-
|
|
14925
|
-
captureSignature =
|
|
14926
|
-
|
|
14927
|
-
captureSignatureVideo =
|
|
15042
|
+
_o = _a.signatureCaptureProps,
|
|
15043
|
+
signatureCaptureProps = _o === void 0 ? {} : _o,
|
|
15044
|
+
_p = _a.videoSignatureCaptureProps,
|
|
15045
|
+
videoSignatureCaptureProps = _p === void 0 ? {} : _p,
|
|
15046
|
+
_q = _a.videoIdCaptureProps,
|
|
15047
|
+
videoIdCaptureProps = _q === void 0 ? {} : _q,
|
|
15048
|
+
_r = _a.captureSignature,
|
|
15049
|
+
captureSignature = _r === void 0 ? false : _r,
|
|
15050
|
+
_s = _a.captureSignatureVideo,
|
|
15051
|
+
captureSignatureVideo = _s === void 0 ? false : _s,
|
|
14928
15052
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15053
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
14929
15054
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
14930
|
-
|
|
14931
|
-
debugMode =
|
|
14932
|
-
var
|
|
14933
|
-
submit =
|
|
14934
|
-
submissionStatus =
|
|
14935
|
-
setSignatureData =
|
|
14936
|
-
setAdditionalDocuments =
|
|
14937
|
-
var
|
|
14938
|
-
checkIndex =
|
|
14939
|
-
setCheckIndex =
|
|
15055
|
+
_t = _a.debugMode,
|
|
15056
|
+
debugMode = _t === void 0 ? false : _t;
|
|
15057
|
+
var _u = React.useContext(SubmissionContext),
|
|
15058
|
+
submit = _u.submit,
|
|
15059
|
+
submissionStatus = _u.submissionStatus,
|
|
15060
|
+
setSignatureData = _u.setSignatureData,
|
|
15061
|
+
setAdditionalDocuments = _u.setAdditionalDocuments;
|
|
15062
|
+
var _v = React.useState(0),
|
|
15063
|
+
checkIndex = _v[0],
|
|
15064
|
+
setCheckIndex = _v[1];
|
|
14940
15065
|
var checks = React.useMemo(function () {
|
|
14941
15066
|
var _a, _b;
|
|
14942
15067
|
var checks = __spreadArray([], userChecks, true);
|
|
@@ -15047,13 +15172,16 @@ function CompositeWizard(_a) {
|
|
|
15047
15172
|
case 'IdCapture':
|
|
15048
15173
|
return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
15049
15174
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15175
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15050
15176
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
15051
|
-
requestAccessAutomatically: shouldLoadIdCaptureModels
|
|
15177
|
+
requestAccessAutomatically: shouldLoadIdCaptureModels,
|
|
15178
|
+
classNames: (_c = idCaptureProps.classNames) === null || _c === void 0 ? void 0 : _c.cameraStoreProvider,
|
|
15179
|
+
verbiage: (_d = idCaptureProps.verbiage) === null || _d === void 0 ? void 0 : _d.cameraStoreProvider
|
|
15052
15180
|
}, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
|
|
15053
15181
|
autoStart: false,
|
|
15054
15182
|
shouldLoadModels: shouldLoadIdCaptureModels,
|
|
15055
|
-
documentDetectionModelUrl: (
|
|
15056
|
-
focusModelUrl: (
|
|
15183
|
+
documentDetectionModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.documentDetectionModelUrl) !== null && _f !== void 0 ? _f : '',
|
|
15184
|
+
focusModelUrl: (_h = (_g = idCaptureProps.assets) === null || _g === void 0 ? void 0 : _g.focusModelUrl) !== null && _h !== void 0 ? _h : '',
|
|
15057
15185
|
onModelError: idCaptureProps.onModelError,
|
|
15058
15186
|
modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
|
|
15059
15187
|
allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
|
|
@@ -15064,6 +15192,7 @@ function CompositeWizard(_a) {
|
|
|
15064
15192
|
return /*#__PURE__*/React__namespace.default.createElement(VideoIdWizard, _assign({}, videoIdCaptureProps, {
|
|
15065
15193
|
onComplete: onVideoIdCaptureComplete,
|
|
15066
15194
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15195
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15067
15196
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15068
15197
|
}));
|
|
15069
15198
|
case 'FaceLiveness':
|
|
@@ -15071,7 +15200,10 @@ function CompositeWizard(_a) {
|
|
|
15071
15200
|
preferFrontFacingCamera: true,
|
|
15072
15201
|
preferIphoneContinuityCamera: false,
|
|
15073
15202
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15074
|
-
|
|
15203
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15204
|
+
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
15205
|
+
classNames: (_j = faceLivenessProps.classNames) === null || _j === void 0 ? void 0 : _j.cameraStoreProvider,
|
|
15206
|
+
verbiage: (_k = faceLivenessProps.verbiage) === null || _k === void 0 ? void 0 : _k.cameraStoreProvider
|
|
15075
15207
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
15076
15208
|
autoStart: false,
|
|
15077
15209
|
onModelError: faceLivenessProps.onModelError,
|
|
@@ -15087,6 +15219,7 @@ function CompositeWizard(_a) {
|
|
|
15087
15219
|
return /*#__PURE__*/React__namespace.default.createElement(VideoSignatureWizardWithProviders, _assign({}, videoSignatureCaptureProps, {
|
|
15088
15220
|
onComplete: onVideoSignatureComplete,
|
|
15089
15221
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15222
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15090
15223
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied
|
|
15091
15224
|
}));
|
|
15092
15225
|
case 'AdditionalDocumentCapture':
|
|
@@ -15416,6 +15549,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
15416
15549
|
onUserCancel = _a.onUserCancel,
|
|
15417
15550
|
onModelError = _a.onModelError,
|
|
15418
15551
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15552
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15419
15553
|
_u = _a.theme,
|
|
15420
15554
|
theme = _u === void 0 ? 'default' : _u,
|
|
15421
15555
|
_v = _a.assets,
|
|
@@ -15557,6 +15691,7 @@ var IdValidation = function IdValidation(_a) {
|
|
|
15557
15691
|
captureSignature: captureSignature,
|
|
15558
15692
|
captureSignatureVideo: captureSignatureVideo,
|
|
15559
15693
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15694
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15560
15695
|
debugMode: debugMode
|
|
15561
15696
|
}))));
|
|
15562
15697
|
};
|
|
@@ -15611,6 +15746,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
15611
15746
|
onUserCancel = _a.onUserCancel,
|
|
15612
15747
|
onModelError = _a.onModelError,
|
|
15613
15748
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15749
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15614
15750
|
_j = _a.theme,
|
|
15615
15751
|
theme = _j === void 0 ? 'default' : _j,
|
|
15616
15752
|
assets = _a.assets,
|
|
@@ -15686,6 +15822,7 @@ var FaceValidation = function FaceValidation(_a) {
|
|
|
15686
15822
|
}, []),
|
|
15687
15823
|
faceLivenessProps: faceLivenessProps,
|
|
15688
15824
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
15825
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15689
15826
|
debugMode: debugMode
|
|
15690
15827
|
}))));
|
|
15691
15828
|
};
|
|
@@ -15782,6 +15919,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
15782
15919
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
15783
15920
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
15784
15921
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
15922
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
15785
15923
|
_y = _a.captureSignature,
|
|
15786
15924
|
captureSignature = _y === void 0 ? false : _y,
|
|
15787
15925
|
_z = _a.captureSignatureVideo,
|
|
@@ -15945,6 +16083,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
|
|
|
15945
16083
|
captureSignature: captureSignature,
|
|
15946
16084
|
captureSignatureVideo: captureSignatureVideo,
|
|
15947
16085
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
16086
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
15948
16087
|
debugMode: debugMode
|
|
15949
16088
|
}))));
|
|
15950
16089
|
};
|
|
@@ -16044,6 +16183,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
16044
16183
|
onIdCaptureModelError = _a.onIdCaptureModelError,
|
|
16045
16184
|
onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
|
|
16046
16185
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
16186
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
16047
16187
|
_y = _a.captureSignature,
|
|
16048
16188
|
captureSignature = _y === void 0 ? false : _y,
|
|
16049
16189
|
_z = _a.captureSignatureVideo,
|
|
@@ -16229,6 +16369,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
|
|
|
16229
16369
|
captureSignature: captureSignature,
|
|
16230
16370
|
captureSignatureVideo: captureSignatureVideo,
|
|
16231
16371
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
16372
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
16232
16373
|
debugMode: debugMode
|
|
16233
16374
|
}))));
|
|
16234
16375
|
};
|
|
@@ -16738,6 +16879,7 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
16738
16879
|
onUserCancel = _a.onUserCancel,
|
|
16739
16880
|
onModelError = _a.onModelError,
|
|
16740
16881
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
16882
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
16741
16883
|
_h = _a.geolocationEnabled,
|
|
16742
16884
|
geolocationEnabled = _h === void 0 ? true : _h,
|
|
16743
16885
|
_j = _a.geolocationRequired,
|
|
@@ -16779,7 +16921,10 @@ var CustomerVerification = function CustomerVerification(_a) {
|
|
|
16779
16921
|
useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
|
|
16780
16922
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
16781
16923
|
preferFrontFacingCamera: true,
|
|
16782
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
16924
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
16925
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
16926
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
16927
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
16783
16928
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
16784
16929
|
autoStart: false,
|
|
16785
16930
|
onModelError: onModelError,
|
|
@@ -17299,6 +17444,7 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
17299
17444
|
onUserCancel = _a.onUserCancel,
|
|
17300
17445
|
onModelError = _a.onModelError,
|
|
17301
17446
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17447
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17302
17448
|
_g = _a.theme,
|
|
17303
17449
|
theme = _g === void 0 ? 'default' : _g,
|
|
17304
17450
|
assets = _a.assets,
|
|
@@ -17344,7 +17490,10 @@ var CustomerIdentification = function CustomerIdentification(_a) {
|
|
|
17344
17490
|
useDocumentServiceForLivenessChecks: useDocumentServiceForLivenessChecks
|
|
17345
17491
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
17346
17492
|
preferFrontFacingCamera: true,
|
|
17347
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
17493
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
17494
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17495
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
17496
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
17348
17497
|
}, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
|
|
17349
17498
|
autoStart: false,
|
|
17350
17499
|
modelLoadTimeoutMs: modelLoadTimeoutMs,
|
|
@@ -17392,6 +17541,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
17392
17541
|
onUserCancel = _a.onUserCancel,
|
|
17393
17542
|
onModelError = _a.onModelError,
|
|
17394
17543
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17544
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17395
17545
|
onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
|
|
17396
17546
|
_c = _a.loadingOverlayMode,
|
|
17397
17547
|
loadingOverlayMode = _c === void 0 ? 'default' : _c,
|
|
@@ -17450,6 +17600,7 @@ var SignatureKYC = function SignatureKYC(_a) {
|
|
|
17450
17600
|
return ['VideoSignatureCapture'];
|
|
17451
17601
|
}, []),
|
|
17452
17602
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
17603
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17453
17604
|
videoSignatureCaptureProps: React.useMemo(function () {
|
|
17454
17605
|
return {
|
|
17455
17606
|
customOverlayContent: customOverlayContent,
|
|
@@ -17518,6 +17669,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
17518
17669
|
onExitAfterFailure = _a.onExitAfterFailure,
|
|
17519
17670
|
onUserCancel = _a.onUserCancel,
|
|
17520
17671
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17672
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17521
17673
|
onMicrophoneAccessDenied = _a.onMicrophoneAccessDenied,
|
|
17522
17674
|
idCaptureProps = _a.idCaptureProps,
|
|
17523
17675
|
faceLivenessProps = _a.faceLivenessProps,
|
|
@@ -17701,6 +17853,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
|
|
|
17701
17853
|
captureSignature: captureSignature,
|
|
17702
17854
|
captureSignatureVideo: captureSignatureVideo,
|
|
17703
17855
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
17856
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17704
17857
|
onMicrophoneAccessDenied: onMicrophoneAccessDenied,
|
|
17705
17858
|
debugMode: debugMode
|
|
17706
17859
|
}))));
|
|
@@ -17756,6 +17909,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
17756
17909
|
onUserCancel = _a.onUserCancel,
|
|
17757
17910
|
onModelError = _a.onModelError,
|
|
17758
17911
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
17912
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17759
17913
|
_h = _a.captureAdditionalDocuments,
|
|
17760
17914
|
captureAdditionalDocuments = _h === void 0 ? [] : _h,
|
|
17761
17915
|
_j = _a.captureSignature,
|
|
@@ -17877,6 +18031,7 @@ var CustomerBiometricsEnrollment = function CustomerBiometricsEnrollment(_a) {
|
|
|
17877
18031
|
captureSignature: captureSignature,
|
|
17878
18032
|
captureSignatureVideo: captureSignatureVideo,
|
|
17879
18033
|
onCameraAccessDenied: onCameraAccessDenied,
|
|
18034
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
17880
18035
|
debugMode: debugMode
|
|
17881
18036
|
}))));
|
|
17882
18037
|
};
|
|
@@ -17904,6 +18059,7 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
17904
18059
|
onExitCapture = _a.onExitCapture,
|
|
17905
18060
|
onUserCancel = _a.onUserCancel,
|
|
17906
18061
|
onCameraAccessDenied = _a.onCameraAccessDenied,
|
|
18062
|
+
onCameraTamperingDetected = _a.onCameraTamperingDetected,
|
|
17907
18063
|
_c = _a.documents,
|
|
17908
18064
|
documents = _c === void 0 ? [] : _c,
|
|
17909
18065
|
aspectRatio = _a.aspectRatio,
|
|
@@ -17946,7 +18102,10 @@ var DocumentCapture = function DocumentCapture(_a) {
|
|
|
17946
18102
|
}, /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
|
|
17947
18103
|
requestAccessAutomatically: false,
|
|
17948
18104
|
preferIphoneContinuityCamera: true,
|
|
17949
|
-
onCameraAccessDenied: onCameraAccessDenied
|
|
18105
|
+
onCameraAccessDenied: onCameraAccessDenied,
|
|
18106
|
+
onCameraTamperingDetected: onCameraTamperingDetected,
|
|
18107
|
+
classNames: classNames === null || classNames === void 0 ? void 0 : classNames.cameraStoreProvider,
|
|
18108
|
+
verbiage: verbiage === null || verbiage === void 0 ? void 0 : verbiage.cameraStoreProvider
|
|
17950
18109
|
}, /*#__PURE__*/React__namespace.default.createElement(DocumentCaptureWizard, {
|
|
17951
18110
|
onSuccess: onComplete,
|
|
17952
18111
|
onExitCapture: onExitCapture,
|