@airxpay/sdk-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,510 @@
1
+ "use strict";
2
+ // components/steps/KYCVerification.tsx
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const react_1 = __importStar(require("react"));
41
+ const react_native_1 = require("react-native");
42
+ const react_native_paper_1 = require("react-native-paper");
43
+ const expo_linear_gradient_1 = require("expo-linear-gradient");
44
+ const FileUploader_1 = __importDefault(require("../common/FileUploader"));
45
+ const REQUIRED_DOCUMENTS = [
46
+ { key: 'panCardUrl', label: 'PAN Card', required: true, icon: 'card-account-details', description: 'Clear image of PAN card' },
47
+ { key: 'aadhaarUrl', label: 'Aadhaar Card', required: true, icon: 'card-bulleted', description: 'Both sides of Aadhaar' },
48
+ { key: 'selfieUrl', label: 'Selfie', required: true, icon: 'face', description: 'Clear front-facing photo' },
49
+ { key: 'addressProofUrl', label: 'Address Proof', required: false, icon: 'home', description: 'Utility bill or rent agreement' },
50
+ { key: 'businessRegistrationUrl', label: 'Business Registration', required: false, icon: 'file-document', description: 'GST, MSME, or company registration' },
51
+ { key: 'gstCertificateUrl', label: 'GST Certificate', required: false, icon: 'file-certificate', description: 'If applicable' },
52
+ ];
53
+ const KYCVerification = ({ initialData, mode, kycStatus, onNext, onBack, }) => {
54
+ const [documents, setDocuments] = (0, react_1.useState)(initialData.kycDocuments || {});
55
+ const [uploadingFor, setUploadingFor] = (0, react_1.useState)(null);
56
+ const handleDocumentUpload = async (documentKey, file) => {
57
+ setUploadingFor(documentKey);
58
+ setTimeout(() => {
59
+ setDocuments(prev => ({ ...prev, [documentKey]: file.uri || 'uploaded_file.jpg' }));
60
+ setUploadingFor(null);
61
+ if (mode === 'test') {
62
+ react_native_1.Alert.alert('Test Mode', 'Document would be auto-approved in test mode');
63
+ }
64
+ }, 1000);
65
+ };
66
+ const handleDocumentRemove = (documentKey) => {
67
+ react_native_1.Alert.alert('Remove Document', 'Are you sure you want to remove this document?', [
68
+ { text: 'Cancel', style: 'cancel' },
69
+ {
70
+ text: 'Remove',
71
+ style: 'destructive',
72
+ onPress: () => {
73
+ const updated = { ...documents };
74
+ delete updated[documentKey];
75
+ setDocuments(updated);
76
+ },
77
+ },
78
+ ]);
79
+ };
80
+ const getKYCStatusBadge = () => {
81
+ switch (kycStatus) {
82
+ case 'verified':
83
+ return (<react_native_1.View style={[styles.statusBadge, styles.verified]}>
84
+ <react_native_paper_1.IconButton icon="check-circle" size={14} iconColor="#10B981"/>
85
+ <react_native_1.Text style={styles.statusTextVerified}>Verified</react_native_1.Text>
86
+ </react_native_1.View>);
87
+ case 'pending':
88
+ return (<react_native_1.View style={[styles.statusBadge, styles.pending]}>
89
+ <react_native_paper_1.IconButton icon="clock-outline" size={14} iconColor="#D97706"/>
90
+ <react_native_1.Text style={styles.statusTextPending}>Pending</react_native_1.Text>
91
+ </react_native_1.View>);
92
+ case 'rejected':
93
+ return (<react_native_1.View style={[styles.statusBadge, styles.rejected]}>
94
+ <react_native_paper_1.IconButton icon="alert-circle" size={14} iconColor="#DC2626"/>
95
+ <react_native_1.Text style={styles.statusTextRejected}>Rejected</react_native_1.Text>
96
+ </react_native_1.View>);
97
+ default:
98
+ return (<react_native_1.View style={[styles.statusBadge, styles.notSubmitted]}>
99
+ <react_native_paper_1.IconButton icon="clock-outline" size={14} iconColor="#6B7280"/>
100
+ <react_native_1.Text style={styles.statusTextNotSubmitted}>Not Submitted</react_native_1.Text>
101
+ </react_native_1.View>);
102
+ }
103
+ };
104
+ const isRequiredDocumentsUploaded = () => {
105
+ return REQUIRED_DOCUMENTS
106
+ .filter(doc => doc.required)
107
+ .every(doc => documents[doc.key]);
108
+ };
109
+ const handleSubmit = () => {
110
+ if (mode === 'test') {
111
+ onNext({
112
+ kycDocuments: documents,
113
+ isKycCompleted: true,
114
+ kycStatus: 'verified',
115
+ });
116
+ }
117
+ else {
118
+ onNext({
119
+ kycDocuments: documents,
120
+ isKycCompleted: false,
121
+ kycStatus: 'pending',
122
+ });
123
+ }
124
+ };
125
+ const requiredDocsCount = REQUIRED_DOCUMENTS.filter(doc => doc.required).length;
126
+ const uploadedRequiredCount = REQUIRED_DOCUMENTS.filter(doc => doc.required && documents[doc.key]).length;
127
+ const progress = (uploadedRequiredCount / requiredDocsCount) * 100;
128
+ return (<react_native_1.View style={styles.container}>
129
+ <expo_linear_gradient_1.LinearGradient colors={['#FFFFFF', '#F8F9FA']} style={styles.gradient}>
130
+ <react_native_1.ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={styles.scrollContent}>
131
+ {/* Header Card */}
132
+ <react_native_paper_1.Surface style={styles.headerCard}>
133
+ <react_native_1.View style={styles.headerIcon}>
134
+ <react_native_paper_1.IconButton icon="shield-account" size={24} iconColor="#0066CC"/>
135
+ </react_native_1.View>
136
+ <react_native_1.View style={styles.headerText}>
137
+ <react_native_1.Text style={styles.title}>KYC Verification</react_native_1.Text>
138
+ <react_native_1.Text style={styles.subtitle}>
139
+ Upload your documents for verification
140
+ </react_native_1.Text>
141
+ </react_native_1.View>
142
+ </react_native_paper_1.Surface>
143
+
144
+ {/* Form Card */}
145
+ <react_native_paper_1.Surface style={styles.formCard}>
146
+ {/* Progress Steps */}
147
+ <react_native_1.View style={styles.progressContainer}>
148
+ <react_native_1.View style={styles.progressStep}>
149
+ <react_native_1.View style={[styles.progressDot, styles.progressDotCompleted]}>
150
+ <react_native_paper_1.IconButton icon="check" size={12} iconColor="#FFFFFF"/>
151
+ </react_native_1.View>
152
+ <react_native_1.Text style={styles.progressTextCompleted}>Basic</react_native_1.Text>
153
+ </react_native_1.View>
154
+ <react_native_1.View style={styles.progressLine}/>
155
+ <react_native_1.View style={styles.progressStep}>
156
+ <expo_linear_gradient_1.LinearGradient colors={['#0066CC', '#0099FF']} style={styles.progressDotActive}/>
157
+ <react_native_1.Text style={styles.progressTextActive}>KYC</react_native_1.Text>
158
+ </react_native_1.View>
159
+ <react_native_1.View style={styles.progressLine}/>
160
+ <react_native_1.View style={styles.progressStep}>
161
+ <react_native_1.View style={[styles.progressDot, styles.progressDotInactive]}/>
162
+ <react_native_1.Text style={styles.progressText}>Bank</react_native_1.Text>
163
+ </react_native_1.View>
164
+ </react_native_1.View>
165
+
166
+ {/* KYC Status */}
167
+ <react_native_1.View style={styles.statusContainer}>
168
+ <react_native_1.Text style={styles.statusLabel}>Status:</react_native_1.Text>
169
+ {getKYCStatusBadge()}
170
+ </react_native_1.View>
171
+
172
+ {/* Upload Progress */}
173
+ <react_native_1.View style={styles.progressBarContainer}>
174
+ <react_native_1.View style={styles.progressBar}>
175
+ <expo_linear_gradient_1.LinearGradient colors={['#0066CC', '#0099FF']} style={[styles.progressFill, { width: `${progress}%` }]} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}/>
176
+ </react_native_1.View>
177
+ <react_native_1.Text style={styles.progressText}>
178
+ {uploadedRequiredCount}/{requiredDocsCount} Required
179
+ </react_native_1.Text>
180
+ </react_native_1.View>
181
+
182
+ {/* Rejection Message */}
183
+ {kycStatus === 'rejected' && (<react_native_paper_1.Surface style={styles.rejectionCard}>
184
+ <react_native_1.View style={styles.rejectionContent}>
185
+ <react_native_paper_1.IconButton icon="alert-circle" size={16} iconColor="#DC2626"/>
186
+ <react_native_1.View style={styles.rejectionText}>
187
+ <react_native_1.Text style={styles.rejectionTitle}>KYC Rejected</react_native_1.Text>
188
+ <react_native_1.Text style={styles.rejectionMessage}>
189
+ Please upload clear, valid documents
190
+ </react_native_1.Text>
191
+ </react_native_1.View>
192
+ </react_native_1.View>
193
+ </react_native_paper_1.Surface>)}
194
+
195
+ {/* Document Upload Sections */}
196
+ <react_native_1.View style={styles.documentsContainer}>
197
+ {REQUIRED_DOCUMENTS.map((doc, index) => (<react_native_1.View key={doc.key} style={styles.documentItem}>
198
+ {index > 0 && <react_native_1.View style={styles.documentDivider}/>}
199
+ <FileUploader_1.default label={doc.label} required={doc.required} description={doc.description} icon={doc.icon} value={documents[doc.key]} onUpload={(file) => handleDocumentUpload(doc.key, file)} onRemove={() => handleDocumentRemove(doc.key)} uploading={uploadingFor === doc.key} mode={mode}/>
200
+ </react_native_1.View>))}
201
+ </react_native_1.View>
202
+
203
+ {/* Test Mode Notice */}
204
+ {mode === 'test' && (<react_native_paper_1.Surface style={styles.testModeCard}>
205
+ <react_native_1.View style={styles.testModeContent}>
206
+ <react_native_paper_1.IconButton icon="flask" size={16} iconColor="#92400E"/>
207
+ <react_native_1.View style={styles.testModeText}>
208
+ <react_native_1.Text style={styles.testModeTitle}>Test Mode Active</react_native_1.Text>
209
+ <react_native_1.Text style={styles.testModeDescription}>
210
+ Auto-approved in test mode
211
+ </react_native_1.Text>
212
+ </react_native_1.View>
213
+ </react_native_1.View>
214
+ </react_native_paper_1.Surface>)}
215
+
216
+ {/* Action Buttons */}
217
+ <react_native_1.View style={styles.buttonContainer}>
218
+ <react_native_1.TouchableOpacity style={styles.backButton} onPress={onBack}>
219
+ <react_native_1.Text style={styles.backButtonText}>Back</react_native_1.Text>
220
+ </react_native_1.TouchableOpacity>
221
+
222
+ <react_native_1.TouchableOpacity style={[
223
+ styles.submitButton,
224
+ !isRequiredDocumentsUploaded() && styles.submitButtonDisabled
225
+ ]} onPress={handleSubmit} disabled={!isRequiredDocumentsUploaded()}>
226
+ <expo_linear_gradient_1.LinearGradient colors={isRequiredDocumentsUploaded() ? ['#0066CC', '#0099FF'] : ['#9CA3AF', '#9CA3AF']} style={styles.submitGradient} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }}>
227
+ <react_native_1.Text style={styles.submitButtonText}>
228
+ {mode === 'test' ? 'Continue' : 'Submit KYC'}
229
+ </react_native_1.Text>
230
+ </expo_linear_gradient_1.LinearGradient>
231
+ </react_native_1.TouchableOpacity>
232
+ </react_native_1.View>
233
+ </react_native_paper_1.Surface>
234
+ </react_native_1.ScrollView>
235
+ </expo_linear_gradient_1.LinearGradient>
236
+ </react_native_1.View>);
237
+ };
238
+ const styles = react_native_1.StyleSheet.create({
239
+ container: {
240
+ flex: 1,
241
+ backgroundColor: '#FFFFFF',
242
+ },
243
+ gradient: {
244
+ flex: 1,
245
+ },
246
+ scrollContent: {
247
+ padding: 12,
248
+ },
249
+ headerCard: {
250
+ flexDirection: 'row',
251
+ alignItems: 'center',
252
+ padding: 12,
253
+ backgroundColor: '#FFFFFF',
254
+ borderRadius: 16,
255
+ marginBottom: 12,
256
+ elevation: 2,
257
+ shadowColor: '#000',
258
+ shadowOffset: { width: 0, height: 2 },
259
+ shadowOpacity: 0.1,
260
+ shadowRadius: 4,
261
+ },
262
+ headerIcon: {
263
+ width: 40,
264
+ height: 40,
265
+ borderRadius: 20,
266
+ backgroundColor: '#F0F7FF',
267
+ justifyContent: 'center',
268
+ alignItems: 'center',
269
+ marginRight: 12,
270
+ },
271
+ headerText: {
272
+ flex: 1,
273
+ },
274
+ title: {
275
+ fontSize: 18,
276
+ fontWeight: '700',
277
+ color: '#111827',
278
+ },
279
+ subtitle: {
280
+ fontSize: 12,
281
+ color: '#6B7280',
282
+ marginTop: 2,
283
+ },
284
+ formCard: {
285
+ backgroundColor: '#FFFFFF',
286
+ borderRadius: 20,
287
+ padding: 16,
288
+ elevation: 2,
289
+ shadowColor: '#000',
290
+ shadowOffset: { width: 0, height: 2 },
291
+ shadowOpacity: 0.1,
292
+ shadowRadius: 4,
293
+ },
294
+ progressContainer: {
295
+ flexDirection: 'row',
296
+ alignItems: 'center',
297
+ justifyContent: 'center',
298
+ marginBottom: 16,
299
+ paddingHorizontal: 8,
300
+ },
301
+ progressStep: {
302
+ alignItems: 'center',
303
+ },
304
+ progressDot: {
305
+ width: 24,
306
+ height: 24,
307
+ borderRadius: 12,
308
+ justifyContent: 'center',
309
+ alignItems: 'center',
310
+ },
311
+ progressDotCompleted: {
312
+ backgroundColor: '#10B981',
313
+ },
314
+ progressDotActive: {
315
+ width: 24,
316
+ height: 24,
317
+ borderRadius: 12,
318
+ },
319
+ progressDotInactive: {
320
+ backgroundColor: '#E5E7EB',
321
+ },
322
+ progressLine: {
323
+ width: 30,
324
+ height: 2,
325
+ backgroundColor: '#E5E7EB',
326
+ marginHorizontal: 4,
327
+ },
328
+ progressTextCompleted: {
329
+ fontSize: 9,
330
+ color: '#10B981',
331
+ marginTop: 4,
332
+ fontWeight: '500',
333
+ },
334
+ progressTextActive: {
335
+ fontSize: 9,
336
+ color: '#0066CC',
337
+ marginTop: 4,
338
+ fontWeight: '600',
339
+ },
340
+ progressText: {
341
+ fontSize: 9,
342
+ color: '#9CA3AF',
343
+ marginTop: 4,
344
+ },
345
+ statusContainer: {
346
+ flexDirection: 'row',
347
+ alignItems: 'center',
348
+ marginBottom: 12,
349
+ gap: 8,
350
+ },
351
+ statusLabel: {
352
+ fontSize: 12,
353
+ fontWeight: '500',
354
+ color: '#374151',
355
+ },
356
+ statusBadge: {
357
+ flexDirection: 'row',
358
+ alignItems: 'center',
359
+ paddingHorizontal: 8,
360
+ paddingVertical: 2,
361
+ borderRadius: 12,
362
+ height: 24,
363
+ },
364
+ verified: {
365
+ backgroundColor: '#D1FAE5',
366
+ },
367
+ pending: {
368
+ backgroundColor: '#FEF3C7',
369
+ },
370
+ rejected: {
371
+ backgroundColor: '#FEE2E2',
372
+ },
373
+ notSubmitted: {
374
+ backgroundColor: '#F3F4F6',
375
+ },
376
+ statusTextVerified: {
377
+ fontSize: 11,
378
+ color: '#10B981',
379
+ fontWeight: '500',
380
+ marginRight: 4,
381
+ },
382
+ statusTextPending: {
383
+ fontSize: 11,
384
+ color: '#D97706',
385
+ fontWeight: '500',
386
+ marginRight: 4,
387
+ },
388
+ statusTextRejected: {
389
+ fontSize: 11,
390
+ color: '#DC2626',
391
+ fontWeight: '500',
392
+ marginRight: 4,
393
+ },
394
+ statusTextNotSubmitted: {
395
+ fontSize: 11,
396
+ color: '#6B7280',
397
+ fontWeight: '500',
398
+ marginRight: 4,
399
+ },
400
+ progressBarContainer: {
401
+ marginBottom: 16,
402
+ },
403
+ progressBar: {
404
+ height: 4,
405
+ backgroundColor: '#E5E7EB',
406
+ borderRadius: 2,
407
+ overflow: 'hidden',
408
+ marginBottom: 4,
409
+ },
410
+ progressFill: {
411
+ height: '100%',
412
+ borderRadius: 2,
413
+ },
414
+ rejectionCard: {
415
+ backgroundColor: '#FEE2E2',
416
+ borderRadius: 10,
417
+ marginBottom: 12,
418
+ overflow: 'hidden',
419
+ },
420
+ rejectionContent: {
421
+ flexDirection: 'row',
422
+ alignItems: 'center',
423
+ padding: 8,
424
+ },
425
+ rejectionText: {
426
+ flex: 1,
427
+ },
428
+ rejectionTitle: {
429
+ fontSize: 12,
430
+ fontWeight: '600',
431
+ color: '#991B1B',
432
+ },
433
+ rejectionMessage: {
434
+ fontSize: 11,
435
+ color: '#7F1D1D',
436
+ marginTop: 1,
437
+ },
438
+ documentsContainer: {
439
+ marginBottom: 8,
440
+ },
441
+ documentItem: {
442
+ marginBottom: 8,
443
+ },
444
+ documentDivider: {
445
+ height: 1,
446
+ backgroundColor: '#F3F4F6',
447
+ marginBottom: 8,
448
+ },
449
+ testModeCard: {
450
+ backgroundColor: '#FEF3C7',
451
+ borderRadius: 10,
452
+ marginVertical: 8,
453
+ overflow: 'hidden',
454
+ },
455
+ testModeContent: {
456
+ flexDirection: 'row',
457
+ alignItems: 'center',
458
+ padding: 8,
459
+ },
460
+ testModeText: {
461
+ flex: 1,
462
+ },
463
+ testModeTitle: {
464
+ fontSize: 12,
465
+ fontWeight: '600',
466
+ color: '#92400E',
467
+ },
468
+ testModeDescription: {
469
+ fontSize: 11,
470
+ color: '#92400E',
471
+ marginTop: 1,
472
+ },
473
+ buttonContainer: {
474
+ flexDirection: 'row',
475
+ gap: 8,
476
+ marginTop: 12,
477
+ },
478
+ backButton: {
479
+ flex: 1,
480
+ paddingVertical: 8,
481
+ borderRadius: 10,
482
+ borderWidth: 1,
483
+ borderColor: '#E5E7EB',
484
+ alignItems: 'center',
485
+ backgroundColor: '#FFFFFF',
486
+ },
487
+ backButtonText: {
488
+ fontSize: 12,
489
+ fontWeight: '500',
490
+ color: '#6B7280',
491
+ },
492
+ submitButton: {
493
+ flex: 2,
494
+ borderRadius: 10,
495
+ overflow: 'hidden',
496
+ },
497
+ submitButtonDisabled: {
498
+ opacity: 0.7,
499
+ },
500
+ submitGradient: {
501
+ paddingVertical: 8,
502
+ alignItems: 'center',
503
+ },
504
+ submitButtonText: {
505
+ fontSize: 12,
506
+ fontWeight: '600',
507
+ color: '#FFFFFF',
508
+ },
509
+ });
510
+ exports.default = KYCVerification;