@shopbite-de/storefront 1.31.0 → 1.31.2

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.
@@ -65,7 +65,7 @@ jobs:
65
65
  - name: Install pnpm
66
66
  uses: pnpm/action-setup@v6
67
67
  with:
68
- version: 12.5.1
68
+ version: 12.9.1
69
69
 
70
70
  - name: Install Node.js
71
71
  uses: actions/setup-node@v7
@@ -25,7 +25,7 @@ jobs:
25
25
 
26
26
  - uses: pnpm/action-setup@v6
27
27
  with:
28
- version: 12.5.1
28
+ version: 12.9.1
29
29
 
30
30
  - uses: actions/setup-node@v7
31
31
  with:
@@ -69,7 +69,7 @@ jobs:
69
69
 
70
70
  - uses: pnpm/action-setup@v6
71
71
  with:
72
- version: 12.5.1
72
+ version: 12.9.1
73
73
 
74
74
  - uses: actions/setup-node@v7
75
75
  with:
@@ -105,7 +105,7 @@ jobs:
105
105
 
106
106
  - uses: pnpm/action-setup@v6
107
107
  with:
108
- version: 12.5.1
108
+ version: 12.9.1
109
109
 
110
110
  - uses: actions/setup-node@v7
111
111
  with:
package/CLAUDE.md CHANGED
@@ -138,7 +138,7 @@ Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): f
138
138
  - `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
139
139
  - The home page FAQ (`faq` in `content/index.yml`, `Home/Faq.vue`, #404) uses native `<details>`, not `UAccordion`: Reka unmounts closed panels, and the answers must be in the SSR HTML. The same items feed the `FAQPage` JSON-LD and `/llms.txt`.
140
140
  - `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.
141
- - Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`) 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).
141
+ - 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).
142
142
 
143
143
  ### Testing setup
144
144
 
@@ -63,6 +63,7 @@ export function useRestaurantSchema() {
63
63
  buildRestaurantSchema({
64
64
  site: {
65
65
  name: site.name,
66
+ alternateNames: splitList(site.alternateNames),
66
67
  description: site.description,
67
68
  url: siteConfig.url,
68
69
  image: site.ogImage
@@ -9,11 +9,12 @@ const route = useRoute();
9
9
  // out of client-side navigations (#314).
10
10
  const { data: page, error } = await useAsyncData(
11
11
  `landingpages-${route.path}`,
12
- () => $fetch("/api/content/page", { query: { path: route.path } }),
12
+ async () =>
13
+ (await $fetch("/api/content/page", { query: { path: route.path } })).page,
13
14
  );
14
15
 
15
16
  // A failing content server is a real error and stays fatal (logged); 4xx
16
- // means there is no such page (the route rejects over-long paths with 400).
17
+ // means there is no content page (the route rejects over-long paths with 400).
17
18
  if ((error.value?.statusCode ?? 0) >= 500) {
18
19
  throw createError({
19
20
  statusCode: 500,
@@ -26,6 +26,8 @@ type HolidayLike = {
26
26
 
27
27
  export type SiteInfo = {
28
28
  name: string;
29
+ /** Other names the shop is listed under, e.g. "Alte Schmiede". */
30
+ alternateNames?: string[];
29
31
  url: string;
30
32
  description?: string;
31
33
  image?: string;
@@ -199,6 +201,9 @@ export function buildRestaurantSchema(input: {
199
201
  "@type": "Restaurant",
200
202
  "@id": `${site.url}#restaurant`,
201
203
  name: site.name,
204
+ alternateName: site.alternateNames?.length
205
+ ? site.alternateNames
206
+ : undefined,
202
207
  description: site.description,
203
208
  url: site.url,
204
209
  image: site.image,
