create-brainerce-store 1.18.0 → 1.20.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/LICENSE +0 -0
- package/dist/index.js +31 -9
- package/messages/en.json +366 -362
- package/messages/he.json +366 -362
- package/package.json +8 -8
- package/templates/nextjs/base/next.config.ts +31 -31
- package/templates/nextjs/base/scripts/fetch-store-info.mjs +81 -81
- package/templates/nextjs/base/src/app/.well-known/apple-developer-merchantid-domain-association/route.ts +26 -26
- package/templates/nextjs/base/src/app/account/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/account/page.tsx +122 -122
- package/templates/nextjs/base/src/app/api/auth/logout/route.ts +14 -14
- package/templates/nextjs/base/src/app/api/auth/me/route.ts +56 -56
- package/templates/nextjs/base/src/app/api/auth/oauth-callback/route.ts +59 -59
- package/templates/nextjs/base/src/app/api/auth/reset-callback/route.ts +41 -41
- package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +77 -77
- package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +198 -198
- package/templates/nextjs/base/src/app/auth/callback/page.tsx +92 -92
- package/templates/nextjs/base/src/app/cart/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/cart/page.tsx +204 -204
- package/templates/nextjs/base/src/app/checkout/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/checkout/page.tsx +860 -860
- package/templates/nextjs/base/src/app/forgot-password/page.tsx +112 -112
- package/templates/nextjs/base/src/app/layout.tsx.ejs +75 -0
- package/templates/nextjs/base/src/app/login/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/login/page.tsx +59 -59
- package/templates/nextjs/base/src/app/order-confirmation/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/order-confirmation/page.tsx +17 -0
- package/templates/nextjs/base/src/app/payment-complete/page.tsx +59 -0
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +67 -67
- package/templates/nextjs/base/src/app/products/[slug]/product-client-section.tsx +486 -486
- package/templates/nextjs/base/src/app/products/layout.tsx +18 -18
- package/templates/nextjs/base/src/app/products/page.tsx +431 -431
- package/templates/nextjs/base/src/app/register/layout.tsx +9 -9
- package/templates/nextjs/base/src/app/register/page.tsx +65 -65
- package/templates/nextjs/base/src/app/reset-password/page.tsx +132 -132
- package/templates/nextjs/base/src/app/robots.ts +14 -14
- package/templates/nextjs/base/src/app/sitemap.ts +25 -25
- package/templates/nextjs/base/src/app/verify-email/page.tsx +258 -258
- package/templates/nextjs/base/src/components/account/address-book.tsx +432 -432
- package/templates/nextjs/base/src/components/account/order-history.tsx +350 -350
- package/templates/nextjs/base/src/components/auth/oauth-buttons.tsx +137 -137
- package/templates/nextjs/base/src/components/auth/register-form.tsx +232 -232
- package/templates/nextjs/base/src/components/cart/cart-bundle-offer.tsx +247 -111
- package/templates/nextjs/base/src/components/cart/cart-item.tsx +153 -153
- package/templates/nextjs/base/src/components/cart/cart-upgrade-banner.tsx +142 -142
- package/templates/nextjs/base/src/components/cart/free-shipping-bar.tsx +59 -59
- package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +415 -415
- package/templates/nextjs/base/src/components/checkout/order-bump-card.tsx +243 -83
- package/templates/nextjs/base/src/components/checkout/payment-step.tsx +49 -3
- package/templates/nextjs/base/src/components/layout/footer.tsx +41 -41
- package/templates/nextjs/base/src/components/layout/header.tsx +336 -336
- package/templates/nextjs/base/src/components/layout/language-switcher.tsx.ejs +63 -0
- package/templates/nextjs/base/src/components/products/discount-badge.tsx +22 -22
- package/templates/nextjs/base/src/components/products/frequently-bought-together.tsx +202 -202
- package/templates/nextjs/base/src/components/products/product-card.tsx +218 -218
- package/templates/nextjs/base/src/components/products/recommendation-section.tsx +107 -107
- package/templates/nextjs/base/src/components/products/stock-badge.tsx +63 -63
- package/templates/nextjs/base/src/components/products/variant-selector.tsx +292 -292
- package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +72 -72
- package/templates/nextjs/base/src/i18n.ts.ejs +21 -0
- package/templates/nextjs/base/src/lib/auth.ts +149 -149
- package/templates/nextjs/base/src/lib/brainerce.ts.ejs +9 -0
- package/templates/nextjs/base/src/lib/translations.ts.ejs +31 -0
- package/templates/nextjs/base/src/middleware.ts.ejs +81 -0
- package/templates/nextjs/base/src/providers/store-provider.tsx.ejs +41 -0
- package/templates/nextjs/base/src/lib/translations.ts +0 -11
- package/templates/nextjs/base/src/middleware.ts +0 -25
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import type { Metadata } from 'next';
|
|
2
|
-
import { notFound } from 'next/navigation';
|
|
3
|
-
import { getServerClient } from '@/lib/brainerce';
|
|
4
|
-
import { ProductJsonLd } from '@/components/seo/product-json-ld';
|
|
5
|
-
import { ProductClientSection } from './product-client-section';
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
params: Promise<{ slug: string }>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
12
|
-
const { slug } = await params;
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const client = getServerClient();
|
|
16
|
-
const product = await client.getProductBySlug(slug);
|
|
17
|
-
const imageUrl = product.images?.[0]?.url;
|
|
18
|
-
const description = product.description?.substring(0, 160) || product.name;
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
title: product.name,
|
|
22
|
-
description,
|
|
23
|
-
alternates: {
|
|
24
|
-
canonical: `/products/${slug}`,
|
|
25
|
-
},
|
|
26
|
-
openGraph: {
|
|
27
|
-
title: product.name,
|
|
28
|
-
description,
|
|
29
|
-
images: imageUrl ? [{ url: imageUrl, alt: product.name }] : [],
|
|
30
|
-
type: 'website',
|
|
31
|
-
},
|
|
32
|
-
twitter: {
|
|
33
|
-
card: 'summary_large_image',
|
|
34
|
-
title: product.name,
|
|
35
|
-
description,
|
|
36
|
-
images: imageUrl ? [imageUrl] : [],
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
} catch {
|
|
40
|
-
return {
|
|
41
|
-
title: 'Product not found',
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default async function ProductDetailPage({ params }: Props) {
|
|
47
|
-
const { slug } = await params;
|
|
48
|
-
|
|
49
|
-
let product;
|
|
50
|
-
try {
|
|
51
|
-
const client = getServerClient();
|
|
52
|
-
product = await client.getProductBySlug(slug);
|
|
53
|
-
} catch {
|
|
54
|
-
notFound();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
|
|
58
|
-
const productUrl = `${baseUrl}/products/${slug}`;
|
|
59
|
-
const currency = process.env.NEXT_PUBLIC_STORE_CURRENCY || 'USD';
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<>
|
|
63
|
-
<ProductJsonLd product={product} url={productUrl} currency={currency} />
|
|
64
|
-
<ProductClientSection product={product} />
|
|
65
|
-
</>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import { notFound } from 'next/navigation';
|
|
3
|
+
import { getServerClient } from '@/lib/brainerce';
|
|
4
|
+
import { ProductJsonLd } from '@/components/seo/product-json-ld';
|
|
5
|
+
import { ProductClientSection } from './product-client-section';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
params: Promise<{ slug: string }>;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
12
|
+
const { slug } = await params;
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
const client = getServerClient();
|
|
16
|
+
const product = await client.getProductBySlug(slug);
|
|
17
|
+
const imageUrl = product.images?.[0]?.url;
|
|
18
|
+
const description = product.description?.substring(0, 160) || product.name;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
title: product.name,
|
|
22
|
+
description,
|
|
23
|
+
alternates: {
|
|
24
|
+
canonical: `/products/${slug}`,
|
|
25
|
+
},
|
|
26
|
+
openGraph: {
|
|
27
|
+
title: product.name,
|
|
28
|
+
description,
|
|
29
|
+
images: imageUrl ? [{ url: imageUrl, alt: product.name }] : [],
|
|
30
|
+
type: 'website',
|
|
31
|
+
},
|
|
32
|
+
twitter: {
|
|
33
|
+
card: 'summary_large_image',
|
|
34
|
+
title: product.name,
|
|
35
|
+
description,
|
|
36
|
+
images: imageUrl ? [imageUrl] : [],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
} catch {
|
|
40
|
+
return {
|
|
41
|
+
title: 'Product not found',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default async function ProductDetailPage({ params }: Props) {
|
|
47
|
+
const { slug } = await params;
|
|
48
|
+
|
|
49
|
+
let product;
|
|
50
|
+
try {
|
|
51
|
+
const client = getServerClient();
|
|
52
|
+
product = await client.getProductBySlug(slug);
|
|
53
|
+
} catch {
|
|
54
|
+
notFound();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || '';
|
|
58
|
+
const productUrl = `${baseUrl}/products/${slug}`;
|
|
59
|
+
const currency = process.env.NEXT_PUBLIC_STORE_CURRENCY || 'USD';
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<ProductJsonLd product={product} url={productUrl} currency={currency} />
|
|
64
|
+
<ProductClientSection product={product} />
|
|
65
|
+
</>
|
|
66
|
+
);
|
|
67
|
+
}
|