@unifold/connect-react-native 0.1.26 → 0.1.27
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 +47 -9
- package/dist/index.d.mts +21 -9
- package/dist/index.d.ts +21 -9
- package/dist/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +19 -16
- package/dist/stripe.d.mts +0 -252
- package/dist/stripe.d.ts +0 -252
- package/dist/stripe.js +0 -2
- package/dist/stripe.mjs +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/connect-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "Unifold Connect React Native SDK - Crypto deposit and onramp for React Native/Expo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -10,11 +10,6 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.mjs",
|
|
12
12
|
"require": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./stripe": {
|
|
15
|
-
"types": "./dist/stripe.d.ts",
|
|
16
|
-
"import": "./dist/stripe.mjs",
|
|
17
|
-
"require": "./dist/stripe.js"
|
|
18
13
|
}
|
|
19
14
|
},
|
|
20
15
|
"files": [
|
|
@@ -23,30 +18,38 @@
|
|
|
23
18
|
"LICENSE"
|
|
24
19
|
],
|
|
25
20
|
"peerDependencies": {
|
|
21
|
+
"@react-native-async-storage/async-storage": ">=1.19.0",
|
|
22
|
+
"@stripe/stripe-react-native": ">=0.62.0",
|
|
26
23
|
"expo": ">=49.0.0",
|
|
27
24
|
"react": "^18.2.0 || ^19.0.0",
|
|
28
|
-
"react-native": ">=0.72.0"
|
|
25
|
+
"react-native": ">=0.72.0",
|
|
26
|
+
"react-native-gesture-handler": ">=2.14.0",
|
|
27
|
+
"react-native-svg": ">=13.0.0",
|
|
28
|
+
"react-native-webview": ">=13.0.0",
|
|
29
|
+
"expo-constants": ">=14.0.0"
|
|
29
30
|
},
|
|
30
31
|
"peerDependenciesMeta": {
|
|
31
32
|
"expo": {
|
|
32
33
|
"optional": true
|
|
34
|
+
},
|
|
35
|
+
"expo-constants": {
|
|
36
|
+
"optional": true
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
|
-
"
|
|
37
|
-
"@stripe/stripe-react-native": "^0.62.0",
|
|
38
|
-
"@tanstack/react-query": "^5.90.11",
|
|
39
|
-
"react-native-gesture-handler": "^2.14.0",
|
|
40
|
-
"react-native-qrcode-svg": "^6.3.2",
|
|
41
|
-
"react-native-svg": "^14.0.0",
|
|
42
|
-
"react-native-webview": "^13.0.0"
|
|
40
|
+
"react-native-qrcode-svg": "^6.3.2"
|
|
43
41
|
},
|
|
44
42
|
"devDependencies": {
|
|
43
|
+
"@react-native-async-storage/async-storage": "^1.23.1",
|
|
44
|
+
"@stripe/stripe-react-native": "^0.62.0",
|
|
45
45
|
"@types/react": "^18.2.0",
|
|
46
46
|
"@types/react-native": "^0.72.0",
|
|
47
|
+
"react-native-gesture-handler": "^2.30.0",
|
|
48
|
+
"react-native-svg": "15.8.0",
|
|
49
|
+
"react-native-webview": "13.12.5",
|
|
47
50
|
"tsup": "^8.0.0",
|
|
48
51
|
"typescript": "^5.0.0",
|
|
49
|
-
"@unifold/ui-react-native": "0.1.
|
|
52
|
+
"@unifold/ui-react-native": "0.1.19"
|
|
50
53
|
},
|
|
51
54
|
"keywords": [
|
|
52
55
|
"unifold",
|
|
@@ -73,7 +76,7 @@
|
|
|
73
76
|
},
|
|
74
77
|
"homepage": "https://unifold.io",
|
|
75
78
|
"scripts": {
|
|
76
|
-
"build": "tsup && cp dist/index.d.ts dist/index.d.mts
|
|
79
|
+
"build": "tsup && cp dist/index.d.ts dist/index.d.mts",
|
|
77
80
|
"dev": "tsup --watch",
|
|
78
81
|
"clean": "rm -rf dist",
|
|
79
82
|
"lint": "eslint \"src/**/*.ts*\"",
|
package/dist/stripe.d.mts
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { Onramp } from '@stripe/stripe-react-native';
|
|
4
|
-
|
|
5
|
-
declare function setStripeOnrampPublishableKey(key: string): void;
|
|
6
|
-
declare function setStripeOnrampApiUrl(url: string): void;
|
|
7
|
-
declare function getStripePublishableKey(): Promise<string>;
|
|
8
|
-
type OnrampSessionTransactionDetails = {
|
|
9
|
-
destination_amount: string;
|
|
10
|
-
destination_currency: string;
|
|
11
|
-
destination_network: string;
|
|
12
|
-
source_amount: string;
|
|
13
|
-
source_currency: string;
|
|
14
|
-
fees: {
|
|
15
|
-
network_fee_amount: string;
|
|
16
|
-
transaction_fee_amount: string;
|
|
17
|
-
};
|
|
18
|
-
quote_expiration: number;
|
|
19
|
-
wallet_address: string;
|
|
20
|
-
last_error: string | null;
|
|
21
|
-
};
|
|
22
|
-
type OnrampSession = {
|
|
23
|
-
id: string;
|
|
24
|
-
client_secret: string;
|
|
25
|
-
status: string;
|
|
26
|
-
transaction_details: OnrampSessionTransactionDetails;
|
|
27
|
-
};
|
|
28
|
-
type CreateSessionParams = {
|
|
29
|
-
cryptoCustomerId: string;
|
|
30
|
-
paymentToken: string;
|
|
31
|
-
sourceAmount: number;
|
|
32
|
-
sourceCurrency: string;
|
|
33
|
-
destinationCurrency: string;
|
|
34
|
-
walletAddress: string;
|
|
35
|
-
destinationNetwork: string;
|
|
36
|
-
};
|
|
37
|
-
type CustomerVerification = {
|
|
38
|
-
name: "kyc_verified" | "phone_verified" | "id_document_verified" | string;
|
|
39
|
-
status: "verified" | "unverified" | string;
|
|
40
|
-
errors: string[];
|
|
41
|
-
};
|
|
42
|
-
type OnrampCustomer = {
|
|
43
|
-
id: string;
|
|
44
|
-
provided_fields: string[];
|
|
45
|
-
verifications: CustomerVerification[];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type KYCData = {
|
|
49
|
-
firstName: string;
|
|
50
|
-
lastName: string;
|
|
51
|
-
idNumber: string;
|
|
52
|
-
dobMonth: string;
|
|
53
|
-
dobDay: string;
|
|
54
|
-
dobYear: string;
|
|
55
|
-
addressLine1: string;
|
|
56
|
-
addressLine2: string;
|
|
57
|
-
city: string;
|
|
58
|
-
state: string;
|
|
59
|
-
postalCode: string;
|
|
60
|
-
country: string;
|
|
61
|
-
};
|
|
62
|
-
type KYCWizardScreenProps = {
|
|
63
|
-
initialData?: Partial<KYCData>;
|
|
64
|
-
loading?: boolean;
|
|
65
|
-
onComplete: (data: KYCData) => void;
|
|
66
|
-
onCancel: () => void;
|
|
67
|
-
};
|
|
68
|
-
declare function KYCWizardScreen({ initialData, loading, onComplete, onCancel, }: KYCWizardScreenProps): react_jsx_runtime.JSX.Element;
|
|
69
|
-
|
|
70
|
-
type OnrampStep = "email" | "register" | "kyc" | "identity" | "amount" | "wallet" | "payment_method" | "session_params" | "quote" | "processing" | "success";
|
|
71
|
-
type OnrampErrorCode = "configuration_error" | "authorization_error" | "registration_error" | "kyc_error" | "identity_error" | "wallet_error" | "payment_error" | "session_error" | "validation_error" | "unknown_error";
|
|
72
|
-
type OnrampError = {
|
|
73
|
-
code: OnrampErrorCode;
|
|
74
|
-
message: string;
|
|
75
|
-
step: OnrampStep;
|
|
76
|
-
stripeErrorCode?: string;
|
|
77
|
-
};
|
|
78
|
-
type OnrampTransaction = {
|
|
79
|
-
sessionId: string;
|
|
80
|
-
status: string;
|
|
81
|
-
sourceAmount: string;
|
|
82
|
-
sourceCurrency: string;
|
|
83
|
-
destinationAmount: string;
|
|
84
|
-
destinationCurrency: string;
|
|
85
|
-
destinationNetwork: string;
|
|
86
|
-
walletAddress: string;
|
|
87
|
-
fees: {
|
|
88
|
-
networkFee: string;
|
|
89
|
-
transactionFee: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
type OnrampConfig = {
|
|
93
|
-
merchantDisplayName?: string;
|
|
94
|
-
defaultWalletAddress?: string;
|
|
95
|
-
defaultNetwork?: Onramp.CryptoNetwork;
|
|
96
|
-
defaultSourceAmount?: string;
|
|
97
|
-
defaultSourceCurrency?: string;
|
|
98
|
-
defaultDestinationCurrency?: string;
|
|
99
|
-
onComplete?: (transaction: OnrampTransaction) => void;
|
|
100
|
-
onError?: (error: OnrampError) => void;
|
|
101
|
-
onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
|
|
102
|
-
/** Pre-fill email — skips the email screen and goes to register (phone) */
|
|
103
|
-
email?: string;
|
|
104
|
-
/** Pre-fill phone — combined with email, skips both screens and auto-triggers Link check + register */
|
|
105
|
-
phone?: string;
|
|
106
|
-
/** Same fields as DepositConfig / beginDeposit() — used to auto-resolve wallet */
|
|
107
|
-
publishableKey?: string;
|
|
108
|
-
externalUserId?: string;
|
|
109
|
-
recipientAddress?: string;
|
|
110
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
111
|
-
destinationChainId?: string;
|
|
112
|
-
destinationTokenAddress?: string;
|
|
113
|
-
/** Flow order: "verify_first" (default) starts with email, "amount_first" starts with amount entry */
|
|
114
|
-
flowOrder?: "verify_first" | "amount_first";
|
|
115
|
-
/**
|
|
116
|
-
* Apple Pay / Platform Pay merchant id (e.g. `merchant.com.your.app`).
|
|
117
|
-
* When unset or blank, Apple Pay is not offered and `isPlatformPaySupported` is not used for that path.
|
|
118
|
-
*/
|
|
119
|
-
merchantIdentifier?: string;
|
|
120
|
-
};
|
|
121
|
-
declare function useStripeOnramp(config?: OnrampConfig): {
|
|
122
|
-
step: OnrampStep;
|
|
123
|
-
loading: boolean;
|
|
124
|
-
status: string;
|
|
125
|
-
error: OnrampError | null;
|
|
126
|
-
email: string;
|
|
127
|
-
phone: string;
|
|
128
|
-
fullName: string;
|
|
129
|
-
country: string;
|
|
130
|
-
customerId: string;
|
|
131
|
-
accessToken: string;
|
|
132
|
-
session: OnrampSession | null;
|
|
133
|
-
kycData: KYCData;
|
|
134
|
-
walletAddress: string;
|
|
135
|
-
resolvedRecipientAddress: string;
|
|
136
|
-
walletNetwork: Onramp.CryptoNetwork;
|
|
137
|
-
sourceAmount: string;
|
|
138
|
-
sourceCurrency: string;
|
|
139
|
-
destinationCurrency: string;
|
|
140
|
-
applePaySupported: boolean;
|
|
141
|
-
walletReady: boolean;
|
|
142
|
-
walletLoading: boolean;
|
|
143
|
-
setStep: react.Dispatch<react.SetStateAction<OnrampStep>>;
|
|
144
|
-
setStatus: react.Dispatch<react.SetStateAction<string>>;
|
|
145
|
-
setEmail: react.Dispatch<react.SetStateAction<string>>;
|
|
146
|
-
setPhone: react.Dispatch<react.SetStateAction<string>>;
|
|
147
|
-
setFullName: react.Dispatch<react.SetStateAction<string>>;
|
|
148
|
-
setCountry: react.Dispatch<react.SetStateAction<string>>;
|
|
149
|
-
setWalletAddress: react.Dispatch<react.SetStateAction<string>>;
|
|
150
|
-
setWalletNetwork: react.Dispatch<react.SetStateAction<Onramp.CryptoNetwork>>;
|
|
151
|
-
setSourceAmount: react.Dispatch<react.SetStateAction<string>>;
|
|
152
|
-
setSourceCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
153
|
-
setDestinationCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
154
|
-
checkEmail: () => Promise<void>;
|
|
155
|
-
register: () => Promise<void>;
|
|
156
|
-
attachKyc: (data: KYCData) => Promise<void>;
|
|
157
|
-
verifyIdentity: () => Promise<void>;
|
|
158
|
-
registerWallet: () => Promise<void>;
|
|
159
|
-
collectPaymentMethod: (useApplePay?: boolean) => Promise<void>;
|
|
160
|
-
refreshQuote: () => Promise<void>;
|
|
161
|
-
confirmCheckout: () => Promise<void>;
|
|
162
|
-
reset: () => void;
|
|
163
|
-
clearError: () => void;
|
|
164
|
-
resumeFulfillmentPolling: () => void;
|
|
165
|
-
amountFirst: boolean;
|
|
166
|
-
};
|
|
167
|
-
type StripeOnrampHook = ReturnType<typeof useStripeOnramp>;
|
|
168
|
-
|
|
169
|
-
declare function OnrampScreen({ config, onComplete }: {
|
|
170
|
-
config?: OnrampConfig;
|
|
171
|
-
onComplete?: () => void;
|
|
172
|
-
}): react_jsx_runtime.JSX.Element | null;
|
|
173
|
-
|
|
174
|
-
type AmountScreenProps = {
|
|
175
|
-
initialAmount?: string;
|
|
176
|
-
currency?: string;
|
|
177
|
-
onConfirm: (amount: string) => void;
|
|
178
|
-
onCancel: () => void;
|
|
179
|
-
};
|
|
180
|
-
declare function AmountScreen({ initialAmount, currency, onConfirm, onCancel, }: AmountScreenProps): react_jsx_runtime.JSX.Element;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Props for the high-level StripeOnramp component.
|
|
184
|
-
*
|
|
185
|
-
* The developer only needs to provide their user-specific info.
|
|
186
|
-
* Everything else (Stripe key, StripeProvider, SDK preconfiguration)
|
|
187
|
-
* is handled automatically using the Unifold SDK context.
|
|
188
|
-
*/
|
|
189
|
-
interface StripeOnrampProps {
|
|
190
|
-
/** Unifold publishable key — pass from useUnifold().publishableKey */
|
|
191
|
-
publishableKey?: string;
|
|
192
|
-
/** User's email — pre-fills the email step */
|
|
193
|
-
email?: string;
|
|
194
|
-
/** User's phone — combined with email, skips both screens */
|
|
195
|
-
phone?: string;
|
|
196
|
-
/** Your app's user ID — used to auto-resolve the deposit wallet */
|
|
197
|
-
externalUserId: string;
|
|
198
|
-
/** Flow order: "verify_first" (default) or "amount_first" */
|
|
199
|
-
flowOrder?: "verify_first" | "amount_first";
|
|
200
|
-
/** Override destination chain type (default: "ethereum") */
|
|
201
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
202
|
-
/** Override destination chain ID (default: "8453" for Base) */
|
|
203
|
-
destinationChainId?: string;
|
|
204
|
-
/** Override destination token address */
|
|
205
|
-
destinationTokenAddress?: string;
|
|
206
|
-
/** Recipient wallet address — where purchased crypto is sent */
|
|
207
|
-
recipientAddress: string;
|
|
208
|
-
/** Called when the transaction completes successfully */
|
|
209
|
-
onComplete?: (transaction: OnrampTransaction) => void;
|
|
210
|
-
/** Called when an error occurs */
|
|
211
|
-
onError?: (error: OnrampError) => void;
|
|
212
|
-
/** Called when the flow step changes */
|
|
213
|
-
onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
|
|
214
|
-
/** Called when the user closes the flow (via ✕ or Done) */
|
|
215
|
-
onClose?: () => void;
|
|
216
|
-
/**
|
|
217
|
-
* Apple Pay merchant identifier (e.g. `merchant.com.your.app`). Defaults to empty — when empty,
|
|
218
|
-
* Apple Pay is hidden and `initStripe` is called without a merchant id.
|
|
219
|
-
*/
|
|
220
|
-
merchantIdentifier?: string;
|
|
221
|
-
/** URL scheme for Stripe redirects (default: "unifoldOnramp") */
|
|
222
|
-
urlScheme?: string;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* High-level Stripe Onramp component.
|
|
226
|
-
*
|
|
227
|
-
* Handles all the plumbing automatically:
|
|
228
|
-
* - Reads the Unifold publishable key from UnifoldProvider context
|
|
229
|
-
* - Fetches the Stripe publishable key from the Unifold API
|
|
230
|
-
* - Wraps in StripeProvider
|
|
231
|
-
* - Eagerly configures the Stripe Onramp SDK
|
|
232
|
-
* - Renders OnrampScreen with the config
|
|
233
|
-
*
|
|
234
|
-
* Usage:
|
|
235
|
-
* ```tsx
|
|
236
|
-
* <StripeOnramp
|
|
237
|
-
* email={user.email}
|
|
238
|
-
* externalUserId={user.id}
|
|
239
|
-
* onClose={() => navigation.goBack()}
|
|
240
|
-
* />
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
declare function StripeOnramp({ publishableKey, email, phone, externalUserId, flowOrder, destinationChainType, destinationChainId, destinationTokenAddress, recipientAddress, onComplete, onError, onStepChange, onClose, merchantIdentifier, urlScheme, }: StripeOnrampProps): react_jsx_runtime.JSX.Element;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Render inside StripeOnramp after initStripe() has completed.
|
|
247
|
-
* Eagerly calls configure() so the Onramp SDK is ready by the time
|
|
248
|
-
* useStripeOnramp needs it. Renders nothing.
|
|
249
|
-
*/
|
|
250
|
-
declare function StripeOnrampPreconfigure(): null;
|
|
251
|
-
|
|
252
|
-
export { AmountScreen, type CreateSessionParams, type CustomerVerification, type KYCData, KYCWizardScreen, type OnrampConfig, type OnrampCustomer, type OnrampError, type OnrampErrorCode, OnrampScreen, type OnrampSession, type OnrampSessionTransactionDetails, type OnrampStep, type OnrampTransaction, StripeOnramp, type StripeOnrampHook, StripeOnrampPreconfigure, type StripeOnrampProps, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp };
|
package/dist/stripe.d.ts
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as react from 'react';
|
|
3
|
-
import { Onramp } from '@stripe/stripe-react-native';
|
|
4
|
-
|
|
5
|
-
declare function setStripeOnrampPublishableKey(key: string): void;
|
|
6
|
-
declare function setStripeOnrampApiUrl(url: string): void;
|
|
7
|
-
declare function getStripePublishableKey(): Promise<string>;
|
|
8
|
-
type OnrampSessionTransactionDetails = {
|
|
9
|
-
destination_amount: string;
|
|
10
|
-
destination_currency: string;
|
|
11
|
-
destination_network: string;
|
|
12
|
-
source_amount: string;
|
|
13
|
-
source_currency: string;
|
|
14
|
-
fees: {
|
|
15
|
-
network_fee_amount: string;
|
|
16
|
-
transaction_fee_amount: string;
|
|
17
|
-
};
|
|
18
|
-
quote_expiration: number;
|
|
19
|
-
wallet_address: string;
|
|
20
|
-
last_error: string | null;
|
|
21
|
-
};
|
|
22
|
-
type OnrampSession = {
|
|
23
|
-
id: string;
|
|
24
|
-
client_secret: string;
|
|
25
|
-
status: string;
|
|
26
|
-
transaction_details: OnrampSessionTransactionDetails;
|
|
27
|
-
};
|
|
28
|
-
type CreateSessionParams = {
|
|
29
|
-
cryptoCustomerId: string;
|
|
30
|
-
paymentToken: string;
|
|
31
|
-
sourceAmount: number;
|
|
32
|
-
sourceCurrency: string;
|
|
33
|
-
destinationCurrency: string;
|
|
34
|
-
walletAddress: string;
|
|
35
|
-
destinationNetwork: string;
|
|
36
|
-
};
|
|
37
|
-
type CustomerVerification = {
|
|
38
|
-
name: "kyc_verified" | "phone_verified" | "id_document_verified" | string;
|
|
39
|
-
status: "verified" | "unverified" | string;
|
|
40
|
-
errors: string[];
|
|
41
|
-
};
|
|
42
|
-
type OnrampCustomer = {
|
|
43
|
-
id: string;
|
|
44
|
-
provided_fields: string[];
|
|
45
|
-
verifications: CustomerVerification[];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type KYCData = {
|
|
49
|
-
firstName: string;
|
|
50
|
-
lastName: string;
|
|
51
|
-
idNumber: string;
|
|
52
|
-
dobMonth: string;
|
|
53
|
-
dobDay: string;
|
|
54
|
-
dobYear: string;
|
|
55
|
-
addressLine1: string;
|
|
56
|
-
addressLine2: string;
|
|
57
|
-
city: string;
|
|
58
|
-
state: string;
|
|
59
|
-
postalCode: string;
|
|
60
|
-
country: string;
|
|
61
|
-
};
|
|
62
|
-
type KYCWizardScreenProps = {
|
|
63
|
-
initialData?: Partial<KYCData>;
|
|
64
|
-
loading?: boolean;
|
|
65
|
-
onComplete: (data: KYCData) => void;
|
|
66
|
-
onCancel: () => void;
|
|
67
|
-
};
|
|
68
|
-
declare function KYCWizardScreen({ initialData, loading, onComplete, onCancel, }: KYCWizardScreenProps): react_jsx_runtime.JSX.Element;
|
|
69
|
-
|
|
70
|
-
type OnrampStep = "email" | "register" | "kyc" | "identity" | "amount" | "wallet" | "payment_method" | "session_params" | "quote" | "processing" | "success";
|
|
71
|
-
type OnrampErrorCode = "configuration_error" | "authorization_error" | "registration_error" | "kyc_error" | "identity_error" | "wallet_error" | "payment_error" | "session_error" | "validation_error" | "unknown_error";
|
|
72
|
-
type OnrampError = {
|
|
73
|
-
code: OnrampErrorCode;
|
|
74
|
-
message: string;
|
|
75
|
-
step: OnrampStep;
|
|
76
|
-
stripeErrorCode?: string;
|
|
77
|
-
};
|
|
78
|
-
type OnrampTransaction = {
|
|
79
|
-
sessionId: string;
|
|
80
|
-
status: string;
|
|
81
|
-
sourceAmount: string;
|
|
82
|
-
sourceCurrency: string;
|
|
83
|
-
destinationAmount: string;
|
|
84
|
-
destinationCurrency: string;
|
|
85
|
-
destinationNetwork: string;
|
|
86
|
-
walletAddress: string;
|
|
87
|
-
fees: {
|
|
88
|
-
networkFee: string;
|
|
89
|
-
transactionFee: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
type OnrampConfig = {
|
|
93
|
-
merchantDisplayName?: string;
|
|
94
|
-
defaultWalletAddress?: string;
|
|
95
|
-
defaultNetwork?: Onramp.CryptoNetwork;
|
|
96
|
-
defaultSourceAmount?: string;
|
|
97
|
-
defaultSourceCurrency?: string;
|
|
98
|
-
defaultDestinationCurrency?: string;
|
|
99
|
-
onComplete?: (transaction: OnrampTransaction) => void;
|
|
100
|
-
onError?: (error: OnrampError) => void;
|
|
101
|
-
onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
|
|
102
|
-
/** Pre-fill email — skips the email screen and goes to register (phone) */
|
|
103
|
-
email?: string;
|
|
104
|
-
/** Pre-fill phone — combined with email, skips both screens and auto-triggers Link check + register */
|
|
105
|
-
phone?: string;
|
|
106
|
-
/** Same fields as DepositConfig / beginDeposit() — used to auto-resolve wallet */
|
|
107
|
-
publishableKey?: string;
|
|
108
|
-
externalUserId?: string;
|
|
109
|
-
recipientAddress?: string;
|
|
110
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
111
|
-
destinationChainId?: string;
|
|
112
|
-
destinationTokenAddress?: string;
|
|
113
|
-
/** Flow order: "verify_first" (default) starts with email, "amount_first" starts with amount entry */
|
|
114
|
-
flowOrder?: "verify_first" | "amount_first";
|
|
115
|
-
/**
|
|
116
|
-
* Apple Pay / Platform Pay merchant id (e.g. `merchant.com.your.app`).
|
|
117
|
-
* When unset or blank, Apple Pay is not offered and `isPlatformPaySupported` is not used for that path.
|
|
118
|
-
*/
|
|
119
|
-
merchantIdentifier?: string;
|
|
120
|
-
};
|
|
121
|
-
declare function useStripeOnramp(config?: OnrampConfig): {
|
|
122
|
-
step: OnrampStep;
|
|
123
|
-
loading: boolean;
|
|
124
|
-
status: string;
|
|
125
|
-
error: OnrampError | null;
|
|
126
|
-
email: string;
|
|
127
|
-
phone: string;
|
|
128
|
-
fullName: string;
|
|
129
|
-
country: string;
|
|
130
|
-
customerId: string;
|
|
131
|
-
accessToken: string;
|
|
132
|
-
session: OnrampSession | null;
|
|
133
|
-
kycData: KYCData;
|
|
134
|
-
walletAddress: string;
|
|
135
|
-
resolvedRecipientAddress: string;
|
|
136
|
-
walletNetwork: Onramp.CryptoNetwork;
|
|
137
|
-
sourceAmount: string;
|
|
138
|
-
sourceCurrency: string;
|
|
139
|
-
destinationCurrency: string;
|
|
140
|
-
applePaySupported: boolean;
|
|
141
|
-
walletReady: boolean;
|
|
142
|
-
walletLoading: boolean;
|
|
143
|
-
setStep: react.Dispatch<react.SetStateAction<OnrampStep>>;
|
|
144
|
-
setStatus: react.Dispatch<react.SetStateAction<string>>;
|
|
145
|
-
setEmail: react.Dispatch<react.SetStateAction<string>>;
|
|
146
|
-
setPhone: react.Dispatch<react.SetStateAction<string>>;
|
|
147
|
-
setFullName: react.Dispatch<react.SetStateAction<string>>;
|
|
148
|
-
setCountry: react.Dispatch<react.SetStateAction<string>>;
|
|
149
|
-
setWalletAddress: react.Dispatch<react.SetStateAction<string>>;
|
|
150
|
-
setWalletNetwork: react.Dispatch<react.SetStateAction<Onramp.CryptoNetwork>>;
|
|
151
|
-
setSourceAmount: react.Dispatch<react.SetStateAction<string>>;
|
|
152
|
-
setSourceCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
153
|
-
setDestinationCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
154
|
-
checkEmail: () => Promise<void>;
|
|
155
|
-
register: () => Promise<void>;
|
|
156
|
-
attachKyc: (data: KYCData) => Promise<void>;
|
|
157
|
-
verifyIdentity: () => Promise<void>;
|
|
158
|
-
registerWallet: () => Promise<void>;
|
|
159
|
-
collectPaymentMethod: (useApplePay?: boolean) => Promise<void>;
|
|
160
|
-
refreshQuote: () => Promise<void>;
|
|
161
|
-
confirmCheckout: () => Promise<void>;
|
|
162
|
-
reset: () => void;
|
|
163
|
-
clearError: () => void;
|
|
164
|
-
resumeFulfillmentPolling: () => void;
|
|
165
|
-
amountFirst: boolean;
|
|
166
|
-
};
|
|
167
|
-
type StripeOnrampHook = ReturnType<typeof useStripeOnramp>;
|
|
168
|
-
|
|
169
|
-
declare function OnrampScreen({ config, onComplete }: {
|
|
170
|
-
config?: OnrampConfig;
|
|
171
|
-
onComplete?: () => void;
|
|
172
|
-
}): react_jsx_runtime.JSX.Element | null;
|
|
173
|
-
|
|
174
|
-
type AmountScreenProps = {
|
|
175
|
-
initialAmount?: string;
|
|
176
|
-
currency?: string;
|
|
177
|
-
onConfirm: (amount: string) => void;
|
|
178
|
-
onCancel: () => void;
|
|
179
|
-
};
|
|
180
|
-
declare function AmountScreen({ initialAmount, currency, onConfirm, onCancel, }: AmountScreenProps): react_jsx_runtime.JSX.Element;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Props for the high-level StripeOnramp component.
|
|
184
|
-
*
|
|
185
|
-
* The developer only needs to provide their user-specific info.
|
|
186
|
-
* Everything else (Stripe key, StripeProvider, SDK preconfiguration)
|
|
187
|
-
* is handled automatically using the Unifold SDK context.
|
|
188
|
-
*/
|
|
189
|
-
interface StripeOnrampProps {
|
|
190
|
-
/** Unifold publishable key — pass from useUnifold().publishableKey */
|
|
191
|
-
publishableKey?: string;
|
|
192
|
-
/** User's email — pre-fills the email step */
|
|
193
|
-
email?: string;
|
|
194
|
-
/** User's phone — combined with email, skips both screens */
|
|
195
|
-
phone?: string;
|
|
196
|
-
/** Your app's user ID — used to auto-resolve the deposit wallet */
|
|
197
|
-
externalUserId: string;
|
|
198
|
-
/** Flow order: "verify_first" (default) or "amount_first" */
|
|
199
|
-
flowOrder?: "verify_first" | "amount_first";
|
|
200
|
-
/** Override destination chain type (default: "ethereum") */
|
|
201
|
-
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
202
|
-
/** Override destination chain ID (default: "8453" for Base) */
|
|
203
|
-
destinationChainId?: string;
|
|
204
|
-
/** Override destination token address */
|
|
205
|
-
destinationTokenAddress?: string;
|
|
206
|
-
/** Recipient wallet address — where purchased crypto is sent */
|
|
207
|
-
recipientAddress: string;
|
|
208
|
-
/** Called when the transaction completes successfully */
|
|
209
|
-
onComplete?: (transaction: OnrampTransaction) => void;
|
|
210
|
-
/** Called when an error occurs */
|
|
211
|
-
onError?: (error: OnrampError) => void;
|
|
212
|
-
/** Called when the flow step changes */
|
|
213
|
-
onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
|
|
214
|
-
/** Called when the user closes the flow (via ✕ or Done) */
|
|
215
|
-
onClose?: () => void;
|
|
216
|
-
/**
|
|
217
|
-
* Apple Pay merchant identifier (e.g. `merchant.com.your.app`). Defaults to empty — when empty,
|
|
218
|
-
* Apple Pay is hidden and `initStripe` is called without a merchant id.
|
|
219
|
-
*/
|
|
220
|
-
merchantIdentifier?: string;
|
|
221
|
-
/** URL scheme for Stripe redirects (default: "unifoldOnramp") */
|
|
222
|
-
urlScheme?: string;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* High-level Stripe Onramp component.
|
|
226
|
-
*
|
|
227
|
-
* Handles all the plumbing automatically:
|
|
228
|
-
* - Reads the Unifold publishable key from UnifoldProvider context
|
|
229
|
-
* - Fetches the Stripe publishable key from the Unifold API
|
|
230
|
-
* - Wraps in StripeProvider
|
|
231
|
-
* - Eagerly configures the Stripe Onramp SDK
|
|
232
|
-
* - Renders OnrampScreen with the config
|
|
233
|
-
*
|
|
234
|
-
* Usage:
|
|
235
|
-
* ```tsx
|
|
236
|
-
* <StripeOnramp
|
|
237
|
-
* email={user.email}
|
|
238
|
-
* externalUserId={user.id}
|
|
239
|
-
* onClose={() => navigation.goBack()}
|
|
240
|
-
* />
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
declare function StripeOnramp({ publishableKey, email, phone, externalUserId, flowOrder, destinationChainType, destinationChainId, destinationTokenAddress, recipientAddress, onComplete, onError, onStepChange, onClose, merchantIdentifier, urlScheme, }: StripeOnrampProps): react_jsx_runtime.JSX.Element;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Render inside StripeOnramp after initStripe() has completed.
|
|
247
|
-
* Eagerly calls configure() so the Onramp SDK is ready by the time
|
|
248
|
-
* useStripeOnramp needs it. Renders nothing.
|
|
249
|
-
*/
|
|
250
|
-
declare function StripeOnrampPreconfigure(): null;
|
|
251
|
-
|
|
252
|
-
export { AmountScreen, type CreateSessionParams, type CustomerVerification, type KYCData, KYCWizardScreen, type OnrampConfig, type OnrampCustomer, type OnrampError, type OnrampErrorCode, OnrampScreen, type OnrampSession, type OnrampSessionTransactionDetails, type OnrampStep, type OnrampTransaction, StripeOnramp, type StripeOnrampHook, StripeOnrampPreconfigure, type StripeOnrampProps, getStripePublishableKey, setStripeOnrampApiUrl, setStripeOnrampPublishableKey, useStripeOnramp };
|