package/container CHANGED
File without changes
package/nuxt.config.ts CHANGED
@@ -109,6 +109,11 @@ export default defineNuxtConfig({
109
109
  },
110
110
  telephone: "",
111
111
  googleBusinessProfileUrl: "",
112
+ // Other names the shop is known by on maps and directories, comma-
113
+ // separated ("La Fattoria / Alte Schmiede, Alte Schmiede"), so search
114
+ // engines and AI assistants match them to this shop. Restaurant
115
+ // schema `alternateName` and /llms.txt.
116
+ alternateNames: "",
112
117
  // Restaurant schema only, e.g. "€€" (#272).
113
118
  priceRange: "",
114
119
  // Restaurant schema only (#401): comma-separated delivery areas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopbite-de/storefront",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "main": "nuxt.config.ts",
5
5
  "description": "Shopware storefront for food delivery shops",
6
6
  "keywords": [
@@ -69,7 +69,7 @@
69
69
  "tailwindcss": "^4.3.3",
70
70
  "typescript": "^6.0.3",
71
71
  "vitest": "^5.0.1",
72
- "vue-tsc": "3.3.11"
72
+ "vue-tsc": "3.3.12"
73
73
  },
74
74
  "scripts": {
75
75
  "build": "nuxt build",
File without changes
@@ -1,7 +1,8 @@
1
1
  import { queryCollection } from "@nuxt/content/server";
2
2
 
3
- // Landing page (content/*.md) by route path; see home.get.ts for why the
4
- // pages do not query the collection in the browser (#314).
3
+ // Landing page (content/*.md) by route path, `page: null` if there is none;
4
+ // see home.get.ts for why the pages do not query the collection in the
5
+ // browser (#314).
5
6
  export default defineEventHandler(async (event) => {
6
7
  const { path } = getQuery(event);
7
8
 
@@ -9,14 +10,10 @@ export default defineEventHandler(async (event) => {
9
10
  throw createError({ statusCode: 400, statusMessage: "Invalid path" });
10
11
  }
11
12
 
13
+ // No content page is a regular answer, not an error: the catch-all asks
14
+ // here first for every category page, and a 404 would show up as a failed
15
+ // request in the browser console and the RUM data on each navigation.
12
16
  const page = await queryCollection(event, "landingpages").path(path).first();
13
17
 
14
- if (!page) {
15
- throw createError({
16
- statusCode: 404,
17
- statusMessage: `Page ${path} not found!`,
18
- });
19
- }
20
-
21
- return page;
18
+ return { page: page ?? null };
22
19
  });
@@ -114,6 +114,7 @@ export default defineEventHandler(async (event) => {
114
114
 
115
115
  const body = buildLlmsTxt({
116
116
  name: site.name,
117
+ alternateNames: splitList(site.alternateNames),
117
118
  description: site.description,
118
119
  url: siteUrl,
119
120
  cuisine: site.cuisine,
@@ -24,6 +24,8 @@ export type LlmsMenuSection = {
24
24
 
25
25
  export type LlmsTxtInput = {
26
26
  name: string;
27
+ /** Other names the shop is listed under on maps and directories. */
28
+ alternateNames?: string[];
27
29
  description?: string;
28
30
  url: string;
29
31
  cuisine?: string;
@@ -125,6 +127,9 @@ export function buildLlmsTxt(input: LlmsTxtInput): string {
125
127
  .join(" ");
126
128
 
127
129
  const contact = [
130
+ input.alternateNames?.length
131
+ ? `- Auch bekannt als: ${input.alternateNames.join(", ")}`
132
+ : undefined,
128
133
  input.address?.street || input.address?.postalCode || city
129
134
  ? `- Adresse: ${[
130
135
  input.address?.street,
@@ -0,0 +1,74 @@
1
+ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ type Handler = (event: { query: Record<string, unknown> }) => Promise<unknown>;
4
+
5
+ const { mockFirst, mockPath, mockQueryCollection } = vi.hoisted(() => {
6
+ const mockFirst = vi.fn();
7
+ const mockPath = vi.fn(() => ({ first: mockFirst }));
8
+ const mockQueryCollection = vi.fn(() => ({ path: mockPath }));
9
+ return { mockFirst, mockPath, mockQueryCollection };
10
+ });
11
+
12
+ vi.mock("@nuxt/content/server", () => ({
13
+ queryCollection: mockQueryCollection,
14
+ }));
15
+
16
+ // Nitro auto-imports of the route, reduced to what it uses.
17
+ vi.stubGlobal("defineEventHandler", (handler: Handler) => handler);
18
+ vi.stubGlobal(
19
+ "getQuery",
20
+ (event: { query: Record<string, unknown> }) => event.query,
21
+ );
22
+ vi.stubGlobal(
23
+ "createError",
24
+ (input: { statusCode: number; statusMessage: string }) =>
25
+ Object.assign(new Error(input.statusMessage), input),
26
+ );
27
+
28
+ let handler: Handler;
29
+
30
+ beforeAll(async () => {
31
+ // With the stubs above the default export is the plain handler function.
32
+ handler = (await import("../../server/api/content/page.get"))
33
+ .default as unknown as Handler;
34
+ });
35
+
36
+ beforeEach(() => {
37
+ vi.clearAllMocks();
38
+ });
39
+
40
+ describe("GET /api/content/page", () => {
41
+ it("returns the content page of the path", async () => {
42
+ const page = { path: "/agb", title: "AGB" };
43
+ mockFirst.mockResolvedValue(page);
44
+
45
+ await expect(handler({ query: { path: "/agb" } })).resolves.toEqual({
46
+ page,
47
+ });
48
+ expect(mockQueryCollection).toHaveBeenCalledWith(
49
+ expect.anything(),
50
+ "landingpages",
51
+ );
52
+ expect(mockPath).toHaveBeenCalledWith("/agb");
53
+ });
54
+
55
+ it("answers page: null instead of a 404 when there is no content page", async () => {
56
+ mockFirst.mockResolvedValue(null);
57
+
58
+ await expect(
59
+ handler({ query: { path: "/speisekarte/pizza/" } }),
60
+ ).resolves.toEqual({ page: null });
61
+ });
62
+
63
+ it.each([
64
+ ["missing", undefined],
65
+ ["relative", "agb"],
66
+ ["too long", `/${"x".repeat(256)}`],
67
+ ["repeated", ["/agb", "/impressum"]],
68
+ ])("rejects a %s path with 400", async (_label, path) => {
69
+ await expect(handler({ query: { path } })).rejects.toMatchObject({
70
+ statusCode: 400,
71
+ });
72
+ expect(mockQueryCollection).not.toHaveBeenCalled();
73
+ });
74
+ });
@@ -135,9 +135,30 @@ Nach Obertshausen und Lämmerspiel.
135
135
  `);
136
136
  });
137
137
 
138
+ it("names other names of the shop under Kontakt", () => {
139
+ expect(
140
+ buildLlmsTxt({
141
+ name: "Pizzeria La Fattoria",
142
+ alternateNames: ["La Fattoria / Alte Schmiede", "Alte Schmiede"],
143
+ url: "https://www.pizzeria-lafattoria.de",
144
+ now,
145
+ }),
146
+ ).toContain(`## Kontakt
147
+
148
+ - Auch bekannt als: La Fattoria / Alte Schmiede, Alte Schmiede
149
+ - Website: https://www.pizzeria-lafattoria.de
150
+ `);
151
+ });
152
+
138
153
  it("leaves out what is not configured", () => {
139
- expect(buildLlmsTxt({ name: "ShopBite", url: "https://example.com", now }))
140
- .toBe(`# ShopBite
154
+ expect(
155
+ buildLlmsTxt({
156
+ name: "ShopBite",
157
+ alternateNames: [],
158
+ url: "https://example.com",
159
+ now,
160
+ }),
161
+ ).toBe(`# ShopBite
141
162
 
142
163
  > ShopBite.
143
164
 
@@ -243,11 +243,27 @@ describe("buildRestaurantSchema", () => {
243
243
  });
244
244
  });
245
245
 
246
+ it("lists other names of the shop as alternateName", () => {
247
+ const schema = buildRestaurantSchema({
248
+ site: {
249
+ name: "Pizzeria La Fattoria",
250
+ url: "https://www.pizzeria-lafattoria.de",
251
+ alternateNames: ["La Fattoria / Alte Schmiede", "Alte Schmiede"],
252
+ },
253
+ });
254
+
255
+ expect(schema.alternateName).toEqual([
256
+ "La Fattoria / Alte Schmiede",
257
+ "Alte Schmiede",
258
+ ]);
259
+ });
260
+
246
261
  it("leaves empty values out", () => {
247
262
  const schema = buildRestaurantSchema({
248
263
  site: {
249
264
  name: "ShopBite",
250
265
  url: "https://example.com",
266
+ alternateNames: [],
251
267
  telephone: "",
252
268
  address: { street: "", postalCode: "", city: "", country: "DE" },
253
269
  },