@incodetech/core 0.0.0-dev-20260729-9e7b030a → 0.0.0-dev-20260729-a31df3b7
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/{FaceDetectionProvider-BHweGBEM.d.ts → FaceDetectionProvider-Mh6q3EbA.d.ts} +1 -2
- package/dist/IIdCaptureCapability-Cj_aceph.d.ts +231 -0
- package/dist/{IStorageCapability-B8IGxCwe.d.ts → IStorageCapability-ORkQfK3F.d.ts} +112 -1
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-CzR7Y6Ua.esm.js → apiError-CS9ZMDr2.esm.js} +1 -1
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-CmkHvt7_.esm.js → authenticationManager-Cd4tefr2.esm.js} +2 -2
- package/dist/{authenticationManager-BGM8bpD0.d.ts → authenticationManager-Y2_MuGXy.d.ts} +1 -1
- package/dist/{authenticationStateMachine-O3acuOqq.esm.js → authenticationStateMachine-BnH1mizY.esm.js} +2 -2
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-uhDPdU6i.d.ts → consentManager-5HWbGwOa.d.ts} +9 -9
- package/dist/{deepsightLoader-CaUpu0Dy.esm.js → deepsightLoader-CN4B5ugn.esm.js} +3 -3
- package/dist/{deepsightService-CR-CYdka.d.ts → deepsightService-DLVQS_RH.d.ts} +2 -112
- package/dist/document-capture.d.ts +1 -1
- package/dist/document-upload.d.ts +4 -4
- package/dist/{documentCaptureManager-pEqMY_Oo.d.ts → documentCaptureManager-DeSYkGWc.d.ts} +70 -70
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-BxUgij0L.esm.js → dynamicFormsManager-B80PGYEF.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-D0cEsDMH.esm.js → dynamicFormsStateMachine-B7R09HRI.esm.js} +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-LicVPYug.esm.js → ekybManager-Cg_boKM5.esm.js} +1 -1
- package/dist/{ekybStateMachine-IgLa1nXx.esm.js → ekybStateMachine-CAXjJ2gA.esm.js} +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-DqPJCXMG.esm.js → electronicSignatureManager-JuycNykG.esm.js} +1 -1
- package/dist/extensibility.d.ts +14 -14
- package/dist/extensibility.esm.js +8 -8
- package/dist/{faceCaptureManagerFactory-2W_XduCs.esm.js → faceCaptureManagerFactory-Cd1uQnGS.esm.js} +1 -1
- package/dist/{faceCaptureManagerFactory-B92LFT16.d.ts → faceCaptureManagerFactory-K8iLKaRl.d.ts} +5 -4
- package/dist/{faceCaptureSetup-D-9s0vUS.esm.js → faceCaptureSetup-CS7exiIh.esm.js} +3 -2
- package/dist/flow.d.ts +5 -5
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-D_DJ1dNA.esm.js → flowCompletionService-C77_-GvG.esm.js} +1 -1
- package/dist/{flowServices-ZgW3UGcz.esm.js → flowServices-BuSZYjB9.esm.js} +3 -3
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-oLdeMbdy.esm.js → geolocationManager-D2ptN5BO.esm.js} +1 -1
- package/dist/{geolocationStateMachine-CSDKlrHE.esm.js → geolocationStateMachine-fOQUnMxw.esm.js} +1 -1
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-selfie-flow.d.ts +179 -0
- package/dist/id-selfie-flow.esm.js +917 -0
- package/dist/id.d.ts +3 -2
- package/dist/id.esm.js +3 -2
- package/dist/{idCaptureManager-DAsfVDWq.esm.js → idCaptureManager-BokR8KKO.esm.js} +2 -1
- package/dist/{idCaptureManager-B2w2CGuV.d.ts → idCaptureManager-wKz4MXR8.d.ts} +10 -2
- package/dist/idCaptureServices-C3nAZ64o.esm.js +353 -0
- package/dist/{idCaptureStateMachine-BMZCf9M7.esm.js → idCaptureStateMachine-CM8EP_MM.esm.js} +38 -374
- package/dist/{idOcrManager-DXc_xRN7.d.ts → idOcrManager-dLuxey6y.d.ts} +1 -1
- package/dist/identity-reuse.d.ts +1 -1
- package/dist/{identityReuseManager-v2TH5g7e.d.ts → identityReuseManager-D6pD4hcZ.d.ts} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/{mandatoryConsentManager-DOZSFZA2.d.ts → mandatoryConsentManager-DXlHM88Z.d.ts} +6 -6
- package/dist/manualReviewService-BnFXpAg9.esm.js +15 -0
- package/dist/{onDeviceFaceResults-D8FzOXsM.esm.js → onDeviceFaceResults-DFEU5wcC.esm.js} +3 -3
- package/dist/personhood.d.ts +4 -4
- package/dist/personhood.esm.js +3 -3
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{recordingService-D6Hbc408.esm.js → recordingService-BwaHFQSV.esm.js} +2 -16
- package/dist/redirect-to-mobile.d.ts +2 -2
- package/dist/{redirectToMobileManager-BiVH2Ymm.d.ts → redirectToMobileManager-BD2PvT5B.d.ts} +1 -1
- package/dist/{runChildModule-CVKUUVl2.esm.js → runChildModule-1jsZfyb9.esm.js} +1 -1
- package/dist/selfie.d.ts +4 -4
- package/dist/selfie.esm.js +4 -4
- package/dist/{selfieManager-Cnw55Hp_.esm.js → selfieManager-hwv10r0j.esm.js} +2 -2
- package/dist/{selfieManager-CxeMb2tM.d.ts → selfieManager-tMxWiUk6.d.ts} +1 -1
- package/dist/{selfieStateMachine-D-wolitw.esm.js → selfieStateMachine-Cwb5y4OR.esm.js} +2 -2
- package/dist/{session-XugVyrIq.esm.js → session-DWfXLkyx.esm.js} +4 -4
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-B3g2uAsl.esm.js → sessionInitializer-B58TmxdW.esm.js} +2 -2
- package/dist/{setup-BVuwm-QH.esm.js → setup-sxUVsl_J.esm.js} +4 -4
- package/dist/trueSight-D7YiTge6.esm.js +1 -0
- package/dist/{trueSightService-DGkNMx-E.esm.js → trueSightService-BIbE2pK1.esm.js} +1 -1
- package/dist/{types-4-pU2Nhm.d.ts → types-BsTkSXlg2.d.ts} +13 -232
- package/dist/{types-CrUhpMDP.d.ts → types-EELWyWpd.d.ts} +1 -1
- package/dist/{types-BBQjIaK4.d.ts → types-Hmd7U0JA.d.ts} +1 -1
- package/dist/video-selfie.d.ts +8 -100
- package/dist/video-selfie.esm.js +17 -608
- package/dist/videoSelfieCameraWarmer-lG-12ONu.esm.js +614 -0
- package/dist/videoSelfieStepDetector-144x423X.d.ts +117 -0
- package/dist/wasm.esm.js +1 -1
- package/dist/workflow.d.ts +1 -1
- package/dist/workflow.esm.js +14 -14
- package/package.json +8 -3
- package/dist/trueSight-DWfPmAL_.esm.js +0 -1
- /package/dist/{types-BX_XkMsQ.d.ts → types-BX_XkMsQ2.d.ts} +0 -0
- /package/dist/{types-BfgmV7s72.d.ts → types-BfgmV7s7.d.ts} +0 -0
- /package/dist/{types-DPIDuhut2.d.ts → types-DPIDuhut.d.ts} +0 -0
package/dist/id.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { t as IVisibilityObserverCapability } from "./IVisibilityObserverCapability-D4tvIB5v.js";
|
|
2
2
|
import { t as CameraStream } from "./camera-9wWD-pwg.js";
|
|
3
3
|
import { n as PermissionStatus, t as PermissionResult } from "./types-BT-aiBYV.js";
|
|
4
|
-
import {
|
|
5
|
-
import { A as
|
|
4
|
+
import { r as IdCaptureSettings, t as DetectionOrientation } from "./IIdCaptureCapability-Cj_aceph.js";
|
|
5
|
+
import { A as ManualUploadSide, C as RecordingSession, D as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, E as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, O as MANUAL_UPLOAD_MAX_RETRIES, S as IdFlowStep, _ as IdCaptureThresholds, a as DetectionArea, b as IdError, c as IdCaptureConfig, d as IdCaptureEvent, f as IdCaptureGeometry, g as IdCaptureOutput, h as IdCaptureOnlyConfig, i as CapturedImage, j as ManualUploadTab, k as ManualUploadContext, l as IdCaptureContext, m as IdCaptureMode, n as CaptureIdResponse, o as DetectionStatus, p as IdCaptureInput, r as CaptureOnlyResponse, s as ID_ERROR_CODES, t as AddBarcodeV3Response, u as IdCaptureDependencies, v as IdCapturedImageData, w as UploadIdResponse, x as IdErrorCode, y as IdDocumentType } from "./types-BsTkSXlg2.js";
|
|
6
|
+
import { A as createIdCaptureActor, C as CreateIdCaptureOnlyActorOptions, D as idCaptureOnlyMachine, E as IdCaptureOnlyMachine, M as idCaptureMachine, O as CreateIdCaptureActorOptions, S as validateUploadResponse, T as createIdCaptureOnlyActor, _ as startRecordingSession, a as AddBarcodeParams, b as uploadIdImage, c as StartRecordingParams, d as ValidationError, f as addBarcode, g as processId, h as preloadIdRecordingProvider, j as IdCaptureMachine, k as IdCaptureActor, l as UploadIdImageParams, m as initializeIdCapture, n as IdCaptureManager, o as IdCaptureInitResult, p as barcodeToBase64, r as IdCaptureState, s as InitializeIdCaptureParams, t as createIdCaptureManager, u as UploadManualIdFileParams, v as stopRecording, w as IdCaptureOnlyActor, x as uploadManualIdFile, y as stopStream } from "./idCaptureManager-wKz4MXR8.js";
|
|
6
7
|
//#region src/modules/id/idCaptureOnlyManager.d.ts
|
|
7
8
|
type IdCaptureOnlyManager = IdCaptureManager;
|
|
8
9
|
/**
|
package/dist/id.esm.js
CHANGED
|
@@ -2,8 +2,9 @@ import { t as BrowserStorageProvider } from "./BrowserStorageProvider-P6aUarE9.e
|
|
|
2
2
|
import { n as eventModuleNames } from "./events-ethtfu2b.esm.js";
|
|
3
3
|
import { o as createActor, r as assign } from "./xstate.esm-Cf4e0Cfd.esm.js";
|
|
4
4
|
import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
|
|
5
|
-
import {
|
|
6
|
-
import { n as createIdCaptureActor, r as createIdCaptureManagerFromActor, t as createIdCaptureManager } from "./idCaptureManager-
|
|
5
|
+
import { a as MANUAL_UPLOAD_MAX_RETRIES, i as MANUAL_UPLOAD_MAX_FILE_SIZE_BYTES, r as MANUAL_UPLOAD_EXHAUSTION_FORWARD_MS, t as idCaptureMachine } from "./idCaptureStateMachine-CM8EP_MM.esm.js";
|
|
6
|
+
import { n as createIdCaptureActor, r as createIdCaptureManagerFromActor, t as createIdCaptureManager } from "./idCaptureManager-BokR8KKO.esm.js";
|
|
7
|
+
import { a as processId, c as stopStream, d as validateUploadResponse, f as ID_ERROR_CODES, i as preloadIdRecordingProvider, l as uploadIdImage, n as barcodeToBase64, o as startRecordingSession, r as initializeIdCapture, s as stopRecording, t as addBarcode, u as uploadManualIdFile } from "./idCaptureServices-C3nAZ64o.esm.js";
|
|
7
8
|
import { t as invokeOnCaptureCallback } from "./invokeOnCaptureCallback-DVtdZdpI.esm.js";
|
|
8
9
|
//#region src/modules/id/idCaptureOnlyStateMachine.ts
|
|
9
10
|
function buildSubImage(canvas) {
|
|
@@ -4,7 +4,7 @@ import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
|
4
4
|
import { c as createManager, o as createActor } from "./xstate.esm-Cf4e0Cfd.esm.js";
|
|
5
5
|
import { n as setWasmDsFlagSync, t as BrowserVisibilityObserverProvider } from "./BrowserVisibilityObserverProvider-sJclps4C.esm.js";
|
|
6
6
|
import { o as resetWasmMotionPrimedForModule, r as primeMotionFromUserGestureIfNeeded } from "./permissionServices-GFikEK6S.esm.js";
|
|
7
|
-
import { n as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-
|
|
7
|
+
import { n as getManualUploadTabs, t as idCaptureMachine } from "./idCaptureStateMachine-CM8EP_MM.esm.js";
|
|
8
8
|
//#region src/modules/id/digitalUpload/instrumentation.ts
|
|
9
9
|
const TERMINAL_REASONS = /* @__PURE__ */ new Set(["DIGITAL_ID_REQUESTED_BUT_OTHER_PROVIDED", "ID_TYPE_UNACCEPTABLE"]);
|
|
10
10
|
function isHoldingState(value) {
|
|
@@ -219,6 +219,7 @@ function mapCaptureState(snapshot, context) {
|
|
|
219
219
|
orientation: context.orientation,
|
|
220
220
|
idType: context.idType,
|
|
221
221
|
previewImageUrl: context.previewImageUrl,
|
|
222
|
+
barcodeFastPathCaptured: context.barcodeFastPathCaptured,
|
|
222
223
|
uploadProgress: context.uploadProgress ?? 0,
|
|
223
224
|
ageAssurance: context.config.ageAssurance === true,
|
|
224
225
|
uploadErrorMessage: uploadError ? getErrorTitleKey(uploadError, context.currentMode) : void 0,
|
|
@@ -5,10 +5,11 @@ import "./Actor-iTq7YY48.js";
|
|
|
5
5
|
import { t as IVisibilityObserverCapability } from "./IVisibilityObserverCapability-D4tvIB5v.js";
|
|
6
6
|
import "./index-B8weJxmL.js";
|
|
7
7
|
import { t as CameraStream } from "./camera-9wWD-pwg.js";
|
|
8
|
-
import { t as DeepsightService } from "./deepsightService-CR-CYdka.js";
|
|
9
8
|
import { a as RegulationTypes } from "./types-KPvmag_B.js";
|
|
10
9
|
import { n as PermissionStatus } from "./types-BT-aiBYV.js";
|
|
11
|
-
import {
|
|
10
|
+
import { t as DeepsightService } from "./deepsightService-DLVQS_RH.js";
|
|
11
|
+
import { i as Pdf417DecodeResult, n as IIdCaptureCapability, t as DetectionOrientation } from "./IIdCaptureCapability-Cj_aceph.js";
|
|
12
|
+
import { A as ManualUploadSide, C as RecordingSession, T as IAnalyticsCapability, a as DetectionArea, c as IdCaptureConfig, d as IdCaptureEvent, g as IdCaptureOutput, h as IdCaptureOnlyConfig, j as ManualUploadTab, l as IdCaptureContext, m as IdCaptureMode, n as CaptureIdResponse, o as DetectionStatus, p as IdCaptureInput, t as AddBarcodeV3Response, u as IdCaptureDependencies, w as UploadIdResponse, x as IdErrorCode, y as IdDocumentType } from "./types-BsTkSXlg2.js";
|
|
12
13
|
//#region src/modules/id/idCaptureStateMachine.d.ts
|
|
13
14
|
declare const idCaptureMachine: AnyStateMachine;
|
|
14
15
|
type IdCaptureMachine = StateMachine<IdCaptureContext, IdCaptureEvent, any, any, any, any, any, any, any, IdCaptureInput, any, any, any, any>;
|
|
@@ -205,6 +206,13 @@ type IdCaptureCaptureState = {
|
|
|
205
206
|
orientation: DetectionOrientation | undefined;
|
|
206
207
|
idType: string | undefined;
|
|
207
208
|
previewImageUrl?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Barcode fast-path success — render the checkmark "Successfully processed!"
|
|
211
|
+
* screen with NO captured image (the grabbed frame is a backend signal only;
|
|
212
|
+
* `previewImageUrl` is cleared for this path). See the "after barcode capture
|
|
213
|
+
* (no image)" design.
|
|
214
|
+
*/
|
|
215
|
+
barcodeFastPathCaptured: boolean;
|
|
208
216
|
uploadProgress?: number;
|
|
209
217
|
ageAssurance: boolean;
|
|
210
218
|
uploadErrorMessage?: string;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { t as api } from "./api-Bx3gKW_y.esm.js";
|
|
2
|
+
import { t as endpoints } from "./endpoints-DOfmJylF.esm.js";
|
|
3
|
+
import { n as isDesktop } from "./platform-Cd_yWGNG.esm.js";
|
|
4
|
+
import { h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-DFEU5wcC.esm.js";
|
|
5
|
+
import { n as getBackCameraStream } from "./backCameraStream-BqiXcU28.esm.js";
|
|
6
|
+
import { t as getDeviceClass } from "./getDeviceClass-BGmoQmjj.esm.js";
|
|
7
|
+
import { n as preloadOpenViduProvider } from "./recordingService-BwaHFQSV.esm.js";
|
|
8
|
+
import { r as IdCaptureProvider } from "./idCaptureDefaults-BDS43fFL.esm.js";
|
|
9
|
+
//#region src/modules/id/idCameraStream.ts
|
|
10
|
+
async function getIdCameraStream(deviceId) {
|
|
11
|
+
return getBackCameraStream(deviceId);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/modules/id/types.ts
|
|
15
|
+
const ID_ERROR_CODES = {
|
|
16
|
+
UPLOAD_ERROR: "UPLOAD_ERROR",
|
|
17
|
+
CLASSIFICATION_FAILED: "CLASSIFICATION_FAILED",
|
|
18
|
+
LOW_SHARPNESS: "LOW_SHARPNESS",
|
|
19
|
+
GLARE_DETECTED: "GLARE_DETECTED",
|
|
20
|
+
WRONG_DOCUMENT_SIDE: "WRONG_DOCUMENT_SIDE",
|
|
21
|
+
ID_TYPE_UNACCEPTABLE: "ID_TYPE_UNACCEPTABLE",
|
|
22
|
+
READABILITY_ISSUE: "READABILITY_ISSUE",
|
|
23
|
+
RETRY_EXHAUSTED_CONTINUE_TO_BACK: "RETRY_EXHAUSTED_CONTINUE_TO_BACK",
|
|
24
|
+
RETRY_EXHAUSTED_SKIP_BACK: "RETRY_EXHAUSTED_SKIP_BACK",
|
|
25
|
+
NO_MORE_TRIES: "NO_MORE_TRIES",
|
|
26
|
+
UNEXPECTED_ERROR: "UNEXPECTED_ERROR",
|
|
27
|
+
NO_TOKEN: "NO_TOKEN",
|
|
28
|
+
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
29
|
+
USER_CANCELLED: "USER_CANCELLED",
|
|
30
|
+
SERVER: "SERVER_ERROR"
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/modules/id/idCaptureServices.ts
|
|
34
|
+
/**
|
|
35
|
+
* Camera constraints used for PRC warmup before ID capture.
|
|
36
|
+
* Uses environment-facing camera on mobile devices (for back camera ID capture)
|
|
37
|
+
* and user-facing camera on desktop.
|
|
38
|
+
*/
|
|
39
|
+
function getPrcCameraConstraints() {
|
|
40
|
+
if (isDesktop()) return { video: {
|
|
41
|
+
facingMode: "user",
|
|
42
|
+
height: { ideal: 480 },
|
|
43
|
+
width: { ideal: 640 }
|
|
44
|
+
} };
|
|
45
|
+
return { video: {
|
|
46
|
+
facingMode: "environment",
|
|
47
|
+
height: { ideal: 720 }
|
|
48
|
+
} };
|
|
49
|
+
}
|
|
50
|
+
function getUploadEndpoint(type, isSecondId) {
|
|
51
|
+
if (isSecondId) return type === "front" ? endpoints.frontSecondId : endpoints.backSecondId;
|
|
52
|
+
return type === "front" ? endpoints.frontId : endpoints.backId;
|
|
53
|
+
}
|
|
54
|
+
const SHARPNESS_THRESHOLD = 10;
|
|
55
|
+
const GLARE_THRESHOLD = 10;
|
|
56
|
+
const DEFAULT_ID_CAPTURE_THRESHOLDS = {
|
|
57
|
+
blurThreshold: .2,
|
|
58
|
+
blurChangeThreshold: .2,
|
|
59
|
+
glareThreshold: .3,
|
|
60
|
+
clsThreshold: .98,
|
|
61
|
+
sideThreshold: .8,
|
|
62
|
+
iouThreshold: .8,
|
|
63
|
+
framesAggregationInterval: 3e3
|
|
64
|
+
};
|
|
65
|
+
const DEFAULT_ID_CAPTURE_SETTINGS = {
|
|
66
|
+
isFixedMask: false,
|
|
67
|
+
isIPhone14OrHigher: false,
|
|
68
|
+
idType: "",
|
|
69
|
+
blurCheckEnabled: false,
|
|
70
|
+
glareCheckEnabled: false,
|
|
71
|
+
faceQualityCheckEnabled: true,
|
|
72
|
+
iouCheckEnabled: true,
|
|
73
|
+
fpsLimitEnabled: false
|
|
74
|
+
};
|
|
75
|
+
async function initializeIdCapture(params) {
|
|
76
|
+
const { config, deepsightService } = params;
|
|
77
|
+
const provider = new IdCaptureProvider();
|
|
78
|
+
await provider.initialize({});
|
|
79
|
+
provider.setThresholds({
|
|
80
|
+
...DEFAULT_ID_CAPTURE_THRESHOLDS,
|
|
81
|
+
...config.thresholds,
|
|
82
|
+
idDetectedTimeout: config.thresholds?.idDetectedTimeout ?? config.deviceIdleTimeout * 1e3,
|
|
83
|
+
autocaptureTimeout: config.thresholds?.autocaptureTimeout ?? config.autoCaptureTimeout * 1e3
|
|
84
|
+
});
|
|
85
|
+
if (config.settings) provider.setSettings({
|
|
86
|
+
...DEFAULT_ID_CAPTURE_SETTINGS,
|
|
87
|
+
...config.settings
|
|
88
|
+
});
|
|
89
|
+
if (deepsightService && !params.stream) try {
|
|
90
|
+
await deepsightService.performPrcCheck({ constraints: getPrcCameraConstraints() });
|
|
91
|
+
} catch {}
|
|
92
|
+
const { stream, fallbackLevel } = params.stream ? {
|
|
93
|
+
stream: params.stream,
|
|
94
|
+
fallbackLevel: params.cameraFallbackLevel
|
|
95
|
+
} : await getIdCameraStream();
|
|
96
|
+
const videoTrack = stream.getVideoTracks()[0];
|
|
97
|
+
let captureResolution;
|
|
98
|
+
if (videoTrack) {
|
|
99
|
+
const settings = videoTrack.getSettings();
|
|
100
|
+
if (typeof settings.width === "number" && typeof settings.height === "number") captureResolution = `${settings.width}x${settings.height}`;
|
|
101
|
+
}
|
|
102
|
+
if (deepsightService && videoTrack) deepsightService.metadata.updateCameraInfo(videoTrack);
|
|
103
|
+
return {
|
|
104
|
+
stream,
|
|
105
|
+
provider,
|
|
106
|
+
captureResolution,
|
|
107
|
+
cameraFallbackLevel: fallbackLevel
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function stopStream(stream) {
|
|
111
|
+
for (const track of stream.getTracks()) track.stop();
|
|
112
|
+
}
|
|
113
|
+
function validateUploadResponse(response, sessionState) {
|
|
114
|
+
if (response.failReason === "ID_TYPE_UNACCEPTABLE") return {
|
|
115
|
+
error: true,
|
|
116
|
+
message: "ID type is not acceptable",
|
|
117
|
+
messageDescription: "Please use a valid ID type",
|
|
118
|
+
errorKey: ID_ERROR_CODES.ID_TYPE_UNACCEPTABLE
|
|
119
|
+
};
|
|
120
|
+
if (response.failReason === "WRONG_DOCUMENT_SIDE") return {
|
|
121
|
+
error: true,
|
|
122
|
+
message: "Wrong side of document",
|
|
123
|
+
messageDescription: response.side === "back" ? "Please show the back side of your ID" : "Please show the front side of your ID",
|
|
124
|
+
errorKey: ID_ERROR_CODES.WRONG_DOCUMENT_SIDE
|
|
125
|
+
};
|
|
126
|
+
if (!response.classification) return {
|
|
127
|
+
error: true,
|
|
128
|
+
message: "ID classification failed",
|
|
129
|
+
errorKey: ID_ERROR_CODES.CLASSIFICATION_FAILED
|
|
130
|
+
};
|
|
131
|
+
const sharpnessThreshold = getDeviceClass() === "desktop" ? -1 : SHARPNESS_THRESHOLD;
|
|
132
|
+
if (response.sharpness !== void 0 && sharpnessThreshold >= 0 && response.sharpness < sharpnessThreshold) return {
|
|
133
|
+
error: true,
|
|
134
|
+
message: "Image is not sharp enough",
|
|
135
|
+
messageDescription: "Please ensure the image is clear and well-focused",
|
|
136
|
+
errorKey: ID_ERROR_CODES.LOW_SHARPNESS
|
|
137
|
+
};
|
|
138
|
+
if (response.glare !== void 0 && response.glare < GLARE_THRESHOLD && !sessionState?.skipGlareFront && !sessionState?.skipGlareBack) return {
|
|
139
|
+
error: true,
|
|
140
|
+
message: "Glare detected on ID",
|
|
141
|
+
messageDescription: "Please avoid bright reflections on your ID",
|
|
142
|
+
errorKey: ID_ERROR_CODES.GLARE_DETECTED
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
async function getExtraImages(params) {
|
|
146
|
+
const extraImages = params.ageAssurance ? [params.type === "back" ? "croppedBackID" : "croppedFrontID"] : [];
|
|
147
|
+
try {
|
|
148
|
+
const res = await api.post(endpoints.getImages, { images: ["croppedIDFace", ...extraImages] }, { signal: params.signal });
|
|
149
|
+
if (!res.ok) throw new Error(`Failed to get extra images: ${res.status}`);
|
|
150
|
+
return res.data ?? {
|
|
151
|
+
croppedIDFace: "",
|
|
152
|
+
croppedFrontID: "",
|
|
153
|
+
croppedBackID: ""
|
|
154
|
+
};
|
|
155
|
+
} catch {
|
|
156
|
+
return {
|
|
157
|
+
croppedIDFace: "",
|
|
158
|
+
croppedFrontID: "",
|
|
159
|
+
croppedBackID: ""
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const getRealQualityValue = (value) => (1 - value) * 100;
|
|
164
|
+
async function uploadIdImage(params) {
|
|
165
|
+
const { type, image, onProgress, signal, metadata, ageAssurance, glare, sharpness, shouldSkipGlareBack, analyticsProvider, imageData, isSecondId, onlyFront, extractIdFace } = params;
|
|
166
|
+
let finalMetadata = metadata;
|
|
167
|
+
if (analyticsProvider && imageData) try {
|
|
168
|
+
await analyticsProvider.analyzeFrame(imageData);
|
|
169
|
+
analyticsProvider.update();
|
|
170
|
+
finalMetadata = analyticsProvider.getMetadata();
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.warn("[IdCapture] Analytics failed:", error);
|
|
173
|
+
}
|
|
174
|
+
const endpoint = getUploadEndpoint(type, isSecondId);
|
|
175
|
+
const body = {
|
|
176
|
+
base64Image: image,
|
|
177
|
+
metadata: finalMetadata
|
|
178
|
+
};
|
|
179
|
+
const queryParams = { imageType: "id" };
|
|
180
|
+
if (onlyFront && type === "front") queryParams.onlyFront = true;
|
|
181
|
+
if (shouldSkipGlareBack && type === "back") queryParams.glare = 0;
|
|
182
|
+
else if (glare !== void 0) queryParams.glare = getRealQualityValue(glare);
|
|
183
|
+
if (sharpness !== void 0) queryParams.sharpness = getRealQualityValue(sharpness);
|
|
184
|
+
if (extractIdFace === false && type === "front") queryParams.extractIdFace = false;
|
|
185
|
+
try {
|
|
186
|
+
const res = await api.post(endpoint, body, {
|
|
187
|
+
signal,
|
|
188
|
+
query: queryParams,
|
|
189
|
+
onUploadProgress: onProgress
|
|
190
|
+
});
|
|
191
|
+
if (!res.ok) throw new Error(`POST ${endpoint} failed: ${res.status} ${res.statusText}`);
|
|
192
|
+
const response = res.data;
|
|
193
|
+
const extraImages = await getExtraImages({
|
|
194
|
+
type,
|
|
195
|
+
ageAssurance,
|
|
196
|
+
signal
|
|
197
|
+
});
|
|
198
|
+
const fullResponse = {
|
|
199
|
+
...response,
|
|
200
|
+
originalImage: image,
|
|
201
|
+
frontIdImage: type === "front" ? image : void 0,
|
|
202
|
+
backIdImage: extraImages.croppedBackID,
|
|
203
|
+
...extraImages
|
|
204
|
+
};
|
|
205
|
+
onProgress?.(100);
|
|
206
|
+
return fullResponse;
|
|
207
|
+
} catch (error) {
|
|
208
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
209
|
+
throw new Error(`${ID_ERROR_CODES.UPLOAD_ERROR}: ${errorMessage}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function buildStandardResolution(width, height) {
|
|
213
|
+
return height > width ? {
|
|
214
|
+
width: 1080,
|
|
215
|
+
height: 1920
|
|
216
|
+
} : {
|
|
217
|
+
width: 1920,
|
|
218
|
+
height: 1080
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function buildResolutionFromStream(stream) {
|
|
222
|
+
const track = stream.getVideoTracks()[0];
|
|
223
|
+
if (!track) return "1080x1920";
|
|
224
|
+
const settings = track.getSettings();
|
|
225
|
+
const width = settings.width;
|
|
226
|
+
const height = settings.height;
|
|
227
|
+
if (typeof width === "number" && typeof height === "number") {
|
|
228
|
+
const standard = buildStandardResolution(width, height);
|
|
229
|
+
return `${standard.width}x${standard.height}`;
|
|
230
|
+
}
|
|
231
|
+
return "1080x1920";
|
|
232
|
+
}
|
|
233
|
+
function preloadIdRecordingProvider(config) {
|
|
234
|
+
if (config.enableIdRecording !== true) return;
|
|
235
|
+
preloadOpenViduProvider();
|
|
236
|
+
}
|
|
237
|
+
async function createOpenViduRecordingProvider() {
|
|
238
|
+
const { OpenViduRecordingProvider } = await import("./OpenViduRecordingProvider-Du98qevC.esm.js");
|
|
239
|
+
return new OpenViduRecordingProvider();
|
|
240
|
+
}
|
|
241
|
+
async function startRecordingSession(params) {
|
|
242
|
+
if (params.config.enableIdRecording !== true) return;
|
|
243
|
+
if (params.existing) return params.existing;
|
|
244
|
+
const provider = params.config.recording?.capability ?? await createOpenViduRecordingProvider();
|
|
245
|
+
const clonedStream = params.stream.clone();
|
|
246
|
+
const hasAudio = clonedStream.getAudioTracks().length > 0;
|
|
247
|
+
const resolution = buildResolutionFromStream(clonedStream);
|
|
248
|
+
const session = await createRecordingSession(params.type);
|
|
249
|
+
const connection = await provider.connect({
|
|
250
|
+
sessionToken: session.token,
|
|
251
|
+
stream: clonedStream,
|
|
252
|
+
events: {}
|
|
253
|
+
});
|
|
254
|
+
await startRecording({
|
|
255
|
+
videoRecordingId: session.videoRecordingId,
|
|
256
|
+
type: params.type,
|
|
257
|
+
resolution,
|
|
258
|
+
hasAudio
|
|
259
|
+
});
|
|
260
|
+
return {
|
|
261
|
+
token: session.token,
|
|
262
|
+
sessionId: session.sessionId,
|
|
263
|
+
videoRecordingId: session.videoRecordingId,
|
|
264
|
+
connection,
|
|
265
|
+
resolution,
|
|
266
|
+
hasAudio
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function stopRecording(session) {
|
|
270
|
+
(async () => {
|
|
271
|
+
try {
|
|
272
|
+
await stopRecording$1(session.videoRecordingId);
|
|
273
|
+
} finally {
|
|
274
|
+
await session.connection.disconnect();
|
|
275
|
+
}
|
|
276
|
+
})();
|
|
277
|
+
}
|
|
278
|
+
async function processId(isSecondId = false, queueName = "", signal) {
|
|
279
|
+
const endpoint = isSecondId ? endpoints.processSecondId : endpoints.processId;
|
|
280
|
+
const url = queueName ? `${endpoint}?queueName=${queueName}` : endpoint;
|
|
281
|
+
return { isDocumentExpired: (await api.post(url, {}, { signal })).data?.isDocumentExpired ?? false };
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Upload a user-selected image as front / back / passport ID.
|
|
285
|
+
*
|
|
286
|
+
* Uses the same request shape as the live-camera path (`uploadIdImage`):
|
|
287
|
+
* JSON body `{ base64Image }` with default application/json Content-Type,
|
|
288
|
+
* `captureType=UPLOAD` query param, `retry=true` when retrying.
|
|
289
|
+
* Back is POSTed to `/omni/add/back-id/v2` (or `/omni/add/back-second-id/v2`
|
|
290
|
+
* when `isSecondId`); front and passport go to `/omni/add/front-id/v2` (or
|
|
291
|
+
* `/omni/add/front-second-id/v2` when `isSecondId`).
|
|
292
|
+
*
|
|
293
|
+
* The v2 endpoints reject raw `image/jpeg` bodies with 415, so the caller
|
|
294
|
+
* must convert the File to base64 before calling this service.
|
|
295
|
+
*/
|
|
296
|
+
async function uploadManualIdFile(params) {
|
|
297
|
+
const { side, base64Image, retry, onlyFront, signal, isSecondId, extractIdFace } = params;
|
|
298
|
+
const endpoint = getUploadEndpoint(side === "back" ? "back" : "front", isSecondId);
|
|
299
|
+
const queryParams = { captureType: "UPLOAD" };
|
|
300
|
+
if (retry) queryParams.retry = true;
|
|
301
|
+
if (onlyFront && side === "front") queryParams.onlyFront = true;
|
|
302
|
+
if (extractIdFace === false && side !== "back") queryParams.extractIdFace = false;
|
|
303
|
+
const res = await api.post(endpoint, { base64Image }, {
|
|
304
|
+
signal,
|
|
305
|
+
query: queryParams
|
|
306
|
+
});
|
|
307
|
+
if (!res.ok) throw new Error(`POST ${endpoint} failed: ${res.status} ${res.statusText}`);
|
|
308
|
+
return res.data;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* UTF-8-safe base64 encoding of a decoded barcode payload. Uses the browser
|
|
312
|
+
* `TextEncoder` + `btoa` (always available in the SDK's target environment) so
|
|
313
|
+
* non-ASCII payloads survive `btoa`, which only accepts Latin-1.
|
|
314
|
+
*/
|
|
315
|
+
function barcodeToBase64(raw) {
|
|
316
|
+
const bytes = new TextEncoder().encode(raw);
|
|
317
|
+
let binary = "";
|
|
318
|
+
bytes.forEach((byte) => {
|
|
319
|
+
binary += String.fromCharCode(byte);
|
|
320
|
+
});
|
|
321
|
+
return btoa(binary);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* US Smart Capture: submits a decoded PDF417 barcode to
|
|
325
|
+
* `POST /omni/add/barcode/v3`. The response drives the downstream front-capture
|
|
326
|
+
* and Process ID skips (`forceFrontIdCapture` / `idValidationCompleted`).
|
|
327
|
+
* Mirrors SDK 1's `addBarcode`. Throws (carrying `status`/`data`) on a non-OK
|
|
328
|
+
* response so the caller can fall back to a full-frame upload. The
|
|
329
|
+
* hardware-id token is injected by the shared `api` layer, as in `uploadIdImage`.
|
|
330
|
+
*/
|
|
331
|
+
async function addBarcode(params) {
|
|
332
|
+
const { rawBarcode, processId = true, metrics, signal } = params;
|
|
333
|
+
const body = { base64Barcode: barcodeToBase64(rawBarcode) };
|
|
334
|
+
if (metrics) {
|
|
335
|
+
body.pdf417RowNumber = metrics.rowNumber;
|
|
336
|
+
body.pdf417ColumnNumber = metrics.columnNumber;
|
|
337
|
+
body.pdf417CodewordLengthInPixelsMin = metrics.codewordLengthInPixelsMin;
|
|
338
|
+
body.pdf417CodewordLengthInPixelsMax = metrics.codewordLengthInPixelsMax;
|
|
339
|
+
body.pdf417CorrectedErrorsCount = metrics.correctedErrorsCount;
|
|
340
|
+
body.ecLevel = metrics.ecLevel;
|
|
341
|
+
}
|
|
342
|
+
const res = await api.post(endpoints.addBarcode, body, {
|
|
343
|
+
query: { processId },
|
|
344
|
+
signal
|
|
345
|
+
});
|
|
346
|
+
if (!res.ok) throw Object.assign(/* @__PURE__ */ new Error(`POST ${endpoints.addBarcode} failed: ${res.status} ${res.statusText}`), {
|
|
347
|
+
status: res.status,
|
|
348
|
+
data: res.data
|
|
349
|
+
});
|
|
350
|
+
return res.data;
|
|
351
|
+
}
|
|
352
|
+
//#endregion
|
|
353
|
+
export { processId as a, stopStream as c, validateUploadResponse as d, ID_ERROR_CODES as f, preloadIdRecordingProvider as i, uploadIdImage as l, barcodeToBase64 as n, startRecordingSession as o, getIdCameraStream as p, initializeIdCapture as r, stopRecording as s, addBarcode as t, uploadManualIdFile as u };
|