@sanctum-key/react-native-sdk 1.0.22 → 1.0.24
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/build/package.json +1 -1
- package/build/src/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/src/components/KYCElements/CountrySelectionTemplate.js +131 -26
- package/build/src/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/src/components/KYCElements/IDCardCapture.js +12 -1
- package/build/src/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/src/config/region_mapping.js +14 -14
- package/build/src/config/region_mapping.js.map +1 -1
- package/build/src/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/src/modules/api/CardAuthentification.js +10 -2
- package/build/src/modules/api/CardAuthentification.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +161 -29
- package/src/components/KYCElements/IDCardCapture.tsx +13 -1
- package/src/config/region_mapping.ts +14 -14
- package/src/modules/api/CardAuthentification.ts +16 -5
|
@@ -132,6 +132,11 @@ export async function frontVerification(
|
|
|
132
132
|
token: token,
|
|
133
133
|
postfix: result.currentSide || 'front'
|
|
134
134
|
});
|
|
135
|
+
|
|
136
|
+
if (documentData && documentData.data && Object.keys(documentData.data).length === 0) {
|
|
137
|
+
logger.log("Front OCR Extraction Failed: Backend returned empty data dict.");
|
|
138
|
+
throw new Error("Impossible de lire les informations du document. L'image est peut-être floue ou mal éclairée.");
|
|
139
|
+
}
|
|
135
140
|
} catch (err: any) {
|
|
136
141
|
logger.log("Front OCR Extraction Error:", err?.message || err);
|
|
137
142
|
}
|
|
@@ -203,8 +208,8 @@ export async function backVerification(
|
|
|
203
208
|
templatePath?: string,
|
|
204
209
|
mrzType?: string,
|
|
205
210
|
templateResponse?: ApiVerificationResponse,
|
|
206
|
-
issuingSubdivision?: string,
|
|
207
|
-
frontTemplatePath?: string
|
|
211
|
+
issuingSubdivision?: string, // Capture province/state
|
|
212
|
+
frontTemplatePath?: string // Capture the front template to compare against
|
|
208
213
|
},
|
|
209
214
|
env: KycEnvironment = 'PRODUCTION'
|
|
210
215
|
) {
|
|
@@ -273,7 +278,7 @@ export async function backVerification(
|
|
|
273
278
|
if (!cardData) throw new Error('CARD_NOT_FULLY_IN_FRAME');
|
|
274
279
|
|
|
275
280
|
let points: number[][] | null = null;
|
|
276
|
-
console.log(points)
|
|
281
|
+
console.log(points);
|
|
277
282
|
let isCardInFrame = false;
|
|
278
283
|
let hasCroppedSides = true;
|
|
279
284
|
|
|
@@ -320,7 +325,7 @@ export async function backVerification(
|
|
|
320
325
|
if (frontPy && backPy) {
|
|
321
326
|
logger.log(`Validating Front (${frontPy}) vs Back (${backPy}) for region ${result.code}`);
|
|
322
327
|
|
|
323
|
-
const isCanadianSubRegionDoc = result.code === 'CA' && ['
|
|
328
|
+
const isCanadianSubRegionDoc = result.code === 'CA' && ['xxx'].includes(result.selectedDocumentType);
|
|
324
329
|
const safeSubRegion = isCanadianSubRegionDoc ? (result.issuingSubdivision || "") : "";
|
|
325
330
|
|
|
326
331
|
const matchValidation = await kycService.validateBackTemplate({
|
|
@@ -358,9 +363,16 @@ export async function backVerification(
|
|
|
358
363
|
token: token,
|
|
359
364
|
postfix: result.currentSide || 'back'
|
|
360
365
|
});
|
|
366
|
+
|
|
367
|
+
if (documentData && documentData.data && Object.keys(documentData.data).length === 0) {
|
|
368
|
+
logger.log("Back OCR Extraction Failed: Backend returned empty data dict.");
|
|
369
|
+
throw new Error("Impossible de lire les informations du document. L'image est peut-être floue ou mal éclairée.");
|
|
370
|
+
}
|
|
371
|
+
|
|
361
372
|
extractionResult.documentData = documentData;
|
|
362
373
|
} catch (err: any) {
|
|
363
374
|
logger.log("Back OCR Extraction Error:", err?.message || err);
|
|
375
|
+
throw new Error(err?.message || "Impossible d'extraire les données. Veuillez reprendre la photo.");
|
|
364
376
|
}
|
|
365
377
|
}
|
|
366
378
|
|
|
@@ -395,7 +407,6 @@ export async function backVerification(
|
|
|
395
407
|
const barcode = await kycService.extractBarcode({ fileUri: result.path!, token: token }, env);
|
|
396
408
|
extractionResult.barcode = barcode;
|
|
397
409
|
} catch (e: any) {
|
|
398
|
-
// If it explicitly expects a barcode (and not an MRZ) and fails, throw to user
|
|
399
410
|
if (!extractionResult.mrz) {
|
|
400
411
|
throw new Error(`Lecture Barcode échouée: ${e?.message}`);
|
|
401
412
|
}
|