@hszrdm/create-commerce 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/cli.mjs +3 -0
  3. package/templates/backend/.env.example +24 -1
  4. package/templates/backend/package.json +8 -7
  5. package/templates/backend/scripts/sync-env-example.mjs +55 -0
  6. package/templates/backend/scripts/verify-env-contract.mjs +6 -5
  7. package/templates/backend/src/scripts/verify-runtime-modules.ts +1 -0
  8. package/templates/storefront/.env.example +6 -0
  9. package/templates/storefront/.env.local +3 -0
  10. package/templates/storefront/package.json +2 -1
  11. package/templates/storefront/src/app/[countryCode]/categories/[handle]/page.tsx +5 -1
  12. package/templates/storefront/src/app/[countryCode]/products/[handle]/page.tsx +14 -5
  13. package/templates/storefront/src/app/[countryCode]/products/page.tsx +10 -1
  14. package/templates/storefront/src/app/account/orders/[id]/page.tsx +17 -2
  15. package/templates/storefront/src/app/checkout/success/page.tsx +5 -0
  16. package/templates/storefront/src/app/documents/page.tsx +27 -0
  17. package/templates/storefront/src/app/layout.tsx +8 -1
  18. package/templates/storefront/src/components/add-to-cart.tsx +16 -14
  19. package/templates/storefront/src/components/arukereso-backlink.tsx +43 -0
  20. package/templates/storefront/src/components/arukereso-trusted-shop-widget.tsx +81 -0
  21. package/templates/storefront/src/components/arukereso-trusted-shop.tsx +71 -0
  22. package/templates/storefront/src/components/carrier-pickup-adapter.ts +93 -0
  23. package/templates/storefront/src/components/carrier-pickup-dialog.tsx +119 -0
  24. package/templates/storefront/src/components/carrier-pickup-map.tsx +200 -0
  25. package/templates/storefront/src/components/cart-view.tsx +4 -2
  26. package/templates/storefront/src/components/category-documents.tsx +18 -0
  27. package/templates/storefront/src/components/checkout-analytics.tsx +22 -0
  28. package/templates/storefront/src/components/checkout-flow.tsx +75 -115
  29. package/templates/storefront/src/components/document-list.tsx +47 -0
  30. package/templates/storefront/src/components/google-ads-cart-remarketing.tsx +71 -0
  31. package/templates/storefront/src/components/google-ads-purchase.tsx +37 -0
  32. package/templates/storefront/src/components/price-display.tsx +39 -0
  33. package/templates/storefront/src/components/product-card.tsx +7 -6
  34. package/templates/storefront/src/components/product-documents.tsx +18 -0
  35. package/templates/storefront/src/components/product-view-tracker.tsx +17 -2
  36. package/templates/storefront/src/components/reorder-button.tsx +74 -0
  37. package/templates/storefront/src/components/variant-price-display.tsx +7 -11
  38. package/templates/storefront/src/lib/core/catalog.ts +6 -2
  39. package/templates/storefront/src/lib/core/commerce.ts +51 -0
  40. package/templates/storefront/src/lib/core/documents.ts +37 -0
  41. package/templates/storefront/src/lib/core/google-ads.ts +154 -7
  42. package/templates/storefront/src/lib/core/reorder.ts +26 -0
  43. package/templates/storefront/src/lib/storefront-routes.ts +3 -0
  44. package/templates/storefront/src/proxy.ts +2 -0
  45. package/templates/storefront/tests/carrier-pickup-adapter.test.mjs +69 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hszrdm/create-commerce",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Create a complete HSZRDM Commerce webshop project.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/src/cli.mjs CHANGED
