@test-web/react-native-sdk 2.2.0 → 2.4.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/android/build/.transforms/246c075ea944392e66db7aa639265547/results.bin +1 -0
- package/android/build/.transforms/246c075ea944392e66db7aa639265547/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/yourcompany/sdk/BuildConfig.dex +0 -0
- package/android/build/.transforms/246c075ea944392e66db7aa639265547/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/yourcompany/sdk/YourSDKModule.dex +0 -0
- package/android/build/.transforms/246c075ea944392e66db7aa639265547/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/yourcompany/sdk/YourSDKPackage.dex +0 -0
- package/android/build/.transforms/246c075ea944392e66db7aa639265547/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/.transforms/952af5a0e7b5b2ac3d48ad66eccefd1f/results.bin +1 -0
- package/android/build/.transforms/952af5a0e7b5b2ac3d48ad66eccefd1f/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/generated/source/buildConfig/debug/com/yourcompany/sdk/BuildConfig.java +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +34 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/yourcompany/sdk/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/yourcompany/sdk/YourSDKModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/yourcompany/sdk/YourSDKPackage.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +56 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +34 -0
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/yourcompany/sdk/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/yourcompany/sdk/YourSDKModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/yourcompany/sdk/YourSDKPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +61 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/package.json +1 -1
- package/src/apis/captureBarcode.ts +37 -0
- package/src/apis/captureMRZ.ts +39 -0
- package/src/apis/checkLiveness.ts +48 -0
- package/src/apis/index.ts +26 -75
- package/src/components/common/Footer.tsx +19 -22
- package/src/components/common/Header.tsx +22 -21
- package/src/components/common/Loader.tsx +9 -28
- package/src/components/ui/Button.tsx +23 -31
- package/src/components/ui/ThemedText.tsx +21 -32
- package/src/context/FailedCountContext.tsx +35 -0
- package/src/context/IDMConfigurationContext.tsx +12 -2
- package/src/context/themes.ts +20 -0
- package/src/index.tsx +41 -29
- package/src/screens/BackDocumentAdvice.tsx +13 -18
- package/src/screens/BarcodeAdvice.tsx +39 -19
- package/src/screens/BarcodeCapture.tsx +127 -158
- package/src/screens/DocumentCaptureBack.tsx +145 -102
- package/src/screens/DocumentCaptureFront.tsx +146 -113
- package/src/screens/FrontDocumentAdvice.tsx +13 -18
- package/src/screens/LocationPermission.tsx +124 -17
- package/src/screens/MrzAdvice.tsx +27 -13
- package/src/screens/MrzCapture.tsx +233 -206
- package/src/screens/SelectDocuments.tsx +57 -66
- package/src/screens/SelfieAdvice.tsx +2 -3
- package/src/screens/SelfieCapture.tsx +135 -103
- package/src/screens/ThankYou.tsx +25 -31
- package/src/screens/VerifyIdentity.tsx +1 -0
- package/src/styles/BarcodeAdviceStyles.ts +6 -6
- package/src/styles/DocumentCaptureBackStyle.ts +70 -0
- package/src/styles/DocumentCaptureFrontStyle.ts +70 -0
- package/src/styles/FooterStyles.ts +27 -0
- package/src/styles/HeaderStyles.ts +20 -0
- package/src/styles/LoaderStyles.ts +14 -0
- package/src/styles/ScannerStyles.ts +46 -9
- package/src/styles/ThankYouStyles.ts +8 -11
- package/src/types/index.ts +8 -0
- package/src/utils/MRZ_README.md +111 -0
- package/src/utils/imagesHelper.ts +264 -0
- package/src/utils/metadata_new.json +11373 -1
- package/src/utils/mrzExamples.ts +127 -0
- package/src/utils/mrzParser.ts +303 -0
- package/src/utils/mrzUtils.ts +70 -0
|
@@ -8,21 +8,58 @@ export default (theme: Theme, orientation: Orientation) => {
|
|
|
8
8
|
return StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
10
|
flex: 1,
|
|
11
|
-
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
backgroundColor: theme.colors.background,
|
|
13
|
+
position: 'relative',
|
|
14
|
+
},
|
|
15
|
+
topLabel: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: isPortrait ? 80 : 20,
|
|
18
|
+
fontSize: 18,
|
|
19
|
+
fontWeight: '700',
|
|
20
|
+
width: '100%',
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
zIndex: 5,
|
|
23
|
+
color: '#fff',
|
|
24
|
+
},
|
|
25
|
+
bottomLabel: {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
bottom: isPortrait ? 140 : 20,
|
|
28
|
+
fontSize: 16,
|
|
29
|
+
width: '100%',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
zIndex: 5,
|
|
32
|
+
color: '#fff',
|
|
12
33
|
},
|
|
13
34
|
camera: {
|
|
14
35
|
flex: 1,
|
|
15
36
|
},
|
|
16
|
-
|
|
37
|
+
overlay: {
|
|
17
38
|
position: 'absolute',
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: '50%',
|
|
41
|
+
top: '20%',
|
|
42
|
+
bottom: 0,
|
|
43
|
+
left: 0,
|
|
44
|
+
right: 0,
|
|
45
|
+
},
|
|
46
|
+
captureButton: {
|
|
47
|
+
position: 'absolute',
|
|
48
|
+
bottom: isPortrait ? 50 : 20,
|
|
49
|
+
left: '50%',
|
|
50
|
+
marginLeft: -35,
|
|
51
|
+
width: 70,
|
|
52
|
+
height: 70,
|
|
53
|
+
backgroundColor: 'white',
|
|
54
|
+
borderRadius: 35,
|
|
55
|
+
borderWidth: 4,
|
|
56
|
+
borderColor: '#ccc',
|
|
57
|
+
},
|
|
58
|
+
text: {
|
|
59
|
+
color: theme.colors.text,
|
|
60
|
+
fontSize: 16,
|
|
24
61
|
textAlign: 'center',
|
|
25
|
-
|
|
62
|
+
marginBottom: 20,
|
|
26
63
|
},
|
|
27
64
|
});
|
|
28
65
|
};
|
|
@@ -2,30 +2,27 @@ import { StyleSheet } from 'react-native';
|
|
|
2
2
|
import { Theme } from '../types';
|
|
3
3
|
import { Orientation } from '../hooks/useOrientation';
|
|
4
4
|
|
|
5
|
-
export default (theme: Theme, orientation: Orientation) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return StyleSheet.create({
|
|
5
|
+
export default (theme: Theme, orientation: Orientation) =>
|
|
6
|
+
StyleSheet.create({
|
|
9
7
|
container: {
|
|
10
8
|
flex: 1,
|
|
11
9
|
backgroundColor: theme.colors.background,
|
|
12
10
|
alignItems: 'center',
|
|
13
|
-
justifyContent: 'center',
|
|
14
11
|
paddingHorizontal: 20,
|
|
12
|
+
paddingTop: 0,
|
|
13
|
+
justifyContent: 'center',
|
|
15
14
|
},
|
|
16
15
|
maintitle: {
|
|
17
16
|
textAlign: 'center',
|
|
18
|
-
fontWeight: '
|
|
19
|
-
marginBottom:
|
|
17
|
+
fontWeight: '700',
|
|
18
|
+
marginBottom: 0,
|
|
20
19
|
color: theme.colors.text,
|
|
21
|
-
fontSize: 32,
|
|
22
20
|
},
|
|
23
21
|
subtitle: {
|
|
24
|
-
textAlign: 'center',
|
|
25
22
|
fontWeight: '300',
|
|
26
|
-
color: theme.colors.subtitle,
|
|
27
23
|
fontSize: 20,
|
|
24
|
+
color: theme.colors.subtitle,
|
|
25
|
+
textAlign: 'center',
|
|
28
26
|
lineHeight: 30,
|
|
29
27
|
},
|
|
30
28
|
});
|
|
31
|
-
};
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# MRZ Scanner
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
MRZ (Machine Readable Zone) scanner implementation based on demo-testing-sdk.
|
|
6
|
+
|
|
7
|
+
Extracts **all text** from identity documents including:
|
|
8
|
+
- All visible text on the card (address, labels, personal info, etc.)
|
|
9
|
+
- MRZ lines (machine-readable zone at the bottom)
|
|
10
|
+
- Everything concatenated into a single normalized string
|
|
11
|
+
|
|
12
|
+
## Implementation
|
|
13
|
+
|
|
14
|
+
Based on `demo-testing-sdk/src/pages/MrzCapture.tsx` with the following approach:
|
|
15
|
+
|
|
16
|
+
1. **Camera Setup**: Uses react-native-vision-camera
|
|
17
|
+
2. **Text Recognition**: Uses @react-native-ml-kit/text-recognition
|
|
18
|
+
3. **Normalization**: Cleans OCR errors (O→0, I→1, S→5, etc.)
|
|
19
|
+
4. **Extraction**: Filters MRZ lines (28-46 characters)
|
|
20
|
+
5. **Full Text**: Concatenates all text from the card
|
|
21
|
+
6. **API Call**: Sends to `/ocr/mrz/text` endpoint
|
|
22
|
+
|
|
23
|
+
## Supported Document Types
|
|
24
|
+
|
|
25
|
+
### TD1 - ID Card Size
|
|
26
|
+
- **Format:** 3 lines × 30 characters = 90 total
|
|
27
|
+
- **Examples:** National ID cards, Residence permits
|
|
28
|
+
- **Works with:** Any country
|
|
29
|
+
|
|
30
|
+
### TD2 - Intermediate Size
|
|
31
|
+
- **Format:** 2 lines × 36 characters = 72 total
|
|
32
|
+
- **Examples:** Some travel documents
|
|
33
|
+
- **Works with:** Any country
|
|
34
|
+
|
|
35
|
+
### TD3 - Passport Size
|
|
36
|
+
- **Format:** 2 lines × 44 characters = 88 total
|
|
37
|
+
- **Examples:** Passports, Passport cards
|
|
38
|
+
- **Works with:** Any country
|
|
39
|
+
|
|
40
|
+
## Code Flow
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// 1. Take photo
|
|
44
|
+
const photo = await cameraRef.current.takePhoto();
|
|
45
|
+
|
|
46
|
+
// 2. Extract text using ML Kit
|
|
47
|
+
const result = await TextRecognition.recognize(imagePath);
|
|
48
|
+
|
|
49
|
+
// 3. Normalize all text lines
|
|
50
|
+
const allLines = result.blocks
|
|
51
|
+
.flatMap(block => block.lines)
|
|
52
|
+
.map(line => normalizeMrz(line.text));
|
|
53
|
+
|
|
54
|
+
// 4. Filter MRZ lines
|
|
55
|
+
const mrzLines = allLines.filter(text =>
|
|
56
|
+
/^[A-Z0-9<]{28,46}$/.test(text)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// 5. Concatenate all text
|
|
60
|
+
const fullCardText = allLines.join('');
|
|
61
|
+
|
|
62
|
+
// 6. Send to API
|
|
63
|
+
await captureMRZ(idmConf, {
|
|
64
|
+
code: fullCardText,
|
|
65
|
+
token: verificationToken,
|
|
66
|
+
engine: 'idmerit',
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## API Request
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// Endpoint: POST /ocr/mrz/text
|
|
74
|
+
// Content-Type: multipart/form-data
|
|
75
|
+
|
|
76
|
+
const formData = new FormData();
|
|
77
|
+
formData.append('token', requestData.token);
|
|
78
|
+
formData.append('code', requestData.code); // Full card text
|
|
79
|
+
formData.append('engine', requestData.engine);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Normalization Rules
|
|
83
|
+
|
|
84
|
+
| OCR Reads | Corrected To | Reason |
|
|
85
|
+
|-----------|--------------|--------|
|
|
86
|
+
| `O` | `0` | Letter O → Zero |
|
|
87
|
+
| `I` | `1` | Letter I → One |
|
|
88
|
+
| `S` | `5` | Letter S → Five |
|
|
89
|
+
| `«` or `»` | `<` | Angle quotes → Less than |
|
|
90
|
+
| Spaces | (removed) | Clean formatting |
|
|
91
|
+
|
|
92
|
+
## Auto-Scanning
|
|
93
|
+
|
|
94
|
+
The scanner automatically:
|
|
95
|
+
- Takes photos every 1 second
|
|
96
|
+
- Processes text recognition
|
|
97
|
+
- Retries if MRZ not detected
|
|
98
|
+
- Stops when valid MRZ is found
|
|
99
|
+
|
|
100
|
+
## Files
|
|
101
|
+
|
|
102
|
+
- `src/screens/MrzCapture.tsx` - Main scanner component
|
|
103
|
+
- `src/utils/mrzUtils.ts` - MRZ utilities
|
|
104
|
+
- `src/utils/mrzParser.ts` - Advanced MRZ parsing (optional)
|
|
105
|
+
- `src/apis/captureMRZ.ts` - API integration
|
|
106
|
+
|
|
107
|
+
## Reference
|
|
108
|
+
|
|
109
|
+
Implementation based on:
|
|
110
|
+
- `demo-testing-sdk/src/pages/MrzCapture.tsx`
|
|
111
|
+
- `demo-testing-sdk/src/apis/captureMRZ.ts`
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// utils/imagesHelper.ts
|
|
2
|
+
|
|
3
|
+
// ✅ Static image imports (Metro-safe)
|
|
4
|
+
const IMAGES = {
|
|
5
|
+
// Card type images
|
|
6
|
+
'driver-license.png': require('../../assets/images/driver-license.png'),
|
|
7
|
+
'national-id.png': require('../../assets/images/national-id.png'),
|
|
8
|
+
'permit-card.png': require('../../assets/images/permit-card.png'),
|
|
9
|
+
'passport.png': require('../../assets/images/passport.png'),
|
|
10
|
+
'passport-card.png': require('../../assets/images/passport-card.png'),
|
|
11
|
+
'greencard.png': require('../../assets/images/greencard.png'),
|
|
12
|
+
'health-card.png': require('../../assets/images/health-card.png'),
|
|
13
|
+
|
|
14
|
+
// Generic scan icons
|
|
15
|
+
'card-scan-icon.jpg': require('../../assets/images/card-scan-icon.jpg'),
|
|
16
|
+
'card-scan-icon-dl.png': require('../../assets/images/card-scan-icon-dl.png'),
|
|
17
|
+
'card-scan-icon-ni.png': require('../../assets/images/card-scan-icon-ni.png'),
|
|
18
|
+
'card-scan-icon-pr.png': require('../../assets/images/card-scan-icon-pr.png'),
|
|
19
|
+
'card-scan-icon-aadhaar.png': require('../../assets/images/card-scan-icon-aadhaar.png'),
|
|
20
|
+
'card-scan-icon-aadhaar-back.png': require('../../assets/images/card-scan-icon-aadhaar-back.png'),
|
|
21
|
+
'card-scan-icon-pan.png': require('../../assets/images/card-scan-icon-pan.png'),
|
|
22
|
+
'card-scan-icon-passport.png': require('../../assets/images/card-scan-icon-passport.png'),
|
|
23
|
+
'card-scan-icon-greencard.jpg': require('../../assets/images/card-scan-icon-greencard.jpg'),
|
|
24
|
+
'card-scan-icon-passport-card.jpg': require('../../assets/images/card-scan-icon-passport-card.jpg'),
|
|
25
|
+
'card-scan-icon-hc.png': require('../../assets/images/card-scan-icon-hc.png'),
|
|
26
|
+
'card-scan-icon-default-back.png': require('../../assets/images/card-scan-icon-default-back.png'),
|
|
27
|
+
'card-scan-icon-can-pr.png': require('../../assets/images/card-scan-icon-can-pr.png'),
|
|
28
|
+
|
|
29
|
+
// NI country-specific front
|
|
30
|
+
'card-scan-icon-ni-brazil.jpg': require('../../assets/images/card-scan-icon-ni-brazil.jpg'),
|
|
31
|
+
'card-scan-icon-ni-argentina.jpg': require('../../assets/images/card-scan-icon-ni-argentina.jpg'),
|
|
32
|
+
'card-scan-icon-ni-germany.jpg': require('../../assets/images/card-scan-icon-ni-germany.jpg'),
|
|
33
|
+
'card-scan-icon-ni-dominican-republic-front.png': require('../../assets/images/card-scan-icon-ni-dominican-republic-front.png'),
|
|
34
|
+
'card-scan-icon-ni-paraguay-front.png': require('../../assets/images/card-scan-icon-ni-paraguay-front.png'),
|
|
35
|
+
'card-scan-icon-ni-ukrain-front.png': require('../../assets/images/card-scan-icon-ni-ukrain-front.png'),
|
|
36
|
+
'card-scan-icon-ni-france-front.png': require('../../assets/images/card-scan-icon-ni-france-front.png'),
|
|
37
|
+
'card-scan-icon-ni-uae-front.png': require('../../assets/images/card-scan-icon-ni-uae-front.png'),
|
|
38
|
+
'card-scan-icon-ni-uganda-front.png': require('../../assets/images/card-scan-icon-ni-uganda-front.png'),
|
|
39
|
+
|
|
40
|
+
// NI country-specific back
|
|
41
|
+
'card-scan-icon-ni-brazil-back.jpg': require('../../assets/images/card-scan-icon-ni-brazil-back.jpg'),
|
|
42
|
+
'card-scan-icon-ni-argentina-back.jpg': require('../../assets/images/card-scan-icon-ni-argentina-back.jpg'),
|
|
43
|
+
'card-scan-icon-ni-dominican-republic-back.png': require('../../assets/images/card-scan-icon-ni-dominican-republic-back.png'),
|
|
44
|
+
'card-scan-icon-ni-paraguay-back.png': require('../../assets/images/card-scan-icon-ni-paraguay-back.png'),
|
|
45
|
+
'card-scan-icon-ni-ukrain-back.png': require('../../assets/images/card-scan-icon-ni-ukrain-back.png'),
|
|
46
|
+
'card-scan-icon-ni-france-back.png': require('../../assets/images/card-scan-icon-ni-france-back.png'),
|
|
47
|
+
'card-scan-icon-ni-uae-back.png': require('../../assets/images/card-scan-icon-ni-uae-back.png'),
|
|
48
|
+
|
|
49
|
+
// MRZ icons
|
|
50
|
+
'mrz.png': require('../../assets/images/mrz.png'),
|
|
51
|
+
'mrz-back.png': require('../../assets/images/mrz-back.png'),
|
|
52
|
+
'mrz-ni.png': require('../../assets/images/mrz-ni.png'),
|
|
53
|
+
'card-scan-icon-greencard-back.jpg': require('../../assets/images/card-scan-icon-greencard-back.jpg'),
|
|
54
|
+
'card-scan-icon-passport-card-back.jpg': require('../../assets/images/card-scan-icon-passport-card-back.jpg'),
|
|
55
|
+
'card-scan-icon-ni-germany-back.jpg': require('../../assets/images/card-scan-icon-ni-germany-back.jpg'),
|
|
56
|
+
'card-scan-icon-ni-dominican-republic-mrz.png': require('../../assets/images/card-scan-icon-ni-dominican-republic-mrz.png'),
|
|
57
|
+
'card-scan-icon-ni-paraguay-scan-mrz.png': require('../../assets/images/card-scan-icon-ni-paraguay-scan-mrz.png'),
|
|
58
|
+
'card-scan-icon-ni-ukrain-scan-mrz.png': require('../../assets/images/card-scan-icon-ni-ukrain-scan-mrz.png'),
|
|
59
|
+
'card-scan-icon-ni-france-scan-mrz.png': require('../../assets/images/card-scan-icon-ni-france-scan-mrz.png'),
|
|
60
|
+
'card-scan-icon-ni-uae-scan-mrz.png': require('../../assets/images/card-scan-icon-ni-uae-scan-mrz.png'),
|
|
61
|
+
'card-scan-icon-ni-uganda-scan-mrz.png': require('../../assets/images/card-scan-icon-ni-uganda-scan-mrz.png'),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get card type illustration (static image)
|
|
66
|
+
*/
|
|
67
|
+
export function getCardTypeImage(type: string) {
|
|
68
|
+
if (!type) return null;
|
|
69
|
+
|
|
70
|
+
let file = null;
|
|
71
|
+
switch (type) {
|
|
72
|
+
case 'DL':
|
|
73
|
+
file = 'driver-license.png';
|
|
74
|
+
break;
|
|
75
|
+
case 'NI':
|
|
76
|
+
file = 'national-id.png';
|
|
77
|
+
break;
|
|
78
|
+
case 'PR':
|
|
79
|
+
file = 'permit-card.png';
|
|
80
|
+
break;
|
|
81
|
+
case 'AADHAAR':
|
|
82
|
+
file = 'national-id.png';
|
|
83
|
+
break;
|
|
84
|
+
case 'PAN':
|
|
85
|
+
file = 'permit-card.png';
|
|
86
|
+
break;
|
|
87
|
+
case 'PP':
|
|
88
|
+
file = 'passport.png';
|
|
89
|
+
break;
|
|
90
|
+
case 'PPC':
|
|
91
|
+
case 'PPI':
|
|
92
|
+
case 'VC':
|
|
93
|
+
file = 'passport-card.png';
|
|
94
|
+
break;
|
|
95
|
+
case 'GREEN_CARD':
|
|
96
|
+
file = 'greencard.png';
|
|
97
|
+
break;
|
|
98
|
+
case 'HC':
|
|
99
|
+
file = 'health-card.png';
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return file ? IMAGES[file] : null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get front scan image
|
|
107
|
+
*/
|
|
108
|
+
export function getCardScanImage(type: string, countryCode: string) {
|
|
109
|
+
if (!type) return null;
|
|
110
|
+
|
|
111
|
+
let file = null;
|
|
112
|
+
|
|
113
|
+
if (type === 'DL') file = 'card-scan-icon-dl.png';
|
|
114
|
+
else if (type === 'NI') {
|
|
115
|
+
switch (countryCode) {
|
|
116
|
+
case 'BRA':
|
|
117
|
+
file = 'card-scan-icon-ni-brazil.jpg';
|
|
118
|
+
break;
|
|
119
|
+
case 'ARG':
|
|
120
|
+
file = 'card-scan-icon-ni-argentina.jpg';
|
|
121
|
+
break;
|
|
122
|
+
case 'DEU':
|
|
123
|
+
file = 'card-scan-icon-ni-germany.jpg';
|
|
124
|
+
break;
|
|
125
|
+
case 'DOM':
|
|
126
|
+
file = 'card-scan-icon-ni-dominican-republic-front.png';
|
|
127
|
+
break;
|
|
128
|
+
case 'PRY':
|
|
129
|
+
file = 'card-scan-icon-ni-paraguay-front.png';
|
|
130
|
+
break;
|
|
131
|
+
case 'UKR':
|
|
132
|
+
file = 'card-scan-icon-ni-ukrain-front.png';
|
|
133
|
+
break;
|
|
134
|
+
case 'FRA':
|
|
135
|
+
file = 'card-scan-icon-ni-france-front.png';
|
|
136
|
+
break;
|
|
137
|
+
case 'ARE':
|
|
138
|
+
file = 'card-scan-icon-ni-uae-front.png';
|
|
139
|
+
break;
|
|
140
|
+
case 'UGA':
|
|
141
|
+
file = 'card-scan-icon-ni-uganda-front.png';
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
file = 'card-scan-icon-ni.png';
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
switch (type) {
|
|
148
|
+
case 'PR':
|
|
149
|
+
file = 'card-scan-icon-pr.png';
|
|
150
|
+
break;
|
|
151
|
+
case 'AADHAAR':
|
|
152
|
+
file = 'card-scan-icon-aadhaar.png';
|
|
153
|
+
break;
|
|
154
|
+
case 'PAN':
|
|
155
|
+
file = 'card-scan-icon-pan.png';
|
|
156
|
+
break;
|
|
157
|
+
case 'PP':
|
|
158
|
+
file = 'card-scan-icon-passport.png';
|
|
159
|
+
break;
|
|
160
|
+
case 'GREEN_CARD':
|
|
161
|
+
file = 'card-scan-icon-greencard.jpg';
|
|
162
|
+
break;
|
|
163
|
+
case 'PPC':
|
|
164
|
+
file = 'card-scan-icon-passport-card.jpg';
|
|
165
|
+
break;
|
|
166
|
+
case 'HC':
|
|
167
|
+
if (countryCode === 'CAN') file = 'card-scan-icon-hc.png';
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return file ? IMAGES[file] : IMAGES['card-scan-icon.jpg'];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Get back scan image
|
|
177
|
+
*/
|
|
178
|
+
export function getCardScanImageBack(type: string, countryCode: string) {
|
|
179
|
+
if (!type) return null;
|
|
180
|
+
|
|
181
|
+
let file = null;
|
|
182
|
+
|
|
183
|
+
if (type === 'NI') {
|
|
184
|
+
switch (countryCode) {
|
|
185
|
+
case 'BRA':
|
|
186
|
+
file = 'card-scan-icon-ni-brazil-back.jpg';
|
|
187
|
+
break;
|
|
188
|
+
case 'ARG':
|
|
189
|
+
file = 'card-scan-icon-ni-argentina-back.jpg';
|
|
190
|
+
break;
|
|
191
|
+
case 'DOM':
|
|
192
|
+
file = 'card-scan-icon-ni-dominican-republic-back.png';
|
|
193
|
+
break;
|
|
194
|
+
case 'PRY':
|
|
195
|
+
file = 'card-scan-icon-ni-paraguay-back.png';
|
|
196
|
+
break;
|
|
197
|
+
case 'UKR':
|
|
198
|
+
file = 'card-scan-icon-ni-ukrain-back.png';
|
|
199
|
+
break;
|
|
200
|
+
case 'FRA':
|
|
201
|
+
file = 'card-scan-icon-ni-france-back.png';
|
|
202
|
+
break;
|
|
203
|
+
case 'ARE':
|
|
204
|
+
file = 'card-scan-icon-ni-uae-back.png';
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
file = 'card-scan-icon-default-back.png';
|
|
208
|
+
}
|
|
209
|
+
} else if (type === 'AADHAAR') {
|
|
210
|
+
file = 'card-scan-icon-aadhaar-back.png';
|
|
211
|
+
} else if (type === 'RESIDENCE_PERMIT' && countryCode === 'CAN') {
|
|
212
|
+
file = 'card-scan-icon-can-pr.png';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return file ? IMAGES[file] : IMAGES['card-scan-icon-default-back.png'];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Get MRZ image based on documentType, countryCode, and barcodeType
|
|
220
|
+
*/
|
|
221
|
+
export function getMRZImage(documentType: string, countryCode: string, barcodeType: string) {
|
|
222
|
+
if (barcodeType === 'td3b') {
|
|
223
|
+
if (documentType === 'GREEN_CARD') {
|
|
224
|
+
return IMAGES['card-scan-icon-greencard-back.jpg'];
|
|
225
|
+
}
|
|
226
|
+
if (documentType === 'PPC') {
|
|
227
|
+
return IMAGES['card-scan-icon-passport-card-back.jpg'];
|
|
228
|
+
}
|
|
229
|
+
return IMAGES['mrz-back.png'];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Other barcode types
|
|
233
|
+
if (documentType === 'GREEN_CARD') {
|
|
234
|
+
return IMAGES['card-scan-icon-greencard-back.jpg'];
|
|
235
|
+
}
|
|
236
|
+
if (documentType === 'PPC') {
|
|
237
|
+
return IMAGES['card-scan-icon-passport-card-back.jpg'];
|
|
238
|
+
}
|
|
239
|
+
if (documentType === 'NI') {
|
|
240
|
+
switch (countryCode) {
|
|
241
|
+
case 'DEU':
|
|
242
|
+
return IMAGES['card-scan-icon-ni-germany-back.jpg'];
|
|
243
|
+
case 'DOM':
|
|
244
|
+
return IMAGES['card-scan-icon-ni-dominican-republic-mrz.png'];
|
|
245
|
+
case 'PRY':
|
|
246
|
+
return IMAGES['card-scan-icon-ni-paraguay-scan-mrz.png'];
|
|
247
|
+
case 'UKR':
|
|
248
|
+
return IMAGES['card-scan-icon-ni-ukrain-scan-mrz.png'];
|
|
249
|
+
case 'FRA':
|
|
250
|
+
return IMAGES['card-scan-icon-ni-france-scan-mrz.png'];
|
|
251
|
+
case 'ARE':
|
|
252
|
+
return IMAGES['card-scan-icon-ni-uae-scan-mrz.png'];
|
|
253
|
+
case 'UGA':
|
|
254
|
+
return IMAGES['card-scan-icon-ni-uganda-scan-mrz.png'];
|
|
255
|
+
default:
|
|
256
|
+
return IMAGES['mrz-ni.png'];
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (documentType === 'RPC' && countryCode === 'CAN') {
|
|
260
|
+
return IMAGES['card-scan-icon-can-pr.png'];
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return IMAGES['mrz.png'];
|
|
264
|
+
}
|