create-brainerce-store 1.68.0 → 1.71.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.
Files changed (32) hide show
  1. package/dist/index.js +22 -2
  2. package/messages/en.json +52 -2
  3. package/messages/he.json +52 -2
  4. package/package.json +1 -1
  5. package/templates/nextjs/base/src/app/checkout/page.tsx +1018 -1017
  6. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +1 -1
  7. package/templates/nextjs/base/src/app/register/page.tsx +67 -64
  8. package/templates/nextjs/base/src/components/account/profile-section.tsx +303 -226
  9. package/templates/nextjs/base/src/components/auth/register-form.tsx +326 -245
  10. package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +306 -294
  11. package/templates/nextjs/base/src/components/checkout/date-picker.tsx +13 -1
  12. package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +61 -21
  13. package/templates/nextjs/base/src/components/shared/birthday-picker.tsx +258 -0
  14. package/templates/nextjs/base/src/core/lib/auth.ts +162 -154
  15. package/templates/nextjs/base/src/core/lib/birthday.ts +74 -0
  16. package/templates/nextjs/base/src/core/lib/store-info.ts +10 -0
  17. package/templates/nextjs/base/src/ui/layout/newsletter-signup.tsx +143 -0
  18. package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +18 -2
  19. package/templates/nextjs/base/src/ui/product/back-in-stock-form.tsx +173 -0
  20. package/templates/nextjs/base/src/ui/product/product-client-section.tsx +484 -455
  21. package/templates/nextjs/base/src/ui/product/review-form.tsx +136 -12
  22. package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +139 -108
  23. package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +155 -142
  24. package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +500 -477
  25. package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +135 -11
  26. package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +179 -148
  27. package/templates/nextjs/ui-canvas/layout/newsletter-signup.tsx +122 -0
  28. package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +87 -83
  29. package/templates/nextjs/ui-canvas/product/back-in-stock-form.tsx +151 -0
  30. package/templates/nextjs/ui-canvas/product/product-client-section.tsx +373 -352
  31. package/templates/nextjs/ui-canvas/product/review-form.tsx +129 -11
  32. package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +127 -96
@@ -192,7 +192,7 @@ export default async function ProductDetailPage({ params }: Props) {
192
192
  <div className="mx-auto max-w-7xl px-4 pt-6 sm:px-6 lg:px-8">
193
193
  <Breadcrumbs items={breadcrumbItems} />
194
194
  </div>
195
- <ProductClientSection product={product} />
195
+ <ProductClientSection product={product} stockAlertsEnabled={storeInfo?.stockAlertsEnabled} />
196
196
  {/* Visible Q&A + the FAQPage JSON-LD above read the same product.faq —
197
197
  the extractable format AI answer engines cite. */}
198
198
  <ProductFaqSection product={product} locale={locale} />
@@ -1,64 +1,67 @@
1
- 'use client';
2
-
3
- import { useState } from 'react';
4
- import { useRouter, Link } from '@/core/lib/navigation';
5
- import { useAuth } from '@/core/providers/store-provider';
6
- import { proxyRegister } from '@/core/lib/auth';
7
- import { RegisterForm } from '@/components/auth/register-form';
8
- import { OAuthButtons } from '@/components/auth/oauth-buttons';
9
- import { useTranslations } from '@/core/lib/translations';
10
-
11
- export default function RegisterPage() {
12
- const router = useRouter();
13
- const auth = useAuth();
14
- const t = useTranslations('auth');
15
- const [error, setError] = useState<string | null>(null);
16
-
17
- async function handleRegister(data: {
18
- firstName: string;
19
- lastName: string;
20
- email: string;
21
- password: string;
22
- acceptsMarketing: boolean;
23
- }) {
24
- try {
25
- setError(null);
26
- const result = await proxyRegister(data);
27
-
28
- if (result.requiresVerification) {
29
- // Cookie already set by proxy; verify-email uses it for auth
30
- router.push('/verify-email');
31
- return;
32
- }
33
-
34
- // Cookie was set by the proxy; refresh auth state
35
- await auth.login();
36
- router.push('/');
37
- } catch (err) {
38
- const message = err instanceof Error ? err.message : 'Registration failed. Please try again.';
39
- setError(message);
40
- }
41
- }
42
-
43
- return (
44
- <div className="flex min-h-[60vh] items-center justify-center px-4 py-12">
45
- <div className="w-full max-w-md space-y-6">
46
- <div className="text-center">
47
- <h1 className="text-foreground text-2xl font-bold">{t('createAccountTitle')}</h1>
48
- <p className="text-muted-foreground mt-1 text-sm">{t('joinSubtitle')}</p>
49
- </div>
50
-
51
- <RegisterForm onSubmit={handleRegister} error={error} />
52
-
53
- <OAuthButtons />
54
-
55
- <p className="text-muted-foreground text-center text-sm">
56
- {t('alreadyHaveAccount')}{' '}
57
- <Link href="/login" className="text-primary font-medium hover:underline">
58
- {t('signIn')}
59
- </Link>
60
- </p>
61
- </div>
62
- </div>
63
- );
64
- }
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { useRouter, Link } from '@/core/lib/navigation';
5
+ import { useAuth } from '@/core/providers/store-provider';
6
+ import { proxyRegister } from '@/core/lib/auth';
7
+ import { RegisterForm } from '@/components/auth/register-form';
8
+ import { OAuthButtons } from '@/components/auth/oauth-buttons';
9
+ import { useTranslations } from '@/core/lib/translations';
10
+
11
+ export default function RegisterPage() {
12
+ const router = useRouter();
13
+ const auth = useAuth();
14
+ const t = useTranslations('auth');
15
+ const [error, setError] = useState<string | null>(null);
16
+
17
+ async function handleRegister(data: {
18
+ firstName: string;
19
+ lastName: string;
20
+ email: string;
21
+ password: string;
22
+ acceptsMarketing: boolean;
23
+ /** Month and day only, never a year. Present together or not at all. */
24
+ birthMonth?: number;
25
+ birthDay?: number;
26
+ }) {
27
+ try {
28
+ setError(null);
29
+ const result = await proxyRegister(data);
30
+
31
+ if (result.requiresVerification) {
32
+ // Cookie already set by proxy; verify-email uses it for auth
33
+ router.push('/verify-email');
34
+ return;
35
+ }
36
+
37
+ // Cookie was set by the proxy; refresh auth state
38
+ await auth.login();
39
+ router.push('/');
40
+ } catch (err) {
41
+ const message = err instanceof Error ? err.message : 'Registration failed. Please try again.';
42
+ setError(message);
43
+ }
44
+ }
45
+
46
+ return (
47
+ <div className="flex min-h-[60vh] items-center justify-center px-4 py-12">
48
+ <div className="w-full max-w-md space-y-6">
49
+ <div className="text-center">
50
+ <h1 className="text-foreground text-2xl font-bold">{t('createAccountTitle')}</h1>
51
+ <p className="text-muted-foreground mt-1 text-sm">{t('joinSubtitle')}</p>
52
+ </div>
53
+
54
+ <RegisterForm onSubmit={handleRegister} error={error} />
55
+
56
+ <OAuthButtons />
57
+
58
+ <p className="text-muted-foreground text-center text-sm">
59
+ {t('alreadyHaveAccount')}{' '}
60
+ <Link href="/login" className="text-primary font-medium hover:underline">
61
+ {t('signIn')}
62
+ </Link>
63
+ </p>
64
+ </div>
65
+ </div>
66
+ );
67
+ }