@shopbite-de/storefront 1.29.0 → 1.30.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 +4 -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/useShareLink.ts +47 -0
- package/app/composables/useTopSellers.ts +4 -1
- 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/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/nuxt.config.ts +20 -0
- package/package.json +1 -1
- 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/useShareLink.test.ts +76 -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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
parseListParam,
|
|
4
|
+
productDeepLink,
|
|
5
|
+
withQuickViewConfiguration,
|
|
6
|
+
} from "../../app/utils/productUrl";
|
|
7
|
+
|
|
8
|
+
describe("productDeepLink", () => {
|
|
9
|
+
it("uses the canonical product SEO URL when it is a deep link", () => {
|
|
10
|
+
expect(
|
|
11
|
+
productDeepLink(
|
|
12
|
+
{
|
|
13
|
+
productNumber: "LF-21",
|
|
14
|
+
seoUrls: [
|
|
15
|
+
{ seoPathInfo: "Pizza-Margherita/LF-21", isCanonical: false },
|
|
16
|
+
{
|
|
17
|
+
seoPathInfo: "Speisekarte/Pizza/?produkt=LF-21",
|
|
18
|
+
isCanonical: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
"/Speisekarte/Nudeln/",
|
|
23
|
+
),
|
|
24
|
+
).toBe("/Speisekarte/Pizza/?produkt=LF-21");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("builds the link from the category without a deep link SEO URL", () => {
|
|
28
|
+
expect(
|
|
29
|
+
productDeepLink(
|
|
30
|
+
{
|
|
31
|
+
productNumber: "LF-21",
|
|
32
|
+
seoUrls: [
|
|
33
|
+
{ seoPathInfo: "Pizza-Margherita/LF-21", isCanonical: true },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
"/Speisekarte/Pizza/",
|
|
37
|
+
),
|
|
38
|
+
).toBe("/Speisekarte/Pizza/?produkt=LF-21");
|
|
39
|
+
expect(productDeepLink({ productNumber: "A 1/2" }, "c/Pizza/")).toBe(
|
|
40
|
+
"/c/Pizza/?produkt=A+1%2F2",
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("is undefined without SEO URL and category", () => {
|
|
45
|
+
expect(productDeepLink({ productNumber: "LF-21" })).toBeUndefined();
|
|
46
|
+
expect(productDeepLink({}, "/c/Pizza/")).toBeUndefined();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("parseListParam", () => {
|
|
51
|
+
it("splits comma-separated and repeated values", () => {
|
|
52
|
+
expect(parseListParam("Zwiebeln, Oliven,")).toEqual(["Zwiebeln", "Oliven"]);
|
|
53
|
+
expect(parseListParam(["LF-500", "LF-501,LF-502"])).toEqual([
|
|
54
|
+
"LF-500",
|
|
55
|
+
"LF-501",
|
|
56
|
+
"LF-502",
|
|
57
|
+
]);
|
|
58
|
+
expect(parseListParam(undefined)).toEqual([]);
|
|
59
|
+
expect(parseListParam([null])).toEqual([]);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("withQuickViewConfiguration", () => {
|
|
64
|
+
const query = {
|
|
65
|
+
properties: "a|b",
|
|
66
|
+
produkt: "LF-21",
|
|
67
|
+
ohne: "Zwiebeln",
|
|
68
|
+
extras: "LF-500",
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
it("replaces the configuration and keeps other parameters", () => {
|
|
72
|
+
expect(
|
|
73
|
+
withQuickViewConfiguration(query, {
|
|
74
|
+
productNumber: "LF-21-groß",
|
|
75
|
+
without: ["Zwiebeln", "Oliven"],
|
|
76
|
+
extras: [],
|
|
77
|
+
}),
|
|
78
|
+
).toEqual({
|
|
79
|
+
properties: "a|b",
|
|
80
|
+
produkt: "LF-21-groß",
|
|
81
|
+
ohne: "Zwiebeln,Oliven",
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("removes all three parameters without a configuration", () => {
|
|
86
|
+
expect(withQuickViewConfiguration(query, undefined)).toEqual({
|
|
87
|
+
properties: "a|b",
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
});
|
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
|
+
});
|