@shopbite-de/storefront 1.28.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/README.md +14 -14
- package/app/components/Category/Listing.vue +1 -0
- package/app/components/Home/Faq.vue +58 -0
- package/app/components/Home/Highlights.vue +69 -0
- package/app/components/Home/MenuCategories.vue +148 -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 +19 -11
- 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 +25 -4
- package/content.config.ts +28 -17
- package/docs/notes/2026-09-23-issue-388-home-sections.md +45 -0
- package/docs/notes/2026-09-25-dependency-update.md +55 -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 -1
- package/package.json +9 -10
- package/pnpm-workspace.yaml +0 -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/HomeMenuCategories.test.ts +94 -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
- package/app/components/Food/Marquee.vue +0 -35
- package/app/components/Food/MarqueeItem.vue +0 -77
- package/app/components/Topseller.vue +0 -53
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { mountSuspended } from "@nuxt/test-utils/runtime";
|
|
3
|
+
import type { Schemas } from "#shopware";
|
|
4
|
+
import ProductDeselectIngredient from "~/components/Product/DeselectIngredient.vue";
|
|
5
|
+
|
|
6
|
+
const product = {
|
|
7
|
+
properties: ["Tomatensoße", "Zwiebeln", "Oliven"].map((name) => ({
|
|
8
|
+
group: { name: "Hauptzutaten" },
|
|
9
|
+
translated: { name },
|
|
10
|
+
})),
|
|
11
|
+
} as unknown as Schemas["Product"];
|
|
12
|
+
|
|
13
|
+
describe("ProductDeselectIngredient", () => {
|
|
14
|
+
it("starts without deselected ingredients", async () => {
|
|
15
|
+
const wrapper = await mountSuspended(ProductDeselectIngredient, {
|
|
16
|
+
props: { product },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
expect(wrapper.emitted("ingredients-deselected")).toBeUndefined();
|
|
20
|
+
expect(wrapper.findAll('[aria-pressed="true"]')).toHaveLength(0);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("deselects ingredients from the URL and ignores unknown names (#411)", async () => {
|
|
24
|
+
const wrapper = await mountSuspended(ProductDeselectIngredient, {
|
|
25
|
+
props: { product, initialDeselected: ["Zwiebeln", "Salami"] },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
expect(wrapper.emitted("ingredients-deselected")?.[0]).toEqual([
|
|
29
|
+
["Zwiebeln"],
|
|
30
|
+
]);
|
|
31
|
+
const pressed = wrapper.findAll('[aria-pressed="true"]');
|
|
32
|
+
expect(pressed.map((button) => button.text())).toEqual(["Zwiebeln"]);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { mountSuspended, mockNuxtImport } from "@nuxt/test-utils/runtime";
|
|
3
|
+
import { defineComponent, h } from "vue";
|
|
4
|
+
|
|
5
|
+
const { add } = vi.hoisted(() => ({ add: vi.fn() }));
|
|
6
|
+
mockNuxtImport("useToast", () => () => ({ add }));
|
|
7
|
+
|
|
8
|
+
async function mountShare() {
|
|
9
|
+
let api!: ReturnType<typeof useShareLink>;
|
|
10
|
+
await mountSuspended(
|
|
11
|
+
defineComponent({
|
|
12
|
+
setup() {
|
|
13
|
+
api = useShareLink();
|
|
14
|
+
return () => h("div");
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
return api;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe("useShareLink", () => {
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
vi.unstubAllGlobals();
|
|
24
|
+
add.mockReset();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("uses the native share sheet when available", async () => {
|
|
28
|
+
const share = vi.fn().mockResolvedValue(undefined);
|
|
29
|
+
vi.stubGlobal("navigator", { ...navigator, share });
|
|
30
|
+
|
|
31
|
+
const api = await mountShare();
|
|
32
|
+
expect(api.canShare.value).toBe(true);
|
|
33
|
+
await api.share({ title: "Pizza" });
|
|
34
|
+
|
|
35
|
+
expect(share).toHaveBeenCalledWith({
|
|
36
|
+
title: "Pizza",
|
|
37
|
+
url: window.location.href,
|
|
38
|
+
});
|
|
39
|
+
expect(add).not.toHaveBeenCalled();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("copies the link without share sheet", async () => {
|
|
43
|
+
const writeText = vi.fn().mockResolvedValue(undefined);
|
|
44
|
+
vi.stubGlobal("navigator", {
|
|
45
|
+
...navigator,
|
|
46
|
+
share: undefined,
|
|
47
|
+
clipboard: { writeText },
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const api = await mountShare();
|
|
51
|
+
await api.share();
|
|
52
|
+
|
|
53
|
+
expect(writeText).toHaveBeenCalledWith(window.location.href);
|
|
54
|
+
expect(add).toHaveBeenCalledWith(
|
|
55
|
+
expect.objectContaining({ title: "Link kopiert" }),
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("does nothing when the share sheet is closed", async () => {
|
|
60
|
+
const share = vi
|
|
61
|
+
.fn()
|
|
62
|
+
.mockRejectedValue(new DOMException("closed", "AbortError"));
|
|
63
|
+
const writeText = vi.fn();
|
|
64
|
+
vi.stubGlobal("navigator", {
|
|
65
|
+
...navigator,
|
|
66
|
+
share,
|
|
67
|
+
clipboard: { writeText },
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const api = await mountShare();
|
|
71
|
+
await api.share();
|
|
72
|
+
|
|
73
|
+
expect(writeText).not.toHaveBeenCalled();
|
|
74
|
+
expect(add).not.toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
AI_SEARCH_USER_AGENTS,
|
|
4
|
+
AI_TRAINING_USER_AGENTS,
|
|
5
|
+
buildAiCrawlerGroups,
|
|
6
|
+
} from "../../server/utils/aiCrawlers";
|
|
7
|
+
|
|
8
|
+
const disallow = ["/merkliste", "/passwort-vergessen"];
|
|
9
|
+
|
|
10
|
+
describe("buildAiCrawlerGroups", () => {
|
|
11
|
+
it("allows both kinds and repeats the disallow rules by default", () => {
|
|
12
|
+
const [search, training] = buildAiCrawlerGroups(
|
|
13
|
+
{ search: true, training: true },
|
|
14
|
+
disallow,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(search).toMatchObject({
|
|
18
|
+
userAgent: AI_SEARCH_USER_AGENTS,
|
|
19
|
+
allow: ["/"],
|
|
20
|
+
disallow,
|
|
21
|
+
});
|
|
22
|
+
expect(training).toMatchObject({
|
|
23
|
+
userAgent: AI_TRAINING_USER_AGENTS,
|
|
24
|
+
allow: ["/"],
|
|
25
|
+
disallow,
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("blocks training crawlers only", () => {
|
|
30
|
+
const [search, training] = buildAiCrawlerGroups(
|
|
31
|
+
{ search: true, training: false },
|
|
32
|
+
disallow,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(search).toMatchObject({ allow: ["/"], disallow });
|
|
36
|
+
expect(training).toMatchObject({ allow: [], disallow: ["/"] });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("does not copy a site-wide Disallow: / into an allowed group", () => {
|
|
40
|
+
const [search] = buildAiCrawlerGroups({ search: true, training: true }, [
|
|
41
|
+
"/",
|
|
42
|
+
"",
|
|
43
|
+
"/konto",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
expect(search!.disallow).toEqual(["/konto"]);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { buildLlmsTxt } from "../../server/utils/llmsTxt";
|
|
3
|
+
|
|
4
|
+
const now = new Date("2026-10-05T12:00:00Z");
|
|
5
|
+
|
|
6
|
+
describe("buildLlmsTxt", () => {
|
|
7
|
+
it("renders shop, hours, ordering, menu and pages as Markdown", () => {
|
|
8
|
+
const text = buildLlmsTxt({
|
|
9
|
+
name: "Pizzeria La Fattoria",
|
|
10
|
+
description: "Italienisch-deutsche Küche seit 1997.",
|
|
11
|
+
url: "https://www.pizzeria-lafattoria.de",
|
|
12
|
+
cuisine: "Italienische Küche",
|
|
13
|
+
address: {
|
|
14
|
+
street: "Kantstraße 6",
|
|
15
|
+
postalCode: "63179",
|
|
16
|
+
city: "Obertshausen",
|
|
17
|
+
},
|
|
18
|
+
telephone: "+49 6104 71427",
|
|
19
|
+
deliveryAreas: ["63179 Obertshausen", "63165 Lämmerspiel"],
|
|
20
|
+
businessHours: [1, 2, 3, 4, 5].map((dayOfWeek) => ({
|
|
21
|
+
dayOfWeek,
|
|
22
|
+
openingTime: "11:30:00",
|
|
23
|
+
closingTime: "22:00:00",
|
|
24
|
+
})),
|
|
25
|
+
holidays: [
|
|
26
|
+
// ended before `now`: left out
|
|
27
|
+
{ start: "2026-07-12T21:00:00Z", end: "2026-08-05T22:00:00Z" },
|
|
28
|
+
{ start: "2026-12-24T00:00:00Z", end: "2026-12-26T00:00:00Z" },
|
|
29
|
+
],
|
|
30
|
+
isCheckoutEnabled: true,
|
|
31
|
+
deliveryTime: 30,
|
|
32
|
+
menuUrl: "https://www.pizzeria-lafattoria.de/speisekarte",
|
|
33
|
+
menu: [
|
|
34
|
+
{
|
|
35
|
+
name: "Pizza",
|
|
36
|
+
url: "https://www.pizzeria-lafattoria.de/c/Pizza/",
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
name: "Pizza Margherita",
|
|
40
|
+
price: 7,
|
|
41
|
+
fromPrice: true,
|
|
42
|
+
ingredients: ["Tomatensoße", "Mozzarella"],
|
|
43
|
+
diets: ["vegetarian"],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "Pizza Salami",
|
|
47
|
+
price: 8.5,
|
|
48
|
+
url: "https://www.pizzeria-lafattoria.de/c/Pizza/?produkt=22",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "Nudeln",
|
|
54
|
+
items: [],
|
|
55
|
+
sections: [
|
|
56
|
+
{
|
|
57
|
+
name: "Spaghetti",
|
|
58
|
+
items: [
|
|
59
|
+
{
|
|
60
|
+
name: "Spaghetti Aglio e Olio",
|
|
61
|
+
price: 9,
|
|
62
|
+
diets: ["vegetarian", "vegan"],
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
// no products: left out
|
|
69
|
+
{ name: "Saisonales", items: [] },
|
|
70
|
+
],
|
|
71
|
+
pages: [
|
|
72
|
+
{
|
|
73
|
+
title: "Zahlungs- und Lieferinformationen",
|
|
74
|
+
url: "https://www.pizzeria-lafattoria.de/zahlung-und-versand",
|
|
75
|
+
description: "Zahlungs- und Lieferinformationen",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
faq: [
|
|
79
|
+
{
|
|
80
|
+
question: "Wohin liefern Sie?",
|
|
81
|
+
answer: "Nach Obertshausen und Lämmerspiel.",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
currency: "EUR",
|
|
85
|
+
now,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
expect(text).toBe(`# Pizzeria La Fattoria
|
|
89
|
+
|
|
90
|
+
> Pizzeria La Fattoria: Italienische Küche in Obertshausen. Online bestellen zur Lieferung oder Abholung unter https://www.pizzeria-lafattoria.de.
|
|
91
|
+
|
|
92
|
+
Italienisch-deutsche Küche seit 1997.
|
|
93
|
+
|
|
94
|
+
## Kontakt
|
|
95
|
+
|
|
96
|
+
- Adresse: Kantstraße 6, 63179 Obertshausen
|
|
97
|
+
- Telefon: +49 6104 71427
|
|
98
|
+
- Website: https://www.pizzeria-lafattoria.de
|
|
99
|
+
|
|
100
|
+
## Öffnungszeiten
|
|
101
|
+
|
|
102
|
+
- Mo–Fr: 11:30–22:00
|
|
103
|
+
- Sa–So: Ruhetag
|
|
104
|
+
- Geschlossen: 24.12.2026 – 26.12.2026
|
|
105
|
+
|
|
106
|
+
## Bestellen
|
|
107
|
+
|
|
108
|
+
- Online bestellen: https://www.pizzeria-lafattoria.de/speisekarte
|
|
109
|
+
- Liefergebiet: 63179 Obertshausen, 63165 Lämmerspiel
|
|
110
|
+
- Lieferzeit: ca. 30 Minuten
|
|
111
|
+
- Abholung im Restaurant möglich
|
|
112
|
+
|
|
113
|
+
## Häufige Fragen
|
|
114
|
+
|
|
115
|
+
### Wohin liefern Sie?
|
|
116
|
+
|
|
117
|
+
Nach Obertshausen und Lämmerspiel.
|
|
118
|
+
|
|
119
|
+
## Speisekarte
|
|
120
|
+
|
|
121
|
+
### [Pizza](https://www.pizzeria-lafattoria.de/c/Pizza/)
|
|
122
|
+
|
|
123
|
+
- Pizza Margherita: ab 7,00 € (Tomatensoße, Mozzarella; vegetarisch)
|
|
124
|
+
- [Pizza Salami](https://www.pizzeria-lafattoria.de/c/Pizza/?produkt=22): 8,50 €
|
|
125
|
+
|
|
126
|
+
### Nudeln
|
|
127
|
+
|
|
128
|
+
#### Spaghetti
|
|
129
|
+
|
|
130
|
+
- Spaghetti Aglio e Olio: 9,00 € (vegan)
|
|
131
|
+
|
|
132
|
+
## Weitere Informationen
|
|
133
|
+
|
|
134
|
+
- [Zahlungs- und Lieferinformationen](https://www.pizzeria-lafattoria.de/zahlung-und-versand)
|
|
135
|
+
`);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("leaves out what is not configured", () => {
|
|
139
|
+
expect(buildLlmsTxt({ name: "ShopBite", url: "https://example.com", now }))
|
|
140
|
+
.toBe(`# ShopBite
|
|
141
|
+
|
|
142
|
+
> ShopBite.
|
|
143
|
+
|
|
144
|
+
## Kontakt
|
|
145
|
+
|
|
146
|
+
- Website: https://example.com
|
|
147
|
+
`);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import type { Schemas } from "#shopware";
|
|
3
3
|
import {
|
|
4
|
+
getDiets,
|
|
4
5
|
getMainIngredients,
|
|
6
|
+
hasYesOption,
|
|
5
7
|
lineItemHoldsProduct,
|
|
6
8
|
productIsAvailable,
|
|
7
9
|
} from "../../app/utils/product";
|
|
@@ -70,3 +72,21 @@ describe("getMainIngredients", () => {
|
|
|
70
72
|
expect(getMainIngredients([group("Küche", ["Italienisch"])])).toEqual([]);
|
|
71
73
|
});
|
|
72
74
|
});
|
|
75
|
+
|
|
76
|
+
describe("hasYesOption", () => {
|
|
77
|
+
it("needs the option Ja in the named group", () => {
|
|
78
|
+
const properties = [group("Vegetarisch", ["Ja"]), group("Vegan", ["Nein"])];
|
|
79
|
+
expect(hasYesOption(properties, "Vegetarisch")).toBe(true);
|
|
80
|
+
expect(hasYesOption(properties, "Vegan")).toBe(false);
|
|
81
|
+
expect(hasYesOption(undefined, "Vegetarisch")).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe("getDiets", () => {
|
|
86
|
+
it("returns the marked diets", () => {
|
|
87
|
+
expect(
|
|
88
|
+
getDiets([group("Vegetarisch", ["Ja"]), group("Vegan", ["Ja"])]),
|
|
89
|
+
).toEqual(["vegetarian", "vegan"]);
|
|
90
|
+
expect(getDiets([group("Hauptzutaten", ["Salami"])])).toEqual([]);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { MarqueeItem } from "~/components/Food/MarqueeItem.vue";
|
|
3
|
-
|
|
4
|
-
defineProps<{
|
|
5
|
-
title: string;
|
|
6
|
-
description?: string | undefined;
|
|
7
|
-
headline?: string | undefined;
|
|
8
|
-
items: MarqueeItem[];
|
|
9
|
-
}>();
|
|
10
|
-
</script>
|
|
11
|
-
|
|
12
|
-
<template>
|
|
13
|
-
<AnimatedSection
|
|
14
|
-
animation="fade-up"
|
|
15
|
-
duration="duration-1000"
|
|
16
|
-
delay="delay-100"
|
|
17
|
-
>
|
|
18
|
-
<UPageSection
|
|
19
|
-
id="food"
|
|
20
|
-
:title="title"
|
|
21
|
-
:description="description"
|
|
22
|
-
:headline="headline"
|
|
23
|
-
:ui="{ container: 'max-w-full' }"
|
|
24
|
-
>
|
|
25
|
-
<UMarquee :repeat="6" pause-on-hover :overlay="true">
|
|
26
|
-
<FoodMarqueeItem
|
|
27
|
-
v-for="item in items"
|
|
28
|
-
:key="item.productId"
|
|
29
|
-
:product-id="item.productId"
|
|
30
|
-
:image="item.image"
|
|
31
|
-
/>
|
|
32
|
-
</UMarquee>
|
|
33
|
-
</UPageSection>
|
|
34
|
-
</AnimatedSection>
|
|
35
|
-
</template>
|