@@ -318,6 +318,9 @@ function configureBackend(root, settings) {
318
318
  AUTH_CORS: `${settings.storefrontUrl},${settings.backendUrl}`,
319
319
  INTEGRATION_SETTINGS_ENCRYPTION_KEY: settings.integrationEncryptionKey,
320
320
  SHIPPING_WEBHOOK_SECRET: settings.shippingWebhookSecret,
321
+ FOXPOST_PACKAGE_SIZE: "M",
322
+ SHIPPING_STATUS_SYNC_ENABLED: "true",
323
+ SHIPPING_STATUS_SYNC_BATCH_SIZE: "100",
321
324
  STORE_NAME: settings.storeName,
322
325
  STORE_SLUG: settings.slug,
323
326
  STORE_LOCALE: settings.locale,
@@ -238,22 +238,32 @@ BILLINGO_LANGUAGE=hu
238
238
  BILLINGO_ELECTRONIC=true
239
239
  BILLINGO_DUE_DAYS=0
240
240
  BILLINGO_UNIT=db
241
- BILLINGO_TIMEOUT_MS=15000
241
+ BILLINGO_TIMEOUT_MS=30000
242
242
  BILLINGO_AUTO_INVOICE=true
243
243
  BILLINGO_AUTO_SEND=true
244
244
  BILLINGO_AUTO_CANCEL_ON_ORDER_CANCELED=false
245
245
  BILLINGO_INVOICE_TRIGGER=payment_captured
246
246
 
247
247
  # -----------------------------------------------------------------------------
248
+ # Background carrier status sync: FOXPOST, GLS, Packeta, Csomagpiac every 30 minutes.
249
+ # MPL uses its hourly PULL job when MPL_TRACKING_ENABLED=true;
250
+ # DPD uses its dedicated Statusdata FTP job when DPD_STATUSDATA_ENABLED=true.
251
+ SHIPPING_STATUS_SYNC_ENABLED=true
252
+ SHIPPING_STATUS_SYNC_BATCH_SIZE=100
253
+
248
254
  # Shipping fallback/bootstrap settings
249
255
  # Prefer Admin -> Settings -> Integrációk.
250
256
  # -----------------------------------------------------------------------------
251
257
  FOXPOST_ENABLED=false
258
+ # FOXPOST_API_URL üresen: a sandbox kapcsoló alapján automatikus teszt/éles végpont.
259
+ # Egyedi környezetben itt felülírható.
252
260
  FOXPOST_API_URL=
253
261
  FOXPOST_API_USERNAME=
254
262
  FOXPOST_API_PASSWORD=
255
263
  FOXPOST_API_KEY=
256
264
  FOXPOST_SANDBOX=true
265
+ # Fixed FOXPOST parcel size sent during Create Fulfillment (XS/S/M/L/XL); default M.
266
+ FOXPOST_PACKAGE_SIZE=M
257
267
  FOXPOST_LOCKER_FEED_URL=https://cdn.foxpost.hu/foxplus.json
258
268
  FOXPOST_LOCKER_PRICE_HUF=1290
259
269
  FOXPOST_HOME_DELIVERY_PRICE_HUF=1990
@@ -366,6 +376,19 @@ MPL_TRACKING_ACCOUNT_CODE=
366
376
  MPL_PUSH_READ_WINDOW_MS=8000
367
377
  MPL_TRACKING_LANGUAGE=hu
368
378
 
379
+ CSOMAGPIAC_ENABLED=false
380
+ CSOMAGPIAC_LIVE=false
381
+ CSOMAGPIAC_API_URL=
382
+ CSOMAGPIAC_TOKEN=
383
+ CSOMAGPIAC_USERNAME=
384
+ CSOMAGPIAC_PASSWORD=
385
+ CSOMAGPIAC_PICKUP_POINT_ID=
386
+ CSOMAGPIAC_PRICE_HUF=1990
387
+ CSOMAGPIAC_FREE_SHIPPING_THRESHOLD_HUF=
388
+ CSOMAGPIAC_TIMEOUT_MS=15000
389
+ CSOMAGPIAC_DEFAULT_WEIGHT_KG=1
390
+ CSOMAGPIAC_LABEL_FORMAT=A4
391
+
369
392
  # -----------------------------------------------------------------------------
370
393
  # Product feeds / trust widgets - optional
371
394
  # -----------------------------------------------------------------------------
@@ -15,19 +15,20 @@
15
15
  "core:backup": "node ./scripts/core-backup.mjs --project-dir .",
16
16
  "core:restore": "node ./scripts/core-restore.mjs --project-dir .",
17
17
  "storefront:key": "npm run prepare:project && medusa exec ./src/scripts/create-storefront-key.ts",
18
+ "runtime:verify": "npm run prepare:project && medusa exec ./src/scripts/verify-runtime-modules.ts",
18
19
  "bootstrap:assert": "npm run prepare:project && medusa exec ./src/scripts/verify-bootstrap.ts",
19
20
  "db:migrate": "npm run prepare:project && medusa db:migrate",
20
21
  "db:generate": "npm run prepare:project && medusa db:generate",
21
22
  "start:prod": "cd .medusa/server && medusa start"
22
23
  },
