@growth-labs/store 0.3.2 → 0.3.6

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
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.6
4
+
5
+ - Release responsive Fourthwall images from the corrected consumer gate, which
6
+ runs whole-workspace installs and suites on the heavy runner class.
7
+
8
+ ## 0.3.5
9
+
10
+ - Release the responsive Fourthwall image defaults with consumer validation
11
+ that preserves the shared policy of separate compiler contexts.
12
+
13
+
14
+ ## 0.3.4
15
+
16
+ - Enable Cloudflare image transformations by default, including Fourthwall's
17
+ imgproxy host, so responsive candidates deliver their requested widths and
18
+ negotiate AVIF/WebP. Keep an explicit opt-out for preview hosts.
19
+
20
+ ## 0.3.3
21
+
22
+ - Restore the product-detail related-products shelf using each site's curated
23
+ collection order, with the main catalogue as a best-effort fallback.
24
+ - Keep one primary purchase action on product pages instead of stacking
25
+ equally prominent Add to cart and Buy now buttons.
26
+ - Restore the compact secure-checkout label, payment badges, and Fourthwall
27
+ fulfillment note beneath the purchase action.
28
+
3
29
  ## 0.3.2
4
30
 
5
31
  - Export `@growth-labs/store/tailwind.css` so Tailwind CSS 4 consumers can
package/README.md CHANGED
@@ -5,6 +5,12 @@ Storefront API client, browser cart, checkout/webhook routes, and page-body
5
5
  components. See [`packages-docs/store.md`](../../packages-docs/store.md) for
6
6
  the full contract, config shape, and adoption notes.
7
7
 
8
+ `StoreProductPage` includes one primary Add to cart action and a best-effort
9
+ three-item related-products shelf. It prefers the first configured division
10
+ or type collection containing the current product, then falls back to the
11
+ main catalogue. The purchase block also shows the shared payment badges and
12
+ compact Fourthwall checkout/fulfillment disclosure used by channel sites.
13
+
8
14
  ## Install
9
15
 
10
16
  ```sh
@@ -47,3 +53,11 @@ export const prerender = false
47
53
  <StoreIndexPage />
48
54
  </Base>
49
55
  ```
56
+
57
+ ## Image transforms
58
+
59
+ Fourthwall images use Cloudflare Image Transformations by default, including
60
+ `imgproxy.fourthwall.dev` images. The custom-domain zone must allow the
61
+ Fourthwall image origins. Responsive candidates request their declared widths
62
+ with `format=auto` for browser format negotiation. Set
63
+ `imageTransform: { enabled: false }` for local or workers.dev previews.
package/dist/image.d.ts CHANGED
@@ -2,12 +2,11 @@
2
2
  * Route a remote image URL through Cloudflare Image Resizing.
3
3
  *
4
4
  * Uses the zone-local `/cdn-cgi/image/...` transform endpoint. Works on any
5
- * custom domain whose zone has "Any origin" image resizing enabled. It does
6
- * NOT work on the workers.dev subdomain, so non-matching URLs pass through
7
- * unmodified.
5
+ * custom domain whose zone permits the Fourthwall image origins. Local and
6
+ * unsupported image URLs pass through unmodified.
8
7
  *
9
- * Opt-in via `imageTransform` on `StoreOptions`. Until a custom domain with
10
- * Image Resizing is wired up, this stays off and raw CDN URLs ship as-is.
8
+ * Enabled by default. Set `imageTransform.enabled: false` for local previews
9
+ * or workers.dev hosts, which do not support zone-local transformations.
11
10
  *
12
11
  * `format=auto` picks AVIF/WebP/JPEG based on the request's `Accept` header.
13
12
  */
@@ -17,7 +16,7 @@ export interface OptimizeFwImageOpts {
17
16
  height?: number;
18
17
  quality?: number;
19
18
  fit?: 'cover' | 'contain' | 'scale-down' | 'crop' | 'pad';
20
- /** From `StoreOptions.imageTransform`. Defaults to disabled. */
19
+ /** From `StoreOptions.imageTransform`. Defaults to enabled. */
21
20
  enabled?: boolean;
22
21
  }
