@shopbite-de/storefront 2.2.1 → 2.4.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 (69) hide show
  1. package/.github/workflows/build.yaml +2 -2
  2. package/.github/workflows/ci.yaml +11 -11
  3. package/.nuxtrc +1 -1
  4. package/CLAUDE.md +13 -7
  5. package/app/app.vue +10 -7
  6. package/app/components/Address/Fields.vue +1 -2
  7. package/app/components/Category/Breadcrumb.vue +9 -10
  8. package/app/components/Checkout/Summary.vue +27 -2
  9. package/app/components/Header.vue +6 -2
  10. package/app/components/Menu/BonCard.vue +1 -2
  11. package/app/components/Order/Confirmation.vue +1 -2
  12. package/app/components/Product/QuickView.vue +1 -2
  13. package/app/composables/useBusinessHours.ts +35 -14
  14. package/app/composables/useHolidays.ts +31 -11
  15. package/app/composables/useHomeMenuCategories.ts +6 -34
  16. package/app/composables/useLiveShopData.ts +17 -0
  17. package/app/composables/useNavigation.ts +14 -66
  18. package/app/composables/useNavigationSearch.ts +8 -31
  19. package/app/composables/useRestaurantSchema.ts +2 -13
  20. package/app/composables/useSeoUrlRoute.ts +21 -0
  21. package/app/composables/useShopBiteConfig.ts +50 -6
  22. package/app/composables/useTopSellers.ts +2 -43
  23. package/app/error.vue +4 -0
  24. package/docs/notes/2026-09-10-issue-275-accessibility.md +2 -2
  25. package/docs/notes/2026-09-12-issue-327-home-hero.md +1 -1
  26. package/docs/notes/2026-09-13-issue-332-home-info-cards.md +1 -3
  27. package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +1 -1
  28. package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +1 -1
  29. package/docs/notes/2026-09-23-issue-388-home-sections.md +2 -2
  30. package/docs/notes/2026-10-05-issue-401-restaurant-schema-ordering.md +1 -1
  31. package/docs/notes/2026-11-18-dependency-update.md +118 -0
  32. package/modules/theme.ts +1 -1
  33. package/node.dockerfile +7 -7
  34. package/nuxt.config.ts +22 -1
  35. package/package.json +40 -40
  36. package/pnpm-workspace.yaml +0 -2
  37. package/server/api/_cache/purge.post.ts +6 -3
  38. package/server/api/breadcrumb/[categoryId].get.ts +31 -0
  39. package/server/api/navigation/[type].get.ts +97 -0
  40. package/server/api/payment-methods.get.ts +29 -0
  41. package/server/api/seo-url/index.get.ts +17 -0
  42. package/server/api/seo-url/known.get.ts +33 -0
  43. package/server/api/shopbite/business-hours.get.ts +22 -0
  44. package/server/api/shopbite/config.get.ts +6 -0
  45. package/server/api/shopbite/holidays.get.ts +20 -0
  46. package/server/api/top-sellers.get.ts +59 -0
  47. package/server/plugins/ai-crawlers.ts +1 -1
  48. package/server/plugins/site-url.ts +2 -2
  49. package/server/routes/llms.txt.ts +6 -2
  50. package/server/utils/backoff.ts +67 -0
  51. package/server/utils/cachePurge.ts +45 -12
  52. package/server/utils/menuRoot.ts +24 -18
  53. package/server/utils/seoPaths.ts +130 -0
  54. package/server/utils/seoUrlCache.ts +98 -0
  55. package/server/utils/shopBiteConfig.ts +30 -0
  56. package/server/utils/storeApi.ts +25 -1
  57. package/test/a11y/presets.test.ts +3 -1
  58. package/test/layer/nuxt.config.ts +1 -1
  59. package/test/nuxt/CheckoutOnePage.test.ts +2 -0
  60. package/test/nuxt/CheckoutSummary.test.ts +38 -2
  61. package/test/nuxt/HeaderFooterPreset.test.ts +13 -4
  62. package/test/nuxt/liveShopData.test.ts +114 -0
  63. package/test/nuxt/useShopBiteConfig.test.ts +22 -0
  64. package/test/nuxt/useTopSellers.test.ts +10 -27
  65. package/test/unit/cachePurge.spec.ts +41 -0
  66. package/test/unit/layoutCacheRoutes.spec.ts +566 -0
  67. package/test/unit/nitroStubs.ts +99 -0
  68. package/test/unit/seoPaths.spec.ts +117 -0
  69. package/patches/@shopware__nuxt-module@1.5.2.patch +0 -13
