@transfergratis/react-native-sdk 0.1.24 → 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.
Files changed (149) hide show
  1. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +12 -5
  2. package/android/build/intermediates/aar_main_jar/debug/syncDebugLibJars/classes.jar +0 -0
  3. package/android/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  4. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  5. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  6. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +61 -59
  7. package/android/build/intermediates/merged_java_res/debug/mergeDebugJavaResource/feature-transfergratis-react-native-sdk.jar +0 -0
  8. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +12 -5
  9. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  10. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  11. package/android/build/outputs/aar/transfergratis-react-native-sdk-debug.aar +0 -0
  12. package/android/build/outputs/logs/manifest-merger-debug-report.txt +26 -34
  13. package/android/src/main/AndroidManifest.xml +10 -7
  14. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts +12 -0
  15. package/build/components/KYCElements/AdditionalDocumentsTemplate.d.ts.map +1 -0
  16. package/build/components/KYCElements/AdditionalDocumentsTemplate.js +283 -0
  17. package/build/components/KYCElements/AdditionalDocumentsTemplate.js.map +1 -0
  18. package/build/components/KYCElements/EmailVerificationTemplate.d.ts +12 -0
  19. package/build/components/KYCElements/EmailVerificationTemplate.d.ts.map +1 -0
  20. package/build/components/KYCElements/EmailVerificationTemplate.js +193 -0
  21. package/build/components/KYCElements/EmailVerificationTemplate.js.map +1 -0
  22. package/build/components/KYCElements/IDCardCapture.d.ts.map +1 -1
  23. package/build/components/KYCElements/IDCardCapture.js +180 -7
  24. package/build/components/KYCElements/IDCardCapture.js.map +1 -1
  25. package/build/components/KYCElements/OrientationVideoCapture.d.ts +2 -0
  26. package/build/components/KYCElements/OrientationVideoCapture.d.ts.map +1 -1
  27. package/build/components/KYCElements/OrientationVideoCapture.js +2 -2
  28. package/build/components/KYCElements/OrientationVideoCapture.js.map +1 -1
  29. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts +2 -0
  30. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.d.ts.map +1 -1
  31. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js +2 -2
  32. package/build/components/KYCElements/OrientationVideoCaptureEnhanced.js.map +1 -1
  33. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts +2 -0
  34. package/build/components/KYCElements/OrientationVideoCaptureFinal.d.ts.map +1 -1
  35. package/build/components/KYCElements/OrientationVideoCaptureFinal.js +2 -2
  36. package/build/components/KYCElements/OrientationVideoCaptureFinal.js.map +1 -1
  37. package/build/components/KYCElements/PersonalInformationTemplate.d.ts +12 -0
  38. package/build/components/KYCElements/PersonalInformationTemplate.d.ts.map +1 -0
  39. package/build/components/KYCElements/PersonalInformationTemplate.js +120 -0
  40. package/build/components/KYCElements/PersonalInformationTemplate.js.map +1 -0
  41. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts +12 -0
  42. package/build/components/KYCElements/PhoneVerificationTemplate.d.ts.map +1 -0
  43. package/build/components/KYCElements/PhoneVerificationTemplate.js +185 -0
  44. package/build/components/KYCElements/PhoneVerificationTemplate.js.map +1 -0
  45. package/build/components/KYCElements/SelfieCaptureTemplate.d.ts.map +1 -1
  46. package/build/components/KYCElements/SelfieCaptureTemplate.js +7 -3
  47. package/build/components/KYCElements/SelfieCaptureTemplate.js.map +1 -1
  48. package/build/components/TemplateKYCExample.d.ts +4 -0
  49. package/build/components/TemplateKYCExample.d.ts.map +1 -1
  50. package/build/components/TemplateKYCExample.js +7 -30
  51. package/build/components/TemplateKYCExample.js.map +1 -1
  52. package/build/components/TemplateKYCFlowRefactored.d.ts +4 -0
  53. package/build/components/TemplateKYCFlowRefactored.d.ts.map +1 -1
  54. package/build/components/TemplateKYCFlowRefactored.js +14 -2
  55. package/build/components/TemplateKYCFlowRefactored.js.map +1 -1
  56. package/build/config/KYCConfig.d.ts +14 -0
  57. package/build/config/KYCConfig.d.ts.map +1 -0
  58. package/build/config/KYCConfig.js +26 -0
  59. package/build/config/KYCConfig.js.map +1 -0
  60. package/build/config/allowedDomains.d.ts.map +1 -1
  61. package/build/config/allowedDomains.js +4 -19
  62. package/build/config/allowedDomains.js.map +1 -1
  63. package/build/hooks/useOrientationVideo.d.ts +2 -1
  64. package/build/hooks/useOrientationVideo.d.ts.map +1 -1
  65. package/build/hooks/useOrientationVideo.js +3 -3
  66. package/build/hooks/useOrientationVideo.js.map +1 -1
  67. package/build/hooks/useTemplateKYCFlow.d.ts +6 -1
  68. package/build/hooks/useTemplateKYCFlow.d.ts.map +1 -1
  69. package/build/hooks/useTemplateKYCFlow.js +286 -23
  70. package/build/hooks/useTemplateKYCFlow.js.map +1 -1
  71. package/build/i18n/en/index.d.ts +40 -0
  72. package/build/i18n/en/index.d.ts.map +1 -1
  73. package/build/i18n/en/index.js +41 -1
  74. package/build/i18n/en/index.js.map +1 -1
  75. package/build/i18n/fr/index.d.ts +26 -0
  76. package/build/i18n/fr/index.d.ts.map +1 -1
  77. package/build/i18n/fr/index.js +27 -1
  78. package/build/i18n/fr/index.js.map +1 -1
  79. package/build/index.d.ts +1 -0
  80. package/build/index.d.ts.map +1 -1
  81. package/build/index.js +2 -0
  82. package/build/index.js.map +1 -1
  83. package/build/modules/api/CardAuthentification.d.ts +24 -3
  84. package/build/modules/api/CardAuthentification.d.ts.map +1 -1
  85. package/build/modules/api/CardAuthentification.js +68 -10
  86. package/build/modules/api/CardAuthentification.js.map +1 -1
  87. package/build/modules/api/KYCService.d.ts +7 -7
  88. package/build/modules/api/KYCService.d.ts.map +1 -1
  89. package/build/modules/api/KYCService.js +101 -37
  90. package/build/modules/api/KYCService.js.map +1 -1
  91. package/build/modules/api/SelfieVerification.d.ts +3 -1
  92. package/build/modules/api/SelfieVerification.d.ts.map +1 -1
  93. package/build/modules/api/SelfieVerification.js +17 -1
  94. package/build/modules/api/SelfieVerification.js.map +1 -1
  95. package/build/modules/api/TemplateService.d.ts +0 -1
  96. package/build/modules/api/TemplateService.d.ts.map +1 -1
  97. package/build/modules/api/TemplateService.js +3 -3
  98. package/build/modules/api/TemplateService.js.map +1 -1
  99. package/build/types/KYC.types.d.ts +124 -3
  100. package/build/types/KYC.types.d.ts.map +1 -1
  101. package/build/types/KYC.types.js.map +1 -1
  102. package/build/types/env.types.d.ts +13 -0
  103. package/build/types/env.types.d.ts.map +1 -0
  104. package/build/types/env.types.js +2 -0
  105. package/build/types/env.types.js.map +1 -0
  106. package/build/utils/deviceDetection.d.ts +6 -0
  107. package/build/utils/deviceDetection.d.ts.map +1 -0
  108. package/build/utils/deviceDetection.js +12 -0
  109. package/build/utils/deviceDetection.js.map +1 -0
  110. package/build/utils/platformAlert.d.ts.map +1 -1
  111. package/build/utils/platformAlert.js.map +1 -1
  112. package/build/utils/template-transformer.d.ts.map +1 -1
  113. package/build/utils/template-transformer.js +12 -0
  114. package/build/utils/template-transformer.js.map +1 -1
  115. package/build/web/WebKYCEntry.d.ts.map +1 -1
  116. package/build/web/WebKYCEntry.js +82 -38
  117. package/build/web/WebKYCEntry.js.map +1 -1
  118. package/package.json +1 -1
  119. package/plugin/build/withVisionCamera.js +3 -4
  120. package/plugin/src/withVisionCamera.js +3 -4
  121. package/plugin/src/withVisionCamera.ts +3 -4
  122. package/src/components/KYCElements/AdditionalDocumentsTemplate.tsx +346 -0
  123. package/src/components/KYCElements/EmailVerificationTemplate.tsx +264 -0
  124. package/src/components/KYCElements/IDCardCapture.tsx +216 -15
  125. package/src/components/KYCElements/OrientationVideoCapture.tsx +4 -1
  126. package/src/components/KYCElements/OrientationVideoCaptureEnhanced.tsx +4 -1
  127. package/src/components/KYCElements/OrientationVideoCaptureFinal.tsx +4 -1
  128. package/src/components/KYCElements/PersonalInformationTemplate.tsx +158 -0
  129. package/src/components/KYCElements/PhoneVerificationTemplate.tsx +253 -0
  130. package/src/components/KYCElements/SelfieCaptureTemplate.tsx +6 -3
  131. package/src/components/TemplateKYCExample.tsx +31 -46
  132. package/src/components/TemplateKYCFlowRefactored.tsx +27 -1
  133. package/src/config/KYCConfig.ts +34 -0
  134. package/src/config/allowedDomains.ts +7 -26
  135. package/src/hooks/useOrientationVideo.ts +5 -4
  136. package/src/hooks/useTemplateKYCFlow.tsx +314 -21
  137. package/src/i18n/en/index.ts +43 -2
  138. package/src/i18n/fr/index.ts +28 -1
  139. package/src/index.ts +3 -0
  140. package/src/modules/api/CardAuthentification.ts +75 -10
  141. package/src/modules/api/KYCService.ts +117 -37
  142. package/src/modules/api/SelfieVerification.ts +25 -3
  143. package/src/modules/api/TemplateService.ts +4 -4
  144. package/src/types/KYC.types.ts +146 -3
  145. package/src/types/env.types.ts +13 -0
  146. package/src/utils/deviceDetection.ts +11 -0
  147. package/src/utils/platformAlert.ts +1 -0
  148. package/src/utils/template-transformer.ts +20 -8
  149. package/src/web/WebKYCEntry.tsx +112 -61
