@airxpay/sdk-ui 1.0.3 → 1.0.6

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 (40) hide show
  1. package/README.md +186 -216
  2. package/dist/api/merchant.d.ts +11 -0
  3. package/dist/api/{seller.js → merchant.js} +12 -3
  4. package/dist/components/common/FileUploader.d.ts +1 -1
  5. package/dist/components/common/StepIndicator.d.ts +1 -1
  6. package/dist/components/steps/BankDetails.d.ts +3 -3
  7. package/dist/components/steps/BankDetails.js +223 -162
  8. package/dist/components/steps/BasicDetailsForm.d.ts +3 -3
  9. package/dist/components/steps/BasicDetailsForm.js +143 -144
  10. package/dist/components/steps/KYCVerification.d.ts +3 -3
  11. package/dist/components/steps/KYCVerification.js +290 -123
  12. package/dist/components/steps/OnboardingComplete.d.ts +3 -3
  13. package/dist/components/steps/OnboardingComplete.js +112 -36
  14. package/dist/components/ui/MerchantOnboard/MerchantOnboarding.d.ts +4 -0
  15. package/dist/components/ui/{SellerOnboard/SellerOnboarding.js → MerchantOnboard/MerchantOnboarding.js} +250 -79
  16. package/dist/contexts/AirXPayProvider.d.ts +14 -7
  17. package/dist/contexts/AirXPayProvider.js +40 -89
  18. package/dist/hooks/{SellerOnboarding.js → MerchantOnboarding.js} +2 -2
  19. package/dist/hooks/useAirXPayReady.d.ts +6 -0
  20. package/dist/hooks/useAirXPayReady.js +27 -0
  21. package/dist/index.d.ts +7 -4
  22. package/dist/index.js +10 -9
  23. package/dist/sdk/airxpay.d.ts +1 -2
  24. package/dist/sdk/airxpay.js +2 -5
  25. package/dist/types/dev.js +1 -2
  26. package/dist/types/dev.ts +2 -2
  27. package/dist/types/{sellertypes.d.ts → merchantTypes.d.ts} +29 -14
  28. package/dist/types/merchantTypes.js +3 -0
  29. package/dist/types/merchantTypes.ts +94 -0
  30. package/dist/types/type.d.ts +4 -5
  31. package/dist/types/type.js +1 -0
  32. package/dist/types/type.ts +7 -5
  33. package/package.json +1 -1
  34. package/dist/api/seller.d.ts +0 -9
  35. package/dist/components/ui/SellerOnboard/SellerOnboarding.d.ts +0 -4
  36. package/dist/types/sellertypes.js +0 -4
  37. package/dist/types/sellertypes.ts +0 -85
  38. /package/dist/components/ui/{SellerOnboard → MerchantOnboard}/CustomSegmentedButtons.d.ts +0 -0
  39. /package/dist/components/ui/{SellerOnboard → MerchantOnboard}/CustomSegmentedButtons.js +0 -0
  40. /package/dist/hooks/{SellerOnboarding.d.ts → MerchantOnboarding.d.ts} +0 -0
@@ -38,15 +38,21 @@ const react_1 = __importStar(require("react"));
38
38
  const react_native_1 = require("react-native");
39
39
  const react_native_paper_1 = require("react-native-paper");
40
40
  const expo_linear_gradient_1 = require("expo-linear-gradient");
