PageSourceSearch

https://static.usehaven.com/assets/CQYDYHr12.js

js usehaven.com collected 2026-09-26 10:03:14 UTC 12,578 bytes, 1 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`f071606d256de3b2e5001e8c91951dd823c43bd6`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`43c74926-57cb-47e6-900a-57a64498587c`,e._sentryDebugIdIdentifier=`sentry-dbid-43c74926-57cb-47e6-900a-57a64498587c`)}catch{}})();import{o as e}from"./5v_HMQ8i.js";import{Ru as t,So as n,po as r,xo as i,zu as a}from"./BikK9A2q.js";import{Ki as o,qi as s,ua as c}from"./D_H8ZTso.js";import{t as l}from"./CPV9fQTj.js";import{a as u}from"./B8DjGN9J.js";import{s as d}from"./hAnnhimc.js";import"./BA1tyIjY.js";import{o as f}from"./lRMFeX13.js";import{c as p,d as m,o as h,u as g}from"./t3Ug9gQX.js";import{t as _}from"./OtnHiY_C.js";import{i as v,r as y}from"./BQMLgkel.js";import{t as b}from"./CqjMVOvd.js";import{t as x}from"./CRQjpfUk.js";import{t as S}from"./CLsMaEyW.js";import{S as C}from"./BV7Hly_O2.js";import{a as w}from"./BzFTvcHb2.js";import{c as T,l as E,u as D}from"./BYxPcN-O2.js";import{t as O}from"./3nIxV5AT2.js";import{t as k}from"./C__rWSpB2.js";var A=e(a(),1),j=()=>{let e=i(),t=n(),a=r(),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(``),[u,d]=(0,A.useState)(null),[f,p]=(0,A.useState)(``),m=(e,t)=>
1{a.session.updateSession({session_jwt:e,session_token:t}),a.session.authenticate()};return(0,A.useEffect)(()=>{let e=t.get(`token`),n=t.get(`stytch_token_type`);e&&n===`reset_password`&&p(e)},[t]),{email:o,setEmail:s,newPassword:c,setNewPassword:l,error:u,handleResetPassword:async()=>{let t=await g({email:o,token:f,newPassword:c});if(!t.ok){switch(t.error.error_type){case`weak_password`:d({error_message:`Password is too weak. Please enter a stronger password.`,error_type:`weak_password`});break;default:d(t.error);return}return}let n=await h({email:w(o),password:c});if(!n.ok){d(n.error);return}if(!n.data){d({error_message:`Something went wrong. Please try again. Or contact support if the problem persists.`,error_type:`unexpected_error`});return}m(n.data.session_jwt,n.data.session_token),e.push(y.ACCOUNTING_DASHBOARD)}}},M=t();function N(){let{newPassword:e,setNewPassword:t,error:n,handleResetPassword:r,email:i,setEmail:a}=j(),[c,l]=(0,A.useState)(!1);return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-6 w-full items-center max-w-[320px]`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full items-center`,children:[(0,M.jsx)(`div`,{className:`text-2xl font-bold`,children:`Reset password`}),(0,M.jsx)(`div`,{className:`text-sm text-gray-500 flex flex-col gap-2`,children:(0,M.jsx)(`p`,{className:`text-sm`,children:`Please enter your email and new password to continue.`})})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[(0,M.jsx)(x,{htmlFor:`email`,className:`text-xs`,children:`Email address`}),(0,M.jsx)(b,{id:`email`,placeholder:`Enter your email address`,className:`placeholder:text-gray-500`,type:`email`,value:i,onChange:e=>a(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[(0,M.jsx)(x,{htmlFor:`password`,className:`text-xs`,children:`New password`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(b,{id:`password`,type:c?`text`:`password`,placeholder:`Enter your new password`,className:`placeholder:text-gray-500 [&::-ms-reveal]:hidden [&::-webkit-credentials-auto-fill-button]:hidden`,value:e,onChange:e=>t(e.target.value)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>l(!c),className:`absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700`,children:c?(0,M.jsx)(s,{className:`h-4 w-4`}):(0,M.jsx)(o,{className:`h-4 w-4`})})]})]})]}),n&&(0,M.jsx)(`div`,{className:`text-hav-error text-xs`,children:C(n)}),(0,M.jsx)(`form`,{action:r,children:(0,M.jsx)(u,{type:`submit`,className:`w-[320px]`,size:`sm`,disabled:e===``,children:`Continue`})})]})})}var P=()=>{let e=i(),t=r(),[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)(!0),[d,g]=(0,A.useState)(null),[_,b]=(0,A.useState)(!1),[x,S]=(0,A.useState)(!1),C=n(),w=async(e,n)=>{t.session.updateSession({session_jwt:e,session_token:n}),await t.session.authenticate()},{mutateAsync:O,isPending:k}=f({mutationFn:async t=>{if(!await T({email:a})){if(await D({email:a})){if(await E({email:a})!==`NotFound`){g({error_message:`This account has been deactivated. Please reach out to Haven Support to regain access.`,error_type:`stytch_error`});return}let n=await m({email:a,sessionToken:null});if(!n.ok){g({error_message:`Something went wrong. Please try again or reach out to Haven Support.`,error_type:`stytch_error`});return}let r=new URLSearchParams(C.toString());r.set(`otp`,`true`),r.set(`email`,a),r.set(`emailId`,n.data.email_id),e.push(t??`${v.SIGN_UP}?${r}`);return}g({error_message:`Email not found. Please sign up first.`,error_type:`email_not_found`});return}g(null);let n=await h({email:a,password:s,staySignedIn:l});if(!n.ok)switch(n.error.error_type){case`reset_password`:b(!0);return;case`email_not_found`:g({error_message:`Email not found. Please sign up first.`,error_type:`email_not_found`});return;default:g(n.error);return}if(!n.data){g({error_message:`Something went wrong. Please try again. Or contact support if the problem persists.`,error_type:`unexpected_error`});return}await w(n.data.session_jwt,n.data.session_token),e.push(t??y.ACCOUNTING_DASHBOARD)}});return{email:a,setEmail:o,password:s,setPassword:c,staySignedIn:l,setStaySignedIn:u,error:d,setError:g,signInUser:O,isSigningIn:k,resetPassword:_,resetExistingPassword:async()=>{g(null);let e=await p({email:a});if(!e.ok){g(e.error);return}if(!e.data){g({error_message:`Something went wrong. Please try again. Or contact support if the problem persists.`,error_type:`unexpected_error`});return}S(!0)},setResetPassword:b,passwordIsReset:x}};function F(){let{email:e,setEmail:t,password:r,setPassword:a,staySignedIn:o,setStaySignedIn:s,error:l,setError:u,signInUser:f,isSigningIn:p,resetPassword:m,resetExistingPassword:h,setResetPassword:g,passwordIsReset:_}=P(),[v,y]=(0,A.useState)(!1),b=n(),x=i(),C=b.get(`initial`)===`true`,w=b.get(`r`)||void 0,{copy:T}=O(),E=async(e,t)=>{await T(e)?d({title:`Copied ${t} to clipboard`}):d({title:`Failed to copy`})};return(0,A.useEffect)(()=>{C&&(g(!0),y(!0))},[C,x,g,y]),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-10 justify-center items-center w-full max-w-[400px]`,children:[m?(0,M.jsxs)(M.Fragment,{children:[!_&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full items-center`,children:[(0,M.jsx)(`div`,{className:`text-2xl font-bold`,children:v?`Welcome back!`:`Reset password`}),(0,M.jsxs)(`div`,{className:`text-sm text-gray-500 flex flex-col gap-2`,children:[v&&(0,M.jsx)(`p`,{className:`text-sm mt-4`,children:`Haven's login flow has been updated.`}),(0,M.jsx)(`p`,{className:`text-sm`,children:`Please enter your email address to continue.`})]})]}),_&&(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full items-center`,children:[(0,M.jsx)(`div`,{className:`text-2xl font-bold my-4`,children:v?`Check your email`:`Password reset`}),(0,M.jsx)(`div`,{className:`text-sm text-gray-500 flex flex-col gap-2`,children:(0,M.jsxs)(`p`,{className:`text-sm`,children:[`Please check your email for instructions on how to`,` `,v?`set`:`reset`,` your password.`]})})]})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full items-center`,children:[(0,M.jsx)(`div`,{className:`text-2xl font-bold`,children:`Sign in to Haven`}),(0,M.jsx)(`div`,{className:`text-sm text-gray-500`,children:(0,M.jsx)(S,{per:`word`,as:`h3`,preset:`blur`,children:`Welcome back! Please sign in to continue`})})]}),m?(0,M.jsx)(M.Fragment,{children:!_&&(0,M.jsx)(L,{isInitial:v,setResetPassword:g,handleResetPassword:h,email:e,setEmail:t,setError:u,error:l})}):(0,M.jsx)(I,{handleSignIn:()=>f(w),isLoading:p||x.isLoading,email:e,setEmail:t,password:r,setPassword:a,staySignedIn:o,setStaySignedIn:s,error:l,setError:u,setResetPassword:g})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 items-center max-w-[400px] px-2 py-10 mt-12 border-t`,children:[(0,M.jsx)(`div`,{className:`hav-text-card-title`,children:`Got a friend who could use Haven too?`}),(0,M.jsxs)(`p`,{className:`hav-text-softer text-sm`,children:[`When they join Haven, you'll both`,` `,(0,M.jsx)(`span`,{className:`text-black font-semibold`,children:`earn $250.`})]}),(0,M.jsx)(`div`,{className:`flex gap-1 items-center text-xs`,children:(0,M.jsxs)(`button`,{onClick:()=>E(`[email protected]`,`email`),className:`flex items-center gap-2 hav-bg-surface hover:hav-elev-2 roun
1ded-lg px-2 py-1.5 hav-text-default text-xs`,children:[`Make an introduction to`,` `,(0,M.jsx)(`span`,{className:`underline font-medium h-full`,children:`[email protected]`}),(0,M.jsx)(c,{size:14})]})})]})]})}function I({handleSignIn:e,isLoading:t,email:n,setEmail:r,password:i,setPassword:a,staySignedIn:c,setStaySignedIn:l,error:d,setError:f,setResetPassword:p}){let[m,h]=(0,A.useState)(!1);return(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(`form`,{className:`flex flex-col gap-6 w-full items-center max-w-[320px]`,onSubmit:t=>{t.preventDefault(),e()},children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 w-full`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[(0,M.jsx)(x,{htmlFor:`email`,className:`text-xs`,children:`Email address`}),(0,M.jsx)(b,{autoFocus:!0,id:`email`,placeholder:`Enter your email address`,className:`placeholder:text-gray-500`,type:`email`,value:n,onChange:e=>r(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[(0,M.jsx)(x,{htmlFor:`password`,className:`text-xs`,children:`Password`}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(b,{id:`password`,type:m?`text`:`password`,placeholder:`Enter your password`,className:`placeholder:text-gray-500 [&::-ms-reveal]:hidden [&::-webkit-credentials-auto-fill-button]:hidden`,value:i,onChange:e=>a(e.target.value)}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(!m),className:`absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700`,children:m?(0,M.jsx)(s,{className:`h-4 w-4`}):(0,M.jsx)(o,{className:`h-4 w-4`})})]}),(0,M.jsx)(z,{staySignedIn:c,setStaySignedIn:l,disabled:t})]})]}),d&&d.error_message&&(0,M.jsx)(`div`,{className:`text-red-500 text-xs`,children:_[d.error_message]??d.error_message}),(0,M.jsx)(u,{type:`submit`,className:`w-[320px]`,size:`sm`,isLoading:t,disabled:n===``||i===``||t,children:`Continue`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,M.jsx)(`span`,{className:`text-xs text-gray-500`,children:`Forgot your password? `}),(0,M.jsx)(R,{onClick:()=>{p(!0),f(null)},disabled:t,children:`Reset password`})]})]})})}function L({handleResetPassword:e,email:t,isInitial:n,setEmail:r,setResetPassword:i,error:a,setError:o}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`form`,{className:`flex flex-col gap-6 w-full items-center max-w-[320px]`,action:e,children:[(0,M.jsx)(`div`,{className:`flex flex-col gap-4 w-full`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 w-full`,children:[(0,M.jsx)(x,{htmlFor:`email`,className:`text-xs`,children:`Email address`}),(0,M.jsx)(b,{autoFocus:!0,id:`email`,placeholder:`Enter your email address`,className:`placeholder:text-gray-500`,type:`email`,value:t,onChange:e=>r(e.target.value)})]})}),a&&(0,M.jsx)(`div`,{className:`text-red-500 text-xs`,children:a.error_message}),(0,M.jsx)(u,{type:`submit`,className:`w-[320px]`,size:`sm`,disabled:t===``,children:n?`Send password link`:`Send reset link`})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-center gap-1`,children:[(0,M.jsx)(`span`,{className:`text-xs text-gray-500`,children:`Return to`}),(0,M.jsx)(R,{onClick:()=>{i(!1),o(null)},children:`Sign in`})]})]})}function R({children:e,onClick:t,disabled:n=!1}){return(0,M.jsx)(`span`,{onClick:()=>!n&&t(),className:l(`text-xs font-normal text-black cursor-pointer`,n&&`opacity-50 cursor-not-allowed`),children:e})}function z({staySignedIn:e,setStaySignedIn:t,disabled:n}){return(0,M.jsx)(k,{title:`Stay signed in for 30 days?`,id:`staySignedIn`,checked:e,onClick:()=>t(!e),labelClassName:`text-xs text-black`,disabled:n})}function B(){let e=n(),[t,r]=(0,A.useState)(``);return(0,A.useEffect)(()=>{let t=e.get(`token`),n=e.get(`stytch_token_type`);t&&n===`reset_password`&&r(t)},[e]),t?(0,M.jsx)(N,{}):(0,M.jsx)(F,{})}var V={default:B};export{V as export_33b4b2452f73};

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.