@shopbite-de/storefront 1.23.3 → 1.25.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 (204) hide show
  1. package/.env.example +22 -0
  2. package/.github/workflows/build.yaml +1 -1
  3. package/.github/workflows/ci.yaml +6 -3
  4. package/CLAUDE.md +48 -3
  5. package/README.md +139 -40
  6. package/api-gen.config.json +9 -0
  7. package/api-types/storeApiSchema.shopbite.overrides.json +35 -0
  8. package/api-types/storeApiTypes.d.ts +95 -81
  9. package/app/app.config.ts +3 -2
  10. package/app/app.vue +40 -53
  11. package/app/assets/css/main.css +36 -4
  12. package/app/components/AddToWishlist.vue +13 -6
  13. package/app/components/Address/Fields.vue +2 -21
  14. package/app/components/AnimatedSection.vue +9 -4
  15. package/app/components/BottomNavi.vue +9 -2
  16. package/app/components/Cart/Bar.vue +102 -0
  17. package/app/components/Cart/Item.vue +21 -10
  18. package/app/components/Cart/QuickView.vue +4 -0
  19. package/app/components/Cart/Upsell.vue +106 -0
  20. package/app/components/Category/Header.vue +9 -3
  21. package/app/components/Category/Listing.vue +62 -45
  22. package/app/components/Checkout/PaymentAndDelivery.vue +19 -3
  23. package/app/components/Checkout/Summary.vue +70 -2
  24. package/app/components/Cta.vue +4 -2
  25. package/app/components/DemoBanner.vue +13 -0
  26. package/app/components/Feature/Card.vue +121 -0
  27. package/app/components/Features.vue +14 -9
  28. package/app/components/Food/MarqueeItem.vue +20 -8
  29. package/app/components/Footer/Contact.vue +82 -0
  30. package/app/components/Footer/StoreStatus.vue +30 -0
  31. package/app/components/Footer.vue +2 -1
  32. package/app/components/Header/Body.vue +1 -1
  33. package/app/components/Header/Right.vue +60 -17
  34. package/app/components/Header/Title.vue +1 -0
  35. package/app/components/Header.vue +5 -15
  36. package/app/components/Hero.vue +169 -36
  37. package/app/components/ImageGallery.vue +11 -5
  38. package/app/components/Product/Card.vue +104 -46
  39. package/app/components/Product/CardCompact.vue +72 -0
  40. package/app/components/Product/CardDietBadges.vue +38 -31
  41. package/app/components/Product/CardIngredients.vue +35 -0
  42. package/app/components/Product/CardSkeleton.vue +10 -18
  43. package/app/components/Product/Category.vue +9 -2
  44. package/app/components/Product/Configurator.vue +11 -7
  45. package/app/components/Product/CrossSelling.vue +45 -34
  46. package/app/components/Product/DeselectIngredient.vue +37 -31
  47. package/app/components/Product/Detail.vue +73 -13
  48. package/app/components/Product/QuickView.vue +77 -0
  49. package/app/components/Topseller.vue +44 -34
  50. package/app/components/User/RegistrationForm.vue +0 -1
  51. package/app/components/Wishlist.vue +2 -15
  52. package/app/composables/useAddToCart.ts +13 -40
  53. package/app/composables/useAddressAutocomplete.ts +12 -19
  54. package/app/composables/useAddressSuggestionArea.ts +16 -0
  55. package/app/composables/useAddressValidation.ts +3 -19
  56. package/app/composables/useCartMutations.ts +168 -0
  57. package/app/composables/useCartQuickView.ts +19 -0
  58. package/app/composables/useCartUpsell.ts +100 -0
  59. package/app/composables/{useCategory.ts → useCategoryById.ts} +1 -1
  60. package/app/composables/useCategorySeo.ts +27 -29
  61. package/app/composables/useCheckoutMethodGuard.ts +201 -0
  62. package/app/composables/useMatomo.ts +25 -0
  63. package/app/composables/useMatomoConfig.ts +12 -0
  64. package/app/composables/useMenuSectionSchema.ts +55 -0
  65. package/app/composables/useNavigation.ts +12 -9
  66. package/app/composables/usePageSeo.ts +50 -0
  67. package/app/composables/useProductCartQuantity.ts +15 -0
  68. package/app/composables/useProductCrossSelling.ts +1 -0
  69. package/app/composables/useProductDetail.ts +15 -1
  70. package/app/composables/useProductEvents.ts +30 -0
  71. package/app/composables/useProductQuickView.ts +65 -0
  72. package/app/composables/useRestaurantSchema.ts +64 -0
  73. package/app/composables/useScrollAnimation.ts +39 -8
  74. package/app/composables/useSearchTracking.ts +33 -0
  75. package/app/composables/useSeoUrlRoute.ts +58 -0
  76. package/app/composables/useSortingSelection.ts +28 -0
  77. package/app/composables/useStoreStatus.ts +48 -0
  78. package/app/composables/useTopSellers.ts +22 -0
  79. package/app/composables/useTrackEvent.ts +36 -23
  80. package/app/pages/[...all].vue +4 -4
  81. package/app/pages/account/recover/password/index.vue +1 -0
  82. package/app/pages/anmelden.vue +4 -0
  83. package/app/pages/bestellung/[id]/erfolg.vue +1 -5
  84. package/app/pages/bestellung/[id]/fehler.vue +2 -2
  85. package/app/pages/bestellung/[id]/index.vue +9 -3
  86. package/app/pages/bestellung/bestaetigen.vue +1 -5
  87. package/app/pages/bestellung/warenkorb.vue +1 -5
  88. package/app/pages/bestellung/zahlung-versand.vue +1 -5
  89. package/app/pages/c/[...all].vue +2 -35
  90. package/app/pages/index.vue +28 -14
  91. package/app/pages/kontakt.vue +4 -0
  92. package/app/pages/konto/adressen.vue +4 -0
  93. package/app/pages/konto/bestellung/[id].vue +4 -0
  94. package/app/pages/konto/bestellungen.vue +4 -0
  95. package/app/pages/konto/index.vue +4 -0
  96. package/app/pages/konto/profil.vue +4 -0
  97. package/app/pages/maintenance.vue +6 -0
  98. package/app/pages/merkliste.vue +1 -7
  99. package/app/pages/passwort-vergessen.vue +1 -0
  100. package/app/pages/registrierung/bestaetigen.vue +4 -0
  101. package/app/pages/registrierung/index.vue +4 -0
  102. package/app/pages/speisekarte/[...all].vue +2 -36
  103. package/app/pages/suche.vue +42 -26
  104. package/app/plugins/matomo.ts +35 -0
  105. package/app/types/Association.d.ts +1 -0
  106. package/app/utils/hydrateWhenVisible.ts +20 -0
  107. package/app/utils/media.ts +33 -0
  108. package/app/utils/openingHours.ts +90 -0
  109. package/app/utils/product.ts +31 -0
  110. package/app/utils/schema.ts +235 -0
  111. package/app/utils/seo.ts +56 -0
  112. package/app/utils/seoPath.ts +57 -0
  113. package/content/index.yml +26 -20
  114. package/content.config.ts +16 -0
  115. package/docs/notes/2026-07-05-issue-259-matomo-broken.md +7 -0
  116. package/docs/notes/2026-09-08-issue-240-shipping-method-blocked.md +83 -0
  117. package/docs/notes/2026-09-08-issue-241-cart-lock-conflicts.md +63 -0
  118. package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +65 -0
  119. package/docs/notes/2026-09-08-issue-276-payment-method-blocked.md +39 -0
  120. package/docs/notes/2026-09-08-issue-277-typecheck.md +99 -0
  121. package/docs/notes/2026-09-10-issue-250-animated-section.md +23 -0
  122. package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +30 -0
  123. package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +27 -0
  124. package/docs/notes/2026-09-10-issue-273-performance-media.md +64 -0
  125. package/docs/notes/2026-09-10-issue-274-seo-basics.md +49 -0
  126. package/docs/notes/2026-09-10-issue-275-accessibility.md +46 -0
  127. package/docs/notes/2026-09-10-issue-290-footer-nap.md +28 -0
  128. package/docs/notes/2026-09-10-issue-291-seo-url-trailing-slash.md +24 -0
  129. package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +33 -0
  130. package/docs/notes/2026-09-10-issue-295-search-hydration-mismatch.md +25 -0
  131. package/docs/notes/2026-09-10-issue-296-track-direct-search.md +19 -0
  132. package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +64 -0
  133. package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +29 -0
  134. package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +119 -0
  135. package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
  136. package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
  137. package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
  138. package/docs/notes/2026-09-13-demo-banner.md +32 -0
  139. package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
  140. package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
  141. package/docs/notes/2026-09-14-cart-upsell.md +105 -0
  142. package/docs/notes/2026-09-14-demo-noindex.md +57 -0
  143. package/node.dockerfile +5 -2
  144. package/nuxt.config.ts +98 -15
  145. package/package.json +5 -3
  146. package/patches/@shopware__nuxt-module@1.5.1.patch +32 -0
  147. package/pnpm-workspace.yaml +2 -0
  148. package/public/hero-poster.webp +0 -0
  149. package/scripts/perf/first-render.mjs +30 -0
  150. package/scripts/perf/h2-proxy.cjs +49 -0
  151. package/scripts/perf/lighthouse.sh +22 -0
  152. package/scripts/perf/quick-view-layout.mjs +126 -0
  153. package/server/api/__sitemap__/urls.get.ts +49 -0
  154. package/server/api/category/[categoryId].get.ts +20 -9
  155. package/server/api/content/home.get.ts +14 -0
  156. package/server/api/content/page.get.ts +22 -0
  157. package/server/api/listing/[categoryId].get.ts +14 -18
  158. package/server/api/product/[productId]/cross-selling.get.ts +3 -9
  159. package/server/api/product/[productId].get.ts +4 -8
  160. package/server/api/search.get.ts +2 -0
  161. package/server/plugins/site-url.ts +13 -0
  162. package/server/plugins/sitemap-trailing-slash.ts +26 -0
  163. package/server/utils/sitemap.ts +60 -0
  164. package/server/utils/storeApi.ts +34 -0
  165. package/shopware.d.ts +35 -11
  166. package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
  167. package/test/nuxt/AddressFields.test.ts +2 -73
  168. package/test/nuxt/AnimatedSection.test.ts +67 -0
  169. package/test/nuxt/CartBar.test.ts +110 -0
  170. package/test/nuxt/CartItem.test.ts +95 -0
  171. package/test/nuxt/CartUpsell.test.ts +125 -0
  172. package/test/nuxt/DemoBanner.test.ts +12 -0
  173. package/test/nuxt/FooterContact.test.ts +102 -0
  174. package/test/nuxt/FooterStoreStatus.test.ts +48 -0
  175. package/test/nuxt/HeaderRight.test.ts +14 -10
  176. package/test/nuxt/Hero.test.ts +68 -0
  177. package/test/nuxt/PaymentAndDelivery.test.ts +67 -8
  178. package/test/nuxt/RegistrationForm.test.ts +3 -0
  179. package/test/nuxt/useAddToCart.test.ts +37 -17
  180. package/test/nuxt/useAddressAutocomplete.test.ts +2 -38
  181. package/test/nuxt/useAddressSuggestionArea.test.ts +27 -0
  182. package/test/nuxt/useBusinessHours.test.ts +1 -1
  183. package/test/nuxt/useCartMutations.test.ts +225 -0
  184. package/test/nuxt/useCartUpsell.test.ts +126 -0
  185. package/test/nuxt/useCheckoutMethodGuard.test.ts +386 -0
  186. package/test/nuxt/useScrollAnimation.test.ts +55 -49
  187. package/test/nuxt/useSearchTracking.test.ts +71 -0
  188. package/test/nuxt/useSeoUrlRoute.test.ts +93 -0
  189. package/test/nuxt/useStoreStatus.test.ts +77 -0
  190. package/test/nuxt/useTrackEvent.test.ts +127 -0
  191. package/test/unit/media.spec.ts +49 -0
  192. package/test/unit/openingHours.spec.ts +90 -0
  193. package/test/unit/product.spec.ts +72 -0
  194. package/test/unit/schema.spec.ts +243 -0
  195. package/test/unit/seo.spec.ts +107 -0
  196. package/test/unit/seoPath.spec.ts +116 -0
  197. package/test/unit/sitemap.spec.ts +88 -0
  198. package/test/unit/useCategorySeo.spec.ts +42 -31
  199. package/test/unit/useSortingSelection.spec.ts +39 -0
  200. package/test/visual/playwright.config.ts +33 -0
  201. package/test/visual/visual.spec.ts +87 -0
  202. package/app/components/Product/CardDescription.vue +0 -27
  203. package/app/components/Product/CardFooter.vue +0 -51
  204. package/app/composables/useValidCitiesForDelivery.ts +0 -12
@@ -10,18 +10,24 @@ const { category: categoryRef } = toRefs(props);
10
10
  const categoryCover = computed(
11
11
  () => categoryRef.value.media?.url ?? "/category-placeholder.webp",
12
12
  );
13
+
14
+ // Shopware thumbnails (400/800/1920 px) instead of the original, which is
15
+ // several thousand pixels wide (#273). The box is 700 px at most.
16
+ const srcset = computed(() => mediaSrcSet(categoryRef.value.media));
13
17
  </script>
14
18
 
15
19
  <template>
16
20
  <div
17
21
  class="relative mb-4 mt-8 min-h-36 w-full overflow-hidden rounded-[0.5rem]"
18
22
  >
19
- <NuxtImg
23
+ <img
20
24
  :src="categoryCover"
25
+ :srcset="srcset"
26
+ sizes="(min-width: 768px) 700px, 100vw"
27
+ fetchpriority="high"
28
+ decoding="async"
21
29
  class="absolute inset-0 h-full w-full object-cover"
22
- sizes="sm:100vw md:700px"
23
30
  :alt="category.name + ' Cover Image'"
24
- placeholder
25
31
  />
26
32
  <div class="absolute inset-0 bg-linear-to-t from-black/50 to-black/10" />
27
33
 
@@ -1,6 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import type { Schemas } from "#shopware";
3
3
  import Breadcrumb from "~/components/Category/Breadcrumb.vue";
4
+ import ProductCard from "~/components/Product/Card.vue";
5
+
6
+ // A menu category lists up to 100 products; hydrating every card up front
7
+ // costs ~1 s of main-thread time on phones (#314).
8
+ const ProductCardWhenVisible = hydrateWhenVisible(ProductCard);
4
9
 
5
10
  const props = defineProps<{
6
11
  id: string;
@@ -8,7 +13,7 @@ const props = defineProps<{
8
13
 
9
14
  const { id: categoryId } = toRefs(props);
10
15
 
11
- const { category } = await useCategory(categoryId);
16
+ const { category } = await useCategoryById(categoryId);
12
17
 
13
18
  const selectedPropertyFilters = useState<string[]>(
14
19
  "listing-property-filters",
@@ -34,22 +39,13 @@ async function resetFilters() {
34
39
  }
35
40
 
36
41
  useCategorySeo(category);
42
+ useMenuSectionSchema(category, elements);
37
43
 
38
- // Derived from the listing data instead of snapshotted at setup time: on the
39
- // server the listing resolves after setup, so a snapshot would render
40
- // "Sortieren" while client hydration (payload already present) would render
41
- // the actual sorting label — a hydration mismatch (#239).
42
- // The placeholder is never stored as an override, so the select keeps
43
- // following the listing data until the user explicitly picks a sorting.
44
- const SORTING_PLACEHOLDER = "Sortieren";
45
- const sortingOverride = ref<string | null>(null);
46
- const currentSorting = computed<string>({
47
- get: () =>
48
- sortingOverride.value ?? currentSortingOrder.value ?? SORTING_PLACEHOLDER,
49
- set: (val) => {
50
- sortingOverride.value = val === SORTING_PLACEHOLDER ? null : val;
51
- },
52
- });
44
+ const quickView = useProductQuickView(elements);
45
+
46
+ // Derived from the listing data instead of snapshotted at setup time, which
47
+ // would be a hydration mismatch (#239); see useSortingSelection.
48
+ const { currentSorting } = useSortingSelection(currentSortingOrder);
53
49
 
54
50
  const propertyFilters = computed<Schemas["PropertyGroup"][]>(
55
51
  () =>
@@ -116,6 +112,19 @@ watch(currentSorting, async (val) => {
116
112
  const moreThanOneFilterAndOption = computed<boolean>(
117
113
  () => propertyFilters.value.length > 0,
118
114
  );
115
+
116
+ // The mobile filter drawer (vaul) is created on first use; mounting it with
117
+ // the page forced a layout of the whole listing (#314).
118
+ const filterDrawerMounted = ref(false);
119
+ const filterDrawerOpen = ref(false);
120
+
121
+ async function openFilterDrawer() {
122
+ if (!filterDrawerMounted.value) {
123
+ filterDrawerMounted.value = true;
124
+ await nextTick();
125
+ }
126
+ filterDrawerOpen.value = true;
127
+ }
119
128
  </script>
120
129
 
121
130
  <template>
@@ -141,26 +150,31 @@ const moreThanOneFilterAndOption = computed<boolean>(
141
150
  :items="sortingOrders"
142
151
  placeholder="Sortierung"
143
152
  />
144
- <ClientOnly v-if="moreThanOneFilterAndOption">
145
- <UDrawer class="lg:hidden" title="Filter" direction="right">
146
- <UButton
147
- icon="i-lucide-sliders-horizontal"
148
- :color="
149
- selectedPropertyFilters.length ? 'primary' : 'neutral'
150
- "
151
- :variant="selectedPropertyFilters.length ? 'solid' : 'subtle'"
152
- >
153
- Filter
154
- <UBadge
155
- v-if="selectedPropertyFilters.length"
156
- :label="String(selectedPropertyFilters.length)"
157
- size="sm"
158
- color="neutral"
159
- variant="solid"
160
- class="ml-1"
161
- />
162
- </UButton>
163
-
153
+ <template v-if="moreThanOneFilterAndOption">
154
+ <UButton
155
+ class="lg:hidden"
156
+ icon="i-lucide-sliders-horizontal"
157
+ :color="selectedPropertyFilters.length ? 'primary' : 'neutral'"
158
+ :variant="selectedPropertyFilters.length ? 'solid' : 'subtle'"
159
+ aria-haspopup="dialog"
160
+ @click="openFilterDrawer"
161
+ >
162
+ Filter
163
+ <UBadge
164
+ v-if="selectedPropertyFilters.length"
165
+ :label="String(selectedPropertyFilters.length)"
166
+ size="sm"
167
+ color="neutral"
168
+ variant="solid"
169
+ class="ml-1"
170
+ />
171
+ </UButton>
172
+ <LazyUDrawer
173
+ v-if="filterDrawerMounted"
174
+ v-model:open="filterDrawerOpen"
175
+ title="Filter"
176
+ direction="right"
177
+ >
164
178
  <template #body>
165
179
  <div class="flex flex-col gap-4">
166
180
  <CategoryFilterGroup
@@ -177,16 +191,13 @@ const moreThanOneFilterAndOption = computed<boolean>(
177
191
  />
178
192
  </div>
179
193
  </template>
180
- </UDrawer>
181
- <template #fallback>
182
- <USkeleton class="h-8 w-20 lg:hidden" />
183
- </template>
184
- </ClientOnly>
194
+ </LazyUDrawer>
195
+ </template>
185
196
  </div>
186
197
 
187
198
  <div
188
199
  v-if="showSkeleton"
189
- class="flex flex-col gap-4"
200
+ class="grid grid-cols-1 gap-4"
190
201
  aria-busy="true"
191
202
  aria-label="Produkte werden geladen"
192
203
  >
@@ -195,17 +206,23 @@ const moreThanOneFilterAndOption = computed<boolean>(
195
206
 
196
207
  <div
197
208
  v-else
198
- class="flex flex-col gap-4 transition-opacity duration-200"
209
+ class="grid grid-cols-1 gap-4 transition-opacity duration-200"
199
210
  :class="{ 'opacity-40 pointer-events-none': loading }"
200
211
  >
201
- <ProductCard
212
+ <ProductCardWhenVisible
202
213
  v-for="product in elements"
203
214
  :key="product.id"
204
215
  :product="product"
205
216
  :with-favorite-button="true"
206
- :with-add-to-cart-button="true"
217
+ :selectable="true"
218
+ @select="quickView.show"
207
219
  />
208
220
  </div>
221
+ <LazyProductQuickView
222
+ v-if="quickView.mounted.value"
223
+ v-model:open="quickView.open.value"
224
+ :product="quickView.product.value"
225
+ />
209
226
  </div>
210
227
  </UPageBody>
211
228
 
@@ -17,12 +17,17 @@ const {
17
17
  } = useCheckout();
18
18
 
19
19
  const { refreshCart } = useCart();
20
+ const { ensureAvailableCheckoutMethods } = useCheckoutMethodGuard();
20
21
 
21
22
  const toast = useToast();
22
23
 
23
- onMounted(() => {
24
- getPaymentMethods();
25
- getShippingMethods();
24
+ onMounted(async () => {
25
+ try {
26
+ await Promise.all([getPaymentMethods(), getShippingMethods()]);
27
+ await ensureAvailableCheckoutMethods();
28
+ } catch (error) {
29
+ console.error("[checkout][PaymentAndDelivery][onMounted]", error);
30
+ }
26
31
  });
27
32
 
28
33
  const selectablePaymentMethods = computed<RadioGroupItem[]>(() => {
@@ -48,11 +53,21 @@ const selectedShippingMethodId = ref<RadioGroupValue | undefined>(
48
53
  selectedShippingMethod.value?.id,
49
54
  );
50
55
 
56
+ // Keep the radios in sync when the session's methods change elsewhere
57
+ // (e.g. the guard switched away from a blocked method).
58
+ watch(selectedPaymentMethod, (method) => {
59
+ selectedPaymentMethodId.value = method?.id;
60
+ });
61
+ watch(selectedShippingMethod, (method) => {
62
+ selectedShippingMethodId.value = method?.id;
63
+ });
64
+
51
65
  watch(
52
66
  selectedPaymentMethodId,
53
67
  async (newValue: RadioGroupValue | undefined) => {
54
68
  if (newValue === undefined) return;
55
69
  if (selectedPaymentMethod.value === null) return;
70
+ if (newValue === selectedPaymentMethod.value.id) return;
56
71
  await setPaymentMethod({ id: newValue as string });
57
72
  toast.add({
58
73
  title: "Zahlart geändert",
@@ -69,6 +84,7 @@ watch(
69
84
  async (newValue: RadioGroupValue | undefined) => {
70
85
  if (newValue === undefined) return;
71
86
  if (selectedShippingMethod.value === null) return;
87
+ if (newValue === selectedShippingMethod.value.id) return;
72
88
  await setShippingMethod({ id: newValue as string });
73
89
  await refreshCart();
74
90
  toast.add({
@@ -9,6 +9,11 @@ const { refreshCart } = useCart();
9
9
  const { isLoggedIn, isGuestSession, refreshUser } = useUser();
10
10
  const { isCheckoutEnabled, refresh } = useShopBiteConfig();
11
11
  const { trackOrder } = useTrackEvent();
12
+ const {
13
+ isShippingMethodBlocked,
14
+ isPaymentMethodBlocked,
15
+ ensureAvailableCheckoutMethods,
16
+ } = useCheckoutMethodGuard();
12
17
 
13
18
  const {
14
19
  public: { storeUrl },
@@ -26,6 +31,9 @@ onMounted(() => {
26
31
  activeBillingAddress: {},
27
32
  },
28
33
  });
34
+ ensureAvailableCheckoutMethods().catch((error) => {
35
+ console.error("[checkout][ensureAvailableCheckoutMethods]", error);
36
+ });
29
37
  });
30
38
 
31
39
  useIntervalFn(refresh, 10000);
@@ -35,9 +43,41 @@ const { handlePayment, paymentUrl } = useOrderPayment(
35
43
  computed(() => createdOrder.value),
36
44
  );
37
45
 
46
+ /**
47
+ * The shipping or payment method may have become unavailable since the
48
+ * cart was last loaded (availability rules, order value, address).
49
+ * Re-check and switch before creating the order instead of failing with
50
+ * an invalid cart. Reports problems to the customer itself.
51
+ * See issues #240 and #276.
52
+ */
53
+ async function hasAvailableCheckoutMethods(): Promise<boolean> {
54
+ try {
55
+ if (await ensureAvailableCheckoutMethods()) return true;
56
+ toast.add({
57
+ title: `Keine ${blockedMethodLabel.value} verfügbar`,
58
+ description: `Für deine Bestellung ist aktuell keine ${blockedMethodLabel.value} verfügbar. Bitte prüfe deine Adresse und deinen Warenkorb.`,
59
+ color: "error",
60
+ icon: blockedMethodIcon.value,
61
+ progress: false,
62
+ });
63
+ } catch (error) {
64
+ console.error("[checkout][ensureAvailableCheckoutMethods]", error);
65
+ toast.add({
66
+ title: "Versand- und Zahlart konnten nicht geprüft werden",
67
+ description: "Bitte versuche es in einem Moment erneut.",
68
+ color: "error",
69
+ icon: "i-lucide-x-circle",
70
+ progress: false,
71
+ });
72
+ }
73
+ return false;
74
+ }
75
+
38
76
  async function handleCreateOrder() {
39
77
  isPlacingOrder.value = true;
40
78
  try {
79
+ if (!(await hasAvailableCheckoutMethods())) return;
80
+
41
81
  const order = await createOrder({
42
82
  customerComment: "Wunschlieferzeit: " + selectedDeliveryTime.value,
43
83
  });
@@ -63,6 +103,17 @@ async function handleCreateOrder() {
63
103
  progress: false,
64
104
  });
65
105
  navigateTo(`/bestellung/${order.id}/erfolg`);
106
+ } catch (error) {
107
+ console.error("[checkout][createOrder]", error);
108
+ toast.add({
109
+ title: "Bestellung fehlgeschlagen",
110
+ description:
111
+ "Deine Bestellung konnte nicht aufgegeben werden. Bitte prüfe deine Angaben und versuche es erneut.",
112
+ color: "error",
113
+ icon: "i-lucide-x-circle",
114
+ progress: false,
115
+ });
116
+ await refreshCart().catch(() => {});
66
117
  } finally {
67
118
  isPlacingOrder.value = false;
68
119
  }
@@ -81,7 +132,16 @@ const isValidToProceed = computed(
81
132
  customerDataAvailable.value &&
82
133
  isCheckoutEnabled.value &&
83
134
  isValidTime.value &&
84
- shippingAndPaymentSet.value,
135
+ shippingAndPaymentSet.value &&
136
+ !isShippingMethodBlocked.value &&
137
+ !isPaymentMethodBlocked.value,
138
+ );
139
+
140
+ const blockedMethodLabel = computed(() =>
141
+ isShippingMethodBlocked.value ? "Versandart" : "Zahlart",
142
+ );
143
+ const blockedMethodIcon = computed(() =>
144
+ isShippingMethodBlocked.value ? "i-lucide-truck" : "i-lucide-badge-euro",
85
145
  );
86
146
 
87
147
  const isPlacingOrder = ref(false);
@@ -101,6 +161,10 @@ const checkoutButtonLabel = computed<string>(() => {
101
161
  return "Es werden aktuell keine weiteren Bestellungen mehr aufgenommen";
102
162
  }
103
163
 
164
+ if (isShippingMethodBlocked.value || isPaymentMethodBlocked.value) {
165
+ return `Aktuell ist keine ${blockedMethodLabel.value} verfügbar`;
166
+ }
167
+
104
168
  return "Jetzt bestellen!";
105
169
  });
106
170
  </script>
@@ -128,7 +192,11 @@ const checkoutButtonLabel = computed<string>(() => {
128
192
  <div class="flex flex-col gap-4">
129
193
  <h3 class="text-lg font-semibold">Warenkorb</h3>
130
194
  <UCard>
131
- <QuickView :with-quantity-input="false" :with-delete-button="false" />
195
+ <QuickView
196
+ :with-quantity-input="false"
197
+ :with-delete-button="false"
198
+ :with-upsell="true"
199
+ />
132
200
  </UCard>
133
201
  <CheckoutVoucherInput />
134
202
  <UButton
@@ -11,11 +11,13 @@ defineProps<{
11
11
 
12
12
  <template>
13
13
  <div class="relative overflow-hidden">
14
- <NuxtImg
14
+ <img
15
15
  v-if="backgroundImage"
16
16
  :src="backgroundImage"
17
+ loading="lazy"
18
+ decoding="async"
17
19
  class="absolute inset-0 z-0 w-full h-full object-cover opacity-40"
18
- alt="CTA Background"
20
+ alt=""
19
21
  />
20
22
  <UPageCTA
21
23
  variant="soft"
@@ -0,0 +1,13 @@
1
+ <script setup lang="ts">
2
+ // Notice for demo shops (demos/): rendered above the header when
3
+ // `shopBite.feature.demoBanner` is set. Not dismissible on purpose, so a
4
+ // prospect never mistakes the demo for a live shop.
5
+ </script>
6
+
7
+ <template>
8
+ <UBanner
9
+ color="warning"
10
+ icon="i-lucide-flask-conical"
11
+ title="Demo-Shop: Bestellungen werden nicht bearbeitet und nicht ausgeliefert."
12
+ />
13
+ </template>
@@ -0,0 +1,121 @@
1
+ <script setup lang="ts">
2
+ // Information card on the home page (#332): tinted icon, category label, a
3
+ // bold lead line, detail text and an optional action. `kind` fills the lead
4
+ // with live data; both live parts render on the client only, like the
5
+ // footer's store status (#275), with their height reserved.
6
+ export type FeatureCardProps = {
7
+ title: string;
8
+ description: string;
9
+ icon?: string;
10
+ kind?: "hours" | "delivery" | "reservation";
11
+ lead?: string;
12
+ link?: { label: string; to: string };
13
+ };
14
+
15
+ const props = defineProps<FeatureCardProps>();
16
+
17
+ const { businessHours } = useBusinessHours();
18
+ const { status } = useStoreStatus();
19
+ const { deliveryTime } = useShopBiteConfig();
20
+
21
+ const isLive = computed(
22
+ () => props.kind === "hours" || props.kind === "delivery",
23
+ );
24
+
25
+ const lead = computed(() => {
26
+ if (props.kind === "hours") {
27
+ return businessHours.value
28
+ ? formatTodayHours(businessHours.value, new Date())
29
+ : "";
30
+ }
31
+ if (props.kind === "delivery") {
32
+ return `In ca. ${deliveryTime.value} Minuten bei dir`;
33
+ }
34
+ return props.lead ?? "";
35
+ });
36
+
37
+ const statusLabel = computed(() => {
38
+ if (props.kind !== "hours" || !status.value) return "";
39
+ if (status.value.open) return `Geöffnet bis ${status.value.closesAt}`;
40
+ return status.value.nextOpening
41
+ ? `Öffnet ${status.value.nextOpening}`
42
+ : "Geschlossen";
43
+ });
44
+
45
+ const isCallLink = computed(() => props.link?.to.startsWith("tel:") ?? false);
46
+ </script>
47
+
48
+ <template>
49
+ <div
50
+ class="flex h-full flex-col gap-3 rounded-2xl bg-default p-5 shadow-md ring ring-default"
51
+ >
52
+ <div class="flex items-center justify-between gap-3">
53
+ <span
54
+ class="flex size-11 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary"
55
+ aria-hidden="true"
56
+ >
57
+ <UIcon v-if="icon" :name="icon" class="size-6" />
58
+ </span>
59
+ <ClientOnly v-if="kind === 'hours'">
60
+ <span
61
+ v-if="statusLabel"
62
+ class="inline-flex items-center gap-1.5 text-sm font-semibold"
63
+ :class="status?.open ? 'text-success' : 'text-muted'"
64
+ role="status"
65
+ >
66
+ <span
67
+ class="size-2 rounded-full"
68
+ :class="status?.open ? 'bg-success' : 'bg-dimmed'"
69
+ aria-hidden="true"
70
+ />
71
+ {{ statusLabel }}
72
+ </span>
73
+ <template #fallback>
74
+ <span class="h-5" aria-hidden="true" />
75
+ </template>
76
+ </ClientOnly>
77
+ </div>
78
+
79
+ <div class="flex flex-col gap-1">
80
+ <span class="text-xs font-semibold tracking-wider text-muted uppercase">
81
+ {{ title }}
82
+ </span>
83
+ <ClientOnly v-if="isLive">
84
+ <span class="text-lg leading-6 font-bold text-highlighted">
85
+ {{ lead }}
86
+ </span>
87
+ <template #fallback>
88
+ <span class="block h-6" aria-hidden="true" />
89
+ </template>
90
+ </ClientOnly>
91
+ <span
92
+ v-else-if="lead"
93
+ class="text-lg leading-6 font-bold text-highlighted"
94
+ >
95
+ {{ lead }}
96
+ </span>
97
+ <p class="text-sm text-default">{{ description }}</p>
98
+ </div>
99
+
100
+ <div v-if="link" class="mt-auto pt-1">
101
+ <UButton
102
+ v-if="isCallLink"
103
+ :label="link.label"
104
+ :to="link.to"
105
+ icon="i-lucide-phone"
106
+ variant="subtle"
107
+ size="lg"
108
+ class="justify-center"
109
+ block
110
+ />
111
+ <UButton
112
+ v-else
113
+ :label="link.label"
114
+ :to="link.to"
115
+ variant="link"
116
+ trailing-icon="i-lucide-arrow-right"
117
+ class="px-0"
118
+ />
119
+ </div>
120
+ </div>
121
+ </template>
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
- import type { PageFeatureProps } from "#ui/components/PageFeature.vue";
2
+ import type { FeatureCardProps } from "~/components/Feature/Card.vue";
3
3
 
4
4
  defineProps<{
5
5
  title: string;
6
6
  description: string;
7
7
  headline?: string | undefined;
8
- features: PageFeatureProps[];
8
+ features: FeatureCardProps[];
9
9
  }>();
10
10
  </script>
11
11
 
@@ -18,20 +18,25 @@ defineProps<{
18
18
  <UPageSection
19
19
  id="features"
20
20
  :description="description"
21
- :title="title"
22
- :features="features"
23
21
  :headline="headline"
24
22
  class="relative overflow-hidden"
25
23
  >
24
+ <template #title>
25
+ <MDC :value="title" class="*:leading-9" />
26
+ </template>
26
27
  <div
27
- class="absolute rounded-full -left-10 top-10 size-[300px] z-10 bg-primary opacity-30 blur-[200px]"
28
+ class="absolute rounded-full -left-10 top-10 size-[300px] -z-10 bg-primary opacity-30 blur-[200px]"
28
29
  />
29
30
  <div
30
- class="absolute rounded-full -right-10 -bottom-10 size-[300px] z-10 bg-primary opacity-30 blur-[200px]"
31
+ class="absolute rounded-full -right-10 -bottom-10 size-[300px] -z-10 bg-primary opacity-30 blur-[200px]"
31
32
  />
32
- <template #title>
33
- <MDC :value="title" class="*:leading-9" />
34
- </template>
33
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
34
+ <FeatureCard
35
+ v-for="(feature, index) in features"
36
+ :key="index"
37
+ v-bind="feature"
38
+ />
39
+ </div>
35
40
  </UPageSection>
36
41
  </AnimatedSection>
37
42
  </template>
@@ -19,9 +19,13 @@ const product: Schemas["Product"] = productResponse.product;
19
19
 
20
20
  const CART_SUCCESS_TITLE = "Gute Wahl!";
21
21
 
22
- const { refreshCart, addProduct } = useCart();
22
+ const { addLineItems } = useCartMutations();
23
23
  const toast = useToast();
24
24
 
25
+ // Synchronous guard: a double-click fires before a reactive :disabled
26
+ // binding reaches the DOM.
27
+ const isAdding = ref(false);
28
+
25
29
  const alt = computed(() => product.name + " #" + product.productNumber);
26
30
 
27
31
  async function showSuccessToast() {
@@ -35,20 +39,27 @@ async function showSuccessToast() {
35
39
  }
36
40
 
37
41
  async function addToCart(productId: string) {
38
- const newCart = await addProduct({
39
- id: productId,
40
- quantity: 1,
41
- });
42
- await refreshCart(newCart);
43
- await showSuccessToast();
42
+ if (isAdding.value) return;
43
+ isAdding.value = true;
44
+ try {
45
+ const newCart = await addLineItems([
46
+ { id: productId, quantity: 1, type: "product" },
47
+ ]);
48
+ if (!newCart) return;
49
+ await showSuccessToast();
50
+ } finally {
51
+ isAdding.value = false;
52
+ }
44
53
  }
45
54
  </script>
46
55
 
47
56
  <template>
48
57
  <div v-if="product" :id="product.id" class="relative inline-block">
49
- <NuxtImg
58
+ <img
50
59
  :src="image"
51
60
  :alt="alt"
61
+ loading="lazy"
62
+ decoding="async"
52
63
  class="rounded-lg shadow-2xl ring ring-default h-50 md:h-80"
53
64
  />
54
65
  <div
@@ -58,6 +69,7 @@ async function addToCart(productId: string) {
58
69
  <UButton
59
70
  icon="i-lucide-shopping-cart"
60
71
  size="lg"
72
+ :disabled="isAdding"
61
73
  @click="addToCart(product.id)"
62
74
  />
63
75
  </div>