1import{A as D,D as m,r as i,t as n,j as t,ah as re,T as ae,F as ne,W as oe,U as ie}from"./index-CnHApc00.js";import{L as T,l as ce,e as le,u as de,d as ue,a as me,b as pe,c as xe}from"./leads.functions-DTVVJHnw.js";import{R as be}from"./refresh-cw-BZCeRmk-.js";import{C as fe}from"./chevron-down-C3yVlipX.js";import{T as he}from"./trash-2-Dg5NHCVz.js";import{E as ye}from"./external-link-CrugxiKE.js";import{P as ge}from"./plus-CAMdYWbf.js";const ve=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],je=D("chevron-up",ve);const Ne=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],we=D("copy",Ne),E=[{step:0,offsetDays:0,label_fr:"Premier contact",label_en:"First contact",subject_fr:"{{name}} â votre visibilité dans les réponses IA",subject_en:"{{name}} â your visibility in AI answers",body_fr:`Bonjour {{firstName}}, 2 3Merci pour votre message. Votre fiche {{company}} peut apparaître dans le répertoire ManuGEO, conçu pour être lu par ChatGPT, Claude et Perplexity. 4 5Voulez-vous que je vous montre comment {{company}} apparaît aujourd'hui dans les réponses IA ? 6 7â Benoit Cormier, ManuGEO.ai`,body_en:`Hi {{firstName}}, 8 9Thanks for reaching out. {{company}} can be listed in the ManuGEO directory, built to be read by ChatGPT, Claude and Perplexity. 10 11Would you like me to show you how {{company}} currently shows up in AI answers? 12 13â Benoit Cormier, ManuGEO.ai`},{step:1,offsetDays:3,label_fr:"Relance douce",label_en:"Gentle follow-up",subject_fr:"Re: votre visibilité dans les réponses IA",subject_en:"Re: your visibility in AI answers",body_fr:`Bonjour {{firstName}}, 14 15Petite relance â les acheteurs industriels interrogent de plus en plus les assistants IA pour trouver des fournisseurs comme {{company}}. 16 17Je peux vous préparer un mini-diagnostic gratuit de votre visibilité IA (10 minutes). Ãa vous intéresse ? 18 19â Benoit, ManuGEO.ai`,body_en:`Hi {{firstName}}, 20 21Quick follow-up â industrial buyers increasingly ask AI assistants to find suppliers like {{company}}. 22 23I can prepare a free mini-assessment of your AI visibility (10 minutes). Interested? 24 25â Benoit, ManuGEO.ai`},{step:2,offsetDays:7,label_fr:"Preuve / mini-audit",label_en:"Proof / mini-audit",subject_fr:"Ce que ChatGPT dit de {{company}} aujourd'hui",subject_en:"What ChatGPT says about {{company}} today",body_fr:`Bonjour {{firstName}}, 26 27J'ai testé quelques requêtes typiques dans ChatGPT et Perplexity avec les mots-clés de votre secteur. Résultat : les manufacturiers structurés pour l'IA sont cités, les autres sont absents. 28 29Voici 3 actions concrètes que {{company}} pourrait appliquer cette semaine. On en discute 15 minutes ? 30 31â Benoit, ManuGEO.ai`,body_en:`Hi {{firstName}}, 32 33I ran a few typical queries in ChatGPT and Perplexity using your sector's keywords. Result: AI-ready manufacturers get cited; the others are invisible. 34 35Here are 3 concrete actions {{company}} could apply this week. Can we talk for 15 minutes? 36 37â Benoit, ManuGEO.ai`},{step:3,offsetDays:14,label_fr:"Partage de contenu",label_en:"Content share",subject_fr:"Un article utile pour {{company}}",subject_en:"A useful read for {{company}}",body_fr:`Bonjour {{firstName}}, 38 39Je vous partage un article de notre veille qui touche directement votre secteur : comment les manufacturiers canadiens se font trouver par les IA en 2026. 40 41Si {{company}} veut figurer dans notre répertoire (déjà indexé par Google et lisible par les IA), c'est par ici : https://manugeo.ai/fr/directory 42 43â Benoit, ManuGEO.ai`,body_en:`Hi {{firstName}}, 44 45Sharing an article from our watch that directly concerns your sector: how Canadian manufacturers get found by AI in 2026. 46 47If {{company}} wants to be listed in our directory (already indexed by Google and readable by AI), it's here: https://manugeo.ai/en/directory 48 49â Benoit, ManuGEO.ai`},{step:4,offsetDays:21,label_fr:"Dernière relance",label_en:"Last follow-up",subject_fr:"On clôt le dossier {{company}} ?",subject_en:"Should I close the {{company}} file?",body_fr:`Bonjour {{firstName}}, 50 51Dernier mot de ma part : si la visibilité IA n'est pas une priorité pour {{company}} en ce moment, aucun souci â je clôturerai le suivi. 52 53Sinon, répondez simplement « oui » et je vous envoie le mini-diagnostic gratuit. 54
55â Benoit, ManuGEO.ai`,body_en:`Hi {{firstName}}, 56 57Last note from me: if AI visibility isn't a priority for {{company}} right now, no problem â I'll close the file. 58 59Otherwise, just reply "yes" and I'll send the free mini-assessment. 60 61â Benoit, ManuGEO.ai`},{step:5,offsetDays:30,label_fr:"Clôture",label_en:"Close-out",subject_fr:"{{company}} â fermeture du suivi",subject_en:"{{company}} â closing the loop",body_fr:`Bonjour {{firstName}}, 62 63Je clôture le suivi pour {{company}}. Si la question de la visibilité IA revient sur la table, écrivez-moi â la porte reste ouverte. 64 65Bonne continuation ! 66 67â Benoit, ManuGEO.ai`,body_en:`Hi {{firstName}}, 68 69I'm closing the follow-up for {{company}}. If AI visibility comes back on the table, just write me â the door stays open. 70 71All the best! 72 73â Benoit, ManuGEO.ai`}];function q(o,l){const v=l.name.trim().split(/\s+/)[0]??l.name;return o.replaceAll("{{name}}",l.name).replaceAll("{{firstName}}",v).replaceAll("{{company}}",l.company||l.name)}const y={new:"Nouveau",contacted:"Contacté",qualified:"Qualifié",converted:"Converti",lost:"Perdu"},_e={new:"bg-primary/10 text-primary-text border-primary/30",contacted:"bg-amber-500/10 text-amber-600 border-amber-500/30",qualified:"bg-blue-500/10 text-blue-600 border-blue-500/30",converted:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30",lost:"bg-muted text-muted-foreground border-border"},Ce={note:"Note",email_sent:"Courriel envoyé",reply:"Réponse reçue",call:"Appel",meeting:"Rencontre"};function g(o){return o?new Date(o).toLocaleDateString("fr-CA",{year:"numeric",month:"short",day:"numeric"}):"â"}function B(o){return!o.next_touch_at||o.status==="converted"||o.status==="lost"?!1:new Date(o.next_touch_at).getTime()<=Date.now()}function Te(){const o=m(ce),l=m(de),v=m(ue),G=m(me),M=m(xe),R=m(pe),P=m(le),[j,$]=i.useState([]),[U,F]=i.useState({}),[p,H]=i.useState("all"),[N,J]=i.useState(""),[V,I]=i.useState(!0),[x,c]=i.useState(null),[k,z]=i.useState(null),[w,Q]=i.useState({}),[b,_]=i.useState({type:"note",note:""}),[L,O]=i.useState({}),u=i.useCallback(async()=>{I(!0);try{const e=await o({data:{status:p,search:N}});$(e.leads),F(e.counts)}catch(e){n.error(e instanceof Error?e.message:"Chargement impossible")}finally{I(!1)}},[o,p,N]);i.useEffect(()=>{u()},[u]);const C=async e=>{try{const s=await M({data:{leadId:e}});Q(a=>({...a,[e]:s.activities}))}catch{}},W=async e=>{const s=k===e.id?null:e.id;z(s),s&&(O(a=>({...a,[e.id]:e.notes??""})),w[e.id]||await C(e.id))},Y=async e=>{c(e.id);try{await l({data:{id:e.id,notes:L[e.id]??""}}),n.success("Note enregistrée"),await u()}catch(s){n.error(s instanceof Error?s.message:"Enregistrement impossible")}finally{c(null)}},K=async(e,s)=>{c(e.id);try{await l({data:{id:e.id,status:s}}),n.success(`Statut : ${y[s]}`),await u()}catch(a){n.error(a instanceof Error?a.message:"Mise à jour impossible")}finally{c(null)}},X=async e=>{if(confirm(`Supprimer le lead « ${e.name} » ?`)){c(e.id);try{await v({data:{id:e.id}}),await u()}catch(s){n.error(s instanceof Error?s.message:"Suppression impossible")}finally{c(null)}}},Z=async e=>{c(e.id);try{const s=await G({data:{id:e.id,step:e.sequence_step}});n.success(s.nextTouchAt?`Ãtape ${e.sequence_step+1} enregistrée â prochaine relance le ${g(s.nextTouchAt)}`:"Séquence terminée"),await u(),await C(e.id)}catch(s){n.error(s instanceof Error?s.message:"Mise à jour impossible")}finally{c(null)}},ee=async e=>{if(b.note.trim()){c(e.id);try{await R({data:{leadId:e.id,type:b.type,note:b.note}}),_({type:"note",note:""}),n.success("Activité ajoutée"),await C(e.id)}catch(s){n.error(s instanceof Error?s.message:"Ajout impossible")}finally{c(null)}}},te=async()=>{try{const e=await P({data:{status:p}}),s=new Blob(["\uFEFF"+e.csv],{type:"text/csv;charset=utf-8"}),a=URL.createObjectURL(s),d=document.createElement("a");d.href=a,d.download=`manugeo-leads-${p}-${new Date().toISOString().slice(0,10)}.csv`,d.click(),URL.revokeObjectURL(a),n.success(`${e.count} prospect(s) exporté(s)`)}catch(e){n.error(e instanceof Error?e.message:"Export impossible")}}
73,h=j.filter(B);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-xl font-bold",children:"Pipeline de prospects"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Leads capturés depuis le formulaire de contact, avec séquence de relances manuelle."})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>{te()},className:"inline-flex items-center gap-2 border border-border px-3 py-2 text-sm hover:bg-muted",children:[t.jsx(re,{className:"h-4 w-4"})," Export CSV"]}),t.jsxs("button",{onClick:()=>{u()},className:"inline-flex items-center gap-2 border border-border px-3 py-2 text-sm hover:bg-muted",children:[t.jsx(be,{className:"h-4 w-4"})," Rafraîchir"]})]})]}),h.length>0?t.jsxs("div",{className:"border border-amber-500/40 bg-amber-500/5 p-4 text-sm",children:[t.jsxs("span",{className:"font-semibold text-amber-600",children:[h.length," relance",h.length>1?"s":""," à faire aujourd'hui :"]})," ",h.map(e=>e.name).join(", ")]}):null,t.jsx("div",{className:"flex flex-wrap gap-2",children:["all",...T].map(e=>t.jsxs("button",{onClick:()=>H(e),className:`px-3 py-1.5 text-xs font-mono uppercase tracking-widest border ${p===e?"border-primary text-primary-text bg-primary/5":"border-border text-muted-foreground hover:text-foreground"}`,children:[e==="all"?"Tous":y[e]," (",U[e]??0,")"]},e))}),t.jsxs("div",{className:"relative max-w-sm",children:[t.jsx(ae,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx("input",{value:N,onChange:e=>J(e.target.value),placeholder:"Nom, courriel, entrepriseâ¦",className:"w-full border border-border bg-background pl-9 pr-3 py-2 text-sm"})]}),V?t.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t.jsx(ne,{className:"h-4 w-4 animate-spin"})," Chargementâ¦"]}):j.length===0?t.jsx("div",{className:"border border-border bg-muted/30 p-6 text-sm text-muted-foreground",children:"Aucun prospect pour ce filtre."}):t.jsx("div",{className:"border border-border divide-y divide-border",children:j.map(e=>{const s=E.find(r=>r.step===e.sequence_step),a=k===e.id,d=e.language==="en"?"en":"fr",A=s?q(d==="en"?s.subject_en:s.subject_fr,{name:e.name,company:e.company??""}):"",S=s?q(d==="en"?s.body_en:s.body_fr,{name:e.name,company:e.company??""}):"",se=s?`mailto:${encodeURIComponent(e.email)}?subject=${encodeURIComponent(A)}&body=${encodeURIComponent(S)}`:null;return t.jsxs("div",{className:"p-4",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"font-semibold",children:e.name}),t.jsx("span",{className:`px-2 py-0.5 text-[10px] font-mono uppercase tracking-widest border ${_e[e.status]}`,children:y[e.status]}),B(e)?t.jsx("span",{className:"px-2 py-0.5 text-[10px] font-mono uppercase tracking-widest border border-amber-500/40 bg-amber-500/10 text-amber-600",children:"à relancer"}):null,t.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:[e.source," · ",e.language.toUpperCase()," · étape ",e.sequence_step,"/",E.length]})]}),t.jsxs("div",{className:"text-sm text-muted-foreground mt-1",children:[t.jsxs("a",{href:`mailto:${e.email}`,className:"inline-flex items-center gap-1 hover:text-foreground",children:[t.jsx(oe,{className:"h-3.5 w-3.5"})," ",e.email]}),e.company?t.jsxs("span",{children:[" · ",e.company]}):null]}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-1 font-mono",children:["Reçu ",g(e.created_at),e.next_touch_at?` · prochaine relance ${g(e.next_touch_at)}`:""]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("select",{value:e.status,disabled:x===e.id,onChange:r=>{K(e,r.target.value)},className:"border border-border bg-background px-2 py-1.5 text-sm",children:T.map(r=>t.jsx("option",{value:r,children:y[r]},r))}),t.jsxs("button",{onClick:()=>{W(e)},className:"border border-border px-3 py-1.5 text-sm hover:bg-muted inline-flex items-center gap-1",children:["Séquence ",a?t.jsx(je,{className:"h-3.5 w-3.5"}):t.jsx(fe,{className:"h-3.5 w-3.5"})]}),t.jsx("button",{onClick:()=>{X(e)},disabled:x===e.id,className:"border border-border px-2 py-1.5 text-destructive-text hover:bg-destructive/5","aria-label":"Supprimer",children:t.jsx(he,{className:"h-4 w-4"})})]})]}),e.message?t.jsx("p",{className:"mt-3 text-sm text-muted-foreground border-l-2 border-border pl-3 whitespace-pre-wrap",children:e.message}):null,e.notes&&!a?t.jsxs("p",{className:"mt-3 text-sm text-muted-foreground border-l-2 border-border pl-3 whitespace-pre-wrap",children:["Note : ",e.notes]}):null,a?t.jsxs("div",{className:"mt-4 border border-border bg-muted/20 p-4 space-y-4",children:[t.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(r=>
73t.jsxs("span",{className:`px-2 py-1 text-[10px] font-mono uppercase tracking-widest border ${r.step<e.sequence_step?"border-emerald-500/40 bg-emerald-500/10 text-emerald-600":r.step===e.sequence_step?"border-primary bg-primary/10 text-primary-text":"border-border text-muted-foreground"}`,children:[r.step+1,". ",d==="en"?r.label_en:r.label_fr," (J+",r.offsetDays,")"]},r.step))}),s?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground",children:["Modèle ",d==="en"?"EN":"FR"," â ",A]}),t.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-background border border-border p-3 max-h-64 overflow-auto",children:S}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsxs("a",{href:se??"#",className:"inline-flex items-center gap-2 bg-primary text-primary-foreground px-3 py-1.5 text-sm",children:[t.jsx(ye,{className:"h-4 w-4"})," Ouvrir dans le courriel"]}),t.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(`Objet: ${A} 74 75${S}`),n.success("Modèle copié")},className:"inline-flex items-center gap-2 border border-border px-3 py-1.5 text-sm hover:bg-muted",children:[t.jsx(we,{className:"h-4 w-4"})," Copier"]}),t.jsxs("button",{onClick:()=>{Z(e)},disabled:x===e.id,className:"inline-flex items-center gap-2 border border-border px-3 py-1.5 text-sm hover:bg-muted",children:[t.jsx(ie,{className:"h-4 w-4"})," Marquer envoyé â prochaine relance"]})]})]}):t.jsx("p",{className:"text-sm text-muted-foreground",children:"Séquence terminée pour ce prospect."}),t.jsxs("div",{children:[t.jsx("div",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground mb-2",children:"Note interne"}),t.jsx("textarea",{value:L[e.id]??"",onChange:r=>O(f=>({...f,[e.id]:r.target.value})),rows:3,placeholder:"Notes de suivi internes sur ce prospectâ¦",className:"w-full border border-border bg-background px-3 py-2 text-sm"}),t.jsx("div",{className:"mt-2 flex justify-end",children:t.jsx("button",{onClick:()=>{Y(e)},disabled:x===e.id,className:"inline-flex items-center gap-2 border border-border px-3 py-1.5 text-sm hover:bg-muted",children:"Enregistrer la note"})})]}),t.jsxs("div",{children:[t.jsx("div",{className:"text-xs font-mono uppercase tracking-widest text-muted-foreground mb-2",children:"Journal d'activité"}),t.jsxs("div",{className:"space-y-1.5",children:[(w[e.id]??[]).map(r=>t.jsxs("div",{className:"text-sm flex gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-mono whitespace-nowrap",children:g(r.occurred_at)}),t.jsx("span",{className:"text-xs font-mono text-primary-text whitespace-nowrap",children:Ce[r.type]??r.type}),t.jsxs("span",{className:"text-muted-foreground",children:[r.subject?`${r.subject} â `:"",r.note]})]},r.id)),(w[e.id]??[]).length===0?t.jsx("p",{className:"text-xs text-muted-foreground",children:"Aucune activité."}):null]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsxs("select",{value:b.type,onChange:r=>_(f=>({...f,type:r.target.value})),className:"border border-border bg-background px-2 py-1.5 text-sm",children:[t.jsx("option",{value:"note",children:"Note"}),t.jsx("option",{value:"reply",children:"Réponse reçue"}),t.jsx("option",{value:"call",children:"Appel"}),t.jsx("option",{value:"meeting",children:"Rencontre"})]}),t.jsx("input",{value:b.note,onChange:r=>_(f=>({...f,note:r.target.value})),placeholder:"Ex. : réponse reçue, intéressé par un appelâ¦",className:"flex-1 border border-border bg-background px-2 py-1.5 text-sm"}),t.jsxs("button",{onClick:()=>{ee(e)},disabled:x===e.id,className:"inline-flex items-center gap-1 border border-border px-3 py-1.5 text-sm hover:bg-muted",children:[t.jsx(ge,{className:"h-4 w-4"})," Ajouter"]})]})]})]}):null]},e.id)})})]})}export{Te as component};
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.