@shopbite-de/storefront 1.24.0 → 1.26.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 +3 -0
- package/CLAUDE.md +10 -3
- package/README.md +0 -1
- package/app/app.config.ts +3 -2
- package/app/app.vue +4 -1
- package/app/assets/css/main.css +16 -0
- package/app/components/AddToWishlist.vue +13 -6
- package/app/components/Cart/Bar.vue +102 -0
- package/app/components/Cart/QuickView.vue +4 -0
- package/app/components/Cart/Upsell.vue +106 -0
- package/app/components/Category/Listing.vue +11 -3
- package/app/components/Checkout/DeliveryTimeSelect.vue +28 -2
- package/app/components/Checkout/Summary.vue +25 -3
- 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/Footer/Contact.vue +5 -1
- package/app/components/Header/Right.vue +44 -15
- package/app/components/Hero.vue +126 -36
- package/app/components/Product/Card.vue +102 -50
- 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/composables/useAddToCart.ts +3 -30
- package/app/composables/useBusinessHours.ts +10 -3
- package/app/composables/useCartQuickView.ts +19 -0
- package/app/composables/useCartUpsell.ts +100 -0
- package/app/composables/useCategorySeo.ts +5 -4
- package/app/composables/useHolidays.ts +7 -3
- package/app/composables/useOpeningHoursData.ts +53 -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/useTopSellers.ts +22 -0
- package/app/composables/useTrackEvent.ts +7 -0
- package/app/pages/bestellung/bestaetigen.vue +0 -3
- package/app/pages/bestellung/warenkorb.vue +0 -3
- package/app/pages/bestellung/zahlung-versand.vue +0 -3
- package/app/pages/bestellung.vue +22 -14
- package/app/pages/index.vue +3 -1
- package/app/pages/suche.vue +18 -5
- package/app/types/Association.d.ts +1 -0
- package/app/utils/openingHours.ts +31 -8
- package/app/utils/product.ts +31 -0
- package/app/utils/retry.ts +17 -0
- package/content/index.yml +16 -11
- package/content.config.ts +13 -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/docs/notes/2026-09-16-issue-339-checkout-hydration.md +49 -0
- package/docs/notes/2026-09-16-issue-349-order-button-loading.md +39 -0
- package/docs/notes/2026-09-16-issue-350-remove-pinia.md +41 -0
- package/docs/notes/2026-09-16-issue-355-opening-hours-error.md +57 -0
- package/nuxt.config.ts +25 -2
- package/package.json +2 -3
- 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/listing/[categoryId].get.ts +2 -0
- package/server/api/search.get.ts +2 -0
- package/test/e2e/simple-checkout-as-recurring-customer.test.ts +13 -17
- package/test/nuxt/CartBar.test.ts +110 -0
- package/test/nuxt/CartUpsell.test.ts +125 -0
- package/test/nuxt/CheckoutSummary.test.ts +127 -0
- package/test/nuxt/DemoBanner.test.ts +12 -0
- package/test/nuxt/useAddToCart.test.ts +6 -19
- package/test/nuxt/useCartUpsell.test.ts +126 -0
- package/test/nuxt/useOpeningHoursData.test.ts +120 -0
- package/test/nuxt/useTrackEvent.test.ts +15 -0
- package/test/unit/openingHours.spec.ts +32 -1
- package/test/unit/product.spec.ts +72 -0
- package/test/unit/retry.spec.ts +58 -0
- package/test/unit/useCategorySeo.spec.ts +2 -1
- 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 -61
- package/app/composables/useCheckoutStore.ts +0 -1
- package/app/stores/checkout.ts +0 -22
package/.env.example
CHANGED
|
@@ -9,6 +9,9 @@ NUXT_PUBLIC_SHOPWARE_COUNTRY_ID=019a17a0f67b706a8ec9ead3059e12ba
|
|
|
9
9
|
|
|
10
10
|
NUXT_PUBLIC_SHOP_BITE_FEATURE_MULTI_CHANNEL=false
|
|
11
11
|
NUXT_PUBLIC_SHOP_BITE_FEATURE_SECURE_KEY=
|
|
12
|
+
NUXT_PUBLIC_SHOP_BITE_FEATURE_CONTACT_FORM=false
|
|
13
|
+
# Demo shops: notice above the header that orders are not fulfilled
|
|
14
|
+
NUXT_PUBLIC_SHOP_BITE_FEATURE_DEMO_BANNER=false
|
|
12
15
|
# Optional Geoapify bounding box lon1,lat1,lon2,lat2 for the address
|
|
13
16
|
# suggestions in the checkout (empty = no filter)
|
|
14
17
|
NUXT_PUBLIC_SHOP_BITE_ADDRESS_AUTOCOMPLETE_BOUNDING_BOX=
|
package/CLAUDE.md
CHANGED
|
@@ -94,8 +94,8 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
94
94
|
|
|
95
95
|
- **Navigation:** menu sections are the children of the sales channel navigation root (`readNavigation main-navigation`), optionally scoped by `runtimeConfig.public.shopBite.menuCategoryId`. Category icon comes from the custom field `shopbite_category_icon` (icones.js.org name such as `i-lucide-pizza`), set by the ShopBite plugin.
|
|
96
96
|
- **Property groups:** `Hauptzutaten` (ingredients on the card, deselectable on the detail page, removed ones are appended to the cart label with "-"), `Vegetarisch` and `Vegan` with the option `Ja` (diet badges), `Küche` (kitchen badge). Filterable groups appear as listing filters.
|
|
97
|
-
- **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. Selected extras are sent as children of a `container` line item (`useAddToCart.ts`, handled by the ShopBite plugin).
|
|
98
|
-
- **Custom fields on products:** `shopbite_receipt_print_type` (`number` prints the menu number on the receipt, `label` prints the name) and `shopbite_delivery_time_factor` (int),
|
|
97
|
+
- **Extras:** product cross-sellings of type `productList`; the cross-selling name is the label ("Extras", "Beilagen"), the assigned products need a price and sales-channel visibility but no category. Selected extras are sent as children of a `container` line item (`useAddToCart.ts`, handled by the ShopBite plugin). The product card has no buttons: the card opens the quick view drawer (`Product/QuickView.vue`), whose state is the `produkt` query parameter (product number) via `useProductQuickView` (#325).
|
|
98
|
+
- **Custom fields on products:** `shopbite_receipt_print_type` (`number` prints the menu number on the receipt, `label` prints the name) and `shopbite_delivery_time_factor` (int) and `shopbite_cart_upsell` (bool, suggests the product on the order confirmation step `/bestellung/bestaetigen` via `useCartUpsell`; variant parents are never suggested, a flag on a parent applies to its variants), all from the ShopBite plugin.
|
|
99
99
|
- **Variants:** standard configurator settings (`Product/Configurator.vue`); `server/api/product/variant.get.ts` resolves a variant by option ids.
|
|
100
100
|
|
|
101
101
|
### Server routes
|
|
@@ -113,13 +113,20 @@ The storefront reads plain Shopware entities with fixed names; seed data must ma
|
|
|
113
113
|
- Long lists render on the server and hydrate on scroll: `hydrateWhenVisible(Component)` (`app/utils`) keeps the markup and the chunk, `AnimatedSection` still animates. Used for product cards and the footer.
|
|
114
114
|
- `NuxtLink` prefetches on interaction only (`experimental.defaults.nuxtLink`), and Rolldown groups shared framework/UI modules into two chunks (`vite.build.rollupOptions.output.codeSplitting`). Measure with Lighthouse behind the h2 proxy (see `docs/notes/2026-09-10-issue-314-mobile-js-cost.md`) before changing either.
|
|
115
115
|
|
|
116
|
+
### Stylesheet (#319)
|
|
117
|
+
|
|
118
|
+
- Nuxt UI runs with `ui.experimental.componentDetection`, so only the theme files of the `<U…>` components found in the layers become Tailwind sources; a component rendered dynamically by name must be listed in the option's array form or its theme is empty.
|
|
119
|
+
- Every family in the `--font-sans` stack costs a system font lookup per text style during the first layout. `fonts.defaults.fallbacks["sans-serif"]` is therefore limited to the phone system fonts (Roboto, Helvetica Neue); do not add desktop families back without measuring Style & Layout (`docs/notes/2026-09-12-issue-319-stylesheet-cost.md`).
|
|
120
|
+
- `ui.colors.primary` in `app.config.ts` must be a colour alias defined in `main.css` (`brand`), not a hex value.
|
|
121
|
+
|
|
116
122
|
### SEO
|
|
117
123
|
|
|
124
|
+
- This repository, deployed as the app, is the demo shop (demo.shopbite.de) and must not be crawled: its Dokploy deployment sets `NUXT_SITE_INDEXABLE=false`. Never set `site.indexable` in `nuxt.config.ts`: shops extending the layer would inherit it and drop out of search engines.
|
|
118
125
|
- `server/plugins/site-url.ts` makes `storeUrl` the nuxt-site-config URL, so canonical, sitemap and robots.txt share one base. Build absolute URLs with `toAbsoluteUrl(useSiteConfig().url, path)` (`app/utils/seo.ts`).
|
|
119
126
|
- `app.vue` sets the title template (`site.titleTemplate`), canonical from the route, `og:url`, fallback `og:image` (`site.ogImage`) and `twitter:card`. Page titles are plain (`"Warenkorb"`), never suffixed with the shop name. Indexable pages use `usePageSeo` (`standalone: true` skips the template, home page); categories use `useCategorySeo`, which overrides the canonical with the SEO URL.
|
|
120
127
|
- Shopware category SEO URLs end in `/` and 404 without it, but the sitemap module strips trailing slashes from every URL. Sitemap entries that need the slash carry `_trailingSlash: true`; `server/plugins/sitemap-trailing-slash.ts` restores it in the XML. Never normalise trailing slashes of backend SEO URLs.
|
|
121
128
|
- `@nuxtjs/sitemap` must stay before `@nuxt/content` in `modules`; content collections need the `sitemap` schema field to appear in the sitemap.
|
|
122
|
-
- Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`) and is rendered by `components/Footer/Contact.vue`. `useBusinessHours`/`useHolidays` use `immediate: false` (app.vue loads them on mount); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`.
|
|
129
|
+
- Shop contact data (NAP) lives in `runtimeConfig.public.site` (`address.*`, `telephone`, `googleBusinessProfileUrl`) and is rendered by `components/Footer/Contact.vue`. `useBusinessHours`/`useHolidays` use `immediate: false` (app.vue loads them on mount); a component that needs them in the SSR HTML calls `onServerPrefetch(() => refresh())`. In the browser both requests are retried twice (`withRetries`); `useOpeningHoursData` gives components the combined loading/failed state and `retry()`, and reports a failure only after mounting (a failed server prefetch would otherwise break hydration, #355).
|
|
123
130
|
|
|
124
131
|
### Testing setup
|
|
125
132
|
|
package/README.md
CHANGED
|
@@ -128,7 +128,6 @@ app/
|
|
|
128
128
|
├── components/ Cart, Checkout, Product, Food, Navigation, Header, …
|
|
129
129
|
├── composables/ Business logic — useBusinessHours, useDeliveryTime, useAddToCart, …
|
|
130
130
|
├── pages/ German routes: /speisekarte, /warenkorb, /konto, /bestellung
|
|
131
|
-
├── stores/ Pinia (checkout state)
|
|
132
131
|
├── validation/ Zod schemas for forms
|
|
133
132
|
└── assets/css/ Tailwind v4 theme tokens
|
|
134
133
|
server/api/ Cached Store API proxies + the Geoapify key guard
|
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
|
@@ -57,7 +57,7 @@ onMounted(async () => {
|
|
|
57
57
|
|
|
58
58
|
const route = useRoute();
|
|
59
59
|
const siteConfig = useSiteConfig();
|
|
60
|
-
const { site } = useRuntimeConfig().public;
|
|
60
|
+
const { site, shopBite } = useRuntimeConfig().public;
|
|
61
61
|
|
|
62
62
|
// Pages with a backend SEO URL (categories) override the canonical link.
|
|
63
63
|
const canonicalUrl = computed(() => toAbsoluteUrl(siteConfig.url, route.path));
|
|
@@ -101,6 +101,8 @@ useSeoMeta({
|
|
|
101
101
|
<NuxtLoadingIndicator />
|
|
102
102
|
|
|
103
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" />
|
|
104
106
|
<Header />
|
|
105
107
|
<UMain>
|
|
106
108
|
<NuxtLayout>
|
|
@@ -108,5 +110,6 @@ useSeoMeta({
|
|
|
108
110
|
</NuxtLayout>
|
|
109
111
|
</UMain>
|
|
110
112
|
<FooterWhenVisible />
|
|
113
|
+
<CartBar />
|
|
111
114
|
</UApp>
|
|
112
115
|
</template>
|
package/app/assets/css/main.css
CHANGED
|
@@ -22,6 +22,22 @@
|
|
|
22
22
|
|
|
23
23
|
/* This is important because apple devices will zoom in when the font size is below 16px */
|
|
24
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
|
+
}
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
/*
|
|
@@ -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>
|
|
@@ -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>
|
|
@@ -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>
|
|
@@ -41,6 +41,8 @@ async function resetFilters() {
|
|
|
41
41
|
useCategorySeo(category);
|
|
42
42
|
useMenuSectionSchema(category, elements);
|
|
43
43
|
|
|
44
|
+
const quickView = useProductQuickView(elements);
|
|
45
|
+
|
|
44
46
|
// Derived from the listing data instead of snapshotted at setup time, which
|
|
45
47
|
// would be a hydration mismatch (#239); see useSortingSelection.
|
|
46
48
|
const { currentSorting } = useSortingSelection(currentSortingOrder);
|
|
@@ -195,7 +197,7 @@ async function openFilterDrawer() {
|
|
|
195
197
|
|
|
196
198
|
<div
|
|
197
199
|
v-if="showSkeleton"
|
|
198
|
-
class="
|
|
200
|
+
class="grid grid-cols-1 gap-4"
|
|
199
201
|
aria-busy="true"
|
|
200
202
|
aria-label="Produkte werden geladen"
|
|
201
203
|
>
|
|
@@ -204,7 +206,7 @@ async function openFilterDrawer() {
|
|
|
204
206
|
|
|
205
207
|
<div
|
|
206
208
|
v-else
|
|
207
|
-
class="
|
|
209
|
+
class="grid grid-cols-1 gap-4 transition-opacity duration-200"
|
|
208
210
|
:class="{ 'opacity-40 pointer-events-none': loading }"
|
|
209
211
|
>
|
|
210
212
|
<ProductCardWhenVisible
|
|
@@ -212,9 +214,15 @@ async function openFilterDrawer() {
|
|
|
212
214
|
:key="product.id"
|
|
213
215
|
:product="product"
|
|
214
216
|
:with-favorite-button="true"
|
|
215
|
-
:
|
|
217
|
+
:selectable="true"
|
|
218
|
+
@select="quickView.show"
|
|
216
219
|
/>
|
|
217
220
|
</div>
|
|
221
|
+
<LazyProductQuickView
|
|
222
|
+
v-if="quickView.mounted.value"
|
|
223
|
+
v-model:open="quickView.open.value"
|
|
224
|
+
:product="quickView.product.value"
|
|
225
|
+
/>
|
|
218
226
|
</div>
|
|
219
227
|
</UPageBody>
|
|
220
228
|
|
|
@@ -45,6 +45,11 @@ const {
|
|
|
45
45
|
} = useDeliveryTime(now);
|
|
46
46
|
|
|
47
47
|
const { isClosedHoliday } = useHolidays();
|
|
48
|
+
const {
|
|
49
|
+
isLoaded: isOpeningHoursLoaded,
|
|
50
|
+
hasFailed: hasOpeningHoursFailed,
|
|
51
|
+
retry: retryOpeningHours,
|
|
52
|
+
} = useOpeningHoursData();
|
|
48
53
|
|
|
49
54
|
const validationError = computed<string | null>(() =>
|
|
50
55
|
selected.value ? validate(selected.value) : null,
|
|
@@ -134,7 +139,28 @@ function handleTimeInput(event: Event): void {
|
|
|
134
139
|
</script>
|
|
135
140
|
|
|
136
141
|
<template>
|
|
137
|
-
<div v-if="
|
|
142
|
+
<div v-if="hasOpeningHoursFailed" class="mt-4">
|
|
143
|
+
<UAlert
|
|
144
|
+
color="error"
|
|
145
|
+
variant="subtle"
|
|
146
|
+
icon="i-lucide-circle-alert"
|
|
147
|
+
title="Öffnungszeiten konnten nicht geladen werden"
|
|
148
|
+
description="Ohne Öffnungszeiten können wir keine Lieferzeit anbieten."
|
|
149
|
+
:actions="[
|
|
150
|
+
{
|
|
151
|
+
label: 'Erneut versuchen',
|
|
152
|
+
icon: 'i-lucide-refresh-cw',
|
|
153
|
+
color: 'error',
|
|
154
|
+
variant: 'outline',
|
|
155
|
+
onClick: retryOpeningHours,
|
|
156
|
+
},
|
|
157
|
+
]"
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
<div
|
|
161
|
+
v-else-if="isOpeningHoursLoaded && isClosedHoliday(now) === false"
|
|
162
|
+
class="flex flex-col gap-2 mt-4"
|
|
163
|
+
>
|
|
138
164
|
<div class="flex flex-row items-center justify-between gap-4">
|
|
139
165
|
<label for="delivery-time" class="flex-1">
|
|
140
166
|
Wunschlieferung- oder Abholzeit ab:
|
|
@@ -171,7 +197,7 @@ function handleTimeInput(event: Event): void {
|
|
|
171
197
|
variant="subtle"
|
|
172
198
|
/>
|
|
173
199
|
</div>
|
|
174
|
-
<div v-else-if="isClosedHoliday(now) === true">
|
|
200
|
+
<div v-else-if="isOpeningHoursLoaded && isClosedHoliday(now) === true">
|
|
175
201
|
<UBadge
|
|
176
202
|
variant="subtle"
|
|
177
203
|
class="w-full"
|
|
@@ -9,6 +9,8 @@ const { refreshCart } = useCart();
|
|
|
9
9
|
const { isLoggedIn, isGuestSession, refreshUser } = useUser();
|
|
10
10
|
const { isCheckoutEnabled, refresh } = useShopBiteConfig();
|
|
11
11
|
const { trackOrder } = useTrackEvent();
|
|
12
|
+
const { isLoading: isLoadingOpeningHours, hasFailed: hasOpeningHoursFailed } =
|
|
13
|
+
useOpeningHoursData();
|
|
12
14
|
const {
|
|
13
15
|
isShippingMethodBlocked,
|
|
14
16
|
isPaymentMethodBlocked,
|
|
@@ -146,13 +148,27 @@ const blockedMethodIcon = computed(() =>
|
|
|
146
148
|
|
|
147
149
|
const isPlacingOrder = ref(false);
|
|
148
150
|
const selectedDeliveryTime = ref("");
|
|
149
|
-
|
|
151
|
+
// DeliveryTimeSelect reports `false` during its setup (no time selected before
|
|
152
|
+
// the business hours load in the browser). Starting with `true` rendered the
|
|
153
|
+
// order button differently on the server and at hydration (#339).
|
|
154
|
+
const isValidTime = ref(false);
|
|
150
155
|
|
|
151
156
|
const checkoutButtonLabel = computed<string>(() => {
|
|
152
157
|
if (!customerDataAvailable.value) {
|
|
153
158
|
return "Bitte einloggen oder Kundendaten erfassen";
|
|
154
159
|
}
|
|
155
160
|
|
|
161
|
+
// app.vue loads business hours and holidays after mounting. Until then (or
|
|
162
|
+
// when that fails) an invalid time says nothing about the shop being closed
|
|
163
|
+
// (#349, #355).
|
|
164
|
+
if (isLoadingOpeningHours.value) {
|
|
165
|
+
return "Lade Öffnungszeiten …";
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (hasOpeningHoursFailed.value) {
|
|
169
|
+
return "Öffnungszeiten konnten nicht geladen werden";
|
|
170
|
+
}
|
|
171
|
+
|
|
156
172
|
if (!isValidTime.value) {
|
|
157
173
|
return "Wir haben aktuell leider geschlossen";
|
|
158
174
|
}
|
|
@@ -192,13 +208,19 @@ const checkoutButtonLabel = computed<string>(() => {
|
|
|
192
208
|
<div class="flex flex-col gap-4">
|
|
193
209
|
<h3 class="text-lg font-semibold">Warenkorb</h3>
|
|
194
210
|
<UCard>
|
|
195
|
-
<QuickView
|
|
211
|
+
<QuickView
|
|
212
|
+
:with-quantity-input="false"
|
|
213
|
+
:with-delete-button="false"
|
|
214
|
+
:with-upsell="true"
|
|
215
|
+
/>
|
|
196
216
|
</UCard>
|
|
197
217
|
<CheckoutVoucherInput />
|
|
198
218
|
<UButton
|
|
199
219
|
:icon="isValidToProceed ? 'i-lucide-shopping-cart' : 'i-lucide-lock'"
|
|
200
220
|
:disabled="!isValidToProceed || isPlacingOrder"
|
|
201
|
-
:loading="
|
|
221
|
+
:loading="
|
|
222
|
+
isPlacingOrder || (customerDataAvailable && isLoadingOpeningHours)
|
|
223
|
+
"
|
|
202
224
|
:label="checkoutButtonLabel"
|
|
203
225
|
size="xl"
|
|
204
226
|
block
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// Notice for demo shops (demos/): rendered above the header when
|
|
3
|
+
// `shopBite.feature.demoBanner` is set. Not dismissible on purpose, so a
|
|
4
|
+
// prospect never mistakes the demo for a live shop.
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<UBanner
|
|
9
|
+
color="warning"
|
|
10
|
+
icon="i-lucide-flask-conical"
|
|
11
|
+
title="Demo-Shop: Bestellungen werden nicht bearbeitet und nicht ausgeliefert."
|
|
12
|
+
/>
|
|
13
|
+
</template>
|