PageSourceSearch

https://shinkai-contracts.pages.dev/assets/OAuthStatusScreen-C4KNGm-v-CxGMvfgk.js

js shinkai-contracts.pages.dev collected 2026-10-03 05:33:53 UTC 5,980 bytes, 2 lines download raw bytes

1import{dE as K,d8 as X,d9 as z,db as Z,dd as h,df as i,dN as ee,ei as j,dA as f,da as g,ej as te,e0 as E}from"./index-DfYqf8IS.js";import{i as re,B as oe,C as ae,o as ne,h as ie,s as se,d as de,n as ce,l as le,e as ue,r as me}from"./twitch-5IOe4sIQ-9xqoLlFV.js";import{F as pe}from"./GlobeAltIcon-SWSk100B.js";import{a as he}from"./shouldProceedtoEmbeddedWalletCreationFlow-BdpCzEJT-CGrSSyN3.js";import{n as Ee}from"./ScreenLayout-kyRBwF5n-B75D8hQj.js";import{e as ye}from"./capitalizeFirstLetter-DmLYqXsO-tV1Idewc.js";import"./ModalHeader-CvLNEZ0F-DgSK_aSI.js";import"./Screen-DnEl8dVF-BVrKGheG.js";import"./index-Dq_xe9dz-CdSEv91P.js";const fe=({style:e})=>g.jsx(pe,{style:{color:"var(--privy-color-error)",...e}});let F={google:{name:"Google",component:me},discord:{name:"Discord",component:ue},github:{name:"Github",component:le},linkedin:{name:"LinkedIn",component:ce},twitter:{name:"Twitter",component:de},spotify:{name:"Spotify",component:se},instagram:{name:"Instagram",component:ie},tiktok:{name:"Tiktok",component:ne},line:{name:"LINE",component:ae},twitch:{name:"Twitch",component:oe},apple:{name:"Apple",component:re}},ve=({iconUrl:e,...o})=>E.createElement("svg",{width:"33",height:"32",viewBox:"0 0 33 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},E.createElement("foreignObject",{x:"2",y:"2",width:"29",height:"28"},E.createElement("img",{src:e,width:"29",height:"28",style:{display:"block",objectFit:"contain",borderRadius:"4px"},alt:"Provider icon"})));const v=(e,o)=>{if(e in F)return F[e];if(te(e)&&o){let a=o.find((t=>t.provider===e));if(a)return{name:a.provider_display_name,component:t=>E.createElement(ve,{...t,iconUrl:a.provider_icon_url})}}return{name:"Unknown",component:fe}};function ge(e,o,a){let t={detail:"",retryable:!1},s=ye(o);if((e==null?void 0:e.privyErrorCode)===i.LINKED_TO_ANOTHER_USER&&(t.detail="This account has already been linked to another user."),(e==null?void 0:e.privyErrorCode)===i.INVALID_CREDENTIALS&&(t.retryable=!0,t.detail="Something went wrong. Try again."),e.privyErrorCode===i.OAUTH_USER_DENIED&&(t.detail=`Retry and check ${s} to finish connecting your account.`,t.retryable=!0),(e==null?void 0:e.privyErrorCode)===i.TOO_MANY_REQUESTS&&(t.detail="Too many requests. Please wait before trying again."),(e==null?void 0:e.privyErrorCode)===i.TOO_MANY_REQUESTS&&e.message.includes("provider rate limit")){let n=v(o,a).name;t.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if((e==null?void 0:e.privyErrorCode)===i.OAUTH_ACCOUNT_SUSPENDED){let n=v(o,a).name;t.detail=`Your ${n} account is suspended. Please try another login method.`}return(e==null?void 0:e.privyErrorCode)===i.CANNOT_LINK_MORE_OF_TYPE&&(t.detail="You cannot authorize more than one account for this user."),(e==null?void 0:e.privyErrorCode)===i.OAUTH_UNEXPECTED&&o.startsWith("privy:")&&(t.detail="Something went wrong. Please try again."),t}const Se=({providerName:e,ProviderLogo:o,success:a,errorMessage:t,onRetry:s})=>{let n=a?`Successfully connected with ${e}`:t?t.message:`Verifying connection to ${e}`;return g.jsx(Ee,{title:n,subtitle:a?"You're good to go!":t?t.detail:"Just a few moments more",icon:o,iconVariant:"loading",iconLoadingStatus:{success:a,fail:!!t},secondaryCta:t!=null&&t.retryable&&s?{label:"Retry",onClick:s}:void 0,watermark:!0})},Ue={component:()=>{var _;let{authenticated:e,logout:o,ready:a,user:t}=K(),{setModalData:s,navigate:n,resetNavigation:u}=X(),d=z(),{getAuthMeta:S,initLoginWithOAuth:Y,loginWithOAuth:H,updateWallets:V,setReadyToTrue:A,closePrivyModal:q,createAnalyticsEvent:B}=Z(),[y,Q]=h.useState(!1),[m,c]=h.useState(void 0),l=((_=S())==null?void 0:_.provider)||"google",{name:T,component:G}=v(l,d.customOAuthProviders);return h.useEffect((()=>{H(l).then((()=>{Q(!0),A(!0)})).catch((r=>{var O,C,w,N,R,b,U,I,L,k,D,P,$,x,M,W;if(A(!1),(r==null?void 0:r.privyErrorCode)===i.ALLOWLIST_REJECTED)return c(void 0),u(),void n("AllowlistRejectionScreen");if((r==null?void 0:r.privyErrorCode)===i.USER_LIMIT_REACHED)return console.error(new ee(r).toString()),c(void 0),u(),void n("UserLimitReachedScreen");if((r==null?void 0:r.privyErrorCode)===i.USER_DOES_NOT_EXIST)return c(void 0),u(),void n("AccountNotFoundScreen");if((r==null?void 0:r.privyErrorCode)===i.ACCOUNT_TRANSFER_REQUIRED&&((C=(O=r.data)==null?void 0:O.data)!=null&&C.nonce))return c(void 0),u(),s({accountTransfer:{nonce:(N=(w=r.data)==null?void 0:w.data)==null?void 0:N.nonce,account:(b=(R=r.data)==null?void 0:R.data)==null?void 0:b.subject,displayName:(L=(I=(U=r.data)==null?void 0:U.data)==null?void 0:I.account)==null?void 0:L.displayName,linkMethod:(k=S())==null?void 0:k.provider,embeddedWalletAddress:($=(P=(D=r.data)==null?void 0:D.data)==null?void 0:P.otherUser)==null?void 0:$.embeddedWalletAddress,oAuthUserInfo:(W=(M=(x=r.data)==null?void 0:x.data)==null?void 0:M.otherUser)==null?void 0:W.oAuthUserInfo}}),void n("LinkConflictScreen");let{retryable:p,detail:J}=ge(r,l,d.customOAuthProviders);c({retryable:p,detail:J,message:"Authentication failed"})})).finally((()=>{j()}))}),[T,l]),h.useEffect((()=>
1{if(a&&e&&y&&t){if(d!=null&&d.legal.requireUsersAcceptTerms&&!t.hasAcceptedTerms){let r=setTimeout((()=>{n("AffirmativeConsentScreen")}),f);return()=>clearTimeout(r)}if(he(t,d.embeddedWallets)){let r=setTimeout((()=>{s({createWallet:{onSuccess:()=>{},onFailure:p=>{console.error(p),B({eventName:"embedded_wallet_creation_failure_logout",payload:{error:p,provider:l,screen:"OAuthStatusScreen"}}),o()},callAuthOnSuccessOnClose:!0}}),n("EmbeddedWalletOnAccountCreateScreen")}),f);return()=>clearTimeout(r)}{let r=setTimeout((()=>q({shouldCallAuthOnSuccess:!0,isSuccess:!0})),f);return V(),()=>clearTimeout(r)}}}),[a,e,y,t]),g.jsx(Se,{providerName:T,ProviderLogo:G,success:y,errorMessage:m,onRetry:m!=null&&m.retryable?()=>{j(),Y(l),c(void 0)}:void 0})},isShownBeforeReady:!0};export{Ue as OAuthStatusScreen,Se as OAuthStatusScreenView,Ue as default};
2//# sourceMappingURL=OAuthStatusScreen-C4KNGm-v-CxGMvfgk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.