@@ -65,12 +65,12 @@ jobs:
65
65
  - name: Install pnpm
66
66
  uses: pnpm/action-setup@v6
67
67
  with:
68
- version: 12.11.2
68
+ version: 12.21.0
69
69
 
70
70
  - name: Install Node.js
71
71
  uses: actions/setup-node@v7
72
72
  with:
73
- node-version: '24'
73
+ node-version: '26'
74
74
  cache: 'pnpm'
75
75
  registry-url: 'https://registry.npmjs.org'
76
76
 
@@ -25,11 +25,11 @@ jobs:
25
25
 
26
26
  - uses: pnpm/action-setup@v6
27
27
  with:
28
- version: 12.11.2
28
+ version: 12.21.0
29
29
 
30
30
  - uses: actions/setup-node@v7
31
31
  with:
32
- node-version: '24'
32
+ node-version: '26'
33
33
  cache: 'pnpm'
34
34
 
35
35
  - name: Install build dependencies
@@ -69,11 +69,11 @@ jobs:
69
69
 
70
70
  - uses: pnpm/action-setup@v6
71
71
  with:
72
- version: 12.11.2
72
+ version: 12.21.0
73
73
 
74
74
  - uses: actions/setup-node@v7
75
75
  with:
76
- node-version: '24'
76
+ node-version: '26'
77
77
 
78
78
  - name: Restore workspace from cache
79
79
  uses: actions/cache/restore@v6
@@ -105,11 +105,11 @@ jobs:
105
105
 
106
106
  - uses: pnpm/action-setup@v6
107
107
  with:
108
- version: 12.11.2
108
+ version: 12.21.0
109
109
 
110
110
  - uses: actions/setup-node@v7
111
111
  with:
112
- node-version: '24'
112
+ node-version: '26'
113
113
 
114
114
  - name: Restore workspace from cache
115
115
  uses: actions/cache/restore@v6
@@ -134,11 +134,11 @@ jobs:
134
134
 
135
135
  - uses: pnpm/action-setup@v6
136
136
  with:
137
- version: 12.11.2
137
+ version: 12.21.0
138
138
 
139
139
  - uses: actions/setup-node@v7
140
140
  with:
141
- node-version: '24'
141
+ node-version: '26'
142
142
 
143
143
  - name: Restore workspace from cache
144
144
  uses: actions/cache/restore@v6
@@ -172,11 +172,11 @@ jobs:
172
172
 
173
173
  - uses: pnpm/action-setup@v6
174
174
  with:
175
- version: 12.11.2
175
+ version: 12.21.0
176
176
 
177
177
  - uses: actions/setup-node@v7
178
178
  with:
179
- node-version: '24'
179
+ node-version: '26'
180
180
 
181
181
  - name: Restore workspace from cache
182
182
  uses: actions/cache/restore@v6
@@ -226,7 +226,7 @@ jobs:
226
226
  #
227
227
  # - uses: actions/setup-node@v6
228
228
  # with:
229
- # node-version: '24'
229
+ # node-version: '26'
230
230
  #
231
231
  # - name: Restore workspace from cache
232
232
  # uses: actions/cache/restore@v5
package/.nuxtrc CHANGED
@@ -1 +1 @@
1
- setups.@nuxt/test-utils="4.3.3"
1
+ setups.@nuxt/test-utils="4.4.0"
package/CLAUDE.md CHANGED
@@ -32,6 +32,10 @@ pnpm load-schema # Reload Shopware API schema
32
32
 
