@crossmint/client-sdk-react-ui 1.19.19 → 1.19.21
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/{chunk-XK3LGIO6.js → chunk-2TOQXWMY.js} +1 -1
- package/dist/{chunk-EGQ4NTLW.cjs → chunk-3BZUKE42.cjs} +1 -1
- package/dist/{chunk-EQJWNYAG.js → chunk-5CO53PUQ.js} +1 -1
- package/dist/{chunk-CMBGS7PU.cjs → chunk-5UHGWNMC.cjs} +1 -1
- package/dist/{chunk-3NYCRXEY.js → chunk-A3QBMKZL.js} +1 -1
- package/dist/{chunk-I6KXO3XP.cjs → chunk-AXM7WDBC.cjs} +1 -1
- package/dist/{chunk-PW36V2VX.cjs → chunk-AZ3GDQQX.cjs} +1 -1
- package/dist/{chunk-YU7LONE5.js → chunk-BKHRHZ7Y.js} +1 -1
- package/dist/{chunk-ZRLBAPYU.js → chunk-D6OLUOZ5.js} +1 -1
- package/dist/{chunk-UJVV72XQ.cjs → chunk-DPQQD5UU.cjs} +1 -1
- package/dist/{chunk-243TGVXX.js → chunk-FZEHIEBJ.js} +1 -1
- package/dist/{chunk-JDV3G523.cjs → chunk-GA6TGNOT.cjs} +1 -1
- package/dist/{chunk-Z4ALU7OM.cjs → chunk-I3KH7QJM.cjs} +1 -1
- package/dist/chunk-P6CXZQZI.js +1 -0
- package/dist/{chunk-KMRGWM3C.cjs → chunk-PYLW5BP7.cjs} +1 -1
- package/dist/{chunk-VV4MSXHA.cjs → chunk-QHY5IGLT.cjs} +1 -1
- package/dist/{chunk-T3WAM7IH.js → chunk-TSQBTNUP.js} +1 -1
- package/dist/{chunk-2LRJQ3UP.cjs → chunk-TXF3GNS6.cjs} +1 -1
- package/dist/chunk-URI4SATB.js +6 -0
- package/dist/{chunk-HHAOAX32.js → chunk-VQ2SSUKU.js} +1 -1
- package/dist/{chunk-4WA2JPM2.cjs → chunk-WJQ4ZR5O.cjs} +3 -3
- package/dist/{chunk-OA7LJLKC.js → chunk-X2XVHJNY.js} +1 -1
- package/dist/components/CrossmintNFTCollectionView.cjs +1 -1
- package/dist/components/CrossmintNFTCollectionView.js +1 -1
- package/dist/components/CrossmintNFTDetail.cjs +1 -1
- package/dist/components/CrossmintNFTDetail.js +1 -1
- package/dist/components/auth/AuthForm.cjs +1 -1
- package/dist/components/auth/AuthForm.js +1 -1
- package/dist/components/auth/AuthFormBackButton.cjs +1 -1
- package/dist/components/auth/AuthFormBackButton.js +1 -1
- package/dist/components/auth/AuthFormDialog.cjs +1 -1
- package/dist/components/auth/AuthFormDialog.js +1 -1
- package/dist/components/auth/EmbeddedAuthForm.cjs +1 -1
- package/dist/components/auth/EmbeddedAuthForm.js +1 -1
- package/dist/components/auth/methods/email/EmailAuthFlow.cjs +1 -1
- package/dist/components/auth/methods/email/EmailAuthFlow.js +1 -1
- package/dist/components/auth/methods/email/EmailOTPInput.cjs +1 -1
- package/dist/components/auth/methods/email/EmailOTPInput.js +1 -1
- package/dist/components/auth/methods/email/EmailSignIn.cjs +1 -1
- package/dist/components/auth/methods/email/EmailSignIn.js +1 -1
- package/dist/components/auth/methods/farcaster/FarcasterSignIn.cjs +1 -1
- package/dist/components/auth/methods/farcaster/FarcasterSignIn.js +1 -1
- package/dist/components/auth/methods/google/ContinueWithGoogle.cjs +1 -1
- package/dist/components/auth/methods/google/ContinueWithGoogle.js +1 -1
- package/dist/components/auth/methods/google/GoogleSignIn.cjs +1 -1
- package/dist/components/auth/methods/google/GoogleSignIn.js +1 -1
- package/dist/components/auth/methods/twitter/TwitterSignIn.cjs +1 -1
- package/dist/components/auth/methods/twitter/TwitterSignIn.js +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlow.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlow.js +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlowButton.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3AuthFlowButton.js +1 -1
- package/dist/components/auth/methods/web3/Web3Connectors.cjs +1 -1
- package/dist/components/auth/methods/web3/Web3Connectors.js +1 -1
- package/dist/components/common/Divider.cjs +1 -1
- package/dist/components/common/Divider.js +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.cjs +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3IFrame.cjs +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3IFrame.js +1 -1
- package/dist/components/embed/v3/index.cjs +1 -1
- package/dist/components/embed/v3/index.js +1 -1
- package/dist/components/hosted/CrossmintPayButton_DEPRECATED.cjs +1 -1
- package/dist/components/hosted/CrossmintPayButton_DEPRECATED.js +1 -1
- package/dist/components/hosted/index.cjs +1 -1
- package/dist/components/hosted/index.js +1 -1
- package/dist/components/hosted/v3/CrossmintHostedCheckoutV3.cjs +1 -1
- package/dist/components/hosted/v3/CrossmintHostedCheckoutV3.js +1 -1
- package/dist/components/hosted/v3/index.cjs +1 -1
- package/dist/components/hosted/v3/index.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.js +1 -1
- package/dist/consts/version.cjs +1 -1
- package/dist/consts/version.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAuth.cjs +1 -1
- package/dist/hooks/useAuth.js +1 -1
- package/dist/hooks/useCrossmintAuth.cjs +1 -1
- package/dist/hooks/useCrossmintAuth.js +1 -1
- package/dist/hooks/useCrossmintCheckout.cjs +1 -1
- package/dist/hooks/useCrossmintCheckout.js +1 -1
- package/dist/hooks/useOAuthWindowListener.cjs +1 -1
- package/dist/hooks/useOAuthWindowListener.js +1 -1
- package/dist/hooks/useSignerInvisibleIFrame.d.cts +79 -0
- package/dist/hooks/useSignerInvisibleIFrame.d.ts +79 -0
- package/dist/hooks/useWallet.cjs +1 -1
- package/dist/hooks/useWallet.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/providers/CrossmintAuthProvider.cjs +1 -1
- package/dist/providers/CrossmintAuthProvider.js +1 -1
- package/dist/providers/CrossmintWalletProvider.cjs +1 -1
- package/dist/providers/CrossmintWalletProvider.js +1 -1
- package/dist/providers/auth/AuthFormProvider.cjs +1 -1
- package/dist/providers/auth/AuthFormProvider.js +1 -1
- package/dist/providers/auth/web3/DynamicWeb3WalletConnect.cjs +1 -1
- package/dist/providers/auth/web3/DynamicWeb3WalletConnect.js +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/providers/signers/CrossmintSignerProvider.cjs +1 -1
- package/dist/providers/signers/CrossmintSignerProvider.js +1 -1
- package/dist/utils/createCrossmintApiClient.cjs +1 -1
- package/dist/utils/createCrossmintApiClient.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-2LLUIVXR.js +0 -6
- package/dist/chunk-E55GKOB4.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossmint/client-sdk-react-ui",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.21",
|
|
4
4
|
"repository": "https://github.com/Crossmint/crossmint-sdk",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Paella Labs Inc",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"tailwindcss": "3.4.10",
|
|
42
42
|
"viem": "2.23.6",
|
|
43
43
|
"zod": "3.22.4",
|
|
44
|
-
"@crossmint/client-sdk-
|
|
44
|
+
"@crossmint/client-sdk-auth": "1.2.9",
|
|
45
45
|
"@crossmint/client-sdk-react-base": "0.2.16",
|
|
46
46
|
"@crossmint/client-sdk-window": "1.0.0",
|
|
47
|
-
"@crossmint/client-signers": "0.0.15",
|
|
48
47
|
"@crossmint/common-sdk-auth": "1.0.32",
|
|
49
48
|
"@crossmint/common-sdk-base": "0.5.1",
|
|
50
49
|
"@crossmint/wallets-sdk": "0.8.1",
|
|
51
|
-
"@crossmint/client-
|
|
50
|
+
"@crossmint/client-signers": "0.0.16",
|
|
51
|
+
"@crossmint/client-sdk-base": "1.5.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@testing-library/react": "^16.0.1",
|
package/dist/chunk-2LLUIVXR.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as jt}from"./chunk-P7UQAP6A.js";import{a as Jt}from"./chunk-JSNUJJQJ.js";import{b as te}from"./chunk-4KDASQO6.js";import{a as Zt}from"./chunk-LD3MRJ3F.js";import{a as Bt}from"./chunk-JOMJPVZA.js";import{a as Kt}from"./chunk-EMXNIC4M.js";import{a as Ut,e as Lt,h as Mt,i as Dt}from"./chunk-UDQUVZUQ.js";import{a as Vt,b as Ht,c as J}from"./chunk-VHNBXIOC.js";import{a as Rt}from"./chunk-2VBA64WU.js";import{a as G}from"./chunk-TNCETEEL.js";import{a as N}from"./chunk-NBJIJZGO.js";import{a as _t}from"./chunk-BFHQZOV3.js";import{a as it}from"./chunk-C22ZEFQD.js";import{a as ee}from"./chunk-ZZYJ6XM2.js";import{a as pt}from"./chunk-RZG2PAKA.js";import{a as ht}from"./chunk-WW6GUXHG.js";import{a as qt}from"./chunk-SFDQPSSP.js";import{a as Xt}from"./chunk-JPJKOERH.js";import{a as Yt}from"./chunk-VWL76U5G.js";import{a as zt}from"./chunk-FFTKGVUN.js";import{a as yt}from"./chunk-UAFW3OWA.js";import{a as Qt}from"./chunk-VLDE23JX.js";import{a as Gt}from"./chunk-C3JRTLQP.js";import{a as $t}from"./chunk-E4TBJMOO.js";import{b as tt}from"./chunk-ROJ6HFVK.js";import{a as oe}from"./chunk-WQVJJ44F.js";import{a as _,b as K,c as Z,d as b}from"./chunk-PXDN3KFO.js";import{createContext as Mo,useContext as Do,useRef as Ue,useState as Nt,useEffect as Bo,useMemo as _o}from"react";import{CrossmintWallets as Ko}from"@crossmint/wallets-sdk";import{PublicKey as Vo}from"@solana/web3.js";import gt from"bs58";import{environmentToCrossmintBaseURL as Ho,getEnvironmentForKey as Go}from"@crossmint/common-sdk-base";import{useContext as Ve}from"react";import{createContext as De,useMemo as re,useState as le}from"react";import{createPortal as Be}from"react-dom";import{CrossmintWallets as _e}from"@crossmint/wallets-sdk";import{jsx as lt,jsxs as Ke}from"react/jsx-runtime";var Pt=De({status:"not-loaded",getOrCreateWallet:()=>Promise.resolve({startedCreation:!1}),createPasskeySigner:()=>Promise.resolve(null),clearWallet:()=>{}});function ae({children:r,showPasskeyHelpers:e=!0,appearance:o,experimental_enableRecoveryKeys:t=!1,experimental_signersURL:s=void 0}){let[i,n]=le({status:"not-loaded"}),c={walletState:i,setWalletState:n,showPasskeyHelpers:e,appearance:o,experimental_enableRecoveryKeys:t};return t?lt(pt,{children:lt(se,{walletState:i,setWalletState:n,appearance:o,signersURL:s,children:lt(ne,K(_({},c),{children:r}))})}):lt(ne,K(_({},c),{children:r}))}function ne({children:r,showPasskeyHelpers:e=!0,appearance:o,walletState:t,setWalletState:s,experimental_enableRecoveryKeys:i}){let{crossmint:n}=tt("CrossmintWalletProvider must be used within CrossmintProvider"),{experimental_getOrCreateWalletWithRecoveryKey:c}=ie({enabled:i!=null?i:!1}),a=re(()=>_e.from({apiKey:n.apiKey,jwt:n==null?void 0:n.jwt}),[n.apiKey,n.jwt]),[d,u]=le({open:!1}),w=g=>b(this,null,function*(){var p,A;if(t.status=="in-progress")return{startedCreation:!1,reason:"Wallet is already loading."};if(n.jwt==null)return{startedCreation:!1,reason:'Jwt not set in "CrossmintProvider".'};try{s({status:"in-progress"});let P={onWalletCreationStart:m("create-wallet"),onWalletCreationFail:m("create-wallet-error"),onTransactionStart:m("transaction"),onTransactionFail:m("transaction-error")};switch(g.type){case"evm-smart-wallet":{let W={adminSigner:(p=g.args.adminSigner)!=null?p:{type:"evm-passkey"},linkedUser:g.args.linkedUser},T=yield a.getOrCreateWallet("evm-smart-wallet",W,{experimental_callbacks:((A=W.adminSigner)==null?void 0:A.type)==="evm-passkey"?P:void 0});s({status:"loaded",wallet:T,type:"evm-smart-wallet"});break}case"solana-smart-wallet":{let W=yield a.getOrCreateWallet("solana-smart-wallet",g.args);s({status:"loaded",wallet:W,type:"solana-smart-wallet"});break}}}catch(P){console.error("There was an error creating a wallet ",P),s(it(P))}return{startedCreation:!0}}),m=g=>()=>new Promise(p=>{if(!e){p();return}u({type:g,open:!0,primaryActionOnClick:()=>{u({open:!1}),p()},secondaryActionOnClick:()=>{u({open:!1}),p()}})}),C=()=>{s({status:"not-loaded"})},h=(g,p)=>b(this,null,function*(){return p!=null&&(yield m(p)()),yield _t(g)}),f=re(()=>K(_({},t),{getOrCreateWallet:w,createPasskeySigner:h,clearWallet:C,experimental_getOrCreateWalletWithRecoveryKey:c}),[t,c]);return Ke(Pt.Provider,{value:f,children:[r,d.open?Be(lt(Bt,{state:d,appearance:o}),document.body):null]})}function me(){let r=Ve(Pt);if(!r)throw new Error("useWallet must be used within CrossmintAuthProvider or CrossmintWalletProvider");return r}import{useContext as Lo}from"react";import{createContext as Wo,useEffect as It,useMemo as Re,useRef as Eo,useState as ft,useCallback as X}from"react";import{CrossmintAuth as ko,getCookie as Oo}from"@crossmint/client-sdk-auth";import{validateApiKeyAndGetCrossmintBaseUrl as Fo}from"@crossmint/common-sdk-base";import{SESSION_PREFIX as To}from"@crossmint/common-sdk-auth";import{VisuallyHidden as Fe}from"@radix-ui/react-visually-hidden";import{createContext as Ge,useCallback as je,useContext as ze,useEffect as qe,useState as wt}from"react";import{CrossmintAuthenticationError as $e}from"@crossmint/common-sdk-auth";import{useContext as He}from"react";function V(){let r=He(at);if(!r)throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");return r}import{jsx as Je}from"react/jsx-runtime";var ue={google:"",twitter:""},ce=Ge(void 0),S=()=>{let r=ze(ce);if(!r)throw new Error("useAuthForm must be used within an AuthFormProvider");return r},de=({setDialogOpen:r,preFetchOAuthUrls:e,initialState:o,children:t})=>{let{crossmintAuth:s}=V(),[i,n]=wt("initial"),[c,a]=wt(null),[d,u]=wt(ue),[w,m]=wt(!0),{loginMethods:C,baseUrl:h,appearance:f,termsOfServiceText:g,authModalTitle:p,defaultEmail:A}=o,P=je(()=>b(void 0,null,function*(){m(!0);try{let v=C.filter(x=>x in ue).map(x=>b(void 0,null,function*(){let l=yield s==null?void 0:s.getOAuthUrl(x);return{[x]:l}})),y=Object.assign({},...yield Promise.all(v));u(y)}catch(O){a(O instanceof $e?O.message:"Unable to load oauth providers. Please try again later.")}finally{m(!1)}}),[C,s]);qe(()=>{e&&P()},[P,e]);let T={step:i,error:c,baseUrl:h,appearance:f,termsOfServiceText:g,authModalTitle:p,loginMethods:C,defaultEmail:A,oauthUrlMap:d,isLoadingOauthUrlMap:w,setDialogOpen:(O,v)=>{r==null||r(O,v),O||setTimeout(()=>n("initial"),250)},setError:a,setStep:n};return Je(ce.Provider,{value:T,children:t})};import Co from"color";import{useState as io}from"react";import{useState as At}from"react";import{jsx as fe}from"react/jsx-runtime";var et=i=>{var n=i,{className:r,iconColor:e,ringColor:o,onClick:t}=n,s=Z(n,["className","iconColor","ringColor","onClick"]);let{setError:c}=S();return fe("button",K(_({className:N("absolute left-4 top-4 min-[480px]:!left-6 min-[480px]:!top-6 rounded-full opacity-70 ring-offset-background text-cm-text-primary transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-cm-accent focus:ring-offset-2 disabled:pointer-events-none",r),onClick:a=>{c(null),t==null||t(a)}},s),{children:fe(qt,{className:"w-6 h-6",style:{color:e}})}))};import{jsx as U,jsxs as mt}from"react/jsx-runtime";var Xe=6;function ge({otpEmailData:r,setOtpEmailData:e}){var g,p,A,P,W,T,O,v,y,x,l,R,I,D,H,Q,z,F,$,st;let{crossmintAuth:o}=V(),{appearance:t,setDialogOpen:s,setStep:i,setError:n}=S(),[c,a]=At(""),[d,u]=At(!1),[w,m]=At(!1),C=()=>b(this,null,function*(){var B,Y;m(!0);try{let q=yield o==null?void 0:o.confirmEmailOtp((B=r==null?void 0:r.email)!=null?B:"",(Y=r==null?void 0:r.emailId)!=null?Y:"",c);yield o==null?void 0:o.handleRefreshAuthMaterial(q),s(!1,!0),i("initial")}catch(q){console.error("Error confirming email OTP",q),n("Invalid code. Please try again."),u(!0)}finally{m(!1)}}),h=()=>b(this,null,function*(){var B;try{yield o==null?void 0:o.sendEmailOtp((B=r==null?void 0:r.email)!=null?B:"")}catch(Y){n("Failed to resend code. Please try again.")}});return mt("div",{children:[U(et,{onClick:()=>{i("initial"),e(null)},iconColor:(g=t==null?void 0:t.colors)==null?void 0:g.textPrimary,ringColor:(p=t==null?void 0:t.colors)==null?void 0:p.accent}),mt("div",{className:"flex flex-col items-center justify-start w-full",children:[U("div",{className:"relative left-3",children:U(Gt,{customAccentColor:(A=t==null?void 0:t.colors)==null?void 0:A.accent,customButtonBackgroundColor:(P=t==null?void 0:t.colors)==null?void 0:P.buttonBackground,customBackgroundColor:(W=t==null?void 0:t.colors)==null?void 0:W.background})}),U("p",{className:"text-base font-normal mt-4 mb-1 text-center text-cm-text-primary",style:{color:(T=t==null?void 0:t.colors)==null?void 0:T.textPrimary},children:"Check your email"}),mt("p",{className:"text-center text-cm-text-secondary px-4",style:{color:(O=t==null?void 0:t.colors)==null?void 0:O.textSecondary},children:["A temporary login code has been sent to"," ",r!=null&&r.email?r.email:"your email address"]}),U("div",{className:"py-8",children:U(Vt,{maxLength:Xe,value:c,onChange:B=>{a(B),u(!1),n(null)},onComplete:C,disabled:w,customStyles:{accent:(y=(v=t==null?void 0:t.colors)==null?void 0:v.accent)!=null?y:"#04AA6D",danger:(l=(x=t==null?void 0:t.colors)==null?void 0:x.danger)!=null?l:"#f44336",border:(I=(R=t==null?void 0:t.colors)==null?void 0:R.border)!=null?I:"#E5E7EB",textPrimary:(H=(D=t==null?void 0:t.colors)==null?void 0:D.textPrimary)!=null?H:"#909ca3",buttonBackground:(z=(Q=t==null?void 0:t.colors)==null?void 0:Q.buttonBackground)!=null?z:"#eff6ff",inputBackground:($=(F=t==null?void 0:t.colors)==null?void 0:F.inputBackground)!=null?$:"#FFFFFF",borderRadius:t==null?void 0:t.borderRadius},children:mt(Ht,{children:[U(J,{index:0,hasError:d}),U(J,{index:1,hasError:d}),U(J,{index:2,hasError:d}),U(J,{index:3,hasError:d}),U(J,{index:4,hasError:d}),U(J,{index:5,hasError:d})]})})}),U("div",{className:"text-xs leading-tight text-cm-text-secondary text-center",children:mt("span",{style:{color:(st=t==null?void 0:t.colors)==null?void 0:st.textSecondary},children:["Can't find the email? Check spam folder.",`
|
|
2
|
-
`,"Some emails may take several minutes to arrive."]})}),U(Kt,{initialSeconds:60,appearance:t,countdownText:B=>`Re-send code in ${B}s`,countdownCompleteText:"Re-send code",handleOnClick:h})]})]})}import{useState as Et}from"react";import no from"color";import{isEmailValid as bt}from"@crossmint/common-sdk-auth";import{ChildWindow as Qe,PopupWindow as Ye}from"@crossmint/client-sdk-window";import{useEffect as Ze,useRef as to,useState as eo}from"react";import{z as xt}from"zod";var ot=r=>{let{crossmintAuth:e}=V(),{oauthUrlMap:o,setError:t}=S(),[s,i]=eo(!1),n=to(null);return Ze(()=>(n.current==null&&(n.current=new Qe(window.opener||window.parent,"*",{incomingEvents:oo})),()=>{n.current!=null&&n.current.off("authMaterialFromPopupCallback")}),[]),{createPopupAndSetupListeners:a=>b(void 0,null,function*(){if(n.current==null)throw new Error("Child window not initialized");i(!0),t(null);let d=new URL(o[r]);if(a!=null){let h=Array.from(d.searchParams.entries());d.search="",a&&d.searchParams.append("provider_login_hint",a),h.forEach(([f,g])=>{d.searchParams.append(f,g)})}let u=yield Ye.init(d.toString(),{awaitToLoad:!1,crossOrigin:!0,width:400,height:700}),w=h=>b(void 0,null,function*(){var f;yield e==null?void 0:e.handleRefreshAuthMaterial(h.oneTimeSecret),(f=n.current)==null||f.off("authMaterialFromPopupCallback"),u.window.close(),i(!1)}),m=h=>{var f;t(h.error),(f=n.current)==null||f.off("errorFromPopupCallback"),u.window.close(),i(!1)};n.current.on("authMaterialFromPopupCallback",w),n.current.on("errorFromPopupCallback",m);let C=setInterval(()=>{var h;u.window.closed&&(clearInterval(C),i(!1),(h=n.current)==null||h.off("authMaterialFromPopupCallback"))},2500)}),isLoading:s}},oo={authMaterialFromPopupCallback:xt.object({oneTimeSecret:xt.string()}),errorFromPopupCallback:xt.object({error:xt.string()})};import{jsx as Wt,jsxs as ro}from"react/jsx-runtime";function pe({emailInput:r,appearance:e}){var s,i,n,c;let{createPopupAndSetupListeners:o,isLoading:t}=ot("google");return ro("button",{type:"button",className:N("flex items-center gap-2 justify-center h-[32px] px-2.5 border border-cm-border rounded-xl bg-cm-background-primary","hover:bg-cm-hover focus:bg-cm-hover outline-none",t?"cursor-not-allowed hover:bg-cm-muted-primary":""),onClick:t?void 0:()=>o(r.trim().toLowerCase()),style:{backgroundColor:(s=e==null?void 0:e.colors)==null?void 0:s.buttonBackground,borderRadius:e==null?void 0:e.borderRadius},children:[Wt(ht,{className:"max-h-[18px] max-w-[18px] h-[18px] w-[18px]"}),t?Wt(G,{style:{color:(i=e==null?void 0:e.colors)==null?void 0:i.textSecondary,fill:(n=e==null?void 0:e.colors)==null?void 0:n.textPrimary,width:"18px",height:"18px"}}):Wt("span",{className:"text-cm-accent",style:{color:(c=e==null?void 0:e.colors)==null?void 0:c.accent},children:"Continue"})]})}import{Fragment as so,jsx as j,jsxs as kt}from"react/jsx-runtime";function ye({setOtpEmailData:r}){var h,f,g,p,A,P,W,T,O,v,y,x,l,R;let{crossmintAuth:e}=V(),{appearance:o,defaultEmail:t,setStep:s,setError:i}=S(),[n,c]=Et(t!=null?t:""),[a,d]=Et(""),[u,w]=Et(!1),m=n.toLowerCase().includes("@gmail.com")&&!n.toLowerCase().includes("+")&&bt(n)&&!u;function C(I){return b(this,null,function*(){I.preventDefault(),w(!0);try{let D=n.trim().toLowerCase(),H=yield e==null?void 0:e.sendEmailOtp(D);r({email:D,emailId:H.emailId}),s("otp")}catch(D){w(!1),i("Failed to send email. Please try again or contact support.")}})}return j(so,{children:j("div",{className:"flex flex-col items-start justify-start w-full rounded-lg",children:kt("div",{className:"w-full",children:[j("label",{className:"text-cm-text-primary block mb-[5px]",style:{color:(h=o==null?void 0:o.colors)==null?void 0:h.textPrimary},children:"Email"}),kt("form",{role:"form",className:"relative",onSubmit:I=>{if(m){I.preventDefault();return}bt(n)?C(I):I.preventDefault()},noValidate:!0,children:[j("label",{htmlFor:"emailInput",className:"sr-only",children:"Email"}),j("input",{className:N("flex-grow text-cm-text-primary text-left pl-[16px] h-[58px] w-full border border-cm-border rounded-xl bg-cm-background-primary placeholder:text-md","transition-none duration-200 ease-in-out","focus:outline-none focus-ring-custom","placeholder:[color:var(--placeholder-color)]",a?"border-red-500":"",m?"pr-[132px]":"pr-[80px]"),style:{color:(f=o==null?void 0:o.colors)==null?void 0:f.textPrimary,borderRadius:o==null?void 0:o.borderRadius,borderColor:a?(g=o==null?void 0:o.colors)==null?void 0:g.danger:(p=o==null?void 0:o.colors)==null?void 0:p.border,backgroundColor:(A=o==null?void 0:o.colors)==null?void 0:A.inputBackground,"--placeholder-color":(W=(P=o==null?void 0:o.colors)==null?void 0:P.textSecondary)!=null?W:"#67797F","--focus-ring-color":new no((O=(T=o==null?void 0:o.colors)==null?void 0:T.accent)!=null?O:"#04AA6D").alpha(.18).toString()},type:"email",placeholder:"your@email.com",value:n,onChange:I=>{c(I.target.value),d(""),i(null)},readOnly:u,"aria-describedby":"emailError"}),kt("div",{className:"absolute inset-y-0 right-0 flex items-center pr-4",children:[a&&j(yt,{customColor:(v=o==null?void 0:o.colors)==null?void 0:v.danger}),u&&j(G,{style:{color:(y=o==null?void 0:o.colors)==null?void 0:y.textSecondary,fill:(x=o==null?void 0:o.colors)==null?void 0:x.textPrimary}}),m?j(pe,{emailInput:n,appearance:o}):!a&&!u?j("button",{type:"submit",className:N("font-medium text-cm-accent text-nowrap bg-cm-background-primary",bt(n)?"cursor-pointer":"!cursor-not-allowed opacity-60"),style:{color:(l=o==null?void 0:o.colors)==null?void 0:l.accent,backgroundColor:(R=o==null?void 0:o.colors)==null?void 0:R.inputBackground},disabled:!bt(n)||u,children:"Submit"}):null]})]}),a&&j("p",{className:"text-xs text-red-500 mb-2 pt-2",children:a})]})})})}import{jsx as he}from"react/jsx-runtime";function we(){let{step:r}=S(),[e,o]=io(null);return r==="otp"?he(ge,{otpEmailData:e,setOtpEmailData:o}):r==="initial"?he(ye,{setOtpEmailData:o}):null}import{jsx as Ot,jsxs as lo}from"react/jsx-runtime";function xe({appearance:r,text:e}){var t,s,i;let{step:o}=S();return o!=="initial"?null:lo("div",{className:"flex items-center justify-center w-full pt-2 pb-3",children:[Ot("span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(t=r==null?void 0:r.colors)==null?void 0:t.border}}),e!=null?Ot("p",{className:"flex-none px-2 text-sm text-cm-text-primary",style:{color:(s=r==null?void 0:r.colors)==null?void 0:s.textSecondary},children:e}):null,Ot("span",{className:"w-full h-[1px] bg-cm-border",style:{backgroundColor:(i=r==null?void 0:r.colors)==null?void 0:i.border}})]})}import{Fragment as ao,jsx as Ct,jsxs as be}from"react/jsx-runtime";function Ce(e){var r=Z(e,[]);var a,d,u,w;let{step:o,appearance:t,isLoadingOauthUrlMap:s}=S(),{createPopupAndSetupListeners:i,isLoading:n}=ot("google"),c=s||n;return o!=="initial"?null:be("button",K(_({className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",c?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(a=t==null?void 0:t.colors)==null?void 0:a.buttonBackground},onClick:c?void 0:()=>i()},r),{children:[be(ao,{children:[Ct(ht,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),c?Ct(G,{style:{color:(d=t==null?void 0:t.colors)==null?void 0:d.textSecondary,fill:(u=t==null?void 0:t.colors)==null?void 0:u.textPrimary}}):Ct("span",{className:"font-medium",style:{margin:"0px 32px",color:(w=t==null?void 0:t.colors)==null?void 0:w.textPrimary},children:"Sign in with Google"})]}),Ct("span",{className:"sr-only",children:"Sign in with Google"})]}))}import{useEffect as Ft,useMemo as mo,useState as uo}from"react";import{useSignIn as co,QRCode as fo}from"@farcaster/auth-kit";import{Fragment as po,jsx as L,jsxs as ut}from"react/jsx-runtime";function ve(){var s,i;let{step:r,appearance:e,setStep:o,setError:t}=S();return r==="initial"?L("div",{children:ut("button",{className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:e==null?void 0:e.borderRadius,backgroundColor:(s=e==null?void 0:e.colors)==null?void 0:s.buttonBackground},onClick:()=>{o("qrCode"),t(null)},children:[L($t,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),L("span",{className:"font-medium",style:{margin:"0px 32px",color:(i=e==null?void 0:e.colors)==null?void 0:i.textPrimary},children:"Sign in with Farcaster"}),L("span",{className:"sr-only",children:"Sign in with Farcaster"})]})}):r==="qrCode"?L(go,{}):null}function go(){var h,f,g,p,A,P,W,T,O;let{crossmintAuth:r}=V(),{appearance:e,setStep:o,setDialogOpen:t,setError:s}=S(),[i,n]=uo(null),c=mo(()=>({onSuccess:v=>{n(v)}}),[]),{signIn:a,url:d,connect:u,signOut:w,isConnected:m}=co(c),C=v=>b(this,null,function*(){s(null);try{let y=yield r==null?void 0:r.signInWithFarcaster(v);yield r==null?void 0:r.handleRefreshAuthMaterial(y),t(!1),o("initial")}catch(y){console.error("Error during Farcaster sign-in:",y),s("Failed to sign in with Farcaster")}});return Ft(()=>{i!=null&&C(i)},[i]),Ft(()=>{m&&a()},[m]),Ft(()=>{u()},[]),ut("div",{children:[L(et,{onClick:()=>{w(),o("initial")},iconColor:(h=e==null?void 0:e.colors)==null?void 0:h.textPrimary,ringColor:(f=e==null?void 0:e.colors)==null?void 0:f.accent}),ut("div",{className:"flex flex-col items-center gap-4",children:[ut("div",{className:"text-center",children:[L("h3",{className:"text-lg font-semibold text-cm-text-primary mb-2",style:{color:(g=e==null?void 0:e.colors)==null?void 0:g.textPrimary},children:"Sign in with Farcaster"}),L("p",{className:"text-base font-normal text-cm-text-secondary",style:{color:(p=e==null?void 0:e.colors)==null?void 0:p.textSecondary},children:"Scan with your phone's camera to continue."})]}),L("div",{className:"bg-white aspect-square rounded-lg p-4",style:{backgroundColor:(A=e==null?void 0:e.colors)==null?void 0:A.inputBackground,borderRadius:e==null?void 0:e.borderRadius},children:d!=null?L(fo,{uri:d,size:280}):L("div",{className:"min-h-[246px] flex items-center justify-center",children:L(G,{style:{color:(P=e==null?void 0:e.colors)==null?void 0:P.textSecondary,fill:(W=e==null?void 0:e.colors)==null?void 0:W.textPrimary}})})}),d?ut(po,{children:[L("p",{className:"text-base text-center font-normal text-cm-text-secondary",style:{color:(T=e==null?void 0:e.colors)==null?void 0:T.textSecondary},children:"Alternatively, click on this link to open Warpcast."}),L("a",{href:d,rel:"noopener noreferrer",target:"_blank",className:"text-base font-normal text-cm-link",style:{color:(O=e==null?void 0:e.colors)==null?void 0:O.textLink},children:"Open Warpcast"})]}):null]})]})}import{Fragment as yo,jsx as vt,jsxs as Se}from"react/jsx-runtime";function Pe(e){var r=Z(e,[]);var a,d,u,w;let{step:o,appearance:t,isLoadingOauthUrlMap:s}=S(),{createPopupAndSetupListeners:i,isLoading:n}=ot("twitter"),c=s||n;return o!=="initial"?null:Se("button",K(_({className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none",c?"cursor-not-allowed hover:bg-cm-muted-primary":""),style:{borderRadius:t==null?void 0:t.borderRadius,backgroundColor:(a=t==null?void 0:t.colors)==null?void 0:a.buttonBackground},onClick:c?void 0:()=>i()},r),{children:[Se(yo,{children:[vt(Xt,{className:"max-h-[25px] max-w-[25px] h-[25px] w-[25px] absolute left-[18px]"}),c?vt(G,{style:{color:(d=t==null?void 0:t.colors)==null?void 0:d.textSecondary,fill:(u=t==null?void 0:t.colors)==null?void 0:u.textPrimary}}):vt("span",{className:"font-medium",style:{margin:"0px 32px",color:(w=t==null?void 0:t.colors)==null?void 0:w.textPrimary},children:"Sign in with X"})]}),vt("span",{className:"sr-only",children:"Sign in with X"})]}))}import{jsx as St,jsxs as ho}from"react/jsx-runtime";function Ae(){var s,i,n,c,a;let{step:r,appearance:e,setStep:o,setError:t}=S();return r!=="initial"?null:ho("button",{className:N("relative flex text-base p-4 bg-cm-muted-primary text-cm-text-primary items-center w-full rounded-xl justify-center","transition-colors duration-200 ease-in-out","hover:bg-cm-hover focus:bg-cm-hover outline-none"),style:{borderRadius:e==null?void 0:e.borderRadius,borderColor:(s=e==null?void 0:e.colors)==null?void 0:s.border,backgroundColor:(i=e==null?void 0:e.colors)==null?void 0:i.buttonBackground},onClick:()=>{o("web3"),t(null)},children:[St(Yt,{className:"h-[21px] w-[21px] absolute left-[20px]",style:{color:(n=e==null?void 0:e.colors)==null?void 0:n.textPrimary}}),St("span",{className:"font-medium",style:{margin:"0px 32px",color:(c=e==null?void 0:e.colors)==null?void 0:c.textPrimary},children:"Continue with a wallet"}),St(Qt,{className:"h-[21px] w-[21px] absolute right-[20px]",style:{color:(a=e==null?void 0:e.colors)==null?void 0:a.textSecondary}}),St("span",{className:"sr-only",children:"Continue with a wallet"})]})}import{DynamicEmbeddedWidget as wo}from"@dynamic-labs/sdk-react-core";import{Fragment as xo,jsx as ct,jsxs as bo}from"react/jsx-runtime";function We(){var t,s;let{appearance:r,step:e,setStep:o}=S();return e==="web3"?bo(xo,{children:[ct(et,{onClick:()=>o("initial"),iconColor:(t=r==null?void 0:r.colors)==null?void 0:t.textPrimary,ringColor:(s=r==null?void 0:r.colors)==null?void 0:s.accent}),ct("div",{className:"flex flex-col items-center",children:ct("div",{className:"flex flex-col gap-[10px] w-full",children:ct("div",{className:"widget-container",children:ct(wo,{background:"none"})})})})]}):null}import{jsx as Ee}from"react/jsx-runtime";function ke(){let{step:r}=S();return r.startsWith("web3")?Ee(We,{}):r==="initial"?Ee(Ae,{}):null}import{jsx as M,jsxs as dt}from"react/jsx-runtime";function Oe({className:r}){var a,d,u,w,m,C,h,f,g,p,A,P,W;let{step:e,appearance:o,loginMethods:t,baseUrl:s,error:i,termsOfServiceText:n,authModalTitle:c}=S();return dt("div",{className:N("relative pt-10 pb-[30px] px-6 !min-[480px]:px-10 flex flex-col gap-[10px] antialiased animate-none",r),children:[i!=null?dt("div",{className:"flex items-start justify-start w-full rounded-lg p-2 mt-4 bg-cm-danger-muted",style:{backgroundColor:new Co((d=(a=o==null?void 0:o.colors)==null?void 0:a.danger)!=null?d:"#f44336").alpha(.12).toString()},children:[M("div",{className:"min-w-[20px]",children:M(yt,{customColor:(w=(u=o==null?void 0:o.colors)==null?void 0:u.danger)!=null?w:"#f44336"})}),M("p",{className:"ml-2 text-sm",style:{color:(C=(m=o==null?void 0:o.colors)==null?void 0:m.danger)!=null?C:"#f44336"},children:i})]}):null,e==="initial"?dt("div",{children:[M("h1",{className:"text-2xl font-bold text-cm-text-primary",style:{color:(h=o==null?void 0:o.colors)==null?void 0:h.textPrimary},children:c!=null?c:"Sign in to Crossmint"}),M("p",{className:"text-base font-normal mb-3 text-cm-text-secondary",style:{color:(f=o==null?void 0:o.colors)==null?void 0:f.textSecondary},children:"Access using one of the options below."})]}):null,t.includes("google")?M(Ce,{}):null,t.includes("farcaster")?M(Jt,{baseUrl:s,children:M(ve,{})}):null,t.includes("twitter")?M(Pe,{}):null,t.some(T=>T.startsWith("web3"))?M(ke,{}):null,t.includes("email")?dt("div",{children:[t.length>1?M(xe,{appearance:o,text:"OR"}):null,M(we,{})]}):null,e==="initial"&&n!=null?dt("div",{className:"text-sm text-center text-cm-text-secondary mt-2",style:{color:(g=o==null?void 0:o.colors)==null?void 0:g.textSecondary},children:[M("style",{children:`
|
|
3
|
-
p a {
|
|
4
|
-
color: ${(A=(p=o==null?void 0:o.colors)==null?void 0:p.textLink)!=null?A:"#1A74E9"};
|
|
5
|
-
}
|
|
6
|
-
`}),n]}):null,e==="initial"||e==="otp"?M(Rt,{className:"mt-1.5 md:mt-4 justify-center",color:(W=(P=o==null?void 0:o.colors)==null?void 0:P.textSecondary)!=null?W:"#67797F"}):null]})}import{useEffect as vo}from"react";import{jsx as rt,jsxs as So}from"react/jsx-runtime";function Tt({open:r}){var t,s,i;let{appearance:e,setDialogOpen:o}=S();return vo(()=>{document.body.style.overflow=r?"hidden":""},[r]),rt(Ut,{modal:!1,open:r,onOpenChange:o,children:So(Lt,{onInteractOutside:n=>n.preventDefault(),onOpenAutoFocus:n=>n.preventDefault(),closeButtonColor:(t=e==null?void 0:e.colors)==null?void 0:t.textPrimary,closeButtonRingColor:(s=e==null?void 0:e.colors)==null?void 0:s.accent,className:"!p-0 !min-[480px]:p-0",style:{borderRadius:e==null?void 0:e.borderRadius,backgroundColor:(i=e==null?void 0:e.colors)==null?void 0:i.background},children:[rt(Fe,{asChild:!0,children:rt(Mt,{children:"Crossmint Auth"})}),rt(Fe,{asChild:!0,children:rt(Dt,{children:"Sign in via Crossmint"})}),rt(Oe,{className:"max-w-[448px]"})]})})}import Po from"bs58";import{EthereumWalletConnectors as Te}from"@dynamic-labs/ethereum";import{SolanaWalletConnectors as Ie}from"@dynamic-labs/solana";import{jsx as Ao}from"react/jsx-runtime";function Ne({children:r,apiKeyEnvironment:e,enabled:o}){var a,d;let{crossmintAuth:t}=V(),{appearance:s,loginMethods:i}=S(),n=o?[Te,Ie]:void 0;i.includes("web3:evm-only")?n=[Te]:i.includes("web3:solana-only")&&(n=[Ie]);let c=`.powered-by-dynamic { display: none !important; } .wallet-list__scroll-container { padding: 0px !important; } .wallet-list__search-container { padding-left: 0px !important; padding-right: 0px !important; } .dynamic-footer { display: none !important; } h1 { color: ${(a=s==null?void 0:s.colors)==null?void 0:a.textPrimary} !important; } * { color: ${(d=s==null?void 0:s.colors)==null?void 0:d.textSecondary} !important; }`;return Ao(Zt,{apiKeyEnvironment:e,settings:{walletConnectors:n,cssOverrides:c,events:{onWalletRemoved(){console.log("[CryptoWalletConnectionHandler] onWalletRemoved")},onAuthFlowCancel(){console.log("[CryptoWalletConnectionHandler] onAuthFlowCancel")},onAuthFlowClose(){console.log("[CryptoWalletConnectionHandler] onAuthFlowClose")},onAuthFailure(u,w){console.error("[CryptoWalletConnectionHandler] onAuthFailure",u,w)},onAuthSuccess(u){console.log("[CryptoWalletConnectionHandler] onAuthSuccess",u)}},handlers:{handleConnectedWallet:u=>b(this,null,function*(){var h;console.log("[CryptoWalletConnectionHandler] handleConnectedWallet",u);let w=u.address;if(!w)return console.error("[CryptoWalletConnectionHandler] handleConnectedWallet: address is missing"),!1;let C=(yield te(u))==="solana"?"solana":"evm";try{let f=yield t==null?void 0:t.signInWithSmartWallet(w,C),g=yield(h=u.connector)==null?void 0:h.proveOwnership(w,f.challenge),p=g;if(C==="solana"){let W=Buffer.from(g,"base64");p=Po.encode(W)}let P=(yield t==null?void 0:t.authenticateSmartWallet(w,C,p)).oneTimeSecret;yield t==null?void 0:t.handleRefreshAuthMaterial(P)}catch(f){console.error("[CryptoWalletConnectionHandler] Error authenticating wallet:",f)}return!0})}},children:r},`${e}-${i.join(",")}`)}import{jsx as nt,jsxs as Uo}from"react/jsx-runtime";var Io={crossmintAuth:void 0,login:()=>{},logout:()=>{},jwt:void 0,user:void 0,status:"initializing",getUser:()=>{}},at=Wo(Io),No={createOnLogin:"off",type:"evm-smart-wallet",experimental_enableRecoveryKeys:!1,experimental_signersURL:void 0};function di({embeddedWallets:r=No,children:e,appearance:o,termsOfServiceText:t,prefetchOAuthUrls:s=!0,authModalTitle:i,onLoginSuccess:n,loginMethods:c=["email","google"],refreshRoute:a,logoutRoute:d}){var z;let[u,w]=ft(void 0),{crossmint:m,setJwt:C}=tt("CrossmintAuthProvider must be used within CrossmintProvider"),h=Eo(null),f=Re(()=>(h.current||(h.current=ko.from(m,{callbacks:{onLogout:()=>{C(void 0),w(void 0)},onTokenRefresh:F=>{C(F.jwt),w(F.user)}},refreshRoute:a,logoutRoute:d})),h.current),[]),g=Fo(m.apiKey),[p,A]=ft(!1),[P,W]=ft(!1),[T,O]=ft(void 0),[v,y]=ft(!1),x=c.some(F=>F.startsWith("web3")),l=X(()=>{n==null||n()},[n]);It(()=>{if(m.jwt==null){let F=Oo(To);C(F)}W(!0)},[m.jwt,C]),It(()=>{m.jwt!=null&&p&&(A(!1),l())},[m.jwt,p,l]);let R=X(F=>{if(m.jwt!=null){console.log("User already logged in");return}F!=null&&typeof F=="string"&&O(F),A(!0)},[m.jwt]),I=X(()=>{f.logout()},[f]),D=X(()=>!P||x&&!v?"initializing":m.jwt!=null?"logged-in":p?"in-progress":"logged-out",[P,m.jwt,p,v,x]),H=X(()=>b(this,null,function*(){if(m.jwt==null){console.log("User not logged in");return}let F=yield f.getUser();w(F)}),[m.jwt,f]),Q=Re(()=>({crossmintAuth:f,login:R,logout:I,jwt:m.jwt,user:u,status:D(),getUser:H}),[f,R,I,m.jwt,u,D,H]);return nt(pt,{children:nt(at.Provider,{value:Q,children:nt(ae,{showPasskeyHelpers:r.showPasskeyHelpers,appearance:o,experimental_enableRecoveryKeys:(z=r.experimental_enableRecoveryKeys)!=null?z:!1,children:nt(de,{setDialogOpen:(F,$)=>{A(F),$&&l()},preFetchOAuthUrls:D()==="logged-out"&&s,initialState:{appearance:o,loginMethods:c,termsOfServiceText:t,authModalTitle:i,embeddedWallets:r,baseUrl:g,defaultEmail:T},children:Uo(Ne,{enabled:x,apiKeyEnvironment:m.apiKey.includes("production")?"production":"staging",children:[nt(Ro,{embeddedWallets:r,accessToken:m.jwt,setIsDynamicSdkLoaded:y,isWeb3Enabled:x}),e,nt(Tt,{open:p})]})})},m.jwt)})})}function Ro({embeddedWallets:r,accessToken:e,setIsDynamicSdkLoaded:o,isWeb3Enabled:t}){let{getOrCreateWallet:s,clearWallet:i,status:n}=me(),{sdkHasLoaded:c,getAdminSigner:a,cleanup:d,isDynamicWalletConnected:u}=oe(t,o,e),{createOnLogin:w,adminSigner:m,linkedUser:C}=r,h=w==="all-users"&&n==="not-loaded"&&e!=null&&c,f=X(()=>b(this,null,function*(){var P,W;if(!h)return;let p=m,A=r.type;if(u&&(p=(P=yield a())!=null?P:p,A=(W=ee(p==null?void 0:p.type))!=null?W:A),!u&&r.type==null){console.error("[CrossmintAuthProvider] \u26A0\uFE0F embeddedWallets.type is required when no external wallet is connected");return}s({type:A,args:{adminSigner:p,linkedUser:C}})}),[h,s,C,m,r.type,a]),g=X(()=>{e==null&&n==="loaded"&&i(),d()},[n,e,i,d]);return It(()=>{f(),g()},[f,g]),null}function Si(){let r=Lo(at);if(r===void 0)throw new Error("useAuth must be used within an AuthProvider");return r}import{jsx as jo,jsxs as zo}from"react/jsx-runtime";var Le={timeoutMs:1e4,intervalMs:5e3},Me=Mo(null);function se({children:r,setWalletState:e,appearance:o,signersURL:t}){let{crossmint:{apiKey:s,jwt:i}}=tt(),n=_o(()=>Ko.from({apiKey:s,jwt:i}),[s,i]),c=Go(s);if(c==null)throw new Error("Could not determine environment from API key");let a=zt(c,t),[d,u]=Nt(""),[w,m]=Nt("initial"),[C,h]=Nt(!1),f=Ue(null),g=Ue(null),p=v=>b(this,null,function*(){try{e({status:"in-progress"}),u(v.email);let y=Ho(s.startsWith("ck_development_")?"development":"staging"),R=(yield(yield fetch(`${y}/api/unstable/wallets/ncs/doesnt-matter/public-key`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`,"x-api-key":s},body:JSON.stringify({authId:`email:${v.email}`,signingAlgorithm:"EDDSA_ED25519"})})).json()).publicKey,I=Uint8Array.from(atob(R),z=>z.charCodeAt(0)),D=gt.encode(I),H=yield T(D),Q=K(_({},H),{sendTransaction:z=>b(this,null,function*(){return new Promise((F,$)=>{let st=()=>{h(!1),m("initial")},B=()=>b(this,null,function*(){st();try{let q=yield H.sendTransaction(z);F(q)}catch(q){$(q)}}),Y=q=>{st(),$(q)};f.current=B,g.current=Y,A().then(B).catch(Y)})})});e({status:"loaded",wallet:Q,type:"solana-smart-wallet"})}catch(y){throw console.error("There was an error creating a wallet ",y),e(it(y)),y}});function A(){return b(this,null,function*(){if(!a.current||i==null)throw new Error("[handleGetRecoverySigner] IFrame window not initialized or JWT not set");return new Promise((v,y)=>b(this,null,function*(){var x;try{let l=yield(x=a.current)==null?void 0:x.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:{jwt:i,apiKey:s}}});if((l==null?void 0:l.status)!=="success")throw new Error(l==null?void 0:l.error);if(l.signerStatus==="ready")return console.log("Signer already exists, skipping OTP flow"),v();f.current=()=>v(),g.current=R=>y(R),m("initial"),h(!0)}catch(l){console.error("Error getting recovery signer",l),y(l)}}))})}let P=v=>b(this,null,function*(){var y,x;if(!a.current||i==null)throw new Error("[handleSendEmailOTP] IFrame window not initialized or JWT not set");try{console.log("Creating Recovery Key");let l=yield(y=a.current)==null?void 0:y.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:{jwt:i,apiKey:s},data:{authId:`email:${v}`}}});if(l.status==="error")throw new Error(l.error);if(l.status==="success"&&l.signerStatus==="ready"){console.log("Signer already exists, skipping OTP flow"),m("initial"),h(!1);return}console.log("Proceeding to OTP flow"),m("otp"),h(!0)}catch(l){throw console.error("Error in email submission:",l),(x=g.current)==null||x.call(g,l),l}}),W=v=>b(this,null,function*(){var y,x;if(!a.current||i==null)throw new Error("[handleOTPSubmit] IFrame window not initialized or JWT not set");try{let l=yield a.current.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:{jwt:i,apiKey:s},data:{onboardingAuthentication:{encryptedOtp:v}}}});if(l.status==="error")throw new Error(l.error);m("initial"),h(!1),(y=f.current)==null||y.call(f)}catch(l){throw console.error("Error completing onboarding:",l),(x=g.current)==null||x.call(g,l),l}});function T(v){return b(this,null,function*(){if(i==null)throw new Error("[getOrCreateSolanaWalletWithSigner] JWT not set!");try{return yield n.getOrCreateWallet("solana-smart-wallet",{adminSigner:{type:"solana-keypair",address:v,signer:{signMessage:y=>O(()=>b(this,null,function*(){if(a.current==null)throw new Error("IFrame window not initialized");let x=yield a.current.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:s},data:{keyType:"ed25519",bytes:gt.encode(y),encoding:"base58"}},options:Le});if(x.status==="error"){let l=new Error(x.error);throw l.code=x.code,l}if(x.signature==null)throw new Error("Failed to sign message");if(x.signature.encoding!=="base58")throw new Error("Unsupported signature encoding: "+x.signature.encoding);return gt.decode(x.signature.bytes)})),signTransaction:y=>O(()=>b(this,null,function*(){var R;let x=y.message.serialize(),l=yield(R=a.current)==null?void 0:R.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:s},data:{keyType:"ed25519",bytes:gt.encode(x),encoding:"base58"}},options:Le});if((l==null?void 0:l.status)==="error"){let I=new Error(l.error);throw I.code=l.code,I}if((l==null?void 0:l.signature)==null)throw new Error("Failed to sign transaction");if(l.signature.encoding!=="base58")throw new Error("Unsupported signature encoding: "+l.signature.encoding);return y.addSignature(new Vo(v),gt.decode(l.signature.bytes)),y}))}}})}catch(y){throw console.error("Error creating wallet with signer:",y),e(it(y)),y}})}function O(v){return b(this,null,function*(){try{return yield v()}catch(y){if(y.code==="invalid-device-share")return yield A(),yield v();throw y}})}return Bo(()=>{document.body.style.overflow=C?"hidden":""},[C]),zo(Me.Provider,{value:{experimental_getOrCreateWalletWithRecoveryKey:p},children:[jo(jt,{email:d,open:C,setOpen:h,step:w,onSubmitOTP:W,onResendOTPCode:P,onSubmitEmail:P,appearance:o}),r]})}function ie({enabled:r=!0}={}){let e=Do(Me);if(!r)return{experimental_getOrCreateWalletWithRecoveryKey:()=>b(this,null,function*(){yield Promise.reject(new Error("useCrossmintSigner is disabled, please set 'experimental_enableRecoveryKeys' to true"))})};if(e===null)throw new Error("useCrossmintSigner must be used within a CrossmintSignerProvider");return e}export{Me as a,se as b,ie as c,Pt as d,ae as e,me as f,V as g,S as h,de as i,et as j,Xe as k,ge as l,ot as m,pe as n,ye as o,we as p,xe as q,Ce as r,ve as s,Pe as t,Ae as u,We as v,ke as w,Oe as x,Tt as y,Ne as z,at as A,di as B,Si as C};
|
package/dist/chunk-E55GKOB4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="1.19.19";var r=s;export{r as a};
|