@trustchex/react-native-sdk 1.481.1 → 1.484.0
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 +14 -5
- package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +0 -3
- package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +21 -0
- package/lib/module/Screens/Dynamic/VideoCallScreen.js +1 -1
- package/lib/module/Screens/Static/ResultScreen.js +33 -10
- package/lib/module/Shared/Components/EIDScanner.js +52 -19
- package/lib/module/Shared/Contexts/AppContext.js +3 -0
- package/lib/module/Shared/EIDReader/eidReader.js +18 -1
- package/lib/module/Shared/EIDReader/lds/icao/dg11File.js +77 -0
- package/lib/module/Shared/EIDReader/lds/icao/mrzInfo.js +4 -4
- package/lib/module/Shared/Libs/documentDataNormalizer.js +104 -0
- package/lib/module/Shared/Libs/mrz.utils.js +0 -5
- package/lib/module/Shared/Libs/mrzTransliteration.js +80 -0
- package/lib/module/Shared/Services/DataUploadService.js +6 -3
- package/lib/module/Shared/Types/documentData.js +1 -0
- package/lib/module/Shared/Types/documentReadResult.js +3 -0
- package/lib/module/Trustchex.js +12 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -1
- package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +5 -0
- package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts +2 -0
- package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg11File.d.ts +35 -0
- package/lib/typescript/src/Shared/EIDReader/lds/icao/dg11File.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/documentDataNormalizer.d.ts +12 -0
- package/lib/typescript/src/Shared/Libs/documentDataNormalizer.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Libs/mrzTransliteration.d.ts +3 -0
- package/lib/typescript/src/Shared/Libs/mrzTransliteration.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts +3 -2
- package/lib/typescript/src/Shared/Services/DataUploadService.d.ts.map +1 -1
- package/lib/typescript/src/Shared/Types/documentData.d.ts +44 -0
- package/lib/typescript/src/Shared/Types/documentData.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/documentReadResult.d.ts +44 -0
- package/lib/typescript/src/Shared/Types/documentReadResult.d.ts.map +1 -0
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts +1 -1
- package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -1
- package/lib/typescript/src/Trustchex.d.ts +9 -0
- package/lib/typescript/src/Trustchex.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +0 -4
- package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +23 -0
- package/src/Screens/Dynamic/VideoCallScreen.tsx +5 -1
- package/src/Screens/Static/ResultScreen.tsx +39 -15
- package/src/Shared/Components/EIDScanner.tsx +67 -18
- package/src/Shared/Contexts/AppContext.ts +8 -0
- package/src/Shared/EIDReader/eidReader.ts +27 -1
- package/src/Shared/EIDReader/lds/icao/dg11File.ts +94 -0
- package/src/Shared/EIDReader/lds/icao/mrzInfo.ts +4 -4
- package/src/Shared/Libs/documentDataNormalizer.ts +108 -0
- package/src/Shared/Libs/mrz.utils.ts +0 -5
- package/src/Shared/Libs/mrzTransliteration.ts +131 -0
- package/src/Shared/Services/DataUploadService.ts +9 -3
- package/src/Shared/Types/documentData.ts +52 -0
- package/src/Shared/Types/documentReadResult.ts +47 -0
- package/src/Shared/Types/mrzFields.ts +0 -5
- package/src/Trustchex.tsx +22 -0
- package/src/index.tsx +7 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { DocumentName } from '../Types/documentReadResult';
|
|
2
|
+
|
|
3
|
+
type DigraphMap = [string, string][];
|
|
4
|
+
|
|
5
|
+
// ICAO 9303 digraphs safe to apply universally — these appear across many
|
|
6
|
+
// national variants and are unlikely to collide with real letter sequences.
|
|
7
|
+
// SS→ß, TH→Þ etc. are excluded: too ambiguous (HASSAN, THOMAS).
|
|
8
|
+
const UNIVERSAL: DigraphMap = [
|
|
9
|
+
['OE', 'Ö'],
|
|
10
|
+
['UE', 'Ü'],
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const GERMAN: DigraphMap = [
|
|
14
|
+
['AE', 'Ä'],
|
|
15
|
+
['OE', 'Ö'],
|
|
16
|
+
['UE', 'Ü'],
|
|
17
|
+
['SS', 'ß'],
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const SWEDISH: DigraphMap = [
|
|
21
|
+
['AA', 'Å'],
|
|
22
|
+
['AE', 'Æ'],
|
|
23
|
+
['OE', 'Ø'],
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const DANISH: DigraphMap = [
|
|
27
|
+
['AA', 'Å'],
|
|
28
|
+
['AE', 'Æ'],
|
|
29
|
+
['OE', 'Ø'],
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
const NORWEGIAN: DigraphMap = [
|
|
33
|
+
['AA', 'Å'],
|
|
34
|
+
['AE', 'Æ'],
|
|
35
|
+
['OE', 'Ø'],
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const FRENCH: DigraphMap = [
|
|
39
|
+
['OE', 'Œ'],
|
|
40
|
+
['AE', 'Æ'],
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const ICELANDIC: DigraphMap = [
|
|
44
|
+
['AE', 'Æ'],
|
|
45
|
+
['OE', 'Ö'],
|
|
46
|
+
['TH', 'Þ'],
|
|
47
|
+
['D', 'Ð'],
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const COUNTRY_MAP: Record<string, DigraphMap> = {
|
|
51
|
+
DEU: GERMAN,
|
|
52
|
+
AUT: GERMAN,
|
|
53
|
+
CHE: GERMAN,
|
|
54
|
+
SWE: SWEDISH,
|
|
55
|
+
DNK: DANISH,
|
|
56
|
+
NOR: NORWEGIAN,
|
|
57
|
+
FRA: FRENCH,
|
|
58
|
+
LUX: FRENCH,
|
|
59
|
+
ISL: ICELANDIC,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function applyDigraphMap(token: string, map: DigraphMap): string {
|
|
63
|
+
let result = '';
|
|
64
|
+
let i = 0;
|
|
65
|
+
while (i < token.length) {
|
|
66
|
+
let matched = false;
|
|
67
|
+
for (const [digraph, unicode] of map) {
|
|
68
|
+
if (token.startsWith(digraph, i)) {
|
|
69
|
+
result += unicode;
|
|
70
|
+
i += digraph.length;
|
|
71
|
+
matched = true;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!matched) {
|
|
76
|
+
result += token[i];
|
|
77
|
+
i++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function convertName(rawName: string, map: DigraphMap): string {
|
|
84
|
+
return rawName
|
|
85
|
+
.split(' ')
|
|
86
|
+
.map((word) => applyDigraphMap(word, map))
|
|
87
|
+
.join(' ');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function buildDocumentName(
|
|
91
|
+
rawFirst: string,
|
|
92
|
+
rawLast: string,
|
|
93
|
+
issuingState: string | null | undefined,
|
|
94
|
+
dg11First?: string | null,
|
|
95
|
+
dg11Last?: string | null
|
|
96
|
+
): DocumentName {
|
|
97
|
+
if (dg11First != null && dg11Last != null && (dg11First || dg11Last)) {
|
|
98
|
+
return {
|
|
99
|
+
rawFirst,
|
|
100
|
+
rawLast,
|
|
101
|
+
displayFirst: dg11First,
|
|
102
|
+
displayLast: dg11Last,
|
|
103
|
+
source: 'dg11',
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const country = (issuingState ?? '').toUpperCase().trim();
|
|
108
|
+
const map = COUNTRY_MAP[country];
|
|
109
|
+
|
|
110
|
+
if (map) {
|
|
111
|
+
return {
|
|
112
|
+
rawFirst,
|
|
113
|
+
rawLast,
|
|
114
|
+
displayFirst: convertName(rawFirst, map),
|
|
115
|
+
displayLast: convertName(rawLast, map),
|
|
116
|
+
source: 'reverse_table',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// No country-specific table: apply OE→Ö and UE→Ü universally.
|
|
121
|
+
const displayFirst = convertName(rawFirst, UNIVERSAL);
|
|
122
|
+
const displayLast = convertName(rawLast, UNIVERSAL);
|
|
123
|
+
const changed = displayFirst !== rawFirst || displayLast !== rawLast;
|
|
124
|
+
return {
|
|
125
|
+
rawFirst,
|
|
126
|
+
rawLast,
|
|
127
|
+
displayFirst,
|
|
128
|
+
displayLast,
|
|
129
|
+
source: changed ? 'reverse_table' : 'raw',
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
ScannedIdentityDocument,
|
|
6
6
|
LivenessDetection,
|
|
7
7
|
} from '../Types/identificationInfo';
|
|
8
|
+
import type { DocumentName } from '../Types/documentReadResult';
|
|
8
9
|
import { getSessionKey, encryptWithAes } from '../Libs/crypto.utils';
|
|
9
10
|
import mrzUtils from '../Libs/mrz.utils';
|
|
10
11
|
import httpClient, { getSessionToken } from '../Libs/http-client';
|
|
@@ -46,7 +47,8 @@ export class DataUploadService {
|
|
|
46
47
|
async submitDocumentData(
|
|
47
48
|
identificationId: string,
|
|
48
49
|
scannedDocument: ScannedIdentityDocument,
|
|
49
|
-
sessionKey: string
|
|
50
|
+
sessionKey: string,
|
|
51
|
+
documentName?: DocumentName
|
|
50
52
|
): Promise<void> {
|
|
51
53
|
if (!scannedDocument || scannedDocument.documentType === 'UNKNOWN') {
|
|
52
54
|
debugLog('DataUploadService', 'No document data to submit');
|
|
@@ -63,6 +65,9 @@ export class DataUploadService {
|
|
|
63
65
|
type: mrzFields.documentCode,
|
|
64
66
|
name: mrzFields.firstName,
|
|
65
67
|
surname: mrzFields.lastName,
|
|
68
|
+
displayName: documentName?.source === 'dg11' ? documentName.displayFirst : undefined,
|
|
69
|
+
displaySurname: documentName?.source === 'dg11' ? documentName.displayLast : undefined,
|
|
70
|
+
nameSource: documentName?.source === 'dg11' ? documentName.source : undefined,
|
|
66
71
|
gender: this.getGenderEnumType(mrzFields.sex),
|
|
67
72
|
number: mrzFields.documentNumber,
|
|
68
73
|
country: mrzFields.issuingState,
|
|
@@ -270,7 +275,8 @@ export class DataUploadService {
|
|
|
270
275
|
*/
|
|
271
276
|
async uploadCollectedData(
|
|
272
277
|
identificationInfo: IdentificationInfo,
|
|
273
|
-
onProgress?: (progress: number) => void
|
|
278
|
+
onProgress?: (progress: number) => void,
|
|
279
|
+
documentName?: DocumentName
|
|
274
280
|
): Promise<boolean> {
|
|
275
281
|
const { identificationId, sessionId, scannedDocument, livenessDetection } =
|
|
276
282
|
identificationInfo;
|
|
@@ -329,7 +335,7 @@ export class DataUploadService {
|
|
|
329
335
|
if (scannedDocument) {
|
|
330
336
|
onProgress?.(0.1);
|
|
331
337
|
await runWithRetry(() =>
|
|
332
|
-
this.submitDocumentData(identificationId, scannedDocument, authToken)
|
|
338
|
+
this.submitDocumentData(identificationId, scannedDocument, authToken, documentName)
|
|
333
339
|
);
|
|
334
340
|
onProgress?.(0.3);
|
|
335
341
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified, source-independent document data produced after a scan — whether
|
|
3
|
+
* the data came from an NFC chip read or camera OCR. All fields are normalized
|
|
4
|
+
* to consistent formats regardless of which path produced them.
|
|
5
|
+
*/
|
|
6
|
+
export interface DocumentData {
|
|
7
|
+
/**
|
|
8
|
+
* Document type.
|
|
9
|
+
* - `"P"` — passport (TD3)
|
|
10
|
+
* - `"I"` — ID card (TD1 / TD2)
|
|
11
|
+
*/
|
|
12
|
+
documentType: 'P' | 'I' | string;
|
|
13
|
+
|
|
14
|
+
/** 3-letter ICAO issuing country code, e.g. `"TUR"`, `"DEU"`. */
|
|
15
|
+
issuingCountry: string;
|
|
16
|
+
|
|
17
|
+
/** 3-letter ICAO nationality code, e.g. `"TUR"`. */
|
|
18
|
+
nationality: string;
|
|
19
|
+
|
|
20
|
+
/** Document serial / number exactly as encoded on the document. */
|
|
21
|
+
documentNumber: string;
|
|
22
|
+
|
|
23
|
+
/** National identity number where applicable (e.g. Turkish TC kimlik no). Null if not present. */
|
|
24
|
+
personalNumber: string | null;
|
|
25
|
+
|
|
26
|
+
/** Last name — raw MRZ ASCII (OCR-B), e.g. `"OEZTUERK"`. */
|
|
27
|
+
lastName: string;
|
|
28
|
+
|
|
29
|
+
/** First name(s) — raw MRZ ASCII (OCR-B), e.g. `"GOEKHAN MEHMET"`. */
|
|
30
|
+
firstName: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Sex / gender.
|
|
34
|
+
* - `"M"` — male
|
|
35
|
+
* - `"F"` — female
|
|
36
|
+
* - `"X"` — unspecified / non-binary
|
|
37
|
+
* - `"U"` — unknown (not encoded on document)
|
|
38
|
+
*/
|
|
39
|
+
sex: 'M' | 'F' | 'X' | 'U';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Date of birth in `YYYY-MM-DD` format, e.g. `"1985-01-15"`.
|
|
43
|
+
* Null if the document does not encode it.
|
|
44
|
+
*/
|
|
45
|
+
dateOfBirth: string | null;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Document expiry date in `YYYY-MM-DD` format, e.g. `"2030-12-31"`.
|
|
49
|
+
* Null if the document does not encode it.
|
|
50
|
+
*/
|
|
51
|
+
dateOfExpiry: string | null;
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DocumentData } from './documentData';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* How the display name was derived from the raw MRZ ASCII name.
|
|
5
|
+
*
|
|
6
|
+
* - `dg11` — read from the chip's DG11 supplemental data file (exact printed name)
|
|
7
|
+
* - `reverse_table` — reconstructed via country-aware ICAO 9303 reverse transliteration table
|
|
8
|
+
* - `raw` — no conversion applied; display equals the raw MRZ value
|
|
9
|
+
*/
|
|
10
|
+
export type DocumentNameSource = 'dg11' | 'reverse_table' | 'raw';
|
|
11
|
+
|
|
12
|
+
export interface DocumentName {
|
|
13
|
+
/** First name exactly as stored in the MRZ (ASCII, OCR-B, e.g. "GOEKHAN"). */
|
|
14
|
+
rawFirst: string;
|
|
15
|
+
/** Last name exactly as stored in the MRZ (ASCII, OCR-B, e.g. "OEZTUERK"). */
|
|
16
|
+
rawLast: string;
|
|
17
|
+
/** First name in best available Unicode form (e.g. "GÖKHAN"). */
|
|
18
|
+
displayFirst: string;
|
|
19
|
+
/** Last name in best available Unicode form (e.g. "ÖZTÜRK"). */
|
|
20
|
+
displayLast: string;
|
|
21
|
+
/** How displayFirst / displayLast were derived. */
|
|
22
|
+
source: DocumentNameSource;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface DocumentFaceImage {
|
|
26
|
+
/** Base64-encoded image data (no data-URI prefix). */
|
|
27
|
+
data: string;
|
|
28
|
+
/** MIME type, e.g. "image/jpeg" or "image/png". */
|
|
29
|
+
mimeType: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DocumentReadResult {
|
|
33
|
+
/** Normalized document data — consistent shape regardless of NFC or OCR source. */
|
|
34
|
+
document: DocumentData;
|
|
35
|
+
/**
|
|
36
|
+
* Name in both raw MRZ ASCII form and best-available Unicode display form.
|
|
37
|
+
* rawFirst / rawLast mirror document.firstName / document.lastName.
|
|
38
|
+
* displayFirst / displayLast are the Unicode-converted equivalents.
|
|
39
|
+
*/
|
|
40
|
+
name: DocumentName;
|
|
41
|
+
/**
|
|
42
|
+
* Face image — from the chip's DG2 file on the NFC path, or extracted from
|
|
43
|
+
* the document photo on the camera OCR path. Optional: only present when a
|
|
44
|
+
* face image was successfully obtained.
|
|
45
|
+
*/
|
|
46
|
+
face?: DocumentFaceImage;
|
|
47
|
+
}
|
|
@@ -7,18 +7,13 @@ export type MRZFieldName =
|
|
|
7
7
|
| 'documentCode'
|
|
8
8
|
| 'issuingState'
|
|
9
9
|
| 'documentNumber'
|
|
10
|
-
| 'documentNumberCheckDigit'
|
|
11
10
|
| 'nationality'
|
|
12
11
|
| 'lastName'
|
|
13
12
|
| 'firstName'
|
|
14
13
|
| 'sex'
|
|
15
14
|
| 'birthDate'
|
|
16
|
-
| 'birthDateCheckDigit'
|
|
17
15
|
| 'expirationDate'
|
|
18
|
-
| 'expirationDateCheckDigit'
|
|
19
16
|
| 'personalNumber'
|
|
20
|
-
| 'personalNumberCheckDigit'
|
|
21
|
-
| 'compositeCheckDigit'
|
|
22
17
|
| 'optional1'
|
|
23
18
|
| 'optional2';
|
|
24
19
|
|
package/src/Trustchex.tsx
CHANGED
|
@@ -28,6 +28,7 @@ import MRZTestScreen from './Screens/Debug/MRZTestScreen';
|
|
|
28
28
|
import BarcodeTestScreen from './Screens/Debug/BarcodeTestScreen';
|
|
29
29
|
import NFCScanTestScreen from './Screens/Debug/NFCScanTestScreen';
|
|
30
30
|
import AppContext, { type AppContextType } from './Shared/Contexts/AppContext';
|
|
31
|
+
import type { DocumentReadResult } from './Shared/Types/documentReadResult';
|
|
31
32
|
import DebugNavigationPanel from './Shared/Components/DebugNavigationPanel';
|
|
32
33
|
import i18n from './Translation';
|
|
33
34
|
import { initializeTTS } from './Shared/Libs/tts.utils';
|
|
@@ -55,6 +56,14 @@ interface TrustchexProps {
|
|
|
55
56
|
locale?: 'en' | 'tr';
|
|
56
57
|
onCompleted?: () => void;
|
|
57
58
|
onError?: (error: string) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Called as soon as document data is available — immediately after a
|
|
61
|
+
* successful NFC chip read (before the user taps "Approve and Continue")
|
|
62
|
+
* or after a successful camera OCR scan. Receives MRZ fields (raw,
|
|
63
|
+
* untouched ASCII), a name object with both raw and best-available Unicode
|
|
64
|
+
* display form, and optionally the face image.
|
|
65
|
+
*/
|
|
66
|
+
onDocumentRead?: (result: DocumentReadResult) => void;
|
|
58
67
|
enableAnalytics?: boolean;
|
|
59
68
|
debug?: boolean;
|
|
60
69
|
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
@@ -74,6 +83,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
74
83
|
locale: propLocale,
|
|
75
84
|
onCompleted,
|
|
76
85
|
onError,
|
|
86
|
+
onDocumentRead,
|
|
77
87
|
enableAnalytics = true,
|
|
78
88
|
debug = false,
|
|
79
89
|
logLevel = 'trace',
|
|
@@ -86,6 +96,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
86
96
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
87
97
|
const [analyticsInitialized, setAnalyticsInitialized] = useState(false);
|
|
88
98
|
const [isDemoSession, setIsDemoSession] = useState(false);
|
|
99
|
+
const [lastDocumentRead, setLastDocumentReadState] = useState<DocumentReadResult | undefined>(undefined);
|
|
89
100
|
|
|
90
101
|
const branding = useMemo(
|
|
91
102
|
() => ({
|
|
@@ -116,6 +127,13 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
116
127
|
setIsDemoSession(value);
|
|
117
128
|
}, []);
|
|
118
129
|
|
|
130
|
+
const setLastDocumentRead = useCallback((result: DocumentReadResult) => {
|
|
131
|
+
if (contextRef.current) {
|
|
132
|
+
contextRef.current.lastDocumentRead = result;
|
|
133
|
+
}
|
|
134
|
+
setLastDocumentReadState(result);
|
|
135
|
+
}, []);
|
|
136
|
+
|
|
119
137
|
const contextValue = useMemo(() => {
|
|
120
138
|
const prev = contextRef.current;
|
|
121
139
|
|
|
@@ -142,8 +160,11 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
142
160
|
currentWorkflowStep: prev?.currentWorkflowStep,
|
|
143
161
|
isDebugNavigated: prev?.isDebugNavigated,
|
|
144
162
|
isTestVideoSession: prev?.isTestVideoSession,
|
|
163
|
+
lastDocumentRead,
|
|
145
164
|
onCompleted,
|
|
146
165
|
onError,
|
|
166
|
+
onDocumentRead,
|
|
167
|
+
setLastDocumentRead,
|
|
147
168
|
setSessionId,
|
|
148
169
|
setBaseUrl,
|
|
149
170
|
setIsDemoSession: setIsDemoSessionAndPersist,
|
|
@@ -168,6 +189,7 @@ const Trustchex: React.FC<TrustchexProps> = ({
|
|
|
168
189
|
onCompleted,
|
|
169
190
|
onError,
|
|
170
191
|
isDemoSession,
|
|
192
|
+
lastDocumentRead,
|
|
171
193
|
setIsDemoSessionAndPersist,
|
|
172
194
|
]);
|
|
173
195
|
|
package/src/index.tsx
CHANGED
|
@@ -51,5 +51,12 @@ export type {
|
|
|
51
51
|
export { default as mrzUtils } from './Shared/Libs/mrz.utils';
|
|
52
52
|
export type { MRZFormat, MRZValidationResult } from './Shared/Libs/mrz.utils';
|
|
53
53
|
export type { MRZFields, MRZFieldName } from './Shared/Types/mrzFields';
|
|
54
|
+
export type { DocumentData } from './Shared/Types/documentData';
|
|
55
|
+
export type {
|
|
56
|
+
DocumentReadResult,
|
|
57
|
+
DocumentName,
|
|
58
|
+
DocumentNameSource,
|
|
59
|
+
DocumentFaceImage,
|
|
60
|
+
} from './Shared/Types/documentReadResult';
|
|
54
61
|
|
|
55
62
|
export default Trustchex;
|
package/src/version.ts
CHANGED