1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6444],{26444:function(e,s,r){r.r(s),r.d(s,{EmbeddedWalletPasswordUpdateScreen:function(){return c},default:function(){return c}});var t=r(57437),a=r(2265),o=r(35293),d=r(13461),n=r(97422),l=r(28771),i=r(91123);r(13130),r(36393),r(63858),r(94023),r(92861);let c={component:()=>{let[e,s]=(0,a.useState)(null),[r,c]=(0,a.useState)(!1),[u,w]=(0,a.useState)(null),[y,v]=(0,a.useState)(""),{authenticated:p,user:g}=(0,o.u)(),{client:h,walletProxy:_,refreshSessionAndUser:f,closePrivyModal:m,createAnalyticsEvent:M}=(0,n.u)(),{navigate:b,data:R,onUserCloseViaDialogOrKeybindRef:P}=(0,o.a)(),A=(0,d.u)(),{onSuccess:S,onFailure:E}=R.setWalletPassword,C=(0,o.g)(g),N="user-passcode"===e?.recoveryMethod,x="user-passcode"===C?.recoveryMethod;(0,a.useEffect)(()=>{p||(b("LandingScreen"),E(new n.o("User must be authenticated before setting a password on a Privy wallet")))},[p]);let k=()=>(u?E(u):N?S(e):E(new n.m("Exited before password was added to wallet")),void m({shouldCallAuthOnSuccess:!1}));return P.current=k,(0,t.jsx)(i.S,{appName:A?.name||"privy",config:{initiatedBy:"user",onCancel:k},error:u?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:y,isResettingPassword:x,onPasswordGenerate:()=>v((0,i.g)()),onPasswordChange:v,onSubmit:async()=>{N?(S(e),m({shouldCallAuthOnSuccess:!1})):(c(!0),w(null),await (async()=>{let e=await h.getAccessToken();if(e&&g&&C?.address&&y&&_)try{M({eventName:"embedded_wallet_set_recovery_started",payload:{walletAddress:C.address,existingRecoveryMethod:C.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:x}});let{entropyId:r,entropyIdVerifier:t}=(0,l.d)(g);if(!(await _.setRecovery({accessToken:e,entropyId:r,entropyIdVerifier:t,recoveryPassword:y,recoveryMethod:"user-passcode"})).entropyId)return w(new n.m("Error setting password on privy wallet")),void M({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:C.address,existingRecoveryMethod:C.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:x,reason:"error setting password"}});let a=await f(),d=(0,o.g)(a);if(!d)return w(new n.m("Error setting password on privy wallet")),void M({eventName:"embedded_wallet_set_recovery_failed",payload:{walletAddress:C.address,existingRecoveryMethod:C.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:x,reason:"wallet disconnected"}});s(d),M({eventName:"embedded_wallet_set_recovery_completed",payload:{walletAddress:C.address,existingRecoveryMethod:C.recoveryMethod,targetRecoveryMethod:"user-passcode",isResettingPassword:x}})}catch(e){console.warn(e),w(e instanceof Error?e:Error("Error setting password on privy wallet")),M({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:C.address,reason:e}})}})(),c(!1))},onClose:k})}}}}]);
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.