@techninja/clearstack 0.3.38 → 0.3.40

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/lib/build-og.js CHANGED
@@ -101,11 +101,12 @@ export function buildOG(opts) {
101
101
 
102
102
  /** Resolve meta from config + data context. */
103
103
  function resolveMeta(config, data, baseUrl, path) {
104
+ const imgField = config.ogImage || config.image;
104
105
  return {
105
106
  title: interpolate(config.title, data),
106
107
  description: interpolate(config.description, data),
107
108
  url: `${baseUrl}${path}`,
108
- image: config.image ? interpolate(config.image, data) : undefined,
109
+ image: imgField ? interpolate(imgField, data) : undefined,
109
110
  };
110
111
  }
111
112
 
@@ -71,24 +71,27 @@ export function buildContext(config, itemData, site) {
71
71
  const title = interpolate(config.title, itemData);
72
72
  const desc = config.description ? interpolate(config.description, itemData) : '';
73
73
  const image = config.image ? interpolate(config.image, itemData) : '';
74
+ const baseUrl = itemData.store?.url || '';
75
+ const resolvedImage = image && !image.startsWith('http') ? `${baseUrl}${image}` : image;
74
76
  const item = itemData.item || {};
75
77
  const emoji = item.emoji || itemData.emoji || '';
76
78
 
77
79
  return {
78
80
  ...itemData, ...item,
79
81
  title: truncate(title, 60),
80
- description: truncate(desc, 120),
82
+ description: truncate(desc, 160),
81
83
  bg: t['color-bg'] || '#0f172a',
82
84
  surface: t['color-surface'] || '#1e293b',
83
85
  primary: t['color-primary'] || '#818cf8',
84
86
  accent: t['color-accent'] || '#34d399',
85
87
  text: t['color-text'] || '#e2e8f0',
86
88
  textMuted: t['color-text-muted'] || '#a8b8cc',
87
- emoji, image,
89
+ emoji, image: resolvedImage,
88
90
  variantsFormatted: formatNum(item.expected_variants),
89
91
  uniqueFormatted: formatNum(item.estimated_unique_variants),
90
- imageHtml: image ? `<img class="hero" src="${image}">` : '',
91
- cardClass: image ? 'card-with-image' : '',
92
+ priceFormatted: item.price ? `$${(item.price / 100).toFixed(2)}` : '',
93
+ imageHtml: resolvedImage ? `<img class="hero" src="${resolvedImage}">` : '',
94
+ cardClass: resolvedImage ? 'card-with-image' : '',
92
95
  logoHtml: site.logo ? `<img class="logo" src="${site.logo}">` : '',
93
96
  badgeHtml: site.siteName ? `<div class="badge">${site.siteName}</div>` : '',
94
97
  emojiHtml: emoji ? `<div class="emoji">${emoji}</div>` : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {