@incodetech/core 0.0.0-dev-20260126-4504c5b
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/Manager-Co-PsiG9.d.ts +19 -0
- package/dist/OpenViduLogger-BLxxXoyF.esm.js +803 -0
- package/dist/OpenViduLogger-DyqID_-7.esm.js +3 -0
- package/dist/api-DfRLAneb.esm.js +53 -0
- package/dist/chunk-V5DOKNPJ.esm.js +49 -0
- package/dist/deepsightLoader-BMT0FSg6.esm.js +24 -0
- package/dist/deepsightService-j5zMt6wf.esm.js +236 -0
- package/dist/email.d.ts +264 -0
- package/dist/email.esm.js +478 -0
- package/dist/endpoints-BUsSVoJV.esm.js +3288 -0
- package/dist/events-B8ZkhAZo.esm.js +285 -0
- package/dist/flow.d.ts +278 -0
- package/dist/flow.esm.js +638 -0
- package/dist/getDeviceClass-DkfbtsIJ.esm.js +41 -0
- package/dist/id-r1mw9zBM.esm.js +1827 -0
- package/dist/id.d.ts +5 -0
- package/dist/id.esm.js +9 -0
- package/dist/index-CJMK8K5u.d.ts +614 -0
- package/dist/index.d.ts +445 -0
- package/dist/index.esm.js +163 -0
- package/dist/lib-CbAibJlt.esm.js +11700 -0
- package/dist/phone.d.ts +292 -0
- package/dist/phone.esm.js +552 -0
- package/dist/selfie.d.ts +592 -0
- package/dist/selfie.esm.js +1221 -0
- package/dist/src-DYtpbFY5.esm.js +2781 -0
- package/dist/stats-DnU4uUFv.esm.js +16 -0
- package/dist/stats.d.ts +12 -0
- package/dist/stats.esm.js +4 -0
- package/dist/streamingEvents-CfEJv3xH.esm.js +96 -0
- package/dist/types-CMR6NkxW.d.ts +359 -0
- package/dist/types-CRVSv38Q.d.ts +344 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { a as CameraStream, n as PermissionStatus, t as PermissionResult } from "./types-CRVSv38Q.js";
|
|
2
|
+
import { A as IdCaptureMode, B as IIdCaptureCapability, C as CaptureIdResponse, D as ID_ERROR_CODES, E as DetectionStatus, F as IdFlowStep, I as RecordingSession, L as UploadIdResponse, M as IdDocumentType, N as IdError, O as IdCaptureConfig, P as IdErrorCode, R as IdCaptureProvider, S as validateUploadResponse, T as DetectionArea, V as IdCaptureSettings, _ as processId, a as IdCaptureActor, b as stopStream, c as IdCaptureEvent, d as idCaptureMachine, f as IdCaptureInitResult, g as initializeIdCapture, h as ValidationError, i as CreateIdCaptureActorOptions, j as IdCaptureThresholds, k as IdCaptureGeometry, l as IdCaptureInput, m as UploadIdImageParams, n as IdCaptureState, o as createIdCaptureActor, p as StartRecordingParams, r as createIdCaptureManager, s as IdCaptureContext, t as IdCaptureManager, u as IdCaptureMachine, v as startRecordingSession, w as CapturedImage, x as uploadIdImage, y as stopRecording, z as DetectionOrientation } from "./index-CJMK8K5u.js";
|
|
3
|
+
import { c as warmupWasm, s as WasmPipeline } from "./types-CMR6NkxW.js";
|
|
4
|
+
import "./Manager-Co-PsiG9.js";
|
|
5
|
+
|
|
6
|
+
//#region ../infra/src/http/types.d.ts
|
|
7
|
+
type CreateApiConfig = {
|
|
8
|
+
apiURL: string;
|
|
9
|
+
customHeaders?: Record<string, string>;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
};
|
|
12
|
+
type RequestConfig = {
|
|
13
|
+
method?: string;
|
|
14
|
+
url: string;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
17
|
+
params?: Record<string, string | number | boolean | undefined>;
|
|
18
|
+
body?: unknown;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
timeout?: number;
|
|
21
|
+
parse?: 'json' | 'text' | 'blob' | 'arrayBuffer' | 'response';
|
|
22
|
+
onUploadProgress?: (progress: number) => void;
|
|
23
|
+
};
|
|
24
|
+
type HttpResponse<T = unknown> = {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
status: number;
|
|
27
|
+
statusText: string;
|
|
28
|
+
url: string;
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
data: T;
|
|
31
|
+
};
|
|
32
|
+
type HttpClient = {
|
|
33
|
+
defaults: {
|
|
34
|
+
baseURL: string;
|
|
35
|
+
headers: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
request<T = unknown>(config: RequestConfig): Promise<HttpResponse<T>>;
|
|
38
|
+
get<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
39
|
+
post<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
40
|
+
put<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
41
|
+
patch<T = unknown>(url: string, body?: unknown, config?: Omit<RequestConfig, 'method' | 'url' | 'body'>): Promise<HttpResponse<T>>;
|
|
42
|
+
delete<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
43
|
+
head<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
44
|
+
options<T = unknown>(url: string, config?: Omit<RequestConfig, 'method' | 'url'>): Promise<HttpResponse<T>>;
|
|
45
|
+
setHeader(name: string, value: string): void;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../infra/src/http/createApi.d.ts
|
|
49
|
+
declare const createApi: (config: CreateApiConfig) => HttpClient;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/internal/device/getBrowser.d.ts
|
|
52
|
+
type Browser = 'chrome' | 'firefox' | 'safari' | 'edge' | 'other';
|
|
53
|
+
declare function getBrowser(): Browser;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/internal/device/getDeviceClass.d.ts
|
|
56
|
+
type DeviceClass = 'ios' | 'android' | 'desktop';
|
|
57
|
+
declare function getDeviceClass(): DeviceClass;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/internal/http/api.d.ts
|
|
60
|
+
type MethodConfig = {
|
|
61
|
+
headers?: Record<string, string>;
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
timeout?: number;
|
|
64
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
65
|
+
onUploadProgress?: (progress: number) => void;
|
|
66
|
+
};
|
|
67
|
+
type ApiClient = {
|
|
68
|
+
get<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
69
|
+
post<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
70
|
+
put<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
71
|
+
patch<T>(url: string, data?: unknown, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
72
|
+
delete<T>(url: string, config?: MethodConfig): Promise<HttpResponse<T>>;
|
|
73
|
+
};
|
|
74
|
+
declare function getApi(): HttpClient;
|
|
75
|
+
declare const api: ApiClient;
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region src/internal/permissions/permissionServices.d.ts
|
|
78
|
+
/**
|
|
79
|
+
* Checks the current camera permission state without prompting the user.
|
|
80
|
+
*/
|
|
81
|
+
declare function checkPermission(): Promise<PermissionResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Requests camera permission by attempting to access the camera, then immediately
|
|
84
|
+
* stops the obtained stream. This function does not keep or return the stream.
|
|
85
|
+
*/
|
|
86
|
+
declare function requestPermission(): Promise<PermissionResult>;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/internal/session/sessionService.d.ts
|
|
89
|
+
type CreateSessionOptions = {
|
|
90
|
+
/** The configuration/flow ID from the Incode dashboard */
|
|
91
|
+
configurationId: string;
|
|
92
|
+
/** External ID to associate with this session */
|
|
93
|
+
externalId?: string;
|
|
94
|
+
/** External customer ID */
|
|
95
|
+
externalCustomerId?: string;
|
|
96
|
+
/** Language for the session (e.g., 'en-US', 'es-MX') */
|
|
97
|
+
language?: string;
|
|
98
|
+
/** Custom fields to attach to the session */
|
|
99
|
+
customFields?: Record<string, unknown>;
|
|
100
|
+
/** UUID for continuing an existing session */
|
|
101
|
+
uuid?: string;
|
|
102
|
+
/** Interview ID for continuing an existing interview */
|
|
103
|
+
interviewId?: string;
|
|
104
|
+
};
|
|
105
|
+
type Session = {
|
|
106
|
+
token: string;
|
|
107
|
+
interviewId: string;
|
|
108
|
+
uuid?: string;
|
|
109
|
+
regulationType?: string;
|
|
110
|
+
showMandatoryConsent?: boolean;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Creates a new onboarding session.
|
|
114
|
+
*
|
|
115
|
+
* @param apiKey - The API key from the Incode dashboard
|
|
116
|
+
* @param options - Session creation options
|
|
117
|
+
* @param signal - Optional AbortSignal for request cancellation
|
|
118
|
+
* @returns The created session with token
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```ts
|
|
122
|
+
* const session = await createSession('your-api-key', {
|
|
123
|
+
* configurationId: 'your-flow-id',
|
|
124
|
+
* language: 'en-US',
|
|
125
|
+
* });
|
|
126
|
+
* console.log(session.token); // Use this token for subsequent API calls
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function createSession(apiKey: string, options: CreateSessionOptions, signal?: AbortSignal): Promise<Session>;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/setup.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* WASM warmup configuration.
|
|
134
|
+
*/
|
|
135
|
+
type WasmConfig = {
|
|
136
|
+
/** Path to the WASM binary */
|
|
137
|
+
wasmPath: string;
|
|
138
|
+
/** Path to the SIMD-optimized WASM binary (optional) */
|
|
139
|
+
wasmSimdPath?: string;
|
|
140
|
+
/** Path to the WASM glue code */
|
|
141
|
+
glueCodePath: string;
|
|
142
|
+
/** Whether to use SIMD optimizations (default: true) */
|
|
143
|
+
useSimd?: boolean;
|
|
144
|
+
/** Which pipelines to preload models for */
|
|
145
|
+
pipelines?: WasmPipeline[];
|
|
146
|
+
/**
|
|
147
|
+
* Base path for ML model files. Models will be loaded from `${modelsBasePath}/${modelFileName}`.
|
|
148
|
+
* If not provided, models are expected in a 'models' subdirectory relative to the WASM binary.
|
|
149
|
+
*/
|
|
150
|
+
modelsBasePath?: string;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Configuration options for the SDK setup.
|
|
154
|
+
*/
|
|
155
|
+
type SetupOptions = {
|
|
156
|
+
/** The base URL for the API */
|
|
157
|
+
apiURL: string;
|
|
158
|
+
/** The session token for API requests (optional - can be set later or omitted for createSession calls) */
|
|
159
|
+
token?: string;
|
|
160
|
+
/** Custom headers to include in all requests */
|
|
161
|
+
customHeaders?: Record<string, string>;
|
|
162
|
+
/** Request timeout in milliseconds */
|
|
163
|
+
timeout?: number;
|
|
164
|
+
/** Optional WASM warmup config - if provided, preloads WASM and ML models */
|
|
165
|
+
wasm?: WasmConfig;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Initializes the SDK with the provided configuration.
|
|
169
|
+
* Must be called before using any SDK functionality.
|
|
170
|
+
*
|
|
171
|
+
* If `wasm` config is provided, this function becomes async and will
|
|
172
|
+
* preload WASM binary and ML models. Otherwise, it's synchronous.
|
|
173
|
+
*
|
|
174
|
+
* @param options - Configuration options for the SDK
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { setup, createSession } from '@incodetech/core';
|
|
179
|
+
*
|
|
180
|
+
* // Setup with API URL first (for session creation)
|
|
181
|
+
* await setup({ apiURL: 'https://api.incode.com' });
|
|
182
|
+
* const session = await createSession('api-key', { configurationId: 'flow-id' });
|
|
183
|
+
*
|
|
184
|
+
* // Basic setup with token
|
|
185
|
+
* await setup({
|
|
186
|
+
* apiURL: 'https://api.incode.com',
|
|
187
|
+
* token: 'session-token',
|
|
188
|
+
* });
|
|
189
|
+
*
|
|
190
|
+
* // Setup with WASM warmup
|
|
191
|
+
* await setup({
|
|
192
|
+
* apiURL: 'https://api.incode.com',
|
|
193
|
+
* token: 'session-token',
|
|
194
|
+
* wasm: {
|
|
195
|
+
* wasmPath: '/wasm/ml-wasm.wasm',
|
|
196
|
+
* glueCodePath: '/wasm/ml-wasm.js',
|
|
197
|
+
* pipelines: ['selfie', 'idCapture'],
|
|
198
|
+
* },
|
|
199
|
+
* });
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare function setup(options: SetupOptions): Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* Sets the WASM configuration without performing warmup.
|
|
205
|
+
* Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
|
|
206
|
+
*
|
|
207
|
+
* @param config - WASM configuration to store
|
|
208
|
+
*/
|
|
209
|
+
declare function setWasmConfig(config: WasmConfig): void;
|
|
210
|
+
/**
|
|
211
|
+
* Initializes WasmUtilProvider with the stored WASM configuration.
|
|
212
|
+
* Should be called after warmupWasm() completes when using conditional warmup.
|
|
213
|
+
* This ensures image encryption works properly.
|
|
214
|
+
*
|
|
215
|
+
* @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
|
|
216
|
+
* @throws Error if no config is provided and none is stored
|
|
217
|
+
*/
|
|
218
|
+
declare function initializeWasmUtil(config?: WasmConfig): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Checks if the SDK has been configured.
|
|
221
|
+
*
|
|
222
|
+
* @returns true if setup() has been called, false otherwise
|
|
223
|
+
*/
|
|
224
|
+
declare function isConfigured(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Resets the SDK configuration. Useful for testing.
|
|
227
|
+
*/
|
|
228
|
+
declare function reset(): void;
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/internal/events/types.d.ts
|
|
231
|
+
type Event = {
|
|
232
|
+
code: string;
|
|
233
|
+
module?: string;
|
|
234
|
+
screen?: string;
|
|
235
|
+
payload?: Record<string, unknown>;
|
|
236
|
+
clientTimestamp?: number;
|
|
237
|
+
};
|
|
238
|
+
declare const eventModuleNames: {
|
|
239
|
+
readonly selfie: "SELFIE";
|
|
240
|
+
readonly authFace: "AUTH_FACE";
|
|
241
|
+
readonly mlConsent: "ML_CONSENT";
|
|
242
|
+
readonly combinedConsent: "COMBINED_CONSENT";
|
|
243
|
+
readonly curpValidation: "CURP_VALIDATION";
|
|
244
|
+
readonly faceMatch: "FACE_MATCH";
|
|
245
|
+
readonly qr: "QR";
|
|
246
|
+
readonly videoSelfie: "VIDEO_ONBOARDING";
|
|
247
|
+
readonly passport: "ID";
|
|
248
|
+
readonly front: "ID";
|
|
249
|
+
readonly back: "ID";
|
|
250
|
+
readonly id: "ID";
|
|
251
|
+
readonly document: "DOCUMENT_CAPTURE";
|
|
252
|
+
readonly creditCard: "CREDIT_CARD_FRONT";
|
|
253
|
+
readonly creditCardBack: "CREDIT_CARD_BACK";
|
|
254
|
+
readonly conference: "CONFERENCE";
|
|
255
|
+
readonly otp: "OTP";
|
|
256
|
+
readonly signature: "SIGNATURE";
|
|
257
|
+
readonly ekyc: "EXTERNAL_VERIFICATION";
|
|
258
|
+
readonly globalWatchList: "GLOBAL_WATCHLIST";
|
|
259
|
+
readonly customWatchList: "CUSTOM_WATCHLIST";
|
|
260
|
+
readonly email: "EMAIL";
|
|
261
|
+
readonly phone: "PHONE";
|
|
262
|
+
readonly instantVerifyEmail: "INSTANT_VERIFY_EMAIL";
|
|
263
|
+
readonly instantVerifyConsent: "INSTANT_VERIFY_CONSENT";
|
|
264
|
+
readonly forms: "FORMS";
|
|
265
|
+
readonly customModule: "CUSTOM_MODULE";
|
|
266
|
+
};
|
|
267
|
+
declare const eventScreenNames: {
|
|
268
|
+
readonly faceMatch: "FACE_MATCH";
|
|
269
|
+
readonly faceCaptureTutorial: "SELFIE_CAPTURE_TUTORIAL";
|
|
270
|
+
readonly faceCaptureCamera: "SELFIE_CAMERA_CAPTURE";
|
|
271
|
+
readonly faceCaptureError: "SELFIE_ATTEMPT_FAILED";
|
|
272
|
+
readonly faceCaptureSuccess: "SELFIE_UPLOAD_SUCCEEDED";
|
|
273
|
+
readonly faceCaptureUpload: "SELFIE_UPLOAD_PROGRESS";
|
|
274
|
+
readonly mlConsent: "MACHINE_LEARNING_CONSENT";
|
|
275
|
+
readonly combinedConsent: "COMBINED_CONSENT";
|
|
276
|
+
readonly curpEnter: "ENTER_CURP";
|
|
277
|
+
readonly curpValidate: "VALIDATE_CURP";
|
|
278
|
+
readonly curpGenerate: "GENERATE_CURP";
|
|
279
|
+
readonly curpValidation: "CURP_VALIDATION_PROGRESS";
|
|
280
|
+
readonly curpValidationFailed: "CURP_VALIDATION_FAILED";
|
|
281
|
+
readonly curpValidationSuccess: "CURP_VALIDATION_SUCCEEDED";
|
|
282
|
+
readonly qrTutorial: "QR_TUTORIAL";
|
|
283
|
+
readonly qrScan: "QR_SCAN";
|
|
284
|
+
readonly smsOtp: "OTP";
|
|
285
|
+
readonly simpleOTP: "OTP";
|
|
286
|
+
readonly signatureInput: "SIGNATURE_INPUT";
|
|
287
|
+
readonly frontTutorial: "FRONT_ID_CAPTURE_TUTORIAL";
|
|
288
|
+
readonly frontCameraCapture: "FRONT_ID_CAMERA_CAPTURE";
|
|
289
|
+
readonly frontHelp: "FRONT_ID_HELP";
|
|
290
|
+
readonly frontReviewPhoto: "FRONT_ID_REVIEW_PHOTO";
|
|
291
|
+
readonly frontUploadProgress: "FRONT_ID_UPLOAD_PROGRESS";
|
|
292
|
+
readonly frontAttemptFailed: "FRONT_ID_ATTEMPT_FAILED";
|
|
293
|
+
readonly frontUploadSuccess: "FRONT_ID_UPLOAD_SUCCEEDED";
|
|
294
|
+
readonly backTutorial: "BACK_ID_CAPTURE_TUTORIAL";
|
|
295
|
+
readonly backCameraCapture: "BACK_ID_CAMERA_CAPTURE";
|
|
296
|
+
readonly backReviewPhoto: "BACK_ID_REVIEW_PHOTO";
|
|
297
|
+
readonly backUploadProgress: "BACK_ID_UPLOAD_PROGRESS";
|
|
298
|
+
readonly backAttemptFailed: "BACK_ID_ATTEMPT_FAILED";
|
|
299
|
+
readonly backUploadSuccess: "BACK_ID_UPLOAD_SUCCEEDED";
|
|
300
|
+
readonly backHelp: "BACK_ID_HELP";
|
|
301
|
+
readonly passportTutorial: "TUTORIAL_PASSPORT";
|
|
302
|
+
readonly documentTutorial: "DOCUMENT_CAPTURE_TUTORIAL";
|
|
303
|
+
readonly documentCameraCapture: "DOCUMENT_CAMERA_CAPTURE";
|
|
304
|
+
readonly documentHelp: "DOCUMENT_HELP";
|
|
305
|
+
readonly documentReviewPhoto: "DOCUMENT_REVIEW_PHOTO";
|
|
306
|
+
readonly documentUploadProgress: "DOCUMENT_UPLOAD_IN_PROGRESS";
|
|
307
|
+
readonly documentAttemptFailed: "DOCUMENT_ATTEMPT_FAILED";
|
|
308
|
+
readonly documentUploadSuccess: "DOCUMENT_UPLOAD_SUCCEEDED";
|
|
309
|
+
readonly conferenceWait: "CONFERENCE_WAIT";
|
|
310
|
+
readonly conferenceVideoChat: "CONFERENCE_VIDEO_CHAT";
|
|
311
|
+
readonly conferenceMessageChat: "CONFERENCE_MESSAGE_CHAT";
|
|
312
|
+
readonly videoSelfieTutorial: "VIDEO_SELFIE_TUTORIAL";
|
|
313
|
+
readonly videoSelfie: "VIDEO_SELFIE";
|
|
314
|
+
readonly videoSelfieFaceCapture: "VIDEO_SELFIE_FACE_CAPTURE";
|
|
315
|
+
readonly videoSelfieFaceUploadProgress: "VIDEO_SELFIE_FACE_UPLOAD_PROGRESS";
|
|
316
|
+
readonly videoSelfieFaceAttemptFailed: "VIDEO_SELFIE_FACE_ATTEMPT_FAILED";
|
|
317
|
+
readonly videoSelfieFaceUploadSucceeded: "VIDEO_SELFIE_FACE_UPLOAD_SUCCEEDED";
|
|
318
|
+
readonly videoSelfieFrontIdCapture: "VIDEO_SELFIE_FRONT_ID_CAPTURE";
|
|
319
|
+
readonly videoSelfieFrontIdUploadProgress: "VIDEO_SELFIE_FRONT_ID_UPLOAD_PROGRESS";
|
|
320
|
+
readonly videoSelfieFrontIdAttemptFailed: "VIDEO_SELFIE_FRONT_ID_ATTEMPT_FAILED";
|
|
321
|
+
readonly videoSelfieFrontIdUploadSucceeded: "VIDEO_SELFIE_FRONT_ID_UPLOAD_SUCCEEDED";
|
|
322
|
+
readonly videoSelfieBackIdCapture: "VIDEO_SELFIE_BACK_ID_CAPTURE";
|
|
323
|
+
readonly videoSelfieBackIdUploadProgress: "VIDEO_SELFIE_BACK_ID_UPLOAD_PROGRESS";
|
|
324
|
+
readonly videoSelfieBackIdAttemptFailed: "VIDEO_SELFIE_BACK_ID_ATTEMPT_FAILED";
|
|
325
|
+
readonly videoSelfieBackIdUploadSucceeded: "VIDEO_SELFIE_BACK_ID_UPLOAD_SUCCEEDED";
|
|
326
|
+
readonly videoSelfieDocumentCapture: "VIDEO_SELFIE_DOCUMENT_CAPTURE";
|
|
327
|
+
readonly videoSelfieVoiceQuestion: "VIDEO_SELFIE_VOICE_QUESTION";
|
|
328
|
+
readonly videoSelfieVoiceFinalQuestion: "VIDEO_SELFIE_VOICE_FINAL_QUESTION";
|
|
329
|
+
readonly videoSelfieVideoUpload: "VIDEO SELFIE VIDEO UPLOAD";
|
|
330
|
+
readonly ekycInput: "EKYC_INPUT";
|
|
331
|
+
readonly ekycProgress: "EKYC_PROGRESS";
|
|
332
|
+
readonly ekycSucceeded: "EKYC_SUCCEEDED";
|
|
333
|
+
readonly ekycFailed: "EKYC_FAILED";
|
|
334
|
+
readonly forms: "FORMS";
|
|
335
|
+
readonly globalWatchListInput: "GLOBAL_WATCHLIST_INPUT";
|
|
336
|
+
readonly globalWatchListProgress: "GLOBAL_WATCHLIST_PROGRESS";
|
|
337
|
+
readonly globalWatchListSuccess: "GLOBAL_WATCHLIST_SUCCEEDED";
|
|
338
|
+
readonly globalWatchListFailed: "GLOBAL_WATCHLIST_FAILED";
|
|
339
|
+
readonly customWatchListInput: "CUSTOM_WATCHLIST_INPUT";
|
|
340
|
+
readonly customWatchListProgress: "CUSTOM_WATCHLIST_PROGRESS";
|
|
341
|
+
readonly customWatchListSuccess: "CUSTOM_WATCHLIST_SUCCEEDED";
|
|
342
|
+
readonly customWatchListFailed: "CUSTOM_WATCHLIST_FAILED";
|
|
343
|
+
readonly emailInput: "EMAIL_INPUT";
|
|
344
|
+
readonly phoneInput: "PHONE_INPUT";
|
|
345
|
+
readonly instantVerify: "INSTANT_VERIFY";
|
|
346
|
+
readonly authFace: "AUTH_FACE";
|
|
347
|
+
readonly authFaceError: "AUTH_FACE_ATTEMPT_FAILED";
|
|
348
|
+
readonly authFaceUpload: "AUTH_FACE_UPLOAD_PROGRESS";
|
|
349
|
+
readonly authFaceUploadSuccess: "AUTH_FACE_UPLOAD_SUCCEEDED";
|
|
350
|
+
readonly authFaceUploadFailed: "AUTH_FACE_UPLOAD_FAILED";
|
|
351
|
+
readonly customModuleCallback: "CUSTOM_MODULE_CALLBACK";
|
|
352
|
+
readonly customModuleProcessing: "CUSTOM_MODULE_PROCESSING";
|
|
353
|
+
readonly digitalIdFileSelection: "DIGITAL_ID_FILE_SELECTION";
|
|
354
|
+
readonly digitalIdFileReview: "DIGITAL_ID_FILE_REVIEW";
|
|
355
|
+
readonly digitalIdUploadProgress: "DIGITAL_ID_UPLOAD_PROGRESS";
|
|
356
|
+
readonly digitalIdUploadSuccess: "DIGITAL_ID_UPLOAD_SUCCEEDED";
|
|
357
|
+
readonly digitalIdUploadFailed: "DIGITAL_ID_UPLOAD_FAILED";
|
|
358
|
+
readonly digitalIdAnalysisProgress: "DIGITAL_ID_ANALYSIS_PROGRESS";
|
|
359
|
+
readonly digitalIdVerificationSuccess: "DIGITAL_ID_VERIFICATION_SUCCESS";
|
|
360
|
+
readonly digitalIdVerificationFailed: "DIGITAL_ID_VERIFICATION_FAILED";
|
|
361
|
+
};
|
|
362
|
+
declare const videoSelfieEvents: {
|
|
363
|
+
readonly imageTooBlurry: "imageTooBlurry";
|
|
364
|
+
readonly fillFrame: "fillFrame";
|
|
365
|
+
readonly checkCameraOrLighting: "checkCameraOrLighting";
|
|
366
|
+
readonly frontIdCaptureStarted: "frontIdCaptureStarted";
|
|
367
|
+
readonly lookAtCamera: "lookAtCamera";
|
|
368
|
+
readonly moveCloser: "moveCloser";
|
|
369
|
+
readonly lookingForFrontId: "lookingForFrontId";
|
|
370
|
+
readonly lookingForBackId: "lookingForBackId";
|
|
371
|
+
readonly cameraSwitchToBack: "cameraSwitchToBack";
|
|
372
|
+
readonly cameraSwitchToFront: "cameraSwitchToFront";
|
|
373
|
+
readonly audioStreamOpened: "audioStreamOpened";
|
|
374
|
+
readonly audioStreamClosed: "audioStreamClosed";
|
|
375
|
+
readonly videoSelfieVideoUploadInProgress: "videoSelfieVideoUploadInProgress";
|
|
376
|
+
readonly videoSelfieTosNotAccepted: "videoSelfieTosNotAccepted";
|
|
377
|
+
readonly videoSelfieTosAccepted: "videoSelfieTosAccepted";
|
|
378
|
+
readonly videoSelfieStreamCreated: "videoSelfieStreamCreated";
|
|
379
|
+
readonly videoSelfieStreamDestroyed: "videoSelfieStreamDestroyed";
|
|
380
|
+
readonly videoSelfieReconnecting: "videoSelfieReconnecting";
|
|
381
|
+
readonly videoSelfieReconnected: "videoSelfieReconnected";
|
|
382
|
+
};
|
|
383
|
+
declare const tutorialScreenNamesMapper: {
|
|
384
|
+
readonly passport: "TUTORIAL_PASSPORT";
|
|
385
|
+
readonly front: "FRONT_ID_CAPTURE_TUTORIAL";
|
|
386
|
+
readonly back: "BACK_ID_CAPTURE_TUTORIAL";
|
|
387
|
+
readonly selfie: "SELFIE_CAPTURE_TUTORIAL";
|
|
388
|
+
};
|
|
389
|
+
declare const cameraScreenNamesMapper: {
|
|
390
|
+
readonly front: "front";
|
|
391
|
+
readonly back: "back";
|
|
392
|
+
readonly passport: "passport";
|
|
393
|
+
readonly creditCard: "front";
|
|
394
|
+
readonly creditCardBack: "back";
|
|
395
|
+
readonly document: "document";
|
|
396
|
+
};
|
|
397
|
+
type EventModule = (typeof eventModuleNames)[keyof typeof eventModuleNames];
|
|
398
|
+
type EventScreen = (typeof eventScreenNames)[keyof typeof eventScreenNames];
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/internal/events/addEvent.d.ts
|
|
401
|
+
type EventSubscriber = (event: Event) => void;
|
|
402
|
+
/**
|
|
403
|
+
* Subscribes to all SDK events for logging, debugging, or custom analytics.
|
|
404
|
+
* Returns an unsubscribe function.
|
|
405
|
+
*
|
|
406
|
+
* @param listener - Callback function that receives each event
|
|
407
|
+
* @returns Unsubscribe function to remove the listener
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```typescript
|
|
411
|
+
* const unsubscribe = subscribeEvent((event) => {
|
|
412
|
+
* console.log('[Event]', event.code, event.module);
|
|
413
|
+
* });
|
|
414
|
+
*
|
|
415
|
+
* // Later
|
|
416
|
+
* unsubscribe();
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
declare function subscribeEvent(listener: EventSubscriber): () => void;
|
|
420
|
+
/**
|
|
421
|
+
* Sends an event to the dashboard for tracking.
|
|
422
|
+
* Fire-and-forget: never blocks, never throws.
|
|
423
|
+
* Events are queued if SDK is not configured yet.
|
|
424
|
+
*/
|
|
425
|
+
declare function addEvent(event: Event): void;
|
|
426
|
+
/**
|
|
427
|
+
* Flushes any queued events that were sent before SDK was configured.
|
|
428
|
+
* Called automatically by setup() after token is set.
|
|
429
|
+
*/
|
|
430
|
+
declare function flushEventQueue(): void;
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/internal/events/helpers.d.ts
|
|
433
|
+
type ScreenEventParams = {
|
|
434
|
+
module: EventModule | string;
|
|
435
|
+
screen?: EventScreen | string;
|
|
436
|
+
code: string;
|
|
437
|
+
payload?: Record<string, unknown>;
|
|
438
|
+
};
|
|
439
|
+
declare function screenEvent(params: ScreenEventParams): void;
|
|
440
|
+
declare function moduleOpened(module: EventModule | string, screen?: EventScreen | string, payload?: Record<string, unknown>): void;
|
|
441
|
+
declare function moduleClosed(module: EventModule | string, screen?: EventScreen | string, payload?: Record<string, unknown>): void;
|
|
442
|
+
declare function screenOpened(module: EventModule | string, screen: EventScreen | string, payload?: Record<string, unknown>): void;
|
|
443
|
+
declare function screenClosed(module: EventModule | string, screen: EventScreen | string, payload?: Record<string, unknown>): void;
|
|
444
|
+
//#endregion
|
|
445
|
+
export { type Browser, CameraStream, CaptureIdResponse, CapturedImage, CreateIdCaptureActorOptions, type CreateSessionOptions, DetectionArea, DetectionOrientation, DetectionStatus, type DeviceClass, type Event, type EventModule, type EventScreen, type HttpClient, ID_ERROR_CODES, IIdCaptureCapability, IdCaptureActor, IdCaptureConfig, IdCaptureContext, IdCaptureEvent, IdCaptureGeometry, IdCaptureInitResult, IdCaptureInput, IdCaptureMachine, IdCaptureManager, IdCaptureMode, IdCaptureProvider, IdCaptureSettings, IdCaptureState, IdCaptureThresholds, IdDocumentType, IdError, IdErrorCode, IdFlowStep, type PermissionResult, type PermissionStatus, RecordingSession, type Session, type SetupOptions, StartRecordingParams, UploadIdImageParams, UploadIdResponse, ValidationError, type WasmConfig, type WasmPipeline, addEvent, api, cameraScreenNamesMapper, checkPermission as checkCameraPermission, createApi, createIdCaptureActor, createIdCaptureManager, createSession, eventModuleNames, eventScreenNames, flushEventQueue, getApi, getBrowser, getDeviceClass, idCaptureMachine, initializeIdCapture, initializeWasmUtil, isConfigured, moduleClosed, moduleOpened, processId, requestPermission as requestCameraPermission, reset, screenClosed, screenEvent, screenOpened, setWasmConfig, setup, startRecordingSession, stopRecording, stopStream, subscribeEvent, tutorialScreenNamesMapper, uploadIdImage, validateUploadResponse, videoSelfieEvents, warmupWasm };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { a as videoSelfieEvents, c as screenClosed, d as addEvent, f as flushEventQueue, i as tutorialScreenNamesMapper, l as screenEvent, n as eventModuleNames, o as moduleClosed, p as subscribeEvent, r as eventScreenNames, s as moduleOpened, t as cameraScreenNamesMapper, u as screenOpened } from "./events-B8ZkhAZo.esm.js";
|
|
2
|
+
import { a as processId, c as stopStream, d as ID_ERROR_CODES, i as initializeIdCapture, l as uploadIdImage, n as createIdCaptureActor, o as startRecordingSession, r as idCaptureMachine, s as stopRecording, t as createIdCaptureManager, u as validateUploadResponse } from "./id-r1mw9zBM.esm.js";
|
|
3
|
+
import { i as IdCaptureProvider, o as warmupWasm, r as WasmUtilProvider, w as createApi_default } from "./src-DYtpbFY5.esm.js";
|
|
4
|
+
import "./getDeviceClass-DkfbtsIJ.esm.js";
|
|
5
|
+
import { t as endpoints } from "./endpoints-BUsSVoJV.esm.js";
|
|
6
|
+
import { c as getDeviceClass, l as getBrowser, o as checkPermission, s as requestPermission } from "./streamingEvents-CfEJv3xH.esm.js";
|
|
7
|
+
import { a as resetApi, n as getApi, o as setClient, s as setToken, t as api } from "./api-DfRLAneb.esm.js";
|
|
8
|
+
|
|
9
|
+
//#region src/internal/session/sessionService.ts
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new onboarding session.
|
|
12
|
+
*
|
|
13
|
+
* @param apiKey - The API key from the Incode dashboard
|
|
14
|
+
* @param options - Session creation options
|
|
15
|
+
* @param signal - Optional AbortSignal for request cancellation
|
|
16
|
+
* @returns The created session with token
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const session = await createSession('your-api-key', {
|
|
21
|
+
* configurationId: 'your-flow-id',
|
|
22
|
+
* language: 'en-US',
|
|
23
|
+
* });
|
|
24
|
+
* console.log(session.token); // Use this token for subsequent API calls
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
async function createSession(apiKey, options, signal) {
|
|
28
|
+
const res = await getApi().post(endpoints.createSession, {
|
|
29
|
+
configurationId: options.configurationId,
|
|
30
|
+
externalId: options.externalId,
|
|
31
|
+
externalCustomerId: options.externalCustomerId,
|
|
32
|
+
language: options.language ?? "en-US",
|
|
33
|
+
customFields: options.customFields,
|
|
34
|
+
uuid: options.uuid ?? null,
|
|
35
|
+
interviewId: options.interviewId ?? null
|
|
36
|
+
}, {
|
|
37
|
+
headers: {
|
|
38
|
+
"x-api-key": apiKey,
|
|
39
|
+
"api-version": "1.0"
|
|
40
|
+
},
|
|
41
|
+
signal
|
|
42
|
+
});
|
|
43
|
+
if (!res.ok) throw new Error(`POST ${endpoints.createSession} failed: ${res.status} ${res.statusText}`);
|
|
44
|
+
return res.data;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/setup.ts
|
|
49
|
+
let wasmConfig;
|
|
50
|
+
let configured = false;
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the SDK with the provided configuration.
|
|
53
|
+
* Must be called before using any SDK functionality.
|
|
54
|
+
*
|
|
55
|
+
* If `wasm` config is provided, this function becomes async and will
|
|
56
|
+
* preload WASM binary and ML models. Otherwise, it's synchronous.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration options for the SDK
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { setup, createSession } from '@incodetech/core';
|
|
63
|
+
*
|
|
64
|
+
* // Setup with API URL first (for session creation)
|
|
65
|
+
* await setup({ apiURL: 'https://api.incode.com' });
|
|
66
|
+
* const session = await createSession('api-key', { configurationId: 'flow-id' });
|
|
67
|
+
*
|
|
68
|
+
* // Basic setup with token
|
|
69
|
+
* await setup({
|
|
70
|
+
* apiURL: 'https://api.incode.com',
|
|
71
|
+
* token: 'session-token',
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* // Setup with WASM warmup
|
|
75
|
+
* await setup({
|
|
76
|
+
* apiURL: 'https://api.incode.com',
|
|
77
|
+
* token: 'session-token',
|
|
78
|
+
* wasm: {
|
|
79
|
+
* wasmPath: '/wasm/ml-wasm.wasm',
|
|
80
|
+
* glueCodePath: '/wasm/ml-wasm.js',
|
|
81
|
+
* pipelines: ['selfie', 'idCapture'],
|
|
82
|
+
* },
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
async function setup(options) {
|
|
87
|
+
setClient(createApi_default({
|
|
88
|
+
apiURL: options.apiURL,
|
|
89
|
+
customHeaders: options.customHeaders,
|
|
90
|
+
timeout: options.timeout
|
|
91
|
+
}));
|
|
92
|
+
if (options.token) {
|
|
93
|
+
setToken(options.token);
|
|
94
|
+
flushEventQueue();
|
|
95
|
+
}
|
|
96
|
+
configured = true;
|
|
97
|
+
if (options.wasm) {
|
|
98
|
+
await warmupWasm({
|
|
99
|
+
wasmPath: options.wasm.wasmPath,
|
|
100
|
+
wasmSimdPath: options.wasm.wasmSimdPath,
|
|
101
|
+
glueCodePath: options.wasm.glueCodePath,
|
|
102
|
+
useSimd: options.wasm.useSimd,
|
|
103
|
+
pipelines: options.wasm.pipelines,
|
|
104
|
+
modelsBasePath: options.wasm.modelsBasePath
|
|
105
|
+
});
|
|
106
|
+
await (await WasmUtilProvider.getInstance()).initialize({
|
|
107
|
+
wasmPath: options.wasm.wasmPath,
|
|
108
|
+
wasmSimdPath: options.wasm.wasmSimdPath,
|
|
109
|
+
glueCodePath: options.wasm.glueCodePath,
|
|
110
|
+
useSimd: options.wasm.useSimd,
|
|
111
|
+
pipelines: options.wasm.pipelines,
|
|
112
|
+
modelsBasePath: options.wasm.modelsBasePath
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sets the WASM configuration without performing warmup.
|
|
118
|
+
* Useful when WASM warmup is handled separately (e.g., conditionally based on flow).
|
|
119
|
+
*
|
|
120
|
+
* @param config - WASM configuration to store
|
|
121
|
+
*/
|
|
122
|
+
function setWasmConfig(config) {
|
|
123
|
+
wasmConfig = config;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Initializes WasmUtilProvider with the stored WASM configuration.
|
|
127
|
+
* Should be called after warmupWasm() completes when using conditional warmup.
|
|
128
|
+
* This ensures image encryption works properly.
|
|
129
|
+
*
|
|
130
|
+
* @param config - Optional WASM configuration. If not provided, uses the stored config from setWasmConfig().
|
|
131
|
+
* @throws Error if no config is provided and none is stored
|
|
132
|
+
*/
|
|
133
|
+
async function initializeWasmUtil(config) {
|
|
134
|
+
const wasmConfigToUse = config ?? wasmConfig;
|
|
135
|
+
if (!wasmConfigToUse) throw new Error("WASM config is required. Provide config parameter or call setWasmConfig() first.");
|
|
136
|
+
await (await WasmUtilProvider.getInstance()).initialize({
|
|
137
|
+
wasmPath: wasmConfigToUse.wasmPath,
|
|
138
|
+
wasmSimdPath: wasmConfigToUse.wasmSimdPath,
|
|
139
|
+
glueCodePath: wasmConfigToUse.glueCodePath,
|
|
140
|
+
useSimd: wasmConfigToUse.useSimd,
|
|
141
|
+
pipelines: wasmConfigToUse.pipelines,
|
|
142
|
+
modelsBasePath: wasmConfigToUse.modelsBasePath
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Checks if the SDK has been configured.
|
|
147
|
+
*
|
|
148
|
+
* @returns true if setup() has been called, false otherwise
|
|
149
|
+
*/
|
|
150
|
+
function isConfigured() {
|
|
151
|
+
return configured;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Resets the SDK configuration. Useful for testing.
|
|
155
|
+
*/
|
|
156
|
+
function reset() {
|
|
157
|
+
resetApi();
|
|
158
|
+
configured = false;
|
|
159
|
+
WasmUtilProvider.resetInstance();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { ID_ERROR_CODES, IdCaptureProvider, addEvent, api, cameraScreenNamesMapper, checkPermission as checkCameraPermission, createApi_default as createApi, createIdCaptureActor, createIdCaptureManager, createSession, eventModuleNames, eventScreenNames, flushEventQueue, getApi, getBrowser, getDeviceClass, idCaptureMachine, initializeIdCapture, initializeWasmUtil, isConfigured, moduleClosed, moduleOpened, processId, requestPermission as requestCameraPermission, reset, screenClosed, screenEvent, screenOpened, setWasmConfig, setup, startRecordingSession, stopRecording, stopStream, subscribeEvent, tutorialScreenNamesMapper, uploadIdImage, validateUploadResponse, videoSelfieEvents, warmupWasm };
|