23
22
  export declare function hasProductImages(product: Pick<FwProduct, 'images' | 'variants'>): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;IACzD,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,OAAO,CAKzF;AAED,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,IAAI,EAAE,mBAAmB,GACvB,MAAM,GAAG,IAAI,CAoBf"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAA;IACzD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB;AAQD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,OAAO,CAKzF;AAED,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,IAAI,EAAE,mBAAmB,GACvB,MAAM,GAAG,IAAI,CAuBf"}
package/dist/image.js CHANGED
@@ -2,16 +2,19 @@
2
2
  * Route a remote image URL through Cloudflare Image Resizing.
3
3
  *
4
4
  * Uses the zone-local `/cdn-cgi/image/...` transform endpoint. Works on any
5
- * custom domain whose zone has "Any origin" image resizing enabled. It does
6
- * NOT work on the workers.dev subdomain, so non-matching URLs pass through
7
- * unmodified.
5
+ * custom domain whose zone permits the Fourthwall image origins. Local and
6
+ * unsupported image URLs pass through unmodified.
8
7
  *
9
- * Opt-in via `imageTransform` on `StoreOptions`. Until a custom domain with
10
- * Image Resizing is wired up, this stays off and raw CDN URLs ship as-is.
8
+ * Enabled by default. Set `imageTransform.enabled: false` for local previews
9
+ * or workers.dev hosts, which do not support zone-local transformations.
11
10
  *
12
11
  * `format=auto` picks AVIF/WebP/JPEG based on the request's `Accept` header.
13
12
  */
