@privy-io/react-auth 1.92.3 → 1.92.4

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.
Files changed (35) hide show
  1. package/dist/cjs/events-context-BjjOPVXa.js +1 -0
  2. package/dist/cjs/getEmbeddedConnectedWallet-DKydzAQG.js +1 -0
  3. package/dist/cjs/index.js +22 -22
  4. package/dist/cjs/smart-wallets.js +1 -1
  5. package/dist/cjs/solana.js +1 -1
  6. package/dist/cjs/ui.js +1 -1
  7. package/dist/cjs/{useFundWallet-CdeNBtt7.js → useFundWallet-C0W3IOJ9.js} +2 -2
  8. package/dist/cjs/{useSolanaWallets-9YEhqb4o.js → useSolanaWallets-DDxTypQs.js} +1 -1
  9. package/dist/cjs/{useWallets-DOBd5kcT.js → useWallets-DaKIdLuq.js} +1 -1
  10. package/dist/dts/index.d.mts +12 -25
  11. package/dist/dts/index.d.ts +12 -25
  12. package/dist/dts/smart-wallets.d.mts +1 -1
  13. package/dist/dts/smart-wallets.d.ts +1 -1
  14. package/dist/dts/{solana-57Jxp-1t.d.mts → solana-MHNU24e3.d.mts} +1 -1
  15. package/dist/dts/{solana-57Jxp-1t.d.ts → solana-MHNU24e3.d.ts} +1 -1
  16. package/dist/dts/solana.d.mts +2 -2
  17. package/dist/dts/solana.d.ts +2 -2
  18. package/dist/dts/{types-kQycDPwW.d.mts → types-CHvDgSZo.d.mts} +13 -2
  19. package/dist/dts/{types-kQycDPwW.d.ts → types-CHvDgSZo.d.ts} +13 -2
  20. package/dist/dts/ui.d.mts +1 -1
  21. package/dist/dts/ui.d.ts +1 -1
  22. package/dist/esm/events-context-C3fU8cCf.mjs +1 -0
  23. package/dist/esm/getEmbeddedConnectedWallet-DKiY8uny.mjs +1 -0
  24. package/dist/esm/index.mjs +328 -328
  25. package/dist/esm/smart-wallets.mjs +1 -1
  26. package/dist/esm/solana.mjs +1 -1
  27. package/dist/esm/ui.mjs +1 -1
  28. package/dist/esm/{useFundWallet-CyfvL1bd.mjs → useFundWallet-gMiOtXSS.mjs} +1 -1
  29. package/dist/esm/{useSolanaWallets-BK1ZsW9P.mjs → useSolanaWallets-B_4UBHGn.mjs} +1 -1
  30. package/dist/esm/{useWallets-VaMYksLb.mjs → useWallets-BEQCDiwm.mjs} +1 -1
  31. package/package.json +5 -5
  32. package/dist/cjs/events-context-DoOSxXpH.js +0 -1
  33. package/dist/cjs/getEmbeddedConnectedWallet-DgbdyqLu.js +0 -1
  34. package/dist/esm/events-context-BcbWmpUg.mjs +0 -1
  35. package/dist/esm/getEmbeddedConnectedWallet-CpgKFaVs.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { aG as PrivyErrorCode, U as User, L as LoginMethod, aH as LinkedAccountWithMetadata, O as OAuthTokens, B as BaseConnectedEthereumWallet, aI as BaseConnectedSolanaWallet, t as Wallet, x as MfaMethod, aJ as UserRecoveryMethod, G as SolanaTransactionReceipt, C as Chain, aK as FundingMethod, a6 as SolanaCluster, aF as ConnectedSolanaWallet, a0 as SolanaFundingConfig } from './types-kQycDPwW.js';
1
+ import { aG as PrivyErrorCode, U as User, L as LoginMethod, aH as LinkedAccountWithMetadata, O as OAuthTokens, B as BaseConnectedEthereumWallet, aI as BaseConnectedSolanaWallet, t as Wallet, x as MfaMethod, aJ as UserRecoveryMethod, G as SolanaTransactionReceipt, C as Chain, aK as FundingMethod, a6 as SolanaCluster, aF as ConnectedSolanaWallet, a0 as SolanaFundingConfig } from './types-CHvDgSZo.js';
2
2
  import { TransactionResponse } from '@ethersproject/providers';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
