@hszrdm/create-commerce 1.19.0 → 1.21.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 (27) hide show
  1. package/package.json +1 -1
  2. package/src/cli.mjs +2 -1
  3. package/templates/backend/.env.example +33 -217
  4. package/templates/backend/medusa-config.ts +14 -1
  5. package/templates/backend/package.json +1 -1
  6. package/templates/backend/src/scripts/core-init.ts +0 -5
  7. package/templates/storefront/package.json +5 -1
  8. package/templates/storefront/src/app/[countryCode]/products/[handle]/page.tsx +2 -2
  9. package/templates/storefront/src/app/globals.css +8 -0
  10. package/templates/storefront/src/app/layout.tsx +6 -0
  11. package/templates/storefront/src/components/account-access-gate.tsx +88 -0
  12. package/templates/storefront/src/components/account-dashboard.tsx +56 -19
  13. package/templates/storefront/src/components/account-verification-panel.tsx +145 -0
  14. package/templates/storefront/src/components/checkout-flow.tsx +83 -30
  15. package/templates/storefront/src/components/product-card.tsx +2 -1
  16. package/templates/storefront/src/lib/core/account.ts +49 -8
  17. package/templates/storefront/src/lib/core/checkout-feedback-state.ts +15 -0
  18. package/templates/storefront/src/lib/core/checkout-payment-choices.ts +38 -0
  19. package/templates/storefront/src/lib/core/checkout-summary.ts +120 -0
  20. package/templates/storefront/src/lib/core/checkout.ts +25 -19
  21. package/templates/storefront/src/lib/core/commerce.ts +14 -0
  22. package/templates/storefront/src/lib/core/use-checkout-feedback.ts +53 -0
  23. package/templates/storefront/tests/account-verification.test.mjs +40 -0
  24. package/templates/storefront/tests/checkout-feedback.test.mjs +27 -0
  25. package/templates/storefront/tests/checkout-payment-choices.test.mjs +59 -0
  26. package/templates/storefront/tests/checkout-summary.test.mjs +168 -0
  27. package/templates/storefront/tests/product-image.test.mjs +31 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hszrdm/create-commerce",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "Create a complete HSZRDM Commerce webshop project.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/src/cli.mjs CHANGED
@@ -287,7 +287,8 @@ function configureProject(root, settings) {
287
287
  ".DS_Store",
288
288
  "*.log",
289
289
  "backups/",
290
- ".core/deployment-environment",
290
+ ".core/",
291
+ "backend/.core/",
291
292
  "",
292
293
  ].join("\n"),
293
294
  )
@@ -7,9 +7,13 @@
7
7
  # Required for every shop: DATABASE_URL, JWT_SECRET, COOKIE_SECRET,
8
8
  # STORE_CORS, ADMIN_CORS, AUTH_CORS.
9
9
  #
10
- # External integrations are preferably configured in HSZRDM Commerce Admin
11
- # (Settings -> Integrációk). Environment variables below are fallback/bootstrap
12
- # options only. Do not copy unused integration secrets into production.
10
+ # Merchant credentials and customer-specific settings belong only in encrypted
11
+ # Admin Integration Settings, not in generated .env files.
12
+ # Configure optional integrations after startup in Medusa Admin.
13
+ # Deployment transport, infrastructure and webhook security remain ENV-only.
14
+ # Carrier transport endpoints, sandbox modes and timeouts belong only in the
15
+ # deployment ENV. Prices and free-shipping thresholds belong in Medusa Shipping Options.
16
+ # Never put real customer secrets into generated templates or source control.
13
17
 
14
18
  # -----------------------------------------------------------------------------
15
19
  # Runtime / infrastructure
@@ -37,9 +41,9 @@ AUTH_CORS=http://localhost:3000,http://localhost:9000,http://localhost:7001
37
41
  # Encrypts secrets stored by Settings -> Integrációk.
38
42
  INTEGRATION_SETTINGS_ENCRYPTION_KEY=replace-with-at-least-32-random-characters
39
43
  INTEGRATION_SETTINGS_FILE=
40
- # Shared inbound shipping callback secret. Required only for enabled callback-based providers.
41
- # Security PR #53 requires 32-256 random characters; weaker configuration disables callbacks.
42
- # Generate a unique secret per deployment: openssl rand -hex 32
44
+ # Inbound FOXPOST/GLS status callbacks: deployment ENV only, never Admin DB.
45
+ # Keep off until the callback provider uses the same 32-256 character secret.
46
+ SHIPPING_WEBHOOK_ENABLED=false
43
47
  SHIPPING_WEBHOOK_SECRET=
44
48
 
45
49
  # -----------------------------------------------------------------------------
@@ -82,42 +86,11 @@ OPENAI_BASE_URL=https://api.openai.com/v1
82
86
  # Email Center / transactional email
83
87
  # -----------------------------------------------------------------------------
84
88
  EMAIL_CENTER_ENABLED=true
85
- # SMTP is the only supported email transport. This legacy selector is optional.
89
+ # SMTP is the only supported email transport. Configure and enable it in Admin.
90
+ # SMTP credentials, sender identities and event switches are DB-only.
86
91
  EMAIL_PROVIDER=smtp
87
- # New stores have no SMTP host yet; enable after configuring and verifying SMTP in Admin.
88
- SMTP_ENABLED=false
89
92
  EMAIL_FROM="Example Store <system@example.com>"
90
93
  EMAIL_REPLY_TO=support@example.com
91
- SMTP_HOST=
92
- SMTP_PORT=587
93
- # true for implicit TLS (typically 465), false for STARTTLS (typically 587)
94
- SMTP_SECURE=false
95
- SMTP_REQUIRE_TLS=true
96
- SMTP_USER=
97
- SMTP_PASSWORD=
98
- SMTP_FROM="Example Store <system@example.com>"
99
- SMTP_REPLY_TO=
100
- # Opcionális, a SMTP-szolgáltatónál engedélyezett alternatív feladócímek (Send As)
101
- SMTP_ALLOWED_FROM_ADDRESSES=
102
-
103
- EMAIL_CUSTOMER_WELCOME_ENABLED=
104
- EMAIL_REGISTRATION_VERIFICATION_ENABLED=
105
- EMAIL_PASSWORD_RESET_ENABLED=
106
- EMAIL_CHANGE_VERIFICATION_ENABLED=
107
- EMAIL_PASSWORD_CHANGED_ENABLED=
108
- EMAIL_CHANGED_ENABLED=
109
- EMAIL_ACCOUNT_DELETED_ENABLED=
110
- EMAIL_ORDER_PLACED_ENABLED=
111
- EMAIL_PAYMENT_CAPTURED_ENABLED=
112
- EMAIL_FULFILLMENT_CREATED_ENABLED=
113
- EMAIL_SHIPMENT_CREATED_ENABLED=
114
- EMAIL_ORDER_CANCELED_ENABLED=
115
- EMAIL_PAYMENT_REFUNDED_ENABLED=
116
- EMAIL_AFTER_SALES_SUBMITTED_ENABLED=
117
- EMAIL_AFTER_SALES_APPROVED_ENABLED=
118
- EMAIL_AFTER_SALES_REJECTED_ENABLED=
119
- EMAIL_RETURN_INSTRUCTIONS_ENABLED=
120
- EMAIL_RETURN_RECEIVED_ENABLED=
121
94
 
122
95
  EMAIL_LOGO_URL=
123
96
  EMAIL_TRACKING_ENABLED=true
@@ -209,56 +182,11 @@ SEO_ALLOW_INDEXING=
209
182
  SEO_ROBOTS_DISALLOW=
210
183
 
211
184
  # -----------------------------------------------------------------------------
212
- # Payment fallback/bootstrap settings
213
- # Prefer Admin -> Settings -> Integrációk.
214
- # -----------------------------------------------------------------------------
215
- STRIPE_ENABLED=false
216
- STRIPE_API_KEY=
217
- STRIPE_WEBHOOK_SECRET=
218
- STRIPE_WEBHOOK_URL=http://localhost:9000/hooks/payment/stripe_stripe
219
-
220
- SIMPLEPAY_ENABLED=false
221
- SIMPLEPAY_SANDBOX=true
222
- SIMPLEPAY_HUF_MERCHANT=
223
- SIMPLEPAY_HUF_SECRET_KEY=
224
- SIMPLEPAY_EUR_MERCHANT=
225
- SIMPLEPAY_EUR_SECRET_KEY=
226
- SIMPLEPAY_USD_MERCHANT=
227
- SIMPLEPAY_USD_SECRET_KEY=
228
- SIMPLEPAY_RETURN_BASE_URL=http://localhost:9000/store/simplepay/back
229
- SIMPLEPAY_STOREFRONT_URL=http://localhost:3000
230
- SIMPLEPAY_TIMEOUT_MS=15000
231
-
232
- BANK_TRANSFER_ENABLED=false
233
- BANK_TRANSFER_BANK_NAME=
234
- BANK_TRANSFER_ACCOUNT_HOLDER=
235
- BANK_TRANSFER_ACCOUNT_NUMBER=
236
- BANK_TRANSFER_IBAN=
237
- BANK_TRANSFER_BIC=
238
- BANK_TRANSFER_DUE_DAYS=3
239
- BANK_TRANSFER_REFERENCE_PREFIX=
240
- BANK_TRANSFER_EMAIL_ENABLED=true
241
- BANK_TRANSFER_BILLINGO_PROFORMA=false
242
- BANK_TRANSFER_BILLINGO_PROFORMA_SEND=true
243
-
244
- # -----------------------------------------------------------------------------
245
- # Billingo fallback/bootstrap settings
185
+ # Provider deployment defaults; merchant payment and Billingo integration
186
+ # fields are configured in Admin -> Settings -> Integrációk.
246
187
  # -----------------------------------------------------------------------------
247
- BILLINGO_ENABLED=false
248
- BILLINGO_API_URL=https://api.billingo.hu/v3
249
- BILLINGO_API_KEY=
250
- BILLINGO_DOCUMENT_BLOCK_ID=
251
- BILLINGO_BANK_ACCOUNT_ID=
252
188
  BILLINGO_PAYMENT_METHOD=stripe
253
- BILLINGO_LANGUAGE=hu
254
- BILLINGO_ELECTRONIC=true
255
- BILLINGO_DUE_DAYS=0
256
189
  BILLINGO_UNIT=db
257
- BILLINGO_TIMEOUT_MS=30000
258
- BILLINGO_AUTO_INVOICE=true
259
- BILLINGO_AUTO_SEND=true
260
- BILLINGO_AUTO_CANCEL_ON_ORDER_CANCELED=false
261
- BILLINGO_INVOICE_TRIGGER=payment_captured
262
190
 
263
191
  # -----------------------------------------------------------------------------
264
192
  # Background carrier status sync: FOXPOST, GLS, Packeta, Csomagpiac every 30 minutes.
@@ -267,35 +195,22 @@ BILLINGO_INVOICE_TRIGGER=payment_captured
267
195
  SHIPPING_STATUS_SYNC_ENABLED=true
268
196
  SHIPPING_STATUS_SYNC_BATCH_SIZE=100
269
197
 
270
- # Shipping fallback/bootstrap settings
271
- # Prefer Admin -> Settings -> Integrációk.
198
+ # Carrier technical URL, mode, feed and timeout: deployment ENV only.
199
+ # Merchant credentials: encrypted Admin DB. Rates: Medusa Shipping Options.
272
200
  # -----------------------------------------------------------------------------
273
- FOXPOST_ENABLED=false
274
- # FOXPOST_API_URL üresen: a sandbox kapcsoló alapján automatikus teszt/éles végpont.
201
+ # FOXPOST transport: operator-owned ENV only, never editable in Admin.
202
+ # A blank FOXPOST_SANDBOX follows APP_ENV (production=false, other=true).
275
203
  # Egyedi környezetben itt felülírható.
276
204
  FOXPOST_API_URL=
277
- FOXPOST_API_USERNAME=
278
- FOXPOST_API_PASSWORD=
279
- FOXPOST_API_KEY=
280
- FOXPOST_SANDBOX=true
205
+ FOXPOST_SANDBOX=
281
206
  # Fixed FOXPOST parcel size sent during Create Fulfillment (XS/S/M/L/XL); default M.
282
207
  FOXPOST_PACKAGE_SIZE=M
283
208
  FOXPOST_LOCKER_FEED_URL=https://cdn.foxpost.hu/foxplus.json
284
- FOXPOST_LOCKER_PRICE_HUF=1290
285
- FOXPOST_HOME_DELIVERY_PRICE_HUF=1990
286
- FOXPOST_FREE_SHIPPING_THRESHOLD_HUF=
287
209
  FOXPOST_TIMEOUT_MS=10000
288
210
 
289
- GLS_ENABLED=false
290
- GLS_API_URL=https://api.test.mygls.hu
291
- GLS_USERNAME=
292
- GLS_PASSWORD=
293
- GLS_CLIENT_NUMBER=
294
- GLS_SANDBOX=true
211
+ GLS_API_URL=https://api.mygls.hu
212
+ GLS_SANDBOX=false
295
213
  GLS_DELIVERY_POINTS_URL=https://map.gls-hungary.com/data/deliveryPoints/hu.json
296
- GLS_POINT_PRICE_HUF=1490
297
- GLS_HOME_DELIVERY_PRICE_HUF=1990
298
- GLS_FREE_SHIPPING_THRESHOLD_HUF=
299
214
  GLS_TIMEOUT_MS=15000
300
215
  GLS_PRINTER_TYPE=A4_2x2
301
216
  # Optional absolute PRIVATE directory for original GLS PDF labels.
@@ -303,144 +218,45 @@ GLS_PRINTER_TYPE=A4_2x2
303
218
  # Must survive deploy and be included in filesystem backups. Never expose via /static.
304
219
  GLS_PRIVATE_LABEL_DIR=
305
220
  GLS_WEBSHOP_ENGINE=HSZRDM Commerce
306
- GLS_PICKUP_NAME=Example Store
307
- GLS_PICKUP_STREET=
308
- GLS_PICKUP_HOUSE_NUMBER=
309
- GLS_PICKUP_HOUSE_NUMBER_INFO=
310
- GLS_PICKUP_CITY=
311
- GLS_PICKUP_POSTAL_CODE=
312
- GLS_PICKUP_COUNTRY_CODE=HU
313
- GLS_PICKUP_CONTACT_NAME=
314
- GLS_PICKUP_PHONE=
315
- GLS_PICKUP_EMAIL=
316
221
 
317
- PACKETA_ENABLED=false
318
222
  PACKETA_API_URL=https://www.zasilkovna.cz/api/rest
319
- PACKETA_API_KEY=
320
- PACKETA_API_PASSWORD=
321
- PACKETA_SENDER_INDICATION=
322
- PACKETA_HOME_CARRIER_ID=
323
- PACKETA_POINT_PRICE_HUF=1290
324
- PACKETA_HOME_DELIVERY_PRICE_HUF=1990
325
- PACKETA_FREE_SHIPPING_THRESHOLD_HUF=
223
+ # Optional JSON map of destination country to contracted Packeta HOME carrier ID.
224
+ # Technical, fixed at server deployment; not mutable from Admin.
326
225
  PACKETA_TIMEOUT_MS=15000
327
- PACKETA_DEFAULT_WEIGHT_KG=1
328
- PACKETA_LABEL_FORMAT=A6 on A6
329
- PACKETA_LANGUAGE=hu
330
226
  # Signing key for signed Packeta callbacks. Confirm provider compatibility;
331
227
  # raw body and timestamp are mandatory. Rotate separately from other webhook secrets.
332
228
  PACKETA_WEBHOOK_SIGNING_KEY=
333
229
 
334
- DPD_ENABLED=false
335
- DPD_SANDBOX=true
230
+ # DPD technical settings are deployment-controlled. Blank sandbox follows APP_ENV.
231
+ # Shipping prices are fixed Medusa Shipping Options, not DPD ENV fields.
232
+ DPD_SANDBOX=
336
233
  DPD_API_URL=
337
- DPD_TOKEN=
338
- DPD_BU_CODE=
339
- DPD_CUSTOMER_ID=
340
- DPD_SENDER_ADDRESS_ID=
341
- DPD_HOME_SERVICE_CODE=
342
- DPD_COD_PAYMENT_TYPE=Cash
343
- DPD_PUDO_SOURCE=disabled
344
- DPD_PUDO_SERVICE_CODE=
345
234
  DPD_PUDO_LOCATOR_URL=
346
- DPD_PUDO_DELIS_ID=
347
- DPD_PUDO_PASSWORD=
348
- DPD_PUDO_MESSAGE_LANGUAGE=en_US
349
- DPD_POINT_PRICE_HUF=1490
350
- DPD_HOME_DELIVERY_PRICE_HUF=1990
351
- DPD_FREE_SHIPPING_THRESHOLD_HUF=
352
235
  DPD_TIMEOUT_MS=15000
353
- DPD_DEFAULT_WEIGHT_KG=1
354
- DPD_LABEL_SIZE=A6
355
- DPD_PRINT_FORMAT=PDF
356
- DPD_LABEL_DPI=203
357
236
  DPD_STATUSDATA_ENABLED=false
358
- DPD_STATUSDATA_FTP_HOST=
359
- DPD_STATUSDATA_FTP_PORT=21
360
- DPD_STATUSDATA_FTP_USERNAME=
361
- DPD_STATUSDATA_FTP_PASSWORD=
362
- DPD_STATUSDATA_FTP_DIR=
363
- DPD_STATUSDATA_FTP_TIMEOUT_MS=15000
364
237
 
365
- MPL_ENABLED=false
366
- MPL_SANDBOX=true
238
+ # MPL sandbox mode is ENV-only; blank follows APP_ENV (production = live).
239
+ MPL_SANDBOX=
367
240
  MPL_API_URL=
368
241
  MPL_TRACKING_API_URL=
369
242
  MPL_PUSH_TRACKING_API_URL=
370
243
  MPL_PUSH_TRACKING_STREAM_URL=https://net.posta.hu/tracking/public/tracking/TrackingData
371
244
  MPL_TOKEN_URL=
372
- MPL_API_KEY=
373
- MPL_API_SECRET=
374
- MPL_AGREEMENT=
375
- MPL_ACCOUNT_NO=
376
- MPL_SENDER_NAME=Example Store
377
- MPL_SENDER_EMAIL=orders@example.com
378
- MPL_SENDER_PHONE=
379
- MPL_SENDER_POST_CODE=
380
- MPL_SENDER_CITY=
381
- MPL_SENDER_ADDRESS=
382
- MPL_DEVELOPER=HSZRDM Commerce
383
- MPL_BASIC_SERVICE_CODE=
384
- MPL_EXTRA_SERVICES=
385
- MPL_PAYMENT_MODE=
386
- MPL_TAG=
387
- MPL_HOME_DELIVERY_MODE=HA
388
- MPL_POINT_PRICE_HUF=1290
389
- MPL_HOME_DELIVERY_PRICE_HUF=1990
390
- MPL_FREE_SHIPPING_THRESHOLD_HUF=
391
245
  MPL_TIMEOUT_MS=15000
392
- MPL_DEFAULT_WEIGHT_KG=1
393
- MPL_LABEL_TYPE=A6
394
- MPL_PACKAGE_RETENTION=5
395
246
  MPL_TRACKING_ENABLED=false
396
247
  MPL_PUSH_TRACKING_ENABLED=false
397
- MPL_TRACKING_ACCOUNT_CODE=
398
248
  MPL_PUSH_READ_WINDOW_MS=8000
399
249
  MPL_TRACKING_LANGUAGE=hu
400
250
 
401
- CSOMAGPIAC_ENABLED=false
402
- CSOMAGPIAC_LIVE=false
251
+ # Csomagpiac transport is operator-owned; merchant fields and service
252
+ # profiles are configured in the encrypted Admin DB.
253
+ # Leave CSOMAGPIAC_LIVE unset to follow APP_ENV automatically.
254
+ CSOMAGPIAC_LIVE=
403
255
  CSOMAGPIAC_API_URL=
404
- CSOMAGPIAC_TOKEN=
405
- CSOMAGPIAC_USERNAME=
406
- CSOMAGPIAC_PASSWORD=
407
- CSOMAGPIAC_PICKUP_POINT_ID=
408
- CSOMAGPIAC_PRICE_HUF=1990
409
- CSOMAGPIAC_FREE_SHIPPING_THRESHOLD_HUF=
410
256
  CSOMAGPIAC_TIMEOUT_MS=15000
411
- CSOMAGPIAC_DEFAULT_WEIGHT_KG=1
412
- CSOMAGPIAC_LABEL_FORMAT=A4
413
257
 
414
258
  # -----------------------------------------------------------------------------
415
- # Product feeds / trust widgets - optional
416
- # -----------------------------------------------------------------------------
417
- GOOGLE_MERCHANT_ENABLED=false
418
- GOOGLE_MERCHANT_COUNTRY_CODE=HU
419
- GOOGLE_MERCHANT_CURRENCY_CODE=HUF
420
- GOOGLE_MERCHANT_LOCALE=hu-HU
421
- GOOGLE_MERCHANT_STOREFRONT_URL=
422
- GOOGLE_MERCHANT_PRODUCT_PATH_TEMPLATE=/{locale}/{products_segment}/{handle}?v_id={variant_id}
423
- GOOGLE_MERCHANT_SALES_CHANNEL_ID=
424
- GOOGLE_MERCHANT_FEED_TITLE=
425
- GOOGLE_MERCHANT_FEED_DESCRIPTION=
426
- GOOGLE_MERCHANT_DEFAULT_BRAND=
427
- GOOGLE_MERCHANT_DEFAULT_CONDITION=new
428
- GOOGLE_MERCHANT_INCLUDE_OUT_OF_STOCK=true
429
-
430
- ARUKERESO_ENABLED=false
431
- ARUKERESO_STOREFRONT_URL=
432
- ARUKERESO_PRODUCT_PATH_TEMPLATE=/hu/termekek/{handle}?v_id={variant_id}
433
- ARUKERESO_SALES_CHANNEL_ID=
434
- ARUKERESO_DEFAULT_MANUFACTURER=
435
- ARUKERESO_USE_SKU_AS_PRODUCT_NUMBER=false
436
- ARUKERESO_INCLUDE_OUT_OF_STOCK=true
437
- ARUKERESO_DEFAULT_DELIVERY_TIME=
438
- ARUKERESO_DEFAULT_DELIVERY_COST=
439
-
440
- FOGYASZTOBARAT_ENABLED=false
441
- # Admin integration: paste full provider <script> snippet (legacy ID still supported)
442
- FOGYASZTOBARAT_EMBED_CODE=
443
- FOGYASZTOBARAT_DATA_ID=
259
+ # Product feed and legal/trust widget credentials and options are Admin DB only.
444
260
 
445
261
  # -----------------------------------------------------------------------------
446
262
  # Generator only (not used by a running shop)
@@ -1,3 +1,4 @@
1
+ import { basename, dirname, resolve } from "node:path"
1
2
  import { loadEnv } from "@medusajs/framework/utils"
2
3
  import { createHszrdmCommerceConfig } from "@hszrdm/core/config"
3
4
 
@@ -6,7 +7,19 @@ const envFile =
6
7
  ? "test"
7
8
  : process.env.NODE_ENV || "development"
8
9
 
9
- loadEnv(envFile, process.cwd())
10
+ // In a production build, Medusa starts inside backend/.medusa/server.
11
+ // Read the original backend env file, not a generated directory that is
12
+ // replaced on every build. Development and test working directories are kept.
13
+ const cwd = process.cwd()
14
+ const runningFromBuiltServer =
15
+ basename(cwd) === "server" &&
16
+ basename(dirname(cwd)) === ".medusa"
17
+
18
+ const envRoot = runningFromBuiltServer
19
+ ? resolve(cwd, "../..")
20
+ : cwd
21
+
22
+ loadEnv(envFile, envRoot)
10
23
 
11
24
  const baseConfig = createHszrdmCommerceConfig()
12
25
  const configuredPlugins = (
@@ -23,7 +23,7 @@
23
23
  "start:prod": "cd .medusa/server && medusa start"
24
24
  },
25
25
  "dependencies": {
26
- "@hszrdm/core": "1.19.0",
26
+ "@hszrdm/core": "1.21.0",
27
27
  "@medusajs/admin-sdk": "2.22.2",
28
28
  "@medusajs/cli": "2.22.2",
29
29
  "@medusajs/draft-order": "2.22.2",
@@ -1,7 +1,6 @@
1
1
  import type { ExecArgs } from "@medusajs/framework/types"
2
2
  import coreInit from "@hszrdm/core/scripts/core-init"
3
3
  import ensureLocales from "@hszrdm/core/scripts/ensure-locales"
4
- import ensureShipping from "@hszrdm/core/scripts/ensure-shipping"
5
4
  import { normalizeMedusaExecArgs } from "@hszrdm/core/scripts/exec-args"
6
5
 
7
6
  export default async function runCoreInit(params: ExecArgs) {
@@ -28,8 +27,4 @@ export default async function runCoreInit(params: ExecArgs) {
28
27
  args: [],
29
28
  })
30
29
 
31
- await ensureShipping({
32
- ...params,
33
- args: [],
34
- })
35
30
  }
@@ -14,7 +14,11 @@
14
14
  "test:stripe": "node --experimental-strip-types --test tests/stripe-checkout-phase.test.mjs",
15
15
  "test:company-tax": "node --experimental-strip-types --test tests/company-tax.test.mjs",
16
16
  "test:ga4": "node --experimental-strip-types --test tests/ga4-bootstrap.test.mjs",
17
- "test:seo": "node --experimental-strip-types --test tests/technical-seo.test.mjs"
17
+ "test:seo": "node --experimental-strip-types --test tests/technical-seo.test.mjs",
18
+ "test:account-verification": "node --test tests/account-verification.test.mjs",
19
+ "test:product-images": "node --experimental-strip-types --test tests/product-image.test.mjs",
20
+ "test:checkout-summary": "node --experimental-strip-types --test tests/checkout-summary.test.mjs",
21
+ "test:checkout-payment-choices": "node --experimental-strip-types --test tests/checkout-payment-choices.test.mjs"
18
22
  },
19
23
  "dependencies": {
20
24
  "@stripe/react-stripe-js": "7.0.0",
@@ -11,7 +11,7 @@ import { WishlistButton } from "@/components/wishlist-button"
11
11
  import { getCoreConfig } from "@/lib/core/client"
12
12
  import { checkoutApi } from "@/lib/core/checkout"
13
13
  import { getProductByHandle } from "@/lib/core/catalog"
14
- import { asRecords, productVariantCurrency, productVariantPriceBreakdown, stringValue } from "@/lib/core/commerce"
14
+ import { asRecords, productImageUrl, productVariantCurrency, productVariantPriceBreakdown, stringValue } from "@/lib/core/commerce"
15
15
  import { googleAdsRemarketingItemFromProduct } from "@/lib/core/google-ads"
16
16
  import { metadataFromCore, serializeJsonLd, structuredDataForEntity } from "@/lib/core/seo"
17
17
  import { ecommerceItemFromProduct } from "@/lib/core/tracking"
@@ -49,7 +49,7 @@ export default async function ProductPage({ params }: { params: Promise<{ countr
49
49
  const images = asRecords(product.images)
50
50
  const productId = stringValue(product.id)
51
51
  const title = stringValue(product.title)
52
- const thumbnail = stringValue(product.thumbnail || images[0]?.url)
52
+ const thumbnail = productImageUrl(product)
53
53
  const formatLocale = locale === "en" ? "en-US" : "hu-HU"
54
54
  const galleryImages = [
55
55
  ...(thumbnail ? [{ id: "thumbnail", url: thumbnail, alt: title }] : []),
@@ -138,6 +138,14 @@ input[readonly] { background: var(--surface-soft); color: var(--muted); }
138
138
 
139
139
  .checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
140
140
  .checkout-summary { position: sticky; top: 18px; }
141
+ .checkout-summary-heading { margin: 0; font-size: 1.2rem; line-height: 1.25; font-weight: 850; }
142
+ .checkout-summary-group { display: flex; flex-direction: column; gap: 9px; padding-top: 14px; border-top: 1px solid var(--line); }
143
+ .checkout-summary-group h3 { margin: 0 0 2px; font-size: .93rem; font-weight: 800; }
144
+ .checkout-summary-group .summary-line { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
145
+ .checkout-summary-group .summary-line span:last-child { color: var(--text); }
146
+ .checkout-summary-group .checkout-summary-gross { color: var(--text); font-weight: 750; }
147
+ .checkout-summary-cod { padding-top: 14px; border-top: 1px solid var(--line); font-weight: 750; font-variant-numeric: tabular-nums; }
148
+ .checkout-summary .summary-total { font-variant-numeric: tabular-nums; }
141
149
 
142
150
  /* Stripe SDK and Payment Element both have an explicit loading stage.
143
151
  Keep Elements mounted (for onReady/confirmPayment) underneath the loader. */
@@ -8,6 +8,7 @@ import { AnalyticsGate } from "@/components/analytics"
8
8
  import { ArukeresoBacklink } from "@/components/arukereso-backlink"
9
9
  import { ArukeresoTrustedShopWidget } from "@/components/arukereso-trusted-shop-widget"
10
10
  import { CartProvider } from "@/components/cart-provider"
11
+ import { AccountAccessGate } from "@/components/account-access-gate"
11
12
  import { ConsentBanner } from "@/components/consent-banner"
12
13
  import { CustomerCartResumeGate } from "@/components/customer-cart-resume-gate"
13
14
  import { GoogleAdsCartRemarketing } from "@/components/google-ads-cart-remarketing"
@@ -70,6 +71,10 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
70
71
  <AccessibilityPreferencesProvider>
71
72
  <ToastProvider locale={locale}>
72
73
  <CartProvider config={config}>
74
+ <AccountAccessGate
75
+ config={config}
76
+ restrictedChildren={<main id="main-content" className="shell main" tabIndex={-1}>{children}</main>}
77
+ >
73
78
  <GoogleAdsCartRemarketing googleAds={config.marketing.google_ads} />
74
79
  <a className="skip-link" href="#main-content">
75
80
  {en ? "Skip to content" : "Ugrás a tartalomhoz"}
@@ -107,6 +112,7 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
107
112
  {fogyasztobarat.enabled && fogyasztobarat.placement === "global" ? (
108
113
  <FogyasztobaratEmbed embed={fogyasztobarat} />
109
114
  ) : null}
115
+ </AccountAccessGate>
110
116
  </CartProvider>
111
117
  </ToastProvider>
112
118
  </AccessibilityPreferencesProvider>
@@ -0,0 +1,88 @@
1
+ "use client"
2
+
3
+ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react"
4
+ import { usePathname, useRouter } from "next/navigation"
5
+ import {
6
+ ACCOUNT_AUTH_CHANGED_EVENT,
7
+ accountApi,
8
+ isAccountEmailVerified,
9
+ } from "@/lib/core/account"
10
+ import { CoreApiError } from "@/lib/core/client"
11
+ import type { CoreConfig } from "@/lib/core/types"
12
+
13
+ type AccountAccessState = "guest" | "checking" | "verified" | "unverified" | "error"
14
+
15
+ /**
16
+ * Public pages stay SSR-rendered for search engines. Once hydrated, a signed-in
17
+ * unverified customer is redirected to the profile-only verification view.
18
+ * Authorization itself is enforced on the Core Store API, never by this UI.
19
+ */
20
+ export function AccountAccessGate({
21
+ config,
22
+ children,
23
+ restrictedChildren,
24
+ }: {
25
+ config: CoreConfig
26
+ children: ReactNode
27
+ restrictedChildren: ReactNode
28
+ }) {
29
+ const api = useMemo(() => accountApi(config), [config])
30
+ const pathname = usePathname()
31
+ const router = useRouter()
32
+ const [state, setState] = useState<AccountAccessState>("guest")
33
+ const requestId = useRef(0)
34
+
35
+ const refresh = useCallback(async () => {
36
+ const current = ++requestId.current
37
+ try {
38
+ const { customer } = await api.profile()
39
+ if (requestId.current !== current) return
40
+ setState(isAccountEmailVerified(customer) ? "verified" : "unverified")
41
+ } catch (error) {
42
+ if (requestId.current !== current) return
43
+ if (error instanceof CoreApiError && error.status === 401) {
44
+ setState("guest")
45
+ } else {
46
+ setState("error")
47
+ }
48
+ }
49
+ }, [api])
50
+
51
+ useEffect(() => {
52
+ void refresh()
53
+ const authChanged = () => {
54
+ setState("checking")
55
+ void refresh()
56
+ }
57
+ window.addEventListener(ACCOUNT_AUTH_CHANGED_EVENT, authChanged)
58
+ return () => {
59
+ requestId.current++
60
+ window.removeEventListener(ACCOUNT_AUTH_CHANGED_EVENT, authChanged)
61
+ }
62
+ }, [refresh])
63
+
64
+ useEffect(() => {
65
+ if (state === "unverified" && pathname !== "/account") {
66
+ router.replace("/account")
67
+ }
68
+ }, [state, pathname, router])
69
+
70
+ if (state === "checking" || (state === "unverified" && pathname !== "/account")) {
71
+ return <main className="shell main" role="status">A fiók ellenőrzése…</main>
72
+ }
73
+
74
+ if (state === "error") {
75
+ return (
76
+ <main className="shell main">
77
+ <section className="panel stack">
78
+ <h1>A fiók állapota nem ellenőrizhető</h1>
79
+ <p>Próbáld meg újra. A megerősítés ellenőrzése nélkül a fiók nem használható.</p>
80
+ <button className="button" type="button" onClick={() => { setState("checking"); void refresh() }}>Újrapróbálkozás</button>
81
+ </section>
82
+ </main>
83
+ )
84
+ }
85
+
86
+ if (state === "unverified") return <>{restrictedChildren}</>
87
+ return <>{children}</>
88
+ }