PageSourceSearch

https://dhruvabhattacharya.github.io/assets/VisitorTracker-C_4HGt4g.js

js dhruvabhattacharya.github.io collected 2026-10-03 08:59:53 UTC 18,677 bytes, 1 lines download raw bytes

1import{j as e}from"./index-B-TFSi6j.js";import{a as i,X as L,j as V,y,o as F,D as W}from"./vendor-icons-Da6FAH5J.js";import"./vendor-react-BD48cO2N.js";function ee(){const[c,C]=i.useState(null),[w,_]=i.useState(""),[k,T]=i.useState(""),[E,P]=i.useState("Recruiter / Hiring Manager"),[U,v]=i.useState(!1),[j,I]=i.useState(!1),[$,N]=i.useState(!1),[h,S]=i.useState([]),[K,J]=i.useState(!1),[Y,z]=i.useState(!1),[q,H]=i.useState(()=>sessionStorage.getItem("dhruva_visitor_prompt_dismissed")==="true"),M=()=>{const t=navigator.userAgent;let s="Unknown Browser",o="Unknown OS";t.includes("Firefox/")?s=`Firefox ${t.split("Firefox/")[1]?.split(" ")[0]||""}`:t.includes("Edg/")?s=`Edge ${t.split("Edg/")[1]?.split(" ")[0]||""}`:t.includes("Chrome/")?s=`Chrome ${t.split("Chrome/")[1]?.split(" ")[0]||""}`:t.includes("Safari/")&&!t.includes("Chrome")?s=`Safari ${t.split("Version/")[1]?.split(" ")[0]||""}`:(t.includes("OPR/")||t.includes("Opera/"))&&(s="Opera"),t.includes("Win")?o="Windows":t.includes("Macintosh")||t.includes("Mac OS")?o="macOS":t.includes("iPhone")||t.includes("iPad")?o="iOS":t.includes("Android")?o="Android":t.includes("Linux")&&(o="Linux");const a=window.screen.width,n=window.screen.height,m=(r,l)=>l===0?r:m(l,r%l),d=m(a,n),b=Math.round(a/d),f=Math.round(n/d),x=`${b}:${f}`;let u="Desktop";return/Mobi|Android/i.test(t)&&(u="Mobile"),/iPad|Tablet/i.test(t)&&(u="Tablet"),{browser:s.trim(),os:o,deviceType:u,screenResolution:`${a}x${n}`,aspectRatio:x,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",language:navigator.language||"en",platform:navigator.platform||"unknown",referrer:document.referrer||"Direct Visit"}},A=async(t,s=!1)=>{try{const o="https://formsubmit.co/ajax/[email protected]",a=(f,x=80)=>String(f||"").replace(/<[^>]*>?/gm,"").replace(/[<>"'`\r\n\t]/g," ").trim().slice(0,x),n=a(t.name,60)||"Anonymous Visitor",m=a(t.company,60)||"Not Specified",d=a(t.role,60)||(s?"Recruiter / Hiring Manager":"General Visitor"),b={_subject:s?`🎯 Recruiter Check-In: ${n} (${m}) visited Portfolio 2.0`:`👀 New Visitor Alert: ${a(t.client?.browser,40)||"Browser"} on ${a(t.client?.os,30)||"OS"} (${a(t.client?.deviceType,20)||"Device"})`,_template:"table",_captcha:"false","Visitor Name":n,"Company / Org":m,"Role / Intent":d,"Browser & Version":a(t.client?.browser,50)||"Unknown","Operating System":a(t.client?.os,30)||"Unknown","Device Type":a(t.client?.deviceType,20)||"Desktop","Screen Resolution":a(t.client?.screenResolution,30)||"Unknown","Screen Aspect Ratio":a(t.client?.aspectRatio,20)||"Unknown",Timezone:a(t.client?.timezone,40)||"Unknown","Visit Count":Number(t.visitCount)||1,Timestamp:a(t.displayTime,40)||new Date().toLocaleString(),Referrer:a(t.client?.referrer,100)||"Direct Visit"};await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(b)})}catch{}};i.useEffect(()=>{const t=M(),s=localStorage.getItem("dhruva_portfolio_visitor"),o=JSON.parse(localStorage.getItem("dhruva_visitor_ledger")||"[]"),a=parseInt(localStorage.getItem("dhruva_visit_count")||"0",10)+1;localStorage.setItem("dhruva_visit_count",a.toString());const n=(t.referrer||"").toLowerCase().includes("linkedin"),m=!!(s||n),d={id:"vis_"+Date.now(),timestamp:new Date().toISOString(),displayTime:new Date().toLocaleString(),client:t,visitCount:a,name:s?JSON.parse(s).name:"Anonymous Visitor",company:s?JSON.parse(s).company:"",role:s?JSON.parse(s).role:n?"LinkedIn Recruiter":"General Visitor",category:m?"RECRUITER":"GENERAL",status:"AUTO_ACCEPTED"};if(C(d),S(o),s){const r=JSON.parse(s);_(r.name||""),T(r.company||""),P(r.role||""),I(!0)}const b=setTimeout(()=>{J(!0)},1e4),f=setTimeout(()=>{sessionStorage.getItem("dhruva_visit_email_dispatched")||(A(d,!1),sessionStorage.setItem("dhruva_visit_email_dispatched","true"))},15e3),x=()=>{const r=window.innerHeight,l=window.scrollY,g=document.documentElement.scrollHeight;l+r>=g-650&&z(!0)};window.addEventListener("scroll",x,{passive:!0}),x(),window.getPortfolioVisitors=()=>{const r=JSON.parse(localStorage.getItem("dhruva_visitor_ledger")||"[]");return console.table(r),r},window.getPortfolioVisitorsSummary=()=>{const r=JSON.parse(localStorage.getItem("dhruva_visitor_ledger")||"[]"),l=r.length,g=r.filter(p=>p.category==="RECRUITER"||p.company),R=r.filter(p=>
1p.category!=="RECRUITER"&&!p.company),D=[...new Set(g.map(p=>p.company).filter(Boolean))];return console.log("%c🎯 Dhruva Portfolio Visitor Intelligence Summary","color: #06b6d4; font-size: 14px; font-weight: bold;"),console.log(`Total Tracked Visits: ${l}`),console.log(`Recruiters & Hiring Leads: ${g.length} (${l?Math.round(g.length/l*100):0}%)`),console.log(`General / Casual Visitors: ${R.length} (${l?Math.round(R.length/l*100):0}%)`),console.log("Top Organizations:",D),console.log("All Requests Status: AUTO-ACCEPTED (100%)"),console.table(r),{total:l,recruiters:g.length,casual:R.length,companies:D,logs:r}};const u=r=>{r.ctrlKey&&r.shiftKey&&r.key.toLowerCase()==="v"&&N(l=>!l)};return window.addEventListener("keydown",u),()=>{clearTimeout(b),clearTimeout(f),window.removeEventListener("scroll",x),window.removeEventListener("keydown",u)}},[]),i.useEffect(()=>{},[]);const B=t=>{t&&t.preventDefault();const s=w.replace(/[<>]/g,"").trim().slice(0,80)||"Recruiter Guest",o=k.replace(/[<>]/g,"").trim().slice(0,80)||"Hiring Organization",a={name:s,company:o,role:E};localStorage.setItem("dhruva_portfolio_visitor",JSON.stringify(a));const n={...c,name:s,company:o,role:E,category:"RECRUITER",status:"AUTO_ACCEPTED"},m=JSON.parse(localStorage.getItem("dhruva_visitor_ledger")||"[]"),d=[n,...m.slice(0,49)];localStorage.setItem("dhruva_visitor_ledger",JSON.stringify(d)),A(n,!0),C(n),S(d),I(!0),v(!1)},O=()=>{if(v(!1),H(!0),sessionStorage.setItem("dhruva_visitor_prompt_dismissed","true"),!j&&c){const t=JSON.parse(localStorage.getItem("dhruva_visitor_ledger")||"[]"),s=[c,...t.slice(0,49)];localStorage.setItem("dhruva_visitor_ledger",JSON.stringify(s)),S(s)}},G=()=>{const t="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(h,null,2)),s=document.createElement("a");s.setAttribute("href",t),s.setAttribute("download",`dhruva_portfolio_visitors_${Date.now()}.json`),document.body.appendChild(s),s.click(),s.remove()};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed bottom-4 sm:bottom-6 left-4 sm:left-6 z-40",children:e.jsxs("button",{onClick:()=>j?N(!0):v(!0),className:"flex items-center gap-2.5 px-4 py-2 rounded-full bg-white/95 dark:bg-slate-900/90 hover:bg-slate-50 dark:hover:bg-slate-800 border border-slate-200 dark:border-slate-700/80 shadow-lg hover:shadow-xl backdrop-blur-md text-xs font-mono text-slate-700 dark:text-slate-300 hover:text-cyan-600 dark:hover:text-cyan-400 transition-all group",title:"Click to view visitor intelligence & check-in (Ctrl+Shift+V)",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-cyan-500 dark:bg-cyan-400 animate-pulse"}),j?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"font-semibold text-slate-900 dark:text-slate-100",children:["Hi, ",w]}),k&&e.jsxs("span",{className:"text-slate-500",children:["(",k,")"]})]}):e.jsx("span",{className:"font-medium",children:"👋 Visiting? Check in"}),e.jsxs("span",{className:"text-[10px] text-slate-400 dark:text-slate-500 group-hover:text-slate-600 dark:group-hover:text-slate-400",children:["• ",c?.client?.browser?.split(" ")[0]||"Browser"]})]})}),U&&e.jsx("div",{className:"fixed inset-0 z-[110] flex items-end sm:items-center justify-center p-4 sm:p-6 pb-6 sm:pb-6 bg-black/60 backdrop-blur-md animate-in fade-in duration-200",children:e.jsxs("div",{className:"relative w-full max-w-lg rounded-3xl bg-white dark:bg-[#1c1c1e] border border-black/[0.08] dark:border-white/[0.12] shadow-2xl p-6 sm:p-8 space-y-5 sm:space-y-6 animate-in slide-in-from-bottom-6 sm:zoom-in-95 duration-200",children:[e.jsx("button",{onClick:O,className:"absolute top-5 right-5 sm:top-6 sm:right-6 p-2 rounded-full bg-black/[0.04] hover:bg-black/[0.08] dark:bg-white/[0.08] dark:hover:bg-white/[0.14] text-slate-500 hover:text-slate-900 dark:text-slate-400 dark:hover:text-white transition-colors","aria-label":"Close modal",children:e.jsx(L,{className:"w-4 h-4 sm:w-4.5 sm:h-4.5"})}),e.jsxs("div",{className:"flex items-center gap-3 sm:gap-3.5 pr-8",children:[e.jsx("div",{className:"p-3 rounded-2xl bg-[#0071e3]/10 border border-[#0071e3]/20 text-[#0071e3] dark:text-cyan-400 shrink-0",children:e.jsx(V,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-base sm:text-lg font-bold text-slate-900 dark:text-white leading-tight tracking-tight",children:"Welcome to Dhruva's Portfolio"}),e.jsx("p",{className:"text-xs sm:text-[13px] text-slate-500 dark:text-[#86868b] mt-0.5",children:"Reviewing candidate profile? Say hello!"})]})]}),e.jsxs("div",{className:"px-4 py-3 sm:px-4.5 sm:py-3.5 rounded-2xl bg-emerald-500/10 border border-emerald-500/20 text-xs sm:text-[13px] text-emerald-800 dark:text-emerald-300 font-mono flex items-start gap-2.5 sm:gap-3 leading-relaxed",children:[e.jsx(y,{className:"w-4 h-4 text-emerald-600 dark:text-emerald-400 shrink-0 mt-0.5"}),e.jsx("span",{children:"Auto-Accept Guarantee: All check-ins and meeting requests are instantly confirmed & priority acknowledged."})]}
1),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 dark:text-[#a1a1a6] leading-relaxed",children:"If you're visiting from a recruitment team or engineering org, leave your name so Dhruva knows who reviewed his work:"}),e.jsxs("form",{onSubmit:B,className:"space-y-4 text-xs sm:text-sm font-mono",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-700 dark:text-slate-400 font-medium mb-1.5",children:"Your Name"}),e.jsx("input",{type:"text",placeholder:"e.g. Alex Rivera",maxLength:80,value:w,onChange:t=>_(t.target.value),className:"w-full px-4 py-2.5 sm:py-3 rounded-xl bg-black/[0.02] dark:bg-white/[0.04] border border-black/[0.08] dark:border-white/[0.1] text-slate-900 dark:text-slate-100 focus:border-[#0071e3] dark:focus:border-cyan-400 focus:bg-white dark:focus:bg-black/50 focus:outline-none placeholder-slate-400 transition-colors",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-slate-700 dark:text-slate-400 font-medium mb-1.5",children:"Company / Organization"}),e.jsx("input",{type:"text",placeholder:"e.g. Google, Microsoft, Tech Startup",maxLength:80,value:k,onChange:t=>T(t.target.value),className:"w-full px-4 py-2.5 sm:py-3 rounded-xl bg-black/[0.02] dark:bg-white/[0.04] border border-black/[0.08] dark:border-white/[0.1] text-slate-900 dark:text-slate-100 focus:border-[#0071e3] dark:focus:border-cyan-400 focus:bg-white dark:focus:bg-black/50 focus:outline-none placeholder-slate-400 transition-colors"})]}),e.jsxs("div",{className:"px-4 py-2.5 sm:py-3 rounded-xl bg-black/[0.02] dark:bg-white/[0.03] border border-black/[0.06] dark:border-white/[0.06] text-[11px] sm:text-xs text-slate-500 dark:text-[#86868b] flex items-center justify-between",children:[e.jsxs("span",{children:["Detected: ",c?.client?.browser," on ",c?.client?.os]}),e.jsxs("span",{className:"text-[#0071e3] dark:text-cyan-400 font-semibold",children:[c?.client?.screenResolution," (",c?.client?.aspectRatio,")"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 pt-2 sm:pt-3",children:[e.jsxs("button",{type:"submit",className:"flex-1 py-3 px-5 rounded-full bg-[#0071e3] hover:bg-[#0077ed] text-white font-medium text-xs sm:text-sm flex items-center justify-center gap-2 transition-all shadow-md hover:shadow-lg active:scale-95",children:[e.jsx(y,{className:"w-4 h-4 text-white shrink-0"}),e.jsx("span",{children:"Auto-Accept & Check In"})]}),e.jsx("button",{type:"button",onClick:O,className:"px-5 py-3 rounded-full bg-black/[0.04] hover:bg-black/[0.08] text-slate-700 dark:bg-white/[0.08] dark:hover:bg-white/[0.12] dark:text-slate-300 text-xs sm:text-sm font-medium transition-all active:scale-95 text-center",children:"Browse Anonymously"})]})]})]})}),$&&e.jsx("div",{className:"fixed inset-0 z-[130] flex items-center justify-center p-4 sm:p-6 bg-slate-950/70 backdrop-blur-md animate-in fade-in duration-200",children:e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[85vh] rounded-3xl bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-700 shadow-2xl p-6 sm:p-8 flex flex-col space-y-4 sm:space-y-5 animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"flex items-center justify-between pb-3 sm:pb-4 border-b border-slate-200 dark:border-slate-800",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:"w-5 h-5 text-cyan-600 dark:text-cyan-400 shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base sm:text-lg font-bold text-slate-900 dark:text-white",children:"Visitor Intelligence Ledger"}),e.jsx("p",{className:"text-xs text-slate-600 dark:text-slate-400 font-mono mt-0.5",children:"Consolidated telemetry across N visitors (Recruiter vs Casual classification)"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:G,className:"py-2 px-3 rounded-xl bg-slate-100 hover:bg-slate-200 text-slate-700 dark:bg-slate-800 dark:hover:bg-slate-700 dark:text-slate-300 text-xs font-mono flex items-center gap-1.5 transition-colors",title:"Export Visitor Logs",children:[e.jsx(W,{className:"w-3.5 h-3.5 text-cyan-600 dark:text-cyan-400"}),e.jsx("span",{children:"Export"})]}),e.jsx("button",{onClick:()=>N(!1),className:"p-2 rounded-xl bg-slate-100 hover:bg-slate-200 text-slate-500 hover:text-slate-900 dark:bg-slate-800 dark:text-slate-400 dark:hover:text-white transition-colors",children:e.jsx(L,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"px-4 py-3 sm:px-4.5 sm:py-3.5 rounded-2xl bg-cyan-500/10 border border-cyan-500/30 flex flex-wrap items-center justify-between gap-3 text-xs font-mono",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(V,{className:"w-4 h-4 text-cyan-600 dark:text-cyan-400 shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-bold text-slate-900 dark:text-white",children:"Consolidated Telemetry: "}),e.jsxs("span",{className:"text-cyan-700 dark:text-cyan-300 font-semibold",children:[h.filter(t=>t.category==="RECRUITER"||t.company).length," Recruiters"]}
1),e.jsx("span",{className:"text-slate-400",children:" • "}),e.jsxs("span",{className:"text-slate-700 dark:text-slate-300",children:[h.filter(t=>t.category!=="RECRUITER"&&!t.company).length," Casual Visitors"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-emerald-500/15 border border-emerald-500/30 text-emerald-700 dark:text-emerald-400 text-[11px] font-bold",children:[e.jsx(y,{className:"w-3 h-3"}),e.jsx("span",{children:"Auto-Accept All: Active"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2.5 text-xs font-mono",children:[e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800",children:[e.jsx("span",{className:"text-[10px] text-slate-500 dark:text-slate-400 block mb-0.5",children:"Browser"}),e.jsx("span",{className:"text-cyan-700 dark:text-cyan-400 font-bold",children:c?.client?.browser})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800",children:[e.jsx("span",{className:"text-[10px] text-slate-500 dark:text-slate-400 block mb-0.5",children:"Platform / OS"}),e.jsx("span",{className:"text-emerald-700 dark:text-emerald-400 font-bold",children:c?.client?.os})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800",children:[e.jsx("span",{className:"text-[10px] text-slate-500 dark:text-slate-400 block mb-0.5",children:"Screen Ratio"}),e.jsx("span",{className:"text-amber-700 dark:text-amber-400 font-bold",children:c?.client?.aspectRatio})]}),e.jsxs("div",{className:"p-3.5 rounded-xl bg-slate-50 dark:bg-slate-950 border border-slate-200 dark:border-slate-800",children:[e.jsx("span",{className:"text-[10px] text-slate-500 dark:text-slate-400 block mb-0.5",children:"Total Visits"}),e.jsxs("span",{className:"text-indigo-700 dark:text-indigo-400 font-bold",children:["#",c?.visitCount]})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2.5 pr-1.5 text-xs font-mono",children:[e.jsxs("p",{className:"text-[11px] text-slate-600 dark:text-slate-400 font-bold uppercase tracking-wider pb-1",children:["Recent Visitor History (",h.length," logged sessions):"]}),h.length===0?e.jsx("p",{className:"text-slate-400 text-center py-8",children:"No previous visitor sessions recorded yet."}):h.map((t,s)=>e.jsxs("div",{className:"p-3.5 sm:p-4 rounded-xl bg-slate-50 dark:bg-slate-950/80 border border-slate-200 dark:border-slate-800/80 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-bold text-slate-900 dark:text-white",children:t.name||"Anonymous Guest"}),t.category==="RECRUITER"?e.jsx("span",{className:"px-2 py-0.5 rounded text-[9px] bg-purple-500/10 border border-purple-500/30 text-purple-700 dark:text-purple-300 font-bold uppercase",children:"Recruiter"}):e.jsx("span",{className:"px-2 py-0.5 rounded text-[9px] bg-slate-200 dark:bg-slate-800 text-slate-600 dark:text-slate-400 font-medium",children:"Casual"}),t.company&&e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] bg-cyan-50 dark:bg-cyan-500/10 border border-cyan-200 dark:border-cyan-500/30 text-cyan-800 dark:text-cyan-300 font-semibold",children:t.company})]}),e.jsxs("p",{className:"text-[11px] text-slate-600 dark:text-slate-400",children:[t.client?.browser," • ",t.client?.os," • ",t.client?.screenResolution," (",t.client?.aspectRatio,")"]})]}),e.jsxs("div",{className:"text-right space-y-1",children:[e.jsx("span",{className:"text-[10px] text-slate-500 whitespace-nowrap block",children:t.displayTime||t.timestamp?.split("T")[0]}),e.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 font-semibold flex items-center gap-1 justify-end",children:[e.jsx(y,{className:"w-2.5 h-2.5"})," Auto-Accepted"]})]})]},t.id||s))]}),e.jsxs("div",{className:"pt-3 sm:pt-4 border-t border-slate-200 dark:border-slate-800 text-[10px] sm:text-[11px] font-mono text-slate-500 flex justify-between",children:[e.jsx("span",{children:"Press Ctrl+Shift+V anytime to toggle this ledger"}),e.jsx("span",{children:"Dev Console: window.getPortfolioVisitorsSummary()"})]})]})})]})}export{ee 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.