@koraidv/react 1.7.8 → 1.7.10
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -19
- package/dist/index.mjs +25 -19
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -87,7 +87,7 @@ interface UseKoraIDVReturn {
|
|
|
87
87
|
/**
|
|
88
88
|
* Upload document image
|
|
89
89
|
*/
|
|
90
|
-
uploadDocument: (imageData: Blob, side: 'front' | 'back') => Promise<boolean>;
|
|
90
|
+
uploadDocument: (imageData: Blob, side: 'front' | 'back', country?: string) => Promise<boolean>;
|
|
91
91
|
/**
|
|
92
92
|
* Upload selfie image
|
|
93
93
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ interface UseKoraIDVReturn {
|
|
|
87
87
|
/**
|
|
88
88
|
* Upload document image
|
|
89
89
|
*/
|
|
90
|
-
uploadDocument: (imageData: Blob, side: 'front' | 'back') => Promise<boolean>;
|
|
90
|
+
uploadDocument: (imageData: Blob, side: 'front' | 'back', country?: string) => Promise<boolean>;
|
|
91
91
|
/**
|
|
92
92
|
* Upload selfie image
|
|
93
93
|
*/
|
package/dist/index.js
CHANGED
|
@@ -191,11 +191,11 @@ function useKoraIDV() {
|
|
|
191
191
|
[sdk, selectedDocumentType]
|
|
192
192
|
);
|
|
193
193
|
const uploadDocument = (0, import_react2.useCallback)(
|
|
194
|
-
async (imageData, side) => {
|
|
194
|
+
async (imageData, side, country) => {
|
|
195
195
|
if (!selectedDocumentType) return false;
|
|
196
196
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
197
197
|
try {
|
|
198
|
-
const result = await sdk.uploadDocument(imageData, side, selectedDocumentType);
|
|
198
|
+
const result = await sdk.uploadDocument(imageData, side, selectedDocumentType, country);
|
|
199
199
|
if (result.success) {
|
|
200
200
|
if (side === "front") {
|
|
201
201
|
setDocumentFrontCaptured(true);
|
|
@@ -1509,13 +1509,18 @@ function ProcessingScreen({ steps }) {
|
|
|
1509
1509
|
] });
|
|
1510
1510
|
}
|
|
1511
1511
|
function computeScoreBreakdown(verification) {
|
|
1512
|
-
const
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
const docPercent = Math.round(
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1512
|
+
const livenessPercent = Math.round(
|
|
1513
|
+
verification.scores?.liveness ?? verification.livenessVerification?.livenessScore ?? 0
|
|
1514
|
+
);
|
|
1515
|
+
const docPercent = Math.round(
|
|
1516
|
+
verification.scores?.documentAuth ?? (verification.documentVerification?.authenticityScore ?? 0) * 100
|
|
1517
|
+
);
|
|
1518
|
+
const nameMatch = Math.round(
|
|
1519
|
+
verification.scores?.nameMatch ?? (verification.documentVerification?.firstName && verification.documentVerification?.lastName ? 100 : 0)
|
|
1520
|
+
);
|
|
1521
|
+
const selfiePercent = Math.round(
|
|
1522
|
+
verification.scores?.faceMatch ?? verification.faceVerification?.matchScore ?? 0
|
|
1523
|
+
);
|
|
1519
1524
|
function getStatus(score) {
|
|
1520
1525
|
if (score >= 75) return "pass";
|
|
1521
1526
|
if (score >= 50) return "borderline";
|
|
@@ -2663,7 +2668,9 @@ function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplifie
|
|
|
2663
2668
|
}
|
|
2664
2669
|
}
|
|
2665
2670
|
function SuccessResult({ verification, onDone }) {
|
|
2666
|
-
const score =
|
|
2671
|
+
const score = Math.round(
|
|
2672
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 16)
|
|
2673
|
+
);
|
|
2667
2674
|
const metrics = computeScoreBreakdown(verification);
|
|
2668
2675
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContainer, children: [
|
|
2669
2676
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContent, children: [
|
|
@@ -2704,7 +2711,9 @@ function SuccessResult({ verification, onDone }) {
|
|
|
2704
2711
|
] });
|
|
2705
2712
|
}
|
|
2706
2713
|
function RejectedResult({ verification, onRetry }) {
|
|
2707
|
-
const score =
|
|
2714
|
+
const score = Math.round(
|
|
2715
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 58)
|
|
2716
|
+
);
|
|
2708
2717
|
const metrics = computeScoreBreakdown(verification);
|
|
2709
2718
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContainer, children: [
|
|
2710
2719
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContent, children: [
|
|
@@ -2795,7 +2804,9 @@ function ExpiredResult({ verification, onRetry }) {
|
|
|
2795
2804
|
] });
|
|
2796
2805
|
}
|
|
2797
2806
|
function ManualReviewResult({ verification, onDone }) {
|
|
2798
|
-
const score =
|
|
2807
|
+
const score = Math.round(
|
|
2808
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 32)
|
|
2809
|
+
);
|
|
2799
2810
|
const metrics = computeScoreBreakdown(verification);
|
|
2800
2811
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContainer, children: [
|
|
2801
2812
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: styles.resultContent, children: [
|
|
@@ -3065,11 +3076,6 @@ function VerificationFlow({
|
|
|
3065
3076
|
(0, import_react10.useEffect)(() => {
|
|
3066
3077
|
startVerification(externalId, tier);
|
|
3067
3078
|
}, [externalId, tier, startVerification]);
|
|
3068
|
-
(0, import_react10.useEffect)(() => {
|
|
3069
|
-
if (state.step === "complete" && state.verification && onComplete) {
|
|
3070
|
-
onComplete(state.verification);
|
|
3071
|
-
}
|
|
3072
|
-
}, [state.step, state.verification, onComplete]);
|
|
3073
3079
|
(0, import_react10.useEffect)(() => {
|
|
3074
3080
|
if (state.error && onError) {
|
|
3075
3081
|
onError(state.error);
|
|
@@ -3152,7 +3158,7 @@ function VerificationFlow({
|
|
|
3152
3158
|
{
|
|
3153
3159
|
side: "front",
|
|
3154
3160
|
onQualityCheck: (blob) => checkDocumentQuality(blob),
|
|
3155
|
-
onCapture: (imageData) => uploadDocument(imageData, "front"),
|
|
3161
|
+
onCapture: (imageData) => uploadDocument(imageData, "front", selectedCountry?.id),
|
|
3156
3162
|
onCancel: handleCancel
|
|
3157
3163
|
}
|
|
3158
3164
|
),
|
|
@@ -3167,7 +3173,7 @@ function VerificationFlow({
|
|
|
3167
3173
|
DocumentCaptureScreen,
|
|
3168
3174
|
{
|
|
3169
3175
|
side: "back",
|
|
3170
|
-
onCapture: (imageData) => uploadDocument(imageData, "back"),
|
|
3176
|
+
onCapture: (imageData) => uploadDocument(imageData, "back", selectedCountry?.id),
|
|
3171
3177
|
onCancel: handleCancel
|
|
3172
3178
|
}
|
|
3173
3179
|
),
|
package/dist/index.mjs
CHANGED
|
@@ -142,11 +142,11 @@ function useKoraIDV() {
|
|
|
142
142
|
[sdk, selectedDocumentType]
|
|
143
143
|
);
|
|
144
144
|
const uploadDocument = useCallback(
|
|
145
|
-
async (imageData, side) => {
|
|
145
|
+
async (imageData, side, country) => {
|
|
146
146
|
if (!selectedDocumentType) return false;
|
|
147
147
|
setState((prev) => ({ ...prev, isLoading: true, error: null }));
|
|
148
148
|
try {
|
|
149
|
-
const result = await sdk.uploadDocument(imageData, side, selectedDocumentType);
|
|
149
|
+
const result = await sdk.uploadDocument(imageData, side, selectedDocumentType, country);
|
|
150
150
|
if (result.success) {
|
|
151
151
|
if (side === "front") {
|
|
152
152
|
setDocumentFrontCaptured(true);
|
|
@@ -1460,13 +1460,18 @@ function ProcessingScreen({ steps }) {
|
|
|
1460
1460
|
] });
|
|
1461
1461
|
}
|
|
1462
1462
|
function computeScoreBreakdown(verification) {
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
const docPercent = Math.round(
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
const
|
|
1463
|
+
const livenessPercent = Math.round(
|
|
1464
|
+
verification.scores?.liveness ?? verification.livenessVerification?.livenessScore ?? 0
|
|
1465
|
+
);
|
|
1466
|
+
const docPercent = Math.round(
|
|
1467
|
+
verification.scores?.documentAuth ?? (verification.documentVerification?.authenticityScore ?? 0) * 100
|
|
1468
|
+
);
|
|
1469
|
+
const nameMatch = Math.round(
|
|
1470
|
+
verification.scores?.nameMatch ?? (verification.documentVerification?.firstName && verification.documentVerification?.lastName ? 100 : 0)
|
|
1471
|
+
);
|
|
1472
|
+
const selfiePercent = Math.round(
|
|
1473
|
+
verification.scores?.faceMatch ?? verification.faceVerification?.matchScore ?? 0
|
|
1474
|
+
);
|
|
1470
1475
|
function getStatus(score) {
|
|
1471
1476
|
if (score >= 75) return "pass";
|
|
1472
1477
|
if (score >= 50) return "borderline";
|
|
@@ -2614,7 +2619,9 @@ function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplifie
|
|
|
2614
2619
|
}
|
|
2615
2620
|
}
|
|
2616
2621
|
function SuccessResult({ verification, onDone }) {
|
|
2617
|
-
const score =
|
|
2622
|
+
const score = Math.round(
|
|
2623
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 16)
|
|
2624
|
+
);
|
|
2618
2625
|
const metrics = computeScoreBreakdown(verification);
|
|
2619
2626
|
return /* @__PURE__ */ jsxs9("div", { style: styles.resultContainer, children: [
|
|
2620
2627
|
/* @__PURE__ */ jsxs9("div", { style: styles.resultContent, children: [
|
|
@@ -2655,7 +2662,9 @@ function SuccessResult({ verification, onDone }) {
|
|
|
2655
2662
|
] });
|
|
2656
2663
|
}
|
|
2657
2664
|
function RejectedResult({ verification, onRetry }) {
|
|
2658
|
-
const score =
|
|
2665
|
+
const score = Math.round(
|
|
2666
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 58)
|
|
2667
|
+
);
|
|
2659
2668
|
const metrics = computeScoreBreakdown(verification);
|
|
2660
2669
|
return /* @__PURE__ */ jsxs9("div", { style: styles.resultContainer, children: [
|
|
2661
2670
|
/* @__PURE__ */ jsxs9("div", { style: styles.resultContent, children: [
|
|
@@ -2746,7 +2755,9 @@ function ExpiredResult({ verification, onRetry }) {
|
|
|
2746
2755
|
] });
|
|
2747
2756
|
}
|
|
2748
2757
|
function ManualReviewResult({ verification, onDone }) {
|
|
2749
|
-
const score =
|
|
2758
|
+
const score = Math.round(
|
|
2759
|
+
verification.scores?.overall ?? 100 - (verification.riskScore ?? 32)
|
|
2760
|
+
);
|
|
2750
2761
|
const metrics = computeScoreBreakdown(verification);
|
|
2751
2762
|
return /* @__PURE__ */ jsxs9("div", { style: styles.resultContainer, children: [
|
|
2752
2763
|
/* @__PURE__ */ jsxs9("div", { style: styles.resultContent, children: [
|
|
@@ -3016,11 +3027,6 @@ function VerificationFlow({
|
|
|
3016
3027
|
useEffect8(() => {
|
|
3017
3028
|
startVerification(externalId, tier);
|
|
3018
3029
|
}, [externalId, tier, startVerification]);
|
|
3019
|
-
useEffect8(() => {
|
|
3020
|
-
if (state.step === "complete" && state.verification && onComplete) {
|
|
3021
|
-
onComplete(state.verification);
|
|
3022
|
-
}
|
|
3023
|
-
}, [state.step, state.verification, onComplete]);
|
|
3024
3030
|
useEffect8(() => {
|
|
3025
3031
|
if (state.error && onError) {
|
|
3026
3032
|
onError(state.error);
|
|
@@ -3103,7 +3109,7 @@ function VerificationFlow({
|
|
|
3103
3109
|
{
|
|
3104
3110
|
side: "front",
|
|
3105
3111
|
onQualityCheck: (blob) => checkDocumentQuality(blob),
|
|
3106
|
-
onCapture: (imageData) => uploadDocument(imageData, "front"),
|
|
3112
|
+
onCapture: (imageData) => uploadDocument(imageData, "front", selectedCountry?.id),
|
|
3107
3113
|
onCancel: handleCancel
|
|
3108
3114
|
}
|
|
3109
3115
|
),
|
|
@@ -3118,7 +3124,7 @@ function VerificationFlow({
|
|
|
3118
3124
|
DocumentCaptureScreen,
|
|
3119
3125
|
{
|
|
3120
3126
|
side: "back",
|
|
3121
|
-
onCapture: (imageData) => uploadDocument(imageData, "back"),
|
|
3127
|
+
onCapture: (imageData) => uploadDocument(imageData, "back", selectedCountry?.id),
|
|
3122
3128
|
onCancel: handleCancel
|
|
3123
3129
|
}
|
|
3124
3130
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koraidv/react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10",
|
|
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.7.
|
|
24
|
+
"@koraidv/core": "^1.7.10"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^18.2.0",
|