@shopbite-de/storefront 1.26.1 → 1.27.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.
Files changed (38) hide show
  1. package/.github/workflows/build.yaml +1 -1
  2. package/.github/workflows/ci.yaml +3 -3
  3. package/.gitignore +40 -0
  4. package/CLAUDE.md +9 -2
  5. package/app/app.vue +4 -1
  6. package/app/components/Hero.vue +17 -7
  7. package/app/components/User/RegistrationForm.vue +73 -29
  8. package/app/composables/useStoreStatus.ts +12 -7
  9. package/app/composables/useSyncWishlist.ts +119 -0
  10. package/app/pages/[...all].vue +9 -3
  11. package/app/pages/index.vue +1 -5
  12. package/app/pages/kontakt.vue +1 -5
  13. package/app/pages/registrierung/bestaetigen.vue +100 -27
  14. package/app/pages/registrierung/index.vue +20 -1
  15. package/app/utils/notFound.ts +14 -0
  16. package/content/index.yml +9 -9
  17. package/docs/notes/2026-09-21-dependency-update.md +89 -0
  18. package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +49 -0
  19. package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +43 -0
  20. package/docs/notes/2026-09-21-issue-365-home-hydration-mismatch.md +47 -0
  21. package/docs/notes/2026-09-21-issue-366-wishlist-404.md +41 -0
  22. package/docs/notes/2026-09-21-issue-369-register-confirm.md +35 -0
  23. package/modules/public-cache.ts +44 -0
  24. package/node.dockerfile +3 -3
  25. package/nuxt.config.ts +6 -0
  26. package/package.json +26 -26
  27. package/patches/@shopware__nuxt-module@1.5.2.patch +13 -0
  28. package/pnpm-workspace.yaml +3 -1
  29. package/shopware.d.ts +1 -1
  30. package/test/nuxt/Hero.test.ts +60 -2
  31. package/test/nuxt/RegisterConfirmPage.test.ts +117 -0
  32. package/test/nuxt/RegistrationForm.test.ts +132 -2
  33. package/test/nuxt/notFound.test.ts +13 -0
  34. package/test/nuxt/useSearchTracking.test.ts +3 -0
  35. package/test/nuxt/useStoreStatus.test.ts +40 -10
  36. package/test/nuxt/useSyncWishlist.test.ts +85 -0
  37. package/test/unit/publicCache.spec.ts +64 -0
  38. package/patches/@shopware__nuxt-module@1.5.1.patch +0 -32
@@ -65,7 +65,7 @@ jobs:
65
65
  - name: Install pnpm
66
66
  uses: pnpm/action-setup@v6
67
67
  with:
68
- version: 10.34.5
68
+ version: 12.5.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: 10.34.5
28
+ version: 12.5.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: 10.34.5
72
+ version: 12.5.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: 10.34.5
108
+ version: 12.5.1
109
109
 
110
110
  - uses: actions/setup-node@v7
111
111
  with:
package/.gitignore ADDED
@@ -0,0 +1,40 @@
1
+ # Nuxt dev/build outputs
2
+ .output
3
+ .data
4
+ .nuxt
5
+ .nitro
6
+ .cache
7
+ dist
8
+
9
+ # Node dependencies
10
+ node_modules
11
+
12
+ # Logs
13
+ logs
14
+ *.log
15
+
16
+ # Misc
17
+ .DS_Store
18
+ .fleet
19
+ .idea
20
+
21
+ # Local env files
22
+ .env
23
+ .env.*
24
+ !.env.example
25
+ coverage
26
+ test-results
27
+ playwright-report
28
+
29
+ # Playwright
30
+ /playwright-report/
31
+ /blob-report/
32
+ /playwright/.cache/
33
+ /playwright/.auth/
34
+
35
+ # Performance tooling (scripts/perf)
36
+ scripts/perf/out
37
+ scripts/perf/exp
38
+ scripts/perf/*.pem
39
+ test/visual/__snapshots__
40
+ test/visual/results
package/CLAUDE.md CHANGED
@@ -28,6 +28,10 @@ pnpm generate-types # Regenerate api-types/storeApiTypes.d.ts from schema (the
28
28
  pnpm load-schema # Reload Shopware API schema
29
29
  ```
30
30
 
31
+ ### Package manager
32
+
33
+ pnpm 12 (pinned in `package.json`, CI and `node.dockerfile`). Settings live in `pnpm-workspace.yaml` (`.npmrc` is auth/registry only since pnpm 11). pnpm 12 rejects packages published less than 24 hours ago (`minimumReleaseAge`), also in an existing lockfile; update dependencies with pnpm 12 itself, not an older global pnpm (`docs/notes/2026-09-21-dependency-update.md`).
34
+
31
35
  ### Running a single test
32
36
 
33
37
  ```bash
@@ -47,7 +51,7 @@ Always run `nuxt typecheck` via the `pnpm typecheck` script, not via `npx vue-ts
47
51
 
48
52
  - `shopware.d.ts` falls back to the api-client's default types for operations/schemas our instance does not expose, and keeps `LineItem.payload` optional.
49
53
  - `api-gen.config.json` applies the upstream schema patches plus `api-types/storeApiSchema.shopbite.overrides.json` when generating types.
50
- - `patches/@shopware__nuxt-module@1.5.1.patch` (pnpm patch) gives the module's plugin an explicit type. When Renovate bumps `@shopware/nuxt-module`, the patch must be re-applied to the new version (`pnpm patch @shopware/nuxt-module@<version>`).
54
+ - `patches/@shopware__nuxt-module@1.5.2.patch` (pnpm patch) points the plugin's `ShopwareNuxtOptions` import at `./dist/index` (the package ships no `src/`). Since 1.5.2 the plugin carries its explicit type upstream, so this one line is all that is left. When Renovate bumps `@shopware/nuxt-module`, the patch must be re-applied to the new version (`pnpm patch @shopware/nuxt-module@<version>`), or dropped once upstream fixes the import.
51
55
 
52
56
  Do not name a project composable like one from the `@shopware/composables` layer (e.g. `useCategory`): the project version shadows the layer's inside the layer's own code as well.
53
57
 
@@ -87,6 +91,7 @@ Key custom composables:
87
91
  - **`useAddToCart`** – products with extras/toppings use UUID v5 (product ID + sorted extras) as container item reference; simple products bypass the container
88
92
  - **`useAddressAutocomplete`** – proxies Geoapify through `/api/address/autocomplete` to avoid exposing the API key client-side
89
93
  - **`useShopBiteConfig`** – fetches delivery config and checkout state from the custom Shopware plugin
94
+ - **`useSyncWishlist`** – deliberate override of the layer composable (copy of `@shopware/composables` 1.13.0) that does not log the expected 404/403 of a missing or disabled wishlist (#366); compare with the layer source when Renovate bumps `@shopware/composables`
90
95
 
91
96
  ### Product data model (what Shopware must contain)
92
97
 
@@ -104,6 +109,8 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
104
109
  `server/utils/shopware/adminApiClient.ts` — Admin API client for server-side Shopware operations requiring elevated credentials.
105
110
  `server/api/__sitemap__/urls.get.ts` — dynamic `@nuxtjs/sitemap` source (navigation categories from the Store API).
106
111
  `server/utils/storeApi.ts` — `storeApiPost()` and `MEDIA_INCLUDES` for the routes above. Always send Store API criteria as a POST body (also via `apiClient.invoke("… post …", { body })`): as `_criteria` query parameters Shopware ignores the `includes` projection and returns every field (#312).
112
+ Pages without content throw `createNotFoundError()` (`app/utils/notFound.ts`): fatal only in the browser, because a fatal error makes Nitro log a `[request error] [fatal]` block per scanner request (#363).
113
+ `modules/public-cache.ts` (local module, also active in shops extending the layer) adds a 30-day `Cache-Control` route rule for every file in the `public/` folders of all layers; Nitro serves them without one. `image.ipx.maxAge` gives resized logos the same lifetime. Replace a public file under a new name (#273).
107
114
  `server/api/content/*.get.ts` — Nuxt Content queries for the pages. Do not call `queryCollection()` in page code: in the browser it downloads the SQLite WASM build (865 KB) on client-side navigation (#314).
108
115
 
109
116
  ### Client-side JavaScript budget (#314)
@@ -126,7 +133,7 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
126
133
  - `app.vue` sets the title template (`site.titleTemplate`), canonical from the route, `og:url`, fallback `og:image` (`site.ogImage`) and `twitter:card`. Page titles are plain (`"Warenkorb"`), never suffixed with the shop name. Indexable pages use `usePageSeo` (`standalone: true` skips the template, home page); categories use `useCategorySeo`, which overrides the canonical with the SEO URL.
127
134
  - Shopware category SEO URLs end in `/` and 404 without it, but the sitemap module strips trailing slashes from every URL. Sitemap entries that need the slash carry `_trailingSlash: true`; `server/plugins/sitemap-trailing-slash.ts` restores it in the XML. Never normalise trailing slashes of backend SEO URLs.
128
135
  - `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
129
- - 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).
136
+ - 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).
130
137
 
131
138
  ### Testing setup
132
139
 
package/app/app.vue CHANGED
@@ -43,9 +43,12 @@ const { refresh: refreshHolidays } = useHolidays();
43
43
  const { refreshCart } = useCart();
44
44
  const { getWishlistProducts } = useWishlist();
45
45
 
46
+ // The wishlist page (app/pages/merkliste.vue) loads the products itself.
47
+ const WISHLIST_ROUTE_NAME = "merkliste";
48
+
46
49
  if (import.meta.client) {
47
50
  // getting the wishlist products should not block SSR
48
- if (!(router.currentRoute.value.name as string).includes("wishlist")) {
51
+ if (router.currentRoute.value.name !== WISHLIST_ROUTE_NAME) {
49
52
  getWishlistProducts(); // initial page loading
50
53
  }
51
54
  }
@@ -165,18 +165,26 @@ const secondaryLinks = computed(() => props.links.slice(1));
165
165
  </p>
166
166
  </div>
167
167
 
168
- <!-- Fixed height: the status arrives after hydration (#327). -->
168
+ <!-- Fixed height: the status arrives after mounting (#327, #365).
169
+ Phones get one row each for status and delivery, so a long
170
+ status cannot wrap the line; from sm both share one row and the
171
+ delivery time waits for the status. -->
169
172
  <div
170
- class="flex min-h-6 flex-wrap items-center gap-x-4 gap-y-1 text-sm text-white/90"
173
+ class="grid items-center text-sm text-white/90 sm:flex sm:min-h-6 sm:gap-x-4"
174
+ :class="
175
+ isCheckoutEnabled
176
+ ? 'grid-rows-[1.5rem_1.5rem]'
177
+ : 'grid-rows-[1.5rem]'
178
+ "
171
179
  aria-live="polite"
172
180
  >
173
181
  <span
174
182
  v-if="statusLabel"
175
- class="inline-flex items-center gap-2"
183
+ class="row-start-1 flex min-w-0 items-center gap-2"
176
184
  data-testid="hero-status"
177
185
  >
178
186
  <span
179
- class="size-2 rounded-full"
187
+ class="size-2 shrink-0 rounded-full"
180
188
  :class="
181
189
  status?.open
182
190
  ? 'bg-green-400 shadow-[0_0_0_3px_rgba(74,222,128,0.3)]'
@@ -184,11 +192,13 @@ const secondaryLinks = computed(() => props.links.slice(1));
184
192
  "
185
193
  aria-hidden="true"
186
194
  />
187
- {{ statusLabel }}
195
+ <span class="truncate">{{ statusLabel }}</span>
188
196
  </span>
189
197
  <span
190
- v-if="statusLabel && isCheckoutEnabled"
191
- class="inline-flex items-center gap-1.5"
198
+ v-if="isCheckoutEnabled"
199
+ class="row-start-2 inline-flex items-center gap-1.5"
200
+ :class="{ 'sm:hidden': !statusLabel }"
201
+ data-testid="hero-delivery"
192
202
  >
193
203
  <UIcon name="i-lucide-bike" class="size-4" />
194
204
  Lieferung ca. {{ deliveryTime }} Min
@@ -3,19 +3,27 @@ import { createRegistrationSchema } from "~/validation/registrationSchema";
3
3
  import type { RegistrationSchema } from "~/validation/registrationSchema";
4
4
  import { ApiClientError } from "@shopware/api-client";
5
5
  import type { FormSubmitEvent } from "@nuxt/ui";
6
+ import type { Schemas } from "#shopware";
6
7
 
7
- const config = useRuntimeConfig();
8
- const { register, isLoggedIn } = useUser();
9
-
10
- if (import.meta.client && isLoggedIn.value) {
11
- navigateTo({ path: "/konto" });
12
- }
8
+ const props = withDefaults(
9
+ defineProps<{
10
+ /**
11
+ * Whether the visitor may skip the customer account (guest order). The
12
+ * registration page (`/registrierung`) always creates a real account, the
13
+ * checkout offers the choice.
14
+ */
15
+ allowGuest?: boolean;
16
+ }>(),
17
+ {
18
+ allowGuest: true,
19
+ },
20
+ );
13
21
 
14
- watch(isLoggedIn, (isLoggedIn) => {
15
- if (isLoggedIn) {
16
- navigateTo({ path: "/konto" });
17
- }
18
- });
22
+ const config = useRuntimeConfig();
23
+ // Where to go after a successful registration is the caller's decision: the
24
+ // registration page sends the visitor to the account, the checkout continues
25
+ // with the order.
26
+ const { register } = useUser();
19
27
 
20
28
  const state = reactive({
21
29
  accountType: "private" as "private" | "business",
@@ -23,7 +31,7 @@ const state = reactive({
23
31
  firstName: "",
24
32
  lastName: "",
25
33
  email: "",
26
- guest: true,
34
+ guest: props.allowGuest,
27
35
  password: "",
28
36
  passwordConfirm: "",
29
37
  acceptedDataProtection: false,
@@ -59,6 +67,23 @@ const state = reactive({
59
67
 
60
68
  const schema = computed(() => createRegistrationSchema(state));
61
69
 
70
+ // The API payload keeps the negated `guest` flag, the form asks the positive
71
+ // question: a guest order is the default, creating an account is the opt-in.
72
+ const createAccount = computed({
73
+ get: () => !state.guest,
74
+ set: (value: boolean) => {
75
+ state.guest = !value;
76
+ },
77
+ });
78
+
79
+ /**
80
+ * With double opt-in enabled in Shopware the customer stays inactive until the
81
+ * confirmation link is clicked, so there is no session to continue with.
82
+ */
83
+ function needsEmailConfirmation(customer: Schemas["Customer"] | undefined) {
84
+ return !!customer?.doubleOptInRegistration && !customer?.active;
85
+ }
86
+
62
87
  const toast = useToast();
63
88
 
64
89
  const billingAddressFields = ref();
@@ -93,16 +118,30 @@ async function onSubmit(event: FormSubmitEvent<RegistrationSchema>) {
93
118
  }
94
119
 
95
120
  try {
96
- // @ts-expect-error - password is required in the API type but not for guests
97
- await register(registrationData);
121
+ const customer: Schemas["Customer"] | undefined =
122
+ // @ts-expect-error - password is required in the API type but not for guests
123
+ await register(registrationData);
124
+
125
+ if (needsEmailConfirmation(customer)) {
126
+ toast.add({
127
+ title: "Fast geschafft!",
128
+ description:
129
+ "Wir haben dir eine E-Mail geschickt. Bitte bestätige den Link darin, um dein Konto zu aktivieren.",
130
+ color: "info",
131
+ });
132
+ } else {
133
+ toast.add({
134
+ title: registrationData.guest
135
+ ? "Erfolgreich Kundendaten erfasst"
136
+ : "Konto erfolgreich erstellt",
137
+ color: "success",
138
+ });
139
+ }
98
140
 
99
- toast.add({
100
- title: "Erfolgreich Kundendaten erfasst",
101
- color: "success",
102
- });
103
141
  emit(
104
142
  "registration-success",
105
143
  registrationData as unknown as RegistrationSchema,
144
+ customer,
106
145
  );
107
146
  } catch (error) {
108
147
  console.error("Registration failed:", error);
@@ -136,7 +175,10 @@ const accountTypes = ref([
136
175
  ]);
137
176
 
138
177
  const emit = defineEmits<{
139
- "registration-success": [data: RegistrationSchema];
178
+ "registration-success": [
179
+ data: RegistrationSchema,
180
+ customer: Schemas["Customer"] | undefined,
181
+ ];
140
182
  }>();
141
183
  </script>
142
184
 
@@ -157,14 +199,6 @@ const emit = defineEmits<{
157
199
  />
158
200
  </UFormField>
159
201
 
160
- <UFormField name="guest">
161
- <USwitch
162
- v-model="state.guest"
163
- label="Kein Kundenkonto erstellen"
164
- class="w-full"
165
- />
166
- </UFormField>
167
-
168
202
  <div class="flex flex-row justify-between gap-4">
169
203
  <UFormField label="Vorname" name="firstName" required class="w-full">
170
204
  <UInput v-model="state.firstName" type="text" class="w-full" />
@@ -179,14 +213,24 @@ const emit = defineEmits<{
179
213
  <UInput v-model="state.email" class="w-full" />
180
214
  </UFormField>
181
215
 
182
- <UFormField v-if="!state.guest" label="Password" name="password">
216
+ <UFormField v-if="allowGuest" name="guest">
217
+ <UCheckbox
218
+ v-model="createAccount"
219
+ label="Kundenkonto anlegen"
220
+ description="Für schnellere Bestellungen mit gespeicherten Adressen"
221
+ class="w-full"
222
+ />
223
+ </UFormField>
224
+
225
+ <UFormField v-if="!state.guest" label="Passwort" name="password" required>
183
226
  <UInput v-model="state.password" type="password" class="w-full" />
184
227
  </UFormField>
185
228
 
186
229
  <UFormField
187
230
  v-if="!state.guest"
188
- label="Password wiederholen"
231
+ label="Passwort wiederholen"
189
232
  name="passwordConfirm"
233
+ required
190
234
  >
191
235
  <UInput v-model="state.passwordConfirm" type="password" class="w-full" />
192
236
  </UFormField>
@@ -11,7 +11,10 @@ const formatTime = (date: Date) =>
11
11
  * Whether the store is open right now, with the closing time of the current
12
12
  * interval or the next opening. `null` until business hours and holidays are
13
13
  * loaded. Client only: the browser's clock and time zone decide, the server's
14
- * would not match the shop's (#275).
14
+ * would not match the shop's (#275). The clock starts when the component is
15
+ * mounted, so the status is also `null` on the server and during hydration:
16
+ * the home page prefetches the hours on the server (`useRestaurantSchema`),
17
+ * and a status rendered there mismatched the browser's (#365).
15
18
  */
16
19
  export function useStoreStatus() {
17
20
  const {
@@ -22,15 +25,17 @@ export function useStoreStatus() {
22
25
  } = useBusinessHours();
23
26
  const { holidays, isClosedHoliday } = useHolidays();
24
27
 
25
- const now = ref(new Date());
26
- useIntervalFn(() => {
28
+ const now = ref<Date | null>(null);
29
+ const tick = () => {
27
30
  now.value = new Date();
28
- }, 60_000);
31
+ };
32
+ onMounted(tick);
33
+ useIntervalFn(tick, 60_000);
29
34
 
30
35
  const status = computed<StoreStatus | null>(() => {
31
- if (!businessHours.value || !holidays.value) return null;
32
-
33
36
  const current = now.value;
37
+ if (!current || !businessHours.value || !holidays.value) return null;
38
+
34
39
  if (isStoreOpen(current, isClosedHoliday)) {
35
40
  const interval = getServiceIntervals(current).find(
36
41
  ({ start, end }) => current >= start && current <= end,
@@ -40,7 +45,7 @@ export function useStoreStatus() {
40
45
 
41
46
  return {
42
47
  open: false,
43
- nextOpening: getNextOpeningTime(now, isClosedHoliday),
48
+ nextOpening: getNextOpeningTime(now as Ref<Date>, isClosedHoliday),
44
49
  };
45
50
  });
46
51
 
@@ -0,0 +1,119 @@
1
+ import { ApiClientError } from "@shopware/api-client";
2
+ import type { ComputedRef, Ref } from "vue";
3
+ import type { Schemas } from "#shopware";
4
+
5
+ /**
6
+ * Overrides `useSyncWishlist` of the `@shopware/composables` layer (1.13.0),
7
+ * including its use inside the layer's `useWishlist`. The only change: a
8
+ * customer without a wishlist (404) or a shop with the wishlist disabled (403)
9
+ * is an expected state and not logged as an error (#366).
10
+ */
11
+ export type UseSyncWishlistReturn = {
12
+ getWishlistProducts(
13
+ defaultSearchCriteria?: Schemas["Criteria"],
14
+ ): Promise<void>;
15
+ mergeWishlistProducts(itemsToMerge: string[]): void;
16
+ addToWishlistSync(id: string): void;
17
+ removeFromWishlistSync(id: string): void;
18
+ items: ComputedRef<string[]>;
19
+ count: ComputedRef<number>;
20
+ currentPage: ComputedRef<number>;
21
+ limit: ComputedRef<number>;
22
+ products: ComputedRef<Schemas["Product"][]>;
23
+ isLoading: Ref<boolean>;
24
+ };
25
+
26
+ const EXPECTED_WISHLIST_ERRORS = [
27
+ "CHECKOUT__WISHLIST_NOT_FOUND",
28
+ "CHECKOUT__WISHLIST_IS_NOT_ACTIVATED",
29
+ ];
30
+
31
+ function isExpectedWishlistError(error: unknown): boolean {
32
+ const errors = error instanceof ApiClientError ? error.details?.errors : null;
33
+ return (
34
+ Array.isArray(errors) &&
35
+ errors.some((e) => EXPECTED_WISHLIST_ERRORS.includes(e.code))
36
+ );
37
+ }
38
+
39
+ const _wishlistItems: Ref<string[]> = ref([]);
40
+ const _wishlistProducts: Ref<Schemas["Product"][]> = ref([]);
41
+ const _currentPage: Ref<number> = ref(1);
42
+ const _limit: Ref<number> = ref(15);
43
+ const totalWishlistItemsCount: Ref<number> = ref(0);
44
+ const isLoading: Ref<boolean> = ref(false);
45
+
46
+ export function useSyncWishlist(): UseSyncWishlistReturn {
47
+ const { apiClient } = useShopwareContext();
48
+
49
+ async function addToWishlistSync(id: string) {
50
+ await apiClient.invoke(
51
+ "addProductOnWishlist post /customer/wishlist/add/{productId}",
52
+ {
53
+ pathParams: { productId: id },
54
+ },
55
+ );
56
+ }
57
+
58
+ async function removeFromWishlistSync(id: string) {
59
+ await apiClient.invoke(
60
+ "deleteProductOnWishlist delete /customer/wishlist/delete/{productId}",
61
+ {
62
+ pathParams: { productId: id },
63
+ },
64
+ );
65
+ }
66
+
67
+ async function getWishlistProducts(
68
+ defaultSearchCriteria?: Schemas["Criteria"],
69
+ ) {
70
+ try {
71
+ const response = await apiClient.invoke(
72
+ "readCustomerWishlist post /customer/wishlist",
73
+ { body: { ...defaultSearchCriteria, "total-count-mode": "exact" } },
74
+ );
75
+ _wishlistItems.value = [
76
+ ...response.data.products.elements.map((element) => element.id),
77
+ ];
78
+ _wishlistProducts.value = response.data.products.elements;
79
+ totalWishlistItemsCount.value = response.data.products.total ?? 0;
80
+ _currentPage.value = response.data.products.page ?? 1;
81
+ _limit.value = response.data.products.limit ?? 15;
82
+ } catch (error) {
83
+ if (!isExpectedWishlistError(error)) {
84
+ console.error("[useSyncWishlist][getWishlistProducts][error]:", error);
85
+ }
86
+ _wishlistItems.value = [];
87
+ _wishlistProducts.value = [];
88
+ totalWishlistItemsCount.value = 0;
89
+ }
90
+ }
91
+
92
+ async function mergeWishlistProducts(productIds: string[]) {
93
+ await apiClient.invoke(
94
+ "mergeProductOnWishlist post /customer/wishlist/merge",
95
+ {
96
+ body: { productIds },
97
+ },
98
+ );
99
+ }
100
+
101
+ const items = computed(() => _wishlistItems.value);
102
+ const count = computed(() => totalWishlistItemsCount.value);
103
+ const currentPage = computed(() => _currentPage.value);
104
+ const products = computed(() => _wishlistProducts.value);
105
+ const limit = computed(() => _limit.value);
106
+
107
+ return {
108
+ getWishlistProducts,
109
+ addToWishlistSync,
110
+ removeFromWishlistSync,
111
+ mergeWishlistProducts,
112
+ products,
113
+ items,
114
+ count,
115
+ currentPage,
116
+ isLoading,
117
+ limit,
118
+ };
119
+ }
@@ -7,14 +7,20 @@ const { data: page, error } = await useAsyncData(
7
7
  () => $fetch("/api/content/page", { query: { path: route.path } }),
8
8
  );
9
9
 
10
- if (error.value || !page.value) {
10
+ // A failing content server is a real error and stays fatal (logged); 4xx
11
+ // means there is no such page (the route rejects over-long paths with 400).
12
+ if ((error.value?.statusCode ?? 0) >= 500) {
11
13
  throw createError({
12
- statusCode: 404,
13
- statusMessage: `Page ${route.path} not found!`,
14
+ statusCode: 500,
15
+ statusMessage: "Page could not be loaded",
14
16
  fatal: true,
15
17
  });
16
18
  }
17
19
 
20
+ if (!page.value) {
21
+ throw createNotFoundError(`Page ${route.path} not found!`);
22
+ }
23
+
18
24
  usePageSeo({
19
25
  title: page.value?.title,
20
26
  description: page.value?.description,
@@ -5,11 +5,7 @@ const { data: page } = await useAsyncData("index", () =>
5
5
  $fetch("/api/content/home"),
6
6
  );
7
7
  if (!page.value) {
8
- throw createError({
9
- statusCode: 404,
10
- statusMessage: "Page not found",
11
- fatal: true,
12
- });
8
+ throw createNotFoundError();
13
9
  }
14
10
 
15
11
  const { site } = useRuntimeConfig().public;
@@ -3,11 +3,7 @@ import ContactForm from "~/components/Contact/Form.vue";
3
3
  const config = useRuntimeConfig();
4
4
 
5
5
  if (config.public.shopBite.feature.contactForm !== true) {
6
- throw createError({
7
- statusCode: 404,
8
- statusMessage: "Page not found",
9
- fatal: true,
10
- });
6
+ throw createNotFoundError();
11
7
  }
12
8
 
13
9
  useSeoMeta({