@hszrdm/create-commerce 1.2.0 → 1.3.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/package.json +2 -2
- package/templates/backend/.env.example +45 -0
- package/templates/backend/package.json +1 -1
- package/templates/storefront/README.md +14 -1
- package/templates/storefront/src/app/[countryCode]/products/[handle]/page.tsx +2 -0
- package/templates/storefront/src/app/blog/[slug]/page.tsx +36 -0
- package/templates/storefront/src/app/blog/page.tsx +25 -0
- package/templates/storefront/src/app/contact/page.tsx +25 -0
- package/templates/storefront/src/app/customer-capabilities.css +60 -0
- package/templates/storefront/src/app/knowledge-base/[slug]/page.tsx +35 -0
- package/templates/storefront/src/app/knowledge-base/page.tsx +25 -0
- package/templates/storefront/src/app/layout.tsx +11 -2
- package/templates/storefront/src/app/pages/[slug]/page.tsx +35 -0
- package/templates/storefront/src/app/quote-request/page.tsx +20 -0
- package/templates/storefront/src/components/cms-content.tsx +75 -0
- package/templates/storefront/src/components/lead-form.tsx +203 -0
- package/templates/storefront/src/components/newsletter-signup.tsx +107 -0
- package/templates/storefront/src/components/product-reviews.tsx +150 -0
- package/templates/storefront/src/components/quote-request-form.tsx +212 -0
- package/templates/storefront/src/lib/core/cms.ts +5 -4
- package/templates/storefront/src/lib/storefront-routes.ts +30 -0
- package/templates/storefront/src/proxy.ts +22 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hszrdm/create-commerce",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Create a complete HSZRDM Commerce webshop project.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"prepare:templates": "node ./scripts/prepare-templates.mjs",
|
|
18
18
|
"prepack": "npm run prepare:templates",
|
|
19
|
-
"test": "node --test"
|
|
19
|
+
"test": "npm run prepare:templates && node --test"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=22"
|
|
@@ -67,6 +67,51 @@ SUPPORT_EMAIL=support@example.com
|
|
|
67
67
|
BILLING_EMAIL=billing@example.com
|
|
68
68
|
SYSTEM_EMAIL=system@example.com
|
|
69
69
|
|
|
70
|
+
# -----------------------------------------------------------------------------
|
|
71
|
+
# Email Center / transactional email / newsletter campaigns
|
|
72
|
+
# -----------------------------------------------------------------------------
|
|
73
|
+
# Shared template, campaign and delivery layer on top of Medusa Notification.
|
|
74
|
+
EMAIL_CENTER_ENABLED=true
|
|
75
|
+
|
|
76
|
+
# Raw e-mail delivery provider. Supported: sendgrid, resend. Leave blank during
|
|
77
|
+
# local development to keep Medusa's local notification provider on e-mail.
|
|
78
|
+
# Generic credentials override provider-specific legacy variables.
|
|
79
|
+
EMAIL_PROVIDER=
|
|
80
|
+
EMAIL_API_KEY=
|
|
81
|
+
EMAIL_FROM=
|
|
82
|
+
EMAIL_REPLY_TO=
|
|
83
|
+
# Provider-specific fallbacks if EMAIL_API_KEY / EMAIL_FROM are left empty.
|
|
84
|
+
RESEND_API_KEY=
|
|
85
|
+
RESEND_FROM_EMAIL=
|
|
86
|
+
|
|
87
|
+
# Optional per-event overrides. Empty means Email Center defaults apply; with
|
|
88
|
+
# EMAIL_CENTER_ENABLED=true the customer/order transactional contracts are on.
|
|
89
|
+
# Set a specific switch to false to disable only that event.
|
|
90
|
+
EMAIL_CUSTOMER_WELCOME_ENABLED=
|
|
91
|
+
EMAIL_REGISTRATION_VERIFICATION_ENABLED=
|
|
92
|
+
EMAIL_PASSWORD_RESET_ENABLED=
|
|
93
|
+
EMAIL_CHANGE_VERIFICATION_ENABLED=
|
|
94
|
+
EMAIL_PASSWORD_CHANGED_ENABLED=
|
|
95
|
+
EMAIL_CHANGED_ENABLED=
|
|
96
|
+
EMAIL_ACCOUNT_DELETED_ENABLED=
|
|
97
|
+
EMAIL_ORDER_PLACED_ENABLED=
|
|
98
|
+
EMAIL_PAYMENT_CAPTURED_ENABLED=
|
|
99
|
+
EMAIL_FULFILLMENT_CREATED_ENABLED=
|
|
100
|
+
EMAIL_SHIPMENT_CREATED_ENABLED=
|
|
101
|
+
EMAIL_ORDER_CANCELED_ENABLED=
|
|
102
|
+
EMAIL_PAYMENT_REFUNDED_ENABLED=
|
|
103
|
+
|
|
104
|
+
# Optional public logo URL shown in the shared email layout.
|
|
105
|
+
EMAIL_LOGO_URL=
|
|
106
|
+
# Open/click tracking is signed. Empty EMAIL_TRACKING_SECRET falls back to the
|
|
107
|
+
# generated COOKIE_SECRET, then JWT_SECRET. Production has no weak built-in key.
|
|
108
|
+
EMAIL_TRACKING_ENABLED=true
|
|
109
|
+
EMAIL_TRACKING_BASE_URL=
|
|
110
|
+
EMAIL_TRACKING_SECRET=
|
|
111
|
+
# Optional secret for POST /hooks/email/status. A provider-specific adapter can
|
|
112
|
+
# normalize delivered/bounced/failed callbacks to this internal endpoint.
|
|
113
|
+
EMAIL_WEBHOOK_SECRET=
|
|
114
|
+
|
|
70
115
|
# -----------------------------------------------------------------------------
|
|
71
116
|
# Customer after-sales self-service
|
|
72
117
|
# -----------------------------------------------------------------------------
|
|
@@ -28,6 +28,8 @@ szükséges. A payment/shipping/legal/SEO/analytics capability-k a `GET /store/c
|
|
|
28
28
|
- teljes terméklista: keresés, kategóriaszűrés, rendezés, lapozás;
|
|
29
29
|
- kategória- és termékoldal Core SEO/JSON-LD contracttal;
|
|
30
30
|
- variáns- és mennyiségválasztás, Add to Cart;
|
|
31
|
+
- wishlist guest móddal, account merge-dzsel és saját wishlist oldallal;
|
|
32
|
+
- termékértékelések approved listával, aggregált értékeléssel és bejelentkezett ügyfél review beküldéssel;
|
|
31
33
|
- közös cart state, cart drawer és teljes kosároldal;
|
|
32
34
|
- kupon hozzáadás/eltávolítás;
|
|
33
35
|
- region automatikus feloldása a Core alapértelmezett országa alapján;
|
|
@@ -46,10 +48,21 @@ szükséges. A payment/shipping/legal/SEO/analytics capability-k a `GET /store/c
|
|
|
46
48
|
- címjegyzék CRUD;
|
|
47
49
|
- rendelési előzmények és rendelésrészlet;
|
|
48
50
|
- return / exchange / claim self-service;
|
|
51
|
+
- CMS referencia UI: blog lista/detail, generic page detail és tudástár lista/detail;
|
|
52
|
+
- newsletter signup a footerben, double-opt-in confirm és leiratkozó oldalakkal;
|
|
53
|
+
- általános ajánlatkérő oldal a Core extra meződefinícióival;
|
|
54
|
+
- dinamikus lead/contact form privacy consenttel, honeypottal és opcionális Cloudflare Turnstile támogatással;
|
|
49
55
|
- globális loading/error/404/empty state-ek;
|
|
56
|
+
- toast, share, accessibility preferences, keyboard/focus UX és reduced-motion támogatás;
|
|
50
57
|
- Consent Mode v2, GA4/GTM és e-commerce tracking;
|
|
51
58
|
- robots.txt / sitemap.xml proxy és Search Console verification.
|
|
52
59
|
|
|
60
|
+
## Customer-facing Core capability elv
|
|
61
|
+
|
|
62
|
+
A starter célja, hogy minden általános, customer-facing Core képességhez legyen design-semleges referencia UI vagy route. Az ügyfélprojektekben a vizuális réteg szabadon cserélhető, de a `src/lib/core` contractok és a referencia flow-k mutatják a támogatott integrációt.
|
|
63
|
+
|
|
64
|
+
Admin-, számlázási-, fulfillment-, audit-, integration-settings- és más háttérképességekhez nem tartozik storefront UI, mert azok nem customer-facing funkciók.
|
|
65
|
+
|
|
53
66
|
## Authority boundary
|
|
54
67
|
|
|
55
68
|
A starter **nem** számol újra:
|
|
@@ -105,4 +118,4 @@ npm run typecheck
|
|
|
105
118
|
npm run build
|
|
106
119
|
```
|
|
107
120
|
|
|
108
|
-
A backend unit suite statikus regressziós tesztje azt is ellenőrzi, hogy a kötelező starter route-ok és Core contractok megmaradjanak.
|
|
121
|
+
A backend unit suite statikus regressziós tesztje azt is ellenőrzi, hogy a kötelező starter route-ok, customer-facing Core capability-k és Core contractok megmaradjanak.
|
|
@@ -2,6 +2,7 @@ import { notFound } from "next/navigation"
|
|
|
2
2
|
import { AddToCart } from "@/components/add-to-cart"
|
|
3
3
|
import { Breadcrumbs } from "@/components/breadcrumbs"
|
|
4
4
|
import { ProductGallery } from "@/components/product-gallery"
|
|
5
|
+
import { ProductReviews } from "@/components/product-reviews"
|
|
5
6
|
import { ProductViewTracker } from "@/components/product-view-tracker"
|
|
6
7
|
import { ShareButton } from "@/components/share-button"
|
|
7
8
|
import { VariantPriceDisplay } from "@/components/variant-price-display"
|
|
@@ -82,6 +83,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
|
|
|
82
83
|
<div className="product-meta">{product.subtitle ? <span>{stringValue(product.subtitle)}</span> : null}{product.material ? <span>{copy.material}: {stringValue(product.material)}</span> : null}{product.origin_country ? <span>{copy.origin}: {stringValue(product.origin_country)}</span> : null}</div>
|
|
83
84
|
</section>
|
|
84
85
|
</div>
|
|
86
|
+
{productId ? <ProductReviews productId={productId} locale={locale} /> : null}
|
|
85
87
|
</div>
|
|
86
88
|
)
|
|
87
89
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { notFound } from "next/navigation"
|
|
3
|
+
import { Breadcrumbs } from "@/components/breadcrumbs"
|
|
4
|
+
import { CmsEntryBody, CmsEntryMeta } from "@/components/cms-content"
|
|
5
|
+
import { cmsEntrySeo, getBlogPost } from "@/lib/core/cms"
|
|
6
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
7
|
+
import { STOREFRONT_ROUTES, medusaLocale } from "@/lib/storefront-routes"
|
|
8
|
+
|
|
9
|
+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
|
10
|
+
const { slug } = await params
|
|
11
|
+
const locale = await requestStorefrontLocale()
|
|
12
|
+
const result = await getBlogPost(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
13
|
+
return result ? cmsEntrySeo(result.entry) : {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function BlogPostPage({ params }: { params: Promise<{ slug: string }> }) {
|
|
17
|
+
const { slug } = await params
|
|
18
|
+
const locale = await requestStorefrontLocale()
|
|
19
|
+
const english = locale === "en"
|
|
20
|
+
const result = await getBlogPost(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
21
|
+
if (!result) notFound()
|
|
22
|
+
const entry = result.entry
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<article className="stack page-section cms-detail">
|
|
26
|
+
<Breadcrumbs items={[{ label: english ? "Blog" : "Blog", href: STOREFRONT_ROUTES[locale].blog }, { label: entry.title }]} label={english ? "Breadcrumb" : "Morzsanavigáció"} />
|
|
27
|
+
<header className="stack-sm">
|
|
28
|
+
<CmsEntryMeta entry={entry} locale={locale} />
|
|
29
|
+
<h1>{entry.title}</h1>
|
|
30
|
+
{entry.excerpt ? <p className="lead">{entry.excerpt}</p> : null}
|
|
31
|
+
{entry.featured_image_url ? <img className="cms-hero-image" src={entry.featured_image_url} alt={entry.featured_image_alt || entry.title} /> : null}
|
|
32
|
+
</header>
|
|
33
|
+
<CmsEntryBody entry={entry} />
|
|
34
|
+
</article>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CmsEntryCard } from "@/components/cms-content"
|
|
2
|
+
import { listBlogPosts } from "@/lib/core/cms"
|
|
3
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
4
|
+
import { blogPostPath, medusaLocale } from "@/lib/storefront-routes"
|
|
5
|
+
|
|
6
|
+
export default async function BlogPage() {
|
|
7
|
+
const locale = await requestStorefrontLocale()
|
|
8
|
+
const english = locale === "en"
|
|
9
|
+
const { entries } = await listBlogPosts({ locale: medusaLocale(locale), limit: 50 }).catch(() => ({ entries: [] }))
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="stack page-section">
|
|
13
|
+
<header className="stack-sm">
|
|
14
|
+
<p className="eyebrow">{english ? "Articles" : "Cikkek"}</p>
|
|
15
|
+
<h1>{english ? "Blog" : "Blog"}</h1>
|
|
16
|
+
<p className="muted">{english ? "News, guides and useful content from the store." : "Hírek, útmutatók és hasznos tartalmak a webáruháztól."}</p>
|
|
17
|
+
</header>
|
|
18
|
+
{entries.length ? (
|
|
19
|
+
<div className="cms-grid">
|
|
20
|
+
{entries.map((entry) => <CmsEntryCard key={entry.id} entry={entry} href={blogPostPath(locale, entry.slug)} locale={locale} />)}
|
|
21
|
+
</div>
|
|
22
|
+
) : <div className="empty-state">{english ? "No published articles yet." : "Még nincs publikált bejegyzés."}</div>}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LeadForm } from "@/components/lead-form"
|
|
2
|
+
import { leadFormConfig } from "@/lib/core/leads"
|
|
3
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
4
|
+
|
|
5
|
+
export default async function ContactPage() {
|
|
6
|
+
const locale = await requestStorefrontLocale()
|
|
7
|
+
const english = locale === "en"
|
|
8
|
+
const config = await leadFormConfig("contact").catch(() => ({ forms: [], spam_protection: { honeypot_field: "website", turnstile: { enabled: false, site_key: null } } }))
|
|
9
|
+
const form = config.forms.find((item) => item.enabled) || null
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="stack page-section narrow-page">
|
|
13
|
+
<header className="stack-sm">
|
|
14
|
+
<p className="eyebrow">{english ? "Contact" : "Kapcsolat"}</p>
|
|
15
|
+
<h1>{form?.label || (english ? "Send us a message" : "Írj nekünk")}</h1>
|
|
16
|
+
<p className="muted">{english ? "Use the form below and the team will get back to you." : "Töltsd ki az űrlapot, és a csapat felveszi veled a kapcsolatot."}</p>
|
|
17
|
+
</header>
|
|
18
|
+
{form ? (
|
|
19
|
+
<LeadForm locale={locale} form={form} spamProtection={config.spam_protection} />
|
|
20
|
+
) : (
|
|
21
|
+
<div className="empty-state">{english ? "The contact form is currently unavailable." : "A kapcsolatfelvételi űrlap jelenleg nem elérhető."}</div>
|
|
22
|
+
)}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Customer-facing Core capability reference UI. Brand tokens remain storefront-owned. */
|
|
2
|
+
|
|
3
|
+
.cms-grid,
|
|
4
|
+
.review-list {
|
|
5
|
+
display: grid;
|
|
6
|
+
gap: 18px;
|
|
7
|
+
}
|
|
8
|
+
.cms-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
|
|
9
|
+
.cms-card { overflow: hidden; }
|
|
10
|
+
.cms-card-image,
|
|
11
|
+
.cms-hero-image {
|
|
12
|
+
width: 100%;
|
|
13
|
+
border-radius: 14px;
|
|
14
|
+
object-fit: cover;
|
|
15
|
+
}
|
|
16
|
+
.cms-card-image { aspect-ratio: 16 / 9; }
|
|
17
|
+
.cms-hero-image { max-height: 520px; }
|
|
18
|
+
.cms-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; }
|
|
19
|
+
.cms-body { max-width: 78ch; line-height: 1.75; }
|
|
20
|
+
.cms-body img { max-width: 100%; height: auto; border-radius: 12px; }
|
|
21
|
+
.cms-body blockquote { margin: 0; border-left: 4px solid var(--line); padding-left: 18px; color: var(--muted); }
|
|
22
|
+
.cms-detail { max-width: 900px; margin-inline: auto; }
|
|
23
|
+
|
|
24
|
+
.product-reviews { border-top: 1px solid var(--line); padding-top: 28px; }
|
|
25
|
+
.review-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
|
|
26
|
+
.review-summary strong { font-size: 1.35rem; }
|
|
27
|
+
.review-card { display: grid; gap: 10px; }
|
|
28
|
+
.review-card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
|
|
29
|
+
.review-card-heading > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
30
|
+
.verified-badge { border-radius: 999px; background: var(--surface-soft); padding: 4px 8px; font-size: .75rem; font-weight: 800; }
|
|
31
|
+
.review-form select,
|
|
32
|
+
.review-form textarea,
|
|
33
|
+
.newsletter-form input,
|
|
34
|
+
.quote-request-form input,
|
|
35
|
+
.quote-request-form select,
|
|
36
|
+
.quote-request-form textarea,
|
|
37
|
+
.lead-form input,
|
|
38
|
+
.lead-form select,
|
|
39
|
+
.lead-form textarea {
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.footer-newsletter-shell { padding-top: 28px; }
|
|
44
|
+
.footer-newsletter { border-bottom: 1px solid var(--line); padding-bottom: 28px; }
|
|
45
|
+
.newsletter-form { display: grid; gap: 10px; max-width: 760px; }
|
|
46
|
+
.newsletter-form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
|
|
47
|
+
.checkbox-row { display: flex; gap: 10px; align-items: flex-start; }
|
|
48
|
+
.checkbox-row input { width: auto; margin-top: 3px; }
|
|
49
|
+
|
|
50
|
+
.narrow-page { max-width: 920px; margin-inline: auto; }
|
|
51
|
+
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
|
|
52
|
+
.form-fieldset { margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
|
|
53
|
+
.form-fieldset legend { padding-inline: 6px; font-weight: 850; }
|
|
54
|
+
.honeypot-field { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
|
|
55
|
+
|
|
56
|
+
@media (max-width: 760px) {
|
|
57
|
+
.form-grid,
|
|
58
|
+
.newsletter-form-row { grid-template-columns: 1fr; }
|
|
59
|
+
.review-summary { align-items: flex-start; }
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { notFound } from "next/navigation"
|
|
3
|
+
import { Breadcrumbs } from "@/components/breadcrumbs"
|
|
4
|
+
import { CmsEntryBody, CmsEntryMeta } from "@/components/cms-content"
|
|
5
|
+
import { cmsEntrySeo, getKnowledgeBaseEntry } from "@/lib/core/cms"
|
|
6
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
7
|
+
import { STOREFRONT_ROUTES, medusaLocale } from "@/lib/storefront-routes"
|
|
8
|
+
|
|
9
|
+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
|
10
|
+
const { slug } = await params
|
|
11
|
+
const locale = await requestStorefrontLocale()
|
|
12
|
+
const result = await getKnowledgeBaseEntry(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
13
|
+
return result ? cmsEntrySeo(result.entry) : {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function KnowledgeBaseEntryPage({ params }: { params: Promise<{ slug: string }> }) {
|
|
17
|
+
const { slug } = await params
|
|
18
|
+
const locale = await requestStorefrontLocale()
|
|
19
|
+
const english = locale === "en"
|
|
20
|
+
const result = await getKnowledgeBaseEntry(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
21
|
+
if (!result) notFound()
|
|
22
|
+
const entry = result.entry
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<article className="stack page-section cms-detail">
|
|
26
|
+
<Breadcrumbs items={[{ label: english ? "Knowledge base" : "Tudástár", href: STOREFRONT_ROUTES[locale].knowledgeBase }, { label: entry.title }]} label={english ? "Breadcrumb" : "Morzsanavigáció"} />
|
|
27
|
+
<header className="stack-sm">
|
|
28
|
+
<CmsEntryMeta entry={entry} locale={locale} />
|
|
29
|
+
<h1>{entry.title}</h1>
|
|
30
|
+
{entry.excerpt ? <p className="lead">{entry.excerpt}</p> : null}
|
|
31
|
+
</header>
|
|
32
|
+
<CmsEntryBody entry={entry} />
|
|
33
|
+
</article>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CmsEntryCard } from "@/components/cms-content"
|
|
2
|
+
import { listKnowledgeBaseEntries } from "@/lib/core/cms"
|
|
3
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
4
|
+
import { knowledgeBasePath, medusaLocale } from "@/lib/storefront-routes"
|
|
5
|
+
|
|
6
|
+
export default async function KnowledgeBasePage() {
|
|
7
|
+
const locale = await requestStorefrontLocale()
|
|
8
|
+
const english = locale === "en"
|
|
9
|
+
const { entries } = await listKnowledgeBaseEntries({ locale: medusaLocale(locale), limit: 100 }).catch(() => ({ entries: [] }))
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="stack page-section">
|
|
13
|
+
<header className="stack-sm">
|
|
14
|
+
<p className="eyebrow">{english ? "Help center" : "Segítség"}</p>
|
|
15
|
+
<h1>{english ? "Knowledge base" : "Tudástár"}</h1>
|
|
16
|
+
<p className="muted">{english ? "Answers, guides and practical information." : "Válaszok, útmutatók és gyakorlati információk."}</p>
|
|
17
|
+
</header>
|
|
18
|
+
{entries.length ? (
|
|
19
|
+
<div className="cms-grid">
|
|
20
|
+
{entries.map((entry) => <CmsEntryCard key={entry.id} entry={entry} href={knowledgeBasePath(locale, entry.slug)} locale={locale} />)}
|
|
21
|
+
</div>
|
|
22
|
+
) : <div className="empty-state">{english ? "No knowledge-base entries yet." : "Még nincs publikált tudástár-bejegyzés."}</div>}
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import "./globals.css"
|
|
2
2
|
import "./core-ux.css"
|
|
3
|
+
import "./customer-capabilities.css"
|
|
3
4
|
import type { Metadata } from "next"
|
|
4
5
|
import Link from "next/link"
|
|
5
6
|
import { AccessibilityPreferencesControl, AccessibilityPreferencesProvider } from "@/components/accessibility-preferences"
|
|
6
7
|
import { AnalyticsGate } from "@/components/analytics"
|
|
7
8
|
import { CartProvider } from "@/components/cart-provider"
|
|
8
9
|
import { ConsentBanner } from "@/components/consent-banner"
|
|
10
|
+
import { NewsletterSignup } from "@/components/newsletter-signup"
|
|
9
11
|
import { StorefrontHeader } from "@/components/storefront-header"
|
|
10
12
|
import { ToastProvider } from "@/components/toast-provider"
|
|
11
13
|
import { getCoreConfig } from "@/lib/core/client"
|
|
@@ -61,15 +63,22 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
|
|
|
61
63
|
<StorefrontHeader config={config} />
|
|
62
64
|
<main id="main-content" className="shell main" tabIndex={-1}>{children}</main>
|
|
63
65
|
<footer className="footer">
|
|
66
|
+
<div className="shell footer-newsletter-shell">
|
|
67
|
+
<NewsletterSignup locale={locale} />
|
|
68
|
+
</div>
|
|
64
69
|
<div className="shell footer-inner">
|
|
65
70
|
<div>
|
|
66
71
|
<strong>{config.store.name}</strong>
|
|
67
72
|
<p className="muted small">Powered by HSZRDM Commerce</p>
|
|
68
73
|
</div>
|
|
69
74
|
<nav className="footer-nav" aria-label={en ? "Footer navigation" : "Lábléc navigáció"}>
|
|
70
|
-
<Link href={routes.legal}>{en ? "Legal documents" : "Jogi dokumentumok"}</Link>
|
|
71
|
-
<Link href={routes.account}>{en ? "Account" : "Fiókom"}</Link>
|
|
72
75
|
<Link href={routes.products}>{en ? "Products" : "Termékek"}</Link>
|
|
76
|
+
<Link href={routes.blog}>{en ? "Blog" : "Blog"}</Link>
|
|
77
|
+
<Link href={routes.knowledgeBase}>{en ? "Knowledge base" : "Tudástár"}</Link>
|
|
78
|
+
<Link href={routes.quoteRequest}>{en ? "Request a quote" : "Ajánlatkérés"}</Link>
|
|
79
|
+
<Link href={routes.contact}>{en ? "Contact" : "Kapcsolat"}</Link>
|
|
80
|
+
<Link href={routes.account}>{en ? "Account" : "Fiókom"}</Link>
|
|
81
|
+
<Link href={routes.legal}>{en ? "Legal documents" : "Jogi dokumentumok"}</Link>
|
|
73
82
|
</nav>
|
|
74
83
|
<AccessibilityPreferencesControl locale={locale} />
|
|
75
84
|
</div>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { notFound } from "next/navigation"
|
|
3
|
+
import { Breadcrumbs } from "@/components/breadcrumbs"
|
|
4
|
+
import { CmsEntryBody } from "@/components/cms-content"
|
|
5
|
+
import { cmsEntrySeo, getCmsPage } from "@/lib/core/cms"
|
|
6
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
7
|
+
import { STOREFRONT_ROUTES, medusaLocale } from "@/lib/storefront-routes"
|
|
8
|
+
|
|
9
|
+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
|
|
10
|
+
const { slug } = await params
|
|
11
|
+
const locale = await requestStorefrontLocale()
|
|
12
|
+
const result = await getCmsPage(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
13
|
+
return result ? cmsEntrySeo(result.entry) : {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function CmsPage({ params }: { params: Promise<{ slug: string }> }) {
|
|
17
|
+
const { slug } = await params
|
|
18
|
+
const locale = await requestStorefrontLocale()
|
|
19
|
+
const english = locale === "en"
|
|
20
|
+
const result = await getCmsPage(slug, { locale: medusaLocale(locale) }).catch(() => null)
|
|
21
|
+
if (!result) notFound()
|
|
22
|
+
const entry = result.entry
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<article className="stack page-section cms-detail">
|
|
26
|
+
<Breadcrumbs items={[{ label: english ? "Pages" : "Oldalak", href: STOREFRONT_ROUTES[locale].home }, { label: entry.title }]} label={english ? "Breadcrumb" : "Morzsanavigáció"} />
|
|
27
|
+
<header className="stack-sm">
|
|
28
|
+
<h1>{entry.title}</h1>
|
|
29
|
+
{entry.excerpt ? <p className="lead">{entry.excerpt}</p> : null}
|
|
30
|
+
{entry.featured_image_url ? <img className="cms-hero-image" src={entry.featured_image_url} alt={entry.featured_image_alt || entry.title} /> : null}
|
|
31
|
+
</header>
|
|
32
|
+
<CmsEntryBody entry={entry} />
|
|
33
|
+
</article>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { QuoteRequestForm } from "@/components/quote-request-form"
|
|
2
|
+
import { quoteRequestConfig } from "@/lib/core/quotes"
|
|
3
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
4
|
+
|
|
5
|
+
export default async function QuoteRequestPage() {
|
|
6
|
+
const locale = await requestStorefrontLocale()
|
|
7
|
+
const english = locale === "en"
|
|
8
|
+
const config = await quoteRequestConfig().catch(() => ({ enabled: false, order_types: [], extra_fields: [] }))
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<div className="stack page-section narrow-page">
|
|
12
|
+
<header className="stack-sm">
|
|
13
|
+
<p className="eyebrow">{english ? "Business request" : "Üzleti megkeresés"}</p>
|
|
14
|
+
<h1>{english ? "Request a quote" : "Ajánlatkérés"}</h1>
|
|
15
|
+
<p className="muted">{english ? "Describe what you need and we will prepare a tailored offer." : "Írd le, mire van szükséged, és személyre szabott ajánlatot készítünk."}</p>
|
|
16
|
+
</header>
|
|
17
|
+
<QuoteRequestForm locale={locale} config={config} />
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import Link from "next/link"
|
|
2
|
+
import type { CmsEntry } from "@/lib/core/cms"
|
|
3
|
+
|
|
4
|
+
type Locale = "hu" | "en"
|
|
5
|
+
|
|
6
|
+
export function CmsEntryCard({ entry, href, locale }: { entry: CmsEntry; href: string; locale: Locale }) {
|
|
7
|
+
const english = locale === "en"
|
|
8
|
+
return (
|
|
9
|
+
<article className="panel cms-card stack-sm">
|
|
10
|
+
{entry.featured_image_url ? (
|
|
11
|
+
<img className="cms-card-image" src={entry.featured_image_url} alt={entry.featured_image_alt || entry.title} />
|
|
12
|
+
) : null}
|
|
13
|
+
<div className="stack-sm">
|
|
14
|
+
<CmsEntryMeta entry={entry} locale={locale} />
|
|
15
|
+
<h2><Link href={href}>{entry.title}</Link></h2>
|
|
16
|
+
{entry.excerpt ? <p>{entry.excerpt}</p> : null}
|
|
17
|
+
<Link className="text-link" href={href}>{english ? "Read more" : "Tovább olvasom"}</Link>
|
|
18
|
+
</div>
|
|
19
|
+
</article>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function CmsEntryMeta({ entry, locale }: { entry: CmsEntry; locale: Locale }) {
|
|
24
|
+
const english = locale === "en"
|
|
25
|
+
const date = entry.published_at || entry.created_at
|
|
26
|
+
return (
|
|
27
|
+
<div className="cms-meta muted small">
|
|
28
|
+
{entry.author_name ? <span>{entry.author_name}</span> : null}
|
|
29
|
+
{date ? (
|
|
30
|
+
<time dateTime={date}>
|
|
31
|
+
{new Intl.DateTimeFormat(english ? "en-US" : "hu-HU", { dateStyle: "medium" }).format(new Date(date))}
|
|
32
|
+
</time>
|
|
33
|
+
) : null}
|
|
34
|
+
{entry.terms?.length ? <span>{entry.terms.map((term) => term.name).join(" · ")}</span> : null}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function CmsEntryBody({ entry }: { entry: CmsEntry }) {
|
|
40
|
+
if (entry.body_format === "html" && entry.body) {
|
|
41
|
+
return <div className="cms-body" dangerouslySetInnerHTML={{ __html: entry.body }} />
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (entry.body_format === "blocks" && Array.isArray(entry.blocks)) {
|
|
45
|
+
return (
|
|
46
|
+
<div className="cms-body stack-sm">
|
|
47
|
+
{entry.blocks.map((block, index) => <CmsBlock block={block} index={index} key={index} />)}
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const paragraphs = String(entry.body || "")
|
|
53
|
+
.split(/\n\s*\n/)
|
|
54
|
+
.map((paragraph) => paragraph.trim())
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className="cms-body stack-sm">
|
|
59
|
+
{paragraphs.map((paragraph, index) => <p key={index}>{paragraph}</p>)}
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CmsBlock({ block, index }: { block: unknown; index: number }) {
|
|
65
|
+
if (typeof block === "string") return <p>{block}</p>
|
|
66
|
+
if (!block || typeof block !== "object" || Array.isArray(block)) return null
|
|
67
|
+
const row = block as Record<string, unknown>
|
|
68
|
+
const type = typeof row.type === "string" ? row.type : ""
|
|
69
|
+
const raw = row.text ?? row.content ?? row.value ?? (row.data && typeof row.data === "object" && !Array.isArray(row.data) ? (row.data as Record<string, unknown>).text : null)
|
|
70
|
+
const text = typeof raw === "string" ? raw : ""
|
|
71
|
+
if (!text) return null
|
|
72
|
+
if (type === "heading" || type === "h2" || type === "h3") return <h3>{text}</h3>
|
|
73
|
+
if (type === "quote") return <blockquote>{text}</blockquote>
|
|
74
|
+
return <p data-block-index={index}>{text}</p>
|
|
75
|
+
}
|