astra-sdk-web 1.1.8 → 1.1.9
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/astra-sdk.cjs.js +38 -11
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.d.cts +0 -4
- package/dist/astra-sdk.es.js +38 -11
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +38 -11
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +38 -11
- package/dist/components.es.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/package.json +1 -1
- package/src/features/faceScan/hooks/useFaceScan.ts +3 -3
- package/src/pages/DocumentUploadModal.tsx +21 -1
- package/src/pages/FaceScanModal.tsx +24 -2
- package/src/services/faceMeshService.ts +5 -7
- package/src/services/kycApiService.ts +7 -0
package/dist/components.es.js
CHANGED
|
@@ -8,6 +8,12 @@ import { QRCodeSVG } from 'qrcode.react';
|
|
|
8
8
|
// src/components/KycFlow.tsx
|
|
9
9
|
|
|
10
10
|
// src/services/kycApiService.ts
|
|
11
|
+
var COMPLETED_STEPS = {
|
|
12
|
+
INITIATED: "initiated",
|
|
13
|
+
FACE: "face_scan",
|
|
14
|
+
DOCS: "document_upload",
|
|
15
|
+
COMPLETED: "completed"
|
|
16
|
+
};
|
|
11
17
|
var KycApiService = class {
|
|
12
18
|
config;
|
|
13
19
|
constructor(config) {
|
|
@@ -430,7 +436,17 @@ function DocumentUploadModal({ onComplete }) {
|
|
|
430
436
|
const checkSession = async () => {
|
|
431
437
|
if (!apiService) return;
|
|
432
438
|
try {
|
|
433
|
-
await apiService.
|
|
439
|
+
const statusResponse = await apiService.getSessionStatus();
|
|
440
|
+
const { completed_steps, next_step, status } = statusResponse.data;
|
|
441
|
+
if (status !== "ACTIVE") {
|
|
442
|
+
throw new Error("Session expired or inactive");
|
|
443
|
+
}
|
|
444
|
+
if (completed_steps.includes(COMPLETED_STEPS.DOCS)) {
|
|
445
|
+
console.log("Document already uploaded");
|
|
446
|
+
}
|
|
447
|
+
if (next_step === COMPLETED_STEPS.FACE && !completed_steps.includes(COMPLETED_STEPS.FACE)) {
|
|
448
|
+
console.warn("Face scan not completed, but in document upload modal");
|
|
449
|
+
}
|
|
434
450
|
setSessionError(null);
|
|
435
451
|
} catch (error) {
|
|
436
452
|
const message = error.message || "Session expired or inactive";
|
|
@@ -876,7 +892,8 @@ var FaceMeshService = class {
|
|
|
876
892
|
}
|
|
877
893
|
}
|
|
878
894
|
} else if (state.stage === "DONE") {
|
|
879
|
-
|
|
895
|
+
const reducedThreshold = 0.08;
|
|
896
|
+
if (absYaw < reducedThreshold) {
|
|
880
897
|
state.centerHold += 1;
|
|
881
898
|
if (state.centerHold >= holdFramesCenter && !state.snapTriggered) {
|
|
882
899
|
state.snapTriggered = true;
|
|
@@ -890,11 +907,7 @@ var FaceMeshService = class {
|
|
|
890
907
|
} else {
|
|
891
908
|
state.centerHold = 0;
|
|
892
909
|
if (this.callbacks.onLivenessUpdate) {
|
|
893
|
-
|
|
894
|
-
this.callbacks.onLivenessUpdate(state.stage, "Center your face inside the circle");
|
|
895
|
-
} else {
|
|
896
|
-
this.callbacks.onLivenessUpdate(state.stage, "Please look straight at the camera");
|
|
897
|
-
}
|
|
910
|
+
this.callbacks.onLivenessUpdate(state.stage, "Please look straight at the camera");
|
|
898
911
|
}
|
|
899
912
|
}
|
|
900
913
|
}
|
|
@@ -1056,7 +1069,7 @@ function useFaceScan(videoRef, canvasRef, callbacks) {
|
|
|
1056
1069
|
}, []);
|
|
1057
1070
|
const handleFaceCapture = useCallback(async () => {
|
|
1058
1071
|
if (!videoRef.current) return;
|
|
1059
|
-
const
|
|
1072
|
+
const reducedThreshold = 0.08;
|
|
1060
1073
|
const currentAbsYaw = livenessStateRef.current.currentAbsYaw;
|
|
1061
1074
|
if (currentAbsYaw === null || currentAbsYaw === void 0) {
|
|
1062
1075
|
setState((prev) => ({
|
|
@@ -1065,7 +1078,7 @@ function useFaceScan(videoRef, canvasRef, callbacks) {
|
|
|
1065
1078
|
}));
|
|
1066
1079
|
return;
|
|
1067
1080
|
}
|
|
1068
|
-
if (currentAbsYaw >=
|
|
1081
|
+
if (currentAbsYaw >= reducedThreshold) {
|
|
1069
1082
|
setState((prev) => ({
|
|
1070
1083
|
...prev,
|
|
1071
1084
|
livenessInstruction: "Please look straight at the camera before capturing"
|
|
@@ -1312,7 +1325,21 @@ function FaceScanModal({ onComplete }) {
|
|
|
1312
1325
|
const checkSession = async () => {
|
|
1313
1326
|
if (!apiService) return;
|
|
1314
1327
|
try {
|
|
1315
|
-
await apiService.
|
|
1328
|
+
const statusResponse = await apiService.getSessionStatus();
|
|
1329
|
+
const { completed_steps, next_step, status } = statusResponse.data;
|
|
1330
|
+
if (status !== "ACTIVE") {
|
|
1331
|
+
throw new Error("Session expired or inactive");
|
|
1332
|
+
}
|
|
1333
|
+
if (completed_steps.includes(COMPLETED_STEPS.FACE)) {
|
|
1334
|
+
setState((prev) => ({ ...prev, showDocumentUpload: true }));
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
if (next_step !== COMPLETED_STEPS.FACE && next_step !== COMPLETED_STEPS.INITIATED) {
|
|
1338
|
+
if (next_step === COMPLETED_STEPS.DOCS) {
|
|
1339
|
+
setState((prev) => ({ ...prev, showDocumentUpload: true }));
|
|
1340
|
+
return;
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1316
1343
|
setSessionError(null);
|
|
1317
1344
|
} catch (error) {
|
|
1318
1345
|
const message = error.message || "Session expired or inactive";
|
|
@@ -1323,7 +1350,7 @@ function FaceScanModal({ onComplete }) {
|
|
|
1323
1350
|
}
|
|
1324
1351
|
};
|
|
1325
1352
|
checkSession();
|
|
1326
|
-
}, [apiService, navigate]);
|
|
1353
|
+
}, [apiService, navigate, setState]);
|
|
1327
1354
|
useEffect(() => {
|
|
1328
1355
|
setState((prev) => ({ ...prev, cameraReady }));
|
|
1329
1356
|
}, [cameraReady, setState]);
|