@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Schemas } from "#shopware";
|
|
3
|
+
import type { AssociationItemProduct } from "~/types/Association";
|
|
3
4
|
|
|
4
5
|
const props = defineProps<{
|
|
5
6
|
productId: string;
|
|
@@ -9,6 +10,7 @@ const emit = defineEmits(["product-added", "variant-selected"]);
|
|
|
9
10
|
|
|
10
11
|
const {
|
|
11
12
|
productDetails,
|
|
13
|
+
associationItems,
|
|
12
14
|
pending,
|
|
13
15
|
selectedProduct,
|
|
14
16
|
selectedQuantity,
|
|
@@ -19,6 +21,29 @@ const {
|
|
|
19
21
|
onIngredientsDeselected,
|
|
20
22
|
} = useProductDetail(() => props.productId);
|
|
21
23
|
|
|
24
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
25
|
+
|
|
26
|
+
const selectedExtras = ref<AssociationItemProduct[]>([]);
|
|
27
|
+
|
|
28
|
+
function onExtras(extras: AssociationItemProduct[]) {
|
|
29
|
+
selectedExtras.value = extras;
|
|
30
|
+
onExtrasSelected(extras);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Unit price plus extras, times the quantity: what the button will add.
|
|
34
|
+
const total = computed(() => {
|
|
35
|
+
const unitPrice = selectedProduct.value?.calculatedPrice.unitPrice ?? 0;
|
|
36
|
+
const extrasPrice = selectedExtras.value.reduce(
|
|
37
|
+
(sum, extra) => sum + (extra.unitPrice ?? 0),
|
|
38
|
+
0,
|
|
39
|
+
);
|
|
40
|
+
return (unitPrice + extrasPrice) * selectedQuantity.value;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const isAvailable = computed(() =>
|
|
44
|
+
selectedProduct.value ? productIsAvailable(selectedProduct.value) : true,
|
|
45
|
+
);
|
|
46
|
+
|
|
22
47
|
const onVariantSwitched = (variant: Schemas["Product"]) => {
|
|
23
48
|
setSelectedProduct(variant);
|
|
24
49
|
emit("variant-selected", variant);
|
|
@@ -28,41 +53,76 @@ const onAddToCart = () => emit("product-added");
|
|
|
28
53
|
</script>
|
|
29
54
|
|
|
30
55
|
<template>
|
|
31
|
-
<div
|
|
32
|
-
|
|
56
|
+
<div class="flex flex-col gap-5">
|
|
57
|
+
<!-- One placeholder in the shape of the loaded body (options, extras,
|
|
58
|
+
ingredients), shown until product and extras are both loaded. -->
|
|
59
|
+
<div v-if="pending" class="flex flex-col gap-5" aria-busy="true">
|
|
60
|
+
<div class="flex flex-col gap-2">
|
|
61
|
+
<USkeleton class="h-5 w-24" />
|
|
62
|
+
<USkeleton class="h-11 w-full" />
|
|
63
|
+
</div>
|
|
64
|
+
<div class="flex flex-col gap-2">
|
|
65
|
+
<USkeleton class="h-5 w-20" />
|
|
66
|
+
<div class="flex flex-wrap gap-2">
|
|
67
|
+
<USkeleton class="h-10 w-32 rounded-full" />
|
|
68
|
+
<USkeleton class="h-10 w-28 rounded-full" />
|
|
69
|
+
<USkeleton class="h-10 w-36 rounded-full" />
|
|
70
|
+
<USkeleton class="h-10 w-24 rounded-full" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="flex flex-col gap-2">
|
|
74
|
+
<USkeleton class="h-5 w-16" />
|
|
75
|
+
<div class="flex flex-wrap gap-2">
|
|
76
|
+
<USkeleton class="h-10 w-28 rounded-full" />
|
|
77
|
+
<USkeleton class="h-10 w-24 rounded-full" />
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<template v-else-if="productDetails?.configurator">
|
|
33
82
|
<ProductConfigurator
|
|
34
|
-
v-if="productDetails?.configurator"
|
|
35
83
|
:p="productDetails.product"
|
|
36
84
|
:c="productDetails.configurator"
|
|
37
85
|
@variant-switched="onVariantSwitched"
|
|
38
86
|
/>
|
|
39
87
|
<ProductCrossSelling
|
|
40
|
-
v-if="
|
|
41
|
-
:
|
|
42
|
-
@extras-selected="
|
|
88
|
+
v-if="associationItems.length > 0"
|
|
89
|
+
:associations="associationItems"
|
|
90
|
+
@extras-selected="onExtras"
|
|
43
91
|
/>
|
|
44
92
|
<ProductDeselectIngredient
|
|
45
93
|
v-if="selectedProduct"
|
|
46
94
|
:product="selectedProduct"
|
|
47
95
|
@ingredients-deselected="onIngredientsDeselected"
|
|
48
96
|
/>
|
|
49
|
-
</
|
|
50
|
-
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<div
|
|
100
|
+
class="sticky bottom-0 mt-auto flex items-center gap-3 border-t border-default bg-default pt-4"
|
|
101
|
+
>
|
|
51
102
|
<UInputNumber
|
|
52
103
|
v-model="selectedQuantity"
|
|
53
104
|
size="xl"
|
|
54
|
-
|
|
105
|
+
aria-label="Anzahl"
|
|
55
106
|
:min="1"
|
|
56
107
|
:max="100"
|
|
108
|
+
:disabled="pending"
|
|
109
|
+
class="w-28 shrink-0"
|
|
57
110
|
/>
|
|
111
|
+
<!-- Short label: "In den Warenkorb" wrapped next to the total on phones. -->
|
|
58
112
|
<UButton
|
|
59
|
-
|
|
113
|
+
class="flex-1 justify-between whitespace-nowrap"
|
|
60
114
|
size="xl"
|
|
61
|
-
label="In den Warenkorb"
|
|
62
115
|
icon="i-lucide-shopping-cart"
|
|
63
|
-
|
|
116
|
+
:disabled="isLoading || pending || !isAvailable"
|
|
117
|
+
:loading="isLoading"
|
|
118
|
+
aria-label="In den Warenkorb"
|
|
64
119
|
@click="addToCart(onAddToCart)"
|
|
65
|
-
|
|
120
|
+
>
|
|
121
|
+
<span>{{ isAvailable ? "Hinzufügen" : "Ausverkauft" }}</span>
|
|
122
|
+
<span v-if="isAvailable && !pending" class="font-bold">
|
|
123
|
+
{{ getFormattedPrice(total) }}
|
|
124
|
+
</span>
|
|
125
|
+
</UButton>
|
|
66
126
|
</div>
|
|
67
127
|
</div>
|
|
68
128
|
</template>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Schemas } from "#shopware";
|
|
3
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
product: Schemas["Product"] | undefined;
|
|
7
|
+
}>();
|
|
8
|
+
|
|
9
|
+
const open = defineModel<boolean>("open", { required: true });
|
|
10
|
+
|
|
11
|
+
// Bottom sheet on phones, side panel from the lg breakpoint (64rem).
|
|
12
|
+
const isDesktop = useMediaQuery("(min-width: 64rem)");
|
|
13
|
+
const direction = computed(() => (isDesktop.value ? "right" : "bottom"));
|
|
14
|
+
|
|
15
|
+
const sortedProperties = computed(
|
|
16
|
+
() =>
|
|
17
|
+
props.product?.sortedProperties as Schemas["PropertyGroup"][] | undefined,
|
|
18
|
+
);
|
|
19
|
+
const label = ref(props.product?.translated.name ?? props.product?.name ?? "");
|
|
20
|
+
const description = ref(props.product?.description);
|
|
21
|
+
|
|
22
|
+
watch(
|
|
23
|
+
() => props.product,
|
|
24
|
+
(product) => {
|
|
25
|
+
if (!product) return;
|
|
26
|
+
label.value = product.translated.name ?? product.name;
|
|
27
|
+
description.value = product.description;
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function onVariantSelected(variant: Schemas["Product"]) {
|
|
32
|
+
label.value = variant.translated.name ?? variant.name;
|
|
33
|
+
description.value = variant.translated.description ?? variant.description;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<!-- Only the body scrolls: header and footer stay in place without sticky
|
|
39
|
+
positioning, and shrink-0 keeps the flex column from squeezing the
|
|
40
|
+
header to its min-height (#325). -->
|
|
41
|
+
<UDrawer
|
|
42
|
+
v-model:open="open"
|
|
43
|
+
:direction="direction"
|
|
44
|
+
:close="true"
|
|
45
|
+
:ui="{
|
|
46
|
+
content: direction === 'right' ? 'w-full max-w-md' : 'max-h-[92vh]',
|
|
47
|
+
container: 'overflow-hidden',
|
|
48
|
+
header: 'shrink-0 items-start border-b border-default pb-3',
|
|
49
|
+
body: 'flex min-h-0 flex-col gap-5 overflow-y-auto',
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
<template #title>
|
|
53
|
+
<span class="flex flex-col gap-0.5">
|
|
54
|
+
<span class="text-xs font-semibold text-primary">
|
|
55
|
+
#{{ product?.productNumber }}
|
|
56
|
+
</span>
|
|
57
|
+
<span class="text-xl font-bold text-highlighted">{{ label }}</span>
|
|
58
|
+
</span>
|
|
59
|
+
</template>
|
|
60
|
+
<template v-if="description" #description>
|
|
61
|
+
{{ description }}
|
|
62
|
+
</template>
|
|
63
|
+
<template #body>
|
|
64
|
+
<ProductCardIngredients
|
|
65
|
+
:sorted-properties="sortedProperties"
|
|
66
|
+
:with-diet-badges="true"
|
|
67
|
+
/>
|
|
68
|
+
<ProductDetail
|
|
69
|
+
v-if="product"
|
|
70
|
+
:key="product.id"
|
|
71
|
+
:product-id="product.id"
|
|
72
|
+
@product-added="open = false"
|
|
73
|
+
@variant-selected="onVariantSelected"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
</UDrawer>
|
|
77
|
+
</template>
|
|
@@ -1,43 +1,53 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
// Top sellers as a horizontal snap scroller below the hero (#327); a tap
|
|
3
|
+
// opens the product quick view (#325). Renders nothing without top sellers.
|
|
4
4
|
const { loadTopSellers } = useTopSellers();
|
|
5
5
|
|
|
6
|
-
const topSellers = await
|
|
6
|
+
const { data: topSellers } = await useAsyncData("top-sellers", () =>
|
|
7
|
+
loadTopSellers(),
|
|
8
|
+
);
|
|
7
9
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
label: "Zur Speisekarte",
|
|
11
|
-
to: "/speisekarte",
|
|
12
|
-
color: "primary",
|
|
13
|
-
variant: "subtle",
|
|
14
|
-
trailingIcon: "i-lucide-arrow-right",
|
|
15
|
-
},
|
|
16
|
-
]);
|
|
10
|
+
const products = computed(() => topSellers.value ?? []);
|
|
11
|
+
const quickView = useProductQuickView(products);
|
|
17
12
|
</script>
|
|
18
13
|
|
|
19
14
|
<template>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
15
|
+
<section v-if="products.length > 0" aria-labelledby="top-sellers-title">
|
|
16
|
+
<UContainer class="flex flex-col gap-3 pt-6 sm:pt-8">
|
|
17
|
+
<div class="flex items-baseline justify-between gap-4">
|
|
18
|
+
<h2
|
|
19
|
+
id="top-sellers-title"
|
|
20
|
+
class="text-xl font-extrabold tracking-tight text-highlighted sm:text-2xl"
|
|
21
|
+
>
|
|
22
|
+
Beliebt bei unseren Gästen
|
|
23
|
+
</h2>
|
|
24
|
+
<UButton
|
|
25
|
+
label="Speisekarte"
|
|
26
|
+
to="/speisekarte/"
|
|
27
|
+
variant="link"
|
|
28
|
+
color="primary"
|
|
29
|
+
trailing-icon="i-lucide-arrow-right"
|
|
30
|
+
class="shrink-0 px-0"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
</UContainer>
|
|
34
|
+
<!-- Scrolls edge to edge on phones, padded like the container. -->
|
|
35
|
+
<div
|
|
36
|
+
class="flex snap-x snap-mandatory gap-3 overflow-x-auto px-4 py-2 pb-4 sm:px-6 lg:px-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
|
25
37
|
>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</AnimatedSection>
|
|
42
|
-
</div>
|
|
38
|
+
<div class="mx-auto flex w-full max-w-(--ui-container) gap-3">
|
|
39
|
+
<ProductCardCompact
|
|
40
|
+
v-for="product in products"
|
|
41
|
+
:key="product.id"
|
|
42
|
+
:product="product"
|
|
43
|
+
@select="quickView.show"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<LazyProductQuickView
|
|
48
|
+
v-if="quickView.mounted.value"
|
|
49
|
+
v-model:open="quickView.open.value"
|
|
50
|
+
:product="quickView.product.value"
|
|
51
|
+
/>
|
|
52
|
+
</section>
|
|
43
53
|
</template>
|
|
@@ -149,7 +149,7 @@ onMounted(async () => {
|
|
|
149
149
|
</div>
|
|
150
150
|
<div class="flex-1 min-w-0">
|
|
151
151
|
<div class="flex flex-col gap-1">
|
|
152
|
-
<span class="text-xs text-
|
|
152
|
+
<span class="text-xs text-primary font-medium">
|
|
153
153
|
#{{ product.productNumber }}
|
|
154
154
|
</span>
|
|
155
155
|
<h3
|
|
@@ -157,7 +157,7 @@ onMounted(async () => {
|
|
|
157
157
|
>
|
|
158
158
|
{{ product.translated.name }}
|
|
159
159
|
</h3>
|
|
160
|
-
<p class="text-base font-bold text-primary
|
|
160
|
+
<p class="text-base font-bold text-primary">
|
|
161
161
|
{{
|
|
162
162
|
getFormattedPrice(
|
|
163
163
|
product.calculatedPrice.totalPrice,
|
|
@@ -222,16 +222,3 @@ onMounted(async () => {
|
|
|
222
222
|
</div>
|
|
223
223
|
</div>
|
|
224
224
|
</template>
|
|
225
|
-
|
|
226
|
-
<style scoped>
|
|
227
|
-
@import "tailwindcss";
|
|
228
|
-
@import "@nuxt/ui";
|
|
229
|
-
|
|
230
|
-
h1 {
|
|
231
|
-
@apply text-3xl sm:text-4xl lg:text-5xl text-pretty tracking-tight font-bold text-highlighted my-14;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
h2 {
|
|
235
|
-
@apply mt-0 text-2xl sm:text-3xl lg:text-4xl text-pretty tracking-tight font-bold text-highlighted my-10;
|
|
236
|
-
}
|
|
237
|
-
</style>
|
|
@@ -4,14 +4,13 @@ import { v5 as uuidv5, v4 as uuidv4 } from "uuid";
|
|
|
4
4
|
import { computed, ref } from "vue";
|
|
5
5
|
|
|
6
6
|
const UUID_NAMESPACE = "b098ef7e-0fa2-4073-b002-7ceec4360fbf";
|
|
7
|
-
const CART_SUCCESS_TITLE = "Gute Wahl!";
|
|
8
7
|
const LINE_ITEM_PRODUCT = "product";
|
|
9
8
|
const LINE_ITEM_CONTAINER = "container";
|
|
10
9
|
|
|
11
10
|
export function useAddToCart() {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
const {
|
|
11
|
+
const { addLineItems } = useCartMutations();
|
|
12
|
+
// Feedback is the cart bar / header badge animation, not a toast (#325).
|
|
13
|
+
const { triggerCartItemAdded } = useProductEvents();
|
|
15
14
|
const { trackAddToCart: trackAddToCartEvent } = useTrackEvent();
|
|
16
15
|
|
|
17
16
|
const selectedExtras = ref<AssociationItemProduct[]>([]);
|
|
@@ -45,12 +44,6 @@ export function useAddToCart() {
|
|
|
45
44
|
"-",
|
|
46
45
|
);
|
|
47
46
|
|
|
48
|
-
console.log(
|
|
49
|
-
selectedProduct.value.translated.name,
|
|
50
|
-
extrasFormatted,
|
|
51
|
-
removedFormatted,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
47
|
return `${selectedProduct.value.translated.name}${extrasFormatted}${removedFormatted}`;
|
|
55
48
|
});
|
|
56
49
|
|
|
@@ -118,40 +111,20 @@ export function useAddToCart() {
|
|
|
118
111
|
];
|
|
119
112
|
}
|
|
120
113
|
|
|
121
|
-
async function showSuccessToast() {
|
|
122
|
-
if (!selectedProduct.value) return;
|
|
123
|
-
|
|
124
|
-
toast.add({
|
|
125
|
-
title: CART_SUCCESS_TITLE,
|
|
126
|
-
description: `${selectedProduct.value.translated.name} wurde in den Warenkorb gelegt.`,
|
|
127
|
-
icon: "i-lucide-shopping-cart",
|
|
128
|
-
color: "primary",
|
|
129
|
-
progress: true,
|
|
130
|
-
duration: 2000,
|
|
131
|
-
actions: [
|
|
132
|
-
{
|
|
133
|
-
label: "Zum Warenkorb",
|
|
134
|
-
to: "/bestellung/warenkorb",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
114
|
async function addToCart(onSuccess?: () => void) {
|
|
141
|
-
if (!selectedProduct.value) return;
|
|
115
|
+
if (!selectedProduct.value || isLoading.value) return;
|
|
142
116
|
isLoading.value = true;
|
|
143
117
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
triggerProductAdded();
|
|
150
|
-
trackAddToCartEvent(selectedProduct.value, selectedQuantity.value);
|
|
118
|
+
try {
|
|
119
|
+
// Failures are reported by useCartMutations; it resolves undefined.
|
|
120
|
+
const newCart = await addLineItems(createCartItems());
|
|
121
|
+
if (!newCart) return;
|
|
151
122
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
onSuccess();
|
|
123
|
+
triggerCartItemAdded(selectedProduct.value, selectedQuantity.value);
|
|
124
|
+
trackAddToCartEvent(selectedProduct.value, selectedQuantity.value);
|
|
125
|
+
onSuccess?.();
|
|
126
|
+
} finally {
|
|
127
|
+
isLoading.value = false;
|
|
155
128
|
}
|
|
156
129
|
}
|
|
157
130
|
|
|
@@ -25,7 +25,7 @@ interface GeoapifyResponse {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export function useAddressAutocomplete() {
|
|
28
|
-
const { boundingBoxCoordinates
|
|
28
|
+
const { boundingBoxCoordinates } = useAddressSuggestionArea();
|
|
29
29
|
|
|
30
30
|
async function getSuggestions(text: string): Promise<AddressSuggestion[]> {
|
|
31
31
|
if (!text || text.length < 3) {
|
|
@@ -54,24 +54,17 @@ export function useAddressAutocomplete() {
|
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return data.value.features
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
street
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})
|
|
69
|
-
.filter((suggestion: AddressSuggestion) => {
|
|
70
|
-
if (validCities.value.length === 0) return true;
|
|
71
|
-
return validCities.value.some(
|
|
72
|
-
(city) => city.toLowerCase() === suggestion.city.toLowerCase(),
|
|
73
|
-
);
|
|
74
|
-
});
|
|
57
|
+
return data.value.features.map((feature: GeoapifyFeature) => {
|
|
58
|
+
const props = feature.properties;
|
|
59
|
+
return {
|
|
60
|
+
street: props.street
|
|
61
|
+
? `${props.street}${props.housenumber ? " " + props.housenumber : ""}`
|
|
62
|
+
: props.name || "",
|
|
63
|
+
city: props.city || "",
|
|
64
|
+
zipcode: props.postcode || "",
|
|
65
|
+
label: props.formatted || "",
|
|
66
|
+
};
|
|
67
|
+
});
|
|
75
68
|
} catch (error) {
|
|
76
69
|
console.error("Error fetching address suggestions:", error);
|
|
77
70
|
return [];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional area that narrows the Geoapify address suggestions
|
|
3
|
+
* (`filter=rect:lon1,lat1,lon2,lat2`), from
|
|
4
|
+
* `runtimeConfig.public.shopBite.addressAutocomplete.boundingBox`. Empty means
|
|
5
|
+
* no filter. Where the shop delivers is decided by the Shopware cart rules,
|
|
6
|
+
* not here (#251).
|
|
7
|
+
*/
|
|
8
|
+
export function useAddressSuggestionArea() {
|
|
9
|
+
const { addressAutocomplete } = useRuntimeConfig().public.shopBite;
|
|
10
|
+
|
|
11
|
+
const boundingBoxCoordinates = computed(() =>
|
|
12
|
+
addressAutocomplete.boundingBox.trim(),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return { boundingBoxCoordinates };
|
|
16
|
+
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { ref,
|
|
2
|
-
import type { Ref
|
|
1
|
+
import { ref, watch, toValue, onUnmounted } from "vue";
|
|
2
|
+
import type { Ref } from "vue";
|
|
3
3
|
import type { AddressSchema } from "~/validation/registrationSchema";
|
|
4
4
|
import type { AddressSuggestion } from "~/composables/useAddressAutocomplete";
|
|
5
5
|
|
|
6
6
|
export function useAddressValidation(
|
|
7
7
|
model: Ref<AddressSchema>,
|
|
8
8
|
options: {
|
|
9
|
-
isShipping?: Ref<boolean> | ComputedRef<boolean> | boolean;
|
|
10
9
|
getSuggestions: (query: string) => Promise<AddressSuggestion[] | undefined>;
|
|
11
|
-
validCities: Ref<string[]>;
|
|
12
10
|
},
|
|
13
11
|
) {
|
|
14
|
-
const {
|
|
12
|
+
const { getSuggestions } = options;
|
|
15
13
|
|
|
16
14
|
const showCorrection = ref(false);
|
|
17
15
|
const correction = ref<AddressSuggestion | null>(null);
|
|
@@ -41,19 +39,6 @@ export function useAddressValidation(
|
|
|
41
39
|
return false;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
const isInvalidCity = computed(() => {
|
|
45
|
-
if (!toValue(isShipping)) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const m = toValue(model);
|
|
49
|
-
if (!m.city || validCities.value.length === 0) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return !validCities.value.some(
|
|
53
|
-
(city) => city.toLowerCase() === m.city.toLowerCase(),
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
42
|
let debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
58
43
|
|
|
59
44
|
watch(
|
|
@@ -99,7 +84,6 @@ export function useAddressValidation(
|
|
|
99
84
|
return {
|
|
100
85
|
showCorrection,
|
|
101
86
|
correction,
|
|
102
|
-
isInvalidCity,
|
|
103
87
|
checkAddress,
|
|
104
88
|
flushPendingCheck,
|
|
105
89
|
applyCorrection,
|