@trustchex/react-native-sdk 1.409.0 → 1.464.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.
Files changed (156) hide show
  1. package/android/src/main/java/com/trustchex/reactnativesdk/TrustchexSDKModule.kt +2 -8
  2. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +59 -1
  3. package/ios/Camera/TrustchexCameraView.swift +9 -1
  4. package/lib/module/Screens/Debug/NFCScanTestScreen.js +635 -0
  5. package/lib/module/Screens/Dynamic/ContractAcceptanceScreen.js +1 -4
  6. package/lib/module/Screens/Dynamic/IdentityDocumentEIDScanningScreen.js +17 -4
  7. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +102 -23
  8. package/lib/module/Screens/Dynamic/VerbalConsentScreen.js +1079 -0
  9. package/lib/module/Screens/Dynamic/VideoCallScreen.js +3 -1
  10. package/lib/module/Screens/Static/ResultScreen.js +128 -22
  11. package/lib/module/Screens/Static/VerificationSessionCheckScreen.js +8 -0
  12. package/lib/module/Shared/Animations/recording.json +1 -0
  13. package/lib/module/Shared/Components/DebugNavigationPanel.js +69 -71
  14. package/lib/module/Shared/Components/EIDScanner.js +212 -108
  15. package/lib/module/Shared/Components/IdentityDocumentCamera.flows.js +5 -3
  16. package/lib/module/Shared/Components/IdentityDocumentCamera.js +53 -36
  17. package/lib/module/Shared/Components/IdentityDocumentCamera.utils.js +13 -4
  18. package/lib/module/Shared/Components/NavigationManager.js +24 -16
  19. package/lib/module/Shared/EIDReader/aesSecureMessagingWrapper.js +51 -0
  20. package/lib/module/Shared/EIDReader/apduLevelPACECapable.js +3 -0
  21. package/lib/module/Shared/EIDReader/bacKey.js +16 -2
  22. package/lib/module/Shared/EIDReader/eidReader.js +354 -13
  23. package/lib/module/Shared/EIDReader/eidService.js +25 -1
  24. package/lib/module/Shared/EIDReader/nfcManagerCardService.js +4 -7
  25. package/lib/module/Shared/EIDReader/paceInfo.js +85 -0
  26. package/lib/module/Shared/EIDReader/paceKeySpec.js +51 -0
  27. package/lib/module/Shared/EIDReader/protocol/paceAPDUSender.js +100 -0
  28. package/lib/module/Shared/EIDReader/protocol/paceProtocol.js +655 -0
  29. package/lib/module/Shared/EIDReader/protocol/paceResult.js +37 -0
  30. package/lib/module/Shared/EIDReader/secureMessagingWrapper.js +27 -4
  31. package/lib/module/Shared/EIDReader/smartcards/commandAPDU.js +2 -1
  32. package/lib/module/Shared/EIDReader/tlv/tlv.helpers.js +1 -1
  33. package/lib/module/Shared/EIDReader/tlv/tlv.utils.js +6 -3
  34. package/lib/module/Shared/EIDReader/utils/aesCrypto.utils.js +189 -0
  35. package/lib/module/Shared/Libs/analytics.utils.js +4 -0
  36. package/lib/module/Shared/Libs/contains.js +1 -40
  37. package/lib/module/Shared/Libs/country-display.utils.js +34 -0
  38. package/lib/module/Shared/Libs/demo.utils.js +8 -0
  39. package/lib/module/Shared/Libs/mrz.utils.js +3 -2
  40. package/lib/module/Shared/Libs/status-bar.utils.js +4 -2
  41. package/lib/module/Shared/Types/analytics.types.js +2 -0
  42. package/lib/module/Translation/Resources/en.js +41 -2
  43. package/lib/module/Translation/Resources/tr.js +41 -2
  44. package/lib/module/Trustchex.js +54 -20
  45. package/lib/module/version.js +1 -1
  46. package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts +3 -0
  47. package/lib/typescript/src/Screens/Debug/NFCScanTestScreen.d.ts.map +1 -0
  48. package/lib/typescript/src/Screens/Dynamic/ContractAcceptanceScreen.d.ts.map +1 -1
  49. package/lib/typescript/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.d.ts.map +1 -1
  50. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  51. package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts +3 -0
  52. package/lib/typescript/src/Screens/Dynamic/VerbalConsentScreen.d.ts.map +1 -0
  53. package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -1
  54. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  55. package/lib/typescript/src/Screens/Static/VerificationSessionCheckScreen.d.ts.map +1 -1
  56. package/lib/typescript/src/Shared/Components/DebugNavigationPanel.d.ts.map +1 -1
  57. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  58. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  59. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts +1 -1
  60. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.flows.d.ts.map +1 -1
  61. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts +5 -0
  62. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.utils.d.ts.map +1 -1
  63. package/lib/typescript/src/Shared/Components/NavigationManager.d.ts.map +1 -1
  64. package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts +18 -0
  65. package/lib/typescript/src/Shared/EIDReader/aesSecureMessagingWrapper.d.ts.map +1 -0
  66. package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts +23 -0
  67. package/lib/typescript/src/Shared/EIDReader/apduLevelPACECapable.d.ts.map +1 -0
  68. package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts +6 -0
  69. package/lib/typescript/src/Shared/EIDReader/bacKey.d.ts.map +1 -1
  70. package/lib/typescript/src/Shared/EIDReader/eidReader.d.ts.map +1 -1
  71. package/lib/typescript/src/Shared/EIDReader/eidService.d.ts +9 -0
  72. package/lib/typescript/src/Shared/EIDReader/eidService.d.ts.map +1 -1
  73. package/lib/typescript/src/Shared/EIDReader/nfcManagerCardService.d.ts.map +1 -1
  74. package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts +50 -0
  75. package/lib/typescript/src/Shared/EIDReader/paceInfo.d.ts.map +1 -0
  76. package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts +30 -0
  77. package/lib/typescript/src/Shared/EIDReader/paceKeySpec.d.ts.map +1 -0
  78. package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts +17 -0
  79. package/lib/typescript/src/Shared/EIDReader/protocol/paceAPDUSender.d.ts.map +1 -0
  80. package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts +105 -0
  81. package/lib/typescript/src/Shared/EIDReader/protocol/paceProtocol.d.ts.map +1 -0
  82. package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts +24 -0
  83. package/lib/typescript/src/Shared/EIDReader/protocol/paceResult.d.ts.map +1 -0
  84. package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts +15 -0
  85. package/lib/typescript/src/Shared/EIDReader/secureMessagingWrapper.d.ts.map +1 -1
  86. package/lib/typescript/src/Shared/EIDReader/smartcards/commandAPDU.d.ts.map +1 -1
  87. package/lib/typescript/src/Shared/EIDReader/tlv/tlv.utils.d.ts.map +1 -1
  88. package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts +39 -0
  89. package/lib/typescript/src/Shared/EIDReader/utils/aesCrypto.utils.d.ts.map +1 -0
  90. package/lib/typescript/src/Shared/Libs/analytics.utils.d.ts.map +1 -1
  91. package/lib/typescript/src/Shared/Libs/contains.d.ts +0 -7
  92. package/lib/typescript/src/Shared/Libs/contains.d.ts.map +1 -1
  93. package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts +2 -0
  94. package/lib/typescript/src/Shared/Libs/country-display.utils.d.ts.map +1 -0
  95. package/lib/typescript/src/Shared/Libs/demo.utils.d.ts.map +1 -1
  96. package/lib/typescript/src/Shared/Libs/http-client.d.ts +1 -1
  97. package/lib/typescript/src/Shared/Libs/http-client.d.ts.map +1 -1
  98. package/lib/typescript/src/Shared/Libs/mrz.utils.d.ts.map +1 -1
  99. package/lib/typescript/src/Shared/Libs/status-bar.utils.d.ts.map +1 -1
  100. package/lib/typescript/src/Shared/Types/analytics.types.d.ts +2 -0
  101. package/lib/typescript/src/Shared/Types/analytics.types.d.ts.map +1 -1
  102. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts +10 -1
  103. package/lib/typescript/src/Shared/Types/identificationInfo.d.ts.map +1 -1
  104. package/lib/typescript/src/Translation/Resources/en.d.ts +40 -1
  105. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  106. package/lib/typescript/src/Translation/Resources/tr.d.ts +40 -1
  107. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  108. package/lib/typescript/src/Trustchex.d.ts.map +1 -1
  109. package/lib/typescript/src/version.d.ts +1 -1
  110. package/package.json +7 -4
  111. package/src/Screens/Debug/NFCScanTestScreen.tsx +692 -0
  112. package/src/Screens/Dynamic/ContractAcceptanceScreen.tsx +1 -4
  113. package/src/Screens/Dynamic/IdentityDocumentEIDScanningScreen.tsx +21 -4
  114. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +124 -23
  115. package/src/Screens/Dynamic/VerbalConsentScreen.tsx +1401 -0
  116. package/src/Screens/Dynamic/VideoCallScreen.tsx +3 -1
  117. package/src/Screens/Static/ResultScreen.tsx +183 -31
  118. package/src/Screens/Static/VerificationSessionCheckScreen.tsx +9 -0
  119. package/src/Shared/Animations/recording.json +1 -0
  120. package/src/Shared/Components/DebugNavigationPanel.tsx +73 -48
  121. package/src/Shared/Components/EIDScanner.tsx +222 -111
  122. package/src/Shared/Components/IdentityDocumentCamera.flows.ts +7 -4
  123. package/src/Shared/Components/IdentityDocumentCamera.tsx +199 -184
  124. package/src/Shared/Components/IdentityDocumentCamera.utils.ts +13 -4
  125. package/src/Shared/Components/NavigationManager.tsx +27 -18
  126. package/src/Shared/EIDReader/aesSecureMessagingWrapper.ts +69 -0
  127. package/src/Shared/EIDReader/apduLevelPACECapable.ts +34 -0
  128. package/src/Shared/EIDReader/bacKey.ts +24 -8
  129. package/src/Shared/EIDReader/eidReader.ts +398 -12
  130. package/src/Shared/EIDReader/eidService.ts +49 -1
  131. package/src/Shared/EIDReader/nfcManagerCardService.ts +4 -6
  132. package/src/Shared/EIDReader/paceInfo.ts +159 -0
  133. package/src/Shared/EIDReader/paceKeySpec.ts +56 -0
  134. package/src/Shared/EIDReader/protocol/paceAPDUSender.ts +163 -0
  135. package/src/Shared/EIDReader/protocol/paceProtocol.ts +946 -0
  136. package/src/Shared/EIDReader/protocol/paceResult.ts +62 -0
  137. package/src/Shared/EIDReader/secureMessagingWrapper.ts +28 -10
  138. package/src/Shared/EIDReader/smartcards/commandAPDU.ts +2 -1
  139. package/src/Shared/EIDReader/tlv/tlv.helpers.ts +1 -1
  140. package/src/Shared/EIDReader/tlv/tlv.utils.ts +8 -5
  141. package/src/Shared/EIDReader/utils/aesCrypto.utils.ts +217 -0
  142. package/src/Shared/Libs/analytics.utils.ts +4 -0
  143. package/src/Shared/Libs/contains.ts +0 -53
  144. package/src/Shared/Libs/country-display.utils.ts +55 -0
  145. package/src/Shared/Libs/crypto.utils.ts +2 -2
  146. package/src/Shared/Libs/demo.utils.ts +10 -0
  147. package/src/Shared/Libs/http-client.ts +12 -4
  148. package/src/Shared/Libs/mrz.utils.ts +3 -2
  149. package/src/Shared/Libs/status-bar.utils.ts +4 -2
  150. package/src/Shared/Services/VideoSessionService.ts +1 -1
  151. package/src/Shared/Types/analytics.types.ts +2 -0
  152. package/src/Shared/Types/identificationInfo.ts +11 -0
  153. package/src/Translation/Resources/en.ts +63 -3
  154. package/src/Translation/Resources/tr.ts +62 -3
  155. package/src/Trustchex.tsx +53 -17
  156. package/src/version.ts +1 -1