23
24
  "dependencies": {
24
- "@hszrdm/core": "1.7.0",
25
- "@medusajs/admin-sdk": "2.21.2",
26
- "@medusajs/cli": "2.21.2",
27
- "@medusajs/draft-order": "2.21.2",
28
- "@medusajs/framework": "2.21.2",
29
- "@medusajs/medusa": "2.21.2",
30
- "@medusajs/ui": "4.2.6",
25
+ "@hszrdm/core": "1.9.0",
26
+ "@medusajs/admin-sdk": "2.22.2",
27
+ "@medusajs/cli": "2.22.2",
28
+ "@medusajs/draft-order": "2.22.2",
29
+ "@medusajs/framework": "2.22.2",
30
+ "@medusajs/medusa": "2.22.2",
31
+ "@medusajs/ui": "4.2.9",
31
32
  "react": "^18.3.1",
32
33
  "react-dom": "^18.3.1",
33
34
  "react-router-dom": "7.18.2"
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync, writeFileSync, copyFileSync, chmodSync, statSync } from "node:fs"
3
+ import { resolve } from "node:path"
4
+ import { fileURLToPath } from "node:url"
5
+
6
+ /** Idempotent: only append keys missing from the actual env; never override secrets. */
7
+ export function syncMissingEnvKeys(examplePath, envPath) {
8
+ if (!existsSync(examplePath)) throw new Error("Missing .env.example: " + examplePath)
9
+ if (!existsSync(envPath)) throw new Error("Missing existing .env file: " + envPath)
10
+ const template = readFileSync(examplePath, "utf8")
11
+ const current = readFileSync(envPath, "utf8")
12
+ const extract = (source, name) => {
13
+ const values = new Map()
14
+ for (const raw of source.split(/\r?\n/)) {
15
+ const match = raw.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/)
16
+ if (!match) continue
17
+ if (values.has(match[1])) throw new Error("Duplicate " + name + " env key: " + match[1])
18
+ values.set(match[1], match[2])
19
+ }
20
+ return values
21
+ }
22
+ const exampleKeys = extract(template, "example")
23
+ const currentKeys = extract(current, "current")
24
+ const missing = [...exampleKeys.entries()].filter(([key]) => !currentKeys.has(key))
25
+ if (!missing.length) return { added: [], changed: false }
26
+ // Only the original .env is modified, never the canonical template.
27
+ // A backup is made before any modification. Do not log configuration values.
28
+ const backup = envPath + ".bak"
29
+ copyFileSync(envPath, backup)
30
+ chmodSync(backup, 0o600)
31
+ const additions = missing.map(([key, value]) => key + "=" + value).join("\n")
32
+ const updated = current + (current.endsWith("\n") ? "" : "\n") +
33
+ "\n# Missing keys automatically added from .env.example\n" + additions + "\n"
34
+ writeFileSync(envPath, updated, { mode: statSync(envPath).mode & 0o777 })
35
+ return { added: missing.map(([key]) => key), changed: true, backup }
36
+ }
37
+
38
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
39
+ const example = process.argv[2]
40
+ const env = process.argv[3]
41
+ if (!example || !env) {
42
+ console.error("Usage: node sync-env-example.mjs <example-file> <existing-env-file>")
43
+ process.exitCode = 64
44
+ } else {
45
+ try {
46
+ const result = syncMissingEnvKeys(example, env)
47
+ console.log(result.changed
48
+ ? "Environment synchronized: " + result.added.length + " missing keys added; backup created."
49
+ : "Environment already contains all example keys.")
50
+ } catch (error) {
51
+ console.error(error instanceof Error ? error.message : String(error))
52
+ process.exitCode = 1
53
+ }
54
+ }
55
+ }
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { existsSync, readFileSync } from "node:fs"
4
4
  import { resolve } from "node:path"
5
+ import { syncMissingEnvKeys } from "./sync-env-example.mjs"
5
6
 
6
7
  const backendRoot = resolve(import.meta.dirname, "..")
7
8
  const examplePath = resolve(backendRoot, ".env.example")
@@ -15,16 +16,16 @@ if (!existsSync(envPath)) {
15
16
  throw new Error(`Hiányzik a backend .env: ${envPath}`)
16
17
  }
17
18
 
