.switch{position:relative;display:inline-block;width:56px;height:28px} .switch input{display:none} .slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:#ccc;border-radius:28px;transition:.2s} .slider:before{content:"";position:absolute;height:22px;width:22px;left:3px;bottom:3px;background:white;border-radius:50%;transition:.2s} input:checked + .slider{background:#000} input:checked + .slider:before{transform:translateX(28px)}
Piano e stato abbonamento
Gestisci fatturazione

AI spenta

ventListener('change', async()=>{ const desired=chk.checked; lbl.textContent=desired?'AI attiva':'AI spenta'; await fetch('https://TUA_N8N/toggle/set',{ method:'POST', headers:{'Content-Type':'application/json','Authorization':'Bearer '+session.access_token}, body:JSON.stringify({ user_id: session.user.id, toggle_ai: desired }) }); }); // ๐Ÿ”น 3. gestisci fatturazione document.getElementById('manage-billing').onclick=async()=>{ const r=await fetch('https://TUA_N8N/stripe/portal',{ method:'POST', headers:{'Content-Type':'application/json','Authorization':'Bearer '+session.access_token}, body:JSON.stringify({ user_id: session.user.id }) }); const { url } = await r.json(); window.location=url; }; })();