@@ -0,0 +1,635 @@
1
+ "use strict";
2
+
3
+ import React, { useState, useRef, useCallback } from 'react';
4
+ import { View, Text, TextInput, TouchableOpacity, ScrollView, StyleSheet, Image, Platform, StatusBar, KeyboardAvoidingView, Modal } from 'react-native';
5
+ import { SafeAreaView } from 'react-native-safe-area-context';
6
+ import NFCManager from 'react-native-nfc-manager';
7
+ import { eidReader } from "../../Shared/EIDReader/eidReader.js";
8
+ import { useKeepAwake } from "../../Shared/Libs/native-keep-awake.utils.js";
9
+ import mrzUtils from "../../Shared/Libs/mrz.utils.js";
10
+ import { TrustchexCamera } from "../../Shared/Components/TrustchexCamera.js";
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const NFCScanTestScreen = () => {
13
+ useKeepAwake();
14
+ const [documentNumber, setDocumentNumber] = useState('');
15
+ const [dateOfBirth, setDateOfBirth] = useState('');
16
+ const [dateOfExpiry, setDateOfExpiry] = useState('');
17
+ const [isScanning, setIsScanning] = useState(false);
18
+ const [progress, setProgress] = useState(0);
19
+ const [logs, setLogs] = useState([]);
20
+ const [faceImage, setFaceImage] = useState(null);
21
+ const [faceMimeType, setFaceMimeType] = useState('image/jpeg');
22
+ const [mrzResult, setMrzResult] = useState(null);
23
+ const [mrzText, setMrzText] = useState('');
24
+ const [cameraOpen, setCameraOpen] = useState(false);
25
+ const [cameraMrzStatus, setCameraMrzStatus] = useState('');
26
+ const scrollRef = useRef(null);
27
+ const cameraRef = useRef(null);
28
+ const originalConsoleDebug = useRef(null);
29
+ const addLog = useCallback((message, type = 'info') => {
30
+ const now = new Date();
31
+ const time = `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}.${String(now.getMilliseconds()).padStart(3, '0')}`;
32
+ setLogs(prev => [...prev, {
33
+ time,
34
+ message: String(message),
35
+ type
36
+ }]);
37
+ setTimeout(() => scrollRef.current?.scrollToEnd({
38
+ animated: false
39
+ }), 50);
40
+ }, []);
41
+ const clearAll = useCallback(() => {
42
+ setLogs([]);
43
+ setFaceImage(null);
44
+ setMrzResult(null);
45
+ setProgress(0);
46
+ }, []);
47
+ const parseMRZText = useCallback(text => {
48
+ setMrzText(text);
49
+ if (!text.trim()) return;
50
+ const result = mrzUtils.validateMRZWithCorrections(text);
51
+ if (result.valid && result.fields) {
52
+ const {
53
+ documentNumber: dn,
54
+ birthDate: bd,
55
+ expirationDate: ed
56
+ } = result.fields;
57
+ if (dn) setDocumentNumber(dn);
58
+ if (bd) setDateOfBirth(bd);
59
+ if (ed) setDateOfExpiry(ed);
60
+ }
61
+ }, []);
62
+ const handleCameraFrame = useCallback(event => {
63
+ const frame = event.nativeEvent.frame;
64
+ if (!frame.resultText || !frame.resultText.includes('<')) {
65
+ setCameraMrzStatus('Point camera at MRZ zone...');
66
+ return;
67
+ }
68
+ let mrzOnlyText = '';
69
+ if (frame.textBlocks && frame.textBlocks.length > 0) {
70
+ const frameHeight = frame.height;
71
+ const bottomThreshold = frameHeight * 0.5;
72
+ const mrzBlocks = frame.textBlocks.filter(block => {
73
+ const blockText = block.text || '';
74
+ return blockText.includes('<') && blockText.length >= 12 && (block.blockFrame ? block.blockFrame.y > bottomThreshold : false);
75
+ });
76
+ if (mrzBlocks.length > 0) {
77
+ mrzOnlyText = mrzBlocks.map(b => b.text).join('\n');
78
+ }
79
+ }
80
+ if (!mrzOnlyText) mrzOnlyText = frame.resultText;
81
+ const fixedMrz = mrzUtils.fixMRZ(mrzOnlyText);
82
+ const result = mrzUtils.validateMRZWithCorrections(fixedMrz);
83
+ if (result.valid && result.fields) {
84
+ const {
85
+ documentNumber: dn,
86
+ birthDate: bd,
87
+ expirationDate: ed
88
+ } = result.fields;
89
+ if (dn) setDocumentNumber(dn);
90
+ if (bd) setDateOfBirth(bd);
91
+ if (ed) setDateOfExpiry(ed);
92
+ setMrzText(fixedMrz);
93
+ setCameraOpen(false);
94
+ } else {
95
+ setCameraMrzStatus('Reading MRZ... Hold steady');
96
+ }
97
+ }, []);
98
+ const argsToString = args => args.map(a => {
99
+ if (a instanceof Error) return `[${a.name}] ${a.message}`;
100
+ if (typeof a === 'object' && a !== null) {
101
+ try {
102
+ return JSON.stringify(a);
103
+ } catch {
104
+ return String(a);
105
+ }
106
+ }
107
+ return String(a);
108
+ }).join(' ');
109
+ const startScan = useCallback(async () => {
110
+ const docNum = documentNumber.trim();
111
+ const dob = dateOfBirth.trim();
112
+ const doe = dateOfExpiry.trim();
113
+ if (!docNum) {
114
+ addLog('Document number is required', 'error');
115
+ return;
116
+ }
117
+ if (dob.length !== 6 || !/^\d{6}$/.test(dob)) {
118
+ addLog('Date of Birth must be 6 digits (YYMMDD)', 'error');
119
+ return;
120
+ }
121
+ if (doe.length !== 6 || !/^\d{6}$/.test(doe)) {
122
+ addLog('Date of Expiry must be 6 digits (YYMMDD)', 'error');
123
+ return;
124
+ }
125
+ clearAll();
126
+ setIsScanning(true);
127
+
128
+ // Capture console.debug to show internal EIDReader logs
129
+ originalConsoleDebug.current = console.debug;
130
+ console.debug = (...args) => {
131
+ originalConsoleDebug.current?.(...args);
132
+ addLog(argsToString(args), 'debug');
133
+ };
134
+ addLog(`Doc: ${docNum} DOB: ${dob} DOE: ${doe}`, 'info');
135
+ addLog('Hold device near NFC chip on passport/ID…', 'info');
136
+ try {
137
+ const result = await eidReader(docNum, dob, doe, p => {
138
+ const pct = Math.round(p);
139
+ setProgress(pct);
140
+ addLog(`Progress: ${pct}%`, 'info');
141
+ });
142
+ if (result) {
143
+ addLog('Scan completed successfully', 'success');
144
+ if (result.faceImage) {
145
+ setFaceImage(result.faceImage);
146
+ setFaceMimeType(result.mimeType || 'image/jpeg');
147
+ addLog(`Face image: ${result.faceImage.length} base64 chars (${result.mimeType})`, 'success');
148
+ } else {
149
+ addLog('No face image in result', 'info');
150
+ }
151
+ if (result.mrz) {
152
+ setMrzResult(result.mrz);
153
+ addLog('MRZ data received', 'success');
154
+ } else {
155
+ addLog('No MRZ data in result', 'info');
156
+ }
157
+ } else {
158
+ addLog('eidReader returned undefined', 'error');
159
+ }
160
+ } catch (err) {
161
+ const msg = err instanceof Error ? err.message : String(err);
162
+ addLog(`Error: ${msg}`, 'error');
163
+ if (err instanceof Error && err.stack) {
164
+ addLog(err.stack, 'debug');
165
+ }
166
+ } finally {
167
+ if (originalConsoleDebug.current) {
168
+ console.debug = originalConsoleDebug.current;
169
+ originalConsoleDebug.current = null;
170
+ }
171
+ setIsScanning(false);
172
+ }
173
+ }, [documentNumber, dateOfBirth, dateOfExpiry, addLog, clearAll]);
174
+ const cancelScan = useCallback(async () => {
175
+ addLog('Cancelling NFC session…', 'info');
176
+ try {
177
+ await NFCManager.cancelTechnologyRequest();
178
+ } catch {
179
+ // ignore
180
+ }
181
+ }, [addLog]);
182
+ const logColor = {
183
+ info: '#cccccc',
184
+ debug: '#888888',
185
+ success: '#4caf50',
186
+ error: '#f44336'
187
+ };
188
+ return /*#__PURE__*/_jsxs(SafeAreaView, {
189
+ style: styles.container,
190
+ edges: ['top', 'bottom'],
191
+ children: [/*#__PURE__*/_jsx(StatusBar, {
192
+ barStyle: "light-content",
193
+ backgroundColor: "#111"
194
+ }), /*#__PURE__*/_jsx(Text, {
195
+ style: styles.header,
196
+ children: "NFC Scan Debug"
197
+ }), /*#__PURE__*/_jsx(KeyboardAvoidingView, {
198
+ behavior: Platform.OS === 'ios' ? 'padding' : undefined,
199
+ children: /*#__PURE__*/_jsxs(View, {
200
+ style: styles.inputSection,
201
+ children: [/*#__PURE__*/_jsxs(View, {
202
+ style: styles.row,
203
+ children: [/*#__PURE__*/_jsx(View, {
204
+ style: styles.flexOne,
205
+ children: /*#__PURE__*/_jsx(Text, {
206
+ style: styles.label,
207
+ children: "Paste MRZ Text (auto-fills fields below)"
208
+ })
209
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
210
+ style: [styles.button, styles.scanMrzButton],
211
+ onPress: () => {
212
+ setCameraMrzStatus('Point camera at MRZ zone...');
213
+ setCameraOpen(true);
214
+ },
215
+ disabled: isScanning,
216
+ children: /*#__PURE__*/_jsx(Text, {
217
+ style: styles.buttonText,
218
+ children: "Scan MRZ"
219
+ })
220
+ })]
221
+ }), /*#__PURE__*/_jsx(TextInput, {
222
+ style: [styles.input, styles.mrzInput],
223
+ value: mrzText,
224
+ onChangeText: parseMRZText,
225
+ placeholder: "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<\nL898902C36UTO7408122F1204159<<<<<<<<<<<<<<",
226
+ placeholderTextColor: "#555",
227
+ multiline: true,
228
+ numberOfLines: 3,
229
+ autoCapitalize: "characters",
230
+ autoCorrect: false,
231
+ editable: !isScanning
232
+ }), /*#__PURE__*/_jsx(Text, {
233
+ style: styles.label,
234
+ children: "Document Number"
235
+ }), /*#__PURE__*/_jsx(TextInput, {
236
+ style: styles.input,
237
+ value: documentNumber,
238
+ onChangeText: setDocumentNumber,
239
+ placeholder: "e.g. A12345678",
240
+ placeholderTextColor: "#555",
241
+ autoCapitalize: "characters",
242
+ autoCorrect: false,
243
+ editable: !isScanning
244
+ }), /*#__PURE__*/_jsxs(View, {
245
+ style: styles.row,
246
+ children: [/*#__PURE__*/_jsxs(View, {
247
+ style: styles.halfColumn,
248
+ children: [/*#__PURE__*/_jsx(Text, {
249
+ style: styles.label,
250
+ children: "Date of Birth (YYMMDD)"
251
+ }), /*#__PURE__*/_jsx(TextInput, {
252
+ style: styles.input,
253
+ value: dateOfBirth,
254
+ onChangeText: setDateOfBirth,
255
+ placeholder: "e.g. 900115",
256
+ placeholderTextColor: "#555",
257
+ keyboardType: "numeric",
258
+ maxLength: 6,
259
+ editable: !isScanning
260
+ })]
261
+ }), /*#__PURE__*/_jsxs(View, {
262
+ style: styles.halfColumn,
263
+ children: [/*#__PURE__*/_jsx(Text, {
264
+ style: styles.label,
265
+ children: "Date of Expiry (YYMMDD)"
266
+ }), /*#__PURE__*/_jsx(TextInput, {
267
+ style: styles.input,
268
+ value: dateOfExpiry,
269
+ onChangeText: setDateOfExpiry,
270
+ placeholder: "e.g. 280101",
271
+ placeholderTextColor: "#555",
272
+ keyboardType: "numeric",
273
+ maxLength: 6,
274
+ editable: !isScanning
275
+ })]
276
+ })]
277
+ }), /*#__PURE__*/_jsxs(View, {
278
+ style: styles.row,
279
+ children: [/*#__PURE__*/_jsx(TouchableOpacity, {
280
+ style: [styles.button, styles.scanButton, isScanning && styles.buttonDisabled],
281
+ onPress: startScan,
282
+ disabled: isScanning,
283
+ children: /*#__PURE__*/_jsx(Text, {
284
+ style: styles.buttonText,
285
+ children: isScanning ? `Scanning… ${Math.round(progress)}%` : 'Start NFC Scan'
286
+ })
287
+ }), isScanning ? /*#__PURE__*/_jsx(TouchableOpacity, {
288
+ style: [styles.button, styles.cancelButton],
289
+ onPress: cancelScan,
290
+ children: /*#__PURE__*/_jsx(Text, {
291
+ style: styles.buttonText,
292
+ children: "Cancel"
293
+ })
294
+ }) : /*#__PURE__*/_jsx(TouchableOpacity, {
295
+ style: [styles.button, styles.clearButton],
296
+ onPress: clearAll,
297
+ children: /*#__PURE__*/_jsx(Text, {
298
+ style: styles.buttonText,
299
+ children: "Clear"
300
+ })
301
+ })]
302
+ })]
303
+ })
304
+ }), (faceImage || mrzResult) && /*#__PURE__*/_jsxs(View, {
305
+ children: [/*#__PURE__*/_jsx(Text, {
306
+ style: styles.chipDataHeader,
307
+ children: "NFC Chip Data"
308
+ }), /*#__PURE__*/_jsxs(View, {
309
+ style: styles.resultSection,
310
+ children: [faceImage && /*#__PURE__*/_jsx(Image, {
311
+ source: {
312
+ uri: `data:${faceMimeType};base64,${faceImage}`
313
+ },
314
+ style: styles.faceImage,
315
+ resizeMode: "contain"
316
+ }), mrzResult && /*#__PURE__*/_jsxs(View, {
317
+ style: styles.mrzFields,
318
+ children: [/*#__PURE__*/_jsx(MRZRow, {
319
+ label: "Doc Code",
320
+ value: mrzResult.getDocumentCode()
321
+ }), /*#__PURE__*/_jsx(MRZRow, {
322
+ label: "Issuing State",
323
+ value: mrzResult.getIssuingState()
324
+ }), /*#__PURE__*/_jsx(MRZRow, {
325
+ label: "Surname",
326
+ value: mrzResult.getPrimaryIdentifier()
327
+ }), /*#__PURE__*/_jsx(MRZRow, {
328
+ label: "Given Names",
329
+ value: mrzResult.getSecondaryIdentifier()
330
+ }), /*#__PURE__*/_jsx(MRZRow, {
331
+ label: "Doc Number",
332
+ value: mrzResult.getDocumentNumber()
333
+ }), /*#__PURE__*/_jsx(MRZRow, {
334
+ label: "Nationality",
335
+ value: mrzResult.getNationality()
336
+ }), /*#__PURE__*/_jsx(MRZRow, {
337
+ label: "Date of Birth",
338
+ value: mrzResult.getDateOfBirth()
339
+ }), /*#__PURE__*/_jsx(MRZRow, {
340
+ label: "Date of Expiry",
341
+ value: mrzResult.getDateOfExpiry()
342
+ }), /*#__PURE__*/_jsx(MRZRow, {
343
+ label: "Gender",
344
+ value: mrzResult.getGender()?.getStrCode() ?? ''
345
+ }), /*#__PURE__*/_jsx(MRZRow, {
346
+ label: "Personal Number",
347
+ value: mrzResult.getPersonalNumber() ?? ''
348
+ })]
349
+ })]
350
+ })]
351
+ }), /*#__PURE__*/_jsx(Modal, {
352
+ visible: cameraOpen,
353
+ animationType: "slide",
354
+ onRequestClose: () => setCameraOpen(false),
355
+ children: /*#__PURE__*/_jsxs(View, {
356
+ style: styles.cameraContainer,
357
+ children: [/*#__PURE__*/_jsx(TrustchexCamera, {
358
+ ref: cameraRef,
359
+ style: StyleSheet.absoluteFill,
360
+ cameraType: "back",
361
+ enableFrameProcessing: true,
362
+ enableFaceDetection: false,
363
+ enableTextRecognition: true,
364
+ enableBarcodeScanning: false,
365
+ includeBase64: false,
366
+ targetFps: 10,
367
+ onFrameAvailable: handleCameraFrame
368
+ }), /*#__PURE__*/_jsxs(SafeAreaView, {
369
+ style: styles.cameraOverlay,
370
+ edges: ['top', 'bottom'],
371
+ children: [/*#__PURE__*/_jsxs(View, {
372
+ style: styles.cameraTopBar,
373
+ children: [/*#__PURE__*/_jsx(Text, {
374
+ style: styles.cameraTitle,
375
+ children: "Scan MRZ"
376
+ }), /*#__PURE__*/_jsx(TouchableOpacity, {
377
+ style: styles.cameraCloseButton,
378
+ onPress: () => setCameraOpen(false),
379
+ children: /*#__PURE__*/_jsx(Text, {
380
+ style: styles.cameraCloseText,
381
+ children: "Close"
382
+ })
383
+ })]
384
+ }), /*#__PURE__*/_jsxs(View, {
385
+ style: styles.cameraGuide,
386
+ children: [/*#__PURE__*/_jsx(View, {
387
+ style: styles.cameraGuideBox
388
+ }), /*#__PURE__*/_jsx(Text, {
389
+ style: styles.cameraGuideText,
390
+ children: cameraMrzStatus
391
+ })]
392
+ })]
393
+ })]
394
+ })
395
+ }), /*#__PURE__*/_jsx(ScrollView, {
396
+ ref: scrollRef,
397
+ style: styles.logScroll,
398
+ contentContainerStyle: styles.logContent,
399
+ nestedScrollEnabled: true,
400
+ children: logs.length === 0 ? /*#__PURE__*/_jsx(Text, {
401
+ style: styles.logPlaceholder,
402
+ children: "Logs will appear here\u2026"
403
+ }) : logs.map((entry, i) => /*#__PURE__*/_jsxs(Text, {
404
+ style: [styles.logLine, {
405
+ color: logColor[entry.type]
406
+ }],
407
+ children: [/*#__PURE__*/_jsxs(Text, {
408
+ style: styles.logTime,
409
+ children: [entry.time, " "]
410
+ }), entry.message]
411
+ }, i))
412
+ })]
413
+ });
414
+ };
415
+ const MRZRow = ({
416
+ label,
417
+ value
418
+ }) => /*#__PURE__*/_jsxs(View, {
419
+ style: styles.mrzRow,
420
+ children: [/*#__PURE__*/_jsxs(Text, {
421
+ style: styles.mrzLabel,
422
+ children: [label, ":"]
423
+ }), /*#__PURE__*/_jsx(Text, {
424
+ style: styles.mrzValue,
425
+ children: value || '—'
426
+ })]
427
+ });
428
+ const styles = StyleSheet.create({
429
+ container: {
430
+ flex: 1,
431
+ backgroundColor: '#111'
432
+ },
433
+ header: {
434
+ color: '#fff',
435
+ fontSize: 16,
436
+ fontWeight: '700',
437
+ textAlign: 'center',
438
+ paddingVertical: 10,
439
+ backgroundColor: '#1a1a1a',
440
+ letterSpacing: 0.5
441
+ },
442
+ inputSection: {
443
+ padding: 12,
444
+ backgroundColor: '#1a1a1a',
445
+ borderBottomWidth: 1,
446
+ borderBottomColor: '#333'
447
+ },
448
+ label: {
449
+ color: '#aaa',
450
+ fontSize: 11,
451
+ marginBottom: 3,
452
+ marginTop: 8,
453
+ textTransform: 'uppercase',
454
+ letterSpacing: 0.5
455
+ },
456
+ input: {
457
+ backgroundColor: '#2a2a2a',
458
+ color: '#fff',
459
+ borderRadius: 6,
460
+ paddingHorizontal: 10,
461
+ paddingVertical: 8,
462
+ fontSize: 14,
463
+ borderWidth: 1,
464
+ borderColor: '#444',
465
+ fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace'
466
+ },
467
+ mrzInput: {
468
+ fontSize: 11,
469
+ minHeight: 54,
470
+ textAlignVertical: 'top'
471
+ },
472
+ row: {
473
+ flexDirection: 'row',
474
+ gap: 8,
475
+ marginTop: 4
476
+ },
477
+ halfColumn: {
478
+ flex: 1
479
+ },
480
+ button: {
481
+ paddingVertical: 10,
482
+ paddingHorizontal: 16,
483
+ borderRadius: 6,
484
+ alignItems: 'center',
485
+ justifyContent: 'center',
486
+ marginTop: 10
487
+ },
488
+ scanButton: {
489
+ flex: 2,
490
+ backgroundColor: '#1565c0'
491
+ },
492
+ scanMrzButton: {
493
+ backgroundColor: '#e65100',
494
+ paddingVertical: 6,
495
+ paddingHorizontal: 12,
496
+ marginTop: 4
497
+ },
498
+ cancelButton: {
499
+ flex: 1,
500
+ backgroundColor: '#b71c1c'
501
+ },
502
+ clearButton: {
503
+ flex: 1,
504
+ backgroundColor: '#333'
505
+ },
506
+ buttonDisabled: {
507
+ backgroundColor: '#333'
508
+ },
509
+ buttonText: {
510
+ color: '#fff',
511
+ fontSize: 13,
512
+ fontWeight: '600'
513
+ },
514
+ resultSection: {
515
+ flexDirection: 'row',
516
+ backgroundColor: '#1a1a1a',
517
+ padding: 8,
518
+ gap: 8
519
+ },
520
+ chipDataHeader: {
521
+ color: '#4fc3f7',
522
+ fontSize: 13,
523
+ fontWeight: '700',
524
+ paddingHorizontal: 8,
525
+ paddingTop: 8,
526
+ paddingBottom: 4,
527
+ backgroundColor: '#1a1a1a',
528
+ borderBottomWidth: 0,
529
+ letterSpacing: 0.5
530
+ },
531
+ faceImage: {
532
+ width: 72,
533
+ height: 96,
534
+ borderRadius: 4,
535
+ backgroundColor: '#2a2a2a'
536
+ },
537
+ mrzFields: {
538
+ flex: 1
539
+ },
540
+ mrzRow: {
541
+ flexDirection: 'row',
542
+ marginBottom: 2
543
+ },
544
+ mrzLabel: {
545
+ color: '#888',
546
+ fontSize: 11,
547
+ width: 90,
548
+ textTransform: 'uppercase'
549
+ },
550
+ mrzValue: {
551
+ color: '#e0e0e0',
552
+ fontSize: 11,
553
+ flex: 1,
554
+ fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace'
555
+ },
556
+ logScroll: {
557
+ flex: 1,
558
+ backgroundColor: '#0d0d0d'
559
+ },
560
+ logContent: {
561
+ padding: 8,
562
+ paddingBottom: 16
563
+ },
564
+ logPlaceholder: {
565
+ color: '#444',
566
+ fontSize: 12,
567
+ fontStyle: 'italic',
568
+ textAlign: 'center',
569
+ marginTop: 20
570
+ },
571
+ logLine: {
572
+ fontSize: 11,
573
+ lineHeight: 17,
574
+ fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace'
575
+ },
576
+ logTime: {
577
+ color: '#555',
578
+ fontSize: 10
579
+ },
580
+ cameraContainer: {
581
+ flex: 1,
582
+ backgroundColor: '#000'
583
+ },
584
+ cameraOverlay: {
585
+ ...StyleSheet.absoluteFillObject,
586
+ justifyContent: 'space-between'
587
+ },
588
+ cameraTopBar: {
589
+ flexDirection: 'row',
590
+ justifyContent: 'space-between',
591
+ alignItems: 'center',
592
+ paddingHorizontal: 16,
593
+ paddingVertical: 10,
594
+ backgroundColor: 'rgba(0,0,0,0.5)'
595
+ },
596
+ cameraTitle: {
597
+ color: '#fff',
598
+ fontSize: 16,
599
+ fontWeight: '700'
600
+ },
601
+ cameraCloseButton: {
602
+ backgroundColor: 'rgba(255,255,255,0.2)',
603
+ paddingVertical: 6,
604
+ paddingHorizontal: 14,
605
+ borderRadius: 6
606
+ },
607
+ cameraCloseText: {
608
+ color: '#fff',
609
+ fontSize: 13,
610
+ fontWeight: '600'
611
+ },
612
+ cameraGuide: {
613
+ alignItems: 'center',
614
+ paddingBottom: 40
615
+ },
616
+ cameraGuideBox: {
617
+ width: '85%',
618
+ height: 80,
619
+ borderWidth: 2,
620
+ borderColor: '#FFA500',
621
+ borderRadius: 8,
622
+ backgroundColor: 'rgba(255,165,0,0.05)',
623
+ marginBottom: 12
624
+ },
625
+ cameraGuideText: {
626
+ color: '#FFA500',
627
+ fontSize: 13,
628
+ fontWeight: '600',
629
+ textAlign: 'center'
630
+ },
631
+ flexOne: {
632
+ flex: 1
633
+ }
634
+ });
635
+ export default NFCScanTestScreen;
@@ -163,13 +163,10 @@ const ContractAcceptanceScreen = () => {
163
163
  });
