@transfergratis/react-native-sdk 0.1.4 → 0.1.5
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/build/api/axios.d.ts +30 -0
- package/build/api/axios.d.ts.map +1 -0
- package/build/api/axios.js +92 -0
- package/build/api/axios.js.map +1 -0
- package/build/components/EnhancedCameraView.d.ts +1 -41
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +75 -34
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts +1 -41
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +28 -4
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +2 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +71 -114
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +7 -3
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts +7 -2
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +253 -104
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/InitializationStep.d.ts +5 -0
- package/build/components/KYCElements/InitializationStep.d.ts.map +1 -0
- package/build/components/KYCElements/InitializationStep.js +41 -0
- package/build/components/KYCElements/InitializationStep.js.map +1 -0
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +15 -13
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -2
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -2
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -2
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/ReviewSubmitTemplate.d.ts +12 -0
- package/build/components/KYCElements/ReviewSubmitTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/ReviewSubmitTemplate.js +171 -0
- package/build/components/KYCElements/ReviewSubmitTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts +6 -2
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +105 -35
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.d.ts +12 -0
- package/build/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/VerificationProgressTemplate.js +93 -0
- package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -0
- package/build/components/OverLay/IdCard.d.ts +1 -1
- package/build/components/OverLay/IdCard.d.ts.map +1 -1
- package/build/components/OverLay/IdCard.js +10 -6
- package/build/components/OverLay/IdCard.js.map +1 -1
- package/build/components/OverLay/SelfieOverlay.d.ts +1 -1
- package/build/components/OverLay/SelfieOverlay.d.ts.map +1 -1
- package/build/components/OverLay/SelfieOverlay.js +5 -4
- package/build/components/OverLay/SelfieOverlay.js.map +1 -1
- package/build/components/OverLay/type.d.ts +71 -1
- package/build/components/OverLay/type.d.ts.map +1 -1
- package/build/components/OverLay/type.js.map +1 -1
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +72 -197
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +63 -39
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/OrientationVideoExample.d.ts.map +1 -1
- package/build/components/example/OrientationVideoExample.js +1 -5
- package/build/components/example/OrientationVideoExample.js.map +1 -1
- package/build/config/countriesData.d.ts +3 -0
- package/build/config/countriesData.d.ts.map +1 -0
- package/build/config/countriesData.js +79 -0
- package/build/config/countriesData.js.map +1 -0
- package/build/config/region_mapping.d.ts +3 -0
- package/build/config/region_mapping.d.ts.map +1 -0
- package/build/config/region_mapping.js +687 -0
- package/build/config/region_mapping.js.map +1 -0
- package/build/hooks/useI18n.d.ts +11 -0
- package/build/hooks/useI18n.d.ts.map +1 -0
- package/build/hooks/useI18n.js +37 -0
- package/build/hooks/useI18n.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +1 -2
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +2 -1
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useRealtimeVerifier.d.ts +28 -0
- package/build/hooks/useRealtimeVerifier.d.ts.map +1 -0
- package/build/hooks/useRealtimeVerifier.js +91 -0
- package/build/hooks/useRealtimeVerifier.js.map +1 -0
- package/build/hooks/useTemplateKYCFlow.d.ts +1 -0
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +337 -38
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/i18n/en/index.d.ts +168 -0
- package/build/i18n/en/index.d.ts.map +1 -0
- package/build/i18n/en/index.js +195 -0
- package/build/i18n/en/index.js.map +1 -0
- package/build/i18n/fr/index.d.ts +168 -0
- package/build/i18n/fr/index.d.ts.map +1 -0
- package/build/i18n/fr/index.js +194 -0
- package/build/i18n/fr/index.js.map +1 -0
- package/build/i18n/index.d.ts +10 -0
- package/build/i18n/index.d.ts.map +1 -0
- package/build/i18n/index.js +56 -0
- package/build/i18n/index.js.map +1 -0
- package/build/i18n/types.d.ts +153 -0
- package/build/i18n/types.d.ts.map +1 -0
- package/build/i18n/types.js +3 -0
- package/build/i18n/types.js.map +1 -0
- package/build/i18n/usage-example.d.ts +4 -0
- package/build/i18n/usage-example.d.ts.map +1 -0
- package/build/i18n/usage-example.js +189 -0
- package/build/i18n/usage-example.js.map +1 -0
- package/build/modules/api/CardAuthentification.d.ts +22 -0
- package/build/modules/api/CardAuthentification.d.ts.map +1 -0
- package/build/modules/api/CardAuthentification.js +107 -0
- package/build/modules/api/CardAuthentification.js.map +1 -0
- package/build/modules/api/KYCService.d.ts +57 -1
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +348 -27
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -0
- package/build/modules/api/SelfieVerification.d.ts.map +1 -0
- package/build/modules/api/SelfieVerification.js +9 -0
- package/build/modules/api/SelfieVerification.js.map +1 -0
- package/build/modules/api/backendApi.d.ts +2 -0
- package/build/modules/api/backendApi.d.ts.map +1 -0
- package/build/modules/api/backendApi.js +6 -0
- package/build/modules/api/backendApi.js.map +1 -0
- package/build/modules/api/types.d.ts +20 -0
- package/build/modules/api/types.d.ts.map +1 -0
- package/build/modules/api/types.js +2 -0
- package/build/modules/api/types.js.map +1 -0
- package/build/types/KYC.types.d.ts +59 -7
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +9 -1
- package/build/types/KYC.types.js.map +1 -1
- package/build/utils/cropByObb.d.ts +11 -0
- package/build/utils/cropByObb.d.ts.map +1 -0
- package/build/utils/cropByObb.js +78 -0
- package/build/utils/cropByObb.js.map +1 -0
- package/build/utils/get-document-type-info.d.ts +13 -0
- package/build/utils/get-document-type-info.d.ts.map +1 -0
- package/build/utils/get-document-type-info.js +59 -0
- package/build/utils/get-document-type-info.js.map +1 -0
- package/build/utils/pathToBase64.d.ts +3 -0
- package/build/utils/pathToBase64.d.ts.map +1 -0
- package/build/utils/pathToBase64.js +47 -0
- package/build/utils/pathToBase64.js.map +1 -0
- package/build/utils/remove-duplicate.d.ts +2 -0
- package/build/utils/remove-duplicate.d.ts.map +1 -0
- package/build/utils/remove-duplicate.js +4 -0
- package/build/utils/remove-duplicate.js.map +1 -0
- package/package.json +3 -1
- package/src/api/axios.ts +144 -0
- package/src/components/EnhancedCameraView.tsx +96 -78
- package/src/components/EnhancedCameraView.web.tsx +41 -40
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +104 -136
- package/src/components/KYCElements/FileUploadTemplate.tsx +14 -8
- package/src/components/KYCElements/IDCardCapture.tsx +311 -115
- package/src/components/KYCElements/InitializationStep.tsx +53 -0
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +17 -15
- package/src/components/KYCElements/OrientationVideoCapture.tsx +2 -2
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +2 -2
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +2 -2
- package/src/components/KYCElements/ReviewSubmitTemplate.tsx +201 -0
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +140 -53
- package/src/components/KYCElements/VerificationProgressTemplate.tsx +123 -0
- package/src/components/OverLay/IdCard.tsx +17 -9
- package/src/components/OverLay/SelfieOverlay.tsx +6 -5
- package/src/components/OverLay/type.ts +64 -2
- package/src/components/TemplateKYCExample.tsx +76 -197
- package/src/components/TemplateKYCFlowRefactored.tsx +74 -46
- package/src/components/example/OrientationVideoExample.tsx +3 -7
- package/src/config/countriesData.ts +84 -0
- package/src/config/region_mapping.ts +688 -0
- package/src/hooks/useI18n.ts +53 -0
- package/src/hooks/useOrientationVideo.ts +2 -2
- package/src/hooks/useRealtimeVerifier.ts +128 -0
- package/src/hooks/useTemplateKYCFlow.tsx +375 -53
- package/src/i18n/README.md +288 -0
- package/src/i18n/en/index.ts +206 -0
- package/src/i18n/fr/index.ts +205 -0
- package/src/i18n/index.ts +65 -0
- package/src/i18n/types.ts +172 -0
- package/src/i18n/usage-example.tsx +202 -0
- package/src/modules/api/CardAuthentification.ts +114 -0
- package/src/modules/api/KYCService.ts +403 -30
- package/src/modules/api/SelfieVerification.ts +11 -0
- package/src/modules/api/backendApi.ts +8 -0
- package/src/modules/api/types.ts +24 -0
- package/src/types/KYC.types.ts +83 -14
- package/src/utils/cropByObb.ts +99 -0
- package/src/utils/get-document-type-info.ts +62 -0
- package/src/utils/pathToBase64.ts +47 -0
- package/src/utils/remove-duplicate.ts +3 -0
- package/src/types/nativewind.d.ts +0 -2
|
@@ -1,94 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { View, Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';
|
|
3
|
-
import { TemplateComponent, CountrySelectionConfig, LocalizedText } from '../../types/KYC.types';
|
|
3
|
+
import { TemplateComponent, CountrySelectionConfig, LocalizedText, Country } from '../../types/KYC.types';
|
|
4
|
+
import { countryMapping } from '../../config/region_mapping';
|
|
5
|
+
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
6
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
7
|
+
import { Button } from '../ui/Button';
|
|
8
|
+
import { countryData } from '../../config/countriesData';
|
|
4
9
|
|
|
5
10
|
interface CountrySelectionTemplateProps {
|
|
6
11
|
component: TemplateComponent;
|
|
7
12
|
value?: string;
|
|
8
|
-
onValueChange: (value:
|
|
13
|
+
onValueChange: (value: Country) => void;
|
|
9
14
|
error?: string;
|
|
10
15
|
language?: string;
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
const countryData: Record<string, { name: string; flag: string }> = {
|
|
14
|
-
FR: { name: 'France', flag: '🇫🇷' },
|
|
15
|
-
CM: { name: 'Cameroun', flag: '🇨🇲' },
|
|
16
|
-
US: { name: 'États-Unis', flag: '🇺🇸' },
|
|
17
|
-
DE: { name: 'Allemagne', flag: '🇩🇪' },
|
|
18
|
-
BE: { name: 'Belgique', flag: '🇧🇪' },
|
|
19
|
-
LU: { name: 'Luxembourg', flag: '🇱🇺' },
|
|
20
|
-
IT: { name: 'Italie', flag: '🇮🇹' },
|
|
21
|
-
ES: { name: 'Espagne', flag: '🇪🇸' },
|
|
22
|
-
PT: { name: 'Portugal', flag: '🇵🇹' },
|
|
23
|
-
AT: { name: 'Autriche', flag: '🇦🇹' },
|
|
24
|
-
CH: { name: 'Suisse', flag: '🇨🇭' },
|
|
25
|
-
NL: { name: 'Pays-Bas', flag: '🇳🇱' },
|
|
26
|
-
CA: { name: 'Canada', flag: '🇨🇦' },
|
|
27
|
-
GB: { name: 'Royaume-Uni', flag: '🇬🇧' },
|
|
28
|
-
AU: { name: 'Australie', flag: '🇦🇺' },
|
|
29
|
-
JP: { name: 'Japon', flag: '🇯🇵' },
|
|
30
|
-
KR: { name: 'Corée du Sud', flag: '🇰🇷' },
|
|
31
|
-
SG: { name: 'Singapour', flag: '🇸🇬' },
|
|
32
|
-
HK: { name: 'Hong Kong', flag: '🇭🇰' },
|
|
33
|
-
AE: { name: 'Émirats Arabes Unis', flag: '🇦🇪' },
|
|
34
|
-
SA: { name: 'Arabie Saoudite', flag: '🇸🇦' },
|
|
35
|
-
QA: { name: 'Qatar', flag: '🇶🇦' },
|
|
36
|
-
KW: { name: 'Koweït', flag: '🇰🇼' },
|
|
37
|
-
BH: { name: 'Bahreïn', flag: '🇧🇭' },
|
|
38
|
-
OM: { name: 'Oman', flag: '🇴🇲' },
|
|
39
|
-
JO: { name: 'Jordanie', flag: '🇯🇴' },
|
|
40
|
-
LB: { name: 'Liban', flag: '🇱🇧' },
|
|
41
|
-
EG: { name: 'Égypte', flag: '🇪🇬' },
|
|
42
|
-
MA: { name: 'Maroc', flag: '🇲🇦' },
|
|
43
|
-
TN: { name: 'Tunisie', flag: '🇹🇳' },
|
|
44
|
-
DZ: { name: 'Algérie', flag: '🇩🇿' },
|
|
45
|
-
SN: { name: 'Sénégal', flag: '🇸🇳' },
|
|
46
|
-
CI: { name: 'Côte d\'Ivoire', flag: '🇨🇮' },
|
|
47
|
-
NG: { name: 'Nigeria', flag: '🇳🇬' },
|
|
48
|
-
KE: { name: 'Kenya', flag: '🇰🇪' },
|
|
49
|
-
ZA: { name: 'Afrique du Sud', flag: '🇿🇦' },
|
|
50
|
-
BR: { name: 'Brésil', flag: '🇧🇷' },
|
|
51
|
-
MX: { name: 'Mexique', flag: '🇲🇽' },
|
|
52
|
-
AR: { name: 'Argentine', flag: '🇦🇷' },
|
|
53
|
-
CL: { name: 'Chili', flag: '🇨🇱' },
|
|
54
|
-
PE: { name: 'Pérou', flag: '🇵🇪' },
|
|
55
|
-
CO: { name: 'Colombie', flag: '🇨🇴' },
|
|
56
|
-
VE: { name: 'Venezuela', flag: '🇻🇪' },
|
|
57
|
-
EC: { name: 'Équateur', flag: '🇪🇨' },
|
|
58
|
-
UY: { name: 'Uruguay', flag: '🇺🇾' },
|
|
59
|
-
PY: { name: 'Paraguay', flag: '🇵🇾' },
|
|
60
|
-
BO: { name: 'Bolivie', flag: '🇧🇴' },
|
|
61
|
-
IN: { name: 'Inde', flag: '🇮🇳' },
|
|
62
|
-
CN: { name: 'Chine', flag: '🇨🇳' },
|
|
63
|
-
TH: { name: 'Thaïlande', flag: '🇹🇭' },
|
|
64
|
-
VN: { name: 'Vietnam', flag: '🇻🇳' },
|
|
65
|
-
ID: { name: 'Indonésie', flag: '🇮🇩' },
|
|
66
|
-
MY: { name: 'Malaisie', flag: '🇲🇾' },
|
|
67
|
-
PH: { name: 'Philippines', flag: '🇵🇭' },
|
|
68
|
-
TR: { name: 'Turquie', flag: '🇹🇷' },
|
|
69
|
-
IL: { name: 'Israël', flag: '🇮🇱' },
|
|
70
|
-
RU: { name: 'Russie', flag: '🇷🇺' },
|
|
71
|
-
UA: { name: 'Ukraine', flag: '🇺🇦' },
|
|
72
|
-
PL: { name: 'Pologne', flag: '🇵🇱' },
|
|
73
|
-
CZ: { name: 'République Tchèque', flag: '🇨🇿' },
|
|
74
|
-
HU: { name: 'Hongrie', flag: '🇭🇺' },
|
|
75
|
-
RO: { name: 'Roumanie', flag: '🇷🇴' },
|
|
76
|
-
BG: { name: 'Bulgarie', flag: '🇧🇬' },
|
|
77
|
-
HR: { name: 'Croatie', flag: '🇭🇷' },
|
|
78
|
-
SI: { name: 'Slovénie', flag: '🇸🇮' },
|
|
79
|
-
SK: { name: 'Slovaquie', flag: '🇸🇰' },
|
|
80
|
-
LT: { name: 'Lituanie', flag: '🇱🇹' },
|
|
81
|
-
LV: { name: 'Lettonie', flag: '🇱🇻' },
|
|
82
|
-
EE: { name: 'Estonie', flag: '🇪🇪' },
|
|
83
|
-
FI: { name: 'Finlande', flag: '🇫🇮' },
|
|
84
|
-
SE: { name: 'Suède', flag: '🇸🇪' },
|
|
85
|
-
NO: { name: 'Norvège', flag: '🇳🇴' },
|
|
86
|
-
DK: { name: 'Danemark', flag: '🇩🇰' },
|
|
87
|
-
IS: { name: 'Islande', flag: '🇮🇸' },
|
|
88
|
-
IE: { name: 'Irlande', flag: '🇮🇪' },
|
|
89
|
-
NZ: { name: 'Nouvelle-Zélande', flag: '🇳🇿' },
|
|
90
|
-
};
|
|
91
|
-
|
|
92
18
|
export const CountrySelectionTemplate: React.FC<CountrySelectionTemplateProps> = ({
|
|
93
19
|
component,
|
|
94
20
|
value,
|
|
@@ -96,9 +22,15 @@ export const CountrySelectionTemplate: React.FC<CountrySelectionTemplateProps> =
|
|
|
96
22
|
error,
|
|
97
23
|
language = 'en',
|
|
98
24
|
}) => {
|
|
25
|
+
const { t } = useI18n();
|
|
99
26
|
const config = component.config as CountrySelectionConfig;
|
|
100
|
-
const allowedCountries = config.allowed_countries || Object.keys(countryData);
|
|
101
|
-
const defaultCountry = config.default_country || '
|
|
27
|
+
const allowedCountries = (config.allowed_countries || Object.keys(countryData));
|
|
28
|
+
const defaultCountry = config.default_country || 'CM';
|
|
29
|
+
const { actions, state} = useTemplateKYCFlowContext();
|
|
30
|
+
|
|
31
|
+
console.log({ language }, state.currentLanguage);
|
|
32
|
+
|
|
33
|
+
const [selectedCountry, setSelectedCountry] = useState<Country>({ code: defaultCountry, ...countryData[defaultCountry] });
|
|
102
34
|
|
|
103
35
|
const getLocalizedText = (text: LocalizedText): string => {
|
|
104
36
|
return text[language] || text.en || '';
|
|
@@ -115,67 +47,102 @@ export const CountrySelectionTemplate: React.FC<CountrySelectionTemplateProps> =
|
|
|
115
47
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
116
48
|
|
|
117
49
|
return (
|
|
118
|
-
<View style={styles.
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
</Text>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
<Text style={styles.
|
|
50
|
+
<View style={styles.root}>
|
|
51
|
+
<View style={styles.container}>
|
|
52
|
+
<Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>
|
|
53
|
+
<Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>
|
|
54
|
+
|
|
55
|
+
<ScrollView style={styles.countriesContainer} showsVerticalScrollIndicator={false}>
|
|
56
|
+
{filteredCountries.map((country) => (
|
|
57
|
+
<TouchableOpacity
|
|
58
|
+
key={country.code}
|
|
59
|
+
style={[
|
|
60
|
+
styles.countryOption,
|
|
61
|
+
selectedCountry.code === country.code && styles.selectedCountryOption
|
|
62
|
+
]}
|
|
63
|
+
onPress={() => {
|
|
64
|
+
console.log({
|
|
65
|
+
country, language
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
setSelectedCountry(country);
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Text style={styles.countryFlag}>{country.flag}</Text>
|
|
72
|
+
<View style={styles.countryContent}>
|
|
73
|
+
<Text style={[
|
|
74
|
+
styles.countryName,
|
|
75
|
+
selectedCountry.code === country.code && styles.selectedCountryName
|
|
76
|
+
]}>
|
|
77
|
+
{state.currentLanguage === "en"? country.name_en: country.name}
|
|
78
|
+
</Text>
|
|
79
|
+
<Text style={styles.countryCode}>{country.code}</Text>
|
|
148
80
|
</View>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
81
|
+
{selectedCountry.code === country.code && (
|
|
82
|
+
<View style={[
|
|
83
|
+
styles.checkmark,
|
|
84
|
+
{ backgroundColor: component.ui.themeColor as string || '#2DBD60' }
|
|
85
|
+
]}>
|
|
86
|
+
<Text style={styles.checkmarkText}>✓</Text>
|
|
87
|
+
</View>
|
|
88
|
+
)}
|
|
89
|
+
</TouchableOpacity>
|
|
90
|
+
))}
|
|
91
|
+
</ScrollView>
|
|
92
|
+
|
|
93
|
+
{selectedCountry.code && (
|
|
94
|
+
<Button title={t('common.next')} onPress={() => {
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const mapping = selectedCountry.code ? countryMapping[selectedCountry.code as keyof typeof countryMapping] : undefined;
|
|
98
|
+
onValueChange({ ...selectedCountry, regionMapping: mapping });
|
|
99
|
+
setTimeout(() => {
|
|
100
|
+
actions.nextComponent();
|
|
101
|
+
}, 500);
|
|
102
|
+
}}
|
|
103
|
+
variant="primary"
|
|
104
|
+
size="large"
|
|
105
|
+
fullWidth
|
|
106
|
+
/>
|
|
107
|
+
)}
|
|
153
108
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<Text style={styles.selectionText}>
|
|
157
|
-
Pays sélectionné: {countryData[selectedValue]?.flag} {countryData[selectedValue]?.name}
|
|
158
|
-
</Text>
|
|
159
|
-
</View>
|
|
160
|
-
)}
|
|
109
|
+
{config.required && !selectedValue && (
|
|
110
|
+
<View style={styles.requiredContainer}>
|
|
161
111
|
|
|
162
|
-
{config.required && !selectedValue && (
|
|
163
|
-
<View style={styles.requiredContainer}>
|
|
164
|
-
<Text style={styles.requiredText}>⚠️ Veuillez sélectionner un pays</Text>
|
|
165
|
-
</View>
|
|
166
|
-
)}
|
|
167
112
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
113
|
+
<Text style={styles.requiredText}>{
|
|
114
|
+
state.currentLanguage === "en" ? "⚠️ Please Select your country" : "⚠️ Veuillez sélectionner un pays"
|
|
115
|
+
}</Text>
|
|
116
|
+
</View>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{error && (
|
|
120
|
+
<Text style={styles.errorText}>{error}</Text>
|
|
121
|
+
)}
|
|
122
|
+
</View>
|
|
171
123
|
</View>
|
|
172
124
|
);
|
|
173
125
|
};
|
|
174
126
|
|
|
175
127
|
const styles = StyleSheet.create({
|
|
176
|
-
|
|
128
|
+
root: {
|
|
177
129
|
flex: 1,
|
|
178
|
-
|
|
130
|
+
maxWidth: 760,
|
|
131
|
+
width: '100%',
|
|
132
|
+
},
|
|
133
|
+
container: {
|
|
134
|
+
backgroundColor: 'white',
|
|
135
|
+
margin: 10,
|
|
136
|
+
borderRadius: 10,
|
|
137
|
+
paddingVertical: 16,
|
|
138
|
+
paddingHorizontal: 16,
|
|
139
|
+
// shadow
|
|
140
|
+
shadowColor: '#000',
|
|
141
|
+
shadowOffset: { width: 0, height: 2 },
|
|
142
|
+
shadowOpacity: 0.35,
|
|
143
|
+
shadowRadius: 4.84,
|
|
144
|
+
elevation: 10,
|
|
145
|
+
|
|
179
146
|
},
|
|
180
147
|
title: {
|
|
181
148
|
fontSize: 24,
|
|
@@ -192,7 +159,8 @@ const styles = StyleSheet.create({
|
|
|
192
159
|
lineHeight: 22,
|
|
193
160
|
},
|
|
194
161
|
countriesContainer: {
|
|
195
|
-
|
|
162
|
+
height: "80%",
|
|
163
|
+
maxHeight: 600,
|
|
196
164
|
},
|
|
197
165
|
countryOption: {
|
|
198
166
|
flexDirection: 'row',
|
|
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { View, Text, TouchableOpacity, StyleSheet, ScrollView, Image, Alert } from 'react-native';
|
|
3
3
|
import { useKYCStore } from '../../stores/kycStore';
|
|
4
4
|
import NativeCameraModule from '../../modules/camera/NativeCameraModule';
|
|
5
|
+
import { useI18n } from '../../hooks/useI18n';
|
|
5
6
|
import { TemplateComponent, FileUploadConfig, LocalizedText } from '../../types/KYC.types';
|
|
6
7
|
|
|
7
8
|
interface FileUploadTemplateProps {
|
|
@@ -26,6 +27,7 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
26
27
|
error,
|
|
27
28
|
language = 'en',
|
|
28
29
|
}) => {
|
|
30
|
+
const { t } = useI18n();
|
|
29
31
|
const [uploadedFiles, setUploadedFiles] = useState<UploadedFile[]>([]);
|
|
30
32
|
const [isUploading, setIsUploading] = useState(false);
|
|
31
33
|
const { setProcessing } = useKYCStore();
|
|
@@ -100,6 +102,7 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
100
102
|
onValueChange(updatedFiles.map(file => file.uri));
|
|
101
103
|
};
|
|
102
104
|
|
|
105
|
+
|
|
103
106
|
const getFileIcon = (fileName: string) => {
|
|
104
107
|
const extension = fileName.split('.').pop()?.toLowerCase();
|
|
105
108
|
switch (extension) {
|
|
@@ -136,15 +139,15 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
136
139
|
|
|
137
140
|
return (
|
|
138
141
|
<View style={styles.container}>
|
|
139
|
-
<Text style={styles.title}>{getLocalizedText(component.labels)}</Text>
|
|
140
|
-
<Text style={styles.description}>{getLocalizedText(component.instructions)}</Text>
|
|
142
|
+
<Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>
|
|
143
|
+
<Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>
|
|
141
144
|
|
|
142
145
|
<View style={styles.uploadArea}>
|
|
143
146
|
<TouchableOpacity
|
|
144
147
|
style={[
|
|
145
148
|
styles.uploadButton,
|
|
146
149
|
isUploading && styles.uploadButtonDisabled,
|
|
147
|
-
{ borderColor: component.ui.themeColor || '#2DBD60' }
|
|
150
|
+
{ borderColor: component.ui.themeColor as string || '#2DBD60' }
|
|
148
151
|
]}
|
|
149
152
|
onPress={pickDocument}
|
|
150
153
|
disabled={isUploading}
|
|
@@ -152,7 +155,7 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
152
155
|
<Text style={styles.uploadIcon}>📁</Text>
|
|
153
156
|
<Text style={[
|
|
154
157
|
styles.uploadText,
|
|
155
|
-
{ color: component.ui.themeColor || '#2DBD60' }
|
|
158
|
+
{ color: component.ui.themeColor as string || '#2DBD60' }
|
|
156
159
|
]}>
|
|
157
160
|
{isUploading ? 'Sélection en cours...' : 'Sélectionner des fichiers'}
|
|
158
161
|
</Text>
|
|
@@ -198,9 +201,9 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
198
201
|
|
|
199
202
|
{!hasFiles && (
|
|
200
203
|
<View style={styles.emptyState}>
|
|
201
|
-
<Text style={styles.emptyStateText}>
|
|
204
|
+
<Text style={styles.emptyStateText}>{t('kyc.fileUpload.selectFile')}</Text>
|
|
202
205
|
<Text style={styles.emptyStateSubtext}>
|
|
203
|
-
{isRequired ? '
|
|
206
|
+
{isRequired ? t('validation.required') : t('common.info')}
|
|
204
207
|
</Text>
|
|
205
208
|
</View>
|
|
206
209
|
)}
|
|
@@ -210,11 +213,14 @@ export const FileUploadTemplate: React.FC<FileUploadTemplateProps> = ({
|
|
|
210
213
|
<TouchableOpacity
|
|
211
214
|
style={[
|
|
212
215
|
styles.primaryButton,
|
|
213
|
-
{ backgroundColor: component.ui.themeColor || '#2DBD60' }
|
|
216
|
+
{ backgroundColor: component.ui.themeColor as string || '#2DBD60' }
|
|
214
217
|
]}
|
|
218
|
+
onPress={() => {
|
|
219
|
+
onValueChange(uploadedFiles.map(file => file.uri));
|
|
220
|
+
}}
|
|
215
221
|
>
|
|
216
222
|
<Text style={styles.primaryButtonText}>
|
|
217
|
-
{getLocalizedText(component.ui.buttonText)}
|
|
223
|
+
{getLocalizedText(component.ui.buttonText as LocalizedText)}
|
|
218
224
|
</Text>
|
|
219
225
|
</TouchableOpacity>
|
|
220
226
|
</View>
|