41
- const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetailsCompleted, isKycCompleted, isBasicCompleted, onComplete, isWaitingForBackend, onBackendConfirmed, }) => {
41
+ const { width } = react_native_1.Dimensions.get('window');
42
+ const OnboardingComplete = ({ merchantData, mode, status, kycStatus, isBankDetailsCompleted, isKycCompleted, isBasicCompleted, onComplete, isWaitingForBackend, onBackendConfirmed, }) => {
42
43
  const [backendConfirmed, setBackendConfirmed] = (0, react_1.useState)(false);
43
- const fadeAnim = react_1.default.useRef(new react_native_1.Animated.Value(0)).current;
44
- const scaleAnim = react_1.default.useRef(new react_native_1.Animated.Value(0.9)).current;
44
+ const [retryCount, setRetryCount] = (0, react_1.useState)(0);
45
+ // Animation values
46
+ const fadeAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
47
+ const scaleAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(0.9)).current;
48
+ const slideAnim = (0, react_1.useRef)(new react_native_1.Animated.Value(30)).current;
45
49
  // Simulate backend confirmation (in real app, this would come from props/context)
46
50
  (0, react_1.useEffect)(() => {
47
- if (isWaitingForBackend) {
48
- // This is where you'd listen for backend confirmation
49
- // For now, we'll simulate it with a timeout
51
+ if (isWaitingForBackend && !backendConfirmed) {
52
+ // In a real app, you would listen for a backend event or poll an API
53
+ // This is where you'd set up your real backend confirmation listener
54
+ console.log('Waiting for backend confirmation...');
55
+ // For demo purposes, simulate backend confirmation
50
56
  const timer = setTimeout(() => {
51
57
  setBackendConfirmed(true);
52
58
  onBackendConfirmed();
@@ -63,11 +69,37 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
63
69
  tension: 40,
64
70
  useNativeDriver: true,
65
71
  }),
72
+ react_native_1.Animated.timing(slideAnim, {
73
+ toValue: 0,
74
+ duration: 500,
75
+ useNativeDriver: true,
76
+ }),
66
77
  ]).start();
67
- }, 3000); // Simulate 3 second backend processing
78
+ }, 3000);
68
79
  return () => clearTimeout(timer);
69
80
  }
70
- }, [isWaitingForBackend]);
81
+ else if (!isWaitingForBackend && !backendConfirmed) {
82
+ // If not waiting for backend, animate immediately
83
+ react_native_1.Animated.parallel([
84
+ react_native_1.Animated.timing(fadeAnim, {
85
+ toValue: 1,
86
+ duration: 500,
87
+ useNativeDriver: true,
88
+ }),
89
+ react_native_1.Animated.spring(scaleAnim, {
90
+ toValue: 1,
91
+ friction: 8,
92
+ tension: 40,
93
+ useNativeDriver: true,
94
+ }),
95
+ react_native_1.Animated.timing(slideAnim, {
96
+ toValue: 0,
97
+ duration: 500,
98
+ useNativeDriver: true,
99
+ }),
100
+ ]).start();
101
+ }
102
+ }, [isWaitingForBackend, backendConfirmed, onBackendConfirmed]);
71
103
  const getStatusColor = (status) => {
72
104
  switch (status) {
73
105
  case 'active':
@@ -105,6 +137,20 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
105
137
  }
106
138
  };
107
139
  const isFullyActive = status === 'active' && kycStatus === 'verified' && isBankDetailsCompleted;
140
+ // Validate all required data before completing
141
+ (0, react_1.useEffect)(() => {
142
+ if (isBasicCompleted && isKycCompleted && isBankDetailsCompleted && !isWaitingForBackend && !backendConfirmed) {
143
+ // All steps completed, trigger onComplete
144
+ onComplete();
145
+ }
146
+ }, [isBasicCompleted, isKycCompleted, isBankDetailsCompleted, isWaitingForBackend, backendConfirmed, onComplete]);
147
+ // Retry function for failed backend confirmation
148
+ const handleRetry = () => {
149
+ setRetryCount(prev => prev + 1);
150
+ setBackendConfirmed(false);
151
+ // Trigger backend confirmation again
152
+ onBackendConfirmed();
153
+ };
108
154
  // Loading State
109
155
  if (isWaitingForBackend && !backendConfirmed) {
110
156
  return (<react_native_1.View style={styles.container}>
@@ -118,7 +164,7 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
118
164
 
119
165
  <react_native_1.Text style={styles.loadingTitle}>Creating Your Account</react_native_1.Text>
120
166
  <react_native_1.Text style={styles.loadingSubtitle}>
121
- Please wait while we set up your seller account...
167
+ Please wait while we set up your merchant account...
122
168
  </react_native_1.Text>
123
169
 
124
170
  {/* Step Status Indicators */}
@@ -165,6 +211,10 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
165
211
  <react_native_paper_1.ActivityIndicator size="small" color="#0066CC"/>
166
212
  <react_native_1.Text style={styles.processingText}>Processing...</react_native_1.Text>
167
213
  </react_native_1.View>
214
+
215
+ {retryCount > 0 && (<react_native_1.TouchableOpacity onPress={handleRetry} style={styles.retryButton}>
216
+ <react_native_1.Text style={styles.retryText}>Retry</react_native_1.Text>
217
+ </react_native_1.TouchableOpacity>)}
168
218
  </react_native_paper_1.Surface>
169
219
  </react_native_1.View>
170
220
  </expo_linear_gradient_1.LinearGradient>
@@ -179,7 +229,10 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
179
229
  styles.headerCard,
180
230
  {
181
231
  opacity: fadeAnim,
182
- transform: [{ scale: scaleAnim }]
232
+ transform: [
233
+ { scale: scaleAnim },
234
+ { translateY: slideAnim }
235
+ ]
183
236
  }
184
237
  ]}>
