@airxpay/sdk-ui 1.0.5 → 1.0.7
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 +186 -216
- package/dist/api/client.d.ts +6 -0
- package/dist/api/client.js +104 -0
- package/dist/api/merchant.d.ts +32 -0
- package/dist/api/merchant.js +69 -0
- package/dist/components/common/FileUploader.d.ts +1 -1
- package/dist/components/common/StepIndicator.d.ts +1 -1
- package/dist/components/steps/BankDetails.d.ts +3 -3
- package/dist/components/steps/BankDetails.js +223 -162
- package/dist/components/steps/BasicDetailsForm.d.ts +3 -3
- package/dist/components/steps/BasicDetailsForm.js +143 -144
- package/dist/components/steps/KYCVerification.d.ts +4 -4
- package/dist/components/steps/KYCVerification.js +481 -133
- package/dist/components/steps/OnboardingComplete.d.ts +18 -13
- package/dist/components/steps/OnboardingComplete.js +273 -596
- package/dist/components/ui/MerchantOnboard/MerchantOnboarding.d.ts +4 -0
- package/dist/components/ui/{SellerOnboard/SellerOnboarding.js → MerchantOnboard/MerchantOnboarding.js} +121 -56
- package/dist/contexts/AirXPayProvider.d.ts +17 -13
- package/dist/contexts/AirXPayProvider.js +54 -102
- package/dist/hooks/MerchantOnboarding.d.ts +12 -0
- package/dist/hooks/MerchantOnboarding.js +125 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +26 -11
- package/dist/sdk/airxpay.d.ts +4 -2
- package/dist/sdk/airxpay.js +2 -5
- package/dist/types/dev.js +1 -2
- package/dist/types/dev.ts +2 -2
- package/dist/types/merchantTypes.d.ts +113 -0
- package/dist/types/merchantTypes.js +6 -0
- package/dist/types/merchantTypes.ts +130 -0
- package/dist/types/type.d.ts +4 -5
- package/dist/types/type.js +1 -0
- package/dist/types/type.ts +6 -5
- package/dist/utils/jwt.d.ts +14 -0
- package/dist/utils/jwt.js +40 -0
- package/dist/utils/tokenStorage.d.ts +12 -0
- package/dist/utils/tokenStorage.js +59 -0
- package/package.json +3 -1
- package/dist/api/seller.d.ts +0 -9
- package/dist/api/seller.js +0 -26
- package/dist/components/ui/SellerOnboard/CustomSegmentedButtons.d.ts +0 -15
- package/dist/components/ui/SellerOnboard/CustomSegmentedButtons.js +0 -64
- package/dist/components/ui/SellerOnboard/SellerOnboarding.d.ts +0 -4
- package/dist/hooks/SellerOnboarding.d.ts +0 -3
- package/dist/hooks/SellerOnboarding.js +0 -11
- package/dist/types/sellertypes.d.ts +0 -69
- package/dist/types/sellertypes.js +0 -4
- package/dist/types/sellertypes.ts +0 -85
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
## 🚀 Overview
|
|
37
37
|
|
|
38
|
-
AirXPay Initialization UI is a production-ready React & React Native component library designed to streamline
|
|
38
|
+
AirXPay Initialization UI is a production-ready React & React Native component library designed to streamline merchant 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 merchant information.
|
|
39
39
|
|
|
40
40
|
> **Part of the Flixora Ecosystem** — Integrated with AirXPay for payments, TizzyGo for logistics, TizzyOS for operations, and soon TizzyChat for real-time notifications.
|
|
41
41
|
|
|
@@ -69,29 +69,22 @@ npm install react-native-paper react-native-country-picker-modal @react-native-c
|
|
|
69
69
|
|
|
70
70
|
# Or with Yarn
|
|
71
71
|
yarn add react-native-paper react-native-country-picker-modal @react-native-community/datetimepicker expo-image-picker expo-linear-gradient
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Install the Package
|
|
75
|
-
|
|
76
|
-
```bash
|
|
72
|
+
Install the Package
|
|
73
|
+
bash
|
|
77
74
|
# Install the package from npm
|
|
78
75
|
npm install @airxpay/sdk-ui
|
|
79
76
|
|
|
80
77
|
# Install package from yarn
|
|
81
78
|
yarn add @airxpay/sdk-ui
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Requirements
|
|
85
|
-
|
|
86
|
-
- React 18+
|
|
87
|
-
- React Native >= 0.72
|
|
88
|
-
- Expo SDK (optional, for LinearGradient & ImagePicker)
|
|
79
|
+
Requirements
|
|
80
|
+
React 18+
|
|
89
81
|
|
|
90
|
-
|
|
82
|
+
React Native >= 0.72
|
|
91
83
|
|
|
92
|
-
|
|
84
|
+
Expo SDK (optional, for LinearGradient & ImagePicker)
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
🏗️ Architecture
|
|
87
|
+
text
|
|
95
88
|
@airxpay/sdk-ui/
|
|
96
89
|
├── components/
|
|
97
90
|
│ ├── steps/
|
|
@@ -100,27 +93,21 @@ yarn add @airxpay/sdk-ui
|
|
|
100
93
|
│ │ ├── BankDetails.tsx
|
|
101
94
|
│ │ └── OnboardingComplete.tsx
|
|
102
95
|
│ └── ui/
|
|
103
|
-
│ └──
|
|
104
|
-
│ └──
|
|
96
|
+
│ └── MerchantOnboard/
|
|
97
|
+
│ └── MerchantOnboarding.tsx
|
|
105
98
|
├── contexts/
|
|
106
99
|
│ └── AirXPayProvider.tsx
|
|
107
100
|
├── hooks/
|
|
108
|
-
│ └──
|
|
101
|
+
│ └── MerchantOnboarding.tsx # useAirXPaySheet
|
|
109
102
|
├── api/
|
|
110
|
-
│ └──
|
|
103
|
+
│ └── merchant.ts # verifyPublicKey
|
|
111
104
|
├── types/
|
|
112
105
|
│ ├── dev.ts # __DEV__
|
|
113
106
|
│ └── type.ts # AirXPayConfig
|
|
114
107
|
└── index.ts # Main exports
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
## 🚀 Quick Start
|
|
120
|
-
|
|
121
|
-
### 1️⃣ Wrap with Provider
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
108
|
+
🚀 Quick Start
|
|
109
|
+
1️⃣ Wrap with Provider
|
|
110
|
+
tsx
|
|
124
111
|
// Root.tsx
|
|
125
112
|
import React from 'react';
|
|
126
113
|
import { AirXPayProvider } from '@airxpay/sdk-ui';
|
|
@@ -130,7 +117,6 @@ export default function Root() {
|
|
|
130
117
|
return (
|
|
131
118
|
<AirXPayProvider
|
|
132
119
|
config={{
|
|
133
|
-
baseUrl: 'https://api.airxpay.com',
|
|
134
120
|
publicKey: 'YOUR_PUBLIC_KEY_HERE',
|
|
135
121
|
}}
|
|
136
122
|
enableLogging={__DEV__} // Optional: enables detailed logs in development
|
|
@@ -139,19 +125,16 @@ export default function Root() {
|
|
|
139
125
|
</AirXPayProvider>
|
|
140
126
|
);
|
|
141
127
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
```tsx
|
|
147
|
-
// SellerOnboardingScreen.tsx
|
|
128
|
+
2️⃣ Implement Onboarding
|
|
129
|
+
tsx
|
|
130
|
+
// MerchantOnboardingScreen.tsx
|
|
148
131
|
import React from 'react';
|
|
149
132
|
import { useAirXPaySheet } from '@airxpay/sdk-ui';
|
|
150
133
|
|
|
151
|
-
const
|
|
134
|
+
const MyMerchantOnboarding = () => {
|
|
152
135
|
return (
|
|
153
136
|
<useAirXPaySheet
|
|
154
|
-
|
|
137
|
+
merchantId="merchant_12345"
|
|
155
138
|
mode="live"
|
|
156
139
|
isKycCompleted={false}
|
|
157
140
|
isBankDetailsCompleted={false}
|
|
@@ -163,51 +146,36 @@ const MySellerOnboarding = () => {
|
|
|
163
146
|
onBack={(currentStep) => {
|
|
164
147
|
console.log(`Navigated back from step ${currentStep}`);
|
|
165
148
|
}}
|
|
166
|
-
onComplete={(
|
|
167
|
-
console.log('🎉 Onboarding complete!',
|
|
149
|
+
onComplete={(merchantData) => {
|
|
150
|
+
console.log('🎉 Onboarding complete!', merchantData);
|
|
168
151
|
}}
|
|
169
152
|
/>
|
|
170
153
|
);
|
|
171
154
|
};
|
|
172
155
|
|
|
173
|
-
export default
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
### AirXPayProvider Props
|
|
198
|
-
|
|
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 |
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## 🎣 Hooks & Utilities
|
|
209
|
-
|
|
210
|
-
```tsx
|
|
156
|
+
export default MyMerchantOnboarding;
|
|
157
|
+
📋 Component API
|
|
158
|
+
useAirXPaySheet Props
|
|
159
|
+
Prop Type Required Default Description
|
|
160
|
+
merchantId string ✅ - Unique merchant identifier
|
|
161
|
+
mode 'live' | 'test' ✅ - Environment mode
|
|
162
|
+
isKycCompleted boolean ✅ - KYC completion status
|
|
163
|
+
isBankDetailsCompleted boolean ✅ - Bank details status
|
|
164
|
+
kycStatus string ✅ - 'pending' | 'verified' | 'rejected'
|
|
165
|
+
status string ✅ - 'pending' | 'active' | 'suspended'
|
|
166
|
+
initialStep number ❌ 1 Starting step (1-4)
|
|
167
|
+
initialData Partial<Merchant> ❌ {} Pre-filled merchant data
|
|
168
|
+
loading boolean ❌ false External loading state
|
|
169
|
+
onNext (data: Partial<Merchant>, step: number) => void ✅ - Step completion callback
|
|
170
|
+
onBack (step: number) => void ✅ - Back navigation callback
|
|
171
|
+
onComplete (data: Merchant) => void ✅ - Final completion callback
|
|
172
|
+
AirXPayProvider Props
|
|
173
|
+
Prop Type Required Default Description
|
|
174
|
+
config.publicKey string ✅ - API public key (min 20 chars)
|
|
175
|
+
children ReactNode ✅ - Child components
|
|
176
|
+
enableLogging boolean ❌ __DEV__ Enable/disable console logs
|
|
177
|
+
🎣 Hooks & Utilities
|
|
178
|
+
tsx
|
|
211
179
|
import {
|
|
212
180
|
useAirXPay, // Access config (throws if no provider)
|
|
213
181
|
useAirXPaySafe, // Safe access (returns null if no provider)
|
|
@@ -217,22 +185,17 @@ import {
|
|
|
217
185
|
} from '@airxpay/sdk-ui';
|
|
218
186
|
|
|
219
187
|
// Example usage
|
|
220
|
-
const {
|
|
188
|
+
const { publicKey } = useAirXPay();
|
|
221
189
|
const config = useAirXPaySafe();
|
|
222
190
|
const isReady = useProviderReady();
|
|
223
|
-
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### ⚡ Class-based Initialization
|
|
227
|
-
|
|
191
|
+
⚡ Class-based Initialization
|
|
228
192
|
The package also provides a class-based approach for scenarios where you need to initialize the SDK asynchronously:
|
|
229
193
|
|
|
230
|
-
|
|
194
|
+
tsx
|
|
231
195
|
import { useIsAirXPayReady } from '@airxpay/sdk-ui';
|
|
232
196
|
|
|
233
197
|
// Initialize with config
|
|
234
198
|
const airxpay = new useIsAirXPayReady({
|
|
235
|
-
baseUrl: 'https://api.airxpay.com',
|
|
236
199
|
publicKey: 'your_public_key_here'
|
|
237
200
|
});
|
|
238
201
|
|
|
@@ -245,19 +208,13 @@ async function initializeSDK() {
|
|
|
245
208
|
console.error('Initialization failed:', error);
|
|
246
209
|
}
|
|
247
210
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
---
|
|
211
|
+
🔧 Configuration Validation
|
|
212
|
+
The AirXPayProvider includes built-in validation that throws clear, actionable errors:
|
|
251
213
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
The `AirXPayProvider` includes built-in validation that throws clear, actionable errors:
|
|
255
|
-
|
|
256
|
-
```tsx
|
|
214
|
+
tsx
|
|
257
215
|
// ❌ This will throw a detailed error
|
|
258
216
|
<AirXPayProvider
|
|
259
217
|
config={{
|
|
260
|
-
baseUrl: 'not-a-url',
|
|
261
218
|
publicKey: 'short'
|
|
262
219
|
}}
|
|
263
220
|
>
|
|
@@ -266,17 +223,10 @@ The `AirXPayProvider` includes built-in validation that throws clear, actionable
|
|
|
266
223
|
|
|
267
224
|
// Error message:
|
|
268
225
|
// AirXPayProvider Configuration Error:
|
|
269
|
-
// • baseUrl must be a valid URL
|
|
270
226
|
// • publicKey appears to be invalid
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
## 🎨 Customization
|
|
276
|
-
|
|
277
|
-
### Styling
|
|
278
|
-
|
|
279
|
-
```tsx
|
|
227
|
+
🎨 Customization
|
|
228
|
+
Styling
|
|
229
|
+
tsx
|
|
280
230
|
<useAirXPaySheet
|
|
281
231
|
// ... props
|
|
282
232
|
styles={{
|
|
@@ -284,11 +234,8 @@ The `AirXPayProvider` includes built-in validation that throws clear, actionable
|
|
|
284
234
|
stepIndicator: { backgroundColor: '#6200ee' }
|
|
285
235
|
}}
|
|
286
236
|
/>
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
### Theme Support
|
|
290
|
-
|
|
291
|
-
```tsx
|
|
237
|
+
Theme Support
|
|
238
|
+
tsx
|
|
292
239
|
import { Provider as PaperProvider } from 'react-native-paper';
|
|
293
240
|
|
|
294
241
|
<PaperProvider theme={yourTheme}>
|
|
@@ -296,15 +243,75 @@ import { Provider as PaperProvider } from 'react-native-paper';
|
|
|
296
243
|
<useAirXPaySheet {...props} />
|
|
297
244
|
</AirXPayProvider>
|
|
298
245
|
</PaperProvider>
|
|
299
|
-
|
|
246
|
+
Future Customization Options Hooks and Initialization Like This Structure Will Be Added In Future Updates To Allow More Flexibility And Control Over The Onboarding Flow And SDK Initialization Process. Stay Tuned For More Enhancements!
|
|
247
|
+
text
|
|
248
|
+
import React from "react";
|
|
249
|
+
import {
|
|
250
|
+
useAirXPaySheet,
|
|
251
|
+
useAirXPay,
|
|
252
|
+
useAirXPaySafe,
|
|
253
|
+
useProviderReady,
|
|
254
|
+
useAirXPayConfig,
|
|
255
|
+
} from "@airxpay/sdk-ui";
|
|
256
|
+
import { ActivityIndicator, View, Text } from "react-native";
|
|
257
|
+
|
|
258
|
+
const MerchantOnboardingScreen = () => {
|
|
259
|
+
const { publicKey } = useAirXPay(); // Throws if provider missing
|
|
260
|
+
const safeConfig = useAirXPaySafe(); // Returns null if provider missing
|
|
261
|
+
const isReady = useProviderReady(); // SDK ready check
|
|
262
|
+
const apiUrl = useAirXPayConfig("publicKey"); // Specific config
|
|
263
|
+
|
|
264
|
+
if (!isReady) {
|
|
265
|
+
return (
|
|
266
|
+
<View>
|
|
267
|
+
<ActivityIndicator />
|
|
268
|
+
<Text>Initializing AirXPay🔗...</Text>
|
|
269
|
+
</View>
|
|
270
|
+
);
|
|
271
|
+
}
|
|
300
272
|
|
|
301
|
-
|
|
273
|
+
if (!publicKey) {
|
|
274
|
+
return (
|
|
275
|
+
<View>
|
|
276
|
+
<Text style={{ color: "red" }}>⚠️ AirXPay configuration missing!</Text>
|
|
277
|
+
</View>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
302
280
|
|
|
303
|
-
|
|
281
|
+
if (!safeConfig) {
|
|
282
|
+
return (
|
|
283
|
+
<View>
|
|
284
|
+
<Text style={{ color: "red" }}>⚠️ AirXPay safe config missing!</Text>
|
|
285
|
+
</View>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const merchantSheet = useAirXPaySheet({
|
|
290
|
+
merchantId: "merchant_12345",
|
|
291
|
+
mode: "live",
|
|
292
|
+
isKycCompleted: false,
|
|
293
|
+
isBankDetailsCompleted: false,
|
|
294
|
+
kycStatus: "pending",
|
|
295
|
+
status: "pending",
|
|
296
|
+
onNext: (data: any, step: number) => {
|
|
297
|
+
console.log(`Step ${step} completed`, data);
|
|
298
|
+
},
|
|
299
|
+
onBack: (step: number) => {
|
|
300
|
+
console.log(`Went back from step ${step}`);
|
|
301
|
+
},
|
|
302
|
+
onComplete: (finalData: any) => {
|
|
303
|
+
console.log("🎉 Onboarding Complete:", finalData);
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
return merchantSheet; // ✅ just return it directly
|
|
308
|
+
};
|
|
304
309
|
|
|
305
|
-
|
|
310
|
+
export default MerchantOnboardingScreen;
|
|
311
|
+
🔄 Step Flow
|
|
312
|
+
text
|
|
306
313
|
Step 1: Basic Details
|
|
307
|
-
├──
|
|
314
|
+
├── Merchant Name
|
|
308
315
|
├── Email Address
|
|
309
316
|
├── Phone Number
|
|
310
317
|
└── Business Type
|
|
@@ -324,17 +331,12 @@ Step 4: Completion
|
|
|
324
331
|
├── Success Animation
|
|
325
332
|
├── Summary View
|
|
326
333
|
└── Next Steps
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## 📝 Exports Reference
|
|
332
|
-
|
|
333
|
-
```tsx
|
|
334
|
+
📝 Exports Reference
|
|
335
|
+
tsx
|
|
334
336
|
// Main exports from index.ts
|
|
335
337
|
export { useIsAirXPayReady } from "./sdk/airxpay"; // Class for async init
|
|
336
338
|
export { AirXPayProvider, useProviderReady, useAirXPayConfig, useAirXPaySafe, useAirXPay } from "./contexts/AirXPayProvider";
|
|
337
|
-
export { default as useAirXPaySheet } from "./hooks/
|
|
339
|
+
export { default as useAirXPaySheet } from "./hooks/MerchantOnboarding";
|
|
338
340
|
export { __DEV__ } from './types/dev';
|
|
339
341
|
|
|
340
342
|
// Also available via context
|
|
@@ -344,60 +346,45 @@ export {
|
|
|
344
346
|
useAirXPayConfig,
|
|
345
347
|
AirXPayConsumer
|
|
346
348
|
} from './contexts/AirXPayProvider';
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## 🧪 Development Utilities
|
|
352
|
-
|
|
353
|
-
```tsx
|
|
349
|
+
🧪 Development Utilities
|
|
350
|
+
tsx
|
|
354
351
|
import { __DEV__ } from '@airxpay/sdk-ui';
|
|
355
352
|
|
|
356
353
|
if (__DEV__) {
|
|
357
354
|
console.log('Running in development mode');
|
|
358
355
|
}
|
|
359
|
-
|
|
356
|
+
The __DEV__ flag helps you conditionally run code only in development environments.
|
|
360
357
|
|
|
361
|
-
|
|
358
|
+
📈 Performance
|
|
359
|
+
Memoized Components: All step components are memoized
|
|
362
360
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
## 📈 Performance
|
|
366
|
-
|
|
367
|
-
- **Memoized Components:** All step components are memoized
|
|
368
|
-
- **Optimized Re-renders:** Context splitting prevents unnecessary renders
|
|
369
|
-
- **Lazy Loading:** Steps load on-demand
|
|
370
|
-
- **Development Logging:** Auto-disabled in production via `__DEV__`
|
|
371
|
-
|
|
372
|
-
---
|
|
361
|
+
Optimized Re-renders: Context splitting prevents unnecessary renders
|
|
373
362
|
|
|
374
|
-
|
|
363
|
+
Lazy Loading: Steps load on-demand
|
|
375
364
|
|
|
376
|
-
|
|
377
|
-
- File uploads are validated client-side
|
|
378
|
-
- Sensitive data never stored in logs
|
|
379
|
-
- HTTPS enforced for all requests
|
|
380
|
-
- XSS protection via input sanitization
|
|
365
|
+
Development Logging: Auto-disabled in production via __DEV__
|
|
381
366
|
|
|
382
|
-
|
|
367
|
+
🔒 Security
|
|
368
|
+
All API calls require valid publicKey
|
|
383
369
|
|
|
384
|
-
|
|
370
|
+
File uploads are validated client-side
|
|
385
371
|
|
|
386
|
-
|
|
387
|
-
|-------|----------|
|
|
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 |
|
|
391
|
-
| Images not uploading | Check Expo ImagePicker permissions |
|
|
392
|
-
| TypeScript errors | Update to latest version |
|
|
372
|
+
Sensitive data never stored in logs
|
|
393
373
|
|
|
394
|
-
|
|
374
|
+
HTTPS enforced for all requests
|
|
395
375
|
|
|
396
|
-
|
|
376
|
+
XSS protection via input sanitization
|
|
397
377
|
|
|
398
|
-
|
|
378
|
+
🐛 Troubleshooting
|
|
379
|
+
Issue Solution
|
|
380
|
+
"useAirXPay must be used within AirXPayProvider" Wrap your component tree with provider
|
|
381
|
+
"Public key appears to be invalid" Check if publicKey is at least 20 chars
|
|
382
|
+
Images not uploading Check Expo ImagePicker permissions
|
|
383
|
+
TypeScript errors Update to latest version
|
|
384
|
+
🎣 Available Hooks
|
|
385
|
+
The @airxpay/sdk-ui package provides several utility hooks for accessing configuration, managing initialization state, and safely interacting with the AirXPayProvider.
|
|
399
386
|
|
|
400
|
-
|
|
387
|
+
text
|
|
401
388
|
import {
|
|
402
389
|
useAirXPay,
|
|
403
390
|
useAirXPaySafe,
|
|
@@ -406,12 +393,10 @@ import {
|
|
|
406
393
|
} from '@airxpay/sdk-ui';
|
|
407
394
|
|
|
408
395
|
1️⃣ useAirXPay()
|
|
409
|
-
const {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
**Provides direct access to the full AirXPay configuration.**
|
|
396
|
+
const { publicKey } = useAirXPay();
|
|
397
|
+
Provides direct access to the full AirXPay configuration.
|
|
413
398
|
|
|
414
|
-
|
|
399
|
+
Behavior
|
|
415
400
|
|
|
416
401
|
Must be used inside AirXPayProvider.
|
|
417
402
|
|
|
@@ -421,22 +406,19 @@ Ensures strict enforcement of provider usage.
|
|
|
421
406
|
|
|
422
407
|
When to Use
|
|
423
408
|
|
|
424
|
-
Use this hook when you require guaranteed access to configuration values such as
|
|
409
|
+
Use this hook when you require guaranteed access to configuration values such as publicKey for:
|
|
425
410
|
|
|
426
411
|
API requests
|
|
427
412
|
|
|
428
413
|
Dynamic endpoint handling
|
|
429
414
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
# Recommended for: Production components where the provider is always present.
|
|
415
|
+
Advanced integrations
|
|
433
416
|
|
|
434
|
-
|
|
417
|
+
Recommended for: Production components where the provider is always present.
|
|
418
|
+
text
|
|
435
419
|
2️⃣ useAirXPaySafe()
|
|
436
420
|
const safeConfig = useAirXPaySafe();
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
A safe alternative to ```useAirXPay().```
|
|
421
|
+
A safe alternative to useAirXPay().
|
|
440
422
|
|
|
441
423
|
Behavior
|
|
442
424
|
|
|
@@ -454,11 +436,9 @@ Shared UI components that may or may not be wrapped in the provider
|
|
|
454
436
|
|
|
455
437
|
Recommended for: Flexible usage scenarios where provider presence is not guaranteed.
|
|
456
438
|
|
|
457
|
-
|
|
439
|
+
text
|
|
458
440
|
3️⃣ useProviderReady()
|
|
459
441
|
const isReady = useProviderReady();
|
|
460
|
-
```
|
|
461
|
-
|
|
462
442
|
Checks whether the SDK has been fully initialized.
|
|
463
443
|
|
|
464
444
|
Behavior
|
|
@@ -477,16 +457,14 @@ Delaying onboarding UI until SDK is ready
|
|
|
477
457
|
|
|
478
458
|
Recommended for: Applications using async initialization or class-based setup.
|
|
479
459
|
|
|
480
|
-
|
|
460
|
+
text
|
|
481
461
|
4️⃣ useAirXPayConfig(key)
|
|
482
|
-
const
|
|
483
|
-
```
|
|
484
|
-
|
|
462
|
+
const publicKey = useAirXPayConfig('publicKey');
|
|
485
463
|
Retrieves a specific configuration value from the provider.
|
|
486
464
|
|
|
487
465
|
Behavior
|
|
488
466
|
|
|
489
|
-
Accepts a configuration key
|
|
467
|
+
Accepts a configuration key (e.g.,'publicKey').
|
|
490
468
|
|
|
491
469
|
Returns only the requested value.
|
|
492
470
|
|
|
@@ -500,55 +478,47 @@ Cleaner and more focused component logic
|
|
|
500
478
|
|
|
501
479
|
Recommended for: Minimal, targeted configuration access.
|
|
502
480
|
|
|
503
|
-
|
|
504
|
-
|
|
481
|
+
📌 Hook Comparison
|
|
482
|
+
Hook Throws Error Safe Fallback Primary Purpose
|
|
505
483
|
|
|
506
|
-
|
|
484
|
+
text
|
|
507
485
|
useAirXPay ✅ Yes ❌ No Direct access to full configuration
|
|
508
486
|
useAirXPaySafe ❌ No ✅ Yes Optional/safe configuration access
|
|
509
487
|
useProviderReady ❌ No ✅ Yes Initialization state check
|
|
510
488
|
useAirXPayConfig ❌ No ✅ Yes Access a single configuration value
|
|
511
|
-
|
|
489
|
+
📝 Changelog
|
|
490
|
+
v1.0.5 (Latest)
|
|
491
|
+
Added class-based useIsAirXPayReady for async initialization
|
|
512
492
|
|
|
493
|
+
Enhanced error messages with stack traces
|
|
513
494
|
|
|
514
|
-
|
|
495
|
+
Added __DEV__ flag for environment detection
|
|
515
496
|
|
|
516
|
-
|
|
497
|
+
Improved TypeScript types
|
|
517
498
|
|
|
518
|
-
|
|
519
|
-
- Added class-based `useIsAirXPayReady` for async initialization
|
|
520
|
-
- Enhanced error messages with stack traces
|
|
521
|
-
- Added `__DEV__` flag for environment detection
|
|
522
|
-
- Improved TypeScript types
|
|
523
|
-
- Added `enableLogging` prop to provider
|
|
499
|
+
Added enableLogging prop to provider
|
|
524
500
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
- Basic step flow
|
|
528
|
-
- KYC document upload
|
|
529
|
-
- Bank details validation
|
|
501
|
+
v1.0.3
|
|
502
|
+
Initial release
|
|
530
503
|
|
|
531
|
-
|
|
504
|
+
Basic step flow
|
|
532
505
|
|
|
533
|
-
|
|
506
|
+
KYC document upload
|
|
534
507
|
|
|
535
|
-
|
|
536
|
-
2. Create feature branch (`git checkout -b feature/amazing`)
|
|
537
|
-
3. Commit changes (`git commit -m 'Add amazing feature'`)
|
|
538
|
-
4. Push to branch (`git push origin feature/amazing`)
|
|
539
|
-
5. Open a Pull Request
|
|
508
|
+
Bank details validation
|
|
540
509
|
|
|
541
|
-
|
|
510
|
+
🤝 Contributing
|
|
511
|
+
Fork the repository
|
|
542
512
|
|
|
543
|
-
|
|
513
|
+
Create feature branch (git checkout -b feature/amazing)
|
|
544
514
|
|
|
545
|
-
|
|
515
|
+
Commit changes (git commit -m 'Add amazing feature')
|
|
546
516
|
|
|
547
|
-
|
|
517
|
+
Push to branch (git push origin feature/amazing)
|
|
548
518
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
</div>
|
|
519
|
+
Open a Pull Request
|
|
520
|
+
|
|
521
|
+
📄 License
|
|
522
|
+
MIT License © 2026 Flixora Technologies
|
|
523
|
+
|
|
524
|
+
<div align="center"> <h3>Built with ❤️ by the Flixora Ecosystem</h3> <p><strong>Your Smile, Our Simplicity 😊</strong></p> <p><sub>Version 1.0.5 | Part of AirXPay, TizzyGo, TizzyOS, and TizzyChat</sub></p> <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> </div> ```
|