@hszrdm/create-commerce 0.0.0-stage → 1.0.1

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 (68) hide show
  1. package/README.md +50 -2
  2. package/bin/create-commerce.mjs +51 -0
  3. package/package.json +23 -4
  4. package/src/cli.mjs +585 -0
  5. package/templates/backend/.env.example +113 -0
  6. package/templates/backend/README.md +7 -0
  7. package/templates/backend/instrumentation.ts +24 -0
  8. package/templates/backend/medusa-config.ts +11 -0
  9. package/templates/backend/package.json +42 -0
  10. package/templates/backend/scripts/prepare-project.mjs +49 -0
  11. package/templates/backend/src/project/README.md +13 -0
  12. package/templates/backend/src/project/api/.gitkeep +0 -0
  13. package/templates/backend/src/project/jobs/.gitkeep +0 -0
  14. package/templates/backend/src/project/modules/.gitkeep +0 -0
  15. package/templates/backend/src/project/subscribers/.gitkeep +0 -0
  16. package/templates/backend/src/project/workflows/.gitkeep +0 -0
  17. package/templates/backend/src/scripts/core-init.ts +21 -0
  18. package/templates/backend/src/scripts/create-storefront-key.ts +12 -0
  19. package/templates/backend/src/scripts/verify-bootstrap.ts +1 -0
  20. package/templates/backend/tsconfig.json +33 -0
  21. package/templates/storefront/.env.example +5 -0
  22. package/templates/storefront/README.md +108 -0
  23. package/templates/storefront/next-env.d.ts +4 -0
  24. package/templates/storefront/next.config.ts +8 -0
  25. package/templates/storefront/package.json +24 -0
  26. package/templates/storefront/src/app/[countryCode]/categories/[handle]/page.tsx +38 -0
  27. package/templates/storefront/src/app/[countryCode]/products/[handle]/page.tsx +51 -0
  28. package/templates/storefront/src/app/[countryCode]/products/page.tsx +47 -0
  29. package/templates/storefront/src/app/account/orders/[id]/page.tsx +8 -0
  30. package/templates/storefront/src/app/account/page.tsx +11 -0
  31. package/templates/storefront/src/app/cart/page.tsx +12 -0
  32. package/templates/storefront/src/app/checkout/page.tsx +15 -0
  33. package/templates/storefront/src/app/checkout/success/page.tsx +72 -0
  34. package/templates/storefront/src/app/error.tsx +14 -0
  35. package/templates/storefront/src/app/globals.css +250 -0
  36. package/templates/storefront/src/app/layout.tsx +59 -0
  37. package/templates/storefront/src/app/legal/page.tsx +26 -0
  38. package/templates/storefront/src/app/loading.tsx +3 -0
  39. package/templates/storefront/src/app/not-found.tsx +14 -0
  40. package/templates/storefront/src/app/page.tsx +47 -0
  41. package/templates/storefront/src/app/reset-password/page.tsx +14 -0
  42. package/templates/storefront/src/app/robots.txt/route.ts +13 -0
  43. package/templates/storefront/src/app/sitemap.xml/route.ts +13 -0
  44. package/templates/storefront/src/components/account-dashboard.tsx +325 -0
  45. package/templates/storefront/src/components/add-to-cart.tsx +71 -0
  46. package/templates/storefront/src/components/analytics.tsx +90 -0
  47. package/templates/storefront/src/components/cart-provider.tsx +236 -0
  48. package/templates/storefront/src/components/cart-view.tsx +135 -0
  49. package/templates/storefront/src/components/checkout-flow.tsx +534 -0
  50. package/templates/storefront/src/components/consent-banner.tsx +131 -0
  51. package/templates/storefront/src/components/order-detail.tsx +273 -0
  52. package/templates/storefront/src/components/product-card.tsx +38 -0
  53. package/templates/storefront/src/components/product-view-tracker.tsx +37 -0
  54. package/templates/storefront/src/components/reset-password-form.tsx +65 -0
  55. package/templates/storefront/src/components/storefront-header.tsx +42 -0
  56. package/templates/storefront/src/components/stripe-payment.tsx +90 -0
  57. package/templates/storefront/src/lib/core/account.ts +170 -0
  58. package/templates/storefront/src/lib/core/after-sales.ts +50 -0
  59. package/templates/storefront/src/lib/core/catalog.ts +56 -0
  60. package/templates/storefront/src/lib/core/checkout.ts +330 -0
  61. package/templates/storefront/src/lib/core/client.ts +107 -0
  62. package/templates/storefront/src/lib/core/commerce.ts +148 -0
  63. package/templates/storefront/src/lib/core/consent.ts +111 -0
  64. package/templates/storefront/src/lib/core/legal.ts +33 -0
  65. package/templates/storefront/src/lib/core/seo.ts +88 -0
  66. package/templates/storefront/src/lib/core/tracking.ts +584 -0
  67. package/templates/storefront/src/lib/core/types.ts +123 -0
  68. package/templates/storefront/tsconfig.json +23 -0