19
+ const syncResult = syncMissingEnvKeys(examplePath, envPath)
20
+ if (syncResult.changed) console.log(`Added ${syncResult.added.length} missing keys from .env.example; previous env backed up.`)
21
+
18
22
  const exampleKeys = envKeys(readFileSync(examplePath, "utf8"))
19
23
  const envKeysActual = envKeys(readFileSync(envPath, "utf8"))
20
24
 
21
25
  const missing = exampleKeys.filter((key) => !envKeysActual.includes(key))
22
- const extra = envKeysActual.filter((key) => !exampleKeys.includes(key))
23
-
24
- if (missing.length || extra.length) {
26
+ if (missing.length) {
25
27
  const details = [
26
28
  missing.length ? `Hiányzik a .env-ből: ${missing.join(", ")}` : "",
27
- extra.length ? `Nincs benne a .env.example-ban: ${extra.join(", ")}` : "",
28
29
  ].filter(Boolean)
29
30
 
30
31
  throw new Error(
@@ -32,7 +33,7 @@ if (missing.length || extra.length) {
32
33
  )
33
34
  }
34
35
 
35
- console.log(`✅ Env contract rendben: ${exampleKeys.length} kulcs 1:1 megegyezik.`)
36
+ console.log(`✅ Env contract rendben: ${exampleKeys.length} template kulcs elérhető; egyedi .env kulcsok megőrizve.`)
36
37
 
37
38
  function envKeys(source) {
38
39
  const keys = []
@@ -0,0 +1 @@
1
+ export { default } from "@hszrdm/core/scripts/verify-runtime-modules"
@@ -3,3 +3,9 @@
3
3
  MEDUSA_BACKEND_URL=http://localhost:9000
4
4
  NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000
5
5
  NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=
6
+
7
+ # Public widget key from Packeta Client (never use Packeta API password here).
8
+ NEXT_PUBLIC_PACKETA_WIDGET_API_KEY=
9
+
10
+ # Browser-restricted Google Maps API key for the MPL PostaPont legacy map.
11
+ NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=
@@ -0,0 +1,3 @@
1
+ MEDUSA_BACKEND_URL=http://localhost:9000
2
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9000
3
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_ebe31eec729cb9d2f557923b99c76c765eece8378eec3bf566c6ef527fd8419d
@@ -6,7 +6,8 @@
6
6
  "dev": "next dev",
7
7
  "build": "next build",
8
8
  "start": "next start",
9
- "typecheck": "tsc --noEmit"
9
+ "typecheck": "tsc --noEmit",
10
+ "test:pickup": "node --experimental-strip-types --test tests/carrier-pickup-adapter.test.mjs"
10
11
  },
11
12
  "dependencies": {
12
13
  "@stripe/react-stripe-js": "7.0.0",
@@ -1,4 +1,5 @@
1
1
  import { notFound } from "next/navigation"
2
+ import { CategoryDocuments } from "@/components/category-documents"
2
3
  import { ProductCard } from "@/components/product-card"
3
4
  import { getCoreConfig } from "@/lib/core/client"
4
5
  import { checkoutApi } from "@/lib/core/checkout"
@@ -22,14 +23,16 @@ export default async function CategoryPage({ params }: { params: Promise<{ count
22
23
  const config = await getCoreConfig()
23
24
  const category = await getCategoryByHandle(handle, apiLocale).then((result) => result.product_categories[0]).catch(() => null)
24
25
  if (!category) notFound()
26
+ const categoryId = stringValue(category.id)
25
27
  const [jsonLd, region] = await Promise.all([
26
28
  structuredDataForEntity(config, { type: "category", handle, countryCode }).catch(() => null),
27
29
  checkoutApi(config).resolveDefaultRegion().catch(() => null),
28
30
  ])
29
31
  const products = await listProducts({
30
- categoryId: stringValue(category.id),
32
+ categoryId,
31
33
  order: "-created_at",
32
34
  regionId: region ? stringValue(region.id) : undefined,
35
+ countryCode: config.store.default_country,
33
36
  locale: apiLocale,
34
37
  limit: 48,
35
38
  }).then((result) => result.products).catch(() => [])
@@ -39,6 +42,7 @@ export default async function CategoryPage({ params }: { params: Promise<{ count
39
42
  {jsonLd ? <script className="jsonld" type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} /> : null}
40
43
  <div className="page-heading"><div><p className="eyebrow">{copy.category}</p><h1>{stringValue(category.name)}</h1>{category.description ? <p className="muted">{stringValue(category.description)}</p> : null}</div></div>
41
44
  {products.length ? <div className="product-grid">{products.map((product) => <ProductCard config={config} product={product} locale={locale} key={stringValue(product.id)} />)}</div> : <div className="empty-state">{copy.emptyCategory}</div>}
45
+ {categoryId ? <CategoryDocuments categoryId={categoryId} locale={apiLocale} /> : null}
42
46
  </div>
43
47
  )
44
48
  }
@@ -1,6 +1,7 @@
1
1
  import { notFound } from "next/navigation"
2
2
  import { AddToCart } from "@/components/add-to-cart"
3
3
  import { Breadcrumbs } from "@/components/breadcrumbs"
4
+ import { ProductDocuments } from "@/components/product-documents"
4
5
  import { ProductGallery } from "@/components/product-gallery"
5
6
  import { ProductReviews } from "@/components/product-reviews"
6
7
  import { ProductViewTracker } from "@/components/product-view-tracker"
@@ -10,7 +11,8 @@ import { WishlistButton } from "@/components/wishlist-button"
10
11
  import { getCoreConfig } from "@/lib/core/client"
11
12
  import { checkoutApi } from "@/lib/core/checkout"
12
13
  import { getProductByHandle } from "@/lib/core/catalog"
13
- import { asRecords, productVariantCurrency, productVariantPrice, stringValue } from "@/lib/core/commerce"
14
+ import { asRecords, productVariantCurrency, productVariantPriceBreakdown, stringValue } from "@/lib/core/commerce"
15
+ import { googleAdsRemarketingItemFromProduct } from "@/lib/core/google-ads"
14
16
  import { metadataFromCore, structuredDataForEntity } from "@/lib/core/seo"
15
17
  import { ecommerceItemFromProduct } from "@/lib/core/tracking"
16
18
  import { storefrontCopy } from "@/lib/storefront-copy"
@@ -30,14 +32,20 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
30
32
  const config = await getCoreConfig()
31
33
  const region = await checkoutApi(config).resolveDefaultRegion().catch(() => null)
32
34
  const regionId = region ? stringValue(region.id) : undefined
33
- const product = await getProductByHandle(handle, regionId, medusaLocale(locale)).then((result) => result.products[0]).catch(() => null)
35
+ const product = await getProductByHandle(
36
+ handle,
37
+ regionId,
38
+ medusaLocale(locale),
39
+ config.store.default_country,
40
+ ).then((result) => result.products[0]).catch(() => null)
34
41
  if (!product) notFound()
35
42
  const jsonLd = await structuredDataForEntity(config, { type: "product", handle, countryCode }).catch(() => null)
36
43
  const variants = asRecords(product.variants)
37
44
  const first = variants[0]
38
- const price = productVariantPrice(first)
45
+ const price = productVariantPriceBreakdown(first, config.store.default_currency)
39
46
  const currency = productVariantCurrency(first, config.store.default_currency)
40
47
  const tracking = ecommerceItemFromProduct({ product, variant: first, currency })
48
+ const remarketingItem = googleAdsRemarketingItemFromProduct({ product, variant: first }) || tracking.item
41
49
  const images = asRecords(product.images)
42
50
  const productId = stringValue(product.id)
43
51
  const title = stringValue(product.title)
@@ -57,7 +65,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
57
65
  return (
58
66
  <div className="stack page-section">
59
67
  {jsonLd ? <script className="jsonld" type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} /> : null}
60
- <ProductViewTracker analytics={config.analytics} item={tracking.item} currency={tracking.currency} value={tracking.value} />
68
+ <ProductViewTracker analytics={config.analytics} googleAds={config.marketing.google_ads} item={tracking.item} googleAdsItem={remarketingItem} currency={tracking.currency} value={tracking.value} />
61
69
  <Breadcrumbs
62
70
  label={locale === "en" ? "Breadcrumb" : "Morzsanavigáció"}
63
71
  items={[
@@ -74,7 +82,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
74
82
  />
75
83
  <section className="product-copy stack" aria-labelledby="product-title">
76
84
  <div><p className="eyebrow">{copy.product}</p><h1 id="product-title">{title}</h1></div>
77
- <VariantPriceDisplay initialPrice={price} initialCurrency={currency} locale={formatLocale} />
85
+ <VariantPriceDisplay initialPrice={price} locale={formatLocale} />
78
86
  {product.description ? <p className="product-description">{stringValue(product.description)}</p> : null}
79
87
  <AddToCart product={product} config={config} regionId={regionId} />
80
88
  <div className="button-row product-secondary-actions">
@@ -84,6 +92,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
84
92
  <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>
85
93
  </section>
86
94
  </div>
95
+ {productId ? <ProductDocuments productId={productId} locale={medusaLocale(locale)} /> : null}
87
96
  {productId ? <ProductReviews productId={productId} locale={locale} /> : null}
88
97
  </div>
89
98
  )
@@ -23,7 +23,16 @@ export default async function ProductsPage({ params, searchParams }: { params: P
23
23
  const region = await checkoutApi(config).resolveDefaultRegion().catch(() => null)
24
24
  const regionId = region ? stringValue(region.id) : undefined
25
25
  const [{ products, count = 0 }, categoryResult] = await Promise.all([
26
- listProducts({ q: query.q, categoryId: query.category, order: sortMap[query.sort || "newest"] || sortMap.newest, regionId, locale: apiLocale, limit, offset: (page - 1) * limit }),
26
+ listProducts({
27
+ q: query.q,
28
+ categoryId: query.category,
29
+ order: sortMap[query.sort || "newest"] || sortMap.newest,
30
+ regionId,
31
+ countryCode: config.store.default_country,
32
+ locale: apiLocale,
33
+ limit,
34
+ offset: (page - 1) * limit,
35
+ }),
27
36
  listCategories(apiLocale).catch(() => ({ product_categories: [] })),
28
37
  ])
29
38
  const categories = categoryResult.product_categories
@@ -1,8 +1,23 @@
1
1
  import { OrderDetail } from "@/components/order-detail"
2
+ import { ReorderButton } from "@/components/reorder-button"
2
3
  import { getCoreConfig } from "@/lib/core/client"
4
+ import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
3
5
 
4
6
  export default async function AccountOrderPage({ params }: { params: Promise<{ id: string }> }) {
5
7
  const { id } = await params
6
- const config = await getCoreConfig()
7
- return <div className="page-section"><OrderDetail config={config} orderId={id} /></div>
8
+ const [config, locale] = await Promise.all([
9
+ getCoreConfig(),
10
+ requestStorefrontLocale(),
11
+ ])
12
+ return (
13
+ <div className="stack page-section">
14
+ <div className="button-row">
15
+ <ReorderButton orderId={id} />
16
+ <span className="muted small">
17
+ {locale === "en" ? "Using current prices and availability." : "Aktuális árakkal és készlettel."}
18
+ </span>
19
+ </div>
20
+ <OrderDetail config={config} orderId={id} />
21
+ </div>
22
+ )
8
23
  }
@@ -1,5 +1,7 @@
1
1
  import Link from "next/link"
2
2
  import { notFound } from "next/navigation"
3
+ import { ArukeresoTrustedShop } from "@/components/arukereso-trusted-shop"
4
+ import { GoogleAdsPurchase } from "@/components/google-ads-purchase"
3
5
  import { checkoutApi } from "@/lib/core/checkout"
4
6
  import { endpoint, getCoreConfig, medusaFetch } from "@/lib/core/client"
5
7
  import { asRecords, formatMoney, isRecord, stringValue, type JsonRecord } from "@/lib/core/commerce"
@@ -37,6 +39,9 @@ export default async function CheckoutSuccessPage({ searchParams }: { searchPara
37
39
 
38
40
  return (
39
41
  <div className="stack page-section narrow-page">
42
+ <GoogleAdsPurchase googleAds={config.marketing.google_ads} order={order} />
43
+ <ArukeresoTrustedShop orderId={orderId} />
44
+
40
45
  <section className="success-hero panel stack">
41
46
  <div className="success-icon">✓</div>
42
47
  <div>
@@ -0,0 +1,27 @@
1
+ import { DocumentList } from "@/components/document-list"
2
+ import { getDocuments } from "@/lib/core/documents"
3
+ import { requestStorefrontLocale } from "@/lib/storefront-locale-server"
4
+ import { medusaLocale } from "@/lib/storefront-routes"
5
+
6
+ export async function generateMetadata() {
7
+ const locale = await requestStorefrontLocale()
8
+ return { title: locale === "en" ? "Documents" : "Dokumentumok" }
9
+ }
10
+
11
+ export default async function DocumentsPage() {
12
+ const locale = await requestStorefrontLocale()
13
+ const apiLocale = medusaLocale(locale)
14
+ const en = locale === "en"
15
+ const payload = await getDocuments({ locale: apiLocale }).catch(() => ({ documents: [], count: 0 }))
16
+
17
+ return (
18
+ <div className="stack page-section">
19
+ <div className="stack" style={{ gap: ".5rem" }}>
20
+ <p className="eyebrow">{en ? "Downloads" : "Letöltések"}</p>
21
+ <h1>{en ? "Documents" : "Dokumentumok"}</h1>
22
+ <p className="muted">{en ? "Documents published by the store in one place." : "A webáruház által közzétett dokumentumok egy helyen."}</p>
23
+ </div>
24
+ <DocumentList documents={payload.documents} locale={apiLocale} />
25
+ </div>
26
+ )
27
+ }
@@ -5,9 +5,12 @@ import type { Metadata } from "next"
5
5
  import Link from "next/link"
6
6
  import { AccessibilityPreferencesControl, AccessibilityPreferencesProvider } from "@/components/accessibility-preferences"
7
7
  import { AnalyticsGate } from "@/components/analytics"
8
+ import { ArukeresoBacklink } from "@/components/arukereso-backlink"
9
+ import { ArukeresoTrustedShopWidget } from "@/components/arukereso-trusted-shop-widget"
8
10
  import { CartProvider } from "@/components/cart-provider"
9
11
  import { ConsentBanner } from "@/components/consent-banner"
10
12
  import { CustomerCartResumeGate } from "@/components/customer-cart-resume-gate"
13
+ import { GoogleAdsCartRemarketing } from "@/components/google-ads-cart-remarketing"
11
14
  import { NewsletterSignup } from "@/components/newsletter-signup"
12
15
  import { StorefrontHeader } from "@/components/storefront-header"
13
16
  import { ToastProvider } from "@/components/toast-provider"
@@ -58,6 +61,7 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
58
61
  <AccessibilityPreferencesProvider>
59
62
  <ToastProvider locale={locale}>
60
63
  <CartProvider config={config}>
64
+ <GoogleAdsCartRemarketing googleAds={config.marketing.google_ads} />
61
65
  <a className="skip-link" href="#main-content">
62
66
  {en ? "Skip to content" : "Ugrás a tartalomhoz"}
63
67
  </a>
@@ -72,11 +76,14 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
72
76
  <div>
73
77
  <strong>{config.store.name}</strong>
74
78
  <p className="muted small">Powered by HSZRDM Commerce</p>
79
+ <ArukeresoTrustedShopWidget />
80
+ <ArukeresoBacklink />
75
81
  </div>
76
82
  <nav className="footer-nav" aria-label={en ? "Footer navigation" : "Lábléc navigáció"}>
77
83
  <Link href={routes.products}>{en ? "Products" : "Termékek"}</Link>
78
- <Link href={routes.blog}>{en ? "Blog" : "Blog"}</Link>
84
+ <Link href={routes.blog}>Blog</Link>
79
85
  <Link href={routes.knowledgeBase}>{en ? "Knowledge base" : "Tudástár"}</Link>
86
+ <Link href={routes.documents}>{en ? "Documents" : "Dokumentumok"}</Link>
80
87
  <Link href={routes.cmsPages}>{en ? "Pages" : "Oldalak"}</Link>
81
88
  <Link href={routes.quoteRequest}>{en ? "Request a quote" : "Ajánlatkérés"}</Link>
82
89
  <Link href={routes.contact}>{en ? "Contact" : "Kapcsolat"}</Link>
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useEffect, useMemo, useState } from "react"
4
4
  import { usePathname } from "next/navigation"
5
+ import { PriceDisplay } from "./price-display"
5
6
  import { QuantityStepper } from "./quantity-stepper"
6
7
  import { TierProgressHint } from "./tier-progress-hint"
7
8
  import { useToast } from "./toast-provider"
@@ -12,7 +13,7 @@ import {
12
13
  formatMoney,
13
14
  numberValue,
14
15
  productVariantCurrency,
15
- productVariantPrice,
16
+ productVariantPriceBreakdown,
16
17
  stringValue,
17
18
  } from "@/lib/core/commerce"
18
19
  import { humanizeStorefrontError } from "@/lib/core/form-ux"
@@ -53,7 +54,7 @@ export function AddToCart({
53
54
  const { addItem, mutating } = useCart()
54
55
  const { showToast } = useToast()
55
56
  const selected = variants.find((variant) => stringValue(variant.id) === variantId) || variants[0]
56
- const price = productVariantPrice(selected)
57
+ const price = productVariantPriceBreakdown(selected, config.store.default_currency)
57
58
  const currency = productVariantCurrency(selected, config.store.default_currency)
58
59
  const formatLocale = en ? "en-US" : "hu-HU"
59
60
  const minQuantity = variantMinimum(selected, productMetadata)
@@ -106,8 +107,7 @@ export function AddToCart({
106
107
  onChange={(event) => {
107
108
  const nextId = event.target.value
108
109
  const next = variants.find((variant) => stringValue(variant.id) === nextId)
109
- const nextPrice = productVariantPrice(next)
110
- const nextCurrency = productVariantCurrency(next, config.store.default_currency)
110
+ const nextPrice = productVariantPriceBreakdown(next, config.store.default_currency)
111
111
  setVariantId(nextId)
112
112
  setQuantity(variantMinimum(next, productMetadata))
113
113
  setMessage(null)
@@ -119,20 +119,22 @@ export function AddToCart({
119
119
  variantId: nextId,
120
120
  imageUrl: variantImageUrl(next),
121
121
  price: nextPrice,
122
- currency: nextCurrency,
123
122
  },
124
123
  }))
125
124
  }
126
125
  }}
127
126
  >
128
- {variants.map((variant) => (
129
- <option key={stringValue(variant.id)} value={stringValue(variant.id)}>
130
- {stringValue(variant.title || variant.sku || variant.id)}
131
- {Number.isFinite(productVariantPrice(variant))
132
- ? ` – ${formatMoney(productVariantPrice(variant), productVariantCurrency(variant, currency), formatLocale)}`
133
- : ""}
134
- </option>
135
- ))}
127
+ {variants.map((variant) => {
128
+ const variantPrice = productVariantPriceBreakdown(variant, config.store.default_currency)
129
+ return (
130
+ <option key={stringValue(variant.id)} value={stringValue(variant.id)}>
131
+ {stringValue(variant.title || variant.sku || variant.id)}
132
+ {Number.isFinite(variantPrice.amount)
133
+ ? ` – ${formatMoney(variantPrice.grossAmount, variantPrice.currency, formatLocale)}`
134
+ : ""}
135
+ </option>
136
+ )
137
+ })}
136
138
  </select>
137
139
  </label>
138
140
  ) : null}
@@ -154,7 +156,7 @@ export function AddToCart({
154
156
  </div>
155
157
  <div className="buy-price">
156
158
  <span className="muted">{en ? "Selected price" : "Kiválasztott ár"}</span>
157
- <strong>{Number.isFinite(price) ? formatMoney(price, currency, formatLocale) : "—"}</strong>
159
+ {Number.isFinite(price.amount) ? <PriceDisplay price={price} locale={formatLocale} compact /> : <strong>—</strong>}
158
160
  </div>
159
161
  </div>
160
162
 
@@ -0,0 +1,43 @@
1
+ "use client"
2
+
3
+ import { useEffect, useState } from "react"
4
+ import { medusaFetch } from "@/lib/core/client"
5
+
6
+ type BacklinkResponse = {
7
+ enabled: boolean
8
+ code: string
9
+ }
10
+
11
+ export function ArukeresoBacklink() {
12
+ const [code, setCode] = useState("")
13
+
14
+ useEffect(() => {
15
+ let cancelled = false
16
+
17
+ void (async () => {
18
+ try {
19
+ const data = await medusaFetch<BacklinkResponse>("/store/arukereso/backlink", {
20
+ cache: "no-store",
21
+ })
22
+ if (cancelled || !data.enabled || !data.code) return
23
+ setCode(data.code)
24
+ } catch {
25
+ // A backlink hibája nem zavarhatja a storefront működését.
26
+ }
27
+ })()
28
+
29
+ return () => {
30
+ cancelled = true
31
+ }
32
+ }, [])
33
+
34
+ if (!code) return null
35
+
36
+ return (
37
+ <div
38
+ data-arukereso-backlink
39
+ suppressHydrationWarning
40
+ dangerouslySetInnerHTML={{ __html: code }}
41
+ />
42
+ )
43
+ }