diff --git a/tests/artwork_browser_test.mjs b/tests/artwork_browser_test.mjs
index fbfad0e..354d269 100644
--- a/tests/artwork_browser_test.mjs
+++ b/tests/artwork_browser_test.mjs
@@ -288,6 +288,12 @@ try{
await click('#bVoltar');await click('[data-modo="file"]');
await evaluate('sendSheet()');
await waitFor(()=>evaluate('folhas.length===1 && !!folhas[0].previewSrc && metros===0.342'),'ready-sheet image');
+ // On its way at once, with its own row under the uploader (Dropstar,
+ // 2026-10-29). There is no storage here, so it fails, and says so with a
+ // way to try again; tests/browser_test.mjs sends it for real.
+ await waitFor(()=>evaluate(`!!dtfEnvio.estado(folhas[0].f)`),'the sheet starts uploading at once');
+ await waitFor(()=>evaluate(`$('envios').textContent.includes('Não foi possível enviar folha-montada.png') &&
+ !!$('envios').querySelector('[data-envio]')`),'a failed upload says so under the uploader');
assert.deepEqual(await evaluate(`({mode:modo,art:artes.length,title:$('montcabTit').textContent,rate:precoMetro()})`),{mode:'file',art:0,title:'Sua folha',rate:19.9});
// One price per product (Dropstar, 2026-10-23): the sheet is graded, and the
// grade is shown, but the metre costs the same as for any other grade.
diff --git a/tests/browser_test.mjs b/tests/browser_test.mjs
index 1ad3325..e60f192 100644
--- a/tests/browser_test.mjs
+++ b/tests/browser_test.mjs
@@ -73,6 +73,10 @@ try{
const input=await site.call('DOM.querySelector',{nodeId:root.root.nodeId,selector:'#inp'});
await site.call('DOM.setFileInputFiles',{nodeId:input.nodeId,files:[resolve('tests/fixtures/local-test.cdr')]});
await waitFor(()=>site.eval('!!document.querySelector("[data-comp]")'),'manual length field');
+ // On its way from the product page already, with its own row under the
+ // uploader (Dropstar, 2026-10-29).
+ await waitFor(()=>site.eval(`$('envios').textContent.includes('local-test.cdr') && !$('envios').textContent.includes('Não foi possível')`),
+ 'the file uploads from the product page',45000);
await site.fill('[data-comp]','1.01','change');
await waitFor(()=>site.eval('!!itemAtual'),'cart calculation');
// A CDR is opened by hand: the full price, plus the per-metre charge when
diff --git a/web/checkout.js b/web/checkout.js
index 328771b..40dc8ed 100644
--- a/web/checkout.js
+++ b/web/checkout.js
@@ -126,27 +126,42 @@
message('Nenhum pedido aguardando pagamento.');
button('Ir para o carrinho', () => vaiPara(CARRINHO));
}
- // Files start uploading as soon as they are in the cart, so a sheet of
- // several GB is on its way while the customer fills in the order. The
- // checkout waits for whatever is still going.
+ // Files start uploading as soon as they are on the product page (Dropstar,
+ // 2026-10-29; before, once in the cart), so a sheet of several GB is on its
+ // way while the customer builds the order. The checkout waits for whatever
+ // is still going.
const envios=new Map();
const chaveArquivo=f=>[f.name,f.size,f.lastModified].join('|');
function enviar(file) {
const k=chaveArquivo(file);
let e=envios.get(k);
if (!e) {
- e={file, sent:0, done:false, failed:null};
+ e={file, sent:0, done:false, failed:null, stop:new AbortController()};
e.promise=(async()=>{
const session=await ready;
- return window.dtfUpload(file,{api,scope:session.cart_scope,progress:()=>{},
+ return window.dtfUpload(file,{api,scope:session.cart_scope,progress:()=>{},signal:e.stop.signal,
onBytes:n=>{e.sent=n;pintaEnvio();}});
})();
e.promise.then(()=>{e.done=true;falhas.delete(k);pintaEnvio();},
- error=>{envios.delete(k);falhas.set(k,{file,error});pintaEnvio();});
+ error=>{envios.delete(k);if(error?.name!=='AbortError')falhas.set(k,{file,error});pintaEnvio();});
envios.set(k,e);
}
return e.promise;
}
+ // Each file's upload as the product page shows it, under the uploader.
+ window.dtfEnvio={
+ enviar:file=>{if(!falhas.has(chaveArquivo(file)))enviar(file).catch(()=>{});},
+ estado:file=>{const k=chaveArquivo(file),e=envios.get(k),f=falhas.get(k);
+ return f?{fase:'falhou',erro:f.error?.message||'erro no envio'}
+ :!e?null:e.done?{fase:'pronto'}:e.sent>=file.size?{fase:'verificando'}:{fase:'enviando',enviado:e.sent};},
+ deNovo:file=>{falhas.delete(chaveArquivo(file));enviar(file).catch(()=>{});pintaEnvio();},
+ // A file taken off the page, and in no cart item, stops going.
+ manter:files=>{
+ const quero=new Set([...files,...pedido.flatMap(it=>it.localFiles||[]),...(itemAtual?.localFiles||[])].map(chaveArquivo));
+ for(const [k,e] of envios) if(!e.done && !quero.has(k)) e.stop.abort();
+ for(const k of falhas.keys()) if(!quero.has(k)) falhas.delete(k);
+ },
+ };
// The Kanban shows each order's artwork from the small picture this page
// already made of it (site-upload.js). Never blocks the order: a picture that
// fails to go leaves the Kanban with the layout drawing it shows today.
@@ -203,6 +218,7 @@
return 'Enviando seus arquivos · '+restante(e);
}
function pintaEnvio() {
+ window.dispatchEvent(new Event('dtf-envio'));
const e=estadoEnvio(), texto=textoEnvio(e);
const el=document.getElementById('envioArq');
const falhou=arquivosDoCarrinho().map(f=>falhas.get(chaveArquivo(f))).filter(Boolean);
diff --git a/web/index.html b/web/index.html
index b90069e..7e2e91a 100644
--- a/web/index.html
+++ b/web/index.html
@@ -844,6 +844,7 @@ h2 em{font-style:normal;color:var(--laranja)}
Tem CDR, AI, PSD ou TIFF? Pode mandar também.
Alguém abre na mão, e o metro custa R$ 2,00 a mais.
+