- export { aF as ConnectedSolanaWallet, S as SolanaAdapterConnector, G as SolanaTransactionReceipt, D as SupportedSolanaTransaction, aL as toSolanaWalletConnectors } from './types-kQycDPwW.js';
2
- export { a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, b as useFundWallet, u as useSolanaWallets } from './solana-57Jxp-1t.js';
1
+ export { aF as ConnectedSolanaWallet, S as SolanaAdapterConnector, G as SolanaTransactionReceipt, D as SupportedSolanaTransaction, aL as toSolanaWalletConnectors } from './types-CHvDgSZo.js';
2
+ export { a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, b as useFundWallet, u as useSolanaWallets } from './solana-MHNU24e3.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
@@ -1,5 +1,5 @@
1
- export { aF as ConnectedSolanaWallet, S as SolanaAdapterConnector, G as SolanaTransactionReceipt, D as SupportedSolanaTransaction, aL as toSolanaWalletConnectors } from './types-kQycDPwW.js';
2
- export { a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, b as useFundWallet, u as useSolanaWallets } from './solana-57Jxp-1t.js';
1
+ export { aF as ConnectedSolanaWallet, S as SolanaAdapterConnector, G as SolanaTransactionReceipt, D as SupportedSolanaTransaction, aL as toSolanaWalletConnectors } from './types-CHvDgSZo.js';
2
+ export { a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, b as useFundWallet, u as useSolanaWallets } from './solana-MHNU24e3.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
@@ -351,7 +351,7 @@ type RootWalletForDelegation = {
351
351
  /** Whether or not the root wallet for the entropy being delegated is imported. */
352
352
  imported: boolean;
353
353
  };
