feat: above 10 m the payment asks for the proof in a pop-up, not mandatory (Marcus, 2026-12-02)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
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 1m6s

The proof checkbox in the cart becomes a pop-up when the customer presses
pay on an order above 10 m: "Quero aprovar uma prova" sends proof=true,
"Seguir sem prova", Escape or closing goes on without one. Same text as the
old box. Below 10 m nothing is asked. A cart already sent goes straight to
its payment without asking again. The dialog sits outside the panels so it
shows wherever pay is pressed. The automatic proof above 10 m is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-12-02 10:43:17 -03:00
parent 41126a42fd
commit 1633b995eb
6 changed files with 56 additions and 22 deletions

View File

@@ -615,6 +615,24 @@ try{
}finally{carregarPdfJs=realLoader;window.setTimeout=realTimer;temWorker=realWorker;} }finally{carregarPdfJs=realLoader;window.setTimeout=realTimer;temWorker=realWorker;}
})()`); })()`);
assert.deepEqual(timeoutCleanup,{timedOut:true,destroyed:true}); assert.deepEqual(timeoutCleanup,{timedOut:true,destroyed:true});
// Proof pop-up (Marcus, 2026-12-02): only above 10 m, not mandatory; closing
// it is going on without a proof, and the cart summary follows the answer.
assert.deepEqual(await evaluate(`[pedidoLongo([{cob:10}]),pedidoLongo([{cob:6},{cob:4.5}])]`),[false,true]);
assert.equal(await evaluate(`perguntaProva()`),false);
assert.equal(await evaluate(`$('provaDlg').open`),false);
await evaluate(`window.provaLongo=pedidoLongo; pedidoLongo=()=>true; window.provaResp=perguntaProva(); 1`);
await waitFor(()=>evaluate(`$('provaDlg').open && document.activeElement.id==='provaSim'`),'proof pop-up opens');
assert.equal(await evaluate(`perguntaProva()`),null);
await click('#provaSim');
assert.equal(await evaluate(`window.provaResp`),true);
assert.equal(await evaluate(`querProva && $('resLin').textContent.includes('Prova antes de imprimir')`),true);
await evaluate(`window.provaResp=perguntaProva(); 1`);
await click('#provaNao');
assert.equal(await evaluate(`window.provaResp`),false);
assert.equal(await evaluate(`$('resLin').textContent.includes('Prova antes de imprimir')`),false);
await evaluate(`window.provaResp=perguntaProva(); $('provaDlg').close(); 1`);
assert.equal(await evaluate(`window.provaResp`),false);
await evaluate(`pedidoLongo=window.provaLongo; 1`);
// Inspect the supplied local artwork, when requested, using the real file input. // Inspect the supplied local artwork, when requested, using the real file input.
if(process.env.ARTWORK_FILE){ if(process.env.ARTWORK_FILE){
await click('#bVoltar');await click('[data-modo="file"]'); await click('#bVoltar');await click('[data-modo="file"]');
@@ -629,6 +647,6 @@ try{
console.log('Supplied image:',JSON.stringify(layout)); console.log('Supplied image:',JSON.stringify(layout));
} }
assert.deepEqual(errors,[]); assert.deepEqual(errors,[]);
console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, stale renders, strict inline CSP.'); console.log('PASS: PNG upload and drop, JPG refused, packed copies, 5 mm gaps, aspect ratio, live width/quantity/rotation/mirror, metres, ready-sheet pricing/repeats, residue and solid background stop the order, UV, proof pop-up above 10 m, stale renders, strict inline CSP.');
}catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;} }catch(error){console.error(error);if(stderr)console.error(stderr.slice(-1200));process.exitCode=1;}
finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));} finally{ws?.close();chrome.kill();server.closeAllConnections();await new Promise(r=>server.close(r));}

View File

@@ -526,6 +526,8 @@
const totalArquivos=item=>(item.localFiles||[]).length+(item.savedFiles||[]).length; const totalArquivos=item=>(item.localFiles||[]).length+(item.savedFiles||[]).length;
if (semCap.some(item=>totalArquivos(item)>200)) if (semCap.some(item=>totalArquivos(item)>200))
return message('Este item tem mais de 200 arquivos. Divida em dois itens.','error'); return message('Este item tem mais de 200 arquivos. Divida em dois itens.','error');
// Above 10 m the pop-up asks for the proof; the answer is part of the order.
if ((await perguntaProva())===null || busy) return;
const initialCart=cartSnapshot(); const initialCart=cartSnapshot();
busy = true; busy = true;
$('bPagar').disabled = true; $('bPagar').disabled = true;
@@ -576,8 +578,8 @@
...(cupom?{coupon:cupom}:{})}; ...(cupom?{coupon:cupom}:{})};
const destination = destinoApi(); const destination = destinoApi();
if (destination) content.destination = destination; if (destination) content.destination = destination;
// "Quero aprovar uma prova antes de imprimir": the order waits for the customer. // "Quero aprovar uma prova", chosen in the pop-up: the order waits for the customer.
if ($('fProva')?.checked) content.proof = true; if (querProva) content.proof = true;
// Ajuste Fino: true for every art, or the [item, source] pairs chosen. // Ajuste Fino: true for every art, or the [item, source] pairs chosen.
const treatment=tratamentoParaItens(sheets); const treatment=tratamentoParaItens(sheets);
if (treatment) content.treatment = treatment; if (treatment) content.treatment = treatment;

