This website uses cookies to ensure you get the best experience.

PayFit and our selected partners use cookies and similar technologies (together “cookies”) that are necessary to present this website, and to ensure you get the best experience of it. All the cookies we use are necessary to make the site function - without them, the site wouldn't work.

See our Cookie Policy to read more about the cookies we set.

You can withdraw and manage your consent at any time, by clicking “Manage cookies” at the bottom of each website page.

Gaël De Percin

Group Product Manager

Already working at PayFit?

Let’s recruit together and find your next colleague.

(function(){ // 👉 remplace par TON worker si besoin const API = "https://payfit-career-bot.rrouillard87.workers.dev"; // --- Format Markdown simple (gras, italique, listes, liens, paragraphes) --- function formatMD(text){ if (!text) return ""; let h = String(text).replace(/&/g,"&").replace(//g,">"); h = h.replace(/\*\*(.*?)\*\*/g, "$1").replace(/\*(.*?)\*/g, "$1"); h = h.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, `$1`); h = h.replace(/(?:^|\n)[-\u2022]\s*(.*?)(?=\n|$)/g, `
  • $1
  • `); if (h.includes("
  • ")) h = h.replace(/(
  • .*<\/li>)/gs, ""); h = h.replace(/\n{2,}/g,"

    "); h = `

    ${h}

    `.replace(/\n/g,"
    "); return h; } function addBubble(text, role="bot"){ const log = document.getElementById("pf-log"); if (!log) return; const d = document.createElement("div"); d.className = `pf-msg ${role==="user" ? "pf-user" : "pf-bot"}`; d.innerHTML = formatMD(text); log.appendChild(d); log.scrollTop = log.scrollHeight; return d; } function ensureUI(){ if (!document.body) return setTimeout(ensureUI, 200); // Lanceur if (!document.getElementById("pf-launcher")) { const btn = document.createElement("button"); btn.id = "pf-launcher"; btn.type = "button"; btn.title = "Chat PayFit"; btn.textContent = "💬"; btn.addEventListener("click", () => { const pane = document.getElementById("pf-pane"); if (pane) pane.style.display = (pane.style.display === "none" || !pane.style.display) ? "block" : "none"; }); document.body.appendChild(btn); } // Pane if (!document.getElementById("pf-pane")) { const pane = document.createElement("div"); pane.id = "pf-pane"; pane.innerHTML = `
    PayFit Assistant 💬
    `; pane.style.display = "none"; document.body.appendChild(pane); // Accueil addBubble("Hello 👋 Envie d’en savoir plus sur la vie chez PayFit ou sur nos offres ? Pose-moi ta question, je suis là pour t’aider.", "bot"); bindForm(); } } function bindForm(){ const form = document.getElementById("pf-form"); const input = document.getElementById("pf-input"); const send = document.getElementById("pf-send"); if (!form || !input || !send) return; form.addEventListener("submit", async (e)=>{ e.preventDefault(); const q = (input.value || "").trim(); if (!q) return; addBubble(q, "user"); input.value = ""; const loader = addBubble(` PayFit réfléchit…`, "bot"); input.disabled = true; send.disabled = true; try { const r = await fetch(API, { method:"POST", headers:{ "Content-Type":"application/json" }, body: JSON.stringify({ question: q }) }); const data = await r.json().catch(()=> ({})); if (loader && loader.parentNode) loader.parentNode.removeChild(loader); input.disabled = false; send.disabled = false; if (r.ok && data && data.answer) addBubble(data.answer, "bot"); else addBubble(`Oups — erreur ${r.status}. Réessaie dans un instant.`, "bot"); } catch (err) { if (loader && loader.parentNode) loader.parentNode.removeChild(loader); input.disabled = false; send.disabled = false; addBubble(`Erreur réseau : ${err.message}`, "bot"); } }); } // Injection initiale ensureUI(); // Réassurer l’UI si Teamtailor recharge en SPA const mo = new MutationObserver(()=> { if (!document.getElementById("pf-launcher") || !document.getElementById("pf-pane")) ensureUI(); }); mo.observe(document.documentElement, { childList:true, subtree:true }); // Filet de sécurité régulier setInterval(()=> { if (!document.getElementById("pf-launcher") || !document.getElementById("pf-pane")) ensureUI(); }, 2000); })();