[object Object]

← back to Dw Photo Capture

TK-12162: show a dw_unified save-status line on all 4 capture pages, independent of the Shopify draft result

a99636b361e3694ef4e763d2d3c26aa31844f85d · 2026-09-24 14:49:16 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit a99636b361e3694ef4e763d2d3c26aa31844f85d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 24 14:49:16 2026 -0700

    TK-12162: show a dw_unified save-status line on all 4 capture pages, independent of the Shopify draft result
    
    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---
 public/simple-instant.html  |  8 +++++++-
 public/simple-minimal.html  | 11 +++++++++++
 public/simple-probooth.html |  7 +++++++
 public/simple-wizard.html   | 15 ++++++++++++---
 4 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/public/simple-instant.html b/public/simple-instant.html
index 7c54ab5..4b5a125 100644
--- a/public/simple-instant.html
+++ b/public/simple-instant.html
@@ -435,7 +435,13 @@
       if (r.duplicate){ toast('⚠ ' + (r.err || 'already in catalog')); saveBtn.disabled = false; saveBtn.textContent = prevLabel; return; }
       if (!r.ok){ toast('✗ ' + (r.err || 'save failed')); saveBtn.disabled = false; saveBtn.textContent = prevLabel; return; }
       sessCount++; sessCountEl.textContent = sessCount;
-      toast('✅ Saved ' + (r.dw_sku || 'item'));
+      // dw_unified is a SEPARATE write from the Shopify draft (server.js createNewItem stages
+      // into new_items_staging) — r.ok only means the Shopify draft succeeded, so it's called
+      // out here rather than assumed.
+      var dwuMsg = r.dw_unified
+        ? (r.dw_unified.committed ? ' · ✓ dw_unified' : ' · ⚠ dw_unified failed')
+        : '';
+      toast('✅ Saved ' + (r.dw_sku || 'item') + dwuMsg, dwuMsg ? 3600 : undefined);
       setTimeout(resetToLive, 550);
     }catch(e){ toast('✗ network error'); saveBtn.disabled = false; saveBtn.textContent = prevLabel; }
   });
diff --git a/public/simple-minimal.html b/public/simple-minimal.html
index 6efd019..a4527b6 100644
--- a/public/simple-minimal.html
+++ b/public/simple-minimal.html
@@ -415,6 +415,16 @@
     };
   }
 
