@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.
- package/.env.example +22 -0
- package/.github/workflows/build.yaml +1 -1
- package/.github/workflows/ci.yaml +6 -3
- package/CLAUDE.md +48 -3
- package/README.md +139 -40
- package/api-gen.config.json +9 -0
- package/api-types/storeApiSchema.shopbite.overrides.json +35 -0
- package/api-types/storeApiTypes.d.ts +95 -81
- package/app/app.config.ts +3 -2
- package/app/app.vue +40 -53
- package/app/assets/css/main.css +36 -4
- package/app/components/AddToWishlist.vue +13 -6
- package/app/components/Address/Fields.vue +2 -21
- package/app/components/AnimatedSection.vue +9 -4
- package/app/components/BottomNavi.vue +9 -2
- package/app/components/Cart/Bar.vue +102 -0
- package/app/components/Cart/Item.vue +21 -10
- package/app/components/Cart/QuickView.vue +4 -0
- package/app/components/Cart/Upsell.vue +106 -0
- package/app/components/Category/Header.vue +9 -3
- package/app/components/Category/Listing.vue +62 -45
- package/app/components/Checkout/PaymentAndDelivery.vue +19 -3
- package/app/components/Checkout/Summary.vue +70 -2
- package/app/components/Cta.vue +4 -2
- package/app/components/DemoBanner.vue +13 -0
- package/app/components/Feature/Card.vue +121 -0
- package/app/components/Features.vue +14 -9
- package/app/components/Food/MarqueeItem.vue +20 -8
- package/app/components/Footer/Contact.vue +82 -0
- package/app/components/Footer/StoreStatus.vue +30 -0
- package/app/components/Footer.vue +2 -1
- package/app/components/Header/Body.vue +1 -1
- package/app/components/Header/Right.vue +60 -17
- package/app/components/Header/Title.vue +1 -0
- package/app/components/Header.vue +5 -15
- package/app/components/Hero.vue +169 -36
- package/app/components/ImageGallery.vue +11 -5
- package/app/components/Product/Card.vue +104 -46
- package/app/components/Product/CardCompact.vue +72 -0
- package/app/components/Product/CardDietBadges.vue +38 -31
- package/app/components/Product/CardIngredients.vue +35 -0
- package/app/components/Product/CardSkeleton.vue +10 -18
- package/app/components/Product/Category.vue +9 -2
- package/app/components/Product/Configurator.vue +11 -7
- package/app/components/Product/CrossSelling.vue +45 -34
- package/app/components/Product/DeselectIngredient.vue +37 -31
- package/app/components/Product/Detail.vue +73 -13
- package/app/components/Product/QuickView.vue +77 -0
- package/app/components/Topseller.vue +44 -34
- package/app/components/User/RegistrationForm.vue +0 -1
- package/app/components/Wishlist.vue +2 -15
- package/app/composables/useAddToCart.ts +13 -40
- package/app/composables/useAddressAutocomplete.ts +12 -19
- package/app/composables/useAddressSuggestionArea.ts +16 -0
- package/app/composables/useAddressValidation.ts +3 -19
- package/app/composables/useCartMutations.ts +168 -0
- package/app/composables/useCartQuickView.ts +19 -0
- package/app/composables/useCartUpsell.ts +100 -0
- package/app/composables/{useCategory.ts → useCategoryById.ts} +1 -1
- package/app/composables/useCategorySeo.ts +27 -29
- package/app/composables/useCheckoutMethodGuard.ts +201 -0
- package/app/composables/useMatomo.ts +25 -0
- package/app/composables/useMatomoConfig.ts +12 -0
- package/app/composables/useMenuSectionSchema.ts +55 -0
- package/app/composables/useNavigation.ts +12 -9
- package/app/composables/usePageSeo.ts +50 -0
- package/app/composables/useProductCartQuantity.ts +15 -0
- package/app/composables/useProductCrossSelling.ts +1 -0
- package/app/composables/useProductDetail.ts +15 -1
- package/app/composables/useProductEvents.ts +30 -0
- package/app/composables/useProductQuickView.ts +65 -0
- package/app/composables/useRestaurantSchema.ts +64 -0
- package/app/composables/useScrollAnimation.ts +39 -8
- package/app/composables/useSearchTracking.ts +33 -0
- package/app/composables/useSeoUrlRoute.ts +58 -0
- package/app/composables/useSortingSelection.ts +28 -0
- package/app/composables/useStoreStatus.ts +48 -0
- package/app/composables/useTopSellers.ts +22 -0
- package/app/composables/useTrackEvent.ts +36 -23
- package/app/pages/[...all].vue +4 -4
- package/app/pages/account/recover/password/index.vue +1 -0
- package/app/pages/anmelden.vue +4 -0
- package/app/pages/bestellung/[id]/erfolg.vue +1 -5
- package/app/pages/bestellung/[id]/fehler.vue +2 -2
- package/app/pages/bestellung/[id]/index.vue +9 -3
- package/app/pages/bestellung/bestaetigen.vue +1 -5
- package/app/pages/bestellung/warenkorb.vue +1 -5
- package/app/pages/bestellung/zahlung-versand.vue +1 -5
- package/app/pages/c/[...all].vue +2 -35
- package/app/pages/index.vue +28 -14
- package/app/pages/kontakt.vue +4 -0
- package/app/pages/konto/adressen.vue +4 -0
- package/app/pages/konto/bestellung/[id].vue +4 -0
- package/app/pages/konto/bestellungen.vue +4 -0
- package/app/pages/konto/index.vue +4 -0
- package/app/pages/konto/profil.vue +4 -0
- package/app/pages/maintenance.vue +6 -0
- package/app/pages/merkliste.vue +1 -7
- package/app/pages/passwort-vergessen.vue +1 -0
- package/app/pages/registrierung/bestaetigen.vue +4 -0
- package/app/pages/registrierung/index.vue +4 -0
- package/app/pages/speisekarte/[...all].vue +2 -36
- package/app/pages/suche.vue +42 -26
- package/app/plugins/matomo.ts +35 -0
- package/app/types/Association.d.ts +1 -0
- package/app/utils/hydrateWhenVisible.ts +20 -0
- package/app/utils/media.ts +33 -0
- package/app/utils/openingHours.ts +90 -0
- package/app/utils/product.ts +31 -0
- package/app/utils/schema.ts +235 -0
- package/app/utils/seo.ts +56 -0
- package/app/utils/seoPath.ts +57 -0
- package/content/index.yml +26 -20
- package/content.config.ts +16 -0
- package/docs/notes/2026-07-05-issue-259-matomo-broken.md +7 -0
- package/docs/notes/2026-09-08-issue-240-shipping-method-blocked.md +83 -0
- package/docs/notes/2026-09-08-issue-241-cart-lock-conflicts.md +63 -0
- package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +65 -0
- package/docs/notes/2026-09-08-issue-276-payment-method-blocked.md +39 -0
- package/docs/notes/2026-09-08-issue-277-typecheck.md +99 -0
- package/docs/notes/2026-09-10-issue-250-animated-section.md +23 -0
- package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +30 -0
- package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +27 -0
- package/docs/notes/2026-09-10-issue-273-performance-media.md +64 -0
- package/docs/notes/2026-09-10-issue-274-seo-basics.md +49 -0
- package/docs/notes/2026-09-10-issue-275-accessibility.md +46 -0
- package/docs/notes/2026-09-10-issue-290-footer-nap.md +28 -0
- package/docs/notes/2026-09-10-issue-291-seo-url-trailing-slash.md +24 -0
- package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +33 -0
- package/docs/notes/2026-09-10-issue-295-search-hydration-mismatch.md +25 -0
- package/docs/notes/2026-09-10-issue-296-track-direct-search.md +19 -0
- package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +64 -0
- package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +29 -0
- package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +119 -0
- package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +154 -0
- package/docs/notes/2026-09-12-issue-325-product-card.md +100 -0
- package/docs/notes/2026-09-12-issue-327-home-hero.md +64 -0
- package/docs/notes/2026-09-13-demo-banner.md +32 -0
- package/docs/notes/2026-09-13-issue-332-home-info-cards.md +46 -0
- package/docs/notes/2026-09-13-quick-view-flicker.md +65 -0
- package/docs/notes/2026-09-14-cart-upsell.md +105 -0
- package/docs/notes/2026-09-14-demo-noindex.md +57 -0
- package/node.dockerfile +5 -2
- package/nuxt.config.ts +98 -15
- package/package.json +5 -3
- package/patches/@shopware__nuxt-module@1.5.1.patch +32 -0
- package/pnpm-workspace.yaml +2 -0
- package/public/hero-poster.webp +0 -0
- package/scripts/perf/first-render.mjs +30 -0
- package/scripts/perf/h2-proxy.cjs +49 -0
- package/scripts/perf/lighthouse.sh +22 -0
- package/scripts/perf/quick-view-layout.mjs +126 -0
- package/server/api/__sitemap__/urls.get.ts +49 -0
- package/server/api/category/[categoryId].get.ts +20 -9
- package/server/api/content/home.get.ts +14 -0
- package/server/api/content/page.get.ts +22 -0
- package/server/api/listing/[categoryId].get.ts +14 -18
- package/server/api/product/[productId]/cross-selling.get.ts +3 -9
- package/server/api/product/[productId].get.ts +4 -8
- package/server/api/search.get.ts +2 -0
- package/server/plugins/site-url.ts +13 -0
- package/server/plugins/sitemap-trailing-slash.ts +26 -0
- package/server/utils/sitemap.ts +60 -0
- package/server/utils/storeApi.ts +34 -0
- package/shopware.d.ts +35 -11
- package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
- package/test/nuxt/AddressFields.test.ts +2 -73
- package/test/nuxt/AnimatedSection.test.ts +67 -0
- package/test/nuxt/CartBar.test.ts +110 -0
- package/test/nuxt/CartItem.test.ts +95 -0
- package/test/nuxt/CartUpsell.test.ts +125 -0
- package/test/nuxt/DemoBanner.test.ts +12 -0
- package/test/nuxt/FooterContact.test.ts +102 -0
- package/test/nuxt/FooterStoreStatus.test.ts +48 -0
- package/test/nuxt/HeaderRight.test.ts +14 -10
- package/test/nuxt/Hero.test.ts +68 -0
- package/test/nuxt/PaymentAndDelivery.test.ts +67 -8
- package/test/nuxt/RegistrationForm.test.ts +3 -0
- package/test/nuxt/useAddToCart.test.ts +37 -17
- package/test/nuxt/useAddressAutocomplete.test.ts +2 -38
- package/test/nuxt/useAddressSuggestionArea.test.ts +27 -0
- package/test/nuxt/useBusinessHours.test.ts +1 -1
- package/test/nuxt/useCartMutations.test.ts +225 -0
- package/test/nuxt/useCartUpsell.test.ts +126 -0
- package/test/nuxt/useCheckoutMethodGuard.test.ts +386 -0
- package/test/nuxt/useScrollAnimation.test.ts +55 -49
- package/test/nuxt/useSearchTracking.test.ts +71 -0
- package/test/nuxt/useSeoUrlRoute.test.ts +93 -0
- package/test/nuxt/useStoreStatus.test.ts +77 -0
- package/test/nuxt/useTrackEvent.test.ts +127 -0
- package/test/unit/media.spec.ts +49 -0
- package/test/unit/openingHours.spec.ts +90 -0
- package/test/unit/product.spec.ts +72 -0
- package/test/unit/schema.spec.ts +243 -0
- package/test/unit/seo.spec.ts +107 -0
- package/test/unit/seoPath.spec.ts +116 -0
- package/test/unit/sitemap.spec.ts +88 -0
- package/test/unit/useCategorySeo.spec.ts +42 -31
- package/test/unit/useSortingSelection.spec.ts +39 -0
- package/test/visual/playwright.config.ts +33 -0
- package/test/visual/visual.spec.ts +87 -0
- package/app/components/Product/CardDescription.vue +0 -27
- package/app/components/Product/CardFooter.vue +0 -51
- 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
|
-
<
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
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
|
-
<
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
</
|
|
181
|
-
|
|
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="
|
|
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="
|
|
209
|
+
class="grid grid-cols-1 gap-4 transition-opacity duration-200"
|
|
199
210
|
:class="{ 'opacity-40 pointer-events-none': loading }"
|
|
200
211
|
>
|
|
201
|
-
<
|
|
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
|
-
:
|
|
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
|
-
|
|
25
|
-
|
|
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
|
|
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
|
package/app/components/Cta.vue
CHANGED
|
@@ -11,11 +11,13 @@ defineProps<{
|
|
|
11
11
|
|
|
12
12
|
<template>
|
|
13
13
|
<div class="relative overflow-hidden">
|
|
14
|
-
<
|
|
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="
|
|
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 {
|
|
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:
|
|
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
|
-
<
|
|
33
|
-
<
|
|
34
|
-
|
|
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 {
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
<
|
|
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>
|