View File

@@ -1126,15 +1126,6 @@ h2 em{font-style:normal;color:var(--laranja)}
</div> </div>
</div> </div>
<div class="cxE">
<h4>Prova antes de imprimir</h4>
<label class="provaOp"><input type="checkbox" id="fProva">
<span><b>Quero aprovar uma prova antes de imprimir</b>
Imprimimos uma prova de até 30 cm e mandamos a foto pelo WhatsApp. O resto sai depois
que você aprovar. Até 3 provas por pedido, sem custo.</span></label>
<p class="provaMin" id="provaMin" hidden>A prova é para pedidos acima de 10 m.</p>
</div>
<div class="cxE" id="tratamentoBox" hidden> <div class="cxE" id="tratamentoBox" hidden>
<h4>Ajuste Fino</h4> <h4>Ajuste Fino</h4>
<label class="provaOp"><input type="checkbox" id="fTratamento"> <label class="provaOp"><input type="checkbox" id="fTratamento">
@@ -1242,6 +1233,15 @@ h2 em{font-style:normal;color:var(--laranja)}
</div> </div>
</div></footer> </div></footer>
<!-- A prova no pagamento (Marcus, 2026-12-02): fora dos painéis, que se escondem. -->
<dialog class="ampliaDlg mistaDlg" id="provaDlg" aria-labelledby="provaTit">
<div class="ampliaCab"><b id="provaTit">Prova antes de imprimir</b></div>
<div class="mistaCorpo">
<p>Imprimimos uma prova de até 30 cm e mandamos a foto pelo WhatsApp. O resto sai depois
que você aprovar. Até 3 provas por pedido, sem custo.</p>
<div class="mistaBot"><button type="button" class="ec-go" id="provaSim">Quero aprovar uma prova</button><button type="button" id="provaNao">Seguir sem prova</button></div>
</div>
</dialog>
<!-- The Site's behaviour, split by responsibility. Classic scripts on purpose: <!-- The Site's behaviour, split by responsibility. Classic scripts on purpose:
they share one global scope and run in this order, which is exactly how the they share one global scope and run in this order, which is exactly how the
single inline script this replaces behaved. Order is therefore significant. --> single inline script this replaces behaved. Order is therefore significant. -->

View File

