react-native-timacare 3.3.56-alert → 3.3.57-cccd

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 (101) hide show
  1. package/lib/commonjs/assets/icons/index.js +1 -1
  2. package/lib/commonjs/assets/icons/index.js.flow +2 -0
  3. package/lib/commonjs/assets/icons/index.js.map +1 -1
  4. package/lib/commonjs/assets/icons/modal_confirm.svg +5 -5
  5. package/lib/commonjs/assets/icons/modal_notice.svg +32 -32
  6. package/lib/commonjs/assets/icons/modal_success.svg +26 -26
  7. package/lib/commonjs/assets/icons/modal_warning.svg +21 -21
  8. package/lib/commonjs/assets/icons/user_security.svg +10 -0
  9. package/lib/commonjs/assets/tts/Frame1000011947.png +0 -0
  10. package/lib/commonjs/navigation/primary-navigator.js +1 -1
  11. package/lib/commonjs/navigation/primary-navigator.js.flow +7 -0
  12. package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
  13. package/lib/commonjs/screens/NFC/OcrStart.js +2 -0
  14. package/lib/commonjs/screens/NFC/OcrStart.js.flow +171 -0
  15. package/lib/commonjs/screens/NFC/OcrStart.js.map +1 -0
  16. package/lib/commonjs/screens/NFC/ScanMRZ.js +2 -0
  17. package/lib/commonjs/screens/NFC/ScanMRZ.js.flow +563 -0
  18. package/lib/commonjs/screens/NFC/ScanMRZ.js.map +1 -0
  19. package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
  20. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +203 -133
  21. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -1
  22. package/lib/commonjs/screens/home/index.js +1 -1
  23. package/lib/commonjs/screens/home/index.js.flow +7 -112
  24. package/lib/commonjs/screens/home/index.js.map +1 -1
  25. package/lib/commonjs/screens/nationalID/index.js +1 -1
  26. package/lib/commonjs/screens/nationalID/index.js.flow +123 -218
  27. package/lib/commonjs/screens/nationalID/index.js.map +1 -1
  28. package/lib/commonjs/screens/nationalIDBack/index.js +1 -1
  29. package/lib/commonjs/screens/nationalIDBack/index.js.flow +129 -209
  30. package/lib/commonjs/screens/nationalIDBack/index.js.map +1 -1
  31. package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
  32. package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +269 -555
  33. package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
  34. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
  35. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +225 -287
  36. package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  37. package/lib/commonjs/utils/cameraCrop.js +2 -0
  38. package/lib/commonjs/utils/cameraCrop.js.flow +96 -0
  39. package/lib/commonjs/utils/cameraCrop.js.map +1 -0
  40. package/lib/module/assets/icons/index.js +1 -1
  41. package/lib/module/assets/icons/index.js.map +1 -1
  42. package/lib/module/assets/icons/modal_confirm.svg +5 -5
  43. package/lib/module/assets/icons/modal_notice.svg +32 -32
  44. package/lib/module/assets/icons/modal_success.svg +26 -26
  45. package/lib/module/assets/icons/modal_warning.svg +21 -21
  46. package/lib/module/assets/icons/user_security.svg +10 -0
  47. package/lib/module/assets/tts/Frame1000011947.png +0 -0
  48. package/lib/module/navigation/primary-navigator.js +1 -1
  49. package/lib/module/navigation/primary-navigator.js.map +1 -1
  50. package/lib/module/screens/NFC/OcrStart.js +2 -0
  51. package/lib/module/screens/NFC/OcrStart.js.map +1 -0
  52. package/lib/module/screens/NFC/ScanMRZ.js +2 -0
  53. package/lib/module/screens/NFC/ScanMRZ.js.map +1 -0
  54. package/lib/module/screens/camera/CCCDCameraScreen.js +1 -1
  55. package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -1
  56. package/lib/module/screens/home/index.js +1 -1
  57. package/lib/module/screens/home/index.js.map +1 -1
  58. package/lib/module/screens/nationalID/index.js +1 -1
  59. package/lib/module/screens/nationalID/index.js.map +1 -1
  60. package/lib/module/screens/nationalIDBack/index.js +1 -1
  61. package/lib/module/screens/nationalIDBack/index.js.map +1 -1
  62. package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
  63. package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
  64. package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
  65. package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
  66. package/lib/module/utils/cameraCrop.js +2 -0
  67. package/lib/module/utils/cameraCrop.js.map +1 -0
  68. package/lib/typescript/assets/icons/index.d.ts +2 -1
  69. package/lib/typescript/assets/icons/index.d.ts.map +1 -1
  70. package/lib/typescript/navigation/primary-navigator.d.ts +3 -0
  71. package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
  72. package/lib/typescript/screens/NFC/OcrStart.d.ts +2 -0
  73. package/lib/typescript/screens/NFC/OcrStart.d.ts.map +1 -0
  74. package/lib/typescript/screens/NFC/ScanMRZ.d.ts +15 -0
  75. package/lib/typescript/screens/NFC/ScanMRZ.d.ts.map +1 -0
  76. package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -1
  77. package/lib/typescript/screens/home/index.d.ts.map +1 -1
  78. package/lib/typescript/screens/nationalID/index.d.ts.map +1 -1
  79. package/lib/typescript/screens/nationalIDBack/index.d.ts.map +1 -1
  80. package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
  81. package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
  82. package/lib/typescript/utils/cameraCrop.d.ts +43 -0
  83. package/lib/typescript/utils/cameraCrop.d.ts.map +1 -0
  84. package/package.json +2 -1
  85. package/src/assets/icons/index.tsx +2 -0
  86. package/src/assets/icons/modal_confirm.svg +5 -5
  87. package/src/assets/icons/modal_notice.svg +32 -32
  88. package/src/assets/icons/modal_success.svg +26 -26
  89. package/src/assets/icons/modal_warning.svg +21 -21
  90. package/src/assets/icons/user_security.svg +10 -0
  91. package/src/assets/tts/Frame1000011947.png +0 -0
  92. package/src/navigation/primary-navigator.tsx +7 -0
  93. package/src/screens/NFC/OcrStart.tsx +171 -0
  94. package/src/screens/NFC/ScanMRZ.tsx +563 -0
  95. package/src/screens/camera/CCCDCameraScreen.tsx +203 -133
  96. package/src/screens/home/index.tsx +7 -112
  97. package/src/screens/nationalID/index.tsx +123 -218
  98. package/src/screens/nationalIDBack/index.tsx +129 -209
  99. package/src/screens/toan-trinh-so/OCR.tsx +269 -555
  100. package/src/screens/toan-trinh-so/VehicleCamera.tsx +225 -287
  101. package/src/utils/cameraCrop.ts +96 -0
