@trustchex/react-native-sdk 1.481.1 → 1.483.4

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.
Files changed (64) hide show
  1. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +0 -3
  2. package/lib/module/Screens/Dynamic/IdentityDocumentScanningScreen.js +21 -0
  3. package/lib/module/Screens/Dynamic/VideoCallScreen.js +1 -1
  4. package/lib/module/Screens/Static/ResultScreen.js +33 -10
  5. package/lib/module/Shared/Components/EIDScanner.js +52 -19
  6. package/lib/module/Shared/Contexts/AppContext.js +3 -0
  7. package/lib/module/Shared/EIDReader/eidReader.js +18 -1
  8. package/lib/module/Shared/EIDReader/lds/icao/dg11File.js +77 -0
  9. package/lib/module/Shared/Libs/documentDataNormalizer.js +104 -0
  10. package/lib/module/Shared/Libs/mrz.utils.js +0 -5
  11. package/lib/module/Shared/Libs/mrzTransliteration.js +80 -0
  12. package/lib/module/Shared/Services/DataUploadService.js +6 -3
  13. package/lib/module/Shared/Types/documentData.js +1 -0
  14. package/lib/module/Shared/Types/documentReadResult.js +3 -0
  15. package/lib/module/Trustchex.js +12 -1
  16. package/lib/module/version.js +1 -1
  17. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  18. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentScanningScreen.d.ts.map +1 -1
  19. package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -1
  20. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  21. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  22. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts +5 -0
  23. package/lib/typescript/src/Shared/Contexts/AppContext.d.ts.map +1 -1
  24. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts +2 -0
  25. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
  26. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg11File.d.ts +35 -0
  27. package/lib/typescript/src/Shared/EIDReader/lds/icao/dg11File.d.ts.map +1 -0
  28. package/lib/typescript/src/Shared/Libs/documentDataNormalizer.d.ts +12 -0
  29. package/lib/typescript/src/Shared/Libs/documentDataNormalizer.d.ts.map +1 -0
  30. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  31. package/lib/typescript/src/Shared/Libs/mrzTransliteration.d.ts +3 -0
  32. package/lib/typescript/src/Shared/Libs/mrzTransliteration.d.ts.map +1 -0
  33. package/lib/typescript/src/Shared/Services/DataUploadService.d.ts +3 -2
  34. package/lib/typescript/src/Shared/Services/DataUploadService.d.ts.map +1 -1
  35. package/lib/typescript/src/Shared/Types/documentData.d.ts +44 -0
  36. package/lib/typescript/src/Shared/Types/documentData.d.ts.map +1 -0
  37. package/lib/typescript/src/Shared/Types/documentReadResult.d.ts +44 -0
  38. package/lib/typescript/src/Shared/Types/documentReadResult.d.ts.map +1 -0
  39. package/lib/typescript/src/Shared/Types/mrzFields.d.ts +1 -1
  40. package/lib/typescript/src/Shared/Types/mrzFields.d.ts.map +1 -1
  41. package/lib/typescript/src/Trustchex.d.ts +9 -0
  42. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  43. package/lib/typescript/src/index.d.ts +2 -0
  44. package/lib/typescript/src/index.d.ts.map +1 -1
  45. package/lib/typescript/src/version.d.ts +1 -1
  46. package/package.json +1 -1
  47. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +0 -4
  48. package/src/Screens/Dynamic/IdentityDocumentScanningScreen.tsx +23 -0
  49. package/src/Screens/Dynamic/VideoCallScreen.tsx +5 -1
  50. package/src/Screens/Static/ResultScreen.tsx +39 -15
  51. package/src/Shared/Components/EIDScanner.tsx +67 -18
  52. package/src/Shared/Contexts/AppContext.ts +8 -0
  53. package/src/Shared/EIDReader/eidReader.ts +27 -1
  54. package/src/Shared/EIDReader/lds/icao/dg11File.ts +94 -0
  55. package/src/Shared/Libs/documentDataNormalizer.ts +108 -0
  56. package/src/Shared/Libs/mrz.utils.ts +0 -5
  57. package/src/Shared/Libs/mrzTransliteration.ts +131 -0
  58. package/src/Shared/Services/DataUploadService.ts +9 -3
  59. package/src/Shared/Types/documentData.ts +52 -0
  60. package/src/Shared/Types/documentReadResult.ts +47 -0
  61. package/src/Shared/Types/mrzFields.ts +0 -5
  62. package/src/Trustchex.tsx +22 -0
  63. package/src/index.tsx +7 -0
  64. package/src/version.ts +1 -1
@@ -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
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Version is synced from package.json during build.
3
- export const SDK_VERSION = '1.481.1';
3
+ export const SDK_VERSION = '1.483.4';