@@ -224,6 +224,26 @@ function folhasEstreitas(it){
'Folha de '+n1(Number(s.width_cm))+' cm no tamanho real, centralizada no filme de '+ 'Folha de '+n1(Number(s.width_cm))+' cm no tamanho real, centralizada no filme de '+
String(filme).replace('.',',')+' cm'); String(filme).replace('.',',')+' cm');
} }
// A prova é para pedidos acima de 10 m (Dropstar, 2026-10-28; o
// PROOF_ABOVE_METRES do servidor) e não é obrigatória: no pagamento um pop-up
// pergunta (Marcus, 2026-12-02). Fechar sem escolher é seguir sem prova.
let querProva=false;
function pedidoLongo(aPagar=itensAPagar()){
return aPagar.reduce((t,it)=>t+(it.cob||0),0)>10;
}
// Resolve com a escolha; null quando o pop-up já está aberto (clique repetido).
function perguntaProva(){
const dlg=$('provaDlg');
if(dlg?.open) return Promise.resolve(null);
querProva=false;
if(!dlg || !pedidoLongo()){ pintaPedido(); return Promise.resolve(false); }
return new Promise(resolve=>{
dlg.returnValue='';
dlg.onclose=()=>{ dlg.onclose=null; querProva=dlg.returnValue==='sim'; pintaPedido(); resolve(querProva); };
dlg.showModal();
$('provaSim').focus();
});
}
// O carrinho junta itens de produtos diferentes e cobra uma vez só. // O carrinho junta itens de produtos diferentes e cobra uma vez só.
function pintaPedido(){ function pintaPedido(){
const aPagar = itensAPagar(); const aPagar = itensAPagar();
@@ -309,7 +329,7 @@ function pintaPedido(){
' · +24 h</span><b>'+rs(tratamento)+'</b></div>':'')+ ' · +24 h</span><b>'+rs(tratamento)+'</b></div>':'')+
(redesenho?'<div class="l"><span>Ajuste Fino Redesenho · '+artesRedesenho+ (redesenho?'<div class="l"><span>Ajuste Fino Redesenho · '+artesRedesenho+
(artesRedesenho===1?' arte':' artes')+' · +48 h</span><b>'+rs(redesenho)+'</b></div>':'')+ (artesRedesenho===1?' arte':' artes')+' · +48 h</span><b>'+rs(redesenho)+'</b></div>':'')+
($('fProva')?.checked?'<div class="l"><span>Prova antes de imprimir</span>'+ (querProva && pedidoLongo(aPagar)?'<div class="l"><span>Prova antes de imprimir</span>'+
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>':'')+ '<b><span style="color:var(--verde-ml)">Grátis</span></b></div>':'')+
'<div class="l"><span>Revisão e reencaixe</span>'+ '<div class="l"><span>Revisão e reencaixe</span>'+
'<b><span style="color:var(--verde-ml)">Grátis</span></b></div>'; '<b><span style="color:var(--verde-ml)">Grátis</span></b></div>';
@@ -322,12 +342,6 @@ function pintaPedido(){
: n>1 : n>1
? 'Pagar os '+n+' itens de uma vez' ? 'Pagar os '+n+' itens de uma vez'
: 'Ir para o pagamento'; : 'Ir para o pagamento';
// The proof is only for orders above 10 m (Dropstar, 2026-10-28; the server's
// PROOF_ABOVE_METRES). Below it the box stays, closed, and says the rule
// (Rodada 5, B3).
const prova=$('fProva');
if(prova){ const longo=aPagar.reduce((t,it)=>t+(it.cob||0),0)>10;
prova.disabled=!longo; if(!longo) prova.checked=false; $('provaMin').hidden=longo; }
$('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk() || falta>0; $('bPagar').disabled = !cartPodeEnviar() || !entrega.cotado || !clienteOk() || !enderecoOk() || falta>0;
if(pedido.length || itemAtual) $('carr').classList.add('on'); if(pedido.length || itemAtual) $('carr').classList.add('on');
if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho; if($('cartN')){ $('cartN').textContent=noCarrinho>99?'99+':noCarrinho; $('cartN').hidden=!noCarrinho;
@@ -432,7 +446,8 @@ function avisaDesfazer(texto,acao){
function fechaDesfazer(){ clearTimeout(desfazerTimer); desfazerAcao=null; $('desfazer').hidden=true; } function fechaDesfazer(){ clearTimeout(desfazerTimer); desfazerAcao=null; $('desfazer').hidden=true; }
addEventListener('dtf-page-changed',fechaDesfazer); addEventListener('dtf-page-changed',fechaDesfazer);
$('desfazerBtn').addEventListener('click',()=>{ const acao=desfazerAcao; fechaDesfazer(); if(acao) acao(); }); $('desfazerBtn').addEventListener('click',()=>{ const acao=desfazerAcao; fechaDesfazer(); if(acao) acao(); });
$('fProva')?.addEventListener('change',()=>pintaPedido()); $('provaSim')?.addEventListener('click',()=>$('provaDlg').close('sim'));
$('provaNao')?.addEventListener('click',()=>$('provaDlg').close('nao'));
$('fTratamento')?.addEventListener('change',()=>{ $('fTratamento')?.addEventListener('change',()=>{
if($('fTratamento').checked){ ajusteTudo=true; limpaRedesenho(); } if($('fTratamento').checked){ ajusteTudo=true; limpaRedesenho(); }
else limpaAjuste(); else limpaAjuste();

View File

@@ -32,7 +32,7 @@ const TEXTO_MISTA={
// avulsa: imprimir assim mesmo (C1), ou trocar o arquivo por dois. // avulsa: imprimir assim mesmo (C1), ou trocar o arquivo por dois.
function perguntaMista(){ function perguntaMista(){
const dlg=$('mistaDlg'); const dlg=$('mistaDlg');
if(!dlg || dlg.open || $('larguraDlg')?.open || $('tamanhoDlg')?.open) return; if(!dlg || dlg.open || $('larguraDlg')?.open || $('tamanhoDlg')?.open || $('provaDlg')?.open) return;
const lista=ehFolha()?folhas:artes; const lista=ehFolha()?folhas:artes;
const x=lista.find(y=>!y.mistaVista && mista(tracoDoArquivo(y))); const x=lista.find(y=>!y.mistaVista && mista(tracoDoArquivo(y)));
if(!x) return; if(!x) return;

View File

@@ -372,7 +372,6 @@ section+section{border-top:0}
.provaOp input{margin-top:3px;width:17px;height:17px;flex:none;accent-color:var(--laranja)} .provaOp input{margin-top:3px;width:17px;height:17px;flex:none;accent-color:var(--laranja)}
.provaOp b{display:block;color:var(--preto);font-weight:700} .provaOp b{display:block;color:var(--preto);font-weight:700}
.provaOp:has(input:disabled){cursor:default;opacity:.55} .provaOp:has(input:disabled){cursor:default;opacity:.55}
.provaMin{margin:8px 0 0 27px;font-size:14px;color:var(--fraco)}
.cp input,.cepL input{height:46px;border-radius:var(--raio2)} .cp input,.cepL input{height:46px;border-radius:var(--raio2)}
.cp input:focus,.cepL input:focus{border-color:var(--laranja2);box-shadow:0 0 0 3px rgba(255,168,26,.18)} .cp input:focus,.cepL input:focus{border-color:var(--laranja2);box-shadow:0 0 0 3px rgba(255,168,26,.18)}
.opE{border-radius:12px} .opE{border-radius:12px}