@shopbite-de/storefront 1.23.2 → 1.24.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 +19 -0
- package/.github/workflows/build.yaml +1 -1
- package/.github/workflows/ci.yaml +6 -3
- package/.nuxtrc +1 -1
- package/CLAUDE.md +41 -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.vue +37 -53
- package/app/assets/css/main.css +20 -4
- 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/Item.vue +21 -10
- package/app/components/Category/Breadcrumb.vue +11 -12
- package/app/components/Category/Header.vue +9 -3
- package/app/components/Category/Listing.vue +51 -42
- package/app/components/Checkout/PaymentAndDelivery.vue +19 -3
- package/app/components/Checkout/Summary.vue +65 -1
- package/app/components/Cta.vue +4 -2
- package/app/components/Food/MarqueeItem.vue +20 -8
- package/app/components/Footer/Contact.vue +78 -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 +27 -13
- package/app/components/Header/Title.vue +1 -0
- package/app/components/Header.vue +5 -15
- package/app/components/Hero.vue +45 -2
- package/app/components/ImageGallery.vue +11 -5
- package/app/components/Product/Card.vue +9 -3
- package/app/components/Product/CardFooter.vue +22 -12
- package/app/components/User/RegistrationForm.vue +0 -1
- package/app/components/Wishlist.vue +2 -15
- package/app/composables/useAddToCart.ts +13 -13
- 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/{useCategory.ts → useCategoryById.ts} +1 -1
- package/app/composables/useCategorySeo.ts +22 -25
- 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/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/useTrackEvent.ts +29 -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 +10 -4
- 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 +25 -13
- 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 +24 -21
- package/app/plugins/matomo.ts +35 -0
- package/app/utils/hydrateWhenVisible.ts +20 -0
- package/app/utils/media.ts +33 -0
- package/app/utils/openingHours.ts +67 -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 +10 -9
- package/content.config.ts +3 -0
- package/docs/notes/2026-07-05-issue-259-matomo-broken.md +14 -0
- package/docs/notes/2026-09-07-dependency-update.md +113 -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/node.dockerfile +5 -2
- package/nuxt.config.ts +74 -15
- package/package.json +45 -42
- 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/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 +12 -18
- package/server/api/product/[productId]/cross-selling.get.ts +3 -9
- package/server/api/product/[productId].get.ts +4 -8
- 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/nuxt/AddressFields.test.ts +2 -73
- package/test/nuxt/AnimatedSection.test.ts +67 -0
- package/test/nuxt/CartItem.test.ts +95 -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 +20 -6
- package/test/nuxt/useAddToCart.test.ts +34 -1
- 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/useCategoryListing.test.ts +5 -3
- package/test/nuxt/useCheckoutMethodGuard.test.ts +386 -0
- package/test/nuxt/useProductConfigurator.test.ts +4 -1
- 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 +112 -0
- package/test/unit/media.spec.ts +49 -0
- package/test/unit/openingHours.spec.ts +59 -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 +40 -30
- package/test/unit/useSortingSelection.spec.ts +39 -0
- package/tsconfig.json +1 -1
- package/app/composables/useValidCitiesForDelivery.ts +0 -12
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 } = 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>
|
|
@@ -123,6 +107,6 @@ useHead({
|
|
|
123
107
|
<NuxtPage />
|
|
124
108
|
</NuxtLayout>
|
|
125
109
|
</UMain>
|
|
126
|
-
<
|
|
110
|
+
<FooterWhenVisible />
|
|
127
111
|
</UApp>
|
|
128
112
|
</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;
|
|
@@ -22,8 +24,18 @@
|
|
|
22
24
|
--text-sm: 16px;
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/*
|
|
28
|
+
* Primary and success colours per colour mode, the Nuxt UI convention: a
|
|
29
|
+
* dark step on light backgrounds, the 400 step on dark ones. Text in these
|
|
30
|
+
* colours and text on solid buttons need a contrast of at least 4.5:1
|
|
31
|
+
* (WCAG AA), which the 500 step of most scales misses (#275). Subtle
|
|
32
|
+
* buttons and badges put the colour on a 10 % tint of itself, so aim for
|
|
33
|
+
* 5:1 on white. A brand scale must keep 600 >= 5:1 on white and
|
|
34
|
+
* 400 >= 4.5:1 on #171717.
|
|
35
|
+
*/
|
|
25
36
|
:root {
|
|
26
|
-
--ui-primary: var(--color-brand-
|
|
37
|
+
--ui-primary: var(--color-brand-600);
|
|
38
|
+
--ui-success: var(--color-green-800);
|
|
27
39
|
|
|
28
40
|
--ui-bg: #fff;
|
|
29
41
|
--ui-bg-muted: #f5f5f5;
|
|
@@ -36,12 +48,16 @@
|
|
|
36
48
|
|
|
37
49
|
--ui-text-accented: #171717;
|
|
38
50
|
--ui-text-default: #404040;
|
|
39
|
-
--ui-
|
|
51
|
+
/* 4.9:1 on --ui-bg-elevated (#737373 was 4.38, #275) */
|
|
52
|
+
--ui-text-muted: #6b6b6b;
|
|
40
53
|
--ui-text-dimmed: #a3a3a3;
|
|
41
54
|
--ui-text-inverted: #fff;
|
|
42
55
|
}
|
|
43
56
|
|
|
44
57
|
:root.dark {
|
|
58
|
+
--ui-primary: var(--color-brand-400);
|
|
59
|
+
--ui-success: var(--color-green-400);
|
|
60
|
+
|
|
45
61
|
--ui-bg: #171717;
|
|
46
62
|
--ui-bg-muted: #1f1f1f;
|
|
47
63
|
--ui-bg-elevated: #2a2a2a;
|
|
@@ -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" />
|
|
@@ -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>
|
|
@@ -12,18 +12,17 @@ const { apiClient } = useShopwareContext();
|
|
|
12
12
|
|
|
13
13
|
const breadcrumbJsonLd = ref<object | null>(null);
|
|
14
14
|
|
|
15
|
-
useHead(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
});
|
|
15
|
+
useHead(() => ({
|
|
16
|
+
script: breadcrumbJsonLd.value
|
|
17
|
+
? [
|
|
18
|
+
{
|
|
19
|
+
key: "jsonld-breadcrumb",
|
|
20
|
+
type: "application/ld+json",
|
|
21
|
+
innerHTML: JSON.stringify(breadcrumbJsonLd.value),
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
: [],
|
|
25
|
+
}));
|
|
27
26
|
|
|
28
27
|
const cacheKey = computed(() => `breadcrumb-${categoryId.value}`);
|
|
29
28
|
|
|
@@ -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,11 @@ async function resetFilters() {
|
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
useCategorySeo(category);
|
|
42
|
+
useMenuSectionSchema(category, elements);
|
|
37
43
|
|
|
38
|
-
// Derived from the listing data instead of snapshotted at setup time
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
// the actual sorting label — a hydration mismatch (#239).
|
|
42
|
-
// The placeholder is never stored as an override, so the select keeps
|
|
43
|
-
// following the listing data until the user explicitly picks a sorting.
|
|
44
|
-
const SORTING_PLACEHOLDER = "Sortieren";
|
|
45
|
-
const sortingOverride = ref<string | null>(null);
|
|
46
|
-
const currentSorting = computed<string>({
|
|
47
|
-
get: () =>
|
|
48
|
-
sortingOverride.value ?? currentSortingOrder.value ?? SORTING_PLACEHOLDER,
|
|
49
|
-
set: (val) => {
|
|
50
|
-
sortingOverride.value = val === SORTING_PLACEHOLDER ? null : val;
|
|
51
|
-
},
|
|
52
|
-
});
|
|
44
|
+
// Derived from the listing data instead of snapshotted at setup time, which
|
|
45
|
+
// would be a hydration mismatch (#239); see useSortingSelection.
|
|
46
|
+
const { currentSorting } = useSortingSelection(currentSortingOrder);
|
|
53
47
|
|
|
54
48
|
const propertyFilters = computed<Schemas["PropertyGroup"][]>(
|
|
55
49
|
() =>
|
|
@@ -116,6 +110,19 @@ watch(currentSorting, async (val) => {
|
|
|
116
110
|
const moreThanOneFilterAndOption = computed<boolean>(
|
|
117
111
|
() => propertyFilters.value.length > 0,
|
|
118
112
|
);
|
|
113
|
+
|
|
114
|
+
// The mobile filter drawer (vaul) is created on first use; mounting it with
|
|
115
|
+
// the page forced a layout of the whole listing (#314).
|
|
116
|
+
const filterDrawerMounted = ref(false);
|
|
117
|
+
const filterDrawerOpen = ref(false);
|
|
118
|
+
|
|
119
|
+
async function openFilterDrawer() {
|
|
120
|
+
if (!filterDrawerMounted.value) {
|
|
121
|
+
filterDrawerMounted.value = true;
|
|
122
|
+
await nextTick();
|
|
123
|
+
}
|
|
124
|
+
filterDrawerOpen.value = true;
|
|
125
|
+
}
|
|
119
126
|
</script>
|
|
120
127
|
|
|
121
128
|
<template>
|
|
@@ -141,26 +148,31 @@ const moreThanOneFilterAndOption = computed<boolean>(
|
|
|
141
148
|
:items="sortingOrders"
|
|
142
149
|
placeholder="Sortierung"
|
|
143
150
|
/>
|
|
144
|
-
<
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
<template v-if="moreThanOneFilterAndOption">
|
|
152
|
+
<UButton
|
|
153
|
+
class="lg:hidden"
|
|
154
|
+
icon="i-lucide-sliders-horizontal"
|
|
155
|
+
:color="selectedPropertyFilters.length ? 'primary' : 'neutral'"
|
|
156
|
+
:variant="selectedPropertyFilters.length ? 'solid' : 'subtle'"
|
|
157
|
+
aria-haspopup="dialog"
|
|
158
|
+
@click="openFilterDrawer"
|
|
159
|
+
>
|
|
160
|
+
Filter
|
|
161
|
+
<UBadge
|
|
162
|
+
v-if="selectedPropertyFilters.length"
|
|
163
|
+
:label="String(selectedPropertyFilters.length)"
|
|
164
|
+
size="sm"
|
|
165
|
+
color="neutral"
|
|
166
|
+
variant="solid"
|
|
167
|
+
class="ml-1"
|
|
168
|
+
/>
|
|
169
|
+
</UButton>
|
|
170
|
+
<LazyUDrawer
|
|
171
|
+
v-if="filterDrawerMounted"
|
|
172
|
+
v-model:open="filterDrawerOpen"
|
|
173
|
+
title="Filter"
|
|
174
|
+
direction="right"
|
|
175
|
+
>
|
|
164
176
|
<template #body>
|
|
165
177
|
<div class="flex flex-col gap-4">
|
|
166
178
|
<CategoryFilterGroup
|
|
@@ -177,11 +189,8 @@ const moreThanOneFilterAndOption = computed<boolean>(
|
|
|
177
189
|
/>
|
|
178
190
|
</div>
|
|
179
191
|
</template>
|
|
180
|
-
</
|
|
181
|
-
|
|
182
|
-
<USkeleton class="h-8 w-20 lg:hidden" />
|
|
183
|
-
</template>
|
|
184
|
-
</ClientOnly>
|
|
192
|
+
</LazyUDrawer>
|
|
193
|
+
</template>
|
|
185
194
|
</div>
|
|
186
195
|
|
|
187
196
|
<div
|
|
@@ -198,7 +207,7 @@ const moreThanOneFilterAndOption = computed<boolean>(
|
|
|
198
207
|
class="flex flex-col gap-4 transition-opacity duration-200"
|
|
199
208
|
:class="{ 'opacity-40 pointer-events-none': loading }"
|
|
200
209
|
>
|
|
201
|
-
<
|
|
210
|
+
<ProductCardWhenVisible
|
|
202
211
|
v-for="product in elements"
|
|
203
212
|
:key="product.id"
|
|
204
213
|
:product="product"
|
|
@@ -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({
|