+  // dw_unified is a SEPARATE write from the Shopify draft (server.js createNewItem stages into
+  // new_items_staging); the create-item response can be ok:true with dw_unified failed, so this
+  // is shown independently rather than folded into the main ok/err branch.
+  function setDwUni(dwu){
+    if (!dwu) { rcDwUni.hidden = true; return; }
+    rcDwUni.hidden = false;
+    if (dwu.committed) { rcDwUni.className = 'rc-dwuni ok'; rcDwUni.textContent = '✓ saved to dw_unified'; }
+    else { rcDwUni.className = 'rc-dwuni warn'; rcDwUni.textContent = '⚠ dw_unified write failed — Shopify draft still created'; }
+  }
+
   function showResult(ok, info){
     var elapsed = performance.now() - tStart;
     toResult();
@@ -437,6 +447,7 @@
       rcSku.textContent = info.mfr + '  ·  ' + info.vendor;
       rcDetail.textContent = 'Auto-create is off — nothing was saved.';
     } else {
+      rcDwUni.hidden = true;
       rcard.className = 'rcard err';
       rcIcon.textContent = '✗';
       rcTitle.textContent = info.duplicate ? 'Already in the catalog' : "Couldn't save";
diff --git a/public/simple-probooth.html b/public/simple-probooth.html
index c08385e..4914e0d 100644
--- a/public/simple-probooth.html
+++ b/public/simple-probooth.html
@@ -237,6 +237,7 @@
 <div class="screen" id="saved" hidden>
   <div class="big">✓</div>
   <div class="sku" id="savedSku">DW—</div>
+  <div class="sub" id="savedDwUni" hidden></div>
   <div class="sub">Saved as a Shopify <b>draft</b> — never auto-published. Adjustments and camera stay warm for the next sample.</div>
   <button class="btn gold" id="nextBtn">Next sample</button>
   <div id="sessN2"></div>
@@ -476,6 +477,12 @@ $('#saveBtn').addEventListener('click',async ()=>{
   if(!r || !r.ok){ $('#xstat').textContent='✗ '+((r&&r.err)||'save failed'); $('#xstat').classList.remove('on'); b.disabled=false; return; }
   sess++;
   $('#savedSku').textContent=r.dw_sku||'saved';
+  // dw_unified is a SEPARATE write from the Shopify draft (server.js createNewItem stages into
+  // new_items_staging) — r.ok only means the Shopify draft succeeded, so it's shown independently.
+  const dwuEl=$('#savedDwUni');
+  if(r.dw_unified){ dwuEl.hidden=false; dwuEl.style.color=r.dw_unified.committed?'var(--ok)':'var(--err)';
+    dwuEl.textContent=r.dw_unified.committed?'✓ saved to dw_unified':'⚠ dw_unified write failed'; }
+  else dwuEl.hidden=true;
   $('#sessN').textContent=sess+' ✓'; $('#sessN2').textContent=sess+' saved this session';
   $('#result').hidden=true; $('#saved').hidden=false;
   toast('✅ Draft created'+(r.dw_sku?': '+r.dw_sku:''));
diff --git a/public/simple-wizard.html b/public/simple-wizard.html
index 986a68e..f48da52 100644
--- a/public/simple-wizard.html
+++ b/public/simple-wizard.html
@@ -523,9 +523,9 @@
     mark('createResolved');
 
     if(r && r.ok){
-      showDone({ ok:true, dw_sku: r.dw_sku, vendor, title: 'Sample Captured!', sub: 'This sample is now a draft in the catalog.' });
+      showDone({ ok:true, dw_sku: r.dw_sku, vendor, dw_unified: r.dw_unified, title: 'Sample Captured!', sub: 'This sample is now a draft in the catalog.' });
     } else if(r && r.duplicate){
-      showDone({ ok:true, dw_sku: (r.preview && r.preview.dw_sku) || '', vendor, title: 'Already in the catalog', sub: 'This exact sample is already on file — nothing more to do here.' });
+      showDone({ ok:true, dw_sku: (r.preview && r.preview.dw_sku) || '', vendor, dw_unified: r.dw_unified, title: 'Already in the catalog', sub: 'This exact sample is already on file — nothing more to do here.' });
     } else {
       showDone({ ok:false, title: 'Photo saved', sub: 'The catalog step needs a hand from staff for this one (' + ((r && r.err) || 'unknown issue') + ').' });
     }
@@ -538,9 +538,18 @@
     $('doneIcon').style.background = info.ok ? 'var(--accent)' : 'var(--warn)';
     if(info.ok && info.dw_sku){
       $('doneCard').style.display = 'block';
+      // dw_unified is a SEPARATE write from the Shopify draft (server.js createNewItem stages
+      // into new_items_staging) — ok:true here only means the Shopify draft succeeded, so this
+      // row is shown independently rather than assumed from the overall ok.
+      var dwuRow = info.dw_unified
+        ? '<div class="row"><span class="k">dw_unified</span><span class="v" style="color:' +
+          (info.dw_unified.committed ? 'var(--accent)' : 'var(--warn)') + '">' +
+          (info.dw_unified.committed ? '✓ saved' : '⚠ failed') + '</span></div>'
+        : '';
       $('doneCard').innerHTML =
         '<div class="row"><span class="k">DW SKU</span><span class="v">' + esc(info.dw_sku) + '</span></div>' +
-        '<div class="row"><span class="k">Vendor</span><span class="v">' + esc(info.vendor || '—') + '</span></div>';
+        '<div class="row"><span class="k">Vendor</span><span class="v">' + esc(info.vendor || '—') + '</span></div>' +
+        dwuRow;
       $('errCard').style.display = 'none';
     } else {
       $('doneCard').style.display = 'none';

← e7a5066 TK-12162: auto-save only for registry vendors; case-insensit  ·  back to Dw Photo Capture  ·  TK-12162: Tres Tintas DWTT/DWRW -> DWTS restore maps + delet 34ac646 →