@shopbite-de/storefront 1.29.0 → 1.31.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 +9 -0
- package/CLAUDE.md +5 -1
- package/app/components/Category/Listing.vue +1 -0
- package/app/components/Home/Faq.vue +58 -0
- package/app/components/Home/Highlights.vue +1 -0
- package/app/components/Product/Card.vue +46 -10
- package/app/components/Product/CardDietBadges.vue +7 -13
- package/app/components/Product/CrossSelling.vue +18 -2
- package/app/components/Product/DeselectIngredient.vue +10 -3
- package/app/components/Product/Detail.vue +33 -2
- package/app/components/Product/QuickView.vue +20 -1
- package/app/composables/useMenuSectionSchema.ts +21 -8
- package/app/composables/useProductCrossSelling.ts +1 -0
- package/app/composables/useProductQuickView.ts +151 -9
- package/app/composables/useRestaurantSchema.ts +40 -3
- package/app/composables/useSeoUrlRoute.ts +50 -5
- package/app/composables/useShareLink.ts +61 -0
- package/app/composables/useTopSellers.ts +4 -1
- package/app/composables/useTrackEvent.ts +19 -0
- package/app/pages/[...all].vue +38 -10
- package/app/pages/index.vue +7 -0
- package/app/types/Association.d.ts +2 -0
- package/app/utils/product.ts +28 -0
- package/app/utils/productUrl.ts +87 -0
- package/app/utils/schema.ts +82 -1
- package/app/utils/seo.ts +13 -0
- package/app/utils/seoPath.ts +13 -2
- package/content/index.yml +18 -0
- package/content.config.ts +13 -0
- package/docs/notes/2026-10-05-issue-289-product-deep-links.md +28 -0
- package/docs/notes/2026-10-05-issue-400-menu-item-ingredients-diet.md +18 -0
- package/docs/notes/2026-10-05-issue-401-restaurant-schema-ordering.md +21 -0
- package/docs/notes/2026-10-05-issue-402-llms-txt.md +17 -0
- package/docs/notes/2026-10-05-issue-403-ai-crawlers.md +15 -0
- package/docs/notes/2026-10-05-issue-404-faq.md +21 -0
- package/docs/notes/2026-10-05-issue-411-quick-view-share.md +22 -0
- package/docs/notes/2026-10-06-old-seo-url-redirect.md +30 -0
- package/nuxt.config.ts +20 -0
- package/package.json +3 -3
- package/server/api/listing/[categoryId].get.ts +3 -0
- package/server/api/product/[productId]/cross-selling.get.ts +2 -1
- package/server/plugins/ai-crawlers.ts +27 -0
- package/server/routes/llms.txt.ts +213 -0
- package/server/utils/aiCrawlers.ts +79 -0
- package/server/utils/llmsTxt.ts +207 -0
- package/test/nuxt/HomeFaq.test.ts +34 -0
- package/test/nuxt/ProductCrossSelling.test.ts +20 -0
- package/test/nuxt/ProductDeselectIngredient.test.ts +34 -0
- package/test/nuxt/useSeoUrlRoute.test.ts +88 -5
- package/test/nuxt/useShareLink.test.ts +103 -0
- package/test/nuxt/useTrackEvent.test.ts +16 -0
- package/test/unit/aiCrawlers.spec.ts +48 -0
- package/test/unit/llmsTxt.spec.ts +149 -0
- package/test/unit/product.spec.ts +20 -0
- package/test/unit/productUrl.spec.ts +90 -0
- package/test/unit/schema.spec.ts +123 -0
- package/test/unit/seo.spec.ts +13 -0
- package/test/unit/seoPath.spec.ts +45 -0
- package/app/pages/c/[...all].vue +0 -20
- package/app/pages/speisekarte/[...all].vue +0 -20
package/test/unit/schema.spec.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import {
|
|
3
|
+
buildFaqPageSchema,
|
|
3
4
|
buildMenuSectionSchema,
|
|
4
5
|
buildOpeningHoursSpecification,
|
|
5
6
|
buildRestaurantSchema,
|
|
@@ -182,6 +183,66 @@ describe("buildRestaurantSchema", () => {
|
|
|
182
183
|
});
|
|
183
184
|
});
|
|
184
185
|
|
|
186
|
+
it("adds ordering, delivery areas, geo and payment", () => {
|
|
187
|
+
const schema = buildRestaurantSchema({
|
|
188
|
+
site: {
|
|
189
|
+
...site,
|
|
190
|
+
deliveryAreas: ["63179 Obertshausen", "63165 Lämmerspiel"],
|
|
191
|
+
// strings: env values that are not plain numbers
|
|
192
|
+
geo: { latitude: "50.0716", longitude: 8.8483 },
|
|
193
|
+
acceptsReservations: "Nur telefonisch",
|
|
194
|
+
},
|
|
195
|
+
orderUrl: "https://www.pizzeria-lafattoria.de/speisekarte",
|
|
196
|
+
paymentMethods: ["Barzahlung", "EC-Karte"],
|
|
197
|
+
currency: "EUR",
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
expect(schema).toMatchObject({
|
|
201
|
+
geo: { "@type": "GeoCoordinates", latitude: 50.0716, longitude: 8.8483 },
|
|
202
|
+
areaServed: ["63179 Obertshausen", "63165 Lämmerspiel"],
|
|
203
|
+
acceptsReservations: "Nur telefonisch",
|
|
204
|
+
paymentAccepted: "Barzahlung, EC-Karte",
|
|
205
|
+
currenciesAccepted: "EUR",
|
|
206
|
+
potentialAction: {
|
|
207
|
+
"@type": "OrderAction",
|
|
208
|
+
target: {
|
|
209
|
+
"@type": "EntryPoint",
|
|
210
|
+
urlTemplate: "https://www.pizzeria-lafattoria.de/speisekarte",
|
|
211
|
+
actionPlatform: [
|
|
212
|
+
"https://schema.org/DesktopWebPlatform",
|
|
213
|
+
"https://schema.org/MobileWebPlatform",
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
deliveryMethod: [
|
|
217
|
+
"https://schema.org/OnSitePickup",
|
|
218
|
+
"http://purl.org/goodrelations/v1#DeliveryModeOwnFleet",
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("keeps acceptsReservations false and skips incomplete geo", () => {
|
|
225
|
+
const schema = buildRestaurantSchema({
|
|
226
|
+
site: {
|
|
227
|
+
name: "ShopBite",
|
|
228
|
+
url: "https://example.com",
|
|
229
|
+
geo: { latitude: "50.07", longitude: "" },
|
|
230
|
+
acceptsReservations: false,
|
|
231
|
+
},
|
|
232
|
+
orderUrl: "https://example.com/speisekarte",
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
expect(schema.geo).toBeUndefined();
|
|
236
|
+
expect(schema.acceptsReservations).toBe(false);
|
|
237
|
+
// no address and no delivery areas: no delivery method to state
|
|
238
|
+
expect(schema.potentialAction).toEqual({
|
|
239
|
+
"@type": "OrderAction",
|
|
240
|
+
target: expect.objectContaining({
|
|
241
|
+
urlTemplate: "https://example.com/speisekarte",
|
|
242
|
+
}),
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
185
246
|
it("leaves empty values out", () => {
|
|
186
247
|
const schema = buildRestaurantSchema({
|
|
187
248
|
site: {
|
|
@@ -214,6 +275,7 @@ describe("buildMenuSectionSchema", () => {
|
|
|
214
275
|
items: [
|
|
215
276
|
{
|
|
216
277
|
name: "Pizza Salami",
|
|
278
|
+
url: "https://example.com/c/Pizza/?produkt=22",
|
|
217
279
|
description: "mit Salami",
|
|
218
280
|
price: 9.5,
|
|
219
281
|
image: "https://cdn.example.com/salami.webp",
|
|
@@ -231,6 +293,7 @@ describe("buildMenuSectionSchema", () => {
|
|
|
231
293
|
{
|
|
232
294
|
"@type": "MenuItem",
|
|
233
295
|
name: "Pizza Salami",
|
|
296
|
+
url: "https://example.com/c/Pizza/?produkt=22",
|
|
234
297
|
description: "mit Salami",
|
|
235
298
|
image: "https://cdn.example.com/salami.webp",
|
|
236
299
|
offers: { "@type": "Offer", price: "9.50", priceCurrency: "EUR" },
|
|
@@ -240,4 +303,64 @@ describe("buildMenuSectionSchema", () => {
|
|
|
240
303
|
isPartOf: { "@type": "Menu", "@id": "https://example.com#menu" },
|
|
241
304
|
});
|
|
242
305
|
});
|
|
306
|
+
|
|
307
|
+
it("falls back to the ingredients and adds the diets", () => {
|
|
308
|
+
const schema = buildMenuSectionSchema({
|
|
309
|
+
name: "Pizza",
|
|
310
|
+
currency: "EUR",
|
|
311
|
+
items: [
|
|
312
|
+
{
|
|
313
|
+
name: "Pizza Margherita",
|
|
314
|
+
ingredients: ["Tomatensoße", "Mozzarella", "Basilikum"],
|
|
315
|
+
diets: ["vegetarian"],
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "Pizza Verdure",
|
|
319
|
+
description: "mit Grillgemüse",
|
|
320
|
+
ingredients: ["Zucchini"],
|
|
321
|
+
diets: ["vegetarian", "vegan"],
|
|
322
|
+
},
|
|
323
|
+
{ name: "Pizza Salami", ingredients: [], diets: [] },
|
|
324
|
+
],
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
expect(schema.hasMenuItem).toEqual([
|
|
328
|
+
{
|
|
329
|
+
"@type": "MenuItem",
|
|
330
|
+
name: "Pizza Margherita",
|
|
331
|
+
description: "Tomatensoße, Mozzarella, Basilikum",
|
|
332
|
+
suitableForDiet: ["https://schema.org/VegetarianDiet"],
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"@type": "MenuItem",
|
|
336
|
+
name: "Pizza Verdure",
|
|
337
|
+
description: "mit Grillgemüse",
|
|
338
|
+
suitableForDiet: [
|
|
339
|
+
"https://schema.org/VegetarianDiet",
|
|
340
|
+
"https://schema.org/VeganDiet",
|
|
341
|
+
],
|
|
342
|
+
},
|
|
343
|
+
{ "@type": "MenuItem", name: "Pizza Salami" },
|
|
344
|
+
]);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
describe("buildFaqPageSchema", () => {
|
|
349
|
+
it("maps questions and answers", () => {
|
|
350
|
+
expect(
|
|
351
|
+
buildFaqPageSchema([
|
|
352
|
+
{ question: "Wohin liefern Sie?", answer: "Nach Obertshausen." },
|
|
353
|
+
]),
|
|
354
|
+
).toEqual({
|
|
355
|
+
"@context": "https://schema.org",
|
|
356
|
+
"@type": "FAQPage",
|
|
357
|
+
mainEntity: [
|
|
358
|
+
{
|
|
359
|
+
"@type": "Question",
|
|
360
|
+
name: "Wohin liefern Sie?",
|
|
361
|
+
acceptedAnswer: { "@type": "Answer", text: "Nach Obertshausen." },
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
});
|
|
365
|
+
});
|
|
243
366
|
});
|
package/test/unit/seo.spec.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
buildHomeDescription,
|
|
4
4
|
buildHomeTitle,
|
|
5
5
|
formatPageTitle,
|
|
6
|
+
splitList,
|
|
6
7
|
toAbsoluteUrl,
|
|
7
8
|
} from "../../app/utils/seo";
|
|
8
9
|
|
|
@@ -105,3 +106,15 @@ describe("buildHomeDescription", () => {
|
|
|
105
106
|
).toBeUndefined();
|
|
106
107
|
});
|
|
107
108
|
});
|
|
109
|
+
|
|
110
|
+
describe("splitList", () => {
|
|
111
|
+
it("splits a comma-separated value and keeps arrays", () => {
|
|
112
|
+
expect(splitList("63179 Obertshausen, 63165 Lämmerspiel,")).toEqual([
|
|
113
|
+
"63179 Obertshausen",
|
|
114
|
+
"63165 Lämmerspiel",
|
|
115
|
+
]);
|
|
116
|
+
expect(splitList(["A", "B"])).toEqual(["A", "B"]);
|
|
117
|
+
expect(splitList("")).toEqual([]);
|
|
118
|
+
expect(splitList(undefined)).toEqual([]);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -105,6 +105,51 @@ describe("resolveSeoPath", () => {
|
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
+
describe("old SEO URLs", () => {
|
|
109
|
+
const newPizza = { seoPathInfo: "speisekarte/pizza/", foreignKey: "pizza" };
|
|
110
|
+
const resolve = resolverFor({ "/speisekarte/pizza/": newPizza });
|
|
111
|
+
|
|
112
|
+
it("redirects an old SEO URL to the current one", async () => {
|
|
113
|
+
const resolveOld = resolverFor({ "/c/Pizza/": newPizza });
|
|
114
|
+
|
|
115
|
+
await expect(
|
|
116
|
+
resolveSeoPath("/c/Pizza/", resolve, resolveOld),
|
|
117
|
+
).resolves.toEqual({
|
|
118
|
+
match: newPizza,
|
|
119
|
+
redirectPath: "/speisekarte/pizza/",
|
|
120
|
+
});
|
|
121
|
+
expect(resolveOld).toHaveBeenCalledTimes(1);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("redirects an old SEO URL without its trailing slash", async () => {
|
|
125
|
+
const resolveOld = resolverFor({ "/c/Pizza/": newPizza });
|
|
126
|
+
|
|
127
|
+
await expect(
|
|
128
|
+
resolveSeoPath("/c/pizza", resolve, resolveOld),
|
|
129
|
+
).resolves.toEqual({
|
|
130
|
+
match: newPizza,
|
|
131
|
+
redirectPath: "/speisekarte/pizza/",
|
|
132
|
+
});
|
|
133
|
+
expect(resolveOld).toHaveBeenLastCalledWith("/c/pizza/");
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it("asks for old SEO URLs only when the path is unknown", async () => {
|
|
137
|
+
const resolveOld = vi.fn();
|
|
138
|
+
|
|
139
|
+
await resolveSeoPath("/speisekarte/pizza", resolve, resolveOld);
|
|
140
|
+
expect(resolveOld).not.toHaveBeenCalled();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("returns no match for paths that never were SEO URLs", async () => {
|
|
144
|
+
const resolveOld = resolverFor({});
|
|
145
|
+
|
|
146
|
+
await expect(
|
|
147
|
+
resolveSeoPath("/c/Unbekannt/", resolve, resolveOld),
|
|
148
|
+
).resolves.toEqual({ match: null });
|
|
149
|
+
expect(resolveOld).toHaveBeenCalledTimes(2);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
108
153
|
it("does not toggle the root path", async () => {
|
|
109
154
|
const resolve = resolverFor({});
|
|
110
155
|
|
package/app/pages/c/[...all].vue
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Schemas } from "#shopware";
|
|
3
|
-
|
|
4
|
-
definePageMeta({
|
|
5
|
-
layout: "listing",
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const { clearBreadcrumbs } = useBreadcrumbs();
|
|
9
|
-
const { seoUrl } = await useSeoUrlRoute();
|
|
10
|
-
|
|
11
|
-
const { foreignKey } = useNavigationContext(seoUrl as Ref<Schemas["SeoUrl"]>);
|
|
12
|
-
|
|
13
|
-
onBeforeRouteLeave(() => {
|
|
14
|
-
clearBreadcrumbs();
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<CategoryListing v-if="foreignKey" :id="foreignKey" :key="foreignKey" />
|
|
20
|
-
</template>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Schemas } from "#shopware";
|
|
3
|
-
|
|
4
|
-
definePageMeta({
|
|
5
|
-
layout: "listing",
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
const { clearBreadcrumbs } = useBreadcrumbs();
|
|
9
|
-
const { seoUrl } = await useSeoUrlRoute();
|
|
10
|
-
|
|
11
|
-
const { foreignKey } = useNavigationContext(seoUrl as Ref<Schemas["SeoUrl"]>);
|
|
12
|
-
|
|
13
|
-
onBeforeRouteLeave(() => {
|
|
14
|
-
clearBreadcrumbs();
|
|
15
|
-
});
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<CategoryListing v-if="foreignKey" :id="foreignKey" :key="foreignKey" />
|
|
20
|
-
</template>
|