@koraidv/react 1.8.0 → 1.8.2
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/index.js +33 -8
- package/dist/index.mjs +33 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -101,8 +101,10 @@ function useKoraIDV() {
|
|
|
101
101
|
});
|
|
102
102
|
const [selectedDocumentType, setSelectedDocumentType] = (0, import_react2.useState)(null);
|
|
103
103
|
const [documentFrontCaptured, setDocumentFrontCaptured] = (0, import_react2.useState)(false);
|
|
104
|
+
const lastStartArgsRef = (0, import_react2.useRef)(null);
|
|
104
105
|
const startVerification = (0, import_react2.useCallback)(
|
|
105
106
|
async (externalId, tier = "standard", expectedFirstName, expectedLastName) => {
|
|
107
|
+
lastStartArgsRef.current = { externalId, tier, expectedFirstName, expectedLastName };
|
|
106
108
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
107
109
|
try {
|
|
108
110
|
await sdk.startVerification(
|
|
@@ -363,14 +365,28 @@ function useKoraIDV() {
|
|
|
363
365
|
error: null,
|
|
364
366
|
lastChallengeError: null
|
|
365
367
|
});
|
|
368
|
+
setSelectedDocumentType(null);
|
|
369
|
+
setDocumentFrontCaptured(false);
|
|
366
370
|
}, [sdk]);
|
|
367
371
|
const retry = (0, import_react2.useCallback)(() => {
|
|
368
|
-
|
|
369
|
-
|
|
372
|
+
const args = lastStartArgsRef.current;
|
|
373
|
+
sdk.reset();
|
|
374
|
+
setState({
|
|
375
|
+
step: "consent",
|
|
376
|
+
verification: null,
|
|
377
|
+
livenessSession: null,
|
|
378
|
+
currentChallenge: null,
|
|
379
|
+
completedChallenges: 0,
|
|
380
|
+
isLoading: false,
|
|
370
381
|
error: null,
|
|
371
|
-
|
|
372
|
-
})
|
|
373
|
-
|
|
382
|
+
lastChallengeError: null
|
|
383
|
+
});
|
|
384
|
+
setSelectedDocumentType(null);
|
|
385
|
+
setDocumentFrontCaptured(false);
|
|
386
|
+
if (args) {
|
|
387
|
+
startVerification(args.externalId, args.tier, args.expectedFirstName, args.expectedLastName);
|
|
388
|
+
}
|
|
389
|
+
}, [sdk, startVerification]);
|
|
374
390
|
return {
|
|
375
391
|
state,
|
|
376
392
|
startVerification,
|
|
@@ -1586,6 +1602,7 @@ function ProcessingScreen({ steps, autoAdvance = true }) {
|
|
|
1586
1602
|
] });
|
|
1587
1603
|
}
|
|
1588
1604
|
function computeScoreBreakdown(verification) {
|
|
1605
|
+
const source = verification.metadata?.source ?? "";
|
|
1589
1606
|
const livenessPercent = Math.round(
|
|
1590
1607
|
verification.scores?.liveness ?? verification.livenessVerification?.livenessScore ?? 0
|
|
1591
1608
|
);
|
|
@@ -1598,9 +1615,12 @@ function computeScoreBreakdown(verification) {
|
|
|
1598
1615
|
const selfiePercent = Math.round(
|
|
1599
1616
|
verification.scores?.faceMatch ?? verification.faceVerification?.matchScore ?? 0
|
|
1600
1617
|
);
|
|
1618
|
+
const isWeb = source === "web";
|
|
1619
|
+
const passFloor = isWeb ? 65 : 75;
|
|
1620
|
+
const borderlineFloor = isWeb ? 40 : 50;
|
|
1601
1621
|
function getStatus(score) {
|
|
1602
|
-
if (score >=
|
|
1603
|
-
if (score >=
|
|
1622
|
+
if (score >= passFloor) return "pass";
|
|
1623
|
+
if (score >= borderlineFloor) return "borderline";
|
|
1604
1624
|
return "fail";
|
|
1605
1625
|
}
|
|
1606
1626
|
function getMessage(status) {
|
|
@@ -3654,7 +3674,12 @@ function VerificationFlow({
|
|
|
3654
3674
|
{
|
|
3655
3675
|
verification: state.verification,
|
|
3656
3676
|
onDone: () => onComplete?.(state.verification),
|
|
3657
|
-
onRetry:
|
|
3677
|
+
onRetry: () => {
|
|
3678
|
+
setFlowStep("consent");
|
|
3679
|
+
setSelectedCountry(null);
|
|
3680
|
+
setShowFlipInstruction(true);
|
|
3681
|
+
retry();
|
|
3682
|
+
}
|
|
3658
3683
|
}
|
|
3659
3684
|
)
|
|
3660
3685
|
] });
|
package/dist/index.mjs
CHANGED
|
@@ -52,8 +52,10 @@ function useKoraIDV() {
|
|
|
52
52
|
});
|
|
53
53
|
const [selectedDocumentType, setSelectedDocumentType] = useState(null);
|
|
54
54
|
const [documentFrontCaptured, setDocumentFrontCaptured] = useState(false);
|
|
55
|
+
const lastStartArgsRef = useRef(null);
|
|
55
56
|
const startVerification = useCallback(
|
|
56
57
|
async (externalId, tier = "standard", expectedFirstName, expectedLastName) => {
|
|
58
|
+
lastStartArgsRef.current = { externalId, tier, expectedFirstName, expectedLastName };
|
|
57
59
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
58
60
|
try {
|
|
59
61
|
await sdk.startVerification(
|
|
@@ -314,14 +316,28 @@ function useKoraIDV() {
|
|
|
314
316
|
error: null,
|
|
315
317
|
lastChallengeError: null
|
|
316
318
|
});
|
|
319
|
+
setSelectedDocumentType(null);
|
|
320
|
+
setDocumentFrontCaptured(false);
|
|
317
321
|
}, [sdk]);
|
|
318
322
|
const retry = useCallback(() => {
|
|
319
|
-
|
|
320
|
-
|
|
323
|
+
const args = lastStartArgsRef.current;
|
|
324
|
+
sdk.reset();
|
|
325
|
+
setState({
|
|
326
|
+
step: "consent",
|
|
327
|
+
verification: null,
|
|
328
|
+
livenessSession: null,
|
|
329
|
+
currentChallenge: null,
|
|
330
|
+
completedChallenges: 0,
|
|
331
|
+
isLoading: false,
|
|
321
332
|
error: null,
|
|
322
|
-
|
|
323
|
-
})
|
|
324
|
-
|
|
333
|
+
lastChallengeError: null
|
|
334
|
+
});
|
|
335
|
+
setSelectedDocumentType(null);
|
|
336
|
+
setDocumentFrontCaptured(false);
|
|
337
|
+
if (args) {
|
|
338
|
+
startVerification(args.externalId, args.tier, args.expectedFirstName, args.expectedLastName);
|
|
339
|
+
}
|
|
340
|
+
}, [sdk, startVerification]);
|
|
325
341
|
return {
|
|
326
342
|
state,
|
|
327
343
|
startVerification,
|
|
@@ -1537,6 +1553,7 @@ function ProcessingScreen({ steps, autoAdvance = true }) {
|
|
|
1537
1553
|
] });
|
|
1538
1554
|
}
|
|
1539
1555
|
function computeScoreBreakdown(verification) {
|
|
1556
|
+
const source = verification.metadata?.source ?? "";
|
|
1540
1557
|
const livenessPercent = Math.round(
|
|
1541
1558
|
verification.scores?.liveness ?? verification.livenessVerification?.livenessScore ?? 0
|
|
1542
1559
|
);
|
|
@@ -1549,9 +1566,12 @@ function computeScoreBreakdown(verification) {
|
|
|
1549
1566
|
const selfiePercent = Math.round(
|
|
1550
1567
|
verification.scores?.faceMatch ?? verification.faceVerification?.matchScore ?? 0
|
|
1551
1568
|
);
|
|
1569
|
+
const isWeb = source === "web";
|
|
1570
|
+
const passFloor = isWeb ? 65 : 75;
|
|
1571
|
+
const borderlineFloor = isWeb ? 40 : 50;
|
|
1552
1572
|
function getStatus(score) {
|
|
1553
|
-
if (score >=
|
|
1554
|
-
if (score >=
|
|
1573
|
+
if (score >= passFloor) return "pass";
|
|
1574
|
+
if (score >= borderlineFloor) return "borderline";
|
|
1555
1575
|
return "fail";
|
|
1556
1576
|
}
|
|
1557
1577
|
function getMessage(status) {
|
|
@@ -3605,7 +3625,12 @@ function VerificationFlow({
|
|
|
3605
3625
|
{
|
|
3606
3626
|
verification: state.verification,
|
|
3607
3627
|
onDone: () => onComplete?.(state.verification),
|
|
3608
|
-
onRetry:
|
|
3628
|
+
onRetry: () => {
|
|
3629
|
+
setFlowStep("consent");
|
|
3630
|
+
setSelectedCountry(null);
|
|
3631
|
+
setShowFlipInstruction(true);
|
|
3632
|
+
retry();
|
|
3633
|
+
}
|
|
3609
3634
|
}
|
|
3610
3635
|
)
|
|
3611
3636
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koraidv/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"description": "Kora IDV React Components for Identity Verification",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "vitest run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@koraidv/core": "^1.8.
|
|
24
|
+
"@koraidv/core": "^1.8.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^18.2.0",
|