create-brainerce-store 1.14.3 → 1.14.5

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.
@@ -141,16 +141,38 @@ export function ProductCard({ product, className }: ProductCardProps) {
141
141
  )}
142
142
  >
143
143
  {added ? (
144
- <svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2.5}>
144
+ <svg
145
+ className="h-4 w-4"
146
+ fill="none"
147
+ viewBox="0 0 24 24"
148
+ stroke="currentColor"
149
+ strokeWidth={2.5}
150
+ >
145
151
  <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />
146
152
  </svg>
147
153
  ) : isVariable ? (
148
- <svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
154
+ <svg
155
+ className="h-4 w-4"
156
+ fill="none"
157
+ viewBox="0 0 24 24"
158
+ stroke="currentColor"
159
+ strokeWidth={2}
160
+ >
149
161
  <path strokeLinecap="round" strokeLinejoin="round" d="M12 4v16m8-8H4" />
150
162
  </svg>
151
163
  ) : (
152
- <svg className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
153
- <path strokeLinecap="round" strokeLinejoin="round" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" />
164
+ <svg
165
+ className="h-4 w-4"
166
+ fill="none"
167
+ viewBox="0 0 24 24"
168
+ stroke="currentColor"
169
+ strokeWidth={2}
170
+ >
171
+ <path
172
+ strokeLinecap="round"
173
+ strokeLinejoin="round"
174
+ d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
175
+ />
154
176
  </svg>
155
177
  )}
156
178
  </button>
@@ -4,13 +4,15 @@ import { getProductPriceInfo } from 'brainerce';
4
4
  interface ProductJsonLdProps {
5
5
  product: Product;
6
6
  url: string;
7
+ currency?: string;
7
8
  }
8
9
 
9
- export function ProductJsonLd({ product, url }: ProductJsonLdProps) {
10
+ export function ProductJsonLd({ product, url, currency = 'USD' }: ProductJsonLdProps) {
10
11
  const priceInfo = getProductPriceInfo(product);
11
12
  const imageUrl = product.images?.[0]?.url;
13
+ const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
12
14
 
13
- const jsonLd = {
15
+ const productJsonLd = {
14
16
  '@context': 'https://schema.org',
15
17
  '@type': 'Product',
16
18
  name: product.name,
@@ -21,7 +23,7 @@ export function ProductJsonLd({ product, url }: ProductJsonLdProps) {
21
23
  offers: {
22
24
  '@type': 'Offer',
23
25
  price: priceInfo.price,
24
- priceCurrency: 'ILS',
26
+ priceCurrency: currency,
25
27
  availability:
26
28
  product.inventory?.canPurchase !== false
27
29
  ? 'https://schema.org/InStock'
@@ -30,10 +32,41 @@ export function ProductJsonLd({ product, url }: ProductJsonLdProps) {
30
32
  },
31
33
  };
32
34
 
35
+ const breadcrumbJsonLd = {
36
+ '@context': 'https://schema.org',
37
+ '@type': 'BreadcrumbList',
38
+ itemListElement: [
39
+ {
40
+ '@type': 'ListItem',
41
+ position: 1,
42
+ name: 'Home',
43
+ item: baseUrl || '/',
44
+ },
45
+ {
46
+ '@type': 'ListItem',
47
+ position: 2,
48
+ name: 'Products',
49
+ item: `${baseUrl}/products`,
50
+ },
51
+ {
52
+ '@type': 'ListItem',
53
+ position: 3,
54
+ name: product.name,
55
+ item: url,
56
+ },
57
+ ],
58
+ };
59
+
33
60
  return (
34
- <script
35
- type="application/ld+json"
36
- dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
37
- />
61
+ <>
62
+ <script
63
+ type="application/ld+json"
64
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(productJsonLd) }}
65
+ />
66
+ <script
67
+ type="application/ld+json"
68
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbJsonLd) }}
69
+ />
70
+ </>
38
71
  );
39
72
  }
@@ -81,6 +81,7 @@ export async function proxyRegister(data: {
81
81
  lastName: string;
82
82
  email: string;
83
83
  password: string;
84
+ acceptsMarketing?: boolean;
84
85
  }): Promise<RegisterResult> {
85
86
  const response = await fetch(`/api/store/api/vc/${CONNECTION_ID}/customers/register`, {
86
87
  method: 'POST',