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.
- package/dist/index.js +47 -4
- package/messages/en.json +37 -4
- package/messages/he.json +37 -4
- package/package.json +1 -1
- package/templates/nextjs/base/src/app/account/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/account/page.tsx +122 -112
- package/templates/nextjs/base/src/app/cart/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/checkout/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/checkout/page.tsx +101 -3
- package/templates/nextjs/base/src/app/layout.tsx.ejs +29 -1
- package/templates/nextjs/base/src/app/login/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/order-confirmation/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +5 -1
- package/templates/nextjs/base/src/app/products/layout.tsx +18 -0
- package/templates/nextjs/base/src/app/products/page.tsx +1 -0
- package/templates/nextjs/base/src/app/register/layout.tsx +9 -0
- package/templates/nextjs/base/src/app/register/page.tsx +1 -0
- package/templates/nextjs/base/src/app/verify-email/page.tsx +1 -1
- package/templates/nextjs/base/src/components/account/address-book.tsx +432 -0
- package/templates/nextjs/base/src/components/auth/register-form.tsx +232 -184
- package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +359 -305
- package/templates/nextjs/base/src/components/products/product-card.tsx +26 -4
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +40 -7
- package/templates/nextjs/base/src/lib/auth.ts +1 -0
|
@@ -141,16 +141,38 @@ export function ProductCard({ product, className }: ProductCardProps) {
|
|
|
141
141
|
)}
|
|
142
142
|
>
|
|
143
143
|
{added ? (
|
|
144
|
-
<svg
|
|
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
|
|
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
|
|
153
|
-
|
|
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
|
|
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:
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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',
|