185
238
  <react_native_paper_1.Surface style={styles.headerCardSurface}>
@@ -192,14 +245,14 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
192
245
  <react_native_1.Text style={styles.title}>Onboarding Complete!</react_native_1.Text>
193
246
  <react_native_1.Text style={styles.subtitle}>
194
247
  {isFullyActive
195
- ? 'Your seller account is fully active'
196
- : 'Your seller account has been created'}
248
+ ? 'Your merchant account is fully active'
249
+ : 'Your merchant account has been created'}
197
250
  </react_native_1.Text>
198
251
  </react_native_1.View>
199
252
  </react_native_paper_1.Surface>
200
253
  </react_native_1.Animated.View>
201
254
 
202
- {/* Progress Steps - All Completed */}
255
+ {/* Progress Steps */}
203
256
  <react_native_paper_1.Surface style={styles.progressCard}>
204
257
  <react_native_1.View style={styles.progressContainer}>
205
258
  <react_native_1.View style={styles.progressStep}>
@@ -236,53 +289,41 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
236
289
  <react_native_1.Text style={styles.summaryTitle}>Account Summary</react_native_1.Text>
237
290
  </react_native_1.View>
238
291
 
239
- {/* Seller Info in Grid */}
292
+ {/* Merchant Info in Grid */}
240
293
  <react_native_1.View style={styles.infoGrid}>
241
294
  <react_native_1.View style={styles.infoItem}>
242
295
  <react_native_1.Text style={styles.infoLabel}>Name</react_native_1.Text>
243
296
  <react_native_1.Text style={styles.infoValue} numberOfLines={1}>
244
- {sellerData.sellerName}
297
+ {merchantData.merchantName}
245
298
  </react_native_1.Text>
246
299
  </react_native_1.View>
247
300
 
