@airxpay/sdk-ui 1.0.7 → 1.0.8
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/dist/components/ui/MerchantOnboard/CustomSegmentedButtons.d.ts +15 -0
- package/dist/components/ui/MerchantOnboard/CustomSegmentedButtons.js +64 -0
- package/dist/contexts/AirXPayProvider.d.ts +1 -5
- package/dist/contexts/AirXPayProvider.js +21 -34
- package/dist/hooks/MerchantOnboarding.d.ts +5 -10
- package/dist/hooks/MerchantOnboarding.js +17 -117
- package/dist/hooks/useAirXPayReady.d.ts +6 -0
- package/dist/hooks/useAirXPayReady.js +27 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
interface ButtonType {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
showSelectedCheck?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface CustomSegmentedButtonsProps {
|
|
9
|
+
value: string;
|
|
10
|
+
onValueChange: (value: string) => void;
|
|
11
|
+
buttons: ButtonType[];
|
|
12
|
+
style?: ViewStyle;
|
|
13
|
+
}
|
|
14
|
+
declare const CustomSegmentedButtons: React.FC<CustomSegmentedButtonsProps>;
|
|
15
|
+
export default CustomSegmentedButtons;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const styles = react_native_1.StyleSheet.create({
|
|
9
|
+
segmentedContainer: {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
backgroundColor: '#f0f0f0',
|
|
12
|
+
borderRadius: 8,
|
|
13
|
+
padding: 4,
|
|
14
|
+
},
|
|
15
|
+
segmentedButton: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
paddingVertical: 8,
|
|
21
|
+
paddingHorizontal: 12,
|
|
22
|
+
borderRadius: 6,
|
|
23
|
+
backgroundColor: 'transparent',
|
|
24
|
+
},
|
|
25
|
+
segmentedButtonActive: {
|
|
26
|
+
backgroundColor: '#6200ee',
|
|
27
|
+
elevation: 2,
|
|
28
|
+
shadowColor: '#000',
|
|
29
|
+
shadowOffset: { width: 0, height: 1 },
|
|
30
|
+
shadowOpacity: 0.2,
|
|
31
|
+
shadowRadius: 1,
|
|
32
|
+
},
|
|
33
|
+
segmentedButtonText: {
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
fontWeight: '500',
|
|
36
|
+
color: '#666',
|
|
37
|
+
},
|
|
38
|
+
segmentedButtonTextActive: {
|
|
39
|
+
color: 'white',
|
|
40
|
+
},
|
|
41
|
+
segmentedButtonCheck: {
|
|
42
|
+
color: 'white',
|
|
43
|
+
marginLeft: 4,
|
|
44
|
+
fontSize: 14,
|
|
45
|
+
fontWeight: 'bold',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const CustomSegmentedButtons = ({ value, onValueChange, buttons, style, }) => {
|
|
49
|
+
return (<react_native_1.View style={[styles.segmentedContainer, style]}>
|
|
50
|
+
{buttons.map((button) => (<react_native_1.TouchableOpacity key={button.value} style={[
|
|
51
|
+
styles.segmentedButton,
|
|
52
|
+
value === button.value && styles.segmentedButtonActive
|
|
53
|
+
]} onPress={() => onValueChange(button.value)}>
|
|
54
|
+
<react_native_1.Text style={[
|
|
55
|
+
styles.segmentedButtonText,
|
|
56
|
+
value === button.value && styles.segmentedButtonTextActive
|
|
57
|
+
]}>
|
|
58
|
+
{button.label}
|
|
59
|
+
</react_native_1.Text>
|
|
60
|
+
{button.showSelectedCheck && value === button.value && (<react_native_1.Text style={styles.segmentedButtonCheck}>✓</react_native_1.Text>)}
|
|
61
|
+
</react_native_1.TouchableOpacity>))}
|
|
62
|
+
</react_native_1.View>);
|
|
63
|
+
};
|
|
64
|
+
exports.default = CustomSegmentedButtons;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frontend SDK - AirXPay Provider
|
|
3
|
-
* Context provider for merchant state management
|
|
4
|
-
*/
|
|
5
1
|
import React from 'react';
|
|
6
2
|
import { AirXPayConfig, MerchantCreateResponse } from '../types/merchantTypes';
|
|
7
3
|
interface AirXPayContextType extends AirXPayConfig {
|
|
8
4
|
isValid: boolean;
|
|
9
5
|
loading: boolean;
|
|
10
6
|
merchantData?: MerchantCreateResponse;
|
|
11
|
-
error?: string;
|
|
12
7
|
hasToken: boolean;
|
|
13
8
|
merchantId?: string;
|
|
14
9
|
setHasToken: (value: boolean) => void;
|
|
@@ -22,4 +17,5 @@ interface Props {
|
|
|
22
17
|
export declare const AirXPayProvider: React.FC<Props>;
|
|
23
18
|
export declare const useAirXPay: () => AirXPayContextType;
|
|
24
19
|
export declare const useAirXPaySafe: () => AirXPayContextType | null;
|
|
20
|
+
export declare const useProviderReady: () => boolean;
|
|
25
21
|
export {};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Frontend SDK - AirXPay Provider
|
|
4
|
-
* Context provider for merchant state management
|
|
5
|
-
*/
|
|
6
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
3
|
if (k2 === undefined) k2 = k;
|
|
8
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -46,13 +42,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
46
42
|
});
|
|
47
43
|
};
|
|
48
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.useAirXPaySafe = exports.useAirXPay = exports.AirXPayProvider = void 0;
|
|
45
|
+
exports.useProviderReady = exports.useAirXPaySafe = exports.useAirXPay = exports.AirXPayProvider = void 0;
|
|
50
46
|
const react_1 = __importStar(require("react"));
|
|
51
47
|
const tokenStorage_1 = require("../utils/tokenStorage");
|
|
52
48
|
const merchant_1 = require("../api/merchant");
|
|
53
49
|
const jwt_1 = require("../utils/jwt");
|
|
54
50
|
const AirXPayContext = (0, react_1.createContext)(null);
|
|
55
|
-
const AirXPayProvider = ({ config, children, enableLogging = __DEV__
|
|
51
|
+
const AirXPayProvider = ({ config, children, enableLogging = __DEV__ }) => {
|
|
56
52
|
const [state, setState] = (0, react_1.useState)(Object.assign(Object.assign({}, config), { isValid: false, loading: true, hasToken: false, setHasToken: () => { }, logout: () => __awaiter(void 0, void 0, void 0, function* () { }) }));
|
|
57
53
|
const [hasToken, setHasToken] = (0, react_1.useState)(false);
|
|
58
54
|
const [merchantId, setMerchantId] = (0, react_1.useState)();
|
|
@@ -60,58 +56,44 @@ const AirXPayProvider = ({ config, children, enableLogging = __DEV__, }) => {
|
|
|
60
56
|
yield (0, tokenStorage_1.clearStoredToken)();
|
|
61
57
|
setHasToken(false);
|
|
62
58
|
setMerchantId(undefined);
|
|
63
|
-
if (enableLogging)
|
|
59
|
+
if (enableLogging)
|
|
64
60
|
console.log('[AirXPay] User logged out');
|
|
65
|
-
}
|
|
66
61
|
}), [enableLogging]);
|
|
67
62
|
(0, react_1.useEffect)(() => {
|
|
68
63
|
const initialize = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
64
|
var _a;
|
|
70
65
|
if (!((_a = config.publicKey) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
71
|
-
setState(prev => (Object.assign(Object.assign({}, prev), { isValid: false, loading: false
|
|
66
|
+
setState(prev => (Object.assign(Object.assign({}, prev), { isValid: false, loading: false })));
|
|
72
67
|
return;
|
|
73
68
|
}
|
|
74
69
|
try {
|
|
75
|
-
// Initialize API client
|
|
76
70
|
(0, merchant_1.initializeApi)(config.publicKey);
|
|
77
|
-
// Check for stored token
|
|
78
71
|
const token = yield (0, tokenStorage_1.getStoredToken)();
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setMerchantId(extractedId);
|
|
84
|
-
}
|
|
85
|
-
setHasToken(hasValidToken);
|
|
86
|
-
// Verify public key
|
|
72
|
+
const validToken = !!token;
|
|
73
|
+
const id = validToken ? (0, jwt_1.getMerchantIdFromToken)(token) || undefined : undefined;
|
|
74
|
+
setHasToken(validToken);
|
|
75
|
+
setMerchantId(id);
|
|
87
76
|
const verification = yield (0, merchant_1.verifyPublicKey)(config.publicKey);
|
|
88
|
-
setState(Object.assign(Object.assign({}, config), { isValid: true, loading: false, merchantData: verification.merchantData, hasToken:
|
|
89
|
-
setHasToken,
|
|
77
|
+
setState(Object.assign(Object.assign({}, config), { isValid: true, loading: false, merchantData: verification.merchantData, hasToken: validToken, merchantId: id, setHasToken,
|
|
90
78
|
logout }));
|
|
91
|
-
if (enableLogging)
|
|
92
|
-
console.log('[AirXPay] Initialized', { hasToken:
|
|
93
|
-
}
|
|
79
|
+
if (enableLogging)
|
|
80
|
+
console.log('[AirXPay] Initialized', { hasToken: validToken });
|
|
94
81
|
}
|
|
95
82
|
catch (err) {
|
|
96
|
-
setState(Object.assign(Object.assign({}, config), { isValid: false, loading: false,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
console.error('[AirXPay] Initialization failed', err);
|
|
100
|
-
}
|
|
83
|
+
setState(Object.assign(Object.assign({}, config), { isValid: false, loading: false, hasToken: false, setHasToken, logout }));
|
|
84
|
+
if (enableLogging)
|
|
85
|
+
console.error('[AirXPay] Init failed', err);
|
|
101
86
|
}
|
|
102
87
|
});
|
|
103
88
|
initialize();
|
|
104
89
|
}, [config, enableLogging, logout]);
|
|
105
|
-
return
|
|
106
|
-
{children}
|
|
107
|
-
</AirXPayContext.Provider>);
|
|
90
|
+
return <AirXPayContext.Provider value={Object.assign(Object.assign({}, state), { hasToken, merchantId, setHasToken, logout })}>{children}</AirXPayContext.Provider>;
|
|
108
91
|
};
|
|
109
92
|
exports.AirXPayProvider = AirXPayProvider;
|
|
110
93
|
const useAirXPay = () => {
|
|
111
94
|
const context = (0, react_1.useContext)(AirXPayContext);
|
|
112
|
-
if (!context)
|
|
95
|
+
if (!context)
|
|
113
96
|
throw new Error('useAirXPay must be used inside <AirXPayProvider>');
|
|
114
|
-
}
|
|
115
97
|
return context;
|
|
116
98
|
};
|
|
117
99
|
exports.useAirXPay = useAirXPay;
|
|
@@ -124,3 +106,8 @@ const useAirXPaySafe = () => {
|
|
|
124
106
|
}
|
|
125
107
|
};
|
|
126
108
|
exports.useAirXPaySafe = useAirXPaySafe;
|
|
109
|
+
const useProviderReady = () => {
|
|
110
|
+
const airXPay = (0, exports.useAirXPaySafe)();
|
|
111
|
+
return !!airXPay && airXPay.isValid && !airXPay.loading;
|
|
112
|
+
};
|
|
113
|
+
exports.useProviderReady = useProviderReady;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MerchantOnboardingProps } from '../types/merchantTypes';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
+
* Hook to render the Merchant Onboarding Sheet safely
|
|
5
|
+
* Returns null if AirXPayProvider is not ready
|
|
4
6
|
*/
|
|
5
|
-
|
|
6
|
-
import { Merchant } from '../types/merchantTypes';
|
|
7
|
-
interface MerchantOnboardingScreenProps {
|
|
8
|
-
initialStep?: number;
|
|
9
|
-
onComplete?: (merchantData: Merchant) => void;
|
|
10
|
-
}
|
|
11
|
-
declare const MerchantOnboardingScreen: React.FC<MerchantOnboardingScreenProps>;
|
|
12
|
-
export default MerchantOnboardingScreen;
|
|
7
|
+
export declare const useAirXPaySheet: (props: Partial<MerchantOnboardingProps>) => React.JSX.Element | null;
|
|
@@ -1,125 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Frontend SDK - Merchant Onboarding Screen
|
|
4
|
-
* Fixed: Removed "pending" from MerchantStatus, aligned with backend
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
40
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
41
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
42
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
43
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
44
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
45
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
49
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
50
4
|
};
|
|
51
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
const react_native_paper_1 = require("react-native-paper");
|
|
6
|
+
exports.useAirXPaySheet = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
55
8
|
const MerchantOnboarding_1 = __importDefault(require("../components/ui/MerchantOnboard/MerchantOnboarding"));
|
|
56
9
|
const AirXPayProvider_1 = require("../contexts/AirXPayProvider");
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.log('[AirXPay] Token exists, showing completed state');
|
|
72
|
-
}
|
|
73
|
-
}, [hasToken]);
|
|
74
|
-
const handleNext = (stepData, step) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
setMerchantData(prev => (Object.assign(Object.assign({}, prev), stepData)));
|
|
76
|
-
if (step === 3 && stepData.isBankDetailsCompleted) {
|
|
77
|
-
setLoading(true);
|
|
78
|
-
try {
|
|
79
|
-
const response = yield (0, merchant_1.createMerchant)(Object.assign(Object.assign({}, merchantData), stepData));
|
|
80
|
-
if (response.token) {
|
|
81
|
-
setHasToken(true);
|
|
82
|
-
}
|
|
83
|
-
if (onComplete) {
|
|
84
|
-
onComplete(Object.assign(Object.assign(Object.assign({}, merchantData), stepData), { merchantId: response.merchant.merchantId, airxpayMerchantId: response.merchant.airxpayMerchantId, walletId: response.merchant.walletId, status: response.merchant.status, kycStatus: response.merchant.kycStatus, isKycCompleted: response.merchant.isKycCompleted, isBankDetailsCompleted: response.merchant.isBankDetailsCompleted, mode: response.merchant.mode }));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
console.error('[AirXPay] Failed to create merchant:', error);
|
|
89
|
-
}
|
|
90
|
-
finally {
|
|
91
|
-
setLoading(false);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const handleBack = (currentStep) => {
|
|
96
|
-
console.log('[AirXPay] Navigated back to step:', currentStep);
|
|
97
|
-
};
|
|
98
|
-
const handleComplete = (merchantData) => {
|
|
99
|
-
console.log('[AirXPay] Onboarding complete:', merchantData);
|
|
100
|
-
if (onComplete) {
|
|
101
|
-
onComplete(merchantData);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
if (loading) {
|
|
105
|
-
return (<react_native_1.View style={styles.loadingContainer}>
|
|
106
|
-
<react_native_paper_1.ActivityIndicator size="large" color="#0066CC"/>
|
|
107
|
-
<react_native_paper_1.Text style={styles.loadingText}>Creating your merchant account...</react_native_paper_1.Text>
|
|
108
|
-
</react_native_1.View>);
|
|
109
|
-
}
|
|
110
|
-
return (<MerchantOnboarding_1.default mode={merchantData.mode} initialStep={initialStep} isKycCompleted={merchantData.isKycCompleted || false} isBankDetailsCompleted={merchantData.isBankDetailsCompleted || false} kycStatus={merchantData.kycStatus || 'not_submitted'} status={merchantData.status || 'active'} initialData={merchantData} onNext={handleNext} onBack={handleBack} onComplete={handleComplete} loading={loading}/>);
|
|
10
|
+
/**
|
|
11
|
+
* Hook to render the Merchant Onboarding Sheet safely
|
|
12
|
+
* Returns null if AirXPayProvider is not ready
|
|
13
|
+
*/
|
|
14
|
+
const useAirXPaySheet = (props) => {
|
|
15
|
+
const airXPay = (0, AirXPayProvider_1.useAirXPaySafe)();
|
|
16
|
+
if (!(airXPay === null || airXPay === void 0 ? void 0 : airXPay.merchantData))
|
|
17
|
+
return null;
|
|
18
|
+
const merchantData = airXPay.merchantData;
|
|
19
|
+
// Default empty functions to satisfy required props
|
|
20
|
+
const defaultOnNext = (stepData, step) => { };
|
|
21
|
+
const defaultOnBack = (currentStep) => { };
|
|
22
|
+
const defaultOnComplete = (finalData) => { };
|
|
23
|
+
return (<MerchantOnboarding_1.default merchantId={merchantData.merchant.merchantId} mode={merchantData.merchant.mode} isKycCompleted={merchantData.merchant.isKycCompleted} isBankDetailsCompleted={merchantData.merchant.isBankDetailsCompleted} kycStatus={merchantData.merchant.kycStatus} status={merchantData.merchant.status} onNext={props.onNext || defaultOnNext} onBack={props.onBack || defaultOnBack} onComplete={props.onComplete || defaultOnComplete} initialStep={props.initialStep} loading={props.loading}/>);
|
|
111
24
|
};
|
|
112
|
-
|
|
113
|
-
loadingContainer: {
|
|
114
|
-
flex: 1,
|
|
115
|
-
justifyContent: 'center',
|
|
116
|
-
alignItems: 'center',
|
|
117
|
-
backgroundColor: '#FFFFFF',
|
|
118
|
-
},
|
|
119
|
-
loadingText: {
|
|
120
|
-
marginTop: 16,
|
|
121
|
-
fontSize: 16,
|
|
122
|
-
color: '#666666',
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
exports.default = MerchantOnboardingScreen;
|
|
25
|
+
exports.useAirXPaySheet = useAirXPaySheet;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AirXPayReady = void 0;
|
|
13
|
+
const merchant_1 = require("../api/merchant");
|
|
14
|
+
class AirXPayReady {
|
|
15
|
+
constructor(config) {
|
|
16
|
+
if (!config.publicKey) {
|
|
17
|
+
throw new Error("Public key is required");
|
|
18
|
+
}
|
|
19
|
+
this.publicKey = config.publicKey;
|
|
20
|
+
}
|
|
21
|
+
initialize() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
return yield (0, merchant_1.verifyPublicKey)(this.publicKey);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AirXPayReady = AirXPayReady;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Clean exports with proper separation
|
|
4
4
|
*/
|
|
5
5
|
export { AirXPayProvider } from './contexts/AirXPayProvider';
|
|
6
|
-
export { useAirXPay, useAirXPaySafe, } from './contexts/AirXPayProvider';
|
|
6
|
+
export { useAirXPay, useAirXPaySafe, useProviderReady } from './contexts/AirXPayProvider';
|
|
7
7
|
export { default as MerchantOnboarding } from './components/ui/MerchantOnboard/MerchantOnboarding';
|
|
8
8
|
export { default as OnboardingComplete } from './components/steps/OnboardingComplete';
|
|
9
9
|
export { initializeApi, createMerchant, getMerchantStatus } from './api/merchant';
|
package/dist/index.js
CHANGED
|
@@ -7,13 +7,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.isTokenExpired = exports.getMerchantIdFromToken = exports.decodeJWT = exports.tokenStorage = exports.getMerchantStatus = exports.createMerchant = exports.initializeApi = exports.OnboardingComplete = exports.MerchantOnboarding = exports.useAirXPaySafe = exports.useAirXPay = exports.AirXPayProvider = void 0;
|
|
10
|
+
exports.isTokenExpired = exports.getMerchantIdFromToken = exports.decodeJWT = exports.tokenStorage = exports.getMerchantStatus = exports.createMerchant = exports.initializeApi = exports.OnboardingComplete = exports.MerchantOnboarding = exports.useProviderReady = exports.useAirXPaySafe = exports.useAirXPay = exports.AirXPayProvider = void 0;
|
|
11
11
|
// Context
|
|
12
12
|
var AirXPayProvider_1 = require("./contexts/AirXPayProvider");
|
|
13
13
|
Object.defineProperty(exports, "AirXPayProvider", { enumerable: true, get: function () { return AirXPayProvider_1.AirXPayProvider; } });
|
|
14
14
|
var AirXPayProvider_2 = require("./contexts/AirXPayProvider");
|
|
15
15
|
Object.defineProperty(exports, "useAirXPay", { enumerable: true, get: function () { return AirXPayProvider_2.useAirXPay; } });
|
|
16
16
|
Object.defineProperty(exports, "useAirXPaySafe", { enumerable: true, get: function () { return AirXPayProvider_2.useAirXPaySafe; } });
|
|
17
|
+
Object.defineProperty(exports, "useProviderReady", { enumerable: true, get: function () { return AirXPayProvider_2.useProviderReady; } });
|
|
17
18
|
// Screens
|
|
18
19
|
var MerchantOnboarding_1 = require("./components/ui/MerchantOnboard/MerchantOnboarding");
|
|
19
20
|
Object.defineProperty(exports, "MerchantOnboarding", { enumerable: true, get: function () { return __importDefault(MerchantOnboarding_1).default; } });
|