1import{c as le,w as pe,h as he,r as m,l as je,j as e,B as n,C as j,p as g,s as b,k as f,F as ge,M as J,q as P,i as w}from"./index-3fSA15rf.js";import{u as S}from"./useMutation-CqCtjdiL.js";import{I as c}from"./input-CJMmY7wa.js";import{L as r}from"./label-C-ADY6aQ.js";import{T as be}from"./textarea-MQmD04zo.js";import{S as z}from"./separator-DYkjYBgB.js";import{B as k}from"./badge-n_ggYjUG.js";import{D as fe,a as Ne,b as ve,c as ye,f as we}from"./dialog-BFaGblhs.js";import{C as Se}from"./checkbox-D40WuLGn.js";import{i as C}from"./authUtils-CcDzk6i0.js";import{S as Ce,c as Z,d as G,F as X,Z as Te}from"./shared-layout-CxW78Bxg.js";import{A as Pe}from"./arrow-left-C7ylkW6I.js";import{U as ee}from"./user-BtnYZoTG.js";import{D as se,S as te}from"./shield-TJukN6C-.js";import{S as H}from"./save-SpRWz3uY.js";import{U as Fe}from"./upload-dopDR7iH.js";import{T as Ee}from"./trash-2-BWbQuuHF.js";import{C as ke}from"./clock-BTELmxf_.js";import"./index-D_C6Jsnd.js";import"./index-921pM2U0.js";import"./check-B9yb5PJO.js";import"./loader-circle-CkNtXJ5Y.js";import"./users-DG60jD-V.js";const Ae=le("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const ae=le("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);function ls(){const{user:l}=pe(),{toast:a}=he(),[R,O]=m.useState(!1),[i,d]=m.useState("profile"),[Me,Ue]=m.useState(!1),[ie,Y]=m.useState(!1),[N,B]=m.useState([]),[x,Q]=m.useState([]),[V,T]=m.useState(!1),[u,v]=m.useState({firstName:l?.firstName||"",lastName:l?.lastName||"",fullName:l?.fullName||"",jobTitle:l?.jobTitle||"",companyName:l?.companyName||"",email:l?.email||"",businessType:l?.businessType||"",teamSize:l?.teamSize||""}
1),[p,y]=m.useState({smtpHost:l?.smtpHost||"",smtpPort:l?.smtpPort||587,smtpSecure:l?.smtpSecure||!1,smtpUser:l?.smtpUser||"",smtpPass:l?.smtpPass||"",emailFrom:l?.emailFrom||l?.email||"",emailFromName:l?.emailFromName||`${l?.firstName||""} ${l?.lastName||""}`.trim()||""}),[F,K]=m.useState(l?.emailSignature||""),W=l?.subscriptionPlan==="pro"||l?.subscriptionPlan==="premium"||!!l?.stripeSubscriptionId,{data:A=[]}=je({queryKey:["/api/email-sequences"]}),re=S({mutationFn:async s=>(await w("POST","/api/contacts/import",{csvData:s})).json(),onSuccess:s=>{P.invalidateQueries({queryKey:["/api/contacts"]}),P.invalidateQueries({queryKey:["/api/dashboard/stats"]}),A.filter(o=>o.isActive).length>0&&s.contacts&&s.contacts.length>0?(B(s.contacts),Y(!0)):(a({title:"Import Complete",description:s.message||`${s.imported} contacts imported successfully.`}),s.errors&&s.errors.length>0&&setTimeout(()=>{a({title:"Import Warnings",description:`${s.errors.length} issues: ${s.errors[0]}`,variant:"destructive"})},1e3))},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}const t=s instanceof Error?s.message:"Failed to import contacts";a({title:"Import Failed",description:t.includes("must include")?t:"Failed to import contacts. Please check your CSV format.",variant:"destructive"})}}),M=S({mutationFn:async s=>(await w("PUT","/api/user/profile",s)).json(),onSuccess:()=>{a({title:"Profile Updated",description:"Your profile has been updated successfully."}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Update Failed",description:"Failed to update profile. Please try again.",variant:"destructive"})}}),U=S({mutationFn:async s=>(await w("PUT","/api/smtp-config",s)).json(),onSuccess:()=>{a({title:"Email Settings Updated",description:"Your SMTP configuration has been saved successfully."}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Update Failed",description:"Failed to update email settings. Please try again.",variant:"destructive"})}}),L=S({mutationFn:async()=>(await w("POST","/api/test-email",{})).json(),onSuccess:()=>{a({title:"Test Email Sent",description:"Check your inbox! Email was sent successfully."})},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Email Test Failed",description:"Failed to send test email. Check your SMTP settings.",variant:"destructive"})}}),D=S({mutationFn:async s=>(await w("PUT","/api/settings/signature",{emailSignature:s})).json(),onSuccess:()=>{a({title:"Signature Updated",description:"Your custom email signature has been saved successfully."}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Update Failed",description:"Failed to update email signature. Please try again.",variant:"destructive"})}}),I=S({mutationFn:async()=>(await w("DELETE","/api/user",{})).json(),onSuccess:()=>{a({title:"Account Deleted",description:"Your account and all data have been permanently deleted."}),setTimeout(()=>{window.location.href="/"},1e3)},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Delete Failed",description:"Failed to delete account. Please try again.",variant:"destructive"})}}),ne=()=>{window.confirm("Are you sure you want to delete your account? This action cannot be undone and will permanently delete all your data.")&&I.mutate()},q=S({mutationFn:async({contactIds:s,sequenceIds:t})=>{const o=t.flatMap(h=>s.map($=>w("POST",`/api/email-sequences/${h}/subscribers`,{contactId:$})));await Promise.all(o)},onSuccess:()=>{P.invalidateQueries({queryKey:["/api/email-sequences"]}),a({title:"Import & Enrollment Complete",description:x.length>0?`${N.length} contacts imported and enrolled in ${x.length} email sequence${x.length>
11?"s":""}.`:`${N.length} contacts imported successfully.`}),E()},onError:s=>{if(C(s)){a({title:"Unauthorized",description:"You are logged out. Logging in again...",variant:"destructive"}),setTimeout(()=>{window.location.href="/api/login"},500);return}a({title:"Error",description:"Failed to enroll contacts in email sequences.",variant:"destructive"})}}),ce=()=>{if(N.length>0&&x.length>0){const s=N.map(t=>t.id);q.mutate({contactIds:s,sequenceIds:x})}else a({title:"Import Complete",description:`${N.length} contacts imported successfully.`}),E()},E=()=>{Y(!1),B([]),Q([])},_=s=>{Q(t=>t.includes(s)?t.filter(o=>o!==s):[...t,s])},oe=s=>{const t=s.target.files?.[0];if(!t)return;if(!t.name.toLowerCase().endsWith(".csv")){a({title:"Invalid File Type",description:"Please upload a CSV file.",variant:"destructive"});return}O(!0);const o=new FileReader;o.onload=h=>{const $=h.target?.result;re.mutate($,{onSettled:()=>{O(!1),s.target.value=""}})},o.readAsText(t)},de=()=>{M.mutate(u)},me=()=>{U.mutate(p)},xe=()=>{L.mutate()},ue=async()=>{try{const s=await fetch("/api/contacts/export");if(!s.ok)throw new Error("Export failed");const t=await s.blob(),o=window.URL.createObjectURL(t),h=document.createElement("a");h.href=o,h.download=`hotleadhq-contacts-${new Date().toISOString().split("T")[0]}.csv`,document.body.appendChild(h),h.click(),window.URL.revokeObjectURL(o),document.body.removeChild(h),a({title:"Export Complete",description:"Your contacts have been exported successfully."})}catch{a({title:"Export Failed",description:"Failed to export contacts. Please try again.",variant:"destructive"})}};return(()=>{if(!l?.createdAt)return 14;const s=new Date(l.createdAt),o=Math.floor((new Date().getTime()-s.getTime())/(1e3*60*60*24));return Math.max(0,14-o)})(),e.jsxs(Ce,{currentPage:"settings",rightContent:e.jsx(e.Fragment,{}),children:[e.jsx("header",{className:"bg-white border-b border-slate-200 sticky top-0 z-40",children:e.jsxs("div",{className:"flex items-center justify-between px-6 py-4",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs("a",{href:"/",className:"flex items-center space-x-2",children:[e.jsx(Pe,{className:"w-4 h-4"}),e.jsx("span",{children:"Back to Dashboard"})]})}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center",children:e.jsx(Z,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"text-xl font-semibold text-slate-900",children:"Settings"})]})]}),e.jsx("div",{className:"flex items-center space-x-4"})]})}),e.jsxs("div",{className:"block md:hidden px-4 py-3 bg-white border-b border-slate-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"font-medium text-slate-900 capitalize",children:i==="profile"?"Profile":i==="import"?"Import/Export":i==="subscription"?"Subscription":i==="email"?"Email Setup":"Security"}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>T(!V),children:e.jsx(Z,{className:"w-4 h-4"})})]}),V&&e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsxs("button",{onClick:()=>{d("profile"),T(!1)},className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left text-sm ${i==="profile"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(ee,{className:"w-4 h-4"}),e.jsx("span",{children:"Profile"})]}),e.jsxs("button",{onClick:()=>{d("import"),T(!1)},className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left text-sm ${i==="import"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(se,{className:"w-4 h-4"}),e.jsx("span",{children:"Import/Export"})]}),e.jsxs("button",{onClick:()=>{d("subscription"),T(!1)},className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left text-sm ${i==="subscription"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(G,{className:"w-4 h-4"}),e.jsx("span",{children:"Subscription"})]}),e.jsxs("button",{onClick:()=>{d("email"),T(!1)},className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left text-sm ${i==="email"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(X,{className:"w-4 h-4"}),e.jsx("span",{children:"Email Setup"})]}),e.jsxs("button",{onClick:()=>{d("security"),T(!1)},className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left text-sm ${i==="security"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(te,{className:"w-4 h-4"}),e.jsx("span",{children:"Security"})]})]})]}),e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"hidden md:block w-64 bg-white border-r border-slate-200 min-h-screen",children:e.jsx("nav",{className:"p-6",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{onClick:()=>d("profile"),className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left ${i==="profile"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(ee,{className:"w-5 h-5"}),e.jsx("span",{children:"Profile"})]}),e.jsxs("button",{onClick:()=>d("import"),className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left ${i==="import"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(se,{className:"w-5 h-5"}),e.jsx("span",{children:"Import/Export"})]}),e.jsxs("button",{onClick:()=>d("subscription"),className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left ${i==="subscription"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(G,{className:"w-5 h-5"}),e.jsx("span",{children:"Subscription"})]}),e.jsxs("button",{onClick:()=>d("email"),className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left ${i==="email"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(X,{className:"w-5 h-5"}),e.jsx("span",{children:"Email Setup"})]}),e.jsxs("button",{onClick:()=>d("security"),className:`w-full flex items-center space-x-3 px-3 py-2 rounded-lg text-left ${i==="security"?"bg-blue-50 text-blue-600":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(te,{className:"w-5 h-5"}),e.jsx("span",{children:"Security"})]})]})})}),e.jsxs("div",{className:"flex-1 p-4 md:p-8",children:[i==="profile"&&e.jsx("div",{className:"space-y-6",children:e.jsxs(j,{children:[e.jsx(g,{children:e.jsx(b,{children:"Profile Information"})}),e.jsxs(f,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"firstName",children:"First Name"}),e.jsx(c,{id:"firstName",value:u.firstName,onChange:s=>v(t=>({...t,firstName:s.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"lastName",children:"Last Name"}),e.jsx(c,{id:"lastName",value:u.lastName,onChange:s=>v(t=>({...t,lastName:s.target.value}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"email",children:"Email Address"}),e.jsx(c,{id:"email",type:"email",value:u.email,disabled:!0,className:"bg-slate-50"})]}),e.jsxs("div",{className:"border-t border-slate-200 pt-6 mt-6",children:[e.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-4",children:"Email Signature Information"}),e.jsx("p",{className:"text-sm text-slate-600 mb-4",children:"This information will automatically populate in your email signatures for professional branding."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"fullName",children:"Professional Name"}),e.jsx(c,{id:"fullName",placeholder:"e.g. John Smith",value:u.fullName,onChange:s=>v(t=>({...t,fullName:s.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"jobTitle",children:"Job Title"}),e.jsx(c,{id:"jobTitle",placeholder:"e.g. Sales Manager",value:u.jobTitle,onChange:s=>v(t=>({...t,jobTitle:s.target.value}))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"companyName",children:"Company Name"}),e.jsx(c,{id:"companyName",placeholder:"e.g. Boro Dev Agency",value:u.companyName,onChange:s=>v(t=>({...t,companyName:s.target.value}))}),e.jsx("p",{className:"text-sm text-slate-500",children:"This will appear in your email signatures and welcome messages"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"businessType",children:"Business Type"}
1),e.jsx(c,{id:"businessType",value:u.businessType,onChange:s=>v(t=>({...t,businessType:s.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"teamSize",children:"Team Size"}),e.jsx(c,{id:"teamSize",value:u.teamSize,onChange:s=>v(t=>({...t,teamSize:s.target.value}))})]})]}),e.jsx("div",{className:"flex justify-end pt-4",children:e.jsxs(n,{onClick:de,disabled:M.isPending,className:"w-full md:w-auto",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),M.isPending?"Saving...":"Save Changes"]})})]})]})}),i==="import"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(j,{children:[e.jsxs(g,{children:[e.jsx(b,{children:"Import Contacts"}),e.jsx("p",{className:"text-slate-600",children:"Import your contacts from other CRMs using CSV files"})]}),e.jsxs(f,{className:"space-y-4",children:[e.jsxs("div",{className:"border-2 border-dashed border-slate-300 rounded-lg p-8 text-center",children:[e.jsx(Fe,{className:"w-12 h-12 text-slate-400 mx-auto mb-4"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-medium text-slate-900",children:"Upload CSV File"}),e.jsx("p",{className:"text-slate-600",children:"Supports HubSpot, Salesforce, and standard CSV formats"}),e.jsx("input",{type:"file",accept:".csv",onChange:oe,className:"hidden",id:"csv-upload"}),e.jsx("div",{className:"pt-4",children:e.jsx(n,{asChild:!0,disabled:R,children:e.jsx("label",{htmlFor:"csv-upload",className:"cursor-pointer",children:R?"Importing...":"Choose CSV File"})})})]})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"â Supported Formats"}),e.jsxs("div",{className:"text-sm text-blue-800 space-y-2",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"HubSpot:"})," First Name, Last Name, Email Address, Company Name, Phone Number"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Standard:"})," Name, Email, Company, Phone, Notes, Organization, Region, Address"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Alternative:"})," Contact Name, E-mail, Org, Client, Territory, Street Address"]}),e.jsx("div",{className:"text-blue-700 font-medium mt-2",children:"Only Email column is required. Names will be combined automatically."})]})]})]})]}),e.jsxs(j,{children:[e.jsxs(g,{children:[e.jsx(b,{children:"Export Contacts"}),e.jsx("p",{className:"text-slate-600",children:"Download your contacts as a CSV file"})]}),e.jsx(f,{children:e.jsxs(n,{onClick:ue,variant:"outline",children:[e.jsx(Ae,{className:"w-4 h-4 mr-2"}),"Export All Contacts"]})})]})]}),i==="email"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(j,{className:"border-2 border-blue-200 bg-gradient-to-br from-blue-50 to-indigo-50",children:[e.jsxs(g,{children:[e.jsxs(b,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(ae,{className:"w-6 h-6 text-blue-600"}),e.jsx("span",{className:"text-xl",children:"Professional Email Signature"})]}),!W&&e.jsx(k,{className:"bg-gradient-to-r from-purple-500 to-blue-500 text-white px-3 py-1",children:"Pro Feature"})]}),e.jsx("p",{className:"text-slate-700 text-lg",children:"Add a professional signature to all your automated emails and stand out from competitors"})]}),e.jsx(f,{children:W?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"emailSignature",className:"text-base font-medium",children:"Custom Email Signature (HTML supported)"}),e.jsx(be,{id:"emailSignature",placeholder:`Best regards, 2John Smith 3CEO, Company Name 4[email protected] 5(555) 123-4567`,value:F,onChange:s=>K(s.target.value),rows:8,className:"font-mono text-sm border-2 border-blue-200 focus:border-blue-400"}),e.jsx("p",{className:"text-sm text-slate-600",children:"HTML tags are supported. Use <br> for line breaks, <strong> for bold text, etc."})]}),e.jsxs("div",{className:"flex flex-col md:flex-row space-y-3 md:space-y-0 md:space-x-3",children:[e.jsxs(n,{onClick:()=>D.mutate(F),disabled:D.isPending,className:"bg-blue-600 hover:bg-blue-700 w-full md:w-auto",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),D.isPending?"Saving...":"Save Signature"]}),e.jsx(n,{variant:"outline",onClick:()=>K(""),className:"w-full md:w-auto",children:"Clear"})]}),F&&e.jsxs("div",{className:"mt-4 p-4 bg-white rounded-lg border-2 border-blue-200",children:[e.jsx("h4",{className:"text-base font-medium text-slate-900 mb-2",children:"Live Preview:"}),e.jsx("div",{className:"text-sm border rounded p-3 bg-slate-50",dangerouslySetInnerHTML:{__html:F}})]})]}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-20 h-20 bg-gradient-to-br from-purple-100 to-blue-100 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(ae,{className:"w-10 h-10 text-purple-600"})}),e.jsx("h3",{className:"text-2xl font-semibold text-slate-900 mb-4",children:"Professional Email Signatures"}),e.jsx("p",{className:"text-slate-700 mb-6 text-lg max-w-md mx-auto",children:"Create branded email signatures with HTML formatting that appear in all your automated emails, sequences, and notifications."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(n,{className:"bg-gradient-to-r from-purple-500 to-blue-500 hover:from-purple-600 hover:to-blue-600 text-lg px-8 py-3",children:"Upgrade to Pro - $12/month"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Includes unlimited email sequences, advanced analytics, and priority support"})]})]})})]}),e.jsxs(j,{children:[e.jsxs(g,{children:[e.jsx(b,{children:"Professional Email Setup"}),e.jsx("p",{className:"text-slate-600",children:"Connect your business email service for automated sequences and professional delivery"})]}),e.jsxs(f,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium text-slate-900",children:"Email Identity"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"emailFrom",children:"From Email Address"}),e.jsx(c,{id:"emailFrom",type:"email",placeholder:"[email protected]",value:p.emailFrom,onChange:s=>y(t=>({...t,emailFrom:s.target.value}))}),e.jsx("p",{className:"text-sm text-slate-500",children:"Your professional business email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"emailFromName",children:"From Name"}),e.jsx(c,{id:"emailFromName",placeholder:"Your Name",value:p.emailFromName,onChange:s=>y(t=>({...t,emailFromName:s.target.value}))}),e.jsx("p",{className:"text-sm text-slate-500",children:"Name shown to recipients"})]})]})]}),e.jsx(z,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-medium text-slate-900",children:"SMTP Configuration"}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 mb-2",children:"â Popular Email Services"}),e.jsxs("div",{className:"text-sm text-blue-800 space-y-2",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Gmail Business:"})," smtp.gmail.com, Port 587, Enable TLS"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Outlook/Hotmail:"})," smtp-mail.outlook.com, Port 587, Enable TLS"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Office 365:"})," smtp.office365.com, Port 587, Enable TLS"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"smtpHost",children:"SMTP Server"}),e.jsx(c,{id:"smtpHost",placeholder:"smtp.gmail.com",value:p.smtpHost,onChange:s=>y(t=>({...t,smtpHost:s.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"smtpPort",children:"Port"}),e.jsx(c,{id:"smtpPort",type:"number",placeholder:"587",value:p.smtpPort,onCh
5ange:s=>y(t=>({...t,smtpPort:parseInt(s.target.value)||587}))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"smtpUser",children:"Username"}),e.jsx(c,{id:"smtpUser",type:"email",placeholder:"[email protected]",value:p.smtpUser,onChange:s=>y(t=>({...t,smtpUser:s.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"smtpPass",children:"Password/App Password"}),e.jsx(c,{id:"smtpPass",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢",value:p.smtpPass,onChange:s=>y(t=>({...t,smtpPass:s.target.value}))}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-slate-500",children:"Use an app-specific password for Gmail and Outlook"}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("a",{href:"https://myaccount.google.com/apppasswords",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:text-blue-800 underline",children:"Gmail App Passwords â"}),e.jsx("a",{href:"https://account.microsoft.com/security/app-passwords",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:text-blue-800 underline",children:"Outlook App Passwords â"})]})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"smtpSecure",checked:p.smtpSecure,onChange:s=>y(t=>({...t,smtpSecure:s.target.checked})),className:"rounded"}),e.jsx(r,{htmlFor:"smtpSecure",children:"Use TLS/SSL (recommended for port 587)"})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-between pt-4 space-y-3 md:space-y-0 md:space-x-3",children:[e.jsx(n,{variant:"outline",onClick:xe,disabled:L.isPending||!p.smtpHost,className:"w-full md:w-auto",children:L.isPending?"Testing...":"Send Test Email"}),e.jsxs(n,{onClick:me,disabled:U.isPending,className:"w-full md:w-auto",children:[e.jsx(H,{className:"w-4 h-4 mr-2"}),U.isPending?"Saving...":"Save SMTP Settings"]})]})]})]}),e.jsxs(j,{children:[e.jsx(g,{children:e.jsx(b,{children:"Email Service Setup Guides"})}),e.jsx(f,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"border rounded-lg p-4 bg-blue-50 border-blue-200",children:[e.jsx("h4",{className:"font-medium mb-3 text-blue-900",children:"Gmail Setup Instructions"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"bg-white rounded p-3 border border-blue-200",children:[e.jsx("h5",{className:"font-medium text-blue-800 mb-2",children:"Step 1: Enable 2-Factor Authentication"}),e.jsx("p",{className:"text-slate-600 mb-2",children:"Required before generating app passwords."}),e.jsx("p",{className:"text-xs text-slate-500",children:"Google Account â Security â 2-Step Verification â Turn On"})]}),e.jsxs("div",{className:"bg-white rounded p-3 border border-blue-200",children:[e.jsx("h5",{className:"font-medium text-blue-800 mb-2",children:"Step 2: Generate App Password"}),e.jsx("p",{className:"text-slate-600 mb-2",children:"Create a 16-character password for HotLeadHQ."}),e.jsxs("div",{className:"text-xs text-slate-500 space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Direct Link:"})," ",e.jsx("a",{href:"https://myaccount.google.com/apppasswords",target:"_blank",className:"text-blue-600 underline font-medium",children:"myaccount.google.com/apppasswords"})]}),e.jsx("p",{children:'Select "Mail" as the app type and click "Generate"'}),e.jsxs("p",{children:[e.jsx("strong",{children:"Can't access?"})," Enable 2-step verification first in Google Account security settings"]})]})]}),e.jsxs("div",{className:"bg-white rounded p-3 border border-blue-200",children:[e.jsx("h5",{className:"font-medium text-blue-800 mb-2",children:"Step 3: Enter Settings"}),e.jsxs("ul",{className:"text-slate-600 space-y-1 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"SMTP Server:"})," smtp.gmail.com"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Port:"})," 587"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Security:"})," STARTTLS (not SSL)"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Username:"})," Your full Gmail address"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Password:"})," The 16-character app password"]})]})]}),e.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded p-3",children:e.jsxs("p",{className:"text-amber-800 text-xs",children:[e.jsx("strong",{children:"Important:"})," Use the app password, not your regular Gmail password. Regular passwords won't work for SMTP."]})})]})]}),e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium mb-2",children:"Outlook Business"}),e.jsxs("ul",{className:"text-sm text-slate-600 space-y-1",children:[e.jsx("li",{children:"1. Enable SMTP AUTH"}),e.jsx("li",{children:"2. Use account password"}),e.jsx("li",{children:"3. Test connection"})]})]}),e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium mb-2",children:"Custom SMTP"}),e.jsxs("ul",{className:"text-sm text-slate-600 space-y-1",children:[e.jsx("li",{children:"1. Get SMTP details from host"}),e.jsx("li",{children:"2. Enter server settings"}),e.jsx("li",{children:"3. Test configuration"})]})]})]})})]}),e.jsxs(j,{children:[e.jsx(g,{children:e.jsx(b,{children:"Common Issues & Solutions"})}),e.jsx(f,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-red-800 mb
5-2",children:'Gmail: "Wrong version number" SSL Error'}),e.jsx("p",{className:"text-sm text-red-700 mb-2",children:"This happens when using SSL instead of STARTTLS for port 587."}),e.jsxs("p",{className:"text-xs text-red-600",children:[e.jsx("strong",{children:"Solution:"}),' Make sure "Use SSL" is unchecked for port 587. Gmail uses STARTTLS, not direct SSL.']})]}),e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-red-800 mb-2",children:'Gmail: "Invalid credentials" Error'}),e.jsx("p",{className:"text-sm text-red-700 mb-2",children:"Your regular Gmail password won't work for SMTP."}),e.jsxs("p",{className:"text-xs text-red-600",children:[e.jsx("strong",{children:"Solution:"})," Generate an App Password in your Google Account security settings and use that instead."]})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-800 mb-2",children:`Can't Find "App Passwords" in Google?`}),e.jsxs("div",{className:"text-sm text-blue-700 space-y-2",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"â
Working Link:"})," ",e.jsx("a",{href:"https://myaccount.google.com/apppasswords",target:"_blank",className:"text-blue-600 underline font-medium",children:"myaccount.google.com/apppasswords"})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"If link doesn't work:"})," Enable 2-step verification first in Google Account â Security"]}),e.jsxs("p",{className:"text-xs text-blue-600",children:[e.jsx("strong",{children:"Note:"})," Some business accounts may have this disabled by admin"]})]})]}),e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-yellow-800 mb-2",children:"Test Email Not Arriving"}),e.jsx("p",{className:"text-sm text-yellow-700 mb-2",children:"Email might be delayed or in spam folder."}),e.jsxs("p",{className:"text-xs text-yellow-700",children:[e.jsx("strong",{children:"Solution:"}),' Wait 2-3 minutes, check spam folder, verify the "From" email address is correct.']})]})]})})]})]}),i==="subscription"&&e.jsx("div",{className:"space-y-6",children:e.jsxs(j,{children:[e.jsx(g,{children:e.jsx(b,{children:"Current Plan"})}),e.jsx(f,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Current Plan"}),e.jsx("p",{className:"text-slate-600",children:"Free plan with basic CRM features"})]}),e.jsx(k,{variant:"secondary",children:"Free"})]}),e.jsx(z,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Plan Features:"}),e.jsxs("ul",{className:"space-y-2 text-sm text-slate-600",children:[e.jsx("li",{children:"⢠Contact management"}),e.jsx("li",{children:"⢠Basic dashboard"}),e.jsx("li",{children:"⢠Settings customization"}),e.jsx("li",{children:"⢠Essential CRM tools"})]}),e.jsxs("div",{className:"pt-4",children:[e.jsxs(n,{className:"w-full md:w-auto md:min-w-[200px]",onClick:()=>window.location.href="/billing",children:[e.jsx(G,{className:"w-4 h-4 mr-2"}),"Upgrade to Pro - $12/month"]}),e.jsx("p",{className:"text-sm text-slate-500 text-center mt-2",children:"Unlimited contacts, advanced automation, priority support"})]})]})]})})]})}),i==="security"&&e.jsx("div",{className:"space-y-6",children:e.jsxs(j,{children:[e.jsx(g,{children:e.jsx(b,{children:"Account Security"})}),e.jsx(f,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:"Authentication"}),e.jsx("p",{className:"text-sm text-slate-600",children:"Managed by Replit Auth"})]}),e.jsx(k,{variant:"secondary",children:"Secure"})]}),e.jsx(z,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium text-red-600",children:"Danger Zone"}),e.jsx("div",{className:"border border-red-200 rounded-lg p-4 bg-red-50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h5",{className:"font-medium text-red-900",children:"Delete Account"}),e.jsx("p",{className:"text-sm text-red-700",children:"Permanently delete your account and all data"})]}),e.jsxs(n,{variant:"destructive",size:"sm",onClick:ne,disabled:I.isPending,children:[e.jsx(Ee,{className:"w-4 h-4 mr-2"}),I.isPending?"Deleting...":"Delete Account"]})]})})]})]})})]})})]})]}),e.jsx(fe,{open:ie,onOpenChange:E,children:e.jsxs(Ne,{className:"max-w-lg mx-4 max-h-[85vh] flex flex-col",children:[e.jsx(ve,{children:e.jsxs(ye,{className:"flex items-center space-x-2",children:[e.jsx(ge,{className:"w-5 h-5 text-blue-600"}),e.jsx("span",{children:"Add Imported Contacts to Email Sequences?"})]})}),e.jsxs("div",{className:"space-y-4 py-4 flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-blue-50 rounded-lg",children:[e.jsx(Te,{className:"w-5 h-5 text-blue-600 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:"Automate Your Follow-up"}),e.jsxs("p",{className:"text-sm text-slate-600 mt-1",children:["Enroll your ",N.length," newly imported contacts in email sequences to automatically nurture these leads with personalized follow-ups."]})]})]}),A.filter(s=>s.isActive).length>0?e.jsxs("div",{className:"space-y-3",children:[e.jsx(r,{className:"text-sm font-medium",children:"Select Email Sequences:"}),A.filter(s=>s.isActive).map(s=>e.jsxs("div",{className:"flex items-start space-x-3 p-3 border rounded-lg hover:bg-slate-50 cursor-pointer",onClick:()=>
5_(s.id),children:[e.jsx(Se,{checked:x.includes(s.id),onCheckedChange:()=>_(s.id)}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-1",children:[e.jsx("h4",{className:"font-medium text-slate-900",children:s.name}),e.jsx(k,{variant:"default",className:"text-xs",children:"Active"})]}),e.jsx("p",{className:"text-sm text-slate-600 mb-2",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 text-xs text-slate-500",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(J,{className:"w-3 h-3 mr-1"}),s.emails?.length||0," emails"]}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(ke,{className:"w-3 h-3 mr-1"}),s.emails?.[0]?.delayDays===0?"Starts immediately":`Starts in ${s.emails?.[0]?.delayDays} days`]})]})]})]},s.id))]}):e.jsxs("div",{className:"text-center py-6 text-slate-500",children:[e.jsx(J,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No active email sequences available."})]})]}),e.jsxs(we,{className:"flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-2",children:[e.jsx(n,{variant:"outline",onClick:E,className:"w-full sm:w-auto",children:"Skip for Now"}),e.jsx(n,{onClick:ce,disabled:q.isPending,className:"w-full sm:w-auto",children:q.isPending?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Enrolling..."]}):x.length>0?`Enroll ${N.length} Contacts in ${x.length} Sequence${x.length>1?"s":""}`:"Complete Import Without Sequences"})]})]})})]})}export{ls as default};
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.