164
164
  };
165
165
  const styles = StyleSheet.create({
166
- safeAreaContainer: {
166
+ container: {
167
167
  flex: 1,
168
168
  backgroundColor: 'white'
169
169
  },
170
- container: {
171
- flex: 1
172
- },
173
170
  webViewContainer: {
174
171
  flex: 1,
175
172
  width: '100%'
@@ -19,10 +19,23 @@ const IdentityDocumentEIDScanningScreen = () => {
19
19
  const [idFrontSideData, setIDFrontSideData] = useState(null);
20
20
  const [idBackSideData, setIDBackSideData] = useState(null);
21
21
  const [passportData, setPassportData] = useState();
22
- const [documentNumber, setDocumentNumber] = useState();
23
- const [dateOfBirth, setDateOfBirth] = useState();
24
- const [dateOfExpiry, setDateOfExpiry] = useState();
25
- const [documentType, setDocumentType] = useState();
22
+ const [documentNumber, setDocumentNumber] = useState(() => {
23
+ const mrzFields = appContext.identificationInfo.scannedDocument?.mrzFields;
24
+ return mrzFields?.documentNumber ?? undefined;
25
+ });
26
+ const [dateOfBirth, setDateOfBirth] = useState(() => {
27
+ const mrzFields = appContext.identificationInfo.scannedDocument?.mrzFields;
28
+ return mrzFields?.birthDate ?? undefined;
29
+ });
30
+ const [dateOfExpiry, setDateOfExpiry] = useState(() => {
31
+ const mrzFields = appContext.identificationInfo.scannedDocument?.mrzFields;
32
+ return mrzFields?.expirationDate ?? undefined;
33
+ });
34
+ const [documentType, setDocumentType] = useState(() => {
35
+ const dc = appContext.identificationInfo.scannedDocument?.mrzFields?.documentCode;
36
+ if (!dc) return undefined;
37
+ return dc === 'I' ? 'ID' : dc === 'P' ? 'PASSPORT' : 'UNKNOWN';
38
+ });
26
39
  const [isNFCSupported, setIsNFCSupported] = useState(false);
27
40
  const {
28
41
  t