create-brainerce-store 1.28.15 → 1.28.18

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.
Files changed (25) hide show
  1. package/dist/index.js +1 -1
  2. package/messages/en.json +390 -390
  3. package/messages/he.json +390 -390
  4. package/package.json +1 -1
  5. package/templates/nextjs/base/next.config.ts +47 -47
  6. package/templates/nextjs/base/src/app/api/auth/logout/route.ts +15 -15
  7. package/templates/nextjs/base/src/app/api/auth/oauth-callback/route.ts +66 -66
  8. package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +76 -76
  9. package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +6 -0
  10. package/templates/nextjs/base/src/app/checkout/page.tsx +975 -975
  11. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +7 -16
  12. package/templates/nextjs/base/src/app/products/[slug]/product-client-section.tsx +529 -529
  13. package/templates/nextjs/base/src/app/products/page.tsx +6 -13
  14. package/templates/nextjs/base/src/app/reset-password/page.tsx +138 -138
  15. package/templates/nextjs/base/src/components/auth/register-form.tsx +245 -245
  16. package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +416 -416
  17. package/templates/nextjs/base/src/components/checkout/payment-step.tsx +656 -656
  18. package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +88 -88
  19. package/templates/nextjs/base/src/lib/brainerce.ts.ejs +6 -2
  20. package/templates/nextjs/base/src/lib/csrf.ts +11 -11
  21. package/templates/nextjs/base/src/lib/navigation.tsx.ejs +17 -6
  22. package/templates/nextjs/base/src/lib/nonce.ts +10 -10
  23. package/templates/nextjs/base/src/lib/safe-redirect.ts +45 -45
  24. package/templates/nextjs/base/src/lib/sanitize-html.ts +93 -93
  25. package/templates/nextjs/base/src/lib/validation.ts +37 -37
@@ -1,27 +1,19 @@
1
1
  import type { Metadata } from 'next';
2
- import { headers } from 'next/headers';
3
2
  import { notFound } from 'next/navigation';
4
3
  import { getServerClient } from '@/lib/brainerce';
5
4
  import { ProductJsonLd } from '@/components/seo/product-json-ld';
6
5
  import { ProductClientSection } from './product-client-section';
7
6
 
8
7
  type Props = {
9
- params: Promise<{ slug: string }>;
8
+ params: Promise<{ slug: string; locale?: string }>;
10
9
  };
11
10
 
12
- // Read the locale the middleware set on this request so the SDK can resolve
13
- // translated slugs (translations[locale].slug) in addition to the base slug.
14
- async function getRequestLocale(): Promise<string | undefined> {
15
- return (await headers()).get('x-locale') ?? undefined;
16
- }
17
-
18
11
  export async function generateMetadata({ params }: Props): Promise<Metadata> {
19
- const { slug } = await params;
20
- const locale = await getRequestLocale();
12
+ const { slug, locale } = await params;
21
13
 
22
14
  try {
23
- const client = getServerClient();
24
- const product = await client.getProductBySlug(slug, { locale });
15
+ const client = getServerClient(locale);
16
+ const product = await client.getProductBySlug(slug);
25
17
  const imageUrl = product.images?.[0]?.url;
26
18
  // Prefer merchant-authored SEO copy; fall back to the visible name/description.
27
19
  // Both are served already locale-resolved by the backend.
@@ -58,13 +50,12 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
58
50
  }
59
51
 
60
52
  export default async function ProductDetailPage({ params }: Props) {
61
- const { slug } = await params;
62
- const locale = await getRequestLocale();
53
+ const { slug, locale } = await params;
63
54
 
64
55
  let product;
65
56
  try {
66
- const client = getServerClient();
67
- product = await client.getProductBySlug(slug, { locale });
57
+ const client = getServerClient(locale);
58
+ product = await client.getProductBySlug(slug);
68
59
  } catch {
69
60
  notFound();
70
61
  }