diff --git a/web/site-steps.js b/web/site-steps.js index ff5bcec..fd74e4f 100644 --- a/web/site-steps.js +++ b/web/site-steps.js @@ -3,6 +3,32 @@ switches which page is shown and reads the page's state (the open product, the cart, the checkout status); orders, prices and files stay with the other site-*.js files. */ +// The Site is twenty scripts loaded in turn: one the phone's network dropped +// leaves its functions missing, and the page breaks at the first click +// (Sentry DTF-WEB-1W, site-upload.js on Android). Said to the customer at +// once, with a reload, and Sentry hears which file did not arrive. +(function(){ + const modulos={'site-pages.js':typeof paginaDe,'site-config.js':typeof precoNaMetragem, + 'site-videos.js':typeof videoElement,'site-modes.js':typeof escolheProduto,'site-upload.js':typeof recusa, + 'site-sheet.js':typeof passoDe,'site-pdf.js':typeof testaWorker,'site-quality.js':typeof perguntaMista, + 'packing.js':typeof dilatar,'site-packing.js':typeof carregarImagem,'site-cart.js':typeof artesDoItem, + 'site-flow.js':typeof guardaItem,'upload.js':typeof uploadSlot}; + const faltando=Object.keys(modulos).filter(nome=>modulos[nome]!=='function'); + if(!faltando.length) return; + window.dtfObservability?.uiError?.('O site carregou sem '+faltando.join(', ')+'.','site'); + const aviso=document.createElement('div'); + aviso.setAttribute('role','alert'); + aviso.style.cssText='position:fixed;left:12px;right:12px;bottom:12px;z-index:9999;padding:14px 16px;border-radius:10px;'+ + 'background:#1f1f1f;color:#fff;font:15px/1.4 system-ui,sans-serif;display:flex;gap:12px;align-items:center;justify-content:space-between'; + const texto=document.createElement('span'); + texto.textContent='Uma parte do site não carregou, provavelmente a conexão oscilou. Atualize a página para continuar.'; + const botao=document.createElement('button'); + botao.type='button'; botao.textContent='Atualizar'; + botao.style.cssText='flex:none;padding:8px 14px;border:0;border-radius:8px;background:#F28C1E;color:#111;font-weight:700'; + botao.addEventListener('click',()=>location.reload()); + aviso.append(texto,botao); + document.body.append(aviso); +})(); // Every price on the page (top chip, home example, product cards, price table) // comes from the same table the checkout uses, so they cannot drift. document.querySelectorAll('[data-preco]').forEach(el=>{ el.textContent=rs(PRECO[el.dataset.preco]); });