@transfergratis/react-native-sdk 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
- package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
- package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
- package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
- package/android/src/main/AndroidManifest.xml +13 -5
- package/build/components/EnhancedCameraView.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.js +26 -3
- package/build/components/EnhancedCameraView.js.map +1 -1
- package/build/components/EnhancedCameraView.web.d.ts.map +1 -1
- package/build/components/EnhancedCameraView.web.js +21 -0
- package/build/components/EnhancedCameraView.web.js.map +1 -1
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
- package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
- package/build/components/KYCElements/CameraCapture.d.ts.map +1 -1
- package/build/components/KYCElements/CameraCapture.js +4 -3
- package/build/components/KYCElements/CameraCapture.js.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts +5 -2
- package/build/components/KYCElements/CountrySelectionTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/CountrySelectionTemplate.js +360 -101
- package/build/components/KYCElements/CountrySelectionTemplate.js.map +1 -1
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
- package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/FileUpload.d.ts.map +1 -1
- package/build/components/KYCElements/FileUpload.js +5 -4
- package/build/components/KYCElements/FileUpload.js.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/FileUploadTemplate.js +5 -4
- package/build/components/KYCElements/FileUploadTemplate.js.map +1 -1
- package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
- package/build/components/KYCElements/IDCardCapture.js +356 -227
- package/build/components/KYCElements/IDCardCapture.js.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/LocationCaptureTemplate.js +78 -37
- package/build/components/KYCElements/LocationCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCapture.js +5 -4
- package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
- package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js +5 -4
- package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
- package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
- package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
- package/build/components/KYCElements/SelfieCapture.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCapture.js +4 -3
- package/build/components/KYCElements/SelfieCapture.js.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
- package/build/components/KYCElements/SelfieCaptureTemplate.js +189 -42
- package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
- package/build/components/KYCElements/WelcomeTemplate.d.ts +12 -0
- package/build/components/KYCElements/WelcomeTemplate.d.ts.map +1 -0
- package/build/components/KYCElements/WelcomeTemplate.js +243 -0
- package/build/components/KYCElements/WelcomeTemplate.js.map +1 -0
- package/build/components/TemplateKYCExample.d.ts +8 -2
- package/build/components/TemplateKYCExample.d.ts.map +1 -1
- package/build/components/TemplateKYCExample.js +10 -97
- package/build/components/TemplateKYCExample.js.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts +6 -1
- package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
- package/build/components/TemplateKYCFlowRefactored.js +108 -11
- package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
- package/build/components/example/DynamicTemplateExample.d.ts +10 -0
- package/build/components/example/DynamicTemplateExample.d.ts.map +1 -0
- package/build/components/example/DynamicTemplateExample.js +241 -0
- package/build/components/example/DynamicTemplateExample.js.map +1 -0
- package/build/config/KYCConfig.d.ts +14 -0
- package/build/config/KYCConfig.d.ts.map +1 -0
- package/build/config/KYCConfig.js +26 -0
- package/build/config/KYCConfig.js.map +1 -0
- package/build/config/allowedDomains.d.ts +30 -0
- package/build/config/allowedDomains.d.ts.map +1 -0
- package/build/config/allowedDomains.js +112 -0
- package/build/config/allowedDomains.js.map +1 -0
- package/build/hooks/useOrientationVideo.d.ts +2 -1
- package/build/hooks/useOrientationVideo.d.ts.map +1 -1
- package/build/hooks/useOrientationVideo.js +3 -3
- package/build/hooks/useOrientationVideo.js.map +1 -1
- package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
- package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
- package/build/hooks/useTemplateKYCFlow.js +317 -34
- package/build/hooks/useTemplateKYCFlow.js.map +1 -1
- package/build/hooks/useTemplateLoader.d.ts +14 -0
- package/build/hooks/useTemplateLoader.d.ts.map +1 -0
- package/build/hooks/useTemplateLoader.js +85 -0
- package/build/hooks/useTemplateLoader.js.map +1 -0
- package/build/i18n/en/index.d.ts +49 -0
- package/build/i18n/en/index.d.ts.map +1 -1
- package/build/i18n/en/index.js +50 -1
- package/build/i18n/en/index.js.map +1 -1
- package/build/i18n/fr/index.d.ts +35 -0
- package/build/i18n/fr/index.d.ts.map +1 -1
- package/build/i18n/fr/index.js +36 -1
- package/build/i18n/fr/index.js.map +1 -1
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/index.js.map +1 -1
- package/build/modules/api/CardAuthentification.d.ts +24 -3
- package/build/modules/api/CardAuthentification.d.ts.map +1 -1
- package/build/modules/api/CardAuthentification.js +69 -10
- package/build/modules/api/CardAuthentification.js.map +1 -1
- package/build/modules/api/KYCService.d.ts +7 -7
- package/build/modules/api/KYCService.d.ts.map +1 -1
- package/build/modules/api/KYCService.js +108 -39
- package/build/modules/api/KYCService.js.map +1 -1
- package/build/modules/api/SelfieVerification.d.ts +3 -1
- package/build/modules/api/SelfieVerification.d.ts.map +1 -1
- package/build/modules/api/SelfieVerification.js +17 -1
- package/build/modules/api/SelfieVerification.js.map +1 -1
- package/build/modules/api/TemplateService.d.ts +44 -0
- package/build/modules/api/TemplateService.d.ts.map +1 -0
- package/build/modules/api/TemplateService.js +145 -0
- package/build/modules/api/TemplateService.js.map +1 -0
- package/build/types/KYC.types.d.ts +265 -4
- package/build/types/KYC.types.d.ts.map +1 -1
- package/build/types/KYC.types.js +15 -0
- package/build/types/KYC.types.js.map +1 -1
- package/build/types/env.types.d.ts +13 -0
- package/build/types/env.types.d.ts.map +1 -0
- package/build/types/env.types.js +2 -0
- package/build/types/env.types.js.map +1 -0
- package/build/utils/cropByObb.d.ts +1 -0
- package/build/utils/cropByObb.d.ts.map +1 -1
- package/build/utils/cropByObb.js +70 -0
- package/build/utils/cropByObb.js.map +1 -1
- package/build/utils/deviceDetection.d.ts +6 -0
- package/build/utils/deviceDetection.d.ts.map +1 -0
- package/build/utils/deviceDetection.js +12 -0
- package/build/utils/deviceDetection.js.map +1 -0
- package/build/utils/platformAlert.d.ts +20 -0
- package/build/utils/platformAlert.d.ts.map +1 -0
- package/build/utils/platformAlert.js +67 -0
- package/build/utils/platformAlert.js.map +1 -0
- package/build/utils/template-transformer.d.ts +10 -0
- package/build/utils/template-transformer.d.ts.map +1 -0
- package/build/utils/template-transformer.js +365 -0
- package/build/utils/template-transformer.js.map +1 -0
- package/build/web/WebKYCEntry.d.ts.map +1 -1
- package/build/web/WebKYCEntry.js +158 -32
- package/build/web/WebKYCEntry.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.js +3 -4
- package/plugin/src/withVisionCamera.ts +3 -4
- package/src/components/EnhancedCameraView.tsx +31 -2
- package/src/components/EnhancedCameraView.web.tsx +24 -0
- package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
- package/src/components/KYCElements/CameraCapture.tsx +4 -3
- package/src/components/KYCElements/CountrySelectionTemplate.tsx +410 -113
- package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
- package/src/components/KYCElements/FileUpload.tsx +5 -4
- package/src/components/KYCElements/FileUploadTemplate.tsx +5 -4
- package/src/components/KYCElements/IDCardCapture.tsx +397 -254
- package/src/components/KYCElements/LocationCaptureTemplate.tsx +95 -44
- package/src/components/KYCElements/OrientationVideoCapture.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +6 -3
- package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +6 -3
- package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
- package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
- package/src/components/KYCElements/SelfieCapture.tsx +4 -3
- package/src/components/KYCElements/SelfieCaptureTemplate.tsx +201 -44
- package/src/components/KYCElements/WelcomeTemplate.tsx +289 -0
- package/src/components/TemplateKYCExample.tsx +37 -108
- package/src/components/TemplateKYCFlowRefactored.tsx +148 -12
- package/src/components/example/DynamicTemplateExample.tsx +289 -0
- package/src/config/KYCConfig.ts +34 -0
- package/src/config/allowedDomains.ts +133 -0
- package/src/hooks/useOrientationVideo.ts +5 -4
- package/src/hooks/useTemplateKYCFlow.tsx +347 -32
- package/src/hooks/useTemplateLoader.ts +102 -0
- package/src/i18n/en/index.ts +53 -2
- package/src/i18n/fr/index.ts +37 -1
- package/src/index.ts +14 -0
- package/src/modules/api/CardAuthentification.ts +76 -11
- package/src/modules/api/KYCService.ts +129 -45
- package/src/modules/api/SelfieVerification.ts +25 -3
- package/src/modules/api/TemplateService.ts +167 -0
- package/src/types/KYC.types.ts +331 -3
- package/src/types/env.types.ts +13 -0
- package/src/utils/cropByObb.ts +83 -3
- package/src/utils/deviceDetection.ts +11 -0
- package/src/utils/platformAlert.ts +86 -0
- package/src/utils/template-transformer.ts +445 -0
- package/src/web/WebKYCEntry.tsx +199 -50
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions,
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';
|
|
3
3
|
import { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';
|
|
4
4
|
import { useI18n } from '../hooks/useI18n';
|
|
5
|
+
import { showAlert } from '../utils/platformAlert';
|
|
5
6
|
import { IDCardCapture } from './KYCElements/IDCardCapture';
|
|
6
7
|
import { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';
|
|
7
8
|
import { FileUploadTemplate } from './KYCElements/FileUploadTemplate';
|
|
@@ -10,11 +11,38 @@ import { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate
|
|
|
10
11
|
import { InitializationStep } from './KYCElements/InitializationStep';
|
|
11
12
|
import { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';
|
|
12
13
|
import { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';
|
|
13
|
-
|
|
14
|
+
import { useTemplateLoader } from '../hooks/useTemplateLoader';
|
|
15
|
+
import { WelcomeTemplate } from './KYCElements/WelcomeTemplate';
|
|
16
|
+
import { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';
|
|
17
|
+
import { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';
|
|
18
|
+
import { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';
|
|
19
|
+
import { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';
|
|
20
|
+
export const TemplateKYCFlow = ({ template: providedTemplate, templateId, onComplete, onError, language = 'fr', onCancel, API_KEY, env = 'PRODUCTION', existingSessionId, initialStep, }) => {
|
|
14
21
|
const { t } = useI18n();
|
|
15
|
-
|
|
22
|
+
const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();
|
|
23
|
+
// Validate props
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!providedTemplate && !templateId) {
|
|
26
|
+
const errorMsg = 'Either template or templateId must be provided';
|
|
27
|
+
onError?.(errorMsg);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (templateId && !API_KEY) {
|
|
31
|
+
// Try to load without API key (will use token authentication)
|
|
32
|
+
loadTemplate(templateId);
|
|
33
|
+
}
|
|
34
|
+
else if (templateId && API_KEY) {
|
|
35
|
+
loadTemplate(templateId, API_KEY);
|
|
36
|
+
}
|
|
37
|
+
}, [templateId, API_KEY, providedTemplate, loadTemplate, onError]);
|
|
38
|
+
// Handle loading errors
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (error) {
|
|
41
|
+
onError?.(error);
|
|
42
|
+
}
|
|
43
|
+
}, [error, onError]);
|
|
16
44
|
const OnCancel = () => {
|
|
17
|
-
|
|
45
|
+
showAlert(t('kyc.cancelConfirmation.title'), t('kyc.cancelConfirmation.message'), [
|
|
18
46
|
{ text: t('kyc.cancelConfirmation.cancelButton'), style: 'cancel' },
|
|
19
47
|
{
|
|
20
48
|
text: t('kyc.cancelConfirmation.confirmButton'),
|
|
@@ -24,7 +52,33 @@ export const TemplateKYCFlow = ({ template, onComplete, onError, language = 'fr'
|
|
|
24
52
|
},
|
|
25
53
|
]);
|
|
26
54
|
};
|
|
27
|
-
|
|
55
|
+
// Determine which template to use
|
|
56
|
+
const template = providedTemplate || loadedTemplate;
|
|
57
|
+
// Show loading state while fetching template
|
|
58
|
+
if (templateId && isLoading && !template) {
|
|
59
|
+
return (<View style={styles.loadingContainer}>
|
|
60
|
+
<ActivityIndicator size="large" color="#2DBD60"/>
|
|
61
|
+
<Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>
|
|
62
|
+
</View>);
|
|
63
|
+
}
|
|
64
|
+
// Show error state if template failed to load
|
|
65
|
+
if (templateId && error && !template) {
|
|
66
|
+
return (<View style={styles.errorContainer}>
|
|
67
|
+
<Text style={styles.errorText}>{error}</Text>
|
|
68
|
+
<TouchableOpacity style={styles.retryButton} onPress={() => loadTemplate(templateId, API_KEY)}>
|
|
69
|
+
<Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
</View>);
|
|
72
|
+
}
|
|
73
|
+
// Show error if no template available
|
|
74
|
+
if (!template) {
|
|
75
|
+
return (<View style={styles.errorContainer}>
|
|
76
|
+
<Text style={styles.errorText}>
|
|
77
|
+
{t('errors.unknownError') || 'Template not available'}
|
|
78
|
+
</Text>
|
|
79
|
+
</View>);
|
|
80
|
+
}
|
|
81
|
+
return (<TemplateKYCFlowProvider template={template} onComplete={onComplete} onError={onError} onCancel={OnCancel} initialLanguage={language} apiKey={API_KEY} env={env} existingSessionId={existingSessionId} initialStep={initialStep}>
|
|
28
82
|
<TemplateKYCFlowContent onCancel={OnCancel}/>
|
|
29
83
|
</TemplateKYCFlowProvider>);
|
|
30
84
|
};
|
|
@@ -52,6 +106,8 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
52
106
|
return <InitializationStep session={state.session}/>;
|
|
53
107
|
}
|
|
54
108
|
switch (currentComponent.type) {
|
|
109
|
+
case 'welcome':
|
|
110
|
+
return <WelcomeTemplate {...commonProps}/>;
|
|
55
111
|
case 'id_card':
|
|
56
112
|
return <IDCardCapture {...commonProps}/>;
|
|
57
113
|
case 'selfie':
|
|
@@ -64,6 +120,14 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
64
120
|
return <CountrySelectionTemplate {...commonProps}/>;
|
|
65
121
|
case 'review_submit':
|
|
66
122
|
return <ReviewSubmitTemplate {...commonProps}/>;
|
|
123
|
+
case 'email_verification':
|
|
124
|
+
return <EmailVerificationTemplate {...commonProps}/>;
|
|
125
|
+
case 'phone_verification':
|
|
126
|
+
return <PhoneVerificationTemplate {...commonProps}/>;
|
|
127
|
+
case 'personal_information':
|
|
128
|
+
return <PersonalInformationTemplate {...commonProps}/>;
|
|
129
|
+
case 'additional_documents':
|
|
130
|
+
return <AdditionalDocumentsTemplate {...commonProps}/>;
|
|
67
131
|
case 'verification_progress':
|
|
68
132
|
return <VerificationProgressTemplate {...commonProps}/>;
|
|
69
133
|
default:
|
|
@@ -104,9 +168,9 @@ const TemplateKYCFlowContent = ({ onCancel }) => {
|
|
|
104
168
|
</View>) : null}
|
|
105
169
|
|
|
106
170
|
{/* Contenu principal */}
|
|
107
|
-
<
|
|
171
|
+
<ScrollView style={styles.scrollView} contentContainerStyle={styles.content} showsVerticalScrollIndicator={Platform.OS === 'web'} bounces={false}>
|
|
108
172
|
{renderCurrentComponent()}
|
|
109
|
-
</
|
|
173
|
+
</ScrollView>
|
|
110
174
|
|
|
111
175
|
{state.isProcessing && (<View style={styles.processingContainer}>
|
|
112
176
|
<Text style={styles.processingText}>{t('common.loading')}</Text>
|
|
@@ -185,11 +249,13 @@ const styles = StyleSheet.create({
|
|
|
185
249
|
color: '#666',
|
|
186
250
|
lineHeight: 20,
|
|
187
251
|
},
|
|
188
|
-
|
|
252
|
+
scrollView: {
|
|
189
253
|
flex: 1,
|
|
190
|
-
|
|
254
|
+
},
|
|
255
|
+
content: {
|
|
256
|
+
flexGrow: 1,
|
|
191
257
|
alignItems: 'center',
|
|
192
|
-
|
|
258
|
+
paddingBottom: 20, // Add padding for better mobile scrolling
|
|
193
259
|
},
|
|
194
260
|
navigation: {
|
|
195
261
|
flexDirection: 'row',
|
|
@@ -248,5 +314,36 @@ const styles = StyleSheet.create({
|
|
|
248
314
|
fontWeight: 'bold',
|
|
249
315
|
marginBottom: 10,
|
|
250
316
|
},
|
|
317
|
+
loadingContainer: {
|
|
318
|
+
flex: 1,
|
|
319
|
+
justifyContent: 'center',
|
|
320
|
+
alignItems: 'center',
|
|
321
|
+
backgroundColor: '#f5f5f5',
|
|
322
|
+
},
|
|
323
|
+
loadingText: {
|
|
324
|
+
marginTop: 16,
|
|
325
|
+
fontSize: 16,
|
|
326
|
+
color: '#666',
|
|
327
|
+
textAlign: 'center',
|
|
328
|
+
},
|
|
329
|
+
errorContainer: {
|
|
330
|
+
flex: 1,
|
|
331
|
+
justifyContent: 'center',
|
|
332
|
+
alignItems: 'center',
|
|
333
|
+
backgroundColor: '#f5f5f5',
|
|
334
|
+
padding: 20,
|
|
335
|
+
},
|
|
336
|
+
retryButton: {
|
|
337
|
+
marginTop: 20,
|
|
338
|
+
paddingHorizontal: 24,
|
|
339
|
+
paddingVertical: 12,
|
|
340
|
+
backgroundColor: '#2DBD60',
|
|
341
|
+
borderRadius: 8,
|
|
342
|
+
},
|
|
343
|
+
retryButtonText: {
|
|
344
|
+
color: '#fff',
|
|
345
|
+
fontSize: 16,
|
|
346
|
+
fontWeight: '600',
|
|
347
|
+
},
|
|
251
348
|
});
|
|
252
349
|
//# sourceMappingURL=TemplateKYCFlowRefactored.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateKYCFlowRefactored.js","sourceRoot":"","sources":["../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE5H,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCA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AAE;QACZ,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,EAAE;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, Alert } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\n\ninterface TemplateKYCFlowProps {\n template: KYCTemplate;\n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string;\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n}) => {\n const { t } = useI18n();\n // console.log('API_KEY', API_KEY);\n const OnCancel = () => {\n Alert.alert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n { text: t('kyc.cancelConfirmation.cancelButton'), style: 'cancel' },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n onCancel?.();\n }\n },\n ]\n );\n };\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={onComplete}\n onError={onError}\n onCancel={OnCancel}\n initialLanguage={language}\n apiKey={API_KEY}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const {\n state,\n actions,\n currentComponent,\n progress,\n } = useTemplateKYCFlowContext();\n\n const { t } = useI18n();\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n // Rendu du composant actuel\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'id_card':\n return <IDCardCapture {...commonProps} />;\n\n case 'selfie':\n return <SelfieCaptureTemplate {...commonProps} />;\n\n case 'file_upload':\n return <FileUploadTemplate {...commonProps} />;\n\n case 'location':\n return <LocationCaptureTemplate {...commonProps} />;\n\n case 'country_selection':\n return <CountrySelectionTemplate {...commonProps} />;\n\n case 'review_submit':\n return <ReviewSubmitTemplate {...commonProps} />;\n\n case 'verification_progress':\n return <VerificationProgressTemplate {...commonProps} />;\n\n default:\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n <SafeAreaView style={styles.container}>\n {/* Header avec informations sur l'étape */}\n\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', { current: state.currentComponentIndex + 1, total: state.template.components.length })}\n </Text>\n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View\n style={[\n styles.progressFill,\n { width: `${progress}%` }\n ]}\n />\n </View>\n\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n {/* Contenu principal */}\n <View style={styles.content}>\n {renderCurrentComponent()}\n </View>\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#f5f5f5',\n\n },\n header: {\n backgroundColor: 'white',\n paddingVertical: 20,\n paddingHorizontal: 12,\n borderBottomWidth: 1,\n borderBottomColor: '#e0e0e0',\n marginHorizontal: 12,\n marginTop: 12,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.15,\n shadowRadius: 1.84,\n elevation: 5,\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n },\n description: {\n fontSize: 16,\n color: '#666',\n marginBottom: 20,\n },\n progressContainer: {\n // marginBottom: 20,\n },\n progressBar: {\n height: 8,\n backgroundColor: '#e0e0e0',\n borderRadius: 4,\n overflow: 'hidden',\n },\n progressFill: {\n height: '100%',\n backgroundColor: '#2DBD60',\n borderRadius: 4,\n },\n progressText: {\n fontSize: 14,\n color: 'black',\n fontWeight: '600',\n textAlign: 'left',\n marginBottom: 8,\n },\n stepInfo: {\n backgroundColor: '#f8f9fa',\n padding: 16,\n borderRadius: 8,\n borderLeftWidth: 4,\n borderLeftColor: '#2DBD60',\n },\n stepTitle: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n },\n stepDescription: {\n fontSize: 14,\n color: '#666',\n lineHeight: 20,\n },\n content: {\n flex: 1,\n // justifyContent: 'center',\n alignItems: 'center',\n // paddingTop: Dimensions.get('window').height > 760 ? 12 : 0,\n },\n navigation: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 20,\n backgroundColor: 'white',\n borderTopWidth: 1,\n borderTopColor: '#e0e0e0',\n },\n navButton: {\n paddingHorizontal: 24,\n paddingVertical: 12,\n borderRadius: 8,\n minWidth: 100,\n alignItems: 'center',\n },\n primaryButton: {\n backgroundColor: '#2DBD60',\n },\n navButtonText: {\n fontSize: 16,\n fontWeight: '600',\n color: 'white',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n unsupportedContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: 20,\n },\n unsupportedText: {\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n },\n processingContainer: {\n position: 'absolute',\n flex: 1,\n width: Dimensions.get('window').width,\n height: Dimensions.get('window').height,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 10000000,\n },\n processingText: {\n fontSize: 16,\n color: '#fff',\n textAlign: 'center',\n fontWeight: 'bold',\n marginBottom: 10,\n },\n}); "]}
|
|
1
|
+
{"version":3,"file":"TemplateKYCFlowRefactored.js","sourceRoot":"","sources":["../../src/components/TemplateKYCFlowRefactored.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3I,OAAO,E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,QAAQ;KACjB;IACD,cAAc,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,EAAE;KACjB;IACD,gBAAgB,EAAE;QAChB,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,SAAS;KAC3B;IACD,WAAW,EAAE;QACX,SAAS,EAAE,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;KACZ;IACD,WAAW,EAAE;QACX,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,EAAE;QACrB,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,CAAC;KAChB;IACD,eAAe,EAAE;QACf,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;CACF,CAAC,CAAC","sourcesContent":["import React, { useEffect } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TouchableOpacity, ActivityIndicator, Dimensions, ScrollView, Platform } from 'react-native';\nimport { KYCTemplate, VerificationState } from '../types/KYC.types';\nimport { TemplateKYCFlowProvider, useTemplateKYCFlowContext } from '../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../hooks/useI18n';\nimport { showAlert } from '../utils/platformAlert';\nimport { IDCardCapture } from './KYCElements/IDCardCapture';\nimport { SelfieCaptureTemplate } from './KYCElements/SelfieCaptureTemplate';\nimport { FileUploadTemplate } from './KYCElements/FileUploadTemplate';\nimport { LocationCaptureTemplate } from './KYCElements/LocationCaptureTemplate';\nimport { CountrySelectionTemplate } from './KYCElements/CountrySelectionTemplate';\nimport { InitializationStep } from './KYCElements/InitializationStep';\nimport { ReviewSubmitTemplate } from './KYCElements/ReviewSubmitTemplate';\nimport { VerificationProgressTemplate } from './KYCElements/VerificationProgressTemplate';\nimport { useTemplateLoader } from '../hooks/useTemplateLoader';\nimport { WelcomeTemplate } from './KYCElements/WelcomeTemplate';\nimport { EmailVerificationTemplate } from './KYCElements/EmailVerificationTemplate';\nimport { PhoneVerificationTemplate } from './KYCElements/PhoneVerificationTemplate';\nimport { PersonalInformationTemplate } from './KYCElements/PersonalInformationTemplate';\nimport { AdditionalDocumentsTemplate } from './KYCElements/AdditionalDocumentsTemplate';\nimport { KycEnvironment } from '../types/env.types';\n\ninterface TemplateKYCFlowProps {\n template?: KYCTemplate; // Format SDK direct (existing, now optional)\n templateId?: string; // New: ID to load from API\n onComplete?: (data: VerificationState) => void;\n onError?: (error: string) => void;\n language?: string;\n onCancel?: () => void;\n API_KEY?: string; // Required if templateId is used\n env?: KycEnvironment; // Environment mode: PRODUCTION or SANDBOX\n existingSessionId?: string;\n initialStep?: number; // Initial step index to resume verification\n}\n\nexport const TemplateKYCFlow: React.FC<TemplateKYCFlowProps> = ({\n template: providedTemplate,\n templateId,\n onComplete,\n onError,\n language = 'fr',\n onCancel,\n API_KEY,\n env = 'PRODUCTION',\n existingSessionId,\n initialStep,\n}) => {\n const { t } = useI18n();\n const { template: loadedTemplate, isLoading, error, loadTemplate } = useTemplateLoader();\n\n // Validate props\n useEffect(() => {\n if (!providedTemplate && !templateId) {\n const errorMsg = 'Either template or templateId must be provided';\n onError?.(errorMsg);\n return;\n }\n\n if (templateId && !API_KEY) {\n // Try to load without API key (will use token authentication)\n loadTemplate(templateId);\n } else if (templateId && API_KEY) {\n loadTemplate(templateId, API_KEY);\n }\n }, [templateId, API_KEY, providedTemplate, loadTemplate, onError]);\n\n // Handle loading errors\n useEffect(() => {\n if (error) {\n onError?.(error);\n }\n }, [error, onError]);\n\n const OnCancel = () => {\n showAlert(\n t('kyc.cancelConfirmation.title'),\n t('kyc.cancelConfirmation.message'),\n [\n { text: t('kyc.cancelConfirmation.cancelButton'), style: 'cancel' },\n {\n text: t('kyc.cancelConfirmation.confirmButton'),\n onPress: () => {\n onCancel?.();\n }\n },\n ]\n );\n };\n\n // Determine which template to use\n const template = providedTemplate || loadedTemplate;\n\n // Show loading state while fetching template\n if (templateId && isLoading && !template) {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator size=\"large\" color=\"#2DBD60\" />\n <Text style={styles.loadingText}>{t('common.loading') || 'Loading template...'}</Text>\n </View>\n );\n }\n\n // Show error state if template failed to load\n if (templateId && error && !template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>{error}</Text>\n <TouchableOpacity\n style={styles.retryButton}\n onPress={() => loadTemplate(templateId, API_KEY)}\n >\n <Text style={styles.retryButtonText}>{t('common.retry') || 'Retry'}</Text>\n </TouchableOpacity>\n </View>\n );\n }\n\n // Show error if no template available\n if (!template) {\n return (\n <View style={styles.errorContainer}>\n <Text style={styles.errorText}>\n {t('errors.unknownError') || 'Template not available'}\n </Text>\n </View>\n );\n }\n\n return (\n <TemplateKYCFlowProvider\n template={template}\n onComplete={onComplete}\n onError={onError}\n onCancel={OnCancel}\n initialLanguage={language}\n apiKey={API_KEY}\n env={env}\n existingSessionId={existingSessionId}\n initialStep={initialStep}\n >\n <TemplateKYCFlowContent onCancel={OnCancel} />\n </TemplateKYCFlowProvider>\n );\n};\n\nconst TemplateKYCFlowContent: React.FC<{ onCancel?: () => void }> = ({ onCancel }) => {\n const {\n state,\n actions,\n currentComponent,\n progress,\n } = useTemplateKYCFlowContext();\n\n const { t } = useI18n();\n\n const updateComponentData = (componentId: number, data: unknown) => {\n actions.updateComponentData(componentId, data);\n };\n\n if (!currentComponent) {\n return (\n <View style={styles.container}>\n <Text style={styles.errorText}>{t('errors.unknownError')}</Text>\n </View>\n );\n }\n\n // Rendu du composant actuel\n const renderCurrentComponent = () => {\n const commonProps = {\n component: currentComponent,\n value: state.componentData[currentComponent.id],\n onValueChange: (data: unknown) => updateComponentData(currentComponent.id, data),\n error: state.errors[currentComponent.id],\n language: state.currentLanguage,\n };\n\n if (!state.session.isInitialized) {\n return <InitializationStep session={state.session} />\n }\n\n switch (currentComponent.type) {\n case 'welcome':\n return <WelcomeTemplate {...commonProps} />;\n\n case 'id_card':\n return <IDCardCapture {...commonProps} />;\n\n case 'selfie':\n return <SelfieCaptureTemplate {...commonProps} />;\n\n case 'file_upload':\n return <FileUploadTemplate {...commonProps} />;\n\n case 'location':\n return <LocationCaptureTemplate {...commonProps} />;\n\n case 'country_selection':\n return <CountrySelectionTemplate {...commonProps} />;\n\n case 'review_submit':\n return <ReviewSubmitTemplate {...commonProps} />;\n\n case 'email_verification':\n return <EmailVerificationTemplate {...commonProps} />;\n\n case 'phone_verification':\n return <PhoneVerificationTemplate {...commonProps} />;\n\n case 'personal_information':\n return <PersonalInformationTemplate {...commonProps} />;\n\n case 'additional_documents':\n return <AdditionalDocumentsTemplate {...commonProps} />;\n\n case 'verification_progress':\n return <VerificationProgressTemplate {...commonProps} />;\n\n default:\n return (\n <View style={styles.unsupportedContainer}>\n <Text style={styles.unsupportedText}>\n {t('errors.unknownError')}: {currentComponent.type}\n </Text>\n </View>\n );\n }\n };\n\n return (\n <View style={{ flex: 1, position: 'relative' }}>\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n <SafeAreaView style={styles.container}>\n {/* Header avec informations sur l'étape */}\n\n {(state.showCustomStepper && state.session.isInitialized) ? (\n <View style={styles.header}>\n <Text style={styles.progressText}>\n {t('kyc.step', { current: state.currentComponentIndex + 1, total: state.template.components.length })}\n </Text>\n <View style={styles.progressContainer}>\n <View style={styles.progressBar}>\n <View\n style={[\n styles.progressFill,\n { width: `${progress}%` }\n ]}\n />\n </View>\n\n </View>\n\n <View style={{ position: 'absolute', right: 12, top: 12 }}>\n <TouchableOpacity onPress={onCancel} disabled={!onCancel} style={{ opacity: onCancel ? 1 : 0.5 }}>\n <Text style={{ fontSize: 20, fontWeight: 'bold', color: '#333' }}>{`X`}</Text>\n </TouchableOpacity>\n </View>\n </View>\n ) : null}\n\n {/* Contenu principal */}\n <ScrollView\n style={styles.scrollView}\n contentContainerStyle={styles.content}\n showsVerticalScrollIndicator={Platform.OS === 'web'}\n bounces={false}\n >\n {renderCurrentComponent()}\n </ScrollView>\n\n {state.isProcessing && (\n <View style={styles.processingContainer}>\n <Text style={styles.processingText}>{t('common.loading')}</Text>\n <ActivityIndicator size=\"large\" color=\"#fff\" />\n </View>\n )}\n </SafeAreaView>\n </View>\n\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#f5f5f5',\n\n },\n header: {\n backgroundColor: 'white',\n paddingVertical: 20,\n paddingHorizontal: 12,\n borderBottomWidth: 1,\n borderBottomColor: '#e0e0e0',\n marginHorizontal: 12,\n marginTop: 12,\n // shadow\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.15,\n shadowRadius: 1.84,\n elevation: 5,\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n },\n description: {\n fontSize: 16,\n color: '#666',\n marginBottom: 20,\n },\n progressContainer: {\n // marginBottom: 20,\n },\n progressBar: {\n height: 8,\n backgroundColor: '#e0e0e0',\n borderRadius: 4,\n overflow: 'hidden',\n },\n progressFill: {\n height: '100%',\n backgroundColor: '#2DBD60',\n borderRadius: 4,\n },\n progressText: {\n fontSize: 14,\n color: 'black',\n fontWeight: '600',\n textAlign: 'left',\n marginBottom: 8,\n },\n stepInfo: {\n backgroundColor: '#f8f9fa',\n padding: 16,\n borderRadius: 8,\n borderLeftWidth: 4,\n borderLeftColor: '#2DBD60',\n },\n stepTitle: {\n fontSize: 18,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n },\n stepDescription: {\n fontSize: 14,\n color: '#666',\n lineHeight: 20,\n },\n scrollView: {\n flex: 1,\n },\n content: {\n flexGrow: 1,\n alignItems: 'center',\n paddingBottom: 20, // Add padding for better mobile scrolling\n },\n navigation: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n padding: 20,\n backgroundColor: 'white',\n borderTopWidth: 1,\n borderTopColor: '#e0e0e0',\n },\n navButton: {\n paddingHorizontal: 24,\n paddingVertical: 12,\n borderRadius: 8,\n minWidth: 100,\n alignItems: 'center',\n },\n primaryButton: {\n backgroundColor: '#2DBD60',\n },\n navButtonText: {\n fontSize: 16,\n fontWeight: '600',\n color: 'white',\n },\n errorText: {\n color: '#dc2626',\n fontSize: 16,\n textAlign: 'center',\n margin: 20,\n },\n unsupportedContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: 20,\n },\n unsupportedText: {\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n },\n processingContainer: {\n position: 'absolute',\n flex: 1,\n width: Dimensions.get('window').width,\n height: Dimensions.get('window').height,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n justifyContent: 'center',\n alignItems: 'center',\n zIndex: 10000000,\n },\n processingText: {\n fontSize: 16,\n color: '#fff',\n textAlign: 'center',\n fontWeight: 'bold',\n marginBottom: 10,\n },\n loadingContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: '#f5f5f5',\n },\n loadingText: {\n marginTop: 16,\n fontSize: 16,\n color: '#666',\n textAlign: 'center',\n },\n errorContainer: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: '#f5f5f5',\n padding: 20,\n },\n retryButton: {\n marginTop: 20,\n paddingHorizontal: 24,\n paddingVertical: 12,\n backgroundColor: '#2DBD60',\n borderRadius: 8,\n },\n retryButtonText: {\n color: '#fff',\n fontSize: 16,\n fontWeight: '600',\n },\n}); "]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Example component demonstrating how to use dynamic template loading
|
|
4
|
+
*
|
|
5
|
+
* This example shows two ways to use templates:
|
|
6
|
+
* 1. With templateId - loads template dynamically from backend API
|
|
7
|
+
* 2. With direct template object - uses hardcoded template (backward compatibility)
|
|
8
|
+
*/
|
|
9
|
+
export declare const DynamicTemplateExample: React.FC;
|
|
10
|
+
//# sourceMappingURL=DynamicTemplateExample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicTemplateExample.d.ts","sourceRoot":"","sources":["../../../src/components/example/DynamicTemplateExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EA8J1C,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet, SafeAreaView, TextInput, TouchableOpacity, ScrollView } from 'react-native';
|
|
3
|
+
import { TemplateKYCFlow } from '../TemplateKYCFlowRefactored';
|
|
4
|
+
/**
|
|
5
|
+
* Example component demonstrating how to use dynamic template loading
|
|
6
|
+
*
|
|
7
|
+
* This example shows two ways to use templates:
|
|
8
|
+
* 1. With templateId - loads template dynamically from backend API
|
|
9
|
+
* 2. With direct template object - uses hardcoded template (backward compatibility)
|
|
10
|
+
*/
|
|
11
|
+
export const DynamicTemplateExample = () => {
|
|
12
|
+
const [templateId, setTemplateId] = useState('');
|
|
13
|
+
const [apiKey, setApiKey] = useState('');
|
|
14
|
+
const [showFlow, setShowFlow] = useState(false);
|
|
15
|
+
const [language, setLanguage] = useState('en');
|
|
16
|
+
const handleComplete = (data) => {
|
|
17
|
+
console.log('KYC Verification completed:', data);
|
|
18
|
+
setShowFlow(false);
|
|
19
|
+
alert('Verification completed successfully!');
|
|
20
|
+
};
|
|
21
|
+
const handleError = (error) => {
|
|
22
|
+
console.error('KYC Error:', error);
|
|
23
|
+
alert(`Error: ${error}`);
|
|
24
|
+
setShowFlow(false);
|
|
25
|
+
};
|
|
26
|
+
const handleCancel = () => {
|
|
27
|
+
console.log('KYC Flow cancelled');
|
|
28
|
+
setShowFlow(false);
|
|
29
|
+
};
|
|
30
|
+
const startFlow = () => {
|
|
31
|
+
if (!templateId.trim()) {
|
|
32
|
+
alert('Please enter a template ID');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setShowFlow(true);
|
|
36
|
+
};
|
|
37
|
+
if (showFlow) {
|
|
38
|
+
return (<SafeAreaView style={styles.container}>
|
|
39
|
+
<TemplateKYCFlow templateId={templateId} API_KEY={apiKey || undefined} language={language} onComplete={handleComplete} onError={handleError} onCancel={handleCancel}/>
|
|
40
|
+
</SafeAreaView>);
|
|
41
|
+
}
|
|
42
|
+
return (<SafeAreaView style={styles.container}>
|
|
43
|
+
<ScrollView style={styles.scrollView} contentContainerStyle={styles.content}>
|
|
44
|
+
<Text style={styles.title}>Dynamic Template KYC Example</Text>
|
|
45
|
+
<Text style={styles.subtitle}>
|
|
46
|
+
Load a KYC template dynamically from the backend API
|
|
47
|
+
</Text>
|
|
48
|
+
|
|
49
|
+
<View style={styles.section}>
|
|
50
|
+
<Text style={styles.label}>Template ID *</Text>
|
|
51
|
+
<TextInput style={styles.input} placeholder="e.g., free-style" value={templateId} onChangeText={setTemplateId} autoCapitalize="none" autoCorrect={false}/>
|
|
52
|
+
<Text style={styles.hint}>
|
|
53
|
+
Enter the template ID to load from the backend API
|
|
54
|
+
</Text>
|
|
55
|
+
</View>
|
|
56
|
+
|
|
57
|
+
<View style={styles.section}>
|
|
58
|
+
<Text style={styles.label}>API Key (Optional)</Text>
|
|
59
|
+
<TextInput style={styles.input} placeholder="Your API key" value={apiKey} onChangeText={setApiKey} autoCapitalize="none" autoCorrect={false} secureTextEntry/>
|
|
60
|
+
<Text style={styles.hint}>
|
|
61
|
+
If not provided, the SDK will use token-based authentication
|
|
62
|
+
</Text>
|
|
63
|
+
</View>
|
|
64
|
+
|
|
65
|
+
<View style={styles.section}>
|
|
66
|
+
<Text style={styles.label}>Language</Text>
|
|
67
|
+
<View style={styles.languageContainer}>
|
|
68
|
+
<TouchableOpacity style={[
|
|
69
|
+
styles.languageButton,
|
|
70
|
+
language === 'en' && styles.languageButtonActive,
|
|
71
|
+
]} onPress={() => setLanguage('en')}>
|
|
72
|
+
<Text style={[
|
|
73
|
+
styles.languageButtonText,
|
|
74
|
+
language === 'en' && styles.languageButtonTextActive,
|
|
75
|
+
]}>
|
|
76
|
+
English
|
|
77
|
+
</Text>
|
|
78
|
+
</TouchableOpacity>
|
|
79
|
+
<TouchableOpacity style={[
|
|
80
|
+
styles.languageButton,
|
|
81
|
+
language === 'fr' && styles.languageButtonActive,
|
|
82
|
+
]} onPress={() => setLanguage('fr')}>
|
|
83
|
+
<Text style={[
|
|
84
|
+
styles.languageButtonText,
|
|
85
|
+
language === 'fr' && styles.languageButtonTextActive,
|
|
86
|
+
]}>
|
|
87
|
+
Français
|
|
88
|
+
</Text>
|
|
89
|
+
</TouchableOpacity>
|
|
90
|
+
</View>
|
|
91
|
+
</View>
|
|
92
|
+
|
|
93
|
+
<TouchableOpacity style={[styles.button, !templateId.trim() && styles.buttonDisabled]} onPress={startFlow} disabled={!templateId.trim()}>
|
|
94
|
+
<Text style={styles.buttonText}>Start KYC Verification</Text>
|
|
95
|
+
</TouchableOpacity>
|
|
96
|
+
|
|
97
|
+
<View style={styles.infoSection}>
|
|
98
|
+
<Text style={styles.infoTitle}>Usage Example:</Text>
|
|
99
|
+
<Text style={styles.code}>
|
|
100
|
+
{`<TemplateKYCFlow
|
|
101
|
+
templateId="free-style"
|
|
102
|
+
API_KEY="your-api-key"
|
|
103
|
+
language="fr"
|
|
104
|
+
onComplete={handleComplete}
|
|
105
|
+
onError={handleError}
|
|
106
|
+
onCancel={handleCancel}
|
|
107
|
+
/>`}
|
|
108
|
+
</Text>
|
|
109
|
+
</View>
|
|
110
|
+
|
|
111
|
+
<View style={styles.infoSection}>
|
|
112
|
+
<Text style={styles.infoTitle}>Notes:</Text>
|
|
113
|
+
<Text style={styles.infoText}>
|
|
114
|
+
• Template ID is required to load from backend{'\n'}
|
|
115
|
+
• API Key is optional but recommended for production{'\n'}
|
|
116
|
+
• The SDK will automatically transform the backend template format to SDK format{'\n'}
|
|
117
|
+
• Templates are cached for 5 minutes to improve performance{'\n'}
|
|
118
|
+
• You can also use a direct template object for backward compatibility
|
|
119
|
+
</Text>
|
|
120
|
+
</View>
|
|
121
|
+
</ScrollView>
|
|
122
|
+
</SafeAreaView>);
|
|
123
|
+
};
|
|
124
|
+
const styles = StyleSheet.create({
|
|
125
|
+
container: {
|
|
126
|
+
flex: 1,
|
|
127
|
+
backgroundColor: '#f5f5f5',
|
|
128
|
+
},
|
|
129
|
+
scrollView: {
|
|
130
|
+
flex: 1,
|
|
131
|
+
},
|
|
132
|
+
content: {
|
|
133
|
+
padding: 20,
|
|
134
|
+
paddingBottom: 40,
|
|
135
|
+
},
|
|
136
|
+
title: {
|
|
137
|
+
fontSize: 24,
|
|
138
|
+
fontWeight: 'bold',
|
|
139
|
+
color: '#333',
|
|
140
|
+
marginBottom: 8,
|
|
141
|
+
textAlign: 'center',
|
|
142
|
+
},
|
|
143
|
+
subtitle: {
|
|
144
|
+
fontSize: 16,
|
|
145
|
+
color: '#666',
|
|
146
|
+
marginBottom: 32,
|
|
147
|
+
textAlign: 'center',
|
|
148
|
+
},
|
|
149
|
+
section: {
|
|
150
|
+
marginBottom: 24,
|
|
151
|
+
},
|
|
152
|
+
label: {
|
|
153
|
+
fontSize: 16,
|
|
154
|
+
fontWeight: '600',
|
|
155
|
+
color: '#333',
|
|
156
|
+
marginBottom: 8,
|
|
157
|
+
},
|
|
158
|
+
input: {
|
|
159
|
+
backgroundColor: 'white',
|
|
160
|
+
borderWidth: 1,
|
|
161
|
+
borderColor: '#ddd',
|
|
162
|
+
borderRadius: 8,
|
|
163
|
+
padding: 12,
|
|
164
|
+
fontSize: 16,
|
|
165
|
+
color: '#333',
|
|
166
|
+
},
|
|
167
|
+
hint: {
|
|
168
|
+
fontSize: 12,
|
|
169
|
+
color: '#999',
|
|
170
|
+
marginTop: 4,
|
|
171
|
+
},
|
|
172
|
+
languageContainer: {
|
|
173
|
+
flexDirection: 'row',
|
|
174
|
+
gap: 12,
|
|
175
|
+
},
|
|
176
|
+
languageButton: {
|
|
177
|
+
flex: 1,
|
|
178
|
+
padding: 12,
|
|
179
|
+
backgroundColor: 'white',
|
|
180
|
+
borderWidth: 1,
|
|
181
|
+
borderColor: '#ddd',
|
|
182
|
+
borderRadius: 8,
|
|
183
|
+
alignItems: 'center',
|
|
184
|
+
},
|
|
185
|
+
languageButtonActive: {
|
|
186
|
+
backgroundColor: '#2DBD60',
|
|
187
|
+
borderColor: '#2DBD60',
|
|
188
|
+
},
|
|
189
|
+
languageButtonText: {
|
|
190
|
+
fontSize: 16,
|
|
191
|
+
color: '#666',
|
|
192
|
+
fontWeight: '500',
|
|
193
|
+
},
|
|
194
|
+
languageButtonTextActive: {
|
|
195
|
+
color: 'white',
|
|
196
|
+
fontWeight: '600',
|
|
197
|
+
},
|
|
198
|
+
button: {
|
|
199
|
+
backgroundColor: '#2DBD60',
|
|
200
|
+
padding: 16,
|
|
201
|
+
borderRadius: 8,
|
|
202
|
+
alignItems: 'center',
|
|
203
|
+
marginTop: 8,
|
|
204
|
+
marginBottom: 32,
|
|
205
|
+
},
|
|
206
|
+
buttonDisabled: {
|
|
207
|
+
backgroundColor: '#ccc',
|
|
208
|
+
},
|
|
209
|
+
buttonText: {
|
|
210
|
+
color: 'white',
|
|
211
|
+
fontSize: 16,
|
|
212
|
+
fontWeight: '600',
|
|
213
|
+
},
|
|
214
|
+
infoSection: {
|
|
215
|
+
backgroundColor: 'white',
|
|
216
|
+
padding: 16,
|
|
217
|
+
borderRadius: 8,
|
|
218
|
+
marginBottom: 16,
|
|
219
|
+
},
|
|
220
|
+
infoTitle: {
|
|
221
|
+
fontSize: 16,
|
|
222
|
+
fontWeight: '600',
|
|
223
|
+
color: '#333',
|
|
224
|
+
marginBottom: 8,
|
|
225
|
+
},
|
|
226
|
+
code: {
|
|
227
|
+
fontFamily: 'monospace',
|
|
228
|
+
fontSize: 12,
|
|
229
|
+
color: '#555',
|
|
230
|
+
backgroundColor: '#f5f5f5',
|
|
231
|
+
padding: 12,
|
|
232
|
+
borderRadius: 4,
|
|
233
|
+
overflow: 'hidden',
|
|
234
|
+
},
|
|
235
|
+
infoText: {
|
|
236
|
+
fontSize: 14,
|
|
237
|
+
color: '#666',
|
|
238
|
+
lineHeight: 20,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
//# sourceMappingURL=DynamicTemplateExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicTemplateExample.js","sourceRoot":"","sources":["../../../src/components/example/DynamicTemplateExample.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAa,GAAG,EAAE;IACnD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACzD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAc,IAAI,CAAC,CAAC;IAE5D,M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BAAkB,EAAE;QAClB,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,KAAK;KAClB;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;KAClB;IACD,MAAM,EAAE;QACN,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,EAAE;KACjB;IACD,cAAc,EAAE;QACd,eAAe,EAAE,MAAM;KACxB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,WAAW,EAAE;QACX,eAAe,EAAE,OAAO;QACxB,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,EAAE;KACjB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,CAAC;KAChB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,WAAW;QACvB,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,QAAQ;KACnB;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { View, Text, StyleSheet, SafeAreaView, TextInput, TouchableOpacity, ScrollView } from 'react-native';\nimport { TemplateKYCFlow } from '../TemplateKYCFlowRefactored';\nimport { VerificationState } from '../../types/KYC.types';\n\n/**\n * Example component demonstrating how to use dynamic template loading\n * \n * This example shows two ways to use templates:\n * 1. With templateId - loads template dynamically from backend API\n * 2. With direct template object - uses hardcoded template (backward compatibility)\n */\nexport const DynamicTemplateExample: React.FC = () => {\n const [templateId, setTemplateId] = useState<string>('');\n const [apiKey, setApiKey] = useState<string>('');\n const [showFlow, setShowFlow] = useState<boolean>(false);\n const [language, setLanguage] = useState<'en' | 'fr'>('en');\n\n const handleComplete = (data: VerificationState) => {\n console.log('KYC Verification completed:', data);\n setShowFlow(false);\n alert('Verification completed successfully!');\n };\n\n const handleError = (error: string) => {\n console.error('KYC Error:', error);\n alert(`Error: ${error}`);\n setShowFlow(false);\n };\n\n const handleCancel = () => {\n console.log('KYC Flow cancelled');\n setShowFlow(false);\n };\n\n const startFlow = () => {\n if (!templateId.trim()) {\n alert('Please enter a template ID');\n return;\n }\n setShowFlow(true);\n };\n\n if (showFlow) {\n return (\n <SafeAreaView style={styles.container}>\n <TemplateKYCFlow\n templateId={templateId}\n API_KEY={apiKey || undefined}\n language={language}\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n />\n </SafeAreaView>\n );\n }\n\n return (\n <SafeAreaView style={styles.container}>\n <ScrollView style={styles.scrollView} contentContainerStyle={styles.content}>\n <Text style={styles.title}>Dynamic Template KYC Example</Text>\n <Text style={styles.subtitle}>\n Load a KYC template dynamically from the backend API\n </Text>\n\n <View style={styles.section}>\n <Text style={styles.label}>Template ID *</Text>\n <TextInput\n style={styles.input}\n placeholder=\"e.g., free-style\"\n value={templateId}\n onChangeText={setTemplateId}\n autoCapitalize=\"none\"\n autoCorrect={false}\n />\n <Text style={styles.hint}>\n Enter the template ID to load from the backend API\n </Text>\n </View>\n\n <View style={styles.section}>\n <Text style={styles.label}>API Key (Optional)</Text>\n <TextInput\n style={styles.input}\n placeholder=\"Your API key\"\n value={apiKey}\n onChangeText={setApiKey}\n autoCapitalize=\"none\"\n autoCorrect={false}\n secureTextEntry\n />\n <Text style={styles.hint}>\n If not provided, the SDK will use token-based authentication\n </Text>\n </View>\n\n <View style={styles.section}>\n <Text style={styles.label}>Language</Text>\n <View style={styles.languageContainer}>\n <TouchableOpacity\n style={[\n styles.languageButton,\n language === 'en' && styles.languageButtonActive,\n ]}\n onPress={() => setLanguage('en')}\n >\n <Text\n style={[\n styles.languageButtonText,\n language === 'en' && styles.languageButtonTextActive,\n ]}\n >\n English\n </Text>\n </TouchableOpacity>\n <TouchableOpacity\n style={[\n styles.languageButton,\n language === 'fr' && styles.languageButtonActive,\n ]}\n onPress={() => setLanguage('fr')}\n >\n <Text\n style={[\n styles.languageButtonText,\n language === 'fr' && styles.languageButtonTextActive,\n ]}\n >\n Français\n </Text>\n </TouchableOpacity>\n </View>\n </View>\n\n <TouchableOpacity\n style={[styles.button, !templateId.trim() && styles.buttonDisabled]}\n onPress={startFlow}\n disabled={!templateId.trim()}\n >\n <Text style={styles.buttonText}>Start KYC Verification</Text>\n </TouchableOpacity>\n\n <View style={styles.infoSection}>\n <Text style={styles.infoTitle}>Usage Example:</Text>\n <Text style={styles.code}>\n {`<TemplateKYCFlow\n templateId=\"free-style\"\n API_KEY=\"your-api-key\"\n language=\"fr\"\n onComplete={handleComplete}\n onError={handleError}\n onCancel={handleCancel}\n/>`}\n </Text>\n </View>\n\n <View style={styles.infoSection}>\n <Text style={styles.infoTitle}>Notes:</Text>\n <Text style={styles.infoText}>\n • Template ID is required to load from backend{'\\n'}\n • API Key is optional but recommended for production{'\\n'}\n • The SDK will automatically transform the backend template format to SDK format{'\\n'}\n • Templates are cached for 5 minutes to improve performance{'\\n'}\n • You can also use a direct template object for backward compatibility\n </Text>\n </View>\n </ScrollView>\n </SafeAreaView>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: '#f5f5f5',\n },\n scrollView: {\n flex: 1,\n },\n content: {\n padding: 20,\n paddingBottom: 40,\n },\n title: {\n fontSize: 24,\n fontWeight: 'bold',\n color: '#333',\n marginBottom: 8,\n textAlign: 'center',\n },\n subtitle: {\n fontSize: 16,\n color: '#666',\n marginBottom: 32,\n textAlign: 'center',\n },\n section: {\n marginBottom: 24,\n },\n label: {\n fontSize: 16,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n },\n input: {\n backgroundColor: 'white',\n borderWidth: 1,\n borderColor: '#ddd',\n borderRadius: 8,\n padding: 12,\n fontSize: 16,\n color: '#333',\n },\n hint: {\n fontSize: 12,\n color: '#999',\n marginTop: 4,\n },\n languageContainer: {\n flexDirection: 'row',\n gap: 12,\n },\n languageButton: {\n flex: 1,\n padding: 12,\n backgroundColor: 'white',\n borderWidth: 1,\n borderColor: '#ddd',\n borderRadius: 8,\n alignItems: 'center',\n },\n languageButtonActive: {\n backgroundColor: '#2DBD60',\n borderColor: '#2DBD60',\n },\n languageButtonText: {\n fontSize: 16,\n color: '#666',\n fontWeight: '500',\n },\n languageButtonTextActive: {\n color: 'white',\n fontWeight: '600',\n },\n button: {\n backgroundColor: '#2DBD60',\n padding: 16,\n borderRadius: 8,\n alignItems: 'center',\n marginTop: 8,\n marginBottom: 32,\n },\n buttonDisabled: {\n backgroundColor: '#ccc',\n },\n buttonText: {\n color: 'white',\n fontSize: 16,\n fontWeight: '600',\n },\n infoSection: {\n backgroundColor: 'white',\n padding: 16,\n borderRadius: 8,\n marginBottom: 16,\n },\n infoTitle: {\n fontSize: 16,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n },\n code: {\n fontFamily: 'monospace',\n fontSize: 12,\n color: '#555',\n backgroundColor: '#f5f5f5',\n padding: 12,\n borderRadius: 4,\n overflow: 'hidden',\n },\n infoText: {\n fontSize: 14,\n color: '#666',\n lineHeight: 20,\n },\n});"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BackendEnvironment } from '../types/env.types';
|
|
2
|
+
declare class KYCConfig {
|
|
3
|
+
private static instance;
|
|
4
|
+
private backendEnvironment;
|
|
5
|
+
private backendUrls;
|
|
6
|
+
private constructor();
|
|
7
|
+
static getInstance(): KYCConfig;
|
|
8
|
+
setBackendEnvironment(env: BackendEnvironment): void;
|
|
9
|
+
getBackendUrl(): string;
|
|
10
|
+
getBackendEnvironment(): BackendEnvironment;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: KYCConfig;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=KYCConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KYCConfig.d.ts","sourceRoot":"","sources":["../../src/config/KYCConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,cAAM,SAAS;IACX,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAY;IACnC,OAAO,CAAC,kBAAkB,CAAoC;IAE9D,OAAO,CAAC,WAAW,CAGjB;IAEF,OAAO;WAEO,WAAW,IAAI,SAAS;IAO/B,qBAAqB,CAAC,GAAG,EAAE,kBAAkB;IAI7C,aAAa,IAAI,MAAM;IAIvB,qBAAqB,IAAI,kBAAkB;CAGrD;;AAED,wBAAuC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class KYCConfig {
|
|
2
|
+
static instance;
|
|
3
|
+
backendEnvironment = 'PRODUCTION';
|
|
4
|
+
backendUrls = {
|
|
5
|
+
PRODUCTION: 'https://service.sanctumkey.com/api/v1',
|
|
6
|
+
TEST: 'https://test-service.sanctumkey.com/api/v1', // Placeholder URL
|
|
7
|
+
};
|
|
8
|
+
constructor() { }
|
|
9
|
+
static getInstance() {
|
|
10
|
+
if (!KYCConfig.instance) {
|
|
11
|
+
KYCConfig.instance = new KYCConfig();
|
|
12
|
+
}
|
|
13
|
+
return KYCConfig.instance;
|
|
14
|
+
}
|
|
15
|
+
setBackendEnvironment(env) {
|
|
16
|
+
this.backendEnvironment = env;
|
|
17
|
+
}
|
|
18
|
+
getBackendUrl() {
|
|
19
|
+
return this.backendUrls[this.backendEnvironment];
|
|
20
|
+
}
|
|
21
|
+
getBackendEnvironment() {
|
|
22
|
+
return this.backendEnvironment;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export default KYCConfig.getInstance();
|
|
26
|
+
//# sourceMappingURL=KYCConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KYCConfig.js","sourceRoot":"","sources":["../../src/config/KYCConfig.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS;IACH,MAAM,CAAC,QAAQ,CAAY;IAC3B,kBAAkB,GAAuB,YAAY,CAAC;IAEtD,WAAW,GAAuC;QACtD,UAAU,EAAE,uCAAuC;QACnD,IAAI,EAAE,4CAA4C,EAAE,kBAAkB;KACzE,CAAC;IAEF,gBAAwB,CAAC;IAElB,MAAM,CAAC,WAAW;QACrB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACtB,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;QACzC,CAAC;QACD,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC9B,CAAC;IAEM,qBAAqB,CAAC,GAAuB;QAChD,IAAI,CAAC,kBAAkB,GAAG,GAAG,CAAC;IAClC,CAAC;IAEM,aAAa;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACrD,CAAC;IAEM,qBAAqB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;CACJ;AAED,eAAe,SAAS,CAAC,WAAW,EAAE,CAAC","sourcesContent":["import { BackendEnvironment } from '../types/env.types';\n\nclass KYCConfig {\n private static instance: KYCConfig;\n private backendEnvironment: BackendEnvironment = 'PRODUCTION';\n\n private backendUrls: Record<BackendEnvironment, string> = {\n PRODUCTION: 'https://service.sanctumkey.com/api/v1',\n TEST: 'https://test-service.sanctumkey.com/api/v1', // Placeholder URL\n };\n\n private constructor() { }\n\n public static getInstance(): KYCConfig {\n if (!KYCConfig.instance) {\n KYCConfig.instance = new KYCConfig();\n }\n return KYCConfig.instance;\n }\n\n public setBackendEnvironment(env: BackendEnvironment) {\n this.backendEnvironment = env;\n }\n\n public getBackendUrl(): string {\n return this.backendUrls[this.backendEnvironment];\n }\n\n public getBackendEnvironment(): BackendEnvironment {\n return this.backendEnvironment;\n }\n}\n\nexport default KYCConfig.getInstance();\n"]}
|