fix: a Site script the network dropped is said at once, with a reload, and reported (DTF-WEB-1W)
All checks were successful
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 8m36s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m13s
All checks were successful
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 8m36s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m13s
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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]); });
|
||||
|
||||
Reference in New Issue
Block a user