@blamejs/blamejs-shop 0.3.48 → 0.3.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,8 @@ upgrading across more than a few patches at a time.
8
8
 
9
9
  ## v0.3.x
10
10
 
11
+ - v0.3.49 (2026-06-02) — **Real collection tiles on the home page, a working mobile nav, Collections/Categories in the header, and From-price on multi-variant products.** The home page's 'Featured collections' band linked to fixed keyword searches that landed on empty results unless a product happened to contain those words, the header navigation disappeared entirely on phones with no menu to replace it, and the two real catalog-browse surfaces (Collections and Categories) were reachable only from the footer. This release resolves those: the home tiles now render the store's actual collections with real links, the header gains a no-JavaScript mobile menu, and Collections and Categories appear in the primary nav. Multi-variant products now show a 'From <lowest price>' headline instead of always showing the first variant's price, the non-functional 'New arrivals'/'On sale' sort links are removed, and two small accessibility fixes land (the survey required-field marker and a dark color-scheme hint for native form controls). **Changed:** *Home 'Featured collections' tiles render real collections* — The featured-collections band on the home page now lists the store's actual collections with links to each collection page, instead of fixed keyword searches that could land on an empty results page. If no collections are defined, the band is omitted rather than shown empty. Both the cached and dynamically rendered home pages produce identical markup. · *Mobile navigation menu (no JavaScript required)* — On narrow screens the header now offers a disclosure menu that reveals the navigation links, which previously vanished entirely below a tablet width. It is a pure-CSS menu, so it works with JavaScript disabled. · *Collections and Categories in the header navigation* — The two catalog-browse surfaces — Collections and Categories — are now in the primary header navigation (and inside the mobile menu), not only in the footer. · *Multi-variant products show a 'From' price* — A product whose variants differ in price now shows a 'From <lowest price>' headline so the prominent price is no longer misleading when a shopper selects a different variant; each variant chip still shows its own exact price. · *Removed non-functional sort links* — The 'New arrivals' and 'On sale' links did nothing — the home page does not yet support sorting — so they have been removed rather than left as dead controls. They will return if and when catalog sorting is added. · *Accessibility: survey required marker and dark color-scheme* — The survey form's required-field marker is now announced correctly to screen readers, and the theme declares a dark color-scheme so native form controls, scrollbars, and autofill render correctly on the dark surface.
12
+
11
13
  - v0.3.48 (2026-06-02) — **Customers can export or request deletion of their personal data, and the admin console gets a privacy-request queue to fulfil it.** The framework had a complete data-subject-request engine but nothing reached it, so a store handling EU/California personal data had no way for a shopper to exercise their right of access or erasure and no operator path to fulfil one. A signed-in customer can now request a full export of their data — account, addresses, orders, subscriptions, loyalty, and support history, streamed as a downloadable JSON bundle — and can file a deletion request. The admin console gets a Privacy requests screen where an operator reviews each request, downloads the export, previews a deletion (a dry run that changes nothing), and then executes it. Erasure anonymizes the customer's account and archives their addresses and subscriptions while retaining orders, loyalty ledger, and support tickets that must be kept for tax and legal records. A customer can only ever see or act on their own requests; deletion is always filed by the customer and carried out by an operator. **Added:** *Customer data export and deletion requests* — A signed-in customer gets a Privacy & data area under their account where they can request a full export of their personal data and file a deletion request. The export is streamed as a downloadable JSON bundle covering their account, addresses, orders, subscriptions, loyalty balance and ledger, and support history. A customer can only access their own requests and downloads; a request belonging to anyone else returns not-found. · *Privacy-request queue in the admin console* — A new Privacy requests screen lists every data-subject request with its status. An operator can download a request's export, preview a deletion as a dry run that reports what would change without modifying anything, and then execute the deletion behind a confirmation step. Deletion anonymizes the customer's account and archives their addresses and subscriptions, while orders, the loyalty ledger, and support tickets are retained for tax and legal record-keeping. Every customer- and operator-entered field shown in either console is HTML-escaped.
12
14
 
13
15
  - v0.3.47 (2026-06-01) — **Admin product detail, collections list, and order shipment panels load with fewer database round trips.** Three admin-console screens re-derived data with one database query per item: the product-detail screen ran a query per variant per currency for current and historical prices, the collections list pulled up to 200 member rows for each collection just to count them, and the order-detail shipment panel hydrated each shipment and its labels sequentially. These now read in batched or parallel queries. The displayed data is unchanged, with one correctness improvement: a manual collection with more than 200 members now shows its true product count instead of a number capped at 200. **Changed:** *Batched admin product-detail price hydration* — The admin product-detail screen now loads every variant's current and historical prices across all currencies in a single batched query instead of one query per variant per currency. The screen renders identically. · *Collections list counts without pulling member rows* — The admin collections list now counts a manual collection's members with a COUNT query instead of fetching up to 200 member rows per collection. A manual collection with more than 200 members now shows its true count (previously the displayed count was capped at 200); rule-based collections keep their existing bounded preview count. · *Parallel shipment hydration on order detail* — The order-detail shipment panel now hydrates each shipment and its labels in parallel rather than one after another, so an order with several shipments opens faster.
