create-brainerce-store 1.67.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.
- package/dist/index.js +22 -2
- package/messages/en.json +52 -2
- package/messages/he.json +52 -2
- package/package.json +1 -1
- package/templates/nextjs/base/.env.local.ejs +7 -0
- package/templates/nextjs/base/AGENTS.md.ejs +7 -0
- package/templates/nextjs/base/CLAUDE.md.ejs +7 -0
- package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +8 -2
- package/templates/nextjs/base/src/app/category/[slug]/page.tsx +16 -7
- package/templates/nextjs/base/src/app/checkout/page.tsx +1018 -1017
- package/templates/nextjs/base/src/app/error.tsx.ejs +53 -0
- package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +8 -2
- package/templates/nextjs/base/src/app/products/[slug]/page.tsx +17 -7
- package/templates/nextjs/base/src/app/register/page.tsx +67 -64
- package/templates/nextjs/base/src/components/account/profile-section.tsx +303 -226
- package/templates/nextjs/base/src/components/auth/register-form.tsx +326 -245
- package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +306 -294
- package/templates/nextjs/base/src/components/checkout/date-picker.tsx +13 -1
- package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +61 -21
- package/templates/nextjs/base/src/components/shared/birthday-picker.tsx +258 -0
- package/templates/nextjs/base/src/core/lib/auth.ts +162 -154
- package/templates/nextjs/base/src/core/lib/birthday.ts +74 -0
- package/templates/nextjs/base/src/core/lib/site-url.ts +42 -9
- package/templates/nextjs/base/src/core/lib/store-info.ts +10 -0
- package/templates/nextjs/base/src/ui/layout/newsletter-signup.tsx +143 -0
- package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +18 -2
- package/templates/nextjs/base/src/ui/product/back-in-stock-form.tsx +173 -0
- package/templates/nextjs/base/src/ui/product/product-client-section.tsx +484 -455
- package/templates/nextjs/base/src/ui/product/review-form.tsx +136 -12
- package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +139 -108
- package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +155 -142
- package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +500 -477
- package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +135 -11
- package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +179 -148
- package/templates/nextjs/ui-canvas/layout/newsletter-signup.tsx +122 -0
- package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +87 -83
- package/templates/nextjs/ui-canvas/product/back-in-stock-form.tsx +151 -0
- package/templates/nextjs/ui-canvas/product/product-client-section.tsx +373 -352
- package/templates/nextjs/ui-canvas/product/review-form.tsx +129 -11
- package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +127 -96
|
@@ -1,142 +1,155 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Storefront footer — driven by the merchant's dashboard configuration
|
|
3
|
-
* (Sell → Content → Footer), rendered as a deep-forest "signature" band:
|
|
4
|
-
* brand block + tagline + social, merchant link columns, copyright bar.
|
|
5
|
-
*
|
|
6
|
-
* API contract:
|
|
7
|
-
* GET → client.content.footer.get('main', locale) → Content<'FOOTER'> | null
|
|
8
|
-
* Returns null on 404 — the fallback branch renders the same designed
|
|
9
|
-
* chrome with essential storefront links so the page never looks broken.
|
|
10
|
-
*/
|
|
11
|
-
import * as React from 'react';
|
|
12
|
-
import { Link } from '@/core/lib/navigation';
|
|
13
|
-
import type { Content } from 'brainerce';
|
|
14
|
-
<% if (i18nEnabled) { %>
|
|
15
|
-
import { getMessages, defaultLocale } from '@/i18n';
|
|
16
|
-
<% } else { %>
|
|
17
|
-
import { messages as staticMessages, defaultLocale } from '@/i18n';
|
|
18
|
-
<% } %>
|
|
19
|
-
import { IconSocial, IconShield } from '@/ui/shared/icons';
|
|
20
|
-
import { resolveNavUrl } from '@/ui/layout/nav-url';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{ url: '/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
{
|
|
62
|
-
</
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Storefront footer — driven by the merchant's dashboard configuration
|
|
3
|
+
* (Sell → Content → Footer), rendered as a deep-forest "signature" band:
|
|
4
|
+
* brand block + tagline + social, merchant link columns, copyright bar.
|
|
5
|
+
*
|
|
6
|
+
* API contract:
|
|
7
|
+
* GET → client.content.footer.get('main', locale) → Content<'FOOTER'> | null
|
|
8
|
+
* Returns null on 404 — the fallback branch renders the same designed
|
|
9
|
+
* chrome with essential storefront links so the page never looks broken.
|
|
10
|
+
*/
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { Link } from '@/core/lib/navigation';
|
|
13
|
+
import type { Content } from 'brainerce';
|
|
14
|
+
<% if (i18nEnabled) { %>
|
|
15
|
+
import { getMessages, defaultLocale } from '@/i18n';
|
|
16
|
+
<% } else { %>
|
|
17
|
+
import { messages as staticMessages, defaultLocale } from '@/i18n';
|
|
18
|
+
<% } %>
|
|
19
|
+
import { IconSocial, IconShield } from '@/ui/shared/icons';
|
|
20
|
+
import { resolveNavUrl } from '@/ui/layout/nav-url';
|
|
21
|
+
// Base-template component — design packs overlay, so files the pack does not
|
|
22
|
+
// ship stay as base. Wired here because this pack DOES ship its own footer.
|
|
23
|
+
import { NewsletterSignup } from '@/ui/layout/newsletter-signup';
|
|
24
|
+
|
|
25
|
+
interface SiteFooterProps {
|
|
26
|
+
/** Pre-fetched footer payload (server-side). `null` triggers fallback rendering. */
|
|
27
|
+
footer: Content<'FOOTER'> | null;
|
|
28
|
+
/** Store name shown in the brand block + fallback copyright. */
|
|
29
|
+
storeName?: string;
|
|
30
|
+
/** Store locale for the translation-key copy (server component). */
|
|
31
|
+
locale?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function SiteFooter({ footer, storeName, locale = defaultLocale }: SiteFooterProps) {
|
|
35
|
+
<% if (i18nEnabled) { %>
|
|
36
|
+
const messages = await getMessages(locale);
|
|
37
|
+
<% } else { %>
|
|
38
|
+
const messages = staticMessages;
|
|
39
|
+
<% } %>
|
|
40
|
+
const t = (messages.footer ?? {}) as Record<string, string>;
|
|
41
|
+
|
|
42
|
+
const data = footer?.data;
|
|
43
|
+
const columns = data?.columns ?? [];
|
|
44
|
+
const social = data?.social ?? [];
|
|
45
|
+
const year = new Date().getFullYear();
|
|
46
|
+
const brandLabel = storeName ?? 'Store';
|
|
47
|
+
|
|
48
|
+
const fallbackLinks = [
|
|
49
|
+
{ url: '/products', label: t.linkProducts },
|
|
50
|
+
{ url: '/faq', label: t.linkFaq },
|
|
51
|
+
{ url: '/contact', label: t.linkContact },
|
|
52
|
+
{ url: '/cart', label: t.linkCart },
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<footer className="mt-auto bg-primary text-primary-foreground">
|
|
57
|
+
<div className="container-page grid gap-10 py-14 sm:grid-cols-2 lg:grid-cols-4 lg:py-16">
|
|
58
|
+
{/* Brand block */}
|
|
59
|
+
<div className="sm:col-span-2 lg:col-span-2 lg:pe-16">
|
|
60
|
+
<Link href="/" className="font-display text-2xl font-semibold">
|
|
61
|
+
{brandLabel}
|
|
62
|
+
</Link>
|
|
63
|
+
<p className="mt-3 max-w-sm text-sm leading-6 text-primary-foreground/70">
|
|
64
|
+
{t.tagline}
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
{/*
|
|
68
|
+
Newsletter signup. Remove this block if the merchant does not want a
|
|
69
|
+
mailing list — nothing else depends on it. Confirmed opt-in: the
|
|
70
|
+
address is not subscribed until the recipient clicks the emailed
|
|
71
|
+
link, which is why the success copy says "check your email".
|
|
72
|
+
*/}
|
|
73
|
+
<div className="mt-8 max-w-sm">
|
|
74
|
+
<NewsletterSignup />
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{social.length > 0 && (
|
|
78
|
+
<div className="mt-6">
|
|
79
|
+
<p className="mb-3 text-xs font-semibold uppercase tracking-widest text-primary-foreground/60">
|
|
80
|
+
{t.followUs}
|
|
81
|
+
</p>
|
|
82
|
+
<ul className="flex flex-wrap items-center gap-2">
|
|
83
|
+
{social.map((entry, idx) => (
|
|
84
|
+
<li key={`${entry.platform}-${idx}`}>
|
|
85
|
+
<a
|
|
86
|
+
href={entry.url}
|
|
87
|
+
target="_blank"
|
|
88
|
+
rel="noopener noreferrer"
|
|
89
|
+
aria-label={entry.platform}
|
|
90
|
+
className="inline-flex h-10 w-10 items-center justify-center rounded-full border border-primary-foreground/25 text-primary-foreground/85 transition-colors hover:bg-primary-foreground hover:text-primary"
|
|
91
|
+
>
|
|
92
|
+
<IconSocial platform={entry.platform} size={20} />
|
|
93
|
+
</a>
|
|
94
|
+
</li>
|
|
95
|
+
))}
|
|
96
|
+
</ul>
|
|
97
|
+
</div>
|
|
98
|
+
)}
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{/* Merchant link columns (or essential fallback links) */}
|
|
102
|
+
{columns.length > 0 ? (
|
|
103
|
+
columns.map((col, idx) => (
|
|
104
|
+
<nav key={`${col.title}-${idx}`} aria-label={col.title}>
|
|
105
|
+
<h3 className="mb-4 font-sans text-sm font-semibold text-primary-foreground">
|
|
106
|
+
{col.title}
|
|
107
|
+
</h3>
|
|
108
|
+
<ul className="space-y-2.5">
|
|
109
|
+
{col.links.map((link, linkIdx) => (
|
|
110
|
+
<li key={`${link.url}-${linkIdx}`}>
|
|
111
|
+
<a
|
|
112
|
+
href={resolveNavUrl(link.url)}
|
|
113
|
+
className="text-sm text-primary-foreground/70 transition-colors hover:text-primary-foreground"
|
|
114
|
+
>
|
|
115
|
+
{link.label}
|
|
116
|
+
</a>
|
|
117
|
+
</li>
|
|
118
|
+
))}
|
|
119
|
+
</ul>
|
|
120
|
+
</nav>
|
|
121
|
+
))
|
|
122
|
+
) : (
|
|
123
|
+
<nav aria-label={t.quickLinksTitle}>
|
|
124
|
+
<h3 className="mb-4 font-sans text-sm font-semibold text-primary-foreground">
|
|
125
|
+
{t.quickLinksTitle}
|
|
126
|
+
</h3>
|
|
127
|
+
<ul className="space-y-2.5">
|
|
128
|
+
{fallbackLinks.map((link) => (
|
|
129
|
+
<li key={link.url}>
|
|
130
|
+
<a
|
|
131
|
+
href={link.url}
|
|
132
|
+
className="text-sm text-primary-foreground/70 transition-colors hover:text-primary-foreground"
|
|
133
|
+
>
|
|
134
|
+
{link.label}
|
|
135
|
+
</a>
|
|
136
|
+
</li>
|
|
137
|
+
))}
|
|
138
|
+
</ul>
|
|
139
|
+
</nav>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
{/* Bottom bar */}
|
|
144
|
+
<div className="border-t border-primary-foreground/15">
|
|
145
|
+
<div className="container-page flex flex-col items-center justify-between gap-3 py-5 text-xs text-primary-foreground/60 sm:flex-row">
|
|
146
|
+
<p>{data?.copyright ?? `© ${year} ${brandLabel}. ${messages.common?.allRightsReserved ?? ''}`}</p>
|
|
147
|
+
<p className="inline-flex items-center gap-1.5">
|
|
148
|
+
<IconShield size={16} />
|
|
149
|
+
{t.securePayments}
|
|
150
|
+
</p>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</footer>
|
|
154
|
+
);
|
|
155
|
+
}
|