@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
package/app/app.config.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export default defineAppConfig({
|
|
2
2
|
ui: {
|
|
3
3
|
colors: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// Alias of the colour scale in main.css; a hex value here produced
|
|
5
|
+
// invalid `var(--color-#ff5b00-*)` declarations (#319).
|
|
6
|
+
primary: "brand",
|
|
6
7
|
},
|
|
7
8
|
drawer: {
|
|
8
9
|
slots: {
|
package/app/app.vue
CHANGED
|
@@ -1,37 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const TOAST_CONFIG = {
|
|
5
|
-
open: {
|
|
6
|
-
id: "currently-open",
|
|
7
|
-
title: "Wir haben geöffnet!",
|
|
8
|
-
color: "primary" as const,
|
|
9
|
-
progress: false,
|
|
10
|
-
duration: 5000,
|
|
11
|
-
icon: "i-lucide-party-popper",
|
|
12
|
-
actions: [
|
|
13
|
-
{
|
|
14
|
-
icon: "i-lucide-utensils-crossed",
|
|
15
|
-
label: "Zur Speisekarte",
|
|
16
|
-
color: "neutral" as const,
|
|
17
|
-
variant: "outline" as const,
|
|
18
|
-
onClick: () => navigateTo("/speisekarte"),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
} as Partial<Toast>,
|
|
22
|
-
closed: {
|
|
23
|
-
id: "currently-closed",
|
|
24
|
-
title: "Wir haben geschlossen!",
|
|
25
|
-
color: "neutral" as const,
|
|
26
|
-
progress: false,
|
|
27
|
-
duration: 0,
|
|
28
|
-
} as Partial<Toast>,
|
|
29
|
-
} as const;
|
|
2
|
+
import Footer from "~/components/Footer.vue";
|
|
30
3
|
|
|
31
4
|
const { apiClient } = useShopwareContext();
|
|
32
5
|
const appConfig = useAppConfig();
|
|
33
6
|
const router = useRouter();
|
|
34
|
-
|
|
7
|
+
|
|
8
|
+
// The footer is below the fold on every page; its hydration waits until it
|
|
9
|
+
// scrolls into view (#314).
|
|
10
|
+
const FooterWhenVisible = hydrateWhenVisible(Footer);
|
|
35
11
|
|
|
36
12
|
const { data: sessionContextData } = await useAsyncData(
|
|
37
13
|
"sessionContext",
|
|
@@ -59,28 +35,10 @@ if (sessionContextData.value) {
|
|
|
59
35
|
useSessionContext(sessionContextData.value);
|
|
60
36
|
}
|
|
61
37
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = useBusinessHours();
|
|
67
|
-
const { isClosedHoliday, refresh: refreshHolidays } = useHolidays();
|
|
68
|
-
|
|
69
|
-
function displayStoreStatus() {
|
|
70
|
-
const isOpen = isStoreOpen(undefined, isClosedHoliday);
|
|
71
|
-
|
|
72
|
-
if (isOpen) {
|
|
73
|
-
toast.add(TOAST_CONFIG.open);
|
|
74
|
-
} else {
|
|
75
|
-
const nextOpening = getNextOpeningTime(ref(new Date()), isClosedHoliday);
|
|
76
|
-
toast.add({
|
|
77
|
-
...TOAST_CONFIG.closed,
|
|
78
|
-
description: nextOpening
|
|
79
|
-
? `Wir öffnen wieder ${nextOpening}`
|
|
80
|
-
: "Öffnungszeiten siehe Website",
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
38
|
+
// Business hours and holidays feed the store status in the header
|
|
39
|
+
// (HeaderStoreStatus) and the delivery time selection.
|
|
40
|
+
const { refresh: refreshBusinessHours } = useBusinessHours();
|
|
41
|
+
const { refresh: refreshHolidays } = useHolidays();
|
|
84
42
|
|
|
85
43
|
const { refreshCart } = useCart();
|
|
86
44
|
const { getWishlistProducts } = useWishlist();
|
|
@@ -95,21 +53,47 @@ if (import.meta.client) {
|
|
|
95
53
|
onMounted(async () => {
|
|
96
54
|
await Promise.all([refreshHolidays(), refreshBusinessHours()]);
|
|
97
55
|
refreshCart();
|
|
98
|
-
displayStoreStatus();
|
|
99
56
|
});
|
|
100
57
|
|
|
58
|
+
const route = useRoute();
|
|
59
|
+
const siteConfig = useSiteConfig();
|
|
60
|
+
const { site, shopBite } = useRuntimeConfig().public;
|
|
61
|
+
|
|
62
|
+
// Pages with a backend SEO URL (categories) override the canonical link.
|
|
63
|
+
const canonicalUrl = computed(() => toAbsoluteUrl(siteConfig.url, route.path));
|
|
64
|
+
|
|
101
65
|
useHead({
|
|
102
66
|
htmlAttrs: {
|
|
103
67
|
lang: "de",
|
|
104
68
|
},
|
|
69
|
+
titleTemplate: (title) =>
|
|
70
|
+
formatPageTitle(title, site.name, site.titleTemplate),
|
|
105
71
|
link: [
|
|
106
72
|
{
|
|
107
73
|
rel: "icon",
|
|
108
74
|
type: "image/png",
|
|
109
75
|
href: "/favicon.ico",
|
|
110
76
|
},
|
|
77
|
+
{
|
|
78
|
+
rel: "canonical",
|
|
79
|
+
key: "canonical",
|
|
80
|
+
href: canonicalUrl,
|
|
81
|
+
},
|
|
111
82
|
],
|
|
112
83
|
});
|
|
84
|
+
|
|
85
|
+
useSeoMeta({
|
|
86
|
+
ogUrl: canonicalUrl,
|
|
87
|
+
ogType: "website",
|
|
88
|
+
ogSiteName: site.name,
|
|
89
|
+
ogLocale: (
|
|
90
|
+
sessionContextData.value?.languageInfo?.localeCode ?? "de-DE"
|
|
91
|
+
).replace("-", "_"),
|
|
92
|
+
ogImage: site.ogImage
|
|
93
|
+
? toAbsoluteUrl(siteConfig.url, site.ogImage)
|
|
94
|
+
: undefined,
|
|
95
|
+
twitterCard: "summary_large_image",
|
|
96
|
+
});
|
|
113
97
|
</script>
|
|
114
98
|
|
|
115
99
|
<template>
|
|
@@ -117,12 +101,15 @@ useHead({
|
|
|
117
101
|
<NuxtLoadingIndicator />
|
|
118
102
|
|
|
119
103
|
<UApp :toaster="appConfig.toaster">
|
|
104
|
+
<!-- Lazy keeps UBanner out of the entry chunk of real shops (#314). -->
|
|
105
|
+
<LazyDemoBanner v-if="shopBite.feature.demoBanner" />
|
|
120
106
|
<Header />
|
|
121
107
|
<UMain>
|
|
122
108
|
<NuxtLayout>
|
|
123
109
|
<NuxtPage />
|
|
124
110
|
</NuxtLayout>
|
|
125
111
|
</UMain>
|
|
126
|
-
<
|
|
112
|
+
<FooterWhenVisible />
|
|
113
|
+
<CartBar />
|
|
127
114
|
</UApp>
|
|
128
115
|
</template>
|
package/app/assets/css/main.css
CHANGED
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
--color-brand-300: #ffa169;
|
|
12
12
|
--color-brand-400: #ff7a2d;
|
|
13
13
|
--color-brand-500: #ff5b00;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/* primary colour of the light mode: 5.3:1 on white, 4.6:1 on its own
|
|
15
|
+
10 % tint (subtle buttons and badges), see #275 */
|
|
16
|
+
--color-brand-600: #c23d00;
|
|
17
|
+
--color-brand-700: #a83500;
|
|
16
18
|
--color-brand-800: #9a3200;
|
|
17
19
|
--color-brand-900: #7a2800;
|
|
18
20
|
--color-brand-950: #471500;
|
|
@@ -20,10 +22,36 @@
|
|
|
20
22
|
|
|
21
23
|
/* This is important because apple devices will zoom in when the font size is below 16px */
|
|
22
24
|
--text-sm: 16px;
|
|
25
|
+
|
|
26
|
+
/* Feedback after adding to the cart: the cart bar and the header badge
|
|
27
|
+
pop instead of a toast (#325). */
|
|
28
|
+
--animate-cart-pop: cart-pop 450ms cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
29
|
+
|
|
30
|
+
@keyframes cart-pop {
|
|
31
|
+
0% {
|
|
32
|
+
transform: scale(1);
|
|
33
|
+
}
|
|
34
|
+
35% {
|
|
35
|
+
transform: scale(1.06);
|
|
36
|
+
}
|
|
37
|
+
100% {
|
|
38
|
+
transform: scale(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
23
41
|
}
|
|
24
42
|
|
|
43
|
+
/*
|
|
44
|
+
* Primary and success colours per colour mode, the Nuxt UI convention: a
|
|
45
|
+
* dark step on light backgrounds, the 400 step on dark ones. Text in these
|
|
46
|
+
* colours and text on solid buttons need a contrast of at least 4.5:1
|
|
47
|
+
* (WCAG AA), which the 500 step of most scales misses (#275). Subtle
|
|
48
|
+
* buttons and badges put the colour on a 10 % tint of itself, so aim for
|
|
49
|
+
* 5:1 on white. A brand scale must keep 600 >= 5:1 on white and
|
|
50
|
+
* 400 >= 4.5:1 on #171717.
|
|
51
|
+
*/
|
|
25
52
|
:root {
|
|
26
|
-
--ui-primary: var(--color-brand-
|
|
53
|
+
--ui-primary: var(--color-brand-600);
|
|
54
|
+
--ui-success: var(--color-green-800);
|
|
27
55
|
|
|
28
56
|
--ui-bg: #fff;
|
|
29
57
|
--ui-bg-muted: #f5f5f5;
|
|
@@ -36,12 +64,16 @@
|
|
|
36
64
|
|
|
37
65
|
--ui-text-accented: #171717;
|
|
38
66
|
--ui-text-default: #404040;
|
|
39
|
-
--ui-
|
|
67
|
+
/* 4.9:1 on --ui-bg-elevated (#737373 was 4.38, #275) */
|
|
68
|
+
--ui-text-muted: #6b6b6b;
|
|
40
69
|
--ui-text-dimmed: #a3a3a3;
|
|
41
70
|
--ui-text-inverted: #fff;
|
|
42
71
|
}
|
|
43
72
|
|
|
44
73
|
:root.dark {
|
|
74
|
+
--ui-primary: var(--color-brand-400);
|
|
75
|
+
--ui-success: var(--color-green-400);
|
|
76
|
+
|
|
45
77
|
--ui-bg: #171717;
|
|
46
78
|
--ui-bg-muted: #1f1f1f;
|
|
47
79
|
--ui-bg-elevated: #2a2a2a;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { Schemas } from "#shopware";
|
|
3
|
+
import type { ButtonProps } from "@nuxt/ui";
|
|
3
4
|
|
|
4
|
-
const props =
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
product: Schemas["Product"];
|
|
8
|
+
size?: ButtonProps["size"];
|
|
9
|
+
variant?: ButtonProps["variant"];
|
|
10
|
+
}>(),
|
|
11
|
+
{ size: "md", variant: "ghost" },
|
|
12
|
+
);
|
|
7
13
|
|
|
8
14
|
const { addToWishlist, isInWishlist, removeFromWishlist } = useProductWishlist(
|
|
9
15
|
props.product.id,
|
|
@@ -23,11 +29,10 @@ const toggleWishlistProduct = async () => {
|
|
|
23
29
|
}
|
|
24
30
|
};
|
|
25
31
|
|
|
26
|
-
// Computed tooltip text
|
|
27
32
|
const tooltipText = computed(() =>
|
|
28
33
|
isInWishlist.value
|
|
29
34
|
? "Von der Merkliste entfernen"
|
|
30
|
-
: "Auf die Merkliste
|
|
35
|
+
: "Auf die Merkliste setzen",
|
|
31
36
|
);
|
|
32
37
|
</script>
|
|
33
38
|
|
|
@@ -35,8 +40,10 @@ const tooltipText = computed(() =>
|
|
|
35
40
|
<UTooltip :text="tooltipText">
|
|
36
41
|
<UButton
|
|
37
42
|
icon="i-lucide-heart"
|
|
38
|
-
|
|
43
|
+
:size="size"
|
|
44
|
+
:variant="variant"
|
|
39
45
|
:color="isInWishlist ? 'error' : 'neutral'"
|
|
46
|
+
:aria-label="tooltipText"
|
|
40
47
|
@click="toggleWishlistProduct"
|
|
41
48
|
/>
|
|
42
49
|
</UTooltip>
|
|
@@ -3,28 +3,21 @@ import type { AddressSchema } from "~/validation/registrationSchema";
|
|
|
3
3
|
|
|
4
4
|
const model = defineModel<AddressSchema>({ required: true });
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
defineProps<{
|
|
7
7
|
prefix: string;
|
|
8
8
|
accountType?: string;
|
|
9
9
|
showNames?: boolean;
|
|
10
|
-
isShipping?: boolean;
|
|
11
10
|
}>();
|
|
12
11
|
|
|
13
12
|
const { getSuggestions } = useAddressAutocomplete();
|
|
14
|
-
const { validCities } = useValidCitiesForDelivery();
|
|
15
13
|
|
|
16
14
|
const {
|
|
17
15
|
showCorrection,
|
|
18
16
|
correction,
|
|
19
|
-
isInvalidCity,
|
|
20
17
|
checkAddress,
|
|
21
18
|
flushPendingCheck,
|
|
22
19
|
applyCorrection,
|
|
23
|
-
} = useAddressValidation(model, {
|
|
24
|
-
isShipping: props.isShipping,
|
|
25
|
-
getSuggestions,
|
|
26
|
-
validCities,
|
|
27
|
-
});
|
|
20
|
+
} = useAddressValidation(model, { getSuggestions });
|
|
28
21
|
|
|
29
22
|
defineExpose({
|
|
30
23
|
checkAddress,
|
|
@@ -103,18 +96,6 @@ defineExpose({
|
|
|
103
96
|
/>
|
|
104
97
|
</div>
|
|
105
98
|
|
|
106
|
-
<UAlert
|
|
107
|
-
v-if="isInvalidCity"
|
|
108
|
-
color="warning"
|
|
109
|
-
variant="soft"
|
|
110
|
-
icon="i-lucide-triangle-alert"
|
|
111
|
-
>
|
|
112
|
-
<template #title>
|
|
113
|
-
An diese Adresse können wir leider nicht liefern.
|
|
114
|
-
<ULink to="/zahlung-und-versand">Weitere Infos.</ULink>
|
|
115
|
-
</template>
|
|
116
|
-
</UAlert>
|
|
117
|
-
|
|
118
99
|
<UFormField label="Adresszusatz" :name="`${prefix}.additionalAddressLine1`">
|
|
119
100
|
<UInput
|
|
120
101
|
v-model="model.additionalAddressLine1"
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ABOVE_VIEWPORT_MARGIN,
|
|
4
|
+
useScrollAnimation,
|
|
5
|
+
} from "~/composables/useScrollAnimation";
|
|
3
6
|
|
|
4
7
|
interface Props {
|
|
5
8
|
animation?:
|
|
@@ -16,10 +19,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
16
19
|
duration: "duration-1000",
|
|
17
20
|
delay: "delay-0",
|
|
18
21
|
threshold: 0.1,
|
|
19
|
-
rootMargin:
|
|
22
|
+
rootMargin: `${ABOVE_VIEWPORT_MARGIN} 0px 100px 0px`,
|
|
20
23
|
});
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
// Visible in SSR and on the first client render; hidden only after mount
|
|
26
|
+
// for sections below the fold, until they scroll into view (#250).
|
|
27
|
+
const { isHidden, elementRef } = useScrollAnimation({
|
|
23
28
|
threshold: props.threshold,
|
|
24
29
|
rootMargin: props.rootMargin,
|
|
25
30
|
});
|
|
@@ -61,7 +66,7 @@ const currentAnimation = animationClasses[props.animation];
|
|
|
61
66
|
:class="[
|
|
62
67
|
duration,
|
|
63
68
|
delay,
|
|
64
|
-
|
|
69
|
+
isHidden ? currentAnimation.initial : currentAnimation.final,
|
|
65
70
|
]"
|
|
66
71
|
>
|
|
67
72
|
<slot />
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
} from "@heroicons/vue/24/outline";
|
|
9
9
|
|
|
10
10
|
const route = useRoute();
|
|
11
|
+
// Route and phone come from the site config; without a value the button is
|
|
12
|
+
// left out instead of pointing at another shop (#251).
|
|
13
|
+
const { site } = useRuntimeConfig().public;
|
|
11
14
|
</script>
|
|
12
15
|
|
|
13
16
|
<template>
|
|
@@ -16,9 +19,12 @@ const route = useRoute();
|
|
|
16
19
|
>
|
|
17
20
|
<div class="flex flex-row justify-between items-center py-2 gap-1">
|
|
18
21
|
<NuxtLink
|
|
22
|
+
v-if="site.googleBusinessProfileUrl"
|
|
19
23
|
title="Routenplaner"
|
|
20
24
|
class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
|
|
21
|
-
to="
|
|
25
|
+
:to="site.googleBusinessProfileUrl"
|
|
26
|
+
target="_blank"
|
|
27
|
+
rel="noopener"
|
|
22
28
|
>
|
|
23
29
|
<MapPinIcon class="w-5 h-5 text-white" />
|
|
24
30
|
<div class="text-white text-xs">Route</div>
|
|
@@ -51,8 +57,9 @@ const route = useRoute();
|
|
|
51
57
|
<div class="text-white text-xs">Speisekarte</div>
|
|
52
58
|
</NuxtLink>
|
|
53
59
|
<NuxtLink
|
|
60
|
+
v-if="site.telephone"
|
|
54
61
|
title="Anrufen"
|
|
55
|
-
to="
|
|
62
|
+
:to="toTelHref(site.telephone)"
|
|
56
63
|
class="flex flex-col justify-center items-center bg-blackish rounded-md px-3.5 py-2.5 basis-1/4 gap-2"
|
|
57
64
|
>
|
|
58
65
|
<PhoneIcon class="w-5 h-5 text-white" />
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Sticky cart bar on phones: appears as soon as the cart holds something and
|
|
3
|
+
// opens the cart drawer; hidden on the checkout pages, which show the cart
|
|
4
|
+
// themselves. The cart is loaded on the client, so the bar never renders on
|
|
5
|
+
// the server (no hydration mismatch). Adding a product pops the bar and
|
|
6
|
+
// names the product for a moment; this replaces the add-to-cart toast (#325).
|
|
7
|
+
const CHECKOUT_PATH_PREFIX = "/bestellung";
|
|
8
|
+
const ADDED_LABEL_MS = 1800;
|
|
9
|
+
|
|
10
|
+
const route = useRoute();
|
|
11
|
+
const { count, subtotal } = useCart();
|
|
12
|
+
const { isCheckoutEnabled } = useShopBiteConfig();
|
|
13
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
14
|
+
const { show } = useCartQuickView();
|
|
15
|
+
const { onCartItemAdded } = useProductEvents();
|
|
16
|
+
|
|
17
|
+
const visible = computed(
|
|
18
|
+
() =>
|
|
19
|
+
isCheckoutEnabled.value &&
|
|
20
|
+
count.value > 0 &&
|
|
21
|
+
!route.path.startsWith(CHECKOUT_PATH_PREFIX),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const itemsLabel = computed(() =>
|
|
25
|
+
count.value === 1 ? "1 Artikel" : `${count.value} Artikel`,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const addedLabel = ref<string | null>(null);
|
|
29
|
+
// Changing the key re-mounts the button, which restarts the pop animation.
|
|
30
|
+
const popKey = ref(0);
|
|
31
|
+
let addedTimer: ReturnType<typeof setTimeout> | undefined;
|
|
32
|
+
|
|
33
|
+
onCartItemAdded(({ product, quantity }) => {
|
|
34
|
+
const name = product.translated?.name ?? product.name;
|
|
35
|
+
addedLabel.value = quantity > 1 ? `${quantity}× ${name}` : name;
|
|
36
|
+
popKey.value++;
|
|
37
|
+
clearTimeout(addedTimer);
|
|
38
|
+
addedTimer = setTimeout(() => {
|
|
39
|
+
addedLabel.value = null;
|
|
40
|
+
}, ADDED_LABEL_MS);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
onBeforeUnmount(() => clearTimeout(addedTimer));
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<!-- Keeps the page bottom clear of the fixed bar. -->
|
|
48
|
+
<div v-if="visible" class="h-20 lg:hidden" aria-hidden="true" />
|
|
49
|
+
<Transition
|
|
50
|
+
enter-active-class="transition duration-200 ease-out"
|
|
51
|
+
enter-from-class="translate-y-full"
|
|
52
|
+
leave-active-class="transition duration-150 ease-in"
|
|
53
|
+
leave-to-class="translate-y-full"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
v-if="visible"
|
|
57
|
+
class="fixed inset-x-0 bottom-0 z-40 p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] lg:hidden"
|
|
58
|
+
>
|
|
59
|
+
<button
|
|
60
|
+
:key="popKey"
|
|
61
|
+
type="button"
|
|
62
|
+
class="flex h-14 w-full items-center gap-3 rounded-xl bg-primary px-4 text-inverted shadow-lg transition-colors hover:bg-primary/90 active:bg-primary/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
|
|
63
|
+
:class="{ 'motion-safe:animate-cart-pop': popKey > 0 }"
|
|
64
|
+
aria-haspopup="dialog"
|
|
65
|
+
aria-live="polite"
|
|
66
|
+
data-testid="cart-bar"
|
|
67
|
+
@click="show"
|
|
68
|
+
>
|
|
69
|
+
<UIcon name="i-lucide-shopping-bag" class="size-6 shrink-0" />
|
|
70
|
+
<span class="flex min-w-0 flex-1 items-baseline gap-2 text-left">
|
|
71
|
+
<Transition
|
|
72
|
+
mode="out-in"
|
|
73
|
+
enter-active-class="transition duration-150"
|
|
74
|
+
enter-from-class="translate-y-1 opacity-0"
|
|
75
|
+
leave-active-class="transition duration-100"
|
|
76
|
+
leave-to-class="-translate-y-1 opacity-0"
|
|
77
|
+
>
|
|
78
|
+
<span
|
|
79
|
+
v-if="addedLabel"
|
|
80
|
+
key="added"
|
|
81
|
+
class="flex min-w-0 items-baseline gap-2"
|
|
82
|
+
>
|
|
83
|
+
<UIcon
|
|
84
|
+
name="i-lucide-check"
|
|
85
|
+
class="size-4 shrink-0 self-center"
|
|
86
|
+
/>
|
|
87
|
+
<span class="truncate font-semibold">{{ addedLabel }}</span>
|
|
88
|
+
<span class="shrink-0 text-sm opacity-90">hinzugefügt</span>
|
|
89
|
+
</span>
|
|
90
|
+
<span v-else key="cart" class="flex min-w-0 items-baseline gap-2">
|
|
91
|
+
<span class="font-semibold">Warenkorb</span>
|
|
92
|
+
<span class="truncate text-sm opacity-90">
|
|
93
|
+
{{ itemsLabel }} · {{ getFormattedPrice(subtotal) }}
|
|
94
|
+
</span>
|
|
95
|
+
</span>
|
|
96
|
+
</Transition>
|
|
97
|
+
</span>
|
|
98
|
+
<UIcon name="i-lucide-chevron-up" class="size-5 shrink-0" />
|
|
99
|
+
</button>
|
|
100
|
+
</div>
|
|
101
|
+
</Transition>
|
|
102
|
+
</template>
|
|
@@ -13,19 +13,28 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
13
13
|
withDeleteButton: true,
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const { setQuantity, removeLineItem, isMutating } = useCartMutations();
|
|
17
17
|
const { getFormattedPrice } = useCommercePrice();
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// Optimistic local quantity: the input reflects the customer's clicks
|
|
20
|
+
// immediately while the (queued, coalesced) request is in flight, and is
|
|
21
|
+
// re-synced from the cart once no mutation is running.
|
|
22
|
+
const localQuantity = ref(props.cartItem?.quantity ?? 1);
|
|
23
|
+
watch(
|
|
24
|
+
[() => props.cartItem?.quantity, isMutating],
|
|
25
|
+
([cartQuantity, mutating]) => {
|
|
26
|
+
if (!mutating && cartQuantity !== undefined) {
|
|
27
|
+
localQuantity.value = cartQuantity;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
20
32
|
const quantity = computed({
|
|
21
|
-
get: () =>
|
|
22
|
-
set:
|
|
33
|
+
get: () => localQuantity.value,
|
|
34
|
+
set: (value: number) => {
|
|
23
35
|
if (!props.cartItem?.id) return;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
id: props.cartItem.id,
|
|
27
|
-
quantity: value,
|
|
28
|
-
});
|
|
36
|
+
localQuantity.value = value;
|
|
37
|
+
setQuantity(props.cartItem.id, value);
|
|
29
38
|
},
|
|
30
39
|
});
|
|
31
40
|
|
|
@@ -37,7 +46,7 @@ const formattedPrice = computed(() => {
|
|
|
37
46
|
|
|
38
47
|
const handleRemoveItem = () => {
|
|
39
48
|
if (!props.cartItem) return;
|
|
40
|
-
|
|
49
|
+
removeLineItem(props.cartItem);
|
|
41
50
|
};
|
|
42
51
|
</script>
|
|
43
52
|
|
|
@@ -89,6 +98,7 @@ const handleRemoveItem = () => {
|
|
|
89
98
|
variant="soft"
|
|
90
99
|
color="neutral"
|
|
91
100
|
aria-label="Artikel entfernen"
|
|
101
|
+
:disabled="isMutating"
|
|
92
102
|
@click="handleRemoveItem"
|
|
93
103
|
/>
|
|
94
104
|
</div>
|
|
@@ -99,6 +109,7 @@ const handleRemoveItem = () => {
|
|
|
99
109
|
variant="outline"
|
|
100
110
|
color="error"
|
|
101
111
|
aria-label="Artikel entfernen"
|
|
112
|
+
:disabled="isMutating"
|
|
102
113
|
@click="handleRemoveItem"
|
|
103
114
|
/>
|
|
104
115
|
</div>
|
|
@@ -6,11 +6,13 @@ withDefaults(
|
|
|
6
6
|
withQuantityInput?: boolean;
|
|
7
7
|
withDeleteButton?: boolean;
|
|
8
8
|
withToCartButton?: boolean;
|
|
9
|
+
withUpsell?: boolean;
|
|
9
10
|
}>(),
|
|
10
11
|
{
|
|
11
12
|
withQuantityInput: true,
|
|
12
13
|
withDeleteButton: true,
|
|
13
14
|
withToCartButton: false,
|
|
15
|
+
withUpsell: false,
|
|
14
16
|
},
|
|
15
17
|
);
|
|
16
18
|
|
|
@@ -30,6 +32,8 @@ const emit = defineEmits(["go-to-cart"]);
|
|
|
30
32
|
/>
|
|
31
33
|
</div>
|
|
32
34
|
<div class="flex flex-col gap-4">
|
|
35
|
+
<!-- Suggestions right above the total, on the confirmation step only (#338). -->
|
|
36
|
+
<LazyCartUpsell v-if="withUpsell && !isEmpty" />
|
|
33
37
|
<div class="flex flex-row justify-between">
|
|
34
38
|
<template v-if="shippingTotal === 0">
|
|
35
39
|
<div class="text-success font-medium">
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Schemas } from "#shopware";
|
|
3
|
+
|
|
4
|
+
// One-click suggestions on the order confirmation step (#338): flagged
|
|
5
|
+
// products that are not in the cart yet. Renders nothing once every
|
|
6
|
+
// suggestion is in the cart.
|
|
7
|
+
const { loadUpsellProducts, addUpsellProduct, isAdding } = useCartUpsell();
|
|
8
|
+
const { cartItems } = useCart();
|
|
9
|
+
const { getFormattedPrice } = useCommercePrice();
|
|
10
|
+
|
|
11
|
+
// Browser only: the server renders without the cart, so filtering there would
|
|
12
|
+
// not match the hydrated page. The row follows once the request returns.
|
|
13
|
+
const { data: upsellProducts } = useAsyncData(
|
|
14
|
+
"cart-upsell",
|
|
15
|
+
loadUpsellProducts,
|
|
16
|
+
{ server: false },
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const products = computed(() =>
|
|
20
|
+
(upsellProducts.value ?? []).filter(
|
|
21
|
+
(product) =>
|
|
22
|
+
!cartItems.value.some((item) => lineItemHoldsProduct(item, product.id)),
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const productName = (product: Schemas["Product"]) =>
|
|
27
|
+
product.translated?.name ?? product.name;
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<!-- Tinted box with offer cards, so the suggestions do not read as line items. -->
|
|
32
|
+
<section
|
|
33
|
+
v-if="products.length > 0"
|
|
34
|
+
aria-labelledby="cart-upsell-title"
|
|
35
|
+
class="flex flex-col gap-3 rounded-lg bg-primary/5 p-3 ring ring-primary/20"
|
|
36
|
+
>
|
|
37
|
+
<div>
|
|
38
|
+
<h3
|
|
39
|
+
id="cart-upsell-title"
|
|
40
|
+
class="flex items-center gap-1.5 font-bold text-highlighted"
|
|
41
|
+
>
|
|
42
|
+
<UIcon name="i-lucide-sparkles" class="size-4 text-primary" />
|
|
43
|
+
Dazu passt
|
|
44
|
+
</h3>
|
|
45
|
+
<p class="text-sm text-muted">
|
|
46
|
+
Mit einem Klick zur Bestellung hinzufügen.
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
<!-- One suggestion spans the full width; with more the next one peeks in. -->
|
|
50
|
+
<ul
|
|
51
|
+
class="flex snap-x snap-mandatory gap-3 overflow-x-auto [scrollbar-width:thin]"
|
|
52
|
+
>
|
|
53
|
+
<li
|
|
54
|
+
v-for="product in products"
|
|
55
|
+
:key="product.id"
|
|
56
|
+
class="flex shrink-0 snap-start overflow-hidden rounded-lg bg-default shadow-sm ring ring-default"
|
|
57
|
+
:class="products.length > 1 ? 'w-[85%]' : 'w-full'"
|
|
58
|
+
>
|
|
59
|
+
<!-- Decorative: the name is right next to it. -->
|
|
60
|
+
<img
|
|
61
|
+
v-if="product.cover?.media?.url"
|
|
62
|
+
:src="product.cover.media.url"
|
|
63
|
+
:srcset="mediaSrcSet(product.cover.media)"
|
|
64
|
+
sizes="(min-width: 40rem) 144px, 112px"
|
|
65
|
+
alt=""
|
|
66
|
+
loading="lazy"
|
|
67
|
+
decoding="async"
|
|
68
|
+
class="size-28 shrink-0 object-cover sm:size-36"
|
|
69
|
+
/>
|
|
70
|
+
<div
|
|
71
|
+
v-else
|
|
72
|
+
class="flex size-28 shrink-0 items-center justify-center bg-gradient-to-b from-brand-100 to-brand-200 text-brand-600 sm:size-36"
|
|
73
|
+
aria-hidden="true"
|
|
74
|
+
>
|
|
75
|
+
<UIcon name="i-lucide-utensils-crossed" class="size-8" />
|
|
76
|
+
</div>
|
|
77
|
+
<div class="flex min-w-0 flex-1 flex-col gap-0.5 p-3">
|
|
78
|
+
<span class="text-xs font-semibold text-primary">
|
|
79
|
+
#{{ product.productNumber }}
|
|
80
|
+
</span>
|
|
81
|
+
<span
|
|
82
|
+
class="line-clamp-2 text-sm font-semibold text-highlighted sm:text-base"
|
|
83
|
+
>
|
|
84
|
+
{{ productName(product) }}
|
|
85
|
+
</span>
|
|
86
|
+
<div class="mt-auto flex items-center justify-between gap-2 pt-1">
|
|
87
|
+
<span class="font-bold text-highlighted">
|
|
88
|
+
{{ getFormattedPrice(product.calculatedPrice.totalPrice) }}
|
|
89
|
+
</span>
|
|
90
|
+
<UButton
|
|
91
|
+
icon="i-lucide-plus"
|
|
92
|
+
variant="subtle"
|
|
93
|
+
class="shrink-0"
|
|
94
|
+
:aria-label="`${productName(product)} in den Warenkorb`"
|
|
95
|
+
:loading="isAdding(product.id)"
|
|
96
|
+
:disabled="!productIsAvailable(product) || isAdding(product.id)"
|
|
97
|
+
@click="addUpsellProduct(product)"
|
|
98
|
+
>
|
|
99
|
+
<span class="hidden sm:inline">Hinzufügen</span>
|
|
100
|
+
</UButton>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</li>
|
|
104
|
+
</ul>
|
|
105
|
+
</section>
|
|
106
|
+
</template>
|