create-brainerce-store 1.54.0 → 1.55.0

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/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var require_package = __commonJS({
31
31
  "package.json"(exports2, module2) {
32
32
  module2.exports = {
33
33
  name: "create-brainerce-store",
34
- version: "1.54.0",
34
+ version: "1.55.0",
35
35
  description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
36
36
  bin: {
37
37
  "create-brainerce-store": "dist/index.js"
@@ -399,6 +399,9 @@ async function scaffold(options) {
399
399
  * must keep using the escaped storeNameJs / storeNameEnv variants. */
400
400
  storeName: cleanStoreName,
401
401
  storeNameJs: toJsStringLiteral(cleanStoreName),
402
+ /** Pre-escaped for splicing into a JSON string value (no wrapping
403
+ * quotes) — used by the `{{storeName}}` token in messages-patch files. */
404
+ storeNameJsonEscaped: JSON.stringify(cleanStoreName).slice(1, -1),
402
405
  titleTemplateJs: toJsStringLiteral(`%s | ${cleanStoreName}`),
403
406
  storeNameEnv: toEnvLiteral(cleanStoreName),
404
407
  currencyEnv: toEnvLiteral(cleanCurrency),
@@ -479,7 +482,11 @@ async function scaffold(options) {
479
482
  if (!await import_fs_extra.default.pathExists(patchFile)) continue;
480
483
  const targetFile = import_path.default.join(targetMessages, file);
481
484
  const base = await import_fs_extra.default.readJson(targetFile);
482
- const patch = await import_fs_extra.default.readJson(patchFile);
485
+ const patchText = (await import_fs_extra.default.readFile(patchFile, "utf-8")).replace(
486
+ /\{\{storeName\}\}/g,
487
+ templateVars.storeNameJsonEscaped
488
+ );
489
+ const patch = JSON.parse(patchText);
483
490
  await import_fs_extra.default.writeJson(targetFile, deepMerge(base, patch), { spaces: 2 });
484
491
  }
485
492
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-brainerce-store",
3
- "version": "1.54.0",
3
+ "version": "1.55.0",
4
4
  "description": "Scaffold a production-ready e-commerce storefront connected to Brainerce",
5
5
  "bin": {
6
6
  "create-brainerce-store": "dist/index.js"
@@ -6,6 +6,7 @@ import { buildMetaDescription } from '@/core/lib/seo';
6
6
  import { sanitizeHtml } from '@/core/lib/sanitize';
7
7
  import { decodeSlug } from '@/core/lib/utils';
8
8
  import { CategoryJsonLd } from '@/components/seo/category-json-ld';
9
+ import { Breadcrumbs } from '@/components/seo/breadcrumbs';
9
10
  import { ProductGrid } from '@/ui/product/product-grid';
10
11
 
11
12
  type Props = {
@@ -29,8 +30,9 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
29
30
  const description =
30
31
  category.metaDescription || buildMetaDescription(category.description) || category.name;
31
32
  const canonicalSlug = category.slug || slug;
32
- const canonicalPath =
33
- locale ? `/${locale}/category/${canonicalSlug}` : `/category/${canonicalSlug}`;
33
+ const canonicalPath = locale
34
+ ? `/${locale}/category/${canonicalSlug}`
35
+ : `/category/${canonicalSlug}`;
34
36
  return {
35
37
  title: category.name,
36
38
  description,
@@ -69,11 +71,23 @@ export default async function CategoryPage({ params }: Props) {
69
71
 
70
72
  const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
71
73
  const url = `${baseUrl}/category/${category.slug || slug}`;
74
+ const localePrefix = locale ? `/${locale}` : '';
75
+ const breadcrumbItems = [
76
+ { name: 'Home', href: `${localePrefix}/` },
77
+ ...category.breadcrumb
78
+ .filter((ancestor) => ancestor.slug)
79
+ .map((ancestor) => ({
80
+ name: ancestor.name,
81
+ href: `${localePrefix}/category/${ancestor.slug}`,
82
+ })),
83
+ { name: category.name },
84
+ ];
72
85
 
73
86
  return (
74
87
  <>
75
88
  <CategoryJsonLd category={category} url={url} />
76
89
  <div className="container mx-auto px-4 py-8">
90
+ <Breadcrumbs items={breadcrumbItems} />
77
91
  <header className="mb-6">
78
92
  <h1 className="text-3xl font-bold tracking-tight">{category.name}</h1>
79
93
  </header>
@@ -1,157 +1,175 @@
1
- import type { Metadata } from 'next';
2
- import { notFound } from 'next/navigation';
3
- import { getProductPriceInfo } from 'brainerce';
4
- import { getServerClient, fetchStoreInfo } from '@/core/lib/brainerce';
5
- import { resolveCurrency } from '@/core/lib/resolve-currency';
6
- import { buildMetaDescription } from '@/core/lib/seo';
7
- import { decodeSlug } from '@/core/lib/utils';
8
- import { ProductJsonLd } from '@/components/seo/product-json-ld';
9
- import { ReviewsSection } from '@/ui/product/reviews-section';
10
- import { ProductClientSection } from '@/ui/product/product-client-section';
11
-
12
- type Props = {
13
- params: Promise<{ slug: string; locale?: string }>;
14
- };
15
-
16
- function buildHreflang(
17
- baseUrl: string,
18
- baseSlug: string,
19
- localeSlugs: Record<string, string>,
20
- locales: string[],
21
- defaultLoc: string
22
- ): Record<string, string> {
23
- const langs: Record<string, string> = {};
24
- for (const loc of locales) {
25
- const locSlug = localeSlugs[loc] || baseSlug;
26
- const path = loc === defaultLoc ? `/products/${locSlug}` : `/${loc}/products/${locSlug}`;
27
- langs[loc] = `${baseUrl}${path}`;
28
- }
29
- // x-default points to the default-locale canonical (no prefix)
30
- langs['x-default'] = `${baseUrl}/products/${localeSlugs[defaultLoc] || baseSlug}`;
31
- return langs;
32
- }
33
-
34
- export async function generateMetadata({ params }: Props): Promise<Metadata> {
35
- const { slug: rawSlug, locale } = await params;
36
- const slug = decodeSlug(rawSlug);
37
-
38
- try {
39
- const client = getServerClient(locale);
40
- // Fetch product + store info in parallel; storeInfo gives us the live
41
- // currency for OG price tags (with env-var + USD fallbacks so we never
42
- // silently emit a wrong currency when the API is briefly unreachable).
43
- const [product, storeInfo] = await Promise.all([
44
- client.getProductBySlug(slug),
45
- fetchStoreInfo(locale),
46
- ]);
47
- const imageUrl = product.images?.[0]?.url;
48
- // Prefer merchant-authored SEO copy; fall back to a stripped+truncated
49
- // version of the visible description, then product name. We must NEVER
50
- // emit raw HTML or a mid-word cut into <meta name="description">.
51
- const seoTitle = (product as { seoTitle?: string | null }).seoTitle || product.name;
52
- const seoDescription =
53
- (product as { seoDescription?: string | null }).seoDescription ||
54
- buildMetaDescription(product.description) ||
55
- product.name;
56
-
57
- // OG product meta tags drive WhatsApp / Facebook / X link previews and
58
- // Google Merchant Center product enrichment. Emitting the literal "0"
59
- // here (the previous bug) causes price-zero link cards. Use the real
60
- // effective price from the SDK helper.
61
- const priceInfo = getProductPriceInfo(product);
62
- const currency = resolveCurrency(storeInfo);
63
- const priceAmount = priceInfo.price > 0 ? priceInfo.price.toFixed(2) : null;
64
- const inStock = product.inventory?.canPurchase !== false;
65
- const brandName = (product as { brand?: { name?: string } | null }).brand?.name;
66
-
67
- // Multilingual SEO: hreflang tags + correct canonical per locale.
68
- // Locales come from storeInfo.i18n already fetched above, zero extra cost.
69
- const supportedLocales = storeInfo?.i18n?.supportedLocales ?? [];
70
- const defaultLoc = storeInfo?.i18n?.defaultLocale ?? storeInfo?.language ?? '';
71
- const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
72
- const baseSlug = product.slug || slug;
73
- const localeSlugs = product.localeSlugs ?? {};
74
-
75
- // Canonical: use the locale-specific slug for this locale when available.
76
- const canonicalSlug = (locale && localeSlugs[locale]) || baseSlug;
77
- const canonicalPath =
78
- locale && locale !== defaultLoc
79
- ? `/${locale}/products/${canonicalSlug}`
80
- : `/products/${canonicalSlug}`;
81
-
82
- const hreflangLanguages =
83
- supportedLocales.length > 1
84
- ? buildHreflang(baseUrl, baseSlug, localeSlugs, supportedLocales, defaultLoc)
85
- : undefined;
86
-
87
- return {
88
- title: seoTitle,
89
- description: seoDescription,
90
- alternates: {
91
- canonical: canonicalPath,
92
- ...(hreflangLanguages ? { languages: hreflangLanguages } : {}),
93
- },
94
- openGraph: {
95
- title: seoTitle,
96
- description: seoDescription,
97
- images: imageUrl ? [{ url: imageUrl, alt: product.name }] : [],
98
- type: 'website',
99
- },
100
- twitter: {
101
- card: 'summary_large_image',
102
- title: seoTitle,
103
- description: seoDescription,
104
- images: imageUrl ? [imageUrl] : [],
105
- },
106
- // Emit the OG product extension (Facebook / WhatsApp / X link previews,
107
- // Google Merchant Center). Skips the price pair entirely when the SDK
108
- // can't determine a positive amount, rather than shipping "0".
109
- other: {
110
- ...(priceAmount
111
- ? {
112
- 'og:price:amount': priceAmount,
113
- 'og:price:currency': currency,
114
- 'product:price:amount': priceAmount,
115
- 'product:price:currency': currency,
116
- }
117
- : {}),
118
- 'product:availability': inStock ? 'in stock' : 'out of stock',
119
- 'product:condition': 'new',
120
- ...(brandName ? { 'product:brand': brandName } : {}),
121
- },
122
- };
123
- } catch {
124
- return {
125
- title: 'Product not found',
126
- };
127
- }
128
- }
129
-
130
- export default async function ProductDetailPage({ params }: Props) {
131
- const { slug: rawSlug, locale } = await params;
132
- const slug = decodeSlug(rawSlug);
133
-
134
- let product;
135
- try {
136
- const client = getServerClient(locale);
137
- product = await client.getProductBySlug(slug);
138
- } catch {
139
- notFound();
140
- }
141
-
142
- const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
143
- const productUrl = `${baseUrl}/products/${slug}`;
144
- // Reuse the cached storeInfo from generateMetadata's call — React cache()
145
- // collapses both into one backend request per render. resolveCurrency owns
146
- // the env-var + USD fallback chain so this stays a single source of truth.
147
- const storeInfo = await fetchStoreInfo(locale);
148
- const currency = resolveCurrency(storeInfo);
149
-
150
- return (
151
- <>
152
- <ProductJsonLd product={product} url={productUrl} currency={currency} />
153
- <ProductClientSection product={product} />
154
- <ReviewsSection productId={product.id} />
155
- </>
156
- );
157
- }
1
+ import type { Metadata } from 'next';
2
+ import { notFound } from 'next/navigation';
3
+ import { getProductPriceInfo } from 'brainerce';
4
+ import { getServerClient, fetchStoreInfo } from '@/core/lib/brainerce';
5
+ import { resolveCurrency } from '@/core/lib/resolve-currency';
6
+ import { buildMetaDescription } from '@/core/lib/seo';
7
+ import { decodeSlug } from '@/core/lib/utils';
8
+ import { ProductJsonLd } from '@/components/seo/product-json-ld';
9
+ import { Breadcrumbs } from '@/components/seo/breadcrumbs';
10
+ import { ReviewsSection } from '@/ui/product/reviews-section';
11
+ import { ProductClientSection } from '@/ui/product/product-client-section';
12
+
13
+ type Props = {
14
+ params: Promise<{ slug: string; locale?: string }>;
15
+ };
16
+
17
+ function buildHreflang(
18
+ baseUrl: string,
19
+ baseSlug: string,
20
+ localeSlugs: Record<string, string>,
21
+ locales: string[],
22
+ defaultLoc: string
23
+ ): Record<string, string> {
24
+ const langs: Record<string, string> = {};
25
+ for (const loc of locales) {
26
+ const locSlug = localeSlugs[loc] || baseSlug;
27
+ const path = loc === defaultLoc ? `/products/${locSlug}` : `/${loc}/products/${locSlug}`;
28
+ langs[loc] = `${baseUrl}${path}`;
29
+ }
30
+ // x-default points to the default-locale canonical (no prefix)
31
+ langs['x-default'] = `${baseUrl}/products/${localeSlugs[defaultLoc] || baseSlug}`;
32
+ return langs;
33
+ }
34
+
35
+ export async function generateMetadata({ params }: Props): Promise<Metadata> {
36
+ const { slug: rawSlug, locale } = await params;
37
+ const slug = decodeSlug(rawSlug);
38
+
39
+ try {
40
+ const client = getServerClient(locale);
41
+ // Fetch product + store info in parallel; storeInfo gives us the live
42
+ // currency for OG price tags (with env-var + USD fallbacks so we never
43
+ // silently emit a wrong currency when the API is briefly unreachable).
44
+ const [product, storeInfo] = await Promise.all([
45
+ client.getProductBySlug(slug),
46
+ fetchStoreInfo(locale),
47
+ ]);
48
+ const imageUrl = product.images?.[0]?.url;
49
+ // Prefer merchant-authored SEO copy; fall back to a stripped+truncated
50
+ // version of the visible description, then product name. We must NEVER
51
+ // emit raw HTML or a mid-word cut into <meta name="description">.
52
+ const seoTitle = (product as { seoTitle?: string | null }).seoTitle || product.name;
53
+ const seoDescription =
54
+ (product as { seoDescription?: string | null }).seoDescription ||
55
+ buildMetaDescription(product.description) ||
56
+ product.name;
57
+
58
+ // OG product meta tags drive WhatsApp / Facebook / X link previews and
59
+ // Google Merchant Center product enrichment. Emitting the literal "0"
60
+ // here (the previous bug) causes price-zero link cards. Use the real
61
+ // effective price from the SDK helper.
62
+ const priceInfo = getProductPriceInfo(product);
63
+ const currency = resolveCurrency(storeInfo);
64
+ const priceAmount = priceInfo.price > 0 ? priceInfo.price.toFixed(2) : null;
65
+ const inStock = product.inventory?.canPurchase !== false;
66
+ const brandName = (product as { brand?: { name?: string } | null }).brand?.name;
67
+
68
+ // Multilingual SEO: hreflang tags + correct canonical per locale.
69
+ // Locales come from storeInfo.i18n already fetched above, zero extra cost.
70
+ const supportedLocales = storeInfo?.i18n?.supportedLocales ?? [];
71
+ const defaultLoc = storeInfo?.i18n?.defaultLocale ?? storeInfo?.language ?? '';
72
+ const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
73
+ const baseSlug = product.slug || slug;
74
+ const localeSlugs = product.localeSlugs ?? {};
75
+
76
+ // Canonical: use the locale-specific slug for this locale when available.
77
+ const canonicalSlug = (locale && localeSlugs[locale]) || baseSlug;
78
+ const canonicalPath =
79
+ locale && locale !== defaultLoc
80
+ ? `/${locale}/products/${canonicalSlug}`
81
+ : `/products/${canonicalSlug}`;
82
+
83
+ const hreflangLanguages =
84
+ supportedLocales.length > 1
85
+ ? buildHreflang(baseUrl, baseSlug, localeSlugs, supportedLocales, defaultLoc)
86
+ : undefined;
87
+
88
+ return {
89
+ title: seoTitle,
90
+ description: seoDescription,
91
+ alternates: {
92
+ canonical: canonicalPath,
93
+ ...(hreflangLanguages ? { languages: hreflangLanguages } : {}),
94
+ },
95
+ openGraph: {
96
+ title: seoTitle,
97
+ description: seoDescription,
98
+ images: imageUrl ? [{ url: imageUrl, alt: product.name }] : [],
99
+ type: 'website',
100
+ },
101
+ twitter: {
102
+ card: 'summary_large_image',
103
+ title: seoTitle,
104
+ description: seoDescription,
105
+ images: imageUrl ? [imageUrl] : [],
106
+ },
107
+ // Emit the OG product extension (Facebook / WhatsApp / X link previews,
108
+ // Google Merchant Center). Skips the price pair entirely when the SDK
109
+ // can't determine a positive amount, rather than shipping "0".
110
+ other: {
111
+ ...(priceAmount
112
+ ? {
113
+ 'og:price:amount': priceAmount,
114
+ 'og:price:currency': currency,
115
+ 'product:price:amount': priceAmount,
116
+ 'product:price:currency': currency,
117
+ }
118
+ : {}),
119
+ 'product:availability': inStock ? 'in stock' : 'out of stock',
120
+ 'product:condition': 'new',
121
+ ...(brandName ? { 'product:brand': brandName } : {}),
122
+ },
123
+ };
124
+ } catch {
125
+ return {
126
+ title: 'Product not found',
127
+ };
128
+ }
129
+ }
130
+
131
+ export default async function ProductDetailPage({ params }: Props) {
132
+ const { slug: rawSlug, locale } = await params;
133
+ const slug = decodeSlug(rawSlug);
134
+
135
+ let product;
136
+ try {
137
+ const client = getServerClient(locale);
138
+ product = await client.getProductBySlug(slug);
139
+ } catch {
140
+ notFound();
141
+ }
142
+
143
+ const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
144
+ const productUrl = `${baseUrl}/products/${slug}`;
145
+ // Reuse the cached storeInfo from generateMetadata's call React cache()
146
+ // collapses both into one backend request per render. resolveCurrency owns
147
+ // the env-var + USD fallback chain so this stays a single source of truth.
148
+ const storeInfo = await fetchStoreInfo(locale);
149
+ const currency = resolveCurrency(storeInfo);
150
+ const localePrefix = locale ? `/${locale}` : '';
151
+ const primaryCategory = product.categories?.find((c) => c.slug);
152
+ const breadcrumbItems = [
153
+ { name: 'Home', href: `${localePrefix}/` },
154
+ ...(primaryCategory
155
+ ? [{ name: primaryCategory.name, href: `${localePrefix}/category/${primaryCategory.slug}` }]
156
+ : []),
157
+ { name: product.name },
158
+ ];
159
+
160
+ return (
161
+ <>
162
+ <ProductJsonLd
163
+ product={product}
164
+ url={productUrl}
165
+ currency={currency}
166
+ shipping={storeInfo?.shipping}
167
+ />
168
+ <div className="mx-auto max-w-7xl px-4 pt-6 sm:px-6 lg:px-8">
169
+ <Breadcrumbs items={breadcrumbItems} />
170
+ </div>
171
+ <ProductClientSection product={product} />
172
+ <ReviewsSection productId={product.id} />
173
+ </>
174
+ );
175
+ }
@@ -0,0 +1,37 @@
1
+ import Link from 'next/link';
2
+
3
+ interface Crumb {
4
+ name: string;
5
+ /** Site-relative path, e.g. "/category/shoes". Omit on the current (last) crumb. */
6
+ href?: string;
7
+ }
8
+
9
+ /**
10
+ * Visible breadcrumb trail. Renders the exact same path structured data
11
+ * already declares (see category-json-ld.tsx / product-json-ld.tsx) as real
12
+ * `<Link>`s — search engines weight on-page navigation links much more than
13
+ * sitemap-only or script-only (JSON-LD) mentions of a URL.
14
+ */
15
+ export function Breadcrumbs({ items }: { items: Crumb[] }) {
16
+ if (items.length < 2) return null;
17
+ return (
18
+ <nav aria-label="Breadcrumb" className="text-muted-foreground mb-4 text-sm">
19
+ <ol className="flex flex-wrap items-center gap-1.5">
20
+ {items.map((item, idx) => (
21
+ <li key={`${item.name}-${idx}`} className="flex items-center gap-1.5">
22
+ {idx > 0 && <span aria-hidden="true">/</span>}
23
+ {item.href ? (
24
+ <Link href={item.href} className="hover:text-foreground transition-colors">
25
+ {item.name}
26
+ </Link>
27
+ ) : (
28
+ <span aria-current="page" className="text-foreground">
29
+ {item.name}
30
+ </span>
31
+ )}
32
+ </li>
33
+ ))}
34
+ </ol>
35
+ </nav>
36
+ );
37
+ }
@@ -1,4 +1,4 @@
1
- import type { Product } from 'brainerce';
1
+ import type { Product, ShippingSummaryEntry } from 'brainerce';
2
2
  import { getProductPriceInfo } from 'brainerce';
3
3
  import { getNonce } from '@/core/lib/nonce';
4
4
  import { resolveCurrency } from '@/core/lib/resolve-currency';
@@ -8,9 +8,11 @@ interface ProductJsonLdProps {
8
8
  product: Product;
9
9
  url: string;
10
10
  currency?: string;
11
+ /** From `storeInfo.shipping` — real flat-rate/free zones only. Omitted entirely when unset, never fabricated. */
12
+ shipping?: ShippingSummaryEntry[];
11
13
  }
12
14
 
13
- export async function ProductJsonLd({ product, url, currency }: ProductJsonLdProps) {
15
+ export async function ProductJsonLd({ product, url, currency, shipping }: ProductJsonLdProps) {
14
16
  // Defer to the shared server helper so the env-var + USD fallback chain
15
17
  // lives in exactly one place across all server-side currency reads.
16
18
  const resolvedCurrency = resolveCurrency(null, currency);
@@ -24,6 +26,44 @@ export async function ProductJsonLd({ product, url, currency }: ProductJsonLdPro
24
26
  ? 'https://schema.org/InStock'
25
27
  : 'https://schema.org/OutOfStock';
26
28
 
29
+ // All Brainerce catalog listings are first-party new-goods sales — no
30
+ // used/refurbished condition data exists anywhere in the product model, so
31
+ // this is a deliberate always-true assumption, not a per-product field.
32
+ const itemCondition = 'https://schema.org/NewCondition';
33
+
34
+ const shippingDetails = (shipping ?? [])
35
+ .filter((z) => z.amount !== null)
36
+ .map((z) => ({
37
+ '@type': 'OfferShippingDetails',
38
+ shippingRate: { '@type': 'MonetaryAmount', value: z.amount, currency: resolvedCurrency },
39
+ shippingDestination: { '@type': 'DefinedRegion', addressCountry: z.countries },
40
+ ...(z.handlingTime != null || z.minDeliveryDays != null || z.maxDeliveryDays != null
41
+ ? {
42
+ deliveryTime: {
43
+ '@type': 'ShippingDeliveryTime',
44
+ ...(z.handlingTime != null
45
+ ? {
46
+ handlingTime: {
47
+ '@type': 'QuantitativeValue',
48
+ minValue: 0,
49
+ maxValue: z.handlingTime,
50
+ },
51
+ }
52
+ : {}),
53
+ ...(z.minDeliveryDays != null || z.maxDeliveryDays != null
54
+ ? {
55
+ transitTime: {
56
+ '@type': 'QuantitativeValue',
57
+ minValue: z.minDeliveryDays ?? z.maxDeliveryDays,
58
+ maxValue: z.maxDeliveryDays ?? z.minDeliveryDays,
59
+ },
60
+ }
61
+ : {}),
62
+ },
63
+ }
64
+ : {}),
65
+ }));
66
+
27
67
  const isVariable = product.type === 'VARIABLE';
28
68
  const offers =
29
69
  isVariable && product.priceMin
@@ -34,6 +74,8 @@ export async function ProductJsonLd({ product, url, currency }: ProductJsonLdPro
34
74
  offerCount: product.variants?.length ?? 1,
35
75
  priceCurrency: resolvedCurrency,
36
76
  availability,
77
+ itemCondition,
78
+ ...(shippingDetails.length > 0 ? { shippingDetails } : {}),
37
79
  url,
38
80
  }
39
81
  : {
@@ -41,6 +83,11 @@ export async function ProductJsonLd({ product, url, currency }: ProductJsonLdPro
41
83
  price: priceInfo.price,
42
84
  priceCurrency: resolvedCurrency,
43
85
  availability,
86
+ itemCondition,
87
+ ...(product.salePrice && product.salePriceEndsAt
88
+ ? { priceValidUntil: product.salePriceEndsAt }
89
+ : {}),
90
+ ...(shippingDetails.length > 0 ? { shippingDetails } : {}),
44
91
  url,
45
92
  };
46
93
 
@@ -23,6 +23,8 @@ export interface PublicStoreInfo {
23
23
  requireEmailVerification?: boolean;
24
24
  upsell?: StoreInfo['upsell'];
25
25
  i18n?: StoreInfo['i18n'];
26
+ /** Real flat-rate/free shipping zones — feeds Product JSON-LD `shippingDetails`. Public by design (merchants display shipping rates openly). */
27
+ shipping?: StoreInfo['shipping'];
26
28
  }
27
29
 
28
30
  /**
@@ -44,5 +46,6 @@ export function pickPublicStoreInfo(raw: StoreInfo): PublicStoreInfo {
44
46
  requireEmailVerification: raw.requireEmailVerification,
45
47
  upsell: raw.upsell,
46
48
  i18n: raw.i18n,
49
+ shipping: raw.shipping,
47
50
  };
48
51
  }
@@ -3,7 +3,7 @@
3
3
  @tailwind utilities;
4
4
 
5
5
  /* ---------------------------------------------------------------------------
6
- Design system — "Atelier" (premium modern jewelry commerce)
6
+ Design system — "Atelier" (premium modern handcrafted-goods commerce)
7
7
  Palette (5 total): warm white / warm ink / deep forest / warm sand (2 tints)
8
8
  + functional destructive. Tokens only — never raw colors in components.
9
9
  --------------------------------------------------------------------------- */
@@ -8,8 +8,8 @@
8
8
  },
9
9
  "home": {
10
10
  "heroEyebrow": "New collection · Handcrafted",
11
- "heroTitle": "Jewelry that tells your story",
12
- "heroLead": "Delicate gold and silver designs, handcrafted with love — made to be with you through the small moments and the big ones.",
11
+ "heroTitle": "Pieces that tell your story",
12
+ "heroLead": "Thoughtfully designed, handcrafted with love — made to be with you through the small moments and the big ones.",
13
13
  "heroCtaSecondary": "Browse categories",
14
14
  "heroTrust": "Happy customers nationwide",
15
15
  "benefit1Title": "Fast home delivery",
@@ -17,37 +17,37 @@
17
17
  "benefit2Title": "Secure payment",
18
18
  "benefit2Desc": "Encrypted checkout, highest standard",
19
19
  "benefit3Title": "Quality materials",
20
- "benefit3Desc": "Gold, 925 silver and genuine stones",
20
+ "benefit3Desc": "Carefully sourced, built to last",
21
21
  "benefit4Title": "Easy returns",
22
22
  "benefit4Desc": "30 days to exchange or return, no questions",
23
23
  "featuredEyebrow": "Our picks",
24
24
  "featuredSubtitle": "The pieces our customers love most — hand-picked from the new collection.",
25
25
  "categoriesEyebrow": "Categories",
26
26
  "categoriesTitle": "Find the perfect piece",
27
- "categoriesSubtitle": "From delicate rings to statement necklaceseach one speaks its own language.",
27
+ "categoriesSubtitle": "From everyday favorites to statement piecesthere's something for everyone.",
28
28
  "catRings": "Rings",
29
29
  "catNecklaces": "Necklaces",
30
30
  "catEarrings": "Earrings",
31
31
  "catBracelets": "Bracelets",
32
32
  "catCta": "Shop the category",
33
33
  "storyEyebrow": "Our studio",
34
- "storyTitle": "Made by hand, worn by heart",
35
- "storyP1": "Every piece begins as a small sketch on paper — and ends as delicate handwork in our studio. We choose every stone and every link with care, so the piece that reaches you is exactly as we imagined it.",
36
- "storyP2": "We believe in jewelry that lasts: real materials, meticulous finish and full warranty on every piece. That is what love for the small details looks like.",
34
+ "storyTitle": "Made with care, made to last",
35
+ "storyP1": "Every piece begins as a small sketch on paper — and ends as delicate handwork in our studio. We choose every material and every detail with care, so the piece that reaches you is exactly as we imagined it.",
36
+ "storyP2": "We believe in pieces that last: real materials, meticulous finish and full warranty on every piece. That is what love for the small details looks like.",
37
37
  "storyCta": "Discover the collection",
38
38
  "storyStat1Value": "Handmade",
39
39
  "storyStat1Label": "Every piece is made in our studio",
40
- "storyStat2Value": "925 Silver",
41
- "storyStat2Label": "Genuine materials only",
40
+ "storyStat2Value": "Hand-finished",
41
+ "storyStat2Label": "Every piece checked before it ships",
42
42
  "testimonialsEyebrow": "Customer stories",
43
43
  "testimonialsTitle": "They already fell in love",
44
- "testimonial1Quote": "The necklace arrived in gorgeous packaging and looks even better than the photos. I got compliments on day one.",
44
+ "testimonial1Quote": "It arrived in gorgeous packaging and looks even better than the photos. I got compliments on day one.",
45
45
  "testimonial1Name": "Noa L.",
46
46
  "testimonial1Meta": "Tel Aviv",
47
- "testimonial2Quote": "I bought earrings as a gift for my mom and she has not taken them off since. Amazing quality and truly personal service.",
47
+ "testimonial2Quote": "I bought this as a gift for my mom and she has not put it down since. Amazing quality and truly personal service.",
48
48
  "testimonial2Name": "Shira B.",
49
49
  "testimonial2Meta": "Haifa",
50
- "testimonial3Quote": "The ring fits perfectly, the work is delicate and precise. You can feel every detail was made with love. Highly recommend.",
50
+ "testimonial3Quote": "It's exactly as described, the work is delicate and precise. You can feel every detail was made with love. Highly recommend.",
51
51
  "testimonial3Name": "Dana K.",
52
52
  "testimonial3Meta": "Jerusalem",
53
53
  "newsletterTitle": "Join our club",
@@ -88,7 +88,7 @@
88
88
  "shippingAtCheckout": "Shipping calculated at checkout"
89
89
  },
90
90
  "footer": {
91
- "tagline": "Handcrafted jewelry, designed with love in Israel.",
91
+ "tagline": "{{storeName}} handcrafted with love in Israel.",
92
92
  "followUs": "Follow us",
93
93
  "quickLinksTitle": "Quick links",
94
94
  "linkProducts": "All products",
@@ -8,8 +8,8 @@
8
8
  },
9
9
  "home": {
10
10
  "heroEyebrow": "קולקציה חדשה · עבודת יד",
11
- "heroTitle": "תכשיטים שמספרים את הסיפור שלך",
12
- "heroLead": "עיצובים עדינים מזהב ומכסף, בעבודת יד ובאהבה — נוצרו ללוות אתכן ברגעים הקטנים והגדולים.",
11
+ "heroTitle": "פריטים שמספרים את הסיפור שלך",
12
+ "heroLead": "עיצובים עדינים, בעבודת יד ובאהבה — נוצרו ללוות אתכן ברגעים הקטנים והגדולים.",
13
13
  "heroCtaSecondary": "לצפייה בקטגוריות",
14
14
  "heroTrust": "לקוחות מרוצות ברחבי הארץ",
15
15
  "benefit1Title": "משלוח מהיר עד הבית",
@@ -17,37 +17,37 @@
17
17
  "benefit2Title": "תשלום מאובטח",
18
18
  "benefit2Desc": "סליקה מוצפנת בתקן המחמיר ביותר",
19
19
  "benefit3Title": "חומרים איכותיים",
20
- "benefit3Desc": "זהב, כסף 925 ואבני חן אמיתיות",
20
+ "benefit3Desc": "נבחרים בקפידה, עמידים לאורך זמן",
21
21
  "benefit4Title": "החזרה קלה",
22
22
  "benefit4Desc": "30 יום להחלפה או החזרה, בלי שאלות",
23
23
  "featuredEyebrow": "הנבחרים שלנו",
24
24
  "featuredSubtitle": "הפריטים שהלקוחות שלנו הכי אוהבות — נבחרו בקפידה מהקולקציה החדשה.",
25
25
  "categoriesEyebrow": "קטגוריות",
26
- "categoriesTitle": "מצאו את התכשיט המושלם",
27
- "categoriesSubtitle": "מטבעות עדינות ועד שרשראות בולטות — לכל אחת יש את השפה שלה.",
26
+ "categoriesTitle": "מצאו את הפריט המושלם",
27
+ "categoriesSubtitle": "מהפריטים העדינים ועד הבולטים — לכל אחת יש את השפה שלה.",
28
28
  "catRings": "טבעות",
29
29
  "catNecklaces": "שרשראות",
30
30
  "catEarrings": "עגילים",
31
31
  "catBracelets": "צמידים",
32
32
  "catCta": "לצפייה בקטגוריה",
33
33
  "storyEyebrow": "הסטודיו שלנו",
34
- "storyTitle": "נוצר ביד, נלבש בלב",
35
- "storyP1": "כל תכשיט אצלנו מתחיל בסקיצה קטנה על נייר — ונגמר בעבודת יד עדינה בסטודיו. אנחנו בוחרים כל אבן וכל חוליה בקפידה, כדי שהתכשיט שיגיע אליכן יהיה בדיוק כמו שדמיינו אותו.",
36
- "storyP2": "אנחנו מאמינים בתכשיטים שנשארים: חומרים אמיתיים, גימור מוקפד ואחריות מלאה על כל פריט. ככה נראית אהבה לפרטים הקטנים.",
34
+ "storyTitle": "נוצר ביד, נאהב בלב",
35
+ "storyP1": "כל פריט אצלנו מתחיל בסקיצה קטנה על נייר — ונגמר בעבודת יד עדינה בסטודיו. אנחנו בוחרים כל חומר וכל פרט בקפידה, כדי שהפריט שיגיע אליכן יהיה בדיוק כמו שדמיינו אותו.",
36
+ "storyP2": "אנחנו מאמינים בפריטים שנשארים: חומרים אמיתיים, גימור מוקפד ואחריות מלאה על כל פריט. ככה נראית אהבה לפרטים הקטנים.",
37
37
  "storyCta": "לגלות את הקולקציה",
38
38
  "storyStat1Value": "עבודת יד",
39
39
  "storyStat1Label": "כל פריט נוצר בסטודיו שלנו",
40
- "storyStat2Value": "כסף 925",
41
- "storyStat2Label": "חומרים אמיתיים בלבד",
40
+ "storyStat2Value": "גימור מוקפד",
41
+ "storyStat2Label": "כל פריט נבדק לפני המשלוח",
42
42
  "testimonialsEyebrow": "לקוחות מספרות",
43
43
  "testimonialsTitle": "הן כבר התאהבו",
44
- "testimonial1Quote": "השרשרת הגיעה באריזה מהממת ונראית אפילו יותר טוב מבתמונות. קיבלתי מחמאות כבר ביום הראשון.",
44
+ "testimonial1Quote": "הפריט הגיע באריזה מהממת ונראה אפילו יותר טוב מבתמונות. קיבלתי מחמאות כבר ביום הראשון.",
45
45
  "testimonial1Name": "נועה ל.",
46
46
  "testimonial1Meta": "תל אביב",
47
- "testimonial2Quote": "קניתי עגילים במתנה לאמא שלי והיא לא מורידה אותם מאז. איכות מדהימה ושירות סופר אישי.",
47
+ "testimonial2Quote": "קניתי מתנה לאמא שלי והיא לא מפסיקה להשתמש בו מאז. איכות מדהימה ושירות סופר אישי.",
48
48
  "testimonial2Name": "שירה ב.",
49
49
  "testimonial2Meta": "חיפה",
50
- "testimonial3Quote": "הטבעת בדיוק במידה, העבודה עדינה ומוקפדת. מרגישים שכל פרט נעשה באהבה. ממליצה בחום.",
50
+ "testimonial3Quote": "בדיוק כמו שתואר, העבודה עדינה ומוקפדת. מרגישים שכל פרט נעשה באהבה. ממליצה בחום.",
51
51
  "testimonial3Name": "דנה כ.",
52
52
  "testimonial3Meta": "ירושלים",
53
53
  "newsletterTitle": "הצטרפו למועדון שלנו",
@@ -68,7 +68,7 @@
68
68
  "productDetail": {
69
69
  "quantityLabel": "כמות",
70
70
  "shippingNote": "משלוח מהיר עד הבית · החזרה קלה עד 30 יום",
71
- "guaranteeNote": "אחריות מלאה על כל תכשיט",
71
+ "guaranteeNote": "אחריות מלאה על כל פריט",
72
72
  "pickOne": "בחרו אחד",
73
73
  "upTo": "עד {max}",
74
74
  "pickExactly": "בחרו בדיוק {min}",
@@ -88,7 +88,7 @@
88
88
  "shippingAtCheckout": "משלוח יחושב בקופה"
89
89
  },
90
90
  "footer": {
91
- "tagline": "תכשיטים בעבודת יד, מעוצבים באהבה בישראל.",
91
+ "tagline": "{{storeName}} עבודת יד, מעוצב באהבה בישראל.",
92
92
  "followUs": "עקבו אחרינו",
93
93
  "quickLinksTitle": "ניווט מהיר",
94
94
  "linkProducts": "כל המוצרים",
@@ -35,10 +35,10 @@ export function CategoryTiles({ products }: { products: Product[] }) {
35
35
  const tiles: Tile[] = [];
36
36
 
37
37
  // Prefer real category data when the catalog has it.
38
- const byCategory = new Map<string, { name: string; items: Product[] }>();
38
+ const byCategory = new Map<string, { name: string; slug: string | null; items: Product[] }>();
39
39
  for (const p of products) {
40
40
  for (const cat of p.categories ?? []) {
41
- const entry = byCategory.get(cat.id) ?? { name: cat.name, items: [] };
41
+ const entry = byCategory.get(cat.id) ?? { name: cat.name, slug: cat.slug ?? null, items: [] };
42
42
  entry.items.push(p);
43
43
  byCategory.set(cat.id, entry);
44
44
  }
@@ -50,15 +50,21 @@ export function CategoryTiles({ products }: { products: Product[] }) {
50
50
  [...items].reverse().find((p) => p.images?.[0]?.url)?.images?.[0];
51
51
 
52
52
  if (byCategory.size >= 2) {
53
- for (const [id, { name, items }] of Array.from(byCategory.entries()).slice(0, 4)) {
53
+ for (const [id, { name, slug, items }] of Array.from(byCategory.entries()).slice(0, 4)) {
54
54
  const img = pickImage(items);
55
55
  if (!img?.url) continue;
56
+ // Prefer the real category landing page (SEO-indexed, has its own
57
+ // written description) — this is the only place in the storefront that
58
+ // links to it, so without a real slug it'd be an orphaned page. Fall
59
+ // back to the filtered grid for categories with no slug yet.
56
60
  tiles.push({
57
61
  key: id,
58
62
  label: name,
59
63
  imageUrl: img.url,
60
64
  imageAlt: img.alt || name,
61
- href: `/products?category=${encodeURIComponent(id)}`,
65
+ href: slug
66
+ ? `/category/${encodeURIComponent(slug)}`
67
+ : `/products?category=${encodeURIComponent(id)}`,
62
68
  count: items.length,
63
69
  });
64
70
  }
@@ -90,7 +96,7 @@ export function CategoryTiles({ products }: { products: Product[] }) {
90
96
  <div className="mb-8 max-w-xl lg:mb-10">
91
97
  <span className="eyebrow">{t('categoriesEyebrow')}</span>
92
98
  <h2 className="text-4xl sm:text-5xl">{t('categoriesTitle')}</h2>
93
- <p className="mt-3 text-muted-foreground">{t('categoriesSubtitle')}</p>
99
+ <p className="text-muted-foreground mt-3">{t('categoriesSubtitle')}</p>
94
100
  </div>
95
101
 
96
102
  <ul
@@ -109,11 +115,8 @@ export function CategoryTiles({ products }: { products: Product[] }) {
109
115
  : undefined
110
116
  }
111
117
  >
112
- <Link
113
- href={tile.href}
114
- className="group card card-hover block overflow-hidden"
115
- >
116
- <span className="relative block aspect-square overflow-hidden bg-secondary">
118
+ <Link href={tile.href} className="card card-hover group block overflow-hidden">
119
+ <span className="bg-secondary relative block aspect-square overflow-hidden">
117
120
  <Image
118
121
  src={tile.imageUrl}
119
122
  alt={tile.imageAlt}
@@ -124,16 +127,16 @@ export function CategoryTiles({ products }: { products: Product[] }) {
124
127
  </span>
125
128
  <span className="flex items-center justify-between gap-2 px-4 py-3.5">
126
129
  <span>
127
- <span className="block text-[15px] font-semibold text-foreground">
130
+ <span className="text-foreground block text-[15px] font-semibold">
128
131
  {tile.label}
129
132
  </span>
130
- <span className="block text-xs text-muted-foreground">
133
+ <span className="text-muted-foreground block text-xs">
131
134
  {tile.count} {tile.count === 1 ? tc('product') : tc('products')}
132
135
  </span>
133
136
  </span>
134
137
  <span
135
138
  aria-hidden="true"
136
- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-secondary text-foreground transition-colors group-hover:bg-primary group-hover:text-primary-foreground"
139
+ className="bg-secondary text-foreground group-hover:bg-primary group-hover:text-primary-foreground flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors"
137
140
  >
138
141
  <IconArrowEnd size={16} className="rtl-flip" />
139
142
  </span>
@@ -9,7 +9,7 @@ import * as React from 'react';
9
9
  export type IconProps = {
10
10
  size?: 16 | 18 | 20 | 24 | 28 | 32 | 56;
11
11
  className?: string;
12
- /** stroke width — 1.75 default matches the light, jewelry-grade look */
12
+ /** stroke width — 1.75 default matches the light, boutique-grade look */
13
13
  strokeWidth?: number;
14
14
  };
15
15