248
- {sellerData.businessName && (<react_native_1.View style={styles.infoItem}>
301
+ {merchantData.businessName && (<react_native_1.View style={styles.infoItem}>
249
302
  <react_native_1.Text style={styles.infoLabel}>Business</react_native_1.Text>
250
303
  <react_native_1.Text style={styles.infoValue} numberOfLines={1}>
251
- {sellerData.businessName}
304
+ {merchantData.businessName}
252
305
  </react_native_1.Text>
253
306
  </react_native_1.View>)}
254
307
 
255
308
  <react_native_1.View style={styles.infoItem}>
256
309
  <react_native_1.Text style={styles.infoLabel}>Email</react_native_1.Text>
257
310
  <react_native_1.Text style={styles.infoValue} numberOfLines={1}>
258
- {sellerData.sellerEmail}
311
+ {merchantData.merchantEmail}
259
312
  </react_native_1.Text>
260
313
  </react_native_1.View>
261
314
 
262
- {sellerData.sellerDID && (<react_native_1.View style={styles.infoItem}>
263
- <react_native_1.Text style={styles.infoLabel}>Seller ID</react_native_1.Text>
315
+ {merchantData.merchantDID && (<react_native_1.View style={styles.infoItem}>
316
+ <react_native_1.Text style={styles.infoLabel}>Merchant ID</react_native_1.Text>
264
317
  <react_native_1.Text style={styles.infoValue} numberOfLines={1}>
265
- {sellerData.sellerDID.slice(0, 8)}...
318
+ {merchantData.merchantDID.slice(0, 8)}...
266
319
  </react_native_1.Text>
267
320
  </react_native_1.View>)}
268
321
  </react_native_1.View>
269
322
 
270
323
  <react_native_1.View style={styles.divider}/>
271
324
 
272
- {/* Status Badges - Compact Grid */}
325
+ {/* Status Badges */}
273
326
  <react_native_1.View style={styles.badgesGrid}>
274
- {/* Mode Badge */}
275
- <react_native_1.View style={[
276
- styles.badge,
277
- mode === 'live' ? styles.liveBadge : styles.testBadge
278
- ]}>
279
- <react_native_1.Text style={[
280
- styles.badgeText,
281
- mode === 'live' ? styles.liveBadgeText : styles.testBadgeText
282
- ]}>
283
- {mode === 'live' ? '🔴 LIVE' : '🧪 TEST'}
284
- </react_native_1.Text>
285
- </react_native_1.View>
286
327
 
287
328
  {/* KYC Status Badge */}
288
329
  <react_native_1.View style={[styles.badge, { backgroundColor: getKYCStatusColor(kycStatus) + '20' }]}>
@@ -312,7 +353,7 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
312
353
  </react_native_1.View>
313
354
  </react_native_1.View>
314
355
 
315
- {/* Status Messages - Compact */}
356
+ {/* Status Messages */}
316
357
  {mode === 'test' && (<react_native_1.View style={styles.testModeMessage}>
317
358
  <react_native_1.Text style={styles.testModeMessageText}>🧪 Test mode - No real transactions</react_native_1.Text>
318
359
  </react_native_1.View>)}
@@ -326,7 +367,7 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
326
367
  </react_native_1.View>)}
327
368
  </react_native_paper_1.Surface>
328
369
 
329
- {/* Next Steps - Compact */}
370
+ {/* Next Steps */}
330
371
  <react_native_paper_1.Surface style={styles.nextStepsCard}>
331
372
  <react_native_1.View style={styles.nextStepsHeader}>
332
373
  <react_native_paper_1.IconButton icon="format-list-checks" size={16} iconColor="#0066CC"/>
@@ -357,6 +398,13 @@ const OnboardingComplete = ({ sellerData, mode, status, kycStatus, isBankDetails
357
398
  </react_native_1.View>
358
399
  </react_native_paper_1.Surface>
359
400
 
401
+ {/* Complete Button */}
402
+ {!isFullyActive && (<react_native_1.TouchableOpacity style={styles.completeButton} onPress={onComplete}>
403
+ <expo_linear_gradient_1.LinearGradient colors={['#0066CC', '#0099FF']} style={styles.completeButtonGradient}>
404
+ <react_native_1.Text style={styles.completeButtonText}>Go to Dashboard</react_native_1.Text>
405
+ </expo_linear_gradient_1.LinearGradient>
406
+ </react_native_1.TouchableOpacity>)}
407
+
360
408
  <react_native_1.Text style={styles.footerText}>
361
409
  Update info anytime from dashboard
362
410
  </react_native_1.Text>
@@ -374,6 +422,7 @@ const styles = react_native_1.StyleSheet.create({
374
422
  },
375
423
  scrollContent: {
376
424
  padding: 12,
425
+ paddingBottom: 24,
377
426
  },
378
427
  loadingContainer: {
379
428
  flex: 1,
@@ -475,6 +524,19 @@ const styles = react_native_1.StyleSheet.create({
475
524
  fontSize: 14,
476
525
  color: '#6B7280',
477
526
  },
527
+ retryButton: {
528
+ marginTop: 16,
529
+ paddingVertical: 8,
530
+ paddingHorizontal: 16,
531
+ backgroundColor: '#F3F4F6',
532
+ borderRadius: 8,
533
+ alignSelf: 'center',
534
+ },
535
+ retryText: {
536
+ fontSize: 14,
537
+ color: '#0066CC',
538
+ fontWeight: '500',
539
+ },
478
540
  headerCard: {
479
541
  marginBottom: 8,
480
542
  },
@@ -742,6 +804,20 @@ const styles = react_native_1.StyleSheet.create({
742
804
  color: '#374151',
743
805
  textAlign: 'center',
744
806
  },
807
+ completeButton: {
808
+ marginBottom: 12,
809
+ borderRadius: 12,
810
+ overflow: 'hidden',
811
+ },
812
+ completeButtonGradient: {
813
+ paddingVertical: 14,
814
+ alignItems: 'center',
815
+ },
816
+ completeButtonText: {
817
+ fontSize: 15,
818
+ fontWeight: '600',
819
+ color: '#FFFFFF',
820
+ },
745
821
  footerText: {
746
822
  fontSize: 9,
747
823
  color: '#9CA3AF',
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { MerchantOnboardingProps } from '../../../types/merchantTypes';
3
+ declare const MerchantOnboardingSheet: React.FC<MerchantOnboardingProps>;
4
+ export default MerchantOnboardingSheet;