import{aI as r,b0 as U,az as B,t as E,hL as N,L as P,ao as e,aO as L,aF as R,aq as o,ap as k,bU as p,o as m,p as d,de as u,r as x,E as h}from"./app-k0jcl5PQ.js";import{C as A}from"./BRytmq3u.chunk.js";import{I as y,u as I}from"./DUZrD1tR.chunk.js";import"./BhAq_-86.chunk.js";import"./Bj7bJt_4.chunk.js";const w="_copyBtnContainer_1lh1l_1",S={copyBtnContainer:w},C="signUp.emailRecommendation",s=P.encloseNamespace(C);function D(i){const[j,c]=r.useState(!1),f=U(),a=B(y.inviteByType()),{links:n}=I(a.data),t=n==null?void 0:n[0];r.useEffect(()=>{!a.hasCompleted||t||f(y.createInviteLink()).catch(()=>E.throw(new N))},[a.hasCompleted,t]);function v(){c(!0),setTimeout(()=>c(!1),2e3),m.logUserAction({},{entity:h.User,actionType:x.Click,descriptor:u.CopyRecommendationEmail,location:d.PremiumFeatures})}function g(){m.logUserAction({},{entity:h.User,actionType:x.Click,descriptor:u.OpenRecommendationMailTo,location:d.PremiumFeatures})}const b=s("emailSubject"),l=s("emailBody",{inviteUrl:(t==null?void 0:t.inviteUrl)||""}),T=`mailto:?subject=${encodeURIComponent(b)}&body=${encodeURIComponent(l)}`;return e.jsx(L.Provider,{value:C,children:e.jsxs(R,{title:s("title"),closePopup:i.closePopup,size:"lg",showLoadingSpinner:!t,children:[t&&e.jsxs("div",{className:"d-flex flex-column gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-2",children:e.jsx(o,{phrase:"description"})}),e.jsx("p",{className:"mb-0",children:e.jsx(o,{phrase:"instructions"})})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"mb-3",children:[e.jsx(o,{phrase:"copyOrEmail"}),e.jsx("a",{href:T,className:"text-info text-decoration-underline",onClick:g,children:e.jsx(o,{phrase:"openEmailAppLink"})})]}),e.jsx("div",{children:e.jsx(A,{value:l,onCopy:v,copiedText:s("copied"),copyText:s("copy"),showCopiedText:j,styling:"normal-v2",extraButtonClassNames:k("position-absolute bottom-0 end-0",S.copyBtnContainer),label:s("emailTemplate"),textarea:!0,rows:22,textAreaClassName:"bg-light"})})]})]}),e.jsx(p,{children:e.jsx(p.Cancel,{variant:"link",onClick:i.closePopup,text:s("close")})})]})})}export{D as EmailRecommendationPopupView};
//# sourceMappingURL=D0bbB2g9.chunk.js.map
