/* ============================================================ wizard_parts.jsx — Cart, QRCode, Stepper, shared step bits ============================================================ */ /* ---------- QR Code (usa global qrcode-generator) ---------- */ function QRCode({ text, size = 220 }) { const ref = React.useRef(null); React.useEffect(() => { if (!ref.current) return; try { const qr = window.qrcode(0, 'M'); qr.addData(text); qr.make(); const count = qr.getModuleCount(); const cell = Math.floor(size / count); ref.current.innerHTML = qr.createSvgTag({ cellSize: cell, margin: 0, scalable: true }); const svg = ref.current.querySelector('svg'); if (svg) { svg.style.width = size + 'px'; svg.style.height = size + 'px'; svg.style.display = 'block'; } } catch (e) { ref.current.innerHTML = '
QR indisponível
'; } }, [text, size]); return
; } /* ---------- Stepper (topo do wizard) ---------- */ const STEPS = [ { n: 1, label: 'Cadastro', icon: 'user' }, { n: 2, label: 'Serviços', icon: 'cart' }, { n: 3, label: 'Resumo', icon: 'doc' }, { n: 4, label: 'Aceite', icon: 'check' }, { n: 5, label: 'Compartilhar', icon: 'send' }, { n: 6, label: 'Pagamento', icon: 'qr' }, ]; function Stepper({ step, maxStep, onJump }) { return (
{STEPS.map((s, i) => { const done = s.n < step; const active = s.n === step; const reachable = s.n <= maxStep; return ( {i < STEPS.length - 1 && } ); })}
); } /* ---------- Cart sidebar (Etapa 2) ---------- */ function CartSidebar({ items, total, recorrente, onRemove, onAdvance, cliente }) { const empty = items.length === 0; return ( ); } Object.assign(window, { QRCode, Stepper, CartSidebar, STEPS });