33
33
  pnpm 12 (pinned in `package.json`, CI and `node.dockerfile`). Settings live in `pnpm-workspace.yaml` (`.npmrc` is auth/registry only since pnpm 11). pnpm 12 rejects packages published less than 24 hours ago (`minimumReleaseAge`), also in an existing lockfile; update dependencies with pnpm 12 itself, not an older global pnpm (`docs/notes/2026-09-21-dependency-update.md`).
34
34
 
35
+ ### Test-driven development
36
+
37
+ Work test-first (red, green, refactor): for a bug, first write a test that reproduces it and fails on the current code, then fix it; for new behaviour, write the tests that describe it before the implementation. The test lands in the same commit as the change it covers. Changes with nothing to assert (content, copy, styling, dependency bumps) skip this; say so in the commit message.
38
+
35
39
  ### Running a single test
36
40
 
37
41
  ```bash
@@ -47,11 +51,12 @@ pnpm playwright test test/e2e/checkout.spec.ts
47
51
 
48
52
  Always run `nuxt typecheck` via the `pnpm typecheck` script, not via `npx vue-tsc`. The global npx-cached `vue-tsc` version may not be compatible with the project's installed `vue-router`. If `.nuxt/tsconfig.json` has stale pnpm paths after a dependency update (or after adding/renaming a composable), run `pnpm nuxt prepare` to regenerate it.
49
53
 
50
- `pnpm typecheck` must stay at zero errors; CI runs it in the lint job. The sources of `@shopware/composables` and the `@shopware/nuxt-module` plugin are part of the checked program, so three things keep them green (see `docs/notes/2026-09-08-issue-277-typecheck.md`):
54
+ `pnpm typecheck` must stay at zero errors; CI runs it in the lint job. The sources of `@shopware/composables` and the `@shopware/nuxt-module` plugin are part of the checked program, so two things keep them green (see `docs/notes/2026-09-08-issue-277-typecheck.md`):
51
55
 
52
56
  - `shopware.d.ts` falls back to the api-client's default types for operations/schemas our instance does not expose, and keeps `LineItem.payload` optional.
53
57
  - `api-gen.config.json` applies the upstream schema patches plus `api-types/storeApiSchema.shopbite.overrides.json` when generating types.
54
- - `patches/@shopware__nuxt-module@1.5.2.patch` (pnpm patch) points the plugin's `ShopwareNuxtOptions` import at `./dist/index` (the package ships no `src/`). Since 1.5.2 the plugin carries its explicit type upstream, so this one line is all that is left. When Renovate bumps `@shopware/nuxt-module`, the patch must be re-applied to the new version (`pnpm patch @shopware/nuxt-module@<version>`), or dropped once upstream fixes the import.
58
+
59
+ Until 1.5.2 a pnpm patch fixed the plugin's `ShopwareNuxtOptions` import (`./src`, not shipped). `@shopware/nuxt-module` 1.6 imports `ShopwareNuxtOptions` from its package name, so the patch is gone (`docs/notes/2026-11-18-dependency-update.md`). If a future version breaks the plugin's types again, patch it with `pnpm patch @shopware/nuxt-module@<version>` and add `patches/` to `node.dockerfile`'s `COPY`.
55
60
 
56
61
  Do not name a project composable like one from the `@shopware/composables` layer (e.g. `useCategory`): the project version shadows the layer's inside the layer's own code as well.
57
62
 
@@ -90,7 +95,7 @@ Key custom composables:
90
95
  - **`useDeliveryTime`** – validates slots in 5-minute increments, accounts for `deliveryMinutes` (default 30), handles holidays
91
96
  - **`useAddToCart`** – products with extras/toppings use UUID v5 (product ID + sorted extras) as container item reference; simple products bypass the container
92
97
  - **`useAddressAutocomplete`** – proxies Geoapify through `/api/address/autocomplete` to avoid exposing the API key client-side
93
- - **`useShopBiteConfig`** – fetches delivery config and checkout state from the custom Shopware plugin
98
+ - **`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
94
99
  - **`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").
95
100
  - **`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`
96
101
 
@@ -98,7 +103,7 @@ Key custom composables:
98
103
 
99
104
  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):
100
105
 
101
- - **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 `useMenuRootId()` (app) or `menuRootId()` (server), 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.
106
+ - **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.
102
107
  - **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.
103
108
  - **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.
104
109
  - **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.
@@ -115,6 +120,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
115
120
  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).
116
121
  `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).
117
122
  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`.
123
+ 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.
118
124
 
119
125
  `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).
120
126
  `server/api/content/*.get.ts` — Nuxt Content queries for the pages. Do not call `queryCollection()` in page code: in the browser it downloads the SQLite WASM build (865 KB) on client-side navigation (#314).
@@ -133,7 +139,7 @@ The cached Store API handlers (`defineCachedEventHandler`, TTL `public.shopBite.
133
139
 
134
140
  ### Style presets and base components (#439–#446)
135
141
 
136
- - Every shop has a style preset: `trattoria` (default), `grill` (dark) or `asia`. `shopBite.preset` in nuxt.config.ts (or `NUXT_SHOPBITE_PRESET` at build time) sets the default, `shopBite.colors` overrides tokens of that preset (the build warns when a pair misses WCAG AA). `modules/theme.ts` writes the stylesheets of all presets into the build (`.nuxt/shopbite-theme.css`, each scoped to `:root[data-preset=…]`) and registers their fonts (listed before `@nuxt/fonts`; browsers fetch only the faces in use). The active preset is runtime config `shopBite.themePreset` (`NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`): `useThemePreset()` returns `preset`, `menuView` and `colorMode` (from `THEME_PRESETS`), `plugins/theme-preset.ts` sets `data-preset` on `<html>`. One build serves every preset; the lead demos rely on it. `shopBite.logoUrl` (`NUXT_PUBLIC_SHOP_BITE_LOGO_URL`) replaces the header logo files (`public/light|dark/Logo.png`, chosen by the preset's colour mode).
142
+ - Every shop has a style preset: `trattoria` (default), `grill` (dark) or `asia`. `shopBite.preset` in nuxt.config.ts (or `NUXT_SHOPBITE_PRESET` at build time) sets the default, `shopBite.colors` overrides tokens of that preset (the build warns when a pair misses WCAG AA). `modules/theme.ts` writes the stylesheets of all presets into the build (`.nuxt/shopbite-theme.css`, each scoped to `:root[data-preset=…]`) and registers their fonts (listed before `@nuxt/fonts`; browsers fetch only the faces in use). The active preset is runtime config `shopBite.themePreset` (`NUXT_PUBLIC_SHOP_BITE_THEME_PRESET`): `useThemePreset()` returns `preset`, `menuView` and `colorMode` (from `THEME_PRESETS`), `plugins/theme-preset.ts` sets `data-preset` on `<html>`. One build serves every preset, so a single image can run several shops. `shopBite.logoUrl` (`NUXT_PUBLIC_SHOP_BITE_LOGO_URL`) replaces the header logo files (`public/light|dark/Logo.png`, chosen by the preset's colour mode).
137
143
  - 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.
138
144
  - 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-…`).
139
145
  - 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.
@@ -151,11 +157,11 @@ The cached Store API handlers (`defineCachedEventHandler`, TTL `public.shopBite.
151
157
  - `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`).
152
158
  - `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.
153
159
  - 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.
154
- - 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.
160
+ - 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.
155
161
  - `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
156
162
  - 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`.
157
163
  - `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.
158
- - 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` (app.vue loads them on mount); 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).
164
+ - 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).
159
165
 
160
166
  ### Layer imports
161
167
 
package/app/app.vue CHANGED
@@ -33,10 +33,14 @@ if (sessionContextData.value) {
33
33
  useSessionContext(sessionContextData.value);
34
34
  }
35
35
 
