@privy-io/react-auth 1.88.4-beta-20241004182123 → 1.88.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.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/ui.js +3 -4
- package/dist/cjs/useWallets.js +1 -1
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/esm/index.mjs +38 -38
- package/dist/esm/ui.mjs +13 -14
- package/dist/esm/useWallets.mjs +1 -1
- package/package.json +3 -3
package/dist/cjs/ui.js
CHANGED
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
gap: 0.5rem;
|
|
11
11
|
justify-content: center;
|
|
12
12
|
|
|
13
|
+
font-size: 0.875rem;
|
|
13
14
|
background: var(--privy-color-accent);
|
|
14
15
|
color: var(--privy-color-background);
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
${({$variant:e})=>"rounded"===e?"\n border: 1px solid var(--privy-color-foreground-4);\n border-radius: var(--privy-border-radius-full);\n padding: 0.375rem;\n width: var(--size);\n height: var(--size);\n ":"\n border-radius: var(--privy-border-radius-md);\n padding: 0 1rem;\n height: 44px;\n "}
|
|
17
|
+
${({$variant:e})=>"rounded"===e?"\n border: 1px solid var(--privy-color-foreground-4);\n border-radius: var(--privy-border-radius-full);\n width: var(--size);\n height: var(--size);\n ":"default"===e?"\n border-radius: var(--privy-border-radius-md);\n padding: 0 1rem;\n height: 44px;\n ":void 0}
|
|
19
18
|
`;let C=i.styled.button`
|
|
20
19
|
display: flex;
|
|
21
20
|
align-items: center;
|
|
@@ -129,4 +128,4 @@
|
|
|
129
128
|
border-top: 1px solid var(--privy-color-foreground-4);
|
|
130
129
|
`;function be(){let{user:s,exportWallet:r}=t.usePrivy(),i=d.getPrivyEthereumWallet(s);return e.jsxs(de,{children:[e.jsx(ke,{children:"Linked accounts"}),s?.linkedAccounts.map(((t,s)=>e.jsx(pe,{children:e.jsx(I,{account:t,isCopyable:!0})},s))),e.jsx(_e,{}),e.jsx(ke,{children:"Wallet settings"}),e.jsxs(he,{disabled:!i,onClick:()=>r({address:i?.address??""}),children:[e.jsx(w,{}),"Export private key"]})]})}let Me=i.styled.div`
|
|
131
130
|
transition: height 0.2s ease;
|
|
132
|
-
`;function Le({minimal:t}){let{screen:r}=Y(),i=l.useRef(null),n=s.useElementHeight(i),o=null;switch(r){case"Account":o=e.jsx(ye,{minimal:t});break;case"Settings":o=e.jsx(be,{})}return e.jsx(Me,{style:{height:n},children:e.jsx("div",{ref:i,children:o})})}function ze(t){return e.jsx(J,{children:e.jsx(He,{...t})})}function He({children:t,minimal:r}){let{screen:i,reset:n}=Y();return e.jsxs(te,{placement:"bottom-end",onOpenChange:e=>{e&&n()},children:[e.jsx(se,{asChild:!0,children:t}),e.jsx(re,{children:e.jsxs(le,{children:[e.jsxs(oe,{children:[e.jsx(Ce,{}),r||e.jsxs(ae,{children:[e.jsx(Q,{}),i]})]}),e.jsx(Le,{minimal:r}),r?e.jsx("div",{}):e.jsx(s.BlobbyFooter,{})]})})]})}exports.UserPill=({expanded:i=!
|
|
131
|
+
`;function Le({minimal:t}){let{screen:r}=Y(),i=l.useRef(null),n=s.useElementHeight(i),o=null;switch(r){case"Account":o=e.jsx(ye,{minimal:t});break;case"Settings":o=e.jsx(be,{})}return e.jsx(Me,{style:{height:n},children:e.jsx("div",{ref:i,children:o})})}function ze(t){return e.jsx(J,{children:e.jsx(He,{...t})})}function He({children:t,minimal:r}){let{screen:i,reset:n}=Y();return e.jsxs(te,{placement:"bottom-end",onOpenChange:e=>{e&&n()},children:[e.jsx(se,{asChild:!0,children:t}),e.jsx(re,{children:e.jsxs(le,{children:[e.jsxs(oe,{children:[e.jsx(Ce,{}),r||e.jsxs(ae,{children:[e.jsx(Q,{}),i]})]}),e.jsx(Le,{minimal:r}),r?e.jsx("div",{}):e.jsx(s.BlobbyFooter,{})]})})]})}exports.UserPill=({expanded:i=!0,action:n={type:"login"},label:l,size:o=44,ui:{minimal:a}={minimal:!1}})=>{let{user:d,ready:c,authenticated:h}=t.usePrivy(),{wallets:C}=r.useWallets(),{login:u}=s.useLogin(),{connectWallet:g}=s.useConnectWallet(),f=i?"default":"rounded",j=e.jsx(p,{width:"100%",height:"100%",style:{margin:"6px"}});return c&&h&&(d&&!d.isGuest||C[0]&&"connectWallet"===n.type)?e.jsx(ze,{minimal:a,children:e.jsx(x,{$variant:f,$size:o,children:l||(i?e.jsx(E,{isCopyable:!1}):j)})}):e.jsx(x,{$size:o,$variant:f,onClick:"login"===n.type?()=>u(n.options):()=>g(n.options),disabled:!c,children:l||(i?"login"===n.type?"Log in":"Connect wallet":j)})};
|
package/dist/cjs/useWallets.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(require("tinycolor2"));const a={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let n=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),l=e=>n.has(e),i=(e,t,r)=>r.indexOf(e)===t;const s=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(l).filter(i):e?e.filter(l).filter(i):a.appearance.walletList,p={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},c={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},h={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}},u={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0},d={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},m={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},g={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1},f={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},y={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},b={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},C={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},w={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},E={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},v={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},k={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},x=[p,c,v,y,b,C,w,E,g,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},d,m,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},f,{id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0},h,u,k,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],S=new Set(x.map((e=>e.id)));function O(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let A="#FFFFFF";function _(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return o.default({...e.toHsl(),l:r})}function T({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=A;break;case"dark":r="#1E1E1D";break;default:r=e}let a=o.default(r),n=o.default(t),l=o.default("#51BA81"),i=o.default("#FFB74D"),s=o.default("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=_(a,"light"===p?-.04:.11),h=_(a,"light"===p?-.88:.87),u=_(a,"light"===p?-.7:.75),d=_(a,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=_(a,"light"===p?-.08:.25).desaturate("light"===p?60:20),g=_(n,.15),f=_(n,-.06),y=_(s,.3),b=_(i,.3),C=o.default(n.getLuminance()>.5?"#040217":A),w=_(l,-.16),E=_(l,.4);return{colorScheme:p,background:a.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:u.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:n.toHslString(),accentLight:g.toHslString(),accentDark:f.toHslString(),foregroundAccent:C.toHslString(),success:l.toHslString(),successDark:w.toHslString(),successLight:E.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function U(e,t,r){let o,n,l,i,p,c,h,u,d,m,g,f,b,C,w,E,v=r?console.warn:()=>{};t?.loginMethods?(o=t.loginMethods.includes("email"),n=t.loginMethods.includes("sms"),i=t.loginMethods.includes("wallet"),p=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),h=t.loginMethods.includes("discord"),d=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),u=t.loginMethods.includes("tiktok"),f=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),C=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram")):(o=e.emailAuth,n=e.smsAuth,i=e.walletAuth,p=e.googleOAuth,c=e.twitterOAuth,h=e.discordOAuth,f=e.githubOAuth,d=e.spotifyOAuth,m=e.instagramOAuth,u=e.tiktokOAuth,g=e.linkedinOAuth,b=e.appleOAuth,C=e.farcasterAuth,w=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?l=!1:e.passkeyAuth&&(l=!0);let k=[o,n].filter(Boolean),S=[p,c,h,f,d,m,u,g,b,C,w].filter(Boolean),A=[i].filter(Boolean);if(k.length+S.length+A.length===0)throw Error("You must enable at least one login method");let _=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;_&&0===A.length?(v("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),_=!1):_||S.length+k.length!==0||(v("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),_=!0);let U=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&v("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let L=s({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),M=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let o of e.overflow??[])t.includes(o)||r.includes(o)?console.warn(`Duplicated login method: ${o}`):r.push(o);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:P}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let a;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),a=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=x.find((t=>t.id===e.id)),r=t?.rpcUrls.privy?.http[0];return r?O(e,r):e}))}else a=x.concat(e??[]);let n=t?a[0]:y,l=r??n;if(!a.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:a,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),I=!!t?.defaultChain,W=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=!(e.enforceWalletUis??1);if(E=e.legacyWalletUiConfig??1?W?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??R:R,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==E)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:K,...N}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??a.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:T({backgroundTheme:t?.appearance?.theme??a.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??a.appearance.accentColor}),loginGroupPriority:_?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:L,walletChainType:t?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:i,email:o,sms:n,passkey:l,google:p,twitter:c,discord:h,github:f,spotify:d,instagram:m,tiktok:u,linkedin:g,apple:b,farcaster:C,telegram:w},loginMethodsAndOrder:M,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??a.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??a.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??a.rpcConfig.rpcTimeouts},chains:F,defaultChain:P,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:I,captchaEnabled:e.captchaEnabled??a.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??a.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:U},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof K?{requireUserOwnedRecoveryOnCreate:K}:{},...W?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...N,noPromptOnSignature:E},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:W?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??a._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??a.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??a.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??a.fundingMethodConfig.moonpay.useSandbox}}}}let L={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const M=U(L,void 0,!1);let H=t.createContext({appConfig:M,isServerConfigLoaded:!1});const F=t.createContext(null);exports.CHAIN_ID_MAINNET=1,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.CONNECTIONS_HISTORY_KEY="privy:connections",exports.CONNECTORS_STATE_KEY="privy:connectors",exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_APP_CONFIG=M,exports.DEFAULT_NETWORK="0x1",exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_RPC_TIMEOUT=12e4,exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=1400,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=4e3,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_SUPPORTED_CHAINS=x,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.FORKED_TOKEN_STORAGE_KEY="privy:session_transfer_token",exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.MOONPAY_API_URL="https://api.moonpay.com/v1",exports.MOONPAY_API_URL_SANDBOX="https://api.moonpay.com/v1",exports.MOONPAY_PUBLIC_KEY="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",exports.MOONPAY_PUBLIC_KEY_SANDBOX="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.PrivyAppConfigProvider=({children:r,legacyCreateEmbeddedWalletFlag:o,client:a,clientConfig:n})=>{let[l,i]=t.useState(null),s=t.useMemo((()=>U(l??L,n,!!l)),[l,n]);return t.useEffect((()=>{if(!l)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:a,defaultChain:n,externalWallets:l,...i}=e;return{...i,...o?{additionalChains:o.map((e=>e.id))}:void 0,...a?{supportedChains:a.map((e=>e.id))}:void 0,...n?{defaultChain:n.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(n,o),t=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let t,a=0;a<e.length;a++)r=Math.imul(r^(t=e.charCodeAt(a)),2654435761),o=Math.imul(o^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),4294967296*(2097151&(o=Math.imul(o^o>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)}(JSON.stringify(e)).toString(),r=`privy:sent:${l.id}:${t}`;localStorage.getItem(r)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(r,"t"))}),[n,o,l]),t.useEffect((()=>{l||(async()=>{try{let e=await a.getServerConfig();e.customApiUrl&&a.updateApiUrl(e.customApiUrl),i(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),e.jsx(H.Provider,{value:{appConfig:s,isServerConfigLoaded:!!l},children:r})},exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.SESSION_COOKIE_KEY="privy-session",exports.STATE_CODE_KEY="privy:state_code",exports.TOKEN_COOKIE_KEY="privy-token",exports.TOKEN_STORAGE_KEY="privy:token",exports.UseWalletsContext=F,exports.VERSION="1.88.4-beta-20241004182123",exports.WALLET_PROXY_TIMEOUT=3e4,exports.addPrivyRpcToChain=O,exports.addRpcUrlOverrideToChain=function(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}},exports.addToDefaultChains=function(e){let t=e.filter((e=>!S.has(e.id)));return x.concat(t)},exports.arbitrum=p,exports.arbitrumSepolia=c,exports.avalanche=h,exports.avalancheFuji=u,exports.base=d,exports.baseSepolia=m,exports.celo=g,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getPrivyWalletKey=e=>`privy:wallet:${e}`,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.linea=f,exports.mainnet=y,exports.optimism=b,exports.optimismSepolia=C,exports.polygon=w,exports.polygonAmoy=E,exports.sepolia=v,exports.useAppConfig=()=>{let{appConfig:e}=t.useContext(H);return e},exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=t.useContext(H);return e},exports.useWallets=function(){let e=t.useContext(F);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e},exports.zora=k;
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(require("tinycolor2"));const a={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let n=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),l=e=>n.has(e),i=(e,t,r)=>r.indexOf(e)===t;const s=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(l).filter(i):e?e.filter(l).filter(i):a.appearance.walletList,p={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},c={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},h={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}},u={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0},d={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},m={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},g={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1},f={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},y={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},b={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},C={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},w={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},E={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},v={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},k={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},x=[p,c,v,y,b,C,w,E,g,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},d,m,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},f,{id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0},h,u,k,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],S=new Set(x.map((e=>e.id)));function O(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let A="#FFFFFF";function _(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return o.default({...e.toHsl(),l:r})}function T({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=A;break;case"dark":r="#1E1E1D";break;default:r=e}let a=o.default(r),n=o.default(t),l=o.default("#51BA81"),i=o.default("#FFB74D"),s=o.default("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=_(a,"light"===p?-.04:.11),h=_(a,"light"===p?-.88:.87),u=_(a,"light"===p?-.7:.75),d=_(a,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=_(a,"light"===p?-.08:.25).desaturate("light"===p?60:20),g=_(n,.15),f=_(n,-.06),y=_(s,.3),b=_(i,.3),C=o.default(n.getLuminance()>.5?"#040217":A),w=_(l,-.16),E=_(l,.4);return{colorScheme:p,background:a.toHslString(),background2:c.toHslString(),foreground:h.toHslString(),foreground2:u.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:n.toHslString(),accentLight:g.toHslString(),accentDark:f.toHslString(),foregroundAccent:C.toHslString(),success:l.toHslString(),successDark:w.toHslString(),successLight:E.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function U(e,t,r){let o,n,l,i,p,c,h,u,d,m,g,f,b,C,w,E,v=r?console.warn:()=>{};t?.loginMethods?(o=t.loginMethods.includes("email"),n=t.loginMethods.includes("sms"),i=t.loginMethods.includes("wallet"),p=t.loginMethods.includes("google"),c=t.loginMethods.includes("twitter"),h=t.loginMethods.includes("discord"),d=t.loginMethods.includes("spotify"),m=t.loginMethods.includes("instagram"),u=t.loginMethods.includes("tiktok"),f=t.loginMethods.includes("github"),g=t.loginMethods.includes("linkedin"),b=t.loginMethods.includes("apple"),C=t.loginMethods.includes("farcaster"),w=t.loginMethods.includes("telegram")):(o=e.emailAuth,n=e.smsAuth,i=e.walletAuth,p=e.googleOAuth,c=e.twitterOAuth,h=e.discordOAuth,f=e.githubOAuth,d=e.spotifyOAuth,m=e.instagramOAuth,u=e.tiktokOAuth,g=e.linkedinOAuth,b=e.appleOAuth,C=e.farcasterAuth,w=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?l=!1:e.passkeyAuth&&(l=!0);let k=[o,n].filter(Boolean),S=[p,c,h,f,d,m,u,g,b,C,w].filter(Boolean),A=[i].filter(Boolean);if(k.length+S.length+A.length===0)throw Error("You must enable at least one login method");let _=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;_&&0===A.length?(v("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),_=!1):_||S.length+k.length!==0||(v("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),_=!0);let U=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&v("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let L=s({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),M=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let o of e.overflow??[])t.includes(o)||r.includes(o)?console.warn(`Duplicated login method: ${o}`):r.push(o);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),H=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:P}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let a;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),a=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=x.find((t=>t.id===e.id)),r=t?.rpcUrls.privy?.http[0];return r?O(e,r):e}))}else a=x.concat(e??[]);let n=t?a[0]:y,l=r??n;if(!a.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:a,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),I=!!t?.defaultChain,W=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=!(e.enforceWalletUis??1);if(E=e.legacyWalletUiConfig??1?W?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??R:R,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==E)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:K,...N}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??a.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:T({backgroundTheme:t?.appearance?.theme??a.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??a.appearance.accentColor}),loginGroupPriority:_?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:L,walletChainType:t?.appearance?.walletChainType??"ethereum-only"},loginMethods:{wallet:i,email:o,sms:n,passkey:l,google:p,twitter:c,discord:h,github:f,spotify:d,instagram:m,tiktok:u,linkedin:g,apple:b,farcaster:C,telegram:w},loginMethodsAndOrder:M,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??a.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??a.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??a.rpcConfig.rpcTimeouts},chains:F,defaultChain:P,intl:{defaultCountry:H},shouldEnforceDefaultChainOnConnect:I,captchaEnabled:e.captchaEnabled??a.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??a.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:U},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof K?{requireUserOwnedRecoveryOnCreate:K}:{},...W?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...N,noPromptOnSignature:E},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:W?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??a._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??a.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??a.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??a.fundingMethodConfig.moonpay.useSandbox}}}}let L={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const M=U(L,void 0,!1);let H=t.createContext({appConfig:M,isServerConfigLoaded:!1});const F=t.createContext(null);exports.CHAIN_ID_MAINNET=1,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.CONNECTIONS_HISTORY_KEY="privy:connections",exports.CONNECTORS_STATE_KEY="privy:connectors",exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_APP_CONFIG=M,exports.DEFAULT_NETWORK="0x1",exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_RPC_TIMEOUT=12e4,exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=1400,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=4e3,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_SUPPORTED_CHAINS=x,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.FORKED_TOKEN_STORAGE_KEY="privy:session_transfer_token",exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.MOONPAY_API_URL="https://api.moonpay.com/v1",exports.MOONPAY_API_URL_SANDBOX="https://api.moonpay.com/v1",exports.MOONPAY_PUBLIC_KEY="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",exports.MOONPAY_PUBLIC_KEY_SANDBOX="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.PrivyAppConfigProvider=({children:r,legacyCreateEmbeddedWalletFlag:o,client:a,clientConfig:n})=>{let[l,i]=t.useState(null),s=t.useMemo((()=>U(l??L,n,!!l)),[l,n]);return t.useEffect((()=>{if(!l)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:a,defaultChain:n,externalWallets:l,...i}=e;return{...i,...o?{additionalChains:o.map((e=>e.id))}:void 0,...a?{supportedChains:a.map((e=>e.id))}:void 0,...n?{defaultChain:n.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(n,o),t=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let t,a=0;a<e.length;a++)r=Math.imul(r^(t=e.charCodeAt(a)),2654435761),o=Math.imul(o^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(o^o>>>13,3266489909),4294967296*(2097151&(o=Math.imul(o^o>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)}(JSON.stringify(e)).toString(),r=`privy:sent:${l.id}:${t}`;localStorage.getItem(r)||(a.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(r,"t"))}),[n,o,l]),t.useEffect((()=>{l||(async()=>{try{let e=await a.getServerConfig();e.customApiUrl&&a.updateApiUrl(e.customApiUrl),i(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),e.jsx(H.Provider,{value:{appConfig:s,isServerConfigLoaded:!!l},children:r})},exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.SESSION_COOKIE_KEY="privy-session",exports.STATE_CODE_KEY="privy:state_code",exports.TOKEN_COOKIE_KEY="privy-token",exports.TOKEN_STORAGE_KEY="privy:token",exports.UseWalletsContext=F,exports.VERSION="1.88.4",exports.WALLET_PROXY_TIMEOUT=3e4,exports.addPrivyRpcToChain=O,exports.addRpcUrlOverrideToChain=function(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}},exports.addToDefaultChains=function(e){let t=e.filter((e=>!S.has(e.id)));return x.concat(t)},exports.arbitrum=p,exports.arbitrumSepolia=c,exports.avalanche=h,exports.avalancheFuji=u,exports.base=d,exports.baseSepolia=m,exports.celo=g,exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getPrivyWalletKey=e=>`privy:wallet:${e}`,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.linea=f,exports.mainnet=y,exports.optimism=b,exports.optimismSepolia=C,exports.polygon=w,exports.polygonAmoy=E,exports.sepolia=v,exports.useAppConfig=()=>{let{appConfig:e}=t.useContext(H);return e},exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=t.useContext(H);return e},exports.useWallets=function(){let e=t.useContext(F);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e},exports.zora=k;
|
package/dist/dts/ui.d.mts
CHANGED