@privy-io/expo 0.76.5 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/dist/cards.js +2 -2
- package/dist/chunk-3HF374LL.js +1 -0
- package/dist/chunk-6LJTXHKE.js +12 -0
- package/dist/{chunk-6SI7BEEH.js → chunk-B42N35ZL.js} +1 -1
- package/dist/chunk-C5WYSLQF.js +1 -0
- package/dist/{chunk-Z2FSP7KV.js → chunk-CN53OAQW.js} +1 -1
- package/dist/chunk-F7DR7TVR.js +1 -0
- package/dist/connectors.js +1 -1
- package/dist/esm/cards.js +2 -2
- package/dist/esm/chunk-3HF374LL.js +1 -0
- package/dist/esm/chunk-6LJTXHKE.js +12 -0
- package/dist/esm/{chunk-6SI7BEEH.js → chunk-B42N35ZL.js} +1 -1
- package/dist/esm/chunk-C5WYSLQF.js +1 -0
- package/dist/esm/{chunk-Z2FSP7KV.js → chunk-CN53OAQW.js} +1 -1
- package/dist/esm/chunk-F7DR7TVR.js +1 -0
- package/dist/esm/connectors.js +1 -1
- package/dist/esm/extended-chains.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/passkey.js +1 -1
- package/dist/esm/polyfills.js +1 -0
- package/dist/esm/smart-wallets.js +1 -1
- package/dist/esm/ui.js +1 -1
- package/dist/extended-chains.js +1 -1
- package/dist/index.d.ts +21 -5
- package/dist/index.js +1 -1
- package/dist/passkey.d.ts +2 -2
- package/dist/passkey.js +1 -1
- package/dist/polyfills.d.ts +2 -0
- package/dist/polyfills.js +1 -0
- package/dist/smart-wallets.js +1 -1
- package/dist/{types-045de424.d.ts → types-6515eff0.d.ts} +1 -1
- package/dist/ui.js +1 -1
- package/package.json +28 -18
- package/dist/chunk-K5SPDXVF.js +0 -1
- package/dist/chunk-YSPW6UFL.js +0 -12
- package/dist/esm/chunk-K5SPDXVF.js +0 -1
- package/dist/esm/chunk-YSPW6UFL.js +0 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as R,b as N,g as B,h as T,
|
|
1
|
+
import{a as R,b as N,g as B,h as T,la as D}from"./chunk-6LJTXHKE.js";import{b as E,c as P,d as F,e as l}from"./chunk-C5WYSLQF.js";import*as O from"expo-linking";import{useCallback as q,useContext as tt,useEffect as et,useRef as it}from"react";import{Platform as ot}from"react-native";import{PrivyClientError as W}from"@privy-io/js-sdk-core";import{PrivyClientError as X}from"@privy-io/js-sdk-core";import{PrivyClientError as K}from"@privy-io/js-sdk-core";function M(){return l(this,null,function*(){B("expo-apple-authentication");try{return yield import("expo-apple-authentication")}catch(t){throw new K({code:"configuration_error",error:"`expo-apple-authentication` is not installed. Install it and rebuild the native app."})}})}function H(u){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i}){try{let o=yield M();return yield o.signInAsync({state:Y(t),requestedScopes:[o.AppleAuthenticationScope.EMAIL,o.AppleAuthenticationScope.FULL_NAME]})}catch(o){throw o instanceof Error&&"code"in o&&o.code==="ERR_REQUEST_CANCELED"?new X({error:"Apple login was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"}):o}})}function Y(t){var u;return(u=new URL(t).searchParams.get("state"))!=null?u:""}import{Platform as Z}from"react-native";function z(t){return Z.select({android:t.replace("x.com","twitter.com"),default:t})}import*as Q from"expo-linking";import*as m from"expo-web-browser";import{PrivyClientError as j}from"@privy-io/js-sdk-core";function V(o){return l(this,arguments,function*({oauthProviderUrl:t,isLogin:i,returnUrl:u}){var a,p;let n=yield m.openAuthSessionAsync(t,u,{createTask:!1});if(n.type===m.WebBrowserResultType.CANCEL||n.type===m.WebBrowserResultType.DISMISS)throw new j({error:"OAuth was cancelled",code:i?"login_with_oauth_was_cancelled_by_user":"link_with_oauth_was_cancelled_by_user"});if(n.type!=="success")throw new j({error:"OAuth session failed",code:i?"failed_to_complete_login_with_oauth":"failed_to_complete_link_with_oauth"});let r=Q.parse(n.url).queryParams;return{authorizationCode:(a=r==null?void 0:r.privy_oauth_code)!=null?a:null,state:(p=r==null?void 0:r.privy_oauth_state)!=null?p:null,resultUrl:n.url}})}var $=(u={})=>{var o=u,{action:t}=o,i=F(o,["action"]);let{oAuthState:n,setOAuthState:r,client:a}=tt(D),p=it(i);return et(()=>{p.current=i},[i]),{start:q(function(Nt){return l(this,arguments,function*({provider:c,redirectUri:d,isLegacyAppleIosBehaviorEnabled:G=!1,disableSignup:J,onAppleOAuthUserInfo:S}){var C,U,L,v;r({status:"loading"});let y=N(),g=t?t==="login":!!!y;try{if(y&&t==="login"&&!a.isMultiUserModeEnabled)throw new W({code:"attempted_login_with_oauth_while_already_logged_in",error:"Already logged in, if trying to link an OAuth account use `useLinkWithOAuth`"});if(!y&&t==="link")throw new W({code:"attempted_link_oauth_before_logged_in",error:"Must be logged in to link an OAuth account, use `useLoginWithOAuth`"});if(__DEV__&&d!=null&&d.includes("://")){let e=d.split("://")[0];console.warn(`redirectUri includes a scheme prefix (${e}://), it should be a path instead, such as '/authenticated'`)}let w=O.createURL(d||"/"),{url:s}=yield a.auth.oauth.generateURL(c,w);c==="twitter"&&(s=z(s));let h,b,A,f,I,k,_;if(ot.OS==="ios"&&c==="apple"&&!G){let e=yield H({oauthProviderUrl:s,isLogin:g});A=e.authorizationCode,f=e.state,_=e,I="raw"}else{let e=yield V({oauthProviderUrl:s,isLogin:g,returnUrl:w});A=e.authorizationCode,f=e.state,k=e.resultUrl}if(!A||!f)throw new W({error:"OAuth invalid credentials",code:g?"login_with_oauth_returned_with_invalid_credentials":"link_with_oauth_returned_with_invalid_credentials"});if(g){let e=R(),x=yield a.auth.oauth.loginWithCode(A,f,c,I,J?"no-signup":"login-or-sign-up",{embedded:e==null?void 0:e.embedded});h=x.user,b=x.is_new_user}else({user:h}=yield a.auth.oauth.linkWithCode(A,f,c,I));return _&&S&&S({fullName:_.fullName,email:_.email}),(U=(C=p.current).onSuccess)==null||U.call(C,h,b),k&&(yield O.openURL(k.split("?")[0])),r({status:"done",isNewUser:b}),h!=null?h:void 0}catch(w){let s=T(w);throw r({status:"error",error:s}),(v=(L=p.current).onError)==null||v.call(L,s),s}})},[a.auth.oauth,t,r]),state:n}};function Pt(t){let{state:i,start:u}=$(P(E({},t),{action:"login"}));return{state:i,login:u}}export{$ as a,Pt as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty,p=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var r=Math.pow,j=(a,c,b)=>c in a?o(a,c,{enumerable:!0,configurable:!0,writable:!0,value:b}):a[c]=b,s=(a,c)=>{for(var b in c||(c={}))k.call(c,b)&&j(a,b,c[b]);if(f)for(var b of f(c))l.call(c,b)&&j(a,b,c[b]);return a},t=(a,c)=>p(a,q(c));var u=(a,c)=>{var b={};for(var d in a)k.call(a,d)&&c.indexOf(d)<0&&(b[d]=a[d]);if(a!=null&&f)for(var d of f(a))c.indexOf(d)<0&&l.call(a,d)&&(b[d]=a[d]);return b};var v=(a,c,b)=>new Promise((d,i)=>{var m=e=>{try{g(b.next(e))}catch(h){i(h)}},n=e=>{try{g(b.throw(e))}catch(h){i(h)}},g=e=>e.done?d(e.value):Promise.resolve(e.value).then(m,n);g((b=b.apply(a,c)).next())});export{r as a,s as b,t as c,u as d,v as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ka as Ce}from"./chunk-YSPW6UFL.js";import{b as r,c as U,d as m}from"./chunk-K5SPDXVF.js";var C=class extends Error{constructor(o,u){super(u);this.code=o,this.error=u}},he=class extends C{constructor(o){super("underlying_error",o instanceof Error?o.message:"An underlying error occurred");this.wrappedError=o}};import qe,{useContext as ve}from"react";import{useMemo as Ue}from"react";import{createContext as be}from"react";var O=be(void 0);var ge="#5B4FFF";function Se({colorScheme:a,accentHex:t}){return a==="dark"?{interactive:t,background:"#22222A",backgroundSecondary:"#010110",backgroundInformation:"#1E1B4B",backgroundTertiary:"#010110",backgroundHighlight:"#052E16",text:"#ffffff",textPlaceholder:"#9498B8",textMuted:"#FFFFFF",textHighlight:"#BBF7D0",textTitle:"#FFFFFF",textInteractive:"#FFFFFF",icon:"#FFFFFF",iconInformation:"#818CF8",iconSubtle:"#919191",privyBrand:"#FFFFFF",success:"#4ADE80",successLight:"#C5F7D7",border:"#474869",borderInformation:"#818CF8",error:"#FCA5A5",errorDark:"#EF4444"}:{interactive:t,background:"#FFFFFF",backgroundSecondary:"#F3F3F3",backgroundInformation:"#E0E7FF",backgroundTertiary:"#FFFFFF",backgroundHighlight:"#F1F2F9",text:"#040217",textPlaceholder:"#9498B8",textMuted:"#64668B",textHighlight:"#64668B",textTitle:"#1A1C29",textInteractive:"#FFFFFF",icon:"#110F2A",iconSubtle:"#9498B8",iconInformation:"#4F46E5",privyBrand:"#010110",success:"#16A34A",successLight:"#DCFCE7",border:"#E2E3F0",borderInformation:"#5B4FFF",error:"#EF4444",errorDark:"#B91C1C"}}function ke({colorScheme:a,accentHex:t}){return{colors:Se({colorScheme:a,accentHex:t}),colorScheme:a}}function Oe({children:a,appearance:t={}}){let{colorScheme:o="light",accentColor:u}=t,{isReady:d,client:l}=ve(Ce),f=Ue(()=>{var B,L;let s=d?l.app.getConfig():void 0,i=(B=s==null?void 0:s.accent_color)!=null?B:void 0;return ke({colorScheme:o,accentHex:(L=u!=null?u:i)!=null?L:ge})},[o,u,d,l]);return qe.createElement(O.Provider,{value:f},a)}import{useContext as He}from"react";var n=()=>{let a=He(O);if(a===void 0)throw new Error("Components calling useTheme must be wrapped in an ElementsThemeProvider");return a};import{useEffect as Ee}from"react";import{useStore as Ve}from"zustand";import{createStore as Ge}from"zustand/vanilla";var H=Ge()(a=>({elementsConfig:null,updateUIMounted:t=>a({elementsConfig:t})})),Ra=()=>{let{elementsConfig:a}=H.getState();if(!(a!==null))throw new C("privy_elements_not_ready","Privy Elements is not mounted")},ba=()=>{let{elementsConfig:a}=H.getState();if(a===null)throw new C("privy_elements_not_ready","Privy Elements is not mounted");return a},qa=()=>Ve(H,a=>{var t;return(t=a.elementsConfig)==null?void 0:t.appearance}),va=a=>{Ee(()=>{let{updateUIMounted:t}=H.getState();return t(a),()=>{t(null)}},[a])};var we={regular:"Inter_400Regular",medium:"Inter_500Medium",semibold:"Inter_600SemiBold"};import h from"react";import{View as We,Text as Pe,StyleSheet as ze}from"react-native";var Xe=h.forwardRef((d,u)=>{var l=d,{style:a,variant:t="default"}=l,o=m(l,["style","variant"]);let{colors:f}=n();return h.createElement(We,r({ref:u,style:[E.alert,t==="info"&&{backgroundColor:f.backgroundInformation,borderColor:f.borderInformation},a]},o))});Xe.displayName="Alert";var Ne=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.title,{color:l.text},a]},t))});Ne.displayName="AlertTitle";var _e=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.description,{color:l.text},a]},t))});_e.displayName="AlertDescription";var E=ze.create({alert:{borderRadius:8,alignItems:"center",gap:12,paddingHorizontal:12,paddingVertical:8,flexDirection:"row"},title:{marginBottom:4,fontFamily:we.semibold,fontSize:16},description:{fontSize:14,lineHeight:20}});import{forwardRef as Ke,createElement as ye}from"react";import*as V from"react-native-svg";var I={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Ae={fill:I.fill,stroke:I.stroke,strokeWidth:I.strokeWidth,strokeLinecap:I.strokeLinecap,strokeLinejoin:I.strokeLinejoin};var e=(a,t)=>{let o=Ke((p,L)=>{var M=p,{color:u="currentColor",size:d=24,strokeWidth:l=2,absoluteStrokeWidth:f,children:s,"data-testid":i}=M,B=m(M,["color","size","strokeWidth","absoluteStrokeWidth","children","data-testid"]);let v=r({stroke:u,strokeWidth:f?Number(l)*24/Number(d):l},B);return ye(V.Svg,r(U(r({ref:L},I),{width:d,height:d,"data-testid":i}),v),[...t.map(([D,Te])=>{let Re=D.charAt(0).toUpperCase()+D.slice(1);return ye(V[Re],r(r(r({},Ae),v),Te))}),...(Array.isArray(s)?s:[s])||[]])});return o.displayName=`${a}`,o};var G=e("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);var T=e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var W=e("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);var g=e("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);var z=e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var X=e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var N=e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var S=e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var k=e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var w=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var P=e("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var _=e("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);var A=e("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);var K=e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Z=e("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);var J=e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var Q=e("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var j=e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var Y=e("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var y=e("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);var $=e("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);var ee=e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);var ae=e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var te=e("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);var oe=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);var ue=e("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);var de=e("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var le=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var re=e("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);var fe=e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var se=e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var ie=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var ce=e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);var ne=e("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);var pe=e("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);var R=e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);import c from"react";import{Pressable as Fe,StyleSheet as Ze,View as b}from"react-native";var au=({goBack:a,close:t})=>c.createElement(b,{style:me.navigationBar},c.createElement(b,null,a&&c.createElement(Je,{onPress:a})),c.createElement(b,null,t&&c.createElement(Qe,{onPress:t}))),Je=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Back"},a),c.createElement(b,{style:me.backButton},c.createElement(T,{size:24,color:t.icon})))},Qe=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Close"},a),c.createElement(b,{style:me.backButton},c.createElement(R,{size:24,color:t.icon})))},me=Ze.create({navigationBar:{height:48,flexDirection:"row",justifyContent:"space-between"},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import{create as je}from"zustand";var Le=je(()=>null),Ye=()=>{var t;let a=(t=Le.getState())==null?void 0:t.controller;return!a||a.signal.aborted?null:a},du=()=>{var a;(a=Ye())==null||a.abort(),Le.setState(null)},lu=a=>{Le.setState(t=>t&&{step:a})};import x from"react";import{View as Me,Text as ua,Pressable as da,StyleSheet as la}from"react-native";import Ie,{useEffect as $e}from"react";import{Animated as xe,Easing as ea,useAnimatedValue as aa}from"react-native";import ta,{Path as oa}from"react-native-svg";var Be=({color:a})=>{let t=aa(0);$e(()=>{t.setValue(0);let u=xe.loop(xe.timing(t,{toValue:1,duration:1200,useNativeDriver:!0,easing:ea.linear}));return u.start(),()=>u.stop()},[t]);let o=t.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Ie.createElement(xe.View,{style:{transform:[{rotate:o}]}},Ie.createElement(ta,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Ie.createElement(oa,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:a,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var Iu=B=>{var L=B,{variant:a="primary",title:t,destroy:o=!1,loading:u=!1,LeftIcon:d,RightIcon:l,color:f,style:s}=L,i=m(L,["variant","title","destroy","loading","LeftIcon","RightIcon","color","style"]);let{colors:p}=n(),M=o?p.errorDark:p.interactive,v={primary:M,secondary:p.backgroundTertiary,tertiary:p.background}[a],D={primary:p.textInteractive,secondary:p.text,tertiary:M}[a];return x.createElement(da,U(r({},i),{disabled:i.disabled||u}),x.createElement(Me,{style:[q.buttonBox,{backgroundColor:v},a==="secondary"&&q.buttonBoxSecondary,a==="secondary"&&{borderColor:p.border},s]},u?x.createElement(Be,{color:f!=null?f:D}):x.createElement(x.Fragment,null,d,x.createElement(ua,{style:[q.buttonLabel,{color:f!=null?f:D},a==="secondary"&&q.buttonLabelSecondary,a==="tertiary"&&q.buttonLabelTertiary]},t),!!l&&x.createElement(Me,{style:{marginLeft:"auto"}},l))))},q=la.create({buttonBox:{height:54,flexDirection:"row",justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,gap:12},buttonBoxSecondary:{justifyContent:"flex-start",borderWidth:1,borderRadius:12},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24},buttonLabelSecondary:{fontFamily:"Inter_400Regular"},buttonLabelTertiary:{fontFamily:"Inter_500Medium"}});import*as F from"expo-web-browser";import{AppState as ra,Platform as De}from"react-native";var gu=a=>{if(!a)return null;try{return new URL(a).protocol==="https:"?a:null}catch(t){return null}},Su=a=>{let t=!1,o=!1,u=null;function d(){o=!0,u==null||u.remove()}function l(f){if(t||o)return;t=!0;let s=!1;u=De.OS==="android"?ra.addEventListener("change",i=>{i==="background"&&(s=!0),i==="active"&&s&&d()}):null,F.openBrowserAsync(f,{createTask:!1}).then(i=>{i.type!==F.WebBrowserResultType.OPENED&&d()}).catch(d)}return a&&l(a),{navigate:l,isClosed:()=>o,dismiss:()=>{o||(d(),t&&De.OS==="ios"&&F.dismissBrowser().catch(()=>{}))}}};export{Oe as a,n as b,Iu as c,G as d,W as e,g as f,z as g,X as h,N as i,S as j,k,w as l,P as m,_ as n,A as o,K as p,Z as q,J as r,Q as s,j as t,Y as u,y as v,$ as w,ee as x,ae as y,te as z,oe as A,ue as B,de as C,le as D,re as E,fe as F,se as G,ie as H,ce as I,ne as J,pe as K,C as L,he as M,Ra as N,ba as O,qa as P,va as Q,we as R,Xe as S,_e as T,au as U,gu as V,Su as W,Le as X,Ye as Y,du as Z,lu as _};
|
|
1
|
+
import{la as Ce}from"./chunk-6LJTXHKE.js";import{b as r,c as U,d as m}from"./chunk-C5WYSLQF.js";var C=class extends Error{constructor(o,u){super(u);this.code=o,this.error=u}},he=class extends C{constructor(o){super("underlying_error",o instanceof Error?o.message:"An underlying error occurred");this.wrappedError=o}};import qe,{useContext as ve}from"react";import{useMemo as Ue}from"react";import{createContext as be}from"react";var O=be(void 0);var ge="#5B4FFF";function Se({colorScheme:a,accentHex:t}){return a==="dark"?{interactive:t,background:"#22222A",backgroundSecondary:"#010110",backgroundInformation:"#1E1B4B",backgroundTertiary:"#010110",backgroundHighlight:"#052E16",text:"#ffffff",textPlaceholder:"#9498B8",textMuted:"#FFFFFF",textHighlight:"#BBF7D0",textTitle:"#FFFFFF",textInteractive:"#FFFFFF",icon:"#FFFFFF",iconInformation:"#818CF8",iconSubtle:"#919191",privyBrand:"#FFFFFF",success:"#4ADE80",successLight:"#C5F7D7",border:"#474869",borderInformation:"#818CF8",error:"#FCA5A5",errorDark:"#EF4444"}:{interactive:t,background:"#FFFFFF",backgroundSecondary:"#F3F3F3",backgroundInformation:"#E0E7FF",backgroundTertiary:"#FFFFFF",backgroundHighlight:"#F1F2F9",text:"#040217",textPlaceholder:"#9498B8",textMuted:"#64668B",textHighlight:"#64668B",textTitle:"#1A1C29",textInteractive:"#FFFFFF",icon:"#110F2A",iconSubtle:"#9498B8",iconInformation:"#4F46E5",privyBrand:"#010110",success:"#16A34A",successLight:"#DCFCE7",border:"#E2E3F0",borderInformation:"#5B4FFF",error:"#EF4444",errorDark:"#B91C1C"}}function ke({colorScheme:a,accentHex:t}){return{colors:Se({colorScheme:a,accentHex:t}),colorScheme:a}}function Oe({children:a,appearance:t={}}){let{colorScheme:o="light",accentColor:u}=t,{isReady:d,client:l}=ve(Ce),f=Ue(()=>{var B,L;let s=d?l.app.getConfig():void 0,i=(B=s==null?void 0:s.accent_color)!=null?B:void 0;return ke({colorScheme:o,accentHex:(L=u!=null?u:i)!=null?L:ge})},[o,u,d,l]);return qe.createElement(O.Provider,{value:f},a)}import{useContext as He}from"react";var n=()=>{let a=He(O);if(a===void 0)throw new Error("Components calling useTheme must be wrapped in an ElementsThemeProvider");return a};import{useEffect as Ee}from"react";import{useStore as Ve}from"zustand";import{createStore as Ge}from"zustand/vanilla";var H=Ge()(a=>({elementsConfig:null,updateUIMounted:t=>a({elementsConfig:t})})),Ra=()=>{let{elementsConfig:a}=H.getState();if(!(a!==null))throw new C("privy_elements_not_ready","Privy Elements is not mounted")},ba=()=>{let{elementsConfig:a}=H.getState();if(a===null)throw new C("privy_elements_not_ready","Privy Elements is not mounted");return a},qa=()=>Ve(H,a=>{var t;return(t=a.elementsConfig)==null?void 0:t.appearance}),va=a=>{Ee(()=>{let{updateUIMounted:t}=H.getState();return t(a),()=>{t(null)}},[a])};var we={regular:"Inter_400Regular",medium:"Inter_500Medium",semibold:"Inter_600SemiBold"};import h from"react";import{View as We,Text as Pe,StyleSheet as ze}from"react-native";var Xe=h.forwardRef((d,u)=>{var l=d,{style:a,variant:t="default"}=l,o=m(l,["style","variant"]);let{colors:f}=n();return h.createElement(We,r({ref:u,style:[E.alert,t==="info"&&{backgroundColor:f.backgroundInformation,borderColor:f.borderInformation},a]},o))});Xe.displayName="Alert";var Ne=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.title,{color:l.text},a]},t))});Ne.displayName="AlertTitle";var _e=h.forwardRef((u,o)=>{var d=u,{style:a}=d,t=m(d,["style"]);let{colors:l}=n();return h.createElement(Pe,r({ref:o,style:[E.description,{color:l.text},a]},t))});_e.displayName="AlertDescription";var E=ze.create({alert:{borderRadius:8,alignItems:"center",gap:12,paddingHorizontal:12,paddingVertical:8,flexDirection:"row"},title:{marginBottom:4,fontFamily:we.semibold,fontSize:16},description:{fontSize:14,lineHeight:20}});import{forwardRef as Ke,createElement as ye}from"react";import*as V from"react-native-svg";var I={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},Ae={fill:I.fill,stroke:I.stroke,strokeWidth:I.strokeWidth,strokeLinecap:I.strokeLinecap,strokeLinejoin:I.strokeLinejoin};var e=(a,t)=>{let o=Ke((p,L)=>{var M=p,{color:u="currentColor",size:d=24,strokeWidth:l=2,absoluteStrokeWidth:f,children:s,"data-testid":i}=M,B=m(M,["color","size","strokeWidth","absoluteStrokeWidth","children","data-testid"]);let v=r({stroke:u,strokeWidth:f?Number(l)*24/Number(d):l},B);return ye(V.Svg,r(U(r({ref:L},I),{width:d,height:d,"data-testid":i}),v),[...t.map(([D,Te])=>{let Re=D.charAt(0).toUpperCase()+D.slice(1);return ye(V[Re],r(r(r({},Ae),v),Te))}),...(Array.isArray(s)?s:[s])||[]])});return o.displayName=`${a}`,o};var G=e("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);var T=e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var W=e("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);var g=e("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);var z=e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var X=e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var N=e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var S=e("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var k=e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var w=e("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var P=e("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var _=e("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);var A=e("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);var K=e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Z=e("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);var J=e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var Q=e("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var j=e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var Y=e("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);var y=e("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);var $=e("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);var ee=e("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);var ae=e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var te=e("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);var oe=e("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);var ue=e("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);var de=e("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var le=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var re=e("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);var fe=e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);var se=e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);var ie=e("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var ce=e("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);var ne=e("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);var pe=e("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);var R=e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);import c from"react";import{Pressable as Fe,StyleSheet as Ze,View as b}from"react-native";var au=({goBack:a,close:t})=>c.createElement(b,{style:me.navigationBar},c.createElement(b,null,a&&c.createElement(Je,{onPress:a})),c.createElement(b,null,t&&c.createElement(Qe,{onPress:t}))),Je=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Back"},a),c.createElement(b,{style:me.backButton},c.createElement(T,{size:24,color:t.icon})))},Qe=a=>{let{colors:t}=n();return c.createElement(Fe,r({accessibilityRole:"button",accessibilityLabel:"Close"},a),c.createElement(b,{style:me.backButton},c.createElement(R,{size:24,color:t.icon})))},me=Ze.create({navigationBar:{height:48,flexDirection:"row",justifyContent:"space-between"},backButton:{width:48,height:48,justifyContent:"center",alignItems:"center"}});import{create as je}from"zustand";var Le=je(()=>null),Ye=()=>{var t;let a=(t=Le.getState())==null?void 0:t.controller;return!a||a.signal.aborted?null:a},du=()=>{var a;(a=Ye())==null||a.abort(),Le.setState(null)},lu=a=>{Le.setState(t=>t&&{step:a})};import x from"react";import{View as Me,Text as ua,Pressable as da,StyleSheet as la}from"react-native";import Ie,{useEffect as $e}from"react";import{Animated as xe,Easing as ea,useAnimatedValue as aa}from"react-native";import ta,{Path as oa}from"react-native-svg";var Be=({color:a})=>{let t=aa(0);$e(()=>{t.setValue(0);let u=xe.loop(xe.timing(t,{toValue:1,duration:1200,useNativeDriver:!0,easing:ea.linear}));return u.start(),()=>u.stop()},[t]);let o=t.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]});return Ie.createElement(xe.View,{style:{transform:[{rotate:o}]}},Ie.createElement(ta,{width:20,height:20,viewBox:"0 0 20 20",fill:"none"},Ie.createElement(oa,{d:"M19 10a9 9 0 11-6.219-8.56",stroke:a,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})))};var Iu=B=>{var L=B,{variant:a="primary",title:t,destroy:o=!1,loading:u=!1,LeftIcon:d,RightIcon:l,color:f,style:s}=L,i=m(L,["variant","title","destroy","loading","LeftIcon","RightIcon","color","style"]);let{colors:p}=n(),M=o?p.errorDark:p.interactive,v={primary:M,secondary:p.backgroundTertiary,tertiary:p.background}[a],D={primary:p.textInteractive,secondary:p.text,tertiary:M}[a];return x.createElement(da,U(r({},i),{disabled:i.disabled||u}),x.createElement(Me,{style:[q.buttonBox,{backgroundColor:v},a==="secondary"&&q.buttonBoxSecondary,a==="secondary"&&{borderColor:p.border},s]},u?x.createElement(Be,{color:f!=null?f:D}):x.createElement(x.Fragment,null,d,x.createElement(ua,{style:[q.buttonLabel,{color:f!=null?f:D},a==="secondary"&&q.buttonLabelSecondary,a==="tertiary"&&q.buttonLabelTertiary]},t),!!l&&x.createElement(Me,{style:{marginLeft:"auto"}},l))))},q=la.create({buttonBox:{height:54,flexDirection:"row",justifyContent:"center",alignItems:"center",borderRadius:14,paddingHorizontal:16,gap:12},buttonBoxSecondary:{justifyContent:"flex-start",borderWidth:1,borderRadius:12},buttonLabel:{fontFamily:"Inter_600SemiBold",fontSize:16,lineHeight:24},buttonLabelSecondary:{fontFamily:"Inter_400Regular"},buttonLabelTertiary:{fontFamily:"Inter_500Medium"}});import*as F from"expo-web-browser";import{AppState as ra,Platform as De}from"react-native";var gu=a=>{if(!a)return null;try{return new URL(a).protocol==="https:"?a:null}catch(t){return null}},Su=a=>{let t=!1,o=!1,u=null;function d(){o=!0,u==null||u.remove()}function l(f){if(t||o)return;t=!0;let s=!1;u=De.OS==="android"?ra.addEventListener("change",i=>{i==="background"&&(s=!0),i==="active"&&s&&d()}):null,F.openBrowserAsync(f,{createTask:!1}).then(i=>{i.type!==F.WebBrowserResultType.OPENED&&d()}).catch(d)}return a&&l(a),{navigate:l,isClosed:()=>o,dismiss:()=>{o||(d(),t&&De.OS==="ios"&&F.dismissBrowser().catch(()=>{}))}}};export{Oe as a,n as b,Iu as c,G as d,W as e,g as f,z as g,X as h,N as i,S as j,k,w as l,P as m,_ as n,A as o,K as p,Z as q,J as r,Q as s,j as t,Y as u,y as v,$ as w,ee as x,ae as y,te as z,oe as A,ue as B,de as C,le as D,re as E,fe as F,se as G,ie as H,ce as I,ne as J,pe as K,C as L,he as M,Ra as N,ba as O,qa as P,va as Q,we as R,Xe as S,_e as T,au as U,gu as V,Su as W,Le as X,Ye as Y,du as Z,lu as _};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lucide-react-native/dist/esm/defaultAttributes.js:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as o}from"./chunk-C5WYSLQF.js";import{applicationId as n}from"expo-application";import*as e from"expo-secure-store";import{PrivyClientError as c}from"@privy-io/js-sdk-core";var S=()=>{if(typeof n!="string")throw new c({error:"Cannot determine native application ID. Please make sure `expo-application` is installed as a dependency and that `ios.bundleId` or `android.package` is set.",code:"invalid_native_app_id"});return n},a=/[:/]/g;function l(r){return{get(t){return r.get(t.replaceAll(a,"-"))},put(t,i){return r.put(t.replaceAll(a,"-"),i)},del(t){return r.del(t.replaceAll(a,"-"))},getKeys:()=>o(this,null,function*(){return[]})}}var u={get(r){return e.getItemAsync(r,{keychainAccessible:e.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},put(r,t){return e.setItemAsync(r,t,{keychainAccessible:e.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},del(r){return e.deleteItemAsync(r,{keychainAccessible:e.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY})},getKeys:()=>o(void 0,null,function*(){return[]})};export{S as a,l as b,u as c};
|
package/dist/esm/connectors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as M,c as z}from"./chunk-F7DR7TVR.js";import{b as D,c as q,e as m}from"./chunk-C5WYSLQF.js";import{base58 as u,base64 as N}from"@scure/base";import*as c from"expo-linking";import{useState as Z,useEffect as J,useRef as I,useCallback as ee}from"react";import C from"tweetnacl";import{createStore as ne}from"zustand";import{encoding as F}from"@privy-io/encoding";var E=M(z),v=(t,i,s)=>`${t}/ul/v1/${i}?${s.toString()}`,U=(t,i)=>{if(!i)throw new Error("missing shared secret");let s=C.randomBytes(24),h=C.box.after(F.utf8.toBytes(JSON.stringify(t)),s,i);return{nonce:u.encode(s),data:u.encode(h)}},K=(t,i,s)=>{if(!s)throw new Error("missing shared secret");let h=C.box.open.after(u.decode(t),u.decode(i),s);if(!h)throw new Error("Unable to decrypt data");return JSON.parse(F.utf8.fromBytes(h))},re=t=>JSON.stringify({publicKey:Array.from(t.publicKey),secretKey:Array.from(t.secretKey)}),te=t=>{let i=JSON.parse(t);return{publicKey:new Uint8Array(i.publicKey),secretKey:new Uint8Array(i.secretKey)}},B="wallet_keypair",x=6e4,W=({baseUrl:t,appUrl:i,redirectUri:s="/",autoReconnect:h=!0,encryptionPublicKeyName:l})=>{if(!t||!i||!s||!l)throw new Error("baseUrl, appUrl, redirectUri, and encryptionPublicKeyName are required");let{connection:p,setConnection:b,isConnected:P,sharedSecretRef:f}=oe({baseUrl:t,autoReconnect:h}),e=I(null),$=ee(a=>m(void 0,null,function*(){var w;if(!a)return;let n=new URL(a).searchParams,d=n.get("wallet_id");if(!d||d!==l)return;if(n.get("errorCode")){let r=Object.fromEntries([...n]),g=(w=r==null?void 0:r.errorMessage)!=null?w:JSON.stringify(Object.fromEntries([...n]),null,2);console.error("Error from wallet provider: ",g);return}switch(n.get("wallet_action")){case"onConnect":try{if(!n.get("data")||!n.get("nonce")||!n.get(l))throw console.error("missing required fields in response"),new Error("missing required fields in response");let r=yield L(),g=C.box.before(u.decode(n.get(l)),r.secretKey),y=K(n.get("data"),n.get("nonce"),g);f.current=g,b(y),yield E.put(`${t}-key`,N.encode(g)),yield E.put(`${t}-data`,JSON.stringify(y))}catch(r){console.error("Failed to process connect response:",r)}break;case"onSignMessage":try{if(!e.current||e.current.type!=="signMessage"){console.warn("Received signature response but no pending signature request");return}if(!n.get("data")||!n.get("nonce"))throw console.error("missing required fields in response"),new Error("missing required fields in response");let r=K(n.get("data"),n.get("nonce"),f.current);e.current.resolve(r),e.current=null}catch(r){console.error("Failed to process signature response:",r),e.current&&(e.current.reject(r),e.current=null)}break;case"onSignTransaction":try{if(!e.current||e.current.type!=="signTransaction"){console.warn("Received signature response but no pending signature request");return}if(!n.get("data")||!n.get("nonce"))throw console.error("missing required fields in response"),new Error("missing required fields in response");let r=K(n.get("data"),n.get("nonce"),f.current);e.current.resolve(r),e.current=null}catch(r){console.error("Failed to process transaction response:",r),e.current&&(e.current.reject(r),e.current=null)}break;case"onSignAndSendTransaction":try{if(!e.current||e.current.type!=="signAndSendTransaction"){console.warn("Received signature response but no pending signature request");return}if(!n.get("data")||!n.get("nonce"))throw console.error("missing required fields in response"),new Error("missing required fields in response");let r=K(n.get("data"),n.get("nonce"),f.current);e.current.resolve(r),e.current=null}catch(r){console.error("Failed to process transaction response:",r),e.current&&(e.current.reject(r),e.current=null)}break;case"onSignAllTransactions":try{if(!e.current||e.current.type!=="signAllTransactions"){console.warn("Received signature response but no pending signature request");return}if(!n.get("data")||!n.get("nonce"))throw console.error("missing required fields in response"),new Error("missing required fields in response");let r=K(n.get("data"),n.get("nonce"),f.current);e.current.resolve(r),e.current=null}catch(r){console.error("Failed to process transaction response:",r),e.current&&(e.current.reject(r),e.current=null)}break;case"onDisconnect":b(null);break}}),[t,l,b,f]);J(()=>{(()=>m(void 0,null,function*(){let n=yield c.getInitialURL();n&&$(n)}))();let o=c.addEventListener("url",({url:n})=>$(n).catch(d=>{e.current&&(e.current.reject(d),e.current=null)}));return()=>{o.remove()}},[l,$]);let Y=()=>m(void 0,null,function*(){try{let a=yield L();if(!a)throw new Error("No dapp key pair found");let o={session:p==null?void 0:p.session},{nonce:n,data:d}=U(o,f.current),S=new URLSearchParams({nonce:n,dapp_encryption_public_key:u.encode(a.publicKey),redirect_link:`${c.createURL(s)}?wallet_action=onDisconnect&wallet_id=${l}`,payload:d}),w=v(t,"disconnect",S);yield c.openURL(w)}catch(a){throw console.error("Failed to disconnect:",a),a}}),G=a=>m(void 0,null,function*(){if(!P||!p)throw new Error("Wallet not connected");try{let o=yield L();if(!o)throw new Error("No dapp key pair found");let n={session:p.session,message:u.encode(F.utf8.toBytes(a)),display:"utf8"},{nonce:d,data:S}=U(n,f.current),w=new URLSearchParams({dapp_encryption_public_key:u.encode(o.publicKey),nonce:d,payload:S,redirect_link:`${c.createURL(s)}?wallet_action=onSignMessage&wallet_id=${l}`}),r=v(t,"signMessage",w);return new Promise((g,y)=>{c.openURL(r);let T=setTimeout(()=>{e.current&&(y(new Error("Signature request timed out")),e.current=null)},x),k=R=>{clearTimeout(T),g(R)},A=R=>{clearTimeout(T),y(R)};e.current={type:"signMessage",payload:a,resolve:k,reject:A}})}catch(o){throw e.current=null,console.error("Failed to sign message:",o),o}}),H=(a,o)=>m(void 0,null,function*(){if(!P||!p)throw new Error("Wallet not connected");try{let n=yield L();if(!n)throw new Error("No dapp key pair found");let d=a.serialize({requireAllSignatures:!1}),S={session:p.session,transaction:u.encode(d),sendOptions:o},{nonce:w,data:r}=U(S,f.current),g=new URLSearchParams({nonce:w,dapp_encryption_public_key:u.encode(n.publicKey),redirect_link:`${c.createURL(s)}?wallet_action=onSignAndSendTransaction&wallet_id=${l}`,payload:r}),y=v(t,"signAndSendTransaction",g);return new Promise((T,k)=>{c.openURL(y);let A=setTimeout(()=>{e.current&&(k(new Error("Signature request timed out")),e.current=null)},x),R=O=>{clearTimeout(A),T(O)},_=O=>{clearTimeout(A),k(O)};e.current={type:"signAndSendTransaction",payload:a,resolve:R,reject:_}})}catch(n){throw e.current=null,console.error("Failed to sign and send transaction:",n),n}}),Q=a=>m(void 0,null,function*(){if(!P||!p)throw new Error("Wallet not connected");try{let o=yield L();if(!o)throw new Error("No dapp key pair found");let d={transactions:a.map(y=>u.encode(y.serialize({requireAllSignatures:!1}))),session:p.session},{nonce:S,data:w}=U(d,f.current),r=new URLSearchParams({nonce:S,dapp_encryption_public_key:u.encode(o.publicKey),redirect_link:`${c.createURL(s)}?wallet_action=onSignAllTransactions&wallet_id=${l}`,payload:w}),g=v(t,"signAllTransactions",r);return new Promise((y,T)=>{c.openURL(g);let k=setTimeout(()=>{e.current&&(T(new Error("Signature request timed out")),e.current=null)},x),A=_=>{clearTimeout(k),y(_)},R=_=>{clearTimeout(k),T(_)};e.current={type:"signAllTransactions",payload:a,resolve:A,reject:R}})}catch(o){throw e.current=null,console.error("Failed to sign all transactions:",o),o}}),V=a=>m(void 0,null,function*(){if(!P||!p)throw new Error("Wallet not connected");try{let o=yield L();if(!o)throw new Error("No dapp key pair found");let n=a.serialize({requireAllSignatures:!1}),d={session:p.session,transaction:u.encode(n)},{nonce:S,data:w}=U(d,f.current),r=new URLSearchParams({nonce:S,dapp_encryption_public_key:u.encode(o.publicKey),redirect_link:`${c.createURL(s)}?wallet_action=onSignTransaction&wallet_id=${l}`,payload:w}),g=v(t,"signTransaction",r);return new Promise((y,T)=>{c.openURL(g);let k=setTimeout(()=>{e.current&&(T(new Error("Signature request timed out")),e.current=null)},x),A=_=>{clearTimeout(k),y(_)},R=_=>{clearTimeout(k),T(_)};e.current={type:"signTransaction",payload:a,resolve:A,reject:R}})}catch(o){throw e.current=null,console.error("Failed to sign transaction:",o),o}}),X=()=>m(void 0,null,function*(){let a=yield L();if(!a)throw new Error("No dapp key pair found");try{let o=new URLSearchParams({dapp_encryption_public_key:u.encode(a.publicKey),app_url:i,redirect_link:`${c.createURL(s)}?wallet_action=onConnect&wallet_id=${l}`}),n=v(t,"connect",o);yield c.openURL(n)}catch(o){console.error("Failed to open wallet connection:",o)}});return{address:p==null?void 0:p.public_key,connect:X,signMessage:G,signTransaction:V,signAndSendTransaction:H,signAllTransactions:Q,disconnect:Y,isConnected:P}},oe=({autoReconnect:t,baseUrl:i})=>{let[s,h]=Z(null),l=I(null);return J(()=>{let p=()=>m(void 0,null,function*(){let b=yield E.get(`${i}-key`),P=yield E.get(`${i}-data`);b&&P&&(l.current=N.decode(b),h(JSON.parse(P)))});t&&!l.current&&p().catch(console.warn)},[t,i]),{connection:s,setConnection:h,isConnected:!!s,sharedSecretRef:l}},j=ne(()=>({dappKeyPair:null})),L=()=>m(void 0,null,function*(){let t=j.getState().dappKeyPair;if(t)return t;try{let i=yield E.get(B);if(i&&typeof i=="string"){let s=te(i);return j.setState({dappKeyPair:s}),s}else{let s=C.box.keyPair();return j.setState({dappKeyPair:s}),yield E.put(B,re(s)),s}}catch(i){throw console.error("Failed to initialize key pair:",i),i}});var ye=t=>W(q(D({},t),{baseUrl:"https://phantom.app",encryptionPublicKeyName:"phantom_encryption_public_key"}));var Se=t=>W(q(D({},t),{baseUrl:"https://backpack.app",encryptionPublicKeyName:"wallet_encryption_public_key"}));export{Se as useBackpackDeeplinkWalletConnector,W as useDeeplinkWalletConnector,ye as usePhantomDeeplinkWalletConnector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,m as i}from"./chunk-
|
|
1
|
+
import{b as u,m as i}from"./chunk-6LJTXHKE.js";import"./chunk-F7DR7TVR.js";import"./chunk-3HF374LL.js";import{e as a}from"./chunk-C5WYSLQF.js";import{useMemo as d}from"react";import{create as g}from"@privy-io/js-sdk-core";var f=()=>{let e=i();return d(()=>({createWallet(n){return a(this,null,function*(){let s=yield g(e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};import{useMemo as h}from"react";import{isEmbeddedWalletAccount as m,isUnifiedWallet as w,PrivyClientError as c,rawSign as y}from"@privy-io/js-sdk-core";var C=()=>{let e=i();return h(()=>({signRawHash(k){return a(this,arguments,function*({address:n,chainType:s,hash:o}){let l=u();if(!l)throw new c({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(m).filter(w).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new c({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield y(e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};export{f as useCreateWallet,C as useSignRawHash};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as Dt,b as Gt,c as jt,d as Et,e as _t,f as Bt,g as Mt,h as qt}from"./chunk-QSWCX5XI.js";import{a as f,b as I}from"./chunk-B42N35ZL.js";import{$ as It,A as et,B as ot,C as rt,D as nt,E as ut,F as it,G as pt,H as st,I as ht,J as at,K as ft,L as At,M as Ot,N as ct,O as mt,P as kt,Q as lt,R as yt,V as xt,W as dt,X as Ut,Y as Pt,Z as vt,_ as wt,aa as d,ba as Tt,ca as gt,da as Ft,e as y,ea as St,f as G,fa as Lt,ga as Wt,h as x,ha as Rt,ia as Ht,j as v,ja as Ct,k as j,ka as w,l as E,la as a,m as _,ma as Nt,n as B,na as bt,o as M,p as q,q as z,r as J,s as K,t as Q,u as V,v as X,w as Y,x as Z,y as $,z as tt}from"./chunk-6LJTXHKE.js";import{c as P}from"./chunk-F7DR7TVR.js";import"./chunk-3HF374LL.js";import{b as m,c as k,e as l}from"./chunk-C5WYSLQF.js";export*from"@privy-io/js-sdk-core";import r from"react";var Qt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=d(),U=y();if(!u)return r.createElement(r.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return r.createElement(r.Fragment,null,n)}return U?r.createElement(r.Fragment,null,i):r.createElement(r.Fragment,null,o)};import{createDataSuffixPlugin as T}from"@privy-io/js-sdk-core";function g(t){return f(t)}function F(t){let{state:e,start:o}=f(k(m({},t),{action:"link"}));return{state:e,link:o}}import{useCallback as S,useContext as L,useEffect as W,useRef as R}from"react";var H=t=>{let{client:e}=L(a),o=R(t);return W(()=>{o.current=t},[t]),{unlinkOAuth:S(U=>l(void 0,[U],function*({provider:u,subject:p}){var n,A,s,O;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(A=(n=o.current)==null?void 0:n.onSuccess)==null||A.call(n,h),h}catch(h){let c=x(h);throw(O=(s=o.current)==null?void 0:s.onError)==null||O.call(s,c),c}}),[e.auth.oauth])}};import{useContext as C,useEffect as N,useRef as b}from"react";var D=t=>{let{client:e}=C(a),o=b(t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,N(()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};export{Qt as AuthBoundary,a as PrivyContext,bt as PrivyProvider,P as SecureStorageAdapter,v as createPrivyClient,T as dataSuffix,Nt as getAccessToken,Mt as hasError,Dt as isConnected,jt as isConnecting,Bt as isCreating,Et as isDisconnected,_t as isNotCreated,Gt as isReconnecting,qt as needsRecovery,Tt as useAcceptTerms,gt as useAuthorizationSignature,lt as useCreateGuestAccount,et as useDepositAddress,It as useEmbeddedBitcoinWallet,vt as useEmbeddedEthereumWallet,wt as useEmbeddedSolanaWallet,ct as useEmbeddedWallet,mt as useEmbeddedWalletStateChange,Ft as useGetEncryptedAuthorizationKey,ot as useHeadlessCryptoDeposit,tt as useHeadlessDelegatedActions,kt as useIdentityToken,Pt as useImportWallet,z as useLinkEmail,Q as useLinkSMS,st as useLinkWithCrossApp,X as useLinkWithFarcaster,F as useLinkWithOAuth,j as useLinkWithSiwe,B as useLinkWithSiws,pt as useLoginWithCrossApp,K as useLoginWithEmail,Z as useLoginWithFarcaster,$ as useLoginWithFarcasterV2,I as useLoginWithOAuth,V as useLoginWithSMS,E as useLoginWithSiwe,M as useLoginWithSiws,xt as useMfa,dt as useMfaEnrollment,w as useMigrateWallets,g as useOAuthFlow,D as useOAuthTokens,G as useOnNeedsRecovery,d as usePrivy,_ as usePrivyClient,Ot as useRecoverEmbeddedWallet,yt as useRegisterMfaListener,ft as useSendTransactionWithCrossApp,rt as useSessionSigners,At as useSetEmbeddedWalletRecovery,St as useSign7702Authorization,ht as useSignMessageWithCrossApp,at as useSignTypedDataWithCrossApp,nt as useSigners,Ht as useStoredUsers,Ct as useSwitchUser,Lt as useTransfer,J as useUnlinkEmail,Y as useUnlinkFarcaster,H as useUnlinkOAuth,Ut as useUnlinkPasskey,q as useUnlinkWallet,ut as useUpdateEmail,it as useUpdatePhone,Wt as useUpdateWallet,Rt as useWalletActions};
|
package/dist/esm/passkey.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as K,b as N,c as V,d as D,e as F,f as T,g as M,h as j}from"./chunk-QSWCX5XI.js";import{S as _,T as x,U as b,a as w,b as g,h,
|
|
1
|
+
import{a as K,b as N,c as V,d as D,e as F,f as T,g as M,h as j}from"./chunk-QSWCX5XI.js";import{S as _,T as x,U as b,a as w,b as g,h,la as P}from"./chunk-6LJTXHKE.js";import"./chunk-F7DR7TVR.js";import"./chunk-3HF374LL.js";import{e as p}from"./chunk-C5WYSLQF.js";import{useCallback as W,useContext as R}from"react";import{PrivyClientError as v}from"@privy-io/js-sdk-core";var Y=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=R(P),c=W(o=>{var n;let t=h(o);return s({status:"error",error:t}),(n=e==null?void 0:e.onError)==null||n.call(e,t),t},[e==null?void 0:e.onError]);return{linkWithPasskey:W(n=>p(void 0,[n],function*({relyingParty:o,extra_options:t}){var u;try{if(!g())throw new v({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:k}=yield a.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let y=yield _(b(k),t);s({status:"submitting-response"});let{user:m}=yield a.auth.passkey.linkWithPasskey(y,o);return s({status:"done"}),(u=e==null?void 0:e.onSuccess)==null||u.call(e,m),m}catch(r){throw c(r)}}),[a,c,e==null?void 0:e.onSuccess]),state:d}};import{useCallback as O,useContext as H}from"react";import{PrivyClientError as I}from"@privy-io/js-sdk-core";var ie=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=H(P),c=O(o=>{var n;let t=h(o);return s({status:"error",error:t}),(n=e==null?void 0:e.onError)==null||n.call(e,t),t},[e==null?void 0:e.onError]);return{loginWithPasskey:O(n=>p(void 0,[n],function*({relyingParty:o,extra_options:t}){var u,r,k,y;try{if(g())throw new I({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield a.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let f=yield x({challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(u=i.extensions)==null?void 0:u.app_id,credProps:(r=i.extensions)==null?void 0:r.cred_props,hmacCreateSecret:(k=i.extensions)==null?void 0:k.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification},t);s({status:"submitting-response"});let l=w(),C=yield a.auth.passkey.loginWithPasskey(f,i.challenge,o,{embedded:l==null?void 0:l.embedded});return s({status:"done"}),(y=e==null?void 0:e.onSuccess)==null||y.call(e,C.user,C.is_new_user),C.user}catch(m){throw c(m)}}),[a,c,e==null?void 0:e.onSuccess]),state:d}};import{useCallback as U,useContext as L,useEffect as A,useRef as q}from"react";import{PrivyClientError as J}from"@privy-io/js-sdk-core";var ge=e=>{let{client:a,passkeyState:d,setPasskeyState:s}=L(P),c=q(e);A(()=>{c.current=e},[e]);let S=U(t=>{var u,r;let n=h(t);return s({status:"error",error:n}),(r=(u=c.current)==null?void 0:u.onError)==null||r.call(u,n),n},[s]);return{signupWithPasskey:U(u=>p(void 0,[u],function*({relyingParty:t,extra_options:n}){var r,k;try{if(g())throw new J({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:m}=yield a.auth.passkey.generateSignupOptions(t);s({status:"awaiting-passkey"});let i=yield _(b(m),n);s({status:"submitting-response"});let f=w(),l=yield a.auth.passkey.signupWithPasskey(i,t,{embedded:f==null?void 0:f.embedded});return s({status:"done"}),(k=(r=c.current)==null?void 0:r.onSuccess)==null||k.call(r,l.user,l.is_new_user),{user:l.user}}catch(y){throw S(y)}}),[a.auth.passkey,S,s]),state:d}};export{M as hasError,K as isConnected,V as isConnecting,T as isCreating,D as isDisconnected,F as isNotCreated,N as isReconnecting,j as needsRecovery,Y as useLinkWithPasskey,ie as useLoginWithPasskey,ge as useSignupWithPasskey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-3HF374LL.js";import"./chunk-C5WYSLQF.js";o();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as M}from"./chunk-QSWCX5XI.js";import{b as _,d as g,i as v,
|
|
1
|
+
import{a as M}from"./chunk-QSWCX5XI.js";import{b as _,d as g,i as v,la as w,m as k}from"./chunk-6LJTXHKE.js";import"./chunk-F7DR7TVR.js";import"./chunk-3HF374LL.js";import{a as h,b as A,c as I,e as m}from"./chunk-C5WYSLQF.js";import p,{createContext as x,useCallback as Z,useContext as f,useEffect as T,useState as L}from"react";import{getDataSuffixPlugin as O,getUserSmartWallet as S,PrivyClientError as u}from"@privy-io/js-sdk-core";import{createPublicClient as Y,http as H}from"viem";import{getJsonRpcEndpointFromChain as X,getUserSmartWallet as j,PrivyClientError as N}from"@privy-io/js-sdk-core";import{signerToSmartAccountClient as J}from"@privy-io/js-sdk-core/smart-wallets";var P=y=>m(void 0,[y],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:i,dataSuffix:c}){if(!(n!=null&&n.enabled)||!r||!M(r))return;let s=yield i.embeddedWallet.getProvider(r.account),o=n==null?void 0:n.configured_networks.find(B=>B.chain_id===`eip155:${t.id}`);if(!o)throw new N({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let l=j(a),C=l?l.smart_wallet_type:n.smart_wallet_type,W=l?l.smart_wallet_version:n.smart_wallet_version,F=X(t,{rpcUrls:[]},e),G=Y({chain:t,transport:H(F)}),E=yield J({owner:s,smartWalletType:C,smartWalletVersion:W,chain:t,publicClient:G,paymasterContext:Q(o.paymaster_url,o.paymaster_context),bundlerUrl:o.bundler_url,paymasterUrl:o.paymaster_url});if(!E)throw new N({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return K(E,c)});function K(t,e){return e?t.extend(a=>({sendTransaction:r=>a.sendTransaction(I(A({},r),{dataSuffix:e}))})):t}var V=/paymaster\.biconomy\.io\/api/i;function q(t){return V.test(t)}var z={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},Q=(t,e)=>{if(t&&q(t))return z;if(e&&e.policy_id)return{policyId:e.policy_id}};var U=3,tt=500,et=({children:t})=>p.createElement(at,null,p.createElement(it,null,p.createElement(lt,null,t))),D=x({config:void 0}),b=()=>{let{config:t}=f(D);return{config:t}},R=x({smartWalletClient:void 0}),rt=()=>{let{smartWalletClient:t}=f(R);return{smartWalletClient:t}},$=x({client:void 0}),nt=()=>{let{client:t}=f($),e=ot();return{client:t,getClientForChain:e}},at=({children:t})=>{let[e,a]=L(void 0),r=k();return T(()=>{!e&&r&&(()=>m(void 0,null,function*(){try{if(!r){console.warn("No client found");return}let i=yield r.app.getSmartWalletConfig();a(i)}catch(i){console.warn("Error generating smart wallet config: ",i)}}))()},[r,e]),p.createElement(D.Provider,{value:{config:e}},t)},it=({children:t})=>{let{config:e}=b(),{client:a,wallet:r}=f(w),n=g(),[i,c]=L();return T(()=>{(()=>m(void 0,null,function*(){var l;if(!n&&i&&c(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&i&&r.status==="connected")return;let s=a.embeddedWallet.chains.find(C=>e.configured_networks.map(W=>W.chain_id).includes(`eip155:${C.id}`));if(!s)throw new u({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let o=yield P({chain:s,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a,dataSuffix:(l=O(a.plugins))==null?void 0:l.suffix});if(!o)throw new u({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});c(o)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),p.createElement(R.Provider,{value:{smartWalletClient:i}},t)},lt=({children:t})=>{let{client:e,wallet:a}=f(w),r=g(),{smartWalletClient:n}=rt(),{config:i}=b();return T(()=>{let c=!1;return(()=>m(void 0,null,function*(){var d;if(!(!n||!r||S(r)||!(i!=null&&i.enabled)||a.status!=="connected"))for(let s=0;s<U;s++){if(c||S((d=_())!=null?d:r))return;let o=!1;for(let l=0;l<5;l++){if(c)return;if(yield e.embeddedWallet.ping(tt)){o=!0;break}yield v(200*h(2,l))}if(o)try{let{message:l}=yield e.auth.smartWallet.init({address:n.account.address,chainId:`eip155:${n.chain.id}`}),C=yield n.signMessage({message:l});yield e.auth.smartWallet.link(l,C,i.smart_wallet_type,i.smart_wallet_version);return}catch(l){s===U-1?console.error("Error creating smart wallet:",l):yield v(500*h(2,s))}}}))(),()=>{c=!0}},[!!n,!!r,!!S(r),i,a.status]),p.createElement($.Provider,{value:{client:S(r)?n:void 0}},t)},ot=()=>{let{client:t,wallet:e}=f(w),{config:a}=b();return Z(n=>m(void 0,[n],function*({chainId:r}){var s;let i=_();if(!i)throw new u({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!a||!a.enabled)throw new u({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let y=t.embeddedWallet.chains.find(o=>o.id===r);if(!y)throw new u({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let d=yield P({chain:y,privyAppId:t.app.appId,user:i,embeddedWallet:e,smartWalletsConfig:a,client:t,dataSuffix:(s=O(t.plugins))==null?void 0:s.suffix});if(!d)throw new u({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return d}),[a,e,t])};export{et as SmartWalletsProvider,nt as useSmartWallets};
|