@@ -1,69 +1,50 @@
1
1
  //@ts-nocheck
2
2
  import React, { useState } from 'react';
3
3
  import {
4
- ActivityIndicator,
5
- Dimensions,
6
4
  Image,
7
- ImageStyle,
8
5
  SafeAreaView,
9
6
  ScrollView,
10
- TouchableOpacity,
7
+ StyleSheet,
11
8
  View,
12
9
  } from 'react-native';
13
10
  import { StackActions, useNavigation } from '@react-navigation/native';
14
- import { observer, Observer } from 'mobx-react-lite';
11
+ import { observer } from 'mobx-react-lite';
15
12
  import { commonStyles } from '../CommonStyles';
16
13
  import KeyboardSpacer from '../../components/keyboardspace';
17
14
  import MButton from '../../components/MButton';
18
- import { color } from '../../theme';
19
15
  import { ScreenNames } from '../../navigation';
20
16
  import { MText } from '../../components/MText';
21
- import {
22
- CIMBBank,
23
- IconBackWhite,
24
- TimaSmall,
25
- TimaSmallWhite,
26
- } from '../../assets/icons';
27
- import appStore from '../../AppStore';
17
+ import { CIMBBank, TimaSmall, TimaSmallWhite } from '../../assets/icons';
28
18
  import nationalIDStore from './Store';
29
19
  import Loading from '../../components/Loading';
30
20
  import LinearGradient from 'react-native-linear-gradient';
31
21
  import MHeader from '../../components/MHeader';
32
22
  import livenessStore from '../liveness/LivenessStore';
33
23
 
34
- const logoView: ImageStyle = {
35
- position: 'absolute',
36
- width: '100%',
37
- height: '100%',
38
- resizeMode: 'cover',
39
- };
40
-
41
- const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
42
- const frameWidth = screenWidth * 0.85;
43
- const frameHeight = frameWidth * 0.63; // tỷ lệ giống CCCD
44
- const frameAspectRatio = frameWidth / frameHeight;
24
+ // Khung ảnh có chiều cao = 0.63 * chiều rộng nên tỉ lệ W/H = 1 / 0.63 (giống CCCD)
25
+ const frameAspectRatio = 1 / 0.63;
45
26
 
