@transfergratis/react-native-sdk 0.1.5 → 0.1.7
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/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +7 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +32 -3
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/VerificationProgressTemplate.js +106 -5
- package/build/components/KYCElements/VerificationProgressTemplate.js.map +1 -1
- package/build/components/TemplateKYCExample.d.ts +4 -1
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +4 -4
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +3 -2
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +2 -2
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +5 -3
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +89 -74
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +2 -1
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +17 -61
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/types.d.ts +25 -0
- package/build/modules/api/types.d.ts.map +1 -1
- package/build/modules/api/types.js.map +1 -1
- package/build/types/KYC.types.d.ts +2 -5
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js.map +1 -1
- package/build/utils/cropByObb.js +4 -4
- package/build/utils/cropByObb.js.map +1 -1
- package/build/web/WebKYCEntry.d.ts +9 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -0
- package/build/web/WebKYCEntry.js +156 -0
- package/build/web/WebKYCEntry.js.map +1 -0
- package/build/web/index.d.ts +2 -0
- package/build/web/index.d.ts.map +1 -0
- package/build/web/index.js +2 -0
- package/build/web/index.js.map +1 -0
- package/package.json +4 -4
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +8 -1
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +37 -7
- package/src/components/KYCElements/VerificationProgressTemplate.tsx +129 -6
- package/src/components/TemplateKYCExample.tsx +6 -5
- package/src/components/TemplateKYCFlowRefactored.tsx +6 -2
- package/src/hooks/useTemplateKYCFlow.tsx +105 -77
- package/src/index.ts +3 -0
- package/src/modules/api/KYCService.ts +21 -74
- package/src/modules/api/types.ts +30 -3
- package/src/types/KYC.types.ts +4 -5
- package/src/utils/cropByObb.ts +5 -5
- package/src/web/WebKYCEntry.tsx +215 -0
- package/src/web/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountrySelectionTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/CountrySelectionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CountrySelectionTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/CountrySelectionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAyC,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAO1G,UAAU,6BAA6B;IACrC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAkH5E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View, Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';
|
|
3
3
|
import { countryMapping } from '../../config/region_mapping';
|
|
4
4
|
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
@@ -24,6 +24,12 @@ export const CountrySelectionTemplate = ({ component, value, onValueChange, erro
|
|
|
24
24
|
...countryData[code]
|
|
25
25
|
}))
|
|
26
26
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (selectedCountry) {
|
|
29
|
+
const mapping = selectedCountry.code ? countryMapping[selectedCountry.code] : undefined;
|
|
30
|
+
onValueChange({ ...selectedCountry, regionMapping: mapping });
|
|
31
|
+
}
|
|
32
|
+
}, [selectedCountry]);
|
|
27
33
|
return (<View style={styles.root}>
|
|
28
34
|
<View style={styles.container}>
|
|
29
35
|
<Text style={styles.title}>{getLocalizedText(component.labels)}</Text>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountrySelectionTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/CountrySelectionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAA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KACjB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,aAAa,EAAE;QACb,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,aAAa,EAAE;QACb,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;KACrB;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,SAAS;KACjB;IACD,iBAAiB,EAAE;QACjB,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;KACrB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,SAAS;KACjB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { View, Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';\nimport { TemplateComponent, CountrySelectionConfig, LocalizedText, Country } from '../../types/KYC.types';\nimport { countryMapping } from '../../config/region_mapping';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport { countryData } from '../../config/countriesData';\n\ninterface CountrySelectionTemplateProps {\n component: TemplateComponent;\n value?: string;\n onValueChange: (value: Country) => void;\n error?: string;\n language?: string;\n}\n\nexport const CountrySelectionTemplate: React.FC<CountrySelectionTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n language = 'en',\n}) => {\n const { t } = useI18n();\n const config = component.config as CountrySelectionConfig;\n const allowedCountries = (config.allowed_countries || Object.keys(countryData));\n const defaultCountry = config.default_country || 'CM';\n const { actions, state} = useTemplateKYCFlowContext();\n\n console.log({ language }, state.currentLanguage);\n\n const [selectedCountry, setSelectedCountry] = useState<Country>({ code: defaultCountry, ...countryData[defaultCountry] });\n\n const getLocalizedText = (text: LocalizedText): string => {\n return text[language] || text.en || '';\n };\n\n const selectedValue = value || defaultCountry;\n\n const filteredCountries = allowedCountries\n .filter(code => countryData[code])\n .map(code => ({\n code,\n ...countryData[code]\n }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\n return (\n <View style={styles.root}>\n <View style={styles.container}>\n <Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>\n <Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>\n\n <ScrollView style={styles.countriesContainer} showsVerticalScrollIndicator={false}>\n {filteredCountries.map((country) => (\n <TouchableOpacity\n key={country.code}\n style={[\n styles.countryOption,\n selectedCountry.code === country.code && styles.selectedCountryOption\n ]}\n onPress={() => {\n console.log({\n country, language\n });\n\n setSelectedCountry(country);\n }}\n >\n <Text style={styles.countryFlag}>{country.flag}</Text>\n <View style={styles.countryContent}>\n <Text style={[\n styles.countryName,\n selectedCountry.code === country.code && styles.selectedCountryName\n ]}>\n {state.currentLanguage === \"en\"? country.name_en: country.name}\n </Text>\n <Text style={styles.countryCode}>{country.code}</Text>\n </View>\n {selectedCountry.code === country.code && (\n <View style={[\n styles.checkmark,\n { backgroundColor: component.ui.themeColor as string || '#2DBD60' }\n ]}>\n <Text style={styles.checkmarkText}>✓</Text>\n </View>\n )}\n </TouchableOpacity>\n ))}\n </ScrollView>\n\n {selectedCountry.code && (\n <Button title={t('common.next')} onPress={() => {\n\n\n const mapping = selectedCountry.code ? countryMapping[selectedCountry.code as keyof typeof countryMapping] : undefined;\n onValueChange({ ...selectedCountry, regionMapping: mapping });\n setTimeout(() => {\n actions.nextComponent();\n }, 500);\n }}\n variant=\"primary\"\n size=\"large\"\n fullWidth\n />\n )}\n\n {config.required && !selectedValue && (\n <View style={styles.requiredContainer}>\n\n\n <Text style={styles.requiredText}>{\n state.currentLanguage === \"en\" ? \"⚠️ Please Select your country\" : \"⚠️ Veuillez sélectionner un pays\"\n }</Text>\n </View>\n )}\n\n {error && (\n <Text style={styles.errorText}>{error}</Text>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n maxWidth: 760,\n width: '100%',\n },\n container: {\n backgroundColor: 'white',\n margin: 10,\n borderRadius: 10,\n paddingVertical: 16,\n paddingHorizontal: 16,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.35,\n shadowRadius: 4.84,\n elevation: 10,\n\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n description: {\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n marginBottom: 24,\n lineHeight: 22,\n },\n countriesContainer: {\n height: \"80%\",\n maxHeight: 600,\n },\n countryOption: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 16,\n backgroundColor: 'white',\n borderRadius: 12,\n marginBottom: 12,\n borderWidth: 2,\n borderColor: '#e5e5e5',\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 2,\n },\n shadowOpacity: 0.1,\n shadowRadius: 3.84,\n elevation: 5,\n },\n selectedCountryOption: {\n borderColor: '#2DBD60',\n backgroundColor: '#f0f9f0',\n },\n countryFlag: {\n fontSize: 32,\n marginRight: 16,\n },\n countryContent: {\n flex: 1,\n },\n countryName: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n },\n selectedCountryName: {\n color: '#2DBD60',\n },\n countryCode: {\n fontSize: 14,\n color: '#666',\n marginTop: 4,\n fontWeight: '500',\n },\n checkmark: {\n width: 24,\n height: 24,\n borderRadius: 12,\n justifyContent: 'center',\n alignItems: 'center',\n },\n checkmarkText: {\n color: 'white',\n fontSize: 16,\n fontWeight: 'bold',\n },\n selectionInfo: {\n backgroundColor: '#f0f9f0',\n padding: 16,\n borderRadius: 8,\n marginTop: 16,\n alignItems: 'center',\n },\n selectionText: {\n fontSize: 16,\n fontWeight: '600',\n color: '#2DBD60',\n },\n requiredContainer: {\n backgroundColor: '#fff3cd',\n padding: 16,\n borderRadius: 8,\n marginTop: 16,\n alignItems: 'center',\n },\n requiredText: {\n fontSize: 16,\n fontWeight: '600',\n color: '#856404',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 14,\n marginTop: 8,\n textAlign: 'center',\n },\n}); "]}
|
|
1
|
+
{"version":3,"file":"CountrySelectionTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/CountrySelectionTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAUzD,MAAM,CAAC,MAAM,wBAAwB,GAA4C,CAAC,EAChF,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EACL,QA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AAmB,EAAE;QACnB,KAAK,EAAE,SAAS;KACjB;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;KACrB;IACD,aAAa,EAAE;QACb,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,aAAa,EAAE;QACb,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;KACrB;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,SAAS;KACjB;IACD,iBAAiB,EAAE;QACjB,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;KACrB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,SAAS;KACjB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,QAAQ;KACpB;CACF,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { View, Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';\nimport { TemplateComponent, CountrySelectionConfig, LocalizedText, Country } from '../../types/KYC.types';\nimport { countryMapping } from '../../config/region_mapping';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport { countryData } from '../../config/countriesData';\n\ninterface CountrySelectionTemplateProps {\n component: TemplateComponent;\n value?: string;\n onValueChange: (value: Country) => void;\n error?: string;\n language?: string;\n}\n\nexport const CountrySelectionTemplate: React.FC<CountrySelectionTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n language = 'en',\n}) => {\n const { t } = useI18n();\n const config = component.config as CountrySelectionConfig;\n const allowedCountries = (config.allowed_countries || Object.keys(countryData));\n const defaultCountry = config.default_country || 'CM';\n const { actions, state} = useTemplateKYCFlowContext();\n\n console.log({ language }, state.currentLanguage);\n\n const [selectedCountry, setSelectedCountry] = useState<Country>({ code: defaultCountry, ...countryData[defaultCountry] });\n\n const getLocalizedText = (text: LocalizedText): string => {\n return text[language] || text.en || '';\n };\n\n const selectedValue = value || defaultCountry;\n\n const filteredCountries = allowedCountries\n .filter(code => countryData[code])\n .map(code => ({\n code,\n ...countryData[code]\n }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\n useEffect(() => {\n if (selectedCountry) {\n const mapping = selectedCountry.code ? countryMapping[selectedCountry.code as keyof typeof countryMapping] : undefined;\n onValueChange({ ...selectedCountry, regionMapping: mapping });\n }\n }, [selectedCountry]);\n\n return (\n <View style={styles.root}>\n <View style={styles.container}>\n <Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>\n <Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>\n\n <ScrollView style={styles.countriesContainer} showsVerticalScrollIndicator={false}>\n {filteredCountries.map((country) => (\n <TouchableOpacity\n key={country.code}\n style={[\n styles.countryOption,\n selectedCountry.code === country.code && styles.selectedCountryOption\n ]}\n onPress={() => {\n console.log({\n country, language\n });\n\n setSelectedCountry(country);\n }}\n >\n <Text style={styles.countryFlag}>{country.flag}</Text>\n <View style={styles.countryContent}>\n <Text style={[\n styles.countryName,\n selectedCountry.code === country.code && styles.selectedCountryName\n ]}>\n {state.currentLanguage === \"en\"? country.name_en: country.name}\n </Text>\n <Text style={styles.countryCode}>{country.code}</Text>\n </View>\n {selectedCountry.code === country.code && (\n <View style={[\n styles.checkmark,\n { backgroundColor: component.ui.themeColor as string || '#2DBD60' }\n ]}>\n <Text style={styles.checkmarkText}>✓</Text>\n </View>\n )}\n </TouchableOpacity>\n ))}\n </ScrollView>\n\n {selectedCountry.code && (\n <Button title={t('common.next')} onPress={() => {\n\n\n const mapping = selectedCountry.code ? countryMapping[selectedCountry.code as keyof typeof countryMapping] : undefined;\n onValueChange({ ...selectedCountry, regionMapping: mapping });\n setTimeout(() => {\n actions.nextComponent();\n }, 500);\n }}\n variant=\"primary\"\n size=\"large\"\n fullWidth\n />\n )}\n\n {config.required && !selectedValue && (\n <View style={styles.requiredContainer}>\n\n\n <Text style={styles.requiredText}>{\n state.currentLanguage === \"en\" ? \"⚠️ Please Select your country\" : \"⚠️ Veuillez sélectionner un pays\"\n }</Text>\n </View>\n )}\n\n {error && (\n <Text style={styles.errorText}>{error}</Text>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n maxWidth: 760,\n width: '100%',\n },\n container: {\n backgroundColor: 'white',\n margin: 10,\n borderRadius: 10,\n paddingVertical: 16,\n paddingHorizontal: 16,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.35,\n shadowRadius: 4.84,\n elevation: 10,\n\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n description: {\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n marginBottom: 24,\n lineHeight: 22,\n },\n countriesContainer: {\n height: \"80%\",\n maxHeight: 600,\n },\n countryOption: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 16,\n backgroundColor: 'white',\n borderRadius: 12,\n marginBottom: 12,\n borderWidth: 2,\n borderColor: '#e5e5e5',\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 2,\n },\n shadowOpacity: 0.1,\n shadowRadius: 3.84,\n elevation: 5,\n },\n selectedCountryOption: {\n borderColor: '#2DBD60',\n backgroundColor: '#f0f9f0',\n },\n countryFlag: {\n fontSize: 32,\n marginRight: 16,\n },\n countryContent: {\n flex: 1,\n },\n countryName: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n },\n selectedCountryName: {\n color: '#2DBD60',\n },\n countryCode: {\n fontSize: 14,\n color: '#666',\n marginTop: 4,\n fontWeight: '500',\n },\n checkmark: {\n width: 24,\n height: 24,\n borderRadius: 12,\n justifyContent: 'center',\n alignItems: 'center',\n },\n checkmarkText: {\n color: 'white',\n fontSize: 16,\n fontWeight: 'bold',\n },\n selectionInfo: {\n backgroundColor: '#f0f9f0',\n padding: 16,\n borderRadius: 8,\n marginTop: 16,\n alignItems: 'center',\n },\n selectionText: {\n fontSize: 16,\n fontWeight: '600',\n color: '#2DBD60',\n },\n requiredContainer: {\n backgroundColor: '#fff3cd',\n padding: 16,\n borderRadius: 8,\n marginTop: 16,\n alignItems: 'center',\n },\n requiredText: {\n fontSize: 16,\n fontWeight: '600',\n color: '#856404',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 14,\n marginTop: 8,\n textAlign: 'center',\n },\n}); "]}
|
|
@@ -7,7 +7,7 @@ interface IImagePayload {
|
|
|
7
7
|
interface SelfieCaptureTemplateProps {
|
|
8
8
|
component: TemplateComponent;
|
|
9
9
|
value: Record<string, IImagePayload> | undefined;
|
|
10
|
-
onValueChange: (value: Record<string, IImagePayload>) => void;
|
|
10
|
+
onValueChange: (value: Record<string, IImagePayload | string>) => void;
|
|
11
11
|
error?: string;
|
|
12
12
|
language: string;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/SelfieCaptureTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SelfieCaptureTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/SelfieCaptureTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAA8F,MAAM,uBAAuB,CAAC;AAUtJ,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AACD,UAAU,0BAA0B;IAClC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,CAAC;IACjD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA+UtE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, Alert, ScrollView } from 'react-native';
|
|
3
3
|
import { EnhancedCameraView } from '../EnhancedCameraView';
|
|
4
4
|
import { Button } from '../ui/Button';
|
|
@@ -7,6 +7,7 @@ import { useI18n } from '../../hooks/useI18n';
|
|
|
7
7
|
import SelfieOverlay from '../OverLay/SelfieOverlay';
|
|
8
8
|
import selfieVerification from '../../modules/api/SelfieVerification';
|
|
9
9
|
import pathToBase64 from '../../utils/pathToBase64';
|
|
10
|
+
import { truncateFields } from '../../modules/api/KYCService';
|
|
10
11
|
export const SelfieCaptureTemplate = ({ component, value, onValueChange, error, language, }) => {
|
|
11
12
|
const { t } = useI18n();
|
|
12
13
|
const config = component.config;
|
|
@@ -68,6 +69,14 @@ export const SelfieCaptureTemplate = ({ component, value, onValueChange, error,
|
|
|
68
69
|
return orientation;
|
|
69
70
|
}
|
|
70
71
|
};
|
|
72
|
+
// const countryData = useMemo(() => {
|
|
73
|
+
// const geCountryID = Object.keys(state.componentData).find((c: string) => c === "6");
|
|
74
|
+
// if (geCountryID) {
|
|
75
|
+
// const countryMapping = state.componentData[geCountryID];
|
|
76
|
+
// return countryMapping?.code;
|
|
77
|
+
// }
|
|
78
|
+
// return null;
|
|
79
|
+
// }, [state.componentData]);
|
|
71
80
|
const getInstructions = (orientation) => {
|
|
72
81
|
const lang = state.currentLanguage;
|
|
73
82
|
switch (orientation) {
|
|
@@ -143,6 +152,15 @@ export const SelfieCaptureTemplate = ({ component, value, onValueChange, error,
|
|
|
143
152
|
}
|
|
144
153
|
}
|
|
145
154
|
};
|
|
155
|
+
const idCardData = useMemo(() => {
|
|
156
|
+
const idCardID = Object.keys(state.componentData).find((c) => c === "1");
|
|
157
|
+
if (idCardID) {
|
|
158
|
+
const _idCardData = state.componentData[idCardID];
|
|
159
|
+
return _idCardData;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}, [state.componentData]);
|
|
163
|
+
console.log("idCardData", truncateFields(idCardData), JSON.stringify(truncateFields(state.componentData), null, 2));
|
|
146
164
|
const handleError = (event) => {
|
|
147
165
|
Alert.alert('Erreur', event.message);
|
|
148
166
|
setShowCamera(false);
|
|
@@ -225,12 +243,23 @@ export const SelfieCaptureTemplate = ({ component, value, onValueChange, error,
|
|
|
225
243
|
<View style={{ height: 10 }}/>
|
|
226
244
|
{isAllOrientationsCompleted() ? <>
|
|
227
245
|
<Button title={t('common.continue')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={async () => {
|
|
228
|
-
|
|
246
|
+
if (idCardData?.country && idCardData?.documentType) {
|
|
247
|
+
const value = {
|
|
248
|
+
...capturedImages,
|
|
249
|
+
country: idCardData?.country || '',
|
|
250
|
+
documentType: idCardData?.documentType,
|
|
251
|
+
};
|
|
252
|
+
console.log("value", JSON.stringify(truncateFields(value), null, 2));
|
|
253
|
+
onValueChange(value);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
Alert.alert('Erreur', 'Veuillez sélectionner un pays et un type de document');
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
229
259
|
actions.nextComponent();
|
|
230
260
|
}}/>
|
|
231
261
|
</> : (<Button title={t('kyc.selfieCapture.captureButton')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {
|
|
232
262
|
if (isAllOrientationsCompleted()) {
|
|
233
|
-
onValueChange(capturedImages);
|
|
234
263
|
actions.nextComponent();
|
|
235
264
|
}
|
|
236
265
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelfieCaptureTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/SelfieCaptureTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AACtE,OAAO,YAAY,MAAM,0BAA0B,CAAC;AAcpD,MAAM,CAAC,MAAM,qBAAqB,GAAyC,CAAC,EAC1E,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EACL,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,MAAM,MAAM,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,EAAE,CAAC;KAChB;IACD,mBAAmB,EAAE;QACnB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,OAAO;KACf;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { View, Text, StyleSheet, Alert, ScrollView } from 'react-native';\nimport { TemplateComponent, SelfieConfig, LocalizedText, ISilentCaptureResult, OrientationType } from '../../types/KYC.types';\nimport { EnhancedCameraView } from '../EnhancedCameraView';\nimport { Button } from '../ui/Button';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport SelfieOverlay from '../OverLay/SelfieOverlay';\nimport selfieVerification from '../../modules/api/SelfieVerification';\nimport pathToBase64 from '../../utils/pathToBase64';\n\ninterface IImagePayload {\n dir: string;\n file: string;\n}\ninterface SelfieCaptureTemplateProps {\n component: TemplateComponent;\n value: Record<string, IImagePayload> | undefined;\n onValueChange: (value: Record<string, IImagePayload>) => void;\n error?: string;\n language: string;\n}\n\nexport const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n language,\n}) => {\n const { t } = useI18n();\n const config = component.config as SelfieConfig;\n const orientations: OrientationType[] = (config.orientations || ['center']) as OrientationType[];\n const { actions, state, } = useTemplateKYCFlowContext();\n\n const [silentCaptureResult, setSilentCaptureResult] = useState<ISilentCaptureResult>({ success: false, isAnalyzing: false });\n\n\n const [showCamera, setShowCamera] = useState(false);\n const [currentOrientation, setCurrentOrientation] = useState<OrientationType>(orientations[0]);\n const [capturedImages, setCapturedImages] = useState<Record<string, IImagePayload>>(value || {});\n\n const getLocalizedText = (text: LocalizedText | Record<string, LocalizedText>): string => {\n if (!text) return '';\n // If text is a nested record (e.g., per theme/device), try to pick a default then localize\n const maybeNested = text as Record<string, LocalizedText>;\n if (maybeNested && typeof maybeNested === 'object' && 'en' in maybeNested === false && 'fr' in maybeNested === false) {\n const firstKey = Object.keys(maybeNested)[0];\n const nested = maybeNested[firstKey] as LocalizedText;\n return nested?.[language] || nested?.en || '';\n }\n const loc = text as LocalizedText;\n return loc[language] || loc.en || '';\n };\n\n const getOrientationInstructions = (orientation: OrientationType): string => {\n switch (orientation) {\n case 'center':\n return state.currentLanguage === \"en\" ? \"Take a selfie of face, look straight ahead you\" : \"Prenez un selfie de face, regardez droit devant vous\";\n case 'left':\n return state.currentLanguage === \"en\" ? \"Turn your head to the left, keep your shoulders straight\" : \"Tournez votre tête vers la gauche, gardez les épaules droites\";\n case 'right':\n return state.currentLanguage === \"en\" ? \"Turn your head to the right, keep your shoulders straight\" : \"Tournez votre tête vers la droite, gardez les épaules droites\";\n default:\n return getLocalizedText(component.instructions as LocalizedText);\n }\n };\n\n useEffect(() => {\n actions.showCustomStepper(!showCamera);\n }, [showCamera]);\n\n const getOrientationLabel = (orientation: OrientationType): string => {\n switch (orientation) {\n case 'center':\n return state.currentLanguage === \"en\" ? \"Selfie de face\" : \"Selfie de face\";\n case 'left':\n return state.currentLanguage === \"en\" ? \"Selfie profil gauche\" : \"Selfie profil gauche\";\n case 'right':\n return state.currentLanguage === \"en\" ? \"Selfie profil droit\" : \"Selfie profil droit\";\n default:\n return getLocalizedText(component.labels as LocalizedText);\n }\n };\n const getOrientationOpposite = (orientation: OrientationType): OrientationType => {\n switch (orientation) {\n case 'center':\n\n return 'center';\n case 'left':\n return 'left';\n case 'right':\n return 'right';\n default:\n return orientation;\n }\n }\n\n const getInstructions = (orientation: OrientationType): { title: string, subtitle: string } => {\n const lang = state.currentLanguage;\n switch (orientation) {\n case 'center':\n return {\n title:\n\n lang === \"en\" ? 'Center your face' : 'Mettez votre face au centre',\n subtitle: lang === \"en\"\n ? 'Align your face to the center of the selfie area and then take a photo'\n : 'Alignez votre visage au centre de la zone selfie puis prenez une photo'\n };\n case 'left':\n return {\n title:\n lang === 'en'\n ? 'Turn your head left'\n : 'Tournez la tête vers la gauche',\n subtitle:\n lang === 'en'\n ? 'Slowly turn your head to the left while keeping your face in the selfie area'\n : 'Tournez lentement la tête vers la gauche en gardant votre visage dans la zone selfie'\n };\n case 'right':\n return {\n title:\n lang === 'en'\n ? 'Turn your head right'\n : 'Tournez la tête vers la droite',\n subtitle:\n lang === 'en'\n ? 'Slowly turn your head to the right while keeping your face in the selfie area'\n : 'Tournez lentement la tête vers la droite en gardant votre visage dans la zone selfie'\n };\n default:\n return { title: getLocalizedText(component.labels as LocalizedText), subtitle: getLocalizedText(component.instructions as LocalizedText) };\n }\n };\n\n const handleSilentCapture = (result: { success: boolean; path?: string; error?: string }) => {\n if (silentCaptureResult.isAnalyzing) {\n return;\n }\n if (result.success && result.path) {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));\n selfieVerification(result.path).then((response) => {\n if (response.length > 0) {\n const res = response[0];\n if (res?.orientation_direction === getOrientationOpposite(currentOrientation) && res?.capture) {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: true, error: '', path: result.path }));\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\\'est pas correct' }));\n }\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\\'est pas correct' }));\n }\n }).catch((e: any) => {\n\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: e?.message || 'Erreur de vérification du selfie' }));\n });\n }\n }\n\n const handleCapture = async (result: { success: boolean; path?: string; error?: string }) => {\n console.log(\"handleCapturessss\", silentCaptureResult);\n\n if (silentCaptureResult.success && silentCaptureResult.path) {\n const base64 = await pathToBase64(silentCaptureResult.path);\n // Keep backward-compatible structure for UI validation and add *_base64 fields for backend payload\n const newImages: Record<string, any> = {\n ...capturedImages,\n [currentOrientation]: { dir: silentCaptureResult.path, file: base64 } as IImagePayload,\n };\n setCapturedImages(newImages);\n onValueChange(newImages);\n setShowCamera(false);\n\n\n // Passer à l'orientation suivante si disponible\n const currentIndex = orientations.indexOf(currentOrientation as OrientationType);\n if (currentIndex < orientations.length - 1) {\n setCurrentOrientation(orientations[currentIndex + 1]);\n }\n }\n };\n\n const handleError = (event: { message: string }) => {\n Alert.alert('Erreur', event.message);\n setShowCamera(false);\n };\n\n\n const isOrientationCompleted = (orientation: OrientationType): boolean => {\n return !!capturedImages[orientation];\n };\n\n const isAllOrientationsCompleted = (): boolean => {\n return orientations.every(orientation => isOrientationCompleted(orientation));\n };\n console.log(\"Current Orientation\", currentOrientation);\n\n\n if (showCamera) {\n return (\n <View style={styles.containerCamera}>\n <EnhancedCameraView\n instructions={getOrientationInstructions(currentOrientation)}\n showCamera={true}\n cameraType=\"front\"\n style={styles.camera}\n onCapture={handleCapture}\n onError={handleError}\n onClose={() => setShowCamera(false)}\n quality=\"high\"\n showCaptureButton={true}\n showSwitchCamera={false}\n enableFlash={false}\n silentCaptureResult={silentCaptureResult}\n onSilentCapture={handleSilentCapture}\n overlayComponent={<SelfieOverlay\n xMin={20}\n yMin={140}\n xMax={370}\n yMax={340}\n cornerOpacity={1}\n instructions={\"\"}\n language={state.currentLanguage}\n orientation={currentOrientation as 'center' | 'left' | 'right'}\n instructionsTile={getInstructions(currentOrientation).title}\n instructionsSubtitle={getInstructions(currentOrientation).subtitle}\n stepperProps={{\n back: () => {\n setShowCamera(false);\n },\n selectedDocumentType: \"Selfie\",\n step: state.currentComponentIndex + 1,\n totalSteps: state.template.components.length,\n }} />}\n />\n </View>\n );\n }\n\n\n return (\n <View style={[{\n maxWidth: 760,\n width: '100%',\n height: '100%',\n }]}>\n <View style={styles.container}>\n <Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>\n <Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>\n\n <ScrollView style={styles.orientationsContainer} showsVerticalScrollIndicator={false}>\n <View style={{ flexDirection: 'column', alignItems: 'center', gap: 10 }}>\n\n {orientations.map((orientation, key) => (\n <View key={orientation} style={{\n backgroundColor: '#F3F4F6',\n borderRadius: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n width: '100%',\n paddingVertical: 10,\n paddingHorizontal: 10,\n }}>\n <View style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: isOrientationCompleted(orientation) ? '#2DBE60' : '#D1D5DB',\n borderRadius: 100,\n width: 30,\n height: 30,\n }}>\n <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{key + 1}</Text>\n </View>\n\n\n <Text style={styles.orientationTitle}>\n {getOrientationLabel(orientation)}\n </Text>\n\n\n\n </View>\n ))}\n <View style={{ backgroundColor: \"#F6CB0D1A\", width: \"100%\", padding: 10, borderRadius: 10 }} >\n <Text style={{ color: '#997E06', fontSize: 16, fontWeight: 'bold' }}>\n {state.currentLanguage === \"en\"\n ? \"Tips for a good selfie:\" \n : \"Conseils pour une bonne photo selfie :\"}\n </Text>\n <View style={{ paddingLeft: 10, paddingTop: 4 }}>\n <Text style={{ color: '#997E06', fontSize: 14, fontWeight: 'bold' }}>\n {state.currentLanguage === \"en\"\n ? `• Remove glasses and hat \\n• Look directly at the camera \\n• Ensure good lighting \\n`\n : `• Retirez vos lunettes et votre chapeau \\n• Regardez directement la caméra \\n• Assurez-vous d'une bonne luminosité \\n`\n }\n </Text>\n </View>\n </View>\n <View style={{ height: 10 }} />\n {isAllOrientationsCompleted() ? <>\n <Button title={t('common.continue')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={async () => {\n onValueChange(capturedImages);\n actions.nextComponent();\n }} />\n </> : (\n <Button title={t('kyc.selfieCapture.captureButton')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {\n if (isAllOrientationsCompleted()) {\n onValueChange(capturedImages);\n actions.nextComponent();\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: '' }));\n setShowCamera(true);\n }\n }} />\n )}\n\n </View>\n </ScrollView>\n\n {error && (\n <Text style={styles.errorText}>{error}</Text>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n paddingVertical: 10,\n },\n container: {\n backgroundColor: 'white',\n margin: 15,\n borderRadius: 20,\n paddingVertical: 20,\n paddingHorizontal: 16,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.35,\n shadowRadius: 4.84,\n elevation: 10,\n\n\n // padding: 16,\n },\n containerCamera: {\n flex: 1,\n // maxWidth: 760,\n width: '100%',\n height: '100%',\n // borderRadius: 12,\n backgroundColor: '#f5f5f5',\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n description: {\n fontSize: 16,\n color: '#666',\n marginBottom: 20,\n lineHeight: 22,\n textAlign: 'center',\n },\n camera: {\n flex: 1,\n // borderRadius: 12,\n overflow: 'hidden',\n },\n attemptsText: {\n fontSize: 14,\n color: '#666',\n textAlign: 'center',\n marginBottom: 10,\n },\n orientationsContainer: {\n // flex: 1,\n },\n orientationContainer: {\n backgroundColor: 'white',\n borderRadius: 12,\n padding: 16,\n marginBottom: 16,\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 2,\n },\n shadowOpacity: 0.1,\n shadowRadius: 3.84,\n elevation: 5,\n },\n orientationTitle: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n // marginBottom: 12,\n },\n capturedImageContainer: {\n alignItems: 'center',\n },\n capturedImage: {\n width: 200,\n height: 200,\n borderRadius: 12,\n marginBottom: 12,\n },\n captureButton: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#2DBD60',\n paddingVertical: 16,\n paddingHorizontal: 24,\n borderRadius: 12,\n marginTop: 8,\n },\n captureIcon: {\n fontSize: 24,\n marginRight: 8,\n },\n captureText: {\n fontSize: 16,\n fontWeight: '600',\n color: 'white',\n },\n retakeButton: {\n backgroundColor: '#FF6B6B',\n paddingVertical: 12,\n paddingHorizontal: 20,\n borderRadius: 8,\n },\n retakeButtonText: {\n fontSize: 14,\n fontWeight: '600',\n color: 'white',\n },\n completionContainer: {\n alignItems: 'center',\n padding: 20,\n },\n completionText: {\n fontSize: 18,\n fontWeight: '600',\n color: '#2DBD60',\n marginBottom: 16,\n },\n retakeAllButton: {\n backgroundColor: '#FF6B6B',\n paddingVertical: 12,\n paddingHorizontal: 20,\n borderRadius: 8,\n },\n retakeAllButtonText: {\n fontSize: 14,\n fontWeight: '600',\n color: 'white',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 14,\n textAlign: 'center',\n marginTop: 10,\n },\n}); "]}
|
|
1
|
+
{"version":3,"file":"SelfieCaptureTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/SelfieCaptureTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,aAAa,MAAM,0BAA0B,CAAC;AACrD,OAAO,kBAAkB,MAAM,sCAAsC,CAAC;AACtE,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAc9D,MAAM,CAAC,MAAM,qBAAqB,GAAyC,C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EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,CAAC;KAChB;IACD,mBAAmB,EAAE;QACnB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,OAAO;KACf;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,EAAE;KACd;CACF,CAAC,CAAC","sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { View, Text, StyleSheet, Alert, ScrollView } from 'react-native';\nimport { TemplateComponent, SelfieConfig, LocalizedText, ISilentCaptureResult, OrientationType, GovernmentDocumentType } from '../../types/KYC.types';\nimport { EnhancedCameraView } from '../EnhancedCameraView';\nimport { Button } from '../ui/Button';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport SelfieOverlay from '../OverLay/SelfieOverlay';\nimport selfieVerification from '../../modules/api/SelfieVerification';\nimport pathToBase64 from '../../utils/pathToBase64';\nimport { truncateFields } from '../../modules/api/KYCService';\n\ninterface IImagePayload {\n dir: string;\n file: string;\n}\ninterface SelfieCaptureTemplateProps {\n component: TemplateComponent;\n value: Record<string, IImagePayload> | undefined;\n onValueChange: (value: Record<string, IImagePayload | string>) => void;\n error?: string;\n language: string;\n}\n\nexport const SelfieCaptureTemplate: React.FC<SelfieCaptureTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n language,\n}) => {\n const { t } = useI18n();\n const config = component.config as SelfieConfig;\n const orientations: OrientationType[] = (config.orientations || ['center']) as OrientationType[];\n const { actions, state, } = useTemplateKYCFlowContext();\n\n const [silentCaptureResult, setSilentCaptureResult] = useState<ISilentCaptureResult>({ success: false, isAnalyzing: false });\n\n\n const [showCamera, setShowCamera] = useState(false);\n const [currentOrientation, setCurrentOrientation] = useState<OrientationType>(orientations[0]);\n const [capturedImages, setCapturedImages] = useState<Record<string, IImagePayload>>(value || {});\n\n const getLocalizedText = (text: LocalizedText | Record<string, LocalizedText>): string => {\n if (!text) return '';\n // If text is a nested record (e.g., per theme/device), try to pick a default then localize\n const maybeNested = text as Record<string, LocalizedText>;\n if (maybeNested && typeof maybeNested === 'object' && 'en' in maybeNested === false && 'fr' in maybeNested === false) {\n const firstKey = Object.keys(maybeNested)[0];\n const nested = maybeNested[firstKey] as LocalizedText;\n return nested?.[language] || nested?.en || '';\n }\n const loc = text as LocalizedText;\n return loc[language] || loc.en || '';\n };\n\n const getOrientationInstructions = (orientation: OrientationType): string => {\n switch (orientation) {\n case 'center':\n return state.currentLanguage === \"en\" ? \"Take a selfie of face, look straight ahead you\" : \"Prenez un selfie de face, regardez droit devant vous\";\n case 'left':\n return state.currentLanguage === \"en\" ? \"Turn your head to the left, keep your shoulders straight\" : \"Tournez votre tête vers la gauche, gardez les épaules droites\";\n case 'right':\n return state.currentLanguage === \"en\" ? \"Turn your head to the right, keep your shoulders straight\" : \"Tournez votre tête vers la droite, gardez les épaules droites\";\n default:\n return getLocalizedText(component.instructions as LocalizedText);\n }\n };\n\n useEffect(() => {\n actions.showCustomStepper(!showCamera);\n }, [showCamera]);\n\n const getOrientationLabel = (orientation: OrientationType): string => {\n switch (orientation) {\n case 'center':\n return state.currentLanguage === \"en\" ? \"Selfie de face\" : \"Selfie de face\";\n case 'left':\n return state.currentLanguage === \"en\" ? \"Selfie profil gauche\" : \"Selfie profil gauche\";\n case 'right':\n return state.currentLanguage === \"en\" ? \"Selfie profil droit\" : \"Selfie profil droit\";\n default:\n return getLocalizedText(component.labels as LocalizedText);\n }\n };\n const getOrientationOpposite = (orientation: OrientationType): OrientationType => {\n switch (orientation) {\n case 'center':\n\n return 'center';\n case 'left':\n return 'left';\n case 'right':\n return 'right';\n default:\n return orientation;\n }\n }\n // const countryData = useMemo(() => {\n // const geCountryID = Object.keys(state.componentData).find((c: string) => c === \"6\");\n\n // if (geCountryID) {\n // const countryMapping = state.componentData[geCountryID];\n // return countryMapping?.code;\n // }\n // return null;\n // }, [state.componentData]);\n\n const getInstructions = (orientation: OrientationType): { title: string, subtitle: string } => {\n const lang = state.currentLanguage;\n switch (orientation) {\n case 'center':\n return {\n title:\n\n lang === \"en\" ? 'Center your face' : 'Mettez votre face au centre',\n subtitle: lang === \"en\"\n ? 'Align your face to the center of the selfie area and then take a photo'\n : 'Alignez votre visage au centre de la zone selfie puis prenez une photo'\n };\n case 'left':\n return {\n title:\n lang === 'en'\n ? 'Turn your head left'\n : 'Tournez la tête vers la gauche',\n subtitle:\n lang === 'en'\n ? 'Slowly turn your head to the left while keeping your face in the selfie area'\n : 'Tournez lentement la tête vers la gauche en gardant votre visage dans la zone selfie'\n };\n case 'right':\n return {\n title:\n lang === 'en'\n ? 'Turn your head right'\n : 'Tournez la tête vers la droite',\n subtitle:\n lang === 'en'\n ? 'Slowly turn your head to the right while keeping your face in the selfie area'\n : 'Tournez lentement la tête vers la droite en gardant votre visage dans la zone selfie'\n };\n default:\n return { title: getLocalizedText(component.labels as LocalizedText), subtitle: getLocalizedText(component.instructions as LocalizedText) };\n }\n };\n\n const handleSilentCapture = (result: { success: boolean; path?: string; error?: string }) => {\n if (silentCaptureResult.isAnalyzing) {\n return;\n }\n if (result.success && result.path) {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: true, success: false, error: '' }));\n selfieVerification(result.path).then((response) => {\n if (response.length > 0) {\n const res = response[0];\n if (res?.orientation_direction === getOrientationOpposite(currentOrientation) && res?.capture) {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: true, error: '', path: result.path }));\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\\'est pas correct' }));\n }\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: 'Le selfie n\\'est pas correct' }));\n }\n }).catch((e: any) => {\n\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: e?.message || 'Erreur de vérification du selfie' }));\n });\n }\n }\n\n const handleCapture = async (result: { success: boolean; path?: string; error?: string }) => {\n console.log(\"handleCapturessss\", silentCaptureResult);\n\n if (silentCaptureResult.success && silentCaptureResult.path) {\n const base64 = await pathToBase64(silentCaptureResult.path);\n // Keep backward-compatible structure for UI validation and add *_base64 fields for backend payload\n const newImages: Record<string, any> = {\n ...capturedImages,\n [currentOrientation]: { dir: silentCaptureResult.path, file: base64 } as IImagePayload,\n };\n setCapturedImages(newImages);\n onValueChange(newImages);\n setShowCamera(false);\n\n\n // Passer à l'orientation suivante si disponible\n const currentIndex = orientations.indexOf(currentOrientation as OrientationType);\n if (currentIndex < orientations.length - 1) {\n setCurrentOrientation(orientations[currentIndex + 1]);\n }\n }\n };\n const idCardData = useMemo(() => {\n const idCardID = Object.keys(state.componentData).find((c: string) => c === \"1\");\n if (idCardID) {\n const _idCardData = state.componentData[idCardID];\n return _idCardData as unknown as { country: string; documentType: GovernmentDocumentType };\n }\n return null;\n }, [state.componentData]);\n console.log(\"idCardData\", truncateFields(idCardData), JSON.stringify(truncateFields(state.componentData), null, 2));\n\n\n const handleError = (event: { message: string }) => {\n Alert.alert('Erreur', event.message);\n setShowCamera(false);\n };\n\n\n const isOrientationCompleted = (orientation: OrientationType): boolean => {\n return !!capturedImages[orientation];\n };\n\n const isAllOrientationsCompleted = (): boolean => {\n return orientations.every(orientation => isOrientationCompleted(orientation));\n };\n console.log(\"Current Orientation\", currentOrientation);\n\n\n if (showCamera) {\n return (\n <View style={styles.containerCamera}>\n <EnhancedCameraView\n instructions={getOrientationInstructions(currentOrientation)}\n showCamera={true}\n cameraType=\"front\"\n style={styles.camera}\n onCapture={handleCapture}\n onError={handleError}\n onClose={() => setShowCamera(false)}\n quality=\"high\"\n showCaptureButton={true}\n showSwitchCamera={false}\n enableFlash={false}\n silentCaptureResult={silentCaptureResult}\n onSilentCapture={handleSilentCapture}\n overlayComponent={<SelfieOverlay\n xMin={20}\n yMin={140}\n xMax={370}\n yMax={340}\n cornerOpacity={1}\n instructions={\"\"}\n language={state.currentLanguage}\n orientation={currentOrientation as 'center' | 'left' | 'right'}\n instructionsTile={getInstructions(currentOrientation).title}\n instructionsSubtitle={getInstructions(currentOrientation).subtitle}\n stepperProps={{\n back: () => {\n setShowCamera(false);\n },\n selectedDocumentType: \"Selfie\",\n step: state.currentComponentIndex + 1,\n totalSteps: state.template.components.length,\n }} />}\n />\n </View>\n );\n }\n\n return (\n <View style={[{\n maxWidth: 760,\n width: '100%',\n height: '100%',\n }]}>\n <View style={styles.container}>\n <Text style={styles.title}>{getLocalizedText(component.labels as LocalizedText)}</Text>\n <Text style={styles.description}>{getLocalizedText(component.instructions as LocalizedText)}</Text>\n\n <ScrollView style={styles.orientationsContainer} showsVerticalScrollIndicator={false}>\n <View style={{ flexDirection: 'column', alignItems: 'center', gap: 10 }}>\n\n {orientations.map((orientation, key) => (\n <View key={orientation} style={{\n backgroundColor: '#F3F4F6',\n borderRadius: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n width: '100%',\n paddingVertical: 10,\n paddingHorizontal: 10,\n }}>\n <View style={{\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: isOrientationCompleted(orientation) ? '#2DBE60' : '#D1D5DB',\n borderRadius: 100,\n width: 30,\n height: 30,\n }}>\n <Text style={{ color: 'white', fontSize: 16, fontWeight: 'bold' }}>{key + 1}</Text>\n </View>\n\n\n <Text style={styles.orientationTitle}>\n {getOrientationLabel(orientation)}\n </Text>\n\n\n\n </View>\n ))}\n <View style={{ backgroundColor: \"#F6CB0D1A\", width: \"100%\", padding: 10, borderRadius: 10 }} >\n <Text style={{ color: '#997E06', fontSize: 16, fontWeight: 'bold' }}>\n {state.currentLanguage === \"en\"\n ? \"Tips for a good selfie:\"\n : \"Conseils pour une bonne photo selfie :\"}\n </Text>\n <View style={{ paddingLeft: 10, paddingTop: 4 }}>\n <Text style={{ color: '#997E06', fontSize: 14, fontWeight: 'bold' }}>\n {state.currentLanguage === \"en\"\n ? `• Remove glasses and hat \\n• Look directly at the camera \\n• Ensure good lighting \\n`\n : `• Retirez vos lunettes et votre chapeau \\n• Regardez directement la caméra \\n• Assurez-vous d'une bonne luminosité \\n`\n }\n </Text>\n </View>\n </View>\n <View style={{ height: 10 }} />\n {isAllOrientationsCompleted() ? <>\n <Button title={t('common.continue')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={async () => {\n if (idCardData?.country && idCardData?.documentType) {\n const value = {\n ...capturedImages,\n country: idCardData?.country || '',\n documentType: idCardData?.documentType as GovernmentDocumentType,\n }\n console.log(\"value\", JSON.stringify(truncateFields(value), null, 2));\n onValueChange(value);\n } else {\n Alert.alert('Erreur', 'Veuillez sélectionner un pays et un type de document');\n return;\n }\n actions.nextComponent();\n }} />\n </> : (\n <Button title={t('kyc.selfieCapture.captureButton')} fullWidth style={{ paddingVertical: 20, paddingTop: 12 }} onPress={() => {\n if (isAllOrientationsCompleted()) {\n\n actions.nextComponent();\n } else {\n setSilentCaptureResult((prev) => ({ ...prev, isAnalyzing: false, success: false, error: '' }));\n setShowCamera(true);\n }\n }} />\n )}\n\n </View>\n </ScrollView>\n\n {error && (\n <Text style={styles.errorText}>{error}</Text>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n paddingVertical: 10,\n },\n container: {\n backgroundColor: 'white',\n margin: 15,\n borderRadius: 20,\n paddingVertical: 20,\n paddingHorizontal: 16,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.35,\n shadowRadius: 4.84,\n elevation: 10,\n\n\n // padding: 16,\n },\n containerCamera: {\n flex: 1,\n // maxWidth: 760,\n width: '100%',\n height: '100%',\n // borderRadius: 12,\n backgroundColor: '#f5f5f5',\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n description: {\n fontSize: 16,\n color: '#666',\n marginBottom: 20,\n lineHeight: 22,\n textAlign: 'center',\n },\n camera: {\n flex: 1,\n // borderRadius: 12,\n overflow: 'hidden',\n },\n attemptsText: {\n fontSize: 14,\n color: '#666',\n textAlign: 'center',\n marginBottom: 10,\n },\n orientationsContainer: {\n // flex: 1,\n },\n orientationContainer: {\n backgroundColor: 'white',\n borderRadius: 12,\n padding: 16,\n marginBottom: 16,\n shadowColor: '#000',\n shadowOffset: {\n width: 0,\n height: 2,\n },\n shadowOpacity: 0.1,\n shadowRadius: 3.84,\n elevation: 5,\n },\n orientationTitle: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n // marginBottom: 12,\n },\n capturedImageContainer: {\n alignItems: 'center',\n },\n capturedImage: {\n width: 200,\n height: 200,\n borderRadius: 12,\n marginBottom: 12,\n },\n captureButton: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#2DBD60',\n paddingVertical: 16,\n paddingHorizontal: 24,\n borderRadius: 12,\n marginTop: 8,\n },\n captureIcon: {\n fontSize: 24,\n marginRight: 8,\n },\n captureText: {\n fontSize: 16,\n fontWeight: '600',\n color: 'white',\n },\n retakeButton: {\n backgroundColor: '#FF6B6B',\n paddingVertical: 12,\n paddingHorizontal: 20,\n borderRadius: 8,\n },\n retakeButtonText: {\n fontSize: 14,\n fontWeight: '600',\n color: 'white',\n },\n completionContainer: {\n alignItems: 'center',\n padding: 20,\n },\n completionText: {\n fontSize: 18,\n fontWeight: '600',\n color: '#2DBD60',\n marginBottom: 16,\n },\n retakeAllButton: {\n backgroundColor: '#FF6B6B',\n paddingVertical: 12,\n paddingHorizontal: 20,\n borderRadius: 8,\n },\n retakeAllButtonText: {\n fontSize: 14,\n fontWeight: '600',\n color: 'white',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 14,\n textAlign: 'center',\n marginTop: 10,\n },\n}); "]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerificationProgressTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/VerificationProgressTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"VerificationProgressTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/VerificationProgressTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK1D,UAAU,iCAAiC;IACzC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,EAAE,CAAC,iCAAiC,CAuMpF,CAAC"}
|
|
@@ -1,18 +1,111 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
|
|
4
4
|
import { useI18n } from '../../hooks/useI18n';
|
|
5
|
+
import kycService from '../../modules/api/KYCService';
|
|
5
6
|
export const VerificationProgressTemplate = () => {
|
|
6
7
|
const { t } = useI18n();
|
|
7
8
|
const { state, actions } = useTemplateKYCFlowContext();
|
|
9
|
+
const [retryCount, setRetryCount] = useState(0);
|
|
10
|
+
const [isRetrying, setIsRetrying] = useState(false);
|
|
11
|
+
const [timeoutId, setTimeoutId] = useState(null);
|
|
8
12
|
const verification = state.verification;
|
|
9
13
|
const isSuccess = verification.status === 'success';
|
|
10
14
|
const isFailed = verification.status === 'failed';
|
|
15
|
+
// Fonction pour récupérer le résultat de vérification avec retry
|
|
16
|
+
const getVerificationResult = async (currentRetryCount = 0, maxRetries = 40) => {
|
|
17
|
+
try {
|
|
18
|
+
console.log(`Starting verification check (attempt ${currentRetryCount + 1}/${maxRetries + 1})`);
|
|
19
|
+
const result = await kycService.getVerificationResult(state.session.session_id);
|
|
20
|
+
const verificationResult = result[state.session.session_id].data;
|
|
21
|
+
console.log('getVerificationResult result', JSON.stringify(result, null, 2));
|
|
22
|
+
// Vérifier le statut de vérification
|
|
23
|
+
if (verificationResult.verification_status === null || verificationResult.verification_status === "processing" || verificationResult.verification_status === "pending") {
|
|
24
|
+
if (currentRetryCount < maxRetries) {
|
|
25
|
+
const nextRetryCount = currentRetryCount + 1;
|
|
26
|
+
setRetryCount(nextRetryCount);
|
|
27
|
+
setIsRetrying(true);
|
|
28
|
+
console.log(`Verification still processing, retrying in 10s... (${nextRetryCount}/${maxRetries})`);
|
|
29
|
+
// Nettoyer le timeout précédent s'il existe
|
|
30
|
+
if (timeoutId) {
|
|
31
|
+
clearTimeout(timeoutId);
|
|
32
|
+
}
|
|
33
|
+
// Attendre 10 secondes avant de relancer
|
|
34
|
+
const newTimeoutId = setTimeout(() => {
|
|
35
|
+
getVerificationResult(nextRetryCount, maxRetries);
|
|
36
|
+
}, 10000);
|
|
37
|
+
setTimeoutId(newTimeoutId);
|
|
38
|
+
return; // Sortir de la fonction pour éviter de traiter le résultat
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
console.error('Max retries reached, verification still processing');
|
|
42
|
+
setIsRetrying(false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Traiter le résultat final (success, failed, etc.)
|
|
47
|
+
if (verificationResult.verification_status === "completed" ||
|
|
48
|
+
verificationResult.verification_status === "approved") {
|
|
49
|
+
// Mettre à jour l'état avec le succès
|
|
50
|
+
actions.setVerificationState({
|
|
51
|
+
status: 'success',
|
|
52
|
+
result: result
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else if (verificationResult.verification_status === "failed" ||
|
|
56
|
+
verificationResult.verification_status === "rejected") {
|
|
57
|
+
// Mettre à jour l'état avec l'échec
|
|
58
|
+
actions.setVerificationState({
|
|
59
|
+
status: 'failed',
|
|
60
|
+
result: {
|
|
61
|
+
referenceId: verificationResult.verification_id,
|
|
62
|
+
issues: ['Verification failed']
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
setIsRetrying(false);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error('getVerificationResult error', error);
|
|
70
|
+
// En cas d'erreur, on peut aussi retry
|
|
71
|
+
if (currentRetryCount < maxRetries) {
|
|
72
|
+
const nextRetryCount = currentRetryCount + 1;
|
|
73
|
+
setRetryCount(nextRetryCount);
|
|
74
|
+
setIsRetrying(true);
|
|
75
|
+
console.log(`Error occurred, retrying in 10s... (${nextRetryCount}/${maxRetries})`);
|
|
76
|
+
// Nettoyer le timeout précédent s'il existe
|
|
77
|
+
if (timeoutId) {
|
|
78
|
+
clearTimeout(timeoutId);
|
|
79
|
+
}
|
|
80
|
+
const newTimeoutId = setTimeout(() => {
|
|
81
|
+
getVerificationResult(nextRetryCount, maxRetries);
|
|
82
|
+
}, 10000);
|
|
83
|
+
setTimeoutId(newTimeoutId);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
setIsRetrying(false);
|
|
87
|
+
console.error('Max retries reached after errors');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (state.session.session_id) {
|
|
93
|
+
getVerificationResult();
|
|
94
|
+
}
|
|
95
|
+
}, [state.session.session_id]);
|
|
96
|
+
// Nettoyage des timeouts lors du démontage du composant
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
return () => {
|
|
99
|
+
if (timeoutId) {
|
|
100
|
+
clearTimeout(timeoutId);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}, [timeoutId]);
|
|
11
104
|
if (isSuccess) {
|
|
12
105
|
return (<View style={styles.container}>
|
|
13
106
|
<Text style={styles.title}>{t('kyc.verificationProgress.steps.complete')}</Text>
|
|
14
107
|
<Text style={styles.subtitle}>{t('kyc.verificationProgress.subtitle')}</Text>
|
|
15
|
-
<TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.
|
|
108
|
+
<TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.submitVerification()}>
|
|
16
109
|
<Text style={styles.buttonText}>{t('common.continue')}</Text>
|
|
17
110
|
</TouchableOpacity>
|
|
18
111
|
{verification.result?.referenceId ? (<Text style={styles.refText}>{`Verification ID: ${verification.result.referenceId}`}</Text>) : null}
|
|
@@ -24,7 +117,7 @@ export const VerificationProgressTemplate = () => {
|
|
|
24
117
|
<Text style={styles.subtitle}>{t('errors.validationError')}</Text>
|
|
25
118
|
<View style={styles.issuesBox}>
|
|
26
119
|
<Text style={styles.issuesTitle}>{t('common.error')}</Text>
|
|
27
|
-
{(verification.result?.issues
|
|
120
|
+
{Array.isArray(verification.result?.issues) && verification.result.issues.map((issue, idx) => (<Text key={idx} style={styles.issueItem}>• {issue}</Text>))}
|
|
28
121
|
</View>
|
|
29
122
|
<TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.goToComponent(state.template.components.find(c => c.type !== 'review_submit' && c.type !== 'verification_progress')?.id || 0)}>
|
|
30
123
|
<Text style={styles.buttonText}>{t('common.retry')}</Text>
|
|
@@ -37,7 +130,11 @@ export const VerificationProgressTemplate = () => {
|
|
|
37
130
|
}
|
|
38
131
|
return (<View style={styles.container}>
|
|
39
132
|
<Text style={styles.title}>{t('kyc.verificationProgress.title')}</Text>
|
|
40
|
-
<Text style={styles.subtitle}>
|
|
133
|
+
<Text style={styles.subtitle}>
|
|
134
|
+
{isRetrying
|
|
135
|
+
? `${t('kyc.verificationProgress.retrying')} (${retryCount}/10)`
|
|
136
|
+
: t('kyc.verificationProgress.estimatedTime')}
|
|
137
|
+
</Text>
|
|
41
138
|
|
|
42
139
|
<View style={styles.timeline}>
|
|
43
140
|
<View style={[styles.dot, styles.done]}><Text style={styles.stepCheckmark}>✓</Text></View>
|
|
@@ -59,7 +156,11 @@ export const VerificationProgressTemplate = () => {
|
|
|
59
156
|
<Text style={styles.cardTitle}>{t('kyc.selfieCapture.title')}</Text>
|
|
60
157
|
<Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.analyzing')}</Text>
|
|
61
158
|
<Text style={styles.cardTitle}>{t('kyc.verificationProgress.title')}</Text>
|
|
62
|
-
<Text style={styles.cardLine}>
|
|
159
|
+
<Text style={styles.cardLine}>
|
|
160
|
+
{isRetrying
|
|
161
|
+
? `${t('kyc.verificationProgress.status.processing')}...`
|
|
162
|
+
: t('kyc.verificationProgress.status.pending')}
|
|
163
|
+
</Text>
|
|
63
164
|
</View>
|
|
64
165
|
</View>);
|
|
65
166
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerificationProgressTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/VerificationProgressTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAU9C,MAAM,CAAC,MAAM,4BAA4B,GAAgD,GAAG,EAAE;IAC5F,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,yBAAyB,EAAE,CAAC;IAEvD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAExC,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC;IACpD,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,KAAK,QAAQ,CAAC;IAElD,IAAI,SAAS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AAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;IAC/D,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE;IACjE,SAAS,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACvF,WAAW,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE;IACrE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE;IAC7C,SAAS,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE;IACzC,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;CACrE,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet, TouchableOpacity } from 'react-native';\nimport { TemplateComponent } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\n\ninterface VerificationProgressTemplateProps {\n component: TemplateComponent;\n value: unknown;\n onValueChange: (data: unknown) => void;\n error?: string;\n language?: string;\n}\n\nexport const VerificationProgressTemplate: React.FC<VerificationProgressTemplateProps> = () => {\n const { t } = useI18n();\n const { state, actions } = useTemplateKYCFlowContext();\n\n const verification = state.verification;\n\n const isSuccess = verification.status === 'success';\n const isFailed = verification.status === 'failed';\n\n if (isSuccess) {\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.steps.complete')}</Text>\n <Text style={styles.subtitle}>{t('kyc.verificationProgress.subtitle')}</Text>\n <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.resetTemplate()}>\n <Text style={styles.buttonText}>{t('common.continue')}</Text>\n </TouchableOpacity>\n {verification.result?.referenceId ? (\n <Text style={styles.refText}>{`Verification ID: ${verification.result.referenceId}`}</Text>\n ) : null}\n </View>\n );\n }\n\n if (isFailed) {\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.status.failed')}</Text>\n <Text style={styles.subtitle}>{t('errors.validationError')}</Text>\n <View style={styles.issuesBox}>\n <Text style={styles.issuesTitle}>{t('common.error')}</Text>\n {(verification.result?.issues || []).map((issue, idx) => (\n <Text key={idx} style={styles.issueItem}>• {issue}</Text>\n ))}\n </View>\n <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.goToComponent( state.template.components.find(c=>c.type!=='review_submit' && c.type!=='verification_progress')?.id || 0)}>\n <Text style={styles.buttonText}>{t('common.retry')}</Text>\n </TouchableOpacity>\n <TouchableOpacity style={[styles.button, styles.secondary]}>\n <Text style={styles.secondaryText}>{t('common.info')}</Text>\n </TouchableOpacity>\n {verification.result?.referenceId ? (\n <Text style={styles.refText}>{`Reference ID: ${verification.result.referenceId}`}</Text>\n ) : null}\n </View>\n );\n }\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.title')}</Text>\n <Text style={styles.subtitle}>{t('kyc.verificationProgress.estimatedTime')}</Text>\n\n <View style={styles.timeline}>\n <View style={[styles.dot, styles.done]}><Text style={styles.stepCheckmark}>✓</Text></View>\n <View style={styles.line} />\n <View style={[styles.dot, styles.active]}><Text style={styles.stepCheckmark}>2</Text></View>\n <View style={styles.line} />\n <View style={[styles.dot, styles.pending]}><Text style={styles.stepCheckmark}>3</Text></View>\n </View>\n\n <View style={styles.row}>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.status.completed')}</Text>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.analyzing')}</Text>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.verifying')}</Text>\n </View>\n\n <View style={styles.card}>\n <Text style={styles.cardTitle}>{t('kyc.idCardCapture.title')}</Text>\n <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.extracting')}</Text>\n <Text style={styles.cardTitle}>{t('kyc.selfieCapture.title')}</Text>\n <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.analyzing')}</Text>\n <Text style={styles.cardTitle}>{t('kyc.verificationProgress.title')}</Text>\n <Text style={styles.cardLine}>{t('kyc.verificationProgress.status.pending')}</Text>\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, width: '100%', paddingHorizontal: 16, paddingVertical: 12 },\n title: { fontSize: 24, fontWeight: 'bold', color: '#111827', textAlign: 'center', marginTop: 12 },\n subtitle: { fontSize: 14, color: '#6B7280', textAlign: 'center', marginTop: 8 },\n timeline: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginTop: 24 },\n dot: { width: 38, height: 38, borderRadius: 34, justifyContent: 'center', alignItems: 'center' },\n stepCheckmark: { color: 'white', fontSize: 16, fontWeight: 'bold' },\n line: { flex: 1, height: 4, backgroundColor: '#E5E7EB' },\n done: { backgroundColor: '#10B981' },\n active: { backgroundColor: '#F59E0B' },\n pending: { backgroundColor: '#E5E7EB' },\n row: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 8 },\n stepLabel: { fontSize: 14, color: '#111827', fontWeight: '600' },\n card: { backgroundColor: 'white', padding: 16, borderRadius: 16, marginTop: 24 },\n cardTitle: { fontSize: 16, color: '#6B7280', marginTop: 8 },\n cardLine: { fontSize: 18, color: '#111827', fontWeight: '600', marginTop: 2 },\n // Success/Failure specific\n button: { paddingVertical: 14, borderRadius: 10, alignItems: 'center', marginTop: 20 },\n primary: { backgroundColor: '#2DBD60' },\n buttonText: { color: 'white', fontSize: 16, fontWeight: '600' },\n refText: { marginTop: 12, textAlign: 'center', color: '#6B7280' },\n issuesBox: { backgroundColor: '#FEF2F2', borderRadius: 16, padding: 16, marginTop: 20 },\n issuesTitle: { color: '#991B1B', fontWeight: '700', marginBottom: 8 },\n issueItem: { color: '#991B1B', marginTop: 4 },\n secondary: { backgroundColor: '#F3F4F6' },\n secondaryText: { color: '#111827', fontSize: 16, fontWeight: '600' },\n});\n\n\n\n"]}
|
|
1
|
+
{"version":3,"file":"VerificationProgressTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/VerificationProgressTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,UAAU,MAAM,8BAA8B,CAAC;AAUtD,MAAM,CAAC,MAAM,4BAA4B,GAAgD,GAAG,EAAE;IAC5F,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACvD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAEhE,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAExC,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC;IACpD,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,KAAK,QAAQ,CAAC;IAElD,iEAAiE;IACjE,MAAM,qBAAqB,GAAG,KAAK,EAAE,iBAAiB,GAAG,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,E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AK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE;IACrE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE;IAC7C,SAAS,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE;IACzC,aAAa,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;CACrE,CAAC,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { View, Text, StyleSheet, TouchableOpacity } from 'react-native';\nimport { TemplateComponent } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport kycService from '../../modules/api/KYCService';\n\ninterface VerificationProgressTemplateProps {\n component: TemplateComponent;\n value: unknown;\n onValueChange: (data: unknown) => void;\n error?: string;\n language?: string;\n}\n\nexport const VerificationProgressTemplate: React.FC<VerificationProgressTemplateProps> = () => {\n const { t } = useI18n();\n const { state, actions } = useTemplateKYCFlowContext();\n const [retryCount, setRetryCount] = useState(0);\n const [isRetrying, setIsRetrying] = useState(false);\n const [timeoutId, setTimeoutId] = useState<number | null>(null);\n\n const verification = state.verification;\n\n const isSuccess = verification.status === 'success';\n const isFailed = verification.status === 'failed';\n\n // Fonction pour récupérer le résultat de vérification avec retry\n const getVerificationResult = async (currentRetryCount = 0, maxRetries = 40) => {\n try {\n console.log(`Starting verification check (attempt ${currentRetryCount + 1}/${maxRetries + 1})`);\n \n const result = await kycService.getVerificationResult(state.session.session_id);\n const verificationResult = result[state.session.session_id].data;\n\n console.log('getVerificationResult result', JSON.stringify(result, null, 2));\n\n // Vérifier le statut de vérification\n if (verificationResult.verification_status === null || verificationResult.verification_status === \"processing\" || verificationResult.verification_status === \"pending\") {\n if (currentRetryCount < maxRetries) {\n const nextRetryCount = currentRetryCount + 1;\n setRetryCount(nextRetryCount);\n setIsRetrying(true);\n \n console.log(`Verification still processing, retrying in 10s... (${nextRetryCount}/${maxRetries})`);\n\n // Nettoyer le timeout précédent s'il existe\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n // Attendre 10 secondes avant de relancer\n const newTimeoutId = setTimeout(() => {\n getVerificationResult(nextRetryCount, maxRetries);\n }, 10000);\n \n setTimeoutId(newTimeoutId);\n return; // Sortir de la fonction pour éviter de traiter le résultat\n } else {\n console.error('Max retries reached, verification still processing');\n setIsRetrying(false);\n return;\n }\n }\n\n // Traiter le résultat final (success, failed, etc.)\n if (verificationResult.verification_status === \"completed\" ||\n verificationResult.verification_status === \"approved\") {\n // Mettre à jour l'état avec le succès\n actions.setVerificationState({\n status: 'success',\n result: result\n });\n } else if (verificationResult.verification_status === \"failed\" ||\n verificationResult.verification_status === \"rejected\") {\n // Mettre à jour l'état avec l'échec\n actions.setVerificationState({\n status: 'failed',\n result: {\n referenceId: verificationResult.verification_id,\n issues: ['Verification failed']\n } as any\n });\n }\n\n setIsRetrying(false);\n\n } catch (error) {\n console.error('getVerificationResult error', error);\n\n // En cas d'erreur, on peut aussi retry\n if (currentRetryCount < maxRetries) {\n const nextRetryCount = currentRetryCount + 1;\n setRetryCount(nextRetryCount);\n setIsRetrying(true);\n \n console.log(`Error occurred, retrying in 10s... (${nextRetryCount}/${maxRetries})`);\n \n // Nettoyer le timeout précédent s'il existe\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n \n const newTimeoutId = setTimeout(() => {\n getVerificationResult(nextRetryCount, maxRetries);\n }, 10000);\n \n setTimeoutId(newTimeoutId);\n } else {\n setIsRetrying(false);\n console.error('Max retries reached after errors');\n }\n }\n };\n\n useEffect(() => {\n if (state.session.session_id) {\n getVerificationResult();\n }\n }, [state.session.session_id]);\n\n // Nettoyage des timeouts lors du démontage du composant\n useEffect(() => {\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n }, [timeoutId]);\n\n if (isSuccess) {\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.steps.complete')}</Text>\n <Text style={styles.subtitle}>{t('kyc.verificationProgress.subtitle')}</Text>\n <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.submitVerification()}>\n <Text style={styles.buttonText}>{t('common.continue')}</Text>\n </TouchableOpacity>\n {verification.result?.referenceId ? (\n <Text style={styles.refText}>{`Verification ID: ${verification.result.referenceId}`}</Text>\n ) : null}\n </View>\n );\n }\n\n if (isFailed) {\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.status.failed')}</Text>\n <Text style={styles.subtitle}>{t('errors.validationError')}</Text>\n <View style={styles.issuesBox}>\n <Text style={styles.issuesTitle}>{t('common.error')}</Text>\n {Array.isArray(verification.result?.issues) && verification.result.issues.map((issue: string, idx: number) => (\n <Text key={idx} style={styles.issueItem}>• {issue}</Text>\n ))}\n </View>\n <TouchableOpacity style={[styles.button, styles.primary]} onPress={() => actions.goToComponent(state.template.components.find(c => c.type !== 'review_submit' && c.type !== 'verification_progress')?.id || 0)}>\n <Text style={styles.buttonText}>{t('common.retry')}</Text>\n </TouchableOpacity>\n <TouchableOpacity style={[styles.button, styles.secondary]}>\n <Text style={styles.secondaryText}>{t('common.info')}</Text>\n </TouchableOpacity>\n {verification.result?.referenceId ? (\n <Text style={styles.refText}>{`Reference ID: ${verification.result.referenceId}`}</Text>\n ) : null}\n </View>\n );\n }\n\n\n\n\n\n\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{t('kyc.verificationProgress.title')}</Text>\n <Text style={styles.subtitle}>\n {isRetrying\n ? `${t('kyc.verificationProgress.retrying')} (${retryCount}/10)`\n : t('kyc.verificationProgress.estimatedTime')\n }\n </Text>\n\n <View style={styles.timeline}>\n <View style={[styles.dot, styles.done]}><Text style={styles.stepCheckmark}>✓</Text></View>\n <View style={styles.line} />\n <View style={[styles.dot, styles.active]}><Text style={styles.stepCheckmark}>2</Text></View>\n <View style={styles.line} />\n <View style={[styles.dot, styles.pending]}><Text style={styles.stepCheckmark}>3</Text></View>\n </View>\n\n <View style={styles.row}>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.status.completed')}</Text>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.analyzing')}</Text>\n <Text style={styles.stepLabel}>{t('kyc.verificationProgress.steps.verifying')}</Text>\n </View>\n\n <View style={styles.card}>\n <Text style={styles.cardTitle}>{t('kyc.idCardCapture.title')}</Text>\n <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.extracting')}</Text>\n <Text style={styles.cardTitle}>{t('kyc.selfieCapture.title')}</Text>\n <Text style={styles.cardLine}>{t('kyc.verificationProgress.steps.analyzing')}</Text>\n <Text style={styles.cardTitle}>{t('kyc.verificationProgress.title')}</Text>\n <Text style={styles.cardLine}>\n {isRetrying\n ? `${t('kyc.verificationProgress.status.processing')}...`\n : t('kyc.verificationProgress.status.pending')\n }\n </Text>\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: { flex: 1, width: '100%', paddingHorizontal: 16, paddingVertical: 12 },\n title: { fontSize: 24, fontWeight: 'bold', color: '#111827', textAlign: 'center', marginTop: 12 },\n subtitle: { fontSize: 14, color: '#6B7280', textAlign: 'center', marginTop: 8 },\n timeline: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginTop: 24 },\n dot: { width: 38, height: 38, borderRadius: 34, justifyContent: 'center', alignItems: 'center' },\n stepCheckmark: { color: 'white', fontSize: 16, fontWeight: 'bold' },\n line: { flex: 1, height: 4, backgroundColor: '#E5E7EB' },\n done: { backgroundColor: '#10B981' },\n active: { backgroundColor: '#F59E0B' },\n pending: { backgroundColor: '#E5E7EB' },\n row: { flexDirection: 'row', justifyContent: 'space-between', marginTop: 8 },\n stepLabel: { fontSize: 14, color: '#111827', fontWeight: '600' },\n card: { backgroundColor: 'white', padding: 16, borderRadius: 16, marginTop: 24 },\n cardTitle: { fontSize: 16, color: '#6B7280', marginTop: 8 },\n cardLine: { fontSize: 18, color: '#111827', fontWeight: '600', marginTop: 2 },\n // Success/Failure specific\n button: { paddingVertical: 14, borderRadius: 10, alignItems: 'center', marginTop: 20 },\n primary: { backgroundColor: '#2DBD60' },\n buttonText: { color: 'white', fontSize: 16, fontWeight: '600' },\n refText: { marginTop: 12, textAlign: 'center', color: '#6B7280' },\n issuesBox: { backgroundColor: '#FEF2F2', borderRadius: 16, padding: 16, marginTop: 20 },\n issuesTitle: { color: '#991B1B', fontWeight: '700', marginBottom: 8 },\n issueItem: { color: '#991B1B', marginTop: 4 },\n secondary: { backgroundColor: '#F3F4F6' },\n secondaryText: { color: '#111827', fontSize: 16, fontWeight: '600' },\n});\n\n\n\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { VerificationState } from '../types/KYC.types';
|
|
2
3
|
export declare const TemplateKYCExample: React.FC<{
|
|
3
|
-
onComplete: (data:
|
|
4
|
+
onComplete: (data: VerificationState) => void;
|
|
4
5
|
onCancel: () => void;
|
|
5
6
|
onError: (error: string) => void;
|
|
7
|
+
language: string;
|
|
8
|
+
API_KEY: string;
|
|
6
9
|
}>;
|
|
7
10
|
//# sourceMappingURL=TemplateKYCExample.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateKYCExample.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TemplateKYCExample.d.ts","sourceRoot":"","sources":["../../src/components/TemplateKYCExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAe,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AA+NpE,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA6BrL,CAAC"}
|