From 7446a551f605a6e4af369148c97db63d430a500f Mon Sep 17 00:00:00 2001 From: pavlov346346-source Date: Wed, 16 Sep 2026 13:46:08 +0300 Subject: [PATCH] fix: allow premium-dark/premium-emerald in template id whitelists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two separate Set-based whitelists (OFFER_TEMPLATE_IDS in app-runtime.js and TEMPLATE_IDS in ux-fixes-v1764.js) validated any explicit template selection before persisting/rendering it, but neither had been updated when premium-dark/premium-emerald were added. The per-order "Оформление PDF" picker's click handler calls persistOfferTemplate(), which silently returned false when the id failed this check -- so clicking either premium card in an order's offer modal did nothing, no error, no toast. Verified end-to-end against a real order: both ids now persist and the picker shows the selected state correctly. Also bumped performance.js's internal RELEASE tag, since it gates the cache-busting query string used to dynamically load ux-fixes-v1764.js and eight other core modules -- otherwise this fix would hit the same stale-cache issue just fixed in index.html. Co-Authored-By: Claude Sonnet 5 --- public/app-runtime.js | 2 +- public/core/performance.js | 2 +- public/core/ux-fixes-v1764.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app-runtime.js b/public/app-runtime.js index ff3627c..2dd8054 100644 --- a/public/app-runtime.js +++ b/public/app-runtime.js @@ -1101,7 +1101,7 @@ window.SUN_LEGACY_CATALOG_V175=[{"id":"1","name":"Фуршетный бокс } const OFFER_TEMPLATE_KEY='sunOfferTemplateV1'; - const OFFER_TEMPLATE_IDS=new Set(['cream-elegance','neon-menu','emerald-circles','midnight-checklist','gourmet-hero','diamond-gold','light','midnight-glass','editorial-grid','warm-sun','bento-cards','event-story','black-gold','personal-letter','event-ticket','solar-experience','midnight-compact','emerald-gold','neon-emerald']); + const OFFER_TEMPLATE_IDS=new Set(['cream-elegance','neon-menu','emerald-circles','midnight-checklist','gourmet-hero','diamond-gold','premium-dark','premium-emerald','light','midnight-glass','editorial-grid','warm-sun','bento-cards','event-story','black-gold','personal-letter','event-ticket','solar-experience','midnight-compact','emerald-gold','neon-emerald']); function offerTemplateId(){ try{ const api=window.SunOfferTemplate?.get?.(); diff --git a/public/core/performance.js b/public/core/performance.js index 0481ac3..70df1c6 100644 --- a/public/core/performance.js +++ b/public/core/performance.js @@ -1,7 +1,7 @@ (()=>{ 'use strict'; const VERSION='17.7.3'; - const RELEASE='20260912-v17-7-6-signature-auth'; + const RELEASE='20260916-v18-1-1-template-whitelist-fix'; const hasStoredSession=()=>{try{return Object.keys(localStorage).some(k=>/^sb-.*-auth-token$/i.test(k)&&String(localStorage.getItem(k)||'').length>20)}catch(_){return false}}; function installAuthBoot(){ diff --git a/public/core/ux-fixes-v1764.js b/public/core/ux-fixes-v1764.js index 057cdec..e0378ff 100644 --- a/public/core/ux-fixes-v1764.js +++ b/public/core/ux-fixes-v1764.js @@ -6,7 +6,7 @@ const RELEASE_DAY='2026-09-07'; const AUTO_DELAY_MS=60*1000; const AUTO_POLL_MS=15000; - const TEMPLATE_IDS=new Set(['cream-elegance','neon-menu','emerald-circles','midnight-checklist','gourmet-hero','diamond-gold','light','midnight-glass','editorial-grid','warm-sun','bento-cards','event-story','black-gold','personal-letter','event-ticket','solar-experience','midnight-compact','emerald-gold','neon-emerald']); + const TEMPLATE_IDS=new Set(['cream-elegance','neon-menu','emerald-circles','midnight-checklist','gourmet-hero','diamond-gold','premium-dark','premium-emerald','light','midnight-glass','editorial-grid','warm-sun','bento-cards','event-story','black-gold','personal-letter','event-ticket','solar-experience','midnight-compact','emerald-gold','neon-emerald']); const $=id=>document.getElementById(id); const qa=(s,r=document)=>[...r.querySelectorAll(s)]; const esc=v=>window.SunSafe?.escapeHTML?window.SunSafe.escapeHTML(String(v??'')):String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));