@airxpay/sdk-ui 1.0.0 → 1.0.1
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/README.md +146 -112
- package/dist/api/seller.d.ts +9 -0
- package/dist/api/seller.js +13 -4
- package/dist/components/common/CountryDropdown.d.ts +17 -0
- package/dist/components/common/CountryDropdown.js +2 -2
- package/dist/components/common/FileUploader.d.ts +16 -0
- package/dist/components/common/FileUploader.js +17 -8
- package/dist/components/common/StepIndicator.d.ts +11 -0
- package/dist/components/steps/BankDetails.d.ts +10 -0
- package/dist/components/steps/BankDetails.js +23 -16
- package/dist/components/steps/BasicDetailsForm.d.ts +10 -0
- package/dist/components/steps/BasicDetailsForm.js +8 -19
- package/dist/components/steps/KYCVerification.d.ts +11 -0
- package/dist/components/steps/KYCVerification.js +13 -4
- package/dist/components/steps/OnboardingComplete.d.ts +16 -0
- package/dist/components/ui/SellerOnboard/CustomSegmentedButtons.d.ts +15 -0
- package/dist/components/ui/SellerOnboard/SellerOnboarding.d.ts +4 -0
- package/dist/components/ui/SellerOnboard/SellerOnboarding.js +10 -23
- package/dist/contexts/AirXPayProvider.d.ts +14 -0
- package/dist/contexts/AirXPayProvider.js +6 -5
- package/dist/hooks/SellerOnboarding.d.ts +3 -0
- package/dist/hooks/SellerOnboarding.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -3
- package/dist/sdk/airxpay.d.ts +7 -0
- package/dist/sdk/airxpay.js +16 -5
- package/dist/types/dev.d.ts +1 -0
- package/dist/types/dev.js +5 -0
- package/dist/types/dev.ts +2 -0
- package/dist/types/sellertypes.d.ts +69 -0
- package/dist/types/sellertypes.ts +85 -0
- package/dist/types/type.d.ts +9 -0
- package/dist/types/type.ts +10 -0
- package/package.json +7 -15
package/README.md
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
# 📘 AirXPay Initialization UI Components
|
|
2
2
|
|
|
3
|
+
<a href="#-typescript">
|
|
4
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0+-blue?style=for-the-badge&logo=typescript" alt="TypeScript" />
|
|
5
|
+
</a>
|
|
6
|
+
<a href="#-react">
|
|
7
|
+
<img src="https://img.shields.io/badge/React-18.0+-61DAFB?style=for-the-badge&logo=react" alt="React" />
|
|
8
|
+
</a>
|
|
9
|
+
<a href="#-react-native">
|
|
10
|
+
<img src="https://img.shields.io/badge/React_Native-0.72+-61DAFB?style=for-the-badge&logo=react" alt="React Native" />
|
|
11
|
+
</a>
|
|
12
|
+
<a href="#-expo">
|
|
13
|
+
<img src="https://img.shields.io/badge/Expo-50+-000020?style=for-the-badge&logo=expo" alt="Expo" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="#-nextjs">
|
|
16
|
+
<img src="https://img.shields.io/badge/Next.js-14.0+-000000?style=for-the-badge&logo=next.js" alt="Next.js" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="#-javascript">
|
|
19
|
+
<img src="https://img.shields.io/badge/JavaScript-ES6+-F7DF1E?style=for-the-badge&logo=javascript" alt="JavaScript" />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="#-typescript">
|
|
22
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0+-3178C6?style=for-the-badge&logo=typescript" alt="TypeScript" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="#-mit-license">
|
|
25
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge&logo=open-source-initiative" alt="MIT License" />
|
|
26
|
+
</a>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
3
30
|
<div align="center">
|
|
4
|
-
<img src="./assets/images/
|
|
31
|
+
<img src="./assets/images/airxpay.png" alt="AirXPay Flixora SDK" width="120"/>
|
|
5
32
|
</div>
|
|
6
33
|
|
|
34
|
+
---
|
|
35
|
+
|
|
7
36
|
## 🚀 Overview
|
|
8
37
|
|
|
9
38
|
AirXPay Initialization UI is a production-ready React & React Native component library designed to streamline seller onboarding in multi-tenant SaaS applications. Built with TypeScript and enterprise-grade architecture, it provides a seamless, animated, and validated multi-step flow for collecting seller information.
|
|
@@ -23,7 +52,7 @@ AirXPay Initialization UI is a production-ready React & React Native component l
|
|
|
23
52
|
| 🏦 **Bank Verification** | Country-specific bank details collection |
|
|
24
53
|
| 📊 **Progress Tracking** | Visual progress indicator with step status |
|
|
25
54
|
| 🔧 **Configurable** | Customizable via AirXPayProvider |
|
|
26
|
-
| 📘 **TypeScript** | Fully typed components and
|
|
55
|
+
| 📘 **TypeScript** | Fully typed components, hooks, and classes |
|
|
27
56
|
| 📱 **Cross-platform** | Works with React Native, Expo, and Web |
|
|
28
57
|
|
|
29
58
|
---
|
|
@@ -45,11 +74,11 @@ yarn add react-native-paper react-native-country-picker-modal @react-native-comm
|
|
|
45
74
|
### Install the Package
|
|
46
75
|
|
|
47
76
|
```bash
|
|
48
|
-
#
|
|
49
|
-
npm install
|
|
77
|
+
# Install the package from npm
|
|
78
|
+
npm install @airxpay/sdk-ui
|
|
50
79
|
|
|
51
|
-
#
|
|
52
|
-
|
|
80
|
+
# Install package from yarn
|
|
81
|
+
yarn add @airxpay/sdk-ui
|
|
53
82
|
```
|
|
54
83
|
|
|
55
84
|
### Requirements
|
|
@@ -63,31 +92,30 @@ npm install airxpay-initialization-ui
|
|
|
63
92
|
## 🏗️ Architecture
|
|
64
93
|
|
|
65
94
|
```
|
|
66
|
-
airxpay-
|
|
95
|
+
@airxpay/sdk-ui/
|
|
67
96
|
├── components/
|
|
68
97
|
│ ├── steps/
|
|
69
98
|
│ │ ├── BasicDetailsForm.tsx
|
|
70
99
|
│ │ ├── KYCVerification.tsx
|
|
71
100
|
│ │ ├── BankDetails.tsx
|
|
72
101
|
│ │ └── OnboardingComplete.tsx
|
|
73
|
-
│ └──
|
|
102
|
+
│ └── ui/
|
|
103
|
+
│ └── SellerOnboard/
|
|
104
|
+
│ └── SellerOnboarding.tsx
|
|
74
105
|
├── contexts/
|
|
75
106
|
│ └── AirXPayProvider.tsx
|
|
76
|
-
├── api/
|
|
77
|
-
│ └── seller.ts
|
|
78
107
|
├── hooks/
|
|
79
|
-
│
|
|
80
|
-
|
|
81
|
-
│ └──
|
|
82
|
-
|
|
108
|
+
│ └── SellerOnboarding.tsx # useAirXPaySheet
|
|
109
|
+
├── api/
|
|
110
|
+
│ └── seller.ts # verifyPublicKey
|
|
111
|
+
├── types/
|
|
112
|
+
│ ├── dev.ts # __DEV__
|
|
113
|
+
│ └── type.ts # AirXPayConfig
|
|
114
|
+
└── index.ts # Main exports
|
|
83
115
|
```
|
|
84
116
|
|
|
85
117
|
---
|
|
86
118
|
|
|
87
|
-
<div align="center">
|
|
88
|
-
<img src="./assets/images/airxpay.png" alt="AirXPay Flixora SDK" width="100"/>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
119
|
## 🚀 Quick Start
|
|
92
120
|
|
|
93
121
|
### 1️⃣ Wrap with Provider
|
|
@@ -95,7 +123,7 @@ airxpay-initialization-ui/
|
|
|
95
123
|
```tsx
|
|
96
124
|
// Root.tsx
|
|
97
125
|
import React from 'react';
|
|
98
|
-
import { AirXPayProvider } from 'airxpay-
|
|
126
|
+
import { AirXPayProvider } from '@airxpay/sdk-ui';
|
|
99
127
|
import App from './App';
|
|
100
128
|
|
|
101
129
|
export default function Root() {
|
|
@@ -105,6 +133,7 @@ export default function Root() {
|
|
|
105
133
|
baseUrl: 'https://api.airxpay.com',
|
|
106
134
|
publicKey: 'YOUR_PUBLIC_KEY_HERE',
|
|
107
135
|
}}
|
|
136
|
+
enableLogging={__DEV__} // Optional: enables detailed logs in development
|
|
108
137
|
>
|
|
109
138
|
<App />
|
|
110
139
|
</AirXPayProvider>
|
|
@@ -117,11 +146,11 @@ export default function Root() {
|
|
|
117
146
|
```tsx
|
|
118
147
|
// SellerOnboardingScreen.tsx
|
|
119
148
|
import React from 'react';
|
|
120
|
-
import {
|
|
149
|
+
import { useAirXPaySheet } from '@airxpay/sdk-ui';
|
|
121
150
|
|
|
122
151
|
const MySellerOnboarding = () => {
|
|
123
152
|
return (
|
|
124
|
-
<
|
|
153
|
+
<useAirXPaySheet
|
|
125
154
|
sellerId="seller_12345"
|
|
126
155
|
mode="live"
|
|
127
156
|
isKycCompleted={false}
|
|
@@ -148,7 +177,7 @@ export default MySellerOnboarding;
|
|
|
148
177
|
|
|
149
178
|
## 📋 Component API
|
|
150
179
|
|
|
151
|
-
###
|
|
180
|
+
### useAirXPaySheet Props
|
|
152
181
|
|
|
153
182
|
| Prop | Type | Required | Default | Description |
|
|
154
183
|
|------|------|----------|---------|-------------|
|
|
@@ -167,37 +196,80 @@ export default MySellerOnboarding;
|
|
|
167
196
|
|
|
168
197
|
### AirXPayProvider Props
|
|
169
198
|
|
|
170
|
-
| Prop | Type | Required | Description |
|
|
171
|
-
|
|
172
|
-
| config.baseUrl | string | ✅ | API base URL |
|
|
173
|
-
| config.publicKey | string | ✅ | API public key |
|
|
174
|
-
| children | ReactNode | ✅ | Child components |
|
|
199
|
+
| Prop | Type | Required | Default | Description |
|
|
200
|
+
|------|------|----------|---------|-------------|
|
|
201
|
+
| config.baseUrl | string | ✅ | - | API base URL (must be valid URL) |
|
|
202
|
+
| config.publicKey | string | ✅ | - | API public key (min 20 chars) |
|
|
203
|
+
| children | ReactNode | ✅ | - | Child components |
|
|
204
|
+
| enableLogging | boolean | ❌ | \_\_DEV\_\_ | Enable/disable console logs |
|
|
175
205
|
|
|
176
206
|
---
|
|
177
207
|
|
|
178
|
-
## 🎣 Hooks
|
|
208
|
+
## 🎣 Hooks & Utilities
|
|
179
209
|
|
|
180
210
|
```tsx
|
|
181
211
|
import {
|
|
182
|
-
useAirXPay,
|
|
183
|
-
useAirXPaySafe,
|
|
184
|
-
useIsAirXPayReady,
|
|
185
|
-
useAirXPayConfig
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
212
|
+
useAirXPay, // Access config (throws if no provider)
|
|
213
|
+
useAirXPaySafe, // Safe access (returns null if no provider)
|
|
214
|
+
useIsAirXPayReady, // Hook: checks if provider is ready
|
|
215
|
+
useAirXPayConfig, // Access specific config value
|
|
216
|
+
AirXPayConsumer // Context consumer for advanced use
|
|
217
|
+
} from '@airxpay/sdk-ui';
|
|
218
|
+
|
|
219
|
+
// Example usage
|
|
189
220
|
const { baseUrl, publicKey } = useAirXPay();
|
|
190
|
-
|
|
191
|
-
// Safe access (returns null if no provider)
|
|
192
221
|
const config = useAirXPaySafe();
|
|
193
|
-
|
|
194
|
-
// Check if provider is ready
|
|
195
222
|
const isReady = useIsAirXPayReady();
|
|
196
|
-
|
|
197
|
-
// Access specific config value
|
|
198
223
|
const baseUrl = useAirXPayConfig('baseUrl');
|
|
199
224
|
```
|
|
200
225
|
|
|
226
|
+
### ⚡ Class-based Initialization
|
|
227
|
+
|
|
228
|
+
The package also provides a class-based approach for scenarios where you need to initialize the SDK asynchronously:
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
import { useIsAirXPayReady } from '@airxpay/sdk-ui';
|
|
232
|
+
|
|
233
|
+
// Initialize with config
|
|
234
|
+
const airxpay = new useIsAirXPayReady({
|
|
235
|
+
baseUrl: 'https://api.airxpay.com',
|
|
236
|
+
publicKey: 'your_public_key_here'
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Verify credentials asynchronously
|
|
240
|
+
async function initializeSDK() {
|
|
241
|
+
try {
|
|
242
|
+
const result = await airxpay.initialize();
|
|
243
|
+
console.log('SDK initialized successfully:', result);
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error('Initialization failed:', error);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## 🔧 Configuration Validation
|
|
253
|
+
|
|
254
|
+
The `AirXPayProvider` includes built-in validation that throws clear, actionable errors:
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
// ❌ This will throw a detailed error
|
|
258
|
+
<AirXPayProvider
|
|
259
|
+
config={{
|
|
260
|
+
baseUrl: 'not-a-url',
|
|
261
|
+
publicKey: 'short'
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
<App />
|
|
265
|
+
</AirXPayProvider>
|
|
266
|
+
|
|
267
|
+
// Error message:
|
|
268
|
+
// AirXPayProvider Configuration Error:
|
|
269
|
+
// • baseUrl must be a valid URL
|
|
270
|
+
// • publicKey appears to be invalid
|
|
271
|
+
```
|
|
272
|
+
|
|
201
273
|
---
|
|
202
274
|
|
|
203
275
|
## 🎨 Customization
|
|
@@ -205,8 +277,7 @@ const baseUrl = useAirXPayConfig('baseUrl');
|
|
|
205
277
|
### Styling
|
|
206
278
|
|
|
207
279
|
```tsx
|
|
208
|
-
|
|
209
|
-
<SellerOnboardingSheet
|
|
280
|
+
<useAirXPaySheet
|
|
210
281
|
// ... props
|
|
211
282
|
styles={{
|
|
212
283
|
container: { backgroundColor: '#f5f5f5' },
|
|
@@ -215,27 +286,14 @@ const baseUrl = useAirXPayConfig('baseUrl');
|
|
|
215
286
|
/>
|
|
216
287
|
```
|
|
217
288
|
|
|
218
|
-
### Icons & Branding
|
|
219
|
-
|
|
220
|
-
```tsx
|
|
221
|
-
// Custom logo
|
|
222
|
-
<SellerOnboardingSheet
|
|
223
|
-
// ... props
|
|
224
|
-
logo={require('./assets/custom-logo.png')}
|
|
225
|
-
/>
|
|
226
|
-
|
|
227
|
-
// Custom step icons via STEPS array modification
|
|
228
|
-
```
|
|
229
|
-
|
|
230
289
|
### Theme Support
|
|
231
290
|
|
|
232
291
|
```tsx
|
|
233
|
-
// Using with React Native Paper
|
|
234
292
|
import { Provider as PaperProvider } from 'react-native-paper';
|
|
235
293
|
|
|
236
294
|
<PaperProvider theme={yourTheme}>
|
|
237
295
|
<AirXPayProvider config={config}>
|
|
238
|
-
<
|
|
296
|
+
<useAirXPaySheet {...props} />
|
|
239
297
|
</AirXPayProvider>
|
|
240
298
|
</PaperProvider>
|
|
241
299
|
```
|
|
@@ -270,62 +328,38 @@ Step 4: Completion
|
|
|
270
328
|
|
|
271
329
|
---
|
|
272
330
|
|
|
273
|
-
##
|
|
274
|
-
|
|
275
|
-
### Custom Step Implementation
|
|
331
|
+
## 📝 Exports Reference
|
|
276
332
|
|
|
277
333
|
```tsx
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
};
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Error Handling
|
|
295
|
-
|
|
296
|
-
```tsx
|
|
297
|
-
<SellerOnboardingSheet
|
|
298
|
-
onError={(error, step) => {
|
|
299
|
-
switch(error.code) {
|
|
300
|
-
case 'KYC_FAILED':
|
|
301
|
-
showNotification('KYC verification failed');
|
|
302
|
-
break;
|
|
303
|
-
case 'BANK_INVALID':
|
|
304
|
-
showNotification('Invalid bank details');
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
}}
|
|
308
|
-
/>
|
|
334
|
+
// Main exports from index.ts
|
|
335
|
+
export { useIsAirXPayReady } from "./sdk/airxpay"; // Class for async init
|
|
336
|
+
export { AirXPayProvider } from "./contexts/AirXPayProvider";
|
|
337
|
+
export { default as useAirXPaySheet } from "./hooks/SellerOnboarding";
|
|
338
|
+
export { __DEV__ } from './types/dev';
|
|
339
|
+
|
|
340
|
+
// Also available via context
|
|
341
|
+
export {
|
|
342
|
+
useAirXPay,
|
|
343
|
+
useAirXPaySafe,
|
|
344
|
+
useAirXPayConfig,
|
|
345
|
+
AirXPayConsumer
|
|
346
|
+
} from './contexts/AirXPayProvider';
|
|
309
347
|
```
|
|
310
348
|
|
|
311
349
|
---
|
|
312
350
|
|
|
313
|
-
## 🧪
|
|
351
|
+
## 🧪 Development Utilities
|
|
314
352
|
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
npm test
|
|
318
|
-
|
|
319
|
-
# Run with coverage
|
|
320
|
-
npm test -- --coverage
|
|
321
|
-
|
|
322
|
-
# Lint code
|
|
323
|
-
npm run lint
|
|
353
|
+
```tsx
|
|
354
|
+
import { __DEV__ } from '@airxpay/sdk-ui';
|
|
324
355
|
|
|
325
|
-
|
|
326
|
-
|
|
356
|
+
if (__DEV__) {
|
|
357
|
+
console.log('Running in development mode');
|
|
358
|
+
}
|
|
327
359
|
```
|
|
328
360
|
|
|
361
|
+
The `__DEV__` flag helps you conditionally run code only in development environments.
|
|
362
|
+
|
|
329
363
|
---
|
|
330
364
|
|
|
331
365
|
## 📈 Performance
|
|
@@ -333,7 +367,7 @@ npm run type-check
|
|
|
333
367
|
- **Memoized Components:** All step components are memoized
|
|
334
368
|
- **Optimized Re-renders:** Context splitting prevents unnecessary renders
|
|
335
369
|
- **Lazy Loading:** Steps load on-demand
|
|
336
|
-
- **
|
|
370
|
+
- **Development Logging:** Auto-disabled in production via `__DEV__`
|
|
337
371
|
|
|
338
372
|
---
|
|
339
373
|
|
|
@@ -351,22 +385,22 @@ npm run type-check
|
|
|
351
385
|
|
|
352
386
|
| Issue | Solution |
|
|
353
387
|
|-------|----------|
|
|
354
|
-
|
|
|
388
|
+
| "useAirXPay must be used within AirXPayProvider" | Wrap your component tree with provider |
|
|
389
|
+
| "Public key appears to be invalid" | Check if publicKey is at least 20 chars |
|
|
390
|
+
| "baseUrl must be a valid URL" | Include protocol (https://) in baseUrl |
|
|
355
391
|
| Images not uploading | Check Expo ImagePicker permissions |
|
|
356
|
-
| Animation lag | Enable useNativeDriver in config |
|
|
357
392
|
| TypeScript errors | Update to latest version |
|
|
358
|
-
| Bank validation fails | Check country code format |
|
|
359
393
|
|
|
360
394
|
---
|
|
361
395
|
|
|
362
396
|
## 📝 Changelog
|
|
363
397
|
|
|
364
398
|
### v1.0.5 (Latest)
|
|
365
|
-
- Added
|
|
366
|
-
-
|
|
399
|
+
- Added class-based `useIsAirXPayReady` for async initialization
|
|
400
|
+
- Enhanced error messages with stack traces
|
|
401
|
+
- Added `__DEV__` flag for environment detection
|
|
367
402
|
- Improved TypeScript types
|
|
368
|
-
- Added
|
|
369
|
-
- Enhanced error handling
|
|
403
|
+
- Added `enableLogging` prop to provider
|
|
370
404
|
|
|
371
405
|
### v1.0.3
|
|
372
406
|
- Initial release
|
|
@@ -397,4 +431,4 @@ MIT License © 2026 Flixora Technologies
|
|
|
397
431
|
<p><strong>Your Smile, Our Simplicity 😊</strong></p>
|
|
398
432
|
<p><sub>Version 1.0.5 | Part of AirXPay, TizzyGo, TizzyOS, and TizzyChat</sub></p>
|
|
399
433
|
<p><i>We upgraded from v1.0.3 to v1.0.5 to maintain version consistency across our ecosystem. Thanks for your understanding!</i></p>
|
|
400
|
-
</div>
|
|
434
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SellerInitResponse {
|
|
2
|
+
mode: "live" | "test";
|
|
3
|
+
userId: string;
|
|
4
|
+
isKycCompleted: boolean;
|
|
5
|
+
isBankDetailsCompleted: boolean;
|
|
6
|
+
kycStatus: string;
|
|
7
|
+
status: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const verifyPublicKey: (baseUrl: string, publicKey: string) => Promise<SellerInitResponse>;
|
package/dist/api/seller.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.verifyPublicKey = void 0;
|
|
4
|
-
const verifyPublicKey =
|
|
5
|
-
const response =
|
|
13
|
+
const verifyPublicKey = (baseUrl, publicKey) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const response = yield fetch(`${baseUrl}/api/verify-public-key`, {
|
|
6
15
|
method: "POST",
|
|
7
16
|
headers: {
|
|
8
17
|
"Content-Type": "application/json",
|
|
@@ -12,6 +21,6 @@ const verifyPublicKey = async (baseUrl, publicKey) => {
|
|
|
12
21
|
if (!response.ok) {
|
|
13
22
|
throw new Error("Invalid public key or server error");
|
|
14
23
|
}
|
|
15
|
-
return
|
|
16
|
-
};
|
|
24
|
+
return yield response.json();
|
|
25
|
+
});
|
|
17
26
|
exports.verifyPublicKey = verifyPublicKey;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CountryCode } from 'react-native-country-picker-modal';
|
|
3
|
+
interface CountryDropdownProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (country: string, countryCode?: CountryCode) => void;
|
|
6
|
+
withFlag?: boolean;
|
|
7
|
+
withCallingCode?: boolean;
|
|
8
|
+
withCountryNameButton?: boolean;
|
|
9
|
+
withAlphaFilter?: boolean;
|
|
10
|
+
withFilter?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const CountryDropdown: React.FC<CountryDropdownProps>;
|
|
17
|
+
export default CountryDropdown;
|
|
@@ -54,7 +54,7 @@ const CountryDropdown = ({ value, onChange, withFlag = true, withCallingCode = f
|
|
|
54
54
|
return <react_native_1.Text style={styles.placeholder}>{placeholder}</react_native_1.Text>;
|
|
55
55
|
}
|
|
56
56
|
return (<react_native_1.View style={styles.selectedCountry}>
|
|
57
|
-
{selectedCountry
|
|
57
|
+
{(selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.cca2) && withFlag && (<react_native_country_picker_modal_1.default countryCode={selectedCountry.cca2} withFlag={true} withCountryNameButton={false} withCallingCode={false} withFilter={false} withAlphaFilter={false} visible={false}/>)}
|
|
58
58
|
<react_native_1.Text style={styles.selectedCountryName} numberOfLines={1}>
|
|
59
59
|
{value}
|
|
60
60
|
</react_native_1.Text>
|
|
@@ -75,7 +75,7 @@ const CountryDropdown = ({ value, onChange, withFlag = true, withCallingCode = f
|
|
|
75
75
|
|
|
76
76
|
{error ? <react_native_1.Text style={styles.errorText}>{error}</react_native_1.Text> : null}
|
|
77
77
|
|
|
78
|
-
<react_native_country_picker_modal_1.default countryCode={(selectedCountry
|
|
78
|
+
<react_native_country_picker_modal_1.default countryCode={((selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.cca2) || 'US')} withFlag={withFlag} withCallingCode={withCallingCode} withCountryNameButton={withCountryNameButton} withAlphaFilter={withAlphaFilter} withFilter={withFilter} withEmoji={true} withModal={true} visible={modalVisible} onSelect={onSelect} onClose={() => setModalVisible(false)} containerButtonStyle={styles.hiddenPicker} preferredCountries={['IN', 'US', 'GB', 'CA', 'AU', 'SG', 'AE']} modalProps={{
|
|
79
79
|
animationType: 'slide',
|
|
80
80
|
presentationStyle: react_native_1.Platform.OS === 'ios' ? 'pageSheet' : 'overFullScreen',
|
|
81
81
|
}}/>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Mode } from '../../types/sellertypes';
|
|
3
|
+
interface FileUploaderProps {
|
|
4
|
+
label: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
onUpload: (file: any) => void;
|
|
10
|
+
onRemove: () => void;
|
|
11
|
+
uploading?: boolean;
|
|
12
|
+
mode?: Mode;
|
|
13
|
+
accept?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const FileUploader: React.FC<FileUploaderProps>;
|
|
16
|
+
export default FileUploader;
|
|
@@ -33,6 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
36
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
47
|
};
|
|
@@ -42,14 +51,14 @@ const react_native_1 = require("react-native");
|
|
|
42
51
|
const react_native_paper_1 = require("react-native-paper");
|
|
43
52
|
const ImagePicker = __importStar(require("expo-image-picker"));
|
|
44
53
|
const FileUploader = ({ label, required = false, description, value, onUpload, onRemove, uploading = false, mode = 'test', accept = 'image/*', }) => {
|
|
45
|
-
const pickImage =
|
|
54
|
+
const pickImage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
55
|
try {
|
|
47
|
-
const { status } =
|
|
56
|
+
const { status } = yield ImagePicker.requestMediaLibraryPermissionsAsync();
|
|
48
57
|
if (status !== 'granted') {
|
|
49
58
|
react_native_1.Alert.alert('Permission needed', 'Please grant camera roll permissions');
|
|
50
59
|
return;
|
|
51
60
|
}
|
|
52
|
-
const result =
|
|
61
|
+
const result = yield ImagePicker.launchImageLibraryAsync({
|
|
53
62
|
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
|
54
63
|
allowsEditing: true,
|
|
55
64
|
aspect: [4, 3],
|
|
@@ -62,15 +71,15 @@ const FileUploader = ({ label, required = false, description, value, onUpload, o
|
|
|
62
71
|
catch (error) {
|
|
63
72
|
react_native_1.Alert.alert('Error', 'Failed to pick image');
|
|
64
73
|
}
|
|
65
|
-
};
|
|
66
|
-
const takePhoto =
|
|
74
|
+
});
|
|
75
|
+
const takePhoto = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
76
|
try {
|
|
68
|
-
const { status } =
|
|
77
|
+
const { status } = yield ImagePicker.requestCameraPermissionsAsync();
|
|
69
78
|
if (status !== 'granted') {
|
|
70
79
|
react_native_1.Alert.alert('Permission needed', 'Please grant camera permissions');
|
|
71
80
|
return;
|
|
72
81
|
}
|
|
73
|
-
const result =
|
|
82
|
+
const result = yield ImagePicker.launchCameraAsync({
|
|
74
83
|
allowsEditing: true,
|
|
75
84
|
aspect: [4, 3],
|
|
76
85
|
quality: 0.8,
|
|
@@ -82,7 +91,7 @@ const FileUploader = ({ label, required = false, description, value, onUpload, o
|
|
|
82
91
|
catch (error) {
|
|
83
92
|
react_native_1.Alert.alert('Error', 'Failed to take photo');
|
|
84
93
|
}
|
|
85
|
-
};
|
|
94
|
+
});
|
|
86
95
|
const showOptions = () => {
|
|
87
96
|
react_native_1.Alert.alert(`Upload ${label}`, 'Choose an option', [
|
|
88
97
|
{ text: 'Take Photo', onPress: takePhoto },
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StepConfig, Mode } from '../../types/sellertypes';
|
|
3
|
+
interface StepIndicatorProps {
|
|
4
|
+
currentStep: number;
|
|
5
|
+
steps: StepConfig[];
|
|
6
|
+
mode: Mode;
|
|
7
|
+
isKycCompleted: boolean;
|
|
8
|
+
isBankDetailsCompleted: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const StepIndicator: React.FC<StepIndicatorProps>;
|
|
11
|
+
export default StepIndicator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Seller, Mode } from '../../types/sellertypes';
|
|
3
|
+
interface BankDetailsProps {
|
|
4
|
+
initialData: Partial<Seller>;
|
|
5
|
+
mode: Mode;
|
|
6
|
+
onNext: (data: Partial<Seller>) => void;
|
|
7
|
+
onBack: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const BankDetails: React.FC<BankDetailsProps>;
|
|
10
|
+
export default BankDetails;
|