@unifold/connect-react-native 0.1.23 → 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/stripe.d.ts CHANGED
@@ -1,31 +1,237 @@
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
+ 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;
161
+ };
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;
174
+ };
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;
208
+ }
1
209
  /**
2
- * Declaration for `@unifold/connect-react-native/stripe`.
3
- * Runtime re-exports `@unifold/ui-react-native/stripe`; types follow the UI package.
210
+ * High-level Stripe Onramp component.
211
+ *
212
+ * Handles all the plumbing automatically:
213
+ * - Reads the Unifold publishable key from UnifoldProvider context
214
+ * - Fetches the Stripe publishable key from the Unifold API
215
+ * - Wraps in StripeProvider
216
+ * - Eagerly configures the Stripe Onramp SDK
217
+ * - Renders OnrampScreen with the config
218
+ *
219
+ * Usage:
220
+ * ```tsx
221
+ * <StripeOnramp
222
+ * email={user.email}
223
+ * externalUserId={user.id}
224
+ * onClose={() => navigation.goBack()}
225
+ * />
226
+ * ```
4
227
  */
5
- export {
6
- StripeOnramp,
7
- OnrampScreen,
8
- AmountScreen,
9
- KYCWizardScreen,
10
- StripeOnrampPreconfigure,
11
- useStripeOnramp,
12
- setStripeOnrampPublishableKey,
13
- setStripeOnrampApiUrl,
14
- getStripePublishableKey,
15
- } from "@unifold/ui-react-native/stripe";
16
-
17
- export type {
18
- StripeOnrampProps,
19
- KYCData,
20
- OnrampStep,
21
- OnrampErrorCode,
22
- OnrampError,
23
- OnrampTransaction,
24
- OnrampConfig,
25
- StripeOnrampHook,
26
- OnrampSession,
27
- OnrampSessionTransactionDetails,
28
- CreateSessionParams,
29
- CustomerVerification,
30
- OnrampCustomer,
31
- } from "@unifold/ui-react-native/stripe";
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
+
230
+ /**
231
+ * Render inside StripeOnramp after initStripe() has completed.
232
+ * Eagerly calls configure() so the Onramp SDK is ready by the time
233
+ * useStripeOnramp needs it. Renders nothing.
234
+ */
235
+ declare function StripeOnrampPreconfigure(): null;
236
+
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 };
package/dist/stripe.js CHANGED
@@ -1 +1,3 @@
1
- 'use strict';var stripe=require('@unifold/ui-react-native/stripe');var n="__unifold_stripe_onramp__";function r(e){globalThis[n]=e;}r(stripe.StripeOnramp);Object.defineProperty(exports,"AmountScreen",{enumerable:true,get:function(){return stripe.AmountScreen}});Object.defineProperty(exports,"KYCWizardScreen",{enumerable:true,get:function(){return stripe.KYCWizardScreen}});Object.defineProperty(exports,"OnrampScreen",{enumerable:true,get:function(){return stripe.OnrampScreen}});Object.defineProperty(exports,"StripeOnramp",{enumerable:true,get:function(){return stripe.StripeOnramp}});Object.defineProperty(exports,"StripeOnrampPreconfigure",{enumerable:true,get:function(){return stripe.StripeOnrampPreconfigure}});Object.defineProperty(exports,"getStripePublishableKey",{enumerable:true,get:function(){return stripe.getStripePublishableKey}});Object.defineProperty(exports,"setStripeOnrampApiUrl",{enumerable:true,get:function(){return stripe.setStripeOnrampApiUrl}});Object.defineProperty(exports,"setStripeOnrampPublishableKey",{enumerable:true,get:function(){return stripe.setStripeOnrampPublishableKey}});Object.defineProperty(exports,"useStripeOnramp",{enumerable:true,get:function(){return stripe.useStripeOnramp}});
1
+ 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime'),Ot=require('react-native-svg'),stripeReactNative=require('@stripe/stripe-react-native');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ot__default=/*#__PURE__*/_interopDefault(Ot);var $o="__unifold_stripe_onramp__";function Fr(e){globalThis[$o]=e;}var Dr={dark:{background:"#2D2C2F",card:"#3A393C",cardHover:"#48474A",foreground:"#F8FAFC",foregroundMuted:"#94A3B8",foregroundSubtle:"#64748B",border:"#38383A",borderSecondary:"#48484A",primary:"#3B82F6",primaryForeground:"#FFFFFF",success:"#22C55E",successBackground:"rgba(34, 197, 94, 0.1)",warning:"#F59E0B",warningBackground:"rgba(245, 158, 11, 0.1)",error:"#EF4444",errorBackground:"rgba(239, 68, 68, 0.1)",overlay:"rgba(0, 0, 0, 0.7)"}},mr=Dr;function Kt(e,r){return r?{...e,...r,shadowOffset:r.shadowOffset??e.shadowOffset,backShadowOffset:r.backShadowOffset??e.backShadowOffset}:e}function fr(e,r,o){let t=(b,k,S)=>{return S},l={backgroundColor:t("card","backgroundColor",e.card),titleColor:t("card","titleColor",e.foreground),subtitleColor:t("card","subtitleColor",e.foregroundMuted),labelColor:t("card","labelColor",e.foregroundMuted),headerColor:t("card","headerColor",e.foregroundMuted),labelRightColor:t("card","labelRightColor",e.foregroundMuted),labelHighlightRightColor:t("card","labelHighlightRightColor",e.warning),textRightColor:t("card","textRightColor",e.foreground),subtextRightColor:t("card","subtextRightColor",e.foregroundMuted),rowLeftLabel:t("card","rowLeftLabel",e.foregroundMuted),rowRightLabel:t("card","rowRightLabel",e.foreground),iconColor:t("card","iconColor",e.primary),iconBackgroundColor:t("card","iconBackgroundColor",e.primary+"26"),actionColor:t("card","actionColor",e.foregroundMuted),actionIcon:t("card","actionIcon",e.foregroundMuted),descriptionColor:t("card","descriptionColor",e.foregroundMuted),borderRadius:t("card","borderRadius",12),borderWidth:t("card","borderWidth",0),borderColor:t("card","borderColor",e.border),shadowColor:t("card","shadowColor","#000"),shadowOffset:t("card","shadowOffset",{width:0,height:-4}),shadowOpacity:t("card","shadowOpacity",0),shadowRadius:t("card","shadowRadius",12),elevation:t("card","elevation",0),iconContainerBorderRadius:t("card","iconContainerBorderRadius",12),backShadowColor:"transparent",backShadowOffset:{top:4,left:4,right:-4,bottom:-4},backShadowSpacing:8},s=(r?.depositMenu)?.card,h=(r?.transferCrypto)?.depositAddress?.card,a=(r?.depositCard)?.quoteProvider?.card,p=(r?.depositTracker)?.executionRow?.card;return {header:{titleColor:t("header","titleColor",e.foreground),buttonColor:t("header","buttonColor",e.foreground)},card:l,input:{backgroundColor:t("input","backgroundColor",t("search","backgroundColor",e.card)),textColor:t("input","textColor",t("search","inputColor",e.foreground)),placeholderColor:t("input","placeholderColor",t("search","placeholderColor",e.foregroundMuted)),borderColor:t("input","borderColor",e.border),borderRadius:t("input","borderRadius",t("search","borderRadius",8)),borderWidth:t("input","borderWidth",1)},button:{primaryBackground:t("button","primaryBackground",e.primary),primaryText:t("button","primaryText",e.primaryForeground),secondaryBackground:t("button","secondaryBackground",e.card),secondaryText:t("button","secondaryText",e.foreground),borderRadius:t("button","borderRadius",12),borderWidth:t("button","borderWidth",0),borderColor:t("button","borderColor",e.border)},container:{titleColor:t("container","titleColor",e.foreground),subtitleColor:t("container","subtitleColor",e.foregroundMuted),actionColor:t("container","actionColor",e.foregroundMuted),actionTitle:t("container","actionTitle",e.foregroundMuted),buttonColor:t("container","buttonColor",e.primary),buttonTitleColor:t("container","buttonTitleColor",e.primaryForeground),iconBackgroundColor:t("container","iconBackgroundColor",e.success),iconColor:t("container","iconColor",e.foreground)},search:{backgroundColor:t("search","backgroundColor",e.card),inputColor:t("search","inputColor",e.foreground),placeholderColor:t("search","placeholderColor",e.foregroundMuted),borderRadius:t("search","borderRadius",8)},list:{titleSectionColor:t("list","titleSectionColor",e.foregroundMuted),rowBorderRadius:t("list","rowBorderRadius",12)},badge:{borderRadius:t("badge","borderRadius",8)},sheet:{shadowColor:t("sheet","shadowColor","#000"),shadowOffset:t("sheet","shadowOffset",{width:0,height:-4}),shadowOpacity:t("sheet","shadowOpacity",.1),shadowRadius:t("sheet","shadowRadius",12),elevation:t("sheet","elevation",16)},depositMenu:{card:Kt(l,s)},transferCrypto:{depositAddress:{card:Kt(l,h)}},depositCard:{quoteProvider:{card:Kt(l,a)}},depositTracker:{executionRow:{card:Kt(l,p)}}}}var Go=react.createContext(null);function L(){let e=react.useContext(Go);if(!e){let r=mr.dark;return {mode:"dark",colors:r,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:fr(r,void 0),isDark:true}}return e}function Er({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ot.Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ot.Polyline,{points:"12 19 5 12 12 5",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function zt({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ot.Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ot.Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Wr({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ot__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ot.Polyline,{points:"6 9 12 15 18 9",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Mr({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx(Ot.Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx(Ot.Path,{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function lt({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxRuntime.jsx(Ot__default.default,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx(Ot.Polyline,{points:"20 6 9 17 4 12",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function jr({size:e=28}){return jsxRuntime.jsx(Ot__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxRuntime.jsxs(Ot.G,{fillRule:"evenodd",children:[jsxRuntime.jsx(Ot.Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsxRuntime.jsx(Ot.Path,{fill:"#FFF",d:"M13.967 23.86c5.445 0 9.86-4.415 9.86-9.86s-4.415-9.86-9.86-9.86c-5.166 0-9.403 3.974-9.825 9.03h14.63v1.642H4.142c.413 5.065 4.654 9.047 9.826 9.047Z"})]})})}function zr({size:e=28}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ot.G,{clipPath:"url(#eth_clip)",children:[jsxRuntime.jsx(Ot.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#627EEA"}),jsxRuntime.jsx(Ot.Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ot.Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsxRuntime.jsx(Ot.Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsxRuntime.jsx(Ot.Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsxRuntime.jsx(Ot.Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsxRuntime.jsx(Ot.Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsxRuntime.jsx(Ot.Defs,{children:jsxRuntime.jsx(Ot.ClipPath,{id:"eth_clip",children:jsxRuntime.jsx(Ot.Rect,{width:28,height:28,fill:"white"})})})]})}function Hr({size:e=28}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxRuntime.jsxs(Ot.G,{clipPath:"url(#btc_clip)",children:[jsxRuntime.jsx(Ot.Path,{d:"M14 28C21.732 28 28 21.732 28 14C28 6.26801 21.732 0 14 0C6.26801 0 0 6.26801 0 14C0 21.732 6.26801 28 14 28Z",fill:"#F7931A"}),jsxRuntime.jsx(Ot.Path,{d:"M20.0594 12.1625C20.3438 10.2594 18.9 9.23124 16.9203 8.55311L17.5656 5.97186L15.9906 5.57811L15.3672 8.09374C14.9516 7.9953 14.525 7.89686 14.0985 7.79843L14.7328 5.27186L13.1578 4.87811L12.5125 7.45936C12.1735 7.3828 11.8344 7.30624 11.5063 7.22968V7.21874L9.34065 6.67186L8.92502 8.35624C8.92502 8.35624 10.0844 8.61874 10.0625 8.64061C10.6969 8.79374 10.8063 9.2203 10.7844 9.54843L10.0625 12.4578C10.1063 12.4687 10.161 12.4797 10.2266 12.5125C10.1828 12.5016 10.1281 12.4906 10.0735 12.4687L9.05627 16.5375C8.97971 16.7344 8.78284 17.0187 8.34534 16.9094C8.36721 16.9312 7.20784 16.625 7.20784 16.625L6.43127 18.4297L8.47659 18.9437C8.8594 19.0422 9.23127 19.1406 9.59221 19.2281L8.9469 21.8422L10.5219 22.2359L11.1672 19.6547C11.5938 19.775 12.0094 19.8734 12.4141 19.9828L11.7688 22.5531L13.3438 22.9469L13.9891 20.3328C16.6578 20.8359 18.6594 20.6281 19.5016 18.2219C20.1797 16.2859 19.4688 15.1703 18.0688 14.4375C19.086 14.2078 19.8516 13.5406 20.0594 12.1625ZM16.4938 17.1609C16.0125 19.0969 12.7531 18.0469 11.6922 17.7844L12.5453 14.35C13.6063 14.6125 16.9969 15.1484 16.4938 17.1609ZM16.975 12.1297C16.5375 13.8906 13.825 12.9937 12.95 12.775L13.7266 9.6578C14.6016 9.87655 17.4344 10.2812 16.975 12.1297Z",fill:"white"})]}),jsxRuntime.jsx(Ot.Defs,{children:jsxRuntime.jsx(Ot.ClipPath,{id:"btc_clip",children:jsxRuntime.jsx(Ot.Rect,{width:28,height:28,fill:"white"})})})]})}function qr({size:e=28}){return jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxRuntime.jsxs(Ot.Defs,{children:[jsxRuntime.jsxs(Ot.LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ot.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ot.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ot.LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ot.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ot.Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxRuntime.jsxs(Ot.LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx(Ot.Stop,{offset:"0",stopColor:"#00FFA3"}),jsxRuntime.jsx(Ot.Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsxRuntime.jsx(Ot.Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxRuntime.jsxs(Ot.G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsxRuntime.jsx(Ot.Path,{fill:"url(#sol2)",d:"M64.6,3.8C67.1,1.4,70.4,0,73.8,0h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,3.8z"}),jsxRuntime.jsx(Ot.Path,{fill:"url(#sol3)",d:"M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"}),jsxRuntime.jsx(Ot.Path,{fill:"url(#sol1)",d:"M64.6,237.9c2.4-2.4,5.7-3.8,9.2-3.8h317.4c5.8,0,8.7,7,4.6,11.1l-62.7,62.7c-2.4,2.4-5.7,3.8-9.2,3.8H6.5c-5.8,0-8.7-7-4.6-11.1L64.6,237.9z"})]})]})}function Yr({size:e=28}){return jsxRuntime.jsx(Ot__default.default,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxRuntime.jsxs(Ot.G,{children:[jsxRuntime.jsx(Ot.Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsxRuntime.jsx(Ot.Path,{fill:"#FFF",d:"M21.092 12.693c-.369-.215-.848-.215-1.254 0l-2.879 1.654-1.955 1.078-2.879 1.653c-.369.216-.848.216-1.254 0l-2.288-1.294c-.369-.215-.627-.61-.627-1.042V12.19c0-.431.221-.826.627-1.042l2.25-1.258c.37-.216.85-.216 1.256 0l2.25 1.258c.37.216.628.611.628 1.042v1.654l1.955-1.115v-1.653a1.16 1.16 0 0 0-.627-1.042l-4.17-2.372c-.369-.216-.848-.216-1.254 0l-4.244 2.372A1.16 1.16 0 0 0 6 11.076v4.78c0 .432.221.827.627 1.043l4.244 2.372c.369.215.849.215 1.254 0l2.879-1.618 1.955-1.114 2.879-1.617c.369-.216.848-.216 1.254 0l2.251 1.258c.37.215.627.61.627 1.042v2.552c0 .431-.22.826-.627 1.042l-2.25 1.294c-.37.216-.85.216-1.255 0l-2.251-1.258c-.37-.216-.628-.611-.628-1.042v-1.654l-1.955 1.115v1.653c0 .431.221.827.627 1.042l4.244 2.372c.369.216.848.216 1.254 0l4.244-2.372c.369-.215.627-.61.627-1.042v-4.78a1.16 1.16 0 0 0-.627-1.042l-4.28-2.409z"})]})})}var ut=[{label:"Base",value:stripeReactNative.Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:jr},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:zr},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:Hr},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:qr},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Yr}];function Gr(e,r=8,o=4){let n=e.trim();return n.length<=r+o+3?n:`${n.slice(0,r)}...${n.slice(-o)}`}function Ut(e,r){let o=parseFloat(e);if(isNaN(o))return e;let n=r.toLowerCase(),t=["eth","btc"].includes(n)?4:2;return o.toFixed(t)}function $t(e){let r=e.trim().toLowerCase();if(!r)return e.trim();let o=ut.find(t=>t.label.toLowerCase()===r);if(o)return o.label;let n=ut.find(t=>String(t.value).toLowerCase()===r);return n?n.label:e.trim()}function R({onPress:e,title:r}){let{components:o,fonts:n}=L(),t=jsxRuntime.jsx(reactNative.TouchableOpacity,{style:pt.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(zt,{size:20,color:o.header.buttonColor,strokeWidth:2})});return r?jsxRuntime.jsxs(reactNative.View,{style:pt.headerWithTitle,children:[jsxRuntime.jsx(reactNative.View,{style:pt.headerSide}),jsxRuntime.jsx(reactNative.Text,{style:[pt.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:r}),t]}):jsxRuntime.jsxs(reactNative.View,{style:pt.header,children:[jsxRuntime.jsx(reactNative.View,{style:pt.headerSpacer}),t]})}var Ht={paddingTop:60,paddingBottom:16},pt=reactNative.StyleSheet.create({header:{flexDirection:"row",justifyContent:"flex-end",...Ht},headerWithTitle:{flexDirection:"row",alignItems:"center",...Ht},headerSpacer:{flex:1},headerSide:{width:28},headerTitleText:{flex:1,textAlign:"center",fontSize:17},closeBtn:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"}});function D({error:e,progress:r,loading:o}){let{colors:n,fonts:t}=L();return e?jsxRuntime.jsx(reactNative.Text,{style:[Qr.errorText,{color:n.error},...t.regular?[{fontFamily:t.regular}]:[]],children:e.message}):r&&o&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Qr.progressText,{color:n.foregroundSubtle},...t.regular?[{fontFamily:t.regular}]:[]],children:r}):null}var Qr=reactNative.StyleSheet.create({errorText:{fontSize:14,textAlign:"center",lineHeight:20,marginTop:24},progressText:{fontSize:13,textAlign:"center",lineHeight:18,marginTop:24}});function De({quote:e,label:r,value:o,mono:n,last:t}){return jsxRuntime.jsxs(react.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:r}),jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,n&&e.rowMono],children:o})]}),t?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function Sr({quote:e,label:r,address:o,last:n}){let[t,l]=react.useState(false),{colors:s,components:h}=L(),a=()=>{reactNative.Clipboard.setString(o),l(true),setTimeout(()=>l(false),2e3);},p=Gr(o);return jsxRuntime.jsxs(react.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:e.row,children:[jsxRuntime.jsx(reactNative.Text,{style:e.rowLabel,children:r}),jsxRuntime.jsxs(reactNative.View,{style:e.rowRight,children:[jsxRuntime.jsx(reactNative.Text,{style:[e.rowValue,e.rowMono,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsxRuntime.jsx(reactNative.TouchableOpacity,{onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${r}`,children:t?jsxRuntime.jsx(lt,{size:14,color:s.success,strokeWidth:2.5}):jsxRuntime.jsx(Mr,{size:14,color:h.card.actionIcon,strokeWidth:2})})]})]}),n?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function mt(){let{colors:e,fonts:r,components:o}=L(),n=o.input,t=o.button,l=o.container,s=o.card,h=o.header;return react.useMemo(()=>{let a=s.borderRadius,p=reactNative.Platform.OS==="ios"?"Menlo":"monospace",b={flex:{flex:1},screen:{flex:1,backgroundColor:e.background,paddingHorizontal:24,paddingBottom:48},content:{flex:1,paddingTop:16},title:{fontSize:28,color:h.titleColor,marginBottom:8,...r.bold?{fontFamily:r.bold}:{}},subtitle:{fontSize:15,color:e.foregroundMuted,marginBottom:36,lineHeight:22,...r.regular?{fontFamily:r.regular}:{}},fieldWrap:{marginBottom:20},fieldLabel:{fontSize:13,color:e.foregroundSubtle,marginBottom:8,textTransform:"uppercase",letterSpacing:.5,...r.semibold?{fontFamily:r.semibold}:{}},input:{backgroundColor:n.backgroundColor,borderRadius:n.borderRadius,padding:16,fontSize:17,color:n.textColor,borderWidth:n.borderWidth,borderColor:n.borderColor,...r.regular?{fontFamily:r.regular}:{}},hint:{fontSize:12,color:e.foregroundSubtle,marginTop:8,...r.regular?{fontFamily:r.regular}:{}},emailRow:{flexDirection:"row",alignItems:"center",gap:6,marginTop:4,backgroundColor:e.card,paddingHorizontal:14,paddingVertical:10,borderRadius:Math.min(a,12)},emailLabel:{fontSize:13,color:e.foregroundSubtle,...r.regular?{fontFamily:r.regular}:{}},emailValue:{fontSize:13,color:e.foreground,...r.semibold?{fontFamily:r.semibold}:{}},footer:{gap:4},continueBtn:{backgroundColor:l.buttonColor,borderRadius:t.borderRadius,paddingVertical:18,alignItems:"center"},continueBtnDisabled:{backgroundColor:e.card},continueBtnText:{color:l.buttonTitleColor,fontSize:17,...r.bold?{fontFamily:r.bold}:{}},continueBtnTextDisabled:{color:e.foregroundSubtle,...r.regular?{fontFamily:r.regular}:{}},ghostBtn:{paddingVertical:16,alignItems:"center"},ghostBtnText:{color:e.foregroundMuted,fontSize:15,...r.medium?{fontFamily:r.medium}:{}},loaderInButton:{justifyContent:"center",alignItems:"center"}},k={amountContainer:{flex:1,alignItems:"center",justifyContent:"center",gap:8},amountText:{fontSize:64,color:e.foreground,letterSpacing:-2,minWidth:80,textAlign:"center",...r.regular?{fontFamily:r.regular}:{}},amountPlaceholder:{color:e.foregroundSubtle},currencyLabel:{fontSize:15,color:e.foregroundMuted,letterSpacing:1,...r.medium?{fontFamily:r.medium}:{}},numpad:{gap:4,marginBottom:24},numpadRow:{flexDirection:"row",justifyContent:"space-between"},numpadKey:{flex:1,height:68,alignItems:"center",justifyContent:"center",marginHorizontal:4},numpadKeyText:{fontSize:28,color:e.foreground,...r.regular?{fontFamily:r.regular}:{}},backspaceText:{fontSize:22,color:e.foregroundMuted,...r.regular?{fontFamily:r.regular}:{}}},S={heroBox:{backgroundColor:s.backgroundColor,borderRadius:a,padding:24,alignItems:"center",marginBottom:16,marginTop:8,borderWidth:s.borderWidth,borderColor:s.borderColor,gap:4},heroLabel:{fontSize:12,color:e.foregroundSubtle,letterSpacing:.5,textTransform:"uppercase",...r.semibold?{fontFamily:r.semibold}:{}},heroAmount:{fontSize:48,color:e.foreground,letterSpacing:-1,...r.bold?{fontFamily:r.bold}:{}},heroCurrency:{fontSize:22,color:e.primary,...r.medium?{fontFamily:r.medium}:{}},heroNetwork:{fontSize:15,color:e.foregroundSubtle,marginTop:2,...r.medium?{fontFamily:r.medium}:{}},card:{backgroundColor:s.backgroundColor,borderRadius:a,borderWidth:s.borderWidth,borderColor:s.borderColor,overflow:"hidden",marginBottom:12},row:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:14,paddingHorizontal:16},rowRight:{flex:1,minWidth:0,flexDirection:"row",alignItems:"center",justifyContent:"flex-end",gap:8},rowDivider:{height:1,marginHorizontal:16,backgroundColor:e.border},rowLabel:{fontSize:14,color:s.rowLeftLabel,...r.regular?{fontFamily:r.regular}:{}},rowValue:{fontSize:14,fontWeight:"500",color:s.rowRightLabel,...r.medium?{fontFamily:r.medium}:{}},rowMono:{fontFamily:p,fontSize:13}},c=Math.max(16,Math.min(a,22)),d={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:c,borderTopRightRadius:c,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:c,borderBottomRightRadius:c,borderTopLeftRadius:10,borderTopRightRadius:10,marginTop:16},swapConnectorWrap:{alignSelf:"center",zIndex:3,marginTop:-24,marginBottom:-32},swapConnectorCircle:{width:48,height:48,borderRadius:24,backgroundColor:e.primary,alignItems:"center",justifyContent:"center",borderWidth:4,borderColor:e.background},swapRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginTop:8,gap:12},swapLeftCol:{flex:1,minWidth:0},swapSpendAmount:{fontSize:40,color:e.foreground,letterSpacing:-1,...r.regular?{fontFamily:r.regular}:{}},swapReceivePrimary:{fontSize:40,color:e.foreground,letterSpacing:-1,...r.regular?{fontFamily:r.regular}:{}},swapReceiveSub:{fontSize:13,color:e.foregroundMuted,marginTop:4,...r.regular?{fontFamily:r.regular}:{}},swapPill:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:10,paddingHorizontal:14,borderRadius:999,backgroundColor:e.cardHover,borderWidth:s.borderWidth,borderColor:e.border},swapPillText:{fontSize:16,color:e.foreground,...r.semibold?{fontFamily:r.semibold}:{}},payHint:{fontSize:15,color:e.foregroundMuted,textAlign:"center",marginBottom:18,marginTop:4,...r.regular?{fontFamily:r.regular}:{}},summaryLabel:{fontSize:12,color:e.foregroundSubtle,textTransform:"uppercase",letterSpacing:.3,...r.semibold?{fontFamily:r.semibold}:{}},applePayBtn:{backgroundColor:t.secondaryBackground,borderRadius:t.borderRadius,borderWidth:t.borderWidth>0?t.borderWidth:1,borderColor:t.borderWidth>0?t.borderColor:e.border,paddingVertical:18,alignItems:"center",marginBottom:10},applePayBtnText:{color:t.secondaryText,fontSize:17,...r.bold?{fontFamily:r.bold}:{}}},_={input:{fontSize:14,fontFamily:p},list:{gap:8},row:{flexDirection:"row",alignItems:"center",paddingVertical:14,paddingHorizontal:16,borderRadius:Math.min(a,14),borderWidth:s.borderWidth,borderColor:e.border,backgroundColor:e.card},rowSelected:{borderColor:e.primary,backgroundColor:e.successBackground},iconWrap:{width:32,height:32,alignItems:"center",justifyContent:"center",marginRight:12},rowText:{flex:1,fontSize:15,color:e.foregroundMuted,...r.medium?{fontFamily:r.medium}:{}},rowTextSelected:{color:e.foreground,...r.semibold?{fontFamily:r.semibold}:{}},checkCircle:{width:24,height:24,borderRadius:12,backgroundColor:e.primary,alignItems:"center",justifyContent:"center"}},w={centered:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:24},spinnerWrap:{width:80,height:80,borderRadius:40,backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,alignItems:"center",justifyContent:"center",marginBottom:28},idIcon:{fontSize:36},checkCircle:{width:80,height:80,borderRadius:40,backgroundColor:e.successBackground,borderWidth:2,borderColor:e.success,alignItems:"center",justifyContent:"center",marginBottom:28},heading:{fontSize:28,color:h.titleColor,textAlign:"center",marginBottom:10,...r.bold?{fontFamily:r.bold}:{}},sub:{fontSize:15,color:e.foregroundMuted,textAlign:"center",lineHeight:22,marginBottom:36,...r.regular?{fontFamily:r.regular}:{}},successScrollContent:{flexGrow:1,width:"100%",alignItems:"center",paddingBottom:24},detailCard:{width:"100%"}};return {form:b,quote:S,pm:d,wallet:_,flow:w,amount:k}},[e,r,n,t,l,s,h])}var On=[["1","2","3"],["4","5","6"],["7","8","9"],["\u232B","0","."]];function Gt({initialAmount:e="",currency:r="USD",onConfirm:o,onCancel:n}){let t=mt(),[l,s]=react.useState(e),h=k=>{if(k==="\u232B"){s(S=>S.slice(0,-1));return}if(k==="."){if(l.includes("."))return;s(S=>S===""?"0.":S+".");return}s(S=>{let c=S.indexOf(".");return c!==-1&&S.length-c>2?S:S==="0"&&k!=="."?k:S+k});},a=l===""?"0":l,p=parseFloat(l),b=l!==""&&!isNaN(p)&&p>0;return jsxRuntime.jsxs(reactNative.View,{style:t.form.screen,children:[jsxRuntime.jsx(R,{onPress:n,title:"Enter amount"}),jsxRuntime.jsxs(reactNative.View,{style:t.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:t.amount.amountContainer,children:[jsxRuntime.jsxs(reactNative.Text,{style:[t.amount.amountText,a==="0"&&t.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",a]}),jsxRuntime.jsx(reactNative.Text,{style:t.amount.currencyLabel,children:r.toUpperCase()})]}),jsxRuntime.jsx(reactNative.View,{style:t.amount.numpad,children:On.map((k,S)=>jsxRuntime.jsx(reactNative.View,{style:t.amount.numpadRow,children:k.map(c=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:t.amount.numpadKey,onPress:()=>h(c),activeOpacity:.6,children:jsxRuntime.jsx(reactNative.Text,{style:c==="\u232B"?t.amount.backspaceText:t.amount.numpadKeyText,children:c})},c))},S))}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[t.form.continueBtn,!b&&t.form.continueBtnDisabled],onPress:()=>b&&o(l),disabled:!b,children:jsxRuntime.jsx(reactNative.Text,{style:[t.form.continueBtnText,!b&&t.form.continueBtnTextDisabled],children:"Continue"})})]})]})}function I({size:e=56,strokeWidth:r=3,children:o,iconSize:n,style:t,gradientFrom:l,gradientTo:s}){let{colors:h}=L(),a=l??h.warning,p=s??"#FBBF24",b=react.useRef(new reactNative.Animated.Value(0)).current,k=react.useId(),S=react.useMemo(()=>`circularProgressGrad_${k.replace(/[^a-zA-Z0-9_-]/g,"")}`,[k]),c=(e-r)/2,d=2*Math.PI*c,_=e/2,w=n??Math.max(0,Math.round(e-r*2-8)),G=(e-w)/2;react.useEffect(()=>{let U=reactNative.Animated.loop(reactNative.Animated.timing(b,{toValue:1,duration:1500,easing:reactNative.Easing.linear,useNativeDriver:true}));return U.start(),()=>U.stop()},[b]);let m=b.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxRuntime.jsxs(reactNative.View,{style:[{width:e,height:e},t],children:[jsxRuntime.jsx(reactNative.Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:m}]},children:jsxRuntime.jsxs(Ot__default.default,{width:e,height:e,children:[jsxRuntime.jsx(Ot.Defs,{children:jsxRuntime.jsxs(Ot.LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsxRuntime.jsx(Ot.Stop,{offset:"0%",stopColor:a}),jsxRuntime.jsx(Ot.Stop,{offset:"100%",stopColor:p})]})}),jsxRuntime.jsx(Ot.Circle,{cx:_,cy:_,r:c,stroke:`url(#${S})`,strokeWidth:r,fill:"none",strokeDasharray:`${d*.75} ${d*.25}`,strokeLinecap:"round",rotation:-90,origin:`${_}, ${_}`})]})}),o!=null?jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:G+1.5,left:G,width:w,height:w},children:o}):null]})}var Rt=4;function Jt({initialData:e={},loading:r=false,onComplete:o,onCancel:n}){let t=mt(),{colors:l,fonts:s,components:h}=L(),a=h.input.placeholderColor,[p,b]=react.useState(1),[k,S]=react.useState(e.firstName??""),[c,d]=react.useState(e.lastName??""),[_,w]=react.useState(e.dobMonth??""),[G,m]=react.useState(e.dobDay??""),[U,be]=react.useState(e.dobYear??""),[x,Re]=react.useState(e.addressLine1??""),[$,Xe]=react.useState(e.addressLine2??""),[ke,et]=react.useState(e.city??""),[we,tt]=react.useState(e.state??""),[Ce,rt]=react.useState(e.postalCode??""),[N,ot]=react.useState(e.country??"US"),[de,Ie]=react.useState(e.idNumber??""),je=react.useRef(null),Se=react.useRef(null),Ve=react.useRef(null),xe=react.useRef(null),_e=react.useRef(null),K=react.useRef(null),Ae=react.useRef(null),Be=react.useRef(null),nt=()=>{switch(p){case 1:return k.trim().length>0&&c.trim().length>0;case 2:return _.length===2&&G.length===2&&U.length===4;case 3:return x.trim().length>0&&ke.trim().length>0&&we.trim().length>0&&Ce.trim().length>0;case 4:return de.trim().length>0;default:return false}},Fe=()=>{nt()&&(p<Rt?b(O=>O+1):o({firstName:k,lastName:c,idNumber:de,dobMonth:_,dobDay:G,dobYear:U,addressLine1:x,addressLine2:$,city:ke,state:we,postalCode:Ce,country:N}));},ce=()=>{p>1?b(O=>O-1):n();},Ct=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],ar=["Use your full legal name as it appears on your ID.","We use this to verify your identity.","Enter the address associated with your ID.","Your SSN is encrypted and used only for identity verification."],lr=[P.stepCounter,{color:l.foregroundMuted},...s.semibold?[{fontFamily:s.semibold}]:[]];return jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:t.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:t.form.screen,children:[jsxRuntime.jsxs(reactNative.View,{style:P.header,children:[jsxRuntime.jsx(reactNative.View,{style:P.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:P.iconButton,onPress:ce,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsxRuntime.jsx(Er,{size:20,color:h.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:P.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:lr,children:[p," of ",Rt]})}),jsxRuntime.jsx(reactNative.View,{style:P.headerSide,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:P.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsxRuntime.jsx(zt,{size:20,color:h.header.buttonColor,strokeWidth:2})})})]}),jsxRuntime.jsx(reactNative.View,{style:P.progressTrack,children:Array.from({length:Rt}).map((O,F)=>jsxRuntime.jsx(reactNative.View,{style:[P.progressSegment,{backgroundColor:F<p||F+1===p?l.primary:l.border}]},F))}),jsxRuntime.jsxs(reactNative.ScrollView,{style:t.form.flex,contentContainerStyle:P.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsxRuntime.jsx(reactNative.Text,{style:t.form.title,children:Ct[p-1]}),jsxRuntime.jsx(reactNative.Text,{style:t.form.subtitle,children:ar[p-1]}),p===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pe,{form:t.form,label:"First name",children:jsxRuntime.jsx(reactNative.TextInput,{style:t.form.input,placeholder:"Jane",placeholderTextColor:a,value:k,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>je.current?.focus()})}),jsxRuntime.jsx(Pe,{form:t.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:je,style:t.form.input,placeholder:"Doe",placeholderTextColor:a,value:c,onChangeText:d,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Fe})})]}),p===2&&jsxRuntime.jsxs(reactNative.View,{style:P.dobRow,children:[jsxRuntime.jsxs(reactNative.View,{style:P.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Month"}),jsxRuntime.jsx(reactNative.TextInput,{style:[t.form.input,P.dobInput],placeholder:"MM",placeholderTextColor:a,value:_,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);w(F),F.length===2&&Se.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:P.dobCol,children:[jsxRuntime.jsx(reactNative.Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Day"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Se,style:[t.form.input,P.dobInput],placeholder:"DD",placeholderTextColor:a,value:G,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);m(F),F.length===2&&Ve.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxRuntime.jsxs(reactNative.View,{style:P.dobColWide,children:[jsxRuntime.jsx(reactNative.Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Year"}),jsxRuntime.jsx(reactNative.TextInput,{ref:Ve,style:[t.form.input,P.dobInput],placeholder:"YYYY",placeholderTextColor:a,value:U,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,4);be(F);},keyboardType:"number-pad",maxLength:4,returnKeyType:"done",onSubmitEditing:Fe})]})]}),p===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Pe,{form:t.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:t.form.input,placeholder:"123 Main St",placeholderTextColor:a,value:x,onChangeText:Re,returnKeyType:"next",onSubmitEditing:()=>xe.current?.focus()})}),jsxRuntime.jsx(Pe,{form:t.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:xe,style:t.form.input,placeholder:"Apt 2",placeholderTextColor:a,value:$,onChangeText:Xe,returnKeyType:"next",onSubmitEditing:()=>_e.current?.focus()})}),jsxRuntime.jsx(Pe,{form:t.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:_e,style:t.form.input,placeholder:"San Francisco",placeholderTextColor:a,value:ke,onChangeText:et,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>K.current?.focus()})}),jsxRuntime.jsxs(reactNative.View,{style:P.row,children:[jsxRuntime.jsx(reactNative.View,{style:[t.form.flex,{marginRight:8}],children:jsxRuntime.jsx(Pe,{form:t.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:K,style:t.form.input,placeholder:"NY",placeholderTextColor:a,value:we,onChangeText:O=>tt(O.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Ae.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:t.form.flex,children:jsxRuntime.jsx(Pe,{form:t.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ae,style:t.form.input,placeholder:"11201",placeholderTextColor:a,value:Ce,onChangeText:rt,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Be.current?.focus()})})})]}),jsxRuntime.jsx(Pe,{form:t.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Be,style:t.form.input,placeholder:"US",placeholderTextColor:a,value:N,onChangeText:O=>ot(O.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"done",onSubmitEditing:Fe})})]}),p===4&&jsxRuntime.jsxs(Pe,{form:t.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:t.form.input,placeholder:"123-45-6789",placeholderTextColor:a,value:de,onChangeText:Ie,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Fe}),jsxRuntime.jsx(reactNative.Text,{style:[t.form.hint,P.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsxRuntime.jsx(reactNative.View,{style:t.form.footer,children:r&&p===Rt?jsxRuntime.jsx(reactNative.View,{style:[t.form.continueBtn,t.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[t.form.continueBtn,!nt()&&t.form.continueBtnDisabled],onPress:Fe,disabled:!nt(),children:jsxRuntime.jsx(reactNative.Text,{style:[t.form.continueBtnText,!nt()&&t.form.continueBtnTextDisabled],children:p===Rt?"Submit":"Continue"})})})]})})}function Pe({form:e,label:r,children:o}){return jsxRuntime.jsxs(reactNative.View,{style:e.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.fieldLabel,children:r}),o]})}var P=reactNative.StyleSheet.create({header:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingTop:60,paddingBottom:16},headerSide:{width:40,alignItems:"center"},headerCenter:{flex:1,alignItems:"center",justifyContent:"center"},iconButton:{width:28,height:28,borderRadius:8,backgroundColor:"transparent",alignItems:"center",justifyContent:"center"},stepCounter:{fontSize:15},progressTrack:{flexDirection:"row",gap:4,marginBottom:32},progressSegment:{flex:1,height:3,borderRadius:2},scrollContent:{flexGrow:1,paddingBottom:16,paddingTop:16},dobRow:{flexDirection:"row",gap:10,marginBottom:20},dobCol:{flex:1},dobColWide:{flex:1.5},dobLabel:{textAlign:"center"},dobInput:{textAlign:"center"},row:{flexDirection:"row"},ssnHint:{marginTop:10,lineHeight:18}});var Nn="https://api.unifold.io",no,jn="pk_test_123";function Kn(){return typeof __DEV__<"u"&&__DEV__&&no?no:Nn}function io(){return Kn()}function Zt(){return jn}var so="",ao;function Xt(e){so=e;}function er(e){ao=e;}function ye(){let e=so||Zt();return e}function he(){return ao??io()}async function tr(){let e=`${he()}/v1/public/onramps/headless/stripe/config`,r=ye(),o=await fetch(e,{method:"GET",headers:{"x-publishable-key":r,"Content-Type":"application/json"}});if(!o.ok)throw new Error(`Failed to load Stripe config: ${o.status}`);let n=await o.json();if(!n?.publishable_key)throw new Error("Missing Stripe publishable key in config response");return n.publishable_key}async function lo(e){let r=await fetch(`${he()}/v1/public/onramps/headless/stripe/oauth/start`,{method:"POST",headers:{"x-publishable-key":ye(),"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(!r.ok)throw new Error(`Failed to create auth intent: ${r.status}`);let o=await r.json();return o.auth_intent_id??o.id}async function co(e){let r=await fetch(`${he()}/v1/public/onramps/headless/stripe/oauth/token`,{method:"POST",headers:{"x-publishable-key":ye(),"Content-Type":"application/json"},body:JSON.stringify({auth_intent_id:e})});if(!r.ok)throw new Error(`Failed to exchange auth intent for tokens: ${r.status}`);return r.json()}async function uo(e,r){let o={crypto_customer_id:e.cryptoCustomerId,payment_token:e.paymentToken,source_amount:e.sourceAmount,source_currency:e.sourceCurrency,destination_currency:e.destinationCurrency,wallet_address:e.walletAddress,destination_network:e.destinationNetwork},n=await fetch(`${he()}/v1/public/onramps/headless/stripe/sessions`,{method:"POST",headers:{"x-publishable-key":ye(),"x-stripe-oauth-token":r,"Content-Type":"application/json"},body:JSON.stringify(o)}),t=await n.text();if(!n.ok)throw new Error(`Failed to create onramp session: ${n.status} ${t}`);return JSON.parse(t)}async function po(e,r){let o=await fetch(`${he()}/v1/public/onramps/headless/stripe/sessions/${e}/confirm`,{method:"POST",headers:{"x-publishable-key":ye(),"x-stripe-oauth-token":r,"Content-Type":"application/json"}}),n=await o.text();if(!o.ok)throw new Error(`Failed to confirm onramp session: ${o.status} ${n}`);return JSON.parse(n)}async function mo(e,r){let o=`${he()}/v1/public/onramps/headless/stripe/customers/${e}`,n=await fetch(o,{method:"GET",headers:{"x-publishable-key":ye(),"x-stripe-oauth-token":r}}),t=await n.text();if(!n.ok)throw new Error(`Failed to get onramp customer: ${n.status} ${t}`);return JSON.parse(t)}async function fo(e,r){let o=`${he()}/v1/public/onramps/headless/stripe/sessions/${e}`,n=await fetch(o,{method:"GET",headers:{"x-publishable-key":ye(),"x-stripe-oauth-token":r}}),t=await n.text();if(!n.ok)throw new Error(`Failed to get onramp session: ${n.status} ${t}`);return JSON.parse(t)}async function yo(e,r){let o=await fetch(`${he()}/v1/public/onramps/headless/stripe/sessions/${e}/quote/refresh`,{method:"POST",headers:{"x-publishable-key":ye(),"x-stripe-oauth-token":r,"Content-Type":"application/json"}});if(!o.ok){let n=await o.text();throw new Error(`Failed to refresh quote: ${o.status} ${n}`)}return o.json()}async function ho(e){if(!e.recipient_address)throw new Error("[Unifold] recipient_address is required for fetchDepositAddress. Pass recipientAddress in your onramp config.");let r={external_user_id:e.external_user_id,destination_chain_type:e.destination_chain_type||"ethereum",destination_chain_id:e.destination_chain_id||"8453",destination_token_address:e.destination_token_address||"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",recipient_address:e.recipient_address,client_metadata:{}},o=await fetch(`${he()}/v1/public/deposit_addresses`,{method:"POST",headers:{accept:"application/json","x-publishable-key":ye(),"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to create deposit address: ${o.status}`);return o.json()}async function go(e){let r=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),o=await fetch(`${he()}/v1/public/onramps/headless/stripe/default_token?${r.toString()}`,{method:"GET",headers:{accept:"application/json","x-publishable-key":ye()}});if(!o.ok)throw new Error(`Failed to fetch default onramp token: ${o.status}`);return o.json()}var qn=5,bo={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function rr(e){let r=e?.flowOrder==="amount_first",o=r?"session_params":"email",{configure:n,hasLinkAccount:t,registerLinkUser:l,authorize:s,attachKycInfo:h,presentKycInfoVerification:a,verifyIdentity:p,registerWalletAddress:b,collectPaymentMethod:k,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[c,d]=react.useState(o),[_,w]=react.useState(false),[G,m]=react.useState(""),[U,be]=react.useState(null),[x,Re]=react.useState(e?.email??""),[$,Xe]=react.useState(e?.phone??""),[ke,et]=react.useState(""),[we,tt]=react.useState("US"),[Ce,rt]=react.useState(""),[N,ot]=react.useState(""),[de,Ie]=react.useState(false),[je,Se]=react.useState(false),Ve=react.useRef(0),xe=react.useRef(false),_e=react.useRef(false),K=react.useRef(false),Ae=react.useRef(""),Be=react.useRef(null),[nt,Fe]=react.useState(bo),[ce,Ct]=react.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[ar,lr]=react.useState(""),[O,F]=react.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[Ke,Or]=react.useState(e?.defaultSourceAmount??"100"),[Wt,Pr]=react.useState(e?.defaultSourceCurrency??"usd"),[Mt,dr]=react.useState(e?.defaultDestinationCurrency??"usdc"),[ue,St]=react.useState(null),[Fo,Do]=react.useState(false),ne=react.useRef(null),it=react.useRef(false),st=react.useRef(0),vr=react.useRef(e?.onComplete),Lr=react.useRef(e?.onError),Rr=react.useRef(e?.onStepChange),cr=react.useRef(o);react.useEffect(()=>{vr.current=e?.onComplete;},[e?.onComplete]),react.useEffect(()=>{Lr.current=e?.onError;},[e?.onError]),react.useEffect(()=>{Rr.current=e?.onStepChange;},[e?.onStepChange]);let ur=react.useRef(o);react.useEffect(()=>{c!==ur.current&&(Rr.current?.(c,ur.current),ur.current=c),cr.current=c;},[c]);let f=react.useCallback((i,u,g)=>{let C={code:i,message:u,step:cr.current,stripeErrorCode:g};be(C),m(""),Lr.current?.(C);},[]),Ir=react.useCallback(i=>{let u={sessionId:i.id,status:i.status,sourceAmount:i.transaction_details.source_amount,sourceCurrency:i.transaction_details.source_currency,destinationAmount:i.transaction_details.destination_amount,destinationCurrency:i.transaction_details.destination_currency,destinationNetwork:i.transaction_details.destination_network,walletAddress:i.transaction_details.wallet_address,fees:{networkFee:i.transaction_details.fees.network_fee_amount,transactionFee:i.transaction_details.fees.transaction_fee_amount}};return vr.current?.(u),u},[]),T=react.useCallback(()=>be(null),[]);react.useEffect(()=>{stripeReactNative.isPlatformPaySupported().then(Do);},[]),react.useEffect(()=>(it.current=false,()=>{it.current=true,ne.current&&clearTimeout(ne.current);}),[]),react.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||de||je)return;let i=false;Se(true);async function u(){try{let[g,C]=await Promise.all([ho({external_user_id:e.externalUserId,recipient_address:e.recipientAddress,destination_chain_type:e?.destinationChainType,destination_chain_id:e?.destinationChainId,destination_token_address:e?.destinationTokenAddress}),e?.destinationTokenAddress&&e?.destinationChainId&&e?.destinationChainType?go({token_address:e.destinationTokenAddress,chain_id:e.destinationChainId,chain_type:e.destinationChainType}).catch(J=>(console.warn("[useStripeOnramp] fetchDefaultOnrampToken failed, using chain_id fallback:",J?.message),null)):Promise.resolve(null)]);if(i)return;let v=e?.destinationChainType??"ethereum",Q=g.data.find(J=>J.chain_type===v);if(Q?.address){let J=Q.address.toLowerCase();Ct(J),Ae.current=J,Q.recipient_address&&lr(Q.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",v,"in",g.data?.length,"wallets");let re={base:stripeReactNative.Onramp.CryptoNetwork.base,ethereum:stripeReactNative.Onramp.CryptoNetwork.ethereum,solana:stripeReactNative.Onramp.CryptoNetwork.solana,bitcoin:stripeReactNative.Onramp.CryptoNetwork.bitcoin,polygon:stripeReactNative.Onramp.CryptoNetwork.polygon},_t={8453:"base",1:"ethereum",137:"polygon"},at=C?.destination_network,Tt="none";if(at&&re[at])F(re[at]),Tt=at+" (from default_token API)";else if(e?.destinationChainId&&_t[e.destinationChainId]){let J=_t[e.destinationChainId];re[J]&&F(re[J]),Tt=J+" (from chain_id "+e.destinationChainId+")";}else re[v]&&(F(re[v]),Tt=v+" (from chain_type fallback)");C?.destination_currency&&dr(C.destination_currency.toLowerCase()),Ie(!0),K.current=!0;}catch(g){console.error("[useStripeOnramp] Failed to resolve wallet:",g?.message),Ie(true),K.current=true;}finally{i||Se(false);}}return u(),()=>{i=true;}},[e?.publishableKey,e?.externalUserId]);let xt=react.useCallback(async()=>{if(Be.current)return Be.current;let i=n({merchantDisplayName:e?.merchantDisplayName??"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(u=>(u.error&&(console.error("[useStripeOnramp] configureSDK error:",u.error.message,u.error.code),Be.current=null),u)).catch(u=>{throw console.error("[useStripeOnramp] configureSDK threw:",u?.message??u),Be.current=null,u});return Be.current=i,i},[n,e?.merchantDisplayName]);react.useEffect(()=>{xt();},[]);let ze=react.useCallback(async i=>{if(!xe.current){xe.current=true,w(true),T(),m("Creating auth intent...");try{let u=await lo(i);m("Waiting for authorization...");let g=await s(u);if(g?.error){f("authorization_error",g.error.message,g.error.code),d("email");return}if(g?.status==="Denied"){f("authorization_error","Authorization denied by user."),d("email");return}if(g?.status!=="Consented"||!g.customerId){f("authorization_error","Authorization was canceled."),d("email");return}m("Exchanging tokens...");let C=await co(u),v=g.customerId,Q=C.access_token;rt(v),ot(Q),m("Checking verification status...");try{let re=await mo(v,Q),_t=re.verifications.find(Te=>Te.name==="kyc_verified"),at=re.verifications.find(Te=>Te.name==="id_document_verified"),Tt=_t?.status==="verified",J=_t?.status==="rejected",Br=at?.status==="verified",pr=re.provided_fields.includes("first_name");if(m(""),J&&!pr)f("kyc_error","KYC was previously rejected. Please submit with correct info."),d("kyc");else if(J&&pr)d(Br?"wallet":"identity");else if(!Tt&&!pr)d("kyc");else if(!Br)d("identity");else if(K.current&&Ae.current)try{let Te=await b(Ae.current,O);Te?.error?(f("wallet_error",Te.error.message,Te.error.code),d("wallet")):d(r?"payment_method":"session_params");}catch(Te){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Te?.message),d("wallet");}else d("wallet");}catch(re){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",re?.message),m(""),d("kyc");}}catch(u){f("authorization_error",u?.message??String(u)),d("email");}finally{xe.current=false,w(false);}}},[s,T,f,b,O,r]),Eo=react.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){f("validation_error","Please enter an email address.");return}w(true),T(),m("");try{m("Configuring...");let i=await xt();if(i.error){f("configuration_error",i.error.message,i.error.code);return}m("Checking Link account...");let u=await t(x);if(u.error){f("authorization_error",u.error.message,u.error.code);return}u.hasLinkAccount?await ze(x):(m(""),d("register"));}catch(i){f("unknown_error",i?.message??String(i));}finally{w(false);}},[T,xt,x,f,t,ze]),Wo=react.useCallback(async()=>{if(!$){f("validation_error","Please enter your phone number.");return}w(true),T(),m("");try{m("Creating Link account...");let i=await l({email:x,phone:$,fullName:ke||x,country:we||"US"});if(i.error){f("registration_error",i.error.message,i.error.code);return}await ze(x);}catch(i){f("registration_error",i?.message??String(i));}finally{w(false);}},[T,we,x,f,ke,$,l,ze]);react.useEffect(()=>{if(c!=="email"||!e?.email)return;let i=++Ve.current,u=false,g=()=>u||Ve.current!==i;return e?.phone?(async()=>{w(true),T();try{m("Configuring...");let C=await xt();if(g())return;if(C.error){f("configuration_error",C.error.message,C.error.code);return}m("Checking Link account...");let v=await t(e.email);if(g())return;if(v.error){f("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(g())return;await ze(e.email);}else {m("Creating Link account...");let Q=await l({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(g())return;if(Q.error){f("registration_error",Q.error.message,Q.error.code);return}if(g())return;await ze(e.email);}}catch(C){g()||f("unknown_error",C?.message??String(C));}finally{w(false);}})():(async()=>{w(true),T();try{m("Configuring...");let C=await xt();if(g())return;if(C.error){f("configuration_error",C.error.message,C.error.code);return}m("Checking Link account...");let v=await t(e.email);if(g())return;if(v.error){f("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(g())return;await ze(e.email);}else {if(g())return;m(""),d("register");}}catch(C){g()||f("unknown_error",C?.message??String(C));}finally{w(false);}})(),()=>{u=true;}},[c,e?.email,e?.phone]);let Mo=react.useCallback(async i=>{w(true),T(),m(""),Fe(i);try{let u={firstName:i.firstName,lastName:i.lastName,idNumber:i.idNumber||void 0,dateOfBirth:{day:parseInt(i.dobDay,10),month:parseInt(i.dobMonth,10),year:parseInt(i.dobYear,10)},address:{line1:i.addressLine1,line2:i.addressLine2||void 0,city:i.city,state:i.state,postalCode:i.postalCode,country:i.country}},g=await h(u);if(g?.error){if(g.error.stripeErrorCode==="consumer_person_already_verified"){m(""),d("identity");return}f("kyc_error",g.error.message,g.error.stripeErrorCode??g.error.code),d("kyc");return}m("Please review your KYC information...");let C=await a(null);if(C?.error){f("kyc_error",C.error.message,C.error.stripeErrorCode??C.error.code),d("kyc");return}if(C?.status==="UpdateAddress"){f("kyc_error","Please update your address and resubmit."),d("kyc");return}m(""),d("identity");}catch(u){f("kyc_error",u?.message??String(u)),d("kyc");}finally{w(false);}},[h,T,f,a]),Vr=react.useCallback(async()=>{if(!_e.current){_e.current=true,w(true),T(),m("Launching identity verification...");try{let i=await p();if(i?.error){f("identity_error",i.error.message,i.error.code);return}m(""),d("wallet");}catch(i){f("identity_error",i?.message??String(i));}finally{_e.current=false,w(false);}}},[T,f,p]);react.useEffect(()=>{c==="identity"&&!_&&Vr();},[c]);let Ar=react.useCallback(async()=>{if(!ce){f("validation_error","Please enter a wallet address.");return}w(true),T(),m("");try{let i=await b(ce.toLowerCase(),O);if(i?.error){f("wallet_error",i.error.message,i.error.code);return}m(""),d(r?"payment_method":"session_params");}catch(i){f("wallet_error",i?.message??String(i));}finally{w(false);}},[T,f,ce,O,b,r]);react.useEffect(()=>{c==="wallet"&&de&&ce&&!_&&Ar();},[c,de,ce]);let Nt=react.useCallback((i,u)=>{it.current=false,st.current=0;let g=async()=>{try{let C=await fo(i,u);if(it.current)return;st.current=0,C.status==="fulfillment_complete"?(St(C),d("success"),Ir(C)):ne.current=setTimeout(g,3e3);}catch(C){if(it.current)return;if(st.current+=1,console.error("[pollSessionStatus] error:",C?.message),st.current>=qn){f("session_error","We couldn't confirm delivery status. Your purchase may still complete \u2014 try again, or close and check your wallet.");return}ne.current=setTimeout(g,5e3);}};ne.current=setTimeout(g,3e3);},[Ir,f]),No=react.useCallback(()=>{cr.current==="processing"&&(!ue?.id||!N||(T(),st.current=0,ne.current&&(clearTimeout(ne.current),ne.current=null),Nt(ue.id,N)));},[N,T,Nt,ue?.id]),jt=react.useCallback(async i=>{w(true),T(),m("");try{m("Confirming purchase...");let u=await po(i,N);St(u),d("processing"),m(""),Nt(u.id,N);}finally{w(false);}},[N,T,Nt]),jo=react.useCallback(async()=>{if(ue)try{await jt(ue.id);}catch(i){f("session_error",i?.message??String(i)),d("quote");}},[f,jt,ue]),Ko=react.useCallback(async(i=false)=>{if(!Ke||isNaN(Number(Ke))||Number(Ke)<=0){f("validation_error","Please enter a valid amount.");return}w(true),T(),m("");try{let u;if(i){m("Opening Apple Pay...");let Q={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Mt.toUpperCase()} purchase + fees`,amount:Ke||"0.00"}]}};u=await k("PlatformPay",Q);}else m("Select a payment method..."),u=await k("Card");if(u?.error){f("payment_error",u.error.message,u.error.code),d("payment_method");return}if(!u?.displayData){f("payment_error","Payment method selection was canceled."),d("payment_method");return}m("Creating payment token...");let g=await S();if(g?.error){f("payment_error",g.error.message,g.error.code),d("payment_method");return}let C=g.cryptoPaymentToken;m("Creating onramp session...");let v=await uo({cryptoCustomerId:Ce,paymentToken:C,sourceAmount:Number(Ke),sourceCurrency:Wt,destinationCurrency:Mt,walletAddress:ce.toLowerCase(),destinationNetwork:O},N);St(v),m(""),i?await jt(v.id):d("quote");}catch(u){f("session_error",u?.message??String(u)),d("payment_method");}finally{w(false);}},[N,T,k,S,Ce,Mt,f,jt,Ke,Wt,ce,O]),zo=react.useCallback(async()=>{if(ue){w(true),T(),m("");try{let i=await yo(ue.id,N);St(i);}catch(i){f("session_error",i?.message??String(i));}finally{w(false);}}},[N,T,f,ue]),Uo=react.useCallback(()=>{it.current=true,st.current=0,ne.current&&(clearTimeout(ne.current),ne.current=null),d(o),w(false),m(""),be(null),Re(e?.email??""),Xe(e?.phone??""),et(""),tt("US"),rt(""),ot(""),Ie(false),Se(false),Fe(bo),Ct(e?.recipientAddress??""),F(stripeReactNative.Onramp.CryptoNetwork.ethereum),Or(e?.defaultSourceAmount??"100"),Pr(e?.defaultSourceCurrency??"usd"),dr(e?.defaultDestinationCurrency??"usdc"),St(null),Ve.current+=1,xe.current=false,_e.current=false;},[e,o]);return {step:c,loading:_,status:G,error:U,email:x,phone:$,fullName:ke,country:we,customerId:Ce,accessToken:N,session:ue,kycData:nt,walletAddress:ce,resolvedRecipientAddress:ar,walletNetwork:O,sourceAmount:Ke,sourceCurrency:Wt,destinationCurrency:Mt,applePaySupported:Fo,walletReady:de,walletLoading:je,setStep:d,setStatus:m,setEmail:Re,setPhone:Xe,setFullName:et,setCountry:tt,setWalletAddress:Ct,setWalletNetwork:F,setSourceAmount:Or,setSourceCurrency:Pr,setDestinationCurrency:dr,checkEmail:Eo,register:Wo,attachKyc:Mo,verifyIdentity:Vr,registerWallet:Ar,collectPaymentMethod:Ko,refreshQuote:zo,confirmCheckout:jo,reset:Uo,clearError:T,resumeFulfillmentPolling:No,amountFirst:r}}function ko({styles:e,placeholderColor:r,hasPrefilledEmail:o,loading:n,error:t,status:l,email:s,setEmail:h,checkEmail:a,onClose:p}){return o?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(I,{size:56,strokeWidth:3}),jsxRuntime.jsx(D,{error:t,progress:l,loading:n})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your email"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Email address"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:r,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:h,autoFocus:true,returnKeyType:"done",onSubmitEditing:a})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[n?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:a,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(D,{error:t,progress:l,loading:n})]})]})})}function Co({styles:e,loading:r,status:o,error:n,verifyIdentity:t,onClose:l}){return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:l}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(I,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Verifying identity"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:o||"Preparing identity verification..."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(reactNative.Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Identity verification"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:o||"Tap below to continue verification."})]}),jsxRuntime.jsx(D,{error:n,progress:o,loading:false})]}),!r&&jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:t,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Continue Verification"})})})]})}function xo({styles:e,loading:r,error:o,status:n,sourceAmount:t,sourceCurrency:l,destinationCurrency:s,walletNetwork:h,applePaySupported:a,collectPaymentMethod:p,onClose:b}){let{colors:k}=L(),S=ut.find(_=>_.value===h)?.label??h,c=t===""||t===void 0?"0":t,d=k.primaryForeground;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:b,title:"How do you want to pay?"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.payHint,children:"Select a payment method to continue"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.stackWrapper,children:[jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardTop],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You pay"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsxs(reactNative.Text,{style:e.pm.swapSpendAmount,numberOfLines:1,adjustsFontSizeToFit:true,children:["$",c]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:l.toUpperCase()})})]})]}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorWrap,pointerEvents:"none",children:jsxRuntime.jsx(reactNative.View,{style:e.pm.swapConnectorCircle,children:jsxRuntime.jsx(Wr,{size:20,color:d,strokeWidth:2.5})})}),jsxRuntime.jsxs(reactNative.View,{style:[e.pm.swapCard,e.pm.swapCardBottom],children:[jsxRuntime.jsx(reactNative.Text,{style:e.pm.summaryLabel,children:"You receive"}),jsxRuntime.jsxs(reactNative.View,{style:e.pm.swapRow,children:[jsxRuntime.jsx(reactNative.View,{style:e.pm.swapLeftCol,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapReceivePrimary,numberOfLines:1,adjustsFontSizeToFit:true,children:s.toUpperCase()})}),jsxRuntime.jsx(reactNative.View,{style:e.pm.swapPill,children:jsxRuntime.jsx(reactNative.Text,{style:e.pm.swapPillText,children:S.toUpperCase()})})]})]})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[r?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.pm.applePayBtn,onPress:()=>p(true),children:jsxRuntime.jsxs(reactNative.Text,{style:e.pm.applePayBtnText,children:["Pay with ","\uF8FF"," Pay"]})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:()=>p(false),children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Pay with Card"})})]}),jsxRuntime.jsx(D,{error:o,progress:n,loading:r})]})]})}function To({styles:e,error:r,status:o,loading:n,onClose:t,onRetryStatusCheck:l}){let s=!!r;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[s?jsxRuntime.jsx(R,{onPress:t}):jsxRuntime.jsx(reactNative.View,{style:Ht}),jsxRuntime.jsx(reactNative.View,{style:e.flow.centered,children:r?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Could not confirm status"}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.spinnerWrap,children:jsxRuntime.jsx(I,{size:48,strokeWidth:3})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxRuntime.jsxs(reactNative.Text,{style:e.flow.sub,children:["Your payment has been confirmed.",`
2
+ `,"We're sending your crypto \u2014 this usually takes less than a minute."]})]})}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[jsxRuntime.jsx(D,{error:r,progress:o,loading:n}),r?jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:l,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Check status again"})}):null]})]})}function Po({styles:e,session:r,loading:o,error:n,status:t,confirmCheckout:l,refreshQuote:s,onClose:h}){let a=r.transaction_details,p=new Date(a.quote_expiration*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),b=a.wallet_address.slice(0,6)+"..."+a.wallet_address.slice(-4),k=Ut(a.destination_amount,a.destination_currency);return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:h,title:"Review your purchase"}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsxs(reactNative.View,{style:e.quote.heroBox,children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You receive"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:k}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[a.destination_currency.toUpperCase()," ",$t(a.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.quote.card,children:[jsxRuntime.jsx(De,{quote:e.quote,label:"You pay",value:`${a.source_amount} ${a.source_currency.toUpperCase()}`}),jsxRuntime.jsx(De,{quote:e.quote,label:"Network fee",value:`$${a.fees.network_fee_amount}`}),jsxRuntime.jsx(De,{quote:e.quote,label:"Transaction fee",value:`$${a.fees.transaction_fee_amount}`}),jsxRuntime.jsx(De,{quote:e.quote,label:"Wallet",value:b,mono:true}),jsxRuntime.jsx(De,{quote:e.quote,label:"Quote expires",value:p,last:true})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:l,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.ghostBtn,onPress:s,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.ghostBtnText,children:"Refresh Quote"})})]}),jsxRuntime.jsx(D,{error:n,progress:t,loading:o})]})]})}function vo({styles:e,hasPrefilledPhone:r,loading:o,error:n,status:t,email:l,phone:s,setPhone:h,register:a,onClose:p}){let b=L();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(I,{size:56,strokeWidth:3}),jsxRuntime.jsx(D,{error:n,progress:t,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Enter your phone"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Phone number"}),jsxRuntime.jsx(reactNative.TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:b.components.input.placeholderColor,keyboardType:"phone-pad",value:s,onChangeText:k=>h(k.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:a}),jsxRuntime.jsx(reactNative.Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.emailRow,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.emailLabel,children:"Signing up as"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.emailValue,children:l})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:a,disabled:!s,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(D,{error:n,progress:t,loading:o})]})]})})}function Lo({styles:e,session:r,resolvedRecipientAddress:o,recipientFromConfig:n,onDone:t}){let{colors:l}=L(),s=r.transaction_details,h=Ut(s.destination_amount,s.destination_currency),a=o||n||"";return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:t,title:"Purchase complete"}),jsxRuntime.jsx(reactNative.View,{style:e.form.content,children:jsxRuntime.jsxs(reactNative.ScrollView,{style:e.form.flex,contentContainerStyle:e.flow.successScrollContent,showsVerticalScrollIndicator:false,children:[jsxRuntime.jsx(reactNative.View,{style:e.flow.checkCircle,children:jsxRuntime.jsx(lt,{size:40,color:l.success,strokeWidth:2.5})}),jsxRuntime.jsx(reactNative.Text,{style:e.flow.sub,children:"Your crypto is on its way to your wallet."}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.heroBox,e.flow.detailCard],children:[jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroLabel,children:"You received"}),jsxRuntime.jsx(reactNative.Text,{style:e.quote.heroAmount,children:h}),jsxRuntime.jsxs(reactNative.Text,{style:e.quote.heroNetwork,children:[s.destination_currency.toUpperCase()," ",$t(s.destination_network)]})]}),jsxRuntime.jsxs(reactNative.View,{style:[e.quote.card,e.flow.detailCard],children:[jsxRuntime.jsx(Sr,{quote:e.quote,label:"Deposit Address",address:s.wallet_address}),a?jsxRuntime.jsx(Sr,{quote:e.quote,label:"Recipient Address",address:a,last:true}):jsxRuntime.jsx(De,{quote:e.quote,label:"Session",value:r.id.slice(0,8)+"..."+r.id.slice(-6),mono:true,last:true})]})]})}),jsxRuntime.jsx(reactNative.View,{style:e.form.footer,children:jsxRuntime.jsx(reactNative.TouchableOpacity,{style:e.form.continueBtn,onPress:t,children:jsxRuntime.jsx(reactNative.Text,{style:e.form.continueBtnText,children:"Done"})})})]})}function Io({styles:e,hasAutoWallet:r,loading:o,error:n,status:t,walletAddress:l,walletNetwork:s,setWalletAddress:h,setWalletNetwork:a,setDestinationCurrency:p,registerWallet:b,onClose:k}){let{components:S}=L();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:k}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(I,{size:56,strokeWidth:3}),jsxRuntime.jsx(D,{error:n,progress:t,loading:o})]})]}):jsxRuntime.jsx(reactNative.KeyboardAvoidingView,{style:e.form.flex,behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(R,{onPress:k}),jsxRuntime.jsxs(reactNative.View,{style:e.form.content,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.title,children:"Your crypto wallet"}),jsxRuntime.jsx(reactNative.Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsxRuntime.jsx(reactNative.TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:S.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:l,onChangeText:h})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.fieldWrap,children:[jsxRuntime.jsx(reactNative.Text,{style:e.form.fieldLabel,children:"Network"}),jsxRuntime.jsx(reactNative.View,{style:e.wallet.list,children:ut.map(c=>{let d=s===c.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,d&&e.wallet.rowSelected],onPress:()=>{a(c.value),p(c.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(c.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,d&&e.wallet.rowTextSelected],children:c.label}),d&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(lt,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},c.value)})})]})]}),jsxRuntime.jsxs(reactNative.View,{style:e.form.footer,children:[o?jsxRuntime.jsx(reactNative.View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsxRuntime.jsx(I,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[e.form.continueBtn,!l&&e.form.continueBtnDisabled],onPress:b,disabled:!l,children:jsxRuntime.jsx(reactNative.Text,{style:[e.form.continueBtnText,!l&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsxRuntime.jsx(D,{error:n,progress:t,loading:o})]})]})})}function ir({config:e,onComplete:r}){let o=L(),n=mt(),{step:t,loading:l,status:s,error:h,email:a,phone:p,session:b,kycData:k,walletAddress:S,resolvedRecipientAddress:c,walletNetwork:d,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,applePaySupported:m,setStep:U,setEmail:be,setPhone:x,setWalletAddress:Re,setWalletNetwork:$,setSourceAmount:Xe,setDestinationCurrency:ke,checkEmail:et,register:we,attachKyc:tt,verifyIdentity:Ce,registerWallet:rt,collectPaymentMethod:N,refreshQuote:ot,confirmCheckout:de,reset:Ie,resumeFulfillmentPolling:je,amountFirst:Se}=rr(e),Ve=!!e?.email,xe=!!e?.phone,_e=!!e?.publishableKey&&!!e?.externalUserId,K=()=>{Ie(),r?.();};return t==="email"?jsxRuntime.jsx(ko,{styles:n,placeholderColor:o.components.input.placeholderColor,hasPrefilledEmail:Ve,loading:l,error:h,status:s,email:a,setEmail:be,checkEmail:et,onClose:K}):t==="register"?jsxRuntime.jsx(vo,{styles:n,hasPrefilledPhone:xe,loading:l,error:h,status:s,email:a,phone:p,setPhone:x,register:we,onClose:K}):t==="kyc"?jsxRuntime.jsx(Jt,{initialData:k,loading:l,onComplete:tt,onCancel:()=>U("email")}):t==="identity"?jsxRuntime.jsx(Co,{styles:n,loading:l,status:s,error:h,verifyIdentity:Ce,onClose:K}):t==="wallet"?jsxRuntime.jsx(Io,{styles:n,hasAutoWallet:_e,loading:l,error:h,status:s,walletAddress:S,walletNetwork:d,setWalletAddress:Re,setWalletNetwork:$,setDestinationCurrency:ke,registerWallet:rt,onClose:K}):t==="session_params"?jsxRuntime.jsx(Gt,{initialAmount:_,currency:w,onConfirm:Ae=>{Xe(Ae),U(Se?"email":"payment_method");},onCancel:()=>{Se?K():U("wallet");}}):t==="payment_method"?jsxRuntime.jsx(xo,{styles:n,loading:l,error:h,status:s,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,walletNetwork:d,applePaySupported:m,collectPaymentMethod:N,onClose:K}):t==="quote"&&b?jsxRuntime.jsx(Po,{styles:n,session:b,loading:l,error:h,status:s,confirmCheckout:de,refreshQuote:ot,onClose:K}):t==="processing"?jsxRuntime.jsx(To,{styles:n,error:h,status:s,loading:l,onClose:K,onRetryStatusCheck:je}):t==="success"&&b?jsxRuntime.jsx(Lo,{styles:n,session:b,resolvedRecipientAddress:c,recipientFromConfig:e?.recipientAddress,onDone:()=>{Ie(),r?.();}}):null}var hi="https://api.unifold.io",gi="https://api-staging.unifold.io";function bi(){return typeof __DEV__<"u"&&__DEV__?gi:hi}function sr({publishableKey:e,email:r,phone:o,externalUserId:n,flowOrder:t,destinationChainType:l="ethereum",destinationChainId:s="8453",destinationTokenAddress:h,recipientAddress:a,onComplete:p,onError:b,onStepChange:k,onClose:S,merchantIdentifier:c="merchant.io.unifold",urlScheme:d="unifoldOnramp"}){let _=e||Zt(),[w,G]=react.useState("loading"),[m,U]=react.useState(null);react.useEffect(()=>{let x=false;async function Re(){try{_&&(Xt(_),er(bi()));let $=await tr();if(x||(await stripeReactNative.initStripe({publishableKey:$,merchantIdentifier:c,urlScheme:d}),x))return;G("ready");}catch($){if(x)return;console.error("[StripeOnramp] Init failed:",$),U($?.message??"Failed to load Stripe configuration"),G("error");}}return Re(),()=>{x=true;}},[_,c,d]);let be=react.useMemo(()=>{let x={publishableKey:_,externalUserId:n,destinationChainType:l,destinationChainId:s,onComplete:p,onError:b,onStepChange:k};return h&&(x.destinationTokenAddress=h),a&&(x.recipientAddress=a),r&&(x.email=r),o&&(x.phone=o),t&&(x.flowOrder=t),x},[_,n,l,s,h,a,r,o,t,p,b,k]);return w==="error"?jsxRuntime.jsxs(reactNative.View,{style:wt.centered,children:[jsxRuntime.jsx(reactNative.Text,{style:wt.errorText,children:"Unable to initialize"}),jsxRuntime.jsx(reactNative.Text,{style:wt.errorDetail,children:m}),S&&jsxRuntime.jsx(reactNative.TouchableOpacity,{style:wt.retryBtn,onPress:S,children:jsxRuntime.jsx(reactNative.Text,{style:wt.retryBtnText,children:"Go Back"})})]}):w==="loading"?jsxRuntime.jsx(reactNative.View,{style:wt.centered,children:jsxRuntime.jsx(I,{size:56,strokeWidth:3})}):jsxRuntime.jsx(ir,{config:be,onComplete:S})}var wt=reactNative.StyleSheet.create({centered:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#000000",paddingHorizontal:24},errorText:{color:"#FF453A",fontSize:18,fontWeight:"600",marginBottom:8},errorDetail:{color:"#8E8E93",fontSize:14,textAlign:"center",marginBottom:24},retryBtn:{backgroundColor:"#00D924",borderRadius:24,paddingVertical:14,paddingHorizontal:32},retryBtnText:{color:"#000000",fontSize:16,fontWeight:"700"}});function Bo(){let{configure:e}=stripeReactNative.useOnramp(),r=react.useRef(false);return react.useEffect(()=>{r.current||(r.current=true,e({merchantDisplayName:"Unifold",appearance:{lightColors:{primary:"#2d22a1",contentOnPrimary:"#ffffff",borderSelected:"#07b8b8"},darkColors:{primary:"#800080",contentOnPrimary:"#ffffff",borderSelected:"#526f3e"},style:"ALWAYS_DARK",primaryButton:{cornerRadius:8,height:48}}}).then(o=>{o.error&&console.error("[StripeOnrampPreconfigure] error:",o.error.message);}).catch(o=>{console.error("[StripeOnrampPreconfigure] threw:",o?.message);}));},[e]),null}Fr(sr);
3
+ exports.AmountScreen=Gt;exports.KYCWizardScreen=Jt;exports.OnrampScreen=ir;exports.StripeOnramp=sr;exports.StripeOnrampPreconfigure=Bo;exports.getStripePublishableKey=tr;exports.setStripeOnrampApiUrl=er;exports.setStripeOnrampPublishableKey=Xt;exports.useStripeOnramp=rr;