@@ -1,13 +1,13 @@
1
1
  {
2
- "version": "0.3.48",
2
+ "version": "0.3.49",
3
3
  "assets": {
4
4
  "css/admin.css": {
5
- "integrity": "sha384-1SIn6oAf1DjECbRfKENZasdKHJiywGdXR58wn0hsFGcdVHzUmvfgMkEz5ANIAZJ3",
6
- "fingerprinted": "css/admin.72c808274ebcefd9.css"
5
+ "integrity": "sha384-/NizdENQkTc96romD0kmnl8220NAvW32QI0aSFuGiPbWE5lYbRxLXU5shsjlx5Ek",
6
+ "fingerprinted": "css/admin.f028b2e410387546.css"
7
7
  },
8
8
  "css/main.css": {
9
- "integrity": "sha384-kbtcIsmD7X/DDsTJIYQ49JexBKXkz/GU1aQ8430XEyHHW/hcOPMWqbgZ7wRqvsbT",
10
- "fingerprinted": "css/main.37860144b12a94fe.css"
9
+ "integrity": "sha384-9rtEz2wKJbpfALccIipRdo/BWVQZi5O4IufqaLO/7jFyLK1xxCaDc/65Apjy8dbs",
10
+ "fingerprinted": "css/main.1a1a379d6f58e2c0.css"
11
11
  },
12
12
  "js/announcement.js": {
13
13
  "integrity": "sha384-z4zcEMn+tScoVnYRE4nEf8N/oyvpxdpaxTNrT4QO/jURChid4+qjAvWkzatCaAPq",
package/lib/storefront.js CHANGED
@@ -306,12 +306,7 @@ var LAYOUT =
306
306
  " <button type=\"submit\">{{search_submit}}</button>\n" +
307
307
  " </div>\n" +
308
308
  " </form>\n" +
309
- " <nav class=\"site-nav\" aria-label=\"Primary\">\n" +
310
- " <a class=\"site-nav__link\" href=\"/\">{{nav_shop}}</a>\n" +
311
- " <a class=\"site-nav__link\" href=\"/#framework\">{{nav_framework}}</a>\n" +
312
- " <a class=\"site-nav__icon\" href=\"/account\" aria-label=\"{{nav_account}}\"><svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\"><path d=\"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7 9a7 7 0 0 1 14 0\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\"/></svg></a>\n" +
313
- " <a class=\"cart-pill\" href=\"/cart\" aria-label=\"{{nav_cart_aria}}\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path d=\"M3 4h2l2.4 12.1a2 2 0 0 0 2 1.6h7.6a2 2 0 0 0 1.95-1.55L21 8H6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle cx=\"10\" cy=\"21\" r=\"1.4\" fill=\"currentColor\"/><circle cx=\"17\" cy=\"21\" r=\"1.4\" fill=\"currentColor\"/></svg><span class=\"cart-pill__count\">{{cart_count}}</span></a>\n" +
314
- " </nav>\n" +
309
+ " RAW_PRIMARY_NAV\n" +
315
310
  " </div>\n" +
316
311
  " </header>\n" +
317
312
  "\n" +
@@ -349,8 +344,6 @@ var LAYOUT =
349
344
  " <li><a href=\"/\">{{footer_shop_all}}</a></li>\n" +
350
345
  " <li><a href=\"/collections\">{{footer_shop_collections}}</a></li>\n" +
351
346
  " <li><a href=\"/categories\">{{footer_shop_categories}}</a></li>\n" +
352
- " <li><a href=\"/?sort=new\">{{footer_shop_new}}</a></li>\n" +
353
- " <li><a href=\"/?sort=sale\">{{footer_shop_sale}}</a></li>\n" +
354
347
  " <li><a href=\"/compare\">{{footer_shop_compare}}</a></li>\n" +
355
348
  " <li><a href=\"/cart\">{{footer_shop_cart}}</a></li>\n" +
356
349
  " <li><a href=\"/terms\">{{footer_shop_shipping}}</a></li>\n" +
@@ -683,6 +676,57 @@ function _requestUrls(req) {
683
676
  return { canonical_url: origin + path, og_url: origin + path + search };
684
677
  }
685
678
 
679
+ // Whether the Collections / Categories routes are mounted (deps wired).
680
+ // The header links + the mobile-disclosure entries render only when their
681
+ // route exists, so a store that hasn't wired the primitive never shows a
682
+ // link that 404s. Set once at mount (alongside `_ccyEnabled`), read in the
683
+ // nav builder. Default true so a pure render of a page (a unit test calling
684
+ // `renderHome` without mounting) shows the full nav; the route-level
685
+ // conditional only suppresses a link when the mount explicitly lacks the dep.
686
+ var _hasCollections = true;
687
+ var _hasCategoryNav = true;
688
+
689
+ // The account-icon + cart-pill SVGs, lifted verbatim from the prior LAYOUT
690
+ // nav so the builder emits the same chrome. Kept byte-identical to the edge
691
+ // headers (worker/render/*.js).
692
+ var _NAV_ACCOUNT_SVG = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\"><path d=\"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm-7 9a7 7 0 0 1 14 0\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\"/></svg>";
693
+ var _NAV_CART_SVG = "<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path d=\"M3 4h2l2.4 12.1a2 2 0 0 0 2 1.6h7.6a2 2 0 0 0 1.95-1.55L21 8H6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle cx=\"10\" cy=\"21\" r=\"1.4\" fill=\"currentColor\"/><circle cx=\"17\" cy=\"21\" r=\"1.4\" fill=\"currentColor\"/></svg>";
694
+ var _NAV_MENU_SVG = "<svg viewBox=\"0 0 24 24\" width=\"22\" height=\"22\" aria-hidden=\"true\"><path d=\"M4 7h16M4 12h16M4 17h16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\"/></svg>";
695
+
696
+ // Primary nav builder — a desktop link row (`.site-nav__links`) PLUS a
697
+ // CSP-safe <details>/<summary> disclosure (`.site-nav__menu`) carrying the
698
+ // same links for narrow viewports. The CSS shows one or the other by
699
+ // breakpoint (the inline row hides at <=48rem; the disclosure hides above
700
+ // it). No JS — the browser drives open/close. Collections / Categories
701
+ // render only when `hasCollections` / `hasCategories` (their routes mounted).
702
+ // All labels are chrome strings, escaped at the sink. Kept byte-identical to
703
+ // the static nav in every worker/render/*.js header (the edge renders the
704
+ // two extra links unconditionally — accepted divergence; the byte-compare
705
+ // test wires both container deps so the markup matches).
706
+ function _buildNavLinks(chrome, hasCollections, hasCategories, indent) {
707
+ var esc = b.template.escapeHtml;
708
+ return indent + "<a class=\"site-nav__link\" href=\"/\">" + esc(chrome.nav_shop) + "</a>\n" +
709
+ (hasCollections ? indent + "<a class=\"site-nav__link\" href=\"/collections\">" + esc(chrome.nav_collections) + "</a>\n" : "") +
710
+ (hasCategories ? indent + "<a class=\"site-nav__link\" href=\"/categories\">" + esc(chrome.nav_categories) + "</a>\n" : "") +
711
+ indent + "<a class=\"site-nav__link\" href=\"/#framework\">" + esc(chrome.nav_framework) + "</a>\n";
712
+ }
713
+ function _buildPrimaryNav(chrome, cartCount, cartAria, hasCollections, hasCategories) {
714
+ var esc = b.template.escapeHtml;
715
+ return "<nav class=\"site-nav\" aria-label=\"Primary\">\n" +
716
+ " <div class=\"site-nav__links\">\n" +
717
+ _buildNavLinks(chrome, hasCollections, hasCategories, " ") +
718
+ " </div>\n" +
719
+ " <details class=\"site-nav__menu\">\n" +
720
+ " <summary class=\"site-nav__menu-toggle\" aria-label=\"" + esc(chrome.nav_menu) + "\">" + _NAV_MENU_SVG + "<span class=\"site-nav__menu-label\">" + esc(chrome.nav_menu) + "</span></summary>\n" +
721
+ " <div class=\"site-nav__drawer\">\n" +
722
+ _buildNavLinks(chrome, hasCollections, hasCategories, " ") +
723
+ " </div>\n" +
724
+ " </details>\n" +
725
+ " <a class=\"site-nav__icon\" href=\"/account\" aria-label=\"" + esc(chrome.nav_account) + "\">" + _NAV_ACCOUNT_SVG + "</a>\n" +
726
+ " <a class=\"cart-pill\" href=\"/cart\" aria-label=\"" + esc(cartAria) + "\">" + _NAV_CART_SVG + "<span class=\"cart-pill__count\">" + esc(String(cartCount)) + "</span></a>\n" +
727
+ " </nav>";
728
+ }
729
+
686
730
  function _wrap(opts) {
687
731
  var themeCss = (opts && typeof opts.theme_css === "string" && opts.theme_css.length)
688
732
  ? opts.theme_css
@@ -758,7 +802,6 @@ function _wrap(opts) {
758
802
  var vars = {
759
803
  title: opts.title,
760
804
  shop_name: shopName,
761
- cart_count: cartCount,
762
805
  year: _COPYRIGHT_YEAR,
763
806
  search_q: opts.search_q == null ? "" : opts.search_q,
764
807
  theme_css: themeCss,
@@ -770,19 +813,24 @@ function _wrap(opts) {
770
813
  canonical_url: canonicalUrl,
771
814
  lang: localeCtx.lang || "en",
772
815
  dir: localeCtx.dir || "ltr",
773
- nav_cart_aria: cartAria,
774
816
  body: "RAW_BODY_PLACEHOLDER",
775
817
  };
776
- // Layer in every chrome string the LAYOUT references. `nav_cart_aria`
777
- // is handled above (it needs the count interpolated); the two
778
- // `locale_switcher_*` strings live only inside the switcher form
779
- // (spliced via RAW_LOCALE_SWITCHER), not in the LAYOUT body — the
780
- // strict `_render` refuses an unused placeholder, so they're skipped
781
- // here.
818
+ // Layer in every chrome string the LAYOUT references. The nav chrome
819
+ // strings (`nav_shop` / `nav_collections` / `nav_categories` /
820
+ // `nav_framework` / `nav_account` / `nav_menu` / `nav_cart_aria`) are
821
+ // NOT referenced by the LAYOUT const — the nav is raw-spliced via
822
+ // `RAW_PRIMARY_NAV` from `_buildPrimaryNav` so the Collections/Categories
823
+ // links can render conditionally. The strict `_render` refuses an unused
824
+ // placeholder, so those keys are skipped here. Likewise the two
825
+ // `locale_switcher_*` strings live only inside the switcher form (spliced
826
+ // via RAW_LOCALE_SWITCHER).
782
827
  var chromeKeys = Object.keys(chrome);
783
828
  for (var ci = 0; ci < chromeKeys.length; ci += 1) {
784
829
  var ck = chromeKeys[ci];
785
- if (ck === "nav_cart_aria" || ck === "locale_switcher_label" || ck === "locale_switcher_submit") continue;
830
+ if (ck === "nav_shop" || ck === "nav_collections" || ck === "nav_categories" ||
831
+ ck === "nav_framework" || ck === "nav_account" || ck === "nav_menu" ||
832
+ ck === "nav_cart_aria" ||
833
+ ck === "locale_switcher_label" || ck === "locale_switcher_submit") continue;
786
834
  vars[ck] = chrome[ck];
787
835
  }
788
836
 
@@ -821,6 +869,14 @@ function _wrap(opts) {
821
869
  // Matches the edge renderers' `spliceRaw` so the dual-render stays
822
870
  // byte-consistent under a `$`-bearing announcement. See `_spliceRaw`.
823
871
  assembled = _spliceRaw(assembled, "RAW_ANNOUNCEMENT_BAR", announcementBarHtml);
872
+ // Primary nav — a raw splice (post strict-render) so the chrome strings
873
+ // it consumes (nav_shop / nav_collections / nav_categories /
874
+ // nav_framework / nav_account / nav_menu / nav_cart_aria) need no LAYOUT
875
+ // `{{}}` placeholder, and the Collections/Categories links render only
876
+ // when their routes are mounted. Escaped values are spliced via the
877
+ // replacer-function helper so a `$`-sequence lands literally.
878
+ assembled = _spliceRaw(assembled, "RAW_PRIMARY_NAV",
879
+ _buildPrimaryNav(chrome, cartCount, cartAria, _hasCollections, _hasCategoryNav));
824
880
  // The body is RAW HTML (already rendered + escaped at the
825
881
  // per-fragment level). The placeholder swap is post-render so the
826
882
  // outer renderer's HTML-escape doesn't double-escape the inner
@@ -905,6 +961,60 @@ function _buildRelatedProducts(related) {
905
961
  "</section>";
906
962
  }
907
963
 
964
+ // Home "Featured collections" band — the six decorative card-art SVGs
965
+ // lifted verbatim from the prior static band, indexed 1..6. The dynamic
966
+ // builder rotates through them by position so an operator's collections
967
+ // keep the band's designed look without per-collection iconography. Kept
968
+ // byte-identical to worker/render/home.js#COLLECTION_BAND_ART so the dual
969
+ // render agrees.
970
+ var COLLECTION_BAND_ART = [
971
+ "<div class=\"collection-card__art collection-card__art--1\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M70 38 C74 44 86 44 90 38 L104 44 L112 58 L100 64 L96 58 L96 92 L64 92 L64 58 L60 64 L48 58 L56 44 Z\"/><path d=\"M71 40 C75 47 85 47 89 40\" stroke=\"#732A8D\" stroke-width=\"2\"/><path d=\"M73 76 H87\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-dasharray=\"2 3\"/></svg></div>",
972
+ "<div class=\"collection-card__art collection-card__art--2\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"58\" y=\"38\" width=\"44\" height=\"44\" rx=\"4\"/><rect x=\"70\" y=\"50\" width=\"20\" height=\"20\" rx=\"2\" stroke=\"#732A8D\"/><circle cx=\"80\" cy=\"60\" r=\"3\" fill=\"#AD38DB\" stroke=\"none\"/><path d=\"M66 38 V30 M76 38 V30 M86 38 V30 M96 38 V30\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M66 82 V90 M76 82 V90 M86 82 V90 M96 82 V90\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M58 48 H50 M58 60 H50 M58 72 H50\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M102 48 H110 M102 60 H110 M102 72 H110\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>",
973
+ "<div class=\"collection-card__art collection-card__art--3\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M60 74 C50 74 48 62 57 59 C56 47 73 43 79 53 C88 47 100 54 97 64 C107 65 107 74 99 74 Z\" stroke=\"#732A8D\"/><path d=\"M78 60 V86\"/><path d=\"M70 78 L78 88 L86 78\"/><path d=\"M64 98 H92\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>",
974
+ "<div class=\"collection-card__art collection-card__art--4\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M56 50 A26 26 0 0 1 104 56\"/><path d=\"M104 70 A26 26 0 0 1 56 64\"/><path d=\"M104 42 L106 57 L91 55\" stroke=\"#AD38DB\"/><path d=\"M56 78 L54 63 L69 65\" stroke=\"#AD38DB\"/><circle cx=\"80\" cy=\"60\" r=\"6\" stroke=\"#732A8D\"/><circle cx=\"80\" cy=\"60\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/></svg></div>",
975
+ "<div class=\"collection-card__art collection-card__art--5\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M86 36 L106 44 L106 64 L86 72 L66 64 L66 44 Z\" stroke=\"#732A8D\"/><path d=\"M66 44 L86 52 L106 44 M86 52 V72\" stroke=\"#732A8D\"/><path d=\"M70 56 L90 64 L90 88 L70 96 L50 88 L50 64 Z\"/><path d=\"M50 64 L70 72 L90 64 M70 72 V96\"/><path d=\"M70 72 V96\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>",
976
+ "<div class=\"collection-card__art collection-card__art--6\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"48\" y=\"48\" width=\"64\" height=\"42\" rx=\"6\"/><path d=\"M80 48 V90\" stroke=\"#732A8D\"/><path d=\"M80 48 C71 36 56 39 62 49 C57 52 61 57 71 53 C76 51 80 50 80 48 Z\"/><path d=\"M80 48 C89 36 104 39 98 49 C103 52 99 57 89 53 C84 51 80 50 80 48 Z\"/><circle cx=\"80\" cy=\"48\" r=\"2.4\" fill=\"#AD38DB\" stroke=\"none\"/><rect x=\"56\" y=\"70\" width=\"11\" height=\"8\" rx=\"1.6\" stroke=\"currentColor\" stroke-width=\"1.8\"/></svg></div>",
977
+ ];
978
+
979
+ // Home "Featured collections" band builder — operator collections (active,
980
+ // newest-curated first via collections.list, capped at 6) rendered as the
981
+ // existing collection-card grid. Each card links to /collections/<slug>;
982
+ // the decorative per-card art rotates through COLLECTION_BAND_ART by index.
983
+ // Returns "" when there are no collections to show — the caller drops the
984
+ // whole section, so a store with no collections shows hero → catalog with
985
+ // no empty band. Operator slug/title/description are escaped at the sink
986
+ // (escape-by-default; cross-customer free-text rendered to every visitor).
987
+ // A theme that owns its own home template never reaches this band; the
988
+ // data is still threaded so a theme can add a collections slot later.
989
+ // Kept byte-identical to worker/render/home.js#_buildCollectionsBand.
990
+ function _buildCollectionsBand(collections) {
991
+ var esc = b.template.escapeHtml;
992
+ var cols = Array.isArray(collections) ? collections.slice(0, 6) : [];
993
+ if (cols.length === 0) return "";
994
+ var cards = "";
995
+ for (var i = 0; i < cols.length; i += 1) {
996
+ var c = cols[i];
997
+ var art = COLLECTION_BAND_ART[i % COLLECTION_BAND_ART.length];
998
+ cards +=
999
+ " <a class=\"collection-card\" href=\"/collections/" + esc(c.slug) + "\">\n" +
1000
+ " " + art + "\n" +
1001
+ " <div class=\"collection-card__meta\">\n" +
1002
+ " <h3>" + esc(c.title) + "</h3>\n" +
1003
+ (c.description ? " <p>" + esc(c.description) + "</p>\n" : "") +
1004
+ " </div>\n" +
1005
+ " </a>\n";
1006
+ }
1007
+ return "<section class=\"collections\" aria-labelledby=\"collections-title\">\n" +
1008
+ " <header class=\"section-head\">\n" +
1009
+ " <p class=\"eyebrow\">Featured collections</p>\n" +
1010
+ " <h2 id=\"collections-title\" class=\"section-head__title\">Browse the catalog by collection.</h2>\n" +
1011
+ " </header>\n" +
1012
+ " <div class=\"collections__grid\">\n" +
1013
+ cards +
1014
+ " </div>\n" +
1015
+ "</section>\n";
1016
+ }
1017
+
908
1018
  var HOME_HERO =
909
1019
  "<section class=\"hero hero--dark\">\n" +
910
1020
  " <div class=\"hero__bg\" aria-hidden=\"true\">\n" +
@@ -983,57 +1093,7 @@ var HOME_HERO =
983
1093
  "\n" +
984
1094
  "RAW_FEATURED_CALLOUT\n" +
985
1095
  "\n" +
986
- "<section class=\"collections\" aria-labelledby=\"collections-title\">\n" +
987
- " <header class=\"section-head\">\n" +
988
- " <p class=\"eyebrow\">Featured collections</p>\n" +
989
- " <h2 id=\"collections-title\" class=\"section-head__title\">Shaped for a storefront that ships from day one.</h2>\n" +
990
- " <p class=\"section-head__lede\">Drop products into any of these starting categories — or define your own taxonomy through the catalog admin and the framework will server-render the grids, filters, and PDP routes for free.</p>\n" +
991
- " </header>\n" +
992
- " <div class=\"collections__grid\">\n" +
993
- " <a class=\"collection-card\" href=\"/search?q=tee\">\n" +
994
- " <div class=\"collection-card__art collection-card__art--1\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M70 38 C74 44 86 44 90 38 L104 44 L112 58 L100 64 L96 58 L96 92 L64 92 L64 58 L60 64 L48 58 L56 44 Z\"/><path d=\"M71 40 C75 47 85 47 89 40\" stroke=\"#732A8D\" stroke-width=\"2\"/><path d=\"M73 76 H87\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-dasharray=\"2 3\"/></svg></div>\n" +
995
- " <div class=\"collection-card__meta\">\n" +
996
- " <h3>Apparel</h3>\n" +
997
- " <p>Sized, colored, inventoried.</p>\n" +
998
- " </div>\n" +
999
- " </a>\n" +
1000
- " <a class=\"collection-card\" href=\"/search?q=edge\">\n" +
1001
- " <div class=\"collection-card__art collection-card__art--2\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"58\" y=\"38\" width=\"44\" height=\"44\" rx=\"4\"/><rect x=\"70\" y=\"50\" width=\"20\" height=\"20\" rx=\"2\" stroke=\"#732A8D\"/><circle cx=\"80\" cy=\"60\" r=\"3\" fill=\"#AD38DB\" stroke=\"none\"/><path d=\"M66 38 V30 M76 38 V30 M86 38 V30 M96 38 V30\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M66 82 V90 M76 82 V90 M86 82 V90 M96 82 V90\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M58 48 H50 M58 60 H50 M58 72 H50\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"M102 48 H110 M102 60 H110 M102 72 H110\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>\n" +
1002
- " <div class=\"collection-card__meta\">\n" +
1003
- " <h3>Hardware</h3>\n" +
1004
- " <p>Serialized, warranty-tracked.</p>\n" +
1005
- " </div>\n" +
1006
- " </a>\n" +
1007
- " <a class=\"collection-card\" href=\"/search?q=license\">\n" +
1008
- " <div class=\"collection-card__art collection-card__art--3\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M60 74 C50 74 48 62 57 59 C56 47 73 43 79 53 C88 47 100 54 97 64 C107 65 107 74 99 74 Z\" stroke=\"#732A8D\"/><path d=\"M78 60 V86\"/><path d=\"M70 78 L78 88 L86 78\"/><path d=\"M64 98 H92\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>\n" +
1009
- " <div class=\"collection-card__meta\">\n" +
1010
- " <h3>Digital</h3>\n" +
1011
- " <p>License-key fulfillment.</p>\n" +
1012
- " </div>\n" +
1013
- " </a>\n" +
1014
- " <a class=\"collection-card\" href=\"/search?q=subscription\">\n" +
1015
- " <div class=\"collection-card__art collection-card__art--4\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M56 50 A26 26 0 0 1 104 56\"/><path d=\"M104 70 A26 26 0 0 1 56 64\"/><path d=\"M104 42 L106 57 L91 55\" stroke=\"#AD38DB\"/><path d=\"M56 78 L54 63 L69 65\" stroke=\"#AD38DB\"/><circle cx=\"80\" cy=\"60\" r=\"6\" stroke=\"#732A8D\"/><circle cx=\"80\" cy=\"60\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/></svg></div>\n" +
1016
- " <div class=\"collection-card__meta\">\n" +
1017
- " <h3>Subscriptions</h3>\n" +
1018
- " <p>Stripe-backed recurring.</p>\n" +
1019
- " </div>\n" +
1020
- " </a>\n" +
1021
- " <a class=\"collection-card\" href=\"/search?q=bundle\">\n" +
1022
- " <div class=\"collection-card__art collection-card__art--5\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M86 36 L106 44 L106 64 L86 72 L66 64 L66 44 Z\" stroke=\"#732A8D\"/><path d=\"M66 44 L86 52 L106 44 M86 52 V72\" stroke=\"#732A8D\"/><path d=\"M70 56 L90 64 L90 88 L70 96 L50 88 L50 64 Z\"/><path d=\"M50 64 L70 72 L90 64 M70 72 V96\"/><path d=\"M70 72 V96\" stroke=\"currentColor\" stroke-width=\"2\"/></svg></div>\n" +
1023
- " <div class=\"collection-card__meta\">\n" +
1024
- " <h3>Bundles</h3>\n" +
1025
- " <p>Composite SKUs, atomic stock.</p>\n" +
1026
- " </div>\n" +
1027
- " </a>\n" +
1028
- " <a class=\"collection-card\" href=\"/search?q=gift\">\n" +
1029
- " <div class=\"collection-card__art collection-card__art--6\" aria-hidden=\"true\"><svg class=\"collection-card__icon\" viewBox=\"0 0 160 120\" fill=\"none\" stroke=\"#AD38DB\" stroke-width=\"2.4\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"48\" y=\"48\" width=\"64\" height=\"42\" rx=\"6\"/><path d=\"M80 48 V90\" stroke=\"#732A8D\"/><path d=\"M80 48 C71 36 56 39 62 49 C57 52 61 57 71 53 C76 51 80 50 80 48 Z\"/><path d=\"M80 48 C89 36 104 39 98 49 C103 52 99 57 89 53 C84 51 80 50 80 48 Z\"/><circle cx=\"80\" cy=\"48\" r=\"2.4\" fill=\"#AD38DB\" stroke=\"none\"/><rect x=\"56\" y=\"70\" width=\"11\" height=\"8\" rx=\"1.6\" stroke=\"currentColor\" stroke-width=\"1.8\"/></svg></div>\n" +
1030
- " <div class=\"collection-card__meta\">\n" +
1031
- " <h3>Gift cards</h3>\n" +
1032
- " <p>PQC-signed redemption codes.</p>\n" +
1033
- " </div>\n" +
1034
- " </a>\n" +
1035
- " </div>\n" +
1036
- "</section>\n" +
1096
+ "RAW_COLLECTIONS_BAND\n" +
1037
1097
  "\n" +
1038
1098
  "<section id=\"framework\" class=\"framework-band\" aria-labelledby=\"framework-title\">\n" +
1039
1099
  " <div class=\"framework-band__inner\">\n" +
@@ -1092,13 +1152,12 @@ var CATALOG_EMPTY =
1092
1152
 
1093
1153
  var CATALOG_HEAD =
1094
1154
  "<section id=\"catalog\" class=\"catalog-section\">\n" +
1095
- " <header class=\"section-head section-head--with-link\">\n" +
1155
+ " <header class=\"section-head\">\n" +
1096
1156
  " <div>\n" +
1097
1157
  " <p class=\"eyebrow\">Catalog</p>\n" +
1098
1158
  " <h2 class=\"section-head__title\">Products in store</h2>\n" +
1099
1159
  " <p class=\"section-head__lede\">Server-rendered listings — every card, price, and link arrived on the wire as complete HTML.</p>\n" +
1100
1160
  " </div>\n" +
1101
- " <a class=\"link-arrow\" href=\"/?sort=new\">New arrivals <span aria-hidden=\"true\">→</span></a>\n" +
1102
1161
  " </header>\n" +
1103
1162
  " <div class=\"grid\">{{cards}}</div>\n" +
1104
1163
  "</section>\n";
@@ -1181,8 +1240,15 @@ function renderHome(opts) {
1181
1240
  "</section>";
1182
1241
  }
1183
1242
 
1184
- var hero = _render(HOME_HERO, { product_count: heroProductCount })
1185
- .replace("RAW_FEATURED_CALLOUT", featuredHtml);
1243
+ // Featured-collections band operator collections (active, newest
1244
+ // first, capped at 6); the band is dropped entirely when there are
1245
+ // none. Spliced raw (replacer-function form, $-safe) since the
1246
+ // operator slug/title/description are escaped at the band's own sink.
1247
+ var collectionsBand = _buildCollectionsBand(opts.collections || []);
1248
+ var hero = _spliceRaw(
1249
+ _render(HOME_HERO, { product_count: heroProductCount })
1250
+ .replace("RAW_FEATURED_CALLOUT", featuredHtml),
1251
+ "RAW_COLLECTIONS_BAND", collectionsBand);
1186
1252
  // The hero + value band + catalog section give the home page a
1187
1253
  // designed surface even when no products are loaded yet —
1188
1254
  // visitors land on the storefront shell, not a tech demo.
@@ -1754,7 +1820,40 @@ var VARIANT_ROW =
1754
1820
  // worker/render/product.js#_buildBuyBox.
1755
1821
  var BUYBOX_CHIP_LIMIT = 12;
1756
1822
 
1757
- function _buildBuyBox(variants, escAttr, availability) {
1823
+ // Compute the PDP buy-box headline price string. `rendered` is the
1824
+ // formatted-variant list ([{ id, sku, title, price }]); `variants` + the
1825
+ // `prices` map ({ variant_id: { currency, amount_minor } }) carry the
1826
+ // integer minor-units. Multi-variant products with >1 distinct price read
1827
+ // "From <lowest>" (min over amount_minor, formatted once via `fmt`); a
1828
+ // single-variant, no-price, or all-equal-price product keeps the lead
1829
+ // variant's exact formatted price. Money discipline: the minimum is taken
1830
+ // over integers, never over formatted strings; the result is formatted once.
1831
+ // Kept byte-identical to worker/render/product.js#_buildHeadlinePrice.
1832
+ function _buildHeadlinePrice(rendered, variants, prices, fmt) {
1833
+ var leadPrice = (rendered[0] && rendered[0].price) || "—";
1834
+ if (!Array.isArray(rendered) || rendered.length <= 1) return leadPrice;
1835
+ var lowMinor = null;
1836
+ var lowCurrency = null;
1837
+ for (var i = 0; i < variants.length; i += 1) {
1838
+ var p = prices && prices[variants[i].id];
1839
+ if (!p || !Number.isInteger(p.amount_minor)) continue;
1840
+ if (lowMinor === null || p.amount_minor < lowMinor) {
1841
+ lowMinor = p.amount_minor;
1842
+ lowCurrency = p.currency || "USD";
1843
+ }
1844
+ }
1845
+ if (lowMinor === null) return leadPrice;
1846
+ // All variants share one price → keep the exact figure (no "From").
1847
+ var allEqual = true;
1848
+ for (var j = 0; j < variants.length; j += 1) {
1849
+ var pj = prices && prices[variants[j].id];
1850
+ if (pj && Number.isInteger(pj.amount_minor) && pj.amount_minor !== lowMinor) { allEqual = false; break; }
1851
+ }
1852
+ if (allEqual) return leadPrice;
1853
+ return "From " + fmt(lowMinor, lowCurrency);
1854
+ }
1855
+
1856
+ function _buildBuyBox(variants, escAttr, availability, headlinePrice) {
1758
1857
  var inStock = !availability || availability.in_stock !== false;
1759
1858
  if (!variants || variants.length === 0) {
1760
1859
  return "<div class=\"pdp__variants\">\n" +
@@ -1835,8 +1934,9 @@ function _buildBuyBox(variants, escAttr, availability) {
1835
1934
  ? "<button type=\"submit\" class=\"btn-primary cart-page__checkout\">$ add to cart</button>"
1836
1935
  : soldOutBtn;
1837
1936
 
1937
+ var headline = (headlinePrice != null && headlinePrice !== "") ? headlinePrice : lead.price;
1838
1938
  return "<div class=\"pdp__buybox\">\n" +
1839
- " <p class=\"featured-product__price\">" + escAttr(lead.price) + "</p>\n" +
1939
+ " <p class=\"featured-product__price\">" + escAttr(headline) + "</p>\n" +
1840
1940
  " <form method=\"post\" action=\"/cart/lines\">\n" +
1841
1941
  " " + variantBlock + "\n" +
1842
1942
  " <label class=\"pdp__variants-title\" for=\"buybox-qty\">Quantity</label>\n" +
@@ -5689,9 +5789,18 @@ function renderProduct(opts) {
5689
5789
  var preorderShape = opts.preorder_campaign
5690
5790
  ? preorderCtaShape(opts.preorder_campaign.campaign, { remaining_units: opts.preorder_campaign.remaining_units }, fmt, opts.product.slug)
5691
5791
  : null;
5792
+ // Multi-variant headline price — "From <lowest>" so the buy box never
5793
+ // advertises a price that isn't the cheapest buyable variant (variants[0]
5794
+ // may not be the cheapest). The minimum is computed over the integer
5795
+ // amount_minor map and formatted ONCE via the page's own `fmt` (never by
5796
+ // comparing formatted strings — "$9.99" < "$10.00" sorts wrong as text).
5797
+ // Single-variant, no-price, and all-equal-price products keep the lead
5798
+ // variant's exact price string ("From X" when there's only one X is
5799
+ // noise). Kept byte-identical to worker/render/product.js. See UX-5.
5800
+ var headlinePrice = _buildHeadlinePrice(rendered, variants, prices, fmt);
5692
5801
  var buyboxHtml = preorderShape
5693
5802
  ? _buildPreorderCta(preorderShape, b.template.escapeHtml)
5694
- : _buildBuyBox(rendered, b.template.escapeHtml, availability);
5803
+ : _buildBuyBox(rendered, b.template.escapeHtml, availability, headlinePrice);
5695
5804
  // The reserve PRG lands the shopper back on the PDP with a fixed
5696
5805
  // ?preorder=<reserved|unavailable|closed> marker; the banner prepends the
5697
5806
  // buy box. The marker set is closed (built from a lookup, never the raw
@@ -8300,7 +8409,9 @@ function renderOrderList(opts) {
8300
8409
  function _surveyQuestion(q) {
8301
8410
  var esc = function (s) { return b.template.escapeHtml(String(s == null ? "" : s)); };
8302
8411
  var name = "q_" + esc(q.id);
8303
- var req = q.required ? " <abbr class=\"survey-req\" title=\"Required\">*</abbr>" : "";
8412
+ var req = q.required
8413
+ ? " <span class=\"survey-req\" aria-hidden=\"true\">*</span><span class=\"sr-only\">(required)</span>"
8414
+ : "";
8304
8415
  var control = "";
8305
8416
  if (q.kind === "rating") {
8306
8417
  var lo = (q.max >= 9) ? 0 : 1; // 0..10 for NPS-scale, else 1..max
@@ -8630,6 +8741,14 @@ function mount(router, deps) {
8630
8741
  }
8631
8742
  _liveConsentPolicy();
8632
8743
 
8744
+ // Header nav gating — the Collections / Categories links + their mobile-
8745
+ // disclosure entries render only when the matching routes are mounted
8746
+ // (deps wired). Module-scoped so `_buildPrimaryNav` (called from the
8747
+ // module-level `_wrap`, which doesn't close over `deps`) can read them,
8748
+ // matching the `_ccyEnabled` / `_activeConsentPolicy` pattern.
8749
+ _hasCollections = !!deps.collections;
8750
+ _hasCategoryNav = !!deps.categoryNavigation;
8751
+
8633
8752
  function _send(res, status, html) {
8634
8753
  res.status(status);
8635
8754
  res.setHeader && res.setHeader("content-type", "text/html; charset=utf-8");
@@ -9902,8 +10021,19 @@ function mount(router, deps) {
9902
10021
  // id DESC) matches the prior `products.list` order.
9903
10022
  var decorated = await deps.catalog.batch.decoratedActive({ currency: "USD", limit: 24 });
9904
10023
  var products = decorated.rows;
10024
+ // Featured-collections band data — active collections, newest-curated
10025
+ // first (collections.list orders updated_at DESC, slug DESC; the band
10026
+ // caps to 6). Best-effort: a band read failure degrades to no band, it
10027
+ // never blocks the home page. The band itself drops when the list is
10028
+ // empty, so an unwired collections dep also yields hero → catalog.
10029
+ var collections = [];
10030
+ if (deps.collections && typeof deps.collections.list === "function") {
10031
+ try {
10032
+ collections = await deps.collections.list({ active_only: true });
10033
+ } catch (_e) { collections = []; }
10034
+ }
9905
10035
  var ccy = await _currencyForReq(req);
9906
- var html = renderHome(Object.assign({ products: products, shop_name: shopName, theme: theme }, _requestUrls(req), ccy));
10036
+ var html = renderHome(Object.assign({ products: products, collections: collections, shop_name: shopName, theme: theme }, _requestUrls(req), ccy));
9907
10037
  _send(res, 200, html);
9908
10038
  });
9909
10039
 
@@ -15847,6 +15977,7 @@ module.exports = {
15847
15977
  renderProfile: renderProfile,
15848
15978
  renderAccountSubscriptions: renderAccountSubscriptions,
15849
15979
  renderCookiePreferences: renderCookiePreferences,
15980
+ renderSurveyPage: renderSurveyPage,
15850
15981
  renderNewsletterError: renderNewsletterError,
15851
15982
  renderNotFound: renderNotFound,
15852
15983
  // Layout exposed so operators forking the framework can override.
@@ -571,8 +571,12 @@ var CHROME_DEFAULTS = Object.freeze({
571
571
  search_submit: "Search",
572
572
 
573
573
  nav_shop: "Shop",
574
+ nav_collections: "Collections",
575
+ nav_categories: "Categories",
574
576
  nav_framework: "Framework",
575
577
  nav_account: "Account",
578
+ // The narrow-viewport disclosure's <summary> label.
579
+ nav_menu: "Menu",
576
580
  // The cart aria-label carries the live item count; `{count}` is
577
581
  // interpolated by b.i18n at render time.
578
582
  nav_cart_aria: "Cart, {count} items",
@@ -589,8 +593,6 @@ var CHROME_DEFAULTS = Object.freeze({
589
593
  footer_shop_all: "All products",
590
594
  footer_shop_collections: "Collections",
591
595
  footer_shop_categories: "Categories",
592
- footer_shop_new: "New arrivals",
593
- footer_shop_sale: "On sale",
594
596
  footer_shop_compare: "Compare",
595
597
  footer_shop_cart: "Cart",
596
598
  footer_shop_shipping: "Shipping & returns",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/blamejs-shop",
3
- "version": "0.3.48",
3
+ "version": "0.3.49",
4
4
  "description": "Open-source framework built on blamejs. Vendored stack, zero npm runtime deps, PQC-first crypto, security-on by default.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {