@shopbite-de/storefront 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +13 -1
- package/CLAUDE.md +7 -4
- package/api-types/storeApiSchema.json +62 -6
- package/api-types/storeApiTypes.d.ts +23 -4
- package/app/components/Checkout/DeliveryTimeSelect.vue +39 -18
- package/app/components/Checkout/Summary.vue +5 -1
- package/app/components/Home/Categories.vue +2 -2
- package/app/components/Home/Facts.vue +9 -4
- package/app/components/Home/Hero.vue +8 -2
- package/app/components/Navigation/MobileTop.vue +1 -1
- package/app/components/Order/Detail.vue +3 -4
- package/app/composables/useAddressAutocomplete.ts +3 -11
- package/app/composables/useCheckoutMethodGuard.ts +1 -1
- package/app/composables/useDeliveryTime.ts +8 -5
- package/app/composables/useShippingLeadTime.ts +17 -0
- package/app/composables/useShippingMethodChoice.ts +2 -2
- package/app/composables/useShopBiteConfig.ts +10 -1
- package/app/composables/useTrackEvent.ts +4 -3
- package/app/pages/account/recover/password/index.vue +10 -0
- package/app/pages/registrierung/bestaetigen.vue +4 -0
- package/app/utils/leadTime.ts +97 -0
- package/app/utils/openingHours.ts +1 -1
- package/app/utils/schema.ts +2 -2
- package/app/utils/trackingUrl.ts +39 -0
- package/content/index.yml +16 -16
- package/content/zahlung-und-versand.md +3 -3
- package/content.config.ts +2 -2
- package/docs/notes/2026-07-04-issue-239-hydration-mismatches.md +1 -1
- package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +2 -2
- package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +4 -4
- package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +3 -3
- package/docs/notes/2026-09-10-issue-273-performance-media.md +4 -4
- package/docs/notes/2026-09-10-issue-274-seo-basics.md +6 -6
- package/docs/notes/2026-09-10-issue-275-accessibility.md +3 -3
- package/docs/notes/2026-09-10-issue-290-footer-nap.md +5 -5
- package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +1 -1
- package/docs/notes/2026-09-10-issue-296-track-direct-search.md +1 -1
- package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +3 -3
- package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +1 -1
- package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +1 -1
- package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +1 -1
- package/docs/notes/2026-09-12-issue-325-product-card.md +2 -2
- package/docs/notes/2026-09-12-issue-327-home-hero.md +2 -2
- package/docs/notes/2026-09-13-issue-332-home-info-cards.md +1 -1
- package/docs/notes/2026-09-13-quick-view-flicker.md +1 -1
- package/docs/notes/2026-09-14-demo-noindex.md +2 -2
- package/docs/notes/2026-09-17-quick-view-compact-options.md +1 -1
- package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +1 -1
- package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +2 -2
- package/docs/notes/2026-09-21-issue-366-wishlist-404.md +1 -1
- package/docs/notes/2026-09-21-issue-378-dev-modules.md +1 -1
- package/docs/notes/2026-10-05-issue-289-product-deep-links.md +1 -1
- package/docs/notes/2026-10-05-issue-400-menu-item-ingredients-diet.md +1 -1
- package/docs/notes/2026-10-05-issue-401-restaurant-schema-ordering.md +1 -1
- package/docs/notes/2026-10-05-issue-402-llms-txt.md +1 -1
- package/docs/notes/2026-10-05-issue-403-ai-crawlers.md +1 -1
- package/docs/notes/2026-10-05-issue-404-faq.md +1 -1
- package/docs/notes/2026-10-06-old-seo-url-redirect.md +5 -5
- package/docs/notes/2026-10-07-issue-434-property-group-projection.md +1 -1
- package/nuxt.config.ts +56 -8
- package/package.json +3 -2
- package/server/api/address/autocomplete.get.ts +79 -14
- package/server/api/listing/[categoryId].get.ts +5 -28
- package/server/api/search.get.ts +4 -18
- package/server/api/shopbite/config.get.ts +1 -1
- package/server/plugins/bounded-cache.ts +28 -0
- package/server/plugins/security-headers.ts +54 -0
- package/server/routes/llms.txt.ts +6 -5
- package/server/utils/addressAutocomplete.ts +181 -0
- package/server/utils/listingParams.ts +117 -0
- package/server/utils/llmsTxt.ts +7 -3
- package/server/utils/securityHeaders.ts +165 -0
- package/server/utils/shopBiteConfig.ts +1 -1
- package/test/layer/nuxt.config.ts +2 -2
- package/test/nuxt/AccountPagesPreset.test.ts +10 -10
- package/test/nuxt/AuthPagesPreset.test.ts +3 -0
- package/test/nuxt/CheckoutFormsPreset.test.ts +5 -5
- package/test/nuxt/CheckoutOnePage.test.ts +4 -1
- package/test/nuxt/CheckoutSummary.test.ts +42 -3
- package/test/nuxt/DeliveryTimeSelect.test.ts +181 -0
- package/test/nuxt/HeaderFooterPreset.test.ts +10 -10
- package/test/nuxt/HomeFaq.test.ts +1 -1
- package/test/nuxt/HomeLeadTimes.test.ts +78 -0
- package/test/nuxt/NavigationMobileTop.test.ts +1 -1
- package/test/nuxt/OrderPagesPreset.test.ts +22 -2
- package/test/nuxt/RegisterConfirmPage.test.ts +12 -0
- package/test/nuxt/useAddressAutocomplete.test.ts +7 -22
- package/test/nuxt/useCheckoutMethodGuard.test.ts +1 -1
- package/test/nuxt/useDeliveryTime.test.ts +30 -6
- package/test/nuxt/useShippingLeadTime.test.ts +66 -0
- package/test/nuxt/useShippingMethodChoice.test.ts +1 -1
- package/test/nuxt/useShopBiteConfig.test.ts +57 -3
- package/test/nuxt/useTrackEvent.test.ts +16 -0
- package/test/unit/addressAutocomplete.spec.ts +247 -0
- package/test/unit/boundedCache.spec.ts +231 -0
- package/test/unit/highlight.spec.ts +2 -2
- package/test/unit/leadTime.spec.ts +86 -0
- package/test/unit/llmsTxt.spec.ts +30 -29
- package/test/unit/openingHours.spec.ts +3 -3
- package/test/unit/schema.spec.ts +29 -32
- package/test/unit/securityHeaders.spec.ts +254 -0
- package/test/unit/seo.spec.ts +23 -29
- package/test/unit/sitemap.spec.ts +1 -1
- package/test/unit/trackingUrl.spec.ts +48 -0
|
@@ -37,7 +37,7 @@ top sellers as a horizontal scroller.
|
|
|
37
37
|
`useAsyncData`.
|
|
38
38
|
- `useTopSellers`: limit 8, includes for cover, properties and
|
|
39
39
|
availability, and the `sw-inheritance` header so variants marked as top
|
|
40
|
-
sellers carry the parent's name and cover (
|
|
40
|
+
sellers carry the parent's name and cover (the customer shop marks both the
|
|
41
41
|
parent "Cordon Bleu" and its three variants; the header type of the
|
|
42
42
|
generated operation lacks `sw-inheritance`, hence the `@ts-expect-error`).
|
|
43
43
|
- Docs (https://shopbite.de/docs/storefront/content, DE/EN)
|
|
@@ -46,7 +46,7 @@ top sellers as a horizontal scroller.
|
|
|
46
46
|
|
|
47
47
|
## Verification
|
|
48
48
|
|
|
49
|
-
- Production build with the
|
|
49
|
+
- Production build with the customer API: status "Geöffnet bis 23:00",
|
|
50
50
|
eight top sellers, a tap opens the quick view (`?produkt=18V`), video
|
|
51
51
|
only at 1280 px; screenshots mobile light/dark and desktop reviewed, no
|
|
52
52
|
page errors.
|
|
@@ -35,7 +35,7 @@ A (three cards with a bold lead, detail text and one action) vs. B
|
|
|
35
35
|
|
|
36
36
|
## Verification
|
|
37
37
|
|
|
38
|
-
- Production build with the
|
|
38
|
+
- Production build with the customer API: leads "Heute 11:30–14:30
|
|
39
39
|
und 17:30–23:00", "In ca. 30 Minuten bei dir", "Tisch nur telefonisch";
|
|
40
40
|
status "Geöffnet bis 14:30"; the hours link scrolls to
|
|
41
41
|
`#oeffnungszeiten`; no page errors and no hydration warnings on 390 px
|
|
@@ -23,7 +23,7 @@ variant id, `pending` went back to `true` and the extras collapsed into
|
|
|
23
23
|
the skeleton until the (identical) extras came back.
|
|
24
24
|
|
|
25
25
|
Measured with `scripts/perf/quick-view-layout.mjs`, which logs the drawer body per animation
|
|
26
|
-
frame against the production build with the
|
|
26
|
+
frame against the production build with the customer data (product
|
|
27
27
|
18V "Insalata di Pollo", two variants, 12 extras):
|
|
28
28
|
|
|
29
29
|
| Viewport | Open: body height steps | Variant switch: steps |
|
|
@@ -15,7 +15,7 @@ The demo deployment (Dokploy) sets `NUXT_SITE_INDEXABLE=false`. Nothing in
|
|
|
15
15
|
`nuxt.config.ts`:
|
|
16
16
|
|
|
17
17
|
- An unconditional `site: { indexable: false }` would be merged into every shop
|
|
18
|
-
project.
|
|
18
|
+
project. The customer shop does not set `site.indexable`, so it would drop
|
|
19
19
|
out of search engines with the next release.
|
|
20
20
|
- A config flag limited to this repository as the root project (comparing
|
|
21
21
|
`process.cwd()` with the config directory) worked, but was rejected as too
|
|
@@ -37,7 +37,7 @@ module's `max-image-preview:large` rule. The composable now only sets
|
|
|
37
37
|
|
|
38
38
|
## Verified
|
|
39
39
|
|
|
40
|
-
Production build with
|
|
40
|
+
Production build with the customer shop's Store API, `node .output/server/index.mjs`:
|
|
41
41
|
|
|
42
42
|
- `NUXT_SITE_INDEXABLE=false`: robots.txt `Disallow: /`; `/`, `/c/Pizza/` and
|
|
43
43
|
`/bestellung/warenkorb` send `X-Robots-Tag: noindex, nofollow` and render
|
|
@@ -44,7 +44,7 @@ changes the content height while choosing makes it jump:
|
|
|
44
44
|
and could wrap the row. Both states now carry an icon of the same size (X to
|
|
45
45
|
remove, plus to add back).
|
|
46
46
|
|
|
47
|
-
Checked on the production menu of
|
|
47
|
+
Checked on the production menu of the customer shop (12 pizzas with up to 34 extras, 360
|
|
48
48
|
and 390 px wide): toggling every ingredient and ticking an extra keeps the
|
|
49
49
|
drawer height constant.
|
|
50
50
|
|
|
@@ -4,7 +4,7 @@ Follow-up to `2026-09-10-issue-273-performance-media.md` (PR #308).
|
|
|
4
4
|
|
|
5
5
|
## State on 2026-09-21
|
|
6
6
|
|
|
7
|
-
- Object storage media (demo and
|
|
7
|
+
- Object storage media (demo and the customer shop) send
|
|
8
8
|
`public, max-age=31536000, immutable`: done on the buckets.
|
|
9
9
|
- The docs on shopbite.de cover poster, video size, thumbnails and the bucket header.
|
|
10
10
|
- Remaining requests without a useful cache lifetime on demo.shopbite.de:
|
|
@@ -12,7 +12,7 @@ Container logs in OpenObserve (`docker_logs`, 2026-09-19 to 2026-09-21):
|
|
|
12
12
|
|
|
13
13
|
| Container | `[fatal]` blocks (3 days) |
|
|
14
14
|
| ----------------------- | ------------------------- |
|
|
15
|
-
| `
|
|
15
|
+
| `customer-storefront` | ~2,500 |
|
|
16
16
|
| `shopbite-storefront` | 565 |
|
|
17
17
|
| shopbite.de website | 423 (same pattern) |
|
|
18
18
|
|
|
@@ -37,7 +37,7 @@ navigation to an unknown path still shows the error page.
|
|
|
37
37
|
|
|
38
38
|
## Other findings
|
|
39
39
|
|
|
40
|
-
- 117 `[unhandled]` errors on `/api/category|listing|product/*` at
|
|
40
|
+
- 117 `[unhandled]` errors on `/api/category|listing|product/*` at the customer shop,
|
|
41
41
|
all on 2026-09-19 18:00 UTC: the Shopware backend answered with
|
|
42
42
|
`404 page not found` (backend unreachable). Logged correctly; the URL shows a
|
|
43
43
|
double slash (`/store-api//category/…`) because the endpoint env ends in `/`.
|
|
@@ -36,6 +36,6 @@ wishlist request on `/` and one on `/merkliste`, no
|
|
|
36
36
|
still prints its own "Failed to load resource" line for the 403/404 response;
|
|
37
37
|
that is not a JavaScript error and cannot be suppressed from the page.
|
|
38
38
|
|
|
39
|
-
`storefront/.env` currently points at the
|
|
39
|
+
`storefront/.env` currently points at the customer production backend; to test
|
|
40
40
|
against the demo, set `NUXT_PUBLIC_SHOPWARE_ENDPOINT`/`_ACCESS_TOKEN` in the
|
|
41
41
|
environment (they take precedence over `.env`).
|
|
@@ -9,7 +9,7 @@ layer from npm does not get them, but inherits the module list.
|
|
|
9
9
|
|
|
10
10
|
Reproduced with the packed storefront installed into an empty app
|
|
11
11
|
(`extends: ["@shopbite-de/storefront"]`, pnpm 10.26.2, `node-linker=hoisted`
|
|
12
|
-
like
|
|
12
|
+
like the customer shop), no dev tooling installed:
|
|
13
13
|
|
|
14
14
|
- 1.27.0: `pnpm install` fails in the storefront's own `postinstall`
|
|
15
15
|
(`nuxt prepare`, which runs inside `node_modules/@shopbite-de/storefront`
|
|
@@ -10,7 +10,7 @@ Lirim's template, verified on the demo (preview API and after indexing):
|
|
|
10
10
|
{% set main = product.mainCategories|first %}{% set cat = main ? main.category : product.categories|first %}{% for p in (cat.translated.breadcrumb ?? [])|slice(1) %}{{ p }}/{% endfor %}?produkt={{ product.productNumber|url_encode|raw }}
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
- `slice(1)` matches the demo's category template (`category.seoBreadcrumb` → `Speisekarte/Pizza/`, incl. slugs such as `Getraenke`); `slice(2)` gives `Pizza/…`, which does not exist. Shops with a prefixed category template (
|
|
13
|
+
- `slice(1)` matches the demo's category template (`category.seoBreadcrumb` → `Speisekarte/Pizza/`, incl. slugs such as `Getraenke`); `slice(2)` gives `Pizza/…`, which does not exist. Shops with a prefixed category template (the customer shop `c/…`) need the prefix: the plugin derives it.
|
|
14
14
|
- The product number must be `|url_encode|raw`: the SEO escaper slugifies variables, `LF-21-groß` became `LF-21-gross`, which the quick view cannot find. Encoded it is `LF-21-gro%C3%9F`, which the router decodes.
|
|
15
15
|
- `seoBreadcrumb`/`seoCategory` are not available in the product template; the preview API renders main products only, so variants are only visible after indexing.
|
|
16
16
|
- **The demo backend now runs this template** (set via Admin API for verification, both `frontend.detail.page` and `store-api.product.detail`, reindexed).
|
|
@@ -4,7 +4,7 @@ As of 2026-10-05, branch `feature/400-menu-item-ingredients-diet`. Part of the A
|
|
|
4
4
|
|
|
5
5
|
## Finding
|
|
6
6
|
|
|
7
|
-
On
|
|
7
|
+
On the customer shop, `/c/Pizza/` carried 29 `MenuItem`s, but only 4 had a `description`: the ingredients live in the `Hauptzutaten` property group, not in the product description. No item said whether it is vegetarian or vegan. AI assistants answering "what is on it / is it vegetarian" had nothing to go on.
|
|
8
8
|
|
|
9
9
|
## Implementation
|
|
10
10
|
|
|
@@ -18,4 +18,4 @@ As of 2026-10-05, branch `feature/401-restaurant-schema-ordering`. Part of the A
|
|
|
18
18
|
|
|
19
19
|
Production build against the demo backend with the new env variables: the home page `Restaurant` node carries `geo`, both delivery areas, `acceptsReservations: true`, `paymentAccepted: "Nachnahme"`, `currenciesAccepted: "EUR"` and the `OrderAction` with pickup and own delivery. Without the new variables only `paymentAccepted`, `currenciesAccepted` and `potentialAction` (without `deliveryMethod`) are added. Unit + nuxt tests, typecheck, ESLint green.
|
|
20
20
|
|
|
21
|
-
Docs: https://shopbite.de/docs/storefront/configuration (DE/EN), including the note that `NUXT_PUBLIC_SITE_CUISINE` is a cuisine name:
|
|
21
|
+
Docs: https://shopbite.de/docs/storefront/configuration (DE/EN), including the note that `NUXT_PUBLIC_SITE_CUISINE` is a cuisine name: The customer shop sets `italienische`, which produces "italienische in Musterstadt" in its meta description.
|
|
@@ -8,7 +8,7 @@ As of 2026-10-05, branch `feature/402-llms-txt`. Part of the AI visibility issue
|
|
|
8
8
|
- Sources: `runtimeConfig.public.site` (name, description, address, phone, cuisine, delivery areas from #401), the ShopBite plugin routes (business hours, holidays, config: checkout enabled, delivery time), `/context` (currency), the menu navigation (`menuCategoryId`, with SEO URLs) and all main products via `/product` (100 per page, at most 10 pages, `includes` in the POST body, #312). Each source is optional: `Promise.allSettled`, a failed request drops its section.
|
|
9
9
|
- Products are grouped by their directly assigned `categoryIds` (extras without category are not listed). Products with variants show "ab <cheapest price>". Ingredients and diets reuse `getMainIngredients`/`getDiets` (#400).
|
|
10
10
|
- Sorting: the `/product` route ignored `sort` by name, so items are sorted in code (German locale, numeric).
|
|
11
|
-
- Content pages come from the `landingpages` collection; pages that `robots.txt` blocks (
|
|
11
|
+
- Content pages come from the `landingpages` collection; pages that `robots.txt` blocks (the customer shop's legal pages) are filtered with `getPathRobotConfig`.
|
|
12
12
|
- `swr: 3600` route rule. On non-indexable sites the robots module already sends `X-Robots-Tag: noindex, nofollow` for this route, so no own header is needed.
|
|
13
13
|
- `splitList` moved to `app/utils/seo.ts` (shared with `useRestaurantSchema`).
|
|
14
14
|
|
|
@@ -6,7 +6,7 @@ As of 2026-10-05, branch `feature/403-ai-crawler-robots`. Part of the AI visibil
|
|
|
6
6
|
|
|
7
7
|
- `runtimeConfig.aiCrawlers` (server-only): `search` and `training`, both `true` by default (the previous behaviour, now explicit). Env: `NUXT_AI_CRAWLERS_SEARCH`, `NUXT_AI_CRAWLERS_TRAINING`.
|
|
8
8
|
- `server/plugins/ai-crawlers.ts` hooks `robots:config` of `@nuxtjs/robots` (6.2), which runs at runtime for robots.txt and for the per-request `X-Robots-Tag`. A build-time `robots.groups` entry could not read the env. The hook gets a fresh copy of the configured groups on every call, so pushing groups does not accumulate.
|
|
9
|
-
- `server/utils/aiCrawlers.ts` (pure, unit-tested) builds one group per kind. A crawler matching a named group ignores the `*` group, so an allowed group repeats the `*` disallow paths (
|
|
9
|
+
- `server/utils/aiCrawlers.ts` (pure, unit-tested) builds one group per kind. A crawler matching a named group ignores the `*` group, so an allowed group repeats the `*` disallow paths (the customer shop's legal pages stay blocked for AI bots too).
|
|
10
10
|
- User agents verified on the operators' pages on 2026-10-05 (sources in the file header). `Google-Extended` and `Applebot-Extended` are control tokens, not crawlers; Google AI Overviews follow Googlebot, not `Google-Extended`.
|
|
11
11
|
- Non-indexable sites (demo) never reach the hook: the module answers with `Disallow: /` before resolving groups.
|
|
12
12
|
|
|
@@ -4,7 +4,7 @@ As of 2026-10-05, branch `feature/404-faq`. Last of the AI visibility issues #40
|
|
|
4
4
|
|
|
5
5
|
## Decisions
|
|
6
6
|
|
|
7
|
-
- **Data:** optional `faq` (headline, title, description, `items` of question/answer) in the `home` collection (`content/index.yml`), next to the other home sections. Shops without `faq` render nothing;
|
|
7
|
+
- **Data:** optional `faq` (headline, title, description, `items` of question/answer) in the `home` collection (`content/index.yml`), next to the other home sections. Shops without `faq` render nothing; the customer shop has its own `index.yml`, so nothing changes there until it adds questions.
|
|
8
8
|
- **Place:** home page, above the closing CTA. `/zahlung-und-versand` stays a Markdown page.
|
|
9
9
|
- **Markup:** native `<details>`/`<summary>` instead of `UAccordion`. Reka's accordion unmounts closed panels by default, so the answers would be missing from the SSR HTML that crawlers read; `<details>` keeps them in the markup, is keyboard accessible and adds no JavaScript or Nuxt UI theme (#314, #319).
|
|
10
10
|
- **Answers are plain text** (no Markdown/links), so the same strings work in the HTML, the JSON-LD and `/llms.txt`.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Old category SEO URLs redirect to the current ones
|
|
2
2
|
|
|
3
|
-
As of 2026-10-06, branch `feature/redirect-non-canonical-seo-urls`. Prompted by
|
|
3
|
+
As of 2026-10-06, branch `feature/redirect-non-canonical-seo-urls`. Prompted by the customer shop moving its category URLs from `/c/Pizza/` to `/speisekarte/pizza/` via the Shopware SEO URL template.
|
|
4
4
|
|
|
5
|
-
## Findings (
|
|
5
|
+
## Findings (customer Store API)
|
|
6
6
|
|
|
7
|
-
- Shopware keeps the old SEO URL of an entity when the template or the entity name changes: same `foreignKey`, `isCanonical: null`.
|
|
7
|
+
- Shopware keeps the old SEO URL of an entity when the template or the entity name changes: same `foreignKey`, `isCanonical: null`. The customer shop has 262 of them for products already (e.g. `Schnitzel-Wiener-Art/103V` next to the canonical `Schnitzel-Wiener-Art/103`).
|
|
8
8
|
- The Store API `/seo-url` route adds `isCanonical = true` to the criteria unless they contain an `equals` filter on `isCanonical` at top level (a nested `multi` filter does not count). A lookup by `seoPathInfo` alone therefore never finds an old URL: before this change, every old category URL returned 404 after a template change.
|
|
9
9
|
|
|
10
10
|
## Change
|
|
@@ -23,8 +23,8 @@ The category pages `pages/c/[...all].vue` and `pages/speisekarte/[...all].vue` w
|
|
|
23
23
|
|
|
24
24
|
The category bar of the `listing` layout is rendered by the page itself (same markup) instead of switching layouts per result, which would need `setPageLayout` during SSR (hydration warning in Nuxt). A category page now costs one extra request to `/api/content/page`.
|
|
25
25
|
|
|
26
|
-
Checked against the
|
|
26
|
+
Checked against the customer backend (dev server): `/c/Pizza/` 200 with 29 products, `/c/pizza` and `/navigation/<pizza id>` 301 to `/c/Pizza/`, `/agb` 200, `/c/Unbekannt/`, `/Schnitzel-Wiener-Art/103`, `/wp-login.php`, `/.env` 404. Client-side navigation content → category → category → alias → content → back renders the right page each time. The hydration warnings on a category page (`NavigationDesktopLeft`, `CategoryListing`) are the same with the old pages.
|
|
27
27
|
|
|
28
28
|
## Verification
|
|
29
29
|
|
|
30
|
-
Unit tests (`seoPath.spec.ts`, `useSeoUrlRoute.test.ts`), typecheck, ESLint, Prettier. Both queries checked against the
|
|
30
|
+
Unit tests (`seoPath.spec.ts`, `useSeoUrlRoute.test.ts`), typecheck, ESLint, Prettier. Both queries checked against the customer Store API with existing old product URLs: the `seoPathInfo` lookup without an `isCanonical` filter returns nothing, with `isCanonical: null` it returns the old record, and the canonical lookup returns `Schnitzel-Wiener-Art/103`.
|
|
@@ -8,7 +8,7 @@ All Store API projections used the key `property` for property groups. The entit
|
|
|
8
8
|
|
|
9
9
|
- `server/api/product/[productId].get.ts` and `server/api/product/variant.get.ts`: `property_group: ["id", "name", "translated", "options"]`. Options keep `group`: the configurator reads `option.group.id`, the ingredient selection `option.group.name`.
|
|
10
10
|
- `server/api/search.get.ts`: same projection as the listing (#435), because the search page renders the same cards: `property_group` with `displayType`, options without `group`, no `properties`/`propertyIds`.
|
|
11
|
-
- `app/components/Product/Category.vue` deleted: it was rendered nowhere (only recursively by itself), neither in the storefront nor in
|
|
11
|
+
- `app/components/Product/Category.vue` deleted: it was rendered nowhere (only recursively by itself), neither in the storefront nor in the customer shop or the quickstart repo.
|
|
12
12
|
|
|
13
13
|
## Verification (demo backend, `main` build against branch build)
|
|
14
14
|
|
package/nuxt.config.ts
CHANGED
|
@@ -60,12 +60,63 @@ export default defineNuxtConfig({
|
|
|
60
60
|
// Store API caches after menu changes. Empty = route off.
|
|
61
61
|
cachePurgeSecret: "",
|
|
62
62
|
geoapifyApiKey: "",
|
|
63
|
+
// Per-IP token bucket of /api/address/autocomplete: `capacity` lookups at
|
|
64
|
+
// once, refilled by `refillPerMinute`; only lookups that reach Geoapify
|
|
65
|
+
// count. In memory per server process; capacity 0 turns it off (e.g. when
|
|
66
|
+
// the reverse proxy limits the route).
|
|
67
|
+
addressAutocomplete: {
|
|
68
|
+
rateLimit: {
|
|
69
|
+
capacity: 20,
|
|
70
|
+
refillPerMinute: 20,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
// Bound of the Nitro cache (server/plugins/bounded-cache.ts): an LRU in
|
|
74
|
+
// memory with at most `maxEntries` entries and `maxSizeMb` of data;
|
|
75
|
+
// NUXT_CACHE_STORAGE_*, maxEntries 0 = unbounded. A cache storage the
|
|
76
|
+
// shop mounts itself (nitro.storage.cache) is kept.
|
|
77
|
+
cacheStorage: {
|
|
78
|
+
maxEntries: 5000,
|
|
79
|
+
maxSizeMb: 128,
|
|
80
|
+
},
|
|
81
|
+
// Sortings the listing and search routes accept (`order`), comma-
|
|
82
|
+
// separated; empty = Shopware's standard sortings. Add the keys of
|
|
83
|
+
// custom sortings created in the Shopware Administration.
|
|
84
|
+
listingSortings: "",
|
|
63
85
|
// AI crawlers named in robots.txt (#403, server/plugins/ai-crawlers.ts):
|
|
64
86
|
// search = AI search and assistant fetches, training = model training.
|
|
65
87
|
aiCrawlers: {
|
|
66
88
|
search: true,
|
|
67
89
|
training: true,
|
|
68
90
|
},
|
|
91
|
+
// Headers of every response (server/plugins/security-headers.ts),
|
|
92
|
+
// NUXT_SECURITY_HEADERS_*; an empty value leaves the header out.
|
|
93
|
+
securityHeaders: {
|
|
94
|
+
// Only sent when public.storeUrl is https.
|
|
95
|
+
strictTransportSecurity: "max-age=31536000; includeSubDomains",
|
|
96
|
+
contentTypeOptions: "nosniff",
|
|
97
|
+
// A shop embedded in another site sets frameOptions "" and lists the
|
|
98
|
+
// embedding origin in frameAncestors (CSP `frame-ancestors`).
|
|
99
|
+
frameOptions: "DENY",
|
|
100
|
+
frameAncestors: "'none'",
|
|
101
|
+
referrerPolicy: "strict-origin-when-cross-origin",
|
|
102
|
+
// No feature of the storefront uses these (address suggestions are
|
|
103
|
+
// typed, not located); Web Share and the clipboard stay allowed.
|
|
104
|
+
permissionsPolicy:
|
|
105
|
+
"camera=(), microphone=(), geolocation=(), usb=(), browsing-topics=()",
|
|
106
|
+
// Server-rendered HTML may contain the visitor's cart or login
|
|
107
|
+
// (useUserContextInSSR), so no shared or browser cache keeps it.
|
|
108
|
+
htmlCacheControl: "private, no-store",
|
|
109
|
+
// Report-only policy for pages: self, the Shopware endpoint, Matomo
|
|
110
|
+
// and inline scripts by hash. Extra hosts (e.g. a RUM collector) are
|
|
111
|
+
// space-separated lists.
|
|
112
|
+
contentSecurityPolicyReportOnly: {
|
|
113
|
+
enabled: true,
|
|
114
|
+
scriptSrc: "",
|
|
115
|
+
connectSrc: "",
|
|
116
|
+
imgSrc: "",
|
|
117
|
+
reportUri: "",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
69
120
|
public: {
|
|
70
121
|
shopBite: {
|
|
71
122
|
cacheTtl: {
|
|
@@ -92,6 +143,7 @@ export default defineNuxtConfig({
|
|
|
92
143
|
searchFallbackCategoryId: "",
|
|
93
144
|
// Optional Geoapify bounding box "lon1,lat1,lon2,lat2" that narrows
|
|
94
145
|
// the address suggestions in the checkout (empty = no filter, #251).
|
|
146
|
+
// Applied by the server route, never taken from the request.
|
|
95
147
|
addressAutocomplete: {
|
|
96
148
|
boundingBox: "",
|
|
97
149
|
},
|
|
@@ -126,14 +178,14 @@ export default defineNuxtConfig({
|
|
|
126
178
|
telephone: "",
|
|
127
179
|
googleBusinessProfileUrl: "",
|
|
128
180
|
// Other names the shop is known by on maps and directories, comma-
|
|
129
|
-
// separated ("
|
|
181
|
+
// separated ("Esempio / Alter Hof, Alter Hof"), so search
|
|
130
182
|
// engines and AI assistants match them to this shop. Restaurant
|
|
131
183
|
// schema `alternateName` and /llms.txt.
|
|
132
184
|
alternateNames: "",
|
|
133
185
|
// Restaurant schema only, e.g. "€€" (#272).
|
|
134
186
|
priceRange: "",
|
|
135
187
|
// Restaurant schema only (#401): comma-separated delivery areas
|
|
136
|
-
// ("
|
|
188
|
+
// ("12345 Musterstadt, 12346 Beispieldorf"), coordinates and
|
|
137
189
|
// "true"/"false" or a text for table reservations.
|
|
138
190
|
deliveryAreas: "",
|
|
139
191
|
geo: {
|
|
@@ -299,13 +351,9 @@ export default defineNuxtConfig({
|
|
|
299
351
|
globStrict: false,
|
|
300
352
|
// default of 1.x, off by default since 2.0
|
|
301
353
|
cleanupOutdatedCaches: true,
|
|
354
|
+
// No runtime caching of pages: server-rendered HTML may contain the
|
|
355
|
+
// visitor's cart or login and must not be kept in CacheStorage.
|
|
302
356
|
navigateFallback: null,
|
|
303
|
-
runtimeCaching: [
|
|
304
|
-
{
|
|
305
|
-
urlPattern: "/",
|
|
306
|
-
handler: "NetworkFirst",
|
|
307
|
-
},
|
|
308
|
-
],
|
|
309
357
|
},
|
|
310
358
|
devOptions: {
|
|
311
359
|
enabled: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopbite-de/storefront",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"main": "nuxt.config.ts",
|
|
5
5
|
"description": "Shopware storefront for food delivery shops",
|
|
6
6
|
"keywords": [
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"nuxt": "^4.6.4",
|
|
39
39
|
"nuxt-vitalizer": "4.0.0",
|
|
40
40
|
"reka-ui": "^2.11.0",
|
|
41
|
+
"unstorage": "^1.17.6",
|
|
41
42
|
"uuid": "^14.0.3"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
53
54
|
"@typescript-eslint/parser": "^8.73.0",
|
|
54
55
|
"@vitejs/plugin-vue": "^6.0.11",
|
|
55
|
-
"@vitest/ui": "5.1.
|
|
56
|
+
"@vitest/ui": "5.1.1",
|
|
56
57
|
"@vue/compiler-dom": "^3.5.45",
|
|
57
58
|
"@vue/server-renderer": "^3.5.45",
|
|
58
59
|
"@vue/test-utils": "^2.6.0",
|
|
@@ -1,34 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geoapify address autocomplete proxy: keeps the API key on the server.
|
|
3
|
+
* Only `text` (3–200 characters), `lang` (two letters) and `limit` (1–10) are
|
|
4
|
+
* passed on; the area filter comes from the runtime config
|
|
5
|
+
* (`public.shopBite.addressAutocomplete.boundingBox`). Identical lookups are
|
|
6
|
+
* answered from a small in-memory cache for 5 minutes, and lookups that reach
|
|
7
|
+
* Geoapify are rate limited per client IP (`addressAutocomplete.rateLimit`,
|
|
8
|
+
* capacity 0 = off). Upstream errors are logged with the key redacted and
|
|
9
|
+
* answered with a generic 502.
|
|
10
|
+
*/
|
|
11
|
+
import type { AutocompleteParams } from "../../utils/addressAutocomplete";
|
|
12
|
+
|
|
13
|
+
const GEOAPIFY_URL = "https://api.geoapify.com/v1/geocode/autocomplete";
|
|
14
|
+
const CACHE_TTL_MS = 5 * 60 * 1000;
|
|
15
|
+
const CACHE_MAX_ENTRIES = 500;
|
|
16
|
+
|
|
17
|
+
type Suggestions = ReturnType<typeof pickAddressFields>;
|
|
18
|
+
|
|
19
|
+
const cache = createTtlCache<Suggestions>({
|
|
20
|
+
ttlMs: CACHE_TTL_MS,
|
|
21
|
+
maxEntries: CACHE_MAX_ENTRIES,
|
|
22
|
+
});
|
|
23
|
+
let limiter: ReturnType<typeof createTokenBucketLimiter> | null | undefined;
|
|
24
|
+
|
|
25
|
+
function rateLimiter() {
|
|
26
|
+
if (limiter !== undefined) return limiter;
|
|
27
|
+
const { capacity = 20, refillPerMinute = 20 } =
|
|
28
|
+
useRuntimeConfig().addressAutocomplete?.rateLimit ?? {};
|
|
29
|
+
limiter =
|
|
30
|
+
Number(capacity) > 0
|
|
31
|
+
? createTokenBucketLimiter({
|
|
32
|
+
capacity: Number(capacity),
|
|
33
|
+
refillPerMinute: Number(refillPerMinute),
|
|
34
|
+
})
|
|
35
|
+
: null;
|
|
36
|
+
return limiter;
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
export default defineEventHandler(async (event) => {
|
|
2
40
|
const config = useRuntimeConfig();
|
|
3
41
|
const apiKey = config.geoapifyApiKey;
|
|
4
|
-
const query = getQuery(event);
|
|
5
42
|
|
|
6
43
|
if (!apiKey) {
|
|
7
44
|
return { features: [] };
|
|
8
45
|
}
|
|
9
46
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
47
|
+
let params: AutocompleteParams | null;
|
|
48
|
+
try {
|
|
49
|
+
params = parseAutocompleteQuery(getQuery(event));
|
|
50
|
+
} catch {
|
|
51
|
+
throw createError({ statusCode: 400, statusMessage: "Bad Request" });
|
|
52
|
+
}
|
|
53
|
+
if (!params) {
|
|
13
54
|
return { features: [] };
|
|
14
55
|
}
|
|
15
56
|
|
|
16
|
-
const
|
|
17
|
-
|
|
57
|
+
const filter = boundingBoxFilter(
|
|
58
|
+
config.public.shopBite.addressAutocomplete?.boundingBox,
|
|
18
59
|
);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
60
|
+
const key = JSON.stringify([params.text, params.lang, params.limit, filter]);
|
|
61
|
+
const cached = cache.get(key);
|
|
62
|
+
if (cached) return cached;
|
|
63
|
+
|
|
64
|
+
const limit = rateLimiter();
|
|
65
|
+
if (
|
|
66
|
+
limit &&
|
|
67
|
+
!limit.take(getRequestIP(event, { xForwardedFor: true }) ?? "")
|
|
68
|
+
) {
|
|
69
|
+
setResponseHeader(event, "Retry-After", 10);
|
|
70
|
+
throw createError({
|
|
71
|
+
statusCode: 429,
|
|
72
|
+
statusMessage: "Too Many Requests",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const url = new URL(GEOAPIFY_URL);
|
|
77
|
+
url.searchParams.set("apiKey", apiKey);
|
|
78
|
+
url.searchParams.set("text", params.text);
|
|
79
|
+
url.searchParams.set("lang", params.lang);
|
|
80
|
+
url.searchParams.set("limit", String(params.limit));
|
|
81
|
+
if (filter) url.searchParams.set("filter", filter);
|
|
24
82
|
|
|
25
83
|
try {
|
|
26
|
-
|
|
84
|
+
const suggestions = pickAddressFields(await $fetch(url.toString()));
|
|
85
|
+
cache.set(key, suggestions);
|
|
86
|
+
return suggestions;
|
|
27
87
|
} catch (error) {
|
|
28
88
|
const err = error as { response?: { status?: number }; message?: string };
|
|
89
|
+
console.error("Address autocomplete request failed", {
|
|
90
|
+
status: err.response?.status,
|
|
91
|
+
url: redactApiKey(url.toString()),
|
|
92
|
+
message: redactApiKey(String(err.message ?? "")),
|
|
93
|
+
});
|
|
29
94
|
throw createError({
|
|
30
|
-
statusCode:
|
|
31
|
-
statusMessage:
|
|
95
|
+
statusCode: 502,
|
|
96
|
+
statusMessage: "Address suggestions unavailable",
|
|
32
97
|
});
|
|
33
98
|
}
|
|
34
99
|
});
|
|
@@ -60,34 +60,11 @@ const BASE_CRITERIA = {
|
|
|
60
60
|
limit: 100,
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
/** Validates and returns a non-empty string up to maxLength, or undefined. */
|
|
64
|
-
function sanitizeString(value: unknown, maxLength: number): string | undefined {
|
|
65
|
-
if (typeof value !== "string" || value === "") return undefined;
|
|
66
|
-
const trimmed = value.trim();
|
|
67
|
-
return trimmed.length <= maxLength ? trimmed : undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** Validates page number: positive integer in [1, 1000]. */
|
|
71
|
-
function sanitizePage(value: unknown): number | undefined {
|
|
72
|
-
const n = Number(value);
|
|
73
|
-
return Number.isInteger(n) && n >= 1 && n <= 1000 ? n : undefined;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function resolveAllowedParams(query: Record<string, unknown>) {
|
|
77
|
-
return {
|
|
78
|
-
order: sanitizeString(query.order, 64),
|
|
79
|
-
properties: sanitizeString(query.properties, 2048),
|
|
80
|
-
manufacturer: sanitizeString(query.manufacturer, 2048),
|
|
81
|
-
query: sanitizeString(query.query, 256),
|
|
82
|
-
p: sanitizePage(query.p),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
63
|
export default defineCachedEventHandler(
|
|
87
64
|
async (event) => {
|
|
88
|
-
const categoryId = getRouterParam(event, "categoryId")
|
|
65
|
+
const categoryId = categoryIdParam(getRouterParam(event, "categoryId"));
|
|
89
66
|
|
|
90
|
-
const { order, properties, manufacturer, query, p } =
|
|
67
|
+
const { order, properties, manufacturer, query, p } = listingParams(
|
|
91
68
|
getQuery(event) as Record<string, unknown>,
|
|
92
69
|
);
|
|
93
70
|
|
|
@@ -108,10 +85,10 @@ export default defineCachedEventHandler(
|
|
|
108
85
|
maxAge: useRuntimeConfig().public.shopBite.cacheTtl.listing,
|
|
109
86
|
name: "listing",
|
|
110
87
|
getKey: (event) => {
|
|
111
|
-
const categoryId = getRouterParam(event, "categoryId")
|
|
88
|
+
const categoryId = categoryIdParam(getRouterParam(event, "categoryId"));
|
|
112
89
|
const q = getQuery(event) as Record<string, unknown>;
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
// Validated before it becomes a key (400 otherwise).
|
|
91
|
+
const { order, properties, manufacturer, query, p } = listingParams(q);
|
|
115
92
|
return [
|
|
116
93
|
categoryId,
|
|
117
94
|
order ?? "",
|
package/server/api/search.get.ts
CHANGED
|
@@ -50,25 +50,12 @@ const BASE_CRITERIA = {
|
|
|
50
50
|
limit: 100,
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
function sanitizeString(value: unknown, maxLength: number): string | undefined {
|
|
54
|
-
if (typeof value !== "string" || value === "") return undefined;
|
|
55
|
-
const trimmed = value.trim();
|
|
56
|
-
return trimmed.length <= maxLength ? trimmed : undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function sanitizePage(value: unknown): number | undefined {
|
|
60
|
-
const n = Number(value);
|
|
61
|
-
return Number.isInteger(n) && n >= 1 && n <= 1000 ? n : undefined;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
53
|
export default defineCachedEventHandler(
|
|
65
54
|
async (event) => {
|
|
66
55
|
const { endpoint, accessToken } = useRuntimeConfig().public.shopware;
|
|
67
56
|
const q = getQuery(event) as Record<string, unknown>;
|
|
68
57
|
|
|
69
|
-
const search =
|
|
70
|
-
const order = sanitizeString(q.order, 64);
|
|
71
|
-
const p = sanitizePage(q.p);
|
|
58
|
+
const { search, order, p } = searchParams(q);
|
|
72
59
|
|
|
73
60
|
if (!search) {
|
|
74
61
|
return {
|
|
@@ -97,10 +84,9 @@ export default defineCachedEventHandler(
|
|
|
97
84
|
name: "search",
|
|
98
85
|
getKey: (event) => {
|
|
99
86
|
const q = getQuery(event) as Record<string, unknown>;
|
|
100
|
-
|
|
101
|
-
const order =
|
|
102
|
-
|
|
103
|
-
return [search, order, p].join("|");
|
|
87
|
+
// Validated before it becomes a key (400 otherwise).
|
|
88
|
+
const { search, order, p } = searchParams(q);
|
|
89
|
+
return [search ?? "", order ?? "", p ?? 1].join("|");
|
|
104
90
|
},
|
|
105
91
|
},
|
|
106
92
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ShopBite plugin configuration (
|
|
2
|
+
* ShopBite plugin configuration (lead times, checkout switch, menu root)
|
|
3
3
|
* for server-side rendering, cached `cacheTtl.config` (shopBiteConfig). The
|
|
4
4
|
* browser loads it from Shopware again after hydration (useLiveShopData).
|
|
5
5
|
*/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import lruCacheDriver from "unstorage/drivers/lru-cache";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bounded storage for the Nitro cache (cached handlers and functions): an LRU
|
|
5
|
+
* with at most `cacheStorage.maxEntries` entries and `maxSizeMb` of
|
|
6
|
+
* serialised data (NUXT_CACHE_STORAGE_*). Without it the cache lives in the
|
|
7
|
+
* root memory storage without any bound. The least recently used entries
|
|
8
|
+
* are dropped first and are fetched again on their next request. A shop
|
|
9
|
+
* that mounts its own cache storage (`nitro.storage.cache`, e.g. Redis)
|
|
10
|
+
* keeps it; `maxEntries` 0 turns the LRU off.
|
|
11
|
+
*/
|
|
12
|
+
export default defineNitroPlugin(() => {
|
|
13
|
+
const { maxEntries = 5000, maxSizeMb = 128 } =
|
|
14
|
+
(
|
|
15
|
+
useRuntimeConfig() as {
|
|
16
|
+
cacheStorage?: { maxEntries?: number; maxSizeMb?: number };
|
|
17
|
+
}
|
|
18
|
+
).cacheStorage ?? {};
|
|
19
|
+
const max = Math.floor(Number(maxEntries));
|
|
20
|
+
const maxSize = Math.floor(Number(maxSizeMb) * 1024 * 1024);
|
|
21
|
+
if (!(max > 0) || !(maxSize > 0)) return;
|
|
22
|
+
|
|
23
|
+
const storage = useStorage();
|
|
24
|
+
// An unmounted `cache:` resolves to the root storage (base "").
|
|
25
|
+
if (storage.getMount("cache:").base !== "") return;
|
|
26
|
+
|
|
27
|
+
storage.mount("cache", lruCacheDriver({ max, maxSize }));
|
|
28
|
+
});
|