From f58b0701b4031f377b3332ad0f1bcf640a4bea75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Thu, 26 Nov 2026 15:43:30 -0300 Subject: [PATCH] fix: a Site script the network dropped is said at once, with a reload, and reported (DTF-WEB-1W) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On an Android phone site-upload.js never arrived, so recusa() was the page's #recusa element and the product did not open. The last script now checks each module, shows "Uma parte do site não carregou" with Atualizar, and tells Sentry which file is missing. Co-Authored-By: Claude Opus 5.5 (1M context) --- web/site-steps.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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]); });