46
27
  export const NationalIDBack = observer(function NationalIDBack(props: any) {
47
28
  const navigation = useNavigation();
48
29
  const [photo, setPhoto] = useState(null);
49
- const loan = props.route.params?.loan;
50
30
  const [base64, setBase64] = useState(null);
51
31
  const [isLoading, setIsLoading] = useState(false);
32
+ const loan = props.route.params?.loan;
52
33
 
53
- const nextStep = (values) => {
34
+ const nextStep = () => {
54
35
  setIsLoading(true);
55
- const form2 = new FormData();
56
- form2.append('image', {
36
+ const form = new FormData();
37
+ form.append('image', {
57
38
  uri: photo,
58
39
  type: 'image/jpg',
59
40
  name: 'image.jpg',
60
41
  });
61
- form2.append('loanbriefId', loan.id);
62
- form2.append('TypeDocumentId', 311);
63
- form2.append('UploadFrom', 3);
64
- form2.append('SubTypeId', 2);
42
+ form.append('loanbriefId', loan.id);
43
+ form.append('TypeDocumentId', 311);
44
+ form.append('UploadFrom', 3);
45
+ form.append('SubTypeId', 2);
65
46
  nationalIDStore.uploadImage(
66
- form2,
47
+ form,
67
48
  () => {
68
49
  setIsLoading(false);
69
50
  navigation.dispatch(StackActions.push(ScreenNames.Selfie, { loan }));
@@ -75,210 +56,102 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
75
56
  };
76
57
 
77
58
  const takePhoto = () => {
78
- livenessStore.getConfigOcr(
79
- (data) => {
80
- if (data === 1) {
81
- navigation.push(ScreenNames.CCCDCameraScreen, {
82
- front: false,
83
- callback: (photo) => {
84
- setPhoto(photo);
85
- },
86
- });
87
- } else {
88
- navigation.push(ScreenNames.Camera, {
89
- front: false,
90
- callback: (photo) => {
91
- setPhoto(photo);
92
- },
93
- base64: (data) => {
94
- setBase64(data);
95
- },
96
- });
97
- }
98
- },
99
- () => {
100
- navigation.push(ScreenNames.Camera, {
101
- front: false,
102
- callback: (photo) => {
103
- setPhoto(photo);
104
- },
105
- base64: (data) => {
106
- setBase64(data);
107
- },
108
- });
109
- }
110
- );
59
+ navigation.push(ScreenNames.CCCDCameraScreen, {
60
+ front: false,
61
+ callback: setPhoto,
62
+ });
111
63
  };
112
64
 
113
65
  return (
114
- <View style={{ flex: 1 }}>
115
- <Image source={require('../../assets/img/EKYC.png')} style={logoView} />
116
- <MHeader
117
- title="Xác thực khách hàng"
118
- onBack={() => {
119
- navigation.goBack();
120
- }}
66
+ <View style={commonStyles.fill}>
67
+ <Image
68
+ source={require('../../assets/img/EKYC.png')}
69
+ style={styles.logo}
121
70
  />
71
+ <MHeader title="Xác thực khách hàng" onBack={() => navigation.goBack()} />
122
72
  <SafeAreaView style={commonStyles.fill}>
123
73
  <ScrollView style={commonStyles.fill}>
124
- <View style={{}}>
125
- <View style={{ paddingHorizontal: 16, paddingVertical: 16 }}>
126
- <View
127
- style={{
128
- flexDirection: 'row',
129
- alignItems: 'center',
130
- marginTop: 16,
131
- }}
132
- >
133
- <TimaSmallWhite />
134
- <MText
135
- style={[
136
- commonStyles.textNormalBold,
137
- { fontSize: 16, color: '#FFFFFF', marginLeft: 8 },
138
- ]}
139
- >
140
- Chụp CMND/ CCCD mặt sau
74
+ <View style={styles.body}>
75
+ <View style={styles.frontRow}>
76
+ <TimaSmallWhite />
77
+ <MText style={[commonStyles.textNormalBold, styles.frontLabel]}>
78
+ Chụp CMND/ CCCD mặt sau
79
+ </MText>
80
+ </View>
81
+ <View style={styles.frame}>
82
+ <Image
83
+ source={
84
+ photo
85
+ ? { uri: photo }
86
+ : require('../../assets/img/national_id_back.png')
87
+ }
88
+ style={styles.frameImage}
89
+ />
90
+ </View>
91
+ <View style={styles.noteSection}>
92
+ <MText style={[commonStyles.textNormalBold, styles.noteTitle]}>
93
+ Lưu ý chụp CMND/ CCCD
94
+ </MText>
95
+ <View style={styles.noteRow}>
96
+ <TimaSmall />
97
+ <MText style={styles.noteText}>
98
+ Nên đặt CCCD/ CMND lên mặt phẳng để chụp
141
99
  </MText>
142
100
  </View>
143
- <View
144
- style={{
145
- width: '100%',
146
- aspectRatio: frameAspectRatio,
147
- borderWidth: 8,
148
- borderRadius: 6,
149
- borderColor: '#FFFFFF',
150
- marginTop: 16,
151
- }}
152
- >
153
- <Image
154
- source={
155
- photo
156
- ? { uri: photo }
157
- : require('../../assets/img/national_id_back.png')
158
- }
159
- style={{
160
- width: '100%',
161
- height: '100%',
162
- resizeMode: 'cover',
163
- }}
164
- />
101
+ <View style={styles.noteRowTop}>
102
+ <TimaSmall style={styles.noteBulletTop} />
103
+ <MText style={styles.noteText}>
104
+ Đặt CCCD/ CMND nằm gọn trong khung hình{'\n'}(Không quá nhỏ
105
+ hay quá to làm mất chi tiết)
106
+ </MText>
165
107
  </View>
166
- <View style={{ marginTop: 24 }}>
167
- <MText style={[commonStyles.textNormalBold, { fontSize: 16 }]}>
168
- Lưu ý chụp CMND/ CCCD
108
+ <View style={styles.noteRow}>
109
+ <TimaSmall />
110
+ <MText style={styles.noteText}>
111
+ Chọn nơi ánh sáng tốt, tránh lóa/ chói hình chụp
169
112
  </MText>
170
- <View
171
- style={{
172
- flexDirection: 'row',
173
- marginTop: 16,
174
- alignItems: 'center',
175
- }}
176
- >
177
- <TimaSmall />
178
- <MText
179
- style={{ color: '#333333', marginLeft: 8, fontSize: 12 }}
180
- >
181
- Nên đặt CCCD/ CMND lên mặt phẳng để chụp
182
- </MText>
183
- </View>
184
- <View style={{ flexDirection: 'row', marginTop: 8 }}>
185
- <TimaSmall style={{ marginTop: 5 }} />
186
- <MText
187
- style={{ color: '#333333', marginLeft: 8, fontSize: 12 }}
188
- >
189
- Đặt CCCD/ CMND nằm gọn trong khung hình{'\n'}(Không quá nhỏ
190
- hay quá to làm mất chi tiết)
191
- </MText>
192
- </View>
193
- <View
194
- style={{
195
- flexDirection: 'row',
196
- marginTop: 8,
197
- alignItems: 'center',
198
- }}
199
- >
200
- <TimaSmall />
201
- <MText
202
- style={{ color: '#333333', marginLeft: 8, fontSize: 12 }}
203
- >
204
- Chọn nơi ánh sáng tốt, tránh lóa/ chói hình chụp
205
- </MText>
206
- </View>
207
113
  </View>
208
114
  </View>
209
115
  </View>
210
116
  </ScrollView>
211
- <View
212
- style={{
213
- flexDirection: 'row',
214
- paddingHorizontal: 16,
215
- marginBottom: 30,
216
- }}
217
- >
117
+ <View style={styles.actions}>
218
118
  <MButton
219
- onPress={() => {
220
- takePhoto();
221
- }}
119
+ onPress={takePhoto}
222
120
  disabled={isLoading}
223
121
  style={[
224
122
  commonStyles.row,
225
123
  commonStyles.alignCenter,
226
124
  commonStyles.justifyCenter,
227
- {
228
- backgroundColor: '#FFFFFF',
229
- height: 40,
230
- borderRadius: 30,
231
- flex: 1,
232
- marginRight: 8,
233
- borderWidth: 1,
234
- borderColor: '#EF4123',
235
- },
125
+ styles.captureBtn,
236
126
  ]}
237
127
  >
238
- <MText style={[commonStyles.textNormal, { color: '#F05123' }]}>
128
+ <MText style={[commonStyles.textNormal, styles.captureText]}>
239
129
  Chụp ảnh
240
130
  </MText>
241
131
  </MButton>
242
132
 
243
- <Observer>
244
- {() => (
245
- <MButton
246
- disabled={!photo || isLoading}
247
- onPress={nextStep}
248
- style={{ flex: 1 }}
249
- >
250
- <LinearGradient
251
- colors={['#FF7A00', '#EF4123']}
252
- style={[
253
- commonStyles.alignCenter,
254
- commonStyles.justifyCenter,
255
- {
256
- height: 40,
257
- borderRadius: 30,
258
- marginLeft: 8,
259
- },
260
- ]}
261
- >
262
- <MText style={[commonStyles.textNormal, { color: 'white' }]}>
263
- Tiếp tục
264
- </MText>
265
- </LinearGradient>
266
- </MButton>
267
- )}
268
- </Observer>
133
+ <MButton
134
+ disabled={!photo || isLoading}
135
+ onPress={nextStep}
136
+ style={commonStyles.fill}
137
+ >
138
+ <LinearGradient
139
+ colors={['#FF7A00', '#EF4123']}
140
+ style={[
141
+ commonStyles.alignCenter,
142
+ commonStyles.justifyCenter,
143
+ styles.gradientBtn,
144
+ ]}
145
+ >
146
+ <MText style={[commonStyles.textNormal, styles.continueText]}>
147
+ Tiếp tục
148
+ </MText>
149
+ </LinearGradient>
150
+ </MButton>
269
151
  </View>
270
152
  {loan?.isPipelineCIMB && (
271
- <View
272
- style={{
273
- marginBottom: 24,
274
- marginTop: 8,
275
- flexDirection: 'row',
276
- justifyContent: 'center',
277
- }}
278
- >
279
- <MText style={{ fontSize: 12, color: '#333333' }}>
280
- Cung cấp bởi{' '}
281
- </MText>
153
+ <View style={styles.cimbRow}>
154
+ <MText style={styles.cimbText}>Cung cấp bởi </MText>
282
155
  <CIMBBank />
283
156
  </View>
284
157
  )}
@@ -288,3 +161,50 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
288
161
  </View>
289
162
  );
290
163
  });
164
+
165
+ const styles = StyleSheet.create({
166
+ logo: {
167
+ position: 'absolute',
168
+ width: '100%',
169
+ height: '100%',
170
+ resizeMode: 'cover',
171
+ },
172
+ body: { paddingHorizontal: 16, paddingVertical: 16 },
173
+ frontRow: { flexDirection: 'row', alignItems: 'center', marginTop: 16 },
174
+ frontLabel: { fontSize: 16, color: '#FFFFFF', marginLeft: 8 },
175
+ frame: {
176
+ width: '100%',
177
+ aspectRatio: frameAspectRatio,
178
+ borderWidth: 8,
179
+ borderRadius: 6,
180
+ borderColor: '#FFFFFF',
181
+ marginTop: 16,
182
+ },
183
+ frameImage: { width: '100%', height: '100%', resizeMode: 'cover' },
184
+ noteSection: { marginTop: 24 },
185
+ noteTitle: { fontSize: 16 },
186
+ noteRow: { flexDirection: 'row', marginTop: 16, alignItems: 'center' },
187
+ noteRowTop: { flexDirection: 'row', marginTop: 8 },
188
+ noteBulletTop: { marginTop: 5 },
189
+ noteText: { color: '#333333', marginLeft: 8, fontSize: 12 },
190
+ actions: { flexDirection: 'row', paddingHorizontal: 16, marginBottom: 30 },
191
+ captureBtn: {
192
+ backgroundColor: '#FFFFFF',
193
+ height: 40,
194
+ borderRadius: 30,
195
+ flex: 1,
196
+ marginRight: 8,
197
+ borderWidth: 1,
198
+ borderColor: '#EF4123',
199
+ },
200
+ captureText: { color: '#F05123' },
201
+ gradientBtn: { height: 40, borderRadius: 30, marginLeft: 8 },
202
+ continueText: { color: 'white' },
203
+ cimbRow: {
204
+ marginBottom: 24,
205
+ marginTop: 8,
206
+ flexDirection: 'row',
207
+ justifyContent: 'center',
208
+ },
209
+ cimbText: { fontSize: 12, color: '#333333' },
210
+ });