@hszrdm/create-commerce 1.4.0 → 1.6.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 +1 -1
- package/templates/backend/.env.example +13 -0
- package/templates/backend/README.md +4 -0
- package/templates/backend/package.json +3 -1
- package/templates/backend/scripts/core-backup.mjs +281 -0
- package/templates/backend/scripts/core-restore.mjs +179 -0
- package/templates/backend/scripts/lib/core-backup-common.mjs +237 -0
- package/templates/backend/scripts/production-assets/deploy.sh +2 -1
- package/templates/backend/scripts/production-assets/install.sh +2 -1
- package/templates/backend/scripts/production-assets/restore.sh +4 -1
- package/templates/backend/src/scripts/core-init.ts +3 -1
- package/templates/storefront/README.md +35 -12
- package/templates/storefront/src/app/[countryCode]/products/[handle]/page.tsx +3 -2
- package/templates/storefront/src/app/blog/page.tsx +46 -8
- package/templates/storefront/src/app/cart/page.tsx +2 -0
- package/templates/storefront/src/app/cart/shared/[token]/page.tsx +25 -0
- package/templates/storefront/src/app/cart-recovery/page.tsx +35 -0
- package/templates/storefront/src/app/ertekeles/page.tsx +25 -0
- package/templates/storefront/src/app/fiok-aktivalas/page.tsx +35 -0
- package/templates/storefront/src/app/knowledge-base/page.tsx +46 -8
- package/templates/storefront/src/app/layout.tsx +5 -2
- package/templates/storefront/src/app/legal/page.tsx +18 -2
- package/templates/storefront/src/app/page.tsx +33 -4
- package/templates/storefront/src/app/pages/page.tsx +43 -0
- package/templates/storefront/src/components/abandoned-cart-recovery.tsx +139 -0
- package/templates/storefront/src/components/account-activation-form.tsx +333 -0
- package/templates/storefront/src/components/add-to-cart.tsx +132 -2
- package/templates/storefront/src/components/analytics.tsx +52 -19
- package/templates/storefront/src/components/cart-provider.tsx +40 -3
- package/templates/storefront/src/components/cart-share-button.tsx +93 -0
- package/templates/storefront/src/components/cms-taxonomy-filters.tsx +86 -0
- package/templates/storefront/src/components/customer-cart-resume-gate.tsx +112 -0
- package/templates/storefront/src/components/fogyasztobarat-embed.tsx +32 -0
- package/templates/storefront/src/components/review-request-form.tsx +419 -0
- package/templates/storefront/src/components/shared-cart-view.tsx +257 -0
- package/templates/storefront/src/lib/core/abandoned-cart.ts +47 -0
- package/templates/storefront/src/lib/core/account-activation.ts +75 -0
- package/templates/storefront/src/lib/core/back-in-stock.ts +25 -0
- package/templates/storefront/src/lib/core/catalog.ts +12 -0
- package/templates/storefront/src/lib/core/checkout.ts +86 -4
- package/templates/storefront/src/lib/core/customer-cart-resume.ts +51 -0
- package/templates/storefront/src/lib/core/google-ads.ts +58 -0
- package/templates/storefront/src/lib/core/legal.ts +14 -0
- package/templates/storefront/src/lib/core/reviews.ts +37 -5
- package/templates/storefront/src/lib/core/shared-cart.ts +37 -0
- package/templates/storefront/src/lib/core/types.ts +18 -0
- package/templates/storefront/src/lib/storefront-routes.ts +12 -0
- package/templates/storefront/src/proxy.ts +11 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { createHash } from "node:crypto"
|
|
2
|
+
import {
|
|
3
|
+
cpSync,
|
|
4
|
+
existsSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
readFileSync,
|
|
7
|
+
readdirSync,
|
|
8
|
+
statSync,
|
|
9
|
+
} from "node:fs"
|
|
10
|
+
import { dirname, isAbsolute, join, resolve } from "node:path"
|
|
11
|
+
|
|
12
|
+
export const PORTABLE_ENV_KEYS = [
|
|
13
|
+
"MEDUSA_BACKEND_URL",
|
|
14
|
+
"STOREFRONT_URL",
|
|
15
|
+
"MEDUSA_ADMIN_PATH",
|
|
16
|
+
"STORE_CORS",
|
|
17
|
+
"ADMIN_CORS",
|
|
18
|
+
"AUTH_CORS",
|
|
19
|
+
"STORE_NAME",
|
|
20
|
+
"STORE_SLUG",
|
|
21
|
+
"STORE_LOCALE",
|
|
22
|
+
"STORE_DEFAULT_CURRENCY",
|
|
23
|
+
"STORE_DEFAULT_COUNTRY",
|
|
24
|
+
"VITE_ADMIN_BRAND_NAME",
|
|
25
|
+
"ORDER_EMAIL",
|
|
26
|
+
"SUPPORT_EMAIL",
|
|
27
|
+
"BILLING_EMAIL",
|
|
28
|
+
"SYSTEM_EMAIL",
|
|
29
|
+
"AFTER_SALES_ENABLED",
|
|
30
|
+
"AFTER_SALES_RETURNS_ENABLED",
|
|
31
|
+
"AFTER_SALES_EXCHANGES_ENABLED",
|
|
32
|
+
"AFTER_SALES_CLAIMS_ENABLED",
|
|
33
|
+
"AFTER_SALES_POLICY_URL",
|
|
34
|
+
"AFTER_SALES_RETURN_INSTRUCTIONS",
|
|
35
|
+
"SEO_STOREFRONT_URL",
|
|
36
|
+
"SEO_STORE_NAME",
|
|
37
|
+
"SEO_ORGANIZATION_NAME",
|
|
38
|
+
"SEO_ORGANIZATION_LOGO_URL",
|
|
39
|
+
"SEO_DEFAULT_COUNTRY",
|
|
40
|
+
"SEO_DEFAULT_CURRENCY",
|
|
41
|
+
"SEO_PRODUCT_PATH_TEMPLATE",
|
|
42
|
+
"SEO_CATEGORY_PATH_TEMPLATE",
|
|
43
|
+
"SEO_ALLOW_INDEXING",
|
|
44
|
+
"SEO_ROBOTS_DISALLOW",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
export const CORE_DB_MODULES = [
|
|
48
|
+
"medusa_native",
|
|
49
|
+
"integration_settings",
|
|
50
|
+
"integration_operation",
|
|
51
|
+
"core_audit",
|
|
52
|
+
"legal_consent",
|
|
53
|
+
"seo",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
export function backendProjectDir(projectDir) {
|
|
57
|
+
const monorepoBackend = join(projectDir, "apps", "backend")
|
|
58
|
+
if (existsSync(monorepoBackend)) return monorepoBackend
|
|
59
|
+
|
|
60
|
+
const generatedBackend = join(projectDir, "backend")
|
|
61
|
+
if (existsSync(generatedBackend)) return generatedBackend
|
|
62
|
+
|
|
63
|
+
return projectDir
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function loadRuntimeEnv(projectDir, overrides = process.env) {
|
|
67
|
+
const file = join(backendProjectDir(projectDir), ".env")
|
|
68
|
+
const fromFile = existsSync(file) ? parseEnv(readFileSync(file, "utf8")) : {}
|
|
69
|
+
const explicitOverrides = Object.fromEntries(
|
|
70
|
+
Object.entries(overrides).filter(([, value]) => value != null && String(value).trim() !== ""),
|
|
71
|
+
)
|
|
72
|
+
return { ...fromFile, ...explicitOverrides }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function parseEnv(source) {
|
|
76
|
+
const result = {}
|
|
77
|
+
for (const rawLine of String(source).split(/\r?\n/)) {
|
|
78
|
+
const line = rawLine.trim()
|
|
79
|
+
if (!line || line.startsWith("#")) continue
|
|
80
|
+
const eq = line.indexOf("=")
|
|
81
|
+
if (eq <= 0) continue
|
|
82
|
+
const key = line.slice(0, eq).trim()
|
|
83
|
+
let value = line.slice(eq + 1).trim()
|
|
84
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
85
|
+
value = value.slice(1, -1)
|
|
86
|
+
}
|
|
87
|
+
result[key] = value
|
|
88
|
+
}
|
|
89
|
+
return result
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function portableConfig(env) {
|
|
93
|
+
const values = {}
|
|
94
|
+
for (const key of PORTABLE_ENV_KEYS) {
|
|
95
|
+
const value = String(env[key] ?? "").trim()
|
|
96
|
+
if (value) values[key] = value
|
|
97
|
+
}
|
|
98
|
+
return values
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function portableEnvText(values) {
|
|
102
|
+
return `${Object.entries(values)
|
|
103
|
+
.map(([key, value]) => `${key}=${quoteEnv(value)}`)
|
|
104
|
+
.join("\n")}\n`
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function pgEnvironment(databaseUrl, base = process.env) {
|
|
108
|
+
const url = new URL(required(databaseUrl, "DATABASE_URL"))
|
|
109
|
+
if (!["postgres:", "postgresql:"].includes(url.protocol)) {
|
|
110
|
+
throw new Error("DATABASE_URL csak postgres/postgresql URL lehet.")
|
|
111
|
+
}
|
|
112
|
+
const database = decodeURIComponent(url.pathname.replace(/^\//, ""))
|
|
113
|
+
if (!database) throw new Error("DATABASE_URL adatbázisneve hiányzik.")
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
database,
|
|
117
|
+
env: {
|
|
118
|
+
...base,
|
|
119
|
+
PGHOST: url.hostname,
|
|
120
|
+
PGPORT: url.port || "5432",
|
|
121
|
+
PGUSER: decodeURIComponent(url.username || ""),
|
|
122
|
+
PGPASSWORD: decodeURIComponent(url.password || ""),
|
|
123
|
+
PGDATABASE: database,
|
|
124
|
+
...(url.searchParams.get("sslmode") ? { PGSSLMODE: url.searchParams.get("sslmode") } : {}),
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function integrationSnapshotPath(projectDir, env) {
|
|
130
|
+
const backendDir = backendProjectDir(projectDir)
|
|
131
|
+
const configured = String(env.INTEGRATION_SETTINGS_FILE || "").trim()
|
|
132
|
+
if (configured) return isAbsolute(configured) ? configured : resolve(backendDir, configured)
|
|
133
|
+
|
|
134
|
+
const uploadDir = String(env.FILE_UPLOAD_DIR || "").trim()
|
|
135
|
+
if (uploadDir && isAbsolute(uploadDir)) {
|
|
136
|
+
return join(dirname(uploadDir), "integration-settings.enc")
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return join(backendDir, ".core", "integration-settings.enc")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function backupFileSources(projectDir, env) {
|
|
143
|
+
const sources = []
|
|
144
|
+
const backendDir = backendProjectDir(projectDir)
|
|
145
|
+
const snapshot = integrationSnapshotPath(projectDir, env)
|
|
146
|
+
if (existsSync(snapshot)) {
|
|
147
|
+
sources.push({ key: "integration_snapshot", source: snapshot, relative: "files/integration-settings.enc" })
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const localStatic = join(backendDir, "static")
|
|
151
|
+
if (existsSync(localStatic)) {
|
|
152
|
+
sources.push({ key: "local_static", source: localStatic, relative: "files/local-static" })
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const configuredUpload = String(env.FILE_UPLOAD_DIR || "").trim()
|
|
156
|
+
if (configuredUpload && isAbsolute(configuredUpload) && existsSync(configuredUpload)) {
|
|
157
|
+
sources.push({ key: "file_upload_dir", source: configuredUpload, relative: "files/file-upload-dir" })
|
|
158
|
+
}
|
|
159
|
+
return sources
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function copyBackupSource(bundleDir, item) {
|
|
163
|
+
const target = join(bundleDir, item.relative)
|
|
164
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
165
|
+
cpSync(item.source, target, { recursive: true, force: true })
|
|
166
|
+
return target
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function sha256File(path) {
|
|
170
|
+
const hash = createHash("sha256")
|
|
171
|
+
hash.update(readFileSync(path))
|
|
172
|
+
return hash.digest("hex")
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function sha256Tree(path) {
|
|
176
|
+
const hash = createHash("sha256")
|
|
177
|
+
hashDirectory(hash, path, path)
|
|
178
|
+
return hash.digest("hex")
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function verifyManifest(bundleDir, manifest) {
|
|
182
|
+
const failures = []
|
|
183
|
+
for (const artifact of manifest.artifacts || []) {
|
|
184
|
+
const path = join(bundleDir, artifact.path)
|
|
185
|
+
if (!existsSync(path)) {
|
|
186
|
+
failures.push(`${artifact.path}: hiányzik`)
|
|
187
|
+
continue
|
|
188
|
+
}
|
|
189
|
+
const actual = artifact.kind === "directory" ? sha256Tree(path) : sha256File(path)
|
|
190
|
+
if (actual !== artifact.sha256) failures.push(`${artifact.path}: checksum eltérés`)
|
|
191
|
+
}
|
|
192
|
+
if (failures.length) {
|
|
193
|
+
throw new Error(`A backup integritásellenőrzése sikertelen:\n- ${failures.join("\n- ")}`)
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function backupTimestamp(date = new Date()) {
|
|
198
|
+
return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z")
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function requireEncryptionKeyWhenNeeded(manifest, env) {
|
|
202
|
+
if (!manifest.requires_integration_encryption_key) return
|
|
203
|
+
const key = String(env.INTEGRATION_SETTINGS_ENCRYPTION_KEY || "").trim()
|
|
204
|
+
if (key.length < 32) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
"A backup titkosított Integration Settings adatot tartalmaz. A visszaállításhoz add meg az eredeti, legalább 32 karakteres INTEGRATION_SETTINGS_ENCRYPTION_KEY értéket; a kulcs szándékosan nincs a backupban.",
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function hashDirectory(hash, root, current) {
|
|
212
|
+
const entries = readdirSync(current).sort((a, b) => a.localeCompare(b))
|
|
213
|
+
for (const name of entries) {
|
|
214
|
+
const full = join(current, name)
|
|
215
|
+
const relative = full.slice(root.length + 1)
|
|
216
|
+
const stat = statSync(full)
|
|
217
|
+
if (stat.isDirectory()) {
|
|
218
|
+
hash.update(`D:${relative}\n`)
|
|
219
|
+
hashDirectory(hash, root, full)
|
|
220
|
+
} else if (stat.isFile()) {
|
|
221
|
+
hash.update(`F:${relative}:${stat.size}\n`)
|
|
222
|
+
hash.update(readFileSync(full))
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function quoteEnv(value) {
|
|
228
|
+
const text = String(value)
|
|
229
|
+
if (!/[\s#'"\\]/.test(text)) return text
|
|
230
|
+
return JSON.stringify(text)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function required(value, label) {
|
|
234
|
+
const text = String(value || "").trim()
|
|
235
|
+
if (!text) throw new Error(`${label} kötelező.`)
|
|
236
|
+
return text
|
|
237
|
+
}
|
|
@@ -40,7 +40,8 @@ git pull --ff-only
|
|
|
40
40
|
NEW_SHA="$(git rev-parse HEAD)"
|
|
41
41
|
printf 'Deploying %s -> %s\n' "$OLD_SHA" "$NEW_SHA"
|
|
42
42
|
|
|
43
|
-
log "
|
|
43
|
+
log "Clean dependency tree and install exact dependencies"
|
|
44
|
+
rm -rf node_modules
|
|
44
45
|
npm ci
|
|
45
46
|
npm --workspace backend run env:verify
|
|
46
47
|
|
|
@@ -59,8 +59,11 @@ if [[ -d "$TMP/runtime/uploads" ]]; then
|
|
|
59
59
|
fi
|
|
60
60
|
fi
|
|
61
61
|
|
|
62
|
-
log "
|
|
62
|
+
log "Clean dependency tree and install exact dependencies"
|
|
63
|
+
rm -rf node_modules
|
|
63
64
|
npm ci
|
|
65
|
+
|
|
66
|
+
log "Migrate and verify restored application"
|
|
64
67
|
npm --workspace backend run env:verify
|
|
65
68
|
npm run db:migrate
|
|
66
69
|
npm run build
|
|
@@ -5,7 +5,7 @@ import ensureShipping from "@hszrdm/core/scripts/ensure-shipping"
|
|
|
5
5
|
import { normalizeMedusaExecArgs } from "@hszrdm/core/scripts/exec-args"
|
|
6
6
|
|
|
7
7
|
export default async function runCoreInit(params: ExecArgs) {
|
|
8
|
-
await coreInit({
|
|
8
|
+
const completed = await coreInit({
|
|
9
9
|
...params,
|
|
10
10
|
args: normalizeMedusaExecArgs(params.args || [], {
|
|
11
11
|
boolean: ["yes", "force"],
|
|
@@ -21,6 +21,8 @@ export default async function runCoreInit(params: ExecArgs) {
|
|
|
21
21
|
}),
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
+
if (!completed) return
|
|
25
|
+
|
|
24
26
|
await ensureLocales({
|
|
25
27
|
...params,
|
|
26
28
|
args: [],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Újrahasznosítható, teljes referencia-storefront a MEDUSA WEBSHOP CORE backendhez.
|
|
4
4
|
|
|
5
|
-
A starter külön alkalmazás: nincs a backend root npm workspace-ben, így a Medusa deploy és lockfile nem kap Next.js/Stripe frontend függőségeket. Új webshopnál
|
|
5
|
+
A starter külön alkalmazás: nincs a backend root npm workspace-ben, így a Medusa deploy és lockfile nem kap Next.js/Stripe frontend függőségeket. Új webshopnál a `@hszrdm/create-commerce` generátor a teljes frontendrészt a külön ügyfélprojektbe másolja; ezután elsődlegesen a design/branding réteget kell cserélni, a `src/lib/core` integrációs contractokat és a kész commerce flow komponenseket érdemes megtartani.
|
|
6
6
|
|
|
7
7
|
## Indítás
|
|
8
8
|
|
|
@@ -20,18 +20,25 @@ NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000
|
|
|
20
20
|
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
szükséges. A payment/shipping/legal/SEO/analytics capability-k a `GET /store/core-config` contractból érkeznek.
|
|
23
|
+
szükséges. A payment/shipping/legal/SEO/analytics/marketing capability-k a `GET /store/core-config` contractból érkeznek.
|
|
24
24
|
|
|
25
25
|
## Beépített storefront flow
|
|
26
26
|
|
|
27
27
|
- store identity és capability bootstrap;
|
|
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
|
+
- kiemelt termékek a kezdőlapon a Core `featured-products` contractból, fallbackkel a legújabb termékekre;
|
|
31
|
+
- variáns- és mennyiségválasztás, minimum rendelési mennyiség és Add to Cart;
|
|
32
|
+
- mennyiségi / customer-group ársávok megjelenítése, aktuális sáv és következő kedvezményes küszöb;
|
|
33
|
+
- készlet/backorder állapot és készletértesítő feliratkozás;
|
|
31
34
|
- wishlist guest móddal, account merge-dzsel és saját wishlist oldallal;
|
|
32
35
|
- termékértékelések approved listával, aggregált értékeléssel és bejelentkezett ügyfél review beküldéssel;
|
|
36
|
+
- signed review-request oldal;
|
|
33
37
|
- közös cart state, cart drawer és teljes kosároldal;
|
|
34
38
|
- kupon hozzáadás/eltávolítás;
|
|
39
|
+
- shared cart és abandoned-cart recovery;
|
|
40
|
+
- admin/customer kosár automatikus resume belépés után;
|
|
41
|
+
- tartalmas guest cart + customer cart konfliktusnál explicit választás, csendes felülírás nélkül;
|
|
35
42
|
- region automatikus feloldása a Core alapértelmezett országa alapján;
|
|
36
43
|
- checkout contact + shipping/billing cím;
|
|
37
44
|
- Medusa shipping option választás;
|
|
@@ -41,12 +48,13 @@ szükséges. A payment/shipping/legal/SEO/analytics capability-k a `GET /store/c
|
|
|
41
48
|
- OTP SimplePay redirect + BACK return folytatás;
|
|
42
49
|
- banki átutalás / COD system-provider megkülönböztetés Core metadata markerrel;
|
|
43
50
|
- dinamikus legal dokumentumok kötelező elfogadása;
|
|
51
|
+
- Fogyasztó Barát provider embed a publikus legal contractból;
|
|
44
52
|
- order completion és rendelés-visszaigazolás;
|
|
45
53
|
- banki átutalási adatok a sikeroldalon;
|
|
46
|
-
- login,
|
|
54
|
+
- login, regisztráció és migrált fiók aktiválás;
|
|
47
55
|
- profil, e-mail verification/change, jelszócsere/reset és fióktörlés;
|
|
48
56
|
- címjegyzék CRUD;
|
|
49
|
-
- rendelési előzmények és
|
|
57
|
+
- rendelési előzmények, rendelésrészlet és fulfillment tracking link;
|
|
50
58
|
- return / exchange / claim self-service;
|
|
51
59
|
- CMS referencia UI: blog lista/detail, generic page detail és tudástár lista/detail;
|
|
52
60
|
- newsletter signup a footerben, double-opt-in confirm és leiratkozó oldalakkal;
|
|
@@ -54,27 +62,34 @@ szükséges. A payment/shipping/legal/SEO/analytics capability-k a `GET /store/c
|
|
|
54
62
|
- dinamikus lead/contact form privacy consenttel, honeypottal és opcionális Cloudflare Turnstile támogatással;
|
|
55
63
|
- globális loading/error/404/empty state-ek;
|
|
56
64
|
- toast, share, accessibility preferences, keyboard/focus UX és reduced-motion támogatás;
|
|
65
|
+
- first-party webshop analytics;
|
|
57
66
|
- Consent Mode v2, GA4/GTM és e-commerce tracking;
|
|
67
|
+
- Google Ads purchase conversion GTM dataLayer vagy közvetlen gtag flow-val, marketing consenttel;
|
|
58
68
|
- robots.txt / sitemap.xml proxy és Search Console verification.
|
|
59
69
|
|
|
60
70
|
## Customer-facing Core capability elv
|
|
61
71
|
|
|
62
|
-
A starter
|
|
72
|
+
A starter kötelező szabálya, hogy minden általános, customer-facing Core képességhez legyen design-semleges, ténylegesen működő referencia UI vagy route. Egy helper vagy dokumentált endpoint önmagában nem számít kész storefront-bekötésnek.
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
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.
|
|
75
|
+
|
|
76
|
+
Admin-, számlázási-, fulfillment-operátori-, audit-, integration-settings-, import/export- és más háttérképességekhez nem tartozik shopper UI, mert azok az Adminhoz, háttérfolyamathoz vagy külső fogyasztóhoz tartoznak.
|
|
77
|
+
|
|
78
|
+
A teljes besorolás a Core repo `docs/STOREFRONT-CAPABILITY-MATRIX.md` fájljában található.
|
|
65
79
|
|
|
66
80
|
## Authority boundary
|
|
67
81
|
|
|
68
82
|
A starter **nem** számol újra:
|
|
69
83
|
|
|
70
|
-
- árat;
|
|
84
|
+
- árat vagy ársávot;
|
|
71
85
|
- kosár végösszeget;
|
|
72
86
|
- adót;
|
|
73
87
|
- promóciót;
|
|
74
88
|
- shipping availability-t vagy árat;
|
|
75
89
|
- payment provider availability-t;
|
|
76
90
|
- after-sales jogosultságot;
|
|
77
|
-
- legal checkout-követelményt
|
|
91
|
+
- legal checkout-követelményt;
|
|
92
|
+
- customer cart lifecycle-t.
|
|
78
93
|
|
|
79
94
|
Ezek source of truth-ja a Medusa/Core backend. A frontend kizárólag a backend által visszaadott adatot jeleníti meg és a contract szerinti műveleteket indítja.
|
|
80
95
|
|
|
@@ -82,7 +97,7 @@ Ezek source of truth-ja a Medusa/Core backend. A frontend kizárólag a backend
|
|
|
82
97
|
|
|
83
98
|
### Stripe
|
|
84
99
|
|
|
85
|
-
A Core publikus
|
|
100
|
+
A Core publikus Stripe publishable key értékéből a starter létrehozza a Stripe Payment Elementet. Secret key és webhook secret soha nem jut a frontendbe.
|
|
86
101
|
|
|
87
102
|
### SimplePay
|
|
88
103
|
|
|
@@ -108,7 +123,7 @@ A Core publikus, secret-safe list endpointjait használjuk:
|
|
|
108
123
|
|
|
109
124
|
A Packeta official widget ügyfél-designban a checkout `packeta.pickupPoint` adapteréhez köthető. A starter nem teszi ki a backend Packeta API credentialt.
|
|
110
125
|
|
|
111
|
-
## Build ellenőrzés
|
|
126
|
+
## Build és parity ellenőrzés
|
|
112
127
|
|
|
113
128
|
A starter önálló app, ezért külön futtasd:
|
|
114
129
|
|
|
@@ -118,4 +133,12 @@ npm run typecheck
|
|
|
118
133
|
npm run build
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
A
|
|
136
|
+
A Core repo gyökerében a `npm run storefront:verify` statikus regressziós teszttel ellenőrzi, hogy a kötelező customer-facing Core capability-k tényleges UI/route bekötése megmaradjon. A `npm run core:verify` ezt is futtatja.
|
|
137
|
+
|
|
138
|
+
## Generator
|
|
139
|
+
|
|
140
|
+
A `@hszrdm/create-commerce` template preparation a teljes `starters/storefront-next` könyvtárat másolja. Nincs külön, könnyen eldriftelő storefront template, ezért az itt működő referencia-flow-k az újonnan generált webshopba automatikusan bekerülnek.
|
|
141
|
+
|
|
142
|
+
## Részletes funkcióleírások
|
|
143
|
+
|
|
144
|
+
A referenciafolyamatok, a saját analitika/Google consent különbsége, a kosármegosztás és az integrációs korlátok a [repository dokumentációjában](../../docs/README.md) találhatók. Ez a hivatkozás a Core forrásrepójára vonatkozik; a generált ügyfélprojekt nem másolja a teljes docs mappát.
|
|
@@ -29,7 +29,8 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
|
|
|
29
29
|
const routes = STOREFRONT_ROUTES[locale]
|
|
30
30
|
const config = await getCoreConfig()
|
|
31
31
|
const region = await checkoutApi(config).resolveDefaultRegion().catch(() => null)
|
|
32
|
-
const
|
|
32
|
+
const regionId = region ? stringValue(region.id) : undefined
|
|
33
|
+
const product = await getProductByHandle(handle, regionId, medusaLocale(locale)).then((result) => result.products[0]).catch(() => null)
|
|
33
34
|
if (!product) notFound()
|
|
34
35
|
const jsonLd = await structuredDataForEntity(config, { type: "product", handle, countryCode }).catch(() => null)
|
|
35
36
|
const variants = asRecords(product.variants)
|
|
@@ -75,7 +76,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
|
|
|
75
76
|
<div><p className="eyebrow">{copy.product}</p><h1 id="product-title">{title}</h1></div>
|
|
76
77
|
<VariantPriceDisplay initialPrice={price} initialCurrency={currency} locale={formatLocale} />
|
|
77
78
|
{product.description ? <p className="product-description">{stringValue(product.description)}</p> : null}
|
|
78
|
-
<AddToCart product={product} config={config} />
|
|
79
|
+
<AddToCart product={product} config={config} regionId={regionId} />
|
|
79
80
|
<div className="button-row product-secondary-actions">
|
|
80
81
|
{productId ? <WishlistButton productId={productId} /> : null}
|
|
81
82
|
<ShareButton title={title} text={stringValue(product.description)} />
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import { CmsEntryCard } from "@/components/cms-content"
|
|
2
|
-
import {
|
|
2
|
+
import { CmsTaxonomyFilters } from "@/components/cms-taxonomy-filters"
|
|
3
|
+
import { cmsConfig, listBlogPosts, listCmsTaxonomy } from "@/lib/core/cms"
|
|
3
4
|
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
4
|
-
import { blogPostPath, medusaLocale } from "@/lib/storefront-routes"
|
|
5
|
+
import { blogPostPath, medusaLocale, STOREFRONT_ROUTES } from "@/lib/storefront-routes"
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
type PageProps = {
|
|
8
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default async function BlogPage({ searchParams }: PageProps) {
|
|
12
|
+
const [locale, params] = await Promise.all([
|
|
13
|
+
requestStorefrontLocale(),
|
|
14
|
+
searchParams,
|
|
15
|
+
])
|
|
8
16
|
const english = locale === "en"
|
|
9
|
-
const
|
|
17
|
+
const apiLocale = medusaLocale(locale)
|
|
18
|
+
const category = firstParam(params.category)
|
|
19
|
+
const tag = firstParam(params.tag)
|
|
20
|
+
|
|
21
|
+
const [config, taxonomy, content] = await Promise.all([
|
|
22
|
+
cmsConfig().catch(() => null),
|
|
23
|
+
listCmsTaxonomy({ locale: apiLocale }).catch(() => ({ terms: [], count: 0 })),
|
|
24
|
+
listBlogPosts({
|
|
25
|
+
locale: apiLocale,
|
|
26
|
+
category: category || undefined,
|
|
27
|
+
tag: tag || undefined,
|
|
28
|
+
limit: 50,
|
|
29
|
+
}).catch(() => ({ entries: [], count: 0, limit: 50, offset: 0 })),
|
|
30
|
+
])
|
|
31
|
+
|
|
32
|
+
const enabledTaxonomies = new Set(config?.taxonomies || [])
|
|
33
|
+
const terms = taxonomy.terms.filter((term) => enabledTaxonomies.has(term.taxonomy))
|
|
34
|
+
const basePath = STOREFRONT_ROUTES[locale].blog
|
|
10
35
|
|
|
11
36
|
return (
|
|
12
37
|
<div className="stack page-section">
|
|
@@ -15,11 +40,24 @@ export default async function BlogPage() {
|
|
|
15
40
|
<h1>{english ? "Blog" : "Blog"}</h1>
|
|
16
41
|
<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
42
|
</header>
|
|
18
|
-
|
|
43
|
+
|
|
44
|
+
<CmsTaxonomyFilters
|
|
45
|
+
basePath={basePath}
|
|
46
|
+
terms={terms}
|
|
47
|
+
locale={locale}
|
|
48
|
+
activeCategory={category || undefined}
|
|
49
|
+
activeTag={tag || undefined}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
{content.entries.length ? (
|
|
19
53
|
<div className="cms-grid">
|
|
20
|
-
{entries.map((entry) => <CmsEntryCard key={entry.id} entry={entry} href={blogPostPath(locale, entry.slug)} locale={locale} />)}
|
|
54
|
+
{content.entries.map((entry) => <CmsEntryCard key={entry.id} entry={entry} href={blogPostPath(locale, entry.slug)} locale={locale} />)}
|
|
21
55
|
</div>
|
|
22
|
-
) : <div className="empty-state">{english ? "No published articles
|
|
56
|
+
) : <div className="empty-state">{english ? "No published articles match these filters." : "A kiválasztott szűrőkkel nincs publikált bejegyzés."}</div>}
|
|
23
57
|
</div>
|
|
24
58
|
)
|
|
25
59
|
}
|
|
60
|
+
|
|
61
|
+
function firstParam(value: string | string[] | undefined) {
|
|
62
|
+
return (Array.isArray(value) ? value[0] : value || "").trim()
|
|
63
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CartShareButton } from "@/components/cart-share-button"
|
|
1
2
|
import { CartView } from "@/components/cart-view"
|
|
2
3
|
import { getCoreConfig } from "@/lib/core/client"
|
|
3
4
|
|
|
@@ -7,6 +8,7 @@ export default async function CartPage() {
|
|
|
7
8
|
<div className="stack page-section narrow-page">
|
|
8
9
|
<div className="page-heading"><div><p className="eyebrow">Kosár</p><h1>A kosarad</h1><p className="muted">A végösszeg, kedvezmény és adó minden frissítés után közvetlenül a Medusa cartból érkezik.</p></div></div>
|
|
9
10
|
<section className="panel"><CartView config={config} /></section>
|
|
11
|
+
<CartShareButton config={config} />
|
|
10
12
|
</div>
|
|
11
13
|
)
|
|
12
14
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SharedCartView } from "@/components/shared-cart-view"
|
|
2
|
+
import { getCoreConfig } from "@/lib/core/client"
|
|
3
|
+
|
|
4
|
+
export default async function SharedCartPage({
|
|
5
|
+
params,
|
|
6
|
+
}: {
|
|
7
|
+
params: Promise<{ token: string }>
|
|
8
|
+
}) {
|
|
9
|
+
const [{ token }, config] = await Promise.all([params, getCoreConfig()])
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className="stack page-section narrow-page">
|
|
13
|
+
<div className="page-heading">
|
|
14
|
+
<div>
|
|
15
|
+
<p className="eyebrow">Kosármegosztás</p>
|
|
16
|
+
<h1>Megosztott kosár</h1>
|
|
17
|
+
<p className="muted">Nézd át az aktuális árakat és készletet, majd töltsd be a kosaradba.</p>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<section className="panel">
|
|
21
|
+
<SharedCartView token={token} config={config} />
|
|
22
|
+
</section>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { Suspense } from "react"
|
|
3
|
+
import { AbandonedCartRecovery } from "@/components/abandoned-cart-recovery"
|
|
4
|
+
import { getCoreConfig } from "@/lib/core/client"
|
|
5
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
title: "Kosár visszaállítása",
|
|
9
|
+
robots: {
|
|
10
|
+
index: false,
|
|
11
|
+
follow: false,
|
|
12
|
+
},
|
|
13
|
+
referrer: "no-referrer",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function CartRecoveryPage() {
|
|
17
|
+
const [config, locale] = await Promise.all([
|
|
18
|
+
getCoreConfig(),
|
|
19
|
+
requestStorefrontLocale(),
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="page-section narrow-page">
|
|
24
|
+
<Suspense
|
|
25
|
+
fallback={(
|
|
26
|
+
<div className="empty-state">
|
|
27
|
+
{locale === "en" ? "Restoring your cart…" : "A kosarad visszaállítása…"}
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
<AbandonedCartRecovery config={config} />
|
|
32
|
+
</Suspense>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { Suspense } from "react"
|
|
3
|
+
import { ReviewRequestForm } from "@/components/review-request-form"
|
|
4
|
+
import { getCoreConfig } from "@/lib/core/client"
|
|
5
|
+
|
|
6
|
+
export const metadata: Metadata = {
|
|
7
|
+
title: "Értékelés",
|
|
8
|
+
robots: {
|
|
9
|
+
index: false,
|
|
10
|
+
follow: false,
|
|
11
|
+
},
|
|
12
|
+
referrer: "no-referrer",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default async function ReviewRequestPage() {
|
|
16
|
+
const config = await getCoreConfig()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="page-section narrow-page">
|
|
20
|
+
<Suspense fallback={<div className="empty-state">Értékelési link ellenőrzése…</div>}>
|
|
21
|
+
<ReviewRequestForm config={config} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Metadata } from "next"
|
|
2
|
+
import { Suspense } from "react"
|
|
3
|
+
import { AccountActivationForm } from "@/components/account-activation-form"
|
|
4
|
+
import { getCoreConfig } from "@/lib/core/client"
|
|
5
|
+
import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
title: "Fiókaktiválás",
|
|
9
|
+
robots: {
|
|
10
|
+
index: false,
|
|
11
|
+
follow: false,
|
|
12
|
+
},
|
|
13
|
+
referrer: "no-referrer",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default async function AccountActivationPage() {
|
|
17
|
+
const [config, locale] = await Promise.all([
|
|
18
|
+
getCoreConfig(),
|
|
19
|
+
requestStorefrontLocale(),
|
|
20
|
+
])
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="page-section narrow-page">
|
|
24
|
+
<Suspense
|
|
25
|
+
fallback={(
|
|
26
|
+
<div className="empty-state">
|
|
27
|
+
{locale === "en" ? "Checking activation link…" : "Aktiváló link ellenőrzése…"}
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
<AccountActivationForm config={config} />
|
|
32
|
+
</Suspense>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|