36
- // Business hours and holidays feed the store status in the header
37
- // (HeaderStoreStatus) and the delivery time selection.
38
- const { refresh: refreshBusinessHours } = useBusinessHours();
39
- const { refresh: refreshHolidays } = useHolidays();
36
+ // Business hours, holidays and the checkout switch feed the store status
37
+ // (HeaderStoreStatus), the delivery time selection and the order buttons.
38
+ // The server renders them from its caches; after hydration the browser
39
+ // loads them from Shopware (useLiveShopData).
40
+ useBusinessHours();
41
+ useHolidays();
42
+ useShopBiteConfig();
43
+ useLiveShopData();
40
44
 
41
45
  const { refreshCart } = useCart();
42
46
  // Wishlist entries (#467): loaded in the browser, not during SSR. A login
@@ -50,8 +54,7 @@ watch(isLoggedIn, (loggedIn, before) => {
50
54
  else loadWishlist();
51
55
  });
52
56
 
53
- onMounted(async () => {
54
- await Promise.all([refreshHolidays(), refreshBusinessHours()]);
57
+ onMounted(() => {
55
58
  refreshCart();
56
59
  });
57
60
 
@@ -97,7 +100,7 @@ useSeoMeta({
97
100
  </script>
98
101
 
99
102
  <template>
100
- <VitePwaManifest />
103
+ <NuxtPwaManifest />
101
104
  <NuxtLoadingIndicator />
102
105
 
103
106
  <div>
@@ -164,8 +164,7 @@ const error = (name: string) => props.errors?.[`${props.prefix}.${name}`];
164
164
  class="flex flex-col gap-3 rounded-sb-control bg-sb-primary-tint p-4 font-body text-sb-ink sm:col-span-6 sm:flex-row sm:items-center sm:justify-between"
165
165
  >
166
166
  <span>
167
- Meinten Sie: <strong>{{ correction?.label }}</strong
168
- >?
167
+ Meinten Sie: <strong>{{ correction?.label }}</strong>?
169
168
  </span>
170
169
  <SbButton variant="secondary" @click="applyCorrection"
171
170
  >Übernehmen</SbButton
@@ -7,8 +7,6 @@ const props = defineProps<{
7
7
 
8
8
  const { categoryId } = toRefs(props);
9
9
 
10
- const { apiClient } = useShopwareContext();
11
-
12
10
  const breadcrumbJsonLd = ref<object | null>(null);
13
11
 
14
12
  useHead(() => ({
@@ -27,14 +25,15 @@ const cacheKey = computed(() => `breadcrumb-${categoryId.value}`);
27
25
 
28
26
  const { data } = await useAsyncData(cacheKey, async () => {
29
27
  if (!categoryId.value) return [];
30
- const response = await apiClient.invoke(
31
- "readBreadcrumb get /breadcrumb/{id}",
32
- {
33
- pathParams: { id: categoryId.value },
34
- query: { type: "category" },
35
- },
36
- );
37
- return response.data;
28
+ // cached on the server (server/api/breadcrumb); 404 = empty breadcrumb
29
+ try {
30
+ return await $fetch<Schemas["BreadcrumbCollection"]>(
31
+ `/api/breadcrumb/${categoryId.value}`,
32
+ );
33
+ } catch (error) {
34
+ if ((error as { statusCode?: number }).statusCode === 404) return [];
35
+ throw error;
36
+ }
38
37
  });
39
38
 
40
39
  const items = computed<{ label?: string; to: string }[]>(() => {
@@ -7,7 +7,8 @@ const { createOrder, selectedPaymentMethod, selectedShippingMethod } =
7
7
  useCheckout();
8
8
  const { refreshCart } = useCart();
9
9
  const { isLoggedIn, isGuestSession, refreshUser } = useUser();
10
- const { isCheckoutEnabled, refresh } = useShopBiteConfig();
10
+ const { isCheckoutEnabled, refresh, checkCheckoutEnabled } =
11
+ useShopBiteConfig();
11
12
  const { trackOrder } = useTrackEvent();
12
13
  const { isLoading: isLoadingOpeningHours, hasFailed: hasOpeningHoursFailed } =
13
14
  useOpeningHoursData();
@@ -89,10 +90,34 @@ async function hasAvailableCheckoutMethods(): Promise<boolean> {
89
90
  return false;
90
91
  }
91
92
 
93
+ /**
94
+ * The checkout switch as Shopware has it now: the page may still show the
95
+ * value of the server render, and the plugin accepts orders regardless.
96
+ */
97
+ async function isCheckoutStillEnabled(): Promise<boolean> {
98
+ const enabled = await checkCheckoutEnabled();
99
+ if (enabled) return true;
100
+ reportError(
101
+ enabled === false
102
+ ? {
103
+ title: "Bestellung nicht möglich",
104
+ description:
105
+ "Es werden aktuell keine weiteren Bestellungen mehr aufgenommen.",
106
+ }
107
+ : {
108
+ title: "Bestellung nicht möglich",
109
+ description:
110
+ "Ob gerade Bestellungen angenommen werden, konnte nicht geprüft werden. Bitte versuche es in einem Moment erneut.",
111
+ },
112
+ );
113
+ return false;
114
+ }
115
+
92
116
  async function handleCreateOrder() {
93
117
  isPlacingOrder.value = true;
94
118
  orderError.value = null;
95
119
  try {
120
+ if (!(await isCheckoutStillEnabled())) return;
96
121
  if (!(await hasAvailableCheckoutMethods())) return;
97
122
 
98
123
  const order = await createOrder({
@@ -180,7 +205,7 @@ const checkoutButtonLabel = computed<string>(() => {
180
205
  return "Bitte zuerst Ihre Angaben speichern";
181
206
  }
182
207
 
183
- // app.vue loads business hours and holidays after mounting. Until then (or
208
+ // app.vue loads business hours and holidays after hydration. Until then (or
184
209
  // when that fails) an invalid time says nothing about the shop being closed
185
210
  // (#349, #355).
186
211
  if (isLoadingOpeningHours.value) {
@@ -10,8 +10,8 @@ import { useUser } from "@shopware/composables";
10
10
  const { mainMenu } = useNavigation(false);
11
11
  const { site, shopBite } = useRuntimeConfig().public;
12
12
  const { colorMode } = useThemePreset();
13
- // A logo URL from runtime config (NUXT_PUBLIC_SHOP_BITE_LOGO_URL, e.g. the
14
- // lead demos) wins over the files in public/; the dark presets use dark/.
13
+ // A logo URL from runtime config (NUXT_PUBLIC_SHOP_BITE_LOGO_URL, e.g. one
14
+ // image serving several shops) wins over the files in public/; the dark presets use dark/.
15
15
  const logoSrc = computed(
16
16
  () =>
17
17
  (shopBite as { logoUrl?: string }).logoUrl ||
@@ -217,6 +217,10 @@ function logoutHandler() {
217
217
  <path d="M16 10a4 4 0 0 1-8 0" />
218
218
  </svg>
219
219
  <span class="hidden sm:inline" aria-hidden="true">Warenkorb</span>
220
+ <!-- the space keeps the visible text "Warenkorb 2" (not
221
+ "Warenkorb2") part of the button name (WCAG 2.5.3); a flex
222
+ container does not render it -->
223
+ {{ " " }}
220
224
  <span
221
225
  v-if="cartCount"
222
226
  aria-hidden="true"
@@ -138,8 +138,7 @@ function onLinkClick(event: MouseEvent) {
138
138
  >{{ name }}</a
139
139
  >
140
140
  <template v-else>
141
- <span class="sr-only">{{ numberLabel }}</span
142
- >{{ name }}
141
+ <span class="sr-only">{{ numberLabel }}</span>{{ name }}
143
142
  </template>
144
143
  </h3>
145
144
  <p
@@ -48,8 +48,7 @@ onMounted(async () => {
48
48
  Wir haben sie erhalten und bereiten sie jetzt vor.
49
49
  <template v-if="order?.orderNumber">
50
50
  Ihre Bestellnummer ist
51
- <strong class="tabular-nums">{{ order.orderNumber }}</strong
52
- >.
51
+ <strong class="tabular-nums">{{ order.orderNumber }}</strong>.
53
52
  </template>
54
53
  </p>
55
54
  </header>
@@ -78,8 +78,7 @@ function onVariantSelected(variant: Schemas["Product"]) {
78
78
  <DialogTitle
79
79
  class="font-display text-xl leading-tight hyphens-auto [overflow-wrap:anywhere] sm:text-2xl"
80
80
  >
81
- <span class="sr-only">{{ numberLabel }}</span
82
- >{{ label }}
81
+ <span class="sr-only">{{ numberLabel }}</span>{{ label }}
83
82
  </DialogTitle>
84
83
  <DialogDescription
85
84
  v-if="description || diets.length"
@@ -1,27 +1,48 @@
1
1
  import { useShopwareContext } from "#imports";
2
2
  import type { Ref } from "vue";
3
+ import type { Schemas } from "#shopware";
3
4
  import { setTime } from "~/utils/time";
4
5
 
5
6
  export type ServiceInterval = { start: Date; end: Date };
6
7
 
8
+ export const BUSINESS_HOURS_KEY = "business-hours";
9
+
10
+ type ApiClient = ReturnType<typeof useShopwareContext>["apiClient"];
11
+
12
+ /**
13
+ * Weekly opening hours: from the server's cache (`/api/shopbite/business-
14
+ * hours`, `cacheTtl.businessHours`) for server-side rendering, from
15
+ * Shopware in the browser, where app.vue reloads them after hydration
16
+ * (useLiveShopData). Retried in the browser only: on the server a retry
17
+ * would delay the page (#355).
18
+ */
19
+ export async function loadBusinessHours(
20
+ apiClient: ApiClient,
21
+ fromServerCache: boolean,
22
+ retryDelays: readonly number[] = OPENING_HOURS_RETRY_DELAYS,
23
+ ): Promise<Schemas["BusinessHourStruct"]["businessHours"]> {
24
+ if (fromServerCache) {
25
+ const cached = await $fetch<Schemas["BusinessHourStruct"]>(
26
+ "/api/shopbite/business-hours",
27
+ );
28
+ return cached.businessHours;
29
+ }
30
+ const response = await withRetries(
31
+ () =>
32
+ apiClient.invoke(
33
+ "shopbite.business-hour.get get /shopbite/business-hour",
34
+ ),
35
+ retryDelays,
36
+ );
37
+ return response.data.businessHours;
38
+ }
39
+
7
40
  export function useBusinessHours() {
8
41
  const { apiClient } = useShopwareContext();
9
42
 
10
43
  const { data, pending, status, refresh } = useAsyncData(
11
- "business-hours",
12
- async () => {
13
- // Retried in the browser only: on the server a retry would delay the
14
- // page, and app.vue loads the data again after mounting (#355).
15
- const response = await withRetries(
16
- () =>
17
- apiClient.invoke(
18
- "shopbite.business-hour.get get /shopbite/business-hour",
19
- ),
20
- import.meta.client ? OPENING_HOURS_RETRY_DELAYS : [],
21
- );
22
-
23
- return response.data.businessHours;
24
- },
44
+ BUSINESS_HOURS_KEY,
45
+ () => loadBusinessHours(apiClient, import.meta.server),
25
46
  { immediate: false },
26
47
  );
27
48
 
@@ -1,20 +1,40 @@
1
1
  import { useShopwareContext } from "#imports";
2
+ import type { Schemas } from "#shopware";
3
+
4
+ export const HOLIDAYS_KEY = "holidays";
5
+
6
+ type ApiClient = ReturnType<typeof useShopwareContext>["apiClient"];
7
+
8
+ /**
9
+ * Closing days: from the server's cache (`/api/shopbite/holidays`,
10
+ * `cacheTtl.holidays`) for server-side rendering, from Shopware in the
11
+ * browser, where app.vue reloads them after hydration (useLiveShopData).
12
+ * Retried in the browser only (#355).
13
+ */
14
+ export async function loadHolidays(
15
+ apiClient: ApiClient,
16
+ fromServerCache: boolean,
17
+ retryDelays: readonly number[] = OPENING_HOURS_RETRY_DELAYS,
18
+ ): Promise<Schemas["HolidayStruct"]["holidays"]> {
19
+ if (fromServerCache) {
20
+ const cached = await $fetch<Schemas["HolidayStruct"]>(
21
+ "/api/shopbite/holidays",
22
+ );
23
+ return cached.holidays;
24
+ }
25
+ const response = await withRetries(
26
+ () => apiClient.invoke("shopbite.holiday.get get /shopbite/holiday"),
27
+ retryDelays,
28
+ );
29
+ return response.data.holidays;
30
+ }
2
31
 
3
32
  export function useHolidays() {
4
33
  const { apiClient } = useShopwareContext();
5
34
 
6
35
  const { data, pending, status, refresh } = useAsyncData(
7
- "holidays",
8
- async () => {
9
- // Retried in the browser only: on the server a retry would delay the
10
- // page, and app.vue loads the data again after mounting (#355).
11
- const response = await withRetries(
12
- () => apiClient.invoke("shopbite.holiday.get get /shopbite/holiday"),
13
- import.meta.client ? OPENING_HOURS_RETRY_DELAYS : [],
14
- );
15
-
16
- return response.data.holidays;
17
- },
36
+ HOLIDAYS_KEY,
37
+ () => loadHolidays(apiClient, import.meta.server),
18
38
  { immediate: false },
19
39
  );
20
40
 
@@ -1,42 +1,14 @@
1
+ import type { Schemas } from "#shopware";
2
+
1
3
  /**
2
4
  * The menu sections of the home page (#388, #444): the children of the menu
3
- * root (useMenuRootId: env, plugin configuration, navigation root) with their photo
5
+ * root (env, plugin configuration, navigation root; resolved on the server) with their photo
4
6
  * (`category.media`). Shared by the tiles and the word list of the presets.
5
7
  */
6
8
  export async function useHomeMenuCategories() {
7
- const { apiClient } = useShopwareContext();
8
- const menuRootId = useMenuRootId();
9
-
10
- const { data: categories } = await useAsyncData(
11
- "home-menu-categories",
12
- async () => {
13
- const response = await apiClient.invoke(
14
- "readNavigation post /navigation/{activeId}/{rootId}",
15
- {
16
- body: {
17
- depth: 1,
18
- // Sent as a POST body so the projection is honoured (#312).
19
- includes: {
20
- category: [
21
- "id",
22
- "name",
23
- "translated",
24
- "seoUrl",
25
- "customFields",
26
- "media",
27
- ],
28
- media: ["url", "thumbnails", "metaData"],
29
- media_thumbnail: ["url", "width"],
30
- },
31
- },
32
- pathParams: {
33
- activeId: "main-navigation",
34
- rootId: await menuRootId(),
35
- },
36
- },
37
- );
38
- return response.data;
39
- },
9
+ // Cached on the server with the other navigations (server/api/navigation).
10
+ const { data: categories } = await useAsyncData("home-menu-categories", () =>
11
+ $fetch<Schemas["Category"][]>("/api/navigation/home"),
40
12
  );
41
13
 
42
14
  return { categories };
@@ -0,0 +1,17 @@
1
+ import { BUSINESS_HOURS_KEY } from "./useBusinessHours";
2
+ import { HOLIDAYS_KEY } from "./useHolidays";
3
+ import { SHOPBITE_CONFIG_KEY } from "./useShopBiteConfig";
4
+
5
+ /**
6
+ * The checkout switch, opening hours and closing days are rendered from the
7
+ * server's caches; after mounting the browser loads them from Shopware once
8
+ * (app.vue), so the store status, the delivery time choice and every
9
+ * checkout button act on current data. `refreshNuxtData` waits for the end
10
+ * of hydration: a `refresh()` during hydration returns the server's payload
11
+ * without a request.
12
+ */
13
+ export function useLiveShopData() {
14
+ onMounted(() =>
15
+ refreshNuxtData([SHOPBITE_CONFIG_KEY, BUSINESS_HOURS_KEY, HOLIDAYS_KEY]),
16
+ );
17
+ }