@@ -0,0 +1,283 @@
1
+ import React, { useState } from 'react';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Image } from 'react-native';
3
+ import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
4
+ import { useI18n } from '../../hooks/useI18n';
5
+ import { Button } from '../ui/Button';
6
+ import NativeCameraModule from '../../modules/camera/NativeCameraModule';
7
+ import { useKYCStore } from '../../stores/kycStore';
8
+ import { showAlert } from '../../utils/platformAlert';
9
+ export const AdditionalDocumentsTemplate = ({ component, value, onValueChange, error, language = 'en', }) => {
10
+ const { actions, getLocalizedText } = useTemplateKYCFlowContext();
11
+ const { t } = useI18n();
12
+ const { setProcessing } = useKYCStore();
13
+ const config = component.config;
14
+ // State
15
+ const [uploadedFiles, setUploadedFiles] = useState([]);
16
+ const [isUploading, setIsUploading] = useState(false);
17
+ const title = getLocalizedText(component.labels);
18
+ const instructions = getLocalizedText(component.instructions);
19
+ const buttonText = getLocalizedText(component.ui.buttonText) || t('common.continue');
20
+ // Parse max size from config string (e.g. "5MB" -> bytes)
21
+ const parseMaxSize = (sizeStr) => {
22
+ if (!sizeStr)
23
+ return 10 * 1024 * 1024; // Default 10MB
24
+ const value = parseFloat(sizeStr);
25
+ if (sizeStr.toLowerCase().includes('kb'))
26
+ return value * 1024;
27
+ if (sizeStr.toLowerCase().includes('gb'))
28
+ return value * 1024 * 1024 * 1024;
29
+ return value * 1024 * 1024; // Default to MB if only number or MB
30
+ };
31
+ const maxSizeBytes = parseMaxSize(config.maxSizeEach);
32
+ const maxFiles = config.maxDocuments || 3;
33
+ const pickDocument = async () => {
34
+ if (uploadedFiles.length >= maxFiles) {
35
+ showAlert(t('common.limitReached') || 'Limit Reached', t('errors.maxFilesReached', { max: maxFiles }) || `You can only upload ${maxFiles} files.`);
36
+ return;
37
+ }
38
+ try {
39
+ setIsUploading(true);
40
+ setProcessing(true);
41
+ // Default allowed types since AdditionalDocumentsConfig structure is complex for categories
42
+ const allowedTypes = ['application/pdf', 'image/jpeg', 'image/png'];
43
+ const result = await NativeCameraModule.openFilePicker(allowedTypes);
44
+ if (result.success && result.uri && result.path) {
45
+ const fileName = result.path.split('/').pop() || 'Document';
46
+ const fileSize = result.size || 0;
47
+ if (fileSize > maxSizeBytes) {
48
+ showAlert(t('errors.fileTooLarge') || 'File too large', t('errors.maxFileSize', { size: config.maxSizeEach }) || `Max file size is ${config.maxSizeEach}`);
49
+ return;
50
+ }
51
+ const newFile = {
52
+ uri: result.uri,
53
+ path: result.path,
54
+ name: fileName,
55
+ size: fileSize
56
+ };
57
+ const updatedFiles = [...uploadedFiles, newFile];
58
+ setUploadedFiles(updatedFiles);
59
+ onValueChange({ documents: updatedFiles }); // Matching expected data structure
60
+ }
61
+ else if (result.error) {
62
+ // Ignore cancellation errors or show generic if needed
63
+ if (result.error !== 'Canceled') {
64
+ showAlert(t('common.error') || 'Error', result.error);
65
+ }
66
+ }
67
+ }
68
+ catch (error) {
69
+ console.error('Error selecting file:', error);
70
+ showAlert(t('common.error') || 'Error', t('errors.unknownError') || 'Failed to select file');
71
+ }
72
+ finally {
73
+ setIsUploading(false);
74
+ setProcessing(false);
75
+ }
76
+ };
77
+ const removeFile = (index) => {
78
+ const updatedFiles = uploadedFiles.filter((_, i) => i !== index);
79
+ setUploadedFiles(updatedFiles);
80
+ onValueChange({ documents: updatedFiles });
81
+ };
82
+ const handleContinue = () => {
83
+ actions.nextComponent();
84
+ };
85
+ // Helpers for UI
86
+ const getFileIcon = (fileName) => {
87
+ const extension = fileName.split('.').pop()?.toLowerCase();
88
+ switch (extension) {
89
+ case 'pdf': return '📄';
90
+ case 'jpg':
91
+ case 'jpeg':
92
+ case 'png': return '🖼️';
93
+ default: return '📎';
94
+ }
95
+ };
96
+ const isImageFile = (fileName) => {
97
+ const extension = fileName.split('.').pop()?.toLowerCase();
98
+ return ['jpg', 'jpeg', 'png', 'webp'].includes(extension || '');
99
+ };
100
+ const formatFileSize = (bytes) => {
101
+ if (bytes === 0)
102
+ return '0 Bytes';
103
+ const k = 1024;
104
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
105
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
106
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
107
+ };
108
+ return (<View style={styles.container}>
109
+ <Text style={styles.title}>{title}</Text>
110
+ <Text style={styles.instructions}>{instructions}</Text>
111
+
112
+ <View style={styles.uploadArea}>
113
+ <TouchableOpacity style={[
114
+ styles.uploadButton,
115
+ isUploading && styles.uploadButtonDisabled,
116
+ { borderColor: component.ui.themeColor || '#2DBD60' }
117
+ ]} onPress={pickDocument} disabled={isUploading}>
118
+ <Text style={styles.uploadIcon}>📁</Text>
119
+ <Text style={[
120
+ styles.uploadText,
121
+ { color: component.ui.themeColor || '#2DBD60' }
122
+ ]}>
123
+ {isUploading ? (t('common.processing') || 'Processing...') : (t('kyc.additionalDocs.add') || 'Select Files')}
124
+ </Text>
125
+ <Text style={styles.uploadSubtext}>
126
+ {t('kyc.additionalDocs.maxSize', { size: config.maxSizeEach }) || `Max size: ${config.maxSizeEach}`}
127
+ </Text>
128
+ </TouchableOpacity>
129
+ </View>
130
+
131
+ {uploadedFiles.length > 0 && (<View style={styles.filesContainer}>
132
+ <Text style={styles.subTitle}>
133
+ {t('kyc.additionalDocs.uploaded') || 'Uploaded Documents'} ({uploadedFiles.length}/{maxFiles})
134
+ </Text>
135
+ <ScrollView style={styles.filesList} showsVerticalScrollIndicator={false}>
136
+ {uploadedFiles.map((file, index) => (<View key={index} style={styles.fileItem}>
137
+ {isImageFile(file.name) ? (<Image source={{ uri: file.uri }} style={styles.fileThumbnail}/>) : (<View style={styles.fileIcon}>
138
+ <Text style={styles.fileIconText}>{getFileIcon(file.name)}</Text>
139
+ </View>)}
140
+ <View style={styles.fileInfo}>
141
+ <Text style={styles.fileName} numberOfLines={1}>{file.name}</Text>
142
+ <Text style={styles.fileSize}>{formatFileSize(file.size)}</Text>
143
+ </View>
144
+ <TouchableOpacity style={styles.removeButton} onPress={() => removeFile(index)}>
145
+ <Text style={styles.removeButtonText}>✕</Text>
146
+ </TouchableOpacity>
147
+ </View>))}
148
+ </ScrollView>
149
+ </View>)}
150
+
151
+ {error && <Text style={styles.errorText}>{error}</Text>}
152
+
153
+ <Button title={buttonText} onPress={handleContinue} fullWidth style={styles.button} disabled={config.required && uploadedFiles.length < (config.minDocuments || 1)}/>
154
+ </View>);
155
+ };
156
+ const styles = StyleSheet.create({
157
+ container: {
158
+ padding: 20,
159
+ backgroundColor: 'white',
160
+ borderRadius: 12,
161
+ margin: 16,
162
+ shadowColor: '#000',
163
+ shadowOffset: { width: 0, height: 2 },
164
+ shadowOpacity: 0.1,
165
+ shadowRadius: 4,
166
+ elevation: 3,
167
+ width: '95%',
168
+ },
169
+ title: {
170
+ fontSize: 22,
171
+ fontWeight: 'bold',
172
+ marginBottom: 10,
173
+ color: '#333',
174
+ },
175
+ instructions: {
176
+ fontSize: 16,
177
+ color: '#666',
178
+ marginBottom: 20,
179
+ lineHeight: 22,
180
+ },
181
+ subTitle: {
182
+ fontSize: 16,
183
+ fontWeight: '600',
184
+ marginBottom: 10,
185
+ color: '#333',
186
+ },
187
+ uploadArea: {
188
+ marginBottom: 20,
189
+ },
190
+ uploadButton: {
191
+ borderWidth: 2,
192
+ borderStyle: 'dashed',
193
+ borderRadius: 12,
194
+ padding: 24,
195
+ alignItems: 'center',
196
+ backgroundColor: '#f0f9f0',
197
+ },
198
+ uploadButtonDisabled: {
199
+ opacity: 0.6,
200
+ },
201
+ uploadIcon: {
202
+ fontSize: 32,
203
+ marginBottom: 8,
204
+ },
205
+ uploadText: {
206
+ fontSize: 16,
207
+ fontWeight: '600',
208
+ marginBottom: 4,
209
+ },
210
+ uploadSubtext: {
211
+ fontSize: 12,
212
+ color: '#666',
213
+ },
214
+ filesContainer: {
215
+ flex: 1,
216
+ marginBottom: 10,
217
+ },
218
+ filesList: {
219
+ maxHeight: 200,
220
+ },
221
+ fileItem: {
222
+ flexDirection: 'row',
223
+ alignItems: 'center',
224
+ padding: 10,
225
+ backgroundColor: '#f9f9f9',
226
+ borderRadius: 8,
227
+ marginBottom: 8,
228
+ borderWidth: 1,
229
+ borderColor: '#eee',
230
+ },
231
+ fileThumbnail: {
232
+ width: 36,
233
+ height: 36,
234
+ borderRadius: 4,
235
+ marginRight: 10,
236
+ },
237
+ fileIcon: {
238
+ width: 36,
239
+ height: 36,
240
+ borderRadius: 4,
241
+ backgroundColor: '#eee',
242
+ justifyContent: 'center',
243
+ alignItems: 'center',
244
+ marginRight: 10,
245
+ },
246
+ fileIconText: {
247
+ fontSize: 18,
248
+ },
249
+ fileInfo: {
250
+ flex: 1,
251
+ },
252
+ fileName: {
253
+ fontSize: 14,
254
+ fontWeight: '500',
255
+ color: '#333',
256
+ },
257
+ fileSize: {
258
+ fontSize: 12,
259
+ color: '#888',
260
+ },
261
+ removeButton: {
262
+ width: 24,
263
+ height: 24,
264
+ borderRadius: 12,
265
+ backgroundColor: '#ff4444',
266
+ justifyContent: 'center',
267
+ alignItems: 'center',
268
+ marginLeft: 8,
269
+ },
270
+ removeButtonText: {
271
+ color: 'white',
272
+ fontSize: 12,
273
+ fontWeight: 'bold',
274
+ },
275
+ errorText: {
276
+ color: 'red',
277
+ marginBottom: 10,
278
+ },
279
+ button: {
280
+ marginTop: 10,
281
+ },
282
+ });
283
+ //# sourceMappingURL=AdditionalDocumentsTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdditionalDocumentsTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/AdditionalDocumentsTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE3F,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,kBAAkB,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAiBtD,MAAM,CAAC,MAAM,2BAA2B,GAA+C,CAAC,EACpF,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EACL,QAAQ,GAAG,IAAI,GAClB,EAAE,EAAE;IACD,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,G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AY,EAAE,EAAE;KACnB;IACD,MAAM,EAAE;QACJ,SAAS,EAAE,EAAE;KAChB;CACJ,CAAC,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { View, Text, StyleSheet, TouchableOpacity, ScrollView, Image } from 'react-native';\nimport { TemplateComponent, AdditionalDocumentsConfig, LocalizedText } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\nimport NativeCameraModule from '../../modules/camera/NativeCameraModule';\nimport { useKYCStore } from '../../stores/kycStore';\nimport { showAlert } from '../../utils/platformAlert';\n\ninterface AdditionalDocumentsTemplateProps {\n component: TemplateComponent;\n value?: any;\n onValueChange: (data: any) => void;\n error?: string;\n language?: string;\n}\n\ninterface UploadedFile {\n uri: string;\n path: string;\n name: string;\n size: number;\n}\n\nexport const AdditionalDocumentsTemplate: React.FC<AdditionalDocumentsTemplateProps> = ({\n component,\n value,\n onValueChange,\n error,\n language = 'en',\n}) => {\n const { actions, getLocalizedText } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n const { setProcessing } = useKYCStore();\n const config = component.config as AdditionalDocumentsConfig;\n\n // State\n const [uploadedFiles, setUploadedFiles] = useState<UploadedFile[]>([]);\n const [isUploading, setIsUploading] = useState(false);\n\n const title = getLocalizedText(component.labels as LocalizedText);\n const instructions = getLocalizedText(component.instructions as LocalizedText);\n const buttonText = getLocalizedText((component.ui as any).buttonText) || t('common.continue');\n\n // Parse max size from config string (e.g. \"5MB\" -> bytes)\n const parseMaxSize = (sizeStr: string): number => {\n if (!sizeStr) return 10 * 1024 * 1024; // Default 10MB\n const value = parseFloat(sizeStr);\n if (sizeStr.toLowerCase().includes('kb')) return value * 1024;\n if (sizeStr.toLowerCase().includes('gb')) return value * 1024 * 1024 * 1024;\n return value * 1024 * 1024; // Default to MB if only number or MB\n };\n\n const maxSizeBytes = parseMaxSize(config.maxSizeEach);\n const maxFiles = config.maxDocuments || 3;\n\n const pickDocument = async () => {\n if (uploadedFiles.length >= maxFiles) {\n showAlert(\n t('common.limitReached') || 'Limit Reached',\n t('errors.maxFilesReached', { max: maxFiles }) || `You can only upload ${maxFiles} files.`\n );\n return;\n }\n\n try {\n setIsUploading(true);\n setProcessing(true);\n\n // Default allowed types since AdditionalDocumentsConfig structure is complex for categories\n const allowedTypes = ['application/pdf', 'image/jpeg', 'image/png'];\n\n const result = await NativeCameraModule.openFilePicker(allowedTypes);\n\n if (result.success && result.uri && result.path) {\n const fileName = result.path.split('/').pop() || 'Document';\n const fileSize = (result as any).size || 0;\n\n if (fileSize > maxSizeBytes) {\n showAlert(\n t('errors.fileTooLarge') || 'File too large',\n t('errors.maxFileSize', { size: config.maxSizeEach }) || `Max file size is ${config.maxSizeEach}`\n );\n return;\n }\n\n const newFile: UploadedFile = {\n uri: result.uri,\n path: result.path,\n name: fileName,\n size: fileSize\n };\n\n const updatedFiles = [...uploadedFiles, newFile];\n setUploadedFiles(updatedFiles);\n onValueChange({ documents: updatedFiles }); // Matching expected data structure\n } else if (result.error) {\n // Ignore cancellation errors or show generic if needed\n if (result.error !== 'Canceled') {\n showAlert(t('common.error') || 'Error', result.error);\n }\n }\n } catch (error) {\n console.error('Error selecting file:', error);\n showAlert(t('common.error') || 'Error', t('errors.unknownError') || 'Failed to select file');\n } finally {\n setIsUploading(false);\n setProcessing(false);\n }\n };\n\n const removeFile = (index: number) => {\n const updatedFiles = uploadedFiles.filter((_, i) => i !== index);\n setUploadedFiles(updatedFiles);\n onValueChange({ documents: updatedFiles });\n };\n\n const handleContinue = () => {\n actions.nextComponent();\n };\n\n // Helpers for UI\n const getFileIcon = (fileName: string) => {\n const extension = fileName.split('.').pop()?.toLowerCase();\n switch (extension) {\n case 'pdf': return '📄';\n case 'jpg':\n case 'jpeg':\n case 'png': return '🖼️';\n default: return '📎';\n }\n };\n\n const isImageFile = (fileName: string): boolean => {\n const extension = fileName.split('.').pop()?.toLowerCase();\n return ['jpg', 'jpeg', 'png', 'webp'].includes(extension || '');\n };\n\n const formatFileSize = (bytes: number): string => {\n if (bytes === 0) return '0 Bytes';\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n };\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{title}</Text>\n <Text style={styles.instructions}>{instructions}</Text>\n\n <View style={styles.uploadArea}>\n <TouchableOpacity\n style={[\n styles.uploadButton,\n isUploading && styles.uploadButtonDisabled,\n { borderColor: component.ui.themeColor as string || '#2DBD60' }\n ]}\n onPress={pickDocument}\n disabled={isUploading}\n >\n <Text style={styles.uploadIcon}>📁</Text>\n <Text style={[\n styles.uploadText,\n { color: component.ui.themeColor as string || '#2DBD60' }\n ]}>\n {isUploading ? (t('common.processing') || 'Processing...') : (t('kyc.additionalDocs.add') || 'Select Files')}\n </Text>\n <Text style={styles.uploadSubtext}>\n {t('kyc.additionalDocs.maxSize', { size: config.maxSizeEach }) || `Max size: ${config.maxSizeEach}`}\n </Text>\n </TouchableOpacity>\n </View>\n\n {uploadedFiles.length > 0 && (\n <View style={styles.filesContainer}>\n <Text style={styles.subTitle}>\n {t('kyc.additionalDocs.uploaded') || 'Uploaded Documents'} ({uploadedFiles.length}/{maxFiles})\n </Text>\n <ScrollView style={styles.filesList} showsVerticalScrollIndicator={false}>\n {uploadedFiles.map((file, index) => (\n <View key={index} style={styles.fileItem}>\n {isImageFile(file.name) ? (\n <Image source={{ uri: file.uri }} style={styles.fileThumbnail} />\n ) : (\n <View style={styles.fileIcon}>\n <Text style={styles.fileIconText}>{getFileIcon(file.name)}</Text>\n </View>\n )}\n <View style={styles.fileInfo}>\n <Text style={styles.fileName} numberOfLines={1}>{file.name}</Text>\n <Text style={styles.fileSize}>{formatFileSize(file.size)}</Text>\n </View>\n <TouchableOpacity\n style={styles.removeButton}\n onPress={() => removeFile(index)}\n >\n <Text style={styles.removeButtonText}>✕</Text>\n </TouchableOpacity>\n </View>\n ))}\n </ScrollView>\n </View>\n )}\n\n {error && <Text style={styles.errorText}>{error}</Text>}\n\n <Button\n title={buttonText}\n onPress={handleContinue}\n fullWidth\n style={styles.button}\n disabled={config.required && uploadedFiles.length < (config.minDocuments || 1)}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n padding: 20,\n backgroundColor: 'white',\n borderRadius: 12,\n margin: 16,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 2 },\n shadowOpacity: 0.1,\n shadowRadius: 4,\n elevation: 3,\n width: '95%',\n },\n title: {\n fontSize: 22,\n fontWeight: 'bold',\n marginBottom: 10,\n color: '#333',\n },\n instructions: {\n fontSize: 16,\n color: '#666',\n marginBottom: 20,\n lineHeight: 22,\n },\n subTitle: {\n fontSize: 16,\n fontWeight: '600',\n marginBottom: 10,\n color: '#333',\n },\n uploadArea: {\n marginBottom: 20,\n },\n uploadButton: {\n borderWidth: 2,\n borderStyle: 'dashed',\n borderRadius: 12,\n padding: 24,\n alignItems: 'center',\n backgroundColor: '#f0f9f0',\n },\n uploadButtonDisabled: {\n opacity: 0.6,\n },\n uploadIcon: {\n fontSize: 32,\n marginBottom: 8,\n },\n uploadText: {\n fontSize: 16,\n fontWeight: '600',\n marginBottom: 4,\n },\n uploadSubtext: {\n fontSize: 12,\n color: '#666',\n },\n filesContainer: {\n flex: 1,\n marginBottom: 10,\n },\n filesList: {\n maxHeight: 200,\n },\n fileItem: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 10,\n backgroundColor: '#f9f9f9',\n borderRadius: 8,\n marginBottom: 8,\n borderWidth: 1,\n borderColor: '#eee',\n },\n fileThumbnail: {\n width: 36,\n height: 36,\n borderRadius: 4,\n marginRight: 10,\n },\n fileIcon: {\n width: 36,\n height: 36,\n borderRadius: 4,\n backgroundColor: '#eee',\n justifyContent: 'center',\n alignItems: 'center',\n marginRight: 10,\n },\n fileIconText: {\n fontSize: 18,\n },\n fileInfo: {\n flex: 1,\n },\n fileName: {\n fontSize: 14,\n fontWeight: '500',\n color: '#333',\n },\n fileSize: {\n fontSize: 12,\n color: '#888',\n },\n removeButton: {\n width: 24,\n height: 24,\n borderRadius: 12,\n backgroundColor: '#ff4444',\n justifyContent: 'center',\n alignItems: 'center',\n marginLeft: 8,\n },\n removeButtonText: {\n color: 'white',\n fontSize: 12,\n fontWeight: 'bold',\n },\n errorText: {\n color: 'red',\n marginBottom: 10,\n },\n button: {\n marginTop: 10,\n },\n});\n"]}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { TemplateComponent } from '../../types/KYC.types';
3
+ interface EmailVerificationTemplateProps {
4
+ component: TemplateComponent;
5
+ value?: any;
6
+ onValueChange: (data: any) => void;
7
+ error?: string;
8
+ language?: string;
9
+ }
10
+ export declare const EmailVerificationTemplate: React.FC<EmailVerificationTemplateProps>;
11
+ export {};
12
+ //# sourceMappingURL=EmailVerificationTemplate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailVerificationTemplate.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/EmailVerificationTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,uBAAuB,CAAC;AAKzE,UAAU,8BAA8B;IACpC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,aAAa,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,eAAO,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAiK9E,CAAC"}
@@ -0,0 +1,193 @@
1
+ import React, { useState } from 'react';
2
+ import { View, Text, StyleSheet, TextInput, TouchableOpacity, Alert } from 'react-native';
3
+ import { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';
4
+ import { useI18n } from '../../hooks/useI18n';
5
+ import { Button } from '../ui/Button';
6
+ export const EmailVerificationTemplate = ({ component, value, onValueChange, error: propError, }) => {
7
+ const { actions, getLocalizedText } = useTemplateKYCFlowContext();
8
+ const { t } = useI18n();
9
+ // const config = component.config as EmailVerificationConfig; // Keep for future use
10
+ // State
11
+ const [step, setStep] = useState('email');
12
+ const [email, setEmail] = useState('');
13
+ const [otp, setOtp] = useState('');
14
+ const [localError, setLocalError] = useState(null);
15
+ const [isSimulating, setIsSimulating] = useState(false);
16
+ const title = getLocalizedText(component.labels);
17
+ const instructions = getLocalizedText(component.instructions);
18
+ // Determine button text based on step
19
+ const verifyButtonText = getLocalizedText(component.ui.buttonText) || t('common.verify') || 'Verify';
20
+ const sendButtonText = t('common.sendCode') || 'Send Verification Code';
21
+ const buttonText = step === 'email' ? sendButtonText : verifyButtonText;
22
+ const handleSendCode = () => {
23
+ if (!email || !email.includes('@')) {
24
+ setLocalError(t('errors.invalidEmail') || 'Please enter a valid email address');
25
+ return;
26
+ }
27
+ setLocalError(null);
28
+ setIsSimulating(true);
29
+ // Simulate API call to send code
30
+ setTimeout(() => {
31
+ setIsSimulating(false);
32
+ setStep('otp');
33
+ // For demo purposes, we could show an alert or toast here with the code
34
+ // But we'll just expect them to know 123456 or type anything for now if not strict
35
+ }, 1500);
36
+ };
37
+ const handleVerifyCode = () => {
38
+ if (!otp || otp.length < 4) {
39
+ setLocalError(t('errors.invalidCode') || 'Please enter the 6-digit code');
40
+ return;
41
+ }
42
+ setLocalError(null);
43
+ setIsSimulating(true);
44
+ // Simulate verification API
45
+ setTimeout(() => {
46
+ setIsSimulating(false);
47
+ // Mock validation logic
48
+ // Let's accept '123456' as the correct code or any code for testing if strictly requested?
49
+ // User said "verify with error message" implying we should support failure.
50
+ // Let's say if code is "000000" it fails, otherwise success, OR hardcode a success one.
51
+ // User said "verify with error message and next component if is a good one"
52
+ // Let's make "123456" the good one for clarity.
53
+ if (otp === '123456') {
54
+ onValueChange({ email, otp, verified: true });
55
+ actions.nextComponent();
56
+ }
57
+ else {
58
+ setLocalError(t('errors.wrongCode') || 'Invalid verification code. Try 123456');
59
+ }
60
+ }, 1500);
61
+ };
62
+ const onChangeEmail = (text) => {
63
+ setEmail(text);
64
+ if (localError)
65
+ setLocalError(null);
66
+ };
67
+ const onChangeOtp = (text) => {
68
+ setOtp(text);
69
+ if (localError)
70
+ setLocalError(null);
71
+ };
72
+ const handleBackToEmail = () => {
73
+ setStep('email');
74
+ setOtp('');
75
+ setLocalError(null);
76
+ };
77
+ return (<View style={styles.container}>
78
+ <Text style={styles.title}>{title}</Text>
79
+ <Text style={styles.instructions}>
80
+ {step === 'email' ? instructions : (t('kyc.enterCodeSent') || `Please enter the code sent to ${email}`)}
81
+ </Text>
82
+
83
+ <View style={styles.contentContainer}>
84
+ {step === 'email' ? (<View style={styles.inputContainer}>
85
+ <Text style={styles.label}>{t('common.email') || 'Email'}</Text>
86
+ <TextInput style={styles.input} placeholder="name@example.com" value={email} onChangeText={onChangeEmail} keyboardType="email-address" autoCapitalize="none" autoCorrect={false} editable={!isSimulating}/>
87
+ </View>) : (<View style={styles.inputContainer}>
88
+ <Text style={styles.label}>{t('common.verificationCode') || 'Verification Code'}</Text>
89
+ <TextInput style={styles.input} placeholder="123456" value={otp} onChangeText={onChangeOtp} keyboardType="number-pad" maxLength={6} editable={!isSimulating}/>
90
+ <TouchableOpacity onPress={handleBackToEmail} style={styles.changeEmailLink}>
91
+ <Text style={styles.changeEmailText}>{t('common.changeEmail') || 'Change email'}</Text>
92
+ </TouchableOpacity>
93
+ </View>)}
94
+
95
+ {(localError || propError) && (<Text style={styles.errorText}>{localError || propError}</Text>)}
96
+
97
+ <Button title={isSimulating ? (t('common.processing') || 'Processing...') : buttonText} onPress={step === 'email' ? handleSendCode : handleVerifyCode} disabled={isSimulating ||
98
+ (step === 'email' ? !email : !otp)}/>
99
+
100
+ {step === 'otp' && (<TouchableOpacity onPress={() => {
101
+ // Resend logic
102
+ Alert.alert(t('common.codeResent') || 'Code Resent', t('common.codeResentMessage', { email }) || 'Code resent to ' + email);
103
+ }} style={styles.resendButton} disabled={isSimulating}>
104
+ <Text style={styles.resendText}>{t('common.resendCode') || 'Resend Code'}</Text>
105
+ </TouchableOpacity>)}
106
+ </View>
107
+ </View>);
108
+ };
109
+ const styles = StyleSheet.create({
110
+ container: {
111
+ padding: 24,
112
+ backgroundColor: 'white',
113
+ borderRadius: 16,
114
+ margin: 16,
115
+ shadowColor: '#000',
116
+ shadowOffset: { width: 0, height: 4 },
117
+ shadowOpacity: 0.1,
118
+ shadowRadius: 12,
119
+ elevation: 5,
120
+ width: '95%',
121
+ },
122
+ title: {
123
+ fontSize: 24,
124
+ fontWeight: '700',
125
+ marginBottom: 8,
126
+ color: '#1a1a1a',
127
+ textAlign: 'center',
128
+ },
129
+ instructions: {
130
+ fontSize: 16,
131
+ color: '#666',
132
+ marginBottom: 32,
133
+ lineHeight: 24,
134
+ textAlign: 'center',
135
+ },
136
+ contentContainer: {
137
+ // width: '100%',
138
+ },
139
+ inputContainer: {
140
+ marginBottom: 24,
141
+ },
142
+ label: {
143
+ fontSize: 14,
144
+ fontWeight: '600',
145
+ color: '#333',
146
+ marginBottom: 8,
147
+ marginLeft: 4,
148
+ },
149
+ input: {
150
+ borderWidth: 1,
151
+ borderColor: '#e0e0e0',
152
+ padding: 16,
153
+ borderRadius: 12,
154
+ fontSize: 16,
155
+ backgroundColor: '#f8f9fa',
156
+ color: '#333',
157
+ },
158
+ errorText: {
159
+ color: '#dc2626',
160
+ marginBottom: 16,
161
+ fontSize: 14,
162
+ textAlign: 'center',
163
+ backgroundColor: '#fee2e2',
164
+ padding: 8,
165
+ borderRadius: 8,
166
+ overflow: 'hidden',
167
+ },
168
+ button: {
169
+ height: 50,
170
+ borderRadius: 12,
171
+ width: "100%"
172
+ },
173
+ changeEmailLink: {
174
+ alignSelf: 'flex-end',
175
+ marginTop: 8,
176
+ },
177
+ changeEmailText: {
178
+ color: '#2DBD60',
179
+ fontSize: 14,
180
+ fontWeight: '500',
181
+ },
182
+ resendButton: {
183
+ marginTop: 16,
184
+ alignItems: 'center',
185
+ width: "100%"
186
+ },
187
+ resendText: {
188
+ color: '#666',
189
+ fontSize: 14,
190
+ textDecorationLine: 'underline',
191
+ },
192
+ });
193
+ //# sourceMappingURL=EmailVerificationTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmailVerificationTemplate.js","sourceRoot":"","sources":["../../../src/components/KYCElements/EmailVerificationTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAYtC,MAAM,CAAC,MAAM,yBAAyB,GAA6C,CAAC,EAChF,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EAAE,SAAS,GACnB,EAAE,EAAE;IACD,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,EAAE,CAAC;IAClE,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,qFAAqF;IAErF,QAAQ;IACR,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAmB,OAAO,CAAC,CAAC;IAC5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAA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ACd,iBAAiB;KACpB;IACD,cAAc,EAAE;QACZ,YAAY,EAAE,EAAE;KACnB;IACD,KAAK,EAAE;QACH,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,MAAM;QACb,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;KAChB;IACD,KAAK,EAAE;QACH,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,EAAE;QACX,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,eAAe,EAAE,SAAS;QAC1B,KAAK,EAAE,MAAM;KAChB;IACD,SAAS,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,CAAC;QACf,QAAQ,EAAE,QAAQ;KACrB;IACD,MAAM,EAAE;QACJ,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,KAAK,EAAE,MAAM;KAChB;IACD,eAAe,EAAE;QACb,SAAS,EAAE,UAAU;QACrB,SAAS,EAAE,CAAC;KACf;IACD,eAAe,EAAE;QACb,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACV,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,MAAM;KAChB;IACD,UAAU,EAAE;QACR,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,WAAW;KAClC;CACJ,CAAC,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { View, Text, StyleSheet, TextInput, TouchableOpacity, Alert } from 'react-native';\nimport { TemplateComponent, LocalizedText } from '../../types/KYC.types';\nimport { useTemplateKYCFlowContext } from '../../hooks/useTemplateKYCFlow';\nimport { useI18n } from '../../hooks/useI18n';\nimport { Button } from '../ui/Button';\n\ninterface EmailVerificationTemplateProps {\n component: TemplateComponent;\n value?: any;\n onValueChange: (data: any) => void;\n error?: string;\n language?: string;\n}\n\ntype VerificationStep = 'email' | 'otp';\n\nexport const EmailVerificationTemplate: React.FC<EmailVerificationTemplateProps> = ({\n component,\n value,\n onValueChange,\n error: propError,\n}) => {\n const { actions, getLocalizedText } = useTemplateKYCFlowContext();\n const { t } = useI18n();\n // const config = component.config as EmailVerificationConfig; // Keep for future use\n\n // State\n const [step, setStep] = useState<VerificationStep>('email');\n const [email, setEmail] = useState('');\n const [otp, setOtp] = useState('');\n const [localError, setLocalError] = useState<string | null>(null);\n const [isSimulating, setIsSimulating] = useState(false);\n\n const title = getLocalizedText(component.labels as LocalizedText);\n const instructions = getLocalizedText(component.instructions as LocalizedText);\n\n // Determine button text based on step\n const verifyButtonText = getLocalizedText((component.ui as any).buttonText) || t('common.verify') || 'Verify';\n const sendButtonText = t('common.sendCode') || 'Send Verification Code';\n const buttonText = step === 'email' ? sendButtonText : verifyButtonText;\n\n const handleSendCode = () => {\n if (!email || !email.includes('@')) {\n setLocalError(t('errors.invalidEmail') || 'Please enter a valid email address');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n // Simulate API call to send code\n setTimeout(() => {\n setIsSimulating(false);\n setStep('otp');\n // For demo purposes, we could show an alert or toast here with the code\n // But we'll just expect them to know 123456 or type anything for now if not strict\n }, 1500);\n };\n\n const handleVerifyCode = () => {\n if (!otp || otp.length < 4) {\n setLocalError(t('errors.invalidCode') || 'Please enter the 6-digit code');\n return;\n }\n\n setLocalError(null);\n setIsSimulating(true);\n\n // Simulate verification API\n setTimeout(() => {\n setIsSimulating(false);\n\n // Mock validation logic\n // Let's accept '123456' as the correct code or any code for testing if strictly requested?\n // User said \"verify with error message\" implying we should support failure.\n // Let's say if code is \"000000\" it fails, otherwise success, OR hardcode a success one.\n // User said \"verify with error message and next component if is a good one\"\n // Let's make \"123456\" the good one for clarity.\n\n if (otp === '123456') {\n onValueChange({ email, otp, verified: true });\n actions.nextComponent();\n } else {\n setLocalError(t('errors.wrongCode') || 'Invalid verification code. Try 123456');\n }\n }, 1500);\n };\n\n const onChangeEmail = (text: string) => {\n setEmail(text);\n if (localError) setLocalError(null);\n };\n\n const onChangeOtp = (text: string) => {\n setOtp(text);\n if (localError) setLocalError(null);\n };\n\n const handleBackToEmail = () => {\n setStep('email');\n setOtp('');\n setLocalError(null);\n };\n\n return (\n <View style={styles.container}>\n <Text style={styles.title}>{title}</Text>\n <Text style={styles.instructions}>\n {step === 'email' ? instructions : (t('kyc.enterCodeSent') || `Please enter the code sent to ${email}`)}\n </Text>\n\n <View style={styles.contentContainer}>\n {step === 'email' ? (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.email') || 'Email'}</Text>\n <TextInput\n style={styles.input}\n placeholder=\"name@example.com\"\n value={email}\n onChangeText={onChangeEmail}\n keyboardType=\"email-address\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n editable={!isSimulating}\n />\n </View>\n ) : (\n <View style={styles.inputContainer}>\n <Text style={styles.label}>{t('common.verificationCode') || 'Verification Code'}</Text>\n <TextInput\n style={styles.input}\n placeholder=\"123456\"\n value={otp}\n onChangeText={onChangeOtp}\n keyboardType=\"number-pad\"\n maxLength={6}\n editable={!isSimulating}\n />\n <TouchableOpacity onPress={handleBackToEmail} style={styles.changeEmailLink}>\n <Text style={styles.changeEmailText}>{t('common.changeEmail') || 'Change email'}</Text>\n </TouchableOpacity>\n </View>\n )}\n\n {(localError || propError) && (\n <Text style={styles.errorText}>{localError || propError}</Text>\n )}\n\n <Button\n title={isSimulating ? (t('common.processing') || 'Processing...') : buttonText}\n onPress={step === 'email' ? handleSendCode : handleVerifyCode}\n\n\n disabled={\n isSimulating ||\n (step === 'email' ? !email : !otp)\n }\n />\n\n {step === 'otp' && (\n <TouchableOpacity\n onPress={() => {\n // Resend logic\n Alert.alert(\n t('common.codeResent') || 'Code Resent',\n t('common.codeResentMessage', { email }) || 'Code resent to ' + email\n );\n }}\n style={styles.resendButton}\n disabled={isSimulating}\n >\n <Text style={styles.resendText}>{t('common.resendCode') || 'Resend Code'}</Text>\n </TouchableOpacity>\n )}\n </View>\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n padding: 24,\n backgroundColor: 'white',\n borderRadius: 16,\n margin: 16,\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 4 },\n shadowOpacity: 0.1,\n shadowRadius: 12,\n elevation: 5,\n width: '95%',\n },\n title: {\n fontSize: 24,\n fontWeight: '700',\n marginBottom: 8,\n color: '#1a1a1a',\n textAlign: 'center',\n },\n instructions: {\n fontSize: 16,\n color: '#666',\n marginBottom: 32,\n lineHeight: 24,\n textAlign: 'center',\n },\n contentContainer: {\n // width: '100%',\n },\n inputContainer: {\n marginBottom: 24,\n },\n label: {\n fontSize: 14,\n fontWeight: '600',\n color: '#333',\n marginBottom: 8,\n marginLeft: 4,\n },\n input: {\n borderWidth: 1,\n borderColor: '#e0e0e0',\n padding: 16,\n borderRadius: 12,\n fontSize: 16,\n backgroundColor: '#f8f9fa',\n color: '#333',\n },\n errorText: {\n color: '#dc2626',\n marginBottom: 16,\n fontSize: 14,\n textAlign: 'center',\n backgroundColor: '#fee2e2',\n padding: 8,\n borderRadius: 8,\n overflow: 'hidden',\n },\n button: {\n height: 50,\n borderRadius: 12,\n width: \"100%\"\n },\n changeEmailLink: {\n alignSelf: 'flex-end',\n marginTop: 8,\n },\n changeEmailText: {\n color: '#2DBD60',\n fontSize: 14,\n fontWeight: '500',\n },\n resendButton: {\n marginTop: 16,\n alignItems: 'center',\n width: \"100%\"\n },\n resendText: {\n color: '#666',\n fontSize: 14,\n textDecorationLine: 'underline',\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IDCardCapture.d.ts","sourceRoot":"","sources":["../../../src/components/KYCElements/IDCardCapture.tsx"],"names":[],"mappings":"AAAA,O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