[object Object]

← back to Wallco Ai

pdp: universal room-size-mural injector for theme variants (prod serves v12-roomsplit)

d9c4f540fe4f4b10e69c91b2787aadbcffc3b219 · 2026-06-03 21:33:02 -0700 · Steve Abrams

prod default theme is client-side v12-roomsplit, so the bare-PDP server-rendered
block never showed live. MURAL_PDP_INJECT in themeVariantSend injects the Room-size
mural card (from the deployed design.mural API field) above the footer across all
17 variants. Validated on roomsplit locally.

Files touched

Diff

commit d9c4f540fe4f4b10e69c91b2787aadbcffc3b219
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Jun 3 21:33:02 2026 -0700

    pdp: universal room-size-mural injector for theme variants (prod serves v12-roomsplit)
    
    prod default theme is client-side v12-roomsplit, so the bare-PDP server-rendered
    block never showed live. MURAL_PDP_INJECT in themeVariantSend injects the Room-size
    mural card (from the deployed design.mural API field) above the footer across all
    17 variants. Validated on roomsplit locally.
---
 server.js | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/server.js b/server.js
index 3499956..3a77cde 100644
--- a/server.js
+++ b/server.js
@@ -619,6 +619,26 @@ function injectSmartFixLink(file, id) {
 }
 
 const _themeVariantCache = {};
+// Universal room-size-mural injector for theme variants. They render client-side
+// from /api/design/:id; if design.mural.available, append a "Room-size mural"
+// card (preview + 24/36/54in panel chips) above the footer. One inject covers
+// all 17 variants incl. the prod default (v12-roomsplit), where the bare-PDP
+// server-rendered block never reaches.
+const MURAL_PDP_INJECT = `
+<script>(function(){
+  var m=location.pathname.match(/\\/design\\/(\\d+)/); if(!m) return;
+  fetch('/api/design/'+m[1]).then(function(r){return r.json();}).then(function(d){
+    var mu=d&&d.design&&d.design.mural; if(!mu||!mu.available) return;
+    if(document.querySelector('.mural-block-injected')) return;
+    var pn=mu.panels||{}, ft=mu.print_ft||12, ht=mu.height_ft||11;
+    var chips=Object.keys(pn).map(function(k){return '<span style="padding:3px 10px;background:#f3efe6;border:1px solid #e3ddd0;border-radius:999px;font-size:12px;color:#3a2f1f"><b style="color:#7a5c2e">'+pn[k]+'</b> &times; '+k.replace('in','&quot;')+'</span>';}).join('');
+    var el=document.createElement('section'); el.className='mural-block-injected'; el.style.cssText='max-width:760px;margin:36px auto;padding:0 24px';
+    el.innerHTML='<div style="border:1px solid #e8e6e1;border-radius:10px;overflow:hidden;background:#fff"><div style="padding:12px 16px;border-bottom:1px solid #eee;font-weight:600;color:#7a5c2e;display:flex;justify-content:space-between;align-items:baseline"><span>Room-size mural</span><span style="font-size:12px;color:#999;font-weight:400">'+ft+'ft &times; '+ht+'ft &middot; panelized</span></div><img src="'+mu.preview_url+'" loading="lazy" alt="room-size scenic mural" style="width:100%;display:block"><div style="padding:14px 16px"><p style="font-size:13px;line-height:1.6;color:#5a4a33;margin:0 0 10px">Available as a full-wall scenic mural &mdash; one continuous '+ft+'ft &times; '+ht+'ft scene at 150&nbsp;DPI with a 6&quot; install bleed top &amp; bottom, split into vertical panels (pick your width):</p><div style="display:flex;gap:8px;flex-wrap:wrap">'+chips+'</div></div></div>';
+    var foot=document.querySelector('.site-footer, footer');
+    if(foot&&foot.parentNode){foot.parentNode.insertBefore(el,foot);} else {document.body.appendChild(el);}
+  }).catch(function(){});
+})();</script>`;
+
 function themeVariantSend(req, res, file) {
   const id = parseInt(req.params.id, 10);
   if (!Number.isFinite(id) || id < 1) return res.status(404).type('html').send('<h1>404</h1>');
@@ -639,6 +659,11 @@ function themeVariantSend(req, res, file) {
       if (!/site-footer/.test(html)) {
         html = html.replace(/<\/body>/i, `\n${FOOTER}\n<script src="/corner-nav.js" defer></script>\n</body>`);
       }
+      // Universal room-size-mural block — covers ALL theme variants (incl. the
+      // prod default v12-roomsplit) from the one API field, no per-file edits.
+      if (!/mural-block-injected/.test(html)) {
+        html = html.replace(/<\/body>/i, `${MURAL_PDP_INJECT}\n</body>`);
+      }
       _themeVariantCache[file] = html;
     }
     res.type('html').send(html);

← 5dc7d6a fix: digital-for-sale also unpublishes spoon_all_designs (pr  ·  back to Wallco Ai  ·  pdp: inject room-size-mural block on the LIVE-default-theme 0edfa2a →