14
- const TRANSFORMABLE_HOSTS = ['cdn.fourthwall.com', 'storage.googleapis.com'];
13
+ const TRANSFORMABLE_HOSTS = [
14
+ 'cdn.fourthwall.com',
15
+ 'imgproxy.fourthwall.dev',
16
+ 'storage.googleapis.com',
17
+ ];
15
18
  export function hasProductImages(product) {
16
19
  return (product.images.some((image) => Boolean(image.url.trim())) ||
17
20
  product.variants.some((variant) => variant.images?.some((image) => Boolean(image.url.trim()))));
@@ -19,11 +22,12 @@ export function hasProductImages(product) {
19
22
  export function optimizeFwImage(url, opts) {
20
23
  if (!url)
21
24
  return null;
22
- if (!opts.enabled)
25
+ if (opts.enabled === false)
23
26
  return url;
24
27
  try {
25
28
  const parsed = new URL(url);
26
- if (!TRANSFORMABLE_HOSTS.some((h) => parsed.host.endsWith(h))) {
29
+ if (!['https:', 'http:'].includes(parsed.protocol) ||
30
+ !TRANSFORMABLE_HOSTS.some((h) => parsed.hostname === h || parsed.hostname.endsWith(`.${h}`))) {
27
31
  return url;
28
32
  }
29
33
  }
package/dist/image.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,MAAM,mBAAmB,GAAG,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAA;AAE5E,MAAM,UAAU,gBAAgB,CAAC,OAA+C;IAC/E,OAAO,CACN,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EA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,EAAE,EAAE;QAC/B,OAAO,IAAI,CAAC,GAAG,IAAI,OAAO,EAAE;QAC5B,aAAa;KACb,CAAA;IACD,IAAI,IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;IACrD,OAAO,kBAAkB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAA;AACnD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ export { storeOptionsSchema } from './options.js';
19
19
  export type { OrderTelemetryOptions } from './orders.js';
20
20
  export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
21
21
  export { resolveStoreProduct } from './products.js';
22
+ export type { RelatedCollectionProducts, RelatedProductsResult } from './related.js';
23
+ export { chooseRelatedCollection } from './related.js';
22
24
  /**
23
25
  * `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
24
26
  * at runtime — the same mechanism `.astro` page components use internally
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,cAAc,CAAA;AAepE,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,WAAW,EAAE,YAAY,GAAG,gBAAgB,CAyCzE;AAED,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC3E,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAClG,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAC7F,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,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AACjD,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,YAAY,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACvD,mBAAmB,YAAY,CAAA;AAC/B;;;;;;;GAOG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,qCAAqC,EACrC,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ export { hasProductImages, optimizeFwImage } from './image.js';
58
58
  export { storeOptionsSchema } from './options.js';
59
59
  export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js';
60
60
  export { resolveStoreProduct } from './products.js';
61
+ export { chooseRelatedCollection } from './related.js';
61
62
  /**
62
63
  * `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
63
64
  * at runtime — the same mechanism `.astro` page components use internally
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAqB,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,oBAAoB,E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AAMpD,OAAO,EACN,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEvD;;;;;;;GAOG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,qCAAqC,EACrC,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,GAClB,MAAM,cAAc,CAAA"}
package/dist/options.js CHANGED
@@ -96,7 +96,7 @@ const baseStoreOptionsSchema = z.object({
96
96
  legal: storeLegalSchema,
97
97
  imageTransform: z
98
98
  .object({
99
- enabled: z.boolean().default(false),
99
+ enabled: z.boolean().default(true),
100
100
  })
101
101
  .default({}),
102
102
  routes: z
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzB,qGAAqG;IACrG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC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,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;KAC3D,CAAC;SACD,OAAO,CAAC,EAAE,CAAC;CACb,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChF,GAAG,OAAO;IACV,SAAS,EAAE;QACV,GAAG,OAAO,CAAC,SAAS;QACpB,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,IAAI,OAAO,CAAC,UAAU;KACtD;CACD,CAAC,CAAC,CAAA"}
@@ -0,0 +1,18 @@
1
+ import type { StoreCollection } from './collections.js';
2
+ import type { FwProduct } from './types.js';
3
+ export interface RelatedCollectionProducts {
4
+ collection: Pick<StoreCollection, 'handle' | 'name'>;
5
+ results: FwProduct[];
6
+ }
7
+ export interface RelatedProductsResult {
8
+ collectionName: string;
9
+ products: FwProduct[];
10
+ }
11
+ /**
12
+ * Pick the first curated collection that contains the current product and
13
+ * return up to three other products from it. Candidate order is meaningful:
14
+ * consumers put their most specific branded collections before broad product
15
+ * types, so the shelf keeps the strongest merchandising context available.
16
+ */
17
+ export declare function chooseRelatedCollection(productSlug: string, collectionResults: RelatedCollectionProducts[], limit?: number): RelatedProductsResult;
18
+ //# sourceMappingURL=related.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"related.d.ts","sourceRoot":"","sources":["../src/related.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAA;IACpD,OAAO,EAAE,SAAS,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,qBAAqB;IACrC,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,SAAS,EAAE,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACtC,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,yBAAyB,EAAE,EAC9C,KAAK,SAAI,GACP,qBAAqB,CAWvB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Pick the first curated collection that contains the current product and
3
+ * return up to three other products from it. Candidate order is meaningful:
4
+ * consumers put their most specific branded collections before broad product
5
+ * types, so the shelf keeps the strongest merchandising context available.
6
+ */
7
+ export function chooseRelatedCollection(productSlug, collectionResults, limit = 3) {
8
+ for (const { collection, results } of collectionResults) {
9
+ if (!results.some((product) => product.slug === productSlug))
10
+ continue;
11
+ const products = results.filter((product) => product.slug !== productSlug).slice(0, limit);
12
+ if (products.length > 0) {
13
+ return { collectionName: collection.name, products };
14
+ }
15
+ }
16
+ return { collectionName: '', products: [] };
17
+ }
18
+ //# sourceMappingURL=related.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"related.js","sourceRoot":"","sources":["../src/related.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACtC,WAAmB,EACnB,iBAA8C,EAC9C,KAAK,GAAG,CAAC;IAET,KAAK,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,iBAAiB,EAAE,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC;YAAE,SAAQ;QAEtE,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAC1F,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAA;QACrD,CAAC;IACF,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAA;AAC5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-labs/store",
3
- "version": "0.3.2",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -14,7 +14,7 @@ interface Props {
14
14
  fourthwallShopUrl?: string
15
15
  }
16
16
 
17
- const { checkoutPath = '/api/store/checkout', imageTransformEnabled = false, cartPath = '/store/cart/', fourthwallShopUrl } = Astro.props
17
+ const { checkoutPath = '/api/store/checkout', imageTransformEnabled = true, cartPath = '/store/cart/', fourthwallShopUrl } = Astro.props
18
18
 
19
19
  const fwEnv = cloudflareEnv as FwEnv
20
20
  const token = fwEnv?.PUBLIC_FW_STOREFRONT_TOKEN ?? ''
@@ -19,7 +19,7 @@ const {
19
19
  description,
20
20
  coverImageUrl,
21
21
  priority = false,
22
- imageTransformEnabled = false,
22
+ imageTransformEnabled = true,
23
23
  basePath = '/store/collections',
24
24
  } = Astro.props
25
25
 
@@ -13,7 +13,7 @@ interface Props {
13
13
  basePath?: string
14
14
  }
15
15
 
16
- const { product, href, priority = false, imageTransformEnabled = false, basePath = '/store' } = Astro.props
16
+ const { product, href, priority = false, imageTransformEnabled = true, basePath = '/store' } = Astro.props
17
17
  const linkHref = href ?? `${basePath}/${product.slug}/`
18
18
  const colorOptions = getProductCardColorOptions(product)
19
19
  const initialOption = colorOptions[0] ?? null
@@ -40,7 +40,7 @@ const currency = env?.PUBLIC_FW_DEFAULT_CURRENCY ?? config.defaultCurrency
40
40
  Checkout isn't open for this store yet.
41
41
  </p>
42
42
  ) : (
43
- <div id="fw-cart-page" data-fw-token={token} data-fw-currency={currency} data-checkout-path={config.routes.checkoutPath}>
43
+ <div id="fw-cart-page" data-fw-token={token} data-fw-currency={currency} data-checkout-path={config.routes.checkoutPath} data-image-transform={String(config.imageTransform.enabled)}>
44
44
  <p id="fw-cart-page-empty" class="text-[var(--muted-foreground)]">
45
45
  Your cart is empty. <a class="underline" href={storePath}>Browse the store</a>.
46
46
  </p>
@@ -91,6 +91,7 @@ const currency = env?.PUBLIC_FW_DEFAULT_CURRENCY ?? config.defaultCurrency
91
91
  const token = page?.getAttribute('data-fw-token') ?? ''
92
92
  const currency = page?.getAttribute('data-fw-currency') ?? 'USD'
93
93
  const checkoutPath = page?.getAttribute('data-checkout-path') ?? '/api/store/checkout'
94
+ const imageTransformEnabled = page?.getAttribute('data-image-transform') === 'true'
94
95
  if (token) cart.init({ token, currency })
95
96
 
96
97
  function formatMoney(cents: number, cur: string): string {
@@ -121,7 +122,7 @@ const currency = env?.PUBLIC_FW_DEFAULT_CURRENCY ?? config.defaultCurrency
121
122
  contents.classList.remove('hidden')
122
123
  linesEl.innerHTML = snap.items
123
124
  .map((item) => {
124
- const optSrc = optimizeFwImage(item.imageUrl, { width: 224 }) ?? item.imageUrl
125
+ const optSrc = optimizeFwImage(item.imageUrl, { width: 224, enabled: imageTransformEnabled }) ?? item.imageUrl
125
126
  const img = item.imageUrl
126
127
  ? `<img src="${optSrc}" alt="" loading="lazy" decoding="async" class="h-28 w-28 object-cover" />`
127
128
  : `<div class="h-28 w-28 bg-[var(--muted)]"></div>`
@@ -9,6 +9,12 @@
9
9
  */
10
10
  import { getConfig } from '../state.js'
11
11
 
12
+ interface Props {
13
+ /** Hide the text payment-method list when the surrounding purchase block already shows payment badges. */
14
+ showPaymentMethods?: boolean
15
+ }
16
+
17
+ const { showPaymentMethods = true } = Astro.props
12
18
  const config = await getConfig()
13
19
  const legal = config.legal
14
20
  const hasIdentity = Boolean(legal.operator || legal.address)
@@ -19,7 +25,7 @@ const links: Array<{ href: string; label: string }> = [
19
25
  legal.contactPath ? { href: legal.contactPath, label: 'Contact' } : null,
20
26
  ].filter((link): link is { href: string; label: string } => link !== null)
21
27
 
22
- const hasContent = hasIdentity || links.length > 0 || Boolean(legal.paymentMethods?.length)
28
+ const hasContent = hasIdentity || links.length > 0 || (showPaymentMethods && Boolean(legal.paymentMethods?.length))
23
29
  ---
24
30
 
25
31
  {
@@ -44,7 +50,7 @@ const hasContent = hasIdentity || links.length > 0 || Boolean(legal.paymentMetho
44
50
  ))}
45
51
  </nav>
46
52
  )}
47
- {legal.paymentMethods && legal.paymentMethods.length > 0 && <p>Payment methods: {legal.paymentMethods.join(', ')}</p>}
53
+ {showPaymentMethods && legal.paymentMethods && legal.paymentMethods.length > 0 && <p>Payment methods: {legal.paymentMethods.join(', ')}</p>}
48
54
  </footer>
49
55
  )
50
56
  }
@@ -2,8 +2,10 @@
2
2
  import { env as cloudflareEnv } from 'cloudflare:workers'
3
3
  import { cachedJson, purgeProductCache } from '../cache.js'
4
4
  import { createFourthwallClient } from '../client.js'
5
+ import { getGroupedCollections, resolveShopCollections } from '../collections.js'
5
6
  import { getConfig } from '../state.js'
6
7
  import { hasProductImages, optimizeFwImage } from '../image.js'
8
+ import { chooseRelatedCollection } from '../related.js'
7
9
  import { FourthwallError, type FwProduct } from '../types.js'
8
10
  import {
9
11
  buildStoreProductJsonLd,
@@ -13,6 +15,7 @@ import {
13
15
  } from '../variant.js'
14
16
  import AddToCartButton from './AddToCartButton.astro'
15
17
  import Price from './Price.astro'
18
+ import ProductCard from './ProductCard.astro'
16
19
  import StoreLegalFooter from './StoreLegalFooter.astro'
17
20
  import VariantPicker from './VariantPicker.astro'
18
21
 
@@ -42,14 +45,14 @@ const env = cloudflareEnv as FwEnv
42
45
  const token = env?.PUBLIC_FW_STOREFRONT_TOKEN ?? ''
43
46
  const cookieCurrency = Astro.cookies.get('fw_currency')?.value
44
47
  const currency = cookieCurrency && config.supportedCurrencies.includes(cookieCurrency) ? cookieCurrency : config.defaultCurrency
48
+ const client = token ? createFourthwallClient({ token, defaultCurrency: currency }) : null
45
49
 
46
50
  let product: FwProduct | null = null
47
51
  let errorMessage: string | null = null
48
52
 
49
- if (!token) {
53
+ if (!client) {
50
54
  if (config.checkoutEnabled) errorMessage = "Store isn't configured yet."
51
55
  } else {
52
- const client = createFourthwallClient({ token, defaultCurrency: currency })
53
56
  try {
54
57
  product = await cachedJson({
55
58
  pathSegment: `/products/${encodeURIComponent(slug)}`,
@@ -136,6 +139,57 @@ const initialGallery = variantImagesMap[initialVariantId] ?? productLevelImages
136
139
  const heroImage = initialGallery[0]
137
140
  const descriptionHtml = product?.descriptionHtml ?? product?.description ?? ''
138
141
 
142
+ // Restore the merchandising shelf every pre-package storefront carried:
143
+ // prefer the first curated collection that contains this product, then fall
144
+ // back to the main catalogue. All lookups are best-effort so recommendations
145
+ // can never make the product itself unavailable.
146
+ let relatedProducts: FwProduct[] = []
147
+ let relatedCollectionName = ''
148
+ if (product && client) {
149
+ try {
150
+ const collections = await resolveShopCollections({ client, overrides: config.collections })
151
+ const candidateCollections = [
152
+ ...getGroupedCollections(collections, 'division'),
153
+ ...getGroupedCollections(collections, 'type'),
154
+ ].filter((collection) => collection.handle !== config.catalogueHandle)
155
+ const collectionResults = await Promise.allSettled(
156
+ candidateCollections.map((collection) =>
157
+ cachedJson({
158
+ pathSegment: `/collections/${encodeURIComponent(collection.handle)}/products`,
159
+ query: { cur: currency, preview: 'related' },
160
+ ttlSeconds: 600,
161
+ fetcher: () => client.getCollectionProducts({ handle: collection.handle, currency, size: 50 }),
162
+ }).then((data) => ({ collection, results: data.results })),
163
+ ),
164
+ )
165
+ const related = chooseRelatedCollection(
166
+ product.slug,
167
+ collectionResults
168
+ .filter((result) => result.status === 'fulfilled')
169
+ .map((result) => result.value),
170
+ )
171
+ relatedProducts = related.products
172
+ relatedCollectionName = related.collectionName
173
+ } catch {
174
+ // The catalogue fallback below still has a chance to populate the shelf.
175
+ }
176
+
177
+ if (relatedProducts.length === 0) {
178
+ try {
179
+ const result = await cachedJson({
180
+ pathSegment: `/collections/${encodeURIComponent(config.catalogueHandle)}/products`,
181
+ query: { cur: currency, preview: 'related-fallback' },
182
+ ttlSeconds: 600,
183
+ fetcher: () => client.getCollectionProducts({ handle: config.catalogueHandle, currency, size: 50 }),
184
+ })
185
+ relatedProducts = result.results.filter((candidate) => candidate.slug !== product.slug).slice(0, 3)
186
+ relatedCollectionName = 'The store'
187
+ } catch {
188
+ // Product detail remains fully usable when recommendations are unavailable.
189
+ }
190
+ }
191
+ }
192
+
139
193
  const jsonLd =
140
194
  product && selectedVariant
141
195
  ? buildStoreProductJsonLd({
@@ -260,15 +314,52 @@ const fourthwallProductUrl = fourthwallShopBaseUrl && product ? `${fourthwallSho
260
314
  checkoutPath={config.routes.checkoutPath}
261
315
  fourthwallProductUrl={fourthwallProductUrl}
262
316
  />
263
- <AddToCartButton
264
- firstVariantId={selectedVariant.id}
265
- initialAvailable={isStoreVariantAvailable(selectedVariant)}
266
- pickerSelector="[data-variant-picker]"
267
- mode="buy-now"
268
- checkoutPath={config.routes.checkoutPath}
269
- />
270
- {(config.legal.returnsPath || config.legal.shippingPath) && (
271
- <p class="text-sm text-[var(--muted-foreground)]">
317
+ <div class="space-y-3 border-t border-[var(--border)] pt-3">
318
+ <p class="flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-[var(--muted-foreground)]">
319
+ <svg
320
+ class="h-3 w-3 shrink-0"
321
+ viewBox="0 0 24 24"
322
+ fill="none"
323
+ stroke="currentColor"
324
+ stroke-width="2"
325
+ stroke-linecap="round"
326
+ stroke-linejoin="round"
327
+ aria-hidden="true"
328
+ >
329
+ <rect x="4" y="11" width="16" height="9" rx="1" />
330
+ <path d="M8 11V7a4 4 0 0 1 8 0v4" />
331
+ </svg>
332
+ Secure checkout through Fourthwall
333
+ </p>
334
+ <div class="flex flex-wrap items-center gap-3">
335
+ {[
336
+ { src: '/images/payment/apple-pay.svg', alt: 'Apple Pay', class: 'h-8 w-auto', width: 64, height: 32 },
337
+ { src: '/images/payment/google-pay.svg', alt: 'Google Pay', class: 'h-8 w-auto', width: 64, height: 32 },
338
+ { src: '/images/payment/paypal.svg', alt: 'PayPal', class: 'h-5 w-auto', width: 80, height: 20 },
339
+ { src: '/images/payment/visa.svg', alt: 'Visa', class: 'h-6 w-auto', width: 38, height: 24 },
340
+ { src: '/images/payment/mastercard.svg', alt: 'Mastercard', class: 'h-6 w-auto', width: 38, height: 24 },
341
+ { src: '/images/payment/amex.svg', alt: 'American Express', class: 'h-6 w-auto', width: 38, height: 24 },
342
+ ].map((badge) => (
343
+ <img
344
+ src={badge.src}
345
+ alt={badge.alt}
346
+ class={badge.class}
347
+ width={badge.width}
348
+ height={badge.height}
349
+ loading="lazy"
350
+ decoding="async"
351
+ />
352
+ ))}
353
+ </div>
354
+ </div>
355
+ <p class="text-xs leading-relaxed text-[var(--muted-foreground)]">
356
+ Made to order. Production and delivery times vary by item and destination.
357
+ </p>
358
+ <p class="text-xs leading-relaxed text-[var(--muted-foreground)]">
359
+ Sold and fulfilled by Fourthwall.
360
+ {(config.legal.returnsPath || config.legal.shippingPath) && (
361
+ <>
362
+ {' '}
272
363
  {config.legal.shippingPath && (
273
364
  <a href={config.legal.shippingPath} class="underline-offset-4 hover:underline">
274
365
  Shipping
@@ -280,8 +371,9 @@ const fourthwallProductUrl = fourthwallShopBaseUrl && product ? `${fourthwallSho
280
371
  returns
281
372
  </a>
282
373
  )}
283
- </p>
374
+ </>
284
375
  )}
376
+ </p>
285
377
  </div>
286
378
  )}
287
379
  {selectedVariant && !config.checkoutEnabled && (
@@ -291,7 +383,27 @@ const fourthwallProductUrl = fourthwallShopBaseUrl && product ? `${fourthwallSho
291
383
  </div>
292
384
  )}
293
385
 
294
- <StoreLegalFooter />
386
+ {product && relatedProducts.length > 0 && (
387
+ <section class="space-y-6 border-t border-[var(--border)] pt-12" aria-labelledby="store-related-heading">
388
+ <div>
389
+ <p class="text-xs uppercase tracking-[0.14em] text-[var(--muted-foreground)]">More from</p>
390
+ <h2 id="store-related-heading" class="mt-1 text-2xl font-semibold text-[var(--foreground)]">
391
+ {relatedCollectionName}
392
+ </h2>
393
+ </div>
394
+ <div class="grid grid-cols-1 gap-6 sm:grid-cols-3">
395
+ {relatedProducts.map((relatedProduct) => (
396
+ <ProductCard
397
+ product={relatedProduct}
398
+ imageTransformEnabled={config.imageTransform.enabled}
399
+ basePath={basePath}
400
+ />
401
+ ))}
402
+ </div>
403
+ </section>
404
+ )}
405
+
406
+ <StoreLegalFooter showPaymentMethods={false} />
295
407
 
296
408
  <script>
297
409
  document.querySelectorAll<HTMLElement>('[data-product-root]').forEach((root) => {
package/src/image.ts CHANGED
@@ -2,12 +2,11 @@
2
2
  * Route a remote image URL through Cloudflare Image Resizing.
3
3
  *
4
4
  * Uses the zone-local `/cdn-cgi/image/...` transform endpoint. Works on any
5
- * custom domain whose zone has "Any origin" image resizing enabled. It does
6
- * NOT work on the workers.dev subdomain, so non-matching URLs pass through
7
- * unmodified.
5
+ * custom domain whose zone permits the Fourthwall image origins. Local and
6
+ * unsupported image URLs pass through unmodified.
8
7
  *
9
- * Opt-in via `imageTransform` on `StoreOptions`. Until a custom domain with
10
- * Image Resizing is wired up, this stays off and raw CDN URLs ship as-is.
8
+ * Enabled by default. Set `imageTransform.enabled: false` for local previews
9
+ * or workers.dev hosts, which do not support zone-local transformations.
11
10
  *
12
11
  * `format=auto` picks AVIF/WebP/JPEG based on the request's `Accept` header.
13
12
  */
@@ -19,11 +18,15 @@ export interface OptimizeFwImageOpts {
19
18
  height?: number
20
19
  quality?: number
21
20
  fit?: 'cover' | 'contain' | 'scale-down' | 'crop' | 'pad'
22
- /** From `StoreOptions.imageTransform`. Defaults to disabled. */
21
+ /** From `StoreOptions.imageTransform`. Defaults to enabled. */
23
22
  enabled?: boolean
24
23
  }
25
24
 
26
- const TRANSFORMABLE_HOSTS = ['cdn.fourthwall.com', 'storage.googleapis.com']
25
+ const TRANSFORMABLE_HOSTS = [
26
+ 'cdn.fourthwall.com',
27
+ 'imgproxy.fourthwall.dev',
28
+ 'storage.googleapis.com',
29
+ ]
27
30
 
28
31
  export function hasProductImages(product: Pick<FwProduct, 'images' | 'variants'>): boolean {
29
32
  return (
@@ -37,10 +40,13 @@ export function optimizeFwImage(
37
40
  opts: OptimizeFwImageOpts,
38
41
  ): string | null {
39
42
  if (!url) return null
40
- if (!opts.enabled) return url
43
+ if (opts.enabled === false) return url
41
44
  try {
42
45
  const parsed = new URL(url)
43
- if (!TRANSFORMABLE_HOSTS.some((h) => parsed.host.endsWith(h))) {
46
+ if (
47
+ !['https:', 'http:'].includes(parsed.protocol) ||
48
+ !TRANSFORMABLE_HOSTS.some((h) => parsed.hostname === h || parsed.hostname.endsWith(`.${h}`))
49
+ ) {
44
50
  return url
45
51
  }
46
52
  } catch {
package/src/index.ts CHANGED
@@ -87,6 +87,8 @@ export { storeOptionsSchema } from './options.js'
87
87
  export type { OrderTelemetryOptions } from './orders.js'
88
88
  export { buildStoreOrderWAEDataPoint, createD1OrderHandler } from './orders.js'
89
89
  export { resolveStoreProduct } from './products.js'
90
+ export type { RelatedCollectionProducts, RelatedProductsResult } from './related.js'
91
+ export { chooseRelatedCollection } from './related.js'
90
92
  /**
91
93
  * `getConfig`/`getConfigOrNull` resolve this site's fully-parsed `StoreOptions`
92
94
  * at runtime — the same mechanism `.astro` page components use internally
package/src/options.ts CHANGED
@@ -109,7 +109,7 @@ const baseStoreOptionsSchema = z.object({
109
109
 
110
110
  imageTransform: z
111
111
  .object({
112
- enabled: z.boolean().default(false),
112
+ enabled: z.boolean().default(true),
113
113
  })
114
114
  .default({}),
115
115
 
package/src/related.ts ADDED
@@ -0,0 +1,35 @@
1
+ import type { StoreCollection } from './collections.js'
2
+ import type { FwProduct } from './types.js'
3
+
4
+ export interface RelatedCollectionProducts {
5
+ collection: Pick<StoreCollection, 'handle' | 'name'>
6
+ results: FwProduct[]
7
+ }
8
+
9
+ export interface RelatedProductsResult {
10
+ collectionName: string
11
+ products: FwProduct[]
12
+ }
13
+
14
+ /**
15
+ * Pick the first curated collection that contains the current product and
16
+ * return up to three other products from it. Candidate order is meaningful:
17
+ * consumers put their most specific branded collections before broad product
18
+ * types, so the shelf keeps the strongest merchandising context available.
19
+ */
20
+ export function chooseRelatedCollection(
21
+ productSlug: string,
22
+ collectionResults: RelatedCollectionProducts[],
23
+ limit = 3,
24
+ ): RelatedProductsResult {
25
+ for (const { collection, results } of collectionResults) {
26
+ if (!results.some((product) => product.slug === productSlug)) continue
27
+
28
+ const products = results.filter((product) => product.slug !== productSlug).slice(0, limit)
29
+ if (products.length > 0) {
30
+ return { collectionName: collection.name, products }
31
+ }
32
+ }
33
+
34
+ return { collectionName: '', products: [] }
35
+ }