@unifold/connect-react-native 0.1.22 → 0.1.24
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/index.d.mts +402 -370
- package/dist/index.d.ts +402 -370
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/stripe.d.mts +197 -190
- package/dist/stripe.d.ts +197 -190
- package/dist/stripe.js +3 -3
- package/dist/stripe.mjs +3 -3
- package/package.json +3 -5
package/dist/stripe.d.ts
CHANGED
|
@@ -1,204 +1,210 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
3
|
import { Onramp } from '@stripe/stripe-react-native';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
type OnrampSession = {
|
|
23
|
+
id: string;
|
|
24
|
+
client_secret: string;
|
|
25
|
+
status: string;
|
|
26
|
+
transaction_details: OnrampSessionTransactionDetails;
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
36
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
type CustomerVerification = {
|
|
38
|
+
name: "kyc_verified" | "phone_verified" | "id_document_verified" | string;
|
|
39
|
+
status: "verified" | "unverified" | string;
|
|
40
|
+
errors: string[];
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
type OnrampCustomer = {
|
|
43
|
+
id: string;
|
|
44
|
+
provided_fields: string[];
|
|
45
|
+
verifications: CustomerVerification[];
|
|
46
46
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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;
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
type KYCWizardScreenProps = {
|
|
63
|
+
initialData?: Partial<KYCData>;
|
|
64
|
+
loading?: boolean;
|
|
65
|
+
onComplete: (data: KYCData) => void;
|
|
66
|
+
onCancel: () => void;
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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;
|
|
75
77
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
};
|
|
89
91
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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";
|
|
113
115
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
116
|
+
declare function useStripeOnramp(config?: OnrampConfig): {
|
|
117
|
+
step: OnrampStep;
|
|
118
|
+
loading: boolean;
|
|
119
|
+
status: string;
|
|
120
|
+
error: OnrampError | null;
|
|
121
|
+
email: string;
|
|
122
|
+
phone: string;
|
|
123
|
+
fullName: string;
|
|
124
|
+
country: string;
|
|
125
|
+
customerId: string;
|
|
126
|
+
accessToken: string;
|
|
127
|
+
session: OnrampSession | null;
|
|
128
|
+
kycData: KYCData;
|
|
129
|
+
walletAddress: string;
|
|
130
|
+
resolvedRecipientAddress: string;
|
|
131
|
+
walletNetwork: Onramp.CryptoNetwork;
|
|
132
|
+
sourceAmount: string;
|
|
133
|
+
sourceCurrency: string;
|
|
134
|
+
destinationCurrency: string;
|
|
135
|
+
applePaySupported: boolean;
|
|
136
|
+
walletReady: boolean;
|
|
137
|
+
walletLoading: boolean;
|
|
138
|
+
setStep: react.Dispatch<react.SetStateAction<OnrampStep>>;
|
|
139
|
+
setStatus: react.Dispatch<react.SetStateAction<string>>;
|
|
140
|
+
setEmail: react.Dispatch<react.SetStateAction<string>>;
|
|
141
|
+
setPhone: react.Dispatch<react.SetStateAction<string>>;
|
|
142
|
+
setFullName: react.Dispatch<react.SetStateAction<string>>;
|
|
143
|
+
setCountry: react.Dispatch<react.SetStateAction<string>>;
|
|
144
|
+
setWalletAddress: react.Dispatch<react.SetStateAction<string>>;
|
|
145
|
+
setWalletNetwork: react.Dispatch<react.SetStateAction<Onramp.CryptoNetwork>>;
|
|
146
|
+
setSourceAmount: react.Dispatch<react.SetStateAction<string>>;
|
|
147
|
+
setSourceCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
148
|
+
setDestinationCurrency: react.Dispatch<react.SetStateAction<string>>;
|
|
149
|
+
checkEmail: () => Promise<void>;
|
|
150
|
+
register: () => Promise<void>;
|
|
151
|
+
attachKyc: (data: KYCData) => Promise<void>;
|
|
152
|
+
verifyIdentity: () => Promise<void>;
|
|
153
|
+
registerWallet: () => Promise<void>;
|
|
154
|
+
collectPaymentMethod: (useApplePay?: boolean) => Promise<void>;
|
|
155
|
+
refreshQuote: () => Promise<void>;
|
|
156
|
+
confirmCheckout: () => Promise<void>;
|
|
157
|
+
reset: () => void;
|
|
158
|
+
clearError: () => void;
|
|
159
|
+
resumeFulfillmentPolling: () => void;
|
|
160
|
+
amountFirst: boolean;
|
|
158
161
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
type StripeOnrampHook = ReturnType<typeof useStripeOnramp>;
|
|
163
|
+
|
|
164
|
+
declare function OnrampScreen({ config, onComplete }: {
|
|
165
|
+
config?: OnrampConfig;
|
|
166
|
+
onComplete?: () => void;
|
|
167
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
168
|
+
|
|
169
|
+
type AmountScreenProps = {
|
|
170
|
+
initialAmount?: string;
|
|
171
|
+
currency?: string;
|
|
172
|
+
onConfirm: (amount: string) => void;
|
|
173
|
+
onCancel: () => void;
|
|
169
174
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
175
|
+
declare function AmountScreen({ initialAmount, currency, onConfirm, onCancel, }: AmountScreenProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
|
|
177
|
+
interface StripeOnrampProps {
|
|
178
|
+
/** Unifold publishable key — pass from useUnifold().publishableKey */
|
|
179
|
+
publishableKey?: string;
|
|
180
|
+
/** User's email — pre-fills the email step */
|
|
181
|
+
email?: string;
|
|
182
|
+
/** User's phone — combined with email, skips both screens */
|
|
183
|
+
phone?: string;
|
|
184
|
+
/** Your app's user ID — used to auto-resolve the deposit wallet */
|
|
185
|
+
externalUserId: string;
|
|
186
|
+
/** Flow order: "verify_first" (default) or "amount_first" */
|
|
187
|
+
flowOrder?: "verify_first" | "amount_first";
|
|
188
|
+
/** Override destination chain type (default: "ethereum") */
|
|
189
|
+
destinationChainType?: "ethereum" | "solana" | "bitcoin";
|
|
190
|
+
/** Override destination chain ID (default: "8453" for Base) */
|
|
191
|
+
destinationChainId?: string;
|
|
192
|
+
/** Override destination token address */
|
|
193
|
+
destinationTokenAddress?: string;
|
|
194
|
+
/** Recipient wallet address — where purchased crypto is sent */
|
|
195
|
+
recipientAddress: string;
|
|
196
|
+
/** Called when the transaction completes successfully */
|
|
197
|
+
onComplete?: (transaction: OnrampTransaction) => void;
|
|
198
|
+
/** Called when an error occurs */
|
|
199
|
+
onError?: (error: OnrampError) => void;
|
|
200
|
+
/** Called when the flow step changes */
|
|
201
|
+
onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
|
|
202
|
+
/** Called when the user closes the flow (via ✕ or Done) */
|
|
203
|
+
onClose?: () => void;
|
|
204
|
+
/** Apple Pay merchant identifier (default: "merchant.io.unifold") */
|
|
205
|
+
merchantIdentifier?: string;
|
|
206
|
+
/** URL scheme for Stripe redirects (default: "unifoldOnramp") */
|
|
207
|
+
urlScheme?: string;
|
|
202
208
|
}
|
|
203
209
|
/**
|
|
204
210
|
* High-level Stripe Onramp component.
|
|
@@ -219,12 +225,13 @@ export interface StripeOnrampProps {
|
|
|
219
225
|
* />
|
|
220
226
|
* ```
|
|
221
227
|
*/
|
|
222
|
-
|
|
228
|
+
declare function StripeOnramp({ publishableKey, email, phone, externalUserId, flowOrder, destinationChainType, destinationChainId, destinationTokenAddress, recipientAddress, onComplete, onError, onStepChange, onClose, merchantIdentifier, urlScheme, }: StripeOnrampProps): react_jsx_runtime.JSX.Element;
|
|
229
|
+
|
|
223
230
|
/**
|
|
224
231
|
* Render inside StripeOnramp after initStripe() has completed.
|
|
225
232
|
* Eagerly calls configure() so the Onramp SDK is ready by the time
|
|
226
233
|
* useStripeOnramp needs it. Renders nothing.
|
|
227
234
|
*/
|
|
228
|
-
|
|
235
|
+
declare function StripeOnrampPreconfigure(): null;
|
|
229
236
|
|
|
230
|
-
export {};
|
|
237
|
+
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 };
|