354
- type DelegatedWallet = {
354
+ type DelegatedWallet$1 = {
355
355
  /** Address for a wallet to delegate. */
356
356
  address: string;
357
357
  /** Chain type for a wallet to delegate. */
@@ -365,7 +365,7 @@ type DelegatedActionsConsentRequestDataType = {
365
365
  /** Root wallet to delegate, which is the wallet at HD index 0 for the entropy. */
366
366
  rootWallet: RootWalletForDelegation;
367
367
  /** Wallets to delegate, whose entropy is the same as `rootWallet`'s. */
368
- delegatedWallets: DelegatedWallet[];
368
+ delegatedWallets: DelegatedWallet$1[];
369
369
  };
370
370
  type MfaVerifyRequestDataType = {
371
371
  accessToken: string;
@@ -1333,6 +1333,13 @@ interface CrossAppAccountWithMetadata extends LinkMetadata, CrossAppAccount {
1333
1333
  * Object representation of a user's linked accounts
1334
1334
  */
1335
1335
  type LinkedAccountWithMetadata = WalletWithMetadata | SmartWalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | SpotifyOAuthWithMetadata | InstagramOAuthWithMetadata | TiktokOAuthWithMetadata | LinkedInOAuthWithMetadata | AppleOAuthWithMetadata | CustomJwtAccountWithMetadata | FarcasterWithMetadata | PasskeyWithMetadata | TelegramWithMetadata | CrossAppAccountWithMetadata;
1336
+ /** Object representing an embedded wallet that the user has delegated to the Wallet API. */
1337
+ type DelegatedWallet = {
1338
+ /** Chain type of the delegated wallet. Currently, only Solana is supported. */
1339
+ chainType: 'solana';
1340
+ /** Address of the delegated wallet. */
1341
+ address: string;
1342
+ };
1336
1343
  interface User {
1337
1344
  /** The Privy-issued DID for the user. If you need to store additional information
1338
1345
  * about a user, you can use this DID to reference them. */
@@ -1377,6 +1384,10 @@ interface User {
1377
1384
  /** The list of accounts associated with this user. Each account contains additional metadata
1378
1385
  * that may be helpful for advanced use cases. */
1379
1386
  linkedAccounts: Array<LinkedAccountWithMetadata>;
1387
+ /**
1388
+ * The list of embedded wallets that the user has delegated to the Wallet API.
1389
+ **/
1390
+ delegatedWallets: Array<DelegatedWallet>;
1380
1391
  /** The list of MFA Methods associated with this user. */
1381
1392
  mfaMethods: Array<MfaMethod>;
1382
1393
  /**
@@ -351,7 +351,7 @@ type RootWalletForDelegation = {
351
351
  /** Whether or not the root wallet for the entropy being delegated is imported. */
352
352
  imported: boolean;
353
353
  };
354
- type DelegatedWallet = {
354
+ type DelegatedWallet$1 = {
355
355
  /** Address for a wallet to delegate. */
356
356
  address: string;
357
357
  /** Chain type for a wallet to delegate. */
@@ -365,7 +365,7 @@ type DelegatedActionsConsentRequestDataType = {
365
365
  /** Root wallet to delegate, which is the wallet at HD index 0 for the entropy. */
366
366
  rootWallet: RootWalletForDelegation;
367
367
  /** Wallets to delegate, whose entropy is the same as `rootWallet`'s. */
368
- delegatedWallets: DelegatedWallet[];
368
+ delegatedWallets: DelegatedWallet$1[];
369
369
  };
370
370
  type MfaVerifyRequestDataType = {
371
371
  accessToken: string;
@@ -1333,6 +1333,13 @@ interface CrossAppAccountWithMetadata extends LinkMetadata, CrossAppAccount {
1333
1333
  * Object representation of a user's linked accounts
1334
1334
  */
1335
1335
  type LinkedAccountWithMetadata = WalletWithMetadata | SmartWalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | SpotifyOAuthWithMetadata | InstagramOAuthWithMetadata | TiktokOAuthWithMetadata | LinkedInOAuthWithMetadata | AppleOAuthWithMetadata | CustomJwtAccountWithMetadata | FarcasterWithMetadata | PasskeyWithMetadata | TelegramWithMetadata | CrossAppAccountWithMetadata;
1336
+ /** Object representing an embedded wallet that the user has delegated to the Wallet API. */
1337
+ type DelegatedWallet = {
1338
+ /** Chain type of the delegated wallet. Currently, only Solana is supported. */
1339
+ chainType: 'solana';
1340
+ /** Address of the delegated wallet. */
1341
+ address: string;
1342
+ };
1336
1343
  interface User {
1337
1344
  /** The Privy-issued DID for the user. If you need to store additional information
1338
1345
  * about a user, you can use this DID to reference them. */
@@ -1377,6 +1384,10 @@ interface User {
1377
1384
  /** The list of accounts associated with this user. Each account contains additional metadata
1378
1385
  * that may be helpful for advanced use cases. */
1379
1386
  linkedAccounts: Array<LinkedAccountWithMetadata>;
1387
+ /**
1388
+ * The list of embedded wallets that the user has delegated to the Wallet API.
1389
+ **/
1390
+ delegatedWallets: Array<DelegatedWallet>;
1380
1391
  /** The list of MFA Methods associated with this user. */
1381
1392
  mfaMethods: Array<MfaMethod>;
1382
1393
  /**
package/dist/dts/ui.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-kQycDPwW.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CHvDgSZo.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
package/dist/dts/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-kQycDPwW.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CHvDgSZo.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
@@ -0,0 +1 @@
1
+ import{getAddress as e}from"@ethersproject/address";import{createContext as t,useEffect as i,useContext as a}from"react";function r(e){return e?new Date(1e3*e):null}function s(e,t){return e.slice().sort(((e,t)=>(t.firstVerifiedAt??t.verifiedAt).getTime()-(e.firstVerifiedAt??e.verifiedAt).getTime())).find((e=>e.type===t))}const l=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType&&0===e.walletIndex))||null,n=e=>e?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"ethereum"===e.chainType)),d=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType&&0===e.walletIndex))||null,o=e=>e?.linkedAccounts.find((e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType))||null,f=(t,i)=>{let a=(r=t,r?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&"ethereum"===e.chainType))).find((t=>e(t.address)===e(i)));var r;return{signingWallet:a,rootWallet:a?a.imported?a:l(t):void 0}},c=(e,t)=>{let i=(e=>e?.linkedAccounts.filter((e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&"solana"===e.chainType)))(e).find((e=>e.address.toLowerCase()===t.toLowerCase()));return{signingWallet:i,rootWallet:0===i?.walletIndex?i:d(e)}};const u=(e,t)=>!(l(e)||d(e)||"all-users"!==t&&("users-without-wallets"!==t||(e=>e.linkedAccounts.filter((e=>"wallet"===e.type)))(e)?.length));function p(e){if(!e)return null;let t=function(e){let t=[];for(let i of e){let e=i.type;switch(i.type){case"wallet":let a={address:i.address,type:i.type,imported:i.imported,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at),chainType:i.chain_type,chainId:i.chain_id,walletClient:"privy"===i.wallet_client_type?"privy":"unknown",walletClientType:i.wallet_client_type,connectorType:i.connector_type,recoveryMethod:i.recovery_method,walletIndex:i.wallet_index};t.push(a);break;case"smart_wallet":let s={address:i.address,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at),smartWalletType:i.smart_wallet_type};t.push(s);break;case"cross_app":let l={type:i.type,subject:i.subject,embeddedWallets:i.embedded_wallets,smartWallets:i.smart_wallets,providerApp:{id:i.provider_app_id},verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(l);break;case"email":let n={address:i.address,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(n);break;case"phone":let d={number:i.phoneNumber,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(d);break;case"google_oauth":let o={subject:i.subject,email:i.email,name:i.name,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(o);break;case"spotify_oauth":let f={subject:i.subject,email:i.email,name:i.name,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(f);break;case"instagram_oauth":let c={subject:i.subject,username:i.username,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:i.subject,username:i.username,name:i.name,type:i.type,profilePictureUrl:i.profile_picture_url,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(u);break;case"discord_oauth":let p={subject:i.subject,username:i.username,email:i.email,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(p);break;case"github_oauth":let _={subject:i.subject,username:i.username,name:i.name,email:i.email,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(_);break;case"tiktok_oauth":let m={subject:i.subject,username:i.username,name:i.name,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(m);break;case"linkedin_oauth":let y={subject:i.subject,name:i.name,email:i.email,vanityName:i.vanity_name,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(y);break;case"apple_oauth":let v={subject:i.subject,email:i.email,type:i.type,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:i.type,customUserId:i.custom_user_id,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)});break;case"farcaster":let h={type:i.type,fid:i.fid,ownerAddress:i.owner_address,displayName:i.display_name,username:i.username,bio:i.bio,pfp:i.profile_picture_url,url:i.homepage_url,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at),signerPublicKey:i.signer_public_key};t.push(h);break;case"passkey":let A={type:i.type,enrolledInMfa:i.enrolled_in_mfa,credentialId:i.credential_id,authenticatorName:i.authenticator_name,createdWithDevice:i.created_with_device,createdWithOs:i.created_with_os,createdWithBrowser:i.created_with_browser,verifiedAt:r(i.verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(A);break;case"telegram":let b={type:i.type,telegramUserId:i.telegram_user_id,firstName:i.first_name,lastName:i.last_name,username:i.username,photoUrl:i.photo_url,verifiedAt:r(i.first_verified_at),firstVerifiedAt:r(i.first_verified_at),latestVerifiedAt:r(i.latest_verified_at)};t.push(b);break;default:console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return t}(e.linked_accounts),i=s(t,"wallet"),a=s(t,"smart_wallet"),l=s(t,"email"),n=s(t,"phone"),d=s(t,"google_oauth"),o=s(t,"twitter_oauth"),f=s(t,"discord_oauth"),c=s(t,"github_oauth"),u=s(t,"spotify_oauth"),p=s(t,"instagram_oauth"),_=s(t,"tiktok_oauth"),m=s(t,"linkedin_oauth"),y=s(t,"apple_oauth"),v=s(t,"farcaster"),h=s(t,"telegram"),A=e.mfa_methods.map((({type:e,verified_at:t})=>({type:e,verifiedAt:r(t)}))),b=e.delegated_wallets.map((({chain_type:e,address:t})=>({chainType:e,address:t})));return{id:e.id,createdAt:r(e.created_at),linkedAccounts:t,email:l&&{address:l?.address},phone:n&&{number:n?.number},wallet:i&&{address:i.address,chainType:i.chainType,chainId:i.chainId,walletClient:i.walletClient,walletClientType:i.walletClientType,connectorType:i.connectorType,recoveryMethod:i.recoveryMethod,imported:i.imported,walletIndex:i.walletIndex},smartWallet:a&&{address:a.address,smartWalletType:a.smartWalletType},google:d&&{subject:d.subject,email:d.email,name:d.name},twitter:o&&{subject:o.subject,username:o.username,name:o.name,profilePictureUrl:o.profilePictureUrl},discord:f&&{subject:f.subject,username:f.username,email:f.email},github:c&&{subject:c.subject,username:c.username,name:c.name,email:c.email},spotify:u&&{subject:u.subject,email:u.email,name:u.name},instagram:p&&{subject:p.subject,username:p.username},tiktok:_&&{subject:_.subject,username:_.username,name:_.name},linkedin:m&&{subject:m.subject,name:m.name,email:m.email,vanityName:m.vanityName},apple:y&&{subject:y.subject,email:y.email},farcaster:v&&{fid:v.fid,ownerAddress:v.ownerAddress,displayName:v.displayName,username:v.username,bio:v.bio,pfp:v.pfp,url:v.url,signerPublicKey:v.signerPublicKey},telegram:h&&{telegramUserId:h.telegramUserId,firstName:h.firstName,lastName:h.lastName,username:h.username,photoUrl:h.photoUrl},delegatedWallets:b,mfaMethods:A.map((e=>e.type)),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}const _={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},sendSolanaTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},m=t(void 0);let y=()=>a(m);function v(e,t){if(!t)return;let a=y().current[e];return i((()=>{for(let[i,r]of Object.entries(t))a.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${e}"`),a[i]?.push(r);return()=>{for(let[i,r]of Object.entries(t))a.hasOwnProperty(i)||console.warn(`Invalid event type "${i}" for action "${e}"`),a[i]=a[i]?.filter((e=>e!==r))}}),[t])}function h(e,t,i,...a){for(let r of e.current[t][i])r(...a)}function A(){let e=y();return(t,i,...a)=>h(e,t,i,...a)}export{m as P,d as a,A as b,p as c,o as d,h as e,n as f,l as g,f as h,c as i,_ as p,u as s,v as u};
@@ -0,0 +1 @@
1
+ import{jsx as E,jsxs as _}from"react/jsx-runtime";import{useState as N,useEffect as A,useRef as S,useContext as R,createContext as T}from"react";import{z as C,ap as D}from"./useWallets-BEQCDiwm.mjs";import{n as L}from"./privy-context--IShbIGm.mjs";function O({src:_,...N}){return E("img",{src:_,...N,style:{display:"none"}})}var I,e;(I=e||(e={})).LANDING="LANDING",I.CONNECT_OR_CREATE="CONNECT_OR_CREATE",I.AWAITING_CONNECTION="AWAITING_CONNECTION",I.AWAITING_FARCASTER_CONNECTION="AWAITING_FARCASTER_CONNECTION",I.AWAITING_FARCASTER_SIGNER="AWAITING_FARCASTER_SIGNER",I.AWAITING_OAUTH_SCREEN="AWAITING_OAUTH_SCREEN",I.CROSS_APP_AUTH_SCREEN="CROSS_APP_AUTH_SCREEN",I.AWAITING_PASSWORDLESS_CODE="AWAITING_PASSWORDLESS_CODE",I.AWAITING_PASSKEY_SYSTEM_DIALOGUE="AWAITING_PASSKEY_SYSTEM_DIALOGUE",I.LINK_EMAIL_SCREEN="LINK_EMAIL_SCREEN",I.LINK_PHONE_SCREEN="LINK_PHONE_SCREEN",I.LINK_WALLET_SCREEN="LINK_WALLET_SCREEN",I.LINK_PASSKEY_SCREEN="LINK_PASSKEY_SCREEN",I.UPDATE_EMAIL_SCREEN="UPDATE_EMAIL_SCREEN",I.UPDATE_PHONE_SCREEN="UPDATE_PHONE_SCREEN",I.AWAITING_CONNECT_ONLY_CONNECTION="AWAITING_CONNECT_ONLY_CONNECTION",I.CONNECT_ONLY_LANDING_SCREEN="CONNECT_ONLY_LANDING_SCREEN",I.CONNECT_ONLY_AUTHENTICATED_SCREEN="CONNECT_ONLY_AUTHENTICATED_SCREEN",I.LOGIN_FAILED_SCREEN="LOGIN_FAILED_SCREEN",I.ALLOWLIST_REJECTION_SCREEN="ALLOWLIST_REJECTION_SCREEN",I.ACCOUNT_NOT_FOUND_SCREEN="ACCOUNT_NOT_FOUND_SCREEN",I.USER_LIMIT_REACHED_SCREEN="USER_LIMIT_REACHED_SCREEN",I.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN="EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN",I.EMBEDDED_WALLET_CREATED_SCREEN="EMBEDDED_WALLET_CREATED_SCREEN",I.EMBEDDED_WALLET_CONNECTING_SCREEN="EMBEDDED_WALLET_CONNECTING_SCREEN",I.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN="EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN",I.EMBEDDED_WALLET_KEY_EXPORT_SCREEN="EMBEDDED_WALLET_KEY_EXPORT_SCREEN",I.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",I.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN",I.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",I.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",I.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN="EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN",I.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN",I.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN",I.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN="EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN",I.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN="EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN",I.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN="EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN",I.EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN="EMBEDDED_WALLET_DELEGATED_ACTIONS_REVOKE_SCREEN",I.INSTALL_PHANTOM_SCREEN="INSTALL_PHANTOM_SCREEN",I.PHANTOM_INTERSTITIAL_SCREEN="PHANTOM_INTERSTITIAL_SCREEN",I.AFFIRMATIVE_CONSENT_SCREEN="AFFIRMATIVE_CONSENT_SCREEN",I.FUNDING_METHOD_SELECTION_SCREEN="FUNDING_METHOD_SELECTION_SCREEN",I.FUNDING_TRANSFER_FROM_WALLET_SCREEN="FUNDING_TRANSFER_FROM_WALLET_SCREEN",I.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN",I.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN",I.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN="FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN",I.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN="FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN",I.FUNDING_MANUAL_TRANSFER_SCREEN="FUNDING_MANUAL_TRANSFER_SCREEN",I.MOONPAY_PROMPT_SCREEN="MOONPAY_PROMPT_SCREEN",I.MOONPAY_STATUS_SCREEN="MOONPAY_STATUS_SCREEN",I.COINBASE_ONRAMP_STATUS_SCREEN="COINBASE_ONRAMP_STATUS_SCREEN",I.MFA_ENROLLMENT_FLOW_SCREEN="MFA_ENROLLMENT_FLOW_SCREEN",I.CAPTCHA_SCREEN="CAPTCHA_SCREEN",I.ERROR_SCREEN="ERROR_SCREEN",I.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE="IN_APP_BROWSER_LOGIN_NOT_POSSIBLE",I.TELEGRAM_AUTH_SCREEN="TELEGRAM_AUTH_SCREEN",I.LINK_CONFLICT_SCREEN="LINK_CONFLICT_SCREEN";const M=T({ready:!1,app:D,currentScreen:null,lastScreen:null,navigate:L,navigateBack:L,resetNavigation:L,setModalData:L,onUserCloseViaDialogOrKeybindRef:void 0});let a=[e.LANDING,e.CONNECT_ONLY_LANDING_SCREEN,null];const W=R=>{let T=C(),D=R.authenticated,[L,I]=N(R.initialScreen);A((()=>{D||a.includes(R.initialScreen)||R.setInitialScreen(null)}),[D]);let e=S(null);A((()=>{R.open||(e.current=null)}),[R.open]),A((()=>{e.current=null}),[R.initialScreen]);let W={ready:!!T.id,app:T,data:R.data,setModalData:R.setModalData,currentScreen:R.initialScreen,lastScreen:L,navigate:(E,_=!0)=>{R.setInitialScreen(E),_&&I(R.initialScreen)},navigateBack:()=>{R.setInitialScreen(L)},resetNavigation:()=>{R.setInitialScreen(null),I(null)},onUserCloseViaDialogOrKeybindRef:e};return _(M.Provider,{value:W,children:[("string"==typeof T.appearance.logo||"img"===T.appearance.logo?.type)&&E(O,{src:"string"==typeof T.appearance.logo?T.appearance.logo:T.appearance.logo.props.src}),R.children]})},n=()=>R(M);function t(E){return E.find((E=>"privy"===E.walletClientType&&"embedded"===E.connectorType&&!E.imported))??null}export{e as M,W as a,t as g,n as u};