@blamejs/blamejs-shop 0.3.26 → 0.3.27

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.27 (2026-05-31) — **Shared product and page links now show a preview image, and category pages get breadcrumb rich results.** Social-share previews and search rich results were emitting relative image paths, which Facebook, Slack, Twitter, iMessage, and Google all drop — so a shared product or page link showed no preview image, and product rich results had no image. Every og:image, twitter:image, and Product/Article structured-data image is now a fully-qualified URL built from the page's own origin. Collection and category pages, which already showed an on-page breadcrumb, now also emit BreadcrumbList structured data so the trail can appear in search results, matching what product pages already did. And operator-supplied page keywords or announcement text containing a dollar-sign sequence now render literally instead of being garbled. **Fixed:** *Share and rich-result images are now absolute URLs* — The og:image, twitter:image, and the image in Product and blog-article structured data were relative paths, so social platforms and Google could not load them — a shared link showed no preview image. They are now fully-qualified against the page's origin on every page, in both the edge and container renderers, so shares unfurl with the right image and product rich results carry one. Images an operator already hosts at an absolute URL pass through unchanged. · *Breadcrumb structured data on collection and category pages* — Collection and category pages showed a breadcrumb trail on the page but did not expose it as BreadcrumbList structured data, so search engines could not render the trail in results. They now emit it with absolute URLs, the same way product pages already do. · *Dollar-sign sequences in page metadata render literally* — Page meta-keywords and announcement-bar text containing a dollar-sign sequence (for example a price written with a special character) could be garbled in the page head because of how the value was substituted into the template. The substitution now treats the value as literal text, so it renders exactly as entered.
12
+
11
13
  - v0.3.26 (2026-05-31) — **Customers can raise support tickets and operators work them from a queue.** The support-ticket system had a complete backend — threaded messages, assignment, tags, and a status workflow — but no way in or out: a shopper could not open a ticket and an operator could not see one. Both sides are now wired. A logged-in customer can raise a ticket from their account (with an optional link to one of their own orders), see the thread, and reply while it is open. Operators get a Support queue in the console with an unassigned-triage view, the full thread for each ticket, and controls to reply (with an internal-note option that the customer never sees), assign, tag, and move the ticket through its status workflow. A customer only ever sees their own tickets, and replying to a closed ticket is refused. **Added:** *Customer support tickets* — A Support section in the account area lets a signed-in customer open a ticket (subject, message, category, and an optional reference to one of their own orders), list their tickets with status, read the full message thread, and reply while the ticket is open. Internal operator notes are never shown to the customer, a customer can only see and reply to their own tickets, and a reply to a closed ticket is refused. · *Support queue in the admin console* — A Support screen lists inbound tickets by status with an unassigned-triage view. Opening a ticket shows the full thread, the requester, the current status, the assignee, and tags. From there an operator can reply (optionally as an internal note), assign the ticket, tag it, and move it through its status workflow — in progress, waiting on the customer, resolved, closed, or reopened.
12
14
 
13
15
  - v0.3.25 (2026-05-30) — **Open an individual customer to see their orders and manage store credit, notes, and loyalty.** The customers list was view-only — there was no way to open a single customer. Each customer now has a detail screen showing their identity, recent orders (linked), store-credit balance with a grant/deduct control, loyalty balance and tier (with a link to adjust points), internal operator notes, and the segments they belong to. A store-credit grant or deduction requires a reason and is written to the store-credit ledger, an over-deduction is refused, and segment membership is shown read-only because it is computed from purchase behavior rather than set by hand. **Added:** *Customer detail screen* — Opening a customer from the roster now shows their record, recent orders, store-credit balance with a reason-gated grant/deduct (recorded in the store-credit ledger; an over-deduction is refused), their loyalty balance and tier with a link to adjust points, and an internal notes log you can add to. The segments a customer belongs to are listed read-only, since membership is derived from their behavior. Customer identity fields remain read-only by design.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.26",
2
+ "version": "0.3.27",
3
3
  "assets": {
4
4
  "css/admin.css": {
5
5
  "integrity": "sha384-1SIn6oAf1DjECbRfKENZasdKHJiywGdXR58wn0hsFGcdVHzUmvfgMkEz5ANIAZJ3",
package/lib/storefront.js CHANGED
@@ -693,7 +693,6 @@ function _wrap(opts) {
693
693
  var ogType = opts.og_type || "website";
694
694
  var ogTitle = opts.og_title || (opts.title ? opts.title + " — " + shopName : shopName);
695
695
  var ogDescription = opts.og_description || "Open-source ecommerce framework built on blamejs. Server-rendered HTML, post-quantum crypto, zero npm runtime dependencies.";
696
- var ogImage = opts.og_image || "/assets/brand/logo.png";
697
696
  // Absolute request URL drives both `og:url` (full URL incl. query) and
698
697
  // the canonical link (query stripped — the canonical names the page,
699
698
  // not the filtered/sorted view). Renderers thread `opts.canonical_url`
@@ -702,6 +701,14 @@ function _wrap(opts) {
702
701
  // rather than emit a bogus host-less URL.
703
702
  var canonicalUrl = opts.canonical_url || "";
704
703
  var ogUrl = opts.og_url || canonicalUrl;
704
+ // og:image / twitter:image carry a FULLY-QUALIFIED URL — a relative
705
+ // `/assets/...` (the brand-logo default, or a product hero) is dropped by
706
+ // every social-share crawler (Facebook / Slack / Twitter / iMessage) and
707
+ // by Google's rich result. Absolutize against the page origin so the
708
+ // share preview resolves; an operator-hosted `http(s)://` image passes
709
+ // through unchanged. Every container page funnels through `_wrap`, so
710
+ // this is the single absolutization site for the storefront's meta tags.
711
+ var ogImage = _absolutizeOgImage(opts.og_image || "/assets/brand/logo.png", canonicalUrl, shopName);
705
712
  // Multi-currency display switcher — populated only when the operator
706
713
  // configured >1 display currency (opts.currency_options). The block is
707
714
  // empty otherwise, so a single-currency store renders unchanged.
@@ -796,12 +803,18 @@ function _wrap(opts) {
796
803
  var assembled = _render(LAYOUT, vars)
797
804
  .replace("RAW_CSS_INTEGRITY", themeCssIntegrity)
798
805
  .replace("RAW_ROBOTS_META", robotsMeta)
799
- .replace("RAW_ANNOUNCEMENT_BAR", announcementBarHtml)
800
806
  .replace("RAW_CONSENT_SCRIPT", _islandScript("consent.js", { id: "consent-island", policy: _activeConsentPolicy }))
801
807
  .replace("RAW_CART_COUNT_SCRIPT", _islandScript("cart-count.js", { id: "cart-count-island" }))
802
808
  .replace("RAW_ANNOUNCEMENT_SCRIPT", announcementScript)
803
809
  .replace("RAW_CURRENCY_SWITCHER", switcherHtml)
804
810
  .replace("RAW_LOCALE_SWITCHER", localeCtx.switcher_html || "");
811
+ // The announcement bar carries operator-supplied message text (HTML-
812
+ // escaped, but `$` is not an escaped character), so splice it via the
813
+ // replacer-function helper — a `$&` / `` $` `` / `$N` in the message must
814
+ // land literally, not trigger `String.replace`'s dollar substitution.
815
+ // Matches the edge renderers' `spliceRaw` so the dual-render stays
816
+ // byte-consistent under a `$`-bearing announcement. See `_spliceRaw`.
817
+ assembled = _spliceRaw(assembled, "RAW_ANNOUNCEMENT_BAR", announcementBarHtml);
805
818
  // The body is RAW HTML (already rendered + escaped at the
806
819
  // per-fragment level). The placeholder swap is post-render so the
807
820
  // outer renderer's HTML-escape doesn't double-escape the inner
@@ -1204,6 +1217,30 @@ function _absoluteBase(canonicalUrl, shopName) {
1204
1217
  return "https://" + String(shopName || "blamejs.shop").replace(/^https?:\/\//, "");
1205
1218
  }
1206
1219
 
1220
+ // Absolutize an og:image / twitter:image / JSON-LD image value against the
1221
+ // page origin. A relative `/assets/...` path (the brand-logo default, or a
1222
+ // hero R2 key joined onto the asset prefix) becomes `<origin>/assets/...`
1223
+ // so every social-share crawler and rich-result fetch resolves it — a
1224
+ // relative path is dropped by Facebook / Slack / Twitter / iMessage and by
1225
+ // Google's product rich result. An already-absolute `http(s)://` value is
1226
+ // left unchanged (an operator-hosted image), and a value that is neither a
1227
+ // `/`-rooted path nor an absolute URL is returned as-is (nothing safe to
1228
+ // prefix). Absolutizes only against a reliable origin: with a canonical URL
1229
+ // the request origin is used; without one, the shop-name host is used ONLY
1230
+ // when it is usable as a host (no whitespace) — a display-name shop such as
1231
+ // "Test Shop" would otherwise emit an invalid "https://Test Shop/..." URL,
1232
+ // so the path is left relative (it still resolves against the page on a
1233
+ // crawler fetch). Mirrors the edge's worker/render/_lib.js `absolutizeOgImage`
1234
+ // so the two substrates emit identical absolute image URLs.
1235
+ function _absolutizeOgImage(value, canonicalUrl, shopName) {
1236
+ var v = (value == null) ? "" : String(value);
1237
+ if (/^https?:\/\//i.test(v)) return v;
1238
+ if (v.charAt(0) !== "/") return v;
1239
+ var hasCanonical = typeof canonicalUrl === "string" && canonicalUrl.length > 0;
1240
+ if (!hasCanonical && /\s/.test(String(shopName == null ? "" : shopName))) return v;
1241
+ return _absoluteBase(canonicalUrl, shopName) + v;
1242
+ }
1243
+
1207
1244
  // Schema.org Organization + WebSite JSON-LD for the home page. Shared by
1208
1245
  // the container `renderHome` and mirrored by the edge
1209
1246
  // `worker/render/home.js` — keep the two byte-identical. The base URL is
@@ -2860,9 +2897,25 @@ function renderCollection(opts) {
2860
2897
  "</header>" +
2861
2898
  grid +
2862
2899
  "</section>";
2900
+ // BreadcrumbList JSON-LD mirroring the on-page `<nav class="breadcrumb">`
2901
+ // trail (Shop → Collections → this collection). Google's result panel
2902
+ // renders the trail above the title; the `item` URLs are absolute so the
2903
+ // structured data is fully-qualified. Mirrors the PDP's breadcrumb shape.
2904
+ var shopName = opts.shop_name || "blamejs.shop";
2905
+ var absoluteBase = _absoluteBase(opts.canonical_url, shopName);
2906
+ var breadcrumbJsonLd = _jsonLdScript({
2907
+ "@context": "https://schema.org",
2908
+ "@type": "BreadcrumbList",
2909
+ "itemListElement": [
2910
+ { "@type": "ListItem", "position": 1, "name": "Shop", "item": absoluteBase + "/" },
2911
+ { "@type": "ListItem", "position": 2, "name": "Collections", "item": absoluteBase + "/collections" },
2912
+ { "@type": "ListItem", "position": 3, "name": col.title, "item": absoluteBase + "/collections/" + col.slug },
2913
+ ],
2914
+ });
2863
2915
  return _wrap({
2864
- title: col.title, shop_name: opts.shop_name || "blamejs.shop",
2865
- cart_count: opts.cart_count == null ? 0 : opts.cart_count, theme_css: opts.theme_css, body: body,
2916
+ title: col.title, shop_name: shopName,
2917
+ cart_count: opts.cart_count == null ? 0 : opts.cart_count, theme_css: opts.theme_css,
2918
+ body: body + breadcrumbJsonLd,
2866
2919
  canonical_url: opts.canonical_url, og_url: opts.og_url,
2867
2920
  });
2868
2921
  }
@@ -2971,15 +3024,40 @@ function renderCategory(opts) {
2971
3024
  "</section>";
2972
3025
  // Per-page meta description: the category's own description when set,
2973
3026
  // otherwise a "Shop {category}…" pitch.
3027
+ var shopName = opts.shop_name || "blamejs.shop";
2974
3028
  var catMetaDescription = (cat.description && String(cat.description).trim().length)
2975
3029
  ? String(cat.description)
2976
- : ("Shop " + cat.title + " at " + (opts.shop_name || "blamejs.shop") + ".");
3030
+ : ("Shop " + cat.title + " at " + shopName + ".");
3031
+ // BreadcrumbList JSON-LD mirroring the on-page `<nav class="breadcrumb">`
3032
+ // chain (Shop → Categories → …root→current). Google's result panel
3033
+ // renders the trail above the title; the `item` URLs are absolute so the
3034
+ // structured data is fully-qualified. The breadcrumb chain's last entry
3035
+ // is the current category (rendered as plain text on-page), included here
3036
+ // as the trailing list item with its own URL. Mirrors the PDP shape.
3037
+ var absoluteBase = _absoluteBase(opts.canonical_url, shopName);
3038
+ var crumbItems = [
3039
+ { "@type": "ListItem", "position": 1, "name": "Shop", "item": absoluteBase + "/" },
3040
+ { "@type": "ListItem", "position": 2, "name": "Categories", "item": absoluteBase + "/categories" },
3041
+ ];
3042
+ for (var bi = 0; bi < crumbs.length; bi += 1) {
3043
+ crumbItems.push({
3044
+ "@type": "ListItem",
3045
+ "position": bi + 3,
3046
+ "name": crumbs[bi].title,
3047
+ "item": absoluteBase + "/categories/" + crumbs[bi].slug,
3048
+ });
3049
+ }
3050
+ var breadcrumbJsonLd = _jsonLdScript({
3051
+ "@context": "https://schema.org",
3052
+ "@type": "BreadcrumbList",
3053
+ "itemListElement": crumbItems,
3054
+ });
2977
3055
  return _wrap({
2978
- title: cat.title, shop_name: opts.shop_name || "blamejs.shop",
3056
+ title: cat.title, shop_name: shopName,
2979
3057
  cart_count: opts.cart_count == null ? 0 : opts.cart_count, theme_css: opts.theme_css,
2980
3058
  og_description: catMetaDescription,
2981
3059
  canonical_url: opts.canonical_url, og_url: opts.og_url,
2982
- body: body,
3060
+ body: body + breadcrumbJsonLd,
2983
3061
  });
2984
3062
  }
2985
3063
 
@@ -4191,12 +4269,21 @@ function renderProduct(opts) {
4191
4269
  // unfurl as "Operator Tee — blamejs.shop" with the SVG hero, not
4192
4270
  // the default shop-level description + brand logo.
4193
4271
  var heroMedia = (opts.media && opts.media[0]) || null;
4194
- var ogImage = heroMedia ? ((opts.asset_prefix || "/assets/") + heroMedia.r2_key) : "/assets/brand/logo.png";
4195
4272
  // Absolute base for the BreadcrumbList `item` URLs — derived from the
4196
4273
  // PDP's own canonical (origin stripped of the /products/slug path) so
4197
4274
  // the structured-data trail carries fully-qualified URLs. Falls back to
4198
4275
  // the shop-name host when the renderer is called without a request URL.
4199
4276
  var absoluteBase = _absoluteBase(opts.canonical_url, shopName);
4277
+ // og:image / twitter:image / the Product JSON-LD `image` all carry a
4278
+ // FULLY-QUALIFIED URL — a relative hero path (or the brand-logo default)
4279
+ // is dropped by social-share crawlers and by Google's product rich
4280
+ // result. Absolutize once here so the JSON-LD `image` (built below,
4281
+ // before `_wrap`) and the meta tags (`_wrap` re-runs the idempotent
4282
+ // absolutizer) both carry the resolved URL.
4283
+ var ogImage = _absolutizeOgImage(
4284
+ heroMedia ? ((opts.asset_prefix || "/assets/") + heroMedia.r2_key) : "/assets/brand/logo.png",
4285
+ opts.canonical_url, shopName
4286
+ );
4200
4287
 
4201
4288
  // Product + AggregateOffer JSON-LD, with AggregateRating folded in
4202
4289
  // when published reviews exist. Kept byte-compatible with the edge
@@ -12166,6 +12253,10 @@ module.exports = {
12166
12253
  renderHome: renderHome,
12167
12254
  renderSearch: renderSearch,
12168
12255
  renderProduct: renderProduct,
12256
+ renderCollectionList: renderCollectionList,
12257
+ renderCollection: renderCollection,
12258
+ renderCategoryIndex: renderCategoryIndex,
12259
+ renderCategory: renderCategory,
12169
12260
  renderCart: renderCart,
12170
12261
  renderCheckoutForm: renderCheckoutForm,
12171
12262
  renderCheckoutError: renderCheckoutError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/blamejs-shop",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
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": {