@@ -0,0 +1,72 @@
1
+ import Link from "next/link"
2
+ import { notFound } from "next/navigation"
3
+ import { checkoutApi } from "@/lib/core/checkout"
4
+ import { endpoint, getCoreConfig, medusaFetch } from "@/lib/core/client"
5
+ import { asRecords, formatMoney, isRecord, stringValue, type JsonRecord } from "@/lib/core/commerce"
6
+
7
+ type SearchParams = Promise<{ order_id?: string }>
8
+
9
+ export default async function CheckoutSuccessPage({ searchParams }: { searchParams: SearchParams }) {
10
+ const query = await searchParams
11
+ const orderId = query.order_id?.trim()
12
+ if (!orderId) notFound()
13
+ const config = await getCoreConfig()
14
+ const orderPath = endpoint(config.account.endpoints.order, { id: orderId })
15
+ const { order } = await medusaFetch<{ order: JsonRecord }>(
16
+ `${orderPath}?fields=+items,+shipping_methods,+metadata`,
17
+ { cache: "no-store" },
18
+ ).catch(() => ({ order: null as unknown as JsonRecord }))
19
+ if (!order) notFound()
20
+
21
+ const currency = stringValue(order.currency_code || config.store.default_currency).toUpperCase()
22
+ const shippingMethods = asRecords(order.shipping_methods)
23
+ const cod = shippingMethods.some((method) => isRecord(method.data) && (method.data.cod === true || method.data.cod === "true"))
24
+ const metadata = isRecord(order.metadata) ? order.metadata : {}
25
+ const transferSnapshot = isRecord(metadata.bank_transfer) ? metadata.bank_transfer : null
26
+ const bankTransfer = config.payments.bank_transfer.enabled && !cod
27
+ ? await checkoutApi(config).bankTransferDetails().catch(() => null)
28
+ : null
29
+ const bank = bankTransfer && isRecord(bankTransfer.bank) ? bankTransfer.bank : null
30
+
31
+ return (
32
+ <div className="stack page-section narrow-page">
33
+ <section className="success-hero panel stack">
34
+ <div className="success-icon">✓</div>
35
+ <div><p className="eyebrow">Rendelés rögzítve</p><h1>Köszönjük a rendelésed!</h1><p className="muted">Rendelésszám: <strong>#{stringValue(order.display_id || order.id)}</strong></p></div>
36
+ <div className="button-row"><Link className="button" href={`/${config.seo.default_country_code}/products`}>Tovább vásárolok</Link>{order.customer_id ? <Link className="button secondary" href={`/account/orders/${encodeURIComponent(orderId)}`}>Rendelés részletei</Link> : null}</div>
37
+ </section>
38
+
39
+ <section className="panel stack">
40
+ <h2>Összesítés</h2>
41
+ {asRecords(order.items).map((item) => <div className="summary-line" key={stringValue(item.id)}><span>{stringValue(item.product_title || item.title)} × {stringValue(item.quantity)}</span><strong>{typeof item.total === "number" ? formatMoney(item.total, currency, config.store.locale) : ""}</strong></div>)}
42
+ {typeof order.total === "number" ? <div className="summary-total"><span>Összesen</span><strong>{formatMoney(order.total, currency, config.store.locale)}</strong></div> : null}
43
+ </section>
44
+
45
+ {cod ? <div className="notice"><strong>Utánvétes rendelés.</strong> A fizetés a kiválasztott szállítási mód szabályai szerint történik átvételkor.</div> : null}
46
+
47
+ {bank ? (
48
+ <section className="panel stack-sm">
49
+ <div><p className="eyebrow">Banki átutalás</p><h2>Átutalási adatok</h2></div>
50
+ {bank.name ? <Info label="Bank" value={stringValue(bank.name)} /> : null}
51
+ <Info label="Kedvezményezett" value={stringValue(bank.account_holder)} />
52
+ {bank.account_number ? <Info label="Bankszámlaszám" value={stringValue(bank.account_number)} /> : null}
53
+ {bank.iban ? <Info label="IBAN" value={stringValue(bank.iban)} /> : null}
54
+ {bank.bic ? <Info label="BIC / SWIFT" value={stringValue(bank.bic)} /> : null}
55
+ {transferSnapshot?.reference ? <Info label="Közlemény / hivatkozás" value={stringValue(transferSnapshot.reference)} /> : null}
56
+ {transferSnapshot?.dueDate ? <Info label="Fizetési határidő" value={stringValue(transferSnapshot.dueDate)} /> : bankTransfer?.due_days ? <Info label="Fizetési határidő" value={`${stringValue(bankTransfer.due_days)} nap`} /> : null}
57
+ <p className="muted small">A közleményt pontosan a fenti formában add meg. A rendelési e-mail ugyanezeket az adatokat tartalmazza.</p>
58
+ </section>
59
+ ) : null}
60
+
61
+ <section className="panel stack-sm">
62
+ <h2>Szállítás</h2>
63
+ {shippingMethods.map((method) => <Info key={stringValue(method.id)} label={stringValue(method.name || "Szállítás")} value={typeof method.amount === "number" ? formatMoney(method.amount, currency, config.store.locale) : "Kiválasztva"} />)}
64
+ {isRecord(order.shipping_address) ? <p className="muted">{[stringValue(order.shipping_address.first_name), stringValue(order.shipping_address.last_name), stringValue(order.shipping_address.postal_code), stringValue(order.shipping_address.city), stringValue(order.shipping_address.address_1), stringValue(order.shipping_address.address_2)].filter(Boolean).join(" ")}</p> : null}
65
+ </section>
66
+ </div>
67
+ )
68
+ }
69
+
70
+ function Info({ label, value }: { label: string; value: string }) {
71
+ return <div className="info-row"><span className="muted">{label}</span><strong>{value || "—"}</strong></div>
72
+ }
@@ -0,0 +1,14 @@
1
+ "use client"
2
+
3
+ export default function ErrorPage({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
4
+ return (
5
+ <div className="page-section narrow-page">
6
+ <section className="panel stack">
7
+ <p className="eyebrow">Hiba</p>
8
+ <h1>Valami nem sikerült.</h1>
9
+ <p className="muted">{error.message || "Az oldal betöltése közben hiba történt."}</p>
10
+ <button className="button" type="button" onClick={reset}>Újrapróbálás</button>
11
+ </section>
12
+ </div>
13
+ )
14
+ }
@@ -0,0 +1,250 @@
1
+ :root {
2
+ color-scheme: light;
3
+ --bg: #f6f7f9;
4
+ --surface: #ffffff;
5
+ --surface-soft: #f0f2f5;
6
+ --text: #16181d;
7
+ --muted: #6b7280;
8
+ --line: #e2e5e9;
9
+ --brand: #17191e;
10
+ --brand-contrast: #ffffff;
11
+ --success: #087a49;
12
+ --danger: #b42318;
13
+ --warning: #9a6700;
14
+ --radius: 18px;
15
+ --shadow: 0 16px 50px rgba(16, 24, 40, 0.08);
16
+ }
17
+
18
+ * { box-sizing: border-box; }
19
+ html { background: var(--bg); scroll-behavior: smooth; }
20
+ body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
21
+ a { color: inherit; text-decoration: none; }
22
+ button, input, select, textarea { font: inherit; }
23
+ button, a { -webkit-tap-highlight-color: transparent; }
24
+ img { display: block; max-width: 100%; }
25
+ h1, h2, h3, p { margin-top: 0; }
26
+ h1 { font-size: clamp(2rem, 4vw, 3.75rem); line-height: 1.04; letter-spacing: -0.045em; margin-bottom: .6rem; }
27
+ h2 { font-size: clamp(1.25rem, 2vw, 1.8rem); line-height: 1.15; letter-spacing: -0.025em; margin-bottom: .4rem; }
28
+
29
+ .shell { width: min(1240px, calc(100% - 36px)); margin-inline: auto; }
30
+ .main { min-height: calc(100vh - 190px); }
31
+ .page-section { padding-block: 44px 72px; }
32
+ .narrow-page { max-width: 900px; margin-inline: auto; }
33
+ .narrow-card { max-width: 620px; margin-inline: auto; }
34
+ .stack { display: flex; flex-direction: column; gap: 22px; }
35
+ .stack-sm { display: flex; flex-direction: column; gap: 12px; }
36
+ .muted { color: var(--muted); }
37
+ .small { font-size: .86rem; }
38
+ .eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
39
+ .divider { height: 1px; background: var(--line); margin-block: 8px; }
40
+
41
+ .header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; position: relative; z-index: 30; }
42
+ .brand { font-size: 1.15rem; font-weight: 900; letter-spacing: -.025em; }
43
+ .nav { display: flex; align-items: center; gap: 22px; font-size: .94rem; font-weight: 650; }
44
+ .nav a:hover { color: #525866; }
45
+ .nav-cart { border: 0; background: var(--brand); color: white; border-radius: 999px; padding: 9px 13px 9px 15px; cursor: pointer; font-weight: 750; }
46
+ .cart-count { display: inline-grid; min-width: 21px; height: 21px; margin-left: 6px; place-items: center; border-radius: 999px; background: white; color: var(--brand); font-size: .75rem; }
47
+
48
+ .footer { border-top: 1px solid var(--line); background: var(--surface); }
49
+ .footer-inner { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
50
+ .footer-inner p { margin: 4px 0 0; }
51
+ .footer-nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: .9rem; }
52
+
53
+ .panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 2px rgba(16, 24, 40, .02); }
54
+ .page-heading, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
55
+ .page-heading p, .section-heading p { margin-bottom: 0; }
56
+
57
+ .hero { border-radius: 30px; background: var(--brand); color: var(--brand-contrast); overflow: hidden; }
58
+ .storefront-hero { padding: clamp(32px, 6vw, 76px); display: grid; grid-template-columns: 1.5fr .7fr; gap: 46px; align-items: center; }
59
+ .hero-copy h1 { max-width: 820px; }
60
+ .hero-text { max-width: 690px; color: rgba(255,255,255,.72); font-size: 1.08rem; }
61
+ .hero-card { min-height: 250px; display: flex; flex-direction: column; justify-content: end; gap: 10px; padding: 28px; border-radius: 24px; background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.06)); border: 1px solid rgba(255,255,255,.18); }
62
+ .hero-card p { margin: 0; color: rgba(255,255,255,.7); }
63
+ .hero-stat { font-size: 4rem; line-height: 1; font-weight: 900; letter-spacing: -.06em; }
64
+
65
+ .button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
66
+ .button, .inline-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--brand); border-radius: 11px; padding: 9px 16px; background: var(--brand); color: var(--brand-contrast); cursor: pointer; font-weight: 750; transition: .16s ease; }
67
+ .button:hover { transform: translateY(-1px); }
68
+ .button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
69
+ .button.secondary { border-color: var(--line); background: var(--surface); color: var(--text); }
70
+ .hero .button.secondary { border-color: rgba(255,255,255,.3); background: transparent; color: white; }
71
+ .button-large { min-height: 50px; padding-inline: 20px; }
72
+ .danger-button { background: var(--danger); border-color: var(--danger); }
73
+ .text-button { border: 0; background: none; padding: 0; color: #384152; font-weight: 700; cursor: pointer; }
74
+ .text-button.danger, .danger { color: var(--danger); }
75
+ .text-link { color: #344054; font-weight: 750; text-decoration: underline; text-decoration-color: #cfd4dc; text-underline-offset: 4px; }
76
+ .icon-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.4rem; }
77
+
78
+ label { display: flex; flex-direction: column; gap: 7px; font-size: .88rem; font-weight: 700; color: #384152; }
79
+ input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #d8dce2; border-radius: 10px; background: #fff; color: var(--text); padding: 10px 12px; outline: none; }
80
+ textarea { min-height: 105px; resize: vertical; }
81
+ input:focus, select:focus, textarea:focus { border-color: #7d8590; box-shadow: 0 0 0 3px rgba(34, 37, 43, .07); }
82
+ input[readonly] { background: var(--surface-soft); color: var(--muted); }
83
+ .form-grid { display: grid; gap: 14px; }
84
+ .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
85
+ .inline-form { display: flex; gap: 9px; align-items: end; }
86
+ .inline-form > input { flex: 1; }
87
+
88
+ .product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
89
+ .product-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
90
+ .product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
91
+ .product-media { aspect-ratio: 1 / 1; background: var(--surface-soft); overflow: hidden; display: grid; place-items: center; }
92
+ .product-media img { width: 100%; height: 100%; object-fit: cover; }
93
+ .media-placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: 90px; color: #9aa1ab; background: var(--surface-soft); }
94
+ .product-card-body { padding: 17px; display: flex; flex-direction: column; gap: 8px; }
95
+ .product-card-body h2 { margin: 0; font-size: 1rem; }
96
+ .product-card-body strong { font-size: 1.02rem; }
97
+ .product-detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 46px; align-items: start; }
98
+ .product-main-image { aspect-ratio: 1 / 1; border-radius: 24px; overflow: hidden; background: var(--surface-soft); display: grid; place-items: center; }
99
+ .product-main-image img { width: 100%; height: 100%; object-fit: cover; }
100
+ .thumbnail-row { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
101
+ .thumbnail-row img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
102
+ .product-copy { position: sticky; top: 24px; }
103
+ .product-price { font-size: 1.75rem; font-weight: 850; }
104
+ .product-description { color: #4d5561; white-space: pre-line; }
105
+ .product-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .86rem; }
106
+ .product-meta span { padding: 6px 9px; border-radius: 999px; background: var(--surface-soft); }
107
+ .buy-box { border-top: 1px solid var(--line); padding-top: 20px; }
108
+ .buy-row { display: flex; gap: 18px; align-items: end; }
109
+ .quantity-field { width: 115px; }
110
+ .buy-price { display: flex; flex-direction: column; padding-bottom: 8px; }
111
+
112
+ .catalog-toolbar { display: grid; grid-template-columns: minmax(220px, 1.4fr) 1fr 1fr auto; gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
113
+ .category-row, .chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
114
+ .category-chip, .chip { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 8px 12px; font-size: .88rem; font-weight: 700; }
115
+ .chip { cursor: pointer; }
116
+ .pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
117
+ .pagination a:last-child { text-align: right; }
118
+ .pagination a { font-weight: 750; }
119
+
120
+ .cart-lines { display: flex; flex-direction: column; }
121
+ .cart-line { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding-block: 14px; border-bottom: 1px solid var(--line); }
122
+ .cart-line:first-child { padding-top: 0; }
123
+ .cart-line-image { width: 74px; height: 74px; border-radius: 12px; background: var(--surface-soft); overflow: hidden; }
124
+ .cart-line-image img { width: 100%; height: 100%; object-fit: cover; }
125
+ .cart-line-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
126
+ .quantity-control { display: grid; grid-template-columns: 32px 34px 32px; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
127
+ .quantity-control button { height: 34px; border: 0; background: var(--surface-soft); cursor: pointer; }
128
+ .quantity-control span { text-align: center; font-weight: 750; }
129
+ .totals { margin-left: auto; width: min(100%, 420px); display: flex; flex-direction: column; gap: 9px; }
130
+ .total-row, .summary-line, .info-row { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
131
+ .total-strong, .summary-total { margin-top: 5px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 1.08rem; font-weight: 850; }
132
+ .summary-total { display: flex; justify-content: space-between; gap: 20px; }
133
+
134
+ .drawer-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(13, 16, 22, .46); backdrop-filter: blur(3px); }
135
+ .drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 94vw); padding: 24px; overflow-y: auto; background: var(--surface); box-shadow: -20px 0 60px rgba(15,23,42,.16); }
136
+ .drawer-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 22px; }
137
+ .drawer-head h2 { margin: 0; }
138
+
139
+ .checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
140
+ .checkout-summary { position: sticky; top: 18px; }
141
+ .section-title { display: flex; align-items: center; gap: 10px; }
142
+ .section-title h2 { margin: 0; }
143
+ .step-badge { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: var(--brand); color: white; font-size: .8rem; font-weight: 850; }
144
+ .choice-list { display: grid; gap: 9px; }
145
+ .choice-card { display: flex; flex-direction: row; align-items: center; gap: 12px; min-height: 58px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; background: var(--surface); }
146
+ .choice-card.selected { border-color: #686f79; box-shadow: inset 0 0 0 1px #686f79; }
147
+ .choice-card input { width: auto; min-height: 0; }
148
+ .choice-card span { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 12px; }
149
+ .choice-card small { color: var(--muted); }
150
+ .choice-button { width: 100%; text-align: left; justify-content: space-between; color: var(--text); font: inherit; }
151
+ .stripe-element { padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
152
+ .legal-check { flex-direction: row; align-items: flex-start; font-weight: 500; }
153
+ .legal-check input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; }
154
+
155
+ .account-auth-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr); gap: 20px; max-width: 980px; margin-inline: auto; }
156
+ .account-benefits { justify-content: end; min-height: 380px; background: var(--brand); color: white; }
157
+ .account-benefits .muted { color: rgba(255,255,255,.7); }
158
+ .segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-soft); width: fit-content; max-width: 100%; overflow-x: auto; }
159
+ .segmented button { border: 0; border-radius: 8px; background: transparent; padding: 8px 12px; cursor: pointer; white-space: nowrap; font-weight: 750; color: var(--muted); }
160
+ .segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(16,24,40,.08); }
161
+ .account-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
162
+ .account-sidebar { position: sticky; top: 18px; }
163
+ .account-nav { display: flex; flex-direction: column; gap: 4px; margin-block: 20px; }
164
+ .account-nav button { border: 0; background: transparent; text-align: left; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; }
165
+ .account-nav button.active { background: var(--surface-soft); }
166
+ .address-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
167
+ .address-card { display: flex; flex-direction: column; gap: 4px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
168
+ .order-list { display: flex; flex-direction: column; }
169
+ .order-row { display: flex; justify-content: space-between; gap: 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
170
+ .order-row > div { display: flex; flex-direction: column; gap: 3px; }
171
+ .order-row-right { text-align: right; }
172
+ .section-title-row { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
173
+ .status-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; background: var(--surface-soft); padding: 5px 9px; font-size: .75rem; font-weight: 800; }
174
+ .success-pill { background: #e7f8ef; color: var(--success); }
175
+ .warning-pill { background: #fff5d7; color: var(--warning); }
176
+ .danger-zone { border-color: #f1c7c2; }
177
+ .order-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
178
+ .order-item { display: grid; grid-template-columns: 66px minmax(0,1fr) auto; gap: 12px; align-items: center; padding-block: 13px; border-bottom: 1px solid var(--line); }
179
+ .order-item img, .order-item .media-placeholder { width: 66px; height: 66px; border-radius: 10px; object-fit: cover; }
180
+ .order-item > div { display: flex; flex-direction: column; }
181
+ .case-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 12px; border-bottom: 1px solid var(--line); }
182
+ .case-row > div { display: flex; align-items: center; gap: 10px; }
183
+
184
+ .notice { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
185
+ .notice.warning { border-color: #ead69a; background: #fffaf0; }
186
+ .success-box { border-color: #a6dfc1; background: #f1fcf6; color: #06603a; }
187
+ .error-box { border-color: #efb5ae; background: #fff5f4; color: #8e1d13; }
188
+ .success { color: var(--success); margin: 0; }
189
+ .error { color: var(--danger); margin: 0; }
190
+ .empty-state { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 28px; border: 1px dashed #cfd4dc; border-radius: var(--radius); background: rgba(255,255,255,.45); }
191
+ .loader { width: 28px; height: 28px; border: 3px solid #d5d9df; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
192
+ @keyframes spin { to { transform: rotate(360deg); } }
193
+ .success-hero { text-align: center; align-items: center; padding-block: 44px; }
194
+ .success-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #e8f9f0; color: var(--success); font-size: 2rem; font-weight: 900; }
195
+
196
+ .cookie-settings-trigger { position: fixed; left: 16px; bottom: 16px; z-index: 80; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); padding: 9px 12px; box-shadow: 0 6px 24px rgba(16,24,40,.12); cursor: pointer; font-size: .78rem; font-weight: 750; }
197
+ .consent { position: fixed; z-index: 100; inset: auto 18px 18px 18px; max-width: 880px; margin-inline: auto; display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 22px; background: #111318; color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
198
+ .consent p { color: rgba(255,255,255,.68); margin-bottom: 0; }
199
+ .consent-toggle { flex-direction: row; align-items: start; color: white; font-weight: 500; }
200
+ .consent-toggle input { width: 18px; height: 18px; min-height: 0; }
201
+ .consent-toggle span { display: flex; flex-direction: column; gap: 2px; }
202
+ .consent-toggle small { color: rgba(255,255,255,.65); }
203
+ .consent-actions { display: flex; flex-direction: column; justify-content: end; gap: 8px; min-width: 220px; }
204
+ .consent .button.secondary { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: white; }
205
+
206
+ @media (max-width: 1040px) {
207
+ .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
208
+ .checkout-layout { grid-template-columns: 1fr; }
209
+ .checkout-summary { position: static; order: -1; }
210
+ .storefront-hero { grid-template-columns: 1fr; }
211
+ .hero-card { min-height: 180px; }
212
+ .account-layout { grid-template-columns: 220px 1fr; }
213
+ .order-detail-grid { grid-template-columns: 1fr; }
214
+ }
215
+
216
+ @media (max-width: 760px) {
217
+ .shell { width: min(100% - 24px, 1240px); }
218
+ .header { min-height: 66px; }
219
+ .nav > a { display: none; }
220
+ .page-section { padding-block: 28px 52px; }
221
+ .panel, .card { padding: 18px; border-radius: 14px; }
222
+ .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
223
+ .product-detail { grid-template-columns: 1fr; gap: 24px; }
224
+ .product-copy { position: static; }
225
+ .catalog-toolbar { grid-template-columns: 1fr; }
226
+ .two-col { grid-template-columns: 1fr; }
227
+ .cart-line { grid-template-columns: 60px minmax(0,1fr) auto; }
228
+ .cart-line-image { width: 60px; height: 60px; }
229
+ .cart-line > .text-button { grid-column: 2 / -1; justify-self: start; }
230
+ .account-auth-grid, .account-layout { grid-template-columns: 1fr; }
231
+ .account-benefits { min-height: 220px; }
232
+ .account-sidebar { position: static; }
233
+ .account-nav { flex-direction: row; overflow-x: auto; }
234
+ .address-grid { grid-template-columns: 1fr; }
235
+ .footer-inner { align-items: flex-start; flex-direction: column; padding-block: 26px; }
236
+ .consent { grid-template-columns: 1fr; max-height: calc(100vh - 30px); overflow-y: auto; }
237
+ .consent-actions { min-width: 0; }
238
+ }
239
+
240
+ @media (max-width: 480px) {
241
+ .product-grid { grid-template-columns: 1fr 1fr; }
242
+ .product-card-body { padding: 12px; }
243
+ .storefront-hero { padding: 28px 22px; }
244
+ .hero-stat { font-size: 3rem; }
245
+ .button-row > .button { flex: 1; }
246
+ .inline-form { flex-direction: column; align-items: stretch; }
247
+ .page-heading, .section-heading { align-items: flex-start; flex-direction: column; }
248
+ .order-row, .case-row { align-items: flex-start; flex-direction: column; }
249
+ .order-row-right { text-align: left; }
250
+ }
@@ -0,0 +1,59 @@
1
+ import "./globals.css"
2
+ import type { Metadata } from "next"
3
+ import Link from "next/link"
4
+ import { AnalyticsGate } from "@/components/analytics"
5
+ import { CartProvider } from "@/components/cart-provider"
6
+ import { ConsentBanner } from "@/components/consent-banner"
7
+ import { StorefrontHeader } from "@/components/storefront-header"
8
+ import { getCoreConfig } from "@/lib/core/client"
9
+
10
+ const consentDefaultScript = `
11
+ window.dataLayer = window.dataLayer || [];
12
+ window.gtag = window.gtag || function(){window.dataLayer.push(arguments);};
13
+ window.gtag('consent', 'default', {
14
+ analytics_storage: 'denied',
15
+ ad_storage: 'denied',
16
+ ad_user_data: 'denied',
17
+ ad_personalization: 'denied',
18
+ wait_for_update: 500
19
+ });
20
+ `
21
+
22
+ export async function generateMetadata(): Promise<Metadata> {
23
+ const config = await getCoreConfig()
24
+ return {
25
+ title: {
26
+ default: config.store.name,
27
+ template: `%s | ${config.store.name}`,
28
+ },
29
+ verification: config.seo.search_console.enabled && config.seo.search_console.verification_token
30
+ ? { google: config.seo.search_console.verification_token }
31
+ : undefined,
32
+ robots: config.seo.allow_indexing
33
+ ? { index: true, follow: true }
34
+ : { index: false, follow: false },
35
+ }
36
+ }
37
+
38
+ export default async function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
39
+ const config = await getCoreConfig()
40
+ return (
41
+ <html lang={config.store.locale.split("-")[0]}>
42
+ <head><script dangerouslySetInnerHTML={{ __html: consentDefaultScript }} /></head>
43
+ <body>
44
+ <CartProvider config={config}>
45
+ <StorefrontHeader config={config} />
46
+ <main className="shell main">{children}</main>
47
+ <footer className="footer">
48
+ <div className="shell footer-inner">
49
+ <div><strong>{config.store.name}</strong><p className="muted small">Core-powered Medusa storefront.</p></div>
50
+ <nav className="footer-nav"><Link href="/legal">Jogi dokumentumok</Link><Link href="/account">Fiókom</Link><Link href={`/${config.seo.default_country_code}/products`}>Termékek</Link></nav>
51
+ </div>
52
+ </footer>
53
+ <AnalyticsGate analytics={config.analytics} />
54
+ <ConsentBanner enabled={config.features.analytics} />
55
+ </CartProvider>
56
+ </body>
57
+ </html>
58
+ )
59
+ }
@@ -0,0 +1,26 @@
1
+ import { getCoreConfig } from "@/lib/core/client"
2
+ import { listLegalDocuments } from "@/lib/core/legal"
3
+
4
+ export default async function LegalPage() {
5
+ const config = await getCoreConfig()
6
+ const { documents } = await listLegalDocuments(config)
7
+
8
+ return (
9
+ <div className="stack page-section">
10
+ <div className="page-heading">
11
+ <div><p className="eyebrow">Jogi dokumentumok</p><h1>Aktuális szabályzatok</h1><p className="muted">Mindig a backendben verziózott, aktuális dokumentumok jelennek meg.</p></div>
12
+ </div>
13
+ {documents.length ? (
14
+ <div className="product-grid">
15
+ {documents.map((document) => (
16
+ <article className="card stack-sm" key={document.key}>
17
+ <h2>{document.title || document.key}</h2>
18
+ <p className="muted">{(document.requiredAtCheckout ?? document.required_at_checkout) ? "Checkoutnál elfogadás szükséges." : "Tájékoztató dokumentum."}</p>
19
+ {document.pdfEndpoint ? <a className="button secondary" href={document.pdfEndpoint} target="_blank" rel="noreferrer">PDF megnyitása</a> : null}
20
+ </article>
21
+ ))}
22
+ </div>
23
+ ) : <div className="empty-state">Nincs publikált jogi dokumentum.</div>}
24
+ </div>
25
+ )
26
+ }
@@ -0,0 +1,3 @@
1
+ export default function Loading() {
2
+ return <div className="page-section"><div className="empty-state"><span className="loader" />Betöltés…</div></div>
3
+ }
@@ -0,0 +1,14 @@
1
+ import Link from "next/link"
2
+
3
+ export default function NotFound() {
4
+ return (
5
+ <div className="page-section narrow-page">
6
+ <section className="panel stack empty-state">
7
+ <p className="eyebrow">404</p>
8
+ <h1>Az oldal nem található.</h1>
9
+ <p className="muted">Lehet, hogy a termék vagy oldal már nem érhető el.</p>
10
+ <Link className="button inline-button" href="/">Vissza a főoldalra</Link>
11
+ </section>
12
+ </div>
13
+ )
14
+ }
@@ -0,0 +1,47 @@
1
+ import Link from "next/link"
2
+ import { ProductCard } from "@/components/product-card"
3
+ import { getCoreConfig } from "@/lib/core/client"
4
+ import { checkoutApi } from "@/lib/core/checkout"
5
+ import { listCategories, listProducts } from "@/lib/core/catalog"
6
+ import { stringValue } from "@/lib/core/commerce"
7
+
8
+ export default async function HomePage() {
9
+ const config = await getCoreConfig()
10
+ const region = await checkoutApi(config).resolveDefaultRegion().catch(() => null)
11
+ const regionId = region ? stringValue(region.id) : undefined
12
+ const [{ products }, { product_categories: categories }] = await Promise.all([
13
+ listProducts({ limit: 8, order: "-created_at", regionId }).catch(() => ({ products: [] })),
14
+ listCategories().catch(() => ({ product_categories: [] })),
15
+ ])
16
+ const country = config.seo.default_country_code
17
+
18
+ return (
19
+ <div className="stack page-section">
20
+ <section className="hero storefront-hero">
21
+ <div className="hero-copy">
22
+ <p className="eyebrow">{config.store.name}</p>
23
+ <h1>Gyors, biztonságos vásárlás Medusa Core alapon.</h1>
24
+ <p className="hero-text">A termékek, árak, kedvezmények, szállítás, fizetés és jogi szabályok közvetlenül a backend aktuális konfigurációjából érkeznek.</p>
25
+ <div className="button-row"><Link className="button button-large" href={`/${country}/products`}>Termékek</Link>{config.features.account ? <Link className="button secondary button-large" href="/account">Fiókom</Link> : null}</div>
26
+ </div>
27
+ <div className="hero-card">
28
+ <span className="hero-stat">Core</span>
29
+ <strong>Egy starter, több webshop.</strong>
30
+ <p>Az ügyfél-specifikus design cserélhető, a checkout/account/legal/SEO/analytics integrációs réteg újrahasznosítható.</p>
31
+ </div>
32
+ </section>
33
+
34
+ {categories.length ? (
35
+ <section className="stack-sm">
36
+ <div className="section-heading"><div><p className="eyebrow">Kategóriák</p><h2>Fedezd fel a kínálatot</h2></div><Link className="text-link" href={`/${country}/products`}>Összes termék →</Link></div>
37
+ <div className="category-row">{categories.slice(0, 8).map((category) => <Link className="category-chip" key={stringValue(category.id)} href={`/${country}/categories/${encodeURIComponent(stringValue(category.handle))}`}>{stringValue(category.name)}</Link>)}</div>
38
+ </section>
39
+ ) : null}
40
+
41
+ <section className="stack-sm">
42
+ <div className="section-heading"><div><p className="eyebrow">Újdonságok</p><h2>Legfrissebb termékek</h2></div><Link className="text-link" href={`/${country}/products`}>Teljes kínálat →</Link></div>
43
+ {products.length ? <div className="product-grid">{products.map((product) => <ProductCard key={stringValue(product.id)} product={product} config={config} />)}</div> : <div className="empty-state">Még nincs publikált termék.</div>}
44
+ </section>
45
+ </div>
46
+ )
47
+ }
@@ -0,0 +1,14 @@
1
+ import { Suspense } from "react"
2
+ import { ResetPasswordForm } from "@/components/reset-password-form"
3
+ import { getCoreConfig } from "@/lib/core/client"
4
+
5
+ export default async function ResetPasswordPage() {
6
+ const config = await getCoreConfig()
7
+ return (
8
+ <div className="page-section narrow-page">
9
+ <Suspense fallback={<div className="empty-state">Betöltés…</div>}>
10
+ <ResetPasswordForm config={config} />
11
+ </Suspense>
12
+ </div>
13
+ )
14
+ }
@@ -0,0 +1,13 @@
1
+ import { getCoreConfig, medusaRawFetch } from "@/lib/core/client"
2
+
3
+ export async function GET() {
4
+ const config = await getCoreConfig()
5
+ const response = await medusaRawFetch(config.seo.robots_source_endpoint, {
6
+ next: { revalidate: 300 },
7
+ headers: { accept: "text/plain" },
8
+ })
9
+ return new Response(await response.text(), {
10
+ status: response.status,
11
+ headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "public, max-age=300" },
12
+ })
13
+ }
@@ -0,0 +1,13 @@
1
+ import { getCoreConfig, medusaRawFetch } from "@/lib/core/client"
2
+
3
+ export async function GET() {
4
+ const config = await getCoreConfig()
5
+ const response = await medusaRawFetch(config.seo.sitemap_source_endpoint, {
6
+ next: { revalidate: 300 },
7
+ headers: { accept: "application/xml,text/xml" },
8
+ })
9
+ return new Response(await response.text(), {
10
+ status: response.status,
11
+ headers: { "content-type": "application/xml; charset=utf-8", "cache-control": "public, max-age=300" },
12
+ })
13
+ }