1import{d as V,E as D,e as R,a as I,F as c}from"./index-GiHDugGH.js";import{E as L}from"./ExternalLayout-8-taqQHA.js";import{a as O}from"./forms-DbZs24wT.js";import{z as P,r as M,c as u,M as y,N as d,P as t,Q as v,O as x,T,R as b,u as i,bs as B,S as j,I as w,K as _}from"./ant-design-vue-DQtSHzVW.js";import"./emissionsReports-V3As6lF2.js";import"./maths-Dbctc4B3.js";import"./numbers-B-ZQyCwX.js";import"./permissions-PFGx88eG.js";import"./linkedFarms-DtTb1aYn.js";import"./flatten-DFre9WrJ.js";import"./_baseSet-DU_54zF-.js";import"./check-BzF5mc4e.js";import"./errors-PVaTgFi3.js";const F={class:"flex flex-col gap-16"},W={class:"b-solid b-1 b-rumi-grey-500 border-rd-lg bg-rumi-grey-300 flex flex-col gap-2 p-4"},oe=P({__name:"VerifyEmail",setup($){const h=I(),{logout:E}=V(),{isSendingVerificationEmail:a,sendVerificationEmail:S}=D(),{profile:n,isFetchingProfile:C}=R(),{timestamp:A}=O(1e3),r=M(Date.now()+c*1e3),m=u(()=>Math.max(0,Math.ceil((r.value-A.value)/1e3))),f=u(()=>m.value>0),p=u(()=>!n.value||a.value||f.value);async function k(){(await E()).success&&await h.push("/login")}async function N(){if(!n.value||p.value)return;r.value=Date.now()+c*1e3;const s=await S({email:n.value.email});if(!s.success){const e=s.error,l=typeof e=="object"&&e!==null&&"code"in e?e.code:e,o=typeof e=="object"&&e!==null&&"context"in e?e.context:void 0,g=typeof o=="object"&&o!==null&&"retryAfterSeconds"in o&&typeof o.retryAfterSeconds=="number"?Math.ceil(o.retryAfterSeconds):c;l==="RATE_LIMITED"?(r.value=Date.now()+g*1e3,w.warning({message:"Please wait before resending",description:`Please wait ${g} seconds before requesting another verification email.`})):w.error({message:"Failed to send verification email",description:"Something went wrong while attempting to send the verification email. Please try again later."})}}return(s,e)=>{const l=x("AButton"),o=x("a-flex");return _(),y(L,null,{default:d(()=>[t("div",F,[e[2]||(e[2]=t("div",{class:"flex flex-col"},[t("h2",null,"Verify your email address"),t("p",{class:"text-rumi-grey-650 text-sm"}," We've sent you an email with a verification link. Please check your inbox, and click the link to verify your email address and continue. ")],-1)),t("div",W,[e[0]||(e[0]=t("p",{class:"text-rumi-grey-650 text-sm"}," Didn't get the email? Check your spam folder, or click resend below. ",-1)),v(o,null,{default:d(()=>[v(l,{disabled:p.value,onClick:N},{default:d(()=>[!i(n)||i(a)?(_(),y(i(B),{key:0,spin:""})):T("",!0),b(" "+j(i(C)?"Loading...":i(a)?"Sending...":f.value?`Resend available in ${m.value}s`:"Resend"),1)]),_:1},8,["disabled"])]),_:1})]),t("div",{class:"flex flex-col gap-2"},[t("p",{class:"text-rumi-grey-600 text-sm"},[e[1]||(e[1]=b(" Not sure why you're here? ",-1)),t("span",{class:"text-rumi-jungle-green-700 cursor-pointer underline",onClick:k}," Return to login. ")])])])]),_:1})}}});
1export{oe as default}; 2//# sourceMappingURL=VerifyEmail-BS6VRAzm.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.