@unifold/connect-react-native 0.1.23 → 0.1.25
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 +400 -391
- package/dist/index.d.ts +400 -391
- package/dist/index.js +2 -1
- package/dist/index.mjs +2 -1
- package/dist/stripe.d.mts +250 -29
- package/dist/stripe.d.ts +250 -29
- package/dist/stripe.js +2 -1
- package/dist/stripe.mjs +2 -1
- package/package.json +10 -15
package/dist/stripe.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
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'),Ot=require('react-native-svg'),jsxRuntime=require('react/jsx-runtime'),stripeReactNative=require('@stripe/stripe-react-native');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Ot__default=/*#__PURE__*/_interopDefault(Ot);var Uo="__unifold_stripe_onramp__";function Fr(e){globalThis[Uo]=e;}var $o={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)"}},Er=$o;function Kt(e,r){return r?{...e,...r,shadowOffset:r.shadowOffset??e.shadowOffset,backShadowOffset:r.backShadowOffset??e.backShadowOffset}:e}function Dr(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,g=(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,g)}},depositCard:{quoteProvider:{card:Kt(l,a)}},depositTracker:{executionRow:{card:Kt(l,p)}}}}var Yo=react.createContext(null);function V(){let e=react.useContext(Yo);if(!e){let r=Er.dark;return {mode:"dark",colors:r,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Dr(r,void 0),isDark:true}}return e}function Wr({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 Mr({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 Nr({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 Kr({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 Ur({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 qr({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 Yr({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 Gr({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:Kr},{label:"Ethereum",value:stripeReactNative.Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Ur},{label:"Bitcoin",value:stripeReactNative.Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:qr},{label:"Solana",value:stripeReactNative.Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Yr},{label:"Polygon",value:stripeReactNative.Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Gr}];function Qr(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 L({onPress:e,title:r}){let{components:o,fonts:n}=V(),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 E({error:e,progress:r,loading:o}){let{colors:n,fonts:t}=V();return e?jsxRuntime.jsx(reactNative.Text,{style:[Jr.errorText,{color:n.error},...t.regular?[{fontFamily:t.regular}]:[]],children:e.message}):r&&o&&__DEV__?jsxRuntime.jsx(reactNative.Text,{style:[Jr.progressText,{color:n.foregroundSubtle},...t.regular?[{fontFamily:t.regular}]:[]],children:r}):null}var Jr=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 Cr({quote:e,label:r,address:o,last:n}){let[t,l]=react.useState(false),{colors:s,components:g}=V(),a=()=>{reactNative.Clipboard.setString(o),l(true),setTimeout(()=>l(false),2e3);},p=Qr(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(Nr,{size:14,color:g.card.actionIcon,strokeWidth:2})})]})]}),n?null:jsxRuntime.jsx(reactNative.View,{style:e.rowDivider})]})}function mt(){let{colors:e,fonts:r,components:o}=V(),n=o.input,t=o.button,l=o.container,s=o.card,g=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:g.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}},u=Math.max(16,Math.min(a,22)),c={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:u,borderTopRightRadius:u,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:u,borderBottomRightRadius:u,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:g.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:c,wallet:_,flow:w,amount:k}},[e,r,n,t,l,s,g])}var Tn=[["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),g=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 u=S.indexOf(".");return u!==-1&&S.length-u>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(L,{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:Tn.map((k,S)=>jsxRuntime.jsx(reactNative.View,{style:t.amount.numpadRow,children:k.map(u=>jsxRuntime.jsx(reactNative.TouchableOpacity,{style:t.amount.numpadKey,onPress:()=>g(u),activeOpacity:.6,children:jsxRuntime.jsx(reactNative.Text,{style:u==="\u232B"?t.amount.backspaceText:t.amount.numpadKeyText,children:u})},u))},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 R({size:e=56,strokeWidth:r=3,children:o,iconSize:n,style:t,gradientFrom:l,gradientTo:s}){let{colors:g}=V(),a=l??g.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]),u=(e-r)/2,c=2*Math.PI*u,_=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 f=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:f}]},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:u,stroke:`url(#${S})`,strokeWidth:r,fill:"none",strokeDasharray:`${c*.75} ${c*.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:g}=V(),a=g.input.placeholderColor,[p,b]=react.useState(1),[k,S]=react.useState(e.firstName??""),[u,c]=react.useState(e.lastName??""),[_,w]=react.useState(e.dobMonth??""),[G,f]=react.useState(e.dobDay??""),[U,be]=react.useState(e.dobYear??""),[x,Ie]=react.useState(e.addressLine1??""),[$,ke]=react.useState(e.addressLine2??""),[we,et]=react.useState(e.city??""),[Ce,tt]=react.useState(e.state??""),[Se,rt]=react.useState(e.postalCode??""),[N,ot]=react.useState(e.country??"US"),[ce,Ae]=react.useState(e.idNumber??""),Ke=react.useRef(null),xe=react.useRef(null),Ve=react.useRef(null),_e=react.useRef(null),Te=react.useRef(null),K=react.useRef(null),Be=react.useRef(null),Fe=react.useRef(null),nt=()=>{switch(p){case 1:return k.trim().length>0&&u.trim().length>0;case 2:return _.length===2&&G.length===2&&U.length===4;case 3:return x.trim().length>0&&we.trim().length>0&&Ce.trim().length>0&&Se.trim().length>0;case 4:return ce.trim().length>0;default:return false}},Ee=()=>{nt()&&(p<Rt?b(O=>O+1):o({firstName:k,lastName:u,idNumber:ce,dobMonth:_,dobDay:G,dobYear:U,addressLine1:x,addressLine2:$,city:we,state:Ce,postalCode:Se,country:N}));},de=()=>{p>1?b(O=>O-1):n();},Ct=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],lr=["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."],cr=[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:de,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsxRuntime.jsx(Wr,{size:20,color:g.header.buttonColor,strokeWidth:2})})}),jsxRuntime.jsx(reactNative.View,{style:P.headerCenter,children:jsxRuntime.jsxs(reactNative.Text,{style:cr,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:g.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:lr[p-1]}),p===1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ve,{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:()=>Ke.current?.focus()})}),jsxRuntime.jsx(ve,{form:t.form,label:"Last name",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Ke,style:t.form.input,placeholder:"Doe",placeholderTextColor:a,value:u,onChangeText:c,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ee})})]}),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&&xe.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:xe,style:[t.form.input,P.dobInput],placeholder:"DD",placeholderTextColor:a,value:G,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);f(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:Ee})]})]}),p===3&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ve,{form:t.form,label:"Street address",children:jsxRuntime.jsx(reactNative.TextInput,{style:t.form.input,placeholder:"123 Main St",placeholderTextColor:a,value:x,onChangeText:Ie,returnKeyType:"next",onSubmitEditing:()=>_e.current?.focus()})}),jsxRuntime.jsx(ve,{form:t.form,label:"Apt, suite, etc. (optional)",children:jsxRuntime.jsx(reactNative.TextInput,{ref:_e,style:t.form.input,placeholder:"Apt 2",placeholderTextColor:a,value:$,onChangeText:ke,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})}),jsxRuntime.jsx(ve,{form:t.form,label:"City",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Te,style:t.form.input,placeholder:"San Francisco",placeholderTextColor:a,value:we,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(ve,{form:t.form,label:"State",children:jsxRuntime.jsx(reactNative.TextInput,{ref:K,style:t.form.input,placeholder:"NY",placeholderTextColor:a,value:Ce,onChangeText:O=>tt(O.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Be.current?.focus()})})}),jsxRuntime.jsx(reactNative.View,{style:t.form.flex,children:jsxRuntime.jsx(ve,{form:t.form,label:"ZIP code",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Be,style:t.form.input,placeholder:"11201",placeholderTextColor:a,value:Se,onChangeText:rt,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Fe.current?.focus()})})})]}),jsxRuntime.jsx(ve,{form:t.form,label:"Country",children:jsxRuntime.jsx(reactNative.TextInput,{ref:Fe,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:Ee})})]}),p===4&&jsxRuntime.jsxs(ve,{form:t.form,label:"Social Security Number",children:[jsxRuntime.jsx(reactNative.TextInput,{style:t.form.input,placeholder:"123-45-6789",placeholderTextColor:a,value:ce,onChangeText:Ae,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ee}),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(R,{size:28,strokeWidth:2})}):jsxRuntime.jsx(reactNative.TouchableOpacity,{style:[t.form.continueBtn,!nt()&&t.form.continueBtnDisabled],onPress:Ee,disabled:!nt(),children:jsxRuntime.jsx(reactNative.Text,{style:[t.form.continueBtnText,!nt()&&t.form.continueBtnTextDisabled],children:p===Rt?"Submit":"Continue"})})})]})})}function ve({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 Mn="https://api.unifold.io",io,Nn="pk_test_123";function jn(){return typeof __DEV__<"u"&&__DEV__&&io?io:Mn}function Zt(){return jn()}function Xt(){return Nn}var so="",ao;function er(e){so=e;}function tr(e){ao=e;}function ye(){let e=so||Xt();return e}function ge(){return ao??Zt()}async function rr(){let e=`${ge()}/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(`${ge()}/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(`${ge()}/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(`${ge()}/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(`${ge()}/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=`${ge()}/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=`${ge()}/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(`${ge()}/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 go(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(`${ge()}/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 ho(e){let r=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),o=await fetch(`${ge()}/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 Hn=5,bo={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function or(e){let r=e?.flowOrder==="amount_first",o=r?"session_params":"email",{configure:n,hasLinkAccount:t,registerLinkUser:l,authorize:s,attachKycInfo:g,presentKycInfoVerification:a,verifyIdentity:p,registerWalletAddress:b,collectPaymentMethod:k,createCryptoPaymentToken:S}=stripeReactNative.useOnramp(),[u,c]=react.useState(o),[_,w]=react.useState(false),[G,f]=react.useState(""),[U,be]=react.useState(null),[x,Ie]=react.useState(e?.email??""),[$,ke]=react.useState(e?.phone??""),[we,et]=react.useState(""),[Ce,tt]=react.useState("US"),[Se,rt]=react.useState(""),[N,ot]=react.useState(""),[ce,Ae]=react.useState(false),[Ke,xe]=react.useState(false),Ve=react.useRef(0),_e=react.useRef(false),Te=react.useRef(false),K=react.useRef(false),Be=react.useRef(""),Fe=react.useRef(null),[nt,Ee]=react.useState(bo),[de,Ct]=react.useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[lr,cr]=react.useState(""),[O,F]=react.useState(e?.defaultNetwork??stripeReactNative.Onramp.CryptoNetwork.base),[ze,Tr]=react.useState(e?.defaultSourceAmount??"100"),[Wt,Or]=react.useState(e?.defaultSourceCurrency??"usd"),[Mt,dr]=react.useState(e?.defaultDestinationCurrency??"usdc"),[ue,St]=react.useState(null),[Fo,Pr]=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),ur=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 pr=react.useRef(o);react.useEffect(()=>{u!==pr.current&&(Rr.current?.(u,pr.current),pr.current=u),ur.current=u;},[u]);let m=react.useCallback((i,d,h)=>{let C={code:i,message:d,step:ur.current,stripeErrorCode:h};be(C),f(""),Lr.current?.(C);},[]),Ir=react.useCallback(i=>{let d={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?.(d),d},[]),T=react.useCallback(()=>be(null),[]);react.useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){Pr(false);return}let d=false;return stripeReactNative.isPlatformPaySupported().then(h=>{d||Pr(h);}),()=>{d=true;}},[e?.merchantIdentifier]),react.useEffect(()=>(it.current=false,()=>{it.current=true,ne.current&&clearTimeout(ne.current);}),[]),react.useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ce||Ke)return;let i=false;xe(true);async function d(){try{let[h,C]=await Promise.all([go({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?ho({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=h.data.find(J=>J.chain_type===v);if(Q?.address){let J=Q.address.toLowerCase();Ct(J),Be.current=J,Q.recipient_address&&cr(Q.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",v,"in",h.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()),Ae(!0),K.current=!0;}catch(h){console.error("[useStripeOnramp] Failed to resolve wallet:",h?.message),Ae(true),K.current=true;}finally{i||xe(false);}}return d(),()=>{i=true;}},[e?.publishableKey,e?.externalUserId]);let xt=react.useCallback(async()=>{if(Fe.current)return Fe.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(d=>(d.error&&(console.error("[useStripeOnramp] configureSDK error:",d.error.message,d.error.code),Fe.current=null),d)).catch(d=>{throw console.error("[useStripeOnramp] configureSDK threw:",d?.message??d),Fe.current=null,d});return Fe.current=i,i},[n,e?.merchantDisplayName]);react.useEffect(()=>{xt();},[]);let Ue=react.useCallback(async i=>{if(!_e.current){_e.current=true,w(true),T(),f("Creating auth intent...");try{let d=await lo(i);f("Waiting for authorization...");let h=await s(d);if(h?.error){m("authorization_error",h.error.message,h.error.code),c("email");return}if(h?.status==="Denied"){m("authorization_error","Authorization denied by user."),c("email");return}if(h?.status!=="Consented"||!h.customerId){m("authorization_error","Authorization was canceled."),c("email");return}f("Exchanging tokens...");let C=await co(d),v=h.customerId,Q=C.access_token;rt(v),ot(Q),f("Checking verification status...");try{let re=await mo(v,Q),_t=re.verifications.find(Oe=>Oe.name==="kyc_verified"),at=re.verifications.find(Oe=>Oe.name==="id_document_verified"),Tt=_t?.status==="verified",J=_t?.status==="rejected",Br=at?.status==="verified",mr=re.provided_fields.includes("first_name");if(f(""),J&&!mr)m("kyc_error","KYC was previously rejected. Please submit with correct info."),c("kyc");else if(J&&mr)c(Br?"wallet":"identity");else if(!Tt&&!mr)c("kyc");else if(!Br)c("identity");else if(K.current&&Be.current)try{let Oe=await b(Be.current,O);Oe?.error?(m("wallet_error",Oe.error.message,Oe.error.code),c("wallet")):c(r?"payment_method":"session_params");}catch(Oe){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Oe?.message),c("wallet");}else c("wallet");}catch(re){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",re?.message),f(""),c("kyc");}}catch(d){m("authorization_error",d?.message??String(d)),c("email");}finally{_e.current=false,w(false);}}},[s,T,m,b,O,r]),Eo=react.useCallback(async()=>{if(reactNative.Keyboard.dismiss(),!x){m("validation_error","Please enter an email address.");return}w(true),T(),f("");try{f("Configuring...");let i=await xt();if(i.error){m("configuration_error",i.error.message,i.error.code);return}f("Checking Link account...");let d=await t(x);if(d.error){m("authorization_error",d.error.message,d.error.code);return}d.hasLinkAccount?await Ue(x):(f(""),c("register"));}catch(i){m("unknown_error",i?.message??String(i));}finally{w(false);}},[T,xt,x,m,t,Ue]),Do=react.useCallback(async()=>{if(!$){m("validation_error","Please enter your phone number.");return}w(true),T(),f("");try{f("Creating Link account...");let i=await l({email:x,phone:$,fullName:we||x,country:Ce||"US"});if(i.error){m("registration_error",i.error.message,i.error.code);return}await Ue(x);}catch(i){m("registration_error",i?.message??String(i));}finally{w(false);}},[T,Ce,x,m,we,$,l,Ue]);react.useEffect(()=>{if(u!=="email"||!e?.email)return;let i=++Ve.current,d=false,h=()=>d||Ve.current!==i;return e?.phone?(async()=>{w(true),T();try{f("Configuring...");let C=await xt();if(h())return;if(C.error){m("configuration_error",C.error.message,C.error.code);return}f("Checking Link account...");let v=await t(e.email);if(h())return;if(v.error){m("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(h())return;await Ue(e.email);}else {f("Creating Link account...");let Q=await l({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(h())return;if(Q.error){m("registration_error",Q.error.message,Q.error.code);return}if(h())return;await Ue(e.email);}}catch(C){h()||m("unknown_error",C?.message??String(C));}finally{w(false);}})():(async()=>{w(true),T();try{f("Configuring...");let C=await xt();if(h())return;if(C.error){m("configuration_error",C.error.message,C.error.code);return}f("Checking Link account...");let v=await t(e.email);if(h())return;if(v.error){m("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(h())return;await Ue(e.email);}else {if(h())return;f(""),c("register");}}catch(C){h()||m("unknown_error",C?.message??String(C));}finally{w(false);}})(),()=>{d=true;}},[u,e?.email,e?.phone]);let Wo=react.useCallback(async i=>{w(true),T(),f(""),Ee(i);try{let d={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}},h=await g(d);if(h?.error){if(h.error.stripeErrorCode==="consumer_person_already_verified"){f(""),c("identity");return}m("kyc_error",h.error.message,h.error.stripeErrorCode??h.error.code),c("kyc");return}f("Please review your KYC information...");let C=await a(null);if(C?.error){m("kyc_error",C.error.message,C.error.stripeErrorCode??C.error.code),c("kyc");return}if(C?.status==="UpdateAddress"){m("kyc_error","Please update your address and resubmit."),c("kyc");return}f(""),c("identity");}catch(d){m("kyc_error",d?.message??String(d)),c("kyc");}finally{w(false);}},[g,T,m,a]),Ar=react.useCallback(async()=>{if(!Te.current){Te.current=true,w(true),T(),f("Launching identity verification...");try{let i=await p();if(i?.error){m("identity_error",i.error.message,i.error.code);return}f(""),c("wallet");}catch(i){m("identity_error",i?.message??String(i));}finally{Te.current=false,w(false);}}},[T,m,p]);react.useEffect(()=>{u==="identity"&&!_&&Ar();},[u]);let Vr=react.useCallback(async()=>{if(!de){m("validation_error","Please enter a wallet address.");return}w(true),T(),f("");try{let i=await b(de.toLowerCase(),O);if(i?.error){m("wallet_error",i.error.message,i.error.code);return}f(""),c(r?"payment_method":"session_params");}catch(i){m("wallet_error",i?.message??String(i));}finally{w(false);}},[T,m,de,O,b,r]);react.useEffect(()=>{u==="wallet"&&ce&&de&&!_&&Vr();},[u,ce,de]);let Nt=react.useCallback((i,d)=>{it.current=false,st.current=0;let h=async()=>{try{let C=await fo(i,d);if(it.current)return;st.current=0,C.status==="fulfillment_complete"?(St(C),c("success"),Ir(C)):ne.current=setTimeout(h,3e3);}catch(C){if(it.current)return;if(st.current+=1,console.error("[pollSessionStatus] error:",C?.message),st.current>=Hn){m("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(h,5e3);}};ne.current=setTimeout(h,3e3);},[Ir,m]),Mo=react.useCallback(()=>{ur.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(),f("");try{f("Confirming purchase...");let d=await po(i,N);St(d),c("processing"),f(""),Nt(d.id,N);}finally{w(false);}},[N,T,Nt]),No=react.useCallback(async()=>{if(ue)try{await jt(ue.id);}catch(i){m("session_error",i?.message??String(i)),c("quote");}},[m,jt,ue]),jo=react.useCallback(async(i=false)=>{if(!ze||isNaN(Number(ze))||Number(ze)<=0){m("validation_error","Please enter a valid amount.");return}w(true),T(),f("");try{let d;if(i){if(!e?.merchantIdentifier?.trim()){m("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),c("payment_method");return}f("Opening Apple Pay...");let Q={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:stripeReactNative.PlatformPay.PaymentType.Immediate,label:`${Mt.toUpperCase()} purchase + fees`,amount:ze||"0.00"}]}};d=await k("PlatformPay",Q);}else f("Select a payment method..."),d=await k("Card");if(d?.error){m("payment_error",d.error.message,d.error.code),c("payment_method");return}if(!d?.displayData){m("payment_error","Payment method selection was canceled."),c("payment_method");return}f("Creating payment token...");let h=await S();if(h?.error){m("payment_error",h.error.message,h.error.code),c("payment_method");return}let C=h.cryptoPaymentToken;f("Creating onramp session...");let v=await uo({cryptoCustomerId:Se,paymentToken:C,sourceAmount:Number(ze),sourceCurrency:Wt,destinationCurrency:Mt,walletAddress:de.toLowerCase(),destinationNetwork:O},N);St(v),f(""),i?await jt(v.id):c("quote");}catch(d){m("session_error",d?.message??String(d)),c("payment_method");}finally{w(false);}},[N,T,k,S,Se,Mt,m,jt,ze,Wt,de,O,e?.merchantIdentifier]),Ko=react.useCallback(async()=>{if(ue){w(true),T(),f("");try{let i=await yo(ue.id,N);St(i);}catch(i){m("session_error",i?.message??String(i));}finally{w(false);}}},[N,T,m,ue]),zo=react.useCallback(()=>{it.current=true,st.current=0,ne.current&&(clearTimeout(ne.current),ne.current=null),c(o),w(false),f(""),be(null),Ie(e?.email??""),ke(e?.phone??""),et(""),tt("US"),rt(""),ot(""),Ae(false),xe(false),Ee(bo),Ct(e?.recipientAddress??""),F(stripeReactNative.Onramp.CryptoNetwork.ethereum),Tr(e?.defaultSourceAmount??"100"),Or(e?.defaultSourceCurrency??"usd"),dr(e?.defaultDestinationCurrency??"usdc"),St(null),Ve.current+=1,_e.current=false,Te.current=false;},[e,o]);return {step:u,loading:_,status:G,error:U,email:x,phone:$,fullName:we,country:Ce,customerId:Se,accessToken:N,session:ue,kycData:nt,walletAddress:de,resolvedRecipientAddress:lr,walletNetwork:O,sourceAmount:ze,sourceCurrency:Wt,destinationCurrency:Mt,applePaySupported:Fo,walletReady:ce,walletLoading:Ke,setStep:c,setStatus:f,setEmail:Ie,setPhone:ke,setFullName:et,setCountry:tt,setWalletAddress:Ct,setWalletNetwork:F,setSourceAmount:Tr,setSourceCurrency:Or,setDestinationCurrency:dr,checkEmail:Eo,register:Do,attachKyc:Wo,verifyIdentity:Ar,registerWallet:Vr,collectPaymentMethod:jo,refreshQuote:Ko,confirmCheckout:No,reset:zo,clearError:T,resumeFulfillmentPolling:Mo,amountFirst:r}}function ko({styles:e,placeholderColor:r,hasPrefilledEmail:o,loading:n,error:t,status:l,email:s,setEmail:g,checkEmail:a,onClose:p}){return o?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(L,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(R,{size:56,strokeWidth:3}),jsxRuntime.jsx(E,{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(L,{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:g,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(R,{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(E,{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(L,{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(R,{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(E,{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:g,applePaySupported:a,collectPaymentMethod:p,onClose:b}){let{colors:k}=V(),S=ut.find(_=>_.value===g)?.label??g,u=t===""||t===void 0?"0":t,c=k.primaryForeground;return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(L,{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:["$",u]}),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(Mr,{size:20,color:c,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(R,{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(E,{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(L,{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(R,{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(E,{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:g}){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(L,{onPress:g,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(R,{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(E,{error:n,progress:t,loading:o})]})]})}function vo({styles:e,hasPrefilledPhone:r,loading:o,error:n,status:t,email:l,phone:s,setPhone:g,register:a,onClose:p}){let b=V();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(L,{onPress:p}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(R,{size:56,strokeWidth:3}),jsxRuntime.jsx(E,{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(L,{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=>g(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(R,{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(E,{error:n,progress:t,loading:o})]})]})})}function Lo({styles:e,session:r,resolvedRecipientAddress:o,recipientFromConfig:n,onDone:t}){let{colors:l}=V(),s=r.transaction_details,g=Ut(s.destination_amount,s.destination_currency),a=o||n||"";return jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(L,{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:g}),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(Cr,{quote:e.quote,label:"Deposit Address",address:s.wallet_address}),a?jsxRuntime.jsx(Cr,{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:g,setWalletNetwork:a,setDestinationCurrency:p,registerWallet:b,onClose:k}){let{components:S}=V();return r?jsxRuntime.jsxs(reactNative.View,{style:e.form.screen,children:[jsxRuntime.jsx(L,{onPress:k}),jsxRuntime.jsxs(reactNative.View,{style:e.flow.centered,children:[jsxRuntime.jsx(R,{size:56,strokeWidth:3}),jsxRuntime.jsx(E,{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(L,{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:g})]}),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(u=>{let c=s===u.value;return jsxRuntime.jsxs(reactNative.TouchableOpacity,{style:[e.wallet.row,c&&e.wallet.rowSelected],onPress:()=>{a(u.value),p(u.defaultCrypto);},children:[jsxRuntime.jsx(reactNative.View,{style:e.wallet.iconWrap,children:jsxRuntime.jsx(u.Icon,{size:24})}),jsxRuntime.jsx(reactNative.Text,{style:[e.wallet.rowText,c&&e.wallet.rowTextSelected],children:u.label}),c&&jsxRuntime.jsx(reactNative.View,{style:e.wallet.checkCircle,children:jsxRuntime.jsx(lt,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},u.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(R,{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(E,{error:n,progress:t,loading:o})]})]})})}function sr({config:e,onComplete:r}){let o=V(),n=mt(),{step:t,loading:l,status:s,error:g,email:a,phone:p,session:b,kycData:k,walletAddress:S,resolvedRecipientAddress:u,walletNetwork:c,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,applePaySupported:f,setStep:U,setEmail:be,setPhone:x,setWalletAddress:Ie,setWalletNetwork:$,setSourceAmount:ke,setDestinationCurrency:we,checkEmail:et,register:Ce,attachKyc:tt,verifyIdentity:Se,registerWallet:rt,collectPaymentMethod:N,refreshQuote:ot,confirmCheckout:ce,reset:Ae,resumeFulfillmentPolling:Ke,amountFirst:xe}=or(e),Ve=!!e?.email,_e=!!e?.phone,Te=!!e?.publishableKey&&!!e?.externalUserId,K=()=>{Ae(),r?.();};return t==="email"?jsxRuntime.jsx(ko,{styles:n,placeholderColor:o.components.input.placeholderColor,hasPrefilledEmail:Ve,loading:l,error:g,status:s,email:a,setEmail:be,checkEmail:et,onClose:K}):t==="register"?jsxRuntime.jsx(vo,{styles:n,hasPrefilledPhone:_e,loading:l,error:g,status:s,email:a,phone:p,setPhone:x,register:Ce,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:g,verifyIdentity:Se,onClose:K}):t==="wallet"?jsxRuntime.jsx(Io,{styles:n,hasAutoWallet:Te,loading:l,error:g,status:s,walletAddress:S,walletNetwork:c,setWalletAddress:Ie,setWalletNetwork:$,setDestinationCurrency:we,registerWallet:rt,onClose:K}):t==="session_params"?jsxRuntime.jsx(Gt,{initialAmount:_,currency:w,onConfirm:Be=>{ke(Be),U(xe?"email":"payment_method");},onCancel:()=>{xe?K():U("wallet");}}):t==="payment_method"?jsxRuntime.jsx(xo,{styles:n,loading:l,error:g,status:s,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,walletNetwork:c,applePaySupported:f,collectPaymentMethod:N,onClose:K}):t==="quote"&&b?jsxRuntime.jsx(Po,{styles:n,session:b,loading:l,error:g,status:s,confirmCheckout:ce,refreshQuote:ot,onClose:K}):t==="processing"?jsxRuntime.jsx(To,{styles:n,error:g,status:s,loading:l,onClose:K,onRetryStatusCheck:Ke}):t==="success"&&b?jsxRuntime.jsx(Lo,{styles:n,session:b,resolvedRecipientAddress:u,recipientFromConfig:e?.recipientAddress,onDone:()=>{Ae(),r?.();}}):null}function ar({publishableKey:e,email:r,phone:o,externalUserId:n,flowOrder:t,destinationChainType:l="ethereum",destinationChainId:s="8453",destinationTokenAddress:g,recipientAddress:a,onComplete:p,onError:b,onStepChange:k,onClose:S,merchantIdentifier:u="",urlScheme:c="unifoldOnramp"}){let _=e||Xt(),[w,G]=react.useState("loading"),[f,U]=react.useState(null);react.useEffect(()=>{let x=false;async function Ie(){try{_&&(er(_),tr(Zt()));let $=await rr();if(x)return;let ke=u.trim();if(await stripeReactNative.initStripe({publishableKey:$,urlScheme:c,...ke?{merchantIdentifier:ke}:{}}),x)return;G("ready");}catch($){if(x)return;console.error("[StripeOnramp] Init failed:",$),U($?.message??"Failed to load Stripe configuration"),G("error");}}return Ie(),()=>{x=true;}},[_,u,c]);let be=react.useMemo(()=>{let x={publishableKey:_,externalUserId:n,destinationChainType:l,destinationChainId:s,onComplete:p,onError:b,onStepChange:k};return g&&(x.destinationTokenAddress=g),a&&(x.recipientAddress=a),r&&(x.email=r),o&&(x.phone=o),t&&(x.flowOrder=t),x.merchantIdentifier=u,x},[_,n,l,s,g,a,r,o,t,u,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:f}),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(R,{size:56,strokeWidth:3})}):jsxRuntime.jsx(sr,{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(ar);exports.AmountScreen=Gt;exports.KYCWizardScreen=Jt;exports.OnrampScreen=sr;exports.StripeOnramp=ar;exports.StripeOnrampPreconfigure=Bo;exports.getStripePublishableKey=rr;exports.setStripeOnrampApiUrl=tr;exports.setStripeOnrampPublishableKey=er;exports.useStripeOnramp=or;
|
package/dist/stripe.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import {StripeOnramp}from'@unifold/ui-react-native/stripe';export{AmountScreen,KYCWizardScreen,OnrampScreen,StripeOnramp,StripeOnrampPreconfigure,getStripePublishableKey,setStripeOnrampApiUrl,setStripeOnrampPublishableKey,useStripeOnramp}from'@unifold/ui-react-native/stripe';var n="__unifold_stripe_onramp__";function r(e){globalThis[n]=e;}r(StripeOnramp);
|
|
1
|
+
import {createContext,useState,useRef,useEffect,useCallback,useMemo,useContext,useId,Fragment as Fragment$1}from'react';import {StyleSheet,View,Text,TouchableOpacity,KeyboardAvoidingView,ScrollView,TextInput,Platform,Keyboard,Animated,Easing,Clipboard}from'react-native';import Ot,{G,Path,Defs,ClipPath,Rect,LinearGradient,Stop,Circle,Line,Polyline}from'react-native-svg';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Onramp,useOnramp,isPlatformPaySupported,PlatformPay,initStripe}from'@stripe/stripe-react-native';var Uo="__unifold_stripe_onramp__";function Fr(e){globalThis[Uo]=e;}var $o={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)"}},Er=$o;function Kt(e,r){return r?{...e,...r,shadowOffset:r.shadowOffset??e.shadowOffset,backShadowOffset:r.backShadowOffset??e.backShadowOffset}:e}function Dr(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,g=(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,g)}},depositCard:{quoteProvider:{card:Kt(l,a)}},depositTracker:{executionRow:{card:Kt(l,p)}}}}var Yo=createContext(null);function V(){let e=useContext(Yo);if(!e){let r=Er.dark;return {mode:"dark",colors:r,fonts:{regular:void 0,medium:void 0,semibold:void 0,bold:void 0},components:Dr(r,void 0),isDark:true}}return e}function Wr({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxs(Ot,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"19",y1:"12",x2:"5",y2:"12",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 jsxs(Ot,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Line,{x1:"18",y1:"6",x2:"6",y2:"18",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(Line,{x1:"6",y1:"6",x2:"18",y2:"18",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})]})}function Mr({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsx(Ot,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"6 9 12 15 18 9",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Nr({size:e=24,color:r="#fff",strokeWidth:o=2}){return jsxs(Ot,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx(Rect,{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"}),jsx(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 jsx(Ot,{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:jsx(Polyline,{points:"20 6 9 17 4 12",stroke:r,strokeWidth:o,strokeLinecap:"round",strokeLinejoin:"round"})})}function Kr({size:e=28}){return jsx(Ot,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:jsxs(G,{fillRule:"evenodd",children:[jsx(Path,{fill:"#0052FF",fillRule:"nonzero",d:"M14 28a14 14 0 1 0 0-28 14 14 0 0 0 0 28"}),jsx(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 Ur({size:e=28}){return jsxs(Ot,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#eth_clip)",children:[jsx(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"}),jsx(Path,{d:"M14.4357 3.5V11.2612L20.9956 14.1925L14.4357 3.5Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 3.5L7.875 14.1925L14.4357 11.2612V3.5Z",fill:"white"}),jsx(Path,{d:"M14.4357 19.222V24.4956L21 15.414L14.4357 19.222Z",fill:"white",fillOpacity:.602}),jsx(Path,{d:"M14.4357 24.4956V19.2211L7.875 15.414L14.4357 24.4956Z",fill:"white"}),jsx(Path,{d:"M14.4357 18.0014L20.9956 14.1925L14.4357 11.263V18.0014Z",fill:"white",fillOpacity:.2}),jsx(Path,{d:"M7.875 14.1925L14.4357 18.0014V11.263L7.875 14.1925Z",fill:"white",fillOpacity:.602})]}),jsx(Defs,{children:jsx(ClipPath,{id:"eth_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function qr({size:e=28}){return jsxs(Ot,{width:e,height:e,viewBox:"0 0 28 28",fill:"none",children:[jsxs(G,{clipPath:"url(#btc_clip)",children:[jsx(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"}),jsx(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"})]}),jsx(Defs,{children:jsx(ClipPath,{id:"btc_clip",children:jsx(Rect,{width:28,height:28,fill:"white"})})})]})}function Yr({size:e=28}){return jsxs(Ot,{width:e,height:e,viewBox:"0 0 256 256",fill:"none",children:[jsxs(Defs,{children:[jsxs(LinearGradient,{id:"sol1",x1:"360.9",y1:"-37.5",x2:"141.2",y2:"383.3",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol2",x1:"264.8",y1:"-87.6",x2:"45.16",y2:"333.15",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]}),jsxs(LinearGradient,{id:"sol3",x1:"312.55",y1:"-62.69",x2:"92.88",y2:"358.06",gradientUnits:"userSpaceOnUse",children:[jsx(Stop,{offset:"0",stopColor:"#00FFA3"}),jsx(Stop,{offset:"1",stopColor:"#DC1FFF"})]})]}),jsx(Circle,{cx:128,cy:128,r:128,fill:"black"}),jsxs(G,{transform:"translate(128,128) scale(0.35) translate(-198.85,-156)",children:[jsx(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"}),jsx(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"}),jsx(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 Gr({size:e=28}){return jsx(Ot,{width:e,height:e,viewBox:"0 0 32 32",fill:"none",children:jsxs(G,{children:[jsx(Circle,{cx:16,cy:16,r:16,fill:"#6F41D8"}),jsx(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:Onramp.CryptoNetwork.base,defaultCrypto:"usdc",Icon:Kr},{label:"Ethereum",value:Onramp.CryptoNetwork.ethereum,defaultCrypto:"eth",Icon:Ur},{label:"Bitcoin",value:Onramp.CryptoNetwork.bitcoin,defaultCrypto:"btc",Icon:qr},{label:"Solana",value:Onramp.CryptoNetwork.solana,defaultCrypto:"sol",Icon:Yr},{label:"Polygon",value:Onramp.CryptoNetwork.polygon,defaultCrypto:"matic",Icon:Gr}];function Qr(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 L({onPress:e,title:r}){let{components:o,fonts:n}=V(),t=jsx(TouchableOpacity,{style:pt.closeBtn,onPress:e,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(zt,{size:20,color:o.header.buttonColor,strokeWidth:2})});return r?jsxs(View,{style:pt.headerWithTitle,children:[jsx(View,{style:pt.headerSide}),jsx(Text,{style:[pt.headerTitleText,{color:o.header.titleColor},...n.bold?[{fontFamily:n.bold}]:[]],numberOfLines:1,ellipsizeMode:"tail",accessibilityRole:"header",children:r}),t]}):jsxs(View,{style:pt.header,children:[jsx(View,{style:pt.headerSpacer}),t]})}var Ht={paddingTop:60,paddingBottom:16},pt=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 E({error:e,progress:r,loading:o}){let{colors:n,fonts:t}=V();return e?jsx(Text,{style:[Jr.errorText,{color:n.error},...t.regular?[{fontFamily:t.regular}]:[]],children:e.message}):r&&o&&__DEV__?jsx(Text,{style:[Jr.progressText,{color:n.foregroundSubtle},...t.regular?[{fontFamily:t.regular}]:[]],children:r}):null}var Jr=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 jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:r}),jsx(Text,{style:[e.rowValue,n&&e.rowMono],children:o})]}),t?null:jsx(View,{style:e.rowDivider})]})}function Cr({quote:e,label:r,address:o,last:n}){let[t,l]=useState(false),{colors:s,components:g}=V(),a=()=>{Clipboard.setString(o),l(true),setTimeout(()=>l(false),2e3);},p=Qr(o);return jsxs(Fragment$1,{children:[jsxs(View,{style:e.row,children:[jsx(Text,{style:e.rowLabel,children:r}),jsxs(View,{style:e.rowRight,children:[jsx(Text,{style:[e.rowValue,e.rowMono,{flexShrink:1,minWidth:0}],numberOfLines:1,ellipsizeMode:"middle",selectable:true,children:p}),jsx(TouchableOpacity,{onPress:a,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:`Copy ${r}`,children:t?jsx(lt,{size:14,color:s.success,strokeWidth:2.5}):jsx(Nr,{size:14,color:g.card.actionIcon,strokeWidth:2})})]})]}),n?null:jsx(View,{style:e.rowDivider})]})}function mt(){let{colors:e,fonts:r,components:o}=V(),n=o.input,t=o.button,l=o.container,s=o.card,g=o.header;return useMemo(()=>{let a=s.borderRadius,p=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:g.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}},u=Math.max(16,Math.min(a,22)),c={stackWrapper:{width:"100%",marginBottom:8,marginTop:4},swapCard:{backgroundColor:e.card,borderWidth:s.borderWidth,borderColor:e.border,paddingHorizontal:16,paddingVertical:16},swapCardTop:{borderTopLeftRadius:u,borderTopRightRadius:u,borderBottomLeftRadius:10,borderBottomRightRadius:10},swapCardBottom:{borderBottomLeftRadius:u,borderBottomRightRadius:u,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:g.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:c,wallet:_,flow:w,amount:k}},[e,r,n,t,l,s,g])}var Tn=[["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]=useState(e),g=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 u=S.indexOf(".");return u!==-1&&S.length-u>2?S:S==="0"&&k!=="."?k:S+k});},a=l===""?"0":l,p=parseFloat(l),b=l!==""&&!isNaN(p)&&p>0;return jsxs(View,{style:t.form.screen,children:[jsx(L,{onPress:n,title:"Enter amount"}),jsxs(View,{style:t.form.content,children:[jsxs(View,{style:t.amount.amountContainer,children:[jsxs(Text,{style:[t.amount.amountText,a==="0"&&t.amount.amountPlaceholder],adjustsFontSizeToFit:true,numberOfLines:1,children:["$",a]}),jsx(Text,{style:t.amount.currencyLabel,children:r.toUpperCase()})]}),jsx(View,{style:t.amount.numpad,children:Tn.map((k,S)=>jsx(View,{style:t.amount.numpadRow,children:k.map(u=>jsx(TouchableOpacity,{style:t.amount.numpadKey,onPress:()=>g(u),activeOpacity:.6,children:jsx(Text,{style:u==="\u232B"?t.amount.backspaceText:t.amount.numpadKeyText,children:u})},u))},S))}),jsx(TouchableOpacity,{style:[t.form.continueBtn,!b&&t.form.continueBtnDisabled],onPress:()=>b&&o(l),disabled:!b,children:jsx(Text,{style:[t.form.continueBtnText,!b&&t.form.continueBtnTextDisabled],children:"Continue"})})]})]})}function R({size:e=56,strokeWidth:r=3,children:o,iconSize:n,style:t,gradientFrom:l,gradientTo:s}){let{colors:g}=V(),a=l??g.warning,p=s??"#FBBF24",b=useRef(new Animated.Value(0)).current,k=useId(),S=useMemo(()=>`circularProgressGrad_${k.replace(/[^a-zA-Z0-9_-]/g,"")}`,[k]),u=(e-r)/2,c=2*Math.PI*u,_=e/2,w=n??Math.max(0,Math.round(e-r*2-8)),G=(e-w)/2;useEffect(()=>{let U=Animated.loop(Animated.timing(b,{toValue:1,duration:1500,easing:Easing.linear,useNativeDriver:true}));return U.start(),()=>U.stop()},[b]);let f=b.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return jsxs(View,{style:[{width:e,height:e},t],children:[jsx(Animated.View,{style:{position:"absolute",top:0,left:0,width:e,height:e,transform:[{rotate:f}]},children:jsxs(Ot,{width:e,height:e,children:[jsx(Defs,{children:jsxs(LinearGradient,{id:S,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[jsx(Stop,{offset:"0%",stopColor:a}),jsx(Stop,{offset:"100%",stopColor:p})]})}),jsx(Circle,{cx:_,cy:_,r:u,stroke:`url(#${S})`,strokeWidth:r,fill:"none",strokeDasharray:`${c*.75} ${c*.25}`,strokeLinecap:"round",rotation:-90,origin:`${_}, ${_}`})]})}),o!=null?jsx(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:g}=V(),a=g.input.placeholderColor,[p,b]=useState(1),[k,S]=useState(e.firstName??""),[u,c]=useState(e.lastName??""),[_,w]=useState(e.dobMonth??""),[G,f]=useState(e.dobDay??""),[U,be]=useState(e.dobYear??""),[x,Ie]=useState(e.addressLine1??""),[$,ke]=useState(e.addressLine2??""),[we,et]=useState(e.city??""),[Ce,tt]=useState(e.state??""),[Se,rt]=useState(e.postalCode??""),[N,ot]=useState(e.country??"US"),[ce,Ae]=useState(e.idNumber??""),Ke=useRef(null),xe=useRef(null),Ve=useRef(null),_e=useRef(null),Te=useRef(null),K=useRef(null),Be=useRef(null),Fe=useRef(null),nt=()=>{switch(p){case 1:return k.trim().length>0&&u.trim().length>0;case 2:return _.length===2&&G.length===2&&U.length===4;case 3:return x.trim().length>0&&we.trim().length>0&&Ce.trim().length>0&&Se.trim().length>0;case 4:return ce.trim().length>0;default:return false}},Ee=()=>{nt()&&(p<Rt?b(O=>O+1):o({firstName:k,lastName:u,idNumber:ce,dobMonth:_,dobDay:G,dobYear:U,addressLine1:x,addressLine2:$,city:we,state:Ce,postalCode:Se,country:N}));},de=()=>{p>1?b(O=>O-1):n();},Ct=["Enter your name","Enter your date of birth","Enter your address","Enter your SSN"],lr=["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."],cr=[P.stepCounter,{color:l.foregroundMuted},...s.semibold?[{fontFamily:s.semibold}]:[]];return jsx(KeyboardAvoidingView,{style:t.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:t.form.screen,children:[jsxs(View,{style:P.header,children:[jsx(View,{style:P.headerSide,children:jsx(TouchableOpacity,{style:P.iconButton,onPress:de,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:p>1?"Back":"Cancel",children:jsx(Wr,{size:20,color:g.header.buttonColor,strokeWidth:2})})}),jsx(View,{style:P.headerCenter,children:jsxs(Text,{style:cr,children:[p," of ",Rt]})}),jsx(View,{style:P.headerSide,children:jsx(TouchableOpacity,{style:P.iconButton,onPress:n,hitSlop:{top:10,bottom:10,left:10,right:10},accessibilityRole:"button",accessibilityLabel:"Close",children:jsx(zt,{size:20,color:g.header.buttonColor,strokeWidth:2})})})]}),jsx(View,{style:P.progressTrack,children:Array.from({length:Rt}).map((O,F)=>jsx(View,{style:[P.progressSegment,{backgroundColor:F<p||F+1===p?l.primary:l.border}]},F))}),jsxs(ScrollView,{style:t.form.flex,contentContainerStyle:P.scrollContent,keyboardShouldPersistTaps:"handled",children:[jsx(Text,{style:t.form.title,children:Ct[p-1]}),jsx(Text,{style:t.form.subtitle,children:lr[p-1]}),p===1&&jsxs(Fragment,{children:[jsx(ve,{form:t.form,label:"First name",children:jsx(TextInput,{style:t.form.input,placeholder:"Jane",placeholderTextColor:a,value:k,onChangeText:S,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>Ke.current?.focus()})}),jsx(ve,{form:t.form,label:"Last name",children:jsx(TextInput,{ref:Ke,style:t.form.input,placeholder:"Doe",placeholderTextColor:a,value:u,onChangeText:c,autoCapitalize:"words",returnKeyType:"done",onSubmitEditing:Ee})})]}),p===2&&jsxs(View,{style:P.dobRow,children:[jsxs(View,{style:P.dobCol,children:[jsx(Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Month"}),jsx(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&&xe.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:P.dobCol,children:[jsx(Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Day"}),jsx(TextInput,{ref:xe,style:[t.form.input,P.dobInput],placeholder:"DD",placeholderTextColor:a,value:G,onChangeText:O=>{let F=O.replace(/\D/g,"").slice(0,2);f(F),F.length===2&&Ve.current?.focus();},keyboardType:"number-pad",maxLength:2})]}),jsxs(View,{style:P.dobColWide,children:[jsx(Text,{style:[t.form.fieldLabel,P.dobLabel],children:"Year"}),jsx(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:Ee})]})]}),p===3&&jsxs(Fragment,{children:[jsx(ve,{form:t.form,label:"Street address",children:jsx(TextInput,{style:t.form.input,placeholder:"123 Main St",placeholderTextColor:a,value:x,onChangeText:Ie,returnKeyType:"next",onSubmitEditing:()=>_e.current?.focus()})}),jsx(ve,{form:t.form,label:"Apt, suite, etc. (optional)",children:jsx(TextInput,{ref:_e,style:t.form.input,placeholder:"Apt 2",placeholderTextColor:a,value:$,onChangeText:ke,returnKeyType:"next",onSubmitEditing:()=>Te.current?.focus()})}),jsx(ve,{form:t.form,label:"City",children:jsx(TextInput,{ref:Te,style:t.form.input,placeholder:"San Francisco",placeholderTextColor:a,value:we,onChangeText:et,autoCapitalize:"words",returnKeyType:"next",onSubmitEditing:()=>K.current?.focus()})}),jsxs(View,{style:P.row,children:[jsx(View,{style:[t.form.flex,{marginRight:8}],children:jsx(ve,{form:t.form,label:"State",children:jsx(TextInput,{ref:K,style:t.form.input,placeholder:"NY",placeholderTextColor:a,value:Ce,onChangeText:O=>tt(O.toUpperCase().slice(0,2)),autoCapitalize:"characters",maxLength:2,returnKeyType:"next",onSubmitEditing:()=>Be.current?.focus()})})}),jsx(View,{style:t.form.flex,children:jsx(ve,{form:t.form,label:"ZIP code",children:jsx(TextInput,{ref:Be,style:t.form.input,placeholder:"11201",placeholderTextColor:a,value:Se,onChangeText:rt,keyboardType:"number-pad",maxLength:10,returnKeyType:"next",onSubmitEditing:()=>Fe.current?.focus()})})})]}),jsx(ve,{form:t.form,label:"Country",children:jsx(TextInput,{ref:Fe,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:Ee})})]}),p===4&&jsxs(ve,{form:t.form,label:"Social Security Number",children:[jsx(TextInput,{style:t.form.input,placeholder:"123-45-6789",placeholderTextColor:a,value:ce,onChangeText:Ae,keyboardType:"number-pad",secureTextEntry:true,returnKeyType:"done",onSubmitEditing:Ee}),jsx(Text,{style:[t.form.hint,P.ssnHint],children:"Your SSN is transmitted securely and never stored on this device."})]})]}),jsx(View,{style:t.form.footer,children:r&&p===Rt?jsx(View,{style:[t.form.continueBtn,t.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[t.form.continueBtn,!nt()&&t.form.continueBtnDisabled],onPress:Ee,disabled:!nt(),children:jsx(Text,{style:[t.form.continueBtnText,!nt()&&t.form.continueBtnTextDisabled],children:p===Rt?"Submit":"Continue"})})})]})})}function ve({form:e,label:r,children:o}){return jsxs(View,{style:e.fieldWrap,children:[jsx(Text,{style:e.fieldLabel,children:r}),o]})}var P=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 Mn="https://api.unifold.io",io,Nn="pk_test_123";function jn(){return typeof __DEV__<"u"&&__DEV__&&io?io:Mn}function Zt(){return jn()}function Xt(){return Nn}var so="",ao;function er(e){so=e;}function tr(e){ao=e;}function ye(){let e=so||Xt();return e}function ge(){return ao??Zt()}async function rr(){let e=`${ge()}/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(`${ge()}/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(`${ge()}/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(`${ge()}/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(`${ge()}/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=`${ge()}/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=`${ge()}/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(`${ge()}/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 go(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(`${ge()}/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 ho(e){let r=new URLSearchParams({token_address:e.token_address,chain_id:e.chain_id,chain_type:e.chain_type}),o=await fetch(`${ge()}/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 Hn=5,bo={firstName:"",lastName:"",idNumber:"",dobDay:"",dobMonth:"",dobYear:"",addressLine1:"",addressLine2:"",city:"",state:"",postalCode:"",country:"US"};function or(e){let r=e?.flowOrder==="amount_first",o=r?"session_params":"email",{configure:n,hasLinkAccount:t,registerLinkUser:l,authorize:s,attachKycInfo:g,presentKycInfoVerification:a,verifyIdentity:p,registerWalletAddress:b,collectPaymentMethod:k,createCryptoPaymentToken:S}=useOnramp(),[u,c]=useState(o),[_,w]=useState(false),[G,f]=useState(""),[U,be]=useState(null),[x,Ie]=useState(e?.email??""),[$,ke]=useState(e?.phone??""),[we,et]=useState(""),[Ce,tt]=useState("US"),[Se,rt]=useState(""),[N,ot]=useState(""),[ce,Ae]=useState(false),[Ke,xe]=useState(false),Ve=useRef(0),_e=useRef(false),Te=useRef(false),K=useRef(false),Be=useRef(""),Fe=useRef(null),[nt,Ee]=useState(bo),[de,Ct]=useState(e?.defaultWalletAddress??"0x102471956A026866171C44F326e1DfafB6C6e34c"),[lr,cr]=useState(""),[O,F]=useState(e?.defaultNetwork??Onramp.CryptoNetwork.base),[ze,Tr]=useState(e?.defaultSourceAmount??"100"),[Wt,Or]=useState(e?.defaultSourceCurrency??"usd"),[Mt,dr]=useState(e?.defaultDestinationCurrency??"usdc"),[ue,St]=useState(null),[Fo,Pr]=useState(false),ne=useRef(null),it=useRef(false),st=useRef(0),vr=useRef(e?.onComplete),Lr=useRef(e?.onError),Rr=useRef(e?.onStepChange),ur=useRef(o);useEffect(()=>{vr.current=e?.onComplete;},[e?.onComplete]),useEffect(()=>{Lr.current=e?.onError;},[e?.onError]),useEffect(()=>{Rr.current=e?.onStepChange;},[e?.onStepChange]);let pr=useRef(o);useEffect(()=>{u!==pr.current&&(Rr.current?.(u,pr.current),pr.current=u),ur.current=u;},[u]);let m=useCallback((i,d,h)=>{let C={code:i,message:d,step:ur.current,stripeErrorCode:h};be(C),f(""),Lr.current?.(C);},[]),Ir=useCallback(i=>{let d={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?.(d),d},[]),T=useCallback(()=>be(null),[]);useEffect(()=>{if(!(e?.merchantIdentifier?.trim()??"")){Pr(false);return}let d=false;return isPlatformPaySupported().then(h=>{d||Pr(h);}),()=>{d=true;}},[e?.merchantIdentifier]),useEffect(()=>(it.current=false,()=>{it.current=true,ne.current&&clearTimeout(ne.current);}),[]),useEffect(()=>{if(!e?.publishableKey||!e?.externalUserId||!e?.recipientAddress||ce||Ke)return;let i=false;xe(true);async function d(){try{let[h,C]=await Promise.all([go({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?ho({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=h.data.find(J=>J.chain_type===v);if(Q?.address){let J=Q.address.toLowerCase();Ct(J),Be.current=J,Q.recipient_address&&cr(Q.recipient_address);}else console.warn("[resolveWallet] No wallet found for chain_type",v,"in",h.data?.length,"wallets");let re={base:Onramp.CryptoNetwork.base,ethereum:Onramp.CryptoNetwork.ethereum,solana:Onramp.CryptoNetwork.solana,bitcoin:Onramp.CryptoNetwork.bitcoin,polygon: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()),Ae(!0),K.current=!0;}catch(h){console.error("[useStripeOnramp] Failed to resolve wallet:",h?.message),Ae(true),K.current=true;}finally{i||xe(false);}}return d(),()=>{i=true;}},[e?.publishableKey,e?.externalUserId]);let xt=useCallback(async()=>{if(Fe.current)return Fe.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(d=>(d.error&&(console.error("[useStripeOnramp] configureSDK error:",d.error.message,d.error.code),Fe.current=null),d)).catch(d=>{throw console.error("[useStripeOnramp] configureSDK threw:",d?.message??d),Fe.current=null,d});return Fe.current=i,i},[n,e?.merchantDisplayName]);useEffect(()=>{xt();},[]);let Ue=useCallback(async i=>{if(!_e.current){_e.current=true,w(true),T(),f("Creating auth intent...");try{let d=await lo(i);f("Waiting for authorization...");let h=await s(d);if(h?.error){m("authorization_error",h.error.message,h.error.code),c("email");return}if(h?.status==="Denied"){m("authorization_error","Authorization denied by user."),c("email");return}if(h?.status!=="Consented"||!h.customerId){m("authorization_error","Authorization was canceled."),c("email");return}f("Exchanging tokens...");let C=await co(d),v=h.customerId,Q=C.access_token;rt(v),ot(Q),f("Checking verification status...");try{let re=await mo(v,Q),_t=re.verifications.find(Oe=>Oe.name==="kyc_verified"),at=re.verifications.find(Oe=>Oe.name==="id_document_verified"),Tt=_t?.status==="verified",J=_t?.status==="rejected",Br=at?.status==="verified",mr=re.provided_fields.includes("first_name");if(f(""),J&&!mr)m("kyc_error","KYC was previously rejected. Please submit with correct info."),c("kyc");else if(J&&mr)c(Br?"wallet":"identity");else if(!Tt&&!mr)c("kyc");else if(!Br)c("identity");else if(K.current&&Be.current)try{let Oe=await b(Be.current,O);Oe?.error?(m("wallet_error",Oe.error.message,Oe.error.code),c("wallet")):c(r?"payment_method":"session_params");}catch(Oe){console.warn("[proceedToAuthorize] Inline wallet registration failed, falling back to wallet step:",Oe?.message),c("wallet");}else c("wallet");}catch(re){console.warn("[getOnrampCustomer] failed, defaulting to kyc:",re?.message),f(""),c("kyc");}}catch(d){m("authorization_error",d?.message??String(d)),c("email");}finally{_e.current=false,w(false);}}},[s,T,m,b,O,r]),Eo=useCallback(async()=>{if(Keyboard.dismiss(),!x){m("validation_error","Please enter an email address.");return}w(true),T(),f("");try{f("Configuring...");let i=await xt();if(i.error){m("configuration_error",i.error.message,i.error.code);return}f("Checking Link account...");let d=await t(x);if(d.error){m("authorization_error",d.error.message,d.error.code);return}d.hasLinkAccount?await Ue(x):(f(""),c("register"));}catch(i){m("unknown_error",i?.message??String(i));}finally{w(false);}},[T,xt,x,m,t,Ue]),Do=useCallback(async()=>{if(!$){m("validation_error","Please enter your phone number.");return}w(true),T(),f("");try{f("Creating Link account...");let i=await l({email:x,phone:$,fullName:we||x,country:Ce||"US"});if(i.error){m("registration_error",i.error.message,i.error.code);return}await Ue(x);}catch(i){m("registration_error",i?.message??String(i));}finally{w(false);}},[T,Ce,x,m,we,$,l,Ue]);useEffect(()=>{if(u!=="email"||!e?.email)return;let i=++Ve.current,d=false,h=()=>d||Ve.current!==i;return e?.phone?(async()=>{w(true),T();try{f("Configuring...");let C=await xt();if(h())return;if(C.error){m("configuration_error",C.error.message,C.error.code);return}f("Checking Link account...");let v=await t(e.email);if(h())return;if(v.error){m("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(h())return;await Ue(e.email);}else {f("Creating Link account...");let Q=await l({email:e.email,phone:e.phone,fullName:e.email,country:"US"});if(h())return;if(Q.error){m("registration_error",Q.error.message,Q.error.code);return}if(h())return;await Ue(e.email);}}catch(C){h()||m("unknown_error",C?.message??String(C));}finally{w(false);}})():(async()=>{w(true),T();try{f("Configuring...");let C=await xt();if(h())return;if(C.error){m("configuration_error",C.error.message,C.error.code);return}f("Checking Link account...");let v=await t(e.email);if(h())return;if(v.error){m("authorization_error",v.error.message,v.error.code);return}if(v.hasLinkAccount){if(h())return;await Ue(e.email);}else {if(h())return;f(""),c("register");}}catch(C){h()||m("unknown_error",C?.message??String(C));}finally{w(false);}})(),()=>{d=true;}},[u,e?.email,e?.phone]);let Wo=useCallback(async i=>{w(true),T(),f(""),Ee(i);try{let d={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}},h=await g(d);if(h?.error){if(h.error.stripeErrorCode==="consumer_person_already_verified"){f(""),c("identity");return}m("kyc_error",h.error.message,h.error.stripeErrorCode??h.error.code),c("kyc");return}f("Please review your KYC information...");let C=await a(null);if(C?.error){m("kyc_error",C.error.message,C.error.stripeErrorCode??C.error.code),c("kyc");return}if(C?.status==="UpdateAddress"){m("kyc_error","Please update your address and resubmit."),c("kyc");return}f(""),c("identity");}catch(d){m("kyc_error",d?.message??String(d)),c("kyc");}finally{w(false);}},[g,T,m,a]),Ar=useCallback(async()=>{if(!Te.current){Te.current=true,w(true),T(),f("Launching identity verification...");try{let i=await p();if(i?.error){m("identity_error",i.error.message,i.error.code);return}f(""),c("wallet");}catch(i){m("identity_error",i?.message??String(i));}finally{Te.current=false,w(false);}}},[T,m,p]);useEffect(()=>{u==="identity"&&!_&&Ar();},[u]);let Vr=useCallback(async()=>{if(!de){m("validation_error","Please enter a wallet address.");return}w(true),T(),f("");try{let i=await b(de.toLowerCase(),O);if(i?.error){m("wallet_error",i.error.message,i.error.code);return}f(""),c(r?"payment_method":"session_params");}catch(i){m("wallet_error",i?.message??String(i));}finally{w(false);}},[T,m,de,O,b,r]);useEffect(()=>{u==="wallet"&&ce&&de&&!_&&Vr();},[u,ce,de]);let Nt=useCallback((i,d)=>{it.current=false,st.current=0;let h=async()=>{try{let C=await fo(i,d);if(it.current)return;st.current=0,C.status==="fulfillment_complete"?(St(C),c("success"),Ir(C)):ne.current=setTimeout(h,3e3);}catch(C){if(it.current)return;if(st.current+=1,console.error("[pollSessionStatus] error:",C?.message),st.current>=Hn){m("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(h,5e3);}};ne.current=setTimeout(h,3e3);},[Ir,m]),Mo=useCallback(()=>{ur.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=useCallback(async i=>{w(true),T(),f("");try{f("Confirming purchase...");let d=await po(i,N);St(d),c("processing"),f(""),Nt(d.id,N);}finally{w(false);}},[N,T,Nt]),No=useCallback(async()=>{if(ue)try{await jt(ue.id);}catch(i){m("session_error",i?.message??String(i)),c("quote");}},[m,jt,ue]),jo=useCallback(async(i=false)=>{if(!ze||isNaN(Number(ze))||Number(ze)<=0){m("validation_error","Please enter a valid amount.");return}w(true),T(),f("");try{let d;if(i){if(!e?.merchantIdentifier?.trim()){m("configuration_error","Apple Pay is not configured. Pass merchantIdentifier on StripeOnramp or in onramp config."),c("payment_method");return}f("Opening Apple Pay...");let Q={applePay:{merchantCountryCode:"US",currencyCode:Wt.toUpperCase(),cartItems:[{paymentType:PlatformPay.PaymentType.Immediate,label:`${Mt.toUpperCase()} purchase + fees`,amount:ze||"0.00"}]}};d=await k("PlatformPay",Q);}else f("Select a payment method..."),d=await k("Card");if(d?.error){m("payment_error",d.error.message,d.error.code),c("payment_method");return}if(!d?.displayData){m("payment_error","Payment method selection was canceled."),c("payment_method");return}f("Creating payment token...");let h=await S();if(h?.error){m("payment_error",h.error.message,h.error.code),c("payment_method");return}let C=h.cryptoPaymentToken;f("Creating onramp session...");let v=await uo({cryptoCustomerId:Se,paymentToken:C,sourceAmount:Number(ze),sourceCurrency:Wt,destinationCurrency:Mt,walletAddress:de.toLowerCase(),destinationNetwork:O},N);St(v),f(""),i?await jt(v.id):c("quote");}catch(d){m("session_error",d?.message??String(d)),c("payment_method");}finally{w(false);}},[N,T,k,S,Se,Mt,m,jt,ze,Wt,de,O,e?.merchantIdentifier]),Ko=useCallback(async()=>{if(ue){w(true),T(),f("");try{let i=await yo(ue.id,N);St(i);}catch(i){m("session_error",i?.message??String(i));}finally{w(false);}}},[N,T,m,ue]),zo=useCallback(()=>{it.current=true,st.current=0,ne.current&&(clearTimeout(ne.current),ne.current=null),c(o),w(false),f(""),be(null),Ie(e?.email??""),ke(e?.phone??""),et(""),tt("US"),rt(""),ot(""),Ae(false),xe(false),Ee(bo),Ct(e?.recipientAddress??""),F(Onramp.CryptoNetwork.ethereum),Tr(e?.defaultSourceAmount??"100"),Or(e?.defaultSourceCurrency??"usd"),dr(e?.defaultDestinationCurrency??"usdc"),St(null),Ve.current+=1,_e.current=false,Te.current=false;},[e,o]);return {step:u,loading:_,status:G,error:U,email:x,phone:$,fullName:we,country:Ce,customerId:Se,accessToken:N,session:ue,kycData:nt,walletAddress:de,resolvedRecipientAddress:lr,walletNetwork:O,sourceAmount:ze,sourceCurrency:Wt,destinationCurrency:Mt,applePaySupported:Fo,walletReady:ce,walletLoading:Ke,setStep:c,setStatus:f,setEmail:Ie,setPhone:ke,setFullName:et,setCountry:tt,setWalletAddress:Ct,setWalletNetwork:F,setSourceAmount:Tr,setSourceCurrency:Or,setDestinationCurrency:dr,checkEmail:Eo,register:Do,attachKyc:Wo,verifyIdentity:Ar,registerWallet:Vr,collectPaymentMethod:jo,refreshQuote:Ko,confirmCheckout:No,reset:zo,clearError:T,resumeFulfillmentPolling:Mo,amountFirst:r}}function ko({styles:e,placeholderColor:r,hasPrefilledEmail:o,loading:n,error:t,status:l,email:s,setEmail:g,checkEmail:a,onClose:p}){return o?jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:p}),jsxs(View,{style:e.flow.centered,children:[jsx(R,{size:56,strokeWidth:3}),jsx(E,{error:t,progress:l,loading:n})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:p}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your email"}),jsx(Text,{style:e.form.subtitle,children:"We'll check if you have a Link account or create one for you."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Email address"}),jsx(TextInput,{style:e.form.input,placeholder:"jane@example.com",placeholderTextColor:r,keyboardType:"email-address",autoCapitalize:"none",autoCorrect:false,value:s,onChangeText:g,autoFocus:true,returnKeyType:"done",onSubmitEditing:a})]})]}),jsxs(View,{style:e.form.footer,children:[n?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:a,disabled:!s,children:jsx(Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(E,{error:t,progress:l,loading:n})]})]})})}function Co({styles:e,loading:r,status:o,error:n,verifyIdentity:t,onClose:l}){return jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:l}),jsxs(View,{style:e.flow.centered,children:[r?jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(R,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Verifying identity"}),jsx(Text,{style:e.flow.sub,children:o||"Preparing identity verification..."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(Text,{style:e.flow.idIcon,children:"\u{1FAAA}"})}),jsx(Text,{style:e.flow.heading,children:"Identity verification"}),jsx(Text,{style:e.flow.sub,children:o||"Tap below to continue verification."})]}),jsx(E,{error:n,progress:o,loading:false})]}),!r&&jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:t,children:jsx(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:g,applePaySupported:a,collectPaymentMethod:p,onClose:b}){let{colors:k}=V(),S=ut.find(_=>_.value===g)?.label??g,u=t===""||t===void 0?"0":t,c=k.primaryForeground;return jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:b,title:"How do you want to pay?"}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.pm.payHint,children:"Select a payment method to continue"}),jsxs(View,{style:e.pm.stackWrapper,children:[jsxs(View,{style:[e.pm.swapCard,e.pm.swapCardTop],children:[jsx(Text,{style:e.pm.summaryLabel,children:"You pay"}),jsxs(View,{style:e.pm.swapRow,children:[jsxs(Text,{style:e.pm.swapSpendAmount,numberOfLines:1,adjustsFontSizeToFit:true,children:["$",u]}),jsx(View,{style:e.pm.swapPill,children:jsx(Text,{style:e.pm.swapPillText,children:l.toUpperCase()})})]})]}),jsx(View,{style:e.pm.swapConnectorWrap,pointerEvents:"none",children:jsx(View,{style:e.pm.swapConnectorCircle,children:jsx(Mr,{size:20,color:c,strokeWidth:2.5})})}),jsxs(View,{style:[e.pm.swapCard,e.pm.swapCardBottom],children:[jsx(Text,{style:e.pm.summaryLabel,children:"You receive"}),jsxs(View,{style:e.pm.swapRow,children:[jsx(View,{style:e.pm.swapLeftCol,children:jsx(Text,{style:e.pm.swapReceivePrimary,numberOfLines:1,adjustsFontSizeToFit:true,children:s.toUpperCase()})}),jsx(View,{style:e.pm.swapPill,children:jsx(Text,{style:e.pm.swapPillText,children:S.toUpperCase()})})]})]})]})]}),jsxs(View,{style:e.form.footer,children:[r?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsxs(Fragment,{children:[a&&jsx(TouchableOpacity,{style:e.pm.applePayBtn,onPress:()=>p(true),children:jsxs(Text,{style:e.pm.applePayBtnText,children:["Pay with ","\uF8FF"," Pay"]})}),jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:()=>p(false),children:jsx(Text,{style:e.form.continueBtnText,children:"Pay with Card"})})]}),jsx(E,{error:o,progress:n,loading:r})]})]})}function To({styles:e,error:r,status:o,loading:n,onClose:t,onRetryStatusCheck:l}){let s=!!r;return jsxs(View,{style:e.form.screen,children:[s?jsx(L,{onPress:t}):jsx(View,{style:Ht}),jsx(View,{style:e.flow.centered,children:r?jsxs(Fragment,{children:[jsx(Text,{style:e.flow.heading,children:"Could not confirm status"}),jsx(Text,{style:e.flow.sub,children:"Your payment may still be completing. Try checking again, or close this screen and verify your wallet balance."})]}):jsxs(Fragment,{children:[jsx(View,{style:e.flow.spinnerWrap,children:jsx(R,{size:48,strokeWidth:3})}),jsx(Text,{style:e.flow.heading,children:"Processing your purchase"}),jsxs(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."]})]})}),jsxs(View,{style:e.form.footer,children:[jsx(E,{error:r,progress:o,loading:n}),r?jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:l,children:jsx(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:g}){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 jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:g,title:"Review your purchase"}),jsxs(View,{style:e.form.content,children:[jsxs(View,{style:e.quote.heroBox,children:[jsx(Text,{style:e.quote.heroLabel,children:"You receive"}),jsx(Text,{style:e.quote.heroAmount,children:k}),jsxs(Text,{style:e.quote.heroNetwork,children:[a.destination_currency.toUpperCase()," ",$t(a.destination_network)]})]}),jsxs(View,{style:e.quote.card,children:[jsx(De,{quote:e.quote,label:"You pay",value:`${a.source_amount} ${a.source_currency.toUpperCase()}`}),jsx(De,{quote:e.quote,label:"Network fee",value:`$${a.fees.network_fee_amount}`}),jsx(De,{quote:e.quote,label:"Transaction fee",value:`$${a.fees.transaction_fee_amount}`}),jsx(De,{quote:e.quote,label:"Wallet",value:b,mono:true}),jsx(De,{quote:e.quote,label:"Quote expires",value:p,last:true})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsxs(Fragment,{children:[jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:l,children:jsx(Text,{style:e.form.continueBtnText,children:"Confirm Purchase"})}),jsx(TouchableOpacity,{style:e.form.ghostBtn,onPress:s,children:jsx(Text,{style:e.form.ghostBtnText,children:"Refresh Quote"})})]}),jsx(E,{error:n,progress:t,loading:o})]})]})}function vo({styles:e,hasPrefilledPhone:r,loading:o,error:n,status:t,email:l,phone:s,setPhone:g,register:a,onClose:p}){let b=V();return r?jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:p}),jsxs(View,{style:e.flow.centered,children:[jsx(R,{size:56,strokeWidth:3}),jsx(E,{error:n,progress:t,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:p}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Enter your phone"}),jsx(Text,{style:e.form.subtitle,children:"We'll send a verification code to confirm your number."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Phone number"}),jsx(TextInput,{style:e.form.input,placeholder:"+12125551234",placeholderTextColor:b.components.input.placeholderColor,keyboardType:"phone-pad",value:s,onChangeText:k=>g(k.replace(/[^\d+]/g,"").replace(/(?!^)\+/g,"")),autoFocus:true,returnKeyType:"done",onSubmitEditing:a}),jsx(Text,{style:e.form.hint,children:"Include country code, e.g. +12125551234"})]}),jsxs(View,{style:e.form.emailRow,children:[jsx(Text,{style:e.form.emailLabel,children:"Signing up as"}),jsx(Text,{style:e.form.emailValue,children:l})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!s&&e.form.continueBtnDisabled],onPress:a,disabled:!s,children:jsx(Text,{style:[e.form.continueBtnText,!s&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(E,{error:n,progress:t,loading:o})]})]})})}function Lo({styles:e,session:r,resolvedRecipientAddress:o,recipientFromConfig:n,onDone:t}){let{colors:l}=V(),s=r.transaction_details,g=Ut(s.destination_amount,s.destination_currency),a=o||n||"";return jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:t,title:"Purchase complete"}),jsx(View,{style:e.form.content,children:jsxs(ScrollView,{style:e.form.flex,contentContainerStyle:e.flow.successScrollContent,showsVerticalScrollIndicator:false,children:[jsx(View,{style:e.flow.checkCircle,children:jsx(lt,{size:40,color:l.success,strokeWidth:2.5})}),jsx(Text,{style:e.flow.sub,children:"Your crypto is on its way to your wallet."}),jsxs(View,{style:[e.quote.heroBox,e.flow.detailCard],children:[jsx(Text,{style:e.quote.heroLabel,children:"You received"}),jsx(Text,{style:e.quote.heroAmount,children:g}),jsxs(Text,{style:e.quote.heroNetwork,children:[s.destination_currency.toUpperCase()," ",$t(s.destination_network)]})]}),jsxs(View,{style:[e.quote.card,e.flow.detailCard],children:[jsx(Cr,{quote:e.quote,label:"Deposit Address",address:s.wallet_address}),a?jsx(Cr,{quote:e.quote,label:"Recipient Address",address:a,last:true}):jsx(De,{quote:e.quote,label:"Session",value:r.id.slice(0,8)+"..."+r.id.slice(-6),mono:true,last:true})]})]})}),jsx(View,{style:e.form.footer,children:jsx(TouchableOpacity,{style:e.form.continueBtn,onPress:t,children:jsx(Text,{style:e.form.continueBtnText,children:"Done"})})})]})}function Io({styles:e,hasAutoWallet:r,loading:o,error:n,status:t,walletAddress:l,walletNetwork:s,setWalletAddress:g,setWalletNetwork:a,setDestinationCurrency:p,registerWallet:b,onClose:k}){let{components:S}=V();return r?jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:k}),jsxs(View,{style:e.flow.centered,children:[jsx(R,{size:56,strokeWidth:3}),jsx(E,{error:n,progress:t,loading:o})]})]}):jsx(KeyboardAvoidingView,{style:e.form.flex,behavior:Platform.OS==="ios"?"padding":void 0,children:jsxs(View,{style:e.form.screen,children:[jsx(L,{onPress:k}),jsxs(View,{style:e.form.content,children:[jsx(Text,{style:e.form.title,children:"Your crypto wallet"}),jsx(Text,{style:e.form.subtitle,children:"Enter the wallet address where you'd like to receive your crypto."}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Wallet address"}),jsx(TextInput,{style:[e.form.input,e.wallet.input],placeholder:"0x...",placeholderTextColor:S.input.placeholderColor,autoCapitalize:"none",autoCorrect:false,value:l,onChangeText:g})]}),jsxs(View,{style:e.form.fieldWrap,children:[jsx(Text,{style:e.form.fieldLabel,children:"Network"}),jsx(View,{style:e.wallet.list,children:ut.map(u=>{let c=s===u.value;return jsxs(TouchableOpacity,{style:[e.wallet.row,c&&e.wallet.rowSelected],onPress:()=>{a(u.value),p(u.defaultCrypto);},children:[jsx(View,{style:e.wallet.iconWrap,children:jsx(u.Icon,{size:24})}),jsx(Text,{style:[e.wallet.rowText,c&&e.wallet.rowTextSelected],children:u.label}),c&&jsx(View,{style:e.wallet.checkCircle,children:jsx(lt,{size:14,color:S.container.buttonTitleColor,strokeWidth:2.5})})]},u.value)})})]})]}),jsxs(View,{style:e.form.footer,children:[o?jsx(View,{style:[e.form.continueBtn,e.form.loaderInButton],children:jsx(R,{size:28,strokeWidth:2})}):jsx(TouchableOpacity,{style:[e.form.continueBtn,!l&&e.form.continueBtnDisabled],onPress:b,disabled:!l,children:jsx(Text,{style:[e.form.continueBtnText,!l&&e.form.continueBtnTextDisabled],children:"Continue"})}),jsx(E,{error:n,progress:t,loading:o})]})]})})}function sr({config:e,onComplete:r}){let o=V(),n=mt(),{step:t,loading:l,status:s,error:g,email:a,phone:p,session:b,kycData:k,walletAddress:S,resolvedRecipientAddress:u,walletNetwork:c,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,applePaySupported:f,setStep:U,setEmail:be,setPhone:x,setWalletAddress:Ie,setWalletNetwork:$,setSourceAmount:ke,setDestinationCurrency:we,checkEmail:et,register:Ce,attachKyc:tt,verifyIdentity:Se,registerWallet:rt,collectPaymentMethod:N,refreshQuote:ot,confirmCheckout:ce,reset:Ae,resumeFulfillmentPolling:Ke,amountFirst:xe}=or(e),Ve=!!e?.email,_e=!!e?.phone,Te=!!e?.publishableKey&&!!e?.externalUserId,K=()=>{Ae(),r?.();};return t==="email"?jsx(ko,{styles:n,placeholderColor:o.components.input.placeholderColor,hasPrefilledEmail:Ve,loading:l,error:g,status:s,email:a,setEmail:be,checkEmail:et,onClose:K}):t==="register"?jsx(vo,{styles:n,hasPrefilledPhone:_e,loading:l,error:g,status:s,email:a,phone:p,setPhone:x,register:Ce,onClose:K}):t==="kyc"?jsx(Jt,{initialData:k,loading:l,onComplete:tt,onCancel:()=>U("email")}):t==="identity"?jsx(Co,{styles:n,loading:l,status:s,error:g,verifyIdentity:Se,onClose:K}):t==="wallet"?jsx(Io,{styles:n,hasAutoWallet:Te,loading:l,error:g,status:s,walletAddress:S,walletNetwork:c,setWalletAddress:Ie,setWalletNetwork:$,setDestinationCurrency:we,registerWallet:rt,onClose:K}):t==="session_params"?jsx(Gt,{initialAmount:_,currency:w,onConfirm:Be=>{ke(Be),U(xe?"email":"payment_method");},onCancel:()=>{xe?K():U("wallet");}}):t==="payment_method"?jsx(xo,{styles:n,loading:l,error:g,status:s,sourceAmount:_,sourceCurrency:w,destinationCurrency:G,walletNetwork:c,applePaySupported:f,collectPaymentMethod:N,onClose:K}):t==="quote"&&b?jsx(Po,{styles:n,session:b,loading:l,error:g,status:s,confirmCheckout:ce,refreshQuote:ot,onClose:K}):t==="processing"?jsx(To,{styles:n,error:g,status:s,loading:l,onClose:K,onRetryStatusCheck:Ke}):t==="success"&&b?jsx(Lo,{styles:n,session:b,resolvedRecipientAddress:u,recipientFromConfig:e?.recipientAddress,onDone:()=>{Ae(),r?.();}}):null}function ar({publishableKey:e,email:r,phone:o,externalUserId:n,flowOrder:t,destinationChainType:l="ethereum",destinationChainId:s="8453",destinationTokenAddress:g,recipientAddress:a,onComplete:p,onError:b,onStepChange:k,onClose:S,merchantIdentifier:u="",urlScheme:c="unifoldOnramp"}){let _=e||Xt(),[w,G]=useState("loading"),[f,U]=useState(null);useEffect(()=>{let x=false;async function Ie(){try{_&&(er(_),tr(Zt()));let $=await rr();if(x)return;let ke=u.trim();if(await initStripe({publishableKey:$,urlScheme:c,...ke?{merchantIdentifier:ke}:{}}),x)return;G("ready");}catch($){if(x)return;console.error("[StripeOnramp] Init failed:",$),U($?.message??"Failed to load Stripe configuration"),G("error");}}return Ie(),()=>{x=true;}},[_,u,c]);let be=useMemo(()=>{let x={publishableKey:_,externalUserId:n,destinationChainType:l,destinationChainId:s,onComplete:p,onError:b,onStepChange:k};return g&&(x.destinationTokenAddress=g),a&&(x.recipientAddress=a),r&&(x.email=r),o&&(x.phone=o),t&&(x.flowOrder=t),x.merchantIdentifier=u,x},[_,n,l,s,g,a,r,o,t,u,p,b,k]);return w==="error"?jsxs(View,{style:wt.centered,children:[jsx(Text,{style:wt.errorText,children:"Unable to initialize"}),jsx(Text,{style:wt.errorDetail,children:f}),S&&jsx(TouchableOpacity,{style:wt.retryBtn,onPress:S,children:jsx(Text,{style:wt.retryBtnText,children:"Go Back"})})]}):w==="loading"?jsx(View,{style:wt.centered,children:jsx(R,{size:56,strokeWidth:3})}):jsx(sr,{config:be,onComplete:S})}var wt=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}=useOnramp(),r=useRef(false);return 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(ar);export{Gt as AmountScreen,Jt as KYCWizardScreen,sr as OnrampScreen,ar as StripeOnramp,Bo as StripeOnrampPreconfigure,rr as getStripePublishableKey,tr as setStripeOnrampApiUrl,er as setStripeOnrampPublishableKey,or as useStripeOnramp};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/connect-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Unifold Connect React Native SDK - Crypto deposit and onramp for React Native/Expo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -23,34 +23,30 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@react-native-async-storage/async-storage": ">=1.19.0",
|
|
27
26
|
"expo": ">=49.0.0",
|
|
28
27
|
"react": "^18.2.0 || ^19.0.0",
|
|
29
|
-
"react-native": ">=0.72.0"
|
|
30
|
-
"react-native-gesture-handler": ">=2.0.0",
|
|
31
|
-
"react-native-svg": ">=13.0.0",
|
|
32
|
-
"react-native-webview": ">=11.0.0",
|
|
33
|
-
"@stripe/stripe-react-native": ">=0.62.0"
|
|
28
|
+
"react-native": ">=0.72.0"
|
|
34
29
|
},
|
|
35
30
|
"peerDependenciesMeta": {
|
|
36
31
|
"expo": {
|
|
37
32
|
"optional": true
|
|
38
|
-
},
|
|
39
|
-
"@stripe/stripe-react-native": {
|
|
40
|
-
"optional": true
|
|
41
33
|
}
|
|
42
34
|
},
|
|
43
35
|
"dependencies": {
|
|
36
|
+
"@react-native-async-storage/async-storage": "^1.19.0",
|
|
37
|
+
"@stripe/stripe-react-native": "^0.62.0",
|
|
44
38
|
"@tanstack/react-query": "^5.90.11",
|
|
39
|
+
"react-native-gesture-handler": "^2.14.0",
|
|
45
40
|
"react-native-qrcode-svg": "^6.3.2",
|
|
46
|
-
"
|
|
41
|
+
"react-native-svg": "^14.0.0",
|
|
42
|
+
"react-native-webview": "^13.0.0"
|
|
47
43
|
},
|
|
48
44
|
"devDependencies": {
|
|
49
45
|
"@types/react": "^18.2.0",
|
|
50
46
|
"@types/react-native": "^0.72.0",
|
|
51
|
-
"dts-bundle-generator": "^9.5.1",
|
|
52
47
|
"tsup": "^8.0.0",
|
|
53
|
-
"typescript": "^5.0.0"
|
|
48
|
+
"typescript": "^5.0.0",
|
|
49
|
+
"@unifold/ui-react-native": "0.1.17"
|
|
54
50
|
},
|
|
55
51
|
"keywords": [
|
|
56
52
|
"unifold",
|
|
@@ -77,8 +73,7 @@
|
|
|
77
73
|
},
|
|
78
74
|
"homepage": "https://unifold.io",
|
|
79
75
|
"scripts": {
|
|
80
|
-
"build": "tsup &&
|
|
81
|
-
"build:dts": "dts-bundle-generator --config dts-bundle-generator.config.json && cp dist/index.d.ts dist/index.d.mts && cp stripe-entry.d.ts dist/stripe.d.ts && cp stripe-entry.d.ts dist/stripe.d.mts",
|
|
76
|
+
"build": "tsup && cp dist/index.d.ts dist/index.d.mts && cp dist/stripe.d.ts dist/stripe.d.mts",
|
|
82
77
|
"dev": "tsup --watch",
|
|
83
78
|
"clean": "rm -rf dist",
|
|
84
79
|
"lint": "eslint \"src/**/*.ts*\"",
|