smartcomply-web-sdk 1.0.3 → 1.0.5
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/README.md +43 -0
- package/dist/esm/camera/ActionDetector.d.ts +26 -0
- package/dist/esm/camera/ActionDetector.d.ts.map +1 -0
- package/dist/esm/camera/ActionDetector.js +110 -0
- package/dist/esm/camera/ActionDetector.js.map +1 -0
- package/dist/esm/camera/CameraManager.d.ts +7 -0
- package/dist/esm/camera/CameraManager.d.ts.map +1 -0
- package/dist/esm/camera/CameraManager.js +27 -0
- package/dist/esm/camera/CameraManager.js.map +1 -0
- package/dist/esm/camera/FaceDetector.d.ts +12 -0
- package/dist/esm/camera/FaceDetector.d.ts.map +1 -0
- package/dist/esm/camera/FaceDetector.js +51 -0
- package/dist/esm/camera/FaceDetector.js.map +1 -0
- package/dist/esm/camera/Permission.d.ts +42 -0
- package/dist/esm/camera/Permission.d.ts.map +1 -0
- package/dist/esm/camera/Permission.js +101 -0
- package/dist/esm/camera/Permission.js.map +1 -0
- package/dist/esm/camera/VideoRecorder.d.ts +12 -0
- package/dist/esm/camera/VideoRecorder.d.ts.map +1 -0
- package/dist/esm/camera/VideoRecorder.js +47 -0
- package/dist/esm/camera/VideoRecorder.js.map +1 -0
- package/dist/esm/client/Config.d.ts +9 -0
- package/dist/esm/client/Config.d.ts.map +1 -0
- package/dist/esm/client/Config.js +5 -0
- package/dist/esm/client/Config.js.map +1 -0
- package/dist/esm/client/HttpClient.d.ts +44 -0
- package/dist/esm/client/HttpClient.d.ts.map +1 -0
- package/dist/esm/client/HttpClient.js +145 -0
- package/dist/esm/client/HttpClient.js.map +1 -0
- package/dist/esm/client/Smartcomply.d.ts +50 -0
- package/dist/esm/client/Smartcomply.d.ts.map +1 -0
- package/dist/esm/client/Smartcomply.js +73 -0
- package/dist/esm/client/Smartcomply.js.map +1 -0
- package/dist/esm/components/CameraView.d.ts +59 -0
- package/dist/esm/components/CameraView.d.ts.map +1 -0
- package/dist/esm/components/CameraView.js +238 -0
- package/dist/esm/components/CameraView.js.map +1 -0
- package/dist/esm/components/DocumentUpload.d.ts +21 -0
- package/dist/esm/components/DocumentUpload.d.ts.map +1 -0
- package/dist/esm/components/DocumentUpload.js +216 -0
- package/dist/esm/components/DocumentUpload.js.map +1 -0
- package/dist/esm/errors/AuthError.d.ts +8 -0
- package/dist/esm/errors/AuthError.d.ts.map +1 -0
- package/dist/esm/errors/AuthError.js +11 -0
- package/dist/esm/errors/AuthError.js.map +1 -0
- package/dist/esm/errors/NetworkError.d.ts +8 -0
- package/dist/esm/errors/NetworkError.d.ts.map +1 -0
- package/dist/esm/errors/NetworkError.js +11 -0
- package/dist/esm/errors/NetworkError.js.map +1 -0
- package/dist/esm/errors/SDKError.d.ts +7 -0
- package/dist/esm/errors/SDKError.d.ts.map +1 -0
- package/dist/esm/errors/SDKError.js +10 -0
- package/dist/esm/errors/SDKError.js.map +1 -0
- package/dist/esm/flow/DocumentCapture.d.ts +54 -0
- package/dist/esm/flow/DocumentCapture.d.ts.map +1 -0
- package/dist/esm/flow/DocumentCapture.js +797 -0
- package/dist/esm/flow/DocumentCapture.js.map +1 -0
- package/dist/esm/flow/SmartComplyFlow.d.ts +104 -0
- package/dist/esm/flow/SmartComplyFlow.d.ts.map +1 -0
- package/dist/esm/flow/SmartComplyFlow.js +1722 -0
- package/dist/esm/flow/SmartComplyFlow.js.map +1 -0
- package/dist/esm/flow/theme.d.ts +30 -0
- package/dist/esm/flow/theme.d.ts.map +1 -0
- package/dist/esm/flow/theme.js +99 -0
- package/dist/esm/flow/theme.js.map +1 -0
- package/dist/esm/index.d.ts +20 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/modules/liveness/LivenessUI.d.ts +46 -0
- package/dist/esm/modules/liveness/LivenessUI.d.ts.map +1 -0
- package/dist/esm/modules/liveness/LivenessUI.js +605 -0
- package/dist/esm/modules/liveness/LivenessUI.js.map +1 -0
- package/dist/esm/modules/liveness/index.d.ts +5 -0
- package/dist/esm/modules/liveness/index.d.ts.map +1 -0
- package/dist/esm/modules/liveness/index.js +4 -0
- package/dist/esm/modules/liveness/index.js.map +1 -0
- package/dist/esm/modules/liveness/liveness.d.ts +85 -0
- package/dist/esm/modules/liveness/liveness.d.ts.map +1 -0
- package/dist/esm/modules/liveness/liveness.js +421 -0
- package/dist/esm/modules/liveness/liveness.js.map +1 -0
- package/dist/esm/modules/liveness/uploader.d.ts +34 -0
- package/dist/esm/modules/liveness/uploader.d.ts.map +1 -0
- package/dist/esm/modules/liveness/uploader.js +102 -0
- package/dist/esm/modules/liveness/uploader.js.map +1 -0
- package/dist/esm/modules/onboarding/index.d.ts +2 -0
- package/dist/esm/modules/onboarding/index.d.ts.map +1 -0
- package/dist/esm/modules/onboarding/index.js +2 -0
- package/dist/esm/modules/onboarding/index.js.map +1 -0
- package/dist/esm/modules/onboarding/onboarding.d.ts +25 -0
- package/dist/esm/modules/onboarding/onboarding.d.ts.map +1 -0
- package/dist/esm/modules/onboarding/onboarding.js +29 -0
- package/dist/esm/modules/onboarding/onboarding.js.map +1 -0
- package/dist/esm/types/common.d.ts +27 -0
- package/dist/esm/types/common.d.ts.map +1 -0
- package/dist/esm/types/common.js +2 -0
- package/dist/esm/types/common.js.map +1 -0
- package/dist/esm/types/liveness.d.ts +142 -0
- package/dist/esm/types/liveness.d.ts.map +1 -0
- package/dist/esm/types/liveness.js +2 -0
- package/dist/esm/types/liveness.js.map +1 -0
- package/dist/esm/types/onboarding.d.ts +53 -0
- package/dist/esm/types/onboarding.d.ts.map +1 -0
- package/dist/esm/types/onboarding.js +2 -0
- package/dist/esm/types/onboarding.js.map +1 -0
- package/dist/esm/types/quality.d.ts +23 -0
- package/dist/esm/types/quality.d.ts.map +1 -0
- package/dist/esm/types/quality.js +5 -0
- package/dist/esm/types/quality.js.map +1 -0
- package/dist/esm/utils/ImageQuality.d.ts +48 -0
- package/dist/esm/utils/ImageQuality.d.ts.map +1 -0
- package/dist/esm/utils/ImageQuality.js +177 -0
- package/dist/esm/utils/ImageQuality.js.map +1 -0
- package/dist/esm/utils/constants.d.ts +59 -0
- package/dist/esm/utils/constants.d.ts.map +1 -0
- package/dist/esm/utils/constants.js +67 -0
- package/dist/esm/utils/constants.js.map +1 -0
- package/dist/esm/utils/device.d.ts +14 -0
- package/dist/esm/utils/device.d.ts.map +1 -0
- package/dist/esm/utils/device.js +52 -0
- package/dist/esm/utils/device.js.map +1 -0
- package/dist/esm/utils/logger.d.ts +28 -0
- package/dist/esm/utils/logger.d.ts.map +1 -0
- package/dist/esm/utils/logger.js +64 -0
- package/dist/esm/utils/logger.js.map +1 -0
- package/dist/esm/utils/validator.d.ts +35 -0
- package/dist/esm/utils/validator.d.ts.map +1 -0
- package/dist/esm/utils/validator.js +102 -0
- package/dist/esm/utils/validator.js.map +1 -0
- package/package.json +13 -5
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LivenessUploader — thin wrapper around the HttpClient's uploadWithSession()
|
|
3
|
+
* that adds:
|
|
4
|
+
* - Progress callbacks (onProgress)
|
|
5
|
+
* - Upload cancellation via AbortController
|
|
6
|
+
* - Automatic retry on transient network failure (configurable)
|
|
7
|
+
*
|
|
8
|
+
* Used internally by LivenessModule.create() and LivenessModule.submit() when
|
|
9
|
+
* the caller needs progress reporting (e.g. for a progress bar during video
|
|
10
|
+
* upload on slow connections).
|
|
11
|
+
*/
|
|
12
|
+
import { MAX_RETRIES, RETRY_DELAY_MS } from "../../utils/constants";
|
|
13
|
+
import { SDKLogger } from "../../utils/logger";
|
|
14
|
+
export class LivenessUploader {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this.http = http;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Upload a FormData payload to `path` with optional progress and
|
|
20
|
+
* cancellation support.
|
|
21
|
+
*
|
|
22
|
+
* Falls back to the standard `uploadWithSession()` on browsers that do not
|
|
23
|
+
* support XMLHttpRequest upload progress (very rare).
|
|
24
|
+
*/
|
|
25
|
+
async upload(path, formData, options = {}) {
|
|
26
|
+
const { onProgress, signal, retries = MAX_RETRIES } = options;
|
|
27
|
+
// If no progress callback is needed, delegate straight to HttpClient
|
|
28
|
+
// which already has retry logic built in.
|
|
29
|
+
if (!onProgress) {
|
|
30
|
+
return this.http.uploadWithSession(path, formData);
|
|
31
|
+
}
|
|
32
|
+
return this.uploadWithProgress(path, formData, onProgress, signal, retries);
|
|
33
|
+
}
|
|
34
|
+
// ── Private ────────────────────────────────────────────────────────────────
|
|
35
|
+
async uploadWithProgress(path, formData, onProgress, signal, retriesLeft) {
|
|
36
|
+
const sessionToken = this.http.sessionToken;
|
|
37
|
+
if (!sessionToken) {
|
|
38
|
+
throw new Error("SDK: No session token. Call sdk.createSession() first.");
|
|
39
|
+
}
|
|
40
|
+
const baseUrl = this.http.baseUrl;
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const xhr = new XMLHttpRequest();
|
|
43
|
+
// Propagate AbortSignal to XHR
|
|
44
|
+
if (signal) {
|
|
45
|
+
if (signal.aborted) {
|
|
46
|
+
reject(new DOMException("Upload cancelled", "AbortError"));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
signal.addEventListener("abort", () => xhr.abort(), { once: true });
|
|
50
|
+
}
|
|
51
|
+
xhr.open("POST", `${baseUrl}${path}`, true);
|
|
52
|
+
xhr.setRequestHeader("x-access-token", sessionToken);
|
|
53
|
+
xhr.upload.onprogress = (evt) => {
|
|
54
|
+
if (evt.lengthComputable) {
|
|
55
|
+
onProgress(evt.loaded / evt.total);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
xhr.onload = () => {
|
|
59
|
+
onProgress(1);
|
|
60
|
+
let envelope;
|
|
61
|
+
try {
|
|
62
|
+
envelope = JSON.parse(xhr.responseText);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
reject(new Error(`SDK: Non-JSON response from ${path} (${xhr.status})`));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (xhr.status >= 200 && xhr.status < 300 && envelope.status !== "error") {
|
|
69
|
+
SDKLogger.info(`Upload to ${path} succeeded`, { status: xhr.status });
|
|
70
|
+
resolve(envelope.data);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const err = new Error(envelope.message || `Upload to ${path} failed (${xhr.status})`);
|
|
74
|
+
err.statusCode = xhr.status;
|
|
75
|
+
err.code = envelope.code;
|
|
76
|
+
reject(err);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
xhr.onerror = async () => {
|
|
80
|
+
SDKLogger.warn(`Upload to ${path} failed — network error`, { retriesLeft });
|
|
81
|
+
if (retriesLeft > 0) {
|
|
82
|
+
await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
83
|
+
try {
|
|
84
|
+
const result = await this.uploadWithProgress(path, formData, onProgress, signal, retriesLeft - 1);
|
|
85
|
+
resolve(result);
|
|
86
|
+
}
|
|
87
|
+
catch (retryErr) {
|
|
88
|
+
reject(retryErr);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
reject(new Error(`SDK: Upload to ${path} failed after all retries.`));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
xhr.onabort = () => {
|
|
96
|
+
reject(new DOMException("Upload cancelled by user", "AbortError"));
|
|
97
|
+
};
|
|
98
|
+
xhr.send(formData);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=uploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../../../../src/modules/liveness/uploader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAA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","sources":["../../../../src/modules/onboarding/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/onboarding/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HttpClient } from "../../client/HttpClient";
|
|
2
|
+
import { VerifyIdentityRequest, VerifyIdentityResponse } from "../../types/onboarding";
|
|
3
|
+
/**
|
|
4
|
+
* Onboarding module — identity verification.
|
|
5
|
+
*
|
|
6
|
+
* All methods use session-token auth (x-access-token header).
|
|
7
|
+
*/
|
|
8
|
+
export declare class OnboardingModule {
|
|
9
|
+
private http;
|
|
10
|
+
constructor(http: HttpClient);
|
|
11
|
+
/**
|
|
12
|
+
* Verify a user's identity.
|
|
13
|
+
*
|
|
14
|
+
* POST /v1/sdk/onboarding/verify/
|
|
15
|
+
* Auth: x-access-token: <sessionToken>
|
|
16
|
+
*
|
|
17
|
+
* Sends identity_type_id (from ChannelItem.id) and dynamic fields
|
|
18
|
+
* collected from the user based on the channel's field definitions.
|
|
19
|
+
*
|
|
20
|
+
* Example:
|
|
21
|
+
* { identity_type_id: 3, fields: { "bank_verification_number": "12345678901" } }
|
|
22
|
+
*/
|
|
23
|
+
verify(params: VerifyIdentityRequest): Promise<VerifyIdentityResponse>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../../src/modules/onboarding/onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC;;;;;;;;;;;OAWG;IACG,MAAM,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAU7E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Onboarding module — identity verification.
|
|
3
|
+
*
|
|
4
|
+
* All methods use session-token auth (x-access-token header).
|
|
5
|
+
*/
|
|
6
|
+
export class OnboardingModule {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Verify a user's identity.
|
|
12
|
+
*
|
|
13
|
+
* POST /v1/sdk/onboarding/verify/
|
|
14
|
+
* Auth: x-access-token: <sessionToken>
|
|
15
|
+
*
|
|
16
|
+
* Sends identity_type_id (from ChannelItem.id) and dynamic fields
|
|
17
|
+
* collected from the user based on the channel's field definitions.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* { identity_type_id: 3, fields: { "bank_verification_number": "12345678901" } }
|
|
21
|
+
*/
|
|
22
|
+
async verify(params) {
|
|
23
|
+
return this.http.sessionRequest("POST", "/v1/sdk/onboarding/verify/", {
|
|
24
|
+
identity_type_id: params.identity_type_id,
|
|
25
|
+
fields: params.fields,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../../../src/modules/onboarding/onboarding.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,CAAC,MAA6B;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAC7B,MAAM,EACN,4BAA4B,EAC5B;YACE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard backend response envelope.
|
|
3
|
+
* Every backend endpoint wraps its data in this structure.
|
|
4
|
+
*/
|
|
5
|
+
export interface ApiResponse<T = unknown> {
|
|
6
|
+
status: "success" | "error";
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
data: T;
|
|
10
|
+
request_id: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Backend validation error entry.
|
|
14
|
+
*/
|
|
15
|
+
export interface FieldError {
|
|
16
|
+
field: string;
|
|
17
|
+
message: string;
|
|
18
|
+
code: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Backend error data shape.
|
|
22
|
+
*/
|
|
23
|
+
export interface ErrorData {
|
|
24
|
+
errors?: FieldError[];
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-validated challenge actions. Only these 5 are accepted.
|
|
3
|
+
*/
|
|
4
|
+
export type ChallengeAction = "BLINK" | "TURN_LEFT" | "TURN_RIGHT" | "TURN_HEAD" | "OPEN_MOUTH";
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for creating a liveness entry.
|
|
7
|
+
* Sent as multipart to POST /v1/sdk/liveness/create/
|
|
8
|
+
*/
|
|
9
|
+
export interface LivenessCreateRequest {
|
|
10
|
+
identifier: string;
|
|
11
|
+
identifier_type: string;
|
|
12
|
+
country: string;
|
|
13
|
+
challenge_actions: ChallengeAction[];
|
|
14
|
+
autoshot_file?: File | Blob;
|
|
15
|
+
id_file?: File | Blob;
|
|
16
|
+
document?: File | Blob;
|
|
17
|
+
document_front?: File | Blob;
|
|
18
|
+
document_back?: File | Blob;
|
|
19
|
+
snapshot_file?: File | Blob;
|
|
20
|
+
identity_check?: number;
|
|
21
|
+
device_type?: string;
|
|
22
|
+
os_name?: string;
|
|
23
|
+
browser_timezone?: string;
|
|
24
|
+
fingerprint_id?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Response from POST /v1/sdk/liveness/create/ (unwrapped).
|
|
28
|
+
*/
|
|
29
|
+
export interface LivenessCreateResponse {
|
|
30
|
+
id: number;
|
|
31
|
+
client_id: string;
|
|
32
|
+
challenge_actions: ChallengeAction[];
|
|
33
|
+
expires_at: string | null;
|
|
34
|
+
status: "pending";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Response from POST /v1/sdk/liveness/submit/ (unwrapped).
|
|
38
|
+
*/
|
|
39
|
+
export interface LivenessSubmitResponse {
|
|
40
|
+
id: number;
|
|
41
|
+
status: "processing";
|
|
42
|
+
submitted_at: string | null;
|
|
43
|
+
metadata: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Webhook payload shape for liveness.completed event.
|
|
47
|
+
* This is what the backend POSTs to the client's webhook_url.
|
|
48
|
+
*/
|
|
49
|
+
export interface LivenessWebhookPayload {
|
|
50
|
+
event: "liveness.completed";
|
|
51
|
+
verification_id: number;
|
|
52
|
+
verification_type: "data_verification" | "document_verification" | "liveness_only";
|
|
53
|
+
status: "passed" | "failed";
|
|
54
|
+
failure_reason: string | null;
|
|
55
|
+
timestamp: string;
|
|
56
|
+
subject: {
|
|
57
|
+
identifier: string;
|
|
58
|
+
identifier_type: string;
|
|
59
|
+
country: string;
|
|
60
|
+
};
|
|
61
|
+
biometrics: {
|
|
62
|
+
liveness_verified: boolean;
|
|
63
|
+
face_match: {
|
|
64
|
+
attempted: boolean;
|
|
65
|
+
verified: boolean | null;
|
|
66
|
+
confidence_percentage: number | null;
|
|
67
|
+
};
|
|
68
|
+
selfie_url: string | null;
|
|
69
|
+
face_analysis: {
|
|
70
|
+
estimated_age: number | null;
|
|
71
|
+
estimated_gender: string | null;
|
|
72
|
+
dominant_emotion: string | null;
|
|
73
|
+
} | null;
|
|
74
|
+
};
|
|
75
|
+
activity: {
|
|
76
|
+
session_id: string | null;
|
|
77
|
+
started_at: string;
|
|
78
|
+
submitted_at: string | null;
|
|
79
|
+
completed_at: string;
|
|
80
|
+
duration_seconds: number | null;
|
|
81
|
+
};
|
|
82
|
+
request_context: {
|
|
83
|
+
ip: {
|
|
84
|
+
address: string | null;
|
|
85
|
+
city: string | null;
|
|
86
|
+
region: string | null;
|
|
87
|
+
country_code: string | null;
|
|
88
|
+
org: string | null;
|
|
89
|
+
asn_number: string | null;
|
|
90
|
+
asn_name: string | null;
|
|
91
|
+
latitude: string | null;
|
|
92
|
+
longitude: string | null;
|
|
93
|
+
timezone: string | null;
|
|
94
|
+
country_matches_document: boolean | null;
|
|
95
|
+
timezone_matches_browser: boolean | null;
|
|
96
|
+
};
|
|
97
|
+
device: {
|
|
98
|
+
user_agent: string | null;
|
|
99
|
+
type: string | null;
|
|
100
|
+
os: string | null;
|
|
101
|
+
timezone: string | null;
|
|
102
|
+
fingerprint_id: string | null;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
customer_profile?: {
|
|
106
|
+
first_name: string | null;
|
|
107
|
+
last_name: string | null;
|
|
108
|
+
other_name: string | null;
|
|
109
|
+
date_of_birth: string | null;
|
|
110
|
+
gender: string | null;
|
|
111
|
+
id_number: string | null;
|
|
112
|
+
serial_number: string | null;
|
|
113
|
+
occupation: string | null;
|
|
114
|
+
place_of_birth: string | null;
|
|
115
|
+
place_of_live: string | null;
|
|
116
|
+
date_of_issue: string | null;
|
|
117
|
+
photo_url: string | null;
|
|
118
|
+
};
|
|
119
|
+
document?: {
|
|
120
|
+
status: string;
|
|
121
|
+
document_type: string;
|
|
122
|
+
is_expired: boolean;
|
|
123
|
+
first_name: string | null;
|
|
124
|
+
last_name: string | null;
|
|
125
|
+
date_of_birth: string | null;
|
|
126
|
+
age: number | null;
|
|
127
|
+
gender: string | null;
|
|
128
|
+
nationality: string | null;
|
|
129
|
+
document_number: string | null;
|
|
130
|
+
expiry_date: string | null;
|
|
131
|
+
issue_date: string | null;
|
|
132
|
+
issuing_authority: string | null;
|
|
133
|
+
face_match: {
|
|
134
|
+
attempted: boolean;
|
|
135
|
+
verified: boolean | null;
|
|
136
|
+
confidence_percentage: number | null;
|
|
137
|
+
selfie_url: string | null;
|
|
138
|
+
document_face_url: string | null;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=liveness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveness.d.ts","sourceRoot":"","sources":["../../../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QACtB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,UAAU,EAAE;YACV,SAAS,EAAE,OAAO,CAAC;YACnB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;YACzB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;YACrC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;YAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;SAClC,CAAC;KACH,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveness.js","sourceRoot":"","sources":["../../../src/types/liveness.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported identity verification types.
|
|
3
|
+
* - "nin" / "bvn": Data verification (Nigeria-only, requires id_number)
|
|
4
|
+
* - "passport" / "national_id" / "drivers_license": Document verification (global)
|
|
5
|
+
*/
|
|
6
|
+
export type OnboardingType = "nin" | "bvn" | "passport" | "national_id" | "drivers_license";
|
|
7
|
+
/**
|
|
8
|
+
* Request payload for POST /v1/sdk/onboarding/verify/
|
|
9
|
+
* Uses identity_type_id (from ChannelItem.id) and dynamic fields.
|
|
10
|
+
*/
|
|
11
|
+
export interface VerifyIdentityRequest {
|
|
12
|
+
identity_type_id: number;
|
|
13
|
+
fields: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Response from the onboarding verify endpoint (full envelope).
|
|
17
|
+
* Backend returns: { status, code, message, data }
|
|
18
|
+
*/
|
|
19
|
+
export interface VerifyIdentityResponse {
|
|
20
|
+
status: "success" | "verified" | "pending" | "failed";
|
|
21
|
+
code: string;
|
|
22
|
+
message: string;
|
|
23
|
+
data: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Session creation response (unwrapped from envelope).
|
|
27
|
+
*/
|
|
28
|
+
export interface SessionResponse {
|
|
29
|
+
token: string;
|
|
30
|
+
expires_at: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* SDK configuration returned by GET /v1/sdk/initialize/
|
|
34
|
+
*/
|
|
35
|
+
export interface SDKInitConfig {
|
|
36
|
+
id: number;
|
|
37
|
+
brand_name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
theme: string;
|
|
40
|
+
verification_type: string[];
|
|
41
|
+
redirect_url: string | null;
|
|
42
|
+
channels: Record<string, {
|
|
43
|
+
id: number;
|
|
44
|
+
name: string;
|
|
45
|
+
code?: string;
|
|
46
|
+
fields: {
|
|
47
|
+
type: string;
|
|
48
|
+
label: string;
|
|
49
|
+
options?: string[];
|
|
50
|
+
}[];
|
|
51
|
+
}[]>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../src/types/onboarding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,KAAK,GACL,UAAU,GACV,aAAa,GACb,iBAAiB,CAAC;AAEtB;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAC,CAAC;CACxI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../../src/types/onboarding.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for image quality assessment
|
|
3
|
+
*/
|
|
4
|
+
export interface QualityMetrics {
|
|
5
|
+
sharpness: number;
|
|
6
|
+
contrast: number;
|
|
7
|
+
brightness: number;
|
|
8
|
+
isBlurry: boolean;
|
|
9
|
+
hasGlare: boolean;
|
|
10
|
+
overallScore: number;
|
|
11
|
+
}
|
|
12
|
+
export interface QualityFeedback {
|
|
13
|
+
isValid: boolean;
|
|
14
|
+
message: string;
|
|
15
|
+
recommendations: string[];
|
|
16
|
+
quality: QualityMetrics;
|
|
17
|
+
}
|
|
18
|
+
export interface CaptureResult {
|
|
19
|
+
blob: Blob;
|
|
20
|
+
quality: QualityFeedback;
|
|
21
|
+
selectedFrom: number;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=quality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality.d.ts","sourceRoot":"","sources":["../../../src/types/quality.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,eAAe,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quality.js","sourceRoot":"","sources":["../../../src/types/quality.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Quality Assessment for Document Capture
|
|
3
|
+
* Client-side quality checks before sending to backend
|
|
4
|
+
*/
|
|
5
|
+
export interface QualityMetrics {
|
|
6
|
+
sharpness: number;
|
|
7
|
+
contrast: number;
|
|
8
|
+
brightness: number;
|
|
9
|
+
isBlurry: boolean;
|
|
10
|
+
hasGlare: boolean;
|
|
11
|
+
overallScore: number;
|
|
12
|
+
}
|
|
13
|
+
export interface QualityFeedback {
|
|
14
|
+
isValid: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
recommendations: string[];
|
|
17
|
+
quality: QualityMetrics;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Calculate image sharpness using Laplacian variance
|
|
21
|
+
* Higher values = sharper image
|
|
22
|
+
*/
|
|
23
|
+
export declare function calculateSharpness(imageData: ImageData): number;
|
|
24
|
+
/**
|
|
25
|
+
* Detect glare (overexposed areas)
|
|
26
|
+
*/
|
|
27
|
+
export declare function detectGlare(imageData: ImageData, threshold?: number): number;
|
|
28
|
+
/**
|
|
29
|
+
* Calculate contrast (standard deviation)
|
|
30
|
+
*/
|
|
31
|
+
export declare function calculateContrast(imageData: ImageData): number;
|
|
32
|
+
/**
|
|
33
|
+
* Calculate brightness (mean pixel value)
|
|
34
|
+
*/
|
|
35
|
+
export declare function calculateBrightness(imageData: ImageData): number;
|
|
36
|
+
/**
|
|
37
|
+
* Full quality assessment
|
|
38
|
+
*/
|
|
39
|
+
export declare function assessQuality(imageData: ImageData): QualityFeedback;
|
|
40
|
+
/**
|
|
41
|
+
* Get quality color for UI feedback
|
|
42
|
+
*/
|
|
43
|
+
export declare function getQualityColor(score: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get quality message for display
|
|
46
|
+
*/
|
|
47
|
+
export declare function getQualityMessage(score: number): string;
|
|
48
|
+
//# sourceMappingURL=ImageQuality.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageQuality.d.ts","sourceRoot":"","sources":["../../../src/utils/ImageQuality.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAwC/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAYjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAgB9D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAShE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,eAAe,CAyEnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKvD"}
|