@shopbite-de/storefront 2.6.0 → 2.7.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 (469) hide show
  1. package/.env.example +13 -0
  2. package/.github/workflows/ci.yaml +2 -0
  3. package/CLAUDE.md +54 -30
  4. package/GLOSSARY.md +327 -0
  5. package/README.md +5 -6
  6. package/app/app.vue +50 -40
  7. package/app/components/Address/Card.vue +2 -2
  8. package/app/components/Address/Detail.vue +17 -45
  9. package/app/components/Address/Form.vue +38 -26
  10. package/app/components/BranchSwitch.vue +40 -0
  11. package/app/components/Cart/Bar.vue +9 -9
  12. package/app/components/Cart/Item.vue +27 -36
  13. package/app/components/Cart/QuickView.vue +17 -16
  14. package/app/components/Cart/Upsell.vue +19 -27
  15. package/app/components/Category/Breadcrumb.vue +3 -8
  16. package/app/components/Category/FilterGroup.vue +6 -6
  17. package/app/components/Category/Listing.vue +44 -66
  18. package/app/components/Checkout/DeliveryTimeSelect.vue +21 -48
  19. package/app/components/Checkout/OrderMessage.vue +29 -0
  20. package/app/components/Checkout/OrdererAddress.vue +40 -0
  21. package/app/components/Checkout/PaymentAndDelivery.vue +40 -35
  22. package/app/components/Checkout/Summary.vue +89 -74
  23. package/app/components/Checkout/VoucherInput.vue +8 -8
  24. package/app/components/Contact/Form.vue +97 -13
  25. package/app/components/Footer.vue +2 -2
  26. package/app/components/Header.vue +9 -9
  27. package/app/components/Home/Categories.vue +13 -17
  28. package/app/components/Home/Facts.vue +6 -4
  29. package/app/components/Home/Hero.vue +1 -1
  30. package/app/components/Home/Highlights.vue +8 -8
  31. package/app/components/Home/Restaurant.vue +2 -2
  32. package/app/components/Menu/BonCard.vue +21 -37
  33. package/app/components/Menu/CartPanel.vue +2 -2
  34. package/app/components/Menu/CategoryIndex.vue +8 -12
  35. package/app/components/Menu/OrderMode.vue +2 -2
  36. package/app/components/Menu/SectionHeader.vue +6 -10
  37. package/app/components/Navigation/MobileTop.vue +12 -20
  38. package/app/components/Order/Confirmation.vue +10 -10
  39. package/app/components/Order/Detail.vue +47 -49
  40. package/app/components/Product/Configurator.vue +46 -30
  41. package/app/components/Product/CrossSelling.vue +56 -71
  42. package/app/components/Product/DeselectIngredient.vue +10 -11
  43. package/app/components/Product/Detail.vue +62 -55
  44. package/app/components/Product/FoodLabels.vue +4 -9
  45. package/app/components/Product/QuickView.vue +22 -30
  46. package/app/components/User/Detail.vue +20 -43
  47. package/app/components/User/LoginForm.vue +11 -17
  48. package/app/components/User/RegistrationForm.vue +3 -3
  49. package/app/components/Wishlist.vue +99 -106
  50. package/app/components/WishlistSaveButton.vue +17 -9
  51. package/app/composables/useAccountAddresses.ts +89 -0
  52. package/app/composables/useAccountOrders.ts +35 -0
  53. package/app/composables/useAddToCart.ts +63 -110
  54. package/app/composables/useCartData.ts +55 -0
  55. package/app/composables/useCartMutations.ts +93 -85
  56. package/app/composables/useCartUpsell.ts +27 -71
  57. package/app/composables/useCategoryListing.ts +36 -59
  58. package/app/composables/useCategorySeo.ts +11 -16
  59. package/app/composables/useCheckoutMethodGuard.ts +22 -46
  60. package/app/composables/useCheckoutMethods.ts +89 -0
  61. package/app/composables/useCheckoutOrderMessage.ts +19 -0
  62. package/app/composables/useCheckoutOrderer.ts +69 -0
  63. package/app/composables/useCommercePrice.ts +46 -9
  64. package/app/composables/useContactForm.ts +25 -32
  65. package/app/composables/useCustomer.ts +169 -0
  66. package/app/composables/useDeliveryTime.ts +112 -122
  67. package/app/composables/useHolidays.ts +12 -62
  68. package/app/composables/useHomeMenuCategories.ts +5 -5
  69. package/app/composables/useListingSearch.ts +9 -8
  70. package/app/composables/useLiveShopData.ts +15 -9
  71. package/app/composables/useMenuRootId.ts +3 -6
  72. package/app/composables/useMenuSection.ts +14 -0
  73. package/app/composables/useMenuSectionSchema.ts +23 -30
  74. package/app/composables/useNavigation.ts +24 -29
  75. package/app/composables/useOpeningHours.ts +21 -0
  76. package/app/composables/useOpeningHoursData.ts +9 -9
  77. package/app/composables/useOrder.ts +37 -0
  78. package/app/composables/useOrderMode.ts +18 -16
  79. package/app/composables/usePlaceOrder.ts +37 -0
  80. package/app/composables/useProductCartQuantity.ts +6 -6
  81. package/app/composables/useProductDetail.ts +28 -53
  82. package/app/composables/useProductEvents.ts +6 -5
  83. package/app/composables/useProductQuickView.ts +35 -68
  84. package/app/composables/useRegistrationForm.ts +85 -34
  85. package/app/composables/useRestaurantSchema.ts +7 -7
  86. package/app/composables/useSearchTracking.ts +6 -6
  87. package/app/composables/useSectionRoute.ts +48 -0
  88. package/app/composables/useServiceSchedule.ts +23 -0
  89. package/app/composables/useShippingLeadTime.ts +8 -6
  90. package/app/composables/useShippingMethodChoice.ts +13 -23
  91. package/app/composables/useShippingMethods.ts +31 -0
  92. package/app/composables/useShopConfig.ts +60 -0
  93. package/app/composables/useShopData.ts +20 -0
  94. package/app/composables/useSortingSelection.ts +5 -8
  95. package/app/composables/useStoreStatus.ts +13 -37
  96. package/app/composables/useTopSellers.ts +3 -3
  97. package/app/composables/useTrackEvent.ts +29 -24
  98. package/app/composables/useVoucherCode.ts +47 -12
  99. package/app/composables/useWishlistEntries.ts +233 -177
  100. package/app/error.vue +3 -2
  101. package/app/layouts/account.vue +4 -3
  102. package/app/pages/[...all].vue +6 -16
  103. package/app/pages/account/recover/password/index.vue +6 -14
  104. package/app/pages/anmelden.vue +1 -1
  105. package/app/pages/bestellung/[id]/erfolg.vue +3 -3
  106. package/app/pages/bestellung/[id]/fehler.vue +18 -29
  107. package/app/pages/bestellung/kasse.vue +24 -7
  108. package/app/pages/konto/adressen.vue +95 -40
  109. package/app/pages/konto/bestellungen.vue +10 -13
  110. package/app/pages/konto/index.vue +12 -2
  111. package/app/pages/konto/profil.vue +241 -42
  112. package/app/pages/passwort-vergessen.vue +5 -10
  113. package/app/pages/registrierung/bestaetigen.vue +9 -23
  114. package/app/pages/registrierung/index.vue +19 -11
  115. package/app/pages/suche.vue +29 -29
  116. package/app/plugins/shopware-layer-offline.ts +38 -0
  117. package/app/plugins/visitor-has-session.server.ts +19 -0
  118. package/app/utils/accountMessages.ts +74 -0
  119. package/app/utils/accountReads.ts +34 -0
  120. package/app/utils/bffWrite.ts +89 -0
  121. package/app/utils/dish.ts +121 -0
  122. package/app/utils/leadTime.ts +25 -29
  123. package/app/utils/media.ts +11 -17
  124. package/app/utils/menuGroups.ts +22 -35
  125. package/app/utils/money.ts +41 -0
  126. package/app/utils/openingHours.ts +30 -30
  127. package/app/utils/orderStatus.ts +17 -0
  128. package/app/utils/productUrl.ts +14 -31
  129. package/app/utils/restaurantTime.ts +326 -0
  130. package/app/utils/schema.ts +39 -42
  131. package/app/utils/wishlist.ts +139 -0
  132. package/docs/adr/0001-backend-agnostic-storefront.md +409 -0
  133. package/eslint.config.mjs +42 -2
  134. package/nuxt.config.ts +28 -0
  135. package/package.json +1 -1
  136. package/server/adapters/memory/cart.ts +370 -0
  137. package/server/adapters/memory/catalog.ts +367 -0
  138. package/server/adapters/memory/contact.ts +89 -0
  139. package/server/adapters/memory/customer.ts +458 -0
  140. package/server/adapters/memory/demo-menu.json +1190 -0
  141. package/server/adapters/memory/demoImages.ts +13 -0
  142. package/server/adapters/memory/demoMenu.ts +234 -0
  143. package/server/adapters/memory/demoNavigation.ts +71 -0
  144. package/server/adapters/memory/index.ts +122 -0
  145. package/server/adapters/memory/navigation.ts +168 -0
  146. package/server/adapters/memory/ordering.ts +379 -0
  147. package/server/adapters/memory/seed.ts +136 -0
  148. package/server/adapters/memory/wishlist.ts +166 -0
  149. package/server/adapters/notImplemented.ts +67 -0
  150. package/server/adapters/registry.ts +32 -0
  151. package/server/adapters/runtimeConfig.ts +14 -0
  152. package/server/adapters/shopware/cart.ts +792 -0
  153. package/server/adapters/shopware/catalog.ts +850 -0
  154. package/server/adapters/shopware/checkout.ts +138 -0
  155. package/server/adapters/shopware/contact.ts +255 -0
  156. package/server/adapters/shopware/customer.ts +460 -0
  157. package/server/adapters/shopware/index.ts +165 -0
  158. package/server/adapters/shopware/menuRoot.ts +24 -0
  159. package/server/adapters/shopware/navigation.ts +426 -0
  160. package/server/adapters/shopware/ordering.ts +1185 -0
  161. package/server/adapters/shopware/request.ts +67 -0
  162. package/server/adapters/shopware/shop.ts +249 -0
  163. package/server/adapters/shopware/storeApi.ts +62 -0
  164. package/server/adapters/shopware/wishlist.ts +473 -0
  165. package/server/api/__sitemap__/urls.get.ts +10 -38
  166. package/server/api/account/addresses/[addressId]/default.post.ts +13 -0
  167. package/server/api/account/addresses/[addressId].delete.ts +14 -0
  168. package/server/api/account/addresses/[addressId].patch.ts +15 -0
  169. package/server/api/account/addresses/index.get.ts +6 -0
  170. package/server/api/account/addresses/index.post.ts +9 -0
  171. package/server/api/account/email.post.ts +10 -0
  172. package/server/api/account/index.delete.ts +11 -0
  173. package/server/api/account/index.get.ts +9 -0
  174. package/server/api/account/login.post.ts +14 -0
  175. package/server/api/account/logout.post.ts +11 -0
  176. package/server/api/account/orders.get.ts +13 -0
  177. package/server/api/account/password-reset/confirm.post.ts +13 -0
  178. package/server/api/account/password-reset.post.ts +16 -0
  179. package/server/api/account/password.post.ts +18 -0
  180. package/server/api/account/profile.patch.ts +6 -0
  181. package/server/api/account/register/confirm.post.ts +13 -0
  182. package/server/api/account/register.post.ts +15 -0
  183. package/server/api/breadcrumb/[sectionId].get.ts +33 -0
  184. package/server/api/cart/index.get.ts +4 -0
  185. package/server/api/cart/lines/[lineId].delete.ts +6 -0
  186. package/server/api/cart/lines/[lineId].patch.ts +10 -0
  187. package/server/api/cart/lines.post.ts +10 -0
  188. package/server/api/cart/vouchers/[code].delete.ts +9 -0
  189. package/server/api/cart/vouchers.post.ts +12 -0
  190. package/server/api/checkout/guest.post.ts +13 -0
  191. package/server/api/checkout/orderer/addresses/[addressId].patch.ts +16 -0
  192. package/server/api/checkout/orderer.get.ts +10 -0
  193. package/server/api/checkout/orders.post.ts +60 -0
  194. package/server/api/checkout/payment-methods.get.ts +9 -0
  195. package/server/api/checkout/selection.get.ts +10 -0
  196. package/server/api/checkout/selection.post.ts +14 -0
  197. package/server/api/checkout/shipping-methods.get.ts +9 -0
  198. package/server/api/contact/form.get.ts +13 -0
  199. package/server/api/contact/index.post.ts +24 -0
  200. package/server/api/listing/[sectionId].get.ts +33 -0
  201. package/server/api/menu/dishes/[dishId]/variant.get.ts +29 -0
  202. package/server/api/menu/dishes/[dishId].get.ts +19 -0
  203. package/server/api/menu/dishes/index.get.ts +26 -0
  204. package/server/api/menu/media/[name].get.ts +18 -0
  205. package/server/api/menu/root.get.ts +12 -0
  206. package/server/api/menu/sections/[sectionId].get.ts +18 -0
  207. package/server/api/menu/upsell.get.ts +12 -0
  208. package/server/api/navigation/[kind].get.ts +75 -0
  209. package/server/api/orders/[orderId]/payment.post.ts +24 -0
  210. package/server/api/orders/[orderId].get.ts +13 -0
  211. package/server/api/payment-methods.get.ts +11 -15
  212. package/server/api/resolve-path.get.ts +20 -0
  213. package/server/api/search.get.ts +16 -80
  214. package/server/api/session.post.ts +18 -0
  215. package/server/api/shop/branches.get.ts +9 -0
  216. package/server/api/shop/config.get.ts +9 -0
  217. package/server/api/shop/holidays.get.ts +9 -0
  218. package/server/api/shop/opening-hours.get.ts +9 -0
  219. package/server/api/top-sellers.get.ts +14 -50
  220. package/server/api/wishlist/entries/[entryId].delete.ts +8 -0
  221. package/server/api/wishlist/entries.post.ts +13 -0
  222. package/server/api/wishlist/index.get.ts +13 -0
  223. package/server/api/wishlist/merge.post.ts +12 -0
  224. package/server/plugins/visitor-session.ts +35 -0
  225. package/server/ports/CartPort.ts +48 -0
  226. package/server/ports/CatalogPort.ts +66 -0
  227. package/server/ports/CheckoutPort.ts +128 -0
  228. package/server/ports/ContactPort.ts +38 -0
  229. package/server/ports/CustomerPort.ts +154 -0
  230. package/server/ports/NavigationPort.ts +58 -0
  231. package/server/ports/OrderPort.ts +31 -0
  232. package/server/ports/ShopPort.ts +29 -0
  233. package/server/ports/WishlistPort.ts +47 -0
  234. package/server/ports/index.ts +42 -0
  235. package/server/ports/session.ts +22 -0
  236. package/server/routes/llms.txt.ts +28 -154
  237. package/server/session/forwardedFor.ts +24 -0
  238. package/server/session/sameOrigin.ts +47 -0
  239. package/server/session/seal.ts +147 -0
  240. package/server/session/visitorSession.ts +288 -0
  241. package/server/utils/accountRoutes.ts +173 -0
  242. package/server/utils/backend.ts +21 -0
  243. package/server/utils/backoff.ts +18 -5
  244. package/server/utils/cacheKeys.ts +11 -0
  245. package/server/utils/cachePurge.ts +47 -27
  246. package/server/utils/cartRoutes.ts +124 -0
  247. package/server/utils/catalogData.ts +24 -0
  248. package/server/utils/checkoutRoutes.ts +326 -0
  249. package/server/utils/contactRoutes.ts +86 -0
  250. package/server/utils/domainHttp.ts +73 -0
  251. package/server/utils/listingParams.ts +49 -20
  252. package/server/utils/llmsTxt.ts +64 -19
  253. package/server/utils/navigationData.ts +14 -0
  254. package/server/utils/orderPlacement.ts +322 -0
  255. package/server/utils/outageBreaker.ts +126 -0
  256. package/server/utils/pathRoutes.ts +160 -0
  257. package/server/utils/requestBody.ts +43 -0
  258. package/server/utils/shopData.ts +132 -0
  259. package/server/utils/sitemap.ts +14 -36
  260. package/server/utils/storeApi.ts +71 -23
  261. package/server/utils/visitorSession.ts +209 -0
  262. package/server/utils/wishlistRoutes.ts +55 -0
  263. package/shared/domain/customer/index.ts +2 -0
  264. package/shared/domain/customer/types.ts +88 -0
  265. package/shared/domain/discoverability/index.ts +4 -0
  266. package/shared/domain/discoverability/paths.ts +93 -0
  267. package/shared/domain/discoverability/route.ts +32 -0
  268. package/shared/domain/discoverability/types.ts +75 -0
  269. package/shared/domain/index.ts +11 -0
  270. package/shared/domain/kernel/calendar.ts +88 -0
  271. package/shared/domain/kernel/errors.ts +100 -0
  272. package/shared/domain/kernel/freeze.ts +13 -0
  273. package/shared/domain/kernel/ids.ts +6 -0
  274. package/shared/domain/kernel/index.ts +8 -0
  275. package/shared/domain/kernel/media.ts +17 -0
  276. package/shared/domain/kernel/money.ts +104 -0
  277. package/shared/domain/kernel/timeOfDay.ts +39 -0
  278. package/shared/domain/menu/dishConfiguration.ts +72 -0
  279. package/shared/domain/menu/index.ts +3 -0
  280. package/shared/domain/menu/types.ts +185 -0
  281. package/shared/domain/ordering/index.ts +3 -0
  282. package/shared/domain/ordering/time.ts +114 -0
  283. package/shared/domain/ordering/types.ts +195 -0
  284. package/shared/domain/restaurant/holiday.ts +38 -0
  285. package/shared/domain/restaurant/index.ts +4 -0
  286. package/shared/domain/restaurant/openingInterval.ts +97 -0
  287. package/shared/domain/restaurant/types.ts +75 -0
  288. package/test/a11y/presets.test.ts +49 -31
  289. package/test/contract/cart.contract.ts +592 -0
  290. package/test/contract/cart.spec.ts +5 -0
  291. package/test/contract/cartFixtures.ts +573 -0
  292. package/test/contract/catalog.contract.ts +714 -0
  293. package/test/contract/catalog.spec.ts +5 -0
  294. package/test/contract/catalogFixtures.ts +572 -0
  295. package/test/contract/checkout.contract.ts +123 -0
  296. package/test/contract/checkout.spec.ts +5 -0
  297. package/test/contract/contact.contract.ts +149 -0
  298. package/test/contract/contact.spec.ts +4 -0
  299. package/test/contract/contactFixtures.ts +148 -0
  300. package/test/contract/customer.contract.ts +831 -0
  301. package/test/contract/customer.spec.ts +4 -0
  302. package/test/contract/customerFixtures.ts +468 -0
  303. package/test/contract/fixtures.ts +260 -0
  304. package/test/contract/harness.ts +45 -0
  305. package/test/contract/navigation.contract.ts +336 -0
  306. package/test/contract/navigation.spec.ts +5 -0
  307. package/test/contract/navigationFixtures.ts +311 -0
  308. package/test/contract/ordering.contract.ts +655 -0
  309. package/test/contract/ordering.spec.ts +4 -0
  310. package/test/contract/orderingFixtures.ts +498 -0
  311. package/test/contract/shop.contract.ts +164 -0
  312. package/test/contract/shop.spec.ts +5 -0
  313. package/test/contract/wishlist.contract.ts +375 -0
  314. package/test/contract/wishlist.spec.ts +4 -0
  315. package/test/contract/wishlistFixtures.ts +199 -0
  316. package/test/nuxt/AccountPagesPreset.test.ts +320 -83
  317. package/test/nuxt/AuthPagesPreset.test.ts +17 -24
  318. package/test/nuxt/CartBar.test.ts +12 -8
  319. package/test/nuxt/CartCheckoutPreset.test.ts +36 -33
  320. package/test/nuxt/CartItem.test.ts +39 -20
  321. package/test/nuxt/CartQuickView.test.ts +106 -0
  322. package/test/nuxt/CartUpsell.test.ts +37 -39
  323. package/test/nuxt/CategoryBreadcrumb.test.ts +26 -0
  324. package/test/nuxt/CheckoutFormsPreset.test.ts +92 -13
  325. package/test/nuxt/CheckoutOnePage.test.ts +28 -21
  326. package/test/nuxt/CheckoutPageMessage.test.ts +31 -0
  327. package/test/nuxt/CheckoutSummary.test.ts +163 -48
  328. package/test/nuxt/CheckoutVoucherInput.test.ts +77 -80
  329. package/test/nuxt/ContactFormPreset.test.ts +97 -36
  330. package/test/nuxt/DeliveryTimeSelect.test.ts +72 -45
  331. package/test/nuxt/FooterStoreStatus.test.ts +2 -2
  332. package/test/nuxt/HeaderFooterPreset.test.ts +11 -19
  333. package/test/nuxt/HomeCategories.test.ts +47 -0
  334. package/test/nuxt/HomeLeadTimes.test.ts +3 -3
  335. package/test/nuxt/MenuBonCard.test.ts +45 -32
  336. package/test/nuxt/NavigationMobileTop.test.ts +30 -28
  337. package/test/nuxt/OrderPagesPreset.test.ts +83 -52
  338. package/test/nuxt/PaymentAndDelivery.test.ts +25 -26
  339. package/test/nuxt/ProductConfigurator.test.ts +81 -0
  340. package/test/nuxt/ProductCrossSelling.test.ts +23 -20
  341. package/test/nuxt/ProductDeselectIngredient.test.ts +6 -9
  342. package/test/nuxt/ProductFoodLabels.test.ts +7 -24
  343. package/test/nuxt/ProductSheetPreset.test.ts +24 -24
  344. package/test/nuxt/RegisterConfirmPage.test.ts +26 -45
  345. package/test/nuxt/RegistrationForm.test.ts +57 -53
  346. package/test/nuxt/RegistrationPage.test.ts +37 -0
  347. package/test/nuxt/WishlistPage.test.ts +119 -43
  348. package/test/nuxt/WishlistSaveButton.test.ts +39 -12
  349. package/test/nuxt/accountSwitch.test.ts +106 -0
  350. package/test/nuxt/bffWrite.test.ts +41 -0
  351. package/test/nuxt/liveShopData.test.ts +36 -68
  352. package/test/nuxt/shopwareLayerOffline.test.ts +32 -0
  353. package/test/nuxt/useAddToCart.test.ts +142 -115
  354. package/test/nuxt/useCartMutations.test.ts +165 -113
  355. package/test/nuxt/useCartUpsell.test.ts +36 -63
  356. package/test/nuxt/useCategoryListing.test.ts +75 -118
  357. package/test/nuxt/useCheckoutMethodGuard.test.ts +54 -105
  358. package/test/nuxt/useCustomer.test.ts +127 -0
  359. package/test/nuxt/useDeliveryTime.test.ts +169 -157
  360. package/test/nuxt/useNavigation.test.ts +81 -0
  361. package/test/nuxt/useOpeningHoursData.test.ts +18 -18
  362. package/test/nuxt/useOrder.test.ts +38 -0
  363. package/test/nuxt/usePlaceOrder.test.ts +88 -0
  364. package/test/nuxt/useSearchTracking.test.ts +2 -2
  365. package/test/nuxt/useSectionRoute.test.ts +86 -0
  366. package/test/nuxt/useShippingLeadTime.test.ts +17 -17
  367. package/test/nuxt/useShippingMethodChoice.test.ts +22 -22
  368. package/test/nuxt/useShippingMethods.test.ts +71 -0
  369. package/test/nuxt/useShopConfig.test.ts +64 -0
  370. package/test/nuxt/useStoreStatus.test.ts +34 -50
  371. package/test/nuxt/useTopSellers.test.ts +6 -5
  372. package/test/nuxt/useTrackEvent.test.ts +68 -6
  373. package/test/nuxt/useWishlistEntries.test.ts +392 -128
  374. package/test/support/cart.ts +43 -0
  375. package/test/support/dishes.ts +116 -0
  376. package/test/support/navigation.ts +17 -0
  377. package/test/unit/accountMessages.spec.ts +53 -0
  378. package/test/unit/accountRoutes.spec.ts +637 -0
  379. package/test/unit/adapters/memoryCustomer.spec.ts +67 -0
  380. package/test/unit/adapters/memoryDemoMenu.spec.ts +174 -0
  381. package/test/unit/adapters/registry.spec.ts +100 -0
  382. package/test/unit/adapters/shopwareCart.spec.ts +636 -0
  383. package/test/unit/adapters/shopwareCatalog.spec.ts +486 -0
  384. package/test/unit/adapters/shopwareCheckout.spec.ts +197 -0
  385. package/test/unit/adapters/shopwareContact.spec.ts +296 -0
  386. package/test/unit/adapters/shopwareCustomer.spec.ts +256 -0
  387. package/test/unit/adapters/shopwareNavigation.spec.ts +594 -0
  388. package/test/unit/adapters/shopwareOrdering.spec.ts +620 -0
  389. package/test/unit/adapters/shopwareShop.spec.ts +259 -0
  390. package/test/unit/adapters/shopwareWishlist.spec.ts +306 -0
  391. package/test/unit/adapters/useBackend.spec.ts +41 -0
  392. package/test/unit/backoff.spec.ts +47 -0
  393. package/test/unit/boundedCache.spec.ts +59 -59
  394. package/test/unit/cacheKeys.spec.ts +44 -0
  395. package/test/unit/cachePurge.spec.ts +44 -19
  396. package/test/unit/cartRoutes.spec.ts +567 -0
  397. package/test/unit/catalogRoutes.spec.ts +287 -0
  398. package/test/unit/checkoutRoutes.spec.ts +545 -0
  399. package/test/unit/dish.spec.ts +128 -0
  400. package/test/unit/domain/discoverability.spec.ts +154 -0
  401. package/test/unit/domain/dishConfiguration.spec.ts +85 -0
  402. package/test/unit/domain/money.spec.ts +102 -0
  403. package/test/unit/domain/time.spec.ts +336 -0
  404. package/test/unit/domainHttp.spec.ts +74 -0
  405. package/test/unit/forwardedFor.spec.ts +24 -0
  406. package/test/unit/layoutCacheRoutes.spec.ts +47 -471
  407. package/test/unit/leadTime.spec.ts +28 -23
  408. package/test/unit/llmsTxt.spec.ts +120 -9
  409. package/test/unit/media.spec.ts +25 -26
  410. package/test/unit/menuGroups.spec.ts +31 -21
  411. package/test/unit/navigationRoutes.spec.ts +648 -0
  412. package/test/unit/nitroStubs.ts +6 -1
  413. package/test/unit/openingHours.spec.ts +57 -34
  414. package/test/unit/orderPlacement.spec.ts +362 -0
  415. package/test/unit/outageBreaker.spec.ts +213 -0
  416. package/test/unit/productUrl.spec.ts +10 -28
  417. package/test/unit/requestBody.spec.ts +56 -0
  418. package/test/unit/restaurantTime.spec.ts +295 -0
  419. package/test/unit/schema.spec.ts +58 -26
  420. package/test/unit/session/sameOrigin.spec.ts +76 -0
  421. package/test/unit/session/seal.spec.ts +128 -0
  422. package/test/unit/session/visitorSession.spec.ts +439 -0
  423. package/test/unit/shopRoutes.spec.ts +257 -0
  424. package/test/unit/sitemap.spec.ts +11 -47
  425. package/test/unit/storeApiForVisitor.spec.ts +109 -0
  426. package/test/unit/useCategorySeo.spec.ts +57 -31
  427. package/test/unit/wishlistContactRoutes.spec.ts +607 -0
  428. package/vitest.config.ts +5 -1
  429. package/app/components/SalesChannelSwitch.vue +0 -73
  430. package/app/composables/useBusinessHours.ts +0 -192
  431. package/app/composables/useCategoryById.ts +0 -10
  432. package/app/composables/useNavigationSearch.ts +0 -45
  433. package/app/composables/useProductConfigurator.ts +0 -70
  434. package/app/composables/useProductCrossSelling.ts +0 -42
  435. package/app/composables/useProductVariants.ts +0 -61
  436. package/app/composables/useProductVariantsZwei.ts +0 -62
  437. package/app/composables/useSeoUrlRoute.ts +0 -124
  438. package/app/composables/useShopBiteConfig.ts +0 -69
  439. package/app/composables/useSyncWishlist.ts +0 -119
  440. package/app/types/Association.d.ts +0 -14
  441. package/app/utils/product.ts +0 -139
  442. package/app/utils/seoPath.ts +0 -68
  443. package/app/utils/time.ts +0 -20
  444. package/server/api/breadcrumb/[categoryId].get.ts +0 -31
  445. package/server/api/category/[categoryId].get.ts +0 -37
  446. package/server/api/listing/[categoryId].get.ts +0 -102
  447. package/server/api/navigation/[type].get.ts +0 -97
  448. package/server/api/product/[productId]/cross-selling.get.ts +0 -26
  449. package/server/api/product/[productId].get.ts +0 -76
  450. package/server/api/product/variant.get.ts +0 -98
  451. package/server/api/seo-url/index.get.ts +0 -17
  452. package/server/api/seo-url/known.get.ts +0 -33
  453. package/server/api/shopbite/business-hours.get.ts +0 -22
  454. package/server/api/shopbite/config.get.ts +0 -6
  455. package/server/api/shopbite/holidays.get.ts +0 -20
  456. package/server/utils/menuRoot.ts +0 -31
  457. package/server/utils/seoPaths.ts +0 -130
  458. package/server/utils/seoUrlCache.ts +0 -98
  459. package/server/utils/shopBiteConfig.ts +0 -30
  460. package/test/nuxt/useBusinessHours.test.ts +0 -106
  461. package/test/nuxt/useProductConfigurator.test.ts +0 -87
  462. package/test/nuxt/useProductVariants.test.ts +0 -95
  463. package/test/nuxt/useProductVariantsZwei.test.ts +0 -52
  464. package/test/nuxt/useSeoUrlRoute.test.ts +0 -176
  465. package/test/nuxt/useShopBiteConfig.test.ts +0 -131
  466. package/test/nuxt/useSyncWishlist.test.ts +0 -85
  467. package/test/unit/product.spec.ts +0 -160
  468. package/test/unit/seoPath.spec.ts +0 -161
  469. package/test/unit/seoPaths.spec.ts +0 -117
package/.env.example CHANGED
@@ -65,3 +65,16 @@ NUXT_CACHE_STORAGE_MAX_SIZE_MB=128
65
65
  # Sortings accepted by the listing and search routes, comma-separated
66
66
  # (empty = Shopware's standard sortings; add custom sorting keys here)
67
67
  NUXT_LISTING_SORTINGS=
68
+
69
+ # Seals the storefront's session cookie (cart, login): at least 32 random
70
+ # characters, e.g. `openssl rand -hex 32`. Required in production; keep it
71
+ # when you redeploy, or every visitor's cart is gone. To change it, move
72
+ # the old one to NUXT_VISITOR_SESSION_PREVIOUS_PASSWORDS (comma-separated).
73
+ NUXT_VISITOR_SESSION_PASSWORD=""
74
+ # The old password after a change (comma-separated); drop it after
75
+ # NUXT_VISITOR_SESSION_MAX_AGE_DAYS (30), cookies are sealed anew on visits.
76
+ NUXT_VISITOR_SESSION_PREVIOUS_PASSWORDS=""
77
+ NUXT_VISITOR_SESSION_MAX_AGE_DAYS="30"
78
+ # Further exact origins (scheme and host) whose pages may change the cart,
79
+ # e.g. "https://www.my-shop.example" next to NUXT_PUBLIC_STORE_URL.
80
+ NUXT_VISITOR_SESSION_ALLOWED_ORIGINS=""
@@ -12,6 +12,8 @@ env:
12
12
  PORT: '3005'
13
13
  NUXT_PUBLIC_SHOPWARE_ENDPOINT: ${{ secrets.NUXT_PUBLIC_SHOPWARE_ENDPOINT }}
14
14
  NUXT_PUBLIC_SHOPWARE_ACCESS_TOKEN: ${{ secrets.NUXT_PUBLIC_SHOPWARE_ACCESS_TOKEN }}
15
+ # seals the session cookie of the built storefront (a11y job); a test value
16
+ NUXT_VISITOR_SESSION_PASSWORD: 'ci-only-session-password-0123456789abcdef'
15
17
  NUXT_PUBLIC_SITE_COUNTRY_ID: ${{ secrets.NUXT_PUBLIC_SITE_COUNTRY_ID }}
16
18
  GEOPIFY: ${{ secrets.GEOPIFY }}
17
19
 
package/CLAUDE.md CHANGED
@@ -40,7 +40,7 @@ Work test-first (red, green, refactor): for a bug, first write a test that repro
40
40
 
41
41
  ```bash
42
42
  # Vitest – filter by test name or file path
43
- pnpm vitest run test/nuxt/useBusinessHours.test.ts
43
+ pnpm vitest run test/nuxt/useDeliveryTime.test.ts
44
44
  pnpm vitest run --reporter=verbose -t "should return true"
45
45
 
46
46
  # Playwright – filter by file
@@ -62,6 +62,30 @@ Do not name a project composable like one from the `@shopware/composables` layer
62
62
 
63
63
  ## Architecture
64
64
 
65
+ ### Backend-agnostic storefront (ADR 0001)
66
+
67
+ The storefront is moving to ports and adapters so it works against any shop backend; Shopware becomes one adapter. Read [`docs/adr/0001-backend-agnostic-storefront.md`](docs/adr/0001-backend-agnostic-storefront.md) (BFF, session, bounded contexts, migration steps 0–8) and use the words of [`GLOSSARY.md`](GLOSSARY.md) in code, tests and docs (dish, not product; cart line, not line item; path, not SEO URL).
68
+
69
+ - `shared/domain/<context>/` (`kernel`, `menu`, `ordering`, `customer`, `restaurant`, `discoverability`): domain types, value objects with validating constructors (`money`, `timeOfDay`, `calendarDate`, `timeZone`, `leadTime`, `wishedTime` with a service date, `openingInterval` up to 24:00, `holiday` as whole days, `dishConfiguration`), pure domain services (`earliestWishedTime`), `DomainError` codes. Times and dates are the restaurant's (`ShopConfig.timeZone`, runtime config `shopBite.timeZone`, default Europe/Berlin), never the server's or browser's clock. Pure TypeScript; the server imports it relatively, app code imports types only (see Layer imports).
70
+ - `server/ports/`: the nine port interfaces and `Backend`; visitor-specific ports take a `BackendSession`.
71
+ - `server/adapters/shopware/` (the only place that may import `#shopware`, `@shopware/*`, `api-types`) and `server/adapters/memory/` (demo restaurant in memory); `registry.ts` creates them, unimplemented ports reject with `not_implemented`. Server routes get the adapter set with `useBackend(event)` (`server/utils/backend.ts`, runtime config `shopBite.backend`: `shopware` default, `memory`); each adapter builds itself from the runtime config and answers frozen values. Caching and backoff stay in the routes, not in the adapters.
72
+ - `test/contract/`: one contract suite per port (`*.contract.ts`, scenario in domain terms) run against every adapter fixture by `runContract` (`*.spec.ts`, part of `pnpm test:unit`). A port method you implement gets its contract tests first, for both adapters. A port an adapter implements in part is `partlyImplemented()` (`server/adapters/notImplemented.ts`): the rest rejects with `not_implemented`.
73
+ - BFF routes answer domain types and map a `DomainError` to HTTP with `answerDomain()`/`toHttpError()` (`server/utils/domainHttp.ts`, one table `DOMAIN_ERROR_STATUS` for all routes; the answer carries `data.code`, never the backend's message).
74
+ - Moved in step 1 (restaurant operations): `GET /api/shop/config` (`ShopConfig`), `/api/shop/opening-hours` (`OpeningHours`), `/api/shop/holidays` (`Holiday[]`), `/api/shop/branches` (`Branch[]`) and `/api/checkout/shipping-methods` (`ShippingMethod[]`, `CheckoutPort.listShippingMethods`; Shopware: plugin `/shopbite/config` lead times plus Store API `/shipping-method` names, a method the plugin does not list is a delivery without lead time; memory: Lieferung 30, Abholung 15 minutes). Each is a cached function (`server/utils/shopData.ts`: `shop-config`, `shop-opening-hours`, `shop-holidays`, `shop-branches`, `shipping-methods`; `swr: false`, resilient loader) for server-side rendering and llms.txt; `?fresh=1` asks the port directly, never a cache or a last good answer, for the browser's live values and the checkout's gate; while the value's backoff is active (after an outage, cached or fresh) it fails fast without reaching the backend. Failures are DomainErrors, so cached and fresh answers carry `data.code` (`backend_unavailable` with 503). The Shopware adapter lets concurrent reads of the plugin's `/shopbite/config` share one request in flight (`sharingRequestsInFlight`, no caching). The browser calls no Store API for these areas.
75
+ - Moved in step 2 (menu): `CatalogPort` in both adapters. BFF routes answer domain types: `GET /api/listing/[sectionId]` (`MenuListing`; `order`, `filters` = option ids `|`-separated, `p`), `/api/search?query=` (`MenuListing`), `/api/top-sellers` (`Dish[]`, resilient loader), `/api/menu/sections/[sectionId]` (`MenuSection` with SEO data and sub-sections, which group the listing), `/api/menu/dishes/[dishId]` (`DishDetail`: variants, extras, removable ingredients, food labels; a variant's id opens its dish with that variant selected), `/api/menu/dishes?number=` (deep links, 404 if none), `/api/menu/dishes/[dishId]/variant?options=` (`Variant` or null; with fewer options than groups the first variant that has them), `/api/menu/upsell` (`Dish[]`) and `/api/menu/media/[name]` (photos of the memory demo menu, 404 on other backends); `server/utils/catalogData.ts` (`askCatalog`). They replace `/api/product/[productId]` (+ `/cross-selling`), `/api/product/variant` and `/api/category/[categoryId]`, and the browser's own Store API reads of dishes (quick view by number, upsell, wishlist). The Shopware adapter (`server/adapters/shopware/catalog.ts`) owns the criteria, includes and headers (`sw-include-seo-urls`, `sw-inheritance`), the property groups by name, `productList` cross-sellings as extra groups, child products as variants (the detail route's default variant is `selectedVariantId`), the custom fields, the price of a parent from its cheapest variant (`calculatedCheapestPrice`), prices as `Money` in the currency of `/context` (read once per 10 minutes), Shopware's 400 as `invalid_value` and its 404 for a page after the last as an empty page, extras that fail to load as none (logged), media thumbnails as `sources` and the SEO URL that opens the dish sheet as `Dish.path` (else null and the app builds the link, `dishLink()`). The memory adapter serves the quickstart's demo menu (`server/adapters/memory/demo-menu.json` = its `setup/menu.json`, photos in `demoImages.ts`, ids = the quickstart setup's uuid5, so the quickstart's paths and cart accept them). `llms.txt` reads the menu from `getMenu()` and `listMenuDishes()`. Menu components and composables work on the domain types (`Dish`, `DishDetail`, `Variant`, `Extra`, `MenuSection`, `MenuListing`, `Money`, `Media`); presentation helpers in `app/utils/dish.ts` (`dietLabels`, `foodLabelText`, `orderableOf`, `variantAsDish`, `dishForNumber`, `cartLineHoldsDish`), `app/utils/money.ts` (`moneyAmount`, `sumMoney`) and `getFormattedMoney()` of `useCommercePrice`. The cart moved in step 4 (below).
76
+
77
+ - Moved in step 3 (discoverability): `NavigationPort` in both adapters. BFF routes answer domain types: `GET /api/navigation/[kind]` (`NavigationNode[]` for `main`, `footer`, `menu`, `home`; a node is a `menu-section`, `page`, `link` or `group` (footer column, `path: null`), `external` = opens in a new tab, `media` only for `home`), `/api/breadcrumb/[sectionId]` (`BreadcrumbItem[]`, 404 for an unknown section), `/api/resolve-path?path=` (`{ route: ResolvedRoute | null }`: the section with its canonical path, or a redirect with `to` and `sectionId`) and `/api/menu/root` (`{ id }`, the menu root, strict); they replace `/api/navigation/[type]`, `/api/breadcrumb/[categoryId]`, `/api/seo-url` and `/api/seo-url/known`, and the browser's own Store API lookups of old SEO URLs. `useSectionRoute()` (catch-all page) replaces `useSeoUrlRoute`, `useNavigationSearch` and `app/utils/seoPath.ts`; `useNavigation`, `useHomeMenuCategories`, `MenuCategoryIndex`, `NavigationMobileTop`, `HomeCategories` and `CategoryBreadcrumb` work on the domain types. The Shopware adapter (`server/adapters/shopware/navigation.ts`) owns the SEO URLs: lookups by `seoPathInfo`, technical URLs (`/navigation|detail|landingPage/<id>`) by `pathInfo`, the toggled trailing slash, former SEO URLs (`isCanonical: null`, then the canonical one of the same `languageId`), product SEO URLs as no page, the navigation roots (`main-navigation`, `footer-navigation`, the menu root of `menuRoot.ts`), category types as node kinds, `linkNewTab`, `shopbite_category_icon`, the sitemap trees and the paged category SEO paths. The memory adapter serves the quickstart's menu root (its page lists every dish), header, footer and paths. Pure path rules shared by both and the BFF live in `shared/domain/discoverability/` (`isHostilePath`, `pathKey`, `mayBeKnownPath`, `routeTo`, `toggleTrailingSlash`).
78
+
79
+ - Moved in step 4 (session and cart): the storefront session and `CartPort` in both adapters. **Session** (`server/session/`, glue `server/utils/visitorSession.ts`, `server/plugins/visitor-session.ts`): an HttpOnly, SameSite=Lax cookie `shopbite-session` (`__Host-shopbite-session` and Secure when `public.storeUrl` is https) that carries each adapter's state (Shopware: the context token) sealed: AES-256-GCM, key by HKDF from `visitorSession.password` (`NUXT_VISITOR_SESSION_PASSWORD`, at least 32 characters; production does not start without it, development generates one; `previousPasswords` for a rotation: a cookie of a previous password is sealed again with the current one on its visit, drop the previous one only `maxAgeDays` later), format `v1.<key id>.<nonce>.<data>` (`seal.ts`). No server-side storage: sessions survive restarts and deploys. The payload has a session id and a version; every change of a state seals a new value, a cookie is only set when the request changed a state (or once a day to extend `maxAgeDays`, 30). A bounded registry per process (`createSessionRegistry`) keeps each session's newest version and serialises a visitor's writes, the cart's and the bridge's (`useVisitorSession(event).exclusive`; bridge reads run in parallel): a request with an older cookie is stale (`isStale()`), its writes are dropped, cart writes and bridge writes answer 409 `stale_session`, `useCartMutations` sends again after 150 ms, twice at most. Routes hand adapters `backendSession(event, backend.name, { create })` (with `forwardedFor`); cart reads never create a session. The old layer's `sw-context-token` cookie is taken over once (into the `shopware` state) and deleted. CSRF: SameSite=Lax plus `assertSameOriginWrite` (Origin must be the origin of `public.storeUrl`, the request's own or one of `visitorSession.allowedOrigins` (NUXT_VISITOR_SESSION_ALLOWED_ORIGINS, exact origins of any scheme, e.g. several https hosts behind a TLS-terminating proxy), scheme included, forwarded headers not trusted; else `Sec-Fetch-Site` same-origin; 403 `cross_site_request`; a write with neither header is no browser's and is accepted). Visitor-specific answers are `private, no-store` (`answerPrivately`). **Cart BFF**: `GET /api/cart`, `POST /api/cart/lines` (`{ dishId, variantId?, extraIds?, removedIngredientIds?, quantity }`), `PATCH`/`DELETE /api/cart/lines/[lineId]`, `POST /api/cart/vouchers` (`{ code }`), `DELETE /api/cart/vouchers/[code]`, all answering the domain `Cart` (`server/utils/cartRoutes.ts`). The Shopware adapter (`server/adapters/shopware/cart.ts`) keeps the line items of 2.6.1: a plain dish is a `product` line item (id = product id), a configured one the plugin's `container` with the same uuid5 id (`containerLineId()`: product id + sorted extra ids, plus `|without:` and the sorted, lower-cased removals), label and payload hints and children; names, number, parent and main ingredients come from one `/product` lookup (`sw-inheritance`) and the extras a dish offers from its `/cross-selling`, both kept 60 s in the adapter (bounded); a variant must belong to the dish, an extra be offered by it; a visitor without a token gets an empty cart without a request; every cart request (cart, product lookup, extras, currency) has a 10 s deadline (`requestTimeoutMs`), `storeApiGet`/`storeApiPost`/`storeApiForVisitor` and the bridge time out after 10 s, cart requests use the server's endpoint and carry `X-Forwarded-For` (`BackendSession.forwardedFor`); message texts and logged error causes carry no token; a write refused as `CHECKOUT__CART_LOCKED` is sent again once; cart errors become `CartMessage` codes. The memory adapter keeps carts per session in memory. **Transitional bridge** (steps 4 to 6, removed in step 7): the Shopware layer's browser client talks to `/api/store-api/**` (`server/api/store-api/[...path].ts`, `server/adapters/shopware/sessionBridge.ts`), which adds access key and context token from the session, forwards a header allowlist plus `X-Forwarded-For` as a proxy does (incoming chain plus socket address, `forwardedFor()`; Shopware honours it only when `TRUSTED_PROXIES` lists the storefront and the proxies in front of it, via `localhost` both `127.0.0.1` and `::1`); the proxy in front of the storefront must overwrite a client-sent `X-Forwarded-For` (nginx `proxy_set_header X-Forwarded-For $remote_addr`), otherwise a visitor forges addresses past Shopware's per-IP limits, refuses bodies over 1 MB before buffering, stores a token Shopware issues (login, logout, registration) and replaces the visitor's tokens in headers, every JSON string and key and text bodies (Shopware writes them into error texts), and the internal endpoint in routing errors; server-side rendering reads the token from the session (`app/plugins/store-api-session.ts` via `event.context.shopbiteStoreApiSession`, read only), and `app.vue` keeps the token out of the page payload. App: `useCartData()` (the `Cart` state, `refresh()` rejects on failure), `useCartMutations()` (`addLine`, `setQuantity`, `removeLine`; one queue, coalesced quantities), `useAddToCart` (`setSelectedDish(dish, dishId)`: the dish a variant belongs to), `useVoucherCode` (`appliedVouchers`, `removeVoucher`), `cartLineLabel()`/`cartLineHoldsDish()` in `app/utils/dish.ts`; `CartItem` takes `line`. Wishlist and contact moved behind the BFF in step 7 (below), which removed the bridge.
80
+
81
+ - Moved in step 5 (checkout and orders): `CheckoutPort` (but the shipping methods of step 1) and `OrderPort` in both adapters, contract suite `test/contract/ordering.contract.ts` (one backend: cart, checkout and orders together). **BFF** (`server/utils/checkoutRoutes.ts`: `answerVisitor` = private answer, CSRF and `exclusive` + 409 `stale_session` on writes, reads never create a session; body validation with field names in `data.details.field`): `GET`/`POST /api/checkout/selection` (`CheckoutSelection`: shipping and payment method of the next order, also with an empty cart; POST `{ shippingMethodId }` or `{ paymentMethodId }`, a method the cart cannot use is selected anyway and shows as a cart message), `GET /api/checkout/payment-methods` (`PaymentMethod[]`, the visitor's rules, `preferred` = the shop's default), `GET /api/checkout/orderer` (`{ orderer: Orderer | null }`, guest or logged-in customer with billing and delivery address), `POST /api/checkout/guest` (`GuestDetails`; names, street, city, e-mail required, phone 7–40 characters, company for a business, texts up to 255, postal code 50, no control characters), `PATCH /api/checkout/orderer/addresses/[addressId]`, `POST /api/checkout/orders` (`{ attemptId, wishedTime: { date, time }, note? }` → `PlacedOrder`: order, `redirectUrl`, `paymentFailed`), `GET /api/orders/[orderId]` (another visitor's order, a guessed id or number: 404) and `POST /api/orders/[orderId]/payment` (`{ paymentMethodId? }` → `{ redirectUrl }`, the payment retry). **Placing an order** (`server/utils/orderPlacement.ts`): the switch is read fresh (`shopConfigData.fresh()`), the wished time must lie in `wishedTimeWindow()` of the cart's shipping method (one grid step of grace for the browser's clock; 422 `outside_ordering_window`), then `placeOrder` and `startPayment`; a payment that cannot start still answers the order (`paymentFailed`, the checkout goes to `/bestellung/<id>/fehler`). At most once: the browser sends one `attemptId` per press of the order button and the same id only after `stale_session` (`usePlaceOrder`, no retry after a failure without answer); the process remembers placed attempts per session id and backend (bounded, 30 min) and answers them before the staleness check (a double click's second request; `answerVisitor`'s `known`). The order request waits up to 60 s (`ORDER_TIMEOUT_MS`); without an answer the session is marked unanswered (15 min, per process) and nothing is placed for it again: that request, a retry and a new press poll `listOrders(session, 1, 1)` for about 30 s for an order since the attempt and answer it, else 409 `order_status_unknown` (the checkout: "Wir konnten nicht feststellen, ob deine Bestellung eingegangen ist …"). A new attempt with an empty cart is 409 `order_already_placed` with `details.orderId` when the session placed an order in the last 15 minutes (another tab, a reload: the checkout says "Deine Bestellung ist bereits eingegangen." and links it, no payment, no tracking), else `cart_empty`. A reverse proxy needs a read timeout above about 110 s for `POST /api/checkout/orders` (nginx `proxy_read_timeout 120s`), otherwise the guest sees the generic failure text. **Writes in the browser**: one queue for every BFF write (`queuedWrite` in `app/utils/bffWrite.ts`: cart lines and vouchers, selection, guest, addresses, order, payment), a write waits for the answer (and cookie) of the one before; adding to the cart uses `keepalive`; `app.vue` starts a new visitor's session with `POST /api/session` (`server/api/session.post.ts`, a storefront-own state, no backend request) after the first page has loaded, when the server render found no session it can unseal (`event.context.shopbiteHasVisitorSession`, `app/plugins/visitor-has-session.server.ts`, `useState("visitor-has-session")`); the checkout reads the cart again after 1.5 and 3.5 s when it loads empty within 10 s of an add in the tab (`noteCartWrite`, `cartWrittenWithin`; a full navigation while the add lands). **Shopware adapter** (`server/adapters/shopware/ordering.ts`): the selection is the context's methods (`PATCH /context`, shop-wide `/context` without a token), guests are registered with the request of the 2.x form (`accountType`, the address fields as strings with `salutationId: ""`, `acceptedDataProtection`, `storefrontUrl` matched against the sales channel's domains like the layer did: `devStorefrontUrl`, else the request's origin; the domains are kept 10 min), an address without a country (`AddressInput.country: null`, what the checkout form sends) in the configured `public.site.countryId` as before, a country code by ISO code (`/country` filtered by `iso`, the Store API's limit is 100), a changed address keeps its salutation when the change names none, the order is `/checkout/order` with only `customerComment` (`orderComment()`: `Wunschlieferzeit: HH:MM` or `Wunschabholzeit: HH:MM`, a note on the next line; `readComment()` reads it back, a time well before the order is the next day), sent once with a 60 s deadline (timeout, lock, 5xx: `backend_unavailable`), refusals named by the cart's errors (`shopbite-ordering-*` → `ordering_closed`, blocked methods, unavailable dishes, else `validation_failed`; `CHECKOUT__CART_EMPTY` → `cart_empty`, 403 → `unauthenticated`), `/handle-payment`, `/order/payment`, orders from `/order` with the visitor's token (401/403 and other customers' orders are `not_found`), the payment methods without `preferred` when only the context cannot be read, states mapped to `OrderStatus`/`PaymentStatus`, promotions as discounts, `OrderLine.configuration` with removal ids from a product lookup; 10 s deadline per request, `X-Forwarded-For`, no token in errors. **Memory adapter** (`server/adapters/memory/ordering.ts`): selection, guest and orders per session token, orders from the memory cart (numbers from 10000), so menu → cart → checkout → confirmation runs with `NUXT_SHOP_BITE_BACKEND=memory` (no mails). **App**: `useCheckoutMethods()` (`selection`, `paymentMethods`, `selectShippingMethod`, `selectPaymentMethod`; one shared request for the selection), `useCheckoutOrderer()` (`registerGuest`, `updateAddress`; a guest's details set the customer state, so the header knows it), `usePlaceOrder()`, `useOrder(orderId)` (order pages, payment retry), `useDeliveryTime().wishedTimeFor()` (service date of a chosen time), `toGuestDetails()` in `useRegistrationForm` (a guest and, since step 6, an account go to the BFF), `Checkout/OrdererAddress` (the checkout's address edit, with the one `AddressForm` since step 6), `UserDetail` on the `Orderer`, `OrderConfirmation`/`OrderDetail` on the domain `Order` (`ORDER_STATUS_LABEL`, `PAYMENT_STATUS_LABEL` in `app/utils/orderStatus.ts`), `trackOrder(order)` one Matomo item per order line. Login and account registration in the checkout moved in step 6 (`Summary` reloads the orderer when `useCustomer().isLoggedIn` changes). **Bridge** narrowed to `BRIDGE_ROUTES` (`server/adapters/shopware/sessionBridge.ts`; account routes until step 6, see below); everything else 404 without a request (checkout, payment, cart writes, documents). `/api/payment-methods` (Restaurant schema) asks `CheckoutPort.listPaymentMethods()`.
82
+
83
+ - Moved in step 6 (customer account): `CustomerPort` in both adapters, contract suite `test/contract/customer.contract.ts` (one backend with cart, checkout and orders; fixtures expose the mails a backend sent). **BFF** (`server/api/account/**`, body checks in `server/utils/accountRoutes.ts`, all through `answerVisitor`: private, CSRF and `exclusive` + 409 `stale_session` on writes): `GET /api/account` (`{ customer: Customer | null }`, the logged-in customer, the session's guest or null), `POST /api/account/login` (`{ email, password }`), `/logout`, `/register` (`GuestDetails` + `password` → `{ customer, confirmationRequired }`), `/register/confirm` (the e-mail link's query parameters as they came), `/password-reset` (`{ email }`, 204 for an e-mail with and without account, also when Shopware's limit holds it back), `/password-reset/confirm` (`{ token, newPassword }`), `PATCH /api/account/profile` (`{ salutation?, firstName, lastName }`), `POST /api/account/email` (`{ email, password }`), `/password` (`{ currentPassword, newPassword }` → `{ loggedIn }`), `DELETE /api/account`, `GET`/`POST /api/account/addresses`, `PATCH`/`DELETE /api/account/addresses/[addressId]`, `POST /api/account/addresses/[addressId]/default` (`{ use: "billing" | "delivery" }`), `GET /api/account/orders?page=` (`OrderPort.listOrders`, 100 per page). New domain codes `account_not_confirmed` (403), `account_inactive` (403; Shopware 6.7 answers deactivated customers with bad credentials, the mapping of `CHECKOUT__CUSTOMER_IS_INACTIVE` is for other versions), `already_confirmed` (409), `rate_limited` (429, `details.retryAfterSeconds`), `address_in_use` (409). Login, logout, registration, the confirmation, the password change and the deletion make the backend issue a new state, which reseals the session: the cookie of before is stale in the process and its backend token opens nothing (Shopware replaces the context token; checked across a restart). Passwords are read from request bodies only, never answered or logged; the app logs domain codes only (a `$fetch` error carries its request body). **Shopware adapter** (`server/adapters/shopware/customer.ts`, helpers shared with the checkout through `createShopwareOrdering().visitor`): `/account/login` with the visitor's token (Shopware merges the visitor's cart into the customer's saved cart, quantities add up; logout leaves an empty cart), `/account/register` with `guest: false`, the chosen salutation and the 2.x body (double opt-in pending: `doubleOptInRegistration` without `doubleOptInConfirmDate`; Shopware 6.7 answers `active: true`), `/account/register-confirm`, `/account/change-profile` (a salutation only when given), `/account/change-email` (with the password), `/account/change-password` (Shopware 6.7 logs every session of the customer out: the adapter logs the session in again with the new password; `loggedIn: false` when that fails, the password is changed all the same), `/account/recovery-password` and `-confirm` as shop requests with the visitor's `X-Forwarded-For` (no session needed; Shopware answers an unknown e-mail like a known one, its limit (only known e-mails reach it) is answered alike and logged; the link points to a sales channel domain, `storefrontUrlFor`), `/account/list-address`, `POST`/`PATCH`/`DELETE /account/address[/<id>]` (a change without salutation or country keeps the address's; the answer lacks the country code, so the address is read back), `PATCH /account/address/default-billing|default-shipping/<id>`, `DELETE /account/customer`, `/country`. Error codes mapped by Shopware code (`ACCOUNT_REFUSALS`: `CHECKOUT__CUSTOMER_AUTH_BAD_CREDENTIALS` and `VIOLATION::CUSTOMER_PASSWORD_NOT_CORRECT` → `invalid_credentials`, `..._OPTIN_NOT_COMPLETED` → `account_not_confirmed`, `VIOLATION::CUSTOMER_EMAIL_NOT_UNIQUE` → `email_taken`, `CHECKOUT__CUSTOMER_AUTH_THROTTLED` with `meta.parameters.seconds` → `rate_limited`, another customer's address (400 `CHECKOUT__CUSTOMER_ADDRESS_NOT_FOUND`) → `not_found`, `..._ADDRESS_IS_DEFAULT` → `address_in_use`, an expired reset hash (410) → `not_found`), then 401/403 `unauthenticated`, 429 `rate_limited`, 400 `validation_failed` with fields; `VisitorStoreApi` and `storeApiForVisitor` send `DELETE` too. **Memory adapter** (`server/adapters/memory/customer.ts`): accounts with scrypt-hashed passwords, a new token per login, logout and registration (the old one opens nothing), the customer's cart kept apart while logged out and merged on login (`MemoryCart.merge`), orders owned by the customer (`MemoryAccountsView`), ten failed logins per e-mail and visitor address per minute, double opt-in by seed (`customer.doubleOptIn`), mails handed to `createMemoryBackend(seed, { mail })` (the running storefront sends none: no password reset link, no confirmation). **App**: `useCustomer()` (`customer`, `isLoggedIn`, `isGuest`, `loaded`; `login`, `logout`, `register`, `confirmRegistration`, `updateProfile`, `changeEmail`, `changePassword`, `requestPasswordReset`, `resetPassword`, `deleteAccount`; state `customer`, rendered on the server in `app.vue`, every write through `queuedWrite` + `withStaleRetry`), `useAccountAddresses()`, `useAccountOrders()`, `app/utils/accountMessages.ts` (German texts by domain code). One `AddressForm` (`Address/Form.vue`) on the domain `Address` for the address book and the checkout (`save` prop: the caller saves); `AddressDetail`/`AddressCard` show a domain `Address`. The profile asks for the password when the e-mail changes and has a password change; the address book deletes non-default addresses after a confirmation. App code must not name a composable `useUser`, `useAddress`, `useCustomerOrders` or `useCustomerPassword` (the layer's). Until step 7 the layer's context for the price format was read during server-side rendering (`app/utils/layerContext.ts`, gone; the price format is `ShopConfig`'s since step 7); the account's addresses and orders in the browser are forgotten when the customer changes, and a read answering after a switch is dropped (`app/utils/accountReads.ts`). `storeApiGet`/`storeApiPost`/`storeApiForVisitor` share an outage breaker (`server/utils/outageBreaker.ts`): after two requests without an answer (deadline, no connection) within 15 s and no answer between, every request of the process fails at once with 503 for up to 30 s, one probe 10 s after the last one ended (never two at once); any answer closes it, other errors never count; the order placement and its look-ups run in `bypassOutageBreaker` and never open it. `storeApiForVisitor` takes a request's `timeoutMs` (the order's 60 s). **Bridge** narrowed to `GET context`, `POST salutation|contact-form` and the wishlists (removed in step 7).
84
+
85
+ - Moved in step 7 (wishlist and contact; no browser-direct backend call): `WishlistPort` and `ContactPort` in both adapters, contract suites `test/contract/wishlist.contract.ts` (on the customer fixtures: login, logout, another customer) and `test/contract/contact.contract.ts`. **BFF** (all private; writes CSRF-checked): `GET /api/wishlist` (`WishlistEntry[]`, newest first), `POST /api/wishlist/entries` (a `DishConfiguration`: `{ dishId, variantId?, extraIds?, removedIngredientIds? }` → `WishlistEntry`; an equal one answered as it is), `DELETE /api/wishlist/entries/[entryId]` (204; another customer's or an unknown entry 404), `POST /api/wishlist/merge` (`{ configurations }`, at most 100 → `WishlistEntry[]`), through `answerVisitor` (`server/utils/wishlistRoutes.ts`; 401 `unauthenticated` without a logged-in customer, a checkout guest included; 501 `not_implemented` when the backend keeps no wishlist); `POST /api/contact` (`server/utils/contactRoutes.ts`: `{ salutation?, firstName?, lastName?, email, phone?, subject, message }` → `{ confirmation }`, shop-wide: no session read or created; e-mail, subject at least 3, message 10 to 10 000 characters (without the spaces around them), texts up to 255, no control characters and no line breaks (also NEL, U+2028/2029) outside the message, the fields the restaurant requires not blank, any honeypot `hp` value answered without sending; the visitor's address chain goes to the port as `ContactSender.forwardedFor`), `GET /api/contact/form` (`ContactForm`: which of first name, last name, phone the restaurant requires; always the cached function `contact-form`, also for `?fresh=1`, `config` TTL, purged with the layout); wishlist and contact routes read at most 64 KB (`readSmallBody`, 413 `payload_too_large`); `GET /api/wishlist` runs in the visitor's exclusive section (`exclusiveRead`, it may move Shopware's wishlist); a merge takes the first 100 of up to 1000. **Shopware adapter**: `server/adapters/shopware/wishlist.ts` keeps the plugin's records of 2.x (`/shopbite/wishlist`, `/add`, `/merge`, `DELETE /{id}`: the ordered product = variant else dish, removals by name, extras by product number, sorted), translates them from and to ids with one `/product` lookup (`sw-inheritance`) and the dish's `/cross-selling` (both kept 60 s), refuses what the menu does not offer, moves the customer's Shopware wishlist (`/customer/wishlist`, plain products) into the plugin on a read and deletes it there (first, the list only when nothing moved; an empty or switched-off one not asked again for 10 min per token; one move per token at a time), looks a merge up at once (100 ids per request, unknown ids kept a minute), maps a missing route to `not_implemented`; no request without a token. `server/adapters/shopware/contact.ts` posts `/contact-form` as 2.x did (salutation id of `not_specified`, else the shop's first; empty strings for empty fields, `comment`) to the server endpoint with the visitor's `x-forwarded-for` (`contactOverVisitorApi`, no token), takes the required fields from the plugin's `/shopbite/config` when it names them (`firstNameFieldRequired`, `lastNameFieldRequired`, `phoneNumberFieldRequired`), else from Shopware's validation of an empty message (one probe at a time, no copy in the adapter; nothing required when Shopware cannot tell), Shopware's limit as 429 `rate_limited` (`retryAfterSeconds`), refused fields as 422 `validation_failed`. **Memory adapter**: wishlists per account (`MemoryAccountsView.customerOf`), contact messages to the `contact` callback of `createMemoryBackend` (three per 30 s per client address of the chain; required fields by seed `contact.required`). **ShopConfig** carries `currency` and `locale` (Shopware: `/context` without a token, kept 10 min, shared with the catalog's currency via `priceFormatReader`; when it fails the configuration answers EUR/de-DE, logged, not kept); `useCommercePrice` formats with them (`useNuxtData("shop-config")`, `setPriceConfig` overrides), so `app.vue` reads no backend context. **App**: `useWishlistEntries` on domain `WishlistEntry`, guests in local storage `shopbite-wishlist` as `{ version: 2, entries, pending }` (the 2.x storage, and `sw-wishlist-items` last, converted once with the dish sheets in their order; a 404 or 400 dish dropped, an unloadable one kept `pending`; at most `WISHLIST_LIMIT` 100, `WishlistFullError`; changes wait for a load in flight), customers through the BFF (reads in `guardedAccountRead`, writes through `queuedWrite` + `withStaleRetry`), merge right after the login (`app.vue`); `app/utils/wishlist.ts` (`WishlistSelection`, `sameConfiguration`, `fromLegacyEntry`); the dish sheet emits a `WishlistSelection` (ids), `Wishlist.vue` maps ids to the sheet's names and numbers; `useContactForm` posts to `/api/contact`; `Contact/Form.vue` loads `/api/contact/form` and marks, checks and names at the field what the restaurant requires. **No bridge**: `/api/store-api/**` and `sessionBridge.ts` are gone; `app/plugins/shopware-layer-offline.ts` gives the layer's client the base URL `about:invalid` (browser and SSR) and no token (the layer goes in step 8); `forwardedFor()` is in `server/session/forwardedFor.ts`.
86
+
87
+ Rule for new code: use the ports and the domain types; no Shopware import outside `server/adapters/shopware/`. ESLint (`shopbite/backend-agnostic`) warns on such imports until step 8 makes it an error (111 warnings in 103 files at step 0, 105 after step 1, 55 after step 2, 40 after step 3, 35 after step 4, 22 after step 5, 5 after step 6, 0 after step 7); do not add new ones. Code not yet moved still uses the Shopware layer as described below.
88
+
65
89
  ### Stack
66
90
 
67
91
  - **Nuxt 4** with `app/` directory convention (not `src/`)
@@ -91,38 +115,38 @@ Custom ShopBite plugin endpoints are prefixed `shopbite.*` in the operations typ
91
115
 
92
116
  Key custom composables:
93
117
 
94
- - **`useBusinessHours`** – opening hours with multi-interval support; Sunday is day 7 (not 0)
95
- - **`useDeliveryTime`** – validates slots in 5-minute increments, accounts for the lead time of the selected shipping method (`useShippingLeadTime`; 30 minutes until the config is loaded), handles holidays
96
- - **Lead time per shipping method** (shopbite#6) – `/store-api/shopbite/config` returns `shippingMethods: [{ id, fulfillment: "delivery" | "pickup", leadTimeMinutes }]` (active methods of the sales channel); there is no global `deliveryTime` any more and no guessing from method names. `app/utils/leadTime.ts` (also used by llms.txt): `shippingLeadTime()` for a method (unlisted = delivery without lead time), `fulfillmentLeadTime()` = first method of a fulfillment (`null` without one; home hero/facts and llms.txt then leave the time out), `FULFILLMENT_WORDING` (Wunschlieferzeit/Wunschabholzeit, Liefer-/Abholzeiten), `wishedTimeComment()`/`parseWishedTime()`. `useShippingLeadTime()` follows the checkout's selected shipping method (time field, hint, empty states, comment prefix). The order's `customerComment` is `Wunschlieferzeit: HH:MM` or `Wunschabholzeit: HH:MM`; readers accept both (older orders always say Wunschlieferzeit). `useShopBiteConfig()` exposes `deliveryTime`/`pickupTime` (lead time of the first delivery/pickup method or `null`) and `leadTimeFor(method)`; the home facts have `kind: delivery` and `kind: pickup`
97
- - **`useAddToCart`** – products with extras/toppings use UUID v5 (product ID + sorted extras) as container item reference; simple products bypass the container
118
+ - **Restaurant operations (ADR 0001 step 1)** – `useShopConfig()` (`acceptsOrders`, `timeZone`, `checkAcceptsOrders()`), `useOpeningHours()`, `useHolidays()`, `useShippingMethods()` (`deliveryTime`/`pickupTime` = lead time of the first delivery/pickup method or `null`, `leadTimeFor(methodId)`), `useServiceSchedule()` (time zone, hours and holidays, `null` until loaded) read the `/api/shop/*` and `/api/checkout/shipping-methods` routes through `loadShopData()` (`useShopData.ts`: cached on the server, `?fresh=1` with `withRetries` in the browser). They hold domain types (type imports from `shared/domain` only).
119
+ - **Restaurant time** – `app/utils/restaurantTime.ts` (pure, also used by llms.txt): everything is computed in the restaurant's time zone (`restaurantNow`), never the visitor's clock. `serviceSpans()` joins a late-night opening that the domain splits at midnight (Fri 17:00–24:00 + Sat 00:00–01:30 reads Fri 17:00–01:30; 00:00–24:00 days are not joined); `servicePeriodsOn()` adds yesterday's part after midnight (shown from 00:00 in the checkout's hint), like the plugin's ordering window (nothing on a holiday, not after a holiday). `storeStatusAt()` (store status pill, `useStoreStatus`), `wishedTimeWindow()` (checkout time choice), `firstSlot()`/`minutesInWindow()` for the 5-minute grid. Displays (`openingHours.ts`, `schema.ts`) use the joined spans; a span up to the end of the day reads `24:00` (schema.org `00:00`, a full day `00:00`–`23:59`).
120
+ - **`useDeliveryTime`** – the wished time window: today's spans only (yesterday's late-night span included), from now plus the lead time of the selected shipping method (`useShippingLeadTime`; 30 minutes while unknown) to the end of that span (a span up to 24:00 ends at the 23:55 slot, since 00:00 would read as this morning), never on a holiday; no pre-orders for a later day (the plugin refuses them). A window past midnight has min > max in the time input (reversed range); `validate()`, `slotFor()`, `firstSlotTime` work in the window's minutes.
121
+ - **Lead time per shipping method** (shopbite#6) – from the shop's shipping methods (`ShippingMethod.leadTime`); there is no global `deliveryTime` any more and no guessing from method names. `app/utils/leadTime.ts` (also used by llms.txt): `shippingLeadTime(methods, id)` for a method (unlisted = delivery without lead time), `fulfillmentLeadTime()` = first method of a fulfillment (`null` without one; home hero/facts and llms.txt then leave the time out), `FULFILLMENT_WORDING` (Wunschlieferzeit/Wunschabholzeit, Liefer-/Abholzeiten), `wishedTimeComment()`/`parseWishedTime()`. `useShippingLeadTime()` follows the checkout's selected shipping method (time field, hint, empty states, comment prefix). The order's `customerComment` is `Wunschlieferzeit: HH:MM` or `Wunschabholzeit: HH:MM`; readers accept both (older orders always say Wunschlieferzeit). The home facts have `kind: delivery` and `kind: pickup`
122
+ - **`useAddToCart`** – takes a dish or variant (`OrderableDish`, with the id of the dish a variant belongs to), `Extra`s and removed ingredient names (mapped to their ids from the dish's `ingredients`) and posts the configuration to `/api/cart/lines`; the Shopware adapter turns it into the 2.6.1 line items (plain `product`, or a `container` with the 2.6.1 uuid5 id, so configurations that differ only in removals stay two lines)
98
123
  - **`useAddressAutocomplete`** – proxies Geoapify through `/api/address/autocomplete` to avoid exposing the API key client-side
99
- - **`useShopBiteConfig`** – fetches delivery config and checkout state from the custom Shopware plugin; the server renders from the cached `/api/shopbite/config` (60 s), the browser loads it from Shopware after hydration (`useLiveShopData`) and the checkout every 10 s (`Checkout/Summary.vue`). The plugin does not enforce the checkout switch, so the browser's value is the gate and must come from Shopware
100
- - **`useWishlistEntries`** – the wishlist (#467): an entry is a configured dish (product/variant id + number, `without`, `extras`, the quick view configuration of #411). Customers keep entries in the ShopBite plugin (`/store-api/shopbite/wishlist`, `/add`, `/merge`, `DELETE /{id}`, entity `shopbite_wishlist_item`, shopware-plugin#30), guests in localStorage `shopbite-wishlist` (old `sw-wishlist-items` ids are taken over). `app.vue` loads it on mount and on login merges the guest entries into the account (logout reloads the guest's); a backend without the routes (404) keeps customers in localStorage. On the first load a customer's Shopware core wishlist moves into the plugin and is deleted there. `WishlistSaveButton` (heart in the product sheet header, `aria-pressed` for the current configuration) gets the selection from `ProductDetail` (`selection-changed`); `Wishlist.vue` adds rows with `useAddToCart` (same container line item as the sheet) and opens the sheet on the wishlist page with the saved configuration ("Anpassen").
101
- - **`useSyncWishlist`** – deliberate override of the layer composable (copy of `@shopware/composables` 1.13.0) that does not log the expected 404/403 of a missing or disabled wishlist (#366); only the layer's own `useWishlist` still uses it since #467; compare with the layer source when Renovate bumps `@shopware/composables`
124
+ - **`useShopConfig`** – the server renders from the cached `/api/shop/config` (60 s), the browser loads it live after hydration (`useLiveShopData`, together with hours, holidays and shipping methods) and the checkout every 10 s (`Checkout/Summary.vue`; the lead times only after hydration). The ShopBite plugin refuses an order while ordering is paused (`shopbite-ordering-paused`); as defence in depth and for a clear message, `checkAcceptsOrders()` asks `/api/shop/config?fresh=1` before an order and the checkout does not order when it is off or cannot be checked. Until the config is loaded the time zone is `shopBite.timeZone` (state `shop-time-zone`, from the server's runtime config)
125
+ - **`useWishlistEntries`** – the wishlist (#467, ADR 0001 step 7): an entry is a `WishlistEntry` (a `DishConfiguration` by ids, the menu number, `addedAt`). Customers keep entries in the backend through `/api/wishlist` (Shopware: the ShopBite plugin's `/shopbite/wishlist`, entity `shopbite_wishlist_item`, shopware-plugin#30), guests in localStorage `shopbite-wishlist` (`{ version: 2, entries, pending }`; the 2.x storage and the old `sw-wishlist-items` ids are converted once). `app.vue` loads it on mount and on login merges the guest entries into the account (logout reloads the guest's); a backend without a wishlist (501) keeps customers in localStorage. The customer's Shopware core wishlist moves into the plugin in the adapter's read. `WishlistSaveButton` (heart in the product sheet header, `aria-pressed` for the current configuration) gets the `WishlistSelection` from `ProductDetail` (`selection-changed`); `Wishlist.vue` adds rows with `useAddToCart` (same container line item as the sheet) and opens the sheet on the wishlist page with the saved configuration ("Anpassen").
102
126
 
103
127
  ### Product data model (what Shopware must contain)
104
128
 
105
- The storefront reads plain Shopware entities with fixed names; seed data must match them exactly (`shopware/scripts/seed-demo-menu.py` is a working example):
129
+ The Shopware adapter reads plain Shopware entities with fixed names (`server/adapters/shopware/catalog.ts` maps them to the menu's domain types); seed data must match them exactly (`shopware/scripts/seed-demo-menu.py` is a working example):
106
130
 
107
- - **Navigation:** menu sections are the children of the sales channel navigation root (`readNavigation main-navigation`), scoped to the menu root: `runtimeConfig.public.shopBite.menuCategoryId` if set, else `menuCategoryId` from `/store-api/shopbite/config` (plugin configuration per sales channel, #486). Always resolve it through `menuRootId()` (server, falls back to the navigation root), `menuRootIdStrict()` (server, rejects without the plugin config; the cached navigations `menu` and `home` of `/api/navigation/[type]` use it, resolved once per request on `event.context` for key and fetch, so a fallback menu or one root's sections under another root's key is never cached) or `useMenuRootId()` (app, kept for shops), never read the env directly. Both server variants read the cached plugin config (`shopBiteConfig()`, `server/utils/shopBiteConfig.ts`), which keeps the last good config when Shopware fails and asks again only after 30 s. Category icon comes from the custom field `shopbite_category_icon` (icones.js.org name such as `i-lucide-pizza`), set by the ShopBite plugin.
131
+ - **Navigation:** menu sections are the children of the sales channel navigation root (`readNavigation main-navigation`), scoped to the menu root: `runtimeConfig.public.shopBite.menuCategoryId` if set, else `menuCategoryId` from `/store-api/shopbite/config` (plugin configuration per sales channel, #486). The Shopware adapter resolves it (`menuRootReader()`, `server/adapters/shopware/menuRoot.ts`, strict: it rejects when the plugin configuration cannot be read; the sitemap alone falls back to the navigation root); the BFF caches it as `menuRootData` (`server/utils/navigationData.ts`, cached function `menu-root`, `config` TTL, last good root during an outage), which `/api/menu/root` and the cached navigations `menu` and `home` use for key and tree (resolved once per request on `event.context` and passed to `getNavigation(kind, menuRootId)`, so key and tree never name two roots). In the app use `useMenuRootId()`, never read the env directly. Category icon comes from the custom field `shopbite_category_icon` (icones.js.org name such as `i-lucide-pizza`), set by the ShopBite plugin.
108
132
  - **Property groups:** `Hauptzutaten` (ingredients on the card, deselectable on the detail page, removed ones are appended to the cart label with "-"), `Vegetarisch` and `Vegan` with the option `Ja` (diet badges), `Küche` (kitchen badge). Filterable groups appear as listing filters.
109
- - **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. In the quick view each cross-selling is a collapsible checkbox list that shows 6 entries of a long list and a search field above 15 entries (`Product/CrossSelling.vue`). Selected extras are sent as children of a `container` line item (`useAddToCart.ts`, handled by the ShopBite plugin). The bon card opens the quick view sheet (`Product/QuickView.vue`), whose state is the `produkt` query parameter (product number) via `useProductQuickView` (#325). That deep link is the product URL (#289, no product pages): `productDeepLink()` (`app/utils/productUrl.ts`) takes the product SEO URL when it carries `?produkt=` (the ShopBite plugin sets the template, shopware-plugin#28; the number must be `|url_encode|raw` in the template, the SEO escaper slugifies `ß`) and otherwise builds it from the category SEO URL. The card name is a stretched link to it (a plain click stays in place); a number not in the list (a variant) is loaded and opens with its options selected. The quick view keeps its configuration in the URL (#411): `ohne` (deselected ingredients by name) and `extras` (extras by product number), written live with `router.replace` by `useQuickViewConfiguration`; a variant switch updates `produkt` without swapping the sheet's product (numbers the sheet switched to itself are pinned). The share button (`useShareLink`) uses the Web Share API, else copies the link.
133
+ - **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. In the quick view each cross-selling is a collapsible checkbox list that shows 6 entries of a long list and a search field above 15 entries (`Product/CrossSelling.vue`). Selected extras become children of a `container` line item (`server/adapters/shopware/cart.ts`, handled by the ShopBite plugin). The bon card opens the quick view sheet (`Product/QuickView.vue`), whose state is the `produkt` query parameter (product number) via `useProductQuickView` (#325). That deep link is the product URL (#289, no product pages): `dishLink()` (`app/utils/productUrl.ts`) takes `Dish.path`, which the adapter sets from the product SEO URL when it carries `?produkt=` (the ShopBite plugin sets the template, shopware-plugin#28; the number must be `|url_encode|raw` in the template, the SEO escaper slugifies `ß`), and otherwise builds it from the section's path. The card name is a stretched link to it (a plain click stays in place); a number not in the list (a variant) is loaded (`/api/menu/dishes?number=`) and opens with its options selected. The quick view keeps its configuration in the URL (#411): `ohne` (deselected ingredients by name) and `extras` (extras by product number), written live with `router.replace` by `useQuickViewConfiguration`; a variant switch updates `produkt` without swapping the sheet's product (numbers the sheet switched to itself are pinned). The share button (`useShareLink`) uses the Web Share API, else copies the link.
110
134
  - **Custom fields on products:** `shopbite_receipt_print_type` (`number` prints the menu number on the receipt, `label` prints the name) and `shopbite_delivery_time_factor` (int) and `shopbite_cart_upsell` (bool, suggests the product on the order confirmation step `/bestellung/bestaetigen` via `useCartUpsell`; variant parents are never suggested, a flag on a parent applies to its variants), all from the ShopBite plugin.
111
- - **Allergens and additives (#485):** property groups `Allergene` and `Zusatzstoffe` from the ShopBite plugin (shopware-plugin#36, maintained in the backoffice), code in the option custom field `shopbite_code` (A-R, 1-12), product custom field `shopbite_allergens_checked` = lists complete. `getFoodLabels()`/`foodLabelText()`/`allergensChecked()` in `app/utils/product.ts`. Shown only on request (#500): the bon card and the list show nothing, `Product/FoodLabels.vue` is an info button in the sheet's toolbar that opens a Reka popover (not teleported, so the dialog's focus trap holds) with the names written out; without `shopbite_allergens_checked` the sheet points to the restaurant's phone and never says "no allergens". **Includes filter `translated` too:** custom fields only come back when `customFields` is in the `product` and `property_group_option` includes (listing, search, product route, quick view, top sellers).
112
- - **Variants:** standard configurator settings (`Product/Configurator.vue`); `server/api/product/variant.get.ts` resolves a variant by option ids.
135
+ - **Allergens and additives (#485):** property groups `Allergene` and `Zusatzstoffe` from the ShopBite plugin (shopware-plugin#36, maintained in the backoffice), code in the option custom field `shopbite_code` (A-R, 1-12), product custom field `shopbite_allergens_checked` = lists complete. The adapter maps them to `Dish.foodLabels` (`checked` = `shopbite_allergens_checked`); `foodLabelText()` in `app/utils/dish.ts`. Shown only on request (#500): the bon card and the list show nothing, `Product/FoodLabels.vue` is an info button in the sheet's toolbar that opens a Reka popover (not teleported, so the dialog's focus trap holds) with the names written out; without `shopbite_allergens_checked` the sheet points to the restaurant's phone and never says "no allergens". **Includes filter `translated` too:** custom fields only come back when `customFields` is in the `product` and `property_group_option` includes (`DISH_CRITERIA` of the adapter, used by every catalog request).
136
+ - **Variants:** standard configurator settings (`Product/Configurator.vue`, the detail route's `configurator` as `variantGroups`); `/api/menu/dishes/[dishId]/variant` resolves a variant by option ids (`CatalogPort.findVariant`). The detail route answers a parent with its default variant, which the sheet starts with (`DishDetail.selectedVariantId`); the parent's variants come from one more `/product` request (parent or `parentId`).
113
137
 
114
138
  ### Server routes
115
139
 
116
140
  `server/api/address/autocomplete.get.ts` — Geoapify proxy (keeps API key server-side). Passes on only `text` (3–200 characters), `lang` (`/^[a-z]{2}$/`) and `limit` (1–10), 400 otherwise; the area filter comes from `public.shopBite.addressAutocomplete.boundingBox`, never from the query. Upstream errors are logged with the key redacted and answered with a generic 502 (ofetch messages contain the request URL). Identical lookups come from a bounded in-memory cache (5 min, 500 entries); lookups reaching Geoapify are rate limited per client IP (`addressAutocomplete.rateLimit`, token bucket in memory per process, capacity 0 = off; the IP comes from `X-Forwarded-For`, so the app must run behind a proxy that sets it). Helpers in `server/utils/addressAutocomplete.ts`.
117
141
  `server/utils/shopware/adminApiClient.ts` — Admin API client for server-side Shopware operations requiring elevated credentials.
118
- `server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source (navigation categories from the Store API).
119
- `server/routes/llms.txt.ts` — `/llms.txt` for AI assistants (#402): shop, hours, ordering and the menu with prices, ingredients and diets as Markdown, built by the pure `server/utils/llmsTxt.ts`; `swr` 1 h. Every Store API source is optional (`Promise.allSettled`), content pages blocked in `robots.txt` are left out.
120
- `server/utils/storeApi.ts` — `storeApiPost()` and `MEDIA_INCLUDES` for the routes above. Always send Store API criteria as a POST body (also via `apiClient.invoke("… post …", { body })`): as `_criteria` query parameters Shopware ignores the `includes` projection and returns every field (#312).
142
+ `server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source: the contact page and `NavigationPort.listSitemapEntries()` (Shopware: the pages of the main navigation and the menu root's tree, without links, folders and technical URLs) through `toSitemapUrls()`.
143
+ `server/routes/llms.txt.ts` — `/llms.txt` for AI assistants (#402): shop, hours, ordering and the menu with prices, ingredients and diets as Markdown, built by the pure `server/utils/llmsTxt.ts` (`toLlmsMenu()` from the catalog's sections and dishes); `swr` 1 h. Every source is optional (`Promise.allSettled`), content pages blocked in `robots.txt` are left out.
144
+ `server/utils/storeApi.ts` — `storeApiPost()`/`storeApiGet()` for the routes above and the Shopware adapter. Always send Store API criteria as a POST body (also via `apiClient.invoke("… post …", { body })`): as `_criteria` query parameters Shopware ignores the `includes` projection and returns every field (#312).
121
145
  Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): fatal only in the browser, because a fatal error makes Nitro log a `[request error] [fatal]` block per scanner request (#363).
122
146
  `modules/dev-tooling.ts` registers `@nuxt/eslint`, `@nuxt/hints` and `@nuxt/test-utils/module` only when the storefront itself is the project (not for shops extending the layer, not inside `node_modules`); they are devDependencies, so never add them to `modules` in `nuxt.config.ts` (#378).
123
- The cached Store API handlers (`defineCachedEventHandler`, TTL `public.shopBite.cacheTtl`, a day for products, listings, categories) can be emptied by the backoffice: `POST /api/_cache/purge` with `Authorization: Bearer $NUXT_CACHE_PURGE_SECRET` (route off without the secret, #484). `server/utils/cachePurge.ts` picks the Nitro keys (`cache:nitro:handlers:<name>:<escaped key>`) by id, so a new cached handler needs its `name` in `ALL` there and the id in its `getKey`.
124
- The Nitro cache is bounded (`server/plugins/bounded-cache.ts`): an LRU (`unstorage/drivers/lru-cache`) mounted at `cache:` with at most `cacheStorage.maxEntries` entries (5000) and `maxSizeMb` of serialised data (128), `NUXT_CACHE_STORAGE_*`; evicted entries are fetched again. A shop that mounts its own `nitro.storage.cache` keeps it, `maxEntries` 0 leaves the cache unbounded. `/api/listing/[categoryId]` and `/api/search` validate their parameters before they become keys (`server/utils/listingParams.ts`, 400 otherwise): category id and `properties`/`manufacturer` as 32-hex ids (`|`-separated, at most 50, lower-cased, deduplicated and sorted), `order` from `listingSortings` (empty = Shopware's standard sortings `name-asc`, `name-desc`, `price-asc`, `price-desc`, `topseller`, `score`; add custom sortings there), `p` 1–20, text queries at most 100 characters with whitespace collapsed.
125
- Layout data is cached the same way, because every page renders it, a 404 too (once its own page and once `/__nuxt_error`): a vulnerability scanner probing 404 paths otherwise multiplied its request rate at Shopware many times over. With warm caches an SSR request asks Shopware only for `/context` (per visitor: cart, login); paths with non-ASCII characters that pass the known-path filter still make their SEO lookups uncached, and the browser loads config, hours and holidays once per page load (below). Handlers and TTLs (`cacheTtl.*`, `NUXT_PUBLIC_SHOP_BITE_CACHE_TTL_*`): `/api/navigation/[type]` (`main`, `footer`, `menu`, `home`; key includes the menu root; `navigation`, a day), `/api/breadcrumb/[categoryId]` (`category`; an empty breadcrumb, i.e. an unknown id, is a 404 and not cached), `/api/top-sellers` (`listing`), `/api/payment-methods` (Restaurant schema, asked without a visitor context; `paymentMethods`, 1 h), `/api/shopbite/config` (cached function `shopbite-config`, `config`, 60 s), `/api/shopbite/business-hours` and `/holidays` (`businessHours`/`holidays`, 5 min), `/api/seo-url?path=` (function `seo-url`, `seoUrl`, 10 min; key = lookup field (`pathInfo` for technical URLs, else `seoPathInfo`) + lower-cased value; only matches that spell the looked-up value up to case are stored, because Shopware's collation also ignores accents and trailing spaces and each such variant would add an entry). Config, hours, holidays and the SEO caches use `swr: false`: with Nitro's default `swr: true` an expired entry is still served once, so the TTL would not cap the staleness. A failed Shopware request is never cached. During an outage the layout handlers and `shopBiteConfig()` serve the last good answer per key and otherwise fail fast with 503; after a failure each handler asks Shopware again only after 30 s (`createResilientLoader`, `server/utils/backoff.ts`), and `storeApiGet`/`storeApiPost` do not retry (ofetch retries a GET once by default). Use the loader in a new cached handler. Before an order, `Checkout/Summary.vue` asks Shopware for the checkout switch (`checkCheckoutEnabled`) and does not order when it is off or cannot be checked. Only server-side rendering reads config, hours and holidays from the cache: `useAsyncData` reuses the server payload at hydration (a `refresh()` during hydration does not fetch either), so `useLiveShopData` (app.vue, error.vue) reloads the three keys from Shopware with `refreshNuxtData` after hydration; store status, delivery time choice and order buttons then act on that. Keys contain no language or context: like all cached handlers they call Shopware with the sales channel's access key only. Every purge (any target) empties the layout handlers (`LAYOUT`), the lists and the cached functions `seo-url`, `seo-paths`, `shopbite-config`; `{ "layout": true }` empties only the layout data (and `llms.txt`), for changes of hours, closing days or the checkout switch.
147
+ The cached handlers (`defineCachedEventHandler`, TTL `public.shopBite.cacheTtl`, a day for dishes (`product`), listings, sections (`category`)) can be emptied by the backoffice: `POST /api/_cache/purge` with `Authorization: Bearer $NUXT_CACHE_PURGE_SECRET` (route off without the secret, #484). `server/utils/cachePurge.ts` picks the Nitro keys (`cache:nitro:handlers:<name>:<escaped key>`) by id, so a new cached handler needs its `name` in `ALL` there and the id in its `getKey`. Menu handlers: `variant` (by dish id), and `menu-section`, `listing`, `search`, `top-sellers`, `upsell`, `dish`, `dish-number`, which every menu purge empties (a dish sheet carries its extras, which any product change can reach; a section's sub-sections group its parent's listing).
148
+ The Nitro cache is bounded (`server/plugins/bounded-cache.ts`): an LRU (`unstorage/drivers/lru-cache`) mounted at `cache:` with at most `cacheStorage.maxEntries` entries (5000) and `maxSizeMb` of serialised data (128), `NUXT_CACHE_STORAGE_*`; evicted entries are fetched again. A shop that mounts its own `nitro.storage.cache` keeps it, `maxEntries` 0 leaves the cache unbounded. The menu routes validate their parameters before they become keys (`server/utils/listingParams.ts`, 400 otherwise): section, dish and option ids as the backend's opaque ids (letters, digits, `-`, `_`, at most 64, lower-cased), `filters` as such ids (`|`-separated, at most 50, deduplicated and sorted), `number` at most 64 characters, `order` from `listingSortings` (empty = Shopware's standard sortings `name-asc`, `name-desc`, `price-asc`, `price-desc`, `topseller`, `score`; add custom sortings there), `p` 1–20, text queries at most 100 characters with whitespace collapsed.
149
+ Layout data is cached the same way, because every page renders it, a 404 too (once its own page and once `/__nuxt_error`): a vulnerability scanner probing 404 paths otherwise multiplied its request rate at Shopware many times over. With warm caches an SSR request asks Shopware only for the customer of a visitor with a session (`/account/customer`, step 6; the layer's `/context` read is gone since step 7); paths with non-ASCII characters that pass the known-path filter still make their lookups uncached, and the browser loads config, hours and holidays once per page load (below). Handlers and TTLs (`cacheTtl.*`, `NUXT_PUBLIC_SHOP_BITE_CACHE_TTL_*`): `/api/navigation/[kind]` (`main`, `footer`, `menu`, `home`; the key of `menu` and `home` includes the menu root; `navigation`, a day), `/api/breadcrumb/[sectionId]` (`category`; an unknown section is a 404 and not cached), `/api/top-sellers` (`listing`), `/api/payment-methods` (Restaurant schema, asked without a visitor context; `paymentMethods`, 1 h), the restaurant operations of `server/utils/shopData.ts` (cached functions `shop-config`, `shipping-methods`, `shop-branches`: `config`, 60 s; `shop-opening-hours`, `shop-holidays`: `businessHours`/`holidays`, 5 min), the menu root (cached function `menu-root`, `config`), `/api/resolve-path?path=` (`server/utils/pathRoutes.ts`: cached functions `path-route` and `known-paths`, `seoUrl`, 10 min; see SEO below). Config, hours, holidays, the menu root and the path caches use `swr: false`: with Nitro's default `swr: true` an expired entry is still served once, so the TTL would not cap the staleness. A failed Shopware request is never cached. During an outage the layout handlers, the restaurant operations and the menu root serve the last good answer per key and otherwise fail fast with 503; after a failure each handler asks Shopware again only after 30 s (`createResilientLoader`, `server/utils/backoff.ts`), and `storeApiGet`/`storeApiPost` do not retry (ofetch retries a GET once by default). Use the loader in a new cached handler; it answers a pause as the DomainError `backend_unavailable` (503 with `data.code` through `answerDomain`). A handler whose answer shape changes under its old name gets a versioned key (`versionedKey()`, `server/utils/cacheKeys.ts`, raise `ANSWER_SHAPE`), since shops may keep the cache in persistent storage. Before an order, `Checkout/Summary.vue` asks for the live switch (`checkAcceptsOrders`, `?fresh=1`) and does not order when it is off or cannot be checked. Only server-side rendering reads config, hours, holidays and shipping methods from the cache: `useAsyncData` reuses the server payload at hydration (a `refresh()` during hydration does not fetch either), so `useLiveShopData` (app.vue, error.vue) reloads the four keys live (`?fresh=1`) with `refreshNuxtData` after hydration; store status, wished time choice and order buttons then act on that. Keys contain no language or context: like all cached handlers they call Shopware with the sales channel's access key only. Every purge (any target) empties the layout handlers (`LAYOUT`), the lists and the cached functions of `LAYOUT_FUNCTIONS` (`path-route`, `known-paths`, `menu-root` and the restaurant operations); `{ "layout": true }` empties only the layout data (and `llms.txt`), for changes of hours, closing days or the checkout switch.
126
150
 
127
151
  `server/plugins/security-headers.ts` sends the headers of `runtimeConfig.securityHeaders` (`NUXT_SECURITY_HEADERS_*`, empty value = header off, builders in `server/utils/securityHeaders.ts`) with every response: HSTS (only when `public.storeUrl` is https), `nosniff`, `X-Frame-Options: DENY` plus `Content-Security-Policy: frame-ancestors 'none'`, `Referrer-Policy`, `Permissions-Policy` (camera, microphone, geolocation, usb, browsing-topics off; Web Share and clipboard stay allowed). Rendered HTML gets `Cache-Control: private, no-store` (it may carry the visitor's cart or login, `useUserContextInSSR`) unless a route rule sets one, loses `x-powered-by`, and gets a `Content-Security-Policy-Report-Only` (self, Shopware endpoint, Matomo, extra hosts from `contentSecurityPolicyReportOnly.scriptSrc`/`connectSrc`/`imgSrc`, optional `reportUri`) whose `script-src` lists the sha256 of each inline script of that response (Nuxt's config script and the import map; JSON payload and JSON-LD are data blocks). Inline styles stay allowed (Vue style bindings). The service worker caches no pages (no `runtimeCaching`), so personalised HTML never lands in CacheStorage.
128
152
  `modules/public-cache.ts` (local module, also active in shops extending the layer) adds a 30-day `Cache-Control` route rule for every file in the `public/` folders of all layers; Nitro serves them without one. `image.ipx.maxAge` gives resized logos the same lifetime. Replace a public file under a new name (#273).
@@ -130,7 +154,7 @@ Layout data is cached the same way, because every page renders it, a 404 too (on
130
154
 
131
155
  ### Client-side JavaScript budget (#314)
132
156
 
133
- - Nothing that the first paint does not need belongs in the entry chunk. Components that only some shops use go behind `Lazy…` + `v-if` (`SalesChannelSwitch`); the Matomo registry is imported in `plugins/matomo.ts` after `onNuxtReady`, tracking pushes to `_paq` via `useTrackEvent`. Tracked URLs (`setCustomUrl`) go through `trackingUrl()` (`app/utils/trackingUrl.ts`): no fragment, and of the query only campaign parameters (`utm_*`, `mtm_*`, `pk_*`, `matomo_*`) and the quick view configuration (`produkt`, `ohne`, `extras`), because e-mail links carry one-time secrets; the password reset and registration confirmation pages also `router.replace` their query away once read.
157
+ - Nothing that the first paint does not need belongs in the entry chunk. Components that only some shops use go behind `Lazy…` + `v-if` (`BranchSwitch`, the branches of `/api/shop/branches`); the Matomo registry is imported in `plugins/matomo.ts` after `onNuxtReady`, tracking pushes to `_paq` via `useTrackEvent`. Tracked URLs (`setCustomUrl`) go through `trackingUrl()` (`app/utils/trackingUrl.ts`): no fragment, and of the query only campaign parameters (`utm_*`, `mtm_*`, `pk_*`, `matomo_*`) and the quick view configuration (`produkt`, `ohne`, `extras`), because e-mail links carry one-time secrets; the password reset and registration confirmation pages also `router.replace` their query away once read.
134
158
  - Overlays (`SbSheet`, collapsibles) are created on first use (`v-if` + `nextTick()` before opening), not mounted with the page — mounting forces a layout of the whole page.
135
159
  - Long lists render on the server and hydrate on scroll: `hydrateWhenVisible(Component)` (`app/utils`) keeps the markup and the chunk, Used for the bon cards and the footer.
136
160
  - `NuxtLink` prefetches on interaction only (`experimental.defaults.nuxtLink`), and Rolldown groups shared framework/UI modules into two chunks (`vite.build.rollupOptions.output.codeSplitting`). Measure with Lighthouse behind the h2 proxy (see `docs/notes/2026-09-10-issue-314-mobile-js-cost.md`) before changing either.
@@ -146,10 +170,10 @@ Layout data is cached the same way, because every page renders it, a 404 too (on
146
170
  - Components style only with the `--sb-*` colour tokens and `--font-sb-display`/`--font-sb-body` (the `--font` prefix makes @nuxt/fonts resolve the family and add metric fallbacks) through the `sb-*` utilities (`bg-sb-surface`, `text-sb-ink-muted`, `font-display`, `rounded-sb-control`). No colour mode switch: the preset fixes light or dark.
147
171
  - Base components live in `app/components/Sb/` (`SbButton`, `SbIconButton`, `SbSegmentedControl`, `SbSheet`, `SbChoiceGroup`, `SbCheckbox`, `SbField` + `SbInput`, `SbSelect` (native), `SbStepper`, `SbChip`, `SbStatusPill`, `SbStars`, `SbConfirmDialog`, `SbIcon` with inline stroke icons). Behaviour and accessibility come from Reka UI (radio groups, checkbox, dialog and alert dialog with focus trap). Every control is at least 44 px and has a visible focus ring; icon-only buttons need a `label`; toggles use `aria-pressed` with a stable name. Hide a base component responsively with a wrapper (`<span class="hidden sm:block">`): its own `inline-flex` wins over a `hidden` passed as class. Elements focused only by script (`tabindex="-1"`) get no focus ring. Entry animations go behind `motion-safe:` (a `motion-reduce:animate-none` loses against `data-[state=open]:animate-…`).
148
172
  - No toasts (removed in #445, other responses to be designed): results and errors show where they happen, e.g. `role="alert"` boxes in forms and the checkout, `role="status"` regions, the voucher error at its field.
149
- - Menu (#441): `Category/Listing.vue` has three columns from `lg` (`MenuCategoryIndex` word list, the list, `MenuCartPanel`), `NavigationMobileTop` below `lg` (section chips; the open section's sub-categories as a second chip row led by "Alle", the current chip scrolls into view); `MenuSectionHeader` and `MenuBonCard` (one column, number strip, `photo` for the `bonPhoto` view). The card's button adds a product straight to the cart unless `productNeedsChoice()` (a parent with variants, `childCount` in the listing projection), which opens the quick view; extras stay optional. Cards hydrate on approach (`hydrateWhenVisible`), so a click on a card that has not hydrated yet is lost. Filters live in an `SbSheet`, sorting is an `SbSelect` (`toSortingOptions()`). A section with sub-sections (#487) lists its dishes grouped: direct dishes first, then an `h2` per sub-section in navigation order (`groupBySubsections()`/`findCategory()` in `app/utils/menuGroups.ts`, needs `categoryIds` in the listing projection); the sub-section pages stay.
173
+ - Menu (#441): `Category/Listing.vue` has three columns from `lg` (`MenuCategoryIndex` word list, the list, `MenuCartPanel`), `NavigationMobileTop` below `lg` (section chips; the open section's sub-categories as a second chip row led by "Alle", the current chip scrolls into view); `MenuSectionHeader` and `MenuBonCard` (one column, number strip, `photo` for the `bonPhoto` view). The card's button adds a dish straight to the cart unless `Dish.needsChoice` (a parent with variants), which opens the dish sheet; extras stay optional. Cards hydrate on approach (`hydrateWhenVisible`), so a click on a card that has not hydrated yet is lost. Filters live in an `SbSheet`, sorting is an `SbSelect` (`toSortingOptions()`). A section with sub-sections (#487) lists its dishes grouped: direct dishes first, then an `h2` per sub-section in navigation order (`groupBySubsections()` in `app/utils/menuGroups.ts` over `MenuSection.children` and `Dish.sectionIds`; the menu root `/speisekarte/` stays one list); the sub-section pages stay.
150
174
  - Product sheet (#442): `SbSheet` with a bon header (a custom `#header` gets the full width below a toolbar with the `#actions` and the close button; next to the buttons a long name broke after four letters on a 393 px phone) (number strip, name as `DialogTitle`, diet and description as `DialogDescription`); `Configurator` shows variants as `SbChoiceGroup` (required), `DeselectIngredient` as `SbChip` ingredient chips (pressed = included), `CrossSelling` as `SbCheckbox` rows with a search, `Detail` a sticky footer with `SbStepper` and the add button.
151
- - Cart and checkout (#443): `MenuOrderMode` (`useOrderMode`) and the checkout's shipping section list ALL active shipping methods (`useShippingMethodChoice`, `onlyAvailable: false`), because a delivery-area rule on the shipping city never matches before the guest has an address (fixed in 2.0.3); `useCheckoutMethodGuard` switches only a blocked payment method, a blocked shipping method is reported in the checkout and never switched to pickup. It shows the shipping methods as an `SbSegmentedControl` only when there are two to four. The header cart opens an `SbSheet`; `Cart/Item` uses `SbStepper` (remove at 1). The checkout is one page, `/bestellung/kasse` (the old step routes 301 there, `routeRules`): numbered sections Lieferung oder Abholung (`CheckoutPaymentAndDelivery part="shipping"`), Wann, Ihre Angaben (`CheckoutLoginOrRegister` with Reka tabs, `UserRegistrationForm` (logic in `useRegistrationForm`) / `UserLoginForm`, or `UserDetail`), Bezahlung (`part="payment"`) and the order card in `Checkout/Summary.vue`; the order button says "Zahlungspflichtig bestellen" (§ 312j BGB). Forms validate with Zod on submit and show errors at the fields plus a focused summary in form order; `AddressFields` sets `autocomplete`.
152
- - Order and account (#445): `/bestellung/<id>/erfolg` and `/bestellung/<id>` render `OrderConfirmation` (`OrderDetail`: facts incl. the wished time from the `customerComment`, receipt lines, totals; call card), `/bestellung/<id>/fehler` a payment retry. Login, registration, password pages and the registration confirmation render in `UserAuthPanel`; the account pages in `layouts/account.vue` (link navigation with `aria-current`) with `UserAccountHeader`; `AddressForm` (also used when an address is edited in the checkout). Irreversible actions confirm with `SbConfirmDialog` (focus starts on "Abbrechen"). Search, contact (`useContactForm`), wishlist (`useWishlistEntries`, #467), content pages and `error.vue` (with its own `Header`/`Footer`, because the error page replaces `app.vue`) use the same pieces.
175
+ - Cart and checkout (#443): `MenuOrderMode` (`useOrderMode`) and the checkout's shipping section list ALL active shipping methods (`useShippingMethodChoice`: the shop's shipping methods of `/api/checkout/shipping-methods`), because a delivery-area rule on the shipping city never matches before the guest has an address (fixed in 2.0.3); `useCheckoutMethodGuard` switches only a blocked payment method, a blocked shipping method is reported in the checkout and never switched to pickup. It shows the shipping methods as an `SbSegmentedControl` only when there are two to four. The header cart opens an `SbSheet`; `Cart/Item` uses `SbStepper` (remove at 1). The checkout is one page, `/bestellung/kasse` (the old step routes 301 there, `routeRules`): numbered sections Lieferung oder Abholung (`CheckoutPaymentAndDelivery part="shipping"`), Wann, Ihre Angaben (`CheckoutLoginOrRegister` with Reka tabs, `UserRegistrationForm` (logic in `useRegistrationForm`) / `UserLoginForm`, or `UserDetail`), Bezahlung (`part="payment"`) and the order card in `Checkout/Summary.vue`; the order button says "Zahlungspflichtig bestellen" (§ 312j BGB). Forms validate with Zod on submit and show errors at the fields plus a focused summary in form order; `AddressFields` sets `autocomplete`.
176
+ - Order and account (#445): `/bestellung/<id>/erfolg` and `/bestellung/<id>` render `OrderConfirmation` (`OrderDetail` on the domain `Order`: facts incl. `wishedTime`, receipt lines per dish configuration then the discounts, totals; call card), `/bestellung/<id>/fehler` a payment retry. Login, registration, password pages and the registration confirmation render in `UserAuthPanel`; the account pages in `layouts/account.vue` (link navigation with `aria-current`) with `UserAccountHeader`; one `AddressForm` on the domain `Address` (account and checkout, step 6). Irreversible actions confirm with `SbConfirmDialog` (focus starts on "Abbrechen"). Search, contact (`useContactForm`), wishlist (`useWishlistEntries`, #467), content pages and `error.vue` (with its own `Header`/`Footer`, because the error page replaces `app.vue`) use the same pieces.
153
177
  - Home page (#444): `pages/index.vue` renders `HomeHero` (kicker, `[highlight]{.text-primary}` part in the accent colour via `splitHighlight()`, buttons from `hero.links`, live status, rating card from the Google `usp`; the photo is `hero.image` with the blurred video `hero.poster` as fallback, cropped 4:5 at `hero.imagePosition` (object-position); it sits in a `<picture>` with a `min-width: 640px` source, so phones load a 1 px GIF), `HomeFacts` (`features`), `HomeCategories` (word list, `useHomeMenuCategories`; a wide first category image switches to a full-width photo below the words, and `sizes` asks for the width the crop needs, since thumbnails are picked by width), `HomeHighlights` (top sellers as bon cards), `HomeRestaurant` (`gallery` + opening hours in the SSR HTML) and the two-column `HomeFaq`; `cta` and `mittagstisch` in `content/index.yml` are not shown.
154
178
  - Header and footer (#455): `Header.vue` (logo, main nav, status pill, phone, account, wishlist, cart button opening the cart `SbSheet`, menu `SbSheet` on phones), `Footer.vue` (address, hours, footer navigation columns). `app.vue` has the skip link to `main#inhalt`.
155
179
  - Every colour pair a component renders must be in `CONTRAST_PAIRS`; `test/unit/themePresets.spec.ts` fails if a preset misses WCAG AA. Accent red is for headlines only, never on controls (reads as negative).
@@ -158,28 +182,28 @@ Layout data is cached the same way, because every page renders it, a 404 too (on
158
182
 
159
183
  - This repository, deployed as the app, is the demo shop (demo.shopbite.de) and must not be crawled: its Dokploy deployment sets `NUXT_SITE_INDEXABLE=false`. Never set `site.indexable` in `nuxt.config.ts`: shops extending the layer would inherit it and drop out of search engines.
160
184
  - `server/plugins/site-url.ts` makes `storeUrl` the nuxt-site-config URL, so canonical, sitemap and robots.txt share one base. Build absolute URLs with `toAbsoluteUrl(useSiteConfig().url, path)` (`app/utils/seo.ts`).
161
- - `app.vue` sets the title template (`site.titleTemplate`), canonical from the route, `og:url`, fallback `og:image` (`site.ogImage`) and `twitter:card`. Page titles are plain (`"Warenkorb"`), never suffixed with the shop name. Indexable pages use `usePageSeo` (`standalone: true` skips the template, home page); categories use `useCategorySeo`, which overrides the canonical with the SEO URL.
162
- - Shopware category SEO URLs end in `/` and 404 without it, but the sitemap module strips trailing slashes from every URL. Sitemap entries that need the slash carry `_trailingSlash: true`; `server/plugins/sitemap-trailing-slash.ts` restores it in the XML. Never normalise trailing slashes of backend SEO URLs.
163
- - There are no category page routes: the catch-all `pages/[...all].vue` serves Markdown content pages first and otherwise the category SEO URL of the path, whatever prefix the Shopware template gives it (`/c/Pizza/`, `/speisekarte/pizza/`); paths with a file extension 404 without a backend request. It resolves the path with `useSeoUrlRoute` (category SEO URLs only, product SEO URLs 404, #289), which redirects (301) aliases to the SEO URL: other casing, toggled trailing slash, and old SEO URLs that Shopware keeps after a template or name change (`isCanonical: null`). The Store API hides old SEO URLs unless the criteria filter on `isCanonical` explicitly, so `resolvePath` never finds them; `resolveOldPath` looks them up separately, only for unknown paths. `resolvePath` asks `/api/seo-url`, which caches matches only (a cached miss per scanner path would grow the cache without bound); before any lookup the server asks `/api/seo-url/known`, which checks the path against all current and old category SEO paths (`server/utils/seoPaths.ts`: decoded with `decodeURIComponent`, lower case, without accents, `ß`/`æ`/`œ` written out, without outer slashes; a key with non-ASCII characters or `%` is always let through, since MySQL's collation may match it; list cached as `seo-paths`, `cacheTtl.seoUrl`, paged with `page`, which `/seo-url` honours, not `p`, sorted by `id`) and answers a path no category ever had with a 404 without four backend lookups. Paths no SEO URL can have get a 404 (and `/api/seo-url` answers null) without any lookup (`isHostilePath`): undecodable or invalid UTF-8, `%25`, `..`, technical prefixes not followed by a 32-hex id. Operator caveat: a section created or renamed in the Shopware Administration without a purge 404s at its new URL until the list expires (`cacheTtl.seoUrl`, 10 min); the backoffice purge or any `POST /api/_cache/purge` fixes it at once, `NUXT_PUBLIC_SHOP_BITE_CACHE_TTL_SEO_URL` shortens the window. More than 1000 entries per kind is cached as "no filtering"; a failed load lets every path through for 30 s without asking again.
185
+ - `app.vue` sets the title template (`site.titleTemplate`), canonical from the route, `og:url`, fallback `og:image` (`site.ogImage`) and `twitter:card`. Page titles are plain (`"Warenkorb"`), never suffixed with the shop name. Indexable pages use `usePageSeo` (`standalone: true` skips the template, home page); menu sections use `useCategorySeo`, which overrides the canonical with the section's canonical path (`MenuSection.path`).
186
+ - Shopware's section paths end in `/` and redirect without it, but the sitemap module strips trailing slashes from every URL. Sitemap entries that need the slash carry `_trailingSlash: true` (`toSitemapUrls()`); `server/plugins/sitemap-trailing-slash.ts` restores it in the XML. Never normalise trailing slashes of the paths a backend answers.
187
+ - There are no section page routes: the catch-all `pages/[...all].vue` serves Markdown content pages first (never a backend matter) and otherwise the menu section of the path, whatever prefix the backend gives it (`/c/Pizza/`, `/speisekarte/pizza/`); paths with a file extension 404 without a backend request. `useSectionRoute()` asks `/api/resolve-path` (`NavigationPort.resolvePath`): null is a 404, a redirect a 301 to the canonical path with the query kept (dish links `?produkt=`). The Shopware adapter finds category SEO URLs only (product SEO URLs have no page, #289) and redirects other spellings: other casing, toggled trailing slash, technical URLs (`/navigation/<id>` by `pathInfo`), and old SEO URLs that Shopware keeps after a template or name change (`isCanonical: null`; the Store API hides them unless the criteria filter on `isCanonical`, so they are looked up last, with and without the slash, then the canonical one of the same category and language). `server/utils/pathRoutes.ts` shields the backend: paths no section can have are answered null without any request (`isHostilePath` in `shared/domain/discoverability/paths.ts`: undecodable or invalid UTF-8, `%25`, `..`, control characters, a leading `//` or `/\` (also encoded), longer than 750; the Shopware adapter adds technical prefixes not followed by a 32-hex id, `isHostileShopwarePath`); then the path is checked against all current and former section paths (`NavigationPort.listKnownPaths`, cached as `known-paths`, `cacheTtl.seoUrl`; Shopware pages its category SEO URLs with `page`, which `/seo-url` honours, not `p`, sorted by `id`), compared as `pathKey()` (decoded with `decodeURIComponent`, lower case, without accents, `ß`/`æ`/`œ` written out, without outer slashes; a key with non-ASCII characters or `%` is always let through, since MySQL's collation may match it; paths under `KnownPaths.unlistedPrefixes`, Shopware's technical URLs, too), so a path no section ever had is a 404 without four lookups. Lookups are cached as `path-route` by the path in lower case (unlisted prefixes are case-sensitive and keyed apart, so `/Navigation/<id>` is not the technical `/navigation/<id>`): one entry serves every casing, the answer for the visited spelling is rebuilt with `routeTo()`. Only paths that spell the canonical path up to case (also with the slash toggled) and unlisted ones (one per entity) are stored; misses, former paths and loose matches of the collation (accents, trailing spaces) never create an entry, so a scanner cannot grow the cache per spelling. Operator caveat: a section created or renamed in the Shopware Administration without a purge 404s at its new URL until the list expires (`cacheTtl.seoUrl`, 10 min); the backoffice purge or any `POST /api/_cache/purge` fixes it at once, `NUXT_PUBLIC_SHOP_BITE_CACHE_TTL_SEO_URL` shortens the window. More than 1000 entries per kind is cached as "no filtering"; a failed load lets every path through for 30 s without asking again; during an outage of the lookups the route fails fast with 503 after the first failure.
164
188
  - `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
165
189
  - The home page FAQ (`faq` in `content/index.yml`, `Home/Faq.vue`, #404) uses native `<details>`, not a Reka accordion, which unmounts closed panels, and the answers must be in the SSR HTML. The same items feed the `FAQPage` JSON-LD and `/llms.txt`.
166
190
  - `server/plugins/ai-crawlers.ts` adds two named robots.txt groups via the `robots:config` hook (#403): AI search/assistant bots and AI training bots (lists with sources in `server/utils/aiCrawlers.ts`), toggled by `runtimeConfig.aiCrawlers.search`/`.training`. A crawler matching a named group ignores `*`, so allowed groups repeat the `robots.disallow` paths.
167
- - Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`; `alternateNames` lists other names the shop is listed under, for the Restaurant schema `alternateName` and `/llms.txt`) and is rendered by `components/Footer/Contact.vue`. `useBusinessHours`/`useHolidays` use `immediate: false` (during SSR they read the cached `/api/shopbite/*` routes, after hydration `useLiveShopData` loads them from Shopware); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`. In the browser both requests are retried twice (`withRetries`); `useOpeningHoursData` gives components the combined loading/failed state and `retry()`, and reports a failure only after mounting (a failed server prefetch would otherwise break hydration, #355). Anything that depends on the current time (open/closed status, "today") is computed after mounting: `useStoreStatus` starts its clock in `onMounted`, because the home page prefetches the hours on the server and the server's clock and time zone differ from the visitor's (hydration mismatch, #365).
191
+ - Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`; `alternateNames` lists other names the shop is listed under, for the Restaurant schema `alternateName` and `/llms.txt`) and is rendered by `components/Footer/Contact.vue`. `useOpeningHours`/`useHolidays` use `immediate: false` (during SSR they read the cached `/api/shop/*` routes, after hydration `useLiveShopData` loads them live); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`. In the browser both requests are retried twice (`withRetries`); `useOpeningHoursData` gives components the combined loading/failed state and `retry()`, and reports a failure only after mounting (a failed server prefetch would otherwise break hydration, #355). Anything that depends on the current time (open/closed status, "today") is computed after mounting: `useStoreStatus` starts its clock in `onMounted`, because the home page prefetches the hours on the server and the status may change between the server render and hydration (#365). The time zone is the restaurant's (`ShopConfig.timeZone`), not the visitor's.
168
192
 
169
193
  ### Layer imports
170
194
 
171
- Shops extend the storefront as a Nuxt layer, so paths must resolve from the storefront itself: `~`, `@` and `#shared` point to the shop's folders there. App code imports nothing from `shared/` (only types; a relative import breaks the Nitro server bundle), so `modules/theme.ts` passes what the app needs through runtime config (`shopBite.themePresets`). Files in `nuxt.config.ts` use `fileURLToPath(new URL("./…", import.meta.url))` (`css`, local modules). `main.css` lists `@source "../.."`, because Tailwind's automatic detection only scans the shop. `test/layer/` is a minimal shop (`extends: ["../.."]`) that the CI job `layer-build` builds (`pnpm nuxt build test/layer`); 2.0.0 broke every shop because only the storefront itself was built.
195
+ Shops extend the storefront as a Nuxt layer, so paths must resolve from the storefront itself: `~`, `@` and `#shared` point to the shop's folders there. App code imports nothing from `shared/` but types (`import type … from "../../shared/domain"`, erased at build; a value import broke the Nitro server bundle in 2.0.1; app-local helpers such as `restaurantTime.ts` instead), so `modules/theme.ts` passes what the app needs through runtime config (`shopBite.themePresets`). Files in `nuxt.config.ts` use `fileURLToPath(new URL("./…", import.meta.url))` (`css`, local modules). `main.css` lists `@source "../.."`, because Tailwind's automatic detection only scans the shop. `test/layer/` is a minimal shop (`extends: ["../.."]`) that the CI job `layer-build` builds (`pnpm nuxt build test/layer`); 2.0.0 broke every shop because only the storefront itself was built.
172
196
 
173
197
  ### Testing setup
174
198
 
175
199
  Two Vitest projects in `vitest.config.ts`:
176
200
 
177
- - **`unit`** – `test/unit/`, Node environment, pure function tests
201
+ - **`unit`** – `test/unit/**` and `test/contract/**`, Node environment, pure function, domain, adapter and contract tests
178
202
  - **`nuxt`** – `test/nuxt/`, Nuxt environment via `@nuxt/test-utils`, for composables and components
179
203
 
180
204
  In `test/nuxt/`, a `mockNuxtImport("useRuntimeConfig")` without `app.baseURL` breaks the router setup of the test environment (`useRouter()` is undefined, see `useAddressAutocomplete.test.ts` for a working mock). For config values, prefer setting them on the real config, e.g. `Object.assign(useRuntimeConfig().public.site, { … })`.
181
205
 
182
- Accessibility checks (#446) in `test/a11y/` run axe (WCAG 2.1 AA) on home, menu, product sheet, cart, checkout, order confirmation and payment failure (the order is a mocked Store API response), login, registration and the password pages, search, contact, wishlist, a content page and the 404 page, desktop and phone (`pnpm test:a11y`, Playwright projects `a11y` and `a11y-mobile`); serious and critical violations fail. They need no login and only add a product to a guest cart. They test the running build (Playwright starts `.output/server/index.mjs`); the preset is runtime config, so CI runs the `a11y` matrix job per preset on one build with `NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`. Locally: `pnpm build`, then `NUXT_PUBLIC_SHOP_BITE_THEME_PRESET=grill NUXT_PUBLIC_STORE_URL=http://localhost:<port> pnpm test:a11y`.
206
+ Accessibility checks (#446) in `test/a11y/` run axe (WCAG 2.1 AA) on home, menu, product sheet, cart, checkout, order confirmation and payment failure (the order is a mocked answer of `/api/orders/[orderId]`), login, registration and the password pages, search, contact, wishlist, a content page and the 404 page, desktop and phone (`pnpm test:a11y`, Playwright projects `a11y` and `a11y-mobile`); serious and critical violations fail. They need no login and only add a product to a guest cart. They test the running build (Playwright starts `.output/server/index.mjs`); the preset is runtime config, so CI runs the `a11y` matrix job per preset on one build with `NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`. Locally: `pnpm build`, then `NUXT_PUBLIC_SHOP_BITE_THEME_PRESET=grill NUXT_PUBLIC_STORE_URL=http://localhost:<port> pnpm test:a11y`.
183
207
 
184
208
  E2E tests in `test/e2e/` use Playwright (Chromium only) and require `TEST_USER` / `TEST_USER_PASS` env